unit peach;
{
 DESCRIPTION     :  Application providing GUI for calling PEA and third parts
                    open source executables, giving graphic tools for composing
                    appropriate command lines, such as file and folder selection,
                    import/export lists, choose parameters from graphic menus etc.
                    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          :  ---

 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

BACKEND
7z 23.01 (Windows, Linux, macOS)
Pea 1.13

CODE

FILE MANAGER
(macOS) Fixed conditional startup actions on input (open, extract, extract here...)
Added column to display file-level comment in archives (default hidden)
While browsing an archive, the information popup (clicking on status bar) shows if the archive type can be edited in PeaZip
Updated Themes
 Added contrast setting to Themes
 Theme packages now contains customizable, 32 bit PNG icons for archive file types
  Alternative themes with different icons for archive types are available selecting Custom in Theme dropdown menu
  New system icons packages are available to change system icons accordingly to themes, anyway icon files from theme packages can be used for system integration on Operating Systems accepting icons in PNG format

EXTRACTION and ARCHIVING
Added checkbox to manually set RAR binary for Custom / RAR compression format
 This setting will allow Windows users to locate WinRar Rar.exe executable more flexibly than automatic search, and non-Windows users to set up RAR compression using Wine or other alternatives
(Windows) Work path free space is reported in archiving and extraction screens info box, clicking on the status bar
(Windows) Free space on output path and work path (if applicable) is checked before starting archiving and extraction operation, and user is warned if free space may not be enough
Fixes
 Fixed crash if the app is forced to extract to a read only path
 Working directory for ARC compression is now changed accordingly to 7z/p7zip backend working directory
 Correct handling of .tar extension in extraction to new folder, if destination with same name exists

INSTALLERS

230 file extensions supported

Translations updated and replaced in the package

--------------------------------------------------------------------------------
Status of Unicode support (tested on 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 due to
PeaZip browser frontent limitations
2 - Partial extraction is not implemented in PeaZip extraction frontent 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).
--------------------------------------------------------------------------------
Performances

Due the use of TListView component browser rendering performances, in filesystem
and archives, are limited to few thousands of files - in the same directory or
search filter - to operate in real near time; 10s thousands of files are
rendered in a matter of seconds producing a noticeable delay.
A1) Auto-refresh delay, browsing the filesystem, is increased starting from 4K
items, and disabled at 16K items.
A2) Switching to flat mode listing raises warning message always in filesystem,
and starting from 64K items in archives (number of items is found during
pre-parsing, B1).

PeaZip pre-parse 7z/p7zip supported formats at opening in order to warn users in
advance of possible issues.
B1) check if full actual content of the archive can be listed (list -l option),
regardless of what is declared in TOC table (which may be corrpted or have been
maliciosly modified), which scales reasonably up to 1.5M files.
B2) scan for non explicitly listed dirs, which scales slowly and is maxed at
256K files.
B3) scan for number of files, folders, and uncompressed content size contained
in each folder, which scales slowly and is maxed at 32K files in archive.
B4) treeview representation of the structure of archive directories is limited
to 4K dirs, value set by MAXNDIRTREE constant, due to the poor scalability of
the specific code.

PeaZip lists 7z/p7zip supported formats using the more informative -slt option,
which is slower and uses more memory.
C1) PeaZip browse / search archives is allowed to scale up to 0.5M files to be
display at once
C2) same setting is used to scan archives for encrypted content (if applicable
for current format/operation), and scales as C1 up to 0.5M files.

Browser performances dropdown (Options > Settings, Performances) internally sets
prebrowse variable which controls the behavior of the application.
"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
"Do not pre-parse" will skip pre-parsing A1 and otherwise uses same settings as
Fastest mode.
Following table showhs limitations in number of items allowed to be process for
Slow to Fastest modes, and the amount of memory the application is allowed to
use for B1, C1, C2 operations

                      list at once   pre-parse   scan for dirs   dir content
          memory      C1, C2 -slt    B1 -l       B2              B3
Always    unlimited   unlimited      unlimited   unlimited       32K
Slow      192 MB      0.5M           1.5M+	 256K            16K
Medium    64 MB	      160K           0.5M+	 256K            16K
Fast      32 MB	      80K            256K+	 128K            16K
Fastest   16 MB	      40K            128K+	  64K            16K
Never     16 MB       40K            no/128K+      8K             8K

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 8 MB of memory and will
increase to 16, 32, and 64 MB (doubled for listing), the latter approximately
sufficient for pre-parsing 0.5M files or listing 400K files at once, then will
keep increasing as needed (slow)
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 prebrowse (5) setting
1c - searching for encrypted content in archive will stop accordingly to
prebrowse setting (will not be skipped with 5)
2a - list_slt table used for browsing is allocated up to 0.5 M files and will
then increase (slow) 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 prebrowse setting, maxed to 256K files

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

(C) Copyright 2006 Giorgio Tani giorgio.tani.software@gmail.com
Official PeaZip site: se const FIRSTDOM and SECONDDOM
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,
{$ENDIF}
{$IFDEF DARWIN}MacOSAll, CocoaAll,{$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,ansiutf8_utils,img_utils,
unit_gwrap,unit1,unit2,unit3,unit5,unit6,Unit7,Unit8,Unit9,Unit10,Unit11,Unit12,Unit13,
Classes, SysUtils, Process, UTF8Process, dateutils, fileutil, Types;

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;

   { TForm_peach }

   TForm_peach = class(TForm)
     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;
     Bevel20: 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;
     BSchedule1: TBitBtn;
     Button1: TBitBtn;
     Button2: TBitBtn;
     ButtonDesk1: TButton;
     ButtonEditName12: TSpeedButton;
     ButtonEditName14: TSpeedButton;
     ButtonEditName3: TButton;
     ButtonEditName4: TSpeedButton;
     ButtonEditName5: TButton;
     ButtonEditName6: TButton;
     ButtonEditName8: TSpeedButton;
     ButtonEditNameCustom: TButton;
     ButtonEditNameCustom1: TButton;
     Buttonfmactions1: TSpeedButton;
     ButtonRefSize: TButton;
     ButtonUn7za10: TSpeedButton;
     ButtonUn7za11: TSpeedButton;
     cbadvf1: TCheckBox;
     cbadvf2: TCheckBox;
     cbforcetype: TComboBox;
     cbdeleteinputmode: TComboBox;
     cbdeleteinputmode1: TComboBox;
     cbencext: TCheckBox;
     cbensmall: 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;
     cbSys7zlin: TCheckBox;
     cbtimecreated: TCheckBox;
     cbType: TComboBox;
     cbUn7zaRecursive: TCheckBox;
     cbUn7zaRecursiveExclude: TCheckBox;
     cbzooming: TComboBox;
     CheckBox1: TCheckBox;
     CheckBox2: TCheckBox;
     CheckBox3: TCheckBox;
     cbautoclosesingleextract: TCheckBox;
     cbEncoding1: TComboBox;
     cbcustext: TCheckBox;
     cbspacing: TComboBox;
     CheckBox7zunrar5: TCheckBox;
     CheckBoxAccentToolBar: TComboBox;
     CheckBoxAltBar: TComboBox;
     CheckBoxAltgridcol: TCheckBox;
     CheckBoxAltTab: TComboBox;
     CheckBoxAlttabcol: TComboBox;
     CheckBoxArchiveOF: TCheckBox;
     CheckBoxAutoExtTar: TCheckBox;
     CheckBoxAutoExtTar1: TCheckBox;
     cbqdup: TCheckBox;
     CheckBoxAutoTest: TCheckBox;
     CheckBoxAutoOpen: TCheckBox;
     CheckBoxClosePeaZip: TCheckBox;
     CheckBoxEditArchives: TCheckBox;
     CheckBoxEnumd: TCheckBox;
     CheckBoxAC: TCheckBox;
     CheckBoxFolder1: TCheckBox;
     CheckBoxForceConvert: TCheckBox;
     CheckBoxExcludeEF: TCheckBox;
     CheckBoxForceLayout: TCheckBox;
     CheckBoxrelative: TCheckBox;
     CheckBoxSkipenc: TCheckBox;
     CheckBoxsnoi: TCheckBox;
     CheckBoxsnh: TCheckBox;
     CheckBoxsnl: TCheckBox;
     CheckBoxsnon: TCheckBox;
     CheckBoxsnz1: TCheckBox;
     CheckBoxCenteredToolbar: TCheckBox;
     CheckBoxSolidAddress: TComboBox;
     CheckBoxssp: TCheckBox;
     CheckBoxstl: TCheckBox;
     CheckBoxzpaqabsolute: TCheckBox;
     CheckBoxzpaqall: TCheckBox;
     CheckBoxzpaqforce: TCheckBox;
     CheckBoxzpaqfull: TCheckBox;
     ComboBoxMaxArg: TComboBox;
     ComboBoxSyntaxLevel: TComboBox;
     ComboBoxmemuse: TComboBox;
     ComboBoxTAR: TComboBox;
     ComboBoxTAR1: TComboBox;
     ComboBoxTheme: TComboBox;
     ConsoleCreate: TPanel;
     ConsoleOpen: TPanel;
     csvsepchar: TLabel;
     CheckBoxSkipDel: TCheckBox;
     ComboBoxLanguage: TComboBox;
     Edit6: TEdit;
     Editalias: TEdit;
     EditCSVsep: TEdit;
     EditOpenOut1: TEdit;
     EditUn7zaFilterExclude: TEdit;
     gbConsoleCreate: TPanel;
     gbConsoleCreate1: TPanel;
     iConsoleCreateImport: TImage;
     iConsoleCreateImport1: TImage;
     Image7zPj: TBitBtn;
     Image7zPj1: TBitBtn;
     Image7zPj3: TBitBtn;
     ImageFlatcrop: TSpeedButton;
     ImageFlattransform: TSpeedButton;
     ImageFlatren: TSpeedButton;
     ImageFlatconvert: TSpeedButton;
     ImageFlatfolder: TSpeedButton;
     ImageFlatdup: TSpeedButton;
     ImageInfoArchive3: TImage;
     ImageInfoArchive4: TImage;
     ImageBCtext: TImage;
     ImageUn7zPj: TBitBtn;
     ImOpt1: TImage;
     ImageFlat: TSpeedButton;
     ImageFlatadd: TSpeedButton;
     ImageFlatext: TSpeedButton;
     ImageFlattestmore: TSpeedButton;
     ImagePassword: TSpeedButton;
     ImOpt2: TImage;
     ImOpt3: TImage;
     ImOpt4: TImage;
     ImOpt5: TImage;
     ImOpt6: TImage;
     ImOpt7: TImage;
     ImOpt8: TImage;
     Label11: TLabel;
     Label12: TLabel;
     LabelColor5: TLabel;
     LabelUpdates: TLabel;
     LabelDoc: TLabel;
     LabelAddFolder: TLabel;
     Labeladvextzpaq: TLabel;
     Labeladvextzpaq1: TLabel;
     LabelColor4: TLabel;
     LabelColorTabs1: 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;
     LabelStatus10: TLabel;
     LabelStatus9: TLabel;
     Labelsyntaxlevel: TLabel;
     Labelmemuse: TLabel;
     labelCheckBoxSolidAddress: TLabel;
     LabelStatus6d: TLabel;
     LabelStatus6c: TLabel;
     LabelStatus6b: TLabel;
     LabelStatus8: TLabel;
     LabelStatus6a: TLabel;
     LabelColorToolbar: TLabel;
     LabelColorAddressbar: TLabel;
     LabelColorTabs: TLabel;
     Labelmoreopt: TLabel;
     LabelForceLayout: TLabel;
     CheckBoxExtrac32: TCheckBox;
     CheckBoxForceBrowse: TCheckBox;
     CheckBoxExtAnd: TCheckBox;
     ComboBoxKiB: TComboBox;
     ComboBoxPriority: TComboBox;
     Editcommonalgo: TEdit;
     editcustext: TEdit;
     editExtEvForWhat: TEdit;
     Labelcb15: TLabel;
     Labelcb16: TLabel;
     LabelColor2d: TLabel;
     LabelColPresets: TLabel;
     Labelmoreopt1: TLabel;
     Labeloafter: TLabel;
     Labeloptsub5: TLabel;
     Labeloptsub6: TLabel;
     Labeloptsub7: TLabel;
     Labelspac5: TLabel;
     LabelAddFiles: TLabel;
     LabelStatusClip: TLabel;
     LabelStatus4: TLabel;
     LabelStatus5: TLabel;
     Labelalias: TLabel;
     Labeltaropt: TLabel;
     Labeltaropt1: TLabel;
     LabelTitleOptions1: TLabel;
     LabelTitleOptions2: TLabel;
     LabelTitleOptions3: TLabel;
     LabelTitleOptions4: TLabel;
     LabelTitleOptions5: TLabel;
     LabelTitleOptions6: TLabel;
     LabelTitleOptions7: TLabel;
     LabelTitleOptions8: TLabel;
     Labelspacing: TLabel;
     Labelsetwork: TLabel;
     Labelzooming: TLabel;
     lConsoleCreate_jobcode: TLabel;
     lConsoleCreate_jobcode1: TLabel;
     lConsoleCreate_outname: TLabel;
     lConsoleCreate_outname1: TLabel;
     Lpriority: TLabel;
     CheckBoxNoConf: TCheckBox;
     CheckBoxzipxswitch: TCheckBox;
     CheckBoxZstd: TCheckBox;
     CheckBoxConvert0: TCheckBox;
     CheckBoxDragDrop: TCheckBox;
     CheckBoxEncoding: TCheckBox;
     CheckBoxForceEdit: TCheckBox;
     CheckBoxAutoOpenTar: TCheckBox;
     CheckBoxJobEncoding: TCheckBox;
     CheckBoxForceOpen: TCheckBox;
     CheckBoxPrebrowse: TLabel;
     CheckBoxBrotli: TCheckBox;
     CheckBoxShowVolatile: TCheckBox;
     CheckBoxsni: TCheckBox;
     CheckBox4: TCheckBox;
     CheckBoxsni1: TCheckBox;
     CheckBoxsns: TCheckBox;
     CheckBoxARC1: TCheckBox;
     CheckBoxARC2: TCheckBox;
     CheckBoxARC3: TCheckBox;
     CheckBoxArchive4: TCheckBox;
     CheckBoxArchive6: TCheckBox;
     CheckBoxArchiveHistory: TCheckBox;
     CheckBoxAutoHaltA: TCheckBox;
     CheckBoxAutoHaltE: TCheckBox;
     CheckBoxBrowseNotVerbose: TCheckBox;
     CheckBoxConvert: TCheckBox;
     CheckBoxConvert1: TCheckBox;
     CheckBoxDate: TCheckBox;
     CheckBoxDeleteInput: TCheckBox;
     CheckBoxDeleteInput1: TCheckBox;
     CheckBoxFolder: TCheckBox;
     CheckBoxIgnoreDisp: TCheckBox;
     CheckBoxIgnoreSel: TCheckBox;
     CheckBoxIntDir: TCheckBox;
     CheckBoxMailKeep: TCheckBox;
     CheckBoxMQS: TCheckBox;
     CheckBoxNameAsParentFolder: TCheckBox;
     CheckBoxnetworkinfo: TCheckBox;
     CheckBoxParallelArchiving: TCheckBox;
     CheckBoxQuadMax: TCheckBox;
     CheckBoxSameArc: TCheckBox;
     CheckBoxSameExt: TCheckBox;
     CheckBoxSeparate: TCheckBox;
     CheckBoxShowHints: TCheckBox;
     CheckBoxsns1: TCheckBox;
     CheckBoxTarBefore: TCheckBox;
     CheckBoxUnPeaAttributes: TCheckBox;
     CheckBoxUPX1: TCheckBox;
     CheckBoxUPX2: TCheckBox;
     CheckBoxWindowStatus: TCheckBox;
     CheckBoxzcopy: TCheckBox;
     cbRAR5: TCheckBox;
     CheckGroupM1: TCheckGroup;
     CheckGroupM2: TCheckGroup;
     CheckGroupW: TCheckGroup;
     CheckGroupW1: TCheckGroup;
     ColorButton1: TColorButton;
     ColorButton2: TColorButton;
     ColorButton3: TColorButton;
     ComboBox1: TComboBox;
     ComboBoxDrag: TComboBox;
     comboRARdict: TComboBox;
     ComboBoxWD: TComboBox;
     ComboBoxLibre: TComboBox;
     ComboBoxprivacy: TComboBox;
     ComboBox7zalgo: TComboBox;
     ComboBoxARC: TComboBox;
     ComboBoxARC2: TComboBox;
     ComboBoxARCalgo: TComboBox;
     ComboBoxArchive1: TComboBox;
     ComboBoxArchiveAct: TComboBox;
     ComboBoxArchive2: TComboBox;
     ComboBoxArchive3: TComboBox;
     ComboBoxArchive4: TComboBox;
     ComboBoxArchive5: TComboBox;
     ComboBoxArchive6: TComboBox;
     ComboBoxArchive7: TComboBox;
     ComboBoxArchive8: TComboBox;
     ComboBoxArchive9: TComboBox;
     ComboBoxArchiveAct1: TComboBox;
     ComboBoxArchiveCustom: TComboBox;
     ComboBoxArchiveCustom1: TComboBox;
     ComboBoxArchivePasses: TComboBox;
     ComboBoxArchivePaths: TComboBox;
     ComboBoxArchivePaths1: TComboBox;
     ComboBoxArchiveSolid: TComboBox;
     ComboBoxArchiveSolid1: TComboBox;
     ComboBoxArcSfx: TComboBox;
     ComboBoxArcSolid: TComboBox;
     ComboBoxM2: TComboBox;
     ComboBoxM3: TComboBox;
     ComboBoxOverwrite: TComboBox;
     ComboBoxOverwriteARC: TComboBox;
     ComboBoxPAQ1: TComboBox;
     ComboBoxPasses: TComboBox;
     ComboBoxPEA2: TComboBox;
     ComboBoxPEA3: TComboBox;
     ComboBoxPEA4: TComboBox;
     ComboBoxPEACompression1: TComboBox;
     ComboBoxSD: TComboBox;
     ComboBoxSplit3: TComboBox;
     ComboBoxUPX: TComboBox;
     ComboBoxBrowser: TComboBox;
     CompressionARC: TPanel;
     CompressionCustom: TPanel;
     CompressionCustom1: TPanel;
     ctrlext: TSpeedButton;
     ctrlarc: TSpeedButton;
     DateEdit1: TDateEdit;
     DateEdit2: TDateEdit;
     DateEdit3: TDateEdit;
     DateEdit4: TDateEdit;
     Edit1: TEdit;
     Edit2: TEdit;
     Edit3: TEdit;
     Edit4: TEdit;
     Edit5: TEdit;
     EditEncoding: TEdit;
     Edit7: TEdit;
     EditDesk: TEdit;
     EditExtCustom: TEdit;
     EditName3: TEdit;
     EditNameCustom: TEdit;
     EditNameCustom1: TEdit;
     EditOP: TEdit;
     EditOParc: TEdit;
     EditOPcustom: TEdit;
     EditOPcustom1: TEdit;
     EditOpenOut: TEdit;
     EditSchedulePassword: TEdit;
     EditSchedulePassword1: TEdit;
     EditScheduleUser: TEdit;
     EditScheduleUser1: TEdit;
     EditUn7zaFilter: TEdit;
     EditUn7zaFilter1: TEdit;
     Group7za1: TPanel;
     Group7za2: TPanel;
     GroupBox12: TPanel;
     GroupBox4: TPanel;
     GroupBoxCreateOut: TPanel;
     GroupBoxCreateOut1: TPanel;
     GroupBoxPEAAdvanced1: TPanel;
     iadvextract: TImage;
     il_dtheme_48: TImageList;
     il_dtheme_96: TImageList;
     ImageListDlg: TImageList;
     Imagesp1: TImage;
     ImageInfoDefault1: TImage;
     ImageInfoDefault2: TImage;
     ImagePassword3: TSpeedButton;
     Imagesp: TImage;
     Labelcb18: TLabel;
     Labelcb19: TLabel;
     LabelColor2b: TLabel;
     Labellightpresets: TLabel;
     Labelenc: TLabel;
     LabelAdvThemes: TLabel;
     lsetdefaultout_arc: TLabel;
     Labelextevfor: TLabel;
     LabelConfigurearc: TLabel;
     LabelConfigureext: TLabel;
     Labeloamext1: TLabel;
     Labelrr: TLabel;
     labelRARdict: TLabel;
     Labelconsoleencoding: TLabel;
     Labeladvextace: TLabel;
     LabelColor2: TLabel;
     LabelColor3: TLabel;
     LabelConfigurePw: TLabel;
     Labelcwd: TLabel;
     LabelAppPath: TLabel;
     Labelcb17: TLabel;
     LabelcbSD: TLabel;
     LabelcbSDcustom: TLabel;
     LabelConf: TLabel;
     LabelConf1: TLabel;
     LabelConfigureSendTo: TLabel;
     LabelDefaultColor2: TLabel;
     LabelDefaultColor3: TLabel;
     LabelDefaultOpacity: TLabel;
     LabelInfoGeneral: TLabel;
     Labeloaenc: TLabel;
     Labeloaui: TLabel;
     Labelogpaths: TLabel;
     LabelOpacity: TLabel;
     Labelspac4: TLabel;
     LabelErrors: TLabel;
     LabelStatus7: TLabel;
     lsetdefaultout_ext: TLabel;
     eowrun: TMenuItem;
     lightdim: TMenuItem;
     lightlow: TMenuItem;
     lightmocha: TMenuItem;
     lightsenape: TMenuItem;
     lightgraphite: TMenuItem;
     lightplum: TMenuItem;
     mConsoleCreate: TMemo;
     mConsoleCreate1: TMemo;
     MemoList: TMemo;
     maltbk: TMenuItem;
     maltfw: TMenuItem;
     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;
     po_browserccomment: TMenuItem;
     pmccomment: TMenuItem;
     mpeachangelog: TMenuItem;
     mpeatos: TMenuItem;
     pmmoreextract: TMenuItem;
     pmmoreconvert: TMenuItem;
     pmmoreadd: TMenuItem;
     pmtoolcompact: TMenuItem;
     mtranslationsfaq: TMenuItem;
     mswaptab: TMenuItem;
     mfunconvert: TMenuItem;
     PanelAdArchive4: TPanel;
     pmbcnw: TMenuItem;
     pmtabscloseall: TMenuItem;
     pmtabsnewwindow: TMenuItem;
     pmbccp: TMenuItem;
     pmbcps: TMenuItem;
     pmclip: TMenuItem;
     po_clip: TMenuItem;
     po_dedup: TMenuItem;
     po_windowopen: TMenuItem;
     mlargeicons: TMenuItem;
     mfunextract: TMenuItem;
     mfunadd: 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;
     ShapeProgress: TPanel;
     ShapeThemes1: TShape;
     ShapeThemes2: TShape;
     StringGridTB: TStringGrid;
     tabaddress: TMenuItem;
     pmquickdownloads: TMenuItem;
     Separator16: TMenuItem;
     Separator12: TMenuItem;
     mtoggletool: TMenuItem;
     mhbook: TMenuItem;
     mhhist: TMenuItem;
     mhaltup: TMenuItem;
     mhpwf9: TMenuItem;
     mhsearchf3: TMenuItem;
     mhmenunavf4: 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;
     Panelnav4: TSpeedButton;
     Separator4: TMenuItem;
     mprofileimmediate: TMenuItem;
     pmnavbc0: TMenuItem;
     pmnavhistory0: TMenuItem;
     pmnavhistory8: TMenuItem;
     pmnavbc1: TMenuItem;
     pmnavbc2: TMenuItem;
     pmnavbc3: TMenuItem;
     pmnavbc4: TMenuItem;
     pmnavbc5: TMenuItem;
     pmnavbc6: TMenuItem;
     pmnavbc7: TMenuItem;
     pmnavbc8: TMenuItem;
     pmnavhistory1: TMenuItem;
     pmnavhistory2: TMenuItem;
     pmnavhistory3: TMenuItem;
     pmnavhistory4: TMenuItem;
     pmnavhistory5: TMenuItem;
     pmnavhistory6: TMenuItem;
     pmnavhistory7: TMenuItem;
     pmr_files: TMenuItem;
     pmnavhistory: TPopupMenu;
     pmnavbc: 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;
     mdefarcset: 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;
     mtogglesidebar: TMenuItem;
     mtoggletabbar: TMenuItem;
     mtoggletoolbar: 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_lock: TMenuItem;
     po_rr: TMenuItem;
     po_recover: TMenuItem;
     po_comment: TMenuItem;
     pmmorecomment: TMenuItem;
     pmmorerecover: TMenuItem;
     pmmorerr: TMenuItem;
     pmmorelock: TMenuItem;
     mprofilerar: TMenuItem;
     PanelRar: TPanel;
     pob_blake2b: TMenuItem;
     pob_blake2s: TMenuItem;
     mprofile7zfast: TMenuItem;
     mprofile7zfastest: TMenuItem;
     PanelBrotli: TPanel;
     PanelZstd: TPanel;
     po_smart: TMenuItem;
     mprofilebetterzpaq: TMenuItem;
     mprofilesave: TMenuItem;
     mprofileload: TMenuItem;
     mprofilebrotli: TMenuItem;
     mprofilezstd: TMenuItem;
     mprofilealtarc: TMenuItem;
     mprofileextremezpaq: TMenuItem;
     mloadcompsettings: TMenuItem;
     msavecompsettings: TMenuItem;
     mForceSynceditsClear: TMenuItem;
     mForceClear: TMenuItem;
     mextallheresmart: TMenuItem;
     mextallherenew: TMenuItem;
     MenuItemExtAllHereSmart: TMenuItem;
     MenuItemExtAllHereNew: TMenuItem;
     pmqeheresmart: TMenuItem;
     pmqeherenew: TMenuItem;
     po_rename_filesonly: TMenuItem;
     mprofilezipbz2: 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;
     pmstyle2: TMenuItem;
     pmstyle3: TMenuItem;
     pmstyle4: TMenuItem;
     pmstyle5: TMenuItem;
     pmstyle6: 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;
     RadioGroup3: TComboBox;
     RadioGroup4: TComboBox;
     RadioGroup6: TComboBox;
     RadioGroupAction1: TComboBox;
     ShapeTitleAddb1: TShape;
     ShapeTitleAddb2: TShape;
     ShapeTitleAddb3: TShape;
     ShapeTitleAddb4: TShape;
     ShapeTitleAppsb1: TShape;
     ShapeTitleAppsb2: TShape;
     ShapeTitleExtractb1: TShape;
     ShapeTitleExtractb2: TShape;
     ShapeTitleExtractb3: TShape;
     ShapeTitleExtractb4: TShape;
     SpinEdit1: TSpinEdit;
     seRARrr: TSpinEdit;
     splitsearch: TSplitter;
     StringGridAddress3: TStringGrid;
     StringGridArchive: TStringGrid;
     StringGridTabs: TStringGrid;
     Subtitleschopt: TLabel;
     Subtitleschopt1: 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;
     ImageDefaults2: TBitBtn;
     ImageInfoArchive5: TImage;
     ImageInfoArchive6: TImage;
     ImageListSearch1: TImage;
     Imageopenadvf: TImage;
     Imageopenadvf1: TImage;
     Imageopenadvf2: TImage;
     ImagePassword1: TSpeedButton;
     ImagePassword2: TSpeedButton;
     ImageSplit: TImage;
     Label10: TLabel;
     Label7za14: TLabel;
     Label7za18: TLabel;
     Label7za8: TLabel;
     Labeladvext7z: TLabel;
     Labeladvextfreearc: TLabel;
     LabelArcSub3: TLabel;
     Labelogperf: TLabel;
     LabelWD: TLabel;
     Label7za1: TLabel;
     Label7za10: TLabel;
     Label7za11: TLabel;
     Label7za12: TLabel;
     Label7za2: TLabel;
     Label7za3: TLabel;
     Label7za4: TLabel;
     Label7za5: TLabel;
     Label7za6: TLabel;
     Label7za7: TLabel;
     Label7za9: TLabel;
     Label7zaPasses: TLabel;
     Label7zsolidblock: TLabel;
     LabelAbout1: TLabel;
     LabelArchiveOther: TLabel;
     LabelArchiveOther1: TLabel;
     LabelArchiveOther2: TLabel;
     LabelArchiveOther3: TLabel;
     LabelArchiveOther4: TLabel;
     LabelArchiveOther5: TLabel;
     LabelArchiveOther6: TLabel;
     LabelArchiveOther7: TLabel;
     LabelArchiveOther8: TLabel;
     LabelARCsolidblock: TLabel;
     LabelArcSub1: TLabel;
     LabelArcSub2: TLabel;
     Labelbcmblock: TLabel;
     Labelcb14: TLabel;
     Labeloamext: TLabel;
     Labelogreset: TLabel;
     Labelcb7: TLabel;
     Labelcbadvanced: TLabel;
     Labelcbbasic: TLabel;
     Labelcbsample: TLabel;
     Labelcbsampleadvanced: TLabel;
     LabelClipInfo: TLabel;
     LabelClickAdArchive1: TLabel;
     LabelClickAdArchive2: TLabel;
     LabelClickAdArchive3: TLabel;
     LabelClickAdArchive4: TLabel;
     LabelColor1: TLabel;
     LabelConfigurePeaZip: TLabel;
     LabelCustom: TLabel;
     LabelDefaultColor1: TLabel;
     LabelEvery: TLabel;
     LabelEvery1: TLabel;
     LabelEveryUnit: TLabel;
     LabelEveryUnit1: TLabel;
     LabelLang2: TLabel;
     Labeloptsub1: TLabel;
     Labeloptsub2: TLabel;
     Labeloptsub3: TLabel;
     Labeloptsub4: TLabel;
     LabelPanelHintAdd: TLabel;
     LabelPanelHintExtract: TLabel;
     LabelPEA6: TLabel;
     LabelPEA7: TLabel;
     LabelPEA8: TLabel;
     LabelResetApp1: TLabel;
     LabelResetBookmarks: TLabel;
     LabelResetHistory: TLabel;
     LabelResetPM: TLabel;
     LabelResetPtmp: TLabel;
     LabelSplit: TLabel;
     LabelStatus2: TLabel;
     LabelStatus6: 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;
     Lmanageschedule3: TLabel;
     Lmanageschedule4: TLabel;
     lsa1: TLabel;
     lsa2: TLabel;
     lsa3: TLabel;
     lsa4: TLabel;
     lsa5: TLabel;
     lsa6: TLabel;
     lsaday: TLabel;
     lsaday1: TLabel;
     lsp: TLabel;
     lsp1: TLabel;
     lsspc: 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;
     mfun0: TMenuItem;
     metn: TMenuItem;
     morghistory: TMenuItem;
     morgsessionhistory: TMenuItem;
     morgbookmarks: TMenuItem;
     PanelActDefaults: TPanel;
     panelspaceradd2: TPanel;
     RadioGroupActionArc: TComboBox;
     panelspacerextract2: 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;
     Options: TScrollBox;
     OptionsAdv: TScrollBox;
     OptionsARC: TPanel;
     OptionsOpen: TScrollBox;
     PageExtAdv: TScrollBox;
     PageOpt1: TScrollBox;
     PageOpt3: TScrollBox;
     PageOpt4: TScrollBox;
     PageOpt5: TScrollBox;
     PageOpt6: TScrollBox;
     PageOpt7: TScrollBox;
     PageOpt8: TScrollBox;
     Panel7za: TPanel;
     PanelApps1: TPanel;
     PanelApps2: TPanel;
     PanelARC: TPanel;
     PanelArchive2: TPanel;
     PanelCustom: TPanel;
     PanelHDW: TPanel;
     PanelHDW1: TPanel;
     PanelHintAdd: TPanel;
     PanelHintExtract: TPanel;
     PanelMonthly: TPanel;
     PanelMonthly1: TPanel;
     PanelPAQ: TPanel;
     PanelPEA: TPanel;
     PanelQuad: TPanel;
     PanelScheduleAdd: TPanel;
     PanelScheduleAdd1: TPanel;
     PanelSplitFile: TPanel;
     PanelTitleApps: TPanel;
     PanelUPX: TPanel;
     PanelWeekly: TPanel;
     PanelWeekly1: 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;
     Panel9: TPanel;
     pmflat: TMenuItem;
     po_preview: TMenuItem;
     po_analyze: TMenuItem;
     pmmorepreview: TMenuItem;
     pmmorehex: TMenuItem;
     pmqnointdir: TMenuItem;
     pmmoreanalysis: TMenuItem;
     po_rename_timestamp: TMenuItem;
     PanelSearch: TPanel;
     mextract: TMenuItem;
     MenuItem47: TMenuItem;
     mtoggletbrib: TMenuItem;
     mf4: 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;
     RadioGroup0: TComboBox;
     RadioGroup1: TComboBox;
     RadioGroup2: TComboBox;
     RadioGroupAction: TComboBox;
     RadioGroupArchive: TRadioGroup;
     RadioGroupBrowser: TComboBox;
     RadioGroupPaq: TRadioGroup;
     RadioGrouppwrequest: TComboBox;
     RadioGroupQuad: TRadioGroup;
     RadioGroupTS: TComboBox;
     schedaddname: TEdit;
     schedaddname1: TEdit;
     schedaddschedule: TComboBox;
     schedaddschedule1: TComboBox;
     ScheduleAdd: TScrollBox;
     scheduleend: TCheckBox;
     scheduleend1: TCheckBox;
     ScheduleExtract: TScrollBox;
     schedulehh: TSpinEdit;
     schedulehh1: TSpinEdit;
     schedulemm: TSpinEdit;
     schedulemm1: TSpinEdit;
     scheduleNN: TSpinEdit;
     scheduleNN1: TSpinEdit;
     schedulepassword: TLabel;
     schedulepassword1: TLabel;
     schedulestart: TCheckBox;
     schedulestart1: TCheckBox;
     scheduleuser: TCheckBox;
     scheduleuser1: TCheckBox;
     ShapeAddress: TPanel;
     SpinEditArchive1: TSpinEdit;
     Splitter3: TSplitter;
     StringGrid1: TStringGrid;
     StringGrid2: TStringGrid;
     StringGridAddress1: TStringGrid;
     StringGridAddress2: TStringGrid;
     StringGridCustEdit: TStringGrid;
     StringGridCustEdit1: TStringGrid;
     StringGridList: TStringGrid;
     StringGridAddress: TStringGrid;
     Subtitle7zaopt: TLabel;
     Subtitle7zaopt1: TLabel;
     Subtitle7zaopt2: TLabel;
     TabBar: THeaderControl;
     tbcontrast: TTrackBar;
     themesave_label: TLabel;
     theme_label1: TImage;
     Timer4: 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;
     pmrefreshlayout: 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;
     pmemb0: 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;
     pmembf0: TMenuItem;
     pmembf3: TMenuItem;
     pmembf2: TMenuItem;
     pmembf4: TMenuItem;
     pmembf5: TMenuItem;
     pmembf1: TMenuItem;
     pmExploremenu: TMenuItem;
     PanelTitleExtract: TPanel;
     BevelTitleOptions1: TPanel;
     BevelTitleOptions3: TPanel;
     BevelTitleOptions4: TPanel;
     BevelTitleOptions5: TPanel;
     ButtonArchive: TBitBtn;
     ButtonArchive1: TBitBtn;
     ButtonDelete: TSpeedButton;
     ButtonDup: TSpeedButton;
     ButtonDup1: TSpeedButton;
     ButtonNF: TSpeedButton;
     Buttonfmactions: TSpeedButton;
     ButtonEditName13: TSpeedButton;
     ButtonExtCancel: TBitBtn;
     ButtonExtOk: TBitBtn;
     ButtonImgRes: TSpeedButton;
     ButtonImgR: TSpeedButton;
     ButtonImgCrop: TSpeedButton;
     Buttonopenactions: TSpeedButton;
     ButtonOpenWith: TSpeedButton;
     ButtonProperties: TSpeedButton;
     ButtonRename1: TSpeedButton;
     ButtonUn7za1: TSpeedButton;
     ButtonCopy: TSpeedButton;
     Buttoncmto: TSpeedButton;
     ButtonRename: TSpeedButton;
     ButtonImgResize: TSpeedButton;
     ButtonUn7za4: TSpeedButton;
     ButtonUn7za5: TSpeedButton;
     ButtonUn7za6: TSpeedButton;
     ButtonUn7za7: TSpeedButton;
     ButtonCut: TSpeedButton;
     ButtonImg6: TSpeedButton;
     ButtonUn7za8: TSpeedButton;
     ButtonUn7za9: 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;
     Shape3: TPanel;
     Shape4: TPanel;
     ShellTreeView2: 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;
     pmqjmyboxfiles: TMenuItem;
     MenuItemArchive_myboxfiles: TMenuItem;
     MenuItemOpen_myboxfiles: 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;
     MenuItem17: TMenuItem;
     MenuItemOpen_music: TMenuItem;
     MenuItemOpen_pictures: TMenuItem;
     MenuItemOpen_videos: TMenuItem;
     MenuItemArchive_music: TMenuItem;
     MenuItemArchive_pictures: TMenuItem;
     MenuItemArchive_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;
     MenuItem87: TMenuItem;
     MenuItem90: TMenuItem;
     pmhbc0: TMenuItem;
     pnabc1: TMenuItem;
     pnabc2: TMenuItem;
     pnabc3: TMenuItem;
     pnabc4: TMenuItem;
     pnabc5: TMenuItem;
     pnabc6: TMenuItem;
     pnabc7: TMenuItem;
     pnabc8: TMenuItem;
     pnabc0: TMenuItem;
     pnbc2: TMenuItem;
     pnbc3: TMenuItem;
     pnbc4: TMenuItem;
     pnbc5: TMenuItem;
     pnbc6: TMenuItem;
     pnbc7: TMenuItem;
     pnbc8: TMenuItem;
     pnbc0: TMenuItem;
     pnbc1: TMenuItem;
     pmbc: TMenuItem;
     po_task: TMenuItem;
     pnra0: TMenuItem;
     pnha0s: TMenuItem;
     pnr0: TMenuItem;
     pnh0s: TMenuItem;
     pmhr0: TMenuItem;
     pmh0s: TMenuItem;
     mrecent0: TMenuItem;
     MenuItem32: TMenuItem;
     mback: TMenuItem;
     MenuItem37: TMenuItem;
     mbackalias: 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;
     pmbcweb: TMenuItem;
     pmbcproperties: TMenuItem;
     pmbcexplore: 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;
     mfwd: TMenuItem;
     mtstyle_shadow: TMenuItem;
     mtstyle_frame: TMenuItem;
     mtstyle_none: TMenuItem;
     mtstyle: TMenuItem;
     mprelist: TMenuItem;
     Panel11: TPanel;
     pmhrefresh: TMenuItem;
     MenuItemOpen_dropbox: TMenuItem;
     MenuItemOpen_googledrive: TMenuItem;
     MenuItemOpen_onedrive: TMenuItem;
     MenuItemOpen_skydrive: TMenuItem;
     MenuItemOpen_ubuntuone: TMenuItem;
     MenuItemArchive_dropbox: TMenuItem;
     MenuItemArchive_googledrive: TMenuItem;
     MenuItemArchive_onedrive: TMenuItem;
     MenuItemArchive_skydrive: TMenuItem;
     MenuItemArchive_ubuntuone: TMenuItem;
     MenuItem73: TMenuItem;
     pmorganizebookmarks: TMenuItem;
     pmrsearch: TMenuItem;
     MenuItemOpen_organizebookmarks: TMenuItem;
     Panelnav5: TPanel;
     pmqjmore: TMenuItem;
     MenuItem81: TMenuItem;
     pmqjgoogledrive: TMenuItem;
     pmqjonedrive: TMenuItem;
     pmqjskydrive: TMenuItem;
     pmqjubuntuone: 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;
     mpretoggle: TMenuItem;
     mprelightlist: TMenuItem;
     mprelight: TMenuItem;
     mpredetails: TMenuItem;
     mpreaverage: TMenuItem;
     mprelarge: TMenuItem;
     mopresets: 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;
     mpw2: TMenuItem;
     mmore: TMenuItem;
     mjob2: TMenuItem;
     mJob: TMenuItem;
     mProperties: TMenuItem;
     PopupMenu2: TPopupMenu;
     ctrlfwd: TSpeedButton;
     ctrlhistory: TSpeedButton;
     ctrlup: TSpeedButton;
     EditOpenIn: TEdit;
     EditOpenIn1: 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;
     LabelStatusEx2: TLabel;
     LabelStatusdisplayed: TLabel;
     fextallto: TMenuItem;
     fextallfav1: TMenuItem;
     mwebs: TMenuItem;
     po_fm: TMenuItem;
     MenuItem34: TMenuItem;
     fextallfav2: TMenuItem;
     fextallfav3: TMenuItem;
     fextallfav4: TMenuItem;
     fextallfav5: TMenuItem;
     fextallfav6: TMenuItem;
     fextallfav7: TMenuItem;
     fextallfav8: TMenuItem;
     extalllast: TMenuItem;
     mbrowsersort: TMenuItem;
     mbrowsersizes: TMenuItem;
     mbrowsersizem: TMenuItem;
     mbrowsersizel: 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;
     mtogglestatusbar: TMenuItem;
     msorttoggle: TMenuItem;
     mtogglenavbar: TMenuItem;
     MenuItem51: TMenuItem;
     MenuItem62: TMenuItem;
     mttoggletoolbar: TMenuItem;
     pma2s_extnew1: TMenuItem;
     pma2s_extallnew1: TMenuItem;
     pma2s_extnew: TMenuItem;
     pma2s_cancel1: TMenuItem;
     pma2s_extract1: TMenuItem;
     pmapptosys1: 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;
     Panel8: TPanel;
     PanelListBar: TPanel;
     pmqelast: TMenuItem;
     pmqe2fav: TMenuItem;
     pmqe3fav: TMenuItem;
     mextalldocuments: 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;
     fextalldefault: TMenuItem;
     pmopenout: TMenuItem;
     pmqenopath: TMenuItem;
     mextalldesktop: TMenuItem;
     pmqen1: TMenuItem;
     pmqen2: TMenuItem;
     pmqen3: TMenuItem;
     pmqen4: TMenuItem;
     pmqen5: TMenuItem;
     mextallhere: TMenuItem;
     mextallto: 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;
     msmallicon: TMenuItem;
     mwebsearch: TMenuItem;
     PanelIntro: TPanel;
     MenuItemDonations: TMenuItem;
     MenuItemOpen_downloads1: TMenuItem;
     MenuItemArchive_downloads: TMenuItem;
     pmjumpdownloads: TMenuItem;
     pmquickextract: TPopupMenu;
     pmbreadcrumb: TPopupMenu;
     po_open_asarchive: TMenuItem;
     pmjumprecent: TMenuItem;
     pmjumpsearches: TMenuItem;
     pmjumplibraries: TMenuItem;
     MenuItemOrganizeMbar: TMenuItem;
     MenuItemArchive_pubhome: TMenuItem;
     MenuItemOpen_pubhome: TMenuItem;
     mbrowser: TMenuItem;
     MenuItem53: TMenuItem;
     MenuItem55: TMenuItem;
     MenuItem57: TMenuItem;
     MenuItem58: 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;
     pmjumpsearch: TMenuItem;
     pma2s_move: TMenuItem;
     pmsystoapp: TPopupMenu;
     pmapptosys: TPopupMenu;
     Panelnav: TPanel;
     LabelStatusAr2: TLabel;
     ListView1: TListView;
     mctrlf3: TMenuItem;
     mcancel: TMenuItem;
     mbcl: TMenuItem;
     MenuItem10: TMenuItem;
     MenuItem13: TMenuItem;
     MenuItem14: TMenuItem;
     mbpea: TMenuItem;
     mbexplore: TMenuItem;
     MenuItem23: TMenuItem;
     mr9: TMenuItem;
     mhpea: TMenuItem;
     mhexplore: TMenuItem;
     mhcl: TMenuItem;
     MenuItem39: TMenuItem;
     MenuItemOpen_pubdoc: TMenuItem;
     MenuItemArchive_pubdoc: TMenuItem;
     pmjumppubdoc: TMenuItem;
     pnh1: TMenuItem;
     pnh2: TMenuItem;
     pnh3: TMenuItem;
     pnh4: TMenuItem;
     pnh5: TMenuItem;
     pnh6: TMenuItem;
     pnh7: TMenuItem;
     pnh8: TMenuItem;
     SelectDirectoryDialog2: TSelectDirectoryDialog;
     ShellTreeView1: TShellTreeView;
     smHistory1: TMenuItem;
     pnha2: TMenuItem;
     pnha3: TMenuItem;
     pnha4: TMenuItem;
     pnha5: TMenuItem;
     pnha6: TMenuItem;
     pnha7: TMenuItem;
     pnha8: TMenuItem;
     smHistorya1: TMenuItem;
     pnha1: TMenuItem;
     mNav: TMenuItem;
     mhistory2: TMenuItem;
     mhistory3: TMenuItem;
     mhistory4: TMenuItem;
     mhistory5: TMenuItem;
     mhistory6: TMenuItem;
     mhistory7: TMenuItem;
     mhistory8: TMenuItem;
     mHistory: TMenuItem;
     mhistory1: TMenuItem;
     pmh9: TMenuItem;
     mshiftf3: TMenuItem;
     MenuItem41: TMenuItem;
     po_hidden: TMenuItem;
     mopenasarchive: TMenuItem;
     pmbookmarks: TMenuItem;
     po_convertarchive: TMenuItem;
     mrowselect: TMenuItem;
     po_selectall: TMenuItem;
     mlist: TMenuItem;
     mdetails: 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;
     MenuItem28: TMenuItem;
     MenuItem31: TMenuItem;
     MenuItemextexplore: TMenuItem;
     MenuItemArchive_documents1: TMenuItem;
     NotebookOpen: TPanel;
     PanelActAdd: TPanel;
     PanelActExt: TPanel;
     PanelExtract: TPanel;
     PanelFileBrowserOptions: TPanel;
     PopupMenuType: TPopupMenu;
     pmBrowser: TMenuItem;
     mpathself1: TMenuItem;
     MenuItemArchive_home1: TMenuItem;
     MenuItemArchive_pc: TMenuItem;
     mpathdesk1: TMenuItem;
     mpathexplore1: TMenuItem;
     mpathreset1: TMenuItem;
     mf8: TMenuItem;
     mctrlf8: TMenuItem;
     mshiftf8: TMenuItem;
     mf2: TMenuItem;
     mf4up: TMenuItem;
     mfun: TMenuItem;
     PanelBack1: TPanel;
     PopupMenupath1: TPopupMenu;
     smBookmarksa1: TMenuItem;
     smfs1: TMenuItem;
     mf3: TMenuItem;
     MenuItemHistoryBook: TMenuItem;
     PopupMenuHistory: TPopupMenu;
     smfsa1: TMenuItem;
     pnr1: TMenuItem;
     pnr2: TMenuItem;
     pnr3: TMenuItem;
     pnr4: TMenuItem;
     pnr5: TMenuItem;
     pnr6: TMenuItem;
     pnr7: TMenuItem;
     pnr8: TMenuItem;
     pnra1: TMenuItem;
     pnra2: TMenuItem;
     pnra3: TMenuItem;
     pnra4: TMenuItem;
     pnra5: TMenuItem;
     pnra6: TMenuItem;
     pnra7: TMenuItem;
     pnra8: 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;
     MenuItemOpen_pc: 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;
     pajdn1: TMenuItem;
     pajdn2: TMenuItem;
     pajdn3: TMenuItem;
     pajdn4: TMenuItem;
     pajdn5: TMenuItem;
     pajdn6: TMenuItem;
     pajdn7: TMenuItem;
     pajdn8: TMenuItem;
     pajdn9: TMenuItem;
     pajdn10: TMenuItem;
     pajdn11: TMenuItem;
     pajdn12: TMenuItem;
     pajdn13: TMenuItem;
     pajdn14: TMenuItem;
     pajdn15: TMenuItem;
     pajdn16: TMenuItem;
     pajdn17: TMenuItem;
     pajdn18: TMenuItem;
     pajdn19: TMenuItem;
     pajdn20: TMenuItem;
     pajdn21: TMenuItem;
     pajdn22: TMenuItem;
     pajdn23: TMenuItem;
     pajdn24: TMenuItem;
     pajdn25: TMenuItem;
     pajdn26: 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;
     pnba1: TMenuItem;
     pnba2: TMenuItem;
     pnba3: TMenuItem;
     pnba4: TMenuItem;
     pnba5: TMenuItem;
     pnba6: TMenuItem;
     pnba7: TMenuItem;
     pnba8: TMenuItem;
     pnba9: TMenuItem;
     pnba10: TMenuItem;
     pnba11: TMenuItem;
     pnba12: TMenuItem;
     pnba13: TMenuItem;
     pnba14: TMenuItem;
     pnba15: TMenuItem;
     pnba16: TMenuItem;
     pnba17: TMenuItem;
     pnba18: TMenuItem;
     pnba19: TMenuItem;
     pnba20: TMenuItem;
     pnba21: TMenuItem;
     pnba22: TMenuItem;
     pnba23: TMenuItem;
     PopupOpen1: 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;
     sbBrowse: TMenuItem;
     MenuItemOpen_Up: TMenuItem;
     MenuItemOpen_back: TMenuItem;
     MenuItemOpen_fwd: TMenuItem;
     MenuItemOpen_root: TMenuItem;
     MenuItemOpen_jump: TMenuItem;
     MenuItemOpen_Flat: TMenuItem;
     MenuItemOpen_refresh: 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;
     Splitter1: TSplitter;
     Splitter2: TSplitter;
     StringGridBookmarks: TStringGrid;
     StringGridClipboard: TStringGrid;
     StringGridSessionHistory: TStringGrid;
     StringGridRecent: TStringGrid;
     Timer2: TTimer;
     Timer3: 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;
     TrayIcon1: TTrayIcon;
     TreeView1: 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;
      pmJumpArchive: TMenuItem;
      pmJumpPath: TMenuItem;
      pmJump2: TMenuItem;
      pmJump1: 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;
      Notebook1: TPanel;
      PanelArchiveMain: TPanel;
      PanelBarOpen: TPanel;
      PanelDefaults: 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;
      PopupMenu1: TPopupMenu;
      PopupOpen: TPopupMenu;
      SaveDialog2: TSaveDialog;
      SaveDialogPJ: TSaveDialog;
      SelectDirectoryDialog1: TSelectDirectoryDialog;
      StringGridTmp: TStringGrid;
      Timer1: TTimer;
      TreeView2: 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 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 BSchedule1Click(Sender: TObject);
      procedure BScheduleClick(Sender: TObject);
      procedure Button2Click(Sender: TObject);
      procedure ButtonArchive1Click(Sender: TObject);
      procedure ButtoncmtoClick(Sender: TObject);
      procedure ButtonCopyClick(Sender: TObject);
      procedure ButtonCutClick(Sender: TObject);
      procedure ButtonDesk1Click(Sender: TObject);
      procedure ButtonDupClick(Sender: TObject);
      procedure ButtonEditName12Click(Sender: TObject);
      procedure ButtonEditName13Click(Sender: TObject);
      procedure ButtonEditName3Click(Sender: TObject);
      procedure ButtonEditName4Click(Sender: TObject);
      procedure ButtonEditName5Click(Sender: TObject);
      procedure ButtonEditName8Click(Sender: TObject);
      procedure ButtonEditNameCustom1Click(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 ButtonUn7za10Click(Sender: TObject);
      procedure ButtonUn7za11Click(Sender: TObject);
      procedure ButtonUn7za11MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonUn7za4MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonUn7za5Click(Sender: TObject);
      procedure ButtonUn7za5MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonUn7za6Click(Sender: TObject);
      procedure ButtonUn7za7Click(Sender: TObject);
      procedure ButtonUn7za8Click(Sender: TObject);
      procedure ButtonUn7za8MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ButtonUn7za9Click(Sender: TObject);
      procedure cbadvf1Click(Sender: TObject);
      procedure cbadvf2Click(Sender: TObject);
      procedure cbautoclosesingleextractClick(Sender: TObject);
      procedure cbcustextClick(Sender: TObject);
      procedure cbdefaultactionChange(Sender: TObject);
      procedure cbdeleteinputmode1Change(Sender: TObject);
      procedure cbdeleteinputmodeChange(Sender: TObject);
      procedure cbencextClick(Sender: TObject);
      procedure cbEncoding1Change(Sender: TObject);
      procedure cbensmallChange(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 cbSys7zlinChange(Sender: TObject);
      procedure cbtimecreatedClick(Sender: TObject);
      procedure cbtreeChange(Sender: TObject);
      procedure cbspacingChange(Sender: TObject);
      procedure cbzoomingChange(Sender: TObject);
      procedure CheckBox1Click(Sender: TObject);
      procedure CheckBox2Click(Sender: TObject);
      procedure CheckBox3Click(Sender: TObject);
      procedure CheckBox7zunrar5Click(Sender: TObject);
      procedure CheckBoxAccentToolBarChange(Sender: TObject);
      procedure CheckBoxACClick(Sender: TObject);
      procedure CheckBoxAltBarChange(Sender: TObject);
      procedure CheckBoxAltTabChange(Sender: TObject);
      procedure CheckBoxAlttabcolChange(Sender: TObject);
      procedure CheckBoxARC3Click(Sender: TObject);
      procedure CheckBoxArchive4Click(Sender: TObject);
      procedure CheckBoxAutoExtTar1Click(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 CheckBoxConvert0Change(Sender: TObject);
      procedure CheckBoxConvert1Change(Sender: TObject);
      procedure CheckBoxConvertChange(Sender: TObject);
      procedure CheckBoxDateClick(Sender: TObject);
      procedure CheckBoxDeleteInput1Click(Sender: TObject);
      procedure CheckBoxDeleteInputClick(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 CheckBoxFolder1Click(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 CheckBoxMQSClick(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 CheckBoxsni1Click(Sender: TObject);
      procedure CheckBoxsniClick(Sender: TObject);
      procedure CheckBoxsnlClick(Sender: TObject);
      procedure CheckBoxsnoiClick(Sender: TObject);
      procedure CheckBoxsnonClick(Sender: TObject);
      procedure CheckBoxsns1Click(Sender: TObject);
      procedure CheckBoxsnsClick(Sender: TObject);
      procedure CheckBoxsnz1Click(Sender: TObject);
      procedure CheckBoxSolidAddressChange(Sender: TObject);
      procedure CheckBoxsspClick(Sender: TObject);
      procedure CheckBoxstlClick(Sender: TObject);
      procedure CheckBoxARC2Click(Sender: TObject);
      procedure CheckBoxAutoOpenClick(Sender: TObject);
      procedure CheckBoxClipClick(Sender: TObject);
      procedure CheckBoxEncodingClick(Sender: TObject);
      procedure CheckBoxFolderClick(Sender: TObject);
      procedure CheckBoxJobEncodingClick(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 CheckGroupM2ItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupW1ItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupWItemClick(Sender: TObject; Index: integer);
      procedure ColorButton2ColorChanged(Sender: TObject);
      procedure ColorButton3ColorChanged(Sender: TObject);
      procedure ComboBox1Change(Sender: TObject);
      procedure ComboBoxArchive2Change(Sender: TObject);
      procedure ComboBoxArchive3CloseUp(Sender: TObject);
      procedure ComboBoxArchive4CloseUp(Sender: TObject);
      procedure ComboBoxArchive9CloseUp(Sender: TObject);
      procedure ComboBoxBrowserChange(Sender: TObject);
      procedure ComboBoxDragChange(Sender: TObject);
      procedure ComboBoxKiBChange(Sender: TObject);
      procedure ComboBoxLanguageCloseUp(Sender: TObject);
      procedure ComboBoxMaxArgChange(Sender: TObject);
      procedure ComboBoxmemuseChange(Sender: TObject);
      procedure ComboBoxPriorityChange(Sender: TObject);
      procedure ComboBoxSyntaxLevelChange(Sender: TObject);
      procedure ComboBoxTAR1Change(Sender: TObject);
      procedure ComboBoxTARChange(Sender: TObject);
      procedure ComboBoxWDChange(Sender: TObject);
      procedure ComboBoxARC2Change(Sender: TObject);
      procedure ComboBoxArchive7Change(Sender: TObject);
      procedure ComboBoxArchive8Change(Sender: TObject);
      procedure ComboBoxArchiveAct1Change(Sender: TObject);
      procedure ComboBoxArchiveActChange(Sender: TObject);
      procedure ComboBoxLibreChange(Sender: TObject);
      procedure ComboBoxprivacyChange(Sender: TObject);
      procedure ComboBoxSDChange(Sender: TObject);
      procedure comboRARdictChange(Sender: TObject);
      procedure ctrlarcClick(Sender: TObject);
      procedure ctrlextClick(Sender: TObject);
      procedure ctrlhistoryClick(Sender: TObject);
      procedure DateEdit1Change(Sender: TObject);
      procedure DateEdit2Change(Sender: TObject);
      procedure DateEdit3Change(Sender: TObject);
      procedure DateEdit4Change(Sender: TObject);
      procedure Edit5Change(Sender: TObject);
      procedure EditOpenIn1Exit(Sender: TObject);
      procedure EditOpenIn1KeyPress(Sender: TObject; var Key: char);
      procedure EditOpenIn1KeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure EditOpenInChange(Sender: TObject);
      procedure EditOpenOutChange(Sender: TObject);
      procedure EditUn7zaFilter1KeyPress(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 extalllastClick(Sender: TObject);
      procedure fextallfav2Click(Sender: TObject);
      procedure fextallfav3Click(Sender: TObject);
      procedure fextallfav4Click(Sender: TObject);
      procedure fextallfav5Click(Sender: TObject);
      procedure fextallfav6Click(Sender: TObject);
      procedure fextallfav7Click(Sender: TObject);
      procedure fextallfav8Click(Sender: TObject);
      procedure fextallfav1Click(Sender: TObject);
      procedure fextalldefaultClick(Sender: TObject);
      procedure fextalltoClick(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 LabelWDClick(Sender: TObject);
      procedure LabelAddFilesClick(Sender: TObject);
      procedure LabelAddFolderClick(Sender: TObject);
      procedure Labelcb19Click(Sender: TObject);
      procedure LabelColPresetsClick(Sender: TObject);
      procedure LabelConfigurePwClick(Sender: TObject);
      procedure LabelDefaultColor3Click(Sender: TObject);
      procedure LabellightpresetsClick(Sender: TObject);
      procedure LabelErrorsClick(Sender: TObject);
      procedure LabelmoreoptClick(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 lightdimClick(Sender: TObject);
      procedure lightgraphiteClick(Sender: TObject);
      procedure lightmochaClick(Sender: TObject);
      procedure lightplumClick(Sender: TObject);
      procedure lightsenapeClick(Sender: TObject);
      procedure ListView1ContextPopup(Sender: TObject; MousePos: TPoint;
        var Handled: Boolean);
      procedure ListView1MouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure lsetdefaultout_arcClick(Sender: TObject);
      procedure lsetdefaultout_extClick(Sender: TObject);
      procedure mautoadjustClick(Sender: TObject);
      procedure mBenchpeaClick(Sender: TObject);
      procedure mbgnome4Click(Sender: TObject);
      procedure mbgnomeClick(Sender: TObject);
      procedure mbkdeClick(Sender: TObject);
      procedure mbmacClick(Sender: TObject);
      procedure mbrowsercaccessedClick(Sender: TObject);
      procedure mbrowserccommentClick(Sender: TObject);
      procedure mbrowserccreatedClick(Sender: TObject);
      procedure mbrowsercmethodClick(Sender: TObject);
      procedure mbtextClick(Sender: TObject);
      procedure mcaccessedClick(Sender: TObject);
      procedure marcoptClick(Sender: TObject);
      procedure mccommentClick(Sender: TObject);
      procedure mccreatedClick(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 mfunaddClick(Sender: TObject);
      procedure MenuItemShowColMenuClick(Sender: TObject);
      procedure MenuItemToggleNavClick(Sender: TObject);
      procedure mfunconvertClick(Sender: TObject);
      procedure mfunextractClick(Sender: TObject);
      procedure mlargeiconsClick(Sender: TObject);
      procedure mpeachangelogClick(Sender: TObject);
      procedure mpeatosClick(Sender: TObject);
      procedure mswaptabClick(Sender: TObject);
      procedure mtranslationsfaqClick(Sender: TObject);
      procedure Panelnav4Click(Sender: TObject);
      procedure Panelnav4MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure pmbccpClick(Sender: TObject);
      procedure pmbcnwClick(Sender: TObject);
      procedure pmbcpsClick(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 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 menupwClick(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 MenuItemOpen_saveascsvClick(Sender: TObject);
      procedure mfilterbrowserClick(Sender: TObject);
      procedure MenuItemColBeosClick(Sender: TObject);
      procedure MenuItemColMintClick(Sender: TObject);
      procedure MenuItemColUbuntuClick(Sender: TObject);
      procedure MenuItemColWindowsClick(Sender: TObject);
      procedure menuitemopendocumentsClick(Sender: TObject);
      procedure menuitemopendownloadsClick(Sender: TObject);
      procedure mloadlayoutClick(Sender: TObject);
      procedure mprofileimmediateClick(Sender: TObject);
      procedure msamplescriptsClick(Sender: TObject);
      procedure msavelayoutClick(Sender: TObject);
      procedure mTypeClick(Sender: TObject);
      procedure owrunClick(Sender: TObject);
      procedure pmr_filesClick(Sender: TObject);
      procedure pmr_renClick(Sender: TObject);
      procedure pmsaveascsvClick(Sender: TObject);
      procedure pmshowsearchClick(Sender: TObject);
      procedure powRunClick(Sender: TObject);
      procedure po_browserccommentClick(Sender: TObject);
      procedure po_cinnamonsettClick(Sender: TObject);
      procedure po_clipClick(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 MenuItemOpen_runClick(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 mtencClick(Sender: TObject);
      procedure MenuItemExtAllHereNewClick(Sender: TObject);
      procedure MenuItemExtAllHereSmartClick(Sender: TObject);
      procedure MenuItemTextEncodingClick(Sender: TObject);
      procedure mextallherenewClick(Sender: TObject);
      procedure mextallheresmartClick(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 mprofilealtarcClick(Sender: TObject);
      procedure mprofilebetterzpaqClick(Sender: TObject);
      procedure mprofilebrotliClick(Sender: TObject);
      procedure mprofileextremezpaqClick(Sender: TObject);
      procedure mprofile7zfastestClick(Sender: TObject);
      procedure mprofileloadClick(Sender: TObject);
      procedure mprofilerarClick(Sender: TObject);
      procedure mprofilesaveClick(Sender: TObject);
      procedure mprofilezipbz2Click(Sender: TObject);
      procedure mprofilezstdClick(Sender: TObject);
      procedure msavecompsettingsClick(Sender: TObject);
      procedure mtabsClick(Sender: TObject);
      procedure mtogglesidebarClick(Sender: TObject);
      procedure mtoggletabbarClick(Sender: TObject);
      procedure mtoggletoolbarClick(Sender: TObject);
      procedure PanelClickAddressMouseEnter(Sender: TObject);
      procedure pcustmakecabClick(Sender: TObject);
      procedure pmhtabsClick(Sender: TObject);
      procedure pmmorecommentClick(Sender: TObject);
      procedure pmmorelockClick(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 pmstyle2Click(Sender: TObject);
      procedure pmstyle3Click(Sender: TObject);
      procedure pmstyle4Click(Sender: TObject);
      procedure pmstyle5Click(Sender: TObject);
      procedure pmstyle6Click(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 pmtextencClick(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_commentClick(Sender: TObject);
      procedure po_hostnameClick(Sender: TObject);
      procedure po_ipconfigClick(Sender: TObject);
      procedure po_lockClick(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 RadioGroup3Change(Sender: TObject);
      procedure seRARrrChange(Sender: TObject);
      procedure ShellTreeView1MouseEnter(Sender: TObject);
      procedure SpinEditArchive1Change(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 iadvextractClick(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 ImageFlatClick(Sender: TObject);
      procedure ImageInfoArchive3Click(Sender: TObject);
      procedure ImageInfoArchive4Click(Sender: TObject);
      procedure ImageInfoArchive5Click(Sender: TObject);
      procedure ImageInfoArchive6Click(Sender: TObject);
      procedure ImageInfoDefault1Click(Sender: TObject);
      procedure ImageInfoDefault2Click(Sender: TObject);
      procedure ImageListRootMouseEnter(Sender: TObject);
      procedure ImageListRootMouseLeave(Sender: TObject);
      procedure ImageListSearch1Click(Sender: TObject);
      procedure ImageListSearch1MouseEnter(Sender: TObject);
      procedure ImageListSearch1MouseLeave(Sender: TObject);
      procedure ImageListSearchDblClick(Sender: TObject);
      procedure ImageListSearchMouseEnter(Sender: TObject);
      procedure ImageListSearchMouseLeave(Sender: TObject);
      procedure Imageopenadvf1Click(Sender: TObject);
      procedure Imageopenadvf2Click(Sender: TObject);
      procedure ImageopenadvfClick(Sender: TObject);
      procedure ImagePassword1Click(Sender: TObject);
      procedure Button1Click(Sender: TObject);
      procedure ButtonArchiveClick(Sender: TObject);
      procedure ButtonEditNameCustomClick(Sender: TObject);
      procedure ButtonUn7za1Click(Sender: TObject);
      procedure ButtonUn7za4Click(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 ImagePassword2Click(Sender: TObject);
      procedure LabelAppPathClick(Sender: TObject);
      procedure Labelcb17Click(Sender: TObject);
      procedure Labelcb7Click(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 LabelConf1Click(Sender: TObject);
      procedure LabelConfigurePeaZipClick(Sender: TObject);
      procedure LabelConfigureSendToClick(Sender: TObject);
      procedure LabelLang2Click(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 LabelStatus5Click(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 ListView1Click(Sender: TObject);
      procedure ListView1ColumnClick(Sender: TObject; Column: TListColumn);
      procedure ListView1DblClick(Sender: TObject);
      procedure ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
        State: TDragState; var Accept: Boolean);
      procedure ListView1KeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure ListView1KeyPress(Sender: TObject; var Key: char);
      procedure ListView1KeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure ListView1MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ListView1MouseEnter(Sender: TObject);
      procedure ListView1MouseLeave(Sender: TObject);
      procedure ListView1MouseMove(Sender: TObject; Shift: TShiftState; X,
        Y: Integer);
      procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
        Selected: Boolean);
      procedure ListView1StartDrag(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 MenuItemOpen_saveastxtClick(Sender: TObject);
      procedure mextractClick(Sender: TObject);
      procedure maddconvertClick(Sender: TObject);
      procedure maddexistingClick(Sender: TObject);
      procedure mf4Click(Sender: TObject);
      procedure mlayoutsClick(Sender: TObject);
      procedure morgbookmarksClick(Sender: TObject);
      procedure morghistoryClick(Sender: TObject);
      procedure morgsessionhistoryClick(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 mAdminClick(Sender: TObject);
      procedure madvfiltersClick(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 mbackaliasClick(Sender: TObject);
      procedure mbackClick(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 mbrowsercattClick(Sender: TObject);
      procedure mbrowserccrcClick(Sender: TObject);
      procedure mbrowsercdateClick(Sender: TObject);
      procedure mbrowsercnameClick(Sender: TObject);
      procedure mbrowsercpackedClick(Sender: TObject);
      procedure mbrowsercsizeClick(Sender: TObject);
      procedure mbrowserctypeClick(Sender: TObject);
      procedure mbrowsersizelClick(Sender: TObject);
      procedure mbrowsersizemClick(Sender: TObject);
      procedure mbrowsersizesClick(Sender: TObject);
      procedure mcancelClick(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 mctrlf3Click(Sender: TObject);
      procedure mctrlf8Click(Sender: TObject);
      procedure mdefaultarchiveClick(Sender: TObject);
      procedure mdetailsClick(Sender: TObject);
      procedure mctypeClick(Sender: TObject);
      procedure mPeaFAQClick(Sender: TObject);
      procedure mPeaSiteMirrorClick(Sender: TObject);
      procedure MenuItemArchive_dropboxClick(Sender: TObject);
      procedure MenuItemArchive_googledriveClick(Sender: TObject);
      procedure MenuItemArchive_musicClick(Sender: TObject);
      procedure MenuItemArchive_myboxfilesClick(Sender: TObject);
      procedure MenuItemArchive_picturesClick(Sender: TObject);
      procedure MenuItemArchive_onedriveClick(Sender: TObject);
      procedure MenuItemArchive_skydriveClick(Sender: TObject);
      procedure MenuItemArchive_ubuntuoneClick(Sender: TObject);
      procedure MenuItemArchive_videosClick(Sender: TObject);
      procedure MenuItemEnumerateClick(Sender: TObject);
      procedure menuitemopenhomeClick(Sender: TObject);
      procedure MenuItemOpen_dropboxClick(Sender: TObject);
      procedure MenuItemOpen_googledriveClick(Sender: TObject);
      procedure MenuItemOpen_musicClick(Sender: TObject);
      procedure MenuItemOpen_myboxfilesClick(Sender: TObject);
      procedure MenuItemOpen_organizebookmarksClick(Sender: TObject);
      procedure MenuItemOpen_picturesClick(Sender: TObject);
      procedure MenuItemOpen_powershellClick(Sender: TObject);
      procedure MenuItemOpen_onedriveClick(Sender: TObject);
      procedure MenuItemOpen_skydriveClick(Sender: TObject);
      procedure MenuItemOpen_ubuntuoneClick(Sender: TObject);
      procedure MenuItemOpen_videosClick(Sender: TObject);
      procedure MenuItemPowerShellClick(Sender: TObject);
      procedure mfwdClick(Sender: TObject);
      procedure mPeaSupportClick(Sender: TObject);
      procedure mpeautilsClick(Sender: TObject);
      procedure mprelistClick(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 mtoggletbribClick(Sender: TObject);
      procedure mtstyle_frameClick(Sender: TObject);
      procedure mtstyle_noneClick(Sender: TObject);
      procedure mtstyle_shadowClick(Sender: TObject);
      procedure munpeaextractClick(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 Panelnav5Click(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 pmbcexploreClick(Sender: TObject);
      procedure pmbcorganizebookmarksClick(Sender: TObject);
      procedure pmbcpropertiesClick(Sender: TObject);
      procedure pmbcwebClick(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 mpreaverageClick(Sender: TObject);
      procedure mpredetailsClick(Sender: TObject);
      procedure mprelargeClick(Sender: TObject);
      procedure mprelightClick(Sender: TObject);
      procedure mprelightlistClick(Sender: TObject);
      procedure mpretoggleClick(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 pmmorepreviewClick(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 pmqjmyboxfilesClick(Sender: TObject);
      procedure pmqjonedriveClick(Sender: TObject);
      procedure pmqjskydriveClick(Sender: TObject);
      procedure pmqjubuntuoneClick(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 MenuItemopendesktopClick(Sender: TObject);
      procedure MenuItemOrganizeNavbarClick(Sender: TObject);
      procedure MenuItemOrganizeStatusbarClick(Sender: TObject);
      procedure MenuItemOrganizeToolbarClick(Sender: TObject);
      procedure MenuItemPropertiesClick(Sender: TObject);
      procedure mfullscreenClick(Sender: TObject);
      procedure mimmersiveClick(Sender: TObject);
      procedure mjob2Click(Sender: TObject);
      procedure mJobClick(Sender: TObject);
      procedure mobClick(Sender: TObject);
      procedure moblClick(Sender: TObject);
      procedure mobrClick(Sender: TObject);
      procedure modefaultClick(Sender: TObject);
      procedure molClick(Sender: TObject);
      procedure morClick(Sender: TObject);
      procedure motClick(Sender: TObject);
      procedure motlClick(Sender: TObject);
      procedure motrClick(Sender: TObject);
      procedure mpmClick(Sender: TObject);
      procedure mPropertiesClick(Sender: TObject);
      procedure mpw2Click(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 msorttoggleClick(Sender: TObject);
      procedure mthumbimagesClick(Sender: TObject);
      procedure mtogglenavbarClick(Sender: TObject);
      procedure mtoggleopClick(Sender: TObject);
      procedure mtogglestatusbarClick(Sender: TObject);
      procedure mttoggletoolbarClick(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 MenuItemOrganizeMbarClick(Sender: TObject);
      procedure MenuItemArchive_pubdocClick(Sender: TObject);
      procedure MenuItemArchive_pubhomeClick(Sender: TObject);
      procedure MenuItemOpen_pubdocClick(Sender: TObject);
      procedure MenuItemOpen_pubhomeClick(Sender: TObject);
      procedure MenuItemOpen_searchClick(Sender: TObject);
      procedure mextalldesktopClick(Sender: TObject);
      procedure mextalldocumentsClick(Sender: TObject);
      procedure mextallhereClick(Sender: TObject);
      procedure mextalltoClick(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 mextractarchiveClick(Sender: TObject);
      procedure MenuItemArchive_documents1Click(Sender: TObject);
      procedure MenuItemArchive_home1Click(Sender: TObject);
      procedure MenuItemextexploreClick(Sender: TObject);
      procedure MenuItemOpen_LastClick(Sender: TObject);
      procedure mf8Click(Sender: TObject);
      procedure mgoextlayoutClick(Sender: TObject);
      procedure mgotype7zClick(Sender: TObject);
      procedure mgotype7zsfxClick(Sender: TObject);
      procedure mgotypebz2Click(Sender: TObject);
      procedure mgotypegzClick(Sender: TObject);
      procedure mgotypetarClick(Sender: TObject);
      procedure mgotypezipClick(Sender: TObject);
      procedure mLangClick(Sender: TObject);
      procedure mlistClick(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 msetpwClick(Sender: TObject);
      procedure mshiftf3Click(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 MenuItemRefreshClick(Sender: TObject);
      procedure mf2Click(Sender: TObject);
      procedure mf3Click(Sender: TObject);
      procedure mf4upClick(Sender: TObject);
      procedure mpeahelpofflineClick(Sender: TObject);
      procedure mRecent9Click(Sender: TObject);
      procedure mshiftf8Click(Sender: TObject);
      procedure mshowmenuClick(Sender: TObject);
      procedure msmalliconClick(Sender: TObject);
      procedure mswapbarsClick(Sender: TObject);
      procedure mSystemIntegrationClick(Sender: TObject);
      procedure mthlClick(Sender: TObject);
      procedure mtogglenewClick(Sender: TObject);
      procedure mTrayClick(Sender: TObject);
      procedure mTutorialClick(Sender: TObject);
      procedure munsearchClick(Sender: TObject);
      procedure mUserClick(Sender: TObject);
      procedure mwebsearchClick(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 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 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 pmjumplibrariesClick(Sender: TObject);
      procedure pmjumppubdocClick(Sender: TObject);
      procedure pmjumppubhomeClick(Sender: TObject);
      procedure pmjumprecentClick(Sender: TObject);
      procedure pmjumpsearchClick(Sender: TObject);
      procedure pmjumpsearchesClick(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_flatClick(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_previewClick(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_selectallClick(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 mRefreshClick(Sender: TObject);
      procedure CheckBox4Click(Sender: TObject);
      procedure CheckBoxARC1Click(Sender: TObject);
      procedure CheckBoxArchiveHistoryClick(Sender: TObject);
      procedure CheckBoxArchiveOFClick(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 ComboBoxARCChange(Sender: TObject);
      procedure ComboBoxArchive1Change(Sender: TObject);
      procedure ComboBoxArcSolidChange(Sender: TObject);
      procedure ComboBoxPAQ1Change(Sender: TObject);
      procedure ComboBoxPEA2Change(Sender: TObject);
      procedure ComboBoxPEA3Change(Sender: TObject);
      procedure ComboBoxPEA4Change(Sender: TObject);
      procedure ComboBoxPEACompression1Change(Sender: TObject);
      procedure ComboBoxSplit3Change(Sender: TObject);
      procedure ComboBoxThemeChange(Sender: TObject);
      procedure ComboBoxUPXChange(Sender: TObject);
      procedure ctrlbackClick(Sender: TObject);
      procedure ctrlfwdClick(Sender: TObject);
      procedure ctrlupClick(Sender: TObject);
      procedure EditUn7zaFilterKeyPress(Sender: TObject; var Key: char);
      procedure FormCreate(Sender: TObject);
      procedure FormDropFiles(Sender: TObject; const FileNames: array of String
        );
      procedure iConsoleCreateImport1Click(Sender: TObject);
      procedure iConsoleCreateImportClick(Sender: TObject);
      procedure Image7zPj1Click(Sender: TObject);
      procedure Image7zPj3Click(Sender: TObject);
      procedure Image7zPjClick(Sender: TObject);
      procedure ImageDefaults2Click(Sender: TObject);
      procedure ImageListRootClick(Sender: TObject);
      procedure ImageListSearchClick(Sender: TObject);
      procedure ImagePasswordClick(Sender: TObject);
      procedure ImageUn7zPjClick(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_backClick(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_fwdClick(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_rootClick(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 mFlatClick(Sender: TObject);
      procedure mInvertSelectionClick(Sender: TObject);
      procedure mKeyFileClick(Sender: TObject);
      procedure mOptionsClick(Sender: TObject);
      procedure mPEAClick(Sender: TObject);
      procedure mPSELargerClick(Sender: TObject);
      procedure mPSEqualClick(Sender: TObject);
      procedure mPSESmallerClick(Sender: TObject);
      procedure mPSLargerClick(Sender: TObject);
      procedure mPSSmallerClick(Sender: TObject);
      procedure mQuitClick(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 mSelectAllClick(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 pmJumpArchiveClick(Sender: TObject);
      procedure pmJumpPathClick(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 RadioGroup0Change(Sender: TObject);
      procedure RadioGroup1Change(Sender: TObject);
      procedure RadioGroup2Change(Sender: TObject);
      procedure RadioGroup4Change(Sender: TObject);
      procedure RadioGroup6Change(Sender: TObject);
      procedure RadioGroupAction1Change(Sender: TObject);
      procedure RadioGroupActionArcChange(Sender: TObject);
      procedure RadioGroupActionChange(Sender: TObject);
      procedure RadioGroupBrowserChange(Sender: TObject);
      procedure RadioGroupPaqClick(Sender: TObject);
      procedure RadioGrouppwrequestChange(Sender: TObject);
      procedure RadioGroupQuadClick(Sender: TObject);
      procedure RadioGroupTSChange(Sender: TObject);
      procedure schedaddschedule1Change(Sender: TObject);
      procedure schedaddscheduleChange(Sender: TObject);
      procedure scheduleend1Change(Sender: TObject);
      procedure scheduleendChange(Sender: TObject);
      procedure schedulestart1Change(Sender: TObject);
      procedure schedulestartChange(Sender: TObject);
      procedure scheduleuser1Change(Sender: TObject);
      procedure scheduleuserChange(Sender: TObject);
      procedure ShellTreeView1CustomDraw(Sender: TCustomTreeView;
        const ARect: TRect; var DefaultDraw: Boolean);
      procedure ShellTreeView1KeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure ShellTreeView1MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure ShellTreeView1MouseMove(Sender: TObject; Shift: TShiftState; X,
        Y: Integer);
      procedure ShellTreeView1MouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure SpinEdit1Change(Sender: TObject);
      procedure Splitter1Moved(Sender: TObject);
      procedure Splitter2Moved(Sender: TObject);
      procedure Splitter3Moved(Sender: TObject);
      procedure StringGrid1DblClick(Sender: TObject);
      procedure StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
        aRect: TRect; aState: TGridDrawState);
      procedure StringGrid1HeaderClick(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGrid1HeaderSized(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGrid1KeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGrid1KeyPress(Sender: TObject; var Key: char);
      procedure StringGrid1KeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGrid1MouseDown(Sender: TOBject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGrid1MouseUp(Sender: TOBject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGrid2DblClick(Sender: TObject);
      procedure StringGrid2DrawCell(Sender: TObject; aCol, aRow: Integer;
        aRect: TRect; aState: TGridDrawState);
      procedure StringGrid2HeaderClick(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGrid2HeaderSized(Sender: TObject; IsColumn: Boolean;
        Index: Integer);
      procedure StringGrid2KeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGrid2KeyPress(Sender: TObject; var Key: char);
      procedure StringGrid2KeyUp(Sender: TObject; var Key: Word;
        Shift: TShiftState);
      procedure StringGrid2MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure StringGrid2MouseUp(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 StringGridCustEdit1ColRowMoved(Sender: TObject;
        IsColumn: Boolean; sIndex, tIndex: Integer);
      procedure StringGridCustEdit1DblClick(Sender: TObject);
      procedure StringGridCustEdit1MouseDown(Sender: TObject;
        Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
      procedure StringGridCustEdit1SelectCell(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 theme_label1Click(Sender: TObject);
      procedure themesave_labelClick(Sender: TObject);
      procedure Timer1Timer(Sender: TObject);
      procedure Timer2Timer(Sender: TObject);
      procedure Timer3StartTimer(Sender: TObject);
      procedure Timer3Timer(Sender: TObject);
      procedure Timer4Timer(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 TrayIcon1Click(Sender: TObject);
      procedure TrayIcon1DblClick(Sender: TObject);
      procedure TreeView1ContextPopup(Sender: TObject; MousePos: TPoint;
        var Handled: Boolean);
      procedure TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure TreeView1MouseEnter(Sender: TObject);
      procedure TreeView1MouseUp(Sender: TObject; Button: TMouseButton;
        Shift: TShiftState; X, Y: Integer);
      procedure w7contextlangClick(Sender: TObject);
   private
      { private declarations }
   public
      { public declarations }
   end;

{$IFDEF MSWINDOWS}
type //used for file properties
   TSHMultiFileProperties = function(pDataObj: IDataObject; Flag: DWORD): HRESULT;
   stdcall;

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}

function dragtowin(var dragdest:ansistring):integer;
function cleardir(var s:ansistring; cleardirname,force_skip_ptmpcode:boolean):integer;
function ask_pwkeyfile:integer;
procedure hideconfirmation;
procedure showconfirmation;
function launch_cl(cl,jobcode,outname:ansistring):integer;
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 setoutname(var s:ansistring; i:integer):integer;
function control_outpath(var out_param:ansistring):integer;
function testencrypted:integer;
function testencrypted_open:integer;
function checklistsel:integer;
function checklistanysel:integer;
function checklisttotsel(var nsel:integer; var strsel:ansistring):integer;
function gettreeicon(sg:TStringGrid; arow:integer):integer;
function getpcmenuicon(b:TBitmap):integer;
function setpcmenuicon(i:integer):TBitmap;
procedure calcseltsize;
procedure browsehistoryn(n:integer);
procedure jumpto(jumpdest:ansistring);
procedure launch_rsearch;
procedure launch_nrsearch;
procedure launch_rrsearch;
procedure listdir(s:ansistring; recmode,treemode:boolean);
procedure list_toextractor(act,modeofuse:ansistring);
procedure navrefresh;
procedure navgoup;
procedure rsearch;
procedure setquickextractmenu;
procedure update_listview;
procedure ComboBoxArchive4_onchange;
procedure run_websearch(s:ansistring);
procedure quickextract(dest:ansistring);
procedure toggle_view;
procedure peazipreset;
procedure peaziptotalreset;
procedure enter_busy_status;
procedure exit_busy_status;
procedure eraseselected_list(erasemode:integer);
procedure loadpm;
procedure setpm(pmfun:integer);
procedure on_checkboxseparateclick;
procedure ComboBoxArchive1_onchange;
procedure openappn(n:integer);
procedure openadvappn(n:integer);
procedure websearch_sel;
procedure settoolbar;
procedure populatefunmenu;
procedure do_forcerefresh;
procedure do_organizebookmarks;
procedure settonewfolder(i:integer);
procedure on_buttonarchiveclick;
procedure on_buttonextokclick;
procedure navgoback;
procedure navgofwd;
procedure setrecenticons_extract_archive;
procedure browser_explorepath(iscontext:integer);
procedure openwith_peazipnew(iscontext:integer; s:ansistring);
procedure browser_commandprompt(iscontext,isps:integer; s_in:ansistring);
procedure browser_fileproperties(s_in:ansistring);
procedure get_statuss(s:ansistring);
procedure updatecontent_ext;
procedure archivemenu_name(pathpart:ansistring);
procedure load_bookmarks;
function importjobcl(var cl,jobcode,outname:ansistring):integer;
function importjobcl_extract(var cl,jobcode,outname:ansistring):integer;
procedure on_checkboxsamearcclick;
procedure on_checkboxsameextclick;
procedure restartpeaapp;
procedure restartclosepeaapp;
procedure saverestartclosepeaapp;
procedure imgshelltree;
procedure do_pmfun(capt:ansistring);
procedure settpreset(i:integer);
procedure getscheduledtaskname(stype:integer);
procedure ComboBoxTheme_onchange;
procedure setwindowsopacity;
procedure setpanel_extract(ipanel:integer);
procedure populatetree2;
procedure setpanel_add(ipanel:integer);
procedure rename_files(mode:ansistring);
procedure extraction_checkintermediatedir(var outname:ansistring; optype:ansistring);
procedure advancedselect;
procedure select_all(allnone:ansistring);
procedure kp_EditUn7zaFilter1;
procedure kp_EditUn7zaFilter1_nr;
procedure exit_withsave;
procedure exit_nosave;
function wingetdesk:integer;
procedure set_listview_col;
procedure do_resetsearch;
procedure erase_fromname_list(erasemode:integer; s_in:ansistring);
procedure peazip_browse;
procedure setbrowserch(i:integer);
function gettabname(nrow:integer):ansistring;
function drawtabicon(arow:integer):integer;
procedure setupdatecontrols(encnt:boolean);
procedure get_unique_name(var out_param:ansistring);
procedure browsehistory;
procedure syncedit_archive;
procedure renamefileinarchive(nameold,namenew:ansistring;cleardestname:boolean);
procedure peaziplanguage(s: ansistring);
procedure finishlistview;
procedure erase_fromname(ptype:ansistring; var in_param:ansistring);
procedure grid_obj_open;
procedure newextclick;
procedure smartextclick;
procedure load_presetsnames;
procedure update_info;
procedure testrarlocked;
function geticon(fullname,fulltype:ansistring; pc:boolean):integer;
function checkaltdest(outname:ansistring):ansistring;
procedure moveafterextract(var outname:ansistring);
procedure erase_fromarchiving(erasemode:integer; executemode:integer; var cl:ansistring);
{$IFDEF MSWINDOWS}function fileop_fromnamelist(fnames: array of ansistring; fto:ansistring; fileopfun:integer; fileopflags:integer):integer;{$ENDIF}
procedure openwith_base(act,target:ansistring);
procedure openwith_cust(act,custmode:ansistring; j:integer);
procedure browsefiledir(s:ansistring);
procedure browse_special_cases;
procedure populatepcmenu;
procedure cancelbuttonextract;
procedure loadlist(sg:TStringGrid; listfilename:AnsiString);
procedure applypreset(presetname: ansistring);
procedure applycompsettings(settingsname: ansistring);
procedure do_calcstatus;
procedure do_calcstatusar;
procedure do_calcstatusex;
procedure updatelayout(enumdir:ansistring);
procedure untarafter(outname, inname:ansistring; var cl:ansistring; realuntar:boolean; optype:ansistring);
procedure set_dirbeforefiles(dmode:integer);
procedure update_addressbar(apath:ansistring);
function isarchiveeditable:integer;

const
  WS_EX_LAYERED = $80000;
  LWA_ALPHA     = $2;
  PEAZIPVERSION = '9.3';
  PEAZIPREVISION= '.0';
  SPECEXTCONST  = '001 bat exe htm html msi r01 z01';
  PREFALGOCONST = 'CRC32 CRC64 MD5 RIPEMD160 SHA1 BLAKE2S SHA256 SHA3_256';
  FIRSTDOM      = 'https://peazip.github.io/';
  SECONDDOM     = 'https://peazip.sourceforge.io/';
  HLIBRE_DIR    = 0; //hardcode "libre directive" 0 not hardcode, 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; //hardcode privacy_mode directive 0 not hardcode, read from configuration 1,2 hardcoded skippable or non skippable password request at startup, overriding configuration
  HBINPATH      = '';
  HCONFPATH     = '';
  HSHAREPATH    = '';
  MAXNDIRTREE   = 4096;
  DEFAULT_THEME = 'main-embedded';
  DLEFT         = 64;
  DTOP          = 64;
  DWIDTH        = 1024;
  DHEIGTH       = 600;
  DGWLEFT       = 92;
  DGWTOP        = 92;
  DGWWIDTH      = 640;
  DGWHEIGTH     = 320;
  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';
  APPLICATION1  = 'Pea 1.13 (LGPLv3, Giorgio Tani)';
  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';
  //PeaZip's folder in working directory, containing all temporary work files unless 1) set to be created in output 2) archive conversion, always run in output
  STR_PZWORKTMP = 'peazip-tmp';
  //temp app subfolder, where different peazip instances can exchange messages and data
  STR_PEAZIPTMP = '.pztmp';
  //temp subdirs, deleted as soon as possible by each instance during use
  STR_TMP       = '.ptmp';
  STR_STMP      = '.pstmp';//special preview
  STR_TMPEXT    = '.petmp';//interactive extraction
  STR_TMPDD     = '.pdtmp';//drag and drop extraction
  //temp files
  STR_TESTOUT   = '.ptestouttmp';
  STR_STOPALL   = '.pstopalltmp';
  STR_TMPDROPE  = '.pdropetmp';
  STR_TMPERRI   = '.perritmp';
  {$IFDEF MSWINDOWS}
  EXEEXT        = '.exe';
  UNRARNAME     = 'unrar';
  APPLICATION2  = '7z 23.01 (LGPL, Igor Pavlov), and Tino Reichardt sfx modules and codecs v1.5.4r4 (LGPL)';
  APPLICATION3  = 'PAQ8F/JD/L/O, LPAQ1/5/8, ZPAQ 7.15 [Matt Mahoney et al. (GPL)]';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.95 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser)';
  APPLICATION5  = 'QUAD 1.12 (LGPL) / BALZ 1.15 (Public Domain), BCM 1.0 (Public Domain) (Ilia Muraviev)';
  APPLICATION6  = 'UNACEV2.DLL 2.6.0.0 (royalty-free UNACEV2.DLL license, ACE Compression Software)';
  APPLICATION7  = 'FreeArc 0.67 alpha (GPL, Bulat Ziganshin)';
  APPLICATION8  = 'UNRAR 5.21 (freeware, royalty-free, source available with unrar restriction, Alexander Roshal)';
  APPLICATION9  = 'Brotli 1.0.7 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.5.2 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF LINUX}
  EXEEXT        = '';
  UNRARNAME     = 'unrar-nonfree';
  APPLICATION2  = 'Linux 7z 23.01 (LGPL, Igor Pavlov)';
  APPLICATION3  = 'PAQ8F/JD/L/O, LPAQ1/5/8, ZPAQ 7.05 [Matt Mahoney et al. (GPL)]';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.96 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser)';
  APPLICATION5  = 'QUAD 1.12 (LGPL) / BALZ 1.15(Public Domain), BCM 1.0 (Public Domain) (Ilia Muraviev)';
  APPLICATION6  = 'UNACE (royalty-free UNACE for Linux license, Marcel Lemke, ACE Compression Software)';
  APPLICATION7  = 'FreeArc 0.60 (GPL, Bulat Ziganshin)';
  APPLICATION8  = 'UNRAR 5.21 beta 2 (freeware, royalty-free, source available with unrar restriction, Alexander Roshal, Petr Cech)';
  APPLICATION9  = 'Brotli 1.0.9 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.5.2 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF FREEBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'BSD 7z 21.07 (LGPL, Igor Pavlov)';
  APPLICATION3  = '';
  APPLICATION4  = '';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = 'Brotli 1.0.9 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.4.8 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF NETBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'BSD 7z 21.07 (LGPL, Igor Pavlov)';
  APPLICATION3  = '';
  APPLICATION4  = '';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = 'Brotli 1.0.9 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.4.8 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF OPENBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'BSD 7z 21.07 (LGPL, Igor Pavlov)';
  APPLICATION3  = '';
  APPLICATION4  = '';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = 'Brotli 1.0.9 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.4.8 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF DARWIN}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'macOS 7z 23.01 (LGPL, Igor Pavlov)';
  APPLICATION3  = 'ZPAQ 7.15 [Matt Mahoney et al. (GPL)]';
  APPLICATION4  = 'Strip (GPL, GNU binutils)';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = 'Brotli 1.0.9 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.5.2 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}

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

   //scaling
   il16,ilsmall,il48,il96,il192: TImageList;
   qscale,qscaleimages,pspacing,pzooming,pspacingd,pzoomingd,ensmall,ensmalld,
   icon_sizeplus,reficonsize,baseiconsize,
   COL1D,COL2D,COL3D,COL4D,COL5D,COL6D,COL7D:integer;

   //address bar colors
   abactivecol,abarchivecol,tabpencol,tabbrushcol,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: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,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,vpaq2,vupx1,vupx2,vupx3,varc1,varc2,varc3,varc3b,varc4,varc5,varc6,varc8,vsplit1,vpea1,vpea2,vpea3,vpea4,vcustom4:integer;

   //status options
   vopt1,vopt1b,vopt1c,vopt7c,vopt12t,vopt19e,vopt19f,vopt5d3t,vopt5csv:ansistring;
   vopt2,vopt3,vopt4,vopt4b,vopt4c,vopt4d,vopt4e,vopt4f,vopt4g,vopt4h,vopt5,vopt5b,vopt5c,vopt5d,vopt5dt,vopt5d4,vopt5d1,vopt5d2,vopt5d3,vopt5e,
   vopt5f,vopt5f1,vopt5g,vopt5dup,vopt5gtar,vopt5gtar1,vopt5h,vopt5sw,vopt5ca,vopt6,vopt7,vopt7b,vopt8,vopt9,vopt10,vopt11,vopt12,voptlibre,
   voptprivacy,vopt13,voptts,vopt14,vopt15c,vopt15d,vopt15e,vopt15e2,vopt15f,vopt15g,vopt15h,vopt15i,vopt16,vopt17,vopt18,vopt18b,
   vopt19,vopt19b,vopt19c,vopt19d,vopt20,vopt20b,vopt21,vopt22,vopt22b,vopt23,vopt23b,vopt24,vopt24b,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;

   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,
   Bdvd_supported48,Bfd_supported48,BFolder48,Bhd_supported48,Bram_supported48,
   Bremote_supported48,Bremovable_supported48,Btxt48,Bspreadsheet48,Bvideo48,Baudio48,Bimage48,
   Bpresentation48,Bpdf48,Bsupported48,Bbat48,Bdll48,Bdb48,Bgif48,Bico48,Bvector48,Bjpeg48,BArchiveSupported48,
   BFileSupported48,BExesupported48,Bunsupported48,Blink48,Bweb48,Bmail48,
   Barc7z48,Barcrar48,Barczip48,Barcblock48,Barcdisk48,Barcinstaller48,
   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,Bbrowserdetails,Bbrowserlist,Bbrowsericons,Bbrowserdetailslarge,Bbrowserlistlarge,Bdownloadfolder,Bcloudfolder,Bhomefolder,Bbrowsericonslarge,
   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,Bnonthemed0,Bnonthemed1,Bnonthemed3,Bnonthemed4,Bnonthemed5,Bnonthemed6,
   Bnonthemed7,Bnonthemed8,Bnonthemed9,Bnonthemed10,Bnonthemed11,
   Bp1,Bp2,Bp3,Bp4,Bp5,Bp6,Bp7,Bp8,
   binfodlg,bwarningdlg,berrordlg: 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,usr_libraries,usr_downloads,usr_sendto,
   shared_dropbox,shared_googledrive,shared_onedrive,shared_skydrive,shared_ubuntuone,shared_myboxfiles,
   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,csvsep,origout,origoutnf,origouttf,origoutmf,
   prefixd,prefixf,prefixdaz,prefixdza,prefixfaz,alias7z: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,work_dir,prebrowse_dirs,prebrowse_records,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,prebrowsesize,smalliconsize,mediconsize,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,euns1,
   autosync,sys7zlin,i16res,i32res,i48res,i96res,tabheight,tablabelheight,tabheightl,pbarh,autoopentar,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:integer;

   ltime,stime:longint;

   ent_buffer: array [0..63] of byte;
   opacity,opacityd,df,pf,pobj,pcompr,pvol,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,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,
   extpw,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,jobdefenc,
   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,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:byte;

   call_validated,keyf_opened,no_more_files,
   using_tarbefore,tarbeforenameexception,seemencrypted,az,az1,az2,azbook,imgloaded,imgloading,
   settingvalues,archiveopened,browsinghistory,filecopying,openstarted,dragcancelled,
   listingdir,control_listingdir,done_listingexe,waitdrawok,needwaitupdating,updatingarchive_inarchive,goarchiving,updatingarchive_sync,
   stayopen,completeshowpea,savetype,pcmenupopulated,updatinglistview,updatingsel,rowselect,showmenu,enlargeicons,
   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,setsequenceerror,tmpextnf,settmpextnf,
   keeppreview,loadadvdefaults,havewinrar,singleextract,specialopen,pclicked,
   willbemoved,forcewillbemoved,forcenotwillbemoved,pdrop,prebrowsing,imported_tarbeforejob,darwinsimulatedrop: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;
   //used for transparence
   hUser32prop: HMODULE;
   SHMultiFileProperties: TSHMultiFileProperties;
   //drag and drop
   FDragObject:TDragObject;
   //semaphore
   psem,psemwait: THandle;
   {$ENDIF}

   lang_file:ansistring;
   //text strings
   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

{ TForm_peach }

function CloneMenuItem(Src: TMenuItem): TMenuItem;//generic cloning method modified for PeaZip's main menu as source
var
  i: Integer;
begin
  if Src=nil then Exit;
  Result:=TMenuItem.Create(Src.Owner);
  case Src.Name of
     'mfun0', 'mfun', 'mtoggletool', 'mbrowser', 'mLayout', 'mtogglesidebar', 'mtoggletoolbar', 'mtoggletabbar':
     begin
     Result.Visible:=false;
     Result.Enabled:=false;
     end;
  end;
  {$IFNDEF MSWINDOWS}
  case Src.Name of
     'mthumbimages', 'mscheduledscripts', 'mtaskscheduler', 'MenuItem11', 'mAdmin', 'mUser', 'MenuItem33', 'w7contextlang', 'mSystemIntegration':
     begin
     Result.Visible:=false;
     Result.Enabled:=false;
     end;
  end;
  {$ENDIF}
  Result.Caption:=Src.Caption;
  if Result.Caption='' then Result.Visible:=False;
  Result.OnClick:=Src.OnClick;
  Result.Tag:=Src.Tag;
  Result.Checked:=Src.Checked;
  Result.RadioItem:=Src.RadioItem;
  //Result.Visible:=Src.Visible;
  //Result.Enabled:=Src.Enabled;
  Result.Bitmap:=Src.Bitmap;
  for i:=0 to Src.Count-1 do
     Result.Add(CloneMenuItem(Src[i]));
end;

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

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

custom tabs

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

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

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

procedure enterlabel(var a: TLabel; var b:TShape);
begin
b.Brush.Color:=tabbrushhighcol;
b.Pen.Color:=tabpencol;
b.Pen.Style:=psSolid;
if alttabstyle=1 then a.Font.Style:=[fsUnderline] else 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 Form_peach do
begin
exitlabel_add(LabelTitleAdd1,ShapeTitleAddb1);
exitlabel_add(LabelTitleAdd2,ShapeTitleAddb2);
exitlabel_add(LabelTitleAdd3,ShapeTitleAddb3);
exitlabel_add(LabelTitleAdd4,ShapeTitleAddb4);
end;
end;

procedure setlabelpanel_add(var a: Tlabel);
begin
with Form_peach 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 Form_peach do
begin
exitlabel_extract(LabelTitleextract1,ShapeTitleextractb1);
exitlabel_extract(LabelTitleextract2,ShapeTitleextractb2);
exitlabel_extract(LabelTitleextract3,ShapeTitleextractb3);
exitlabel_extract(LabelTitleextract4,ShapeTitleextractb4);
end;
end;

procedure setlabelpanel_extract(var a: Tlabel);
begin
with Form_peach 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 Form_peach do
begin
exitlabel_apps(LabelTitleapps1,ShapeTitleAppsb1);
exitlabel_apps(LabelTitleapps2,ShapeTitleAppsb2);
end;
end;

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

procedure setlabelpanel_apps(var a: Tlabel);
begin
with Form_peach 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: TPanel);
begin
if activelabel_options=a then exit;
if ((highlighttabs=4) or (highlighttabs=5)) then a.Font.Color:=clDefault else a.Font.Color:=pGray;
b.Color:=Form_peach.PanelTitleOptions.Color;
end;

procedure deselectlabels_options;
begin
with Form_peach do
begin
exitlabel_options(LabelTitleoptions1,BevelTitleoptions1);
exitlabel_options(LabelTitleoptions2,BevelTitleoptions2);
exitlabel_options(LabelTitleoptions3,BevelTitleoptions3);
exitlabel_options(LabelTitleoptions4,BevelTitleoptions4);
exitlabel_options(LabelTitleoptions5,BevelTitleoptions5);
exitlabel_options(LabelTitleoptions6,BevelTitleoptions6);
exitlabel_options(LabelTitleoptions7,BevelTitleoptions7);
exitlabel_options(LabelTitleoptions8,BevelTitleoptions8);
end;
end;

procedure updatepluginstatus;
begin
if fileexists(binpath+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT) then
   begin
   unrar5pluginstatus:=txt_5_7_pinstalled;
   Form_peach.baboutremoveunrar.Visible:=true;
   end
else
   begin
   unrar5pluginstatus:=txt_5_7_pmissing;
   Form_peach.baboutremoveunrar.Visible:=false;
   end;
if fileexists(binpath+'unace'+DirectorySeparator+'unace'+EXEEXT) then
   begin
   unacepluginstatus:=txt_5_7_pinstalled;
   Form_peach.baboutremoveunace.Visible:=true;
   end
else
   begin
   unacepluginstatus:=txt_5_7_pmissing;
   Form_peach.baboutremoveunace.Visible:=false;
   end;
if fileexists(binpath+'lpaq'+DirectorySeparator+'lpaq1'+EXEEXT) then
addformatspluginstatus:=txt_5_7_pinstalled
else
addformatspluginstatus:=txt_5_7_pmissing;
Form_peach.Labelabout1.caption:='PeaZip '+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)
        +APPLICATION1+char($0d)+char($0a)
        +APPLICATION2+char($0d)+char($0a)
        +APPLICATION3+char($0d)+char($0a)
        +APPLICATION4+char($0d)+char($0a)
        +APPLICATION5+char($0d)+char($0a)
        +APPLICATION7+char($0d)+char($0a)
        +APPLICATION9+char($0d)+char($0a)
        +APPLICATION10+char($0d)+char($0a)
        +char($0d)+char($0a)
        +'Plugin:'+char($0d)+char($0a)
        +'PeaZip Additional Formats Plugin (LGPLv3) - '+addformatspluginstatus+char($0d)+char($0a)
        +APPLICATION6+' - '+unacepluginstatus+char($0d)+char($0a)
        +APPLICATION8+' - '+unrar5pluginstatus+char($0d)+char($0a);
end;

procedure setlabelpanel_options(var a: Tlabel);
begin
with Form_peach 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: TPanel);
begin
activelabel_options:=a;
deselectlabels_options;
a.Font.Color:=clDefault;
b.Color:=tabbrushcol;//pvlblue;
setlabelpanel_options(a);
end;

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

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

text and translation

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

function valorize_text:integer;
var
   s:ansistring;
begin
valorize_text:=-1;
try
readln(t,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 psetbuttonwidth(var btt:TSpeedButton; rsize:integer; ontheleft:boolean);
var w,h:integer;
begin
Form_peach.labelbsize.Caption:=btt.Caption;
Form_peach.labelbsize.GetPreferredSize(w,h,false,true);
Form_peach.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 Form_peach do
begin
ButtonUn7za1.Layout:=blGlyphTop;
ButtonUn7za4.Layout:=blGlyphTop;
ButtonUn7zaTo.Layout:=blGlyphTop;
ButtonUn7za5.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 Form_peach do
begin
ButtonUn7za1.Layout:=blGlyphLeft;
ButtonUn7za4.Layout:=blGlyphLeft;
ButtonUn7zaTo.Layout:=blGlyphLeft;
ButtonUn7za5.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 Form_peach do
begin
ButtonUn7za1.Margin:=-1;
ButtonUn7za4.Margin:=-1;
ButtonUn7zaTo.Margin:=-1;
ButtonUn7za5.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 Form_peach do
begin
ButtonUn7za1.Spacing:=n;
ButtonUn7za4.Spacing:=n;
ButtonUn7zaTo.Spacing:=n;
ButtonUn7za5.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 Form_peach do
begin
ButtonUn7za1.Glyph:=Btestall_big;
ButtonUn7za4.Glyph:=Barchive_big;
ButtonUn7zaTo.Glyph:=Bextractall_big;
ButtonUn7za5.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 Form_peach do
begin
ButtonUn7za1.Glyph:=Btestall;
ButtonUn7za4.Glyph:=Barchive;
ButtonUn7zaTo.Glyph:=Bextractall;
ButtonUn7za5.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 Form_peach do
begin
ButtonUn7zaTo.Caption:=txt_caption_extract;
ButtonUn7za1.Caption:=txt_caption_test;
ButtonUn7za4.Caption:=txt_add;
pmttitle.Caption:=txt_add;
pmtypeswap.Caption:=txt_add+' <> '+txt_2_8_convert;
ButtonUn7za5.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 Form_peach do
begin
psetbuttonwidth(ButtonUn7zato,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7za1,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7za4,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7za5,refw,glyph_on_side);
ButtonUn7za6.Width:=imagelistroot.width;
ButtonUn7za7.Width:=imagelistroot.width;
ButtonUn7za8.Width:=imagelistroot.width;
ButtonUn7za11.Width:=imagelistroot.width;
ButtonUn7za9.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 Form_peach do
begin
ButtonUn7zaTo.Width:=ctrlback.width;
ButtonUn7za1.Width:=ctrlback.width;
ButtonUn7za4.Width:=ctrlback.width;
ButtonUn7za5.Width:=ctrlback.width;
ButtonUn7za6.Width:=imagelistroot.width;
ButtonUn7za7.Width:=imagelistroot.width;
ButtonUn7za8.Width:=imagelistroot.width;
ButtonUn7za11.Width:=imagelistroot.width;
ButtonUn7za9.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 Form_peach do
begin
if lsize=1 then bheight:=mbarheight
else bheight:=mmbarheight;
PanelBarOpen.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 Form_peach 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;

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

procedure setdescription_advcustedit;
var
   s:ansistring;
   sg:TStringGrid;
begin
sg:=Form_peach.StringGridCustedit1;
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:=Form_peach.StringGridCustedit.Cells[1,Form_peach.StringGridCustedit.Row];
if InputQuery(txt_description, '', s) then
   begin
   Form_peach.StringGridCustedit.Cells[1,Form_peach.StringGridCustedit.Row]:=s;
   Form_peach.StringGridCustedit.AutoSizeColumns;
   end;
end;

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

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

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

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

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;

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;

function dirExtractFilePath(const FileName: ansistring): ansistring;
var
  i : longint;
  EndSep : Set of Char;
begin
  i := Length(FileName);
  EndSep:=AllowDirectorySeparators;
  while (i > 0) and not CharInSet(FileName[i],EndSep) do
    Dec(i);
  If I>0 then
    Result := Copy(FileName, 1, i)
  else
    Result:='';
end;

function dirExtractFileName(const FileName: ansistring): ansistring;
var
  i : longint;
  EndSep : Set of Char;
begin
  I := Length(FileName);
  EndSep:=AllowDirectorySeparators;
  while (I > 0) and not CharInSet(FileName[I],EndSep) do
    Dec(I);
  Result := Copy(FileName, I + 1, MaxInt);
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 Form_peach 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 Form_peach do
begin
with treeview1.Items.AddChild(treeview1.selected,txt_mypc) do
   begin
   Selected:=true;
   ImageIndex:=32;
   SelectedIndex:=32;
   end;
if pmjd1.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[1]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[1]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd2.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[2]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[2]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd3.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[3]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[3]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd4.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[4]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[4]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd5.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[5]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[5]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd6.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[6]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[6]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd7.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[7]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[7]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd8.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[8]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[8]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd9.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[9]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[9]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd10.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[10]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[10]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd11.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[11]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[11]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd12.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[12]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[12]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd13.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[13]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[13]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd14.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[14]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[14]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd15.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[15]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[15]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd16.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[16]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[16]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd17.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[17]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[17]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd18.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[18]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[18]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd19.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[19]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[19]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd20.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[20]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[20]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd21.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[21]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[21]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd22.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[22]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[22]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd23.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[23]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[23]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd24.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[24]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[24]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd25.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[25]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[25]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd26.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[26]) do
      begin
      ImageIndex:=getpcmenuicon(setpcmenuicon(devtype[26]));
      SelectedIndex:=ImageIndex;
      end;
   end;
if expandroot=1 then TreeView1.Selected.Expand(false);
with treeview1.Items.Add(treeview1.selected,txt_2_9_home) do
   begin
   ImageIndex:=42;
   SelectedIndex:=42;
   end;
with treeview1.Items.Add(treeview1.selected,txt_desktop) do
   begin
   ImageIndex:=36;
   SelectedIndex:=36;
   end;
if usr_downloads<>'' then
   with treeview1.Items.Add(treeview1.selected,txt_3_1_downloads) do
      begin
      ImageIndex:=43;
      SelectedIndex:=43;
      end;
with treeview1.Items.Add(treeview1.selected,txt_2_4_documents) do
   begin
   ImageIndex:=2;
   SelectedIndex:=2;
   end;
if usr_music<>'' then
   with treeview1.Items.Add(treeview1.selected,txt_5_0_music) do
      begin
      ImageIndex:=12;
      SelectedIndex:=12;
      end;
if usr_pictures<>'' then
   with treeview1.Items.Add(treeview1.selected,txt_5_0_pictures) do
      begin
      ImageIndex:=17;
      SelectedIndex:=17;
      end;
if usr_videos<>'' then
   with treeview1.Items.Add(treeview1.selected,txt_5_0_videos) do
      begin
      ImageIndex:=15;
      SelectedIndex:=15;
      end;
if shared_dropbox<>'' then
   with treeview1.Items.Add(treeview1.selected,'Dropbox') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_myboxfiles<>'' then
   with treeview1.Items.Add(treeview1.selected,'My Box Files') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_googledrive<>'' then
   with treeview1.Items.Add(treeview1.selected,'Google Drive') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_onedrive<>'' then
   with treeview1.Items.Add(treeview1.selected,'OneDrive') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_skydrive<>'' then
   with treeview1.Items.Add(treeview1.selected,'Sharepoint Workspaces') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
if shared_ubuntuone<>'' then
   with treeview1.Items.Add(treeview1.selected,'Yandex Disk') do
      begin
      ImageIndex:=44;
      SelectedIndex:=44;
      end;
with treeview1.Items.Add(treeview1.selected,'...') do
   begin
   Selected:=true;
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
if users_root<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_4_6_users) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if public_home<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_2_9_home+' - '+txt_2_9_public) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if public_documents<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_2_4_documents+' - '+txt_2_9_public) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
with treeview1.Items.AddChild(treeview1.selected,txt_list_history) do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
if usr_searches<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_3_1_src) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if usr_libraries<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_3_1_lib) do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if expandmore=1 then TreeView1.Selected.Expand(false);
TreeView1.Selected:=TreeView1.Selected.Parent;
if expandfs=1 then TreeView1.Selected.Expand(false) else TreeView1.Selected.Collapse(true);
end;
end;

procedure populate_fs_nonwindows;
begin
with Form_peach do
begin
with treeview1.Items.AddChild(treeview1.selected,txt_mypc) do
   begin
   ImageIndex:=32;
   SelectedIndex:=32;
   end;
with treeview1.Items.AddChild(treeview1.selected,txt_2_9_home) do
   begin
   ImageIndex:=42;
   SelectedIndex:=42;
   end;
with treeview1.Items.AddChild(treeview1.selected,txt_desktop) do
   begin
   ImageIndex:=36;
   SelectedIndex:=36;
   end;
if usr_downloads<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_3_1_downloads) do
      begin
      ImageIndex:=43;
      SelectedIndex:=43;
      end;
if usr_documents<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_2_4_documents) do
      begin
      ImageIndex:=2;
      SelectedIndex:=2;
      end;
if usr_music<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_5_0_music) do
      begin
      ImageIndex:=12;
      SelectedIndex:=12;
      end;
if usr_pictures<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_5_0_pictures) do
      begin
      ImageIndex:=17;
      SelectedIndex:=17;
      end;
if usr_videos<>'' then
   with treeview1.Items.AddChild(treeview1.selected,txt_5_0_videos) do
      begin
      ImageIndex:=15;
      SelectedIndex:=15;
      end;
{$IFNDEF DARWIN}
if checkempty_dir('/media/') = false then
   with treeview1.Items.AddChild(treeview1.selected,'media') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if checkempty_dir('/mnt/') = false then
   with treeview1.Items.AddChild(treeview1.selected,'mnt') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
if (checkempty_dir('/run/media/') = false) and (checkempty_dir('/media/') = true) then
   with treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.selected,'var/run/media') do
      begin
      ImageIndex:=11;
      SelectedIndex:=11;
      end;
{$ELSE}
with treeview1.Items.AddChild(treeview1.selected,'Volumes') do
   begin
   ImageIndex:=11;
   SelectedIndex:=11;
   end;
with treeview1.Items.AddChild(treeview1.selected,'Applications') do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
with treeview1.Items.AddChild(treeview1.selected,'System Applications') do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
if checkempty_dir(home_path+'Library/Mobile Documents/') = false then
   with treeview1.Items.AddChild(treeview1.selected,'Mobile Documents') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
{$ENDIF}
if expandfs=1 then TreeView1.Selected.Expand(false) else TreeView1.Selected.Collapse(true);
end;
end;

procedure populate_bookmarks;
begin
with Form_peach do
begin
with treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.selected,s) do
      begin
      ImageIndex:=gettreeicon(StringGridBookmarks,23);
      SelectedIndex:=ImageIndex;
      end;
   end;
if expandbook=1 then TreeView1.Selected.Expand(true);
end;
end;

procedure populate_history;
var
   j:integer;
begin
with Form_peach do
begin
j:=0;
with treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.selected,s) do
      begin
      j:=j+1;
      ImageIndex:=gettreeicon(StringGridRecent,j);
      SelectedIndex:=ImageIndex;
      end;
   end;
if expandhistory=1 then TreeView1.Selected.Expand(true);
end;
end;

procedure populate_open;
var
    i:integer;
begin
with Form_peach do
begin
with treeview1.Items.Add(nil,txt_open) do
   begin
   Selected:=true;
   ImageIndex:=39;
   SelectedIndex:=39;
   end;

   with treeview1.Items.AddChild(treeview1.selected,txt_add) do
      begin
      ImageIndex:=51;
      SelectedIndex:=51;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_2_8_convert) do
      begin
      ImageIndex:=54;
      SelectedIndex:=54;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_caption_extract) do
      begin
      if tonewfolder=0 then ImageIndex:=52 else ImageIndex:=53;
      SelectedIndex:=ImageIndex;
      end;

   with treeview1.Items.AddChild(treeview1.selected,txt_open_path) do
      begin
      ImageIndex:=39;//3;
      SelectedIndex:=39;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_openarchive) do
      begin
      ImageIndex:=39;//0;
      SelectedIndex:=39;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_searchanddrag) do
      begin
      ImageIndex:=39;//29;
      SelectedIndex:=39;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_search_web) do
      begin
      ImageIndex:=39;
      SelectedIndex:=39;
      end;

   with treeview1.Items.AddChild(treeview1.selected,txt_explore_path) do
      begin
      ImageIndex:=39;
      SelectedIndex:=39;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_cphere) do
      begin
      ImageIndex:=39;
      SelectedIndex:=39;
      end;
   {$IFDEF MSWINDOWS}
   with treeview1.Items.AddChild(treeview1.selected,txt_5_0_ps) do
      begin
      ImageIndex:=39;
      SelectedIndex:=39;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_4_5_properties) do
      begin
      ImageIndex:=39;
      SelectedIndex:=39;
      end;
   {$ENDIF}

   populatetree2;
   with treeview1.Items.AddChild(treeview1.selected,txt_4_8_fun) do //functions
      begin
      Selected:=true;
      ImageIndex:=39;
      SelectedIndex:=39;
      end;
   for i:=0 to treeview2.Items.Count-1 do
     with treeview1.Items.AddChild(treeview1.selected,treeview2.Items.Item[i].Text) do begin ImageIndex:=39; SelectedIndex:=39; end;

   if expandfun=1 then TreeView1.Selected.Expand(false);
   TreeView1.Selected:=TreeView1.Selected.Parent;

   with treeview1.Items.AddChild(treeview1.selected,txt_3_3_apps) do //apps
      begin
      Selected:=true;
      ImageIndex:=41;
      SelectedIndex:=41;
      end;

      with treeview1.Items.AddChild(treeview1.selected,txt_3_3_run) do begin ImageIndex:=41; SelectedIndex:=41; end;
      i:=1;
      if owcustom1.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom1.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=1; i:=i+1; end;
      if owcustom2.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom2.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=2; i:=i+1; end;
      if owcustom3.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom3.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=3; i:=i+1; end;
      if owcustom4.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom4.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=4; i:=i+1; end;
      if owcustom5.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom5.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=5; i:=i+1; end;
      if owcustom6.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom6.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=6; i:=i+1; end;
      if owcustom7.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom7.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb[i]:=7; i:=i+1; end;
      if owcustom8.visible=true then begin with treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.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 treeview1.Items.AddChild(treeview1.selected,owcustom9.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=1; i:=i+1; end;
      if owcustom10.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom10.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=2; i:=i+1; end;
      if owcustom11.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom11.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=3; i:=i+1; end;
      if owcustom12.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom12.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=4; i:=i+1; end;
      if owcustom13.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom13.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=5; i:=i+1; end;
      if owcustom14.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom14.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=6; i:=i+1; end;
      if owcustom15.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom15.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=7; i:=i+1; end;
      if owcustom16.visible=true then begin with treeview1.Items.AddChild(treeview1.selected,owcustom16.caption) do begin ImageIndex:=41; SelectedIndex:=41; end; appdb2[i]:=8; i:=i+1; end;
   if expandapps=1 then TreeView1.Selected.Expand(false);
   TreeView1.Selected:=TreeView1.Selected.Parent;

if expandrun=1 then TreeView1.Selected.Expand(false) else TreeView1.Selected.Collapse(true);
end;
end;

procedure populate_archive;
var
   i,j,k:integer;
   nodefound,nodenotfinalized:boolean;
begin
//tree view archive rapresentation maxed to 4K dirs for performances
Form_peach.treeview1.Items.Beginupdate;

if (Form_Peach.StringGridAddress1.RowCount=1) and (Form_Peach.StringGridAddress2.RowCount=1) then
   begin
   Form_peach.treeview1.Items.Clear;
   exit;
   end;

if fun='UN7Z' then
   if (status1=txt_list_nomatch+txt_2_7_list_tryflatorpw) or (browse_option='l') then
      begin
      Form_peach.treeview1.Items.Clear;
      exit;
      end
   else
else
   begin
   Form_peach.treeview1.Items.Clear;
   exit;
   end;

if set_archivetree=false then
   begin
   if extractfilename(Form_Peach.EditOpenIn.Text)='' then
      begin
      Form_peach.treeview1.Items.Clear;
      end
   else
      begin
      if Form_Peach.StringGridAddress1.rowcount>MAXNDIRTREE then
         for i:=Form_peach.TreeView1.Items.Count-1 downto 2 do Form_peach.TreeView1.Items[i].Delete
      else
         for i:=Form_peach.TreeView1.Items.Count-1 downto Form_Peach.StringGridAddress1.RowCount+1 do Form_peach.TreeView1.Items[i].Delete;
      end;
   exit;
   end
else set_archivetree:=false;

Form_peach.treeview1.Items.Clear;
if extractfilename(form_peach.EditOpenIn1.Text)='' then exit;

with Form_peach.treeview1.Items.Add(nil,extractfilename(form_peach.EditOpenIn1.Text)) do
   begin
   Selected:=true;
   ImageIndex:=geticon(form_peach.EditOpenIn1.Text,ExtractFileExt(form_peach.EditOpenIn1.Text),false);
   SelectedIndex:=ImageIndex;
   end;

if (Form_Peach.StringGridAddress1.rowcount<2) or (Form_Peach.StringGridAddress1.rowcount>MAXNDIRTREE) then
   begin
   Form_peach.treeview1.Items.Add(nil,'');
   exit;
   end;

if Form_Peach.StringGridAddress1.Cells[12,1]='' then
   begin
   Form_peach.treeview1.Items.Add(nil,'');
   exit;
   end;

Form_Peach.StringGridAddress1.Beginupdate;
Form_Peach.StringGridAddress1.SortColRow(true,11);
with Form_peach.TreeView1.Items.AddChild(Form_peach.treeview1.selected,Form_Peach.StringGridAddress1.Cells[12,1]) do
   begin
   Form_Peach.StringGridAddress1.Cells[13,1]:='1';
   Selected:=true;
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
Form_Peach.TreeView1.BeginUpdate;
Form_Peach.TreeView1.visible:=false;
for i:=2 to Form_Peach.StringGridAddress1.RowCount-1 do
   begin
   nodefound:=false;
   for j:=1 to Form_Peach.treeview1.Items.Count-1 do
      begin
      if pos(Form_peach.treeview1.Items[j].Text+directoryseparator,Form_Peach.StringGridAddress1.Cells[12,i]+directoryseparator)=1 then//<>0 then
         begin
         nodenotfinalized:=false;
         for k:=j+1 to Form_Peach.treeview1.Items.Count-1 do
             begin
             if pos(Form_peach.treeview1.Items[k].Text+directoryseparator,Form_Peach.StringGridAddress1.Cells[12,i]+directoryseparator)<>0 then
                begin
                nodenotfinalized:=true;
                break;
                end;
             end;
         if nodenotfinalized=false then
         with Form_peach.TreeView1.Items.AddChild(Form_peach.treeview1.Items[j],Form_Peach.StringGridAddress1.Cells[12,i]) do
            begin
            Selected:=true;
            ImageIndex:=3;
            SelectedIndex:=3;
            nodefound:=true;
            break;
            end;
         end;
      end;
   if nodefound=false then
      with Form_peach.TreeView1.Items.AddChild(Form_peach.treeview1.Items[0],Form_Peach.StringGridAddress1.Cells[12,i]) do
         begin
         Selected:=true;
         ImageIndex:=3;
         SelectedIndex:=3;
         end;
   end;
Form_Peach.TreeView1.EndUpdate;
Form_Peach.TreeView1.visible:=true;
Form_Peach.StringGridAddress1.clear;
Form_Peach.StringGridAddress1.rowcount:=Form_Peach.treeview1.Items.Count;
for i:=1 to Form_Peach.treeview1.Items.Count-1 do
   Form_Peach.StringGridAddress1.Cells[12,i]:=Form_peach.treeview1.Items[i].text;
for j:=1 to Form_Peach.treeview1.Items.Count-1 do
   Form_peach.treeview1.Items[j].Text:=dirextractfilename(Form_peach.treeview1.Items[j].Text);
Form_Peach.StringGridAddress1.EndUpdate;

Form_Peach.TreeView1.Selected:=Form_Peach.TreeView1.Items[0];
Form_Peach.TreeView1.Selected.collapse(true);
aisexpanded:=false;

Form_peach.treeview1.Items.Add(nil,'');

end;

begin
with Form_peach do
begin

populate_archive;

populate_bookmarks;

treeview1.Items.Add(nil,'');
with treeview1.Items.Add(nil,txt_fs) do
   begin
   Selected:=true;
   ImageIndex:=31;
   SelectedIndex:=31;
   end;
{$IFDEF MSWINDOWS}
populate_fs_windows;
{$ELSE}
populate_fs_nonwindows;
{$ENDIF}

treeview1.Items.Add(nil,'');
populate_history;

treeview1.Items.Add(nil,'');
populate_open;

treeview1.Items.Add(nil,'');

Form_peach.TreeView1.TopItem:=Form_peach.TreeView1.Items[0];
if (fun='UN7Z') and (selnode>0) and (selnode<Form_peach.TreeView1.Items.Count) then
   if Form_peach.TreeView1.Items[selnode].IsVisible=false then Form_peach.TreeView1.Items[selnode].MakeVisible;

treeview1.selected:=nil;

treeview1.Items.Endupdate;
end;
end;

procedure testwinrar;
begin
if libre_directive=2 then
   begin
   havewinrar:=false;
   exit;
   end;
if setrarmanual=1 then
   begin
   havewinrar:=true;
   Form_peach.EditNameCustom.Caption:=Form_peach.pcustom1.caption;
   end
else
   begin
   {$IFDEF MSWINDOWS}
   havewinrar:=true;
   if fileexists(GetEnvironmentVariable('ProgramFiles')+'\WinRAR\Rar.exe') then Form_peach.EditNameCustom.Caption:=GetEnvironmentVariable('ProgramFiles')+'\WinRAR\Rar.exe'
   else
      if fileexists(GetEnvironmentVariable('ProgramW6432')+'\WinRAR\Rar.exe') then Form_peach.EditNameCustom.Caption:=GetEnvironmentVariable('ProgramW6432')+'\WinRAR\Rar.exe'
      else
         if fileexists(executable_path+'Rar.exe') then Form_peach.EditNameCustom.Caption:=executable_path+'Rar.exe'
         else
            if fileexists(binpath+'Rar.exe') then Form_peach.EditNameCustom.Caption:=binpath+'Rar.exe'
            else
               if fileexists(binpath+'rar\Rar.exe') then Form_peach.EditNameCustom.Caption:=binpath+'rar\Rar.exe'
               else
                  if fileexists(binpath+'unrar\Rar.exe') then Form_peach.EditNameCustom.Caption:=binpath+'unrar\Rar.exe'
                  else
                     havewinrar:=false;
   //syntax is fixed so it is not needed to change it
   {$ELSE}
   havewinrar:=false;
   {$ENDIF}
   end;
if havewinrar=true then
   begin
   Form_peach.EditExtCustom.Caption:='rar';
   Form_peach.cbRARmanual.Hint:=Form_peach.EditNameCustom.Caption;
   end;
if havewinrar=false then
   begin
   form_peach.cbType.Items[4]:=txt_custom;
   form_peach.mprofilerar.visible:=false;
   end
else
   begin
   form_peach.cbType.Items[4]:=txt_custom+'/RAR';
   form_peach.mprofilerar.visible:=true;
   end;
end;

procedure assign_guitext; //set text
var
   i:integer;
begin
Form_peach.Caption:=APPMAIN;
with Form_peach do
begin
try
cbRARmanual.caption:=txt_9_3_mrar;
Labelsetwork.caption:=txt_settings+' > '+txt_3_1_workingdir;
pmtoolsmall.Caption:=txt_2_9_st;
labelCheckBoxSolidAddress.Caption:=txt_2_9_address;
CheckBoxSolidAddress.Items.Clear;
CheckBoxSolidAddress.Items.Add(txt_8_8_cw);
CheckBoxSolidAddress.Items.Add(txt_8_8_cb+' / '+txt_8_8_light);
CheckBoxSolidAddress.Items.Add(txt_8_8_cb);
CheckBoxSolidAddress.Items.Add(txt_8_8_cb+' / '+txt_7_6_dim);
CheckBoxSolidAddress.Items.Add(txt_8_8_cb+' / '+txt_7_6_dark);
CheckBoxSolidAddress.Items.Add(txt_8_8_ca+' / '+txt_8_8_light);
CheckBoxSolidAddress.Items.Add(txt_8_8_ca);
CheckBoxSolidAddress.Items.Add(txt_8_8_ca+' / '+txt_7_6_dim);
CheckBoxSolidAddress.Items.Add(txt_8_8_ca+' / '+txt_7_6_dark);
CheckBoxCenteredToolbar.Caption:=txt_8_8_centered;
CheckBoxsnz1.Caption:=txt_8_8_snz;
CheckBoxsnoi.Caption:=txt_8_8_snoi;
CheckBoxsnon.Caption:=txt_8_8_snon;
LabelColorAddressbar.Caption:=txt_8_8_solcol;
LabelColorTabs1.Caption:=txt_8_8_altt;
CheckBoxAltTab.Items.Clear;
CheckBoxAltTab.Items.Add(txt_8_8_btn);
CheckBoxAltTab.Items.Add(txt_8_8_lnk);
CheckBoxAltTab.Items.Add(txt_8_8_tab);
LabelColorToolBar.Caption:=txt_2_9_toolbar;
CheckBoxAlttabcol.Items.Clear;
CheckBoxAlttabcol.Items.Add(txt_8_8_cw+' + '+txt_8_8_cb);
CheckBoxAlttabcol.Items.Add(txt_8_8_cw+' + '+txt_8_8_ca);
CheckBoxAlttabcol.Items.Add(txt_8_8_cb);
CheckBoxAlttabcol.Items.Add(txt_8_8_cb+' / '+txt_7_6_dim);
CheckBoxAlttabcol.Items.Add(txt_8_8_ca);
CheckBoxAlttabcol.Items.Add(txt_8_8_ca+' / '+txt_7_6_dim);
CheckBoxAccentToolBar.Items.Clear;
CheckBoxAccentToolBar.Items.Add(txt_8_8_cw);
CheckBoxAccentToolBar.Items.Add(txt_8_8_cb+' / '+txt_8_8_light);
CheckBoxAccentToolBar.Items.Add(txt_8_8_cb);
CheckBoxAccentToolBar.Items.Add(txt_8_8_cb+' / '+txt_7_6_dim);
CheckBoxAccentToolBar.Items.Add(txt_8_8_cb+' / '+txt_7_6_dark);
CheckBoxAccentToolBar.Items.Add(txt_8_8_ca+' / '+txt_8_8_light);
CheckBoxAccentToolBar.Items.Add(txt_8_8_ca);
CheckBoxAccentToolBar.Items.Add(txt_8_8_ca+' / '+txt_7_6_dim);
CheckBoxAccentToolBar.Items.Add(txt_8_8_ca+' / '+txt_7_6_dark);
CheckBoxAltBar.Items.Clear;
CheckBoxAltBar.Items.Add(txt_8_8_cw+' + '+txt_8_8_cb);
CheckBoxAltBar.Items.Add(txt_8_8_cw+' + '+txt_8_8_ca);
CheckBoxAltBar.Items.Add(txt_8_8_cb);
CheckBoxAltBar.Items.Add(txt_8_8_ca);
Labelmoreopt.Caption:=txt_8_7_mo;
Labelmoreopt1.Caption:=txt_8_7_mo;
Labeloptsub7.Caption:=txt_all_size;
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;
pmmorelock.Caption:=txt_7_4_lock;
pmmorerr.Caption:=txt_rr;
if (havewinrar=false) or (userar<>1) then pmmorerecover.Caption:=txt_7_4_recover+' (ARC)'
else pmmorerecover.Caption:=txt_7_4_recover+' (ARC, RAR)';
pmmorecomment.Caption:=txt_7_4_comment;
po_lock.Caption:=txt_7_4_lock;
po_rr.Caption:=txt_rr;
if (havewinrar=false) or (userar<>1) then po_recover.Caption:=txt_7_4_recover+' (ARC)'
else po_recover.Caption:=txt_7_4_recover+' (ARC, RAR)';
po_comment.Caption:=txt_7_4_comment;
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;
Labelmemuse.Caption:=txt_9_0_mem;
CheckBoxsnh.Caption:=txt_9_0_hl+' (WIM, TAR)';
CheckBoxsnl.Caption:=txt_9_0_sl+' (WIM, TAR)';
cbtimecreated.Caption:=txt_8_2_alltimes;
cbtimecreated.Hint:=txt_8_2_supportedby+' 7Z, RAR, TAR/pax, ZIP';
CheckBoxsni.Caption:=txt_6_5_sni+' (WIM)';
CheckBoxsni1.Caption:=txt_6_5_sni+' (WIM)';
CheckBoxsns.Caption:=txt_6_5_sns+' (WIM)';
CheckBoxsns1.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_info;
MenuItemInfomenu.Caption:=txt_info;
MenuItemToggleNav.Caption:=txt_9_0_tnav+' (Alt+4)';
MenuItemToggleStatus.Caption:=txt_toggle_historybookmarks+' (Alt+8)';
pmtabsm.Caption:=txt_6_4_tabbar;
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;
pmtabsbook.Caption:=txt_bookmarks;
pmtabsbookmarkadd.Caption:=txt_add_tobookmarks;
pmtabsbookmarkorg.Caption:=txt_2_9_organize;
MenuItemOpen_saveastxt.Caption:=txt_saveas+' TXT';
pmsaveastxt.Caption:=txt_saveas+' TXT';
MenuItemOpen_saveascsv.Caption:=txt_saveas+' CSV';
pmsaveascsv.Caption:=txt_saveas+' CSV';
po_preview.Caption:=txt_5_9_pff;
po_analyze.Caption:=txt_5_9_lff;
pmmorepreview.Caption:=txt_5_9_pff;
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;
org_autoadjust.Caption:=txt_6_3_autoadjust+' (Ctrl+Alt+A)';
mautoadjust.Caption:=txt_6_3_autoadjust;
pmcname.Caption:=txt_name;
pmctype.Caption:=txt_type;
pmcsize.Caption:=txt_size;
pmcpacked.Caption:=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;
schedulepassword1.Caption:=txt_pw;
scheduleuser1.Caption:=txt_run_as2;
Bschedule1.Caption:=txt_5_1_schedadd;
scheduleend1.Caption:=txt_5_1_enddate;
labelevery1.Caption:=txt_5_1_every;
Lmanageschedule4.Caption:=txt_5_1_schedmanage;
Lmanageschedule3.Caption:=txt_5_1_scriptmanage;
CheckGroupM2.Caption:=txt_5_1_months;
lsa5.Caption:=txt_5_1_schedule;
lsa6.Caption:=txt_5_1_starttime;
PanelClickAddress.Hint:=txt_7_1_typetosearch;
ImageInfoArchive6.Hint:=txt_5_1_schedexplain;
schedulestart1.Caption:=txt_5_1_startdate;
lsa4.Caption:=txt_5_1_schedname;
CheckGroupM2.Checked[0]:=true;
CheckGroupM2.Checked[1]:=true;
CheckGroupM2.Checked[2]:=true;
CheckGroupM2.Checked[3]:=true;
CheckGroupM2.Checked[4]:=true;
CheckGroupM2.Checked[5]:=true;
CheckGroupM2.Checked[6]:=true;
CheckGroupM2.Checked[7]:=true;
CheckGroupM2.Checked[8]:=true;
CheckGroupM2.Checked[9]:=true;
CheckGroupM2.Checked[10]:=true;
CheckGroupM2.Checked[11]:=true;
lsaday1.Caption:=txt_5_1_day;
ComboBoxM3.Items.Clear;
for i:=1 to 31 do ComboBoxM3.Items.Add(inttostr(i));
ComboBoxM3.Items.Add(txt_5_1_last);
CheckGroupW1.Caption:=txt_5_1_days;
CheckGroupW1.Items.Clear;
CheckGroupW1.Items.Add(txt_5_1_w1);
CheckGroupW1.Items.Add(txt_5_1_w2);
CheckGroupW1.Items.Add(txt_5_1_w3);
CheckGroupW1.Items.Add(txt_5_1_w4);
CheckGroupW1.Items.Add(txt_5_1_w5);
CheckGroupW1.Items.Add(txt_5_1_w6);
CheckGroupW1.Items.Add(txt_5_1_w7);
CheckGroupW1.Checked[1]:=true;
CheckGroupW1.Checked[2]:=true;
CheckGroupW1.Checked[3]:=true;
CheckGroupW1.Checked[4]:=true;
CheckGroupW1.Checked[5]:=true;
schedaddschedule1.Items.Clear;
schedaddschedule1.Items.Add(txt_5_1_hourly);
schedaddschedule1.Items.Add(txt_5_1_daily);
schedaddschedule1.Items.Add(txt_5_1_weekly);
schedaddschedule1.Items.Add(txt_5_1_monthly);
schedaddschedule1.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;
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;
ImageInfoArchive5.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;
ButtonUn7za1.Hint:=txt_caption_test;
ButtonUn7za5.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;
MenuItemOpen_pictures.caption:=txt_5_0_pictures;
MenuItemOpen_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;
pmnavhistory0.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;
mwebs.Caption:=txt_search_web;
pmbcweb.Caption:=txt_search_web;
pmbcproperties.Caption:=txt_4_5_properties;
pmbcexplore.Caption:=txt_explore_path;
po_im.Caption:=txt_4_8_imagemanager;
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;
mtstyle.Caption:=txt_4_9_style;
mtstyle_none.Caption:=txt_2_9_none;
mtstyle_shadow.Caption:=txt_4_9_shadow;
mtstyle_frame.Caption:=txt_4_9_frame;
msamplescripts.Caption:=txt_8_5_samplescripts;
mprelist.Caption:=txt_8_5_listlarge;
imagesp.Hint:=txt_2_9_navbar;
mbrowsersizes.Caption:=txt_2_9_st;
mbrowsersizem.Caption:=txt_2_9_mt;
mbrowsersizel.Caption:=txt_2_9_lt;
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;
mopresets.Caption:=txt_4_8_presets+' (Alt+6)';
mprelightlist.Caption:=txt_4_8_listno;
mprelight.Caption:=txt_4_8_detailsno;
mpredetails.Caption:=txt_8_5_detailslarge;
mpreaverage.Caption:=txt_4_8_iconm;
mprelarge.Caption:=txt_4_8_iconl;
pmstyle1.Caption:=txt_4_8_detailsno;
pmstyle2.Caption:=txt_8_5_detailslarge;
pmstyle3.Caption:=txt_4_8_listno;
pmstyle4.Caption:=txt_8_5_listlarge;
pmstyle5.Caption:=txt_4_8_iconm;
pmstyle6.Caption:=txt_4_8_iconl;
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;
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;
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;
CheckBoxFolder1.caption:=txt_5_5_intdir;
MenuItemExtAllTo.caption:=txt_ext_allto+'... (Ctrl+Alt+E / F12)';
MenuItemExtAllHere.caption:=txt_ext_allhere;
MenuItemExtAllHereSmart.caption:=txt_7_1_smart;
MenuItemExtAllHereNew.caption:=txt_7_1_new;
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)';
mSystemIntegration.caption:=txt_3_0_configure;
msmallicon.caption:=txt_3_4_smallicons;
mbreset.caption:=txt_5_0_removeall;
LabelTitleOptions5.Caption:=txt_3_3_apps+'   ';
LabelTitleOptions6.Caption:=txt_theme+'   ';
panelnav4.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;
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;
mopenasarchive.Caption:=txt_2_8_viewasarchive+' '+txt_2_8_experimental;
po_openunitasarchivelin.Caption:=txt_2_8_viewasarchive+' '+txt_2_8_experimental;
mbrowser.Caption:=txt_browser;
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+' '+txt_7_8_requirerestart;
mDetails.Caption:=txt_2_8_details;
mrowselect.Caption:=txt_2_8_rowselect;
mlargeicons.Caption:=txt_9_1_enlargeicons+' '+txt_7_8_requirerestart;
mthl.Caption:=txt_2_9_thl;
mList.Caption:=txt_caption_list;
MenuItemPW.Caption:=txt_2_7_setpw;
mpw2.Caption:=txt_2_7_setpw;
mjob.Caption:=txt_savejob;
mjob2.Caption:=txt_savejob;
CheckBox1.Caption:=txt_2_7_es;
CheckBox2.Caption:=txt_2_7_eu;
pmjb24.Caption:=txt_bookmarks+'...';
mr9.Caption:=txt_list_history+'...';
pmhr9.Caption:=txt_list_history+'...';
smbookmarks1.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;
pmemb0.Caption:=txt_bookmarks;
pmemr0.Caption:=txt_list_history;
pmembf0.Caption:=txt_bookmarks;
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;
MenuItemOpen_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;
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;
pmmorecheck.Caption:=txt_check;
MenuItemToolhexp.Caption:=txt_2_4_hexp;
MenuItemOpen_documents1.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;
pmJumppubdoc.Caption:=txt_2_4_documents+' - '+txt_2_9_public;
pmjumprecent.Caption:=txt_list_history;
pmjumpdownloads.Caption:=txt_3_1_downloads;
pmjumpsearches.Caption:=txt_3_1_src;
pmjumplibraries.Caption:=txt_3_1_lib;
MenuItemOpen_downloads1.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;
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;
RadioGroup0.Items[0]:=STR_7Z;
RadioGroup0.Items[1]:=STR_ARC;
RadioGroup0.Items[2]:=STR_BROTLI;
RadioGroup0.Items[3]:=STR_BZIP2;
RadioGroup0.Items[4]:=txt_custom;
RadioGroup0.Items[5]:=STR_GZIP;
RadioGroup0.Items[6]:=STR_PEA;
RadioGroup0.Items[7]:=STR_QUAD;
RadioGroup0.Items[8]:=txt_sfx+' '+STR_7Z;
RadioGroup0.Items[9]:=txt_sfx+' '+STR_ARC;
RadioGroup0.Items[10]:=txt_split;
RadioGroup0.Items[11]:=STR_TAR;
RadioGroup0.Items[12]:=STR_UPX;
RadioGroup0.Items[13]:=STR_WIM;
RadioGroup0.Items[14]:=STR_XZ;
RadioGroup0.Items[15]:=STR_ZIP;
RadioGroup0.Items[16]:=STR_ZSTD;
RadioGroup0.Items[17]:=STR_ZPAQ;
RadioGroup0.Items[18]:=txt_lastused;
status0:=APPMAIN+' '+PEAZIPVERSION+PEAZIPREVISION;
ComboBoxArchive1.Items.Strings[0]:=txt_singlevol;
ComboBoxArchive1.Items.Strings[1]:=txt_customsize;
ComboBoxArchive1.Items.Strings[2]:=txt_fd;
ComboBoxArchive1.Items.Strings[3]:=txt_attach10;
ComboBoxArchive1.Items.Strings[4]:=txt_4_8_attach25;
ComboBoxArchive1.Items.Strings[5]:=txt_cd650;
ComboBoxArchive1.Items.Strings[6]:=txt_cd700;
ComboBoxArchive1.Items.Strings[7]:=txt_fat32;
ComboBoxArchive1.Items.Strings[8]:=txt_dvd;
ComboBoxArchive1.Items.Strings[9]:=txt_dvddl;
ComboBoxArchive1.Items.Strings[10]:='25 GB Blu-Ray';
CheckBoxTarBefore.Caption:=txt_tarbefore;
CheckBoxTarBefore.Hint:=txt_tarbefore_hint;
cbadvf1.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;
CheckBoxConvert0.Caption:=txt_6_5_chp;
CheckBoxConvert1.Caption:=txt_5_6_verbose;
po_convertarchive.Caption:=txt_2_8_convert;
EditOParc.Hint:=txt_otherparams;
EditOP.Hint:=txt_otherparams;
EditOPcustom.Hint:=txt_otherparams;
Label7za9.Caption:=txt_level;
RadioGroupPaq.Caption:=txt_paqver;
Label7za7.Caption:=txt_level;
CheckBoxUPX1.Caption:=txt_strip;
CheckBoxUPX2.Caption:=txt_backupexe;
CheckBoxUPX2.Hint:=txt_backupexe_hint;
RadioGroupQuad.Caption:=txt_exe;
CheckBoxQuadMax.Caption:=txt_maxcomp;
CheckBoxQuadMax.Hint:=txt_slowercomp;
Label7za10.Caption:=txt_level;
LabelPEA6.Caption:=txt_encryption;
LabelPEA7.Caption:=txt_peaobj;
LabelPEA8.Caption:=txt_volumepea;
LabelSplit.Caption:=txt_integrity;
LabelSplit.Hint:=txt_check_hint;
Subtitle7zaopt1.Caption:=txt_options;
Label7za1.Caption:=txt_function;
Label7za8.Caption:=txt_6_4_paths;
ComboBoxArchivePaths.Items.Strings[0]:=txt_6_4_relative;
ComboBoxArchivePaths.Items.Strings[1]:=txt_6_4_full;
ComboBoxArchivePaths.Items.Strings[2]:=txt_6_4_absolute;
ComboBoxArchivePaths1.Items.Strings[0]:=txt_6_4_relative;
ComboBoxArchivePaths1.Items.Strings[1]:=txt_6_4_full;
ComboBoxArchivePaths1.Items.Strings[2]:=txt_6_4_absolute;
Label7za2.Caption:=txt_threads;
LabelArchiveOther.Caption:=txt_other;
CheckBoxArchive4.Caption:=txt_sendbymail;
CheckBoxArchive4.Hint:=txt_attach;
CheckBoxMailKeep.Caption:=txt_4_8_keeparchive;
Subtitle7zaopt2.Caption:=txt_encryption;
Label7za18.Caption:=txt_algo;
Subtitle7zaopt.Caption:=txt_compression;
Label7za4.Caption:=txt_method;
Label7za3.Caption:=txt_level;
Label7za5.Caption:=txt_dictionary;
Label7za6.Caption:=txt_word;
Label7zaPasses.Caption:=txt_passes;
Label7zsolidblock.Caption:=txt_solid_block;
Labelbcmblock.Caption:=txt_solid_block;
CheckBoxArchive6.Caption:=txt_create_sfx;
RadioGroupArchive.Caption:=txt_sfx_interface;
CheckBoxArchiveOF.Caption:=txt_compress_openforwriting;
CheckBoxMQS.Caption:=txt_6_0_msq;
pmbcexpand.Caption:=txt_6_1_ec;
apmbcexpand.Caption:=txt_6_1_ec;
cbencext.Caption:=txt_6_2_encext;
CheckBoxArchiveOF.Hint:=txt_openfiles_hint;
LabelArchiveOther2.Caption:=txt_parameters;
LabelCustom.Caption:=txt_exe_hint;
LabelArchiveOther3.Caption:=txt_syntax;
LabelArchiveOther8.Caption:=txt_exe;
LabelArchiveOther4.Caption:=txt_ext;
LabelArcSub1.Caption:=txt_compression;
Label7za11.Caption:=txt_level;
LabelARCsolidblock.Caption:=txt_solid;
CheckBoxARC1.Caption:=txt_rr;
CheckBoxARC1.Hint:=txt_rr_hint;
CheckBoxARC3.Caption:=txt_4_2_arcabspath;
CheckBoxARC2.Caption:=txt_create_sfx;
LabelArcSub2.Caption:=txt_options;
Subtitleschopt.Caption:=txt_6_5_def;
Subtitleschopt1.Caption:=txt_6_5_def;
Label7za12.Caption:=txt_function;
LabelArchiveOther1.Caption:=txt_other;
LabelArcSub3.Caption:=txt_encryption;
Label7za14.Caption:=txt_algo;
CheckBoxDate.Caption:=txt_timestamp;
cbcustext.Caption:=txt_7_8_custext;
iConsoleCreateImport.Hint:=txt_pj_hint;
ImageInfoArchive3.hint:=txt_pj_hint2;
lConsoleCreate_jobcode.Caption:=txt_job_code;
lConsoleCreate_outname.Caption:='outname'; //overwritten, don't need to be translated
Image7zPj.Caption:=txt_savejob;
Image7zPj.Hint:=txt_savejobdefinition_hint;
Image7zPj1.Caption:=txt_launch;
ButtonArchive.Caption:=txt_2_7_ok;
ButtonArchive.Hint:='Ctrl+Alt+Enter';
ButtonExtOk.Caption:=txt_2_7_ok;
ButtonExtOk.Hint:='Ctrl+Alt+Enter';
ButtonArchive1.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;
TrayIcon1.hint:='PeaZip | '+txt_5_6_rc;
mlayouts.caption:=txt_5_6_layouts;
ButtonUn7zaTo.Caption:=txt_caption_extract;
ButtonUn7za1.Caption:=txt_caption_test;
ButtonUn7za4.Caption:=txt_add;
ButtonUn7za5.Caption:=txt_2_8_convert;
cbUn7zaRecursive.Caption:=txt_filters_recourse;
cbUn7zaRecursiveExclude.Caption:=txt_exclude_recourse;
MenuItemHistoryBook.Caption:=txt_add_tobookmarks;
ButtonUn7za4.Hint:=txt_add_tolayout;
EditUn7zaFilter1.Hint:=txt_address_hint;
Imagelistsearch.Hint:=txt_searchfor;
Imagelistsearch1.Hint:=txt_reset;
pmireset.Caption:=txt_reset;
pmrsearch.Caption:=txt_searchfor+'...';
pmsrec.Caption:=txt_2_9_rec;
ctrlhistory.Hint:=txt_list_history;
ctrlup.Hint:=txt_up;
ButtonEditName12.Hint:=txt_browse;
ButtonEditName14.Hint:=txt_browse;
ButtonUn7za10.Hint:=txt_browse;
RadioGroupAction.Caption:=txt_action;
CheckBoxUnPeaAttributes.Caption:=txt_restore_att;
LabelArchiveOther5.Caption:=txt_parameters;
iadvextract.hint:=txt_exe_hint;
LabelArchiveOther6.Caption:=txt_syntax;
LabelArchiveOther7.Caption:=txt_exe;
pcustompathexplore.Caption:=txt_explore_path;
Label10.Caption:=txt_2_7_output;
Label11.Caption:=txt_function;
Label12.Caption:=txt_naming;
Labelstatus4.Caption:='';
Labelstatus6.Caption:=txt_2_7_output;
Labelstatus6a.Caption:=txt_type;
Labelstatus6b.Caption:=txt_level;
Labelstatus6c.Caption:=txt_function;
Labelstatus6d.Caption:=txt_split;
Labelstatus7.Caption:=txt_2_7_output;
Labelstatus10.Caption:=txt_path;
Labelstatus8.Caption:=txt_function;
cbadvf2.Caption:=txt_advfilters;
labelstatus5.Caption:='['+txt_ext_all+']';
CheckBoxFolder.Caption:=txt_newfoldermenu;
CheckBoxDeleteInput.Caption:=txt_5_4_deletearchives;
CheckBoxDeleteInput1.Caption:=txt_5_4_deletefiles;
cbdeleteinputmode.Clear;
{$IFDEF MSWINDOWS}
cbdeleteinputmode.DropDownCount:=4;
cbdeleteinputmode.Items.Append(txt_4_7_recycle);
cbdeleteinputmode.Items.Append(txt_quickdelete);
cbdeleteinputmode.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode.Items.Append(txt_securedelete);
{$ELSE}
{$IFDEF DARWIN}
cbdeleteinputmode.DropDownCount:=4;
cbdeleteinputmode.Items.Append(txt_4_7_recycle);
cbdeleteinputmode.Items.Append(txt_quickdelete);
cbdeleteinputmode.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode.Items.Append(txt_securedelete);
{$ELSE}
cbdeleteinputmode.DropDownCount:=3;
cbdeleteinputmode.Items.Append(txt_quickdelete);
cbdeleteinputmode.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode.Items.Append(txt_securedelete);
{$ENDIF}
{$ENDIF}
cbdeleteinputmode.ItemIndex:=0;
cbdeleteinputmode1.Clear;
{$IFDEF MSWINDOWS}
cbdeleteinputmode1.DropDownCount:=4;
cbdeleteinputmode1.Items.Append(txt_4_7_recycle);
cbdeleteinputmode1.Items.Append(txt_quickdelete);
cbdeleteinputmode1.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode1.Items.Append(txt_securedelete);
{$ELSE}
{$IFDEF DARWIN}
cbdeleteinputmode1.DropDownCount:=4;
cbdeleteinputmode1.Items.Append(txt_4_7_recycle);
cbdeleteinputmode1.Items.Append(txt_quickdelete);
cbdeleteinputmode1.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode1.Items.Append(txt_securedelete);
{$ELSE}
cbdeleteinputmode1.DropDownCount:=3;
cbdeleteinputmode1.Items.Append(txt_quickdelete);
cbdeleteinputmode1.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode1.Items.Append(txt_securedelete);
{$ENDIF}
{$ENDIF}
cbdeleteinputmode1.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;
ImageUn7zPj.Caption:=txt_savejob;
ImageUn7zPj.Hint:=txt_savejobdefinition_hint;
iConsoleCreateImport1.Hint:=txt_pj_hint;
ImageInfoArchive4.Hint:=txt_pj_hint2+char($0D)+char($0A)+char($0D)+char($0A)+txt_8_8_intnote;
lConsoleCreate_jobcode1.Caption:=txt_job_code;
lConsoleCreate_outname1.Caption:='outname'; //overwritten, doesn't need translation
Image7zPj3.Caption:=txt_launch;
ImageInfoDefault1.Hint:=txt_cl_hint;
ImageInfoDefault2.Hint:=txt_2_5_langhint;
Labeloaui.Caption:=txt_backend;
Labelcb17.Caption:=txt_desktop;
Labelcb19.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;
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;
Labelcb7.Caption:=txt_reset+' '+txt_3_3_apps;
LabelTitleOptions1.Caption:=txt_general+'   ';
labelmaxarg.Caption:=txt_8_3_maxarg;
CheckBoxSkipDel.Caption:=txt_8_3_skipdel;
LabelTitleOptions2.Caption:=txt_2_6_advanced+'   ';
Labeloaenc.Caption:=txt_2_5_encoding;
Labelconsoleencoding.Caption:=txt_3_1_sccenc;
cbEncoding1.Caption:=txt_3_2_7zutf8nonascii;
CheckBoxJobEncoding.Caption:=txt_2_5_encpj;
CheckBoxDragDrop.Caption:=txt_6_8_ndrop;
CheckBoxEditArchives.Caption:=txt_6_9_autou;
cbSys7zlin.Caption:=txt_7_7_sys7z;
cbSys7zlin.Hint:=txt_7_7_sys7zreq;
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}
cbSys7zlin.visible:=false;
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;
pmshowsearch.Caption:=txt_8_7_showsearchbar;
csvsepchar.Caption:=txt_8_7_csv;
csvsepchar.Hint:=txt_8_7_csvhelp;
EditCSVsep.Hint:=txt_8_7_csvhelp;
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);
CheckBoxAutoExtTar1.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;
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;
CheckBoxShowHints.Caption:=txt_showhints;
LabelTitleOptions3.Caption:=txt_4_6_am+'   ';
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;
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;
Labelcb14.Caption:=txt_default_format;
RadioGroupBrowser.Items.Strings[0]:=txt_browser;
RadioGroupBrowser.Items.Strings[1]:=txt_flat;
RadioGroupBrowser.Items.Strings[2]:=txt_lastused;
CheckBox4.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;
CheckBoxIgnoreSel.Caption:=txt_ignore_sel;
CheckBoxExtAnd.Caption:=txt_8_0_enableextand;
CheckBoxIgnoreDisp.Caption:=txt_ignore_disp;
CheckBoxIntDir.Caption:=txt_5_5_intdir;
CheckBoxPrebrowse.Caption:=txt_browser;
Lpriority.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;
CheckBoxPrebrowse.Hint:=txt_quickbrowse_hint;
Labeloamext.Caption:=txt_caption_extract;
Labeloamext1.Caption:=txt_archive;
Labeloafter.Caption:=txt_8_7_after;
RadioGrouppwrequest.Items[0]:=txt_2_3_never_pw;
RadioGrouppwrequest.Items[1]:=txt_2_3_test_pw100;
RadioGrouppwrequest.Items[2]:=txt_2_9_test_pw2G;
RadioGrouppwrequest.Items[3]:=txt_2_3_test_pw;
RadioGrouppwrequest.Items[4]:=txt_always_pw;
LabelTitleOptions4.Caption:=txt_4_6_fm+'   ';
Labeloptsub6.Caption:=txt_browser;
cbqdup.caption:=txt_9_1_qdup;
LabelOptsub1.Caption:=txt_filetools;
Labeloptsub3.Caption:=txt_dispaly;
Labeloptsub4.Caption:=txt_check_select;
Labeloptsub5.Caption:=txt_check_select;
Labeloptsub6.Caption:=txt_8_3_prefalgo;
RadioGroup3.Items.Strings[0]:=txt_8_3_prefalgo;
RadioGroup3.Items.Strings[1]:=txt_performall;
LabelOptsub2.Caption:=txt_8_3_mbu;
ComboBoxKiB.Items[0]:=txt_8_3_mbubin;
ComboBoxKiB.Items[1]:=txt_8_3_mbudec;
ComboBoxKiB.Items[2]:=txt_2_9_none;
LabelOptsub2.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;
theme_label1.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;
LabelConf1.Caption:=txt_3_2_conf;
LabelConfigureSendTo.Caption:=txt_3_1_sendto;
LabelAppPath.Caption:=txt_3_3_apppath;
LabelLang2.Caption:=txt_localization;
LabelLang2.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_slow;
ComboBoxBrowser.Items.Strings[2]:=txt_level_normal;
ComboBoxBrowser.Items.Strings[3]:=txt_level_fast;
ComboBoxBrowser.Items.Strings[4]:=txt_level_fastest;
ComboBoxBrowser.Items.Strings[5]:=txt_8_1_nopreparse;
ComboBoxBrowser.Hint:=txt_8_1_preparsehint;
CheckBoxPrebrowse.Caption:=txt_8_1_bo;
CheckBoxPrebrowse.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;
RadioGroup4.Items.Strings[0]:=txt_console_interface;
RadioGroup4.Items.Strings[1]:=txt_guicl;
RadioGroup4.Items.Strings[2]:=txt_guipealauncher;
RadioGroup6.Items.Strings[0]:=txt_2_6_plalways;
RadioGroup6.Items.Strings[1]:=txt_8_9_stoptest;
RadioGroup6.Items.Strings[2]:=txt_2_6_plsmart;
RadioGroup6.Items.Strings[3]:=txt_8_4_keepopenerrorslist;
RadioGroup6.Items.Strings[4]:=txt_autoclose;
cbEncoding1.Items.Strings[0]:=txt_7_6_defaultenc;
cbEncoding1.Items.Strings[1]:=txt_7_6_forceutf8enc;
cbEncoding1.Items.Strings[2]:=txt_7_6_forcelocalenc;
cbEncoding1.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;
Labelcb15.Caption:=txt_2_9_tree;
Labelcb16.Caption:=txt_8_0_defaultaction;
Labelcb16.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;
cbEncoding1.Hint:=txt_7_6_cpnote;
Labelenc.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;
labelcolor4.Caption:=txt_8_3_temperature;
labelcolor5.Caption:=txt_9_3_contrast;
LabelColor1.Caption:=txt_pea_appcolor;
LabelColor2.Caption:=txt_7_6_color;
tbtemperature.hint:=txt_8_3_temperature;
LabelColor3.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;
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;
Button1.Caption:=txt_2_7_cancel;
Button2.Caption:=txt_2_7_ok;
ImageDefaults2.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;
pmjumpsearch.Caption:=txt_searchanddrag;
munsearch.Caption:=txt_searchanddrag;
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+' (F5)';
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+' (Ctrl+A)';
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_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;
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_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_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;
mtoggletool.Caption:=txt_8_9_ttb;
MenuItemOrganizeNavbar.Caption:=txt_4_5_shnav;
mshownavbar.Caption:=txt_4_5_shnav;
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;
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)';
mLang.Caption:=txt_localization;
w7contextlang.Caption:=txt_5_3_cml;
mprofileultra7z.Caption:=txt_5_3_profilebest;
mprofilenormal7z.Caption:=txt_5_3_profileadvanced;
mprofilezipbz2.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;
mprofilebetterzpaq.Caption:=txt_7_2_extcomp;
mprofilealtarc.Caption:=txt_7_2_altcomp;
mprofilerar.Caption:=txt_7_4_presetrar;
mprofilebrotli.Caption:={$IFDEF MSWINDOWS}txt_7_4_7zfbrotlicomp{$ELSE}txt_7_2_fbrotlicomp{$ENDIF};
mprofilezstd.Caption:={$IFDEF MSWINDOWS}txt_7_4_7zfzstandardcomp{$ELSE}txt_7_2_fzstandardcomp{$ENDIF};
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_2_5_encoding;
pmtextenc.Caption:=txt_2_5_encoding;
mtenc.Caption:=txt_2_5_encoding;
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;
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_6_3_cinfo;
pmmoretest.Caption:=txt_caption_test;
po_details.Caption:=txt_6_3_cinfo;
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;
MenuItemOpen_organizebookmarks.Caption:=txt_2_9_organize;
pmorganizebookmarks.Caption:=txt_2_9_organize;
pmws.Caption:=txt_search_web;
pmcommand.Caption:=txt_cphere;
pmbccp.Caption:=txt_cphere;
pmbcps.Caption:=txt_5_0_ps;
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;
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_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)';
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;
{$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)';
mfunadd.Caption:=txt_add;
mfunconvert.Caption:=txt_2_8_convert;
mfunextract.Caption:=txt_caption_extract;
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;
mfilterbrowser.caption:=txt_8_5_advbrowser;
mOptions.Caption:=txt_options;
sbBrowse.Caption:=txt_browse;
MenuItemOpen_up.Caption:=txt_up;
MenuItemOpen_back.Caption:=txt_back;
MenuItemOpen_fwd.Caption:=txt_fwd;
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;
MenuItemOpen_Flat.Caption:=txt_toggle_browseflat;
MenuItemOpen_refresh.Caption:=txt_fefreshf5;
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;
MenuItemOpen_desktop1.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;
pmqedisplayed.Caption:=txt_ext_disp;
pmqeselected.Caption:=txt_ext_sel;
pmJump1.Caption:=txt_mypc;
MenuItemOpen_pc.Caption:=txt_mypc;
MenuItemArchive_pc.Caption:=txt_mypc;
pmJump3.Caption:=txt_2_9_home;
pmJump2.Caption:=txt_desktop;
pmJumpPath.Caption:=txt_open_path;
pmJumpArchive.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;
EditOPcustom1.Hint:=txt_otherparams;
OpenDialogLang.Title:=txt_open_file;
OpenDialogList.Title:=txt_open_files;
OpenDialogArchive.Title:=txt_open_file;
OpenDialogTheme.Title:=txt_open_file;
SelectDirectoryDialog1.Title:=txt_selectdir;
SelectDirectoryDialog2.Title:=txt_selectdir;
SaveDialogPJ.Title:=txt_savejobdefinition;
SaveDialog2.Title:=txt_saveas;
po_convert.Caption:=txt_convert;
mextractarchive.caption:=txt_archive;
mtogglenew.caption:=txt_newfoldermenu+' (Shift+Ctrl+N)';
mcancel.caption:=txt_2_7_cancel;
mgotype.caption:=txt_type;
ComboBoxTheme.Items.Strings[6]:=txt_custom;
ComboBoxPAQ1.Items.Strings[0]:=txt_level_fast;
ComboBoxPAQ1.Items.Strings[1]:=txt_level_normal;
ComboBoxPAQ1.Items.Strings[2]:=txt_level_maximum;
ComboBoxPAQ1.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;
ComboBoxPEACompression1.Items.Strings[0]:=txt_bettercompression;
ComboBoxPEACompression1.Items.Strings[1]:=txt_default_compression;
ComboBoxPEACompression1.Items.Strings[2]:=txt_fastcompr;
ComboBoxPEACompression1.Items.Strings[3]:=txt_nocompress_hint;
ComboBoxPEA3.Items.Strings[13]:=txt_none2;
ComboBoxPEA4.Items.Strings[13]:=txt_none2;
ComboBoxSplit3.Items.Strings[13]:=txt_none2;
ComboBoxArchive7.Items.Strings[0]:=txt_newarchive;
ComboBoxArchive7.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxArchive7.Items.Strings[2]:=txt_update;
ComboBoxArchive7.Items.Strings[3]:=txt_6_3_uar;
ComboBoxArchive7.Items.Strings[4]:=txt_6_3_syn;
ComboBoxArchiveAct.Items.Strings[0]:=txt_newarchive;
ComboBoxArchiveAct.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxArchiveAct.Items.Strings[2]:=txt_update;
ComboBoxArchiveAct.Items.Strings[3]:=txt_6_3_uar;
ComboBoxArchiveAct.Items.Strings[4]:=txt_6_3_syn;
ComboBoxArchiveAct1.Items.Strings[0]:=txt_newarchive;
ComboBoxArchiveAct1.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxArchiveAct1.Items.Strings[2]:=txt_update;
ComboBoxArchiveAct1.Items.Strings[3]:=txt_6_3_uar;
ComboBoxArchiveAct1.Items.Strings[4]:=txt_6_3_syn;
ComboBoxArchive8.Items.Strings[0]:=txt_singlethread;
ComboBoxArchive8.Items.Strings[1]:=txt_multithreading;
ComboBoxmemuse.Items.Strings[0]:=txt_default;
ComboBoxArchive4.Items.Strings[0]:=txt_level_store;
ComboBoxArchive4.Items.Strings[1]:=txt_level_fastest;
ComboBoxArchive4.Items.Strings[2]:=txt_level_fast;
ComboBoxArchive4.Items.Strings[3]:=txt_level_normal;
ComboBoxArchive4.Items.Strings[4]:=txt_level_maximum;
ComboBoxArchive4.Items.Strings[5]:=txt_level_ultra;
ComboBoxArchiveSolid.Items.Strings[0]:=txt_nonsolid;
ComboBoxArchiveSolid.Items.Strings[18]:=txt_solid;
ComboBoxArchiveSolid.Items.Strings[19]:=txt_solid_extension;
RadioGroupArchive.Items.Strings[0]:=txt_console;
RadioGroupArchive.Items.Strings[1]:=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;
ComboBoxARC.Items.Strings[0]:='0 '+txt_store;
ComboBoxARC.Items.Strings[1]:='1 '+txt_fastermem;
ComboBoxARC.Items.Strings[4]:='4 '+txt_default2;
ComboBoxARC.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;
ComboBoxARC2.Items.Strings[0]:=txt_newarchive;
ComboBoxARC2.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxARC2.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;
RadioGroupAction.Items.Strings[0]:=txt_caption_extract;
RadioGroupAction.Items.Strings[1]:=txt_ext_nopath;
RadioGroupAction.Items.Strings[2]:=txt_caption_list;
RadioGroupAction.Items.Strings[3]:=txt_list_details;
RadioGroupAction.Items.Strings[4]:=txt_caption_test;
RadioGroupAction.ItemIndex:=0;
RadioGroupAction1.Items.Strings[0]:=txt_caption_extract;
RadioGroupAction1.Items.Strings[1]:=txt_ext_nopath;
RadioGroupAction1.Items.Strings[2]:=txt_caption_list;
RadioGroupAction1.Items.Strings[3]:=txt_caption_test;
RadioGroupAction1.ItemIndex:=0;
ComboBoxOverwriteARC.Items.Strings[0]:=txt_overwrite_askbefore;
ComboBoxOverwriteARC.Items.Strings[1]:=txt_overwrite;
ComboBoxOverwriteARC.Items.Strings[2]:=txt_skip_existing;
RadioGroupActionARC.Items.Strings[0]:=txt_caption_extract;
RadioGroupActionARC.Items.Strings[1]:=txt_ext_nopath;
RadioGroupActionARC.Items.Strings[2]:=txt_caption_list;
RadioGroupActionARC.Items.Strings[3]:=txt_list_details;
RadioGroupActionARC.Items.Strings[4]:=txt_caption_test;
RadioGroupActionARC.Items.Strings[5]:=txt_caption_repair;
RadioGroupActionARC.ItemIndex:=0;
ComboBoxArchiveCustom1.Items.Strings[0]:=txt_pio;
ComboBoxArchiveCustom1.Items.Strings[1]:=txt_poi;
ComboBoxArchiveCustom1.Items.Strings[2]:=txt_ipo;
ComboBoxArchiveCustom1.Items.Strings[3]:=txt_iop;
ComboBoxArchiveCustom1.Items.Strings[4]:=txt_opi;
ComboBoxArchiveCustom1.Items.Strings[5]:=txt_oip;
RadioGroup0.Items.Strings[4]:=txt_custom;
RadioGroup0.Items[8]:=txt_sfx+' '+STR_7Z;
RadioGroup0.Items[9]:=txt_sfx+' '+STR_ARC;
RadioGroup0.Items.Strings[10]:=txt_split;
RadioGroup0.Items.Strings[18]:=txt_lastused;
ComboBoxPEACompression1.Text:=txt_default_compression;
ComboBoxUPX.Text:=txt_best;
ComboBoxArchive8.Text:=txt_multithreading;
ComboBoxArchiveCustom.Text:=txt_pio;
ComboBoxArcSolid.Text:=txt_solid_auto;
ComboBoxARC2.Text:=txt_newarchive;
EditOpenIn.Text:=txt_none;
ComboBoxOverwrite.Text:=txt_ren_extracted;
ComboBoxArchiveCustom1.Text:=txt_pio;
ComboBoxArchive7.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+' - '+s;
readln(t,s);//last revision's translator(s)
langstrhint:=langstrhint+' - '+s;
readln(t,s);//last revision date
langstrhint:=langstrhint+' - '+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);
   readln(t,s); //declaration
   if 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+' - '+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);
      form_peach.MemoAbout.Lines.Clear;
      form_peach.MemoAbout.Lines.Append(APPMAIN+' '+PEAZIPVERSION+PEAZIPREVISION+' - '+caption_build);
      form_peach.MemoAbout.Lines.Append('');
      form_peach.MemoAbout.Lines.Append(txt_read+' '+READE_LIST);
      form_peach.MemoAbout.Lines.Append('');
      form_peach.MemoAbout.Lines.Append(txt_write+' '+WRITEE_LIST);
      form_peach.MemoAbout.Lines.Append('');
      repeat
         readln(t,s);
         form_peach.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_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, treeview, none';
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';
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:='Will run backend binaries in console, cannot browse archives with encrypted filenames. Allows to create scripts that will not run unattended but rather ask user interactively for password.';
txt_7_9_spacing:='Spacing';
txt_7_9_zooming:='Zooming';
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:='7z/p7zip 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:='Remove redundant directory on extraction in 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:='Performance';
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 Recycle Bin?';
txt_4_7_recycle:='Move to Recycle Bin';
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 Navigation 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 seems 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:='Navigation 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 preview';
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: native interface';
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 recycle bin';
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:='Graphic + console';
txt_guipealauncher:='Graphic: wrapped by PeaLauncher';
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:='Save task definition as plain text; you can use it from your scripts';
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';
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, bookmarks, history, clipboard';
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 msg_not_accessible(i:integer);
begin

end;

procedure msg_not_accessible_s(s:ansistring);
begin

end;

procedure msg_not_accessible_list(s:ansistring);
begin

end;

procedure msg_no_input;
begin

end;

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

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

configuration and theming

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

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 (upcase(theme_name)<>upcase(DEFAULT_THEME)) and (upcase(theme_name)<>'NOGRAPHIC-EMBEDDED') then thpath:=confpath
else thpath:=sharepath;
end;

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

procedure setexticonsize(icon_size:integer; var icon_sizep:integer);
begin
{$IFDEF DARWIN}
icon_sizep:=((icon_size)*qscaleimages) div 100; //currently only supports small icons, and size is fixed
{$ELSE}
icon_sizep:=((icon_size+((pspacing*icon_size) div 16))*qscaleimages) div 100;
{$ENDIF}
reficonsize:=icon_sizep;
baseiconsize:=icon_size;
end;

procedure loadlargeicons(icon_size:integer);
var
   abitmap:TBitmap;
   icon_sizep:integer;
begin
with form_peach do
   begin
   setexticonsize(icon_size,icon_sizep);
   case icon_size of
   48: begin
   clearimagelist(il48);
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bexesupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bfilesupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(BFolder48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Blink48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bunsupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bfd_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bhd_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bram_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bremote_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Baudio48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Btxt48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bvideo48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bweb48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bimage48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bpresentation48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bpdf48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bbat48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bsupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdll48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bmail48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdb48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bgif48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bico48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bvector48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bjpeg48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bhomefolder,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdownloadfolder,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bcloudfolder,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barc7z48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcrar48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barczip48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcblock48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcdisk48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcinstaller48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   ListView1.LargeImages:=il48;
   end;
   96: begin
   clearimagelist(il96);
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bexesupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bfilesupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(BFolder96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Blink96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bunsupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bfd_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bhd_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bram_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bremote_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Baudio96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Btxt96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bvideo96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bweb96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bimage96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bpresentation96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bpdf96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bbat96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bsupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdll96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bmail96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdb96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bgif96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bico96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bvector96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bjpeg96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bhomefolder,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdownloadfolder,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bcloudfolder,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barc7z96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcrar96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barczip96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcblock96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcdisk96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcinstaller96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   ListView1.LargeImages:=il96;
   end;
   192: begin
   clearimagelist(il192);
   abitmap:=Tbitmap.Create;
   setpbitmap_tobitmap(Barchivesupported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bexesupported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bfilesupported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(BFolder96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Blink96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bunsupported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdvd_supported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bfd_supported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bhd_supported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bram_supported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bremote_supported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bremovable_supported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Baudio96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bspreadsheet96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Btxt96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bvideo96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bweb96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bimage96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bpresentation96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bpdf96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bbat96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bsupported96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdll96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bmail96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdb96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bgif96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bico96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bvector96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Binfo,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bsearch,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bbookmark,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Broot,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bsystemtools,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bexpand,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bgopath,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bjpeg96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdesk,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bplaceshistory,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bbookmarkadd,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Brun,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bpreview,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bapps,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bhomefolder,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdownloadfolder,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bcloudfolder,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Barc7z96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Barcrar96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Barczip96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Barcblock96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Barcdisk96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Barcinstaller96,abitmap,baseiconsize);
   setsize_bitmap(abitmap, reficonsize, DECO_NONE);
   il192.Add(abitmap,nil);
   ListView1.LargeImages:=il192;
   end;
   end;
   end;
end;

procedure loadsmallicons(icon_size:integer);
var
   abitmap:TBitmap;
   icon_sizep,pspacing_p:integer;
begin
with form_peach do
   begin
   setexticonsize(icon_size,icon_sizep);
   case icon_size of
   16: begin
   clearimagelist(il16);
   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);
   ListView1.SmallImages:=il16;
   end;
   48: begin
   clearimagelist(il48);
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bexesupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bfilesupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(BFolder48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Blink48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bunsupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bfd_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bhd_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bram_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bremote_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Baudio48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Btxt48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bvideo48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bweb48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bimage48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bpresentation48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bpdf48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bbat48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bsupported48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdll48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bmail48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdb48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bgif48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bico48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bvector48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bjpeg48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bhomefolder,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bdownloadfolder,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Bcloudfolder,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barc7z48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcrar48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barczip48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcblock48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcdisk48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   loadlargeicon(Barcinstaller48,abitmap,icon_sizep);
   il48.Add(abitmap,nil);
   ListView1.SmallImages:=il48;
   end;
   96: begin
   clearimagelist(il96);
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bexesupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bfilesupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(BFolder96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Blink96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bunsupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bfd_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bhd_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bram_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bremote_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Baudio96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Btxt96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bvideo96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bweb96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bimage96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bpresentation96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bpdf96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bbat96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bsupported96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdll96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bmail96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdb96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bgif96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bico96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bvector96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bjpeg96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bhomefolder,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bdownloadfolder,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Bcloudfolder,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barc7z96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcrar96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barczip96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcblock96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcdisk96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   loadlargeicon(Barcinstaller96,abitmap,icon_sizep);
   il96.Add(abitmap,nil);
   ListView1.SmallImages:=il96;
   end;
   end;
   end;
end;

procedure loadimglist1icons;
var
   abitmap:TBitmap;
begin
with Form_peach 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);
end;
end;

procedure load_icons; //load icons from bitmaps
var
   i:integer;
   thpath:ansistring;
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 Form_peach do
   begin
   try
   //set non-themed graphic
   Bnonthemed0:=TBitmap.Create;
   Bnonthemed1:=TBitmap.Create;
   Bnonthemed3:=TBitmap.Create;
   Bnonthemed4:=TBitmap.Create;
   Bnonthemed5:=TBitmap.Create;
   Bnonthemed6:=TBitmap.Create;
   Bnonthemed7:=TBitmap.Create;
   Bnonthemed8:=TBitmap.Create;
   Bnonthemed9:=TBitmap.Create;
   Bnonthemed10:=TBitmap.Create;
   Bnonthemed11:=TBitmap.Create;
   Bp1:=TBitmap.Create;
   Bp2:=TBitmap.Create;
   Bp3:=TBitmap.Create;
   Bp4:=TBitmap.Create;
   Bp5:=TBitmap.Create;
   Bp6:=TBitmap.Create;
   Bp7:=TBitmap.Create;
   Bp8:=TBitmap.Create;
   binfodlg:=TBitmap.Create;
   bwarningdlg:=TBitmap.Create;
   berrordlg:=TBitmap.Create;
   il_nonthemed.getbitmap(0,Bnonthemed0);
   il_nonthemed.getbitmap(1,Bnonthemed1);
   il_nonthemed.getbitmap(2,Bnonthemed3);
   il_nonthemed.getbitmap(3,Bnonthemed4);
   il_nonthemed.getbitmap(4,Bnonthemed5);
   il_nonthemed.getbitmap(5,Bnonthemed6);
   il_nonthemed.getbitmap(6,Bnonthemed7);
   il_nonthemed.getbitmap(7,Bnonthemed8);
   il_nonthemed.getbitmap(8,Bnonthemed9);
   il_nonthemed.getbitmap(9,Bnonthemed10);
   il_nonthemed.getbitmap(10,Bnonthemed11);
   il_nonthemed.getbitmap(11,Bp1);
   il_nonthemed.getbitmap(12,Bp2);
   il_nonthemed.getbitmap(13,Bp3);
   il_nonthemed.getbitmap(14,Bp4);
   il_nonthemed.getbitmap(15,Bp5);
   il_nonthemed.getbitmap(16,Bp6);
   il_nonthemed.getbitmap(17,Bp7);
   il_nonthemed.getbitmap(18,Bp8);
   ImageListDlg.getbitmap(0,binfodlg);
   ImageListDlg.getbitmap(1,bwarningdlg);
   ImageListDlg.getbitmap(2,berrordlg);
   setpbitmap(Bnonthemed0,i16res);
   setpbitmap(Bnonthemed1,i16res);
   setpbitmap(Bnonthemed3,i16res);
   setpbitmap(Bnonthemed4,i16res);
   setpbitmap(Bnonthemed5,i16res);
   setpbitmap(Bnonthemed6,i16res);
   setpbitmap(Bnonthemed7,i16res);
   setpbitmap(Bnonthemed8,i16res);
   setpbitmap(Bnonthemed9,i16res);
   setpbitmap(Bnonthemed10,i16res);
   setpbitmap(Bnonthemed11,i16res);
   setpbitmap(Bp1,i16res);
   setpbitmap(Bp2,i16res);
   setpbitmap(Bp3,i16res);
   setpbitmap(Bp4,i16res);
   setpbitmap(Bp5,i16res);
   setpbitmap(Bp6,i16res);
   setpbitmap(Bp7,i16res);
   setpbitmap(Bp8,i16res);
   setpbitmap(binfodlg,i32res);
   setpbitmap(bwarningdlg,i32res);
   setpbitmap(berrordlg,i32res);
   ButtonUn7za6.Glyph:=Bnonthemed0;
   ButtonUn7za7.Glyph:=Bnonthemed0;
   ButtonUn7za8.Glyph:=Bnonthemed0;
   ButtonUn7za11.Glyph:=Bnonthemed0;
   ButtonUn7za9.Glyph:=Bnonthemed0;
   Buttoncmto.Glyph:=Bnonthemed0;
   Buttonopenactions.Glyph:=Bnonthemed0;
   Buttonfmactions.Glyph:=Bnonthemed0;
   Buttonfmactions1.Glyph:=Bnonthemed0;
   ButtonImg6.Glyph:=Bnonthemed0;
   ButtonImgR.Glyph:=Bnonthemed0;
   ButtonImgRes.Glyph:=Bnonthemed0;
   Imagelistroot.Picture.Bitmap:=Bnonthemed0;
   ButtonEditname12.Glyph:=Bnonthemed0;
   ButtonEditname14.Glyph:=Bnonthemed0;
   ButtonEditname8.Glyph:=Bnonthemed0;
   ButtonEditname13.Glyph:=Bnonthemed0;
   ButtonUn7za10.Glyph:=Bnonthemed0;
   ButtonEditname4.Glyph:=Bnonthemed0;
   ImageAddress0.Picture.Bitmap:=Bnonthemed5;
   ImageAddress1.Picture.Bitmap:=Bnonthemed5;
   ImageAddress2.Picture.Bitmap:=Bnonthemed5;
   ImageAddress3.Picture.Bitmap:=Bnonthemed5;
   ImageAddress4.Picture.Bitmap:=Bnonthemed5;
   ImageAddress5.Picture.Bitmap:=Bnonthemed5;
   ImageAddress6.Picture.Bitmap:=Bnonthemed5;
   ImageAddress7.Picture.Bitmap:=Bnonthemed5;
   ImageAdArchive0.Picture.Bitmap:=Bnonthemed5;
   ImageAdArchive1.Picture.Bitmap:=Bnonthemed5;
   ImageAdArchive2.Picture.Bitmap:=Bnonthemed5;
   ImageAdArchive3.Picture.Bitmap:=Bnonthemed5;
   //ImageBCtext.Picture.Bitmap:=Bnonthemed6;
   mAdmin.Bitmap:=Bnonthemed7;
   ctrlext.Glyph:=Bnonthemed10;
   ctrlarc.Glyph:=Bnonthemed10;
   panelnav4.Glyph:=Bnonthemed8;
   Imageopenadvf.Width:=i16res;
   Imageopenadvf.Height:=i16res;
   Imageopenadvf.Picture.Bitmap:=Bnonthemed9;
   Imageopenadvf1.Width:=i16res;
   Imageopenadvf1.Height:=i16res;
   Imageopenadvf1.Picture.Bitmap:=Bnonthemed9;
   Imageopenadvf2.Width:=i16res;
   Imageopenadvf2.Height:=i16res;
   Imageopenadvf2.Picture.Bitmap:=Bnonthemed9;
   imagesp.Width:=i16res;
   imagesp.Height:=i16res;
   imagesp.Picture.Bitmap:=Bnonthemed11;
   imagesp1.Width:=i16res;
   imagesp1.Height:=i16res;
   imagesp1.Picture.Bitmap:=Bnonthemed11;
   //set themed graphic
   Bbrowserdetails:=TBitmap.Create;
   Bbrowserlist:=TBitmap.Create;
   Bbrowsericons:=TBitmap.Create;
   Bbrowserdetailslarge:=TBitmap.Create;
   Bbrowserlistlarge:=TBitmap.Create;
   Bbrowsericonslarge:=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;
   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_supported48:=TBitmap.Create;
   Bfd_supported48:=TBitmap.Create;
   BFolder48:=TBitmap.Create;
   Bhd_supported48:=TBitmap.Create;
   Bram_supported48:=TBitmap.Create;
   Bremote_supported48:=TBitmap.Create;
   Bremovable_supported48:=TBitmap.Create;
   Btxt48:=TBitmap.Create;
   Bspreadsheet48:=TBitmap.Create;
   Bvideo48:=TBitmap.Create;
   Baudio48:=TBitmap.Create;
   Bimage48:=TBitmap.Create;
   Bpresentation48:=TBitmap.Create;
   Bpdf48:=TBitmap.Create;
   Bsupported48:=TBitmap.Create;
   Bbat48:=TBitmap.Create;
   Bdll48:=TBitmap.Create;
   Bdb48:=TBitmap.Create;
   Bgif48:=TBitmap.Create;
   Bico48:=TBitmap.Create;
   Bvector48:=TBitmap.Create;
   Bjpeg48:=TBitmap.Create;
   BArchiveSupported48:=TBitmap.Create;
   BFileSupported48:=TBitmap.Create;
   BExesupported48:=TBitmap.Create;
   Bunsupported48:=TBitmap.Create;
   Blink48:=TBitmap.Create;
   Bweb48:=TBitmap.Create;
   Bmail48:=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;
   Barc7z48:=TBitmap.Create;
   Barcrar48:=TBitmap.Create;
   Barczip48:=TBitmap.Create;
   Barcblock48:=TBitmap.Create;
   Barcdisk48:=TBitmap.Create;
   Barcinstaller48:=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 upcase(theme_name)<>'NOGRAPHIC-EMBEDDED' then
   begin
   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,Bbrowserdetails);
   il_dtheme_16.getbitmap(74,Bbrowserlist);
   il_dtheme_16.getbitmap(75,Bbrowsericons);
   il_dtheme_16.getbitmap(76,Bbrowserdetailslarge);
   il_dtheme_16.getbitmap(77,Bbrowserlistlarge);
   il_dtheme_16.getbitmap(78,Bbrowsericonslarge);
   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_48.getbitmap(0,Bdvd_supported48);
   il_dtheme_48.getbitmap(1,Bfd_supported48);
   il_dtheme_48.getbitmap(2,Bhd_supported48);
   il_dtheme_48.getbitmap(3,Bram_supported48);
   il_dtheme_48.getbitmap(4,Bremote_supported48);
   il_dtheme_48.getbitmap(5,Bremovable_supported48);
   il_dtheme_48.getbitmap(6,BArchiveSupported48);
   il_dtheme_48.getbitmap(7,Baudio48);
   il_dtheme_48.getbitmap(8,Bdll48);
   il_dtheme_48.getbitmap(9,Bdb48);
   il_dtheme_48.getbitmap(10,BFileSupported48);
   il_dtheme_48.getbitmap(11,BExeSupported48);
   il_dtheme_48.getbitmap(12,Bimage48);
   il_dtheme_48.getbitmap(13,Bico48);
   il_dtheme_48.getbitmap(14,Bjpeg48);
   il_dtheme_48.getbitmap(15,Bgif48);
   il_dtheme_48.getbitmap(16,Bvector48);
   il_dtheme_48.getbitmap(17,Blink48);
   il_dtheme_48.getbitmap(18,Bmail48);
   il_dtheme_48.getbitmap(19,Bpdf48);
   il_dtheme_48.getbitmap(20,Bpresentation48);
   il_dtheme_48.getbitmap(21,Bbat48);
   il_dtheme_48.getbitmap(22,Bspreadsheet48);
   il_dtheme_48.getbitmap(23,Bsupported48);
   il_dtheme_48.getbitmap(24,Btxt48);
   il_dtheme_48.getbitmap(25,BUnsupported48);
   il_dtheme_48.getbitmap(26,Bvideo48);
   il_dtheme_48.getbitmap(27,Bweb48);
   il_dtheme_48.getbitmap(28,BFolder48);
   il_dtheme_48.getbitmap(29,Barc7z48);
   il_dtheme_48.getbitmap(30,Barcrar48);
   il_dtheme_48.getbitmap(31,Barczip48);
   il_dtheme_48.getbitmap(32,Barcblock48);
   il_dtheme_48.getbitmap(33,Barcdisk48);
   il_dtheme_48.getbitmap(34,Barcinstaller48);
   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_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;
   if upcase(theme_name)='NOGRAPHIC-EMBEDDED' then
   begin
   il_nonthemed.getbitmap(6,Bbookmarkadd);
   il_nonthemed.getbitmap(6,Bapps);
   il_nonthemed.getbitmap(6,BArchive);
   il_nonthemed.getbitmap(6,Bclearlayout);
   il_nonthemed.getbitmap(6,Bconvert);
   il_nonthemed.getbitmap(6,Bdelete);
   il_nonthemed.getbitmap(6,Bextractall);
   il_nonthemed.getbitmap(6,Bextractalln);
   il_nonthemed.getbitmap(6,Bloadlayout);
   il_nonthemed.getbitmap(6,Bpreview);
   il_nonthemed.getbitmap(6,Brun);
   il_nonthemed.getbitmap(6,Bsavelayout);
   il_nonthemed.getbitmap(6,Bwipe);
   il_nonthemed.getbitmap(6,Btestall);
   il_nonthemed.getbitmap(6,Bdvd_supported);
   il_nonthemed.getbitmap(6,Bfd_supported);
   il_nonthemed.getbitmap(6,Bhd_supported);
   il_nonthemed.getbitmap(6,Bram_supported);
   il_nonthemed.getbitmap(6,Bremote_supported);
   il_nonthemed.getbitmap(6,Bremovable_supported);
   il_nonthemed.getbitmap(6,BArchiveSupported);
   il_nonthemed.getbitmap(6,Baudio);
   il_nonthemed.getbitmap(6,Bdll);
   il_nonthemed.getbitmap(6,Bdb);
   il_nonthemed.getbitmap(6,BFileSupported);
   il_nonthemed.getbitmap(6,BExeSupported);
   il_nonthemed.getbitmap(6,Bimage);
   il_nonthemed.getbitmap(6,Bico);
   il_nonthemed.getbitmap(6,Bjpeg);
   il_nonthemed.getbitmap(6,Bgif);
   il_nonthemed.getbitmap(6,Bvector);
   il_nonthemed.getbitmap(6,Blink);
   il_nonthemed.getbitmap(6,Bmail);
   il_nonthemed.getbitmap(6,Bpdf);
   il_nonthemed.getbitmap(6,Bpresentation);
   il_nonthemed.getbitmap(6,Bbat);
   il_nonthemed.getbitmap(6,Bspreadsheet);
   il_nonthemed.getbitmap(6,Bsupported);
   il_nonthemed.getbitmap(6,Btxt);
   il_nonthemed.getbitmap(6,BUnsupported);
   il_nonthemed.getbitmap(6,Bvideo);
   il_nonthemed.getbitmap(6,Bweb);
   il_nonthemed.getbitmap(6,BFolder);
   il_nonthemed.getbitmap(6,Binfo);
   il_nonthemed.getbitmap(6,Bnav);
   il_nonthemed.getbitmap(6,Bkeyfile);
   il_nonthemed.getbitmap(6,Blocker);
   il_nonthemed.getbitmap(6,Blocker2);
   il_nonthemed.getbitmap(6,Bback);
   il_nonthemed.getbitmap(6,Bexpand);
   il_nonthemed.getbitmap(6,Bgo);
   il_nonthemed.getbitmap(6,Brefresh);
   il_nonthemed.getbitmap(6,Bsearch);
   il_nonthemed.getbitmap(6,Bgopath);
   il_nonthemed.getbitmap(6,Bresetpath);
   il_nonthemed.getbitmap(6,Bgoup);
   il_nonthemed.getbitmap(6,Bp0);
   il_nonthemed.getbitmap(6,Bbookmark);
   il_nonthemed.getbitmap(6,Bdesk);
   il_nonthemed.getbitmap(6,Bplaceshistory);
   il_nonthemed.getbitmap(6,Broot);
   il_nonthemed.getbitmap(6,Bsystemtools);
   il_nonthemed.getbitmap(6,BDefaults);
   il_nonthemed.getbitmap(6,Bstop);
   il_nonthemed.getbitmap(6,BTool_cut_small);
   il_nonthemed.getbitmap(6,BTool_copy_small);
   il_nonthemed.getbitmap(6,BTool_dup_small);
   il_nonthemed.getbitmap(6,Btool_properties_small);
   il_nonthemed.getbitmap(6,Btool_rename_small);
   il_nonthemed.getbitmap(6,Btool_resize_small);
   il_nonthemed.getbitmap(6,Btool_crop_small);
   il_nonthemed.getbitmap(6,BTool_rl_small);
   il_nonthemed.getbitmap(6,BTool_rr_small);
   il_nonthemed.getbitmap(6,Bbrowserdetails);
   il_nonthemed.getbitmap(6,Bbrowserlist);
   il_nonthemed.getbitmap(6,Bbrowsericons);
   il_nonthemed.getbitmap(6,Bbrowserdetailslarge);
   il_nonthemed.getbitmap(6,Bbrowserlistlarge);
   il_nonthemed.getbitmap(6,Bbrowsericonslarge);
   il_nonthemed.getbitmap(6,Bhomefolder);
   il_nonthemed.getbitmap(6,Bdownloadfolder);
   il_nonthemed.getbitmap(6,Bcloudfolder);
   il_nonthemed.getbitmap(6,Barc7z);
   il_nonthemed.getbitmap(6,Barcrar);
   il_nonthemed.getbitmap(6,Barczip);
   il_nonthemed.getbitmap(6,Barcblock);
   il_nonthemed.getbitmap(6,Barcdisk);
   il_nonthemed.getbitmap(6,Barcinstaller);
   il_nonthemed.getbitmap(6,Bdvd_supported48);
   il_nonthemed.getbitmap(6,Bfd_supported48);
   il_nonthemed.getbitmap(6,Bhd_supported48);
   il_nonthemed.getbitmap(6,Bram_supported48);
   il_nonthemed.getbitmap(6,Bremote_supported48);
   il_nonthemed.getbitmap(6,Bremovable_supported48);
   il_nonthemed.getbitmap(6,BArchiveSupported48);
   il_nonthemed.getbitmap(6,Baudio48);
   il_nonthemed.getbitmap(6,Bdll48);
   il_nonthemed.getbitmap(6,Bdb48);
   il_nonthemed.getbitmap(6,BFileSupported48);
   il_nonthemed.getbitmap(6,BExeSupported48);
   il_nonthemed.getbitmap(6,Bimage48);
   il_nonthemed.getbitmap(6,Bico48);
   il_nonthemed.getbitmap(6,Bjpeg48);
   il_nonthemed.getbitmap(6,Bgif48);
   il_nonthemed.getbitmap(6,Bvector48);
   il_nonthemed.getbitmap(6,Blink48);
   il_nonthemed.getbitmap(6,Bmail48);
   il_nonthemed.getbitmap(6,Bpdf48);
   il_nonthemed.getbitmap(6,Bpresentation48);
   il_nonthemed.getbitmap(6,Bbat48);
   il_nonthemed.getbitmap(6,Bspreadsheet48);
   il_nonthemed.getbitmap(6,Bsupported48);
   il_nonthemed.getbitmap(6,Btxt48);
   il_nonthemed.getbitmap(6,BUnsupported48);
   il_nonthemed.getbitmap(6,Bvideo48);
   il_nonthemed.getbitmap(6,Bweb48);
   il_nonthemed.getbitmap(6,BFolder48);
   il_nonthemed.getbitmap(6,Barc7z48);
   il_nonthemed.getbitmap(6,Barcrar48);
   il_nonthemed.getbitmap(6,Barczip48);
   il_nonthemed.getbitmap(6,Barcblock48);
   il_nonthemed.getbitmap(6,Barcdisk48);
   il_nonthemed.getbitmap(6,Barcinstaller48);
   il_nonthemed.getbitmap(6,Bdvd_supported96);
   il_nonthemed.getbitmap(6,Bfd_supported96);
   il_nonthemed.getbitmap(6,Bhd_supported96);
   il_nonthemed.getbitmap(6,Bram_supported96);
   il_nonthemed.getbitmap(6,Bremote_supported96);
   il_nonthemed.getbitmap(6,Bremovable_supported96);
   il_nonthemed.getbitmap(6,BArchiveSupported96);
   il_nonthemed.getbitmap(6,Baudio96);
   il_nonthemed.getbitmap(6,Bdll96);
   il_nonthemed.getbitmap(6,Bdb96);
   il_nonthemed.getbitmap(6,BFileSupported96);
   il_nonthemed.getbitmap(6,BExeSupported96);
   il_nonthemed.getbitmap(6,Bimage96);
   il_nonthemed.getbitmap(6,Bico96);
   il_nonthemed.getbitmap(6,Bjpeg96);
   il_nonthemed.getbitmap(6,Bgif96);
   il_nonthemed.getbitmap(6,Bvector96);
   il_nonthemed.getbitmap(6,Blink96);
   il_nonthemed.getbitmap(6,Bmail96);
   il_nonthemed.getbitmap(6,Bpdf96);
   il_nonthemed.getbitmap(6,Bpresentation96);
   il_nonthemed.getbitmap(6,Bbat96);
   il_nonthemed.getbitmap(6,Bspreadsheet96);
   il_nonthemed.getbitmap(6,Bsupported96);
   il_nonthemed.getbitmap(6,Btxt96);
   il_nonthemed.getbitmap(6,BUnsupported96);
   il_nonthemed.getbitmap(6,Bvideo96);
   il_nonthemed.getbitmap(6,Bweb96);
   il_nonthemed.getbitmap(6,BFolder96);
   il_nonthemed.getbitmap(6,Barc7z96);
   il_nonthemed.getbitmap(6,Barcrar96);
   il_nonthemed.getbitmap(6,Barczip96);
   il_nonthemed.getbitmap(6,Barcblock96);
   il_nonthemed.getbitmap(6,Barcdisk96);
   il_nonthemed.getbitmap(6,Barcinstaller96);
   il_nonthemed.getbitmap(6,Bdetailsfs);
   il_nonthemed.getbitmap(6,BArchive_big);
   il_nonthemed.getbitmap(6,Bconvert_big);
   il_nonthemed.getbitmap(6,Bextractall_big);
   il_nonthemed.getbitmap(6,Bextractalln_big);
   il_nonthemed.getbitmap(6,Btestall_big);
   il_nonthemed.getbitmap(6,Btool_cut);
   il_nonthemed.getbitmap(6,Btool_copy);
   il_nonthemed.getbitmap(6,Btool_paste);
   il_nonthemed.getbitmap(6,Btool_openw);
   il_nonthemed.getbitmap(6,Btool_properties);
   il_nonthemed.getbitmap(6,Btool_rename);
   il_nonthemed.getbitmap(6,Btool_delete);
   il_nonthemed.getbitmap(6,Btool_dup);
   il_nonthemed.getbitmap(6,Btool_resize);
   il_nonthemed.getbitmap(6,Btool_crop);
   il_nonthemed.getbitmap(6,BTool_rl);
   il_nonthemed.getbitmap(6,BTool_rr);
   end;
   if (upcase(theme_name)<>'NOGRAPHIC-EMBEDDED') and (upcase(theme_name)<>'MAIN-EMBEDDED') then
   begin
   try
   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(BArchiveSupported48,thpath+graphicsfolder+'48'+directoryseparator+'48-archive.png');
   getthemedbitmap(Barc7z48,thpath+graphicsfolder+'48'+directoryseparator+'48-7z.png');
   getthemedbitmap(Barcrar48,thpath+graphicsfolder+'48'+directoryseparator+'48-rar.png');
   getthemedbitmap(Barczip48,thpath+graphicsfolder+'48'+directoryseparator+'48-zip.png');
   getthemedbitmap(Barcblock48,thpath+graphicsfolder+'48'+directoryseparator+'48-spanned.png');
   getthemedbitmap(Barcdisk48,thpath+graphicsfolder+'48'+directoryseparator+'48-diskimage.png');
   getthemedbitmap(Barcinstaller48,thpath+graphicsfolder+'48'+directoryseparator+'48-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;//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(BFolder48,thpath+graphicsfolder+'48'+directoryseparator+'48-folder.png');
   getthemedbitmap(Bdll48,thpath+graphicsfolder+'48'+directoryseparator+'48-file-library.png');
   getthemedbitmap(BExeSupported48,thpath+graphicsfolder+'48'+directoryseparator+'48-file-executable.png');
   getthemedbitmap(Bbat48,thpath+graphicsfolder+'48'+directoryseparator+'48-file-script.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(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(Bbrowserdetails,i16res);
   setpbitmap(Bbrowserlist,i16res);
   setpbitmap(Bbrowsericons,i16res);
   setpbitmap(Bbrowserdetailslarge,i16res);
   setpbitmap(Bbrowserlistlarge,i16res);
   setpbitmap(Bbrowsericonslarge,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_supported48,i48res);
   setpbitmap(Bfd_supported48,i48res);
   setpbitmap(Bhd_supported48,i48res);
   setpbitmap(Bram_supported48,i48res);
   setpbitmap(Bremote_supported48,i48res);
   setpbitmap(Bremovable_supported48,i48res);
   setpbitmap(BArchiveSupported48,i48res);
   setpbitmap(Baudio48,i48res);
   setpbitmap(Bdll48,i48res);
   setpbitmap(Bdb48,i48res);
   setpbitmap(BFileSupported48,i48res);
   setpbitmap(BExeSupported48,i48res);
   setpbitmap(Bimage48,i48res);
   setpbitmap(Bico48,i48res);
   setpbitmap(Bjpeg48,i48res);
   setpbitmap(Bgif48,i48res);
   setpbitmap(Bvector48,i48res);
   setpbitmap(Blink48,i48res);
   setpbitmap(Bmail48,i48res);
   setpbitmap(Bpdf48,i48res);
   setpbitmap(Bpresentation48,i48res);
   setpbitmap(Bbat48,i48res);
   setpbitmap(Bspreadsheet48,i48res);
   setpbitmap(Bsupported48,i48res);
   setpbitmap(Btxt48,i48res);
   setpbitmap(BUnsupported48,i48res);
   setpbitmap(Bvideo48,i48res);
   setpbitmap(Bweb48,i48res);
   setpbitmap(BFolder48,i48res);
   setpbitmap(Barc7z48,i48res);
   setpbitmap(Barcrar48,i48res);
   setpbitmap(Barczip48,i48res);
   setpbitmap(Barcblock48,i48res);
   setpbitmap(Barcdisk48,i48res);
   setpbitmap(Barcinstaller48,i48res);
   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(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);

   for i:=1 to 26 do devicon[i]:=Bunsupported;//show "unsupported" icon if the bookmarked unit is not mounted
   mprelight.Bitmap:=Bbrowserdetails;
   mpredetails.Bitmap:=Bbrowserdetailslarge;
   mprelightlist.Bitmap:=Bbrowserlist;
   mprelist.Bitmap:=Bbrowserlistlarge;
   mpreaverage.Bitmap:=Bbrowsericons;
   mprelarge.Bitmap:=Bbrowsericonslarge;
   pmstyle1.Bitmap:=Bbrowserdetails;
   pmstyle2.Bitmap:=Bbrowserdetailslarge;
   pmstyle3.Bitmap:=Bbrowserlist;
   pmstyle4.Bitmap:=Bbrowserlistlarge;
   pmstyle5.Bitmap:=Bbrowsericons;
   pmstyle6.Bitmap:=Bbrowsericonslarge;
   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;
   po_filetools.Bitmap:=Bunsupported;
   //pmcbroot.Bitmap:=Bsystemtools;
   MenuItemopendesktop.Bitmap:=Bdesk;
   MenuItemopendownloads.Bitmap:=Bdownloadfolder;
   MenuItemopendocuments.Bitmap:=BFileSupported;
   ButtonArchive.Glyph:=Btestall;
   ButtonExtOk.Glyph:=Btestall;
   Button2.Glyph:=Btestall;
   ButtonArchive1.Glyph:=Bstop;
   ButtonExtCancel.Glyph:=Bstop;
   Button1.Glyph:=Bstop;
   po_convertarchive.Bitmap:=Bconvert;
   ctrlback.Glyph:=Bback;
   ctrlfwd.Glyph:=Bgo;
   ctrlup.Glyph:=Bgoup;
   ctrlhistory.Glyph:=Bplaceshistory;
   refreshstatus:=0;
   ImageListSearch.Picture.Bitmap:=Bsearch;
   ImageListSearch1.Picture.Bitmap:=Bdelete;
   pmireset.Bitmap:=Bdelete;
   msetpw.Bitmap:=Blocker2;
   mpm.Bitmap:=Bsavelayout;
   mscripts.Bitmap:=bbat;
   ImagePassword.Glyph:=Blocker2;
   ImagePassword1.Glyph:=Blocker2;
   ImagePassword2.Glyph:=Blocker2;
   mkeyfile.Bitmap:=Bkeyfile;
   mverifyself.Bitmap:=BExesupported;
   iConsoleCreateImport.Width:=i16res;
   iConsoleCreateImport.Height:=i16res;
   iConsoleCreateImport.Picture.Bitmap:=Bresetpath;
   iConsoleCreateImport1.Width:=i16res;
   iConsoleCreateImport1.Height:=i16res;
   iConsoleCreateImport1.Picture.Bitmap:=Bresetpath;
   iadvextract.Width:=i16res;
   iadvextract.Height:=i16res;
   iadvextract.Picture.Bitmap:=Binfo;
   iadvextract.Transparent:=true;
   ImageInfoArchive3.Width:=i16res;
   ImageInfoArchive3.Height:=i16res;
   ImageInfoArchive3.Picture.Bitmap:=Binfo;
   ImageInfoArchive3.Transparent:=true;
   ImageInfoArchive4.Width:=i16res;
   ImageInfoArchive4.Height:=i16res;
   ImageInfoArchive4.Picture.Bitmap:=Binfo;
   ImageInfoArchive4.Transparent:=true;
   ImageInfoArchive5.Width:=i16res;
   ImageInfoArchive5.Height:=i16res;
   ImageInfoArchive5.Picture.Bitmap:=Binfo;
   ImageInfoArchive5.Transparent:=true;
   ImageInfoArchive6.Width:=i16res;
   ImageInfoArchive6.Height:=i16res;
   ImageInfoArchive6.Picture.Bitmap:=Binfo;
   ImageInfoArchive6.Transparent:=true;
   ImageInfoDefault1.Width:=i16res;
   ImageInfoDefault1.Height:=i16res;
   ImageInfoDefault1.Picture.Bitmap:=Binfo;
   ImageInfoDefault1.Transparent:=true;
   ImageInfoDefault2.Width:=i16res;
   ImageInfoDefault2.Height:=i16res;
   ImageInfoDefault2.Picture.Bitmap:=Binfo;
   ImageInfoDefault2.Transparent:=true;
   ImageSplit.Width:=i16res;
   ImageSplit.Height:=i16res;
   ImageSplit.Transparent:=true;
   mBookmarks.Bitmap:=BBookmark;
   smBookmarks1.Bitmap:=BBookmark;
   smBookmarksa1.Bitmap:=BBookmark;
   MenuItemOpen_pc.Bitmap:=Bsystemtools;
   MenuItemArchive_pc.Bitmap:=Bsystemtools;
   smfs1.Bitmap:=Broot;
   smfsa1.Bitmap:=Broot;
   pmJumppubhome.Bitmap:=bfolder;
   MenuItemArchive_pubhome.Bitmap:=bfolder;
   MenuItemOpen_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;
   pmquickhome.Bitmap:=Bhomefolder;
   pmquickdesk.Bitmap:=Bdesk;
   pmquickdownloads.Bitmap:=Bdownloadfolder;
   MenuItemOpen_documents1.Bitmap:=bfilesupported;
   MenuItemOpen_downloads1.Bitmap:=Bdownloadfolder;
   MenuItemOpen_music.Bitmap:=baudio;
   MenuItemOpen_pictures.Bitmap:=bimage;
   MenuItemOpen_videos.Bitmap:=bvideo;
   MenuItemOpen_pubdoc.Bitmap:=bfolder;
   pmjump3.Bitmap:=Bhomefolder;
   pmjumpdocuments.Bitmap:=BFileSupported;
   pmjumppubdoc.Bitmap:=bfolder;
   pmjumprecent.Bitmap:=bfolder;
   pmjumpsearches.Bitmap:=bfolder;
   pmjumplibraries.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_back.Bitmap:=Bback;
   MenuItemOpen_ExtractHere.Bitmap:=Bextractall;
   MenuItemPW.Bitmap:=Blocker2;
   mpw2.Bitmap:=Blocker2;
   mjob.Bitmap:=bbat;
   mjob2.Bitmap:=bbat;
   mfunadd.Bitmap:=Barchive;
   mfunconvert.Bitmap:=Bconvert;
   mfunextract.Bitmap:=Bextractall;
   po_setpw.Bitmap:=Blocker2;
   menupw.Bitmap:=Blocker2;
   pmqesetpw.Bitmap:=Blocker2;
   imageflat.Glyph:=Bnonthemed8;
   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:=Bnonthemed0;
   MenuItemOpen_Flat.Bitmap:=Bexpand;
   MenuItemOpen_fwd.Bitmap:=Bgo;
   MenuItemOpen_refresh.Bitmap:=Brefresh;
   MenuItemOpen_test.Bitmap:=Btestall;
   MenuItemOpen_up.Bitmap:=Bgoup;
   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;
   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;
   pmjump1.Bitmap:=Bsystemtools;
   pmqjmore.Bitmap:=bfolder;
   pmjump2.Bitmap:=Bdesk;
   pmqjdropbox.Bitmap:=Bcloudfolder;
   pmqjmyboxfiles.Bitmap:=Bcloudfolder;
   pmqjgoogledrive.Bitmap:=Bcloudfolder;
   pmqjonedrive.Bitmap:=Bcloudfolder;
   pmqjskydrive.Bitmap:=Bcloudfolder;
   pmqjubuntuone.Bitmap:=Bcloudfolder;
   MenuItemOpen_dropbox.Bitmap:=Bcloudfolder;
   MenuItemOpen_myboxfiles.Bitmap:=Bcloudfolder;
   MenuItemOpen_googledrive.Bitmap:=Bcloudfolder;
   MenuItemOpen_onedrive.Bitmap:=Bcloudfolder;
   MenuItemOpen_skydrive.Bitmap:=Bcloudfolder;
   MenuItemOpen_ubuntuone.Bitmap:=Bcloudfolder;
   MenuItemArchive_dropbox.Bitmap:=Bcloudfolder;
   MenuItemArchive_myboxfiles.Bitmap:=Bcloudfolder;
   MenuItemArchive_googledrive.Bitmap:=Bcloudfolder;
   MenuItemArchive_onedrive.Bitmap:=Bcloudfolder;
   MenuItemArchive_skydrive.Bitmap:=Bcloudfolder;
   MenuItemArchive_ubuntuone.Bitmap:=Bcloudfolder;
   MenuItemOpen_desktop1.Bitmap:=Bdesk;
   mpathdesk1.Bitmap:=Bdesk;
   mhistory.Bitmap:=Bplaceshistory;
   smhistorya1.Bitmap:=Bplaceshistory;
   smhistory1.Bitmap:=Bplaceshistory;
   po_test.Bitmap:=Btestall;
   pmtabsclose.Bitmap:=Bdelete;
   pmtabsbookmarkadd.Bitmap:=BBookmarkadd;
   pmtabsbookmarkorg.Bitmap:=BBookmark;
   theme_label1.Width:=i16res;
   theme_label1.Height:=i16res;
   theme_label1.Picture.Bitmap:=Bresetpath;
   theme_label1.Transparent:=true;
   Imagelistsearch.Transparent:=true;
   Imagelistsearch1.Transparent:=true;
   loadimglist1icons;
   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 default_defaults;
begin
lang_file:='default.txt';//lang file
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
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
extpw:=3; //ask for password on Extract/list/test functions from system's meus entries
browserstyle:=0; //0:browser 1:flat 2*:last used ( *=0 browser, *=1 flat);
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
Form_peach.editExtEvForWhat.Caption:=SPECEXTCONST;
Form_peach.Editcommonalgo.Caption:=PREFALGOCONST;
Form_peach.editcustext.Caption:='';
Form_peach.LabelForceLayout.Caption:='';
Form_peach.EditCSVsep.Caption:=',';
csvsep:=',';
Form_peach.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;
maxargsize:=2;
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
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;
userarsfx:=0;
userarsolid:=0;
userarrr:=0;
puserarrr:=3;
userarsaveopen:=0;
userarsavesecurity:=0;
userarsavestreams:=0;
userarlastmodtime:=0;
userarlock:=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
prebrowsesize:=192; //max M blocks of memory allowed to list archive content in the browser
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
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:=1; //default sort files by type for 7z solid compression: on
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:=0; //do not follow sym links
snz7z:=1; //propagate zone.identifier default on
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;
{$IFDEF MSWINDOWS}jobdefenc:=0;{$ELSE}jobdefenc:=1;{$ENDIF}//encoding for job definition 0 system's default; 1 utf8
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:=1; //for generic OS use the oldest syntax level supported 7z 21.07
{$IFDEF MSWINDOWS}syntaxlevel7z:=0;{$ENDIF}
{$IFDEF LINUX}syntaxlevel7z:=0;{$ENDIF}
{$IFDEF DARWIN}syntaxlevel7z:=0;{$ENDIF}
ptsync:=2; //sync archive tree in navigation panel
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; form_peach.splitter1.Cursor:=crSizeNS;
splitter2size:=180; form_peach.splitter2.Cursor:=crSizeWE;
splitter3size:=180; form_peach.splitter3.Cursor:=crSizeWE;
splitsearchsize:=800; form_peach.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;
enlargeicons:=false;
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;
filterbrowser:=0;
showthumbnails:=0;
pimmersive:=0;
simplesearch:=1;
recsearch:=1;
usebreadcrumb:=1;
keeppw:=1;
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;
noconfdel:=0;
swzipx:=0;
convint:=1;
tryopenwerrors:=1;
forcecanbechanged:=0;
forcetype:=0;
excludeef:=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;
Form_peach.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 (solidaddressstyle<0) or (solidaddressstyle>8) then solidaddressstyle:=0;
if (toolcentered<0) or (toolcentered>1) then toolcentered:=0;
if (alttabstyle<0) or (alttabstyle>2) then alttabstyle:=2;
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;
if not(directoryexists(winpfolder)) then
   begin
   winpfolder:='';
   Result:=1;
   end;
if not(directoryexists(winpfolder32)) then
   begin
   winpfolder32:='';
   Result:=1;
   end;
if winpfolder<>'' then
   if winpfolder[length(winpfolder)]<>directoryseparator then winpfolder:=winpfolder+directoryseparator;
if winpfolder32<>'' then
   if winpfolder32[length(winpfolder32)]<>directoryseparator then winpfolder32:=winpfolder32+directoryseparator;
{$ENDIF}
end;

function wingetsystemfolder:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
winsysfolder:='';
winsysfolder:=(GetEnvironmentVariable('SystemRoot'));
Result:=0;
if not(directoryexists(winsysfolder)) then
   begin
   winsysfolder:='';
   Result:=1;
   end;
if winsysfolder<>'' then
   if winsysfolder[length(winsysfolder)]<>directoryseparator then winsysfolder:=winsysfolder+directoryseparator;
{$ENDIF}
end;

function wingetdesk:integer;
begin
wingetdesk:=-1;
{$IFDEF MSWINDOWS}
desktop_path:=GetWindowsSpecialDir(CSIDL_DESKTOPDIRECTORY);
if not(directoryexists(desktop_path)) then home_path:=(GetEnvironmentVariable('USERPROFILE'))+'\Desktop\'; //try from environment variable
if not(directoryexists(desktop_path)) then desktop_path:=GetWindowsSpecialDir(CSIDL_COMMON_DESKTOPDIRECTORY);//fallback on common desktop
if not(directoryexists(desktop_path)) then desktop_path:=GetWindowsSpecialDir(CSIDL_COMMON_DESKTOPDIRECTORY);//fallback on profile
if not(directoryexists(desktop_path)) then desktop_path:=GetWindowsSpecialDir(CSIDL_PROFILE);//fallback on home
if not(directoryexists(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;
{$ENDIF}
end;

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

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

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

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

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

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

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

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

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

function wingetpublichome:integer;
begin
wingetpublichome:=-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(directoryexists(public_home)) then
   begin
   public_home:='';
   Form_peach.pmJumppubhome.Visible:=false;
   Form_peach.MenuItemArchive_pubhome.Visible:=false;
   Form_peach.MenuItemOpen_pubhome.Visible:=false;
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

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

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

function wingetsearches:integer;
begin
wingetsearches:=-1;
{$IFDEF MSWINDOWS}
usr_searches:='';
if winver<>'nt6+' then
   begin
   Form_peach.pmJumpsearches.Visible:=false;
   exit;
   end;
usr_searches:=home_path+'Searches\';
if not(directoryexists(usr_searches)) then
   begin
   usr_searches:='';
   Result:=1;
   end
else Result:=0;
{$ENDIF}
end;

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

function sysgetshared:integer;
begin
sysgetshared:=-1;
shared_dropbox:='';
shared_myboxfiles:='';
shared_googledrive:='';
shared_onedrive:='';
shared_skydrive:='';
shared_ubuntuone:='';
Form_peach.pmqjdropbox.visible:=false;
Form_peach.pmqjmyboxfiles.visible:=false;
Form_peach.pmqjgoogledrive.visible:=false;
Form_peach.pmqjonedrive.visible:=false;
Form_peach.pmqjskydrive.visible:=false;
Form_peach.pmqjubuntuone.visible:=false;
{$IFDEF MSWINDOWS}
if directoryexists(home_path+'Dropbox') then
   begin
   shared_dropbox:=home_path+'Dropbox\';
   Form_peach.pmqjdropbox.visible:=true;
   end;
if directoryexists(usr_documents+'My Box Files') then
   begin
   shared_myboxfiles:=usr_documents+'My Box Files\';
   Form_peach.pmqjmyboxfiles.visible:=true;
   end;
if directoryexists(home_path+'Google Drive') then
   begin
   shared_googledrive:=home_path+'Google Drive\';
   Form_peach.pmqjgoogledrive.visible:=true;
   end;
if directoryexists(home_path+'OneDrive') then
   begin
   shared_onedrive:=home_path+'OneDrive\';
   Form_peach.pmqjonedrive.visible:=true;
   end;
if directoryexists(home_path+'Workspaces') then
   begin
   shared_skydrive:=home_path+'Workspaces\';
   Form_peach.pmqjskydrive.visible:=true;
   end;
if directoryexists(home_path+'YandexDisk') then
   begin
   shared_ubuntuone:=home_path+'YandexDisk\';
   Form_peach.pmqjubuntuone.visible:=true;
   end;
{$ENDIF}
{$IFDEF LINUX}
{$ENDIF}
Form_peach.MenuItemArchive_dropbox.visible:=Form_peach.pmqjdropbox.visible;
Form_peach.MenuItemArchive_myboxfiles.visible:=Form_peach.pmqjmyboxfiles.visible;
Form_peach.MenuItemArchive_googledrive.visible:=Form_peach.pmqjgoogledrive.visible;
Form_peach.MenuItemArchive_onedrive.visible:=Form_peach.pmqjonedrive.visible;
Form_peach.MenuItemArchive_skydrive.visible:=Form_peach.pmqjskydrive.visible;
Form_peach.MenuItemArchive_ubuntuone.visible:=Form_peach.pmqjubuntuone.visible;
Form_peach.MenuItemOpen_dropbox.visible:=Form_peach.pmqjdropbox.visible;
Form_peach.MenuItemOpen_myboxfiles.visible:=Form_peach.pmqjmyboxfiles.visible;
Form_peach.MenuItemOpen_googledrive.visible:=Form_peach.pmqjgoogledrive.visible;
Form_peach.MenuItemOpen_onedrive.visible:=Form_peach.pmqjonedrive.visible;
Form_peach.MenuItemOpen_skydrive.visible:=Form_peach.pmqjskydrive.visible;
Form_peach.MenuItemOpen_ubuntuone.visible:=Form_peach.pmqjubuntuone.visible;
sysgetshared:=0;
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 (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 directoryexists(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(directoryexists(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 (extpw>4) then extpw:=3;
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 (howspecialopen<0) or (howspecialopen>1) then howspecialopen:=0;
if (length(Form_peach.editExtEvForWhat.Caption)<1) or (length(Form_peach.editExtEvForWhat.Caption)>1000) then Form_peach.editExtEvForWhat.Caption:=SPECEXTCONST;
if (length(Form_peach.Editcommonalgo.Caption)<1) or (length(Form_peach.Editcommonalgo.Caption)>1000) then Form_peach.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;
if (maxargsize<0) or (maxargsize>7) then maxargsize:=2;
if (taskpriority>3) then taskpriority:=2;
if (dragtargetprotect>3) then dragtargetprotect:=1;
if (skipdel>1) then skipdel:=1;
if (disableintscript>1) then disableintscript:=1;
if (nonverboselog>1) then nonverboselog:=1;
if (use7zunrar5>1) then use7zunrar5:=1;
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 (userarsaveopen>1) then userarsaveopen:=0;
if (userarsavesecurity>1) then userarsavesecurity:=0;
if (userarsavestreams>1) then userarsavestreams:=0;
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 (repcustext>1) then repcustext:=0;
if (length(Form_peach.editcustext.Caption)>100) then Form_peach.editcustext.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 (prebrowsesize<4) or (prebrowsesize>512) then prebrowsesize:=192; //unused
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 (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:=0;
if (snz7z>1) then snz7z:=1;
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:=1;
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 (jobdefenc>1) then {$IFDEF MSWINDOWS}jobdefenc:=0;{$ELSE}jobdefenc:=1;{$ENDIF}
if (showvolatile<0) or (showvolatile>1) then showvolatile:=0;
if (archivenameenc>1) then archivenameenc:=1;
if (mcuzip>3) then mcuzip:=1;
if (syntaxlevel7z>1) then
{$IFDEF MSWINDOWS}syntaxlevel7z:=0;{$ElSE}
{$IFDEF LINUX}syntaxlevel7z:=0;{$ELSE}syntaxlevel7z:=1;{$ENDIF}{$ENDIF}
if (ptsync>2) then ptsync:=2;
if (defaultactionst>5) then defaultactionst:=0;
if (mappeddrivesinfo<0) or (mappeddrivesinfo>1) then mappeddrivesinfo:=0;
if (local_desktop='') or (not(directoryexists(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>2) then browsersize:=0;
if (listsortcol<1) or (listsortcol>17) then listsortcol:=13;
if (col1size<26) or (col1size>1024) then col1size:=COL1D; //on Windows listview column size is currently fixed to 25 in Lazarus 0.9.26.2
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(directoryexists(defaultextractpath)) then defaultextractpath:='';
if not(directoryexists(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 (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:=1;
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>6) 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 (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>1) then sys7zlin:=0;
end;

procedure settabsstyled;
begin
Form_peach.ShapeTitleAddb1.Height:=tablabelheight;
Form_peach.ShapeTitleAddb2.Height:=tablabelheight;
Form_peach.ShapeTitleAddb3.Height:=tablabelheight;
Form_peach.ShapeTitleAddb4.Height:=tablabelheight;
Form_peach.ShapeTitleExtractb1.Height:=tablabelheight;
Form_peach.ShapeTitleExtractb2.Height:=tablabelheight;
Form_peach.ShapeTitleExtractb3.Height:=tablabelheight;
Form_peach.ShapeTitleExtractb4.Height:=tablabelheight;
Form_peach.ShapeTitleAppsb1.Height:=tablabelheight;
Form_peach.ShapeTitleAppsb2.Height:=tablabelheight;
FormPM.ShapeTitlePMb1.Height:=tablabelheight;
FormPM.ShapeTitlePMb2.Height:=tablabelheight;
Form_gwrap.ShapeTitleb1.Height:=tablabelheight;
Form_gwrap.ShapeTitleb2.Height:=tablabelheight;
Form_gwrap.ShapeTitleb3.Height:=tablabelheight;
Form_gwrap.ShapeTitleb4.Height:=tablabelheight;
if alttabstyle=1 then
begin
Form_peach.LabelTitleExtract1.AnchorSideTop.Control:=Form_peach.PanelTitleExtract;
Form_peach.LabelTitleExtract2.AnchorSideTop.Control:=Form_peach.PanelTitleExtract;
Form_peach.LabelTitleExtract3.AnchorSideTop.Control:=Form_peach.PanelTitleExtract;
Form_peach.LabelTitleExtract4.AnchorSideTop.Control:=Form_peach.PanelTitleExtract;
Form_peach.ShapeTitleExtractb1.visible:=false;
Form_peach.ShapeTitleExtractb2.visible:=false;
Form_peach.ShapeTitleExtractb3.visible:=false;
Form_peach.ShapeTitleExtractb4.visible:=false;
Form_peach.LabelTitleAdd1.AnchorSideTop.Control:=Form_peach.PanelTitleAdd;
Form_peach.LabelTitleAdd2.AnchorSideTop.Control:=Form_peach.PanelTitleAdd;
Form_peach.LabelTitleAdd3.AnchorSideTop.Control:=Form_peach.PanelTitleAdd;
Form_peach.LabelTitleAdd4.AnchorSideTop.Control:=Form_peach.PanelTitleAdd;
Form_peach.ShapeTitleAddb1.visible:=false;
Form_peach.ShapeTitleAddb2.visible:=false;
Form_peach.ShapeTitleAddb3.visible:=false;
Form_peach.ShapeTitleAddb4.visible:=false;
Form_peach.LabelTitleApps1.AnchorSideTop.Control:=Form_peach.PanelTitleApps;
Form_peach.LabelTitleApps2.AnchorSideTop.Control:=Form_peach.PanelTitleApps;
Form_peach.ShapeTitleAppsb1.visible:=false;
Form_peach.ShapeTitleAppsb2.visible:=false;
FormPM.LabelTitlepm1.AnchorSideTop.Control:=FormPM.PanelTitlePM;
FormPM.LabelTitlepm2.AnchorSideTop.Control:=FormPM.PanelTitlePM;
FormPM.ShapeTitlePMb1.visible:=false;
FormPM.ShapeTitlePMb2.visible:=false;
Form_gwrap.LabelTitle1.AnchorSideTop.Control:=Form_gwrap.PanelTitle;
Form_gwrap.LabelTitle2.AnchorSideTop.Control:=Form_gwrap.PanelTitle;
Form_gwrap.LabelTitle3.AnchorSideTop.Control:=Form_gwrap.PanelTitle;
Form_gwrap.LabelTitle4.AnchorSideTop.Control:=Form_gwrap.PanelTitle;
Form_gwrap.ShapeTitleb1.visible:=false;
Form_gwrap.ShapeTitleb2.visible:=false;
Form_gwrap.ShapeTitleb3.visible:=false;
Form_gwrap.ShapeTitleb4.visible:=false;
end
else
begin
Form_peach.LabelTitleExtract1.AnchorSideTop.Control:=Form_peach.ShapeTitleExtractb1;
Form_peach.LabelTitleExtract2.AnchorSideTop.Control:=Form_peach.ShapeTitleExtractb1;
Form_peach.LabelTitleExtract3.AnchorSideTop.Control:=Form_peach.ShapeTitleExtractb1;
Form_peach.LabelTitleExtract4.AnchorSideTop.Control:=Form_peach.ShapeTitleExtractb1;
Form_peach.ShapeTitleExtractb1.visible:=true;
Form_peach.ShapeTitleExtractb2.visible:=true;
Form_peach.ShapeTitleExtractb3.visible:=true;
Form_peach.ShapeTitleExtractb4.visible:=true;
Form_peach.LabelTitleAdd1.AnchorSideTop.Control:=Form_peach.ShapeTitleAddb1;
Form_peach.LabelTitleAdd2.AnchorSideTop.Control:=Form_peach.ShapeTitleAddb1;
Form_peach.LabelTitleAdd3.AnchorSideTop.Control:=Form_peach.ShapeTitleAddb1;
Form_peach.LabelTitleAdd4.AnchorSideTop.Control:=Form_peach.ShapeTitleAddb1;
Form_peach.ShapeTitleAddb1.visible:=true;
Form_peach.ShapeTitleAddb2.visible:=true;
Form_peach.ShapeTitleAddb3.visible:=true;
Form_peach.ShapeTitleAddb4.visible:=true;
Form_peach.LabelTitleApps1.AnchorSideTop.Control:=Form_peach.ShapeTitleAppsb1;
Form_peach.LabelTitleApps2.AnchorSideTop.Control:=Form_peach.ShapeTitleAppsb1;
Form_peach.ShapeTitleAppsb1.visible:=true;
Form_peach.ShapeTitleAppsb2.visible:=true;
FormPM.LabelTitlepm1.AnchorSideTop.Control:=FormPM.ShapeTitlePMb1;
FormPM.LabelTitlepm2.AnchorSideTop.Control:=FormPM.ShapeTitlePMb1;
FormPM.ShapeTitlePMb1.visible:=true;
FormPM.ShapeTitlePMb2.visible:=true;
Form_gwrap.LabelTitle1.AnchorSideTop.Control:=Form_gwrap.ShapeTitleb1;
Form_gwrap.LabelTitle2.AnchorSideTop.Control:=Form_gwrap.ShapeTitleb1;
Form_gwrap.LabelTitle3.AnchorSideTop.Control:=Form_gwrap.ShapeTitleb1;
Form_gwrap.LabelTitle4.AnchorSideTop.Control:=Form_gwrap.ShapeTitleb1;
Form_gwrap.ShapeTitleb1.visible:=true;
Form_gwrap.ShapeTitleb2.visible:=true;
Form_gwrap.ShapeTitleb3.visible:=true;
Form_gwrap.ShapeTitleb4.visible:=true;
end;
Unit8.alttabstyle:=alttabstyle;
Unit_gwrap.alttabstyle:=alttabstyle;
Unit8.highlighttabs:=highlighttabs;
Unit_gwrap.highlighttabs:=highlighttabs;
end;

procedure set_items_height;
var
   refsize,addressbuttonsize,laddressbuttonsize,saddressbuttonsize:integer;
begin
with Form_peach 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*pzooming) div 100;
qscaleimages:=(qscaleimages*pzooming) 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:=(72*qscale) div 100;
//bars
pbarh:=(8*qscale) div 100;
pbarhsmall:=(4*qscale) div 100;
ShapeProgress.Height:=pbarh;
barheight:=(40*qscale) div 100;
mbarheight:=(48*qscale) div 100;
mmbarheight:=(44*qscale) div 100;
PanelListBar.Height:=barheight;
Bevel20.Height:=((32+ensmall)*qscale) div 100;
BevelTitleOptions1.Height:=barheight;
BevelTitleOptions2.Height:=barheight;
BevelTitleOptions3.Height:=barheight;
BevelTitleOptions4.Height:=barheight;
BevelTitleOptions5.Height:=barheight;
BevelTitleOptions6.Height:=barheight;
BevelTitleOptions7.Height:=barheight;
BevelTitleOptions8.Height:=barheight;
PanelNav5.Height:=barheight;
//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;
Panel11.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:=saddressbuttonsize;
Panel9.Width:=addressbuttonsize-2;
Panel8.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;
ImagePassword.Width:=laddressbuttonsize;
//tabs
tabheight:=(36*qscale) div 100;
if alttabstyle=2 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;
PanelActDefaults.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;
StringGrid1.DefaultRowHeight:=rowsize;
StringGrid2.DefaultRowHeight:=rowsize;
StringGridSessionHistory.DefaultRowHeight:=rowsize;
StringGridBookmarks.DefaultRowHeight:=rowsize;
StringGridClipboard.DefaultRowHeight:=rowsize;
StringGridCustEdit.DefaultRowHeight:=rowsize;
StringGridCustEdit1.DefaultRowHeight:=rowsize;
StringGridRecent.DefaultRowHeight:=rowsize;
FormPM.StringGridPM.DefaultRowHeight:=rowsize;
FormPM.StringGridPM1.DefaultRowHeight:=rowsize;
//panels
Panelnav4.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;
ListView1.SmallImages:=il16;
ilsmall := TimageList.Create(owner);
ilsmall.Height:=icon_sizeplus;
ilsmall.Width:=icon_sizeplus;
ShellTreeView2.Images:=ilsmall;
ShellTreeView1.Images:=ilsmall;
TreeView1.Images:=ilsmall;
TabBar.Images:=ilsmall;
il48 := TimageList.Create(owner);
il48.Height:=((48+pspacing)*qscaleimages) div 100;
il48.Width:=((48+pspacing)*qscaleimages) div 100;
il96 := TimageList.Create(owner);
il96.Height:=((96+pspacing)*qscaleimages) div 100;
il96.Width:=((96+pspacing)*qscaleimages) div 100;
il192 := TimageList.Create(owner);
il192.Height:=((192+pspacing)*qscaleimages) div 100;
il192.Width:=((192+pspacing)*qscaleimages) div 100;
end;
end;

procedure setgridaltcolor;
begin
if usealtcolor=1 then
   begin
   Form_peach.StringGrid1.AlternateColor:=StringToColor(collow);
   Form_peach.StringGrid2.AlternateColor:=StringToColor(collow);
   Form_peach.StringGridCustEdit.AlternateColor:=StringToColor(collow);
   Form_peach.StringGridCustEdit1.AlternateColor:=StringToColor(collow);
   Form_peach.StringGridRecent.AlternateColor:=StringToColor(collow);
   Form_peach.StringGridSessionHistory.AlternateColor:=StringToColor(collow);
   Form_peach.StringGridBookmarks.AlternateColor:=StringToColor(collow);
   Form_peach.StringGridClipboard.AlternateColor:=StringToColor(collow);
   end
else
   begin
   Form_peach.StringGrid1.AlternateColor:=StringToColor(color2);
   Form_peach.StringGrid2.AlternateColor:=StringToColor(color2);
   Form_peach.StringGridCustEdit.AlternateColor:=StringToColor(color2);
   Form_peach.StringGridCustEdit1.AlternateColor:=StringToColor(color2);
   Form_peach.StringGridRecent.AlternateColor:=StringToColor(color2);
   Form_peach.StringGridSessionHistory.AlternateColor:=StringToColor(color2);
   Form_peach.StringGridBookmarks.AlternateColor:=StringToColor(color2);
   Form_peach.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);
      tabbrushhighcol:=StringToColor(colvlow);
      end;
   1: begin
      tabcol:=StringToColor(color2);
      tabcol2:=StringToColor(color2);
      tabpencol:=StringToColor(color2);
      tabbrushcol:=pvvlblue;
      tabbrushhighcol:=pvvvlblue;
      end;
   2: begin
      tabcol:=StringToColor(collow);
      tabcol2:=StringToColor(colvlow);
      tabpencol:=StringToColor(collow);
      tabbrushcol:=StringToColor(colmid);
      tabbrushhighcol:=StringToColor(colvlow);
      end;
   3: begin
      tabcol:=StringToColor(colmid);
      tabcol2:=StringToColor(collow);
      tabpencol:=StringToColor(colmid);
      tabbrushcol:=StringToColor(colhigh);
      tabbrushhighcol:=StringToColor(collow);
      end;
   4: begin
      tabcol:=pvvvlblue;
      tabcol2:=pvvvvlblue;
      tabpencol:=pvvvlblue;
      tabbrushcol:=pvvlblue;
      tabbrushhighcol:=pvvvvlblue;
      end;
   5: begin
      tabcol:=pvvlblue;
      tabcol2:=pvvvlblue;
      tabpencol:=pvvlblue;
      tabbrushcol:=pvlblue;
      tabbrushhighcol:=pvvvlblue;
      end;
   end;
Form_peach.PanelTitleOptions.Color:=tabcol;
Form_peach.PanelTitleAdd.Color:=tabcol;
Form_peach.PanelTitleExtract.Color:=tabcol;
Form_peach.PanelTitleApps.Color:=tabcol;
Form_gwrap.PanelTitle.Color:=tabcol;
Unit_gwrap.tabpencol:=tabpencol;
Unit_gwrap.tabbrushcol:=tabbrushcol;
Unit_gwrap.tabbrushhighcol:=tabbrushhighcol;
FormPM.PanelTitlePM.Color:=tabcol;
Unit8.tabpencol:=tabpencol;
Unit8.tabbrushcol:=tabbrushcol;
Unit8.tabbrushhighcol:=tabbrushhighcol;
end;

procedure setfontsbreadcrumb;
begin
if Form_peach.LabelClickAddress1.Caption<>' '+txt_mypc+' ' then Form_peach.LabelClickAddress1.Font.Style:=[];
Form_peach.LabelClickAddress2.Font.Style:=[];
Form_peach.LabelClickAddress3.Font.Style:=[];
Form_peach.LabelClickAddress4.Font.Style:=[];
Form_peach.LabelClickAddress5.Font.Style:=[];
Form_peach.LabelClickAddress6.Font.Style:=[];
Form_peach.LabelClickAddress7.Font.Style:=[];
Form_peach.LabelClickAddress8.Font.Style:=[];
Form_peach.LabelClickAdArchive1.Font.Style:=[];
Form_peach.LabelClickAdArchive2.Font.Style:=[];
Form_peach.LabelClickAdArchive3.Font.Style:=[];
Form_peach.LabelClickAdArchive4.Font.Style:=[];
if Form_peach.LabelClickAdArchive4.caption<>'' then
   begin
   Form_peach.LabelClickAdArchive4.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAdArchive4;
   end
else
if Form_peach.LabelClickAdArchive3.caption<>'' then
   begin
   Form_peach.LabelClickAdArchive3.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAdArchive3;
   end
else
if Form_peach.LabelClickAdArchive2.caption<>'' then
   begin
   Form_peach.LabelClickAdArchive2.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAdArchive2;
   end
else
if Form_peach.LabelClickAdArchive1.caption<>'' then
   begin
   Form_peach.LabelClickAdArchive1.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAdArchive1;
   end
else
if Form_peach.LabelClickAddress8.visible=true then
   begin
   Form_peach.LabelClickAddress8.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress8;
   end
else
if Form_peach.LabelClickAddress7.visible=true then
   begin
   Form_peach.LabelClickAddress7.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress7;
   end
else
if Form_peach.LabelClickAddress6.visible=true then
   begin
   Form_peach.LabelClickAddress6.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress6;
   end
else
if Form_peach.LabelClickAddress5.visible=true then
   begin
   Form_peach.LabelClickAddress5.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress5;
   end
else
if Form_peach.LabelClickAddress4.visible=true then
   begin
   Form_peach.LabelClickAddress4.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress4;
   end
else
if Form_peach.LabelClickAddress3.visible=true then
   begin
   Form_peach.LabelClickAddress3.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress3;
   end
else
if Form_peach.LabelClickAddress2.visible=true then
   begin
   Form_peach.LabelClickAddress2.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress2;
   end
else
if Form_peach.LabelClickAddress1.visible=true then
   begin
   Form_peach.LabelClickAddress1.Font.Style:=[fsBold];
   Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress1;
   end;
Form_peach.PanelClickAddress.Width:=Form_peach.PanelAdArchive4.left+Form_peach.PanelAdArchive4.Width;
Form_peach.bevel20.Width:=Form_peach.PanelClickAddress.Width+Form_peach.Panel11.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);
Form_peach.Color:=stringtocolor(color2);
//Form_peach.Font.Color:=stringtocolor(color5);
Form_peach.StringGridClipboard.Color:=Form_peach.Color;
FormAdvf.Color:=Form_peach.Color;
FormCrop.Color:=Form_peach.Color;
FormDlg.Color:=Form_peach.Color;
FormImgRes.Color:=Form_peach.Color;
FormInput.Color:=Form_peach.Color;
FormKF.Color:=Form_peach.Color;
FormPaths.Color:=Form_peach.Color;
FormPM.Color:=Form_peach.Color;
FormPW.Color:=Form_peach.Color;
FormSelect.Color:=Form_peach.Color;
FormWeb.Color:=Form_peach.Color;
Form_gwrap.Color:=Form_peach.Color;
Form_peach.Panelnav5.Color:=StringToColor(colbtnhigh);
Form_peach.Splitter2.Color:=StringToColor(colmid);
Form_peach.PanelFileBrowserOptions.Color:=StringToColor(collow);
Form_peach.ShapeThemes.Brush.Color:=StringToColor(collow);
Form_peach.ShapeThemes1.Brush.Color:=StringToColor(collow);
Form_peach.ShapeThemes2.Brush.Color:=StringToColor(collow);
case accenttoolbar of
0: begin
   Form_peach.PanelBarOpen.Color:=Form_peach.Color;
   Form_peach.Panelnav4.Color:=Form_peach.PanelBarOpen.Color;
   Form_peach.Bevel13.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel16.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel12.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel14.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel18.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel11.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel15.Pen.Color:=Form_peach.Splitter2.Color;
   end;
1: begin
   Form_peach.PanelBarOpen.Color:=StringToColor(colvlow);
   Form_peach.Panelnav4.Color:=Form_peach.PanelBarOpen.Color;
   Form_peach.Bevel13.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel16.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel12.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel14.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel18.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel11.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel15.Pen.Color:=Form_peach.Splitter2.Color;
   end;
2: begin
   Form_peach.PanelBarOpen.Color:=StringToColor(collow);
   Form_peach.Panelnav4.Color:=Form_peach.PanelBarOpen.Color;
   Form_peach.Bevel13.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel16.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel12.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel14.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel18.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel11.Pen.Color:=Form_peach.Splitter2.Color;
   Form_peach.Bevel15.Pen.Color:=Form_peach.Splitter2.Color;
   end;
3: begin
   Form_peach.PanelBarOpen.Color:=StringToColor(colmid);
   Form_peach.Panelnav4.Color:=Form_peach.PanelBarOpen.Color;
   Form_peach.Bevel13.Pen.Color:=StringToColor(colhigh);
   Form_peach.Bevel16.Pen.Color:=StringToColor(colhigh);
   Form_peach.Bevel12.Pen.Color:=StringToColor(colhigh);
   Form_peach.Bevel14.Pen.Color:=StringToColor(colhigh);
   Form_peach.Bevel18.Pen.Color:=StringToColor(colhigh);
   Form_peach.Bevel11.Pen.Color:=StringToColor(colhigh);
   Form_peach.Bevel15.Pen.Color:=StringToColor(colhigh);
   end;
4: begin
   Form_peach.PanelBarOpen.Color:=StringToColor(colhigh);
   Form_peach.Panelnav4.Color:=Form_peach.PanelBarOpen.Color;
   Form_peach.Bevel13.Pen.Color:=StringToColor(colbtnhigh);
   Form_peach.Bevel16.Pen.Color:=StringToColor(colbtnhigh);
   Form_peach.Bevel12.Pen.Color:=StringToColor(colbtnhigh);
   Form_peach.Bevel14.Pen.Color:=StringToColor(colbtnhigh);
   Form_peach.Bevel18.Pen.Color:=StringToColor(colbtnhigh);
   Form_peach.Bevel11.Pen.Color:=StringToColor(colbtnhigh);
   Form_peach.Bevel15.Pen.Color:=StringToColor(colbtnhigh);
   end;
5: begin
   Form_peach.PanelBarOpen.Color:=pvvvvlblue;
   Form_peach.Panelnav4.Color:=pvvvvlblue;
   Form_peach.Bevel13.Pen.Color:=pvvlblue;
   Form_peach.Bevel16.Pen.Color:=pvvlblue;
   Form_peach.Bevel12.Pen.Color:=pvvlblue;
   Form_peach.Bevel14.Pen.Color:=pvvlblue;
   Form_peach.Bevel18.Pen.Color:=pvvlblue;
   Form_peach.Bevel11.Pen.Color:=pvvlblue;
   Form_peach.Bevel15.Pen.Color:=pvvlblue;
   end;
6: begin
   Form_peach.PanelBarOpen.Color:=pvvvlblue;
   Form_peach.Panelnav4.Color:=pvvvlblue;
   Form_peach.Bevel13.Pen.Color:=pvvlblue;
   Form_peach.Bevel16.Pen.Color:=pvvlblue;
   Form_peach.Bevel12.Pen.Color:=pvvlblue;
   Form_peach.Bevel14.Pen.Color:=pvvlblue;
   Form_peach.Bevel18.Pen.Color:=pvvlblue;
   Form_peach.Bevel11.Pen.Color:=pvvlblue;
   Form_peach.Bevel15.Pen.Color:=pvvlblue;
   end;
7: begin
   Form_peach.PanelBarOpen.Color:=pvvlblue;
   Form_peach.Panelnav4.Color:=pvvlblue;
   Form_peach.Bevel13.Pen.Color:=pvlblue;
   Form_peach.Bevel16.Pen.Color:=pvlblue;
   Form_peach.Bevel12.Pen.Color:=pvlblue;
   Form_peach.Bevel14.Pen.Color:=pvlblue;
   Form_peach.Bevel18.Pen.Color:=pvlblue;
   Form_peach.Bevel11.Pen.Color:=pvlblue;
   Form_peach.Bevel15.Pen.Color:=pvlblue;
   end;
8: begin
   Form_peach.PanelBarOpen.Color:=pvlblue;
   Form_peach.Panelnav4.Color:=pvlblue;
   Form_peach.Bevel13.Pen.Color:=plblue;
   Form_peach.Bevel16.Pen.Color:=plblue;
   Form_peach.Bevel12.Pen.Color:=plblue;
   Form_peach.Bevel14.Pen.Color:=plblue;
   Form_peach.Bevel18.Pen.Color:=plblue;
   Form_peach.Bevel11.Pen.Color:=plblue;
   Form_peach.Bevel15.Pen.Color:=plblue;
   end;
end;

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

Form_peach.PanelBottom.Color:=Form_peach.Color;
Form_peach.Splitter1.Color:=Form_peach.Color;

case altaddressstyle of
3: begin
   Form_peach.Bevel20.Brush.Color:=Form_peach.Color;
   Form_peach.ShapeAddress.Brush.Color:=Form_peach.Color;
   Form_peach.Bevel20.Pen.Color:=pvvvlblue;
   Form_peach.splitsearch.Color:=pvlblue;
   if (altbread>0) and (macbread=0) then abactivecol:=pvvlblue else abactivecol:=pvvvmlblue;
   abarchivecol:=pvvvvlblue;
   sepcol:=pvlblue;
   end;
0: begin
   Form_peach.Bevel20.Brush.Color:=Form_peach.Color;
   Form_peach.ShapeAddress.Brush.Color:=Form_peach.Color;
   Form_peach.Bevel20.Pen.Color:=StringToColor(colmid);
   Form_peach.splitsearch.Color:=StringToColor(colmid);
   if (altbread>0) and (macbread=0) then abactivecol:=StringToColor(colmid) else abactivecol:=StringToColor(collow);
   abarchivecol:=StringToColor(colvlow);
   sepcol:=StringToColor(colmid);
   end;
1: begin
   Form_peach.Bevel20.Brush.Color:=StringToColor(collow);
   Form_peach.ShapeAddress.Brush.Color:=StringToColor(collow);
   Form_peach.Bevel20.Pen.Color:=StringToColor(collow);
   Form_peach.splitsearch.Color:=StringToColor(colbtnhigh);
   if (altbread>0) and (macbread=0) then abactivecol:=StringToColor(colbtnhigh) else abactivecol:=StringToColor(colhigh);
   abarchivecol:=StringToColor(colmid);
   sepcol:=StringToColor(colbtnhigh);
   end;
2: begin
   Form_peach.Bevel20.Brush.Color:=pvvvlblue;
   Form_peach.ShapeAddress.Brush.Color:=pvvvlblue;
   Form_peach.Bevel20.Pen.Color:=pvvvlblue;
   Form_peach.splitsearch.Color:=pvlblue;
   if (altbread>0) and (macbread=0) then abactivecol:=pvmlblue else abactivecol:=pvvlblue;
   abarchivecol:=pvvmlblue;
   sepcol:=pvlblue;
   end;
end;

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

case altbread of
   0:
   begin
   Form_peach.shapeaddress0.visible:=false;
   Form_peach.shapeaddress1.visible:=false;
   Form_peach.shapeaddress2.visible:=false;
   Form_peach.shapeaddress3.visible:=false;
   Form_peach.shapeaddress4.visible:=false;
   Form_peach.shapeaddress5.visible:=false;
   Form_peach.shapeaddress6.visible:=false;
   Form_peach.shapeaddress7.visible:=false;
   Form_peach.shapeaddress8.visible:=false;
   Form_peach.shapeaddress9.visible:=false;
   Form_peach.shapeaddress10.visible:=false;
   Form_peach.shapeaddress11.visible:=false;
   Form_peach.PanelAdArchive4.visible:=false;
   Form_peach.PanelLCA1.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA2.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA3.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA4.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA5.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA6.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA7.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCA8.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCAa1.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCAa2.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCAa3.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelLCAa4.Height:=Form_peach.Panel11.Height;
   Form_peach.PanelClickAddress.AnchorSideRight.Control:=Form_peach.Panel8;
   Form_peach.Bevel20.AnchorSideRight.Control:=Form_peach.PanelSPaddress;
   end;
   1:
   begin
   Form_peach.imageaddress0.visible:=false;
   Form_peach.imageaddress1.visible:=false;
   Form_peach.imageaddress2.visible:=false;
   Form_peach.imageaddress3.visible:=false;
   Form_peach.imageaddress4.visible:=false;
   Form_peach.imageaddress5.visible:=false;
   Form_peach.imageaddress6.visible:=false;
   Form_peach.imageaddress7.visible:=false;
   Form_peach.shapeaddress0.visible:=true;
   Form_peach.shapeaddress1.visible:=true;
   Form_peach.shapeaddress2.visible:=true;
   Form_peach.shapeaddress3.visible:=true;
   Form_peach.shapeaddress4.visible:=true;
   Form_peach.shapeaddress5.visible:=true;
   Form_peach.shapeaddress6.visible:=true;
   Form_peach.shapeaddress7.visible:=true;
   Form_peach.shapeaddress8.visible:=true;
   Form_peach.shapeaddress9.visible:=true;
   Form_peach.shapeaddress10.visible:=true;
   Form_peach.shapeaddress11.visible:=true;
   Form_peach.PanelAdArchive4.visible:=true;
   Form_peach.shapeaddress0.pen.color:=sepcol;
   Form_peach.shapeaddress1.pen.color:=sepcol;
   Form_peach.shapeaddress2.pen.color:=sepcol;
   Form_peach.shapeaddress3.pen.color:=sepcol;
   Form_peach.shapeaddress4.pen.color:=sepcol;
   Form_peach.shapeaddress5.pen.color:=sepcol;
   Form_peach.shapeaddress6.pen.color:=sepcol;
   Form_peach.shapeaddress7.pen.color:=sepcol;
   Form_peach.shapeaddress8.pen.color:=sepcol;
   Form_peach.shapeaddress9.pen.color:=sepcol;
   Form_peach.shapeaddress10.pen.color:=sepcol;
   Form_peach.shapeaddress11.pen.color:=sepcol;
   if macbread=0 then
      begin
      Form_peach.PanelLCA1.Height:=pbarhsmall;
      Form_peach.PanelLCA2.Height:=pbarhsmall;
      Form_peach.PanelLCA3.Height:=pbarhsmall;
      Form_peach.PanelLCA4.Height:=pbarhsmall;
      Form_peach.PanelLCA5.Height:=pbarhsmall;
      Form_peach.PanelLCA6.Height:=pbarhsmall;
      Form_peach.PanelLCA7.Height:=pbarhsmall;
      Form_peach.PanelLCA8.Height:=pbarhsmall;
      Form_peach.PanelLCAa1.Height:=pbarhsmall;
      Form_peach.PanelLCAa2.Height:=pbarhsmall;
      Form_peach.PanelLCAa3.Height:=pbarhsmall;
      Form_peach.PanelLCAa4.Height:=pbarhsmall;
      end;
   Form_peach.PanelClickAddress.AnchorSideRight.Control:=nil;
   Form_peach.Bevel20.AnchorSideRight.Control:=nil;
   setfontsbreadcrumb;
   update_addressbar(form_peach.EditOpenIn1.Text);
   end;
   2:
   begin
   Form_peach.imageaddress0.visible:=false;
   Form_peach.imageaddress1.visible:=false;
   Form_peach.imageaddress2.visible:=false;
   Form_peach.imageaddress3.visible:=false;
   Form_peach.imageaddress4.visible:=false;
   Form_peach.imageaddress5.visible:=false;
   Form_peach.imageaddress6.visible:=false;
   Form_peach.imageaddress7.visible:=false;
   Form_peach.shapeaddress0.visible:=false;
   Form_peach.shapeaddress1.visible:=false;
   Form_peach.shapeaddress2.visible:=false;
   Form_peach.shapeaddress3.visible:=false;
   Form_peach.shapeaddress4.visible:=false;
   Form_peach.shapeaddress5.visible:=false;
   Form_peach.shapeaddress6.visible:=false;
   Form_peach.shapeaddress7.visible:=false;
   Form_peach.shapeaddress8.visible:=false;
   Form_peach.shapeaddress9.visible:=false;
   Form_peach.shapeaddress10.visible:=false;
   Form_peach.shapeaddress11.visible:=false;
   Form_peach.PanelAdArchive4.visible:=false;
   Form_peach.PanelLCA1.Height:=pbarhsmall;
   Form_peach.PanelLCA2.Height:=pbarhsmall;
   Form_peach.PanelLCA3.Height:=pbarhsmall;
   Form_peach.PanelLCA4.Height:=pbarhsmall;
   Form_peach.PanelLCA5.Height:=pbarhsmall;
   Form_peach.PanelLCA6.Height:=pbarhsmall;
   Form_peach.PanelLCA7.Height:=pbarhsmall;
   Form_peach.PanelLCA8.Height:=pbarhsmall;
   Form_peach.PanelLCAa1.Height:=pbarhsmall;
   Form_peach.PanelLCAa2.Height:=pbarhsmall;
   Form_peach.PanelLCAa3.Height:=pbarhsmall;
   Form_peach.PanelLCAa4.Height:=pbarhsmall;
   Form_peach.PanelAddress0.Caption:=DirectorySeparator;
   Form_peach.PanelAddress1.Caption:=DirectorySeparator;
   Form_peach.PanelAddress2.Caption:=DirectorySeparator;
   Form_peach.PanelAddress3.Caption:=DirectorySeparator;
   Form_peach.PanelAddress4.Caption:=DirectorySeparator;
   Form_peach.PanelAddress5.Caption:=DirectorySeparator;
   Form_peach.PanelAddress6.Caption:=DirectorySeparator;
   Form_peach.PanelAddress7.Caption:=DirectorySeparator;
   Form_peach.PanelAdArchive0.Caption:=DirectorySeparator;
   Form_peach.PanelAdArchive1.Caption:=DirectorySeparator;
   Form_peach.PanelAdArchive2.Caption:=DirectorySeparator;
   Form_peach.PanelAdArchive3.Caption:=DirectorySeparator;
   Form_peach.PanelClickAddress.AnchorSideRight.Control:=Form_peach.Panel8;
   Form_peach.Bevel20.AnchorSideRight.Control:=Form_peach.PanelSPaddress;
   setfontsbreadcrumb;
   end;
end;

{Form_peach.Bevel20.Shape:=stRectangle; //the old squared look of the address bar
Form_peach.Bevel20.BorderSpacing.Right:=0;
Form_peach.ShapeAddress.BorderSpacing.Left:=2;
Form_peach.ShapeAddress.BorderSpacing.Right:=2;}
case alttabstyle of
   2:
   begin
   Form_peach.PanelTitleExtractTabAlign.AnchorSideLeft.Side:=asrleft;
   Form_peach.PanelTitleAddTabAlign.AnchorSideLeft.Side:=asrleft;
   Form_peach.PanelTitleAppsTabAlign.AnchorSideLeft.Side:=asrleft;
   FormPM.PanelTitlePMTabAlign.AnchorSideLeft.Side:=asrleft;
   Form_gwrap.PanelTitlePLTabAlign.AnchorSideLeft.Side:=asrleft;
   end
   else
   begin
   Form_peach.PanelTitleExtractTabAlign.AnchorSideLeft.Side:=asrCenter;
   Form_peach.PanelTitleAddTabAlign.AnchorSideLeft.Side:=asrCenter;
   Form_peach.PanelTitleAppsTabAlign.AnchorSideLeft.Side:=asrCenter;
   FormPM.PanelTitlePMTabAlign.AnchorSideLeft.Side:=asrCenter;
   Form_gwrap.PanelTitlePLTabAlign.AnchorSideLeft.Side:=asrCenter;
   end;
end;

Form_peach.Splitter3.Color:=Form_peach.Splitter2.Color;
Form_peach.ShapeTitleAddb1.Brush.Color:=StringToColor(collow);
Form_peach.ShapeTitleAddb2.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleAddb3.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleAddb4.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleExtractb1.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleExtractb2.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleExtractb3.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleExtractb4.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleAppsb1.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Form_peach.ShapeTitleAppsb2.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
FormPM.ShapeTitlePMb1.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
FormPM.ShapeTitlePMb2.Brush.Color:=Form_peach.ShapeTitleAddb1.Brush.Color;
Unit8.color2:=color2;
Form_peach.BevelTitleOpt1.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt2.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt3.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt4.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt5.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt6.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt7.Color:=Form_peach.Splitter2.Color;
Form_peach.BevelTitleOpt8.Color:=Form_peach.Splitter2.Color;
if lastbar=0 then
   Form_peach.Splitter1.Color:=stringtocolor(color2)
else
   Form_peach.Splitter1.Color:=stringtocolor(colbtnhigh);
update_info;
//grayed fonts
Form_peach.labelStatus.Font.Color:=pGray;
Form_peach.LabelStatusdisplayed.Font.Color:=pGray;
Form_peach.LabelPanelHintAdd.Font.Color:=pGray;
Form_peach.LabelPanelHintExtract.Font.Color:=pGray;
//accent app color fonts
Form_peach.Labelmoreopt.Font.Color:=ptextaccent;
Form_peach.Labelmoreopt1.Font.Color:=ptextaccent;
Form_peach.Lmanageschedule1.Font.Color:=ptextaccent;
Form_peach.Lmanageschedule2.Font.Color:=ptextaccent;
Form_peach.Lmanageschedule3.Font.Color:=ptextaccent;
Form_peach.Lmanageschedule4.Font.Color:=ptextaccent;
Form_peach.LabelStatus5.Font.Color:=ptextaccent;
Form_peach.LabelResetApp1.Font.Color:=ptextaccent;
Form_peach.Labelsetwork.Font.Color:=ptextaccent;
Form_peach.LabelConfigurePw.Font.Color:=ptextaccent;
Form_peach.LabelConfigurearc.Font.Color:=ptextaccent;
Form_peach.LabelConfigureext.Font.Color:=ptextaccent;
Form_peach.lsetdefaultout_arc.Font.Color:=ptextaccent;
Form_peach.lsetdefaultout_ext.Font.Color:=ptextaccent;
Form_peach.LabelLang2.Font.Color:=ptextaccent;
Form_peach.Labelcb7.Font.Color:=ptextaccent;
Form_peach.LabelResetHistory.Font.Color:=ptextaccent;
Form_peach.LabelResetBookmarks.Font.Color:=ptextaccent;
Form_peach.LabelWD.Font.Color:=ptextaccent;
Form_peach.LabelUpdates.Font.Color:=ptextaccent;
Form_peach.LabelDoc.Font.Color:=ptextaccent;
Form_peach.LabelResetPM.Font.Color:=ptextaccent;
Form_peach.LabelResetPtmp.Font.Color:=ptextaccent;
Form_peach.LabelConfigurePeaZip.Font.Color:=ptextaccent;
Form_peach.Labelcb17.Font.Color:=ptextaccent;
Form_peach.Labelcb19.Font.Color:=ptextaccent;
Form_peach.LabelConf1.Font.Color:=ptextaccent;
Form_peach.LabelAppPath.Font.Color:=ptextaccent;
Form_peach.LabelConfigureSendTo.Font.Color:=ptextaccent;
Form_peach.themesave_label.Font.Color:=ptextaccent;
Form_peach.LabelDefaultColor1.Font.Color:=ptextaccent;
Form_peach.LabelColPresets.Font.Color:=ptextaccent;
Form_peach.LabelDefaultOpacity.Font.Color:=ptextaccent;
Form_peach.LabelDefaultColor2.Font.Color:=ptextaccent;
Form_peach.Labellightpresets.Font.Color:=ptextaccent;
Form_peach.LabelDefaultColor3.Font.Color:=ptextaccent;
Form_peach.labeltheme.Font.Color:=ptextaccent;
Form_peach.LabelAddFiles.Font.Color:=ptextaccent;
Form_peach.LabelAddFolder.Font.Color:=ptextaccent;
FormPW.LableListPath2.Font.Color:=ptextaccent;
FormPM.Button1.Font.Color:=ptextaccent;
FormPM.Button2.Font.Color:=ptextaccent;
FormInput.LabelLow.Font.Color:=ptextaccent;
FormInput.LabelUp.Font.Color:=ptextaccent;
FormInput.LabelTimestamp.Font.Color:=ptextaccent;
FormInput.Labelappdirn.Font.Color:=ptextaccent;
FormInput.Labelprepdirn.Font.Color:=ptextaccent;
FormInput.Labelrenamereset.Font.Color:=ptextaccent;
FormSelect.Label1.Font.Color:=ptextaccent;
FormSelect.Label3.Font.Color:=ptextaccent;
FormSelect.Label5.Font.Color:=ptextaccent;
Form_gwrap.LabelWarning1.Font.Color:=ptextaccent;
Form_gwrap.ImageButton2.Font.Color:=ptextaccent;
Form_gwrap.ImageSavePJ.Font.Color:=ptextaccent;
Form_gwrap.l2.Font.Color:=ptextaccent;
Form_gwrap.l4.Font.Color:=ptextaccent;
//PanelDefaults Themes
Form_peach.ColorButton1.Color:=stringtocolor(color1);
Form_peach.ColorButton1.ButtonColor:=stringtocolor(color1);
Form_peach.ColorButton2.Color:=stringtocolor(color2);
Form_peach.ColorButton2.ButtonColor:=stringtocolor(color2);
Form_peach.tbtemperature.Position:=temperature;
Form_peach.tbcontrast.Position:=contrast-4;
Form_peach.ColorButton3.Color:=stringtocolor(color3);
Form_peach.ColorButton3.ButtonColor:=stringtocolor(color3);
case pspacing of
   8: Form_peach.cbspacing.ItemIndex :=1;
   12: Form_peach.cbspacing.ItemIndex :=2;
   16: Form_peach.cbspacing.ItemIndex :=3;
   else Form_peach.cbspacing.ItemIndex :=0;
   end;
case pzooming of
   50: Form_peach.cbzooming.ItemIndex :=0;
   67: Form_peach.cbzooming.ItemIndex :=1;
   80: Form_peach.cbzooming.ItemIndex :=2;
   87: Form_peach.cbzooming.ItemIndex :=3;
   115: Form_peach.cbzooming.ItemIndex :=5;
   125: Form_peach.cbzooming.ItemIndex :=6;
   150: Form_peach.cbzooming.ItemIndex :=7;
   200: Form_peach.cbzooming.ItemIndex :=8;
   else Form_peach.cbzooming.ItemIndex :=4;
   end;
Form_peach.cbensmall.ItemIndex:=ensmall;
if usealtcolor=1 then
   Form_peach.CheckBoxAltgridcol.State:=cbChecked
else
   Form_peach.CheckBoxAltgridcol.State:=cbUnchecked;
Form_peach.CheckBoxAlttabcol.ItemIndex:=highlighttabs;
Form_peach.CheckBoxAccentToolBar.ItemIndex:=accenttoolbar;
case altaddressstyle of
   3: Form_peach.CheckBoxAltBar.ItemIndex:=1;
   0: Form_peach.CheckBoxAltBar.ItemIndex:=0;
   1: Form_peach.CheckBoxAltBar.ItemIndex:=2;
   2: Form_peach.CheckBoxAltBar.ItemIndex:=3;
end;
Form_peach.CheckBoxSolidAddress.ItemIndex:=solidaddressstyle;
if toolcentered=1 then
   Form_peach.CheckBoxCenteredToolbar.State:=cbChecked
else
   Form_peach.CheckBoxCenteredToolbar.State:=cbUnchecked;
Form_peach.CheckBoxAltTab.ItemIndex:=alttabstyle;
setgridaltcolor;
settabaltcolor;
load_icons;
if prevpanel='open' then
   begin
   clicklabel_apps(Form_peach.LabelTitleApps1,Form_peach.ShapeTitleAppsb1);
   clicklabel_options(Form_peach.LabelTitleOptions6,Form_peach.BevelTitleOptions6);
   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
readln(conf,color4);//unused
readln(conf,color5);//text, currently unsupported
readln(conf,s); decodebintheming(s,usealtcolor,highlighttabs,accenttoolbar,toolcentered,altaddressstyle,solidaddressstyle,alttabstyle,ensmall,contrast);
readln(conf,s); pzooming:=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);
readln(conf,s); pzoomingd:=strtoint(s);
readln(conf,s); pspacingd:=strtoint(s);
readln(conf,s); temperatured:=strtoint(s);
end;

function isawebservice(s:ansistring):boolean;
begin
if (pos('http://',s)=1) or (pos('https://',s)=1) or (pos('www.',s)=1) then
   result:=true
else
   result:=false;
end;

procedure set_ow_custedit_menu;
begin
with Form_peach 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 StringGridCustedit1.Cells[1,1]<>'' then owcustom9.Caption:=StringGridCustedit1.Cells[1,1]
else owcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then owcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else owcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then owcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else owcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then owcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else owcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then owcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else owcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then owcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else owcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then owcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else owcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then owcustom16.Caption:=StringGridCustedit1.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 Form_peach 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 StringGridCustedit1.Cells[1,1]<>'' then eowcustom9.Caption:=StringGridCustedit1.Cells[1,1]
else eowcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then eowcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else eowcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then eowcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else eowcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then eowcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else eowcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then eowcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else eowcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then eowcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else eowcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then eowcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else eowcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then eowcustom16.Caption:=StringGridCustedit1.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 Form_peach 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 StringGridCustedit1.Cells[1,1]<>'' then powcustom9.Caption:=StringGridCustedit1.Cells[1,1]
else powcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then powcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else powcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then powcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else powcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then powcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else powcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then powcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else powcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then powcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else powcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then powcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else powcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then powcustom16.Caption:=StringGridCustedit1.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 Form_peach 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 StringGridCustedit1.Cells[1,1]<>'' then aowcustom9.Caption:=StringGridCustedit1.Cells[1,1]
else aowcustom9.Caption:=advedit1before+stringdelim('%f')+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then aowcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else aowcustom10.Caption:=advedit2before+stringdelim('%f')+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then aowcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else aowcustom11.Caption:=advedit3before+stringdelim('%f')+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then aowcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else aowcustom12.Caption:=advedit4before+stringdelim('%f')+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then aowcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else aowcustom13.Caption:=advedit5before+stringdelim('%f')+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then aowcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else aowcustom14.Caption:=advedit6before+stringdelim('%f')+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then aowcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else aowcustom15.Caption:=advedit7before+stringdelim('%f')+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then aowcustom16.Caption:=StringGridCustedit1.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 form_peach 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:=StringGridCustedit1.Cells[2,1];
advedit2before:=StringGridCustedit1.Cells[2,2];
advedit3before:=StringGridCustedit1.Cells[2,3];
advedit4before:=StringGridCustedit1.Cells[2,4];
advedit5before:=StringGridCustedit1.Cells[2,5];
advedit6before:=StringGridCustedit1.Cells[2,6];
advedit7before:=StringGridCustedit1.Cells[2,7];
advedit8before:=StringGridCustedit1.Cells[2,8];
advedit1after:=StringGridCustedit1.Cells[3,1];
advedit2after:=StringGridCustedit1.Cells[3,2];
advedit3after:=StringGridCustedit1.Cells[3,3];
advedit4after:=StringGridCustedit1.Cells[3,4];
advedit5after:=StringGridCustedit1.Cells[3,5];
advedit6after:=StringGridCustedit1.Cells[3,6];
advedit7after:=StringGridCustedit1.Cells[3,7];
advedit8after:=StringGridCustedit1.Cells[3,8];
advedit1alt:=StringGridCustedit1.Cells[4,1];
advedit2alt:=StringGridCustedit1.Cells[4,2];
advedit3alt:=StringGridCustedit1.Cells[4,3];
advedit4alt:=StringGridCustedit1.Cells[4,4];
advedit5alt:=StringGridCustedit1.Cells[4,5];
advedit6alt:=StringGridCustedit1.Cells[4,6];
advedit7alt:=StringGridCustedit1.Cells[4,7];
advedit8alt:=StringGridCustedit1.Cells[4,8];
end;
end;

procedure set_custedit_totable;
begin
with form_peach 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;
StringGridCustedit1.Cells[2,1]:=advedit1before;
StringGridCustedit1.Cells[2,2]:=advedit2before;
StringGridCustedit1.Cells[2,3]:=advedit3before;
StringGridCustedit1.Cells[2,4]:=advedit4before;
StringGridCustedit1.Cells[2,5]:=advedit5before;
StringGridCustedit1.Cells[2,6]:=advedit6before;
StringGridCustedit1.Cells[2,7]:=advedit7before;
StringGridCustedit1.Cells[2,8]:=advedit8before;
StringGridCustedit1.Cells[3,1]:=advedit1after;
StringGridCustedit1.Cells[3,2]:=advedit2after;
StringGridCustedit1.Cells[3,3]:=advedit3after;
StringGridCustedit1.Cells[3,4]:=advedit4after;
StringGridCustedit1.Cells[3,5]:=advedit5after;
StringGridCustedit1.Cells[3,6]:=advedit6after;
StringGridCustedit1.Cells[3,7]:=advedit7after;
StringGridCustedit1.Cells[3,8]:=advedit8after;
StringGridCustedit1.Cells[4,1]:=advedit1alt;
StringGridCustedit1.Cells[4,2]:=advedit2alt;
StringGridCustedit1.Cells[4,3]:=advedit3alt;
StringGridCustedit1.Cells[4,4]:=advedit4alt;
StringGridCustedit1.Cells[4,5]:=advedit5alt;
StringGridCustedit1.Cells[4,6]:=advedit6alt;
StringGridCustedit1.Cells[4,7]:=advedit7alt;
StringGridCustedit1.Cells[4,8]:=advedit8alt;
StringGridCustedit1.AutoSizeColumns;
end;
end;

function check7zvolume(s:ansistring):boolean;
begin
check7zvolume:=false;
if length(s)>=4 then
   if copy(s,1,4)='\\.\' then check7zvolume:=true;
end;

function checkUNCpath(s:ansistring):boolean;
begin
checkUNCpath:=false;
if length(s)>=2 then
   if copy(s,1,2)=DirectorySeparator+DirectorySeparator then checkUNCpath:=true;
end;

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

if Form_peach.mRecent1.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent1.Caption; i:=i+1; end;
if Form_peach.mRecent2.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent2.Caption; i:=i+1; end;
if Form_peach.mRecent3.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent3.Caption; i:=i+1; end;
if Form_peach.mRecent4.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent4.Caption; i:=i+1; end;
if Form_peach.mRecent5.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent5.Caption; i:=i+1; end;
if Form_peach.mRecent6.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent6.Caption; i:=i+1; end;
if Form_peach.mRecent7.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent7.Caption; i:=i+1; end;
if Form_peach.mRecent8.Caption<>'' then begin Form_peach.StringGridRecent.Cells[0,i]:=' '; Form_peach.StringGridRecent.Cells[1,i]:=Form_peach.mRecent8.Caption; i:=i+1; end;
Form_peach.StringGridRecent.Rowcount:=i;
Form_peach.StringGridRecent.AutosizeColumns;
Form_peach.StringGridRecent.ColWidths[0]:=rowsize;
Form_peach.StringGridRecent.ColWidths[2]:=0;
Form_peach.StringGridRecent.ColWidths[3]:=0;
Form_peach.StringGridRecent.ColWidths[4]:=0;
except
end;
end;

procedure setsearchhistorymenu;
begin
with Form_peach 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;
Form_peach.mRecent1.Caption:=csrec[1];
Form_peach.mRecent2.Caption:=csrec[2];
Form_peach.mRecent3.Caption:=csrec[3];
Form_peach.mRecent4.Caption:=csrec[4];
Form_peach.mRecent5.Caption:=csrec[5];
Form_peach.mRecent6.Caption:=csrec[6];
Form_peach.mRecent7.Caption:=csrec[7];
Form_peach.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 directoryexists(srecf[i]) then
      begin
      csrecf[j]:=srecf[i];
      j:=j+1;
      end;
Form_peach.mRecent1f.Caption:=csrecf[1];
Form_peach.mRecent2f.Caption:=csrecf[2];
Form_peach.mRecent3f.Caption:=csrecf[3];
Form_peach.mRecent4f.Caption:=csrecf[4];
Form_peach.mRecent5f.Caption:=csrecf[5];
Form_peach.mRecent6f.Caption:=csrecf[6];
Form_peach.mRecent7f.Caption:=csrecf[7];
Form_peach.mRecent8f.Caption:=csrecf[8];
end;

procedure setshowvolatile;
begin
if showvolatile=1 then
begin
Form_peach.checkboxseparate.Font.Style:=[fsItalic];
Form_peach.checkboxsamearc.Font.Style:=[fsItalic];
Form_peach.checkboxconvert.Font.Style:=[fsItalic];
Form_peach.checkboxconvert0.Font.Style:=[fsItalic];
Form_peach.checkboxconvert1.Font.Style:=[fsItalic];
Form_peach.CheckBoxTarBefore.Font.Style:=[fsItalic];
Form_peach.checkboxsameext.Font.Style:=[fsItalic];
Form_peach.ComboBoxArchive7.Font.Style:=[fsItalic];
Form_peach.ComboBoxArchivePaths.Font.Style:=[fsItalic];
Form_peach.Label7za5.Font.Style:=[fsItalic];
Form_peach.Label7za6.Font.Style:=[fsItalic];
Form_peach.Label7zaPasses.Font.Style:=[fsItalic];
Form_peach.Label7zsolidblock.Font.Style:=[fsItalic];
Form_peach.Label7za1.Font.Style:=[fsItalic];
Form_peach.Label7za8.Font.Style:=[fsItalic];
end
else
begin
Form_peach.checkboxseparate.Font.Style:=[];
Form_peach.checkboxsamearc.Font.Style:=[];
Form_peach.checkboxconvert.Font.Style:=[];
Form_peach.checkboxconvert0.Font.Style:=[];
Form_peach.checkboxconvert1.Font.Style:=[];
Form_peach.CheckBoxTarBefore.Font.Style:=[];
Form_peach.checkboxsameext.Font.Style:=[];
Form_peach.ComboBoxArchive7.Font.Style:=[];
Form_peach.ComboBoxArchivePaths.Font.Style:=[];
Form_peach.Label7za5.Font.Style:=[];
Form_peach.Label7za6.Font.Style:=[];
Form_peach.Label7zaPasses.Font.Style:=[];
Form_peach.Label7zsolidblock.Font.Style:=[];
Form_peach.Label7za1.Font.Style:=[];
Form_peach.Label7za8.Font.Style:=[];
end;
end;

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

procedure setspecialextensions;
var
  astr: ansistring;
  aastr: array of ansistring;
  i,j:integer;
begin
astr:=Form_peach.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 readconf_defaults;
var
   s:ansistring;
   srec,srecf:Thistarray;
begin
readln(conf,s); csvsep:=s; if s='' then csvsep:=','; Form_peach.EditCSVsep.Caption:=csvsep;
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); extpw:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); browserstyle:=strtoint(s);
if (browserstyle=0) or (browserstyle=20) then browsingmode7z:=0 else browsingmode7z:=1;
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);
readln(conf,s);
readln(conf,s);
readln(conf,s); prebrowsesize:=strtoint(s);
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]); //Form_peach.mRecent1.Caption:=s;
readln(conf,srec[2]); //Form_peach.mRecent2.Caption:=s;
readln(conf,srec[3]); //Form_peach.mRecent3.Caption:=s;
readln(conf,srec[4]); //Form_peach.mRecent4.Caption:=s;
readln(conf,srec[5]); //Form_peach.mRecent5.Caption:=s;
readln(conf,srec[6]); //Form_peach.mRecent6.Caption:=s;
readln(conf,srec[7]); //Form_peach.mRecent7.Caption:=s;
readln(conf,srec[8]); //Form_peach.mRecent8.Caption:=s;
checkrecent(srec);
Form_peach.pmhr1.Caption:=Form_peach.mRecent1.Caption;
Form_peach.pmhr2.Caption:=Form_peach.mRecent2.Caption;
Form_peach.pmhr3.Caption:=Form_peach.mRecent3.Caption;
Form_peach.pmhr4.Caption:=Form_peach.mRecent4.Caption;
Form_peach.pmhr5.Caption:=Form_peach.mRecent5.Caption;
Form_peach.pmhr6.Caption:=Form_peach.mRecent6.Caption;
Form_peach.pmhr7.Caption:=Form_peach.mRecent7.Caption;
Form_peach.pmhr8.Caption:=Form_peach.mRecent8.Caption;
readln(conf,s);
readln(conf,s);
readln(conf,s); Form_peach.pcustom1.Caption:=s;
readln(conf,s); Form_peach.pcustom2.Caption:=s;
readln(conf,s); Form_peach.pcustom3.Caption:=s;
readln(conf,s); Form_peach.pcustom4.Caption:=s;
readln(conf,s); Form_peach.pcustom5.Caption:=s;
readln(conf,s); Form_peach.pcustom6.Caption:=s;
readln(conf,s); Form_peach.pcustom7.Caption:=s;
readln(conf,s); Form_peach.pcustom8.Caption:=s;
readln(conf,s); Form_peach.EditOPCustom.Caption:=s;
readln(conf,s); customsyntax:=strtoint(s);
readln(conf,s); Form_peach.EditOPCustom1.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);
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 directoryexists(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); jobdefenc:=strtoint(s);
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;
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 Form_peach.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(directoryexists(lastextractionpath)) then lastextractionpath:='';
readln(conf,s);
readln(conf,s);
readln(conf,s); setencfn:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); //ignorepathdd:=strtoint(s);removed from 6.8.0 release
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); Form_peach.pmshist1.Caption:=s;
readln(conf,s); Form_peach.pmshist2.Caption:=s;
readln(conf,s); Form_peach.pmshist3.Caption:=s;
readln(conf,s); Form_peach.pmshist4.Caption:=s;
readln(conf,s); Form_peach.pmshist5.Caption:=s;
readln(conf,s); Form_peach.pmshist6.Caption:=s;
readln(conf,s); Form_peach.pmshist7.Caption:=s;
readln(conf,s); Form_peach.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);
Form_peach.pmhr1f.Caption:=Form_peach.mRecent1f.Caption;
Form_peach.pmhr2f.Caption:=Form_peach.mRecent2f.Caption;
Form_peach.pmhr3f.Caption:=Form_peach.mRecent3f.Caption;
Form_peach.pmhr4f.Caption:=Form_peach.mRecent4f.Caption;
Form_peach.pmhr5f.Caption:=Form_peach.mRecent5f.Caption;
Form_peach.pmhr6f.Caption:=Form_peach.mRecent6f.Caption;
Form_peach.pmhr7f.Caption:=Form_peach.mRecent7f.Caption;
Form_peach.pmhr8f.Caption:=Form_peach.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;
   Form_peach.ComboBoxLibre.ItemIndex:=libre_directive;
   Form_peach.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;
   Form_peach.ComboBoxPrivacy.ItemIndex:=privacy_mode;
   Form_peach.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 Form_peach.cbforcetype.enabled:=true else Form_peach.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 Form_peach.Timerdrag.Enabled:=true else Form_peach.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); Form_peach.EditOP.Caption:=s;
readln(conf,s); Form_peach.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); Form_peach.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);
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); Form_peach.editExtEvForWhat.Caption:=s; setspecialextensions;
readln(conf,s);
readln(conf,s);
readln(conf,s); repcustext:=strtoint(s);
readln(conf,s); Form_peach.editcustext.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); Form_peach.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); Form_peach.LabelForceLayout.Caption:=s;
if (forcelayout=1) and (Form_peach.LabelForceLayout.Caption<>'') then
   if fileexists(Form_peach.LabelForceLayout.Caption) then
      loadlist(nil,Form_peach.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
form_peach.ComboBoxArchive7.ItemIndex:=strtoint(s);
except
form_peach.ComboBoxArchive7.ItemIndex:=0;
end;
defaultarchiveaction:=form_peach.ComboBoxArchive7.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);
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); if strtoint(s)=1 then enlargeicons:=true else enlargeicons:=false;
readln(conf,s);
readln(conf,s);
readln(conf,s); qdup:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); Form_peach.Editalias.Caption:=s; if Form_peach.Editalias.Caption='' then Form_peach.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;
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));
writeln(conf,inttostr(pzooming));
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(contrast));
writeln(conf,inttostr(pzoomingd));
writeln(conf,inttostr(pspacingd));
writeln(conf,inttostr(temperatured));
end;

procedure writeconf_defaults;
begin
writeln(conf,'[language]');
writeln(conf,lang_file);
writeln(conf,Form_peach.EditCSVsep.Caption);
writeln(conf,'[0: always keep open task window for inspection of reports 1: (default) keep open only for errors, list, test operations 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,'[ask for password on extract/list/test operations from system''s menus]');
writeln(conf,inttostr(extpw));
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..4 slower to faster optimization (3 default) 5 do not pre-parse archives, may non correctly list some out of standard archives]');
writeln(conf,inttostr(prebrowse));
writeln(conf,'');
writeln(conf,'[(obsolete) don''t pre-parse archives over this in-memory size]');
writeln(conf,inttostr(prebrowsesize));
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,Form_peach.mRecent1.Caption);
writeln(conf,Form_peach.mRecent2.Caption);
writeln(conf,Form_peach.mRecent3.Caption);
writeln(conf,Form_peach.mRecent4.Caption);
writeln(conf,Form_peach.mRecent5.Caption);
writeln(conf,Form_peach.mRecent6.Caption);
writeln(conf,Form_peach.mRecent7.Caption);
writeln(conf,Form_peach.mRecent8.Caption);
writeln(conf,'');
writeln(conf,'[recently used custom executables]');
writeln(conf,Form_peach.pcustom1.Caption);
writeln(conf,Form_peach.pcustom2.Caption);
writeln(conf,Form_peach.pcustom3.Caption);
writeln(conf,Form_peach.pcustom4.Caption);
writeln(conf,Form_peach.pcustom5.Caption);
writeln(conf,Form_peach.pcustom6.Caption);
writeln(conf,Form_peach.pcustom7.Caption);
writeln(conf,Form_peach.pcustom8.Caption);
writeln(conf,Form_peach.EditOPcustom.Caption);
writeln(conf,inttostr(customsyntax));
writeln(conf,Form_peach.EditOPcustom1.Caption);
writeln(conf,inttostr(customsyntax1));
writeln(conf,'');
writeln(conf,'[save program''s windows status]');
writeln(conf,inttostr(ws));
if Form_peach.Visible=true then
   if Form_peach.WindowState=wsNormal then
      begin
      ws_status:=0;
      ws_left:=Form_peach.Left;
      ws_top:=Form_peach.Top;
      ws_width:=Form_peach.Width;
      ws_height:=Form_peach.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,'[job definition encoding]');
writeln(conf,inttostr(jobdefenc));
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 az=true then writeln(conf,'1') else writeln(conf,'0');
if (browsertype=0) and (Form_Peach.EditOpenIn.Caption<>txt_mypc) then
   begin
   writeln(conf,inttostr(Form_Peach.ListView1.Column[0].Width));
   if ctype=false then writeln(conf,inttostr(col2size)) else writeln(conf,inttostr(Form_Peach.ListView1.Column[1].Width));
   if csize=false then writeln(conf,inttostr(col3size)) else writeln(conf,inttostr(Form_Peach.ListView1.Column[2].Width));
   if cpacked=false then writeln(conf,inttostr(col4size)) else writeln(conf,inttostr(Form_Peach.ListView1.Column[3].Width));
   if cdate=false then writeln(conf,inttostr(col5size)) else writeln(conf,inttostr(Form_Peach.ListView1.Column[4].Width));
   if catt=false then writeln(conf,inttostr(col6size)) else writeln(conf,inttostr(Form_Peach.ListView1.Column[9].Width));
   if ccrc=false then writeln(conf,inttostr(col7size)) else writeln(conf,inttostr(Form_Peach.ListView1.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 Form_peach.CheckBoxFolder.State=cbChecked then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[execute archiving/extraction jobs in parallel when possible]');
if Form_peach.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 Form_peach.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,'[ignore archived path structure when performing custom drag and drop extraction]');
writeln(conf,inttostr(ignorepathdd));
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,Form_peach.pmshist1.Caption);
   writeln(conf,Form_peach.pmshist2.Caption);
   writeln(conf,Form_peach.pmshist3.Caption);
   writeln(conf,Form_peach.pmshist4.Caption);
   writeln(conf,Form_peach.pmshist5.Caption);
   writeln(conf,Form_peach.pmshist6.Caption);
   writeln(conf,Form_peach.pmshist7.Caption);
   writeln(conf,Form_peach.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,Form_peach.mRecent1f.Caption);
writeln(conf,Form_peach.mRecent2f.Caption);
writeln(conf,Form_peach.mRecent3f.Caption);
writeln(conf,Form_peach.mRecent4f.Caption);
writeln(conf,Form_peach.mRecent5f.Caption);
writeln(conf,Form_peach.mRecent6f.Caption);
writeln(conf,Form_peach.mRecent7f.Caption);
writeln(conf,Form_peach.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 / delete after archiving option: 0 recycle (Windows) 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 (default) name.date.time, 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 (default) 0 = off, faster on NTFS filesystem]');
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 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 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(Form_peach.ComboBoxArchive5.ItemIndex));
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advopword)) else writeln(conf,inttostr(Form_peach.ComboBoxArchive6.ItemIndex));
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advoppasses)) else writeln(conf,inttostr(Form_peach.ComboBoxArchivePasses.ItemIndex));
if (dontsavecustom7z=true) or (dontsavecustomzip=true) then writeln(conf,inttostr(advopblocksize)) else writeln(conf,inttostr(Form_peach.ComboBoxArchiveSolid.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,Form_peach.EditOP.Caption);
writeln(conf,Form_peach.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,Form_peach.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,Form_peach.editExtEvForWhat.Caption);
writeln(conf,'');
writeln(conf,'[custom archive extension]');
writeln(conf,inttostr(repcustext));
writeln(conf,Form_peach.editcustext.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 (Form_Peach.EditOpenIn.Caption<>txt_mypc) and (fun='UN7Z') then
   if cmethod=false then
      writeln(conf,inttostr(col5size))
   else
      writeln(conf,inttostr(Form_Peach.ListView1.Column[7].Width))
else writeln(conf,inttostr(col5size));
writeln(conf,'');
writeln(conf,'[preferred checksum and hash algorithms]');
writeln(conf,Form_peach.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,Form_peach.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 Form_peach.LabelStatus4.caption='' then writeln(conf,inttostr(form_peach.ComboBoxArchive7.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 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,'[enlarge file browser icons]');
if enlargeicons=true then writeln(conf,'1') else writeln(conf,'0');
writeln(conf,'');
writeln(conf,'[use quick deduplication routine]');
writeln(conf,inttostr(qdup));
writeln(conf,'');
writeln(conf,'[alias for 7z / p7zip binary name]');
writeln(conf,Form_peach.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 (Form_Peach.EditOpenIn.Caption<>txt_mypc) and (fun='UN7Z') then
   if ccomment=false then
      writeln(conf,inttostr(col7size))
   else
      writeln(conf,inttostr(Form_Peach.ListView1.Column[8].Width))
else writeln(conf,inttostr(col7size));
writeln(conf,'');
writeln(conf,'[Manually set RAR binary]');
writeln(conf,inttostr(setrarmanual));
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': 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': result:=18;
'.db','.dbf','.mdb','.adp','.mdf','.nsf','.dat','.fp','.fp3','.fp5','.fp7',
'.frm','.odb','.ora','.sql','.sqlite','.wdb','.rpt': result:=24;
'.eml': result:=23;
'.bat','.pif','.scr','.vbs','.cmd','.reg','.sh','.command','.csh': result:=20;
'.dll','.sys','.so': result:=22;
'.htm','.html','.xml','.mht','.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': 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','.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','.r01','.z01','.zx01':result:=48;
'.iso':result:=49;
'.deb','.rpm','.appx','.msix','.snap','.appimage':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 drawmenuicon(s1:ansistring):TBitmap;
var
   fulltype:ansistring;
   i:integer;
begin
with Form_peach do
begin
if s1='' then
   begin
   result:=nil;
   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_myboxfiles) or (s1 = shared_googledrive)
   or (s1 = shared_onedrive) or (s1 = shared_skydrive) or (s1 = shared_ubuntuone)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;
var
   s1,s2:ansistring;
begin
with Form_peach 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;
result:=drawmenuicon(s1);
end;
end;

function drawrecenticon(s:ansistring):TBitmap;
var
   fulltype:ansistring;
   i:integer;
begin
with Form_peach 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;

procedure populaterecenticons;
begin
with Form_peach 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 Form_peach 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;
end;
end;

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

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

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

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

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

procedure settonewfolder(i:integer);
begin
with form_peach 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;
     mfunextract.Bitmap:=Bextractall;
     ImageFlatext.Glyph:=Bextractall;
     ImageFlatext.Hint:=txt_ext_sel;
     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;
     mfunextract.Bitmap:=Bextractalln;
     ImageFlatext.Glyph:=Bextractalln;
     ImageFlatext.Hint:=txt_caption_extract+' '+txt_newfolder;
     end;
  end;
end;
populatetree;
end;

procedure updateconf;
begin
alias7z:=Form_peach.Editalias.Caption;
Form_peach.RadioGroup0.ItemIndex:=df;
Form_peach.RadioGroupTS.ItemIndex:=tsstyle;
Form_peach.RadioGroup4.ItemIndex:=zaout;
Form_peach.EditDesk.Text:=local_desktop;
Form_peach.RadioGroup6.ItemIndex:=autoclosegwrap;
Form_peach.ComboBoxLibre.ItemIndex:=libre_directive;
Form_peach.ComboBoxPrivacy.ItemIndex:=privacy_mode;
Form_peach.ComboBox1.ItemIndex:=enc7zscc;
Form_peach.ComboBoxsd.ItemIndex:=browsersd;
Form_peach.LabelcbSDcustom.Caption:=browsersdir;
if clipmode=0 then Form_peach.CheckBoxClip.State:=cbUnchecked
else Form_peach.CheckBoxClip.State:=cbChecked;
if movetorelativepath=0 then Form_peach.CheckBoxrelative.State:=cbUnchecked
else Form_peach.CheckBoxrelative.State:=cbChecked;
if Form_peach.CheckBoxrelative.State=cbChecked then Form_peach.Labelsetwork.enabled:=true
else Form_peach.Labelsetwork.enabled:=false;
if Form_peach.CheckBoxrelative.enabled=false then Form_peach.Labelsetwork.enabled:=false;
case browserstyle of
   0: Form_peach.RadioGroupBrowser.ItemIndex:=0;
   1: Form_peach.RadioGroupBrowser.ItemIndex:=1;
   else Form_peach.RadioGroupBrowser.ItemIndex:=2;
   end;
if mailkeep=1 then Form_peach.CheckBoxMailKeep.State:=cbChecked
else Form_peach.CheckBoxMailKeep.State:=cbUnChecked;
if convertpw=1 then Form_peach.CheckBoxConvert0.State:=cbChecked
else Form_peach.CheckBoxConvert0.State:=cbUnChecked;
if convertverbose=1 then Form_peach.CheckBoxConvert1.State:=cbChecked
else Form_peach.CheckBoxConvert1.State:=cbUnChecked;
if autoopen=1 then
   begin
   Form_peach.CheckBoxAutoOpen.State:=cbChecked;
   Form_peach.pmopenout.Checked:=true;
   Form_peach.mtoggleop.Checked:=true;
   end
else
   begin
   Form_peach.CheckBoxAutoOpen.State:=cbUnChecked;
   Form_peach.pmopenout.Checked:=false;
   Form_peach.mtoggleop.Checked:=false;
   end;
if autotest=1 then
   Form_peach.CheckBoxAutoTest.State:=cbChecked
else
   Form_peach.CheckBoxAutoTest.State:=cbUnChecked;
if autoclosepeazip=1 then
   Form_peach.CheckBoxClosePeaZip.State:=cbChecked
else
   Form_peach.CheckBoxClosePeaZip.State:=cbUnChecked;
if skipenctest=1 then Form_peach.CheckBoxSkipenc.State:=cbChecked else Form_peach.CheckBoxSkipenc.State:=cbUnChecked;
if nameaspartent=1 then Form_peach.CheckBoxnameasparentfolder.State:=cbChecked else Form_peach.CheckBoxnameasparentfolder.State:=cbUnChecked;
if showguihints=1 then Form_peach.CheckBoxShowHints.State:=cbChecked else Form_peach.CheckBoxShowHints.State:=cbUnChecked;
if showguihints=1 then Form_peach.ShowHint:=true else Form_peach.ShowHint:=false;
Form_peach.RadioGrouppwrequest.ItemIndex:=extpw;
Form_peach.ComboBoxOverwrite.Itemindex:=extopt7z;
Form_peach.cbdeleteinputmode.ItemIndex:={$IFDEF MSWINDOWS}favdelete;{$ELSE}{$IFDEF DARWIN}favdelete;{$ELSE}favdelete-1;{$ENDIF}{$ENDIF}
Form_peach.cbdeleteinputmode1.ItemIndex:={$IFDEF MSWINDOWS}favdelete;{$ELSE}{$IFDEF DARWIN}favdelete;{$ELSE}favdelete-1;{$ENDIF}{$ENDIF}
if doptext=1 then
   begin
   Form_peach.CheckBoxDeleteInput.State:=cbChecked;
   Form_peach.cbdeleteinputmode.visible:=true;
   end
else
   begin
   Form_peach.CheckBoxDeleteInput.State:=cbUnChecked;
   Form_peach.cbdeleteinputmode.visible:=false;
   end;
if doptadd=1 then
   begin
   Form_peach.CheckBoxDeleteInput1.State:=cbChecked;
   Form_peach.cbdeleteinputmode1.visible:=true;
   end
else
   begin
   Form_peach.CheckBoxDeleteInput1.State:=cbUnChecked;
   Form_peach.cbdeleteinputmode1.visible:=false;
   end;
Form_peach.pmqen1.checked:=false;
Form_peach.pmqen2.checked:=false;
Form_peach.pmqen3.checked:=false;
Form_peach.pmqen4.checked:=false;
Form_peach.pmqen5.checked:=false;
case extopt7z of
   0: Form_peach.pmqen1.checked:=true;
   1: Form_peach.pmqen2.checked:=true;
   2: Form_peach.pmqen3.checked:=true;
   3: Form_peach.pmqen4.checked:=true;
   4: Form_peach.pmqen5.checked:=true;
   end;
Form_peach.RadioGroupAction.Itemindex:=extaction7z;
if extaction7z=1 then Form_peach.pmqenopath.Checked:=true else Form_peach.pmqenopath.Checked:=false;
Form_peach.RadioGroupActionArc.Itemindex:=extactionarc;
Form_peach.RadioGroupAction1.Itemindex:=extactionace;
Form_peach.ComboBoxWD.Itemindex:=work_dir;
Form_peach.Labelcwd.Caption:=custom_work_path;
Form_peach.ComboBoxOverwriteARC.Itemindex:=extoptarc;
if nativedrag=1 then Form_peach.CheckBoxDragDrop.State:=cbChecked else Form_peach.CheckBoxDragDrop.State:=cbUnChecked;
Form_peach.ComboBoxDrag.ItemIndex:=dragtargetprotect;
if nativedrag=0 then Form_peach.ComboBoxDrag.enabled:=false else Form_peach.ComboBoxDrag.enabled:=true;
if autosync=1 then Form_peach.CheckBoxEditArchives.State:=cbChecked else Form_peach.CheckBoxEditArchives.State:=cbUnChecked;
if sys7zlin=1 then Form_peach.cbsys7zlin.State:=cbChecked else Form_peach.cbsys7zlin.State:=cbUnChecked;
if ignorepathextand=1 then Form_peach.CheckBox4.State:=cbChecked else Form_peach.CheckBox4.State:=cbUnChecked;
if closeonsingleextract=1 then Form_peach.cbautoclosesingleextract.State:=cbChecked else Form_peach.cbautoclosesingleextract.State:=cbUnChecked;
Form_peach.cbExtEvForWhen.Itemindex:=whenspecialopen;
Form_peach.cbExtEvForHow.Itemindex:=howspecialopen;
if whenspecialopen=0 then Form_peach.cbExtEvForHow.enabled:=false else Form_peach.cbExtEvForHow.enabled:=true;
Form_peach.editExtEvForWhat.enabled:=Form_peach.cbExtEvForHow.enabled;
if ignorepathdisp=1 then Form_peach.CheckBoxIgnoreDisp.State:=cbChecked else Form_peach.CheckBoxIgnoreDisp.State:=cbUnChecked;
if ignorepathsel=1 then Form_peach.CheckBoxIgnoreSel.State:=cbChecked else Form_peach.CheckBoxIgnoreSel.State:=cbUnChecked;
if enableextand=1 then Form_peach.CheckBoxExtAnd.State:=cbChecked else Form_peach.CheckBoxExtAnd.State:=cbUnChecked;
if removeintdir=1 then
   begin
   Form_peach.CheckBoxFolder1.State:=cbChecked;
   Form_peach.CheckBoxIntDir.State:=cbChecked;
   Form_peach.pmqnointdir.Checked:=true;
   end
else
   begin
   Form_peach.CheckBoxFolder1.State:=cbUnChecked;
   Form_peach.CheckBoxIntDir.State:=cbUnChecked;
   Form_peach.pmqnointdir.Checked:=false;
   end;
if sni7z=1 then Form_peach.CheckBoxsni.State:=cbChecked else Form_peach.CheckBoxsni.State:=cbUnChecked;
if sns7z=1 then Form_peach.CheckBoxsns.State:=cbChecked else Form_peach.CheckBoxsns.State:=cbUnChecked;
if snh7z=1 then Form_peach.CheckBoxsnh.State:=cbChecked else Form_peach.CheckBoxsnh.State:=cbUnChecked;
if snl7z=1 then Form_peach.CheckBoxsnl.State:=cbChecked else Form_peach.CheckBoxsnl.State:=cbUnChecked;
if sni7z=1 then Form_peach.CheckBoxsni1.State:=cbChecked else Form_peach.CheckBoxsni1.State:=cbUnChecked;
if sns7z=1 then Form_peach.CheckBoxsns1.State:=cbChecked else Form_peach.CheckBoxsns1.State:=cbUnChecked;
if stl7z=1 then Form_peach.CheckBoxstl.State:=cbChecked else Form_peach.CheckBoxstl.State:=cbUnChecked;
if ssp7z=1 then Form_peach.CheckBoxssp.State:=cbChecked else Form_peach.CheckBoxssp.State:=cbUnChecked;
if snz7z=1 then Form_peach.CheckBoxsnz1.State:=cbChecked else Form_peach.CheckBoxsnz1.State:=cbUnChecked;
if storecreated=1 then Form_peach.cbtimecreated.State:=cbChecked else Form_peach.cbtimecreated.State:=cbUnChecked;
if maxbrotli=1 then Form_peach.CheckBoxBrotli.State:=cbChecked else Form_peach.CheckBoxBrotli.State:=cbUnChecked;
if maxzstd=1 then Form_peach.CheckBoxZstd.State:=cbChecked else Form_peach.CheckBoxZstd.State:=cbUnChecked;
if zpaqall=1 then Form_peach.CheckBoxzpaqall.State:=cbChecked else Form_peach.CheckBoxzpaqall.State:=cbUnChecked; Form_peach.CheckBoxzpaqallClick(nil);
if zpaqfull=1 then Form_peach.CheckBoxzpaqfull.State:=cbChecked else Form_peach.CheckBoxzpaqfull.State:=cbUnChecked; Form_peach.CheckBoxzpaqfullClick(nil);
if zpaqabsolute=1 then Form_peach.CheckBoxzpaqabsolute.State:=cbChecked else Form_peach.CheckBoxzpaqabsolute.State:=cbUnChecked; Form_peach.CheckBoxzpaqabsoluteClick(nil);
if zpaqforce=1 then Form_peach.CheckBoxzpaqforce.State:=cbChecked else Form_peach.CheckBoxzpaqforce.State:=cbUnChecked;
Form_peach.ComboBoxBrowser.ItemIndex:=prebrowse;
Form_peach.ComboBoxMaxArg.ItemIndex:=maxargsize;
Form_peach.ComboBoxPriority.ItemIndex:=taskpriority;
if nonverboselog=1 then Form_peach.CheckBoxBrowseNotVerbose.State:=cbChecked else Form_peach.CheckBoxBrowseNotVerbose.State:=cbUnChecked;
if skipdel=1 then Form_peach.CheckBoxSkipDel.State:=cbChecked else Form_peach.CheckBoxSkipDel.State:=cbUnChecked;
if use7zunrar5=1 then Form_peach.CheckBox7zunrar5.State:=cbChecked else Form_peach.CheckBox7zunrar5.State:=cbUnChecked;
if useextrac32=1 then Form_peach.CheckBoxExtrac32.State:=cbChecked else Form_peach.CheckBoxExtrac32.State:=cbUnChecked;
if enumd=1 then Form_peach.CheckBoxEnumd.State:=cbChecked else Form_peach.CheckBoxEnumd.State:=cbUnChecked;
if userar=1 then Form_peach.cbRAR.State:=cbChecked else Form_peach.cbRAR.State:=cbUnChecked;
if userar5=1 then Form_peach.cbRAR5.State:=cbChecked else Form_peach.cbRAR5.State:=cbUnChecked;
Form_peach.comboRARdict.Itemindex:=userardict;
if userarblake2=1 then Form_peach.cbRARBLAKE2.State:=cbChecked else Form_peach.cbRARBLAKE2.State:=cbUnChecked;
if setrarmanual=1 then Form_peach.cbRARmanual.State:=cbChecked else Form_peach.cbRARmanual.State:=cbUnChecked;
if userarsfx=1 then Form_peach.cbRARsfx.State:=cbChecked else Form_peach.cbRARsfx.State:=cbUnChecked;
if userarsolid=1 then Form_peach.cbRARsolid.State:=cbChecked else Form_peach.cbRARsolid.State:=cbUnChecked;
if userarrr=1 then Form_peach.cbRARrr.State:=cbChecked else Form_peach.cbRARrr.State:=cbUnChecked;
Form_peach.seRARrr.Value:=puserarrr;
if userarsaveopen=1 then Form_peach.cbRARsaveopen.State:=cbChecked else Form_peach.cbRARsaveopen.State:=cbUnChecked;
if userarsavesecurity=1 then Form_peach.cbRARsavesecurity.State:=cbChecked else Form_peach.cbRARsavesecurity.State:=cbUnChecked;
if userarsavestreams=1 then Form_peach.cbRARsavestreams.State:=cbChecked else Form_peach.cbRARsavestreams.State:=cbUnChecked;
Form_peach.cbRARlastmodtime.ItemIndex:=userarlastmodtime;
if userarlock=1 then Form_peach.cbRARlock.State:=cbChecked else Form_peach.cbRARlock.State:=cbUnChecked;
if addencext=1 then Form_peach.cbencext.State:=cbChecked else Form_peach.cbencext.State:=cbUnChecked;
if addtstext=1 then Form_peach.CheckBoxDate.State:=cbChecked else Form_peach.CheckBoxDate.State:=cbUnChecked;
if repcustext=1 then Form_peach.cbcustext.State:=cbChecked else Form_peach.cbcustext.State:=cbUnChecked;
if savehistory=1 then Form_peach.CheckBoxArchiveHistory.State:=cbChecked else Form_peach.CheckBoxArchiveHistory.State:=cbUnChecked;
if jobdefenc=1 then Form_peach.CheckBoxJobEncoding.State:=cbChecked else Form_peach.CheckBoxJobEncoding.State:=cbUnChecked;
if showvolatile=1 then Form_peach.CheckBoxShowvolatile.State:=cbChecked else Form_peach.CheckBoxShowvolatile.State:=cbUnChecked;
if autoopentar=1 then Form_peach.CheckBoxAutoOpenTar.State:=cbChecked else Form_peach.CheckBoxAutoOpenTar.State:=cbUnChecked;
if qdup=1 then Form_peach.cbqdup.State:=cbChecked else Form_peach.cbqdup.State:=cbUnChecked;
if tar_atomic=1 then Form_peach.CheckBoxAutoExtTar.State:=cbChecked else Form_peach.CheckBoxAutoExtTar.State:=cbUnChecked;
if tar_atomic_convert=1 then Form_peach.CheckBoxAutoExtTar1.State:=cbChecked else Form_peach.CheckBoxAutoExtTar1.State:=cbUnChecked;
if noconfdel=1 then Form_peach.CheckBoxNoConf.State:=cbChecked else Form_peach.CheckBoxNoConf.State:=cbUnChecked;
if swzipx=1 then Form_peach.CheckBoxzipxswitch.State:=cbChecked else Form_peach.CheckBoxzipxswitch.State:=cbUnChecked;
if convint=1 then Form_peach.CheckBoxAC.State:=cbChecked else Form_peach.CheckBoxAC.State:=cbUnChecked;
if tryopenwerrors=1 then Form_peach.CheckBoxForceOpen.State:=cbChecked else Form_peach.CheckBoxForceOpen.State:=cbUnChecked;
if forcecanbechanged=1 then Form_peach.CheckBoxForceEdit.State:=cbChecked else Form_peach.CheckBoxForceEdit.State:=cbUnChecked;
Form_peach.cbforcetype.ItemIndex:=forcetype;
if excludeef=1 then Form_peach.CheckBoxExcludeEF.State:=cbChecked else Form_peach.CheckBoxExcludeEF.State:=cbUnChecked;
if immediate_execution=1 then Form_peach.mprofileimmediate.Checked:=true else Form_peach.mprofileimmediate.Checked:=false;
if forcelayout=1 then Form_peach.CheckBoxForceLayout.State:=cbChecked else Form_peach.CheckBoxForceLayout.State:=cbUnChecked;
if forcebrowse=1 then Form_peach.CheckBoxForceBrowse.State:=cbChecked else Form_peach.CheckBoxForceBrowse.State:=cbUnChecked;
if forceconvert=1 then Form_peach.CheckBoxForceConvert.State:=cbChecked else Form_peach.CheckBoxForceConvert.State:=cbUnChecked;
if archivenameenc=1 then Form_peach.CheckBoxEncoding.State:=cbChecked else Form_peach.CheckBoxEncoding.State:=cbUnChecked;
Form_peach.cbEncoding1.ItemIndex:=mcuzip;
if Form_peach.cbEncoding1.ItemIndex=3 then Form_peach.EditEncoding.Visible:=true else Form_peach.EditEncoding.Visible:=false;
Form_peach.ComboBoxSyntaxLevel.ItemIndex:=syntaxlevel7z;
Form_peach.cbtree.ItemIndex:=ptsync;
Form_peach.cbdefaultaction.ItemIndex:=defaultactionst;
if mappeddrivesinfo=1 then Form_peach.CheckBoxnetworkinfo.State:=cbChecked else Form_peach.CheckBoxnetworkinfo.State:=cbUnChecked;
if ws=1 then Form_peach.CheckBoxWindowStatus.State:=cbChecked else Form_peach.CheckBoxWindowStatus.State:=cbUnChecked;
if savehistory=1 then
   begin
   sethistory;
   end
else
   begin
   Form_peach.mRecent1.Caption:='';
   Form_peach.mRecent2.Caption:='';
   Form_peach.mRecent3.Caption:='';
   Form_peach.mRecent4.Caption:='';
   Form_peach.mRecent5.Caption:='';
   Form_peach.mRecent6.Caption:='';
   Form_peach.mRecent7.Caption:='';
   Form_peach.mRecent8.Caption:='';
   Form_peach.mRecent1f.Caption:='';
   Form_peach.mRecent2f.Caption:='';
   Form_peach.mRecent3f.Caption:='';
   Form_peach.mRecent4f.Caption:='';
   Form_peach.mRecent5f.Caption:='';
   Form_peach.mRecent6f.Caption:='';
   Form_peach.mRecent7f.Caption:='';
   Form_peach.mRecent8f.Caption:='';
   sethistory;
   end;
if Form_peach.pcustom1.Caption<>'' then Form_peach.pcustom1.Visible:=true else Form_peach.pcustom1.Visible:=false;
if Form_peach.pcustom2.Caption<>'' then Form_peach.pcustom2.Visible:=true else Form_peach.pcustom2.Visible:=false;
if Form_peach.pcustom3.Caption<>'' then Form_peach.pcustom3.Visible:=true else Form_peach.pcustom3.Visible:=false;
if Form_peach.pcustom4.Caption<>'' then Form_peach.pcustom4.Visible:=true else Form_peach.pcustom4.Visible:=false;
if Form_peach.pcustom5.Caption<>'' then Form_peach.pcustom5.Visible:=true else Form_peach.pcustom5.Visible:=false;
if Form_peach.pcustom6.Caption<>'' then Form_peach.pcustom6.Visible:=true else Form_peach.pcustom6.Visible:=false;
if Form_peach.pcustom7.Caption<>'' then Form_peach.pcustom7.Visible:=true else Form_peach.pcustom7.Visible:=false;
if Form_peach.pcustom8.Caption<>'' then Form_peach.pcustom8.Visible:=true else Form_peach.pcustom8.Visible:=false;
Form_peach.ComboBoxArchiveCustom.Itemindex:=customsyntax;
Form_peach.ComboBoxArchiveCustom1.Itemindex:=customsyntax1;
Form_peach.RadioGroup1.ItemIndex:=algodisp;
Form_peach.RadioGroup2.ItemIndex:=browserch-1;
Form_peach.RadioGroup3.ItemIndex:=algoall;
if esna=1 then Form_peach.checkbox1.State:=cbChecked else Form_peach.checkbox1.State:=cbUnChecked;
if euns=1 then
   begin
   Form_peach.checkbox2.State:=cbChecked;
   Form_peach.checkbox3.Enabled:=true;
   if euns1=1 then
      begin
      Form_peach.checkbox3.State:=cbChecked;
      Form_peach.CompressionCustom1.Enabled:=false;
      end
   else
       begin
       Form_peach.checkbox3.State:=cbUnChecked;
       Form_peach.CompressionCustom1.Enabled:=true;
       end;
   end
else
   begin
   Form_peach.checkbox2.State:=cbUnChecked;
   Form_peach.checkbox3.Enabled:=false;
   Form_peach.CompressionCustom1.Enabled:=false;
   if euns1=1 then
      begin
      Form_peach.checkbox3.State:=cbChecked;
      end
   else
       begin
       Form_peach.checkbox3.State:=cbUnChecked;
       end;
   end;
Form_peach.ComboBoxPasses.Itemindex:=erasepasses;
Form_peach.ComboBoxKiB.Itemindex:=filesizebase;
if tonewfolder=1 then
   begin
   Form_peach.CheckBoxFolder.State:=cbChecked;
   Form_peach.pmqenewfolder.checked:=true;
   Form_peach.mtogglenew.checked:=true;
   end
else
   begin
   Form_peach.CheckBoxFolder.State:=cbUnChecked;
   Form_peach.pmqenewfolder.checked:=false;
   Form_peach.mtogglenew.checked:=false;
   end;
if zcopy=1 then Form_peach.CheckBoxzcopy.State:=cbChecked else Form_peach.CheckBoxzcopy.State:=cbUnChecked;
if parallelarchive=1 then Form_peach.CheckBoxParallelarchiving.State:=cbChecked else Form_peach.CheckBoxParallelarchiving.State:=cbUnChecked;
if defaultextractpath<>'' then
   begin
   Form_peach.mdefaultextract.caption:=txt_caption_extract+' > '+txt_2_8_usedefaultoutpath+' '+defaultextractpath;
   Form_peach.mdefaultextract.checked:=true;
   end
else
   begin
   Form_peach.mdefaultextract.caption:=txt_caption_extract+' > '+txt_7_6_setdef;
   Form_peach.mdefaultextract.checked:=false;
   end;
Form_peach.pmusedefault.caption:=Form_peach.mdefaultextract.caption;
Form_peach.pmusedefault.checked:=Form_peach.mdefaultextract.checked;
Form_peach.lsetdefaultout_ext.caption:=Form_peach.mdefaultextract.caption;
if defaultarchivepath<>'' then
   begin
   Form_peach.mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
   Form_peach.mdefaultarchive.checked:=true;
   end
else
   begin
   Form_peach.mdefaultarchive.caption:=txt_archive+' > '+txt_7_6_setdef;
   Form_peach.mdefaultarchive.checked:=false;
   end;
Form_peach.lsetdefaultout_arc.caption:=Form_peach.mdefaultarchive.caption;
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 (upcase(theme_name)<>upcase(DEFAULT_THEME)) and (upcase(theme_name)<>upcase('nographic-embedded')) then
   begin
   assignfile(conf,(thpath+theme_path));
   filemode:=0;
   reset(conf);
   read_header(conf);
   readln(conf,theme_name);
   readln(conf,theme_author);
   readln(conf,theme_license);
   readconf_default_colors;
   CloseFile(conf);
   end;
if (upcase(theme_name)=upcase(DEFAULT_THEME)) then
   begin
   theme_name:='main-embedded';
   theme_author:='Giorgio Tani';
   theme_license:='LGPLv3';
   graphicsfolderd:='themes'+DirectorySeparator+'main-embedded'+DirectorySeparator;
   dodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=ColorToString(PAPPCOL);
   color2d:=ColorToString(clWindow);
   color3d:=ColorToString(PTACOL);
   color4d:=ColorToString(clAppWorkspace);
   color5d:=ColorToString(clWindowText);
   usealtcolord:=0;
   highlighttabsd:=0;
   accenttoolbard:=0;
   toolcenteredd:=0;
   altaddressstyled:=1;
   solidaddressstyled:=0;
   alttabstyled:=2;
   pzoomingd:=100;
   ensmalld:=0;
   pspacingd:=4;
   temperatured:=0;
   contrastd:=4;
   end;
if (upcase(theme_name)=upcase('nographic-embedded')) then
   begin
   theme_name:='nographic-embedded';
   theme_author:='Giorgio Tani';
   theme_license:='LGPLv3';
   graphicsfolderd:='themes'+DirectorySeparator+'nographic-embedded'+DirectorySeparator;
   dodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=ColorToString(PAPPCOL);
   usealtcolord:=0;
   highlighttabsd:=0;
   accenttoolbard:=0;
   toolcenteredd:=0;
   altaddressstyled:=1;
   solidaddressstyled:=0;
   alttabstyled:=2;
   pzoomingd:=100;
   ensmalld:=0;
   pspacingd:=4;
   temperatured:=0;
   contrastd:=4;
   end;
if upcase(theme_name)='MAIN-EMBEDDED' then Form_peach.ComboBoxTheme.ItemIndex:=0
else
   if upcase(theme_name)='DIFFERENT' then Form_peach.ComboBoxTheme.ItemIndex:=1
   else
      if upcase(theme_name)='DROID' then Form_peach.ComboBoxTheme.ItemIndex:=2
      else
         if upcase(theme_name)='MAIN' then Form_peach.ComboBoxTheme.ItemIndex:=3
         else
            if upcase(theme_name)='TEN' then Form_peach.ComboBoxTheme.ItemIndex:=4
            else
               if upcase(theme_name)='TUXEDO' then Form_peach.ComboBoxTheme.ItemIndex:=5
               else
                  Form_peach.ComboBoxTheme.ItemIndex:=6;
end;

procedure load_default_theme;
begin
theme_name:='main-embedded';
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:=Form_peach.StringGridBookmarks.RowCount;
if rc>1 then
   for i:=1 to rc-1 do
      begin
      if Form_peach.StringGridBookmarks.Cells[1,i]=txt_list_browsing then writeln(book,'0')
      else
         if Form_peach.StringGridBookmarks.Cells[1,i]=txt_list_flat then writeln(book,'1')
         else
            if Form_peach.StringGridBookmarks.Cells[1,i]=txt_list_found then writeln(book,'2')
            else writeln(book,'0');
      writeln(book,Form_peach.StringGridBookmarks.Cells[2,i]);
      writeln(book,Form_peach.StringGridBookmarks.Cells[4,i]);
      writeln(book,Form_peach.StringGridBookmarks.Cells[5,i]);
      writeln(book,Form_peach.StringGridBookmarks.Cells[6,i]);
      if savehistory=1 then
         begin
         writeln(book,Form_peach.StringGridBookmarks.Cells[7,i]);
         writeln(book,Form_peach.StringGridBookmarks.Cells[8,i]);
         writeln(book,Form_peach.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 form_peach 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,StringGridCustedit1.Cells[1,1]);
writeln(cedit,StringGridCustedit1.Cells[1,2]);
writeln(cedit,StringGridCustedit1.Cells[1,3]);
writeln(cedit,StringGridCustedit1.Cells[1,4]);
writeln(cedit,StringGridCustedit1.Cells[1,5]);
writeln(cedit,StringGridCustedit1.Cells[1,6]);
writeln(cedit,StringGridCustedit1.Cells[1,7]);
writeln(cedit,StringGridCustedit1.Cells[1,8]);
writeln(cedit,StringGridCustedit1.Cells[2,1]);
writeln(cedit,StringGridCustedit1.Cells[2,2]);
writeln(cedit,StringGridCustedit1.Cells[2,3]);
writeln(cedit,StringGridCustedit1.Cells[2,4]);
writeln(cedit,StringGridCustedit1.Cells[2,5]);
writeln(cedit,StringGridCustedit1.Cells[2,6]);
writeln(cedit,StringGridCustedit1.Cells[2,7]);
writeln(cedit,StringGridCustedit1.Cells[2,8]);
writeln(cedit,StringGridCustedit1.Cells[3,1]);
writeln(cedit,StringGridCustedit1.Cells[3,2]);
writeln(cedit,StringGridCustedit1.Cells[3,3]);
writeln(cedit,StringGridCustedit1.Cells[3,4]);
writeln(cedit,StringGridCustedit1.Cells[3,5]);
writeln(cedit,StringGridCustedit1.Cells[3,6]);
writeln(cedit,StringGridCustedit1.Cells[3,7]);
writeln(cedit,StringGridCustedit1.Cells[3,8]);
writeln(cedit,StringGridCustedit1.Cells[4,1]);
writeln(cedit,StringGridCustedit1.Cells[4,2]);
writeln(cedit,StringGridCustedit1.Cells[4,3]);
writeln(cedit,StringGridCustedit1.Cells[4,4]);
writeln(cedit,StringGridCustedit1.Cells[4,5]);
writeln(cedit,StringGridCustedit1.Cells[4,6]);
writeln(cedit,StringGridCustedit1.Cells[4,7]);
writeln(cedit,StringGridCustedit1.Cells[4,8]);
end;
CloseFile(cedit);
except
   try
   CloseFile(cedit);
   except
   end;
end;
end;

procedure set_win_antivirus;
var
  avgver,istr:integer;
  comodopath,mbampath,esetdir:ansistring;
  astr,bstr,cstr,dstr:array [1..8] of ansistring;
begin
{$IFDEF MSWINDOWS}
istr:=0;
//Security essentials (legacy)
if fileexists(winpfolder32+'Microsoft Security Client\msseces.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Microsoft Security Essentials';
   bstr[istr]:=wincomspec+' /k ""'+winpfolder32+'Microsoft Security Client\Antimalware\MpCmdRun.exe" -Scan -ScanType 3 -File ';
   cstr[istr]:='"';
   dstr[istr]:=winpfolder32+'Microsoft Security Client\msseces.exe';
   end;
if fileexists(winpfolder+'Microsoft Security Client\msseces.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Microsoft Security Essentials';
   bstr[istr]:=wincomspec+' /k ""'+winpfolder+'Microsoft Security Client\Antimalware\MpCmdRun.exe" -Scan -ScanType 3 -File ';
   cstr[istr]:='"';
   dstr[istr]:=winpfolder+'Microsoft Security Client\msseces.exe';
   end;
//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;

if fileexists(winpfolder32+'AVAST Software\avast\ashCmd.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Avast';
   bstr[istr]:='"'+winpfolder32+'AVAST Software\avast\ashCmd.exe" ';
   cstr[istr]:='';
   dstr[istr]:=winpfolder32+'AVAST Software\avast\avastui.exe';
   end;
if fileexists(winpfolder+'AVAST Software\avast\ashCmd.exe') then
   begin
   istr:=istr+1;
   astr[istr]:='Avast';
   bstr[istr]:='"'+winpfolder+'AVAST Software\avast\ashCmd.exe" ';
   cstr[istr]:='';
   dstr[istr]:=winpfolder+'AVAST Software\avast\avastui.exe';
   end;

for avgver:=99 downto 10 do
   begin
   if fileexists(winpfolder32+'AVG\AVG20'+inttostr(avgver)+'\avgscanx.exe') then
      begin
      istr:=istr+1;//stop at first match
      astr[istr]:='AVG Anti-Virus Free';
      bstr[istr]:=wincomspec+' /k ""'+winpfolder32+'AVG\AVG20'+inttostr(avgver)+'\avgscanx.exe" /SCAN=';
      cstr[istr]:='"';
      dstr[istr]:=winpfolder32+'AVG\AVG20'+inttostr(avgver)+'\avgui.exe';
      break;
      end;
   if fileexists(winpfolder+'AVG\AVG20'+inttostr(avgver)+'\avgscanx.exe') then
      begin
      istr:=istr+1;//stop at first match
      astr[istr]:='AVG Anti-Virus Free';
      bstr[istr]:=wincomspec+' /k ""'+winpfolder+'AVG\AVG20'+inttostr(avgver)+'\avgscanx.exe" /SCAN=';
      cstr[istr]:='"';
      dstr[istr]:=winpfolder+'AVG\AVG20'+inttostr(avgver)+'\avgui.exe';
      break;
      end;
   end;

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;

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;

comodopath:='';
if fileexists(winpfolder32+'Comodo\CCE\CCE.exe') then comodopath:=winpfolder32+'Comodo\CCE\CCE.exe';
if fileexists(winpfolder32+'CCE\CCE.exe') then comodopath:=winpfolder32+'CCE\CCE.exe';
if fileexists(winpfolder+'Comodo\CCE\CCE.exe') then comodopath:=winpfolder+'Comodo\CCE\CCE.exe';
if fileexists(winpfolder+'CCE\CCE.exe') then comodopath:=winpfolder+'CCE\CCE.exe';
if fileexists('C:\Comodo\CCE\CCE.exe') then comodopath:='C:\Comodo\CCE\CCE.exe';
if fileexists('C:\CCE\CCE.exe') then comodopath:='C:\CCE\CCE.exe';
if fileexists(local_desktop+'Comodo\CCE\CCE.exe') then comodopath:=local_desktop+'Comodo\CCE\CCE.exe';
if fileexists(local_desktop+'CCE\CCE.exe') then comodopath:=local_desktop+'CCE\CCE.exe';
if fileexists(home_path+'Comodo\CCE\CCE.exe') then comodopath:=home_path+'Comodo\CCE\CCE.exe';
if fileexists(home_path+'CCE\CCE.exe') then comodopath:=home_path+'CCE\CCE.exe';
if fileexists(usr_documents+'Comodo\CCE\CCE.exe') then comodopath:=usr_documents+'Comodo\CCE\CCE.exe';
if fileexists(usr_documents+'CCE\CCE.exe') then comodopath:=usr_documents+'CCE\CCE.exe';
if comodopath<>'' then
   begin
   istr:=istr+1;//adds only once
   astr[istr]:='Comodo Cleaning Essentials';
   bstr[istr]:='"'+comodopath+'" -s -p ';
   cstr[istr]:='';
   dstr[istr]:='"'+comodopath+'"';
   end;

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;

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;

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;

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

function checklinapp(s:utf8string):boolean;
begin
result:=false;
if (fileexists('/bin/'+s)) or
   (fileexists('/usr/bin/'+s)) then result:=true;
end;

function checkmacapp(s:utf8string):boolean;
begin
result:=false;
if (DirectoryExists('/Applications/'+s)) or
   (DirectoryExists('/System/Applications/'+s)) then result:=true;
end;

procedure reset_custedit;
var
   i,ioff,iacro,iooo:integer;
begin
with form_peach 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
   StringGridCustedit1.Cells[1,i]:='';
   StringGridCustedit1.Cells[2,i]:='';
   StringGridCustedit1.Cells[3,i]:='';
   StringGridCustedit1.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
StringGridCustedit.Cells[1,13]:='Internet Explorer';
custedit13:='iexplore.exe';
//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]:='Photos';
custedit5:='open -a Photo';
StringGridCustedit.Cells[1,6]:='Quick Time Player';
custedit6:='open -a "QuickTime Player"';
StringGridCustedit.Cells[1,7]:='Safari';
custedit7:='open -a Safari';
StringGridCustedit.Cells[1,8]:='Script Editor';
custedit8:='open -a "Script Editor"';
if checkmacapp('Gimp.app')=true then
   begin
   StringGridCustedit.Cells[1,9]:='Gimp';
   custedit9:='open -a Gimp';
   end
else
   if checkmacapp('Inkscape.app')=true then
      begin
      StringGridCustedit.Cells[1,9]:='Inkscape';
      custedit9:='open -a Inkscape';
      end
   else
      if checkmacapp('LibreOffice.app')=true then
         begin
         StringGridCustedit.Cells[1,9]:='Draw';
         custedit9:='open -a lodraw';
         end
      else
         if checkmacapp('OpenOffice.app')=true then
            begin
            StringGridCustedit.Cells[1,9]:='Draw';
            custedit9:='open -a oodraw';
            end;
if checkmacapp('VLC.app')=true then
   begin
   StringGridCustedit.Cells[1,10]:='VLC';
   custedit10:='open -a VLC';
   end;
if checkmacapp('Firefox')=true then
   begin
   StringGridCustedit.Cells[1,11]:='Mozilla Firefox';
   custedit11:='open -a Firefox';
   end;
if checkmacapp('Google Chrome.app')=true then
   begin
   StringGridCustedit.Cells[1,12]:='Google Chrome';
   custedit12:='open -a "Google Chrome"';
   end;

if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,13]:='Writer';
   custedit13:='open -a lowriter';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,13]:='Writer';
      custedit13:='open -a oowriter';
      end;
if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,14]:='Calc';
   custedit14:='open -a localc';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,14]:='Calc';
      custedit14:='open -a oocalc';
      end;
if checkmacapp('LibreOffice.app')=true then
   begin
   StringGridCustedit.Cells[1,15]:='Base';
   custedit15:='open -a lobase';
   end
else
   if checkmacapp('OpenOffice.app')=true then
      begin
      StringGridCustedit.Cells[1,15]:='Base';
      custedit15:='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;


{$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
   StringGridCustedit1.Cells[1,1]:='ClamAV';
   advedit1before:='clamscan --bell -i ';
   advedit1after:='';
   advedit1alt:='';
   end;
if checklinapp('maldet')=true then
   begin
   StringGridCustedit1.Cells[1,2]:='LMD';
   advedit2before:='maldet -a ';
   advedit2after:='';
   advedit2alt:='';
   end;
{$ENDIF}
{$ENDIF}
end;
set_custedit_totable;
set_custedit_menus;
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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if Form_peach.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);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=Form_peach.StringGridList.Rowcount;
s:=Form_peach.Caption;
inidir:=Form_peach.EditOpenIn.Caption;
if Form_peach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      begin
      if (Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder) then
         begin
         if mode='selected' then
            if Form_peach.StringGridList.Cells[16,i]='0' then
               begin
               Form_peach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         filemode:=0;
         try
         assignfile(f,Form_peach.StringGridList.Cells[12,i]);
         filemode:=0;
         reset(f);
         except
         Form_peach.StringGridList.Cells[11,i]:='';
         continue;
         end;
         if mode='selected' then Form_peach.Caption:=Form_Peach.ListView1.Column[10].Caption+' ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...'
         else Form_peach.Caption:=Form_Peach.ListView1.Column[10].Caption+' ('+inttostr(i)+'/'+inttostr(rc)+') '+Form_peach.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<>Form_peach.EditOpenIn.Caption) or (endflag=true) then
                  begin
                  exit_busy_status;
                  Form_peach.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: Form_peach.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: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@adler,sizeof(Adler)));
            2: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC16,sizeof(CRC16)));
            4: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
            5: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC64,sizeof(CRC64)));
            6: begin
               Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@ED2KRes.eDonkey, sizeof(ED2KRes.eDonkey)));
               if ED2KRes.differ then Form_peach.StringGridList.Cells[7,i]:=Form_peach.StringGridList.Cells[7,i]+' / eMule: '+upcase(hexstr(@ED2KRes.eMule, sizeof(ED2KRes.eMule)));
               end;
            7: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD4Digest,sizeof(MD4Digest)));
            8: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD5Digest,sizeof(MD5Digest)));
            9: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@RMD160Digest,sizeof(RMD160Digest)));
           10: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA1Digest,sizeof(SHA1Digest)));
           11: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2sDigest,sizeof(Blake2sDigest)));
           12: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           13: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_256Digest,sizeof(SHA3_256Digest)));
           14: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2bDigest,sizeof(Blake2bDigest)));
           15: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           16: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_512Digest,sizeof(SHA3_512Digest)));
           17: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@WhirlDigest,sizeof(WhirlDigest)));
            end;
         Form_Peach.ListView1.Items[i-1].SubItems[9]:=Form_Peach.StringGridList.Cells[11,i];
         end;
      end;
   exit_busy_status;
   Form_peach.Caption:=s;
   //update_listview;
   end;
end;

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

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

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

function checkduplicates2:integer;
var
   i:integer;
begin
result:=0;
for i:=1 to Form_peach.StringGridList.Rowcount-1 do
  if Form_peach.StringGridList.Cells[11,i]<>'' then result:=result+1;
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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if Form_peach.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);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=Form_peach.StringGridList.Rowcount;
s:=Form_peach.Caption;
inidir:=Form_peach.EditOpenIn.Caption;
if Form_peach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      if (Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder) and (Form_peach.StringGridList.Cells[3,i]<>'0') then
         begin
         if mode='selected' then
            if Form_peach.StringGridList.Cells[16,i]='0' then
               begin
               Form_peach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         if countsize(Form_peach.StringGridList.Cells[3,i])<2 then continue;
         filemode:=0;
         try
         assignfile(f,Form_peach.StringGridList.Cells[12,i]);
         filemode:=0;
         reset(f);
         except
         continue;
         end;
         if mode='selected' then Form_peach.Caption:=txt_4_1_duplicatesfind+', '+Form_Peach.ListView1.Column[10].Caption+' ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...'
         else Form_peach.Caption:=txt_4_1_duplicatesfind+', '+Form_Peach.ListView1.Column[10].Caption+' ('+inttostr(i)+'/'+inttostr(rc)+') '+Form_peach.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<>Form_peach.EditOpenIn.Caption) or (endflag=true) then
                  begin
                  exit_busy_status;
                  Form_peach.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: Form_peach.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: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@adler,sizeof(Adler)));
            2: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC16,sizeof(CRC16)));
            4: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
            5: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC64,sizeof(CRC64)));
            6: begin
               Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@ED2KRes.eDonkey, sizeof(ED2KRes.eDonkey)));
               if ED2KRes.differ then Form_peach.StringGridList.Cells[7,i]:=Form_peach.StringGridList.Cells[7,i]+' / eMule: '+upcase(hexstr(@ED2KRes.eMule, sizeof(ED2KRes.eMule)));
               end;
            7: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD4Digest,sizeof(MD4Digest)));
            8: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@MD5Digest,sizeof(MD5Digest)));
            9: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@RMD160Digest,sizeof(RMD160Digest)));
           10: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA1Digest,sizeof(SHA1Digest)));
           11: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2sDigest,sizeof(Blake2sDigest)));
           12: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_256Digest,sizeof(SHA3_256Digest)));
           13: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           14: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@Blake2bDigest,sizeof(Blake2bDigest)));
           15: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA3_512Digest,sizeof(SHA3_512Digest)));
           16: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           17: Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@WhirlDigest,sizeof(WhirlDigest)));
            end;
         Form_peach.StringGridList.Cells[11,i]:=Form_peach.StringGridList.Cells[3,i]+'/'+Form_peach.StringGridList.Cells[11,i];
         Form_Peach.ListView1.Items[i-1].SubItems[9]:=Form_Peach.StringGridList.Cells[11,i];
         end;
   Form_peach.Caption:=txt_4_1_duplicatesfind+', '+Form_Peach.ListView1.Column[10].Caption+' '+s+'...';
   dup:=checkduplicates;
   exit_busy_status;
   Form_peach.Caption:=s;
   //update_listview;
   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:qword;
   inidir,s,strsel:ansistring;
   CRC32:longint;
   f:file of byte;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if Form_peach.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);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=Form_peach.StringGridList.Rowcount;
s:=Form_peach.Caption;
inidir:=Form_peach.EditOpenIn.Caption;
if Form_peach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      if (Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder) and (Form_peach.StringGridList.Cells[3,i]<>'0') then
         begin
         if mode='selected' then
            if Form_peach.StringGridList.Cells[16,i]='0' then
               begin
               Form_peach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         if countsize2(Form_peach.StringGridList.Cells[3,i])<2 then continue;
         filemode:=0;
         try
         assignfile(f,Form_peach.StringGridList.Cells[12,i]);
         filemode:=0;
         reset(f);
         except
         continue;
         end;
         if mode='selected' then Form_peach.Caption:=txt_6_6_pdupfind+', ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...'
         else Form_peach.Caption:=txt_6_6_pdupfind+', ('+inttostr(i)+'/'+inttostr(rc)+') '+Form_peach.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<>Form_peach.EditOpenIn.Caption) or (endflag=true) then
                  begin
                  exit_busy_status;
                  Form_peach.Caption:=s;
                  exit;
                  end;
               end;
         if StrToInt64(Form_peach.StringGridList.Cells[3,i])>(64*1024) then
            begin
            seek(f,StrToInt64(Form_peach.StringGridList.Cells[3,i]) 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);
         Form_peach.StringGridList.Cells[11,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
         Form_peach.StringGridList.Cells[11,i]:=Form_peach.StringGridList.Cells[3,i]+'/'+Form_peach.StringGridList.Cells[11,i];
         Form_Peach.ListView1.Items[i-1].SubItems[9]:=Form_Peach.StringGridList.Cells[11,i];
         end;
   Form_peach.Caption:=txt_6_6_pdupfind+' '+s+'...';
   dup:=checkduplicates;
   exit_busy_status;
   Form_peach.Caption:=s;
   //update_listview;
   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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
{$IFDEF MSWINDOWS}if Form_peach.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);
   if mode='selected' then mode:='displayed';//selection is lost changing to list
   end;
rc:=Form_peach.StringGridList.Rowcount;
s:=Form_peach.Caption;
inidir:=Form_peach.EditOpenIn.Caption;
t:=1;
if Form_peach.visible=true then
   begin
   enter_busy_status;
   for i:=1 to rc-1 do
      if (Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder) then
         begin
         if mode='selected' then
            if Form_peach.StringGridList.Cells[16,i]='0' then
               begin
               Form_peach.StringGridList.Cells[11,i]:='';
               continue;
               end;
         if mode='selected' then Form_peach.Caption:=txt_7_0_af+', ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...'
         else Form_peach.Caption:=txt_7_0_af+', ('+inttostr(i)+'/'+inttostr(rc)+') '+Form_peach.StringGridList.Cells[1,i]+'...';
         nfiles:=0;
         ndirs:=0;
         ctsize:=0;
         rcountsize(Form_peach.StringGridList.Cells[12,i]+directoryseparator,'*',faAnyFile,true,nfiles,ndirs,ctsize);
         Form_peach.StringGridList.Cells[11,i]:=inttostr(ndirs-1)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(ctsize),filesizebase);
         Form_Peach.ListView1.Items[i-1].SubItems[9]:=Form_Peach.StringGridList.Cells[11,i];
         if ndirs-1+nfiles=0 then //mark empty folders
            begin
            Form_Peach.StringGridList.Cells[4,i]:='E';
            Form_peach.StringGridList.Cells[15,i]:='E';
            Form_Peach.ListView1.Items[i-1].SubItems[2]:=Form_Peach.StringGridList.Cells[4,i];
            end;
         t:=t+1;
         end;
   exit_busy_status;
   Form_peach.Caption:=s;
   end;
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,'');
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 directoryexists(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 directoryexists(usr_documents+'My Box Files') then
   begin
   writeln(book,'0');
   writeln(book,usr_documents+'My Box Files\');
   writeln(book,'*');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   writeln(book,'');
   end;
if directoryexists(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 directoryexists(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 directoryexists(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 directoryexists(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_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);
if eof(book)=false then
   repeat
   readln(book,s);
   if s=' ' then break;
   rc:=Form_peach.StringGridBookmarks.Rowcount+1;
   Form_peach.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;
   Form_peach.StringGridBookmarks.Cells[1,rc-1]:=s;
   readln(book,s);
   Form_peach.StringGridBookmarks.Cells[2,rc-1]:=s;
   Form_peach.StringGridBookmarks.Cells[3,rc-1]:=extractbookmarkname(s);
   readln(book,s);
   Form_peach.StringGridBookmarks.Cells[4,rc-1]:=s;
   readln(book,s);
   Form_peach.StringGridBookmarks.Cells[5,rc-1]:=s;
   readln(book,s);
   Form_peach.StringGridBookmarks.Cells[6,rc-1]:=s;
   if savehistory=1 then
      begin
      readln(book,s);
      if s='' then s:='0';
      Form_peach.StringGridBookmarks.Cells[7,rc-1]:=s;
      readln(book,s);
      Form_peach.StringGridBookmarks.Cells[8,rc-1]:=s;
      readln(book,s);
      if s='' then s:=FormatDateTime('yyyy-mm-dd hh:mm:ss',now);
      Form_peach.StringGridBookmarks.Cells[9,rc-1]:=s;
      Form_peach.StringGridBookmarks.Cells[10,rc-1]:=inttostr(length(Form_peach.StringGridBookmarks.Cells[7,rc-1]))+Form_peach.StringGridBookmarks.Cells[7,rc-1];
      end
   else
      begin
      readln(book,s);
      Form_peach.StringGridBookmarks.Cells[7,rc-1]:='';
      readln(book,s);
      Form_peach.StringGridBookmarks.Cells[8,rc-1]:='';
      readln(book,s);
      Form_peach.StringGridBookmarks.Cells[9,rc-1]:='';
      Form_peach.StringGridBookmarks.Cells[10,rc-1]:='';
      end;
   Form_peach.StringGridBookmarks.Cells[11,rc-1]:='0';
   until eof(book);
Form_peach.StringGridBookmarks.AutosizeColumns;
Form_peach.StringGridBookmarks.ColWidths[10]:=0;
Form_peach.StringGridBookmarks.ColWidths[11]:=0;
Form_peach.StringGridBookmarks.ColWidths[0]:=rowsize;
if Form_peach.StringGridBookmarks.Rowcount>1 then
   Form_peach.StringGridBookmarks.Cells[11,1]:='1';
CloseFile(book);
if Form_peach.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);
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 form_peach 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); StringGridCustedit1.Cells[1,1]:=s;
readln(cedit,s); StringGridCustedit1.Cells[1,2]:=s;
readln(cedit,s); StringGridCustedit1.Cells[1,3]:=s;
readln(cedit,s); StringGridCustedit1.Cells[1,4]:=s;
readln(cedit,s); StringGridCustedit1.Cells[1,5]:=s;
readln(cedit,s); StringGridCustedit1.Cells[1,6]:=s;
readln(cedit,s); StringGridCustedit1.Cells[1,7]:=s;
readln(cedit,s); StringGridCustedit1.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;
   pzooming:=pzoomingd;
   ensmall:=ensmalld;
   usealtcolor:=usealtcolord;
   highlighttabs:=highlighttabsd;
   accenttoolbar:=accenttoolbard;
   toolcentered:=toolcenteredd;
   altaddressstyle:=altaddressstyled;
   solidaddressstyle:=solidaddressstyled;
   alttabstyle:=alttabstyled;
   temperature:=temperatured;
   contrast:=contrastd;
   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;
pzooming:=pzoomingd;
ensmall:=ensmalld;
usealtcolor:=usealtcolord;
highlighttabs:=highlighttabsd;
accenttoolbar:=accenttoolbard;
toolcentered:=toolcenteredd;
altaddressstyle:=altaddressstyled;
solidaddressstyle:=solidaddressstyled;
alttabstyle:=alttabstyled;
temperature:=temperatured;
contrast:=contrastd;
//imgloaded:=false;
//apply_theme;
texts('volatile');
updateconf;
set_listview_col;
Form_peach.LabelConf.Caption:='';
indir:={$IFDEF MSWINDOWS}txt_mypc;{$ELSE}'/';{$ENDIF}
end;

procedure writeerror_file;
begin
try
assignfile(conf,GetTempDir+'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);
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(directoryexists(confpath)) then forcedirectories(confpath);
   confpath:=ExpandFileName(confpath);
   if confpath<>'' then
      if confpath[length(confpath)]<>directoryseparator then confpath:=confpath+directoryseparator;
   if not(directoryexists(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,GetTempDir+'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(GetTempDir+'peazip-reset.txt') then udeletefile(GetTempDir+'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 (twice) to write a default configuration and load it
      if conf_failure<>0 then
         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(GetTempDir+'peazip-reset.txt') then udeletefile(GetTempDir+'peazip-reset.txt');
   end;
//load theme
s:=extractfilepath(theme_path);
if s<>'' then setlength(s,length(s)-1);
theme_name:=extractfilename(s);
if theme_name<>'main-embedded' then
   try
   imgloaded:=false;
   load_theme;
   check_theme_failure;
   apply_theme;
   except
   theme_failure;
   apply_theme;
   end;
//check theming and configuration values, apply if correct
check_defaults_failure;
updateconf;
Form_peach.LabelConf.Caption:=confpath;
end;

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
   Form_peach.ComboBoxArchive8.Enabled:=true;
   Form_peach.ComboBoxArchive8.ItemIndex:=multi_option;
   end;
if s='off' then //disallow multithread selection since Compression algorithms used are not supported
   begin
   Form_peach.ComboBoxArchive8.Enabled:=false;
   //Form_peach.ComboBoxArchive8.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;
Form_peach.ComboBoxArchiveSolid.Enabled:=false;
Form_peach.ComboBoxArchiveSolid.ItemIndex:=0;
Form_peach.Subtitle7zaopt2.Visible:=false;
Form_peach.CheckBoxMQS.Enabled:=false;
if archive_type='7z' then
   begin
   Form_peach.CheckBoxMQS.Enabled:=true;
   Form_peach.ComboBoxArchiveSolid.Enabled:=true;
   Form_peach.ComboBoxArchive3.Clear;
   Form_peach.ComboBoxArchive3.DropDownCount:=15;
   Form_peach.ComboBoxArchive3.Items.Append('LZMA');
   Form_peach.ComboBoxArchive3.Items.Append('LZMA2');
   Form_peach.ComboBoxArchive3.Items.Append('PPMd');
   Form_peach.ComboBoxArchive3.Items.Append('BZip2');
   Form_peach.ComboBoxArchive3.Items.Append('Brotli');
   Form_peach.ComboBoxArchive3.Items.Append('FLZMA2');
   Form_peach.ComboBoxArchive3.Items.Append('Lizard_fastLZ4');
   Form_peach.ComboBoxArchive3.Items.Append('Lizard_LIZv1');
   Form_peach.ComboBoxArchive3.Items.Append('Lizard_fastLZ4+Huffman');
   Form_peach.ComboBoxArchive3.Items.Append('Lizard_LIZv1+Huffman');
   Form_peach.ComboBoxArchive3.Items.Append('LZ4');
   Form_peach.ComboBoxArchive3.Items.Append('LZ5');
   Form_peach.ComboBoxArchive3.Items.Append('Zstd');
   Form_peach.ComboBoxArchive3.Items.Append('Deflate');
   Form_peach.ComboBoxArchive3.Items.Append('Deflate64');
   Form_peach.ComboBoxArchive4.Clear;
   Form_peach.ComboBoxArchive4.DropDownCount:=6;
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_store);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_fastest);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_fast);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_normal);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_maximum);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_ultra);
   Form_peach.Label7za18.Visible:=true;
   Form_peach.Subtitle7zaopt2.Visible:=true;
   Form_peach.Combobox7zalgo.Visible:=true;
   Form_peach.Combobox7zalgo.Clear;
   Form_peach.Combobox7zalgo.DropDownCount:=1;
   Form_peach.Combobox7zalgo.Items.Append('AES256');
   Form_peach.Combobox7zalgo.ItemIndex:=0;
   if compression_level=txt_level_store then
      begin
      set_multi('off');
      Form_peach.ComboBoxArchive4.ItemIndex:=0;
      compression_method:='';
      Form_peach.ComboBoxArchive3.Clear;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=false;
      Form_peach.ComboBoxArchive5.Enabled:=false;
      Form_peach.ComboBoxArchive6.Enabled:=false;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      Form_peach.ComboBoxArchiveSolid.Enabled:=false;
      end;
   if compression_method='LZMA' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=0;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=25;
      Form_peach.ComboBoxArchive5.Items.Append('256 KB');
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('6 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('12 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('24 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('48 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('96 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('192 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive5.Items.Append('384 MB');
      Form_peach.ComboBoxArchive5.Items.Append('512 MB');
      Form_peach.ComboBoxArchive5.Items.Append('768 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1024 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1536 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2048 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3072 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4096 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('273');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=6;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=10;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=10;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=12;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      end;
   if compression_method='LZMA2' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=1;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=25;
      Form_peach.ComboBoxArchive5.Items.Append('256 KB');
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('6 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('12 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('24 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('48 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('96 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('192 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive5.Items.Append('384 MB');
      Form_peach.ComboBoxArchive5.Items.Append('512 MB');
      Form_peach.ComboBoxArchive5.Items.Append('768 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1024 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1536 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2048 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3072 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4096 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('273');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=11;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=10;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=14;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=12;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=15;
         end;
      end;
   if compression_method='PPMd' then
      begin
      set_multi('off');
      Form_peach.ComboBoxArchive3.ItemIndex:=2;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=21;
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('6 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('12 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('24 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('48 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('96 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('192 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive5.Items.Append('384 MB');
      Form_peach.ComboBoxArchive5.Items.Append('512 MB');
      Form_peach.ComboBoxArchive5.Items.Append('768 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1024 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1536 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=15;
      Form_peach.ComboBoxArchive6.Items.Append('2');
      Form_peach.ComboBoxArchive6.Items.Append('3');
      Form_peach.ComboBoxArchive6.Items.Append('4');
      Form_peach.ComboBoxArchive6.Items.Append('5');
      Form_peach.ComboBoxArchive6.Items.Append('6');
      Form_peach.ComboBoxArchive6.Items.Append('7');
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('10');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('14');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('20');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('28');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=2;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=3;
         Form_peach.ComboBoxArchive6.ItemIndex:=2;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=10;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=7;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=11;
         Form_peach.ComboBoxArchive6.ItemIndex:=10;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=15;
         Form_peach.ComboBoxArchive6.ItemIndex:=14;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      end;
   if compression_method='BZip2' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=3;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=9;
      Form_peach.ComboBoxArchive5.Items.Append('100 KB');
      Form_peach.ComboBoxArchive5.Items.Append('200 KB');
      Form_peach.ComboBoxArchive5.Items.Append('300 KB');
      Form_peach.ComboBoxArchive5.Items.Append('400 KB');
      Form_peach.ComboBoxArchive5.Items.Append('500 KB');
      Form_peach.ComboBoxArchive5.Items.Append('600 KB');
      Form_peach.ComboBoxArchive5.Items.Append('700 KB');
      Form_peach.ComboBoxArchive5.Items.Append('800 KB');
      Form_peach.ComboBoxArchive5.Items.Append('900 KB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchivePasses.DropDownCount:=10;
      Form_peach.ComboBoxArchivePasses.Items.Append('1');
      Form_peach.ComboBoxArchivePasses.Items.Append('2');
      Form_peach.ComboBoxArchivePasses.Items.Append('3');
      Form_peach.ComboBoxArchivePasses.Items.Append('4');
      Form_peach.ComboBoxArchivePasses.Items.Append('5');
      Form_peach.ComboBoxArchivePasses.Items.Append('6');
      Form_peach.ComboBoxArchivePasses.Items.Append('7');
      Form_peach.ComboBoxArchivePasses.Items.Append('8');
      Form_peach.ComboBoxArchivePasses.Items.Append('9');
      Form_peach.ComboBoxArchivePasses.Items.Append('10');
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=false;
      Form_peach.ComboBoxArchivePasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=6;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=1;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.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': Form_peach.ComboBoxArchive3.ItemIndex:=4;
         'Lizard_fastLZ4': Form_peach.ComboBoxArchive3.ItemIndex:=6;
         'Lizard_LIZv1': Form_peach.ComboBoxArchive3.ItemIndex:=7;
         'Lizard_fastLZ4+Huffman': Form_peach.ComboBoxArchive3.ItemIndex:=8;
         'Lizard_LIZv1+Huffman': Form_peach.ComboBoxArchive3.ItemIndex:=9;
         'LZ4': Form_peach.ComboBoxArchive3.ItemIndex:=10;
         'LZ5': Form_peach.ComboBoxArchive3.ItemIndex:=11;
         'Zstd': Form_peach.ComboBoxArchive3.ItemIndex:=12;
         end;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=0;
      Form_peach.ComboBoxArchive5.Enabled:=False;
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=0;
      Form_peach.ComboBoxArchive6.Enabled:=False;
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=0;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      end;
   if compression_method='FLZMA2' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=5;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=22;
      Form_peach.ComboBoxArchive5.Items.Append('64 KB');
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('6 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('12 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('24 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('48 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('96 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('192 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive5.Items.Append('384 MB');
      Form_peach.ComboBoxArchive5.Items.Append('512 MB');
      Form_peach.ComboBoxArchive5.Items.Append('768 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1024 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1536 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('273');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=1;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=8;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=12;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=10;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=12;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      end;
if compression_method='Deflate' then
   begin
   set_multi('on');
   Form_peach.ComboBoxArchive3.ItemIndex:=13;
   Form_peach.ComboBoxArchive5.Clear;
   Form_peach.ComboBoxArchive5.DropDownCount:=1;
   Form_peach.ComboBoxArchive5.Items.Append('32 KB');
   Form_peach.ComboBoxArchive6.Clear;
   Form_peach.ComboBoxArchive6.DropDownCount:=12;
   Form_peach.ComboBoxArchive6.Items.Append('8');
   Form_peach.ComboBoxArchive6.Items.Append('12');
   Form_peach.ComboBoxArchive6.Items.Append('16');
   Form_peach.ComboBoxArchive6.Items.Append('24');
   Form_peach.ComboBoxArchive6.Items.Append('32');
   Form_peach.ComboBoxArchive6.Items.Append('48');
   Form_peach.ComboBoxArchive6.Items.Append('64');
   Form_peach.ComboBoxArchive6.Items.Append('96');
   Form_peach.ComboBoxArchive6.Items.Append('128');
   Form_peach.ComboBoxArchive6.Items.Append('192');
   Form_peach.ComboBoxArchive6.Items.Append('256');
   Form_peach.ComboBoxArchive6.Items.Append('258');
   Form_peach.ComboBoxArchivePasses.Clear;
   Form_peach.ComboBoxArchivePasses.DropDownCount:=15;
   Form_peach.ComboBoxArchivePasses.Items.Append('1');
   Form_peach.ComboBoxArchivePasses.Items.Append('2');
   Form_peach.ComboBoxArchivePasses.Items.Append('3');
   Form_peach.ComboBoxArchivePasses.Items.Append('4');
   Form_peach.ComboBoxArchivePasses.Items.Append('5');
   Form_peach.ComboBoxArchivePasses.Items.Append('6');
   Form_peach.ComboBoxArchivePasses.Items.Append('7');
   Form_peach.ComboBoxArchivePasses.Items.Append('8');
   Form_peach.ComboBoxArchivePasses.Items.Append('9');
   Form_peach.ComboBoxArchivePasses.Items.Append('10');
   Form_peach.ComboBoxArchivePasses.Items.Append('11');
   Form_peach.ComboBoxArchivePasses.Items.Append('12');
   Form_peach.ComboBoxArchivePasses.Items.Append('13');
   Form_peach.ComboBoxArchivePasses.Items.Append('14');
   Form_peach.ComboBoxArchivePasses.Items.Append('15');
   Form_peach.ComboBoxArchive3.Enabled:=true;
   Form_peach.ComboBoxArchive5.Enabled:=true;
   Form_peach.ComboBoxArchive6.Enabled:=true;
   Form_peach.ComboBoxArchivePasses.Enabled:=true;
   if compression_level=txt_level_fastest then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=1;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=4;
      end;
   if compression_level=txt_level_fast then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=2;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=8;
      end;
   if compression_level=txt_level_normal then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=3;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=4;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=12;
      end;
   if compression_level=txt_level_maximum then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=4;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=6;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=2;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
      end;
   if compression_level=txt_level_ultra then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=5;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=8;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=9;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
      end;
   end;
if compression_method='Deflate64' then
   begin
   set_multi('on');
   Form_peach.ComboBoxArchive3.ItemIndex:=14;
   Form_peach.ComboBoxArchive5.Clear;
   Form_peach.ComboBoxArchive5.DropDownCount:=1;
   Form_peach.ComboBoxArchive5.Items.Append('64 KB');
   Form_peach.ComboBoxArchive6.Clear;
   Form_peach.ComboBoxArchive6.DropDownCount:=12;
   Form_peach.ComboBoxArchive6.Items.Append('8');
   Form_peach.ComboBoxArchive6.Items.Append('12');
   Form_peach.ComboBoxArchive6.Items.Append('16');
   Form_peach.ComboBoxArchive6.Items.Append('24');
   Form_peach.ComboBoxArchive6.Items.Append('32');
   Form_peach.ComboBoxArchive6.Items.Append('48');
   Form_peach.ComboBoxArchive6.Items.Append('64');
   Form_peach.ComboBoxArchive6.Items.Append('96');
   Form_peach.ComboBoxArchive6.Items.Append('128');
   Form_peach.ComboBoxArchive6.Items.Append('192');
   Form_peach.ComboBoxArchive6.Items.Append('256');
   Form_peach.ComboBoxArchive6.Items.Append('257');
   Form_peach.ComboBoxArchivePasses.Clear;
   Form_peach.ComboBoxArchivePasses.DropDownCount:=15;
   Form_peach.ComboBoxArchivePasses.Items.Append('1');
   Form_peach.ComboBoxArchivePasses.Items.Append('2');
   Form_peach.ComboBoxArchivePasses.Items.Append('3');
   Form_peach.ComboBoxArchivePasses.Items.Append('4');
   Form_peach.ComboBoxArchivePasses.Items.Append('5');
   Form_peach.ComboBoxArchivePasses.Items.Append('6');
   Form_peach.ComboBoxArchivePasses.Items.Append('7');
   Form_peach.ComboBoxArchivePasses.Items.Append('8');
   Form_peach.ComboBoxArchivePasses.Items.Append('9');
   Form_peach.ComboBoxArchivePasses.Items.Append('10');
   Form_peach.ComboBoxArchivePasses.Items.Append('11');
   Form_peach.ComboBoxArchivePasses.Items.Append('12');
   Form_peach.ComboBoxArchivePasses.Items.Append('13');
   Form_peach.ComboBoxArchivePasses.Items.Append('14');
   Form_peach.ComboBoxArchivePasses.Items.Append('15');
   Form_peach.ComboBoxArchive3.Enabled:=true;
   Form_peach.ComboBoxArchive5.Enabled:=true;
   Form_peach.ComboBoxArchive6.Enabled:=true;
   Form_peach.ComboBoxArchivePasses.Enabled:=true;
   if compression_level=txt_level_fastest then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=1;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=4;
      end;
   if compression_level=txt_level_fast then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=2;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=8;
      end;
   if compression_level=txt_level_normal then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=3;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=4;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=12;
      end;
   if compression_level=txt_level_maximum then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=4;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=6;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=2;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
      end;
   if compression_level=txt_level_ultra then
      begin
      Form_peach.ComboBoxArchive4.ItemIndex:=5;
      Form_peach.ComboBoxArchive5.ItemIndex:=0;
      Form_peach.ComboBoxArchive6.ItemIndex:=8;
      Form_peach.ComboBoxArchivePasses.ItemIndex:=9;
      Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
      end;
   end;
if archive_type='xz' then
   begin
   Form_peach.ComboBoxArchiveSolid.Enabled:=true;
   Form_peach.ComboBoxArchive3.Clear;
   Form_peach.ComboBoxArchive3.DropDownCount:=1;
   Form_peach.ComboBoxArchive3.Items.Append('LZMA2');
   Form_peach.ComboBoxArchive3.ItemIndex:=0;
   Form_peach.ComboBoxArchive4.Clear;
   Form_peach.ComboBoxArchive4.DropDownCount:=5;
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_fastest);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_fast);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_normal);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_maximum);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_ultra);
   Form_peach.Label7za18.Visible:=true;
   Form_peach.Label7za18.Visible:=false;
   Form_peach.Combobox7zalgo.Visible:=false;
   if compression_method='LZMA2' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=1;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=25;
      Form_peach.ComboBoxArchive5.Items.Append('256 KB');
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('6 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('12 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('24 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('48 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('96 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('192 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive5.Items.Append('384 MB');
      Form_peach.ComboBoxArchive5.Items.Append('512 MB');
      Form_peach.ComboBoxArchive5.Items.Append('768 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1024 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1536 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2048 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3072 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4096 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('273');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=0;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=7;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=11;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=10;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=14;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=12;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=15;
         end;
      end;
   end;
if archive_type='wim' then
   begin
   set_multi('off');
   Form_peach.ComboBoxArchive3.Clear;
   Form_peach.ComboBoxArchive3.DropDownCount:=1;
   Form_peach.ComboBoxArchive3.Items.Append('');
   Form_peach.ComboBoxArchive4.Clear;
   Form_peach.ComboBoxArchive4.DropDownCount:=1;
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_store);
   Form_peach.ComboBoxArchive5.Clear;
   Form_peach.ComboBoxArchive5.DropDownCount:=1;
   Form_peach.ComboBoxArchive5.Items.Append('');
   Form_peach.ComboBoxArchive6.Clear;
   Form_peach.ComboBoxArchive6.DropDownCount:=1;
   Form_peach.ComboBoxArchive6.Items.Append('');
   Form_peach.ComboBoxArchivePasses.Clear;
   Form_peach.ComboBoxArchive3.ItemIndex:=0;
   Form_peach.ComboBoxArchive4.ItemIndex:=0;
   Form_peach.ComboBoxArchive5.ItemIndex:=0;
   Form_peach.ComboBoxArchive6.ItemIndex:=0;
   Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
   Form_peach.ComboBoxArchive3.Enabled:=false;
   Form_peach.ComboBoxArchive5.Enabled:=false;
   Form_peach.ComboBoxArchive6.Enabled:=false;
   Form_peach.Label7za18.Visible:=false;
   Form_peach.Combobox7zalgo.Visible:=false;
   Form_peach.ComboBoxArchivePasses.Enabled:=false;
   end;
if archive_type='tar' then
   begin
   set_multi('off');
   Form_peach.ComboBoxArchive3.Clear;
   Form_peach.ComboBoxArchive3.DropDownCount:=1;
   Form_peach.ComboBoxArchive3.Items.Append('');
   Form_peach.ComboBoxArchive4.Clear;
   Form_peach.ComboBoxArchive4.DropDownCount:=1;
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_store);
   Form_peach.ComboBoxArchive5.Clear;
   Form_peach.ComboBoxArchive5.DropDownCount:=1;
   Form_peach.ComboBoxArchive5.Items.Append('');
   Form_peach.ComboBoxArchive6.Clear;
   Form_peach.ComboBoxArchive6.DropDownCount:=1;
   Form_peach.ComboBoxArchive6.Items.Append('');
   Form_peach.ComboBoxArchivePasses.Clear;
   Form_peach.ComboBoxArchive3.ItemIndex:=0;
   Form_peach.ComboBoxArchive4.ItemIndex:=0;
   Form_peach.ComboBoxArchive5.ItemIndex:=0;
   Form_peach.ComboBoxArchive6.ItemIndex:=0;
   Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
   Form_peach.ComboBoxArchive3.Enabled:=false;
   Form_peach.ComboBoxArchive5.Enabled:=false;
   Form_peach.ComboBoxArchive6.Enabled:=false;
   Form_peach.Label7za18.Visible:=false;
   Form_peach.Combobox7zalgo.Visible:=false;
   Form_peach.ComboBoxArchivePasses.Enabled:=false;
   end;
if archive_type='zip' then
   begin
   Form_peach.ComboBoxArchive3.Clear;
   {$IFDEF MSWINDOWS}
   Form_peach.ComboBoxArchive3.DropDownCount:=6;
   {$ELSE}
   Form_peach.ComboBoxArchive3.DropDownCount:=7;
   {$ENDIF}
   Form_peach.ComboBoxArchive3.Items.Append('Deflate');
   Form_peach.ComboBoxArchive3.Items.Append('Deflate64');
   Form_peach.ComboBoxArchive3.Items.Append('BZip2');
   Form_peach.ComboBoxArchive3.Items.Append('LZMA');
   Form_peach.ComboBoxArchive3.Items.Append('PPMd');
   Form_peach.ComboBoxArchive3.Items.Append('XZ');
   {$IFNDEF MSWINDOWS}
   Form_peach.ComboBoxArchive3.Items.Append('Zstd');
   {$ENDIF}
   Form_peach.ComboBoxArchive4.Clear;
   Form_peach.ComboBoxArchive4.DropDownCount:=6;
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_store);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_fastest);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_fast);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_normal);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_maximum);
   Form_peach.ComboBoxArchive4.Items.Append(txt_level_ultra);
   Form_peach.Label7za18.Visible:=true;
   Form_peach.Subtitle7zaopt2.Visible:=true;
   Form_peach.Combobox7zalgo.Visible:=true;
   Form_peach.Combobox7zalgo.Clear;
   Form_peach.Combobox7zalgo.DropDownCount:=2;
   Form_peach.Combobox7zalgo.Items.Append('AES256');
   Form_peach.Combobox7zalgo.Items.Append(txt_zipcrypto_hint);
   Form_peach.Combobox7zalgo.ItemIndex:=algo_zipenc;
   if compression_level=txt_level_store then
      begin
      set_multi('off');
      Form_peach.ComboBoxArchive4.ItemIndex:=0;
      compression_method:='';
      Form_peach.ComboBoxArchive3.Clear;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=false;
      Form_peach.ComboBoxArchive5.Enabled:=false;
      Form_peach.ComboBoxArchive6.Enabled:=false;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      end;
   if compression_method='Deflate' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=0;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=1;
      Form_peach.ComboBoxArchive5.Items.Append('32 KB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('258');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchivePasses.DropDownCount:=15;
      Form_peach.ComboBoxArchivePasses.Items.Append('1');
      Form_peach.ComboBoxArchivePasses.Items.Append('2');
      Form_peach.ComboBoxArchivePasses.Items.Append('3');
      Form_peach.ComboBoxArchivePasses.Items.Append('4');
      Form_peach.ComboBoxArchivePasses.Items.Append('5');
      Form_peach.ComboBoxArchivePasses.Items.Append('6');
      Form_peach.ComboBoxArchivePasses.Items.Append('7');
      Form_peach.ComboBoxArchivePasses.Items.Append('8');
      Form_peach.ComboBoxArchivePasses.Items.Append('9');
      Form_peach.ComboBoxArchivePasses.Items.Append('10');
      Form_peach.ComboBoxArchivePasses.Items.Append('11');
      Form_peach.ComboBoxArchivePasses.Items.Append('12');
      Form_peach.ComboBoxArchivePasses.Items.Append('13');
      Form_peach.ComboBoxArchivePasses.Items.Append('14');
      Form_peach.ComboBoxArchivePasses.Items.Append('15');
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=2;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=8;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=9;
         end;
      end;
   if compression_method='Deflate64' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=1;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=1;
      Form_peach.ComboBoxArchive5.Items.Append('64 KB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('257');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchivePasses.DropDownCount:=15;
      Form_peach.ComboBoxArchivePasses.Items.Append('1');
      Form_peach.ComboBoxArchivePasses.Items.Append('2');
      Form_peach.ComboBoxArchivePasses.Items.Append('3');
      Form_peach.ComboBoxArchivePasses.Items.Append('4');
      Form_peach.ComboBoxArchivePasses.Items.Append('5');
      Form_peach.ComboBoxArchivePasses.Items.Append('6');
      Form_peach.ComboBoxArchivePasses.Items.Append('7');
      Form_peach.ComboBoxArchivePasses.Items.Append('8');
      Form_peach.ComboBoxArchivePasses.Items.Append('9');
      Form_peach.ComboBoxArchivePasses.Items.Append('10');
      Form_peach.ComboBoxArchivePasses.Items.Append('11');
      Form_peach.ComboBoxArchivePasses.Items.Append('12');
      Form_peach.ComboBoxArchivePasses.Items.Append('13');
      Form_peach.ComboBoxArchivePasses.Items.Append('14');
      Form_peach.ComboBoxArchivePasses.Items.Append('15');
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;//4;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=2;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=8;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=9;
         end;
      end;
   if compression_method='BZip2' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=2;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=9;
      Form_peach.ComboBoxArchive5.Items.Append('100 KB');
      Form_peach.ComboBoxArchive5.Items.Append('200 KB');
      Form_peach.ComboBoxArchive5.Items.Append('300 KB');
      Form_peach.ComboBoxArchive5.Items.Append('400 KB');
      Form_peach.ComboBoxArchive5.Items.Append('500 KB');
      Form_peach.ComboBoxArchive5.Items.Append('600 KB');
      Form_peach.ComboBoxArchive5.Items.Append('700 KB');
      Form_peach.ComboBoxArchive5.Items.Append('800 KB');
      Form_peach.ComboBoxArchive5.Items.Append('900 KB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchivePasses.DropDownCount:=10;
      Form_peach.ComboBoxArchivePasses.Items.Append('1');
      Form_peach.ComboBoxArchivePasses.Items.Append('2');
      Form_peach.ComboBoxArchivePasses.Items.Append('3');
      Form_peach.ComboBoxArchivePasses.Items.Append('4');
      Form_peach.ComboBoxArchivePasses.Items.Append('5');
      Form_peach.ComboBoxArchivePasses.Items.Append('6');
      Form_peach.ComboBoxArchivePasses.Items.Append('7');
      Form_peach.ComboBoxArchivePasses.Items.Append('8');
      Form_peach.ComboBoxArchivePasses.Items.Append('9');
      Form_peach.ComboBoxArchivePasses.Items.Append('10');
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=false;
      Form_peach.ComboBoxArchivePasses.Enabled:=true;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=0;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=1;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=0;
         Form_peach.ComboBoxArchivePasses.ItemIndex:=6;
         end;
      end;
   if compression_method='LZMA' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=3;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=25;
      Form_peach.ComboBoxArchive5.Items.Append('256 KB');
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('6 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('12 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('24 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('48 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('96 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('192 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive5.Items.Append('384 MB');
      Form_peach.ComboBoxArchive5.Items.Append('512 MB');
      Form_peach.ComboBoxArchive5.Items.Append('768 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1024 MB');
      Form_peach.ComboBoxArchive5.Items.Append('1536 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2048 MB');
      Form_peach.ComboBoxArchive5.Items.Append('3072 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4096 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=12;
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchive6.Items.Append('24');
      Form_peach.ComboBoxArchive6.Items.Append('32');
      Form_peach.ComboBoxArchive6.Items.Append('48');
      Form_peach.ComboBoxArchive6.Items.Append('64');
      Form_peach.ComboBoxArchive6.Items.Append('96');
      Form_peach.ComboBoxArchive6.Items.Append('128');
      Form_peach.ComboBoxArchive6.Items.Append('192');
      Form_peach.ComboBoxArchive6.Items.Append('256');
      Form_peach.ComboBoxArchive6.Items.Append('273');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=8;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=10;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=12;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         end;
      end;
   if compression_method='PPMd' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=4;
      Form_peach.ComboBoxArchive5.Clear;
      Form_peach.ComboBoxArchive5.DropDownCount:=9;
      Form_peach.ComboBoxArchive5.Items.Append('1 MB');
      Form_peach.ComboBoxArchive5.Items.Append('2 MB');
      Form_peach.ComboBoxArchive5.Items.Append('4 MB');
      Form_peach.ComboBoxArchive5.Items.Append('8 MB');
      Form_peach.ComboBoxArchive5.Items.Append('16 MB');
      Form_peach.ComboBoxArchive5.Items.Append('32 MB');
      Form_peach.ComboBoxArchive5.Items.Append('64 MB');
      Form_peach.ComboBoxArchive5.Items.Append('128 MB');
      Form_peach.ComboBoxArchive5.Items.Append('256 MB');
      Form_peach.ComboBoxArchive6.Clear;
      Form_peach.ComboBoxArchive6.DropDownCount:=15;
      Form_peach.ComboBoxArchive6.Items.Append('2');
      Form_peach.ComboBoxArchive6.Items.Append('3');
      Form_peach.ComboBoxArchive6.Items.Append('4');
      Form_peach.ComboBoxArchive6.Items.Append('5');
      Form_peach.ComboBoxArchive6.Items.Append('6');
      Form_peach.ComboBoxArchive6.Items.Append('7');
      Form_peach.ComboBoxArchive6.Items.Append('8');
      Form_peach.ComboBoxArchive6.Items.Append('9');
      Form_peach.ComboBoxArchive6.Items.Append('10');
      Form_peach.ComboBoxArchive6.Items.Append('11');
      Form_peach.ComboBoxArchive6.Items.Append('12');
      Form_peach.ComboBoxArchive6.Items.Append('13');
      Form_peach.ComboBoxArchive6.Items.Append('14');
      Form_peach.ComboBoxArchive6.Items.Append('15');
      Form_peach.ComboBoxArchive6.Items.Append('16');
      Form_peach.ComboBoxArchivePasses.Clear;
      Form_peach.ComboBoxArchive3.Enabled:=true;
      Form_peach.ComboBoxArchive5.Enabled:=true;
      Form_peach.ComboBoxArchive6.Enabled:=true;
      Form_peach.ComboBoxArchivePasses.Enabled:=false;
      if compression_level=txt_level_fastest then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=1;
         Form_peach.ComboBoxArchive5.ItemIndex:=0;
         Form_peach.ComboBoxArchive6.ItemIndex:=2;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=2;
         Form_peach.ComboBoxArchive6.ItemIndex:=4;
         end;
      if compression_level=txt_level_normal then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=3;
         Form_peach.ComboBoxArchive5.ItemIndex:=4;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         end;
      if compression_level=txt_level_maximum then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=6;
         Form_peach.ComboBoxArchive6.ItemIndex:=8;
         end;
      if compression_level=txt_level_ultra then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=5;
         Form_peach.ComboBoxArchive5.ItemIndex:=7;
         Form_peach.ComboBoxArchive6.ItemIndex:=10;
         end;
      end;

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

procedure change_imagesplit;
begin
   case Form_peach.ComboBoxArchive1.ItemIndex of
      0: Form_peach.ImageSplit.Picture.Bitmap:=nil;
      1: Form_peach.ImageSplit.Picture.Bitmap:=nil;
      2: Form_peach.ImageSplit.Picture.Bitmap:=Bfd_supported;
      3: Form_peach.ImageSplit.Picture.Bitmap:=Bmail;
      4: Form_peach.ImageSplit.Picture.Bitmap:=Bmail;
      5: Form_peach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      6: Form_peach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      7: Form_peach.ImageSplit.Picture.Bitmap:=Bhd_supported;
      8: Form_peach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      9: Form_peach.ImageSplit.Picture.Bitmap:=Bdvd_supported;
      10: Form_peach.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 (Form_peach.Edit5.Enabled=false) then //existing archive is being updated
   begin
   s:=Form_peach.editopenin.text;
   cutextension(s);
   exit;//does not change archive name if adding to existing archive
   end;
usefoldername:=false;
if (i=0) or (i>Form_peach.StringGrid1.RowCount-1) then i:=Form_peach.StringGrid1.Row;
if Form_peach.StringGrid1.RowCount>1 then
   begin
   //use specified name (if entered) or compose name from selected object's name
   if (Form_peach.CheckBoxNameAsParentFolder.Checked=true) and (Form_peach.CheckBoxSeparate.Checked=false) then
      if Form_peach.StringGrid1.RowCount>2 then
         begin
         usefoldername:=true;
         str:=extractfilepath(Form_peach.StringGrid1.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:=Form_peach.StringGrid1.Cells[8,i]
   else str:=Form_peach.StringGrid1.Cells[8,i];
   aname:=str;
   cutextension(aname); //aname has the extension cut
   if directoryexists(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 (Form_peach.RadioGroupPaq.ItemIndex=0) then s:=str; //full name if using LPAQ, to keep original file extension
   if (Form_peach.StringGrid1.Rowcount=2) and (Form_peach.StringGrid1.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 (Form_peach.StringGrid1.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(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row],1,1);
   if s=directoryseparator then s:='1';
   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=Form_Peach.Stringgrid1 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
   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=Form_Peach.Stringgrid2 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=Form_peach.StringGrid1 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 check_tarbefore(tdirs:integer);
var i:integer;
begin
if (Form_peach.CheckBoxSeparate.Enabled=true) then
   if (Form_peach.CheckBoxSeparate.State=cbChecked) then exit;//disable if creating separate archives
Form_peach.CheckBoxSameArc.State:=cbUnChecked;
on_checkboxsamearcclick;
Form_peach.CheckBoxSameArc.Enabled:=False;
Form_peach.CheckBoxSeparate.State:=cbUnChecked;
on_checkboxseparateclick;
Form_peach.CheckBoxSeparate.Enabled:=False;
Form_peach.CheckBoxConvert.State:=cbUnChecked;
Form_peach.CheckBoxConvert.Enabled:=False;
Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
if (tdirs=0) and (Form_peach.StringGrid1.RowCount<3) then
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked
else
   begin
   Form_peach.CheckBoxTarBefore.State:=cbChecked;
   Form_Peach.StringGridTB.RowCount:=Form_Peach.StringGrid1.RowCount;
   for i:=0 to Form_Peach.StringGrid1.RowCount-1 do
      Form_Peach.StringGridTB.Rows[i].Assign(Form_Peach.StringGrid1.Rows[i]);
   end;
end;

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

function pathistmp(s:ansistring):boolean;
begin
result:=false;
if (pos(STR_TMP,s)) or
   (pos(STR_PZWORKTMP,s)) or
   (pos(STR_STMP,s)) or
   (pos(STR_TMPEXT,s)) or
   (pos(STR_TMPDD,s)) or
   (pos(STR_PEAZIPTMP,s))<>0 then result:=true;
end;

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

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

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

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

procedure hide_panelhintadd;
begin
Form_peach.PanelHintAdd.Visible:=false;
Form_peach.StringGrid1.Hint:=txt_2_7_archivehint;
end;

procedure hide_panelhintextract;
begin
Form_peach.PanelHintExtract.Visible:=false;
Form_peach.StringGrid2.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=Form_peach.StringGrid1 then
   if sg.RowCount>1 then hide_panelhintadd
   else Form_peach.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 (Form_peach.cbType.Text=STR_GZIP) or
      (Form_peach.cbType.Text=STR_BZIP2) or
      (Form_peach.cbType.Text=STR_XZ) or
      (Form_peach.cbType.Text=STR_QUAD) or
      (Form_peach.cbType.Text=STR_BROTLI) or
      (Form_peach.cbType.Text=STR_ZSTD) or
      (Form_peach.cbType.Text=txt_split) or
      ((Form_peach.cbType.Text=STR_ZPAQ) and (Form_peach.RadioGroupPaq.ItemIndex=0)) then
      check_tarbefore(tdirs);
   end;
if Form_peach.StringGrid1.RowCount=1 then
   begin
   status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
   if updatingarchive_inarchive=false then
      begin
      Form_peach.LabelStatusAr2.Caption:=status1;
      Form_peach.LabelStatus4.Caption:='';
      end
   else
      begin
      Form_peach.LabelStatusAr2.Caption:=status1;
      Form_peach.LabelStatus4.Caption:=txt_2_7_updating;
      Form_peach.edit5.Caption:=form_peach.editopenin.caption;
      end;
   if (Form_peach.EditName3.Text='') or (Form_peach.Edit4.Text='') then setoutname(s,0);
   updatingcontent:=0;
   exit;
   end;
if upsort=true then
   begin
   Form_peach.StringGrid1.SortColRow(true,9);
   Form_peach.StringGrid1.Cells[11,1]:='1';
   Form_peach.StringGrid1.Row:=1;
   end;
sizefreeint:=tsize;
status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
if updatingarchive_inarchive=false then
   begin
   Form_peach.LabelStatusAr2.Caption:=status1;
   if tsize<>0 then Form_peach.LabelStatusAr2.Caption:=Form_peach.LabelStatusAr2.Caption+' | '+txt_4_7_pcomp+' '+inttostr((tsize*100 - tpcompsize) div tsize)+'%';
   Form_peach.LabelStatus4.Caption:='';
   end
else
   begin
   Form_peach.LabelStatusAr2.Caption:=status1;
   if tsize<>0 then Form_peach.LabelStatusAr2.Caption:=Form_peach.LabelStatusAr2.Caption+' | '+txt_4_7_pcomp+' '+inttostr((tsize*100 - tpcompsize) div tsize)+'%';
   Form_peach.LabelStatus4.Caption:=txt_2_7_updating;
   Form_peach.edit5.Caption:=form_peach.editopenin.caption;
   end;
if (Form_peach.EditName3.Text='') or (Form_peach.Edit4.Text='') then setoutname(s,0);
updatingcontent:=0;
end;

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

procedure setextzpaqext(iszpaq:integer);
begin
case iszpaq of
   0: //no extended option
   begin
   Form_peach.PanelExtZPAQ.visible:=false;
   Form_peach.Labeladvextzpaq.visible:=false;
   Form_peach.RadioGroupAction.enabled:=true;
   Form_peach.ComboBoxOverwrite.enabled:=true;
   Form_peach.Labeladvextzpaq1.visible:=false;
   Form_peach.CheckBoxzpaqforce.visible:=false;
   end;
   1: //zpaq extended options (all etended options)
   begin
   Form_peach.PanelExtZPAQ.visible:=true;
   Form_peach.Labeladvextzpaq.visible:=true;
   Form_peach.RadioGroupAction.enabled:=false;
   Form_peach.ComboBoxOverwrite.enabled:=false;
   Form_peach.Labeladvextzpaq1.visible:=true;
   Form_peach.CheckBoxzpaqforce.visible:=true;
   end;
   2: //all options
   begin
   Form_peach.PanelExtZPAQ.visible:=true;
   Form_peach.Labeladvextzpaq.visible:=true;
   Form_peach.RadioGroupAction.enabled:=true;
   Form_peach.ComboBoxOverwrite.enabled:=true;
   Form_peach.Labeladvextzpaq1.visible:=true;
   Form_peach.CheckBoxzpaqforce.visible:=true;
   end;
   3: //br zst extended options
   begin
   Form_peach.PanelExtZPAQ.visible:=false;
   Form_peach.Labeladvextzpaq.visible:=false;
   Form_peach.RadioGroupAction.enabled:=false;
   Form_peach.ComboBoxOverwrite.enabled:=false;
   Form_peach.Labeladvextzpaq1.visible:=true;
   Form_peach.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 Form_peach.StringGrid2.RowCount>1 then hide_panelhintextract
   else Form_peach.PanelHintExtract.Visible:=true;
if Form_peach.StringGrid2.RowCount=1 then
else
   begin
   rc:=Form_peach.StringGrid2.RowCount-1;
   tfiles:=0;
   tdirs:=0;
   tsize:=0;
   for i:=1 to rc do
      begin
      if Form_peach.StringGrid2.Cells[2,i] <> txt_list_isfolder then tfiles:=tfiles+1
      else tdirs:=tdirs+1;
      try
         tsize:=tsize+strtoqword(Form_peach.StringGrid2.Cells[12,i]);
      except
      end;
      Form_peach.StringGrid2.Cells[11,i]:='0';
      end;
   end;
get_statuss(Form_peach.EditOpenOut.Text);
if extselall=true then
   begin
   try srcfilesize_multipart(Form_peach.EditOpenIn.Text,tsize); except tsize:=0; end;
   Form_peach.labelstatusex2.Caption:='0 '+txt_dirs+' '+'1 '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
   end
else
   Form_peach.labelstatusex2.Caption:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
Form_peach.labelstatusEx.Visible:=false;
Form_peach.labelstatusEx.Caption:=txt_3_1_workingdir+' '+Form_peach.ComboBoxWD.Caption+' '+Form_peach.Labelcwd.Caption;
autosize_stringgrid2;
if Form_peach.StringGrid2.RowCount>1 then Form_peach.StringGrid2.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 Form_peach.StringGrid2.RowCount-1 do
         if (lowercase(Form_peach.StringGrid2.Cells[2,i]) = '.zpaq') then
            begin
            if Form_peach.StringGrid2.RowCount>2 then setextzpaqext(2) //all options
            else setextzpaqext(1);//zpaq extended options
            break;
            end;
      for i:=1 to Form_peach.StringGrid2.RowCount-1 do
         if ((lowercase(Form_peach.StringGrid2.Cells[2,i]) = '.br') or
            (lowercase(Form_peach.StringGrid2.Cells[2,i]) = '.zst')) then
            begin
            if Form_peach.StringGrid2.RowCount>2 then setextzpaqext(2) //all options
            else setextzpaqext(3);//br zst extended options only
            break;
            end;
      if Form_peach.StringGrid2.RowCount=1 then setextzpaqext(2); //all options
      end;
   end;
   end;
end;

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

procedure test_extfile(s:ansistring; var okfile:boolean);
begin
okfile:=false;
if testname(s, Form_peach.StringGrid2)=0 then //no duplicate entries
   if (testinput(s,false)=0) then //unsupported
      if Form_peach.Checkbox2.State=cbChecked then okfile:=true
      else
   else
      case testext(s) of
         503: if Form_peach.Checkbox1.State=cbChecked then okfile:=true;
         502: if Form_peach.Checkbox1.State=cbChecked then okfile:=true;
         501: if Form_peach.Checkbox1.State=cbChecked then okfile:=true; //non-archives
         500: if Form_peach.Checkbox1.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 Form_peach.Checkbox2.State=cbChecked then okfile:=true
      else
   else
      case testext(s) of
         503: if Form_peach.Checkbox1.State=cbChecked then okfile:=true;
         502: if Form_peach.Checkbox1.State=cbChecked then okfile:=true;
         501: if Form_peach.Checkbox1.State=cbChecked then okfile:=true; //non-archives
         500: if Form_peach.Checkbox1.State=cbChecked then okfile:=true; //Windows executables, installers
         else okfile:=true;
         end;
end;

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

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

procedure addfile_ext_fromname(s:ansistring);
var
   okfile:boolean;
begin
deselectingrid(Form_peach.StringGrid2);
test_extfile(s,okfile);
if okfile=true then
   begin
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
   addfilestr(Form_peach.StringGrid2,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
Form_peach.StringGrid2.Cursor:=crHourGlass;
deselectingrid(Form_peach.StringGrid2);
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(Form_peach.StringGrid2,exp_files[j]);
               end;
            end;
      updatecontent_ext;
      end
   else addfile_ext_fromname(s);
Form_peach.StringGrid2.Cursor:=crDefault;
end;

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

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

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

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

procedure setsearch_enabled;
begin
Form_peach.EditUn7zaFilter.ReadOnly:=false;
Form_peach.EditUn7zaFilter.Enabled:=true;
Form_peach.EditUn7zaFilter.Visible:=true;
Form_peach.EditUn7zaFilter1.ReadOnly:=false;
Form_peach.EditUn7zaFilter1.Visible:=true;
end;

procedure advfiltersupdate;
begin
with Form_peach 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
Form_peach.Imageopenadvf.visible:=vis;
Form_peach.Imageopenadvf1.visible:=vis;
Form_peach.Imageopenadvf2.visible:=vis;
end;

procedure loadlist(sg:TStringGrid; listfilename:AnsiString);
var
   in_param:TFoundlist;
   listfile:ansistring;
   i:integer;
begin
Form_peach.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 Form_peach.OpenDialogLayout.Execute then
      if Form_peach.OpenDialogLayout.FileName<>'' then listfile:=Form_peach.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=Form_peach.StringGrid1 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=Form_peach.StringGrid1 then updatecontent(Form_peach.StringGrid1,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 Form_peach.StringGrid1.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 Form_peach.StringGrid2.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=Form_peach.Stringgrid1 then
   if check_input<>0 then exit;
if sg=Form_peach.Stringgrid2 then
   if check_extraction_input<>0 then exit;
Form_Peach.SaveDialogPJ.DefaultExt:='.txt';
Form_peach.SaveDialogPJ.InitialDir:=confpath+'Layouts'+DirectorySeparator;
if Form_Peach.SaveDialogPJ.Execute then
   if Form_Peach.SaveDialogPJ.FileName<>'' then tname:=Form_Peach.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
Form_peach.StringGrid1.Row:=0;
Form_peach.StringGrid1.RowCount:=1;
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
end;

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

procedure clearlist_ext;
begin
Form_peach.StringGrid2.Row:=0;
Form_peach.StringGrid2.RowCount:=1;
Form_peach.labelstatus2.Caption:='';
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': Form_peach.ComboBoxArchive4.ItemIndex:=level_7z;
'xz': Form_peach.ComboBoxArchive4.ItemIndex:=level_xz;
'zip': Form_peach.ComboBoxArchive4.ItemIndex:=level_zip;
'bz2': Form_peach.ComboBoxArchive4.ItemIndex:=level_bzip2;
'gz': Form_peach.ComboBoxArchive4.ItemIndex:=level_gz;
end;
end;

procedure setpwicons;
begin
try
if (FormPW.EditUn7zaPW.Text='') and (FormPW.EditName3.Text='') then
   begin
   Form_peach.msetpw.Bitmap:=Blocker2;
   Form_peach.msetpw.Caption:=txt_2_7_setpw;
   Form_peach.ImagePassword2.Glyph:=blocker2;
   Form_peach.ImagePassword1.Glyph:=blocker2;
   Form_peach.ImagePassword.Glyph:=blocker2;
   Form_peach.ImagePassword.Hint:=txt_2_7_pwnotset;
   Form_peach.po_setpw.Bitmap:=Blocker2;
   Form_peach.po_setpw.Caption:=txt_2_7_setpw;
   Form_peach.menupw.Bitmap:=Blocker2;
   Form_peach.menupw.Caption:=txt_2_7_setpw;
   Form_peach.pmqesetpw.Bitmap:=Blocker2;
   Form_peach.pmqesetpw.Caption:=txt_2_7_setpw;
   Form_peach.menuitempw.Bitmap:=Blocker2;
   Form_peach.menuitempw.Caption:=txt_2_7_setpw;
   Form_peach.mpw2.Bitmap:=Blocker2;
   Form_peach.mpw2.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
      Form_peach.ImagePassword1.Caption:=txt_2_7_setpw;
      Form_peach.ImagePassword1.Hint:=txt_2_5_nopw;
      Form_peach.ImagePassword1.Visible:=false;
      end
   else
      begin
      Form_peach.ImagePassword1.Caption:=txt_2_7_setpw;
      Form_peach.ImagePassword1.Hint:=txt_encryption;
      Form_peach.ImagePassword1.Visible:=true;
      end;
   Form_peach.ImagePassword2.Caption:=txt_2_7_setpw;
   Form_peach.ImagePassword2.Hint:=txt_encryption;
   end
else
   begin
   Form_peach.msetpw.Bitmap:=Blocker;
   Form_peach.msetpw.Caption:=txt_2_7_setpw+' *';
   Form_peach.ImagePassword2.Glyph:=blocker;
   Form_peach.ImagePassword1.Glyph:=blocker;
   Form_peach.ImagePassword.Glyph:=blocker;
   Form_peach.ImagePassword.Hint:=txt_2_7_pwextset;
   Form_peach.po_setpw.Bitmap:=Blocker;
   Form_peach.po_setpw.Caption:=txt_2_7_setpw+' *';
   Form_peach.menupw.Bitmap:=Blocker;
   Form_peach.menupw.Caption:=txt_2_7_setpw+' *';
   Form_peach.pmqesetpw.Bitmap:=Blocker;
   Form_peach.pmqesetpw.Caption:=txt_2_7_setpw+' *';
   Form_peach.menuitempw.Bitmap:=Blocker;
   Form_peach.menuitempw.Caption:=txt_2_7_setpw+' *';
   Form_peach.mpw2.Bitmap:=Blocker;
   Form_peach.mpw2.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
      Form_peach.ImagePassword1.Caption:=txt_2_7_setpw;
      Form_peach.ImagePassword1.Hint:=txt_2_5_nopw;
      Form_peach.ImagePassword1.Visible:=false;
      end
   else
      begin
      Form_peach.ImagePassword1.Caption:=txt_2_7_setpw;
      Form_peach.ImagePassword1.Hint:=txt_encryption;
      Form_peach.ImagePassword1.Visible:=true;
      end;
   Form_peach.ImagePassword2.Caption:=txt_2_7_setpw;
   Form_peach.ImagePassword2.Hint:=txt_encryption;
   end;
except
end;
end;

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

procedure getarccaption(s:ansistring);
begin
case s of
STR_7Z:
begin
Form_peach.Caption:=txt_create+' .'+archive_type+' | '+compression_level+', '+compression_method+' | '+Form_peach.ComboboxArchive7.Text;
if (FormPW.EditUn7zaPW.Caption<>'') or (FormPW.EditName3.Caption<>'') then Form_peach.Caption:=Form_peach.Caption+' | '+Form_peach.ComboBox7zalgo.Text;
end;
STR_ZIP:
begin
Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+compression_method+' | '+Form_peach.ComboboxArchive7.Text;
if (FormPW.EditUn7zaPW.Caption<>'') or (FormPW.EditName3.Caption<>'') then Form_peach.Caption:=Form_peach.Caption+' | '+Form_peach.ComboBox7zalgo.Text;
end;
STR_ARC:
begin
Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboboxARC2.Text;
if (FormPW.EditUn7zaPW.Caption<>'') or (FormPW.EditName3.Caption<>'') then Form_peach.Caption:=Form_peach.Caption+' | '+Form_peach.ComboBoxARCalgo.Text;
end;
STR_PEA:
begin
Form_peach.Caption:=txt_create+' .pea';
if (FormPW.EditUn7zaPW.Caption<>'') or (FormPW.EditName3.Caption<>'') then Form_peach.Caption:=Form_peach.Caption+' | '+Form_peach.ComboBoxPEA2.Text;
end;
STR_BZIP2, STR_GZIP, STR_WIM, STR_XZ, STR_TAR: Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+' | '+Form_peach.ComboboxArchive7.Text;
STR_ZPAQ, STR_QUAD, STR_BROTLI, STR_ZSTD: Form_peach.Caption:=txt_create+' .'+archive_type;
STR_UPX: Form_peach.Caption:=txt_compress_executable;
else
begin
if (s=txt_custom) or (s=txt_custom+'/RAR') then Form_peach.Caption:=txt_custom;
if s=txt_split then Form_peach.Caption:=txt_split;
if s=txt_sfx+' '+STR_7Z then
   begin
   Form_peach.Caption:=txt_create+' '+txt_sfx+' ('+STR_7Z+') | '+Form_peach.ComboBoxArchive4.Text+', '+compression_method+' | '+Form_peach.ComboboxArchive7.Text;
   if (FormPW.EditUn7zaPW.Caption<>'') then Form_peach.Caption:=Form_peach.Caption+' | '+Form_peach.ComboBox7zalgo.Text;
   end;
if s=txt_sfx+' '+STR_ARC then
   begin
   Form_peach.Caption:=txt_create+' '+txt_sfx+' ('+STR_ARC+') | '+Form_peach.ComboboxARC2.Text;
   if (FormPW.EditUn7zaPW.Caption<>'') then Form_peach.Caption:=Form_peach.Caption+' | '+Form_peach.ComboBoxARCalgo.Text;
   end;
end;
end;
end;

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

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

procedure archive_type_select(s:ansistring);
var
   i:integer;
   s1,fnm:ansistring;
begin
Form_peach.ComboBoxArchive1.Enabled:=true;
Form_peach.Panel7za.Visible:=false;
Form_peach.PanelARC.Visible:=false;
Form_peach.PanelCustom.Visible:=false;
Form_peach.PanelPaq.Visible:=false;
Form_peach.PanelPea.Visible:=false;
Form_peach.PanelQuad.Visible:=false;
Form_peach.PanelBrotli.Visible:=false;
Form_peach.PanelZstd.Visible:=false;
Form_peach.PanelUPX.Visible:=false;
Form_peach.cbadvf1.Enabled:=false;
Form_peach.CheckBoxArchive6.State:=cbUnchecked;
subfun:='';
disable_twofactor:=false;
Form_peach.ComboBoxArchive1.ItemIndex:=defaultspanning;
Form_peach.SpinEditArchive1.Value:=spansize;
Form_peach.ComboBoxArchive2.ItemIndex:=spanunit;
ComboBoxArchive1_onchange;
Form_peach.CheckBoxSeparate.Enabled:=true;
Form_peach.CheckBoxSameArc.Enabled:=true;
Form_peach.CheckBoxDeleteInput1.Enabled:=true;
Form_peach.cbdeleteinputmode1.Enabled:=true;
Form_peach.ComboBoxArchiveAct.Enabled:=true;
if s=STR_7Z then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.ComboBoxArchive4.Text:=txt_level_normal;
   Form_peach.ComboBoxArchive4.Enabled:=true;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if s=STR_ARC then
   begin
   Form_peach.PanelARC.Visible:=true;
   Form_peach.cbadvf1.Enabled:=true;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   archive_type:='arc';
   fun:='ARC';
   Form_peach.ComboBoxARC.ItemIndex:=level_arc;
   Form_peach.ComboBoxARCsolid.ItemIndex:=solid_arc;
   if rr_arc=1 then Form_peach.CheckBoxARC1.State:=cbChecked
   else Form_peach.CheckBoxARC1.State:=cbUnchecked;
   if arcabspath=1 then Form_peach.CheckBoxARC3.State:=cbChecked
   else Form_peach.CheckBoxARC3.State:=cbUnchecked;
   Form_peach.ComboBoxARCalgo.ItemIndex:=algo_arc;
   typehint:=txt_type_description_arc;
   getarccaption(s);
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   Form_peach.CheckBoxARC2.State:=cbunChecked;
   Form_peach.ComboBoxARCsfx.visible:=false;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_BZIP2 then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.ComboBoxArchive4.Text:=txt_level_normal;
   Form_peach.ComboBoxArchive4.Enabled:=true;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if (s=txt_custom) or (s=txt_custom+'/RAR') then
   begin
   Form_peach.PanelCustom.Visible:=true;
   archive_type:=txt_custom;
   fun:='CUSTOM';
   typehint:=txt_type_description_custom;
   getarccaption(s);
   Form_peach.CheckBoxConvert.Enabled:=true;
   if userar=1 then
      begin
      Form_peach.CompressionCustom.Visible:=false;
      Form_peach.PanelRar.Visible:=true;
      Form_peach.EditExtCustom.Caption:='rar';
      Form_peach.EditOPcustom.Caption:='';
      Form_peach.ComboBoxArchive1.Enabled:=true;
      Form_peach.ComboBoxArchive9.Enabled:=true;
      Form_peach.ComboBoxArchive9.ItemIndex:=level_rar;
      Form_peach.CheckBoxArchive4.Enabled:=true;
      Form_peach.ComboBoxArchiveAct.Enabled:=true;
      Form_peach.CheckBoxSameArc.Enabled:=true;
      Form_peach.CheckBoxSeparate.Enabled:=true;
      Form_peach.cbRAR5Click(nil);
      end
   else
      begin
      Form_peach.CompressionCustom.Visible:=true;
      Form_peach.PanelRar.Visible:=false;
      setnonrarcust;
      change_imagesplit;
      Form_peach.ComboBoxArchive1.Enabled:=false;
      Form_peach.SpinEditArchive1.Visible:=false;
      Form_peach.ComboBoxArchive2.Visible:=false;
      Form_peach.ComboBoxArchive9.Enabled:=false;
      Form_peach.CheckBoxArchive4.Enabled:=false;
      Form_peach.ComboBoxArchiveAct.Enabled:=false;
      Form_peach.CheckBoxSameArc.Enabled:=false;
      Form_peach.CheckBoxSameArc.State:=cbUnchecked;
      Form_peach.CheckBoxSeparate.Enabled:=false;
      Form_peach.CheckBoxSeparate.State:=cbUnchecked;
      end
   end;
if s=STR_GZIP then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.ComboBoxArchive4.Text:=txt_level_normal;
   Form_peach.ComboBoxArchive4.Enabled:=true;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if s=STR_WIM then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.Enabled:=true;
   archive_type:='wim';
   fun:='7Z';
   typehint:=txt_3_8_type_description_wim;
   compression_method:='';
   compression_level:=txt_level_store;
   set_values(archive_type,compression_method,compression_level);
   getarccaption(s);
   Form_peach.ComboBoxArchive4.Text:=txt_level_store;
   Form_peach.ComboBoxArchive4.Enabled:=false;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if s=STR_XZ then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.ComboBoxArchive4.Text:=txt_level_normal;
   Form_peach.ComboBoxArchive4.Enabled:=true;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if s=STR_ZPAQ then
   begin
   Form_peach.PanelPaq.Visible:=true;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   fun:='PAQ';
   Form_peach.RadioGroupPaq.ItemIndex:=paqver;
   case Form_peach.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);
   Form_peach.ComboBoxPaq1.ItemIndex:=level_paq;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_PEA then
   begin
   Form_peach.PanelPea.Visible:=true;
   Form_peach.ComboBoxPeaCompression1.ItemIndex:=pcompr;
   Form_peach.ComboBoxPea2.ItemIndex:=pstream;
   Form_peach.ComboBoxPea3.ItemIndex:=pobj;
   Form_peach.ComboBoxPea4.ItemIndex:=pvol;
   Form_peach.PanelSplitFile.Visible:=false;
   archive_type:='';
   fun:='PEA';
   typehint:=txt_type_description_pea;
   getarccaption(s);
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_QUAD then
   begin
   Form_peach.PanelQuad.Visible:=true;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   fun:='QUAD';
   case Form_peach.RadioGroupQuad.ItemIndex of
      0: archive_type:='quad';
      1: archive_type:='balz';
      2: archive_type:='bcm';
   end;
   if Form_peach.RadioGroupQuad.ItemIndex=2 then
   begin
   Form_peach.CheckBoxQuadMax.enabled:=false;
   Form_peach.Labelbcmblock.visible:=true;
   Form_peach.ComboBoxArchiveSolid1.visible:=true;
   end
   else
   begin
   Form_peach.CheckBoxQuadMax.enabled:=true;
   Form_peach.Labelbcmblock.visible:=false;
   Form_peach.ComboBoxArchiveSolid1.visible:=false;
   end;
   getarccaption(s);
   typehint:=txt_type_description_quad;
   if level_quad=0 then Form_peach.CheckBoxQuadMax.State:=cbUnchecked else Form_peach.CheckBoxQuadMax.State:=cbChecked;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_BROTLI then
   begin
   Form_peach.PanelBrotli.Visible:=true;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   fun:='BROTLI';
   archive_type:='br';
   Form_peach.ComboBoxArchive9.ItemIndex:=level_brotli;
   getarccaption(s);
   typehint:=txt_7_1_type_description_brotli;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_ZSTD then
   begin
   Form_peach.PanelZstd.Visible:=true;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   fun:='ZSTD';
   archive_type:='zst';
   Form_peach.ComboBoxArchive9.ItemIndex:=level_zstd;
   getarccaption(s);
   typehint:=txt_7_1_type_description_zstd;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=txt_sfx+' '+STR_7Z then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.CheckBoxArchive6.State:=cbChecked;
   Form_peach.ComboBoxArchive4.Text:=txt_level_normal;
   Form_peach.ComboBoxArchive4.Enabled:=true;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if s=txt_sfx+' '+STR_ARC then
   begin
   Form_peach.PanelARC.Visible:=true;
   Form_peach.cbadvf1.Enabled:=true;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   archive_type:='arc';
   fun:='ARC';
   disable_twofactor:=true;
   Form_peach.ComboBoxARC.ItemIndex:=level_arc;
   Form_peach.ComboBoxARCsolid.ItemIndex:=solid_arc;
   if rr_arc=1 then Form_peach.CheckBoxARC1.State:=cbChecked
   else Form_peach.CheckBoxARC1.State:=cbUnchecked;
   if arcabspath=1 then Form_peach.CheckBoxARC3.State:=cbChecked
   else Form_peach.CheckBoxARC3.State:=cbUnchecked;
   Form_peach.ComboBoxARCalgo.ItemIndex:=algo_arc;
   typehint:=txt_type_description_arc;
   getarccaption(s);
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   Form_peach.CheckBoxARC2.State:=cbChecked;
   Form_peach.ComboBoxARCsfx.visible:=true;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=txt_split then
   begin
   Form_peach.PanelPea.Visible:=true;
   Form_peach.PanelSplitFile.Visible:=true;
   Form_peach.ComboBoxSplit3.ItemIndex:=salgo;
   archive_type:='';
   fun:='RFS';
   typehint:=txt_type_description_split;
   getarccaption(s);
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   //check_tarbefore(tdirs);
   Form_peach.CheckBoxSeparate.Checked:=true; on_checkboxseparateclick;
   Form_peach.ComboBoxArchive1.ItemIndex:=1;
   ComboBoxArchive1_onchange;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_TAR then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.ComboBoxArchive4.Text:=txt_level_store;
   Form_peach.ComboBoxArchive4.Enabled:=false;
   Form_peach.CheckBoxTarBefore.Enabled:=false;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if s=STR_UPX then
   begin
   Form_peach.PanelUPX.Visible:=true;
   Form_peach.CheckBoxDeleteInput1.Enabled:=false;
   Form_peach.cbdeleteinputmode1.Enabled:=false;
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   archive_type:='upx';
   fun:='UPX';
   typehint:=txt_type_description_upx;
   getarccaption(s);
   Form_peach.ComboBoxUPX.ItemIndex:=level_upx;
   Form_peach.CheckBoxTarBefore.Enabled:=false;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxSameArc.Enabled:=false;
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.Enabled:=false;
   Form_peach.CheckBoxSeparate.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=false;
   Form_peach.CheckBoxConvert.State:=cbUnchecked;
   Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_ZIP then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.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);
   Form_peach.ComboBoxArchive4.Text:=txt_level_normal;
   Form_peach.ComboBoxArchive4.Enabled:=true;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   if Form_peach.ComboBoxArchive1.ItemIndex > 0 then Form_peach.CheckBoxArchive4.Enabled:=false
   else Form_peach.CheckBoxArchive4.Enabled:=true;
   end;
if (Form_peach.CheckBoxArchive6.State=cbChecked) then Form_peach.RadioGroupArchive.Visible:=true
else Form_peach.RadioGroupArchive.Visible:=false;
if Form_peach.CheckBoxArchive4.Enabled=false then
   begin
   Form_peach.CheckBoxArchive4.Checked:=false;
   Form_peach.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 Form_peach.cbType.Items.Count-1 do
   if Form_peach.cbType.Items[i]=s then Form_peach.cbType.ItemIndex:=i;
archive_type_selected:=Form_peach.cbType.ItemIndex;
setcompressionlevel7zindex; //otherwise combobox itemindex don't gets updated
suggest_outname(fnm,Form_peach.cbType.Text,0);
fnm:=extractfilename(fnm);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(fnm);
setpwicons;
setquickcompset(fun);
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 set_lastobjarch;
var
   i:integer;
   lastobjfound:boolean;
begin
lastobjfound:=false;
i:=1;
if Form_peach.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 Form_peach.StringGridList.RowCount-1 do
      if Form_Peach.StringGridList.Cells[12,i]=lastobjarch then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then i:=1;
Form_peach.StringGridList.Cells[16,i]:='1';
Form_peach.StringGridList.Row:=i;
end;

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

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

procedure sort_za_stringgridlist(c:integer);
var
   s:ansistring;
   i,rc:integer;
begin
//if refreshstatus<>0 then exit;

if c=2 then //for column = type sort folder always on top
   begin
   rc:=Form_peach.StringGridList.Rowcount;
   if rc>1 then
      begin
      for i:=1 to rc-1 do
         begin
         if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then
            begin
            s:=prefixdza+Form_peach.StringGridList.Cells[c,i]+'  '+Form_peach.StringGridList.Cells[1,i];
            if length(s)>256 then setlength(s,256);
            Form_peach.StringGridList.Cells[17,i]:=s;
            end;
         end;
      Form_peach.StringGridList.SortColRow(true,17);
      end;
   end;

Form_peach.StringGridTmp.ColCount:=Form_peach.StringGridList.ColCount;
Form_peach.StringGridTmp.RowCount:=Form_peach.StringGridList.RowCount;
rc:=Form_peach.StringGridList.Rowcount;
if rc>1 then
   begin
   for i:=1 to rc-1 do Form_peach.StringGridTmp.Rows[i]:=Form_peach.StringGridList.Rows[rc-i];
   for i:=1 to rc-1 do Form_peach.StringGridList.Rows[i]:=Form_peach.StringGridTmp.Rows[i];
   Form_peach.StringGridList.Row:=rc-Form_peach.StringGridList.Row;
   end;
az:=false;
Form_peach.StringGridTmp.Clear;
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;

function smartsortstring(s:ansistring):ansistring;
var
   i,firstpos,nnumb:Integer;
   firstnumber:boolean;
   snumb,fnumb:string;
begin
firstnumber:=false;
firstpos:=0;
nnumb:=0;
snumb:='';
fnumb:='';
for i:=1 to length(s) do
   begin
   if s[i] in ['0'..'9'] then
      if firstnumber=false then
         begin
         firstnumber:=true;
         firstpos:=i;
         if s[i]<>'0' then
            begin
            nnumb:=1;
            snumb:='9';
            fnumb:=s[i];
            end;
         end
      else
         begin
         if s[i]<>'0' then nnumb:=1;
         if nnumb=1 then
            begin
            snumb:=snumb+'9';
            fnumb:=fnumb+s[i];
            end;
         end
   else
      if firstnumber=false then
         begin
         end
      else
         begin
         fnumb:=fnumb+' ';
         break;
         end;
   end;
if firstnumber=true then
   result:=copy(s,1,firstpos-1)+snumb+' '+fnumb+copy(s,firstpos,length(s)+1-firstpos)
else
   result:=s;
end;

function smartsortable(s:ansistring):ansistring;
var
   fname,fext:string;
begin
result:=s;
if result='' then exit;
if pos('.',result)<>0 then
   begin
   fname:=extractfilename(result);//copy(result,1,pos('.',result)-1);
   fext:=extractfileext(result);//copy(result,pos('.',result),length(result)+1-pos('.',result));
   end
else
   begin
   fname:=result;
   fext:='';
   end;
fname:=smartsortstring(fname);
if fext<>'' then fext:=smartsortstring(fext);
result:=fname+' '+fext;
end;

procedure scan_omitted_dirs(var nfolders:integer);
var
   i,j,rc,rc2,dc,dc2,sle,fsize:integer;
   searchsize,tsize,tcsize:qword;
   s,st:ansistring;
   found:boolean;
begin
Form_Peach.StringGridAddress1.RowCount:=1;
Form_Peach.StringGridAddress2.RowCount:=1;
Form_Peach.StringGridAddress1.BeginUpdate;
Form_Peach.StringGridAddress1.Clear;
Form_Peach.StringGridAddress2.BeginUpdate;
Form_Peach.StringGridAddress2.Clear;
Form_Peach.StringGridAddress1.RowCount:=nfolders+1+32*1024;
Form_Peach.StringGridAddress2.RowCount:=1+32*1024;
rc:=nfolders+1;
rc2:=1;

Form_Peach.StringGridAddress2.ColCount:=Form_Peach.StringGridAddress1.ColCount;
set_archivetree:=true;
i:=1;
for j:=0 to Form_Peach.StringGridList.RowCount-1 do
  if Form_peach.StringGridList.Cells[2,j]<>txt_list_isfolder then
  else
     begin
     Form_Peach.StringGridAddress1.Rows[i].Assign(Form_Peach.StringGridList.Rows[j]);
     i:=i+1;
     end;
//if pre-parsing optimization is enabled, limit omitted folders test for reasonable performances
case prebrowse of
   1: searchsize := 256*1024;
   2: searchsize := 256*1024;
   3: searchsize := 128*1024;
   4: searchsize := 64*1024;
   5: searchsize := 8*1024;
   end;
if (Form_peach.StringGridList.RowCount<searchsize) or (prebrowse=0) then
begin
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   begin
   s:=Form_peach.StringGridList.Cells[12,i];
   if dirExtractFilePath(Form_peach.StringGridList.Cells[12,i])=dirExtractFilePath(Form_peach.StringGridList.Cells[12,i-1]) then
   else
      repeat
      s:=dirExtractFilePath(s);
      if (s<>'') and (s<>'/') and (s<>'\') and (s<>DirectorySeparator) and (s<>DirectorySeparator+DirectorySeparator) then
         begin
         if (s[length(s)]='/') or (s[length(s)]='\') or (s[length(s)]=DirectorySeparator) then setlength(s, length(s)-1);
         found:=false;
         sle:=Length(s);
         for j:=1 to Form_peach.StringGridAddress1.RowCount-1 do
            if sle=length(Form_peach.StringGridAddress1.Cells[12,j]) then
            if s=Form_peach.StringGridAddress1.Cells[12,j] then
               begin
               found:=true;
               break;
               end;
         if found=true then break
         else
            begin
            h_folders:=true;
            if rc2>32*1024 then
               if rc2>=Form_peach.StringGridAddress2.RowCount then
               begin
               Form_peach.StringGridAddress1.RowCount:=rc+32*1024;
               Form_peach.StringGridAddress2.RowCount:=rc2+32*1024;
               end;
            Form_peach.StringGridAddress1.Cells[1,rc]:=dirextractfilename(s);
            Form_peach.StringGridAddress1.Cells[2,rc]:=txt_list_isfolder;
            Form_peach.StringGridAddress1.Cells[12,rc]:=s;
            Form_peach.StringGridAddress1.Cells[13,rc]:=prefixd+smartsortable(dirextractfilename(s));
            Form_peach.StringGridAddress1.Cells[3,rc]:='0';
            Form_peach.StringGridAddress1.Cells[14,rc]:='110';
            Form_peach.StringGridAddress1.Cells[4,rc]:='0';
            Form_peach.StringGridAddress1.Cells[15,rc]:='110';
            Form_peach.StringGridAddress1.Cells[10,rc]:='D';
            Form_peach.StringGridAddress1.Cells[16,rc]:='0';
            Form_peach.StringGridAddress2.Rows[rc2].Assign(Form_peach.StringGridAddress1.Rows[rc]);
            nfolders:=nfolders+1;
            rc:=rc+1;
            rc2:=rc2+1;
            end;
         end;
      until (s='') or (s='\') or (s='/') or (s=DirectorySeparator) or (s=DirectorySeparator+DirectorySeparator);
   if i and (16*1024)-1 = 0 then Application.ProcessMessages;
   end;
end;
prebrowse_dirs:=nfolders;
prebrowse_records:=j;

Form_Peach.StringGridAddress1.RowCount:=rc;
Form_Peach.StringGridAddress2.RowCount:=rc2;

case prebrowse of
   0: fsize := 32*1024;
   1,2,3,4: fsize := 16*1024;
   5: fsize := 8*1024;
   end;

if Form_peach.StringGridList.RowCount<fsize then
   displayfoldercontent:=1
else
   displayfoldercontent:=0;

if displayfoldercontent=1 then
begin
Form_Peach.StringGridAddress3.BeginUpdate;
Form_Peach.StringGridAddress3.Clear;
Form_Peach.StringGridAddress3.RowCount:=Form_Peach.StringGridAddress1.RowCount;
for i:=0 to Form_Peach.StringGridAddress1.RowCount-1 do
   Form_Peach.StringGridAddress3.Rows[i].Assign(Form_Peach.StringGridAddress1.Rows[i]);
for i:=1 to Form_peach.StringGridAddress3.RowCount-1 do
   begin
   dc:=0;
   dc2:=0;
   tsize:=0;
   tcsize:=0;
   rc:=Form_peach.StringGridList.RowCount-1;
   st:=Form_peach.StringGridAddress3.Cells[12,i]+directoryseparator;
   for j:=1 to rc do
      if pos(st,Form_peach.StringGridList.Cells[12,j])=1 then
         begin
         if Form_peach.StringGridList.Cells[2,j] =txt_list_isfolder then
            dc:=dc+1
         else
            dc2:=dc2+1;
         try tsize:=tsize+strtoqword(Form_peach.StringGridList.Cells[3,j]); except end;
         try tcsize:=tcsize+strtoqword(Form_peach.StringGridList.Cells[4,j]); except end;
         end;
   rc:=Form_peach.StringGridAddress2.RowCount-1;
   for j:=1 to rc do
      if pos(st,Form_peach.StringGridAddress2.Cells[12,j])=1 then
         dc:=dc+1;
   Form_peach.StringGridAddress3.Cells[3,i]:=inttostr(tsize);
   Form_peach.StringGridAddress3.Cells[4,i]:=inttostr(tcsize);
   Form_peach.StringGridAddress3.Cells[11,i]:=inttostr(dc)+' '+txt_dirs+' '+inttostr(dc2)+' '+txt_files;
   if length(Form_peach.StringGridAddress3.Cells[11,i])>1 then
      if Form_peach.StringGridAddress3.Cells[11,i][length(Form_peach.StringGridAddress3.Cells[11,i])]=',' then
         Form_peach.StringGridAddress3.Cells[11,i]:=copy(Form_peach.StringGridAddress3.Cells[11,i],1,length(Form_peach.StringGridAddress3.Cells[11,i])-1);
   end;
Form_Peach.StringGridAddress3.EndUpdate;
end;

Form_Peach.StringGridAddress1.EndUpdate;
Form_Peach.StringGridAddress2.EndUpdate;
end;

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

if (mode='browse') or (mode='flat') then
   if Form_peach.StringGridList.RowCount>1 then
      begin
      Form_peach.StringGridList.SortColRow(true,listsortcol);
      sort_az_stringgridlist_special(listsortcol);
      if az=false then sort_za_stringgridlist(listsortcol);
      end;

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

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

if mode='silent' then
   begin
   Form_peach.ShapeProgress.Width:=Form_peach.Width*65 div 100;
   pperc:=65;
   Form_peach.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 Form_peach.StringGridList.RowCount<2 then Form_peach.StringGridList.RowCount:=2;

if (mode='silent') then
   begin
   Form_peach.StringGridArchive.RowCount:=Form_peach.StringGridList.RowCount+Form_peach.StringGridAddress2.RowCount-1;
   for i:=1 to Form_peach.StringGridList.Rowcount-1 do Form_peach.StringGridArchive.Rows[i]:=Form_peach.StringGridList.Rows[i];
   for i:=1 to Form_peach.StringGridAddress2.Rowcount-1 do Form_peach.StringGridArchive.Rows[Form_peach.StringGridList.Rowcount+i-1]:=Form_peach.StringGridAddress2.Rows[i];
   end;

Form_peach.StringGridList.EndUpdate;
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_7z_titles:integer;
var
   i:integer;
   s1:ansistring;
begin
result:=0;
i:=0;
repeat
   s1:=Form_peach.MemoList.Lines[i];
   i:=i+1;
until (s1=ZSTRING) or (i>=Form_peach.MemoList.Lines.Count);
title_lines_7z:=i+1; //dynamically find title and comment lines
if i>=Form_peach.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(Form_peach.MemoList.Lines[i])>13 then s1:=copy(Form_peach.MemoList.Lines[i],1,14);
   i:=i+1;
until (s1=RAR5STRING) or (i>=Form_peach.MemoList.Lines.Count);
title_lines_7z:=i+1; //dynamically find title and comment lines
if i>=Form_peach.MemoList.Lines.Count then result:=-1 else result:=1;
end;

function find_7zl_titles:integer;
var
   i,zsline:integer;
   s1,s2,archtype:ansistring;
begin
result:=0;

i:=0;
repeat
   s1:=Form_peach.MemoList.Lines[i];
   i:=i+1;
until (s1=ZSTRINGS) or (i>=Form_peach.MemoList.Lines.Count);
zsline:=i;

i:=0;
repeat
   s1:=Form_peach.MemoList.Lines[i];
   i:=i+1;
until (s1=ZSTRINGL) or (i>=Form_peach.MemoList.Lines.Count);
title_lines_7z:=i; //dynamically find title and comment lines
if i>=Form_peach.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:=Form_peach.MemoList.Lines[i];
     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 list_slt(mode:ansistring);
var
   i,j,k,nfiles,nfolders,ll:integer;
   size,csize,rsize:qword;
   s1,s2,s3,s:ansistring;
   stopped_prebrowse:boolean;
begin
i:=title_lines_7z-2;
k:=Form_peach.MemoList.Lines.Count;
nomatch:=false;
if k<=i then begin Form_peach.StringGridList.RowCount:=2; nomatch:=true; exit; end;
j:=1;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
if mode='silent' then
   begin
   prebrowse_dirs:=-1;
   prebrowse_records:=-1;
   end;
rootdirrecord:=0;
stopped_prebrowse:=false;
Form_peach.StringGridList.RowCount:=1;
status0:=txt_list_searching;
status1:=txt_please_wait;
Form_peach.StringGridList.BeginUpdate;
if k<4*1024*1024 then ll:=(k div 8) else ll:=512*1024; //0.5 M files
Form_peach.StringGridList.RowCount:=ll;
repeat
   if j<ll then
   else
      if j>=Form_peach.StringGridList.RowCount then Form_peach.StringGridList.RowCount:=j+32*1024;
   repeat
      s1:=Form_peach.MemoList.Lines[i];
      {$IFNDEF MSWINDOWS}
      if lowercase(s1)='open error: can not open the file as [7z] archive' then
         begin
         Form_peach.StringGridList.RowCount:=2;
         Form_peach.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);
         Form_peach.StringGridList.Cells[1,j]:=dirExtractFileName(s3);
         Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);//overridden if "Folder" parameter is provided
         Form_peach.StringGridList.Cells[12,j]:=s3;
         end;
         'Folder':
         if copy(s1,length(s1),1)=ZCHAR then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[13,j]:=prefixd+smartsortable(dirExtractFileName(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[13,j]:=prefixf+smartsortable(dirExtractFileName(s3));
            end;
         'Size':
         begin
         Form_peach.StringGridList.Cells[3,j]:=copy(s1,8,length(s1)-7);
         Form_peach.StringGridList.Cells[14,j]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,j]))))+inttostr(length(Form_peach.StringGridList.Cells[3,j]))+Form_peach.StringGridList.Cells[3,j];
         try
            size:=size+strtoqword(Form_peach.StringGridList.Cells[3,j]);
         except
         end;
         end;
         'Packed Size':
         begin
         Form_peach.StringGridList.Cells[4,j]:=copy(s1,15,length(s1)-14);
         Form_peach.StringGridList.Cells[15,j]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,j]))))+inttostr(length(Form_peach.StringGridList.Cells[4,j]))+Form_peach.StringGridList.Cells[4,j];
         try
            csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,j]);
         except
         end;
         end;
         'Modified': Form_peach.StringGridList.Cells[5,j]:=copy(s1,12,length(s1)-11);
         'Created': Form_peach.StringGridList.Cells[6,j]:=copy(s1,11,length(s1)-10);
         'Accessed': Form_peach.StringGridList.Cells[7,j]:=copy(s1,12,length(s1)-11);
         'CRC': Form_peach.StringGridList.Cells[11,j]:=copy(s1,7,length(s1)-6);
         'SHA-1': if Form_peach.StringGridList.Cells[11,j]='' then Form_peach.StringGridList.Cells[11,j]:=copy(s1,12,length(s1)-11);
         'Checksum': if Form_peach.StringGridList.Cells[11,j]='' then Form_peach.StringGridList.Cells[11,j]:=copy(s1,12,length(s1)-11);
         'Attributes':
         begin
         Form_peach.StringGridList.Cells[10,j]:=copy(s1,14,length(s1)-13);
         if pos('D',Form_peach.StringGridList.Cells[10,j])<>0 then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[13,j]:=prefixd+smartsortable(dirExtractFileName(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[13,j]:=prefixf+smartsortable(dirExtractFileName(s3));
            end;
         end;
         'Encrypted':
         if copy(s1,length(s1),1)=ZCHAR then
            begin
            Form_peach.StringGridList.Cells[1,j]:=dirExtractFileName(s3)+' *';
            seemencrypted:=true;
            set_pw;
            end;
         'Method':
         begin
         Form_peach.StringGridList.Cells[8,j]:=copy(s1,10,length(s1)-9);
         if pos('AES',s1)<>0 then
            begin
            Form_peach.StringGridList.Cells[1,j]:=dirExtractFileName(s3)+' *';
            seemencrypted:=true;
            set_pw;
            end;
         end;
         'Comment': Form_peach.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 Form_peach.StringGridList.Cells[1,j]<>'' then
      begin
      if Form_peach.StringGridList.Cells[2,j]<>txt_list_isfolder then nfiles:=nfiles+1
      else
         begin
         nfolders:=nfolders+1;
         if pos(directoryseparator,Form_peach.StringGridList.Cells[12,j])=0 then rootdirrecord:=1;
         end;
      Form_peach.StringGridList.Cells[16,j]:='0';
      j:=j+1;
      end
   else
      if Form_peach.StringGridList.RowCount>1 then
         begin
         Form_peach.StringGridList.RowCount:=Form_peach.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;
Form_peach.StringGridList.RowCount:=j;

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

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

if stopped_prebrowse=true then
   begin
   j:=0;
   size:=0;
   csize:=0;
   if Form_peach.StringGridList.RowCount>1 then
      Form_peach.StringGridList.RowCount:=Form_peach.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 Form_peach.StringGridList.RowCount<2 then Form_peach.StringGridList.RowCount:=2;
if Form_peach.visible=true then Application.Processmessages;
if (mode='browse') or (mode='flat') then
   begin
   if Form_peach.StringGridList.RowCount>1 then Form_peach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   if az=false then sort_za_stringgridlist(listsortcol);
   end;

if (mode='silent') then
   begin
   Form_peach.StringGridArchive.RowCount:=Form_peach.StringGridList.RowCount+Form_peach.StringGridAddress2.RowCount-1;
   for i:=1 to Form_peach.StringGridList.Rowcount-1 do Form_peach.StringGridArchive.Rows[i]:=Form_peach.StringGridList.Rows[i];
   for i:=1 to Form_peach.StringGridAddress2.Rowcount-1 do Form_peach.StringGridArchive.Rows[Form_peach.StringGridList.Rowcount+i-1]:=Form_peach.StringGridAddress2.Rows[i];
   end;
if tvol>1 then status1:=inttostr(tvol)+' '+txt_8_1_volumes+' | '+status1;
Form_peach.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:=Form_peach.MemoList.Lines.Count;
if k<=i then begin Form_peach.StringGridList.RowCount:=2; exit; end;
j:=1;
size:=0;
csize:=0;
nfiles:=0;
nfolders:=0;
if mode='silent' then
   begin
   prebrowse_dirs:=-1;
   prebrowse_records:=-1;
   end;
rootdirrecord:=0;
stopped_prebrowse:=false;
Form_peach.StringGridList.RowCount:=1;
status0:=txt_list_searching;
status1:=txt_please_wait;
Form_peach.StringGridList.BeginUpdate;
Form_peach.StringGridList.RowCount:=512*1024; //optimized for up to 0.5 M files;
repeat
   if j<524288 then
   else
      Form_peach.StringGridList.RowCount:=Form_peach.StringGridList.RowCount+1;
   repeat
      s1:=Form_peach.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);
         Form_peach.StringGridList.Cells[1,j]:=extractfilename(s3);
         Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);//overridden if "Folder" parameter is provided
         Form_peach.StringGridList.Cells[12,j]:=s3;
         end;
         'Type':
         if rar5str='Directory' then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[13,j]:=prefixd+smartsortable(extractfilename(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[13,j]:=prefixf+smartsortable(extractfilename(s3));
            end;
         'Size':
         begin
         Form_peach.StringGridList.Cells[3,j]:=rar5str;
         Form_peach.StringGridList.Cells[14,j]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,j]))))+inttostr(length(Form_peach.StringGridList.Cells[3,j]))+Form_peach.StringGridList.Cells[3,j];
         try
            size:=size+strtoqword(Form_peach.StringGridList.Cells[3,j]);
         except
         end;
         end;
         'Packed size':
         begin
         Form_peach.StringGridList.Cells[4,j]:=rar5str;
         Form_peach.StringGridList.Cells[15,j]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,j]))))+inttostr(length(Form_peach.StringGridList.Cells[4,j]))+Form_peach.StringGridList.Cells[4,j];
         try
            csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,j]);
         except
         end;
         end;
         'mtime': Form_peach.StringGridList.Cells[5,j]:=rar5str;
         'CRC32 MAC': Form_peach.StringGridList.Cells[11,j]:=rar5str;
         'Attributes':
         begin
         Form_peach.StringGridList.Cells[10,j]:=rar5str;
         if pos('D',Form_peach.StringGridList.Cells[10,j])<>0 then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[13,j]:=prefixd+smartsortable(extractfilename(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[13,j]:=prefixf+smartsortable(extractfilename(s3));
            end;
         end;
         'Flags':
         if pos('encrypted',rar5str)<>0 then
            begin
            Form_peach.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 Form_peach.StringGridList.Cells[1,j]<>'' then
      begin
      if Form_peach.StringGridList.Cells[2,j]<>txt_list_isfolder then nfiles:=nfiles+1
      else
         begin
         nfolders:=nfolders+1;
         if pos(directoryseparator,Form_peach.StringGridList.Cells[12,j])=0 then rootdirrecord:=1;
         end;
      Form_peach.StringGridList.Cells[16,j]:='0';
      j:=j+1;
      end
   else
      if Form_peach.StringGridList.RowCount>1 then
         Form_peach.StringGridList.RowCount:=Form_peach.StringGridList.RowCount-1;
   if Form_peach.Visible=true then Application.ProcessMessages;
until i>=k-1;
if j<1 then j:=1;
Form_peach.StringGridList.RowCount:=j;
j:=j-1;
if mode='silent' then
   begin
   prebrowse_dirs:=nfolders;
   prebrowse_records:=j;
   end;
if stopped_prebrowse=true then
   begin
   j:=0;
   size:=0;
   csize:=0;
   if Form_peach.StringGridList.RowCount>1 then
      Form_peach.StringGridList.RowCount:=Form_peach.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 Form_peach.StringGridList.RowCount<2 then Form_peach.StringGridList.RowCount:=2;
if Form_peach.visible=true then Application.Processmessages;
if (mode='browse') or (mode='flat') then
   begin
   if Form_peach.StringGridList.RowCount>1 then Form_peach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   if az=false then sort_za_stringgridlist(listsortcol);
   end;
Form_peach.StringGridList.EndUpdate(true);
end;

procedure teststatus(var i:integer; var s:ansistring);
begin
i:=0;
try
if Form_peach.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 enter_busy_status;//block navigation, browser and address bar context menus, and sorting while file manager is being updated
begin
Form_peach.timer4.enabled:=true;
Form_peach.ListView1.PopupMenu:=nil;
Form_peach.ImageListSearch.Picture.Bitmap:=Bgopath;
Form_peach.ImageListSearch.Hint:=txt_4_8_stop;
refreshstatus:=1;
pcount:=1;
browserbusy:=true;
end;

procedure exit_busy_status;
begin
browserbusy:=false;
Form_peach.ProgressBar2.Visible:=false;
Form_peach.Panel10.Visible:=false;
Form_peach.ListView1.PopupMenu:=Form_peach.PopupOpen;
Form_peach.ListView1.Cursor:=crDefault;
Form_peach.ImageListSearch.Picture.Bitmap:=Bsearch;
Form_peach.ImageListSearch.Hint:=txt_searchfor;
refreshstatus:=0;
end;

function execute_cl(cl,mode:ansistring):integer;
var
  P: tprocessutf8;
  i,BytesRead:integer;
  skipped_prebrowse:boolean;
  M:TmemoryStream;
  nfiles,ndirs,tsize,browselimitsize:QWord;
begin
execute_cl:=-1;
zaout:=zaout1;
if cl='' then
   begin
   pMessageErrorOK(txt_error_emptycl);
   exit_nosave;
   end;
enter_busy_status;
Form_peach.LabelErrors.Caption:='';
if Form_peach.Visible=true then Application.ProcessMessages;
skipped_prebrowse:=false;
i:=0;
P:=tprocessutf8.Create(nil);
P.CommandLine:=cl;
M := TMemoryStream.Create;
BytesRead := 0;
{$IFDEF MSWINDOWS}
if (mode='extandrun') or (mode='delete') or (mode='add') or (mode='preview') then
   if intpw=1 then else P.Options := [poNoConsole]
else P.Options := [poUsePipes, poNoConsole];
if fun='UNARC' then if intpw=1 then else P.Options := [poUsePipes, poNoConsole];
{$ELSE}
if (mode='extandrun') or (mode='delete') or (mode='add') or (mode='preview') then
   if intpw=1 then P.Options := [poNoConsole, poWaitOnExit] else P.Options := [poWaitOnExit] //workaround for Linux, poWaitOnExit does not work correctly with other options
else P.Options := [poUsePipes];
if fun='UNARC' then if intpw=1 then P.Options := [poNoConsole, poWaitOnExit] else P.Options := [poUsePipes];
{$ENDIF}
if mode='silent' then nitems:=0;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
M.SetSize(16*1024*1024);
case prebrowse of
   1: browselimitsize:=192*1024*1024; //pre-parse 1.5M+ / list 0.5M files approx
   2: browselimitsize:=64*1024*1024; //0.5M+ / 200K
   3: browselimitsize:=32*1024*1024; //256K+ / 100K
   4,5: browselimitsize:=16*1024*1024; //128K+ (5 excludes pre-parsing) / 50K
   end;
P.Execute;
while P.Running do
   begin
   if (BytesRead<(32*1024*1024)) then if BytesRead+4*1024>=16*1024*1024 then M.SetSize(32*1024*1024);
   if (BytesRead>=(32*1024*1024)) and (BytesRead<(64*1024*1024)) then if BytesRead+4*1024>=32*1024*1024 then M.SetSize(64*1024*1024);
   if (BytesRead>=(64*1024*1024)) and (BytesRead<(192*1024*1024)) then if BytesRead+4*1024>=64*1024*1024 then M.SetSize(192*1024*1024);
   if BytesRead+4*1024>=M.Size then M.SetSize(BytesRead + 4*1024);
   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;
   if (mode<>'extandrun') and (mode<>'delete') and (mode<>'add')  and (mode<>'preview') then i := P.Output.Read((M.Memory + BytesRead)^, 4*1024);
   if i > 0 then Inc(BytesRead, i)
   else Sleep(100);
   if Form_peach.Visible=true then Application.ProcessMessages;
   end;
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);
   until i <= 0;
M.SetSize(BytesRead);
if fun<>'UNARC' then
   begin
   if tryopenwerrors=0 then execute_cl:=P.ExitStatus else execute_cl:=0;
   end
else
   execute_cl:=P.ExitStatus;
if P.ExitStatus<>0 then Form_peach.LabelErrors.Caption:=txt_7_3_archiveerrors;
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;
   exit_busy_status;
   exit;
   end;
Form_peach.StringGridList.RowCount:=1;
Form_peach.MemoList.Clear;
if execute_cl=0 then
   begin
   Form_peach.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 Form_peach.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 Form_peach.EditUn7zaFilter.Text='*' then
            status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;
         if mode='browse' then lastobjarch:=extractfilepath(Form_peach.EditUn7zaFilter.Text);
         end;
      update_listview;
      Form_peach.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(Form_peach.EditUn7zaFilter.Text);
      status0:=txt_list_browsing;
      update_listview;
      end;
   if mode='flat' then
      begin
      Form_peach.StringGridList.Cells[16,1]:='1';
      Form_peach.StringGridList.Row:=1;
      status0:=txt_list_flat;
      update_listview;
      end;
   end
else //error
   begin
   Form_peach.ShapeProgress.Color:=PRED;
   application.ProcessMessages;
   Form_peach.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;
exit_busy_status;
end;

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 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:integer;
  browselimitsize,sz:QWord;
  Labelenc:boolean;
  s,s1,s2,fun,jobcode,outname: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 lowercase(extractfileext(fname))='.7z' then
   begin
   srcfilesize_multipart(fname,sz);
   if sz<33 then exit;//empty 7z file
   end;
if (lowercase(extractfileext(fname))='.zip') or (lowercase(extractfileext(fname))='.zipx') then
   begin
   srcfilesize_multipart(fname,sz);
   if sz<23 then exit;//empty zip file
   end;
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;
if cl='' then exit;
i:=0;
P:=tprocessutf8.Create(nil);
P.CommandLine:=cl;
M := TMemoryStream.Create;
BytesRead := 0;
P.Options := [poUsePipes{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
M.SetSize(16*1024*1024);
case prebrowse of
   1: browselimitsize:=192*1024*1024; //0.5M files approx
   2: browselimitsize:=64*1024*1024; //200K
   3: browselimitsize:=32*1024*1024; //100K
   4,5: browselimitsize:=16*1024*1024; //50K
   end;
P.Execute;
while P.Running do
   begin
   if (BytesRead<(32*1024*1024)) then if BytesRead+4*1024>=16*1024*1024 then M.SetSize(32*1024*1024);
   if (BytesRead>=(32*1024*1024)) and (BytesRead<(64*1024*1024)) then if BytesRead+4*1024>=32*1024*1024 then M.SetSize(64*1024*1024);
   if (BytesRead>=(64*1024*1024)) and (BytesRead<(192*1024*1024)) then if BytesRead+4*1024>=64*1024*1024 then M.SetSize(192*1024*1024);
   if BytesRead+4*1024>=M.Size then M.SetSize(BytesRead + 4*1024);
   if prebrowse>0 then
      begin
      if BytesRead>browselimitsize then
         begin
         P.Terminate(255);
         break;
         end;
      end;
   i := P.Output.Read((M.Memory + BytesRead)^, 4*1024);
   if i > 0 then Inc(BytesRead, i)
   else Sleep(100);
   if Form_peach.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(100);
until i <= 0;
M.SetSize(BytesRead);
ec:=P.ExitStatus;
P.Free;
Form_peach.MemoList.Clear;
Labelenc:=false;
Form_peach.MemoList.Lines.LoadFromStream(M);
k:=Form_peach.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
   if fun='UN7Z' then
      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:=Form_peach.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;
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.Editun7zaPW.Text='') and (FormPW.EditName3.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;
         exit;
         end;
      FormPW.Caption:=s;
      showconfirmation;
      end;
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(Form_peach.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(Form_peach.Handle, PWideChar ('open'), PWideChar(w), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
if cp_open<33 then
   cp_open:=shellexecuteW(Form_peach.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(Form_peach.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 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;
         P:=tprocessutf8.Create(nil);
         dodirseparators(tempstring);
         outname:=stringdelim(escapefilename(outname+tempstring,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path+'peazip'+EXEEXT,desk_env))+' -ext2openasarchive';//' -ext2open';
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
         cl:=bin_name+' '+outname;
         P.CommandLine:=cl;
         if Form_peach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P.Execute;
         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 (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
         P:=tprocessutf8.Create(nil);
         {$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
               P.Free;
               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(Form_peach.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));
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
         cl:=bin_name+' -ext2open '+outname;
         P.CommandLine:=cl;
         if Form_peach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P.Execute;
         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;

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:=Form_peach.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:=Form_peach.EditUn7zaFilter.Text;
//if copy(s2,1,1)='.' then s2:='*'+copy(s2,2,length(s2)-1);
if Form_peach.EditUn7zaFilterExclude.Text<>'' then cl:=cl+' '+stringdelim('-x!'+escapefilename(s1,desk_env));
if Form_peach.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:=Form_peach.EditUn7zaFilterExclude.Text;
if pos('*'+directoryseparator+'*',s1)<>0 then s1:=copy(s1,1,pos('*'+directoryseparator+'*',s1)-2);
s2:=Form_peach.EditUn7zaFilter.Text;
if Form_peach.EditUn7zaFilterExclude.Text<>'' then cl:=cl+' '+stringdelim('-x'+escapefilename(s1,desk_env)+directoryseparator+'**'+directoryseparator+'**'+directoryseparator)+' '+stringdelim('-x'+escapefilename(s1,desk_env)+directoryseparator+'**'+directoryseparator+'*');
if Form_peach.EditUn7zaFilter.Text<>'' then cl:=cl+' -- '+stringdelim(escapefilename(s2,desk_env));
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);
Form_peach.Visible:=false;
saverestartclosepeaapp;
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;

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 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 rar
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;

function testifrar(s:ansistring):integer; //test RAR
var
   ext:ansistring;
begin
result:=0;
ext:=extractfileext(s);
if upcase(ext)='.RAR' then result:=1;
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((Form_peach.EditOpenIn.Text),desk_env));
if fun='UN7Z' then exe_name:='7z';
bin_name:=stringdelim(escapefilename(binpath,desk_env)+exe_name+DirectorySeparator+exe_name+EXEEXT);
pw:=FormPW.EditUn7zaPW.Text;
if FormPW.EditName3.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
      begin
      pMessageErrorOK(FormPW.EditName3.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:='-pdefault';
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(Form_peach.EditOpenIn.Text))='.ZIP') or (upcase(extractfileext(Form_peach.EditOpenIn.Text))='.ZIPX') then
   case mcuzip of
      0: mcu_option:='';
      1: mcu_option:='-mcu=on';
      2: mcu_option:='-mcl=on';
      3: if Form_peach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+Form_peach.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';
cl:=cl+' '+pw+' '+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 Form_peach.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(Form_peach.EditOpenIn.Text,desk_env));
if fun='UN7Z' then exe_name:=UNRARNAME;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unrar'+DirectorySeparator+exe_name+EXEEXT);
pw:=FormPW.EditUn7zaPW.Text;
if FormPW.EditName3.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
      begin
      pMessageErrorOK(FormPW.EditName3.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 Form_peach.EditUn7zaFilter.Text<>'*' then funflag:=false else funflag:=true;
result:=execute_cl(cl,mode);
end;

procedure clean_archive_breadcrumb;
begin
Form_peach.aabc1.Caption:='';
Form_peach.aabc2.Caption:='';
Form_peach.aabc3.Caption:='';
Form_peach.aabc4.Caption:='';
Form_peach.aabc5.Caption:='';
Form_peach.aabc6.Caption:='';
Form_peach.aabc7.Caption:='';
Form_peach.aabc8.Caption:='';
Form_peach.abc1.Caption:='';
Form_peach.abc2.Caption:='';
Form_peach.abc3.Caption:='';
Form_peach.abc4.Caption:='';
Form_peach.abc5.Caption:='';
Form_peach.abc6.Caption:='';
Form_peach.abc7.Caption:='';
Form_peach.abc8.Caption:='';
Form_peach.abc0.Caption:='';
Form_peach.aabc1.Visible:=false;
Form_peach.aabc2.Visible:=false;
Form_peach.aabc3.Visible:=false;
Form_peach.aabc4.Visible:=false;
Form_peach.aabc5.Visible:=false;
Form_peach.aabc6.Visible:=false;
Form_peach.aabc7.Visible:=false;
Form_peach.aabc8.Visible:=false;
Form_peach.abc1.Visible:=false;
Form_peach.abc2.Visible:=false;
Form_peach.abc3.Visible:=false;
Form_peach.abc4.Visible:=false;
Form_peach.abc5.Visible:=false;
Form_peach.abc6.Visible:=false;
Form_peach.abc7.Visible:=false;
Form_peach.abc8.Visible:=false;
Form_peach.abc0.Visible:=false;
Form_peach.ImageAdArchive0.Visible:=false;
Form_peach.PanelAdArchive0.Visible:=false;
Form_peach.LabelClickAdArchive1.Caption:='';
Form_peach.ImageAdArchive1.Visible:=false;
Form_peach.PanelAdArchive1.Visible:=false;
Form_peach.LabelClickAdArchive2.Caption:='';
Form_peach.ImageAdArchive2.Visible:=false;
Form_peach.PanelAdArchive2.Visible:=false;
Form_peach.LabelClickAdArchive3.Caption:='';
Form_peach.ImageAdArchive3.Visible:=false;
Form_peach.PanelAdArchive3.Visible:=false;
Form_peach.LabelClickAdArchive4.Caption:='';
Form_peach.pmbcexpand.Visible:=false;
Form_peach.apmbcexpand.Visible:=false;
Form_peach.pmbce.Visible:=false;
Form_peach.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
   Form_peach.ImageAdArchive0.Visible:=true;
   Form_peach.PanelAdArchive0.Visible:=true;
   Form_peach.LabelClickAddress8.Visible:=true;
   Form_peach.ImageAdArchive1.Visible:=true;
   Form_peach.PanelAdArchive1.Visible:=true;
   Form_peach.LabelClickAdArchive1.Visible:=true;
   Form_peach.ImageAdArchive2.Visible:=true;
   Form_peach.PanelAdArchive2.Visible:=true;
   Form_peach.LabelClickAdArchive2.Visible:=true;
   Form_peach.ImageAdArchive3.Visible:=true;
   Form_peach.PanelAdArchive3.Visible:=true;
   Form_peach.LabelClickAdArchive3.Visible:=true;
   end;
Str := TStringList.Create;
str.StrictDelimiter := True;
Str.Delimiter := PathDelim;
Str.DelimitedText := PathDelim+Form_peach.EditUn7zaFilter1.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]<>Form_peach.EditUn7zaFilter1.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(Form_peach.EditUn7zaFilter1.Caption)>2 then
         if pos(directoryseparator+directoryseparator, Form_peach.EditUn7zaFilter1.Caption)=1 then
            abcrs[i]:=directoryseparator+directoryseparator+abcrs[i];
      i:=i+1;
      end;
Form_peach.PanelLCAa1.Brush.Color:=abarchivecol;
Form_peach.PanelLCAa2.Brush.Color:=abarchivecol;
Form_peach.PanelLCAa3.Brush.Color:=abarchivecol;
Form_peach.PanelLCAa4.Brush.Color:=abarchivecol;
Form_peach.PanelLCA8.Brush.Color:=abarchivecol;
Form_peach.PanelLCAa1.pen.Color:=abarchivecol;
Form_peach.PanelLCAa2.pen.Color:=abarchivecol;
Form_peach.PanelLCAa3.pen.Color:=abarchivecol;
Form_peach.PanelLCAa4.pen.Color:=abarchivecol;
Form_peach.PanelLCA8.pen.Color:=abarchivecol;
Form_peach.LabelClickAdArchive1.Caption:=ars[1];
if ars[1]='' then
   begin
   Form_peach.ImageAdArchive0.Visible:=false;
   Form_peach.PanelAdArchive0.Visible:=false;
   Form_peach.LabelClickAdArchive1.AnchorSideLeft.Control:=Form_peach.PanelAddress7;
   Form_peach.LabelClickAdArchive1.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAdArchive0.Visible:=true;
   Form_peach.PanelAdArchive0.Visible:=true;
   Form_peach.PanelAdArchive0.AnchorSideLeft.Control:=Form_peach.LabelClickaddress8;
   Form_peach.PanelAdArchive0.AnchorSideLeft.Side:=asrRight;
   Form_peach.LabelClickAdArchive1.AnchorSideLeft.Control:=Form_peach.PanelAdArchive0;
   Form_peach.LabelClickAdArchive1.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAdArchive2.Caption:=ars[2];
if ars[2]='' then
   begin
   Form_peach.ImageAdArchive1.Visible:=false;
   Form_peach.PanelAdArchive1.Visible:=false;
   Form_peach.LabelClickAdArchive2.AnchorSideLeft.Control:=Form_peach.PanelAddress7;
   Form_peach.LabelClickAdArchive2.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAdArchive1.Visible:=true;
   Form_peach.PanelAdArchive1.Visible:=true;
   Form_peach.LabelClickAdArchive2.AnchorSideLeft.Control:=Form_peach.PanelAdArchive1;
   Form_peach.LabelClickAdArchive2.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAdArchive3.Caption:=ars[3];
if ars[3]='' then
   begin
   Form_peach.ImageAdArchive2.Visible:=false;
   Form_peach.PanelAdArchive2.Visible:=false;
   Form_peach.LabelClickAdArchive3.AnchorSideLeft.Control:=Form_peach.PanelAddress7;
   Form_peach.LabelClickAdArchive3.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAdArchive2.Visible:=true;
   Form_peach.PanelAdArchive2.Visible:=true;
   Form_peach.LabelClickAdArchive3.AnchorSideLeft.Control:=Form_peach.PanelAdArchive2;
   Form_peach.LabelClickAdArchive3.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAdArchive4.Caption:=ars[4];
if ars[4]='' then
   begin
   Form_peach.ImageAdArchive3.Visible:=false;
   Form_peach.PanelAdArchive3.Visible:=false;
   Form_peach.LabelClickAdArchive4.AnchorSideLeft.Control:=Form_peach.PanelAddress7;
   Form_peach.LabelClickAdArchive4.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAdArchive3.Visible:=true;
   Form_peach.PanelAdArchive3.Visible:=true;
   Form_peach.LabelClickAdArchive4.AnchorSideLeft.Control:=Form_peach.PanelAdArchive3;
   Form_peach.LabelClickAdArchive4.AnchorSideLeft.Side:=asrRight;
   end;

if macbread=1 then
begin
if ars[4]<>'' then
   begin
   Form_peach.ImageAdArchive0.Visible:=false;
   Form_peach.PanelAdArchive0.Visible:=false;
   Form_peach.LabelClickAddress8.Visible:=false;
   Form_peach.ImageAdArchive1.Visible:=false;
   Form_peach.PanelAdArchive1.Visible:=false;
   Form_peach.LabelClickAdArchive1.Visible:=false;
   Form_peach.ImageAdArchive2.Visible:=false;
   Form_peach.PanelAdArchive2.Visible:=false;
   Form_peach.LabelClickAdArchive2.Visible:=false;
   Form_peach.ImageAdArchive3.Visible:=false;
   Form_peach.PanelAdArchive3.Visible:=false;
   Form_peach.LabelClickAdArchive3.Visible:=false;
   end;
if ars[3]<>'' then
   begin
   Form_peach.ImageAdArchive0.Visible:=false;
   Form_peach.PanelAdArchive0.Visible:=false;
   Form_peach.LabelClickAddress8.Visible:=false;
   Form_peach.ImageAdArchive1.Visible:=false;
   Form_peach.PanelAdArchive1.Visible:=false;
   Form_peach.LabelClickAdArchive1.Visible:=false;
   Form_peach.ImageAdArchive2.Visible:=false;
   Form_peach.PanelAdArchive2.Visible:=false;
   Form_peach.LabelClickAdArchive2.Visible:=false;
   end;
if ars[2]<>'' then
   begin
   Form_peach.ImageAdArchive0.Visible:=false;
   Form_peach.PanelAdArchive0.Visible:=false;
   Form_peach.LabelClickAddress8.Visible:=false;
   Form_peach.ImageAdArchive1.Visible:=false;
   Form_peach.PanelAdArchive1.Visible:=false;
   Form_peach.LabelClickAdArchive1.Visible:=false;
   end;
if ars[1]<>'' then
   begin
   Form_peach.ImageAdArchive0.Visible:=false;
   Form_peach.PanelAdArchive0.Visible:=false;
   Form_peach.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]<>Form_peach.EditUn7zaFilter1.Caption then s[j]:=s[j]+ PathDelim;
         end;

if length(Form_peach.EditUn7zaFilter1.Caption)>2 then
   if pos(directoryseparator+directoryseparator, Form_peach.EditUn7zaFilter1.Caption)=1 then
      for j := 1 to 8 do s[j]:=directoryseparator+directoryseparator+s[j];

Str.Free;
Form_peach.aabc1.Bitmap:=BFolder;
Form_peach.aabc2.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.aabc3.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.aabc4.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.aabc5.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.aabc6.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.aabc7.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.aabc8.Bitmap:=Form_peach.aabc1.Bitmap;
Form_peach.abc1.Bitmap:=BFolder;
Form_peach.abc2.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc3.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc4.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc5.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc6.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc7.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc8.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.abc0.Bitmap:=BArchiveSupported;
if (s[8]<>'') and (s[8]<>directoryseparator+directoryseparator) then Form_peach.abc1.Caption:=s[8]+'*';
if (s[7]<>'') and (s[7]<>directoryseparator+directoryseparator) then Form_peach.abc2.Caption:=s[7]+'*';
if (s[6]<>'') and (s[6]<>directoryseparator+directoryseparator) then Form_peach.abc3.Caption:=s[6]+'*';
if (s[5]<>'') and (s[5]<>directoryseparator+directoryseparator) then Form_peach.abc4.Caption:=s[5]+'*';
if (s[4]<>'') and (s[4]<>directoryseparator+directoryseparator) then Form_peach.abc5.Caption:=s[4]+'*';
if (s[3]<>'') and (s[3]<>directoryseparator+directoryseparator) then Form_peach.abc6.Caption:=s[3]+'*';
if (s[2]<>'') and (s[2]<>directoryseparator+directoryseparator) then Form_peach.abc7.Caption:=s[2]+'*';
if (s[1]<>'') and (s[1]<>directoryseparator+directoryseparator) then Form_peach.abc8.Caption:=s[1]+'*';
Form_peach.abc0.Caption:=extractfilename(Form_peach.EditOpenIn.Text);
if Form_peach.abc1.Caption='' then Form_peach.abc1.Visible:=false else Form_peach.abc1.Visible:=true;
if Form_peach.abc2.Caption='' then Form_peach.abc2.Visible:=false else Form_peach.abc2.Visible:=true;
if Form_peach.abc3.Caption='' then Form_peach.abc3.Visible:=false else Form_peach.abc3.Visible:=true;
if Form_peach.abc4.Caption='' then Form_peach.abc4.Visible:=false else Form_peach.abc4.Visible:=true;
if Form_peach.abc5.Caption='' then Form_peach.abc5.Visible:=false else Form_peach.abc5.Visible:=true;
if Form_peach.abc6.Caption='' then Form_peach.abc6.Visible:=false else Form_peach.abc6.Visible:=true;
if Form_peach.abc7.Caption='' then Form_peach.abc7.Visible:=false else Form_peach.abc7.Visible:=true;
if Form_peach.abc8.Caption='' then Form_peach.abc8.Visible:=false else Form_peach.abc8.Visible:=true;
if Form_peach.abc0.Caption='' then Form_peach.abc0.Visible:=false else Form_peach.abc0.Visible:=true;
Form_peach.pmbcexpand.Visible:=Form_peach.abc0.Visible;
Form_peach.apmbcexpand.Visible:=Form_peach.abc0.Visible;
Form_peach.pmbce.Visible:=Form_peach.abc0.Visible;
Form_peach.Separator25.Visible:=Form_peach.abc0.Visible;
Form_peach.aabc1.Caption:=Form_peach.abc1.Caption;
Form_peach.aabc2.Caption:=Form_peach.abc2.Caption;
Form_peach.aabc3.Caption:=Form_peach.abc3.Caption;
Form_peach.aabc4.Caption:=Form_peach.abc4.Caption;
Form_peach.aabc5.Caption:=Form_peach.abc5.Caption;
Form_peach.aabc6.Caption:=Form_peach.abc6.Caption;
Form_peach.aabc7.Caption:=Form_peach.abc7.Caption;
Form_peach.aabc8.Caption:=Form_peach.abc8.Caption;
Form_peach.aabc1.Visible:=Form_peach.abc1.Visible;
Form_peach.aabc2.Visible:=Form_peach.abc2.Visible;
Form_peach.aabc3.Visible:=Form_peach.abc3.Visible;
Form_peach.aabc4.Visible:=Form_peach.abc4.Visible;
Form_peach.aabc5.Visible:=Form_peach.abc5.Visible;
Form_peach.aabc6.Visible:=Form_peach.abc6.Visible;
Form_peach.aabc7.Visible:=Form_peach.abc7.Visible;
Form_peach.aabc8.Visible:=Form_peach.abc8.Visible;

if pos('\\.\',Form_peach.EditOpenIn.Text)=1 then
   begin
   Form_peach.LabelClickAddress1.Caption:='';
   Form_peach.LabelClickAddress2.Caption:='';
   Form_peach.LabelClickAddress3.Caption:='';
   Form_peach.LabelClickAddress4.Caption:='';
   Form_peach.LabelClickAddress5.Caption:='';
   Form_peach.LabelClickAddress6.Caption:='';
   Form_peach.LabelClickAddress7.Caption:='';
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.ImageAddress5.Visible:=false;
   Form_peach.ImageAddress6.Visible:=false;
   Form_peach.ImageAddress7.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.PanelAddress4.Visible:=false;
   Form_peach.PanelAddress5.Visible:=false;
   Form_peach.PanelAddress6.Visible:=false;
   Form_peach.PanelAddress7.Visible:=false;
   Form_peach.PanelLCA1.Visible:=false;
   Form_peach.PanelLCA2.Visible:=false;
   Form_peach.PanelLCA3.Visible:=false;
   Form_peach.PanelLCA4.Visible:=false;
   Form_peach.PanelLCA5.Visible:=false;
   Form_peach.PanelLCA6.Visible:=false;
   Form_peach.PanelLCA7.Visible:=false;
   Form_peach.LabelClickAddress8.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress8.AnchorSideLeft.Side:=asrRight;
   Form_peach.LabelClickAddress8.Caption:=' '+Form_peach.EditOpenIn.Text+' ';
   Form_peach.PanelLCA8.Brush.Color:=Form_peach.Panelclickaddress.Color;
   Form_peach.PanelLCA8.Pen.Color:=Form_peach.PanelLCA8.Brush.Color;
   end;
if altbread>0 then
   begin
   Form_peach.ImageAdArchive0.Visible:=false;
   Form_peach.ImageAdArchive1.Visible:=false;
   Form_peach.ImageAdArchive2.Visible:=false;
   Form_peach.ImageAdArchive3.Visible:=false;
   setfontsbreadcrumb;
   end;
end;

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

procedure addtohistorypopup;
var
   s:ansistring;
   rc:integer;
begin
with form_peach 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);
   pmnavhistory1.caption:=pmh1.caption;
   pmnavhistory2.caption:=pmh2.caption;
   pmnavhistory3.caption:=pmh3.caption;
   pmnavhistory4.caption:=pmh4.caption;
   pmnavhistory5.caption:=pmh5.caption;
   pmnavhistory6.caption:=pmh6.caption;
   pmnavhistory7.caption:=pmh7.caption;
   pmnavhistory8.caption:=pmh8.caption;
   pmnavhistory1.visible:=pmh1.visible;
   pmnavhistory2.visible:=pmh2.visible;
   pmnavhistory3.visible:=pmh3.visible;
   pmnavhistory4.visible:=pmh4.visible;
   pmnavhistory5.visible:=pmh5.visible;
   pmnavhistory6.visible:=pmh6.visible;
   pmnavhistory7.visible:=pmh7.visible;
   pmnavhistory8.visible:=pmh8.visible;
   if pmnavhistory1.visible=true then pmnavhistory1.Bitmap:=drawhistoryicon(rc-1);
   if pmnavhistory2.visible=true then pmnavhistory2.Bitmap:=drawhistoryicon(rc-2);
   if pmnavhistory3.visible=true then pmnavhistory3.Bitmap:=drawhistoryicon(rc-3);
   if pmnavhistory4.visible=true then pmnavhistory4.Bitmap:=drawhistoryicon(rc-4);
   if pmnavhistory5.visible=true then pmnavhistory5.Bitmap:=drawhistoryicon(rc-5);
   if pmnavhistory6.visible=true then pmnavhistory6.Bitmap:=drawhistoryicon(rc-6);
   if pmnavhistory7.visible=true then pmnavhistory7.Bitmap:=drawhistoryicon(rc-7);
   if pmnavhistory8.visible=true then pmnavhistory8.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;
   end;
end;

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

procedure addtohistory;
var
   rc,selptab:integer;
begin
Form_peach.StringGridSessionHistory.RowCount:=Form_peach.StringGridSessionHistory.Row+1;
if fun='UN7Z' then
   begin
   if (Form_peach.EditUn7zaFilter.Text=Form_peach.StringGridSessionHistory.Cells[1,Form_peach.StringGridSessionHistory.RowCount-1]) and (Form_peach.EditUn7zaFilterExclude.Text=Form_peach.StringGridSessionHistory.Cells[1,Form_peach.StringGridSessionHistory.RowCount-1]) then exit;
   rc:=Form_peach.StringGridSessionHistory.Rowcount;
   if (Form_peach.StringGridSessionHistory.Cells[1,rc-1]=status0) and
      (Form_peach.StringGridSessionHistory.Cells[2,rc-1]=Form_peach.EditOpenIn.Text) and
      (Form_peach.StringGridSessionHistory.Cells[3,rc-1]=Form_peach.EditUn7zaFilter.Text) and
      (Form_peach.StringGridSessionHistory.Cells[4,rc-1]=Form_peach.EditUn7zaFilterExclude.Text) then exit;
   rc:=rc+1;
   Form_peach.StringGridSessionHistory.RowCount:=rc;
   Form_peach.StringGridSessionHistory.Cells[1,rc-1]:=status0;
   Form_peach.StringGridSessionHistory.Cells[2,rc-1]:=Form_peach.EditOpenIn.Text;
   Form_peach.StringGridSessionHistory.Cells[3,rc-1]:=Form_peach.EditUn7zaFilter.Text;
   Form_peach.StringGridSessionHistory.Cells[4,rc-1]:=Form_peach.EditUn7zaFilterExclude.Text;
   end
else
   begin
   rc:=Form_peach.StringGridSessionHistory.Rowcount;
   if (Form_peach.StringGridSessionHistory.Cells[1,rc-1]=status0) and
      (Form_peach.StringGridSessionHistory.Cells[2,rc-1]=Form_peach.EditOpenIn.Text) and
      (Form_peach.StringGridSessionHistory.Cells[3,rc-1]=Form_peach.EditUn7zaFilter.Text) then exit;
   rc:=rc+1;
   Form_peach.StringGridSessionHistory.RowCount:=rc;
   Form_peach.StringGridSessionHistory.Cells[1,rc-1]:=status0;
   Form_peach.StringGridSessionHistory.Cells[2,rc-1]:=Form_peach.EditOpenIn.Text;
   Form_peach.StringGridSessionHistory.Cells[3,rc-1]:=Form_peach.EditUn7zaFilter.Text;
   Form_peach.StringGridSessionHistory.Cells[4,rc-1]:='';
   end;
Form_peach.StringGridSessionHistory.AutosizeColumns;
Form_peach.StringGridSessionHistory.ColWidths[0]:=rowsize;
if Form_peach.StringGridSessionHistory.Width<250 then Form_peach.StringGridSessionHistory.Width:=250;
Form_peach.StringGridSessionHistory.Row:=Form_peach.StringGridSessionHistory.RowCount-1;
addtohistorypopup;
sethistorybuttons;
populatetree;
for selptab:=0 to Form_peach.TabBar.Sections.Count-1 do if Form_peach.TabBar.Sections.Items[selptab].ID=atabid then break;
if Form_peach.TabBar.Sections.Items[selptab].ID<>0 then
    begin
    Form_peach.TabBar.Sections[selptab].Text:=gettabname(Form_peach.StringGridSessionHistory.Row);
    Form_peach.TabBar.Sections[selptab].ImageIndex:=drawtabicon(Form_peach.StringGridSessionHistory.Row);
    Form_peach.StringGridTabs.Rows[atabid]:=Form_peach.StringGridSessionHistory.Rows[Form_peach.StringGridSessionHistory.Row];
    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 gettreeicon(sg:tstringgrid; arow:integer):integer;
var
   s,s1,fulltype:ansistring;
   i,cellfilter:integer;
begin
with Form_peach do
begin
result:=1;
if sg.RowCount<2 then exit;
if arow>=sg.rowcount then exit;
if sg=Form_peach.stringgridbookmarks then cellfilter:=4
else cellfilter:=3;
if sg=Form_peach.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<>Form_peach.stringgridrecent then
   begin
   if sg.Cells[1,arow] = txt_list_found then
      begin
      result:=29;
      exit;
      end;
   if sg.Cells[1,arow] = txt_list_flat then
      begin
      result:=33;
      exit;
      end;
   s1:=sg.Cells[cellfilter,arow];
   if s1<>'' then
      s1:=s1[length(s1)];
   if s1<>'*' then
      begin
      result:=34;
      exit;
      end;
   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_myboxfiles) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_skydrive) or (s = shared_ubuntuone)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 Form_peach 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 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_myboxfiles) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_skydrive) or (s = shared_ubuntuone)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 populatebookmarks;
var
   i,j,k:integer;
   s,s1,s2:ansistring;
begin
with Form_peach 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:=Form_peach.StringGridBookmarks.Cells[2,i];
      s2:=s;
      if length(s)>0 then
         if s[length(s)]=directoryseparator then s1:=s
         else s1:=extractfilepath(s);
      translatespecialfolders(s);
      case i of
         1: begin
            pmembf1.caption:=s2;
            mb1.caption:=s;
            mb1.visible:=true;
            mb1.Bitmap:=drawmenuicon(mb1.Caption);
            pmjb1.caption:=s;
            pmjb1.visible:=true;
            pmjb1.Bitmap:=mb1.Bitmap;
            pnb1.caption:=s1;
            pnba1.caption:=s1;
            if s1<>'' then
               begin
               pnb1.visible:=true;
               pnb1.Bitmap:=drawmenuicon(pnb1.Caption);
               pnba1.visible:=true;
               pnba1.Bitmap:=pnb1.Bitmap;
               end;
            end;
         2: begin
            pmembf2.caption:=s2;
            mb2.caption:=s;
            mb2.visible:=true;
            mb2.Bitmap:=drawmenuicon(mb2.Caption);
            pmjb2.caption:=s;
            pmjb2.visible:=true;
            pmjb2.Bitmap:=mb2.Bitmap;
            pnb2.caption:=s1;
            pnba2.caption:=s1;
            if s1<>'' then
               begin
               pnb2.visible:=true;
               pnb2.Bitmap:=drawmenuicon(pnb2.Caption);
               pnba2.visible:=true;
               pnba2.Bitmap:=pnb2.Bitmap;
               end;
            end;
         3: begin
         pmembf3.caption:=s2;
         mb3.caption:=s;
         mb3.visible:=true;
         mb3.Bitmap:=drawmenuicon(mb3.Caption);
         pmjb3.caption:=s;
         pmjb3.visible:=true;
         pmjb3.Bitmap:=mb3.Bitmap;
         pnb3.caption:=s1;
         pnba3.caption:=s1;
         if s1<>'' then
            begin
            pnb3.visible:=true;
            pnb3.Bitmap:=drawmenuicon(pnb3.Caption);
            pnba3.visible:=true;
            pnba3.Bitmap:=pnb3.Bitmap;
            end;
         end;
         4: begin
         pmembf4.caption:=s2;
         mb4.caption:=s;
         mb4.visible:=true;
         mb4.Bitmap:=drawmenuicon(mb4.Caption);
         pmjb4.caption:=s;
         pmjb4.visible:=true;
         pmjb4.Bitmap:=mb4.Bitmap;
         pnb4.caption:=s1;
         pnba4.caption:=s1;
         if s1<>'' then
            begin
            pnb4.visible:=true;
            pnb4.Bitmap:=drawmenuicon(pnb4.Caption);
            pnba4.visible:=true;
            pnba4.Bitmap:=pnb4.Bitmap;
            end;
         end;
         5: begin
         pmembf5.caption:=s2;
         mb5.caption:=s;
         mb5.visible:=true;
         mb5.Bitmap:=drawmenuicon(mb5.Caption);
         pmjb5.caption:=s;
         pmjb5.visible:=true;
         pmjb5.Bitmap:=mb5.Bitmap;
         pnb5.caption:=s1;
         pnba5.caption:=s1;
         if s1<>'' then
            begin
            pnb5.visible:=true;
            pnb5.Bitmap:=drawmenuicon(pnb5.Caption);
            pnba5.visible:=true;
            pnba5.Bitmap:=pnb5.Bitmap;
            end;
         end;
         6: begin
         pmembf6.caption:=s2;
         mb6.caption:=s;
         mb6.visible:=true;
         mb6.Bitmap:=drawmenuicon(mb6.Caption);
         pmjb6.caption:=s;
         pmjb6.visible:=true;
         pmjb6.Bitmap:=mb6.Bitmap;
         pnb6.caption:=s1;
         pnba6.caption:=s1;
         if s1<>'' then
            begin
            pnb6.visible:=true;
            pnb6.Bitmap:=drawmenuicon(pnb6.Caption);
            pnba6.visible:=true;
            pnba6.Bitmap:=pnb6.Bitmap;
            end;
         end;
         7: begin
         pmembf7.caption:=s2;
         mb7.caption:=s;
         mb7.visible:=true;
         mb7.Bitmap:=drawmenuicon(mb7.Caption);
         pmjb7.caption:=s;
         pmjb7.visible:=true;
         pmjb7.Bitmap:=mb7.Bitmap;
         pnb7.caption:=s1;
         pnba7.caption:=s1;
         if s1<>'' then
            begin
            pnb7.visible:=true;
            pnb7.Bitmap:=drawmenuicon(pnb7.Caption);
            pnba7.visible:=true;
            pnba7.Bitmap:=pnb7.Bitmap;
            end;
         end;
         8: begin
         pmembf8.caption:=s2;
         mb8.caption:=s;
         mb8.visible:=true;
         mb8.Bitmap:=drawmenuicon(mb8.Caption);
         pmjb8.caption:=s;
         pmjb8.visible:=true;
         pmjb8.Bitmap:=mb8.Bitmap;
         pnb8.caption:=s1;
         pnba8.caption:=s1;
         if s1<>'' then
            begin
            pnb8.visible:=true;
            pnb8.Bitmap:=drawmenuicon(pnb8.Caption);
            pnba8.visible:=true;
            pnba8.Bitmap:=pnb8.Bitmap;
            end;
         end;
         9: begin
         mb9.caption:=s;
         mb9.visible:=true;
         mb9.Bitmap:=drawmenuicon(mb9.Caption);
         pmjb9.caption:=s;
         pmjb9.visible:=true;
         pmjb9.Bitmap:=mb9.Bitmap;
         pnb9.caption:=s1;
         pnba9.caption:=s1;
         if s1<>'' then
            begin
            pnb9.visible:=true;
            pnb9.Bitmap:=drawmenuicon(pnb9.Caption);
            pnba9.visible:=true;
            pnba9.Bitmap:=pnb9.Bitmap;
            end;
         end;
         10: begin
         mb10.caption:=s;
         mb10.visible:=true;
         mb10.Bitmap:=drawmenuicon(mb10.Caption);
         pmjb10.caption:=s;
         pmjb10.visible:=true;
         pmjb10.Bitmap:=mb10.Bitmap;
         pnb10.caption:=s1;
         pnba10.caption:=s1;
         if s1<>'' then
            begin
            pnb10.visible:=true;
            pnb10.Bitmap:=drawmenuicon(pnb10.Caption);
            pnba10.visible:=true;
            pnba10.Bitmap:=pnb10.Bitmap;
            end;
         end;
         11: begin
            mb11.caption:=s;
            mb11.visible:=true;
            mb11.Bitmap:=drawmenuicon(mb11.Caption);
            pmjb11.caption:=s;
            pmjb11.visible:=true;
            pmjb11.Bitmap:=mb11.Bitmap;
            pnb11.caption:=s1;
            pnba11.caption:=s1;
            if s1<>'' then
               begin
               pnb11.visible:=true;
               pnb11.Bitmap:=drawmenuicon(pnb11.Caption);
               pnba11.visible:=true;
               pnba11.Bitmap:=pnb11.Bitmap;
               end;
            end;
         12: begin
            mb12.caption:=s;
            mb12.visible:=true;
            mb12.Bitmap:=drawmenuicon(mb12.Caption);
            pmjb12.caption:=s;
            pmjb12.visible:=true;
            pmjb12.Bitmap:=mb12.Bitmap;
            pnb12.caption:=s1;
            pnba12.caption:=s1;
            if s1<>'' then
               begin
               pnb12.visible:=true;
               pnb12.Bitmap:=drawmenuicon(pnb12.Caption);
               pnba12.visible:=true;
               pnba12.Bitmap:=pnb12.Bitmap;
               end;
            end;
         13: begin
         mb13.caption:=s;
         mb13.visible:=true;
         mb13.Bitmap:=drawmenuicon(mb13.Caption);
         pmjb13.caption:=s;
         pmjb13.visible:=true;
         pmjb13.Bitmap:=mb13.Bitmap;
         pnb3.caption:=s1;
         pnba13.caption:=s1;
         if s1<>'' then
            begin
            pnb13.visible:=true;
            pnb13.Bitmap:=drawmenuicon(pnb13.Caption);
            pnba13.visible:=true;
            pnba13.Bitmap:=pnb13.Bitmap;
            end;
         end;
         14: begin
         mb14.caption:=s;
         mb14.visible:=true;
         mb14.Bitmap:=drawmenuicon(mb14.Caption);
         pmjb14.caption:=s;
         pmjb14.visible:=true;
         pmjb14.Bitmap:=mb14.Bitmap;
         pnb14.caption:=s1;
         pnba14.caption:=s1;
         if s1<>'' then
            begin
            pnb14.visible:=true;
            pnb14.Bitmap:=drawmenuicon(pnb14.Caption);
            pnba14.visible:=true;
            pnba14.Bitmap:=pnb14.Bitmap;
            end;
         end;
         15: begin
         mb15.caption:=s;
         mb15.visible:=true;
         mb15.Bitmap:=drawmenuicon(mb15.Caption);
         pmjb15.caption:=s;
         pmjb15.visible:=true;
         pmjb15.Bitmap:=mb15.Bitmap;
         pnb15.caption:=s1;
         pnba15.caption:=s1;
         if s1<>'' then
            begin
            pnb15.visible:=true;
            pnb15.Bitmap:=drawmenuicon(pnb15.Caption);
            pnba15.visible:=true;
            pnba15.Bitmap:=pnb15.Bitmap;
            end;
         end;
         16: begin
         mb16.caption:=s;
         mb16.visible:=true;
         mb16.Bitmap:=drawmenuicon(mb16.Caption);
         pmjb16.caption:=s;
         pmjb16.visible:=true;
         pmjb16.Bitmap:=mb16.Bitmap;
         pnb16.caption:=s1;
         pnba16.caption:=s1;
         if s1<>'' then
            begin
            pnb16.visible:=true;
            pnb16.Bitmap:=drawmenuicon(pnb16.Caption);
            pnba16.visible:=true;
            pnba16.Bitmap:=pnb16.Bitmap;
            end;
         end;
         17: begin
         mb17.caption:=s;
         mb17.visible:=true;
         mb17.Bitmap:=drawmenuicon(mb17.Caption);
         pmjb17.caption:=s;
         pmjb17.visible:=true;
         pmjb17.Bitmap:=mb17.Bitmap;
         pnb17.caption:=s1;
         pnba17.caption:=s1;
         if s1<>'' then
            begin
            pnb17.visible:=true;
            pnb17.Bitmap:=drawmenuicon(pnb17.Caption);
            pnba17.visible:=true;
            pnba17.Bitmap:=pnb17.Bitmap;
            end;
         end;
         18: begin
         mb18.caption:=s;
         mb18.visible:=true;
         mb18.Bitmap:=drawmenuicon(mb18.Caption);
         pmjb18.caption:=s;
         pmjb18.visible:=true;
         pmjb18.Bitmap:=mb18.Bitmap;
         pnb18.caption:=s1;
         pnba18.caption:=s1;
         if s1<>'' then
            begin
            pnb18.visible:=true;
            pnb18.Bitmap:=drawmenuicon(pnb18.Caption);
            pnba18.visible:=true;
            pnba18.Bitmap:=pnb18.Bitmap;
            end;
         end;
         19: begin
         mb19.caption:=s;
         mb19.visible:=true;
         mb19.Bitmap:=drawmenuicon(mb19.Caption);
         pmjb19.caption:=s;
         pmjb19.visible:=true;
         pmjb19.Bitmap:=mb19.Bitmap;
         pnb19.caption:=s1;
         pnba19.caption:=s1;
         if s1<>'' then
            begin
            pnb19.visible:=true;
            pnb19.Bitmap:=drawmenuicon(pnb19.Caption);
            pnba19.visible:=true;
            pnba19.Bitmap:=pnb19.Bitmap;
            end;
         end;
         20: begin
         mb20.caption:=s;
         mb20.visible:=true;
         mb20.Bitmap:=drawmenuicon(mb20.Caption);
         pmjb20.caption:=s;
         pmjb20.visible:=true;
         pmjb20.Bitmap:=mb20.Bitmap;
         pnb20.caption:=s1;
         pnba20.caption:=s1;
         if s1<>'' then
            begin
            pnb20.visible:=true;
            pnb20.Bitmap:=drawmenuicon(pnb20.Caption);
            pnba20.visible:=true;
            pnba20.Bitmap:=pnb20.Bitmap;
            end;
         end;
         21: begin
            mb21.caption:=s;
            mb21.visible:=true;
            mb21.Bitmap:=drawmenuicon(mb21.Caption);
            pmjb21.caption:=s;
            pmjb21.visible:=true;
            pmjb21.Bitmap:=mb21.Bitmap;
            pnb21.caption:=s1;
            pnba21.caption:=s1;
            if s1<>'' then
               begin
               pnb21.visible:=true;
               pnb21.Bitmap:=drawmenuicon(pnb21.Caption);
               pnba21.visible:=true;
               pnba21.Bitmap:=pnb21.Bitmap;
               end;
            end;
         22: begin
            mb22.caption:=s;
            mb22.visible:=true;
            mb22.Bitmap:=drawmenuicon(mb22.Caption);
            pmjb22.caption:=s;
            pmjb22.visible:=true;
            pmjb22.Bitmap:=mb22.Bitmap;
            pnb22.caption:=s1;
            pnba22.caption:=s1;
            if s1<>'' then
               begin
               pnb22.visible:=true;
               pnb22.Bitmap:=drawmenuicon(pnb22.Caption);
               pnba22.visible:=true;
               pnba22.Bitmap:=pnb22.Bitmap;
               end;
            end;
         23: begin
         mb23.caption:=s;
         mb23.visible:=true;
         mb23.Bitmap:=drawmenuicon(mb23.Caption);
         pmjb23.caption:=s;
         pmjb23.visible:=true;
         pmjb23.Bitmap:=mb23.Bitmap;
         pnb3.caption:=s1;
         pnba23.caption:=s1;
         if s1<>'' then
            begin
            pnb23.visible:=true;
            pnb23.Bitmap:=drawmenuicon(pnb23.Caption);
            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;
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 Form_peach.StringGridBookmarks.RowCount-1 do
   if (Form_peach.StringGridBookmarks.Cells[2,i]=s)
   and (Form_peach.StringGridBookmarks.Cells[1,i]=s1)
   and (Form_peach.StringGridBookmarks.Cells[4,i]=s2)
   and (Form_peach.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:=Form_peach.EditOpenIn.Text //ignore selection
   else
      begin
      s:='*current';
      end;
   end;
   '*browsercontext':
   begin
   if fun='FILEBROWSER' then
      if checklistsel<>0 then s:=Form_peach.EditOpenIn.Text
      else s:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]
   else
      begin
      s:='*current';
      end;
   end;
   '*layout':
   begin
   {$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.Top=0{$ENDIF} then s:=Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row]
   else s:=Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row];
   end;
   '*history':
   begin
   s:=Form_peach.StringGridSessionHistory.Cells[2,Form_peach.StringGridSessionHistory.Row];
   s1:=Form_peach.StringGridSessionHistory.Cells[1,Form_peach.StringGridSessionHistory.Row];
   s2:=Form_peach.StringGridSessionHistory.Cells[3,Form_peach.StringGridSessionHistory.Row];
   s3:=Form_peach.StringGridSessionHistory.Cells[4,Form_peach.StringGridSessionHistory.Row];
   end;
   '*recent':
   begin
   s:=Form_peach.StringGridrecent.Cells[1,Form_peach.StringGridrecent.Row];
   s1:=txt_list_browsing;
   s2:='*';
   s3:='';
   end;
   end;

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

if s<>txt_mypc then
   if filegetattr(escapefilename(s,desk_env)) 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:=Form_peach.StringGridBookmarks.Rowcount+1;
   Form_peach.StringGridBookmarks.RowCount:=rc;
   Form_peach.StringGridBookmarks.Cells[2,rc-1]:=s;
   Form_peach.StringGridBookmarks.Cells[1,rc-1]:=s1;
   Form_peach.StringGridBookmarks.Cells[3,rc-1]:=extractbookmarkname(s);
   Form_peach.StringGridBookmarks.Cells[4,rc-1]:=s2;
   Form_peach.StringGridBookmarks.Cells[5,rc-1]:=s3;
   if savehistory=1 then
      Form_peach.StringGridBookmarks.Cells[9,rc-1]:=FormatDateTime('yyyy-mm-dd hh:mm:ss',now)
   else
      Form_peach.StringGridBookmarks.Cells[9,rc-1]:='';
   Form_peach.StringGridBookmarks.AutosizeColumns;
   Form_peach.StringGridBookmarks.ColWidths[10]:=0;
   Form_peach.StringGridBookmarks.ColWidths[11]:=0;
   Form_peach.StringGridBookmarks.ColWidths[0]:=rowsize;
   for i:=1 to Form_peach.StringGridBookmarks.RowCount-2 do Form_peach.StringGridBookmarks.Cells[11,i]:='0';
   Form_peach.StringGridBookmarks.Cells[11,Form_peach.StringGridBookmarks.RowCount-1]:='1';
   end;
populatebookmarks;
end;

function GetUNCName(const uLocalPath: ansistring): ansistring;
var
  BufferSize: DWord;
  LocalPath: widestring;
  s:ansistring;
  wb: array of wchar;
  ws:widestring;
  DummyBuffer: wchar;
  Error: DWord;
  i:integer;
begin
{$IFDEF MSWINDOWS}
Result:='';
localpath:=utf8decode(ulocalpath);
if (upcase(LocalPath)='A:\') or (upcase(LocalPath)='B:\') or (upcase(LocalPath)='C:\') then exit;
BufferSize := 2;
WNetGetUniversalNameW(PWChar(LocalPath), UNIVERSAL_NAME_INFO_LEVEL, @DummyBuffer, BufferSize);
setlength(wb,buffersize);
try
   Error := WNetGetUniversalNameW(PWChar(LocalPath), UNIVERSAL_NAME_INFO_LEVEL, @wb[0], BufferSize);
   if Error <> NO_ERROR then
      begin
      Result:='';
      end;
   s:='';
   if buffersize>0 then
      for i:=0 to buffersize-1 do
         begin
         if i>1 then
            if ord(wb[i])<>0 then begin ws:=wb[i]; s:=s+AnsiString(ws); end;
         end;
   Result:=s;
finally
end;
{$ENDIF}
end;

procedure set_group_fm(cond:boolean);
begin
with Form_peach 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;
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;
   end;
{$IFDEF MSWINDOWS}Form_peach.po_recycle.Visible:=cond;{$ENDIF}
{$IFDEF DARWIN}Form_peach.po_recycle.Visible:=cond;{$ENDIF}
po_delete.Visible:=cond;
po_securedelete.Visible:=cond;
po_zerofile.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 Form_peach do
begin
po_open.visible:=true;
po_windowopen.visible:=true;
po_exthere.visible:=true;
po_addsep.visible:=true;
if EditOpenIn.Text=txt_mypc then
   begin
   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;
   MenuItem145.Visible:=true;
   po_more.Visible:=true;
   po_pdup.Visible:=true;
   po_dedup.Visible:=true;
   po_analyzefolders.Visible:=true;
   pmfilebrowser.Visible:=true;
   pmpanalyzefolders.Visible:=true;
   pmpdup.Visible:=true;
   pmcheck.Visible:=true;
   Separator17.visible:=true;
   po_checksum.Visible:=true;
   po_im.visible:=true;
   set_group_fm(true);
   end;
MenuItemOpen_ExtractHere.Visible:=false;
pmmorefun_details.Enabled:=true;
pmmorefun_list.Enabled:=true;
pmmorefun_info.Enabled:=true;
pmmorelock.Visible:=false;
pmmorerr.Visible:=false;
if (havewinrar=true) and (userar=1) then pmmorerecover.Visible:=true;
pmmorecomment.Visible:=false;
po_lock.Visible:=false;
po_rr.Visible:=false;
if (havewinrar=true) and (userar=1) then po_recover.Visible:=true;
po_comment.Visible:=false;
end;
end;

procedure advancedarchivebrowsermenus;
begin
with Form_peach do
begin
MenuItemOpen_ExtractHere.Visible:=true;
MenuItemOpen_test.Visible:=true;
MenuItemOpen_list.Visible:=true;
MenuItemOpen_preview.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;
pmmorelock.Visible:=false;
pmmorerr.Visible:=false;
pmmorerecover.Visible:=false;
pmmorecomment.Visible:=false;
po_lock.Visible:=false;
po_rr.Visible:=false;
po_recover.Visible:=false;
po_comment.Visible:=false;
end;
end;

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

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

procedure setbuttonmenus;
begin
with Form_peach do
begin
ButtonUn7zaTo.Enabled:=true;
set_extcontext_off;
ButtonUn7za1.Enabled:=false;
ButtonDelete.Enabled:=false;
ButtonUn7za4.Enabled:=false;
ButtonUn7za4.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;
sbBrowse.Visible:=false;
set_group_fm(false);
po_filetools.visible:=false;
MenuItem145.Visible:=false;
po_more.Visible:=false;
po_pdup.Visible:=false;
po_dedup.Visible:=false;
po_analyzefolders.Visible:=false;
pmfilebrowser.Visible:=false;
pmpanalyzefolders.Visible:=false;
pmpdup.Visible:=false;
pmcheck.Visible:=false;
Separator17.visible:=false;
po_im.visible:=false;
MenuItemOpen_preview.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
   ButtonUn7za1.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonDelete.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_tolayout;
   filebrowsermenus;
   sbBrowse.Visible:=true;
   end;
   'UN7Z':
   begin
   ButtonUn7za1.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonDelete.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   sbBrowse.Visible:=true;
   MenuItemOpen_info.Visible:=true;
   end;
   'UNARC':
   begin
   ButtonUn7za1.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonDelete.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   mForceSyncedits.Visible:=false;
   mForceSynceditsClear.Visible:=false;
   mForceClear.Visible:=false;
   MenuItem120.Visible:=false;
   end;
   'UNZPAQ':
   begin
   ButtonUn7za1.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_toarchive;
   end;
   'UNBROTLI': ButtonUn7za1.Enabled:=true;
   'UNZSTD': ButtonUn7za1.Enabled:=true;
   end;
ImageFlatadd.Enabled:=ButtonUn7za4.Enabled;
ImageFlatconvert.Enabled:=ButtonUn7za5.Enabled;
ImageFlatext.Enabled:=ButtonUn7zaTo.Enabled;
end;
end;

procedure prepare_filebrowser;
begin
setpanel_extract(1);
set_extcontext_off;
{$IFDEF MSWINDOWS}Form_peach.po_delete.Caption:=txt_quickdelete+' (Shift+Del)';{$ELSE}Form_peach.po_delete.Caption:=txt_quickdelete;{$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;

function drawlisticon(arow:integer):integer;
var
   fullname,fulltype:ansistring;
   pc:boolean;
begin
result:=5;
if (Form_peach.EditOpenIn.Text<>txt_mypc) then pc:=false
else pc:=true;
fullname:=Form_peach.StringGridList.Cells[12,arow];
fulltype:=Form_peach.StringGridList.Cells[2,arow];
if Form_peach.StringGridList.Cells[1,arow]<>'' then
   result:=geticon(fullname,fulltype,pc);
end;

function drawlisticon16(arow:integer):integer;
var
   fullname,fulltype,s:ansistring;
   pc:boolean;
begin
result:=5;
if (Form_peach.EditOpenIn.Text<>txt_mypc) then pc:=false
else pc:=true;
fullname:=Form_peach.StringGridList.Cells[12,arow];
fulltype:=lowercase(Form_peach.StringGridList.Cells[2,arow]);
if Form_peach.StringGridList.Cells[1,arow]<>'' then
   begin
if (fulltype=lowercase(txt_list_isfolder)) or (fulltype=' [folder]') then
begin
s:=fullname+directoryseparator;
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_myboxfiles) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_skydrive) or (s = shared_ubuntuone)then
   begin
   result:=44;
   exit;
   end;
end;
   result:=geticon(fullname,fulltype,pc);
   end;
end;

function drawtabicon(arow:integer):integer;
var
   s,s1,fulltype:ansistring;
   i:integer;
begin
result:=-1;
if arow>=Form_peach.StringGridSessionHistory.rowcount then exit;
s:=Form_peach.StringGridSessionHistory.Cells[2,arow];
if (s = txt_mypc) or (s = 'Computer''s root') then
   begin
   result:=32;
   exit;
   end;
if Form_peach.StringGridSessionHistory.Cells[1,arow] = txt_list_found then
      begin
      result:=29;
      exit;
      end;
if Form_peach.StringGridSessionHistory.Cells[1,arow] = txt_list_flat then
      begin
      result:=33;
      exit;
      end;
s1:=Form_peach.StringGridSessionHistory.Cells[3,arow];
if s1<>'' then
   s1:=s1[length(s1)];
if s1<>'*' then
      begin
      result:=34;
      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_myboxfiles) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_skydrive) or (s = shared_ubuntuone)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 set_organizebrowsermenu_sort(c:integer);
begin
Form_Peach.mbrowsercname.Checked:=false;
Form_Peach.mbrowserctype.Checked:=false;
Form_Peach.mbrowsercsize.Checked:=false;
Form_Peach.mbrowsercpacked.Checked:=false;
Form_Peach.mbrowsercdate.Checked:=false;
Form_Peach.mbrowserccreated.Checked:=false;
Form_Peach.mbrowsercaccessed.Checked:=false;
Form_Peach.mbrowsercmethod.Checked:=false;
Form_Peach.mbrowserccomment.Checked:=false;
Form_Peach.mbrowsercatt.Checked:=false;
Form_Peach.mbrowserccrc.Checked:=false;
Form_Peach.mbrowsercname.Caption:=Form_Peach.ListView1.Column[0].Caption;
Form_Peach.mbrowserctype.Caption:=Form_Peach.ListView1.Column[1].Caption;
Form_Peach.mbrowsercsize.Caption:=Form_Peach.ListView1.Column[2].Caption;
Form_Peach.mbrowsercpacked.Caption:=Form_Peach.ListView1.Column[3].Caption;
Form_Peach.mbrowsercdate.Caption:=Form_Peach.ListView1.Column[4].Caption;
Form_Peach.mbrowserccreated.Caption:=Form_Peach.ListView1.Column[5].Caption;
Form_Peach.mbrowsercaccessed.Caption:=Form_Peach.ListView1.Column[6].Caption;
Form_Peach.mbrowsercmethod.Caption:=Form_Peach.ListView1.Column[7].Caption;
Form_Peach.mbrowserccomment.Caption:=Form_Peach.ListView1.Column[8].Caption;
Form_Peach.mbrowsercatt.Caption:=Form_Peach.ListView1.Column[9].Caption;
Form_Peach.mbrowserccrc.Caption:=Form_Peach.ListView1.Column[10].Caption;
case c of
   0: begin Form_Peach.mbrowsercname.Checked:=true; end;
   1: begin Form_Peach.mbrowserctype.Checked:=true; end;
   2: begin Form_Peach.mbrowsercsize.Checked:=true; end;
   3: begin Form_Peach.mbrowsercpacked.Checked:=true; end;
   4: begin Form_Peach.mbrowsercdate.Checked:=true; end;
   5: begin Form_Peach.mbrowserccreated.Checked:=true; end;
   6: begin Form_Peach.mbrowsercaccessed.Checked:=true; end;
   7: begin Form_Peach.mbrowsercmethod.Checked:=true; end;
   8: begin Form_Peach.mbrowserccomment.Checked:=true; end;
   9: begin Form_Peach.mbrowsercatt.Checked:=true; end;
   10: begin Form_Peach.mbrowserccrc.Checked:=true; end;
   end;
Form_Peach.po_browsercname.Checked:=Form_Peach.mbrowsercname.Checked;
Form_Peach.po_browserctype.Checked:=Form_Peach.mbrowserctype.Checked;
Form_Peach.po_browsercsize.Checked:=Form_Peach.mbrowsercsize.Checked;
Form_Peach.po_browsercpacked.Checked:=Form_Peach.mbrowsercpacked.Checked;
Form_Peach.po_browsercdate.Checked:=Form_Peach.mbrowsercdate.Checked;
Form_Peach.po_browserccreated.Checked:=Form_Peach.mbrowserccreated.Checked;
Form_Peach.po_browsercaccessed.Checked:=Form_Peach.mbrowsercaccessed.Checked;
Form_Peach.po_browsercmethod.Checked:=Form_Peach.mbrowsercmethod.Checked;
Form_Peach.po_browserccomment.Checked:=Form_Peach.mbrowserccomment.Checked;
Form_Peach.po_browsercatt.Checked:=Form_Peach.mbrowsercatt.Checked;
Form_Peach.po_browserccrc.Checked:=Form_Peach.mbrowserccrc.Checked;
Form_Peach.po_browsercname.Caption:=Form_Peach.mbrowsercname.Caption;
Form_Peach.po_browserctype.Caption:=Form_Peach.mbrowserctype.Caption;
Form_Peach.po_browsercsize.Caption:=Form_Peach.mbrowsercsize.Caption;
Form_Peach.po_browsercpacked.Caption:=Form_Peach.mbrowsercpacked.Caption;
Form_Peach.po_browsercdate.Caption:=Form_Peach.mbrowsercdate.Caption;
Form_Peach.po_browserccreated.Caption:=Form_Peach.mbrowserccreated.Caption;
Form_Peach.po_browsercaccessed.Caption:=Form_Peach.mbrowsercaccessed.Caption;
Form_Peach.po_browsercmethod.Caption:=Form_Peach.mbrowsercmethod.Caption;
Form_Peach.po_browserccomment.Caption:=Form_Peach.mbrowserccomment.Caption;
Form_Peach.po_browsercatt.Caption:=Form_Peach.mbrowsercatt.Caption;
Form_Peach.po_browserccrc.Caption:=Form_Peach.mbrowserccrc.Caption;
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:='';
with Form_peach 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 Form_peach.PanelArchiveMain.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 Form_peach.CheckBoxTarBefore.State=cbChecked then else exit;
   end;

if Form_peach.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 (form_peach.CheckBoxrelative.Checked=true) and (form_peach.CheckBoxrelative.Enabled=true) then
      else exit;
      end;
   else exit;
   end;

//if Form_peach.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 Form_peach 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 Form_peach 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;
Form_peach.LabelStatusdisplayed.Hint:=statushint;
Form_peach.LabelStatus.Hint:=statushint;
Form_peach.LabelClipinfo.Caption:=count_clipboard;
Form_peach.LabelStatusClip.Caption:=Form_peach.LabelClipinfo.Caption;
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;
Form_Peach.po_checksum.Caption:=txt_check_select+' ('+chstr+')';
Form_Peach.pmccrc.Caption:=chstr;
Form_Peach.pmcheck.Caption:=txt_check_select+' ('+chstr+')';
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   Form_Peach.ListView1.Column[0].Caption:=txt_name;
   Form_Peach.ListView1.Column[1].Caption:=txt_type;
   Form_Peach.ListView1.Column[2].Caption:=txt_size;
   Form_Peach.ListView1.Column[3].Caption:=txt_free;
   Form_Peach.ListView1.Column[4].Caption:=txt_fs;
   Form_Peach.ListView1.Column[9].Caption:=txt_attributes;
   Form_Peach.ListView1.Column[10].Caption:=txt_check_select;
   Form_Peach.ListView1.Column[11].Caption:=txt_name_full;
   end
else
   begin
   Form_Peach.ListView1.Column[0].Caption:=txt_name;
   Form_Peach.ListView1.Column[1].Caption:=txt_type;
   Form_Peach.ListView1.Column[2].Caption:=txt_size;
   if fun<>'FILEBROWSER' then Form_Peach.ListView1.Column[3].Caption:=txt_compressed_size else Form_Peach.ListView1.Column[3].Caption:=txt_info;
   Form_Peach.ListView1.Column[4].Caption:=txt_8_2_tm;
   Form_Peach.ListView1.Column[5].Caption:=txt_8_2_tc;
   Form_Peach.ListView1.Column[6].Caption:=txt_8_2_ta;
   Form_Peach.ListView1.Column[7].Caption:=txt_method;
   Form_Peach.ListView1.Column[8].Caption:=txt_7_4_comment;
   Form_Peach.ListView1.Column[9].Caption:=txt_attributes;
   if fun<>'FILEBROWSER' then Form_Peach.ListView1.Column[10].Caption:=txt_check_select else Form_Peach.ListView1.Column[10].Caption:=chstr;
   Form_Peach.ListView1.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 az=true then Form_Peach.ListView1.Column[c].Caption:=Form_Peach.ListView1.Column[c].Caption+' <'
   else Form_Peach.ListView1.Column[c].Caption:=Form_Peach.ListView1.Column[c].Caption+' >';
sortstatusstring:=Form_Peach.ListView1.Column[c].Caption;
if status0<>txt_list_browsing then
   Form_peach.LabelStatusdisplayed.Caption:=status0+' '+status1
else
   Form_peach.LabelStatusdisplayed.Caption:=status1;
set_statuss_nav;
set_organizebrowsermenu_sort(c);
end;

procedure set_listview_visiblecol;
begin
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   if ctype=false then begin Form_Peach.ListView1.Column[1].Width:=0; end;
   if csize=false then begin Form_Peach.ListView1.Column[2].Width:=0; end;
   if cfree=false then begin Form_Peach.ListView1.Column[3].Width:=0; end;
   if cfs=false then begin Form_Peach.ListView1.Column[4].Width:=0; end;
   Form_Peach.ListView1.Column[5].Width:=0;
   Form_Peach.ListView1.Column[6].Width:=0;
   Form_Peach.ListView1.Column[7].Width:=0;
   Form_Peach.ListView1.Column[8].Width:=0;
   Form_Peach.ListView1.Column[9].Width:=0;
   end
else
   begin
   if ctype=false then begin Form_Peach.ListView1.Column[1].Width:=0; end;
   if csize=false then begin Form_Peach.ListView1.Column[2].Width:=0; end;
   if cpacked=false then begin Form_Peach.ListView1.Column[3].Width:=0; end;
   if cdate=false then begin Form_Peach.ListView1.Column[4].Width:=0; end;
   if catt=false then begin Form_Peach.ListView1.Column[9].Width:=0; end;
   if ccrc=false then begin Form_Peach.ListView1.Column[10].Width:=0; end;
   if fun<>'UN7Z' then
      begin
      Form_Peach.ListView1.Column[5].Width:=0;
      Form_Peach.ListView1.Column[6].Width:=0;
      Form_Peach.ListView1.Column[7].Width:=0;
      Form_peach.mccreated.Enabled:=False;
      Form_peach.mcaccessed.Enabled:=False;
      Form_peach.mcmethod.Enabled:=False;
      Form_peach.mccomment.Enabled:=False;
      Form_peach.pmccreated.Enabled:=False;
      Form_peach.pmcaccessed.Enabled:=False;
      Form_peach.pmcmethod.Enabled:=False;
      Form_peach.pmccomment.Enabled:=False;
      end
   else
      begin
      if ccreated=false then begin Form_Peach.ListView1.Column[5].Width:=0; end;
      if caccessed=false then begin Form_Peach.ListView1.Column[6].Width:=0; end;
      if cmethod=false then begin Form_Peach.ListView1.Column[7].Width:=0; end;
      if ccomment=false then begin Form_Peach.ListView1.Column[8].Width:=0; end;
      Form_peach.mccreated.Enabled:=True;
      Form_peach.mcaccessed.Enabled:=True;
      Form_peach.mcmethod.Enabled:=True;
      Form_peach.mccomment.Enabled:=True;
      Form_peach.pmccreated.Enabled:=True;
      Form_peach.pmcaccessed.Enabled:=True;
      Form_peach.pmcmethod.Enabled:=True;
      Form_peach.pmccomment.Enabled:=True;
      end;
   end;
end;

procedure set_listview_col;
begin
set_listview_cnames;
if browsertype=0 then
begin
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   Form_Peach.ListView1.Column[0].Width:=COL1D;
   Form_Peach.ListView1.Column[1].Width:=COL7D;
   Form_Peach.ListView1.Column[2].Width:=COL2D;
   Form_Peach.ListView1.Column[3].Width:=COL2D;
   Form_Peach.ListView1.Column[4].Width:=COL5D;
   Form_Peach.ListView1.Column[5].Width:=0;
   Form_Peach.ListView1.Column[6].Width:=0;
   Form_Peach.ListView1.Column[7].Width:=0;
   Form_Peach.ListView1.Column[8].Width:=0;
   Form_Peach.ListView1.Column[9].Width:=0;
   Form_Peach.ListView1.Column[10].Width:=0;
   Form_Peach.ListView1.Column[11].Width:=0;
   end
else
   begin
   if fun<>'UN7Z' then
      begin
      Form_Peach.ListView1.Column[0].Width:=col1size;
      Form_Peach.ListView1.Column[1].Width:=col2size;
      Form_Peach.ListView1.Column[2].Width:=col3size;
      Form_Peach.ListView1.Column[3].Width:=col4size;
      Form_Peach.ListView1.Column[4].Width:=col5size;
      Form_Peach.ListView1.Column[5].Width:=0;
      Form_Peach.ListView1.Column[6].Width:=0;
      Form_Peach.ListView1.Column[7].Width:=0;
      Form_Peach.ListView1.Column[8].Width:=0;
      Form_Peach.ListView1.Column[9].Width:=col6size;
      Form_Peach.ListView1.Column[10].Width:=col7size;
      end
   else
      begin
      Form_Peach.ListView1.Column[0].Width:=col1size;
      Form_Peach.ListView1.Column[1].Width:=col2size;
      Form_Peach.ListView1.Column[2].Width:=col3size;
      Form_Peach.ListView1.Column[3].Width:=col4size;
      Form_Peach.ListView1.Column[4].Width:=col5size;
      Form_Peach.ListView1.Column[5].Width:=col5size;
      Form_Peach.ListView1.Column[6].Width:=col5size;
      Form_Peach.ListView1.Column[7].Width:=colmethodsize;
      Form_Peach.ListView1.Column[8].Width:=colcommentsize;
      Form_Peach.ListView1.Column[9].Width:=col6size;
      Form_Peach.ListView1.Column[10].Width:=col7size;
      end;
   {$IFDEF MSWINDOWS}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[11].Width:=0
   else Form_Peach.ListView1.Column[11].Width:=384;
   {$ELSE}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[11].Visible:=false
   else begin Form_Peach.ListView1.Column[11].Visible:=true; Form_Peach.ListView1.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
Form_Peach.ListView1.Column[1].Width:=0;
Form_Peach.ListView1.Column[2].Width:=0;
Form_Peach.ListView1.Column[3].Width:=0;
Form_Peach.ListView1.Column[4].Width:=0;
Form_Peach.ListView1.Column[5].Width:=0;
Form_Peach.ListView1.Column[6].Width:=0;
Form_Peach.ListView1.Column[7].Width:=0;
Form_Peach.ListView1.Column[8].Width:=0;
Form_Peach.ListView1.Column[9].Width:=0;
Form_Peach.ListView1.Column[10].Width:=0;
Form_Peach.ListView1.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:=Form_peach.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;
Form_peach.Caption:=stitle1+' '+stitle2;
if statusr=txt_list_found then status0:=statusr;
with Form_peach do
begin
if pathistmp(EditOpenIn.Text)=true then
   begin
   Form_peach.ShapeAddress.Brush.Color:=StringToColor(colalert);
   Form_peach.Bevel20.Pen.Color:=StringToColor(colalert);
   Form_peach.Bevel20.Brush.Color:=StringToColor(colalert);
   end
else
   case altaddressstyle of
      3: begin
         Form_peach.ShapeAddress.Brush.Color:=Form_peach.Color;
         Form_peach.Bevel20.Pen.Color:=pvvvlblue;
         Form_peach.Bevel20.Brush.Color:=Form_peach.Color;
         end;
      0: begin
         Form_peach.ShapeAddress.Brush.Color:=Form_peach.Color;
         Form_peach.Bevel20.Pen.Color:=StringToColor(colmid);
         Form_peach.Bevel20.Brush.Color:=Form_peach.Color;
         end;
      1: begin
         Form_peach.ShapeAddress.Brush.Color:=StringToColor(collow);
         Form_peach.Bevel20.Pen.Color:=StringToColor(collow);
         Form_peach.Bevel20.Brush.Color:=StringToColor(collow);
         end;
      2:
         begin
         Form_peach.ShapeAddress.Brush.Color:=pvvvlblue;
         Form_peach.Bevel20.Pen.Color:=pvvvlblue;
         Form_peach.Bevel20.Brush.Color:=pvvvlblue;
         end;
      end;

Panelclickaddress.Color:=ShapeAddress.Brush.Color;
ShapeAddress.Color:=Panelclickaddress.Color;
EditOpenIn.Color:=ShapeAddress.Brush.Color;
EditOpenIn1.Color:=ShapeAddress.Brush.Color;
Panel11.Color:=ShapeAddress.Brush.Color;
if altbread=1 then
   begin
   Panel8.Color:=PanelListBar.Brush.Color;
   PanelSearch.Color:=PanelListBar.Brush.Color;
   EditUn7zafilter.Color:=PanelListBar.Brush.Color;
   EditUn7zafilter1.Color:=PanelListBar.Brush.Color;
   Panel9.Color:=PanelListBar.Brush.Color;
   end
else
   begin
   Panel8.Color:=ShapeAddress.Brush.Color;
   PanelSearch.Color:=ShapeAddress.Brush.Color;
   EditUn7zafilter.Color:=ShapeAddress.Brush.Color;
   EditUn7zafilter1.Color:=ShapeAddress.Brush.Color;
   Panel9.Color:=ShapeAddress.Brush.Color;
   end;
PanelAddress0.Color:=ShapeAddress.Brush.Color;
PanelAddress1.Color:=ShapeAddress.Brush.Color;
PanelAddress2.Color:=ShapeAddress.Brush.Color;
PanelAddress3.Color:=ShapeAddress.Brush.Color;
PanelAddress4.Color:=ShapeAddress.Brush.Color;
PanelAddress5.Color:=ShapeAddress.Brush.Color;
PanelAddress6.Color:=ShapeAddress.Brush.Color;
PanelAddress7.Color:=ShapeAddress.Brush.Color;
PanelAdArchive4.Color:=ShapeAddress.Brush.Color;
if altbread>0 then
   begin
   PanelAdArchive0.Color:=ShapeAddress.Brush.Color;
   PanelAdArchive1.Color:=ShapeAddress.Brush.Color;
   PanelAdArchive2.Color:=ShapeAddress.Brush.Color;
   PanelAdArchive3.Color:=ShapeAddress.Brush.Color;
   end
else
   begin
   PanelAdArchive0.Color:=abarchivecol;
   PanelAdArchive1.Color:=abarchivecol;
   PanelAdArchive2.Color:=abarchivecol;
   PanelAdArchive3.Color:=abarchivecol;
   end;
PanelLCA1.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA2.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA3.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA4.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA5.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA6.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA7.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA8.Brush.Color:=ShapeAddress.Brush.Color;
PanelLCA1.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA2.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA3.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA4.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA5.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA6.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA7.Pen.Color:=ShapeAddress.Brush.Color;
PanelLCA8.Pen.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa1.Brush.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa2.Brush.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa3.Brush.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa4.Brush.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa1.pen.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa2.pen.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa3.pen.Color:=ShapeAddress.Brush.Color;
Form_peach.PanelLCAa4.pen.Color:=ShapeAddress.Brush.Color;
{$IFDEF MSWINDOWS}
if Form_peach.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:=Form_peach.Stringgridlist.Rowcount;
selfolders:=0;
selfiles:=0;
selsize:=0;
selcsize:=0;
selper:=0;
if Form_peach.EditOpenIn.Text<>txt_mypc then
   if rc>1 then
      for i:=1 to rc-1 do
         if Form_peach.StringGridList.Cells[16,i]='1' then
            begin
            if Form_peach.StringGridList.Cells[1,i]='' then Break;
            if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then selfiles:=selfiles+1
            else selfolders:=selfolders+1;
            try
            if Form_peach.StringGridList.Cells[3,i]<>'' then selsize:=selsize+strtoqword(Form_peach.StringGridList.Cells[3,i]);
            if Form_peach.StringGridList.Cells[4,i]<>'' then selcsize:=selcsize+strtoqword(Form_peach.StringGridList.Cells[4,i]);
            except
            end;
            end;
Form_peach.LabelStatus.Caption:=txt_2_9_selected+' '+inttostr(selfolders)+' '+txt_dirs+' '+inttostr(selfiles)+' '+txt_files+' '+nicenumber(inttostr(selsize),filesizebase);
if selcsize<>0 then Form_peach.LabelStatus.Caption:=Form_peach.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 Form_peach.LabelStatus.Caption:=Form_peach.LabelStatus.Caption+' ('+inttostr(selper)+'%)';
if (selfolders=0) and (selfiles=0) then Form_peach.LabelStatus.Caption:='';
end;

procedure update_addressbar(apath:ansistring);
var
  Str: TStringList;
  i, j, sc, brcsz: integer;
  s: array [1..8] of ansistring;
begin
Form_peach.PanelLCA1.Visible:=true;
Form_peach.PanelLCA2.Visible:=true;
Form_peach.PanelLCA3.Visible:=true;
Form_peach.PanelLCA4.Visible:=true;
Form_peach.PanelLCA5.Visible:=true;
Form_peach.PanelLCA6.Visible:=true;
Form_peach.PanelLCA7.Visible:=true;
{$IFDEF MSWINDOWS}
if apath=txt_mypc then
   begin
   Form_peach.LabelClickAddress1.Caption:=' '+txt_mypc+' ';
   Form_peach.LabelClickAddress2.Caption:='';
   Form_peach.LabelClickAddress3.Caption:='';
   Form_peach.LabelClickAddress4.Caption:='';
   Form_peach.LabelClickAddress5.Caption:='';
   Form_peach.LabelClickAddress6.Caption:='';
   Form_peach.LabelClickAddress7.Caption:='';
   Form_peach.LabelClickAddress8.Caption:='';
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.ImageAddress5.Visible:=false;
   Form_peach.ImageAddress6.Visible:=false;
   Form_peach.ImageAddress7.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.PanelAddress4.Visible:=false;
   Form_peach.PanelAddress5.Visible:=false;
   Form_peach.PanelAddress6.Visible:=false;
   Form_peach.PanelAddress7.Visible:=false;
   Form_peach.pmbc1.visible:=false;
   Form_peach.pmbc2.visible:=false;
   Form_peach.pmbc3.visible:=false;
   Form_peach.pmbc4.visible:=false;
   Form_peach.pmbc5.visible:=false;
   Form_peach.pmbc6.visible:=false;
   Form_peach.pmbc7.visible:=false;
   Form_peach.pmbc8.visible:=false;
   Form_peach.pmnavbc1.visible:=false;
   Form_peach.pmnavbc2.visible:=false;
   Form_peach.pmnavbc3.visible:=false;
   Form_peach.pmnavbc4.visible:=false;
   Form_peach.pmnavbc5.visible:=false;
   Form_peach.pmnavbc6.visible:=false;
   Form_peach.pmnavbc7.visible:=false;
   Form_peach.pmnavbc8.visible:=false;
   Form_peach.mbc1.visible:=false;
   Form_peach.mbc2.visible:=false;
   Form_peach.mbc3.visible:=false;
   Form_peach.mbc4.visible:=false;
   Form_peach.mbc5.visible:=false;
   Form_peach.mbc6.visible:=false;
   Form_peach.mbc7.visible:=false;
   Form_peach.mbc8.visible:=false;
   Form_peach.pnabc1.visible:=false;
   Form_peach.pnabc2.visible:=false;
   Form_peach.pnabc3.visible:=false;
   Form_peach.pnabc4.visible:=false;
   Form_peach.pnabc5.visible:=false;
   Form_peach.pnabc6.visible:=false;
   Form_peach.pnabc7.visible:=false;
   Form_peach.pnabc8.visible:=false;
   Form_peach.pnbc1.visible:=false;
   Form_peach.pnbc2.visible:=false;
   Form_peach.pnbc3.visible:=false;
   Form_peach.pnbc4.visible:=false;
   Form_peach.pnbc5.visible:=false;
   Form_peach.pnbc6.visible:=false;
   Form_peach.pnbc7.visible:=false;
   Form_peach.pnbc8.visible:=false;
   Form_peach.pnbcf1.visible:=false;
   Form_peach.pnbcf2.visible:=false;
   Form_peach.pnbcf3.visible:=false;
   Form_peach.pnbcf4.visible:=false;
   Form_peach.pnbcf5.visible:=false;
   Form_peach.pnbcf6.visible:=false;
   Form_peach.pnbcf7.visible:=false;
   Form_peach.pnbcf8.visible:=false;
   Form_peach.pnbce1.visible:=false;
   Form_peach.pnbce2.visible:=false;
   Form_peach.pnbce3.visible:=false;
   Form_peach.pnbce4.visible:=false;
   Form_peach.pnbce5.visible:=false;
   Form_peach.pnbce6.visible:=false;
   Form_peach.pnbce7.visible:=false;
   Form_peach.pnbce8.visible:=false;
   if altbread>0 then
      begin
      Form_peach.ImageAddress0.Visible:=false;
      Form_peach.ImageAddress1.Visible:=false;
      Form_peach.ImageAddress2.Visible:=false;
      Form_peach.ImageAddress3.Visible:=false;
      Form_peach.ImageAddress4.Visible:=false;
      Form_peach.ImageAddress5.Visible:=false;
      Form_peach.ImageAddress6.Visible:=false;
      Form_peach.ImageAddress7.Visible:=false;
      Form_peach.LabelClickAddress1.Font.Style:=[fsBold]; application.ProcessMessages;
      Form_peach.PanelAdArchive4.AnchorSideLeft.Control:=Form_peach.LabelClickAddress1;
      Form_peach.PanelClickAddress.Width:=Form_peach.PanelAdArchive4.left+Form_peach.PanelAdArchive4.Width;
      Form_peach.bevel20.Width:=Form_peach.PanelClickAddress.Width+Form_peach.Panel11.Width+8;
      end;
   exit;
   end;
{$ENDIF}
if not directoryexists(apath) then
   if not fileexists(apath) then exit;
clean_archive_breadcrumb;
if macbread=1 then Form_peach.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)]+' ';
Form_peach.LabelClickAddress1.Caption:=s[1];
Form_peach.LabelClickAddress2.Caption:=s[2];
if s[1]='' then
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.LabelClickAddress2.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress2.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress1.Visible:=true;
   Form_peach.PanelAddress1.Visible:=true;
   Form_peach.LabelClickAddress2.AnchorSideLeft.Control:=Form_peach.PanelAddress1;
   Form_peach.LabelClickAddress2.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAddress3.Caption:=s[3];
if s[2]='' then
   begin
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.LabelClickAddress3.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress3.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress2.Visible:=true;
   Form_peach.PanelAddress2.Visible:=true;
   Form_peach.LabelClickAddress3.AnchorSideLeft.Control:=Form_peach.PanelAddress2;
   Form_peach.LabelClickAddress3.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAddress4.Caption:=s[4];
if s[3]='' then
   begin
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.LabelClickAddress4.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress4.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress3.Visible:=true;
   Form_peach.PanelAddress3.Visible:=true;
   Form_peach.LabelClickAddress4.AnchorSideLeft.Control:=Form_peach.PanelAddress3;
   Form_peach.LabelClickAddress4.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAddress5.Caption:=s[5];
if s[4]='' then
   begin
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.PanelAddress4.Visible:=false;
   Form_peach.LabelClickAddress5.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress5.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress4.Visible:=true;
   Form_peach.PanelAddress4.Visible:=true;
   Form_peach.LabelClickAddress5.AnchorSideLeft.Control:=Form_peach.PanelAddress4;
   Form_peach.LabelClickAddress5.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAddress6.Caption:=s[6];
if s[5]='' then
   begin
   Form_peach.ImageAddress5.Visible:=false;
   Form_peach.PanelAddress5.Visible:=false;
   Form_peach.LabelClickAddress6.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress6.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress5.Visible:=true;
   Form_peach.PanelAddress5.Visible:=true;
   Form_peach.LabelClickAddress6.AnchorSideLeft.Control:=Form_peach.PanelAddress5;
   Form_peach.LabelClickAddress6.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAddress7.Caption:=s[7];
if s[6]='' then
   begin
   Form_peach.ImageAddress6.Visible:=false;
   Form_peach.PanelAddress6.Visible:=false;
   Form_peach.LabelClickAddress7.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress7.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress6.Visible:=true;
   Form_peach.PanelAddress6.Visible:=true;
   Form_peach.LabelClickAddress7.AnchorSideLeft.Control:=Form_peach.PanelAddress6;
   Form_peach.LabelClickAddress7.AnchorSideLeft.Side:=asrRight;
   end;
Form_peach.LabelClickAddress8.Caption:=s[8];
if s[7]='' then
   begin
   Form_peach.ImageAddress7.Visible:=false;
   Form_peach.PanelAddress7.Visible:=false;
   Form_peach.LabelClickAddress8.AnchorSideLeft.Control:=Form_peach.PanelAddress0;
   Form_peach.LabelClickAddress8.AnchorSideLeft.Side:=asrRight;
   end
else
   begin
   Form_peach.ImageAddress7.Visible:=true;
   Form_peach.PanelAddress7.Visible:=true;
   Form_peach.LabelClickAddress8.AnchorSideLeft.Control:=Form_peach.PanelAddress7;
   Form_peach.LabelClickAddress8.AnchorSideLeft.Side:=asrRight;
   end;

Form_peach.LabelClickAddress1.Visible:=true;
Form_peach.LabelClickAddress2.Visible:=true;
Form_peach.LabelClickAddress3.Visible:=true;
Form_peach.LabelClickAddress4.Visible:=true;
Form_peach.LabelClickAddress5.Visible:=true;
brcsz:=0;
if (Form_peach.width<(1300*qscale) div 100) then brcsz:=5;
if (Form_peach.width<(1200*qscale) div 100) then brcsz:=4;
if (Form_peach.width<(1100*qscale) div 100) then brcsz:=3;
if (Form_peach.width<(1000*qscale) div 100) then brcsz:=2;
if (Form_peach.width<(900*qscale) div 100) then brcsz:=1;
if macbread=1 then brcsz:=0;
case brcsz of
   0:
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.LabelClickAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.LabelClickAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.LabelClickAddress3.Visible:=false;
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.PanelAddress4.Visible:=false;
   Form_peach.LabelClickAddress4.Visible:=false;
   Form_peach.ImageAddress5.Visible:=false;
   Form_peach.PanelAddress5.Visible:=false;
   Form_peach.LabelClickAddress5.Visible:=false;
   Form_peach.ImageAddress6.Visible:=false;
   Form_peach.PanelAddress6.Visible:=false;
   Form_peach.LabelClickAddress6.Visible:=false;
   Form_peach.ImageAddress7.Visible:=false;
   Form_peach.PanelAddress7.Visible:=false;
   Form_peach.LabelClickAddress7.Visible:=false;
   end;
   1:
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.LabelClickAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.LabelClickAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.LabelClickAddress3.Visible:=false;
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.PanelAddress4.Visible:=false;
   Form_peach.LabelClickAddress4.Visible:=false;
   Form_peach.ImageAddress5.Visible:=false;
   Form_peach.PanelAddress5.Visible:=false;
   Form_peach.LabelClickAddress5.Visible:=false;
   end;
   2:
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.LabelClickAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.LabelClickAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.LabelClickAddress3.Visible:=false;
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.PanelAddress4.Visible:=false;
   Form_peach.LabelClickAddress4.Visible:=false;
   end;
   3:
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.LabelClickAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.LabelClickAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.PanelAddress3.Visible:=false;
   Form_peach.LabelClickAddress3.Visible:=false;
   end;
   4:
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.LabelClickAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.PanelAddress2.Visible:=false;
   Form_peach.LabelClickAddress2.Visible:=false;
   end;
   5:
   begin
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.PanelAddress1.Visible:=false;
   Form_peach.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 Form_peach.pmbc8.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc8.caption:=s[1];{$ELSE}Form_peach.pmbc8.caption:=DirectorySeparator+s[1];{$ENDIF} Form_peach.pmbc8.Bitmap:=drawmenuicon(Form_peach.pmbc8.Caption); end else Form_peach.pmbc8.visible:=false;
if s[2] <> '' then begin Form_peach.pmbc7.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc7.caption:=s[2];{$ELSE}Form_peach.pmbc7.caption:=DirectorySeparator+s[2];{$ENDIF} Form_peach.pmbc7.Bitmap:=drawmenuicon(Form_peach.pmbc7.Caption); end else Form_peach.pmbc7.visible:=false;
if s[3] <> '' then begin Form_peach.pmbc6.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc6.caption:=s[3];{$ELSE}Form_peach.pmbc6.caption:=DirectorySeparator+s[3];{$ENDIF} Form_peach.pmbc6.Bitmap:=drawmenuicon(Form_peach.pmbc6.Caption); end else Form_peach.pmbc6.visible:=false;
if s[4] <> '' then begin Form_peach.pmbc5.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc5.caption:=s[4];{$ELSE}Form_peach.pmbc5.caption:=DirectorySeparator+s[4];{$ENDIF} Form_peach.pmbc5.Bitmap:=drawmenuicon(Form_peach.pmbc5.Caption); end else Form_peach.pmbc5.visible:=false;
if s[5] <> '' then begin Form_peach.pmbc4.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc4.caption:=s[5];{$ELSE}Form_peach.pmbc4.caption:=DirectorySeparator+s[5];{$ENDIF} Form_peach.pmbc4.Bitmap:=drawmenuicon(Form_peach.pmbc4.Caption); end else Form_peach.pmbc4.visible:=false;
if s[6] <> '' then begin Form_peach.pmbc3.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc3.caption:=s[6];{$ELSE}Form_peach.pmbc3.caption:=DirectorySeparator+s[6];{$ENDIF} Form_peach.pmbc3.Bitmap:=drawmenuicon(Form_peach.pmbc3.Caption); end else Form_peach.pmbc3.visible:=false;
if s[7] <> '' then begin Form_peach.pmbc2.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc2.caption:=s[7];{$ELSE}Form_peach.pmbc2.caption:=DirectorySeparator+s[7];{$ENDIF} Form_peach.pmbc2.Bitmap:=drawmenuicon(Form_peach.pmbc2.Caption); end else Form_peach.pmbc2.visible:=false;
if s[8] <> '' then begin Form_peach.pmbc1.visible:=true; {$IFDEF MSWINDOWS}Form_peach.pmbc1.caption:=s[8];{$ELSE}Form_peach.pmbc1.caption:=DirectorySeparator+s[8];{$ENDIF} Form_peach.pmbc1.Bitmap:=drawmenuicon(Form_peach.pmbc1.Caption); end else Form_peach.pmbc1.visible:=false;
str.Free;
Form_peach.pmnavbc1.visible:=Form_peach.pmbc1.visible;
Form_peach.pmnavbc2.visible:=Form_peach.pmbc2.visible;
Form_peach.pmnavbc3.visible:=Form_peach.pmbc3.visible;
Form_peach.pmnavbc4.visible:=Form_peach.pmbc4.visible;
Form_peach.pmnavbc5.visible:=Form_peach.pmbc5.visible;
Form_peach.pmnavbc6.visible:=Form_peach.pmbc6.visible;
Form_peach.pmnavbc7.visible:=Form_peach.pmbc7.visible;
Form_peach.pmnavbc8.visible:=Form_peach.pmbc8.visible;
Form_peach.pmnavbc1.caption:=Form_peach.pmbc1.caption;
Form_peach.pmnavbc2.caption:=Form_peach.pmbc2.caption;
Form_peach.pmnavbc3.caption:=Form_peach.pmbc3.caption;
Form_peach.pmnavbc4.caption:=Form_peach.pmbc4.caption;
Form_peach.pmnavbc5.caption:=Form_peach.pmbc5.caption;
Form_peach.pmnavbc6.caption:=Form_peach.pmbc6.caption;
Form_peach.pmnavbc7.caption:=Form_peach.pmbc7.caption;
Form_peach.pmnavbc8.caption:=Form_peach.pmbc8.caption;
Form_peach.pmnavbc1.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.pmnavbc2.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.pmnavbc3.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.pmnavbc4.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.pmnavbc5.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.pmnavbc6.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.pmnavbc7.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.pmnavbc8.bitmap:=Form_peach.pmbc8.bitmap;
Form_peach.mbc1.visible:=Form_peach.pmbc1.visible;
Form_peach.mbc2.visible:=Form_peach.pmbc2.visible;
Form_peach.mbc3.visible:=Form_peach.pmbc3.visible;
Form_peach.mbc4.visible:=Form_peach.pmbc4.visible;
Form_peach.mbc5.visible:=Form_peach.pmbc5.visible;
Form_peach.mbc6.visible:=Form_peach.pmbc6.visible;
Form_peach.mbc7.visible:=Form_peach.pmbc7.visible;
Form_peach.mbc8.visible:=Form_peach.pmbc8.visible;
Form_peach.mbc1.caption:=Form_peach.pmbc1.caption;
Form_peach.mbc2.caption:=Form_peach.pmbc2.caption;
Form_peach.mbc3.caption:=Form_peach.pmbc3.caption;
Form_peach.mbc4.caption:=Form_peach.pmbc4.caption;
Form_peach.mbc5.caption:=Form_peach.pmbc5.caption;
Form_peach.mbc6.caption:=Form_peach.pmbc6.caption;
Form_peach.mbc7.caption:=Form_peach.pmbc7.caption;
Form_peach.mbc8.caption:=Form_peach.pmbc8.caption;
Form_peach.mbc1.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.mbc2.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.mbc3.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.mbc4.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.mbc5.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.mbc6.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.mbc7.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.mbc8.bitmap:=Form_peach.pmbc8.bitmap;
Form_peach.pnabc1.visible:=Form_peach.pmbc1.visible;
Form_peach.pnabc2.visible:=Form_peach.pmbc2.visible;
Form_peach.pnabc3.visible:=Form_peach.pmbc3.visible;
Form_peach.pnabc4.visible:=Form_peach.pmbc4.visible;
Form_peach.pnabc5.visible:=Form_peach.pmbc5.visible;
Form_peach.pnabc6.visible:=Form_peach.pmbc6.visible;
Form_peach.pnabc7.visible:=Form_peach.pmbc7.visible;
Form_peach.pnabc8.visible:=Form_peach.pmbc8.visible;
Form_peach.pnabc1.caption:=Form_peach.pmbc1.caption;
Form_peach.pnabc2.caption:=Form_peach.pmbc2.caption;
Form_peach.pnabc3.caption:=Form_peach.pmbc3.caption;
Form_peach.pnabc4.caption:=Form_peach.pmbc4.caption;
Form_peach.pnabc5.caption:=Form_peach.pmbc5.caption;
Form_peach.pnabc6.caption:=Form_peach.pmbc6.caption;
Form_peach.pnabc7.caption:=Form_peach.pmbc7.caption;
Form_peach.pnabc8.caption:=Form_peach.pmbc8.caption;
Form_peach.pnabc1.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.pnabc2.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.pnabc3.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.pnabc4.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.pnabc5.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.pnabc6.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.pnabc7.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.pnabc8.bitmap:=Form_peach.pmbc8.bitmap;
Form_peach.pnbc1.visible:=Form_peach.pmbc1.visible;
Form_peach.pnbc2.visible:=Form_peach.pmbc2.visible;
Form_peach.pnbc3.visible:=Form_peach.pmbc3.visible;
Form_peach.pnbc4.visible:=Form_peach.pmbc4.visible;
Form_peach.pnbc5.visible:=Form_peach.pmbc5.visible;
Form_peach.pnbc6.visible:=Form_peach.pmbc6.visible;
Form_peach.pnbc7.visible:=Form_peach.pmbc7.visible;
Form_peach.pnbc8.visible:=Form_peach.pmbc8.visible;
Form_peach.pnbc1.caption:=Form_peach.pmbc1.caption;
Form_peach.pnbc2.caption:=Form_peach.pmbc2.caption;
Form_peach.pnbc3.caption:=Form_peach.pmbc3.caption;
Form_peach.pnbc4.caption:=Form_peach.pmbc4.caption;
Form_peach.pnbc5.caption:=Form_peach.pmbc5.caption;
Form_peach.pnbc6.caption:=Form_peach.pmbc6.caption;
Form_peach.pnbc7.caption:=Form_peach.pmbc7.caption;
Form_peach.pnbc8.caption:=Form_peach.pmbc8.caption;
Form_peach.pnbc1.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.pnbc2.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.pnbc3.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.pnbc4.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.pnbc5.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.pnbc6.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.pnbc7.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.pnbc8.bitmap:=Form_peach.pmbc8.bitmap;
Form_peach.pnbcf1.visible:=Form_peach.pmbc1.visible;
Form_peach.pnbcf2.visible:=Form_peach.pmbc2.visible;
Form_peach.pnbcf3.visible:=Form_peach.pmbc3.visible;
Form_peach.pnbcf4.visible:=Form_peach.pmbc4.visible;
Form_peach.pnbcf5.visible:=Form_peach.pmbc5.visible;
Form_peach.pnbcf6.visible:=Form_peach.pmbc6.visible;
Form_peach.pnbcf7.visible:=Form_peach.pmbc7.visible;
Form_peach.pnbcf8.visible:=Form_peach.pmbc8.visible;
Form_peach.pnbcf1.caption:=Form_peach.pmbc1.caption;
Form_peach.pnbcf2.caption:=Form_peach.pmbc2.caption;
Form_peach.pnbcf3.caption:=Form_peach.pmbc3.caption;
Form_peach.pnbcf4.caption:=Form_peach.pmbc4.caption;
Form_peach.pnbcf5.caption:=Form_peach.pmbc5.caption;
Form_peach.pnbcf6.caption:=Form_peach.pmbc6.caption;
Form_peach.pnbcf7.caption:=Form_peach.pmbc7.caption;
Form_peach.pnbcf8.caption:=Form_peach.pmbc8.caption;
Form_peach.pnbcf1.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.pnbcf2.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.pnbcf3.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.pnbcf4.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.pnbcf5.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.pnbcf6.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.pnbcf7.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.pnbcf8.bitmap:=Form_peach.pmbc8.bitmap;
Form_peach.pnbce1.visible:=Form_peach.pmbc1.visible;
Form_peach.pnbce2.visible:=Form_peach.pmbc2.visible;
Form_peach.pnbce3.visible:=Form_peach.pmbc3.visible;
Form_peach.pnbce4.visible:=Form_peach.pmbc4.visible;
Form_peach.pnbce5.visible:=Form_peach.pmbc5.visible;
Form_peach.pnbce6.visible:=Form_peach.pmbc6.visible;
Form_peach.pnbce7.visible:=Form_peach.pmbc7.visible;
Form_peach.pnbce8.visible:=Form_peach.pmbc8.visible;
Form_peach.pnbce1.caption:=Form_peach.pmbc1.caption;
Form_peach.pnbce2.caption:=Form_peach.pmbc2.caption;
Form_peach.pnbce3.caption:=Form_peach.pmbc3.caption;
Form_peach.pnbce4.caption:=Form_peach.pmbc4.caption;
Form_peach.pnbce5.caption:=Form_peach.pmbc5.caption;
Form_peach.pnbce6.caption:=Form_peach.pmbc6.caption;
Form_peach.pnbce7.caption:=Form_peach.pmbc7.caption;
Form_peach.pnbce8.caption:=Form_peach.pmbc8.caption;
Form_peach.pnbce1.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.pnbce2.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.pnbce3.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.pnbce4.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.pnbce5.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.pnbce6.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.pnbce7.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.pnbce8.bitmap:=Form_peach.pmbc8.bitmap;
if altbread>0 then
   begin
   Form_peach.ImageAddress0.Visible:=false;
   Form_peach.ImageAddress1.Visible:=false;
   Form_peach.ImageAddress2.Visible:=false;
   Form_peach.ImageAddress3.Visible:=false;
   Form_peach.ImageAddress4.Visible:=false;
   Form_peach.ImageAddress5.Visible:=false;
   Form_peach.ImageAddress6.Visible:=false;
   Form_peach.ImageAddress7.Visible:=false;
   setfontsbreadcrumb;
   end;
end;

procedure clearicons;
begin
clearimagelist(il16);
clearimagelist(il48);
clearimagelist(il96);
clearimagelist(il192);
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
   if largeiconsize=48 then clearimagelist(il48);
   if largeiconsize=96 then clearimagelist(il96);
   if largeiconsize=192 then clearimagelist(il192);
   loadlargeicons(largeiconsize);
   end;
   1:
   begin
   if mediconsize=16 then clearimagelist(il16);
   if mediconsize=48 then clearimagelist(il48);
   if mediconsize=96 then clearimagelist(il96);
   loadsmallicons(mediconsize);
   end;
   0:
   begin
   if smalliconsize=16 then clearimagelist(il16);
   if smalliconsize=48 then clearimagelist(il48);
   if smalliconsize=96 then clearimagelist(il96);
   loadsmallicons(smalliconsize);
   end;
   end;
end;

function supportedimgtype(s:ansistring):boolean;
var
  sl:ansistring;
begin
sl:=lowercase(s);
case sl of
   '.bmp',
   //'.xbm', //not supported 1.0.8
   '.xpm',
   '.pbm',
   '.pgm',
   '.ppm',
   //'.tga', //not supported 1.0.8
   '.ico',
   //'.icl', //not supported 1.0.8
   '.cur',
   //'.ani', //not supported 1.0.8
   '.icns',
   '.jpg', '.jpe', '.jpeg', '.jif', '.jfif', '.jfi',
   //'.jp2', '.j2k', '.jpx', //jpeg2000 not supported 1.0.8
   //'.webp', //not supported 1.0.8
   '.gif',
   '.png',
   '.tif','.tiff': supportedimgtype:=true
   else supportedimgtype:=false;
end;
end;

function checkfreespace:integer;
var
   s:ansistring;
begin
result:=0;
if sizefreeint<=0 then exit;
s:='';
if sizefreeout>=0 then
   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;

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}
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);
{$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:ansistring;
   P:tprocessutf8;
   lpPoint:TPoint;
   haddress:THandle;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
fres:=-1;
if threadextracting=true then exit;
threadextracting:=true;
CreateDir(vpath);
CreateDir(vpath+'virtual\');
CreateDir(vpath+'source\');
vpath2:=vpath;
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:=Form_peach.EditOpenOut.Text;
GetCursorPos(lpPoint);
if (lpPoint.x<Form_peach.left) or (lpPoint.y<Form_peach.top) or (lpPoint.x>Form_peach.left+Form_peach.width) or (lpPoint.y>Form_peach.top+Form_peach.height) 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;
Form_peach.EditOpenOut.Text:=vpath2+'virtual\';
calcseltsize;
sizefreeint:=tsize;
get_statussdrag(dragdest);
if checkfreespace<>0 then exit;
totrow:=Form_peach.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(Form_peach.EditOpenIn.Text))='.cab' then
      begin
      fun:='UNCUSTOM';
      fun_status:=fun;
      Form_peach.EditNameCustom1.Text:='Extrac32';
      Form_peach.ComboBoxArchiveCustom1.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 Form_peach.Visible:=true else Form_peach.Visible:=false;
   save_conf;
   P:=tprocessutf8.Create(nil);
   P.Options := [poNoConsole, poWaitOnExit];
   P.CommandLine:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+
                  ' -pdrop '+fun+' '+inttostr(pforceconsole)+' '+inttostr(tsize)+' '+stringdelim(Form_peach.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);
   P.Execute;
   pend:=P.ExitCode;
   P.Free;
   if (fileexists(peaziptmpdir+STR_TMPDROPE)=true) then //utter check to handle errors not correctly passed between processes and from the underlying process or console mode
      begin
      pend:=2;
      DeleteFile(peaziptmpdir+STR_TMPDROPE);
      end;
   if (fileexists(peaziptmpdir+STR_TMPERRI)=true) then DeleteFile(peaziptmpdir+STR_TMPERRI)
   else
   if pend<>0 then
      begin
      Form_peach.Visible:=true;
      if haddress<>0 then EnableWindow(haddress,true);
      if haddress<>0 then ShowWindow(haddress,9);
      fun:=fun1;
      fun_status:=fun_status1;
      Form_peach.EditOpenOut.Text:=prevout;
      exit;
      end;
   if status0=txt_list_browsing then
      begin
      relpath:=StringReplace(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row],':','_',[rfReplaceAll]);
      relpath:=extractfilepath(relpath);
      end
   else
      relpath:='';//if in flat or search mode, use root
   if not directoryexists(vpath2+'source\') then CreateDir(vpath2+'source\');
   if intpw=1 then
      begin
      DirSize(Form_peach.EditOpenOut.Text+relpath,'*',FaAnyFile,true,true,nfiles,ndirs,size);
      if size>0 then movecontent_todir(Form_peach.EditOpenOut.Text+relpath,vpath2+'source\',1);
      end
   else
      movecontent_todir(Form_peach.EditOpenOut.Text+relpath,vpath2+'source\',1);
   Form_peach.Visible:=true;
   pclicked:=true;
   if haddress<>0 then EnableWindow(haddress,true);
   if haddress<>0 then ShowWindow(haddress,9);
   end;
fun:=fun1;
fun_status:=fun_status1;
Form_peach.EditOpenOut.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;

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:Tbitmap;
   icon:TIcon;
   s:AnsiString;
   {$IFDEF MSWINDOWS}fileinfo: SHFILEINFO;{$ENDIF}
begin
{$IFDEF MSWINDOWS}
for i:=1 to Form_Peach.StringGridList.rowcount-1 do
   if Form_Peach.StringGridList.Cells[2,i]='.exe' then //SHGetFileInfo not threadsafe
   if strtoint(Form_Peach.StringGridList.Cells[3,i])<50000000 then
      begin
      Application.ProcessMessages;
      case browsertype of
         2: eisize:=largeiconsize;
         1: eisize:=mediconsize;
         0: eisize:=smalliconsize;
      end;
      if eisize>0 then
         begin
         try
            abitmap:=Tbitmap.Create;
            icon:=TIcon.Create;
            s:=Form_Peach.StringGridList.Cells[12,i];
            k:=0;
            if eisize<48 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);
               setpbitmap(abitmap, (icon.Width*qscaleimages) div 100);
               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(Form_Peach.ListView1.Items[1]);
               end;
            case eisize of
               16:
               begin
               setsize_bitmap(abitmap, icon_sizeplus, DECO_NONE);
               il16.Add(abitmap,nil);
               Form_Peach.ListView1.Items[i-1].ImageIndex:=il16.Count-1;
               end;
               48:
               begin
               setsize_bitmap(abitmap, reficonsize, DECO_NONE);
               il48.Add(abitmap,nil);
               Form_Peach.ListView1.Items[i-1].ImageIndex:=il48.Count-1;
               end;
               96:
               begin
               setsize_bitmap(abitmap, reficonsize, DECO_NONE);
               il96.Add(abitmap,nil);
               Form_Peach.ListView1.Items[i-1].ImageIndex:=il96.Count-1;
               end;
               192:
               begin
               setsize_bitmap(abitmap, reficonsize, DECO_NONE);
               il192.Add(abitmap,nil);
               Form_Peach.ListView1.Items[i-1].ImageIndex:=il192.Count-1;
               end;
            end;
         finally
            abitmap.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:=Form_Peach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread1.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      192: il192.Replace(50+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: il16.Replace(50+fi,fbitmap,nil);
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: il16.Replace(50+fi,fbitmap,nil);
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      end;
   end;
   end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
Form_Peach.ListView1.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
Form_Peach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
Form_Peach.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
   Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=strtoint(Form_Peach.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, baseiconsize, deco_style, s);
   setsize_bitmap(abitmap, reficonsize, 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:=Form_Peach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread2.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      192: il192.Replace(50+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: il16.Replace(50+fi,fbitmap,nil);
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: il16.Replace(50+fi,fbitmap,nil);
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      end;
   end;
   end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
Form_Peach.ListView1.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
Form_Peach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
Form_Peach.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
   Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=strtoint(Form_Peach.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, baseiconsize, deco_style, s);
   setsize_bitmap(abitmap, reficonsize, 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:=Form_Peach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread3.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
      2:
      begin
      case largeiconsize of
         48: il48.Replace(50+fi,fbitmap,nil);
         96: il96.Replace(50+fi,fbitmap,nil);
         192: il192.Replace(50+fi,fbitmap,nil);
         end;
      end;
      1:
      begin
      case mediconsize of
         16: il16.Replace(50+fi,fbitmap,nil);
         48: il48.Replace(50+fi,fbitmap,nil);
         96: il96.Replace(50+fi,fbitmap,nil);
         end;
      end;
      0:
      begin
      case smalliconsize of
         16: il16.Replace(50+fi,fbitmap,nil);
         48: il48.Replace(50+fi,fbitmap,nil);
         96: il96.Replace(50+fi,fbitmap,nil);
         end;
      end;
      end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
Form_Peach.ListView1.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
Form_Peach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
Form_Peach.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
   Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=strtoint(Form_Peach.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, baseiconsize, deco_style, s);
   setsize_bitmap(abitmap, reficonsize, 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:=Form_Peach.StringGridList.Cells[12,imlistindex[fi]];
end;

procedure TMyThread4.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      192: il192.Replace(50+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: il16.Replace(50+fi,fbitmap,nil);
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: il16.Replace(50+fi,fbitmap,nil);
      48: il48.Replace(50+fi,fbitmap,nil);
      96: il96.Replace(50+fi,fbitmap,nil);
      end;
   end;
   end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=50+imtodo[fi];
Form_Peach.ListView1.Items[imlistindex[fi]-1].SubItems.Strings[2]:=fs;
Form_Peach.StringGridList.Cells[4,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[15,imlistindex[fi]]:=fs;
Form_Peach.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
   Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=strtoint(Form_Peach.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, baseiconsize, deco_style, s);
   setsize_bitmap(abitmap, reficonsize, 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;

procedure browser_selectnone;
var
   i:integer;
begin
   {$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   if Form_peach.ListView1.Visible=true then
      begin
      if Form_peach.StringGridList.Rowcount<2 then exit;
      if Form_peach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to Form_peach.StringGridList.Rowcount-1 do
         Form_peach.StringGridList.Cells[16,i]:='0';
      end;
end;

procedure testrarlocked;
var
   ext:ansistring;
   i:integer;
begin
i:=testifrarlocked(Form_peach.EditOpenIn.Text);
case i of //RAR revision already reported in status1 as method
   //0: Form_peach.Caption:=Form_peach.Caption;
   1: Form_peach.Caption:=Form_peach.Caption+' | '+txt_7_4_locked;
   //2: Form_peach.Caption:=Form_peach.Caption;
   3: Form_peach.Caption:=Form_peach.Caption+' | '+txt_7_4_locked;
   end;
case i of
   -1: //not rar
      begin
      {ext:=extractfileext(Form_peach.EditOpenIn.Text);
      if upcase(ext)='.ZIP' then Form_peach.pmmorecomment.Visible:=true;}
      end;
   else //rar
      if (havewinrar=true) and (userar=1) then
      begin
      Form_peach.pmmorelock.Visible:=true;
      Form_peach.pmmorerr.Visible:=true;
      Form_peach.pmmorerecover.Visible:=true;
      Form_peach.pmmorecomment.Visible:=true;
      Form_peach.po_lock.Visible:=true;
      Form_peach.po_rr.Visible:=true;
      Form_peach.po_recover.Visible:=true;
      Form_peach.po_comment.Visible:=true;
      end;
   end;
end;

procedure update_listview;
var
   i,j,rc:integer;
   MyThreadimg: TMyThreadimg;
   abitmap:TBitmap;
   redoi:boolean;
   tstr:ansistring;
begin
if updatinglistview=true then exit;
updatinglistview:=true;
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 (Form_peach.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:=Form_Peach.editopenin.Caption+Form_Peach.editun7zafilter.Caption+status0+status1+inttostr(browsertype)+inttostr(largeiconsize)+inttostr(smalliconsize);
   end
else updateid:='';
sync:=sync+1;
imindex:=0;
exeindex:=0;
issearching:=0;
rc:=Form_peach.StringGridList.Rowcount;
Form_Peach.ImageListSearch1.visible:=false;
Form_Peach.ListView1.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
Form_Peach.ListView1.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
   abitmap:=Tbitmap.Create;
   if browsertype=2 then
      begin
      abitmap.Width:=largeiconsize;
      abitmap.Height:=largeiconsize;
      end
   else
      begin
      abitmap.Width:=smalliconsize;
      abitmap.Height:=smalliconsize;
      end;
   for i:=1 to rc-1 do
      begin
      Form_Peach.ListView1.Items.Add;
      Form_Peach.ListView1.Items[i-1].Caption:=Form_Peach.StringGridList.Cells[1,i];
      if ((browsertype=0) and (smalliconsize=16)) or ((browsertype=1) and (smalliconsize=16)) then Form_Peach.ListView1.Items[i-1].ImageIndex:=drawlisticon16(i)
      else Form_Peach.ListView1.Items[i-1].ImageIndex:=drawlisticon(i);
      {$IFDEF MSWINDOWS}
      if fun='FILEBROWSER' then
         begin
         if showthumbnails=1 then
            begin
            if supportedimgtype(Form_Peach.StringGridList.Cells[2,i])=true then
            begin
            imindex:=imindex+1;
            SetLength(imlistindex, imindex+1);
            SetLength(imtodo, imindex+1);
            imlistindex[imindex]:=i;
            imtodo[imindex]:=imindex;
            case browsertype of
            2:
            begin
            case largeiconsize of
               48: il48.Add(abitmap,nil);
               96: il96.Add(abitmap,nil);
               192: il192.Add(abitmap,nil);
               end;
               end;
            1:
            begin
            case mediconsize of
                 16: il16.Add(abitmap,nil);
                 48: il48.Add(abitmap,nil);
                 96: il96.Add(abitmap,nil);
                 end;
                 end;
            0:
            begin
            case smalliconsize of
                 16: il16.Add(abitmap,nil);
                 48: il48.Add(abitmap,nil);
                 96: il96.Add(abitmap,nil);
                 end;
            end;
            end;
            end;
         if Form_Peach.StringGridList.Cells[2,i]='.exe' then
            begin
            exeindex:=exeindex+1;
            SetLength(exelistindex, exeindex+1);
            SetLength(exetodo, exeindex+1);
            exelistindex[exeindex]:=i;
            exetodo[exeindex]:=exeindex;
            case browsertype of
            2:
            begin
            case largeiconsize of
               48: il48.Add(abitmap,nil);
               96: il96.Add(abitmap,nil);
               192: il192.Add(abitmap,nil);
               end;
               end;
            1:
            begin
            case mediconsize of
                 16: il16.Add(abitmap,nil);
                 48: il48.Add(abitmap,nil);
                 96: il96.Add(abitmap,nil);
                 end;
                 end;
            0:
            begin
            case smalliconsize of
                 16: il16.Add(abitmap,nil);
                 48: il48.Add(abitmap,nil);
                 96: il96.Add(abitmap,nil);
                 end;
            end;
            end;
            end;
         end;
         end;
      {$ENDIF}
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[2,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(nicenumber(Form_Peach.StringGridList.Cells[3,i],filesizebase));
      Form_Peach.ListView1.Items[i-1].SubItems.Add(nicenumber(Form_Peach.StringGridList.Cells[4,i],filesizebase));
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[5,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[6,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[7,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[8,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[9,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[10,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[11,i]);
      Form_Peach.ListView1.Items[i-1].SubItems.Add(Form_Peach.StringGridList.Cells[12,i]);
      if Form_Peach.StringGridList.Cells[16,i]='0' then
      else
         try
         Form_peach.ListView1.Items[i-1].Selected:=true;
         except
         end;
      end;
      abitmap.free;
      {$IFDEF MSWINDOWS}
      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}
   end
else
   begin
   set_listview_col;
   Form_Peach.ListView1.Items.Endupdate;
   update_addressbar(form_peach.EditOpenIn1.Text);
   update_selstatus;
   updatinglistview:=false;
   exit;
   end;
set_listview_col;

if Form_peach.ShapeProgress.Visible=true then
   begin
   Form_peach.ShapeProgress.Width:=Form_peach.Width*95 div 100;
   pperc:=95;
   tstr:=Form_peach.LabelStatusdisplayed.Caption;
   Form_peach.LabelStatusdisplayed.Caption:=txt_8_9_disp+' 2/2';
   application.ProcessMessages;
   Form_peach.LabelStatusdisplayed.Caption:=tstr;
   end;

Form_Peach.ListView1.Items.Endupdate;

//sync real time search
Form_Peach.ListAddress.Items.BeginUpdate;
Form_Peach.ListAddress.Clear;
for j:=0 to Form_Peach.ListView1.Items.Count-1 do Form_Peach.ListAddress.Items.Add.Assign(Form_Peach.ListView1.Items[j]);
Form_Peach.ListAddress.Items.EndUpdate;
Form_Peach.StringGridAddress.BeginUpdate;
Form_Peach.StringGridAddress.Clear;
Form_Peach.StringGridAddress.RowCount:=Form_Peach.StringGridList.RowCount;
for j:=0 to Form_Peach.StringGridList.RowCount-1 do Form_Peach.StringGridAddress.Rows[j].Assign(Form_Peach.StringGridList.Rows[j]);
Form_Peach.StringGridAddress.EndUpdate;

if form_peach.Visible=true then try Form_peach.ListView1.SetFocus; except end;
if (Form_Peach.ListView1.Items[0].Caption='') and (Form_Peach.ListView1.Items.Count<2) then Form_Peach.ListView1.Clear
else
   begin
   {$IFDEF MSWINDOWS}
   if form_peach.Visible=true then
      try
      Form_peach.ListView1.ItemFocused:=Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1];
      except
      end;
   {$ENDIF}
   end;
update_addressbar(form_peach.EditOpenIn1.Text);
update_selstatus;

if Form_peach.ShapeProgress.Visible=true then
   begin
   Form_peach.ShapeProgress.Width:=Form_peach.Width*100 div 100;
   pperc:=100;
   application.ProcessMessages;
   end;

{$IFDEF MSWINDOWS}done_listingexe:=false;{$ENDIF}
updatinglistview:=false;
Form_peach.ShapeProgress.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;
rc:=Form_peach.StringGridList.Rowcount;
{$IFDEF MSWINDOWS}Form_Peach.ListView1.Items.Beginupdate;{$ENDIF}
if (rc>1) and (Form_Peach.StringGridList.Cells[1,1]<>'') then
   begin
   for i:=1 to rc-1 do
      begin
      if Form_peach.StringGridList.Cells[0,i]='' then Form_Peach.ListView1.Items[i-1].Cut:=false
      else Form_Peach.ListView1.Items[i-1].Cut:=true; //cut raises update_listview_sel instead of update_listview
      if Form_Peach.StringGridList.Cells[16,i]='0' then
         begin
         try
         Form_peach.ListView1.Items[i-1].Selected:=false;
         except
         end;
         end
      else
         try
         Form_peach.ListView1.Items[i-1].Selected:=true;
         except
         end;
      end;
   end
else
   begin
   set_listview_col;
   {$IFDEF MSWINDOWS}Form_Peach.ListView1.Items.Endupdate;{$ENDIF}
   update_selstatus;
   updatinglistview:=false;
   exit;
   end;
set_listview_col;
{$IFDEF MSWINDOWS}Form_Peach.ListView1.Items.Endupdate;{$ENDIF}
if form_peach.Visible=true then try Form_peach.ListView1.SetFocus; except end;
if (Form_Peach.ListView1.Items[0].Caption='') and (Form_Peach.ListView1.Items.Count<2) then //Form_Peach.ListView1.Clear
else
   begin
   {$IFDEF MSWINDOWS}
   if form_peach.Visible=true then
      try
      Form_peach.ListView1.ItemFocused:=Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1];
      except
      end;
   {$ENDIF}
   end;
update_selstatus;
updatinglistview:=false;
end;

procedure set_lastobj;
var
   i:integer;
   lastobjfound:boolean;
begin
for i:=1 to Form_peach.StringGridList.Rowcount-1 do
   if Form_peach.StringGridList.Cells[16,i]='0' then
   else Form_peach.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 Form_peach.StringGridList.RowCount-1 do
      if Form_Peach.StringGridList.Cells[12,i]=lastobj then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then //i:=1;
else
   begin
   Form_peach.StringGridList.Cells[16,i]:='1';
   Form_peach.StringGridList.Row:=i;
   end;
end;

procedure set_lastobjpc;
var
   i:integer;
   lastobjfound:boolean;
begin
{$IFDEF MSWINDOWS}
for i:=1 to Form_peach.StringGridList.Rowcount-1 do
   if Form_peach.StringGridList.Cells[16,i]='0' then
   else Form_peach.StringGridList.Cells[16,i]:='0';
lastobjfound:=false;
lastobj:=ExtractFileDrive(lastobj)+directoryseparator;
if lastobj<>'' then
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_Peach.StringGridList.Cells[12,i]=lastobj then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then i:=1;
Form_peach.StringGridList.Cells[16,i]:='1';
Form_peach.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 hideintro;
begin
{$IFDEF MSWINDOWS}
if Form_peach.PanelIntro.Visible=true then Form_peach.PanelIntro.Visible:=false;
{$ELSE}
if Form_peach.PanelIntro.Top=0 then Form_peach.PanelIntro.Top:=10000;
{$ENDIF}
Form_peach.Repaint;
end;

procedure settoolbarw;
begin
with Form_peach do
begin
case lasttoolbar of
1: PanelBarOpen1.Width:=ButtonUn7za4.Width+ButtonUn7zaTo.Width+
ButtonUn7za1.Width+ButtonUn7za6.Width+ButtonUn7za5.Width+ButtonUn7za7.Width+
ButtonUn7za8.Width+ButtonUn7za11.Width+ButtonUn7za9.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 Form_peach do
begin
{$IFNDEF MSWINDOWS}
ButtonProperties.Visible:=false;
MenuItemProperties.Visible:=false;
mProperties.Visible:=false;
pmProperties.Visible:=false;
pmbcProperties.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
   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 Form_peach.ButtonUn7za8.enabled:=false; Form_peach.ButtonUn7za11.enabled:=false; end;
1: begin Form_peach.ButtonUn7za8.enabled:=true; Form_peach.ButtonUn7za11.enabled:=true; end;
end;
end;

procedure recpmem;
begin
Form_Peach.ListAddress.Clear;
Form_peach.MemoList.Clear;
Form_Peach.StringGridList.Clear;
Form_peach.StringGridList.RowCount:=1;
Form_Peach.StringGridArchive.Clear;
Form_peach.StringGridArchive.RowCount:=1;
Form_Peach.StringGridAddress.Clear;
Form_peach.StringGridAddress.RowCount:=1;
Form_Peach.StringGridAddress1.Clear;
Form_peach.StringGridAddress1.RowCount:=1;
Form_Peach.StringGridAddress2.Clear;
Form_peach.StringGridAddress2.RowCount:=1;
Form_Peach.StringGridAddress3.Clear;
Form_peach.StringGridAddress3.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 char;
   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:='';
if form_peach.StringGridSessionHistory.rowcount>1 then singleextract:=false;
specialopen:=false;
for k := 1 to 4 do abcrs[k] :='';
recpmem;
Form_peach.LabelErrors.Caption:='';
Form_peach.ImageListSearch.Enabled:=false;
settoolbar;
clean_archive_breadcrumb;
Form_peach.LabelClickAddress1.Visible:=true;
Form_peach.LabelClickAddress2.Visible:=true;
Form_peach.LabelClickAddress3.Visible:=true;
Form_peach.LabelClickAddress4.Visible:=true;
Form_peach.LabelClickAddress5.Visible:=true;
seemencrypted:=false;
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
Form_peach.StringGridArchive.RowCount:=1;
addmenuenable(1);
if Form_peach.EditOpenIn.Text<>txt_mypc then
   begin
   col1size:=Form_Peach.ListView1.Column[0].Width;
   if ctype=true then col2size:=Form_Peach.ListView1.Column[1].Width;
   if csize=true then col3size:=Form_Peach.ListView1.Column[2].Width;
   if cpacked=true then col4size:=Form_Peach.ListView1.Column[3].Width;
   if cdate=true then col5size:=Form_Peach.ListView1.Column[4].Width;
   if catt=true then col6size:=Form_Peach.ListView1.Column[9].Width;
   if ccrc=true then col7size:=Form_Peach.ListView1.Column[10].Width;
   end;
prepare_filebrowser;
status0:=txt_list_browsing;
currentcomp:='';
currentfs:='';
statust:='';
archive_content:='';
status1:=(GetEnvironmentVariable('COMPUTERNAME'));
status_curfilesystem:=usr_name;
fun:='FILEBROWSER';
Form_peach.EditOpenOut.Text:=local_desktop;
fun_status:=fun;
Form_peach.EditOpenIn.Text:=txt_mypc;
statuss:='';
set_statuss_nav;
setbuttonmenus;
GetLogicalDriveStrings(255,@drivestr);
i:=1;
j:=1;
sizetotal:=0;
sizefree:=0;
Form_peach.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]<>#00) 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);
            Form_peach.StringGridList.RowCount:=Form_peach.StringGridList.RowCount+1;
            Form_peach.StringGridList.Cells[1,k]:='('+s1+') '+txt_unit_floppy;
            Form_peach.StringGridList.Cells[2,k]:=txt_unit_floppy;
            Form_peach.StringGridList.Cells[3,k]:='0';
            Form_peach.StringGridList.Cells[4,k]:='0';
            Form_Peach.StringGridList.Cells[14,k]:='';
            Form_peach.StringGridList.Cells[15,k]:='';
            Form_peach.StringGridList.Cells[5,k]:='';
            Form_peach.StringGridList.Cells[12,k]:=s1+directoryseparator;
            Form_peach.StringGridList.Cells[13,k]:=Form_peach.StringGridList.Cells[1,k];
            Form_peach.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 Form_peach.StringGridList.Cells[1,k]:='('+s1+') '+dname
      else Form_peach.StringGridList.Cells[1,k]:='('+s1+') '+uncname+' '+txt_on+' '+dname;
      Form_peach.StringGridList.Cells[2,k]:=dtype;
      Form_peach.StringGridList.Cells[3,k]:='';
      Form_peach.StringGridList.Cells[4,k]:='';
      Form_peach.StringGridList.Cells[5,k]:='';
      if fsname<>'' then
         begin
         sz:=disksize(j);
         if sz=-1 then sz:=0;
         Form_peach.StringGridList.Cells[3,k]:=inttostr(sz);
         sizetotal:=sizetotal+sz;
         end;
      if fsname<>'' then
         begin
         sz1:=diskfree(j);
         if sz1=-1 then sz1:=0;
         Form_peach.StringGridList.Cells[4,k]:=inttostr(sz1);
         sizefree:=sizefree+sz1;
         end;
      Form_Peach.StringGridList.Cells[14,k]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,k]))))+inttostr(length(Form_peach.StringGridList.Cells[3,k]))+Form_Peach.StringGridList.Cells[3,k];
      Form_peach.StringGridList.Cells[15,k]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,k]))))+inttostr(length(Form_peach.StringGridList.Cells[4,k]))+Form_peach.StringGridList.Cells[4,k];
      if fsname<>'' then
         if sz<>0 then
            Form_peach.StringGridList.Cells[5,k]:=fsname+', '+inttostr((sz1*100) div sz)+'% '+txt_free2;
      Form_peach.StringGridList.Cells[12,k]:=s1+directoryseparator;
      Form_peach.StringGridList.Cells[13,k]:=Form_peach.StringGridList.Cells[1,k];
      Form_peach.StringGridList.Cells[16,k]:='0';
      end;
until length(s)=0;
Form_peach.StringGridList.RowCount:=k+1;
Form_peach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if az=false then sort_za_stringgridlist(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(Form_peach.StringGridList.Rowcount-1)+' '+txt_units+'; '+nicenumber(inttostr(sizetotal),filesizebase)+', '+nicenumber(inttostr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(i)+'%)';
update_listview;
Form_peach.Caption:=txt_mypc;
indir:=txt_mypc;
listingdir:=false;
{$ENDIF}
end;

procedure savecol;
begin
if (browsertype=0) and (Form_Peach.EditOpenIn.Caption<>txt_mypc) then
   begin
   if Form_Peach.ListView1.Column[0].Width>0 then col1size:=Form_Peach.ListView1.Column[0].Width;
   if ctype=false then else col2size:=Form_Peach.ListView1.Column[1].Width;
   if csize=false then else col3size:=Form_Peach.ListView1.Column[2].Width;
   if cpacked=false then else col4size:=Form_Peach.ListView1.Column[3].Width;
   if cdate=false then else col5size:=Form_Peach.ListView1.Column[4].Width;
   if catt=false then else col6size:=Form_Peach.ListView1.Column[9].Width;
   if ccrc=false then else col7size:=Form_Peach.ListView1.Column[10].Width;
   end;
end;

procedure filter_archivecontent;
var
   i,j,nfolders,nfiles,rc:integer;
   size,csize,rsize:qword;
   sfilter,sfilterf,stemp,stempf,tstr:ansistring;
begin
savecol;
if Form_peach.ShapeProgress.Visible=true then
   begin
   Form_peach.ShapeProgress.Width:=Form_peach.Width*85 div 100;
   pperc:=85;
   Form_peach.LabelStatusdisplayed.Caption:=txt_8_9_disp+' 1/2';
   application.ProcessMessages;
   end;
if status0=txt_list_browsing then list_un7z('browse')
else list_un7z('flat');

if (length(Form_peach.EditUn7zaFilter.Text)>2) and (Form_peach.cbtree.ItemIndex>0) then
   begin
   tstr:=copy(Form_peach.EditUn7zaFilter.Text,1,length(Form_peach.EditUn7zaFilter.Text)-2);
   if Form_peach.StringGridAddress1.RowCount>MAXNDIRTREE then
   else
      begin
      Form_peach.TreeView1.Items.BeginUpdate;
      for i:=1 to Form_peach.StringGridAddress1.RowCount-1 do
      if Form_peach.StringGridAddress1.Cells[12,i]=tstr then
         begin
         if Form_peach.cbtree.ItemIndex=1 then
            begin
            Form_Peach.TreeView1.Selected:=Form_Peach.TreeView1.Items[0];
            Form_Peach.TreeView1.Selected.Collapse(true);
            end;
         Form_Peach.TreeView1.Selected:=Form_Peach.TreeView1.Items[i];
         selnode:=i;
         break;
         end;
      Form_peach.TreeView1.Items.EndUpdate;
      end;
   end;

if h_folders=true then
begin

Form_Peach.ListView1.Items.BeginUpdate;
Form_Peach.StringGridList.BeginUpdate;
Form_Peach.StringGridAddress2.BeginUpdate;
{$IFDEF DARWIN}Form_peach.ListView1.Cursor:=crDefault;{$ELSE}Form_peach.ListView1.Cursor:=crHourglass;{$ENDIF}
rc:=Form_Peach.StringGridList.RowCount;
if nomatch=true then
begin
Form_Peach.StringGridList.RowCount:=Form_Peach.StringGridAddress2.RowCount;
rc:=1;
for i:=1 to Form_Peach.StringGridAddress2.RowCount-1 do
  Form_Peach.StringGridList.Rows[i].Assign(Form_Peach.StringGridAddress2.Rows[i]);
end
else
for i:=1 to Form_Peach.StringGridAddress2.RowCount-1 do
  begin
  Form_Peach.StringGridList.RowCount:=Form_Peach.StringGridList.RowCount+1;
  Form_Peach.StringGridList.Rows[Form_Peach.StringGridList.RowCount-1].Assign(Form_Peach.StringGridAddress2.Rows[i]);
  end;
Form_Peach.StringGridAddress2.EndUpdate;

if is_searching=false then
begin
if Form_peach.EditUn7zaFilter.Text<>'' then sfilter:=lowercase(copy(Form_peach.EditUn7zaFilter.Text,1,length(Form_peach.EditUn7zaFilter.Text)-1));
if sfilter<>'' then
begin
i:=rc-1;
while i<(Form_Peach.StringGridList.RowCount-1) do
   begin
   sfilterf:=lowercase(Form_Peach.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
      Form_Peach.StringGridList.DeleteRow(i+1);
      end;
   end;
end;
end
else //search
begin
if Form_peach.EditUn7zaFilter.Text<>'' then
begin
i:=rc-1;
while i<(Form_Peach.StringGridList.RowCount-1) do
   begin
   stemp:=Form_Peach.StringGridList.Cells[12,i+1];
   stempf:=Form_peach.EditUn7zaFilter.Text;
   if not(MatchesMask(stemp,stempf,false)) then Form_Peach.StringGridList.DeleteRow(i+1)
   else i:=i+1;
   end;
end;
end;
is_searching:=false;

if Form_peach.EditUn7zaFilterExclude.Text<>'' then
begin
i:=rc-1;
while i<(Form_Peach.StringGridList.RowCount-1) do
   begin
   stemp:=Form_Peach.StringGridList.Cells[12,i+1];
   if pos('\\', stemp)=1 then stemp:=copy(stemp,3,length(stemp)-2);
   stempf:=Form_peach.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
      Form_Peach.StringGridList.DeleteRow(i+1);
      end;
   end;
end;

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

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

i:=1;
repeat
  if Form_Peach.StringGridList.RowCount>1 then
     if Form_Peach.StringGridList.Cells[1,i]='' then Form_Peach.StringGridList.DeleteRow(i)
     else
        begin
        try
        if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then nfiles:=nfiles+1
        else nfolders:=nfolders+1;
        try size:=size+strtoqword(Form_peach.StringGridList.Cells[3,i]); except end;
        try csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,i]); except end;
        finally
        i:=i+1;
        end;
        end;
until i>=Form_Peach.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 Form_peach.StringGridList.RowCount-1 do
  if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then
     begin
     for j:=1 to Form_peach.StringGridAddress3.RowCount-1 do
       if Form_peach.StringGridAddress3.Cells[12,j]<>Form_peach.StringGridList.Cells[12,i] then
       else
          Form_peach.StringGridList.Cells[11,i]:=Form_peach.StringGridAddress3.Cells[11,j];
     end;
end;

if Form_peach.StringGridList.RowCount>1 then Form_peach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if az=false then sort_za_stringgridlist(listsortcol);
update_listview;
generate_archive_breadcrumb;
Form_Peach.ListView1.Cursor:=crDefault;
Form_Peach.ListView1.Items.EndUpdate;
Form_Peach.StringGridList.EndUpdate;
end;
end;

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

procedure autobrowsetar;
begin
if autoopentar=0 then exit;
if (Form_peach.StringGridList.RowCount=2) and (lowercase(Form_peach.StringGridList.Cells[2,1])='.tar') then
   begin
   Form_peach.StringGridList.Cells[16,1]:='1';
   grid_obj_open;
   end;
end;

procedure list_root;
{$IFNDEF MSWINDOWS}
var
   s:ansistring;
{$ENDIF}
begin
case fun of
'UN7Z':
   begin
   //archive already listed flat in prebrowse, until it is requested re-browsing it
   Form_peach.EditUn7zaFilter.Text:='*';
   Form_peach.EditUn7zaFilterExclude.Text:='*'+directoryseparator+'*';
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   filter_archivecontent;
   autobrowsetar;
   addtohistory;
   end;
'FILEBROWSER':
   begin
   {$IFDEF MSWINDOWS}
   listpc;
   {$ELSE}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   addtohistory;
   end;
end;
end;

procedure list_un7z_search;
begin
Form_peach.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
Form_peach.StringGridList.RowCount:=2;
s:=extractfilename(Form_peach.OpenDialogArchive.Filename);
if (fun<>'UNCUSTOM') and (fun<>'UNPEA') then cutextension(s);
Form_peach.StringGridList.Cells[1,1]:=s;
Form_peach.StringGridList.Cells[2,1]:=extractfileext(Form_peach.StringGridList.Cells[1,1]);
size:=0;
csize:=0;
Form_peach.StringGridList.Cells[3,1]:='';
Form_peach.StringGridList.Cells[4,1]:='';
try
assignfile(f,Form_peach.EditOpenIn.Text);
filemode:=0;
reset(f);
if fun='UNQUAD' then
   begin
   size:=0;
   if extractfileext(Form_peach.EditOpenIn.Text)='.quad' then
      blockread(f,size,4)
   else
      begin
      blockread(f,b,1);
      blockread(f,size,4);
      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(Form_peach.EditOpenIn.Text,csize);
closefile(f);
except
end;
Form_peach.StringGridList.Cells[3,1]:=inttostr(size); //expressed in B
Form_peach.StringGridList.Cells[4,1]:=inttostr(csize); //expressed in B
Form_peach.StringGridList.Cells[5,1]:='';
Form_peach.StringGridList.Cells[10,1]:='';
Form_peach.StringGridList.Cells[12,1]:=s;
Form_peach.StringGridList.Cells[13,1]:='';
Form_peach.StringGridList.Cells[14,1]:='';
Form_peach.StringGridList.Cells[15,1]:='';
Form_peach.StringGridList.Cells[16,1]:='1';
if Form_peach.StringGridList.RowCount>1 then Form_peach.StringGridList.Cells[16,1]:='1';
Form_peach.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,Form_peach.OpenDialogArchive.Filename);
filemode:=0;
reset(f);
srcfilesize(Form_peach.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
   Form_peach.StringGridList.RowCount:=1;
   pMessageWarningOK(txt_list_error);
   exit;
end;
Form_peach.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;
   Form_peach.StringGridList.RowCount:=Form_peach.StringGridList.RowCount+1;
   Form_peach.StringGridList.Cells[3,i]:=copy(s,1,pos(char($09),s)-1);
   Form_peach.StringGridList.Cells[14,i]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,i]))))+inttostr(length(Form_peach.StringGridList.Cells[3,i]))+Form_peach.StringGridList.Cells[3,i];
   size:=size+strtoqword(Form_peach.StringGridList.Cells[3,i]);
   Form_peach.StringGridList.Cells[12,i]:=ansitoutf8(copy(s,pos(char($09),s)+1,length(s)));
   Form_peach.StringGridList.Cells[1,i]:=extractfilename(Form_peach.StringGridList.Cells[12,i]);
   Form_peach.StringGridList.Cells[2,i]:=extractfileext(Form_peach.StringGridList.Cells[1,i]);
   Form_peach.StringGridList.Cells[16,i]:='0';
   blockread(f,b,1);
until end_browse=true;
closefile(f);
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.Cells[16,1]:='1';
   Form_peach.StringGridList.Row:=1;
   end;
ratio_info_reduced(0,i,size,csize);
end;

procedure browse_zpaq;
var
   s,s1,s2,s4,s5,cl,jobcode,outname:ansistring;
   size,csize:qword;
   i,k,vparam:integer;
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;
Form_peach.StringGridList.RowCount:=Form_peach.MemoList.Lines.Count;
for i:=0 to Form_peach.MemoList.Lines.Count-1 do
   begin
   s:=Form_peach.MemoList.Lines[i];
   if i=0 then //identify forks
      begin
      s:=copy(Form_peach.MemoList.Lines[i],1,9);
      if s='zpaqfranz' then vparam:=7 else vparam:=0;
      end;
   if s<>'' then
      if s[1]='-' then
         begin
         k:=k+1;
         s:=copy(Form_peach.MemoList.Lines[i],42+vparam,length(Form_peach.MemoList.Lines[i])-41+vparam);//name
         s1:=extractfileext(s);
         s2:=copy(Form_peach.MemoList.Lines[i],23,12+vparam);//size
         s4:=copy(Form_peach.MemoList.Lines[i],3,19);//datetime
         s5:=copy(Form_peach.MemoList.Lines[i],36+vparam,6);//attributes
         Form_peach.StringGridList.Cells[12,k]:=s;
         Form_peach.StringGridList.Cells[1,k]:=extractfilename(s);
         Form_peach.StringGridList.Cells[2,k]:=s1;
         Form_peach.StringGridList.Cells[13,k]:=prefixf+smartsortable(Form_peach.StringGridList.Cells[1,k]);
         Form_peach.StringGridList.Cells[3,k]:=s2;
         Form_peach.StringGridList.Cells[4,k]:='';//s3;
         Form_peach.StringGridList.Cells[5,k]:=s4;
         Form_peach.StringGridList.Cells[10,k]:=s5;
         Form_peach.StringGridList.Cells[16,k]:='0';
         if s5='D     ' then
            begin
            s:=copy(Form_peach.MemoList.Lines[i],42+vparam,length(Form_peach.MemoList.Lines[i])-41+vparam);
            if s<>'' then
               if s[length(s)]='/' then setlength(s,length(s)-1);
            s1:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[12,k]:=s;
            Form_peach.StringGridList.Cells[1,k]:=extractfilename(s);
            Form_peach.StringGridList.Cells[2,k]:=s1;
            Form_peach.StringGridList.Cells[3,k]:='';
            Form_peach.StringGridList.Cells[13,k]:=prefixd+smartsortable(Form_peach.StringGridList.Cells[1,k]);
            end;
         try
         size:=size+strtoqword(Form_peach.StringGridList.Cells[3,k]);
         except
         end;
      end;
   end;
Form_peach.StringGridList.RowCount:=k+1;
if Form_peach.StringGridList.RowCount=1 then Form_peach.StringGridList.RowCount:=2;
try
Form_peach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if az=false then sort_za_stringgridlist(listsortcol);
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.Cells[16,1]:='1';
   Form_peach.StringGridList.Row:=1;
   end;
i:=Form_peach.StringGridList.Rowcount-1;
ratio_info_reduced(0,i,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(Form_peach.MemoList.Lines[8],1,4);
if lincontrol<>'Date' then title_lines_ace:=8;
{$ENDIF}
Form_peach.StringGridList.RowCount:=Form_peach.MemoList.Lines.Count-title_lines_ace-1;
for i:=title_lines_ace to Form_peach.MemoList.Lines.Count-3 do
   begin
   {$IFDEF MSWINDOWS}
   s:=copy(Form_peach.MemoList.Lines[i],9,length(Form_peach.MemoList.Lines[i])-8);
   k:=pos('  (',s);//theorically it's not an univocous marker!
   s:=copy(s,1,k-1);
   Form_peach.StringGridList.Cells[12,i-title_lines_ace+1]:=s;
   Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]:=extractfilename(s);
   Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]:=extractfileext(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
   nfiles:=nfiles+1;
   Form_peach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixf+smartsortable(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
   s:=copy(Form_peach.MemoList.Lines[i],9,length(Form_peach.MemoList.Lines[i])-8);
   k:=pos('  (',s);
   k2:=pos(' byte uncompressed, ',s);
   s:=copy(s,k+3,k2-k-3);
   Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]:=s;
   try
    size:=size+strtoqword(Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]);
   except
   end;
   Form_peach.StringGridList.Cells[14,i-title_lines_ace+1]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]))))+inttostr(length(Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]))+Form_peach.StringGridList.Cells[3,i-title_lines_ace+1];
   s:=copy(Form_peach.MemoList.Lines[i],9,length(Form_peach.MemoList.Lines[i])-8);
   k:=pos(' byte uncompressed, ',s);
   k2:=pos(' byte compressed)',s);
   s:=copy(s,k+20,k2-k-20);
   Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]:=s;
   try
    csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]);
   except
   end;
   Form_peach.StringGridList.Cells[15,i-title_lines_ace+1]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]))))+inttostr(length(Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]))+Form_peach.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 (Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]='') and
      (Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]='0') then
      begin
      Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]:=txt_list_isfolder;
      nfiles:=nfiles-1;
      nfolders:=nfolders+1;
      Form_peach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixd+smartsortable(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
      end;
   Form_peach.StringGridList.Cells[5,i-title_lines_ace+1]:='';//date/time (not featured by the executable)
   Form_peach.StringGridList.Cells[10,i-title_lines_ace+1]:='';//attributes (not featured by the executable)
   {$ENDIF}
   {$IFDEF LINUX}
   s:=copy(Form_peach.MemoList.Lines[i],45,length(Form_peach.MemoList.Lines[i])-44);
   Form_peach.StringGridList.Cells[12,i-title_lines_ace+1]:=s;
   Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]:=extractfilename(s);
   Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]:=extractfileext(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
   Form_peach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixf+smartsortable(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
   //date/time
   Form_peach.StringGridList.Cells[5,i-title_lines_ace+1]:=copy(Form_peach.MemoList.Lines[i],1,8)+' '+copy(Form_peach.MemoList.Lines[i],10,5);
   //size
   Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]:=copy(Form_peach.MemoList.Lines[i],28,9);
   try
    size:=size+strtoqword(Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]);
   except
   end;
   Form_peach.StringGridList.Cells[14,i-title_lines_ace+1]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]))))+inttostr(length(Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]))+Form_peach.StringGridList.Cells[3,i-title_lines_ace+1];
   //packed
   Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]:=copy(Form_peach.MemoList.Lines[i],16,11);
   try
    csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]);
   except
   end;
   Form_peach.StringGridList.Cells[15,i-title_lines_ace+1]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]))))+inttostr(length(Form_peach.StringGridList.Cells[4,i-title_lines_ace+1]))+Form_peach.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 (Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]='') and
      (Form_peach.StringGridList.Cells[3,i-title_lines_ace+1]='0') then
      begin
      Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]:=txt_list_isfolder;
      Form_peach.StringGridList.Cells[13,i-title_lines_ace+1]:=prefixd+smartsortable(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
      end;
   Form_peach.StringGridList.Cells[10,i-title_lines_ace+1]:='';//attributes (not featured by the executable)
   {$ENDIF}
   Form_peach.StringGridList.Cells[16,i-title_lines_ace+1]:='0';
   end;
try
Form_peach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if az=false then sort_za_stringgridlist(listsortcol);
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.Cells[16,1]:='1';
   Form_peach.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 Form_peach.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 Form_peach.MemoList.Lines.Count=0 then
   begin
   seemencrypted:=true;
   set_pw;
   end
else
   begin
   //add rr_lines_arc to title lines if the archive contains recovery records
   dummy:=Form_peach.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
      Form_peach.StringGridList.RowCount:=Form_peach.MemoList.Lines.Count-title_lines_arc-bottom_lines_arc+2;
      for i:=title_lines_arc to Form_peach.MemoList.Lines.Count-bottom_lines_arc do
         begin
         h:=i-title_lines_arc+1;
         s:=ansitoutf8(copy(Form_peach.MemoList.Lines[i],70,length(Form_peach.MemoList.Lines[i])-69));
         tempcharcodefixarc(s);
         Form_peach.StringGridList.Cells[1,h]:=extractfilename(s);
         if seemencrypted=true then Form_peach.StringGridList.Cells[1,h]:=Form_peach.StringGridList.Cells[1,h]+' *';
         if copy(Form_peach.MemoList.Lines[i],22,1)='D' then
            begin
            Form_peach.StringGridList.Cells[12,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=txt_list_isfolder;
            nfolders:=nfolders+1;
            Form_peach.StringGridList.Cells[13,h]:=prefixd+smartsortable(Form_peach.StringGridList.Cells[1,h]);
            end
         else
            begin
            Form_peach.StringGridList.Cells[12,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=extractfileext(Form_peach.StringGridList.Cells[12,h]);
            nfiles:=nfiles+1;
            Form_peach.StringGridList.Cells[13,h]:=prefixf+smartsortable(Form_peach.StringGridList.Cells[1,h]);
            end;
         Form_peach.StringGridList.Cells[3,h]:=trimleft(copy(Form_peach.MemoList.Lines[i],29,15));
         Form_peach.StringGridList.Cells[14,h]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,h]))))+inttostr(length(Form_peach.StringGridList.Cells[3,h]))+Form_peach.StringGridList.Cells[3,h];
         Form_peach.StringGridList.Cells[4,h]:=trimleft(copy(Form_peach.MemoList.Lines[i],45,15));
         Form_peach.StringGridList.Cells[15,h]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,h]))))+inttostr(length(Form_peach.StringGridList.Cells[4,h]))+Form_peach.StringGridList.Cells[4,h];
         try
            size:=size+strtoqword(Form_peach.StringGridList.Cells[3,h]);
            csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,h]);
         except
         end;
         Form_peach.StringGridList.Cells[5,h]:=copy(Form_peach.MemoList.Lines[i],1,19);
         Form_peach.StringGridList.Cells[10,h]:=copy(Form_peach.MemoList.Lines[i],21,7);
         Form_peach.StringGridList.Cells[11,h]:=copy(Form_peach.MemoList.Lines[i],61,8);
         Form_peach.StringGridList.Cells[16,h]:='0';
         end;
      end;
   end;
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   if az=false then sort_za_stringgridlist(listsortcol);
   Form_peach.StringGridList.Cells[16,1]:='1';
   Form_peach.StringGridList.Row:=1;
   end;
if csize=0 then
   begin
   try
      srcfilesize(Form_peach.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 Form_peach.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 Form_peach.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 Form_peach.MemoList.Lines.Count=0 then
   begin
   seemencrypted:=true;
   set_pw;
   end
else
   begin
   //add rr_lines_arc to title lines if the archive contains recovery records
   dummy:=Form_peach.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
      Form_peach.StringGridList.RowCount:=Form_peach.MemoList.Lines.Count-title_lines_arc-bottom_lines_arc;
      for i:=title_lines_arc+1 to Form_peach.MemoList.Lines.Count-bottom_lines_arc-1 do
         begin
         h:=i-title_lines_arc;
         s:=ansitoutf8(copy(Form_peach.MemoList.Lines[i],70,length(Form_peach.MemoList.Lines[i])-69));
         tempcharcodefixarc(s);
         Form_peach.StringGridList.Cells[1,h]:=extractfilename(s);
         if seemencrypted=true then Form_peach.StringGridList.Cells[1,h]:=Form_peach.StringGridList.Cells[1,h]+' *';
         if copy(Form_peach.MemoList.Lines[i],22,1)='D' then
            begin
            Form_peach.StringGridList.Cells[12,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=txt_list_isfolder;
            nfolders:=nfolders+1;
            Form_peach.StringGridList.Cells[13,h]:=prefixd+smartsortable(Form_peach.StringGridList.Cells[1,h]);
            end
         else
            begin
            Form_peach.StringGridList.Cells[12,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=extractfileext(Form_peach.StringGridList.Cells[12,h]);
            nfiles:=nfiles+1;
            Form_peach.StringGridList.Cells[13,h]:=prefixf+smartsortable(Form_peach.StringGridList.Cells[1,h]);
            end;
         Form_peach.StringGridList.Cells[3,h]:=trimleft(copy(Form_peach.MemoList.Lines[i],29,15));
         Form_peach.StringGridList.Cells[14,h]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,h]))))+inttostr(length(Form_peach.StringGridList.Cells[3,h]))+Form_peach.StringGridList.Cells[3,h];
         Form_peach.StringGridList.Cells[4,h]:=trimleft(copy(Form_peach.MemoList.Lines[i],45,15));
         Form_peach.StringGridList.Cells[15,h]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[4,h]))))+inttostr(length(Form_peach.StringGridList.Cells[4,h]))+Form_peach.StringGridList.Cells[4,h];
         try
            size:=size+strtoqword(Form_peach.StringGridList.Cells[3,h]);
            csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,h]);
         except
         end;
         Form_peach.StringGridList.Cells[5,h]:=copy(Form_peach.MemoList.Lines[i],1,19);
         Form_peach.StringGridList.Cells[10,h]:=copy(Form_peach.MemoList.Lines[i],21,7);
         Form_peach.StringGridList.Cells[11,h]:=copy(Form_peach.MemoList.Lines[i],61,8);
         Form_peach.StringGridList.Cells[16,h]:='0';
         end;
      end;
   end;
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   if az=false then sort_za_stringgridlist(listsortcol);
   Form_peach.StringGridList.Cells[16,1]:='1';
   Form_peach.StringGridList.Row:=1;
   end;
if csize=0 then
   begin
   try
      srcfilesize(Form_peach.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 Form_peach.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;

function cleardirsimple(var s:ansistring):integer;
var
   P: tprocessutf8;
   cl:ansistring;
   ntry:integer;
begin
result:=-1;
if s='' then
   begin
   result:=0;
   exit;
   end;
if not(directoryexists((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}
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, poWaitOnExit];
cl:='cmd /c rmdir "'+s+'" /s /q';
P.CommandLine:=cl;
P.Execute;
result:=P.ExitStatus;
P.Free;
{$ELSE} //system needs to support rm command
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
cl:='rm -r '+stringdelim(s);
P.CommandLine:=cl;
P.Execute;
result:=P.ExitStatus;
P.Free;
{$ENDIF}
if directoryexists(s) then result:=-1;
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(directoryexists((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 Form_peach.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}
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, poWaitOnExit];
cl:='cmd /c rmdir "'+s+'" /s /q';
P.CommandLine:=cl;
P.Execute;
cleardir:=P.ExitStatus;
P.Free;
{$ELSE} //system needs to support rm command
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
cl:='rm -r '+stringdelim(s);
P.CommandLine:=cl;
P.Execute;
cleardir:=P.ExitStatus;
P.Free;
{$ENDIF}
if directoryexists(s) then
   begin
   if Form_peach.Visible=true then Application.ProcessMessages;
   sleep(250+random(250));
   {$IFDEF MSWINDOWS}
   P:=tprocessutf8.Create(nil);
   P.Options := [poNoConsole, poWaitOnExit];
   cl:='cmd /c rmdir "'+s+'" /s /q';
   P.CommandLine:=cl;
   P.Execute;
   cleardir:=P.ExitStatus;
   P.Free;
   {if directoryexists(s) then
      if winver='nt6+' then
      begin
      if Form_peach.Visible=true then Application.ProcessMessages;
      sleep(250+random(250));
      P:=tprocessutf8.Create(nil);
      P.Options :=  [poWaitOnExit];
      cl:='powershell.exe Remove-Item -path "'+s+'" -recurse -force';
      P.CommandLine:=cl;
      P.Execute;
      cleardir:=P.ExitStatus;
      P.Free;
      end;}
   {$ELSE} //system needs to support rm command
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit];
   cl:='rm -r '+stringdelim(s);
   P.CommandLine:=cl;
   P.Execute;
   cleardir:=P.ExitStatus;
   P.Free;
   {$ENDIF}
   end;
if directoryexists(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 Form_peach.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;

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 char;
begin
{$IFDEF MSWINDOWS}
GetLogicalDriveStrings(255,@drivestr);
i:=1;
nunits:=0;
repeat
   s:='';
   nunits:=nunits+1;
   while (i<=255) and (drivestr[i]<>#00) do
      begin
      s:=s+char(drivestr[i]);
      inc(i);
      end;
   inc(i);
until length(s)=0;
nunits:=nunits-1;
{$ENDIF}
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 char;
   tsin,tsout:TTimeStamp;
   tdiff:qword;
   ErrorMode: Word;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
for n:=1 to 26 do devname[n]:='';
try
GetLogicalDriveStrings(255,@drivestr);
i:=1;
j:=1;
k:=0;
tsin:=datetimetotimestamp(now);
repeat
   s:='';
   dtype:='';
   dname:='';
   uncname:='';
   bufVolumeName:='';
   k:=k+1;
   while (i<=255) and (drivestr[i]<>#00) 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
   Form_peach.pmjd1.Visible:=true;
   Form_peach.pmjd1.Caption:=devname[1];
   Form_peach.pmjd1.bitmap:=setpcmenuicon(devtype[1]);
   Form_peach.pojdn1.Visible:=true;
   Form_peach.pojdn1.Caption:=devname[1];
   Form_peach.pojdn1.bitmap:=Form_peach.pmjd1.bitmap;
   Form_peach.pajdn1.Visible:=true;
   Form_peach.pajdn1.Caption:=devname[1];
   Form_peach.pajdn1.bitmap:=Form_peach.pmjd1.bitmap;
   end
else
   begin
   Form_peach.pmjd1.Visible:=false;
   Form_peach.pojdn1.Visible:=false;
   Form_peach.pajdn1.Visible:=false;
   end;
if devname[2]<>'' then
   begin
   Form_peach.pmjd2.Visible:=true;
   Form_peach.pmjd2.Caption:=devname[2];
   Form_peach.pmjd2.bitmap:=setpcmenuicon(devtype[2]);
   Form_peach.pojdn2.Visible:=true;
   Form_peach.pojdn2.Caption:=devname[2];
   Form_peach.pojdn2.bitmap:=Form_peach.pmjd2.bitmap;
   Form_peach.pajdn2.Visible:=true;
   Form_peach.pajdn2.Caption:=devname[2];
   Form_peach.pajdn2.bitmap:=Form_peach.pmjd2.bitmap;
   end
else
   begin
   Form_peach.pmjd2.Visible:=false;
   Form_peach.pojdn2.Visible:=false;
   Form_peach.pajdn2.Visible:=false;
   end;
if devname[3]<>'' then
   begin
   Form_peach.pmjd3.Visible:=true;
   Form_peach.pmjd3.Caption:=devname[3];
   Form_peach.pmjd3.bitmap:=setpcmenuicon(devtype[3]);
   Form_peach.pojdn3.Visible:=true;
   Form_peach.pojdn3.Caption:=devname[3];
   Form_peach.pojdn3.bitmap:=Form_peach.pmjd3.bitmap;
   Form_peach.pajdn3.Visible:=true;
   Form_peach.pajdn3.Caption:=devname[3];
   Form_peach.pajdn3.bitmap:=Form_peach.pmjd3.bitmap;
   end
else
   begin
   Form_peach.pmjd3.Visible:=false;
   Form_peach.pojdn3.Visible:=false;
   Form_peach.pajdn3.Visible:=false;
   end;
if devname[4]<>'' then
   begin
   Form_peach.pmjd4.Visible:=true;
   Form_peach.pmjd4.Caption:=devname[4];
   Form_peach.pmjd4.bitmap:=setpcmenuicon(devtype[4]);
   Form_peach.pojdn4.Visible:=true;
   Form_peach.pojdn4.Caption:=devname[4];
   Form_peach.pojdn4.bitmap:=Form_peach.pmjd4.bitmap;
   Form_peach.pajdn4.Visible:=true;
   Form_peach.pajdn4.Caption:=devname[4];
   Form_peach.pajdn4.bitmap:=Form_peach.pmjd4.bitmap;
   end
else
   begin
   Form_peach.pmjd4.Visible:=false;
   Form_peach.pojdn4.Visible:=false;
   Form_peach.pajdn4.Visible:=false;
   end;
if devname[5]<>'' then
   begin
   Form_peach.pmjd5.Visible:=true;
   Form_peach.pmjd5.Caption:=devname[5];
   Form_peach.pmjd5.bitmap:=setpcmenuicon(devtype[5]);
   Form_peach.pojdn5.Visible:=true;
   Form_peach.pojdn5.Caption:=devname[5];
   Form_peach.pojdn5.bitmap:=Form_peach.pmjd5.bitmap;
   Form_peach.pajdn5.Visible:=true;
   Form_peach.pajdn5.Caption:=devname[5];
   Form_peach.pajdn5.bitmap:=Form_peach.pmjd5.bitmap;
   end
else
   begin
   Form_peach.pmjd5.Visible:=false;
   Form_peach.pojdn5.Visible:=false;
   Form_peach.pajdn5.Visible:=false;
   end;
if devname[6]<>'' then
   begin
   Form_peach.pmjd6.Visible:=true;
   Form_peach.pmjd6.Caption:=devname[6];
   Form_peach.pmjd6.bitmap:=setpcmenuicon(devtype[6]);
   Form_peach.pojdn6.Visible:=true;
   Form_peach.pojdn6.Caption:=devname[6];
   Form_peach.pojdn6.bitmap:=Form_peach.pmjd6.bitmap;
   Form_peach.pajdn6.Visible:=true;
   Form_peach.pajdn6.Caption:=devname[6];
   Form_peach.pajdn6.bitmap:=Form_peach.pmjd6.bitmap;
   end
else
   begin
   Form_peach.pmjd6.Visible:=false;
   Form_peach.pojdn6.Visible:=false;
   Form_peach.pajdn6.Visible:=false;
   end;
if devname[7]<>'' then
   begin
   Form_peach.pmjd7.Visible:=true;
   Form_peach.pmjd7.Caption:=devname[7];
   Form_peach.pmjd7.bitmap:=setpcmenuicon(devtype[7]);
   Form_peach.pojdn7.Visible:=true;
   Form_peach.pojdn7.Caption:=devname[7];
   Form_peach.pojdn7.bitmap:=Form_peach.pmjd7.bitmap;
   Form_peach.pajdn7.Visible:=true;
   Form_peach.pajdn7.Caption:=devname[7];
   Form_peach.pajdn7.bitmap:=Form_peach.pmjd7.bitmap;
   end
else
   begin
   Form_peach.pmjd7.Visible:=false;
   Form_peach.pojdn7.Visible:=false;
   Form_peach.pajdn7.Visible:=false;
   end;
if devname[8]<>'' then
   begin
   Form_peach.pmjd8.Visible:=true;
   Form_peach.pmjd8.Caption:=devname[8];
   Form_peach.pmjd8.bitmap:=setpcmenuicon(devtype[8]);
   Form_peach.pojdn8.Visible:=true;
   Form_peach.pojdn8.Caption:=devname[8];
   Form_peach.pojdn8.bitmap:=Form_peach.pmjd8.bitmap;
   Form_peach.pajdn8.Visible:=true;
   Form_peach.pajdn8.Caption:=devname[8];
   Form_peach.pajdn8.bitmap:=Form_peach.pmjd8.bitmap;
   end
else
   begin
   Form_peach.pmjd8.Visible:=false;
   Form_peach.pojdn8.Visible:=false;
   Form_peach.pajdn8.Visible:=false;
   end;
if devname[9]<>'' then
   begin
   Form_peach.pmjd9.Visible:=true;
   Form_peach.pmjd9.Caption:=devname[9];
   Form_peach.pmjd9.bitmap:=setpcmenuicon(devtype[9]);
   Form_peach.pojdn9.Visible:=true;
   Form_peach.pojdn9.Caption:=devname[9];
   Form_peach.pojdn9.bitmap:=Form_peach.pmjd9.bitmap;
   Form_peach.pajdn9.Visible:=true;
   Form_peach.pajdn9.Caption:=devname[9];
   Form_peach.pajdn9.bitmap:=Form_peach.pmjd9.bitmap;
   end
else
   begin
   Form_peach.pmjd9.Visible:=false;
   Form_peach.pojdn9.Visible:=false;
   Form_peach.pajdn9.Visible:=false;
   end;
if devname[10]<>'' then
   begin
   Form_peach.pmjd10.Visible:=true;
   Form_peach.pmjd10.Caption:=devname[10];
   Form_peach.pmjd10.bitmap:=setpcmenuicon(devtype[10]);
   Form_peach.pojdn10.Visible:=true;
   Form_peach.pojdn10.Caption:=devname[10];
   Form_peach.pojdn10.bitmap:=Form_peach.pmjd10.bitmap;
   Form_peach.pajdn10.Visible:=true;
   Form_peach.pajdn10.Caption:=devname[10];
   Form_peach.pajdn10.bitmap:=Form_peach.pmjd10.bitmap;
   end
else
   begin
   Form_peach.pmjd10.Visible:=false;
   Form_peach.pojdn10.Visible:=false;
   Form_peach.pajdn10.Visible:=false;
   end;
if devname[11]<>'' then
   begin
   Form_peach.pmjd11.Visible:=true;
   Form_peach.pmjd11.Caption:=devname[11];
   Form_peach.pmjd11.bitmap:=setpcmenuicon(devtype[11]);
   Form_peach.pojdn11.Visible:=true;
   Form_peach.pojdn11.Caption:=devname[11];
   Form_peach.pojdn11.bitmap:=Form_peach.pmjd11.bitmap;
   Form_peach.pajdn11.Visible:=true;
   Form_peach.pajdn11.Caption:=devname[11];
   Form_peach.pajdn11.bitmap:=Form_peach.pmjd11.bitmap;
   end
else
   begin
   Form_peach.pmjd11.Visible:=false;
   Form_peach.pojdn11.Visible:=false;
   Form_peach.pajdn11.Visible:=false;
   end;
if devname[12]<>'' then
   begin
   Form_peach.pmjd12.Visible:=true;
   Form_peach.pmjd12.Caption:=devname[12];
   Form_peach.pmjd12.bitmap:=setpcmenuicon(devtype[12]);
   Form_peach.pojdn12.Visible:=true;
   Form_peach.pojdn12.Caption:=devname[12];
   Form_peach.pojdn12.bitmap:=Form_peach.pmjd12.bitmap;
   Form_peach.pajdn12.Visible:=true;
   Form_peach.pajdn12.Caption:=devname[12];
   Form_peach.pajdn12.bitmap:=Form_peach.pmjd12.bitmap;
   end
else
   begin
   Form_peach.pmjd12.Visible:=false;
   Form_peach.pojdn12.Visible:=false;
   Form_peach.pajdn12.Visible:=false;
   end;
if devname[13]<>'' then
   begin
   Form_peach.pmjd13.Visible:=true;
   Form_peach.pmjd13.Caption:=devname[13];
   Form_peach.pmjd13.bitmap:=setpcmenuicon(devtype[13]);
   Form_peach.pojdn13.Visible:=true;
   Form_peach.pojdn13.Caption:=devname[13];
   Form_peach.pojdn13.bitmap:=Form_peach.pmjd13.bitmap;
   Form_peach.pajdn13.Visible:=true;
   Form_peach.pajdn13.Caption:=devname[13];
   Form_peach.pajdn13.bitmap:=Form_peach.pmjd13.bitmap;
   end
else
   begin
   Form_peach.pmjd13.Visible:=false;
   Form_peach.pojdn13.Visible:=false;
   Form_peach.pajdn13.Visible:=false;
   end;
if devname[14]<>'' then
   begin
   Form_peach.pmjd14.Visible:=true;
   Form_peach.pmjd14.Caption:=devname[14];
   Form_peach.pmjd14.bitmap:=setpcmenuicon(devtype[14]);
   Form_peach.pojdn14.Visible:=true;
   Form_peach.pojdn14.Caption:=devname[14];
   Form_peach.pojdn14.bitmap:=Form_peach.pmjd14.bitmap;
   Form_peach.pajdn14.Visible:=true;
   Form_peach.pajdn14.Caption:=devname[14];
   Form_peach.pajdn14.bitmap:=Form_peach.pmjd14.bitmap;
   end
else
   begin
   Form_peach.pmjd14.Visible:=false;
   Form_peach.pojdn14.Visible:=false;
   Form_peach.pajdn14.Visible:=false;
   end;
if devname[15]<>'' then
   begin
   Form_peach.pmjd15.Visible:=true;
   Form_peach.pmjd15.Caption:=devname[15];
   Form_peach.pmjd15.bitmap:=setpcmenuicon(devtype[15]);
   Form_peach.pojdn15.Visible:=true;
   Form_peach.pojdn15.Caption:=devname[15];
   Form_peach.pojdn15.bitmap:=Form_peach.pmjd15.bitmap;
   Form_peach.pajdn15.Visible:=true;
   Form_peach.pajdn15.Caption:=devname[15];
   Form_peach.pajdn15.bitmap:=Form_peach.pmjd15.bitmap;
   end
else
   begin
   Form_peach.pmjd15.Visible:=false;
   Form_peach.pojdn15.Visible:=false;
   Form_peach.pajdn15.Visible:=false;
   end;
if devname[16]<>'' then
   begin
   Form_peach.pmjd16.Visible:=true;
   Form_peach.pmjd16.Caption:=devname[16];
   Form_peach.pmjd16.bitmap:=setpcmenuicon(devtype[16]);
   Form_peach.pojdn16.Visible:=true;
   Form_peach.pojdn16.Caption:=devname[16];
   Form_peach.pojdn16.bitmap:=Form_peach.pmjd16.bitmap;
   Form_peach.pajdn16.Visible:=true;
   Form_peach.pajdn16.Caption:=devname[16];
   Form_peach.pajdn16.bitmap:=Form_peach.pmjd16.bitmap;
   end
else
   begin
   Form_peach.pmjd16.Visible:=false;
   Form_peach.pojdn16.Visible:=false;
   Form_peach.pajdn16.Visible:=false;
   end;
if devname[17]<>'' then
   begin
   Form_peach.pmjd17.Visible:=true;
   Form_peach.pmjd17.Caption:=devname[17];
   Form_peach.pmjd17.bitmap:=setpcmenuicon(devtype[17]);
   Form_peach.pojdn17.Visible:=true;
   Form_peach.pojdn17.Caption:=devname[17];
   Form_peach.pojdn17.bitmap:=Form_peach.pmjd17.bitmap;
   Form_peach.pajdn17.Visible:=true;
   Form_peach.pajdn17.Caption:=devname[17];
   Form_peach.pajdn17.bitmap:=Form_peach.pmjd17.bitmap;
   end
else
   begin
   Form_peach.pmjd17.Visible:=false;
   Form_peach.pojdn17.Visible:=false;
   Form_peach.pajdn17.Visible:=false;
   end;
if devname[18]<>'' then
   begin
   Form_peach.pmjd18.Visible:=true;
   Form_peach.pmjd18.Caption:=devname[18];
   Form_peach.pmjd18.bitmap:=setpcmenuicon(devtype[18]);
   Form_peach.pojdn18.Visible:=true;
   Form_peach.pojdn18.Caption:=devname[18];
   Form_peach.pojdn18.bitmap:=Form_peach.pmjd18.bitmap;
   Form_peach.pajdn18.Visible:=true;
   Form_peach.pajdn18.Caption:=devname[18];
   Form_peach.pajdn18.bitmap:=Form_peach.pmjd18.bitmap;
   end
else
   begin
   Form_peach.pmjd18.Visible:=false;
   Form_peach.pojdn18.Visible:=false;
   Form_peach.pajdn18.Visible:=false;
   end;
if devname[19]<>'' then
   begin
   Form_peach.pmjd19.Visible:=true;
   Form_peach.pmjd19.Caption:=devname[19];
   Form_peach.pmjd19.bitmap:=setpcmenuicon(devtype[19]);
   Form_peach.pojdn19.Visible:=true;
   Form_peach.pojdn19.Caption:=devname[19];
   Form_peach.pojdn19.bitmap:=Form_peach.pmjd19.bitmap;
   Form_peach.pajdn19.Visible:=true;
   Form_peach.pajdn19.Caption:=devname[19];
   Form_peach.pajdn19.bitmap:=Form_peach.pmjd19.bitmap;
   end
else
   begin
   Form_peach.pmjd19.Visible:=false;
   Form_peach.pojdn19.Visible:=false;
   Form_peach.pajdn19.Visible:=false;
   end;
if devname[20]<>'' then
   begin
   Form_peach.pmjd20.Visible:=true;
   Form_peach.pmjd20.Caption:=devname[20];
   Form_peach.pmjd20.bitmap:=setpcmenuicon(devtype[20]);
   Form_peach.pojdn20.Visible:=true;
   Form_peach.pojdn20.Caption:=devname[20];
   Form_peach.pojdn20.bitmap:=Form_peach.pmjd20.bitmap;
   Form_peach.pajdn20.Visible:=true;
   Form_peach.pajdn20.Caption:=devname[20];
   Form_peach.pajdn20.bitmap:=Form_peach.pmjd20.bitmap;
   end
else
   begin
   Form_peach.pmjd20.Visible:=false;
   Form_peach.pojdn20.Visible:=false;
   Form_peach.pajdn20.Visible:=false;
   end;
if devname[21]<>'' then
   begin
   Form_peach.pmjd21.Visible:=true;
   Form_peach.pmjd21.Caption:=devname[21];
   Form_peach.pmjd21.bitmap:=setpcmenuicon(devtype[21]);
   Form_peach.pojdn21.Visible:=true;
   Form_peach.pojdn21.Caption:=devname[21];
   Form_peach.pojdn21.bitmap:=Form_peach.pmjd21.bitmap;
   Form_peach.pajdn21.Visible:=true;
   Form_peach.pajdn21.Caption:=devname[21];
   Form_peach.pajdn21.bitmap:=Form_peach.pmjd21.bitmap;
   end
else
   begin
   Form_peach.pmjd21.Visible:=false;
   Form_peach.pojdn21.Visible:=false;
   Form_peach.pajdn21.Visible:=false;
   end;
if devname[22]<>'' then
   begin
   Form_peach.pmjd22.Visible:=true;
   Form_peach.pmjd22.Caption:=devname[22];
   Form_peach.pmjd22.bitmap:=setpcmenuicon(devtype[22]);
   Form_peach.pojdn22.Visible:=true;
   Form_peach.pojdn22.Caption:=devname[22];
   Form_peach.pojdn22.bitmap:=Form_peach.pmjd22.bitmap;
   Form_peach.pajdn22.Visible:=true;
   Form_peach.pajdn22.Caption:=devname[22];
   Form_peach.pajdn22.bitmap:=Form_peach.pmjd22.bitmap;
   end
else
   begin
   Form_peach.pmjd22.Visible:=false;
   Form_peach.pojdn22.Visible:=false;
   Form_peach.pajdn22.Visible:=false;
   end;
if devname[23]<>'' then
   begin
   Form_peach.pmjd23.Visible:=true;
   Form_peach.pmjd23.Caption:=devname[23];
   Form_peach.pmjd23.bitmap:=setpcmenuicon(devtype[23]);
   Form_peach.pojdn23.Visible:=true;
   Form_peach.pojdn23.Caption:=devname[23];
   Form_peach.pojdn23.bitmap:=Form_peach.pmjd23.bitmap;
   Form_peach.pajdn23.Visible:=true;
   Form_peach.pajdn23.Caption:=devname[23];
   Form_peach.pajdn23.bitmap:=Form_peach.pmjd23.bitmap;
   end
else
   begin
   Form_peach.pmjd23.Visible:=false;
   Form_peach.pojdn23.Visible:=false;
   Form_peach.pajdn23.Visible:=false;
   end;
if devname[24]<>'' then
   begin
   Form_peach.pmjd24.Visible:=true;
   Form_peach.pmjd24.Caption:=devname[24];
   Form_peach.pmjd24.bitmap:=setpcmenuicon(devtype[24]);
   Form_peach.pojdn24.Visible:=true;
   Form_peach.pojdn24.Caption:=devname[24];
   Form_peach.pojdn24.bitmap:=Form_peach.pmjd24.bitmap;
   Form_peach.pajdn24.Visible:=true;
   Form_peach.pajdn24.Caption:=devname[24];
   Form_peach.pajdn24.bitmap:=Form_peach.pmjd24.bitmap;
   end
else
   begin
   Form_peach.pmjd24.Visible:=false;
   Form_peach.pojdn24.Visible:=false;
   Form_peach.pajdn24.Visible:=false;
   end;
if devname[25]<>'' then
   begin
   Form_peach.pmjd25.Visible:=true;
   Form_peach.pmjd25.Caption:=devname[25];
   Form_peach.pmjd25.bitmap:=setpcmenuicon(devtype[25]);
   Form_peach.pojdn25.Visible:=true;
   Form_peach.pojdn25.Caption:=devname[25];
   Form_peach.pojdn25.bitmap:=Form_peach.pmjd25.bitmap;
   Form_peach.pajdn25.Visible:=true;
   Form_peach.pajdn25.Caption:=devname[25];
   Form_peach.pajdn25.bitmap:=Form_peach.pmjd25.bitmap;
   end
else
   begin
   Form_peach.pmjd25.Visible:=false;
   Form_peach.pojdn25.Visible:=false;
   Form_peach.pajdn25.Visible:=false;
   end;
if devname[26]<>'' then
   begin
   Form_peach.pmjd26.Visible:=true;
   Form_peach.pmjd26.Caption:=devname[26];
   Form_peach.pmjd26.bitmap:=setpcmenuicon(devtype[26]);
   Form_peach.pojdn26.Visible:=true;
   Form_peach.pojdn26.Caption:=devname[26];
   Form_peach.pojdn26.bitmap:=Form_peach.pmjd26.bitmap;
   Form_peach.pajdn26.Visible:=true;
   Form_peach.pajdn26.Caption:=devname[26];
   Form_peach.pajdn26.bitmap:=Form_peach.pmjd26.bitmap;
   end
else
   begin
   Form_peach.pmjd26.Visible:=false;
   Form_peach.pojdn26.Visible:=false;
   Form_peach.pajdn26.Visible:=false;
   end;
//set up to date icons to bookmarked units
populatebookmarks;
populaterecenticonsf;
addtohistorypopup;
update_addressbar(form_peach.EditOpenIn1.Text);
Form_peach.StringGridBookmarks.Repaint;
except
end;
{$ELSE}
{$ENDIF}
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;
Form_peach.EditOpenIn1.Text:=s;
Form_peach.EditOpenIn.Text:=Form_peach.EditOpenIn1.Text;
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
Form_peach.Timer2.Interval:=250;
Form_peach.Timer2.Enabled:=true;
statuss:='';
set_archivetree:=false;
Form_peach.PanelLCA8.Color:=clNone;
Form_peach.ImageListSearch.Enabled:=true;
forceopenasarchive:=false;
{$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 form_peach.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(form_peach.shelltreeview1,s)=1 then ShellTreeViewSetTextPath(form_peach.shelltreeview1,s);
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
Form_peach.StringGridArchive.RowCount:=1;
addmenuenable(1);
if (extractfilename(prevarchive)<>'') then //if previously browsing archive
   if keeppw=0 then
      begin
      FormPW.EditUn7zaPW.Text:='';
      FormPW.EditUn7zaPW1.Text:='';
      FormPW.EditName3.Text:='';
      setpwicons;
      end;
prevarchive:=s;
prepare_filebrowser;
if not(directoryexists(s)) then
   begin
   s1:=s;
   setlength(s1,length(s1)-1);
   s1:=extractfilepath(s1);
   if s1='\\' then listpc
   else
      listingdir:=false;
      exit;
   end;
currentcomp:='';
statust:='';
archive_content:='';
if s<>'' then
   if s[length(s)]<>directoryseparator then Form_peach.EditOpenIn.Text:=s+directoryseparator
else Form_peach.EditOpenIn.Text:=s;
setbuttonmenus;
Form_peach.EditOpenOut.Text:=Form_peach.EditOpenIn.Text;
enter_busy_status;
Form_peach.LabelErrors.Caption:='';
setsearch_enabled;
if Form_peach.labelstatus2.Caption<>txt_2_7_ext then clearlist_ext; //clear extraction list when leaving an archive
Form_peach.StringGridList.RowCount:=1;
status0:=txt_list_searching;
status1:=txt_please_wait;
if Form_peach.visible=true then
   if issearching=2 then
      begin
      scap:=Form_peach.Caption;
      Form_peach.Caption:=txt_search;
      Form_peach.Refresh;
      Application.Processmessages;
      end;
if Form_peach.EditUn7zaFilter.Text='' then Form_peach.EditUn7zaFilter.Text:='*';
if (simplesearch=1) then listdetails(s,'*'+Form_peach.EditUn7zaFilter.Text+'*',faAnyFile,recmode,false,nfiles,ndirs,flist,fsizes,ftimes,fattr,fattr_dec)
else listdetails(s,Form_peach.EditUn7zaFilter.Text,faAnyFile,recmode,false,nfiles,ndirs,flist,fsizes,ftimes,fattr,fattr_dec);
if Form_peach.visible=true then
   if issearching=2 then
      begin
      Form_peach.Caption:=scap;
      end;
Form_peach.StringGridList.BeginUpdate;
Form_peach.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
         Form_Peach.StringGridList.Cells[2,i]:=txt_list_isfolder;
         setlength(fname,length(fname)-1);
         Form_Peach.StringGridList.Cells[13,i]:=prefixd+smartsortable(extractfilename(fname));
         end
      else
         begin
         Form_Peach.StringGridList.Cells[2,i]:=extractfileext(fname);
         Form_Peach.StringGridList.Cells[13,i]:=prefixf+smartsortable(extractfilename(fname));
         end;
   Form_Peach.StringGridList.Cells[1,i]:=extractfilename(fname);
   Form_Peach.StringGridList.Cells[12,i]:=(fname);
   Form_Peach.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
         Form_Peach.StringGridList.Cells[4,i]:='.'
      else
         Form_Peach.StringGridList.Cells[4,i]:='+';
   Form_Peach.StringGridList.Cells[14,i]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,i]))))+inttostr(length(Form_peach.StringGridList.Cells[3,i]))+Form_Peach.StringGridList.Cells[3,i];
   Form_Peach.StringGridList.Cells[15,i]:=Form_Peach.StringGridList.Cells[4,i];
   try Form_Peach.StringGridList.Cells[5,i]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(ftimes[i-1])); except Form_Peach.StringGridList.Cells[5,i]:=''; end;
   dword2decodedFileAttributes(fattr[i-1],fname);
   Form_Peach.StringGridList.Cells[10,i]:=fname;
   Form_peach.StringGridList.Cells[16,i]:='0';
   end;
if Form_peach.StringGridList.Rowcount<2 then Form_peach.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;
{$IFDEF MSWINDOWS}
d:=Form_peach.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;
{$ENDIF}
status_curfilesystem:=upcase(d)+': '+currentfs+' '+nicenumber(IntToStr(sizetotal),filesizebase)+', '+nicenumber(IntToStr(sizefree),filesizebase)+' '+txt_free2+' ('+inttostr(perfree)+'%)';
//Form_peach.shapeFSfree.Height:=Form_peach.shapeFStotal.Height - ((Form_peach.shapeFStotal.Height*sizefree) div sizetotal);
if recmode=true then Form_peach.labelstatus.Caption:=status0+' '+status1+' ['+status_curfilesystem+']';
if Form_peach.visible=true then Application.Processmessages;
Form_peach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if az=false then sort_za_stringgridlist(listsortcol);
set_lastobj;
lastobj:=Form_peach.EditOpenIn.Text;
if recmode=false then status0:=txt_list_browsing
else status0:=txt_list_flat;
if recmode=true then Form_peach.labelstatus.Caption:=status0+' '+status1+' ['+status_curfilesystem+']';
{$IFDEF MSWINDOWS}
d:=Form_peach.EditOpenIn.Text[1];
if d<>directoryseparator then
   begin
   statust:=copy(Form_peach.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:=Form_peach.EditOpenIn.Caption;
   statuss:='';
   end;
{$ENDIF}
Form_peach.StringGridList.EndUpdate(true);
update_listview;
exit_busy_status;
indir:=s;
listingdir:=false;
end;

procedure open_prepare_reduced;
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditNameCustom1.Text:=Form_peach.pcustom1.caption;
status0:=txt_list_browsing;
status1:=txt_list_na;
if fun='FILEBROWSER' then listdir(Form_peach.OpenDialogArchive.Filename, false,false)
else
   begin
   indir:=extractfilepath(Form_peach.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 flat browsing
      testencrypted_open;
      autobrowsetar;
      end;
end;
addtohistory;
end;

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

procedure open_prepare_unarc;
begin
Form_peach.po_delete.visible:=true;
Form_peach.po_delete.Caption:=txt_2_5_delete_fromarchive;
Form_peach.pmmorerr.Visible:=true;
Form_peach.pmmorerecover.Visible:=true;
Form_peach.po_rr.Visible:=true;
Form_peach.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 do_prebrowse;
var
   i:integer;
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilterExclude.Text:='';
prebrowsing:=true;
Form_peach.ShapeProgress.Color:=PGREEN;
Form_peach.ShapeProgress.Visible:=true;
Form_peach.ShapeProgress.Width:=Form_peach.Width*10 div 100;
pperc:=10;
Form_peach.Caption:=txt_open+' '+Form_peach.editopenin.Caption+'...';
application.ProcessMessages;
i:=list_un7z('silent');//don't add to history
prebrowsing:=false;
teststatus(i,statust);
archive_content:=status1;
Form_peach.ShapeProgress.Width:=Form_peach.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(Form_peach.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;
if prebrowse<5 then do_prebrowse;
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 listun7z_expandall;//auto try flat mode if no match is found
testencrypted_open;
Form_peach.ShapeProgress.Visible:=false;
end;

procedure open_supported;
begin
stime:=(DateTimeToFileDate(now));
Form_peach.Timer2.Interval:=500;
Form_peach.Timer2.Enabled:=true;
Form_peach.ImageListSearch.Enabled:=true;
h_folders:=false;
nomatch:=false;
specialopen:=false;
set_extcontext_off;
setsearch_disabled;
currentcomp:=upcase(extractfileext(Form_peach.OpenDialogArchive.Filename));
currentcomp:=copy(currentcomp,2,length(currentcomp)-1);
currentfs:='';
statust:='';
statuss:='';
selnode:=0;
archive_content:='';
status_curarchive:=currentcomp;
addmenuenable(0);
if (fun='UN7Z') or (fun='FILEBROWSER') then
   begin
   Form_peach.mFlat.Visible:=true;
   Form_peach.pmFlat.Visible:=true;
   end
else
   begin
   Form_peach.mFlat.Visible:=false;
   Form_peach.pmFlat.Visible:=true;
   end;
if fun<>'FILEBROWSER' then clearlist_ext;//clear extraction list when opening an archive
browse_option:='';
israr5:='';
funflag:=false;
Form_peach.EditOpenIn.Text:=Form_peach.OpenDialogArchive.Filename;
if (extractfilename(Form_peach.EditOpenIn.Caption)<>'') and //now browsing archive
   (Form_peach.EditOpenIn.Caption<>prevarchive) then //archive is different than previous one
   if keeppw=0 then
      begin
      FormPW.EditUn7zaPW.Text:='';
      FormPW.EditUn7zaPW1.Text:='';
      FormPW.EditName3.Text:='';
      setpwicons;
      end;
prevarchive:=Form_peach.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 check7zvolume(Form_peach.OpenDialogArchive.Filename)=true then
else
   begin
if Form_peach.OpenDialogArchive.Filename='' then Form_peach.OpenDialogArchive.Filename:=Form_peach.EditOpenIn.Text;
Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.OpenDialogArchive.Filename);
if {$IFDEF MSWINDOWS}not(Form_peach.OpenDialogArchive.Filename=txt_mypc) and{$ENDIF}
   not(fileexists((Form_peach.OpenDialogArchive.Filename))) and
   not(directoryexists((Form_peach.OpenDialogArchive.Filename))) then
   begin
   if (Form_peach.OpenDialogArchive.Filename=txt_none) or (Form_peach.OpenDialogArchive.Filename='<none>') then
      begin
      if directoryexists((extractfilepath(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row]))) then
         Form_peach.OpenDialogArchive.Filename:=extractfilepath(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row])
      else
         Form_peach.OpenDialogArchive.Filename:=indir;
      end
   else
      begin
         listingdir:=false;
         exit;
      end;
   end;
   end;
if Form_peach.OpenDialogArchive.Filename<>'\' then
   if fileexists((Form_peach.OpenDialogArchive.Filename)) then
      {$IFNDEF MSWINDOWS}if extractfileext(Form_peach.OpenDialogArchive.Filename)<>'' then{$ENDIF}
      addtoarchivehistory(Form_peach.OpenDialogArchive.Filename); //add only archive files
archiveopened:=true;
lastobj:=Form_peach.OpenDialogArchive.Filename;
if lastobj<>beingpreviewed then
   begin
   keeppreview:=false;
   beingpreviewed:='';
   end;
if keeppreview=false then
   if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
seemencrypted:=false;
fun:='';
fun_status:='';
subfun:='';
if keeppreview=false then create_ptmpcode(ptmpcode);
setpanel_extract(1);
try
   srcfilesize_multipart_v(Form_peach.OpenDialogArchive.Filename,tvol,tsize); //expressed in B
except
end;
testarctype(Form_peach.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;
         Form_peach.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
   Form_peach.iConsoleCreateImport1.PopupMenu:=Form_peach.pmOpenPJ;
   set_extcontext_on;
   end
   else
      Form_peach.iConsoleCreateImport1.PopupMenu:=nil;
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then update_listview;
get_statuss(Form_peach.EditOpenIn.Text);
set_statuss_nav;
fromtree:=false;
if ShellTreeViewSetTextPath(form_peach.shelltreeview1,extractfilepath(Form_peach.EditOpenIn.Text))=1 then ShellTreeViewSetTextPath(form_peach.shelltreeview1,extractfilepath(Form_peach.EditOpenIn.Text));
listingdir:=false;
end;

procedure showbar(s:ansistring);
begin
prevbar:=lastbar;
with form_peach 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;
   splitter1.Enabled:=true;
   Splitter1.Color:=stringtocolor(colbtnhigh);
   pmclip.Checked:=false;
   po_clip.Checked:=false;
   case s of
      'none' :
      begin
      MenuItemOrganizeStatusbar.Checked:=false;
      mshowstatusbar.Checked:=false;
      splitter1.top:=PanelFilters.Height;
      lastbar:=1;
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      panelfilebrowseroptions.visible:=false;
      pmstatusnone.Checked:=true;
      end;
      'statusbar' :
      begin
      splitter1.top:=PanelFilters.Height-PanelBottom.Height;
      Splitter1.Color:=Form_peach.color;
      splitter1.Enabled:=false;
      lastbar:=0;
      PanelBottom.visible:=true;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      panelfilebrowseroptions.visible:=false;
      pmmstatus_status.Checked:=true;
      end;
      'bookmarks' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=true;
      panelfilebrowseroptions.visible:=false;
      lastbar:=2;
      splitter1.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;
      panelfilebrowseroptions.visible:=false;
      lastbar:=3;
      splitter1.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;
      panelfilebrowseroptions.visible:=false;
      lastbar:=4;
      splitter1.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;
      panelfilebrowseroptions.visible:=true;
      Form_peach.StringGridClipboard.Autosizecolumns;
      lastbar:=5;
      splitter1.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 Form_peach do
   begin
   {$IFDEF MSWINDOWS}
   PanelArchiveMain.Visible:=false;
   PanelOpen.Visible:=false;
   PanelExtract.Visible:=false;
   PanelDefaults.Visible:=false;
   {$ELSE}//sometimes panels remains visible, so hide them otherwise
   PanelArchiveMain.Top:=10000;
   PanelOpen.Top:=10000;
   PanelExtract.Top:=10000;
   PanelDefaults.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;
   end;
end;

procedure prepare_FormPW;
begin
FormPW.Caption:=txt_pw;
FormPW.lablelistPath1.Caption:=txt_pw;
FormPW.lablelistPath3.Caption:=txt_pw_confirm;
FormPW.lablelistPath2.Caption:=txt_keyfile;
FormPW.lablelistPath2.Hint:=txt_2_7_optional;
FormPW.EditName3.Hint:=txt_keyfile+' '+txt_2_7_optional;
FormPW.ButtonEditName3.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:=Bnonthemed0;
FormPW.buttonpanel1.OKButton.Glyph:=Btestall;
FormPW.buttonpanel1.CancelButton.Glyph:=Bstop;
FormPW.buttonpanel1.OKButton.Caption:=txt_2_7_ok;
FormPW.buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
if keeppw=1 then FormPW.CheckBoxKeepPW.State:=cbChecked else FormPW.CheckBoxKeepPW.State:=cbUnchecked;
Unit3.validate_txt:=txt_2_7_validatecl;
Unit3.txt_pw:=txt_pw;
setpwicons;
end;

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

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

procedure prepare_Form_gwrap;
begin
unit_gwrap.peazipver:=PEAZIPVERSION;
unit_gwrap.executable_path:=executable_path;
unit_gwrap.confpath:=confpath;
unit_gwrap.binpath:=binpath;
unit_gwrap.sharepath:=sharepath;
unit_gwrap.lang_file:=lang_file;
unit_gwrap.autoopen:=autoopen;
unit_gwrap.graphicsfolder:=graphicsfolder;
unit_gwrap.opacity:=opacity;
unit_gwrap.color1:=color1;
unit_gwrap.color2:=color2;
unit_gwrap.color3:=color3;
unit_gwrap.color4:=color4;
unit_gwrap.color5:=color5;
unit_gwrap.temperature:=temperature;
unit_gwrap.contrast:=contrast;
unit_gwrap.filesizebase:=filesizebase;
unit_gwrap.pbackground:=txt_2_5_tray;
unit_gwrap.pfromnativedrag:=false;
unit_gwrap.Bp1:=TBitmap.Create;
unit_gwrap.Bp1.Assign(Bp1);
unit_gwrap.Bp2:=TBitmap.Create;
unit_gwrap.Bp2.Assign(Bp2);
unit_gwrap.Bp3:=TBitmap.Create;
unit_gwrap.Bp3.Assign(Bp3);
unit_gwrap.Bp4:=TBitmap.Create;
unit_gwrap.Bp4.Assign(Bp4);
unit_gwrap.Bp5:=TBitmap.Create;
unit_gwrap.Bp5.Assign(Bp5);
unit_gwrap.Bp6:=TBitmap.Create;
unit_gwrap.Bp6.Assign(Bp6);
unit_gwrap.Bp7:=TBitmap.Create;
unit_gwrap.Bp7.Assign(Bp7);
unit_gwrap.Bp8:=TBitmap.Create;
unit_gwrap.Bp8.Assign(Bp8);
unit_gwrap.Bsuccess:=TBitmap.Create;
unit_gwrap.Bsuccess.Assign(Btestall);
unit_gwrap.Binfo:=TBitmap.Create;
unit_gwrap.Binfo.Assign(Binfo);
unit_gwrap.Berror:=TBitmap.Create;
unit_gwrap.Berror.Assign(Bstop);
Form_gwrap.ButtonStop1.Glyph:=Bnonthemed0;
Form_gwrap.Imagestatus.Height:=i16res;
Form_gwrap.Imagestatus.Width:=i16res;
Form_gwrap.left:=ws_gw_left;
Form_gwrap.top:=ws_gw_top;
Form_gwrap.height:=ws_gw_height;
Form_gwrap.width:=ws_gw_width;
unit_gwrap.ws_gw_left:=ws_gw_left;
unit_gwrap.ws_gw_top:=ws_gw_top;
unit_gwrap.ws_gw_height:=ws_gw_height;
unit_gwrap.ws_gw_width:=ws_gw_width;
Form_gwrap.PanelTitle.Height:=tabheight;
Form_gwrap.ShapeTitleb1.Height:=tablabelheight;
Form_gwrap.ShapeTitleb2.Height:=tablabelheight;
Form_gwrap.ShapeTitleb3.Height:=tablabelheight;
Form_gwrap.ShapeTitleb4.Height:=tablabelheight;
Form_gwrap.Panel5.Height:=tabheightl;
Form_gwrap.StringGrid1.DefaultRowHeight:=rowsize;
unit_gwrap.pbarh:=pbarh;
unit_gwrap.pbarhsmall:=pbarhsmall;
unit_gwrap.txt_7_4_recover:=txt_7_4_recover;
unit_gwrap.txt_rr:=txt_rr;
unit_gwrap.txt_7_8_dd:=txt_7_8_dd;
unit_gwrap.txt_8_2_keep:=txt_8_2_keep;
end;

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

procedure prepare_FormPM;
begin
FormPM.Caption:=txt_4_3_pwman;
Unit8.txt_edit:=txt_edit;
Unit8.validate_txt:=txt_2_7_validatecl;
Unit8.local_desktop:=local_desktop;
Unit8.confpath:=confpath;
Unit8.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[0]:=rowsize;
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;
FormPM.mpwexplore.Caption:=txt_explore_path;
FormPM.buttonpanel1.OKButton.Glyph:=Btestall;
FormPM.buttonpanel1.CancelButton.Glyph:=Bstop;
FormPM.buttonpanel1.OKButton.Caption:=txt_2_7_ok;
FormPM.buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
FormPM.button1.Caption:=txt_add;
FormPM.button2.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:=Bnonthemed8;
loadpm;
end;

procedure prepare_FormKF;
begin
with FormKF do
begin
FormKF.Caption:=txt_4_7_pk;
Imageinfoarchive1.Hint:=txt_ent_hint;
GroupBoxKF.Caption:=txt_ent_tools;
EditEnt.Text:=txt_random_keys;
EditEnt.Hint:=txt_random_keys_hint;
ProgressBar1.Hint:=txt_ent;
EditSuggestPW.Hint:=txt_ramdompw_hint;
SpinEditSuggestPW.Hint:=txt_pwlength;
ButtonKFLoadFile.Caption:=txt_loadfile;
ButtonKF.Caption:=txt_create_keyfile;
ButtonSuggestPW.Caption:=txt_suggestpw;
ImageInfoArchive1.Picture.Bitmap:=Binfo;
ImageInfoArchive1.Transparent:=true;
ButtonPanel1.Closebutton.Caption:=txt_3_6_close;
SaveDialog1.Title:=txt_saveas;
OpenDialog2.Title:=txt_open_file;
CheckBoxSuggestPW.Caption:=txt_4_7_spchar;
end;
Unit5.persistent_source:=persistent_source;
Unit5.txt_keyfile_notcreated:=txt_keyfile_notcreated;
Unit5.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.LabelAdvIncludeAlso.Caption:=txt_5_3_ia+' - '+txt_4_2_arcabspath;
FormAdvf.MemoAdvIncludeAlso.Hint:=txt_4_2_arcabspath;
FormAdvf.LabelAdvExclude.Caption:=txt_exclusion;
FormAdvf.ButtonClearFilters.Caption:=txt_clear;
FormAdvf.ImageInfoArchive4.Hint:=txt_2_9_adv+char($0D)+char($0A)+txt_5_3_exc;
FormAdvf.ImageInfoArchive4.Picture.Bitmap:=Binfo;
FormAdvf.ImageInfoArchive4.Transparent:=true;
FormAdvf.buttonpanel1.OKButton.Glyph:=Btestall;
FormAdvf.buttonpanel1.CancelButton.Glyph:=Bstop;
FormAdvf.buttonpanel1.OKButton.Caption:=txt_2_7_ok;
FormAdvf.buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
end;

procedure prepare_FormWeb;
begin
FormWeb.Caption:=txt_search_web;
FormWeb.CheckBox1.Caption:=txt_3_3_multi;
FormWeb.CheckGroup1.Caption:=txt_searchfor;
FormWeb.buttonpanel1.OKButton.Glyph:=Btestall;
FormWeb.buttonpanel1.CancelButton.Glyph:=Bstop;
FormWeb.buttonpanel1.OKButton.Caption:=txt_2_7_ok;
FormWeb.buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
FormWeb.CheckGroup1.Checked[8]:=true;
end;

procedure prepare_apps_panel;
begin
with form_peach do
begin
LabelTitleApps1.Caption:='      '+txt_5_6_basic+'      ';
LabelTitleApps2.Caption:='      '+txt_2_6_advanced+'      ';
activelabel_apps:=LabelTitleApps1;
clicklabel_apps(LabelTitleApps1,ShapeTitleAppsb1);
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 form_peach 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 form_peach 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 savestatus_archiver;
begin
if updatingarchive_inarchive=true then exit;
with form_peach do
begin
if mdefaultarchive.checked=true then apdefault:=1 else apdefault:=0;
apdefaultarchivepath:=defaultarchivepath;
apformat:=cbType.ItemIndex;
if cbadvf1.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 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 cbencext.State=cbchecked then apencext:=1 else apencext:=0;
if CheckBoxdate.State=cbchecked then apappend:=1 else apappend:=0;
if cbcustext.State=cbchecked then apcustext:=1 else apcustext:=0;
apextcapt:=editcustext.Caption;
if CheckBoxConvert0.State=cbchecked then appw:=1 else appw:=0;
if CheckBoxConvert1.State=cbchecked then apverbose:=1 else apverbose:=0;
apsplit:=comboboxarchive1.ItemIndex;
apspin:=Spineditarchive1.Value;
apsize:=comboboxarchive2.ItemIndex;
apdelete:=cbdeleteinputmode1.ItemIndex;
if CheckBoxDeleteInput1.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:=ComboboxArchive9.Itemindex else v9b:=level_brotli;
if (fun='CUSTOM') and (havewinrar=true) and (userar=1) then v9r:=ComboboxArchive9.Itemindex else v9r:=level_rar;
if fun='ZSTD' then v9z:=ComboboxArchive9.Itemindex else v9z:=level_zstd;
v7z1:=ComboboxArchive4.Itemindex;
v7z2:=ComboboxArchive3.Itemindex;
v7z3:=ComboboxArchive5.Itemindex;
v7z4:=ComboboxArchive6.Itemindex;
v7z5:=ComboboxArchivePasses.Itemindex;
v7z6:=ComboboxArchiveSolid.Itemindex;
if CheckboxMQS.State=cbchecked then v7z7b:=1 else v7z7b:=0;
if CheckboxArchiveOF.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 CheckboxArchive6.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:=RadiogroupArchive.Itemindex;
v7z10:=ComboboxArchive7.Itemindex;
v7z11:=ComboboxArchive8.Itemindex;
v7z11b:=Comboboxmemuse.Itemindex;
v7z12:=EditOP.Text;
if CheckboxArchive4.State=cbchecked then v7z13:=1 else v7z13:=0;
if CheckboxMailKeep.State=cbchecked then v7z13b:=1 else v7z13b:=0;
v7z14:=Combobox7zalgo.Itemindex;
v7zpaths:=ComboBoxArchivePaths.Itemindex;
vtartype:=ComboBoxTAR.Itemindex;
vtartime:=ComboBoxTAR1.Itemindex;
//quad/balz/bcm
vquad1:=radiogroupquad.Itemindex;
if CheckboxQuadMax.State=cbchecked then vquad2:=1 else vquad2:=0;
//paq
vpaq1:=ComboBoxPAQ1.ItemIndex;
vpaq2:=RadioGroupPaq.ItemIndex;
//upx
vupx1:=ComboBoxUPX.ItemIndex;
if CheckBoxUPX1.State=cbchecked then vupx2:=1 else vupx2:=0;
if CheckBoxUPX2.State=cbchecked then vupx3:=1 else vupx3:=0;
//arc
varc1:=ComboBoxARC.ItemIndex;
varc2:=ComboBoxARCSolid.ItemIndex;
if CheckBoxARC1.State=cbchecked then varc3:=1 else varc3:=0;
if CheckBoxARC3.State=cbchecked then varc3b:=1 else varc3b:=0;
if CheckBoxARC2.State=cbchecked then varc4:=1 else varc4:=0;
varc5:=ComboBoxARCSfx.ItemIndex;
varc6:=ComboBoxARC2.ItemIndex;
varc7:=EditOPARC.Text;
varc8:=ComboBoxARCalgo.ItemIndex;
//split
vsplit1:=ComboBoxSplit3.ItemIndex;
//pea
vpea1:=ComboBoxPEACompression1.ItemIndex;
vpea2:=ComboBoxPEA3.ItemIndex;
vpea3:=ComboBoxPEA4.ItemIndex;
vpea4:=ComboBoxPEA2.ItemIndex;
//custom
vcustom1:=EditNameCustom.Text;
vcustom2:=EditExtCustom.Text;
vcustom3:=EditOPCustom.Text;
vcustom4:=ComboBoxArchiveCustom.ItemIndex;
savecustlist;
end;
end;

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

procedure ComboBoxArchive1_onchange;
begin
with Form_peach do
begin
if ComboBoxArchive1.ItemIndex > 0 then CheckBoxArchive4.Enabled:=false
else CheckBoxArchive4.Enabled:=true;
if Form_peach.CheckBoxArchive4.Enabled=false then
   begin
   Form_peach.CheckBoxArchive4.Checked:=false;
   Form_peach.CheckBoxMailKeep.Visible:=false;
   end;
change_imagesplit;
if ComboBoxArchive1.ItemIndex = 1 then
   begin
   SpinEditArchive1.Visible:=true;
   ComboBoxArchive2.Visible:=true;
   end
else
   begin
   SpinEditArchive1.Visible:=false;
   ComboBoxArchive2.Visible:=false;
   end;
defaultspanning:=ComboBoxArchive1.ItemIndex;
spansize:=Form_peach.SpinEditArchive1.Value;
spanunit:=Form_peach.ComboBoxArchive2.ItemIndex;
end;
end;

procedure ComboBoxArchive3_onchange;
begin
if settingvalues=false then
   with Form_peach do
      begin
      compression_method:=ComboBoxArchive3.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(Form_peach.cbType.Text);
      end;
end;

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

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

procedure CheckBoxsni1_onclick;
begin
with Form_peach do
begin
if CheckBoxsni1.State=cbChecked then sni7z:=1 else sni7z:=0;
CheckBoxsni.State:=CheckBoxsni1.State;
end;
end;

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

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

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

procedure CheckBoxsnz_onclick;
begin
with Form_peach do
begin
if CheckBoxsnz1.State=cbChecked then snz7z:=1 else snz7z:=0;
end;
end;

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

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

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

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

procedure CheckBoxsns1_onclick;
begin
with Form_peach do
begin
if CheckBoxsns1.State=cbChecked then sns7z:=1 else sns7z:=0;
CheckBoxsns.State:=CheckBoxsns1.State;
end;
end;

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

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

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

procedure on_ComboBoxPAQ1Change;
begin
level_paq:=Form_peach.ComboBoxPAQ1.ItemIndex;
end;

procedure on_RadioGroupPaqClick;
var
   fnm:ansistring;
begin
case Form_peach.RadioGroupPaq.ItemIndex of
   0: begin
      archive_type:='lpaq8';
      check_tarbefore(tdirs);
      end;
   1: archive_type:='paq8o';
   2: archive_type:='zpaq';
   end;
paqver:=Form_peach.RadioGroupPaq.ItemIndex;
suggest_outname(fnm,Form_peach.cbType.Text,0);
fnm:=extractfilename(fnm);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(fnm);
getarccaption(STR_ZPAQ);
end;

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

procedure on_ComboBoxARCChange;
begin
level_arc:=Form_peach.ComboBoxARC.ItemIndex;
setquickcompset('ARC');
end;

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

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

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

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

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

procedure ComboBoxSplit3_onchange;
begin
salgo:=Form_peach.ComboBoxSplit3.ItemIndex;
end;

procedure ComboBoxPEACompression1_onchange;
begin
pcompr:=Form_peach.ComboBoxPEACompression1.ItemIndex;
end;

procedure ComboBoxPEA3_onchange;
begin
pobj:=Form_peach.ComboBoxPEA3.ItemIndex;
end;

procedure ComboBoxPEA4_onchange;
begin
pvol:=Form_peach.ComboBoxPEA4.ItemIndex;
end;

procedure ComboBoxPEA2_onchange;
begin
pstream:=Form_peach.ComboBoxPEA2.ItemIndex;
end;

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

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

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

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

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

procedure TForm_peach.CheckBoxARC3Click(Sender: TObject);
begin
on_CheckBoxARC3Click;
end;

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

procedure TForm_peach.CheckBoxArchive4Click(Sender: TObject);
begin
on_CheckBoxArchive4;
end;

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

procedure TForm_peach.CheckBoxAutoExtTar1Click(Sender: TObject);
begin
on_CheckBoxAutoExtTar1Click;
end;

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

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

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

procedure TForm_peach.CheckBoxAutoOpenTarClick(Sender: TObject);
begin
on_CheckBoxAutoOpenTarClick;
end;

procedure TForm_peach.CheckBoxAutoTestClick(Sender: TObject);
begin
on_CheckBoxAutoTestClick;
end;

procedure TForm_peach.CheckBoxBrotliClick(Sender: TObject);
begin
CheckBoxBrotli_onClick;
end;

procedure on_checkboxconvert1;
begin
if Form_peach.CheckBoxConvert1.Checked=true then convertverbose:=1 else convertverbose:=0;
end;

procedure on_checkboxconvert0;
begin
if Form_peach.CheckBoxConvert0.Checked=true then convertpw:=1 else convertpw:=0;
end;

procedure TForm_peach.CheckBoxConvert1Change(Sender: TObject);
begin
on_checkboxconvert1;
end;

procedure TForm_peach.CheckBoxConvertChange(Sender: TObject);
begin
if CheckBoxConvert.checked=true then
   begin
   LabelTitleAdd1.Caption:='      '+txt_2_8_convert+'      ';
   CheckBoxConvert0.visible:=true;
   CheckBoxConvert1.visible:=true;
   contextconvert_switch:=true;
   end
else
   begin
   LabelTitleAdd1.Caption:='      '+txt_archive+'      ';
   CheckBoxConvert0.visible:=false;
   CheckBoxConvert1.visible:=false;
   contextconvert_switch:=false;
   end;
end;

procedure TForm_peach.CheckBoxDateClick(Sender: TObject);
begin
if Form_peach.CheckBoxDate.State=cbChecked then addtstext:=1 else addtstext:=0;
end;

procedure on_CheckBoxDeleteInput1Click;
begin
if Form_peach.CheckBoxDeleteInput1.State=cbChecked then
   begin
   Form_peach.cbdeleteinputmode1.Visible:=true;
   doptadd:=1;
   end
else
   begin
   Form_peach.cbdeleteinputmode1.Visible:=false;
   doptadd:=0;
   end;
end;

procedure TForm_peach.CheckBoxDeleteInput1Click(Sender: TObject);
begin
on_CheckBoxDeleteInput1Click;
end;

procedure on_CheckBoxDeleteInputClick;
begin
if Form_peach.CheckBoxDeleteInput.State=cbChecked then
   begin
   Form_peach.cbdeleteinputmode.Visible:=true;
   doptext:=1;
   end
else
   begin
   Form_peach.cbdeleteinputmode.Visible:=false;
   doptext:=0;
   end;
end;

procedure TForm_peach.CheckBoxDeleteInputClick(Sender: TObject);
begin
on_CheckBoxDeleteInputClick;
end;

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

procedure TForm_peach.CheckBoxDragDropClick(Sender: TObject);
begin
on_CheckBoxDragDrop_click;
if nativedrag=1 then ignorepathdd:=0 else ignorepathdd:=1;
if nativedrag=1 then Form_peach.Timerdrag.Enabled:=true else Form_peach.Timerdrag.Enabled:=false;
end;

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

procedure TForm_peach.CheckBoxEditArchivesChange(Sender: TObject);
begin
on_CheckBoxEditArchives_click;
end;

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

procedure TForm_peach.CheckBoxMailKeepClick(Sender: TObject);
begin
on_CheckBoxMailKeepClick;
end;

procedure TForm_peach.CheckBoxMQSClick(Sender: TObject);
begin
CheckBoxMQS_onclick;
end;

procedure on_ComboBoxArchive8Change;
begin
if Form_peach.ComboBoxArchive8.Enabled=true then
   multi_option:=Form_peach.ComboBoxArchive8.ItemIndex;
end;

procedure on_ComboBoxmemuseChange;
begin
memuse_option:=Form_peach.ComboBoxmemuse.ItemIndex;
end;

procedure on_cbdeleteinputmode1Change;
begin
favdelete:=Form_peach.cbdeleteinputmode1.ItemIndex;
Form_peach.cbdeleteinputmode.ItemIndex:=Form_peach.cbdeleteinputmode1.ItemIndex;
end;

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

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

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

procedure restorestatus_archiver;
begin
with form_peach 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 cbadvf1.State:=cbchecked else cbadvf1.State:=cbunchecked;
if apenum=1 then checkboxenumd.State:=cbchecked else checkboxenumd.State:=cbunchecked; CheckBoxEnumdClick(nil);
if apencext=1 then cbencext.State:=cbchecked else cbencext.State:=cbunchecked; cbencextclick(nil);
if apappend=1 then CheckBoxdate.State:=cbchecked else CheckBoxdate.State:=cbunchecked; CheckBoxDateClick(nil);
if apcustext=1 then cbcustext.State:=cbchecked else cbcustext.State:=cbunchecked; cbcustextClick(nil);
editcustext.Caption:=apextcapt;
if apverbose=1 then CheckBoxConvert1.State:=cbchecked else CheckBoxConvert1.State:=cbunchecked; on_checkboxconvert1;
CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
if appw=1 then CheckBoxConvert0.State:=cbchecked else CheckBoxConvert0.State:=cbunchecked; on_checkboxconvert0;
CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
comboboxarchive1.ItemIndex:=apsplit;
Spineditarchive1.Value:=apspin;
comboboxarchive2.ItemIndex:=apsize;
ComboBoxArchive1_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;
ComboboxArchive4.Itemindex:=v7z1; ComboBoxArchive4_onchange;
ComboboxArchive3.Itemindex:=v7z2; ComboBoxArchive3_onchange;
ComboboxArchive5.Itemindex:=v7z3;
ComboboxArchive6.Itemindex:=v7z4;
ComboboxArchivePasses.Itemindex:=v7z5;
ComboboxArchiveSolid.Itemindex:=v7z6;
if v7z7b=1 then CheckboxMQS.State:=cbchecked else CheckboxMQS.State:=cbunchecked; CheckboxMQS_onclick;
if v7z7=1 then CheckboxArchiveOF.State:=cbchecked else CheckboxArchiveOF.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 CheckboxArchive6.State:=cbchecked else CheckboxArchive6.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;
RadiogroupArchive.Itemindex:=v7z9;
ComboboxArchive7.Itemindex:=v7z10;
ComboBoxArchiveAct.Itemindex:=ComboboxArchive7.Itemindex;
ComboboxArchive8.Itemindex:=v7z11; on_ComboBoxArchive8Change;
Comboboxmemuse.Itemindex:=v7z11b; on_ComboBoxmemuseChange;
EditOP.Text:=v7z12;
if v7z13=1 then CheckboxArchive4.State:=cbchecked else CheckboxArchive4.State:=cbunchecked;
if v7z13b=1 then CheckboxMailKeep.State:=cbchecked else CheckboxMailKeep.State:=cbunchecked;
on_CheckBoxMailKeepClick;
on_CheckBoxArchive4;
Combobox7zalgo.Itemindex:=v7z14; on_ComboBox7zalgochange;
ComboBoxArchivePaths.Itemindex:=v7zpaths;
ComboBoxtar.Itemindex:=vtartype;
ComboBoxtar1.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
ComboBoxPAQ1.ItemIndex:=vpaq1; on_ComboBoxPAQ1Change;
RadioGroupPaq.ItemIndex:=vpaq2; on_RadioGroupPaqClick;
//upx
ComboBoxUPX.ItemIndex:=vupx1;
if vupx2=1 then CheckBoxUPX1.State:=cbchecked else CheckBoxUPX1.State:=cbunchecked;
if vupx3=1 then CheckBoxUPX2.State:=cbchecked else CheckBoxUPX2.State:=cbunchecked;
//arc
ComboBoxARC.ItemIndex:=varc1; on_ComboBoxARCChange;
ComboBoxARCSolid.ItemIndex:=varc2; on_ComboBoxArcSolidChange;
if varc3=1 then CheckBoxARC1.State:=cbchecked else CheckBoxARC1.State:=cbunchecked; on_CheckBoxARC1Click;
if varc3b=1 then CheckBoxARC3.State:=cbchecked else CheckBoxARC3.State:=cbunchecked; on_CheckBoxARC3Click;
if varc4=1 then CheckBoxARC2.State:=cbchecked else CheckBoxARC2.State:=cbunchecked; on_CheckBoxARC2Click;
ComboBoxARCSfx.ItemIndex:=varc5;
ComboBoxARC2.ItemIndex:=varc6; on_ComboBoxARC2Change;
EditOPARC.Text:=varc7;
ComboBoxARCalgo.ItemIndex:=varc8; on_ComboBoxARCalgoChange;
//split
ComboBoxSplit3.ItemIndex:=vsplit1; ComboBoxSplit3_onchange;
//pea
ComboBoxPEACompression1.ItemIndex:=vpea1; ComboBoxPEACompression1_onchange;
ComboBoxPEA3.ItemIndex:=vpea2; ComboBoxPEA3_onchange;
ComboBoxPEA4.ItemIndex:=vpea3; ComboBoxPEA4_onchange;
ComboBoxPEA2.ItemIndex:=vpea4; ComboBoxPEA2_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 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;
EditExtCustom.Text:=vcustom2;
EditOPCustom.Text:=vcustom3;
ComboBoxArchiveCustom.ItemIndex:=vcustom4; on_ComboBoxArchiveCustomChange;
cbdeleteinputmode1.ItemIndex:=apdelete; on_cbdeleteinputmode1Change;
if apdopt=1 then CheckBoxDeleteInput1.State:=cbchecked else CheckBoxDeleteInput1.State:=cbunchecked; on_CheckBoxDeleteInput1Click;
restorecustlist;
end;
end;

procedure savestatus_extractor;
begin
with form_peach 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:=RadioGroupAction.ItemIndex;
epskip:=Comboboxoverwrite.ItemIndex;
epdelete:=cbdeleteinputmode.ItemIndex;
if CheckBoxDeleteInput.checked=true then epdopt:=1
else epdopt:=0;
if cbadvf2.State=cbchecked then epfilters:=1
else epfilters:=0;
eparcextract:=RadioGroupActionArc.ItemIndex;
eparcskip:=ComboboxoverwriteArc.ItemIndex;
epaceextract:=RadioGroupAction1.ItemIndex;
if checkbox1.State=cbchecked then epsupp:=1
else epsupp:=0;
if CheckBoxsni1.State=cbchecked then epsni:=1
else epsni:=0;
if CheckBoxsns1.State=cbchecked then epsns:=1
else epsns:=0;
if CheckBoxsnz1.State=cbchecked then epsnz:=1
else epsnz:=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 checkbox2.State=cbchecked then epunsupp:=1
else epunsupp:=0;
if checkbox3.State=cbchecked then epunsupp1:=1
else epunsupp1:=0;
vexpaths:=ComboBoxArchivePaths1.ItemIndex;
vexcustom1:=EditNameCustom1.Text;
vexcustom2:=EditOPcustom1.Text;
vexcustom3:=ComboBoxArchiveCustom1.ItemIndex;
savecustlist;
end;
end;

function getextcaption:ansistring;
begin
with form_peach do
begin
if tonewfolder=0 then result:=txt_caption_extract+' | '+ComboBoxOverwrite.Caption
else result:=txt_newfoldermenu+' | '+ComboBoxOverwrite.Caption;
end;
end;

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

procedure on_radiogroupactionchange;
begin
extaction7z:=form_peach.RadioGroupAction.ItemIndex;
updateconf_modified;
end;

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

procedure on_RadioGroupActionArcChange;
begin
extactionarc:=Form_peach.RadioGroupActionArc.ItemIndex;
updateconf_modified;
end;

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

procedure on_RadioGroupAction1Change;
begin
extactionace:=Form_peach.RadioGroupAction1.ItemIndex;
updateconf_modified;
end;

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

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

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

procedure on_cbdeleteinputmodeChange;
begin
favdelete:=Form_peach.cbdeleteinputmode.ItemIndex;
Form_peach.cbdeleteinputmode1.ItemIndex:=Form_peach.cbdeleteinputmode.ItemIndex;
end;

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

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

procedure restorestatus_extractor;
begin
with form_peach 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;
RadioGroupAction.ItemIndex:=epextract; on_radiogroupactionchange;
Comboboxoverwrite.ItemIndex:=epskip; on_ComboBoxOverwriteChange;
cbdeleteinputmode.ItemIndex:=epdelete; on_cbdeleteinputmodeChange;
if epdopt=1 then CheckBoxDeleteInput.checked:=true
else CheckBoxDeleteInput.checked:=false; on_CheckBoxDeleteInputClick;
if epfilters=1 then cbadvf2.State:=cbchecked
else cbadvf2.State:=cbunchecked;
RadioGroupActionArc.ItemIndex:=eparcextract; on_RadioGroupActionArcChange;
ComboboxoverwriteArc.ItemIndex:=eparcskip; on_ComboboxoverwriteArcChange;
RadioGroupAction1.ItemIndex:=epaceextract; on_RadioGroupAction1Change;
if epsupp=1 then checkbox1.State:=cbchecked
else checkbox1.State:=cbunchecked; on_CheckBox1Click;
if epsni=1 then CheckBoxsni1.State:=cbchecked
else CheckBoxsni1.State:=cbunchecked; CheckBoxsni1_onclick;
if epsns=1 then CheckBoxsns1.State:=cbchecked
else CheckBoxsns1.State:=cbunchecked; CheckBoxsns1_onclick;
if epsnz=1 then CheckBoxsnz1.State:=cbchecked
else CheckBoxsnz1.State:=cbunchecked; CheckBoxsnz_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 checkbox2.State:=cbchecked
else checkbox2.State:=cbunchecked; on_CheckBox2Click;
if epunsupp1=1 then checkbox3.State:=cbchecked
else checkbox3.State:=cbunchecked; on_CheckBox3Click;
ComboBoxArchivePaths1.ItemIndex:=vexpaths;
EditNameCustom1.Text:=vexcustom1;
EditOPcustom1.Text:=vexcustom2;
ComboBoxArchiveCustom1.ItemIndex:=vexcustom3;
restorecustlist;
end;
end;

procedure savestatus_defaults;
begin
with form_peach do
begin
vopt1:=EditDesk.Caption;
vopt1b:=EditEncoding.Caption;
vopt1c:=Form_peach.Editalias.Caption;
vopt2:=RadioGroup4.ItemIndex;
vopt3:=RadioGroup6.ItemIndex;
voptlibre:=ComboBoxLibre.ItemIndex;
voptprivacy:=ComboBoxPrivacy.ItemIndex;
if CheckBoxSkipenc.State=cbchecked then vopt4g:=1 else vopt4g:=0;
if CheckBoxFolder1.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;
if cbsys7zlin.State=cbchecked then vopt5f1:=1 else vopt5f1:=0;
if CheckBoxJobEncoding.State=cbchecked then vopt5:=1 else vopt5:=0;
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 CheckBoxAutoExtTar.State=cbchecked then vopt5gtar:=1 else vopt5gtar:=0;
if CheckBoxAutoExtTar1.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 CheckBoxForceLayout.State=cbchecked then vopt5d3:=1 else vopt5d3:=0;
vopt5d3t:=LabelForceLayout.Caption;
vopt5csv:=EditCSVsep.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:=cbEncoding1.ItemIndex;
vopt23b:=ComboBoxSyntaxLevel.ItemIndex;
vopt24:=cbtree.ItemIndex;
vopt24b:=cbdefaultaction.ItemIndex;
vopt7:=Combobox1.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:=RadioGroup0.ItemIndex;
voptts:=RadioGroupTS.ItemIndex;
vopt14:=RadioGroupBrowser.ItemIndex;
vopt15c:=ComboBoxBrowser.ItemIndex;
vopt15h:=ComboBoxMaxArg.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 CheckBox7zunrar5.State=cbchecked then vopt15e:=1 else vopt15e:=0;
if CheckBoxExtrac32.State=cbchecked then vopt15e2:=1 else vopt15e2:=0;
vopt16:=RadioGrouppwrequest.ItemIndex;
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 CheckBox4.State=cbchecked then vopt19:=1 else vopt19:=0;
if cbautoclosesingleextract.State=cbchecked then vopt19b:=1 else vopt19b:=0;
vopt19c:=cbExtEvForWhen.ItemIndex;
vopt19d:=cbExtEvForHow.ItemIndex;
vopt19e:=editExtEvForWhat.Caption;
vopt19f:=Editcommonalgo.Caption;
vopt20:=RadioGroup1.ItemIndex;
vopt20b:=RadioGroup2.ItemIndex;
vopt21:=RadioGroup3.ItemIndex;
vopt22:=ComboBoxPasses.ItemIndex;
vopt22b:=ComboBoxKiB.ItemIndex;
end;
end;

procedure on_RadioGroup4Change;
begin
zaout:=Form_peach.RadioGroup4.ItemIndex;
zaout1:=zaout;
end;

procedure on_RadioGroup6Change;
begin
autoclosegwrap:=Form_peach.RadioGroup6.ItemIndex;
end;

procedure on_CheckBoxJobEncodingClick;
begin
if Form_peach.CheckBoxJobEncoding.State=cbChecked then jobdefenc:=1 else jobdefenc:=0;
end;

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

procedure on_ComboBox1Change;
begin
enc7zscc:=Form_peach.ComboBox1.ItemIndex;
end;

procedure on_ComboBoxSyntaxLevelChange;
begin
syntaxlevel7z:=Form_peach.ComboBoxSyntaxLevel.ItemIndex;
end;

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

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

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

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

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

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

procedure on_RadioGroup0Change;
begin
df:=Form_peach.RadioGroup0.ItemIndex;
archive_type_selected:=-1;
end;

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

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

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

procedure on_RadioGroupTSClick;
begin
tsstyle:=Form_peach.RadioGroupTS.ItemIndex;
end;

procedure on_RadioGroupBrowserChange;
begin
case Form_peach.RadioGroupBrowser.ItemIndex of
   0: browserstyle:=0;
   1: browserstyle:=1;
   2: if browsingmode7z=0 then browserstyle:=20 else browserstyle:=21;
   end;
end;

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

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

procedure TForm_peach.CheckBoxBrowseNotVerboseClick(Sender: TObject);
begin
on_CheckBoxBrowseNotVerbose_click;
end;

procedure TForm_peach.CheckBoxCenteredToolbarClick(Sender: TObject);
begin
if CheckBoxCenteredToolbar.State=cbChecked then toolcentered:=1 else toolcentered:=0;
settoolbarw;
end;

procedure TForm_peach.CheckBoxClosePeaZipClick(Sender: TObject);
begin
if Form_peach.CheckBoxClosePeaZip.State=cbChecked then autoclosepeazip:=1 else autoclosepeazip:=0;
end;

procedure TForm_peach.CheckBoxConvert0Change(Sender: TObject);
begin
on_checkboxconvert0;
end;

procedure on_CheckBoxPrebrowse_click;
begin
prebrowse:=Form_peach.ComboBoxBrowser.ItemIndex;
end;

procedure on_CheckBoxmaxarg_click;
begin
maxargsize:=Form_peach.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_comboboxprioritychange;
begin
taskpriority:=Form_peach.ComboBoxPriority.ItemIndex;
end;

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

procedure on_RadioGrouppwrequestChange;
begin
extpw:=Form_peach.RadioGrouppwrequest.ItemIndex;
end;

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

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

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

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

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

procedure on_RadioGroup1Click;
begin
algodisp:=Form_peach.RadioGroup1.ItemIndex;
end;

procedure on_RadioGroup2Click;
begin
setbrowserch(Form_peach.RadioGroup2.ItemIndex+1);
end;

procedure on_cbcheckallClick;
begin
algoall:=Form_peach.RadioGroup3.ItemIndex;
end;

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

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

procedure on_CBEncoding1Change;
begin
mcuzip:=Form_peach.cbEncoding1.ItemIndex;
if Form_peach.cbEncoding1.ItemIndex=3 then Form_peach.EditEncoding.Visible:=true else Form_peach.EditEncoding.Visible:=false;
end;

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

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

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

procedure TForm_peach.ComboBoxLibreChange(Sender: TObject);
begin
on_ComboBoxLibreChange;
end;

procedure TForm_peach.ComboBoxprivacyChange(Sender: TObject);
begin
on_ComboBoxprivacyChange;
end;

procedure TForm_peach.ComboBoxSDChange(Sender: TObject);
begin
on_ComboBoxSDChange;
end;

procedure TForm_peach.comboRARdictChange(Sender: TObject);
begin
userardict:=comboRARdict.ItemIndex;
end;

procedure TForm_peach.ctrlarcClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ctrlarc.Left+ctrlarc.Width;
p.y:=ctrlarc.top+ctrlarc.Height;
p:=clienttoscreen(p);
popupmenu1.Alignment:=paRight;
popupmenu1.PopUp(p.x,p.y);
popupmenu1.Alignment:=paLeft;
end;

procedure TForm_peach.ctrlextClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ctrlext.Left+ctrlext.Width;
p.y:=ctrlext.top+ctrlext.Height;
p:=clienttoscreen(p);
Form_peach.StringGrid2.popupmenu.Alignment:=paRight;
Form_peach.StringGrid2.popupmenu.PopUp(p.x,p.y);
Form_peach.StringGrid2.popupmenu.Alignment:=paLeft;
end;

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

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

procedure TForm_peach.CheckBox7zunrar5Click(Sender: TObject);
begin
on_CheckBox7zunrar5_click;
end;

procedure TForm_peach.CheckBoxAccentToolBarChange(Sender: TObject);
begin
accenttoolbar:=CheckBoxAccentToolBar.ItemIndex;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.CheckBoxACClick(Sender: TObject);
begin
if Form_peach.CheckBoxAC.State=cbChecked then convint:=1 else convint:=0;
end;

procedure TForm_peach.CheckBoxAltBarChange(Sender: TObject);
begin
case CheckBoxAltBar.ItemIndex of
   1: altaddressstyle:=3;
   0: altaddressstyle:=0;
   2: altaddressstyle:=1;
   3: altaddressstyle:=2;
end;
if openstarted=true then apply_theme;
end;

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

procedure TForm_peach.CheckBoxAltTabChange(Sender: TObject);
begin
alttabstyle:=CheckBoxAltTab.ItemIndex;
if openstarted=true then
   begin
   apply_theme;
   settabs;
   end;
end;

procedure TForm_peach.CheckBoxAlttabcolChange(Sender: TObject);
begin
highlighttabs:=CheckBoxAlttabcol.ItemIndex;
settabaltcolor;
deselectlabels_options;
clicklabel_options(Form_peach.LabelTitleOptions6, Form_peach.BevelTitleOptions6);
end;

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

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

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

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

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

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

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

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

procedure TForm_peach.CheckBoxNoConfClick(Sender: TObject);
begin
on_CheckBoxNoConfClick;
end;

procedure TForm_peach.CheckBoxrelativeClick(Sender: TObject);
begin
on_checkboxrelativeclick;
end;

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

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

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

procedure on_cbsys7zlinchange;
begin
if Form_peach.cbSys7zlin.State=cbChecked then sys7zlin:=1 else sys7zlin:=0;
end;

procedure TForm_peach.cbSys7zlinChange(Sender: TObject);
begin
on_cbsys7zlinchange;
end;

procedure TForm_peach.cbtimecreatedClick(Sender: TObject);
begin
cbtimecreated_onClick;
end;

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

procedure restorestatus_defaults;
begin
with form_peach do
begin
EditDesk.Caption:=vopt1; local_desktop:=vopt1;
EditEncoding.Caption:=vopt1b;
Editalias.Caption:=vopt1c;
RadioGroup4.ItemIndex:=vopt2; on_RadioGroup4Change;
RadioGroup6.ItemIndex:=vopt3; on_RadioGroup6Change;
ComboBoxLibre.ItemIndex:=voptlibre; on_ComboBoxLibreChange;
ComboBoxPrivacy.ItemIndex:=voptprivacy; on_ComboBoxPrivacyChange;
if epfolder1=1 then CheckBoxFolder1.State:=cbchecked else CheckBoxFolder1.State:=cbunchecked; on_CheckBoxFolder1_click;
if vopt4g=1 then CheckBoxSkipenc.State:=cbchecked else CheckBoxSkipenc.State:=cbunchecked; form_peach.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;
form_peach.CheckBoxClosePeaZipClick(nil);
if vopt5=1 then CheckBoxJobEncoding.State:=cbchecked else CheckBoxJobEncoding.State:=cbunchecked; on_CheckBoxJobEncodingClick;
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 vopt5gtar=1 then CheckBoxAutoExtTar.State:=cbchecked else CheckBoxAutoExtTar.State:=cbunchecked; on_CheckBoxAutoExtTarClick;
if vopt5gtar1=1 then CheckBoxAutoExtTar1.State:=cbchecked else CheckBoxAutoExtTar1.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 vopt5d3=1 then CheckBoxForceLayout.State:=cbchecked else CheckBoxForceLayout.State:=cbunchecked; on_CheckBoxForceLayoutClick;
LabelForceLayout.Caption:=vopt5d3t;
EditCSVsep.Caption:=vopt5csv;
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;
if vopt5f1=1 then cbsys7zlin.State:=cbchecked else cbsys7zlin.State:=cbunchecked; on_cbsys7zlinchange;
if vopt6=1 then CheckBoxEncoding.State:=cbchecked else CheckBoxEncoding.State:=cbunchecked; on_CheckBoxEncodingClick;
cbEncoding1.ItemIndex:=vopt23; on_CBEncoding1Change;
ComboBoxSyntaxLevel.ItemIndex:=vopt23b; on_ComboBoxSyntaxLevelChange;
cbtree.ItemIndex:=vopt24; on_cbtreeChange;
cbdefaultaction.ItemIndex:=vopt24b; on_cbdefaultactionchange;
Combobox1.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;
Labelcwd.Caption:=vopt12t;
custom_work_path:=vopt12t;
RadioGroup0.ItemIndex:=vopt13; on_RadioGroup0Change;
RadioGroupTS.ItemIndex:=voptts; on_RadioGroupTSClick;
RadioGroupBrowser.ItemIndex:=vopt14; on_RadioGroupBrowserChange;
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 vopt15e=1 then CheckBox7zunrar5.State:=cbchecked else CheckBox7zunrar5.State:=cbunchecked; on_CheckBox7zunrar5_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;
ComboBoxPriority.ItemIndex:=vopt15g; on_comboboxprioritychange;
ComboBoxDrag.ItemIndex:=vopt15f; on_CheckBoxDrag_click;
RadioGrouppwrequest.ItemIndex:=vopt16; on_RadioGrouppwrequestChange;
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 CheckBox4.State:=cbchecked else CheckBox4.State:=cbunchecked; on_CheckBox4_click;
if vopt19b=1 then cbautoclosesingleextract.State:=cbchecked else cbautoclosesingleextract.State:=cbunchecked; on_cbautoclosesingleextract_click;
cbExtEvForWhen.ItemIndex:=vopt19c; on_cbExtEvForWhenChange;
cbExtEvForHow.ItemIndex:=vopt19d; on_cbExtEvForHowChange;
editExtEvForWhat.Caption:=vopt19e;
Editcommonalgo.Caption:=vopt19f;
RadioGroup1.ItemIndex:=vopt20; on_RadioGroup1Click;
RadioGroup2.ItemIndex:=vopt20b; on_RadioGroup2Click;
RadioGroup3.ItemIndex:=vopt21; on_cbcheckallClick;
Comboboxpasses.ItemIndex:=vopt22; on_ComboBoxPassesChange;
ComboboxKiB.ItemIndex:=vopt22b; on_ComboBoxKiBChange;
updateconf_modified;
activelabel_options:=LabelTitleOptions1;
clicklabel_options(LabelTitleoptions1,BevelTitleoptions1);
end;
end;

procedure setpanel_add(ipanel:integer);
var
   cl,jobcode,outname:ansistring;
begin
with Form_peach do
begin
options.Visible:=false;
optionsadv.Visible:=false;
consolecreate.Visible:=false;
scheduleadd.Visible:=false;
case ipanel of
   1: options.Visible:=true;
   2: optionsadv.Visible:=true;
   3: consolecreate.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
   ButtonEditName13.Enabled:=false;
   ButtonArchive.Enabled:=false;
   if ipanel = 3 then importjobcl(cl,jobcode,outname);
   if ipanel = 4 then getscheduledtaskname(0);
   end
else
   begin
   ButtonEditName13.Enabled:=true;
   ButtonArchive.Enabled:=true;
   {$IFDEF MSWINDOWS}
   if form_peach.Visible=true then
      if prevpanel='archive' then
         try ButtonArchive.Setfocus; except end;
   {$ENDIF}
   end;
end;
end;

procedure setpanel_extract(ipanel:integer);
var
cl,jobcode,outname:ansistring;
begin
with Form_peach do
begin
optionsopen.Visible:=false;
pageextadv.Visible:=false;
consoleopen.Visible:=false;
scheduleextract.Visible:=false;
case ipanel of
   1: optionsopen.Visible:=true;
   2: pageextadv.Visible:=true;
   3: consoleopen.Visible:=true;
   4: scheduleextract.Visible:=true;
   end;
if (ipanel = 3) or (ipanel = 4) then
   begin
   ButtonExtOk.Enabled:=false;
   if ipanel = 3 then importjobcl_extract(cl,jobcode,outname);
   if ipanel = 4 then getscheduledtaskname(1);
   end
else
   begin
   ButtonExtOk.Enabled:=true;
   {$IFDEF MSWINDOWS}
   if form_peach.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 Form_peach.paneldefaults.visible=true then{$ELSE}if Form_peach.paneldefaults.top=0 then{$ENDIF}
   begin
   save_conf;
   prepare_FormPW;
   prepare_FormKF;
   prepare_FormAdvf;
   end;//save configuration exiting from paneldefaults
showpanel_prepare;
with Form_peach do
begin
case panelname of
   'archive' :
   begin
   prevpanel:='archive';
   updateid:='';
   prevupdateid:='';
   titlestring:='';
   mConsoleCreate.Text:='';
   setrecenticons_extract_archive;
   if CheckBoxConvert.checked=true then LabelTitleAdd1.Caption:='      '+txt_2_8_convert+'      ' else LabelTitleAdd1.Caption:='      '+txt_archive+'      ';
   CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   PanelArchiveMain.Top:=0;
   PanelArchiveMain.Visible:=true;
   clicklabel_add(LabelTitleAdd1,ShapeTitleAddb1);
   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;
   mgotypebz2.visible:=true;
   mgotype7z.visible:=true;
   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(Form_peach.cbType.Items[df])
      else archive_type_select(Form_peach.cbType.Items[pf])
   else archive_type_select(Form_peach.cbType.Items[archive_type_selected]);
   status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize),filesizebase);
   LabelStatusAr2.Caption:=status1;
   Form_peach.labelstatus4.Caption:='';
   setpanel_add(1);
   ButtonEditname12.Enabled:=true;
   Edit5.enabled:=true;
   Edit6.Visible:=false;
   ButtonEditname3.Enabled:=true;
   setupdatecontrols(true);
   ButtonEditname13.Enabled:=true;
   pmbrowser.Enabled:=true;
   mgobrowser.Enabled:=true;
   needwaitupdating:=false;
   updatingarchive_inarchive:=false;
   ares:=-1;
   if skipapstatus=false then savestatus_archiver;
   if form_peach.Visible=true then
      if Form_peach.ButtonArchive.enabled=true then
         begin
         {$IFDEF MSWINDOWS}
         if form_peach.Visible=true then
            try Form_peach.ButtonArchive.Setfocus; except end;
         {$ENDIF}
         end;
   Form_peach.Shape3.Color:=stringtocolor(color2);
   Form_peach.Shape3.Height:=0;
   Form_peach.Shape3.Width:=0;
   MenuItemEnumerate.visible:=true;
   mdefaultarchive.visible:=true;
   mdefaultextract.visible:=false;
   Form_peach.PanelTitleAddTabAlign.Width:=Form_peach.ShapeTitleAddb1.Width+
   Form_peach.ShapeTitleAddb2.Width+Form_peach.ShapeTitleAddb3.Width+Form_peach.ShapeTitleAddb4.Width;
   end;
   'open' :
   begin
   prevpanel:='open';
   goarchiving:=false;
   if titlestring<>'' then Caption:=titlestring else Caption:='PeaZip';
   titlestring:='';
   status0:=txt_list_browsing;
   if EditOpenIn1.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:='';
   pmbrowser.Enabled:=true;
   setrecenticons_extract_archive;
   titlestring:=Caption;
   savestatus_extractor;
   Caption:=getextcaption;
   mConsoleCreate1.Text:='';
   PanelExtract.Top:=0;
   clicklabel_extract(LabelTitleExtract1,ShapeTitleExtractb1);
   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;
   mgotypetar.visible:=false;
   mgotypezip.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:=EditOpenOut.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
   EditOpenOut.Text:=s;
   if form_peach.Visible=true then
      if Form_peach.ButtonExtOk.Enabled=true then
         begin
         {$IFDEF MSWINDOWS}
         if form_peach.Visible=true then
            try ButtonExtOk.Setfocus; except end;
         {$ENDIF}
         end;
   Form_peach.Shape4.Color:=stringtocolor(color2);
   Form_peach.Shape4.Height:=0;
   Form_peach.Shape4.Width:=0;
   MenuItemEnumerate.visible:=false;
   mdefaultarchive.visible:=false;
   mdefaultextract.visible:=true;
   Form_peach.PanelTitleExtractTabAlign.Width:=Form_peach.ShapeTitleExtractb1.Width+
   Form_peach.ShapeTitleExtractb2.Width+Form_peach.ShapeTitleExtractb3.Width+Form_peach.ShapeTitleExtractb4.Width;
   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';
   PanelDefaults.Top:=0;
   PanelDefaults.Visible:=true;
   Form_peach.Splitter3.Left:=splitter3size;
   Form_peach.PanelTitleAppsTabAlign.Width:=Form_peach.ShapeTitleAppsb1.Width+Form_peach.ShapeTitleAppsb2.Width;
   ComboBoxLanguage.Caption:=lang_file;
   if work_dir=5 then Form_peach.CheckBoxrelative.enabled:=false
   else CheckBoxrelative.enabled:=true;
   updatepluginstatus;
   if savehistory=1 then Form_peach.LabelResetHistory.enabled:=true else Form_peach.LabelResetHistory.enabled:=false;
   savestatus_defaults;
   end;
   end;
end;
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}
Form_peach.Repaint;
showpanel('archive');
{$ENDIF}
end;

procedure open_archive_do;
begin
   if Form_peach.OpenDialogArchive.Filename<>'' then
      begin
      if check7zvolume(Form_peach.OpenDialogArchive.Filename)=true then
      else
         if forceopenasarchive=false then
            if testinput(Form_peach.OpenDialogArchive.Filename,true)=0 then
               if pMessageInfoYesNo(Form_peach.OpenDialogArchive.Filename+' '+txt_2_8_custom)=7 then exit;
      showpanel('open');
      open_inputselect;
      end;
end;

function open_archive:integer;
begin
result:=0;
Form_peach.OpenDialogArchive.Filename:=''; //clear filename
if Form_peach.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;
Form_peach.OpenDialogArchive.Filename:=s;
open_archive_do;
end;

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

compose command line

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

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 directoryexists(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 directoryexists(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 Form_peach.CheckBoxTarBefore.State=cbChecked then exit;
s0:=extractfilepath(s);
s1:=extractfilename(s);
cutextension(s1);
s2:=extractfileext(s);
if ((Form_peach.cbType.Text=txt_sfx+' '+STR_ARC) or (Form_peach.cbType.Text=txt_sfx+' '+STR_7Z)) and (FormPW.EditUn7zaPW.Text='') then
else
   if (Form_peach.ImagePassword1.Visible=true) and ((FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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 Form_peach.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 (Form_peach.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;
begin
getoutname:=-1;
suggest_outname(s,Form_peach.cbType.Text,i);
   s:=extractfilename(s); //keep only filename, set path to last accepted by SaveDialog2 control
   Form_peach.SaveDialog2.FileName:=addext(s);
   if lastoutpath='' then lastoutpath:=local_desktop; //if no path was previously used, or after configuration reset, show desktop as default
   Form_peach.SaveDialog2.InitialDir:=extractfilepath(Form_peach.Edit5.Caption);//Initialdir:=lastoutpath;
   if Form_peach.SaveDialog2.Execute then
      if Form_peach.SaveDialog2.FileName<>'' then
         begin
         s:=Form_peach.SaveDialog2.FileName;
         cutextension(s);
         end
      else exit
   else exit;
   lastoutpath:=extractfilepath(Form_peach.SaveDialog2.FileName);
getoutname:=0;
end;

function setoutname(var s:ansistring; i:integer):integer;
begin
setoutname:=-1;
suggest_outname(s,Form_peach.cbType.Text,i);
s:=extractfilename(s); //keep only filename, set path to last used
if Form_peach.StringGrid1.RowCount>1 then s:=extractfilepath(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row])+s
else s:=local_desktop+s;
if Form_peach.mdefaultarchive.Checked=true then Form_peach.EditName3.Text:=defaultarchivepath
else Form_peach.EditName3.Text:=extractfilepath(s);
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.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 Form_peach.StringGrid1.RowCount-1 do
         if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then in_param:=in_param+' '+stringdelim(srec+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+FormAdvf.MemoAdvInclude.Lines[j])+' ';
      end
   else
      begin
      i:=strtoint(sel);
      if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then in_param:=stringdelim(srec+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+FormAdvf.MemoAdvInclude.Lines[j])+' ';
      end;
   end;
if sel='all' then
   begin
   for i:=1 to Form_peach.StringGrid1.RowCount-1 do
      if (Form_peach.StringGrid1.Cells[2,i]<>txt_list_isfolder) then
         in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env))+' '
      else
         if (FormAdvf.MemoAdvInclude.Lines.Count=0) then
            in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env))+' ';
   end
else
   begin
   i:=strtoint(sel);
   if Form_peach.StringGrid1.Cells[2,i]<>txt_list_isfolder then
      in_param:=stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env))+' '
   else
      if (FormAdvf.MemoAdvInclude.Lines.Count=0) then
         in_param:=stringdelim(escapefilename(Form_peach.StringGrid1.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 Form_peach.StringGrid1.RowCount-1 do in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env))+' '
else
   begin
   i:=strtoint(sel);
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid1.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 Form_peach.StringGrid1.RowCount-1 do
     begin
     if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then
        {$IFDEF MSWINDOWS}in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+'*')+' '
        {$ELSE}in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator)+' '{$ENDIF}
     else
        in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env))+' ';
     end
else
   begin
   i:=strtoint(sel);
   if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then
      {$IFDEF MSWINDOWS}in_param:=stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+'*')+' '
      {$ELSE}in_param:=stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator)+' '{$ENDIF}
   else
      in_param:=stringdelim(escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env))+' ';
   end;
end;

procedure setspecialtsize;
begin
if Form_peach.CheckBoxSeparate.State=cbChecked then
   try
   tsize:=strtoqword(Form_peach.StringGrid1.Cells[3,Form_peach.StringGrid1.Row]);
   except
   end;
end;

procedure get_in_param_arc(var in_param,sel:ansistring);
var
   i:integer;
   ipath,iname:ansistring;
begin
ipath:=form_peach.editname3.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 Form_peach.StringGrid1.RowCount-1 do
      begin
      iname:=extractrelativepath(ipath,extractfilepath(Form_peach.StringGrid1.Cells[8,i]))+extractfilename(Form_peach.StringGrid1.Cells[8,i]);
      in_param:=in_param+stringdelim(escapefilename(iname,desk_env))+' ';
      end
else
   begin
   i:=strtoint(sel);
   iname:=extractrelativepath(ipath,extractfilepath(Form_peach.StringGrid1.Cells[8,i]))+extractfilename(Form_peach.StringGrid1.Cells[8,i]);
   in_param:=in_param+stringdelim(escapefilename(iname,desk_env))+' ';
   end;
end;

procedure getarch_baseoutname(var s:ansistring);
begin
if Form_peach.CheckBoxSameArc.State=cbChecked then
   begin
   s:=Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row];
   if Form_peach.StringGrid1.Cells[2,Form_peach.StringGrid1.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:=Form_peach.Editname3.Text+Form_peach.Edit4.Text;
      exit;
      end;
   if Form_peach.CheckBoxTarBefore.State=cbChecked then s:=Form_peach.StringGrid1.Cells[8,1]
   else s:=Form_peach.Editname3.Text+Form_peach.Edit4.Text;
   end;
end;

procedure getworkpath(var work_path:ansistring; out_param:ansistring);
begin
work_path:='';
case work_dir of
   0: work_path:=stringdelim('-w'+escapefilename(extractfilepath(out_param),desk_env)); //output
   1: work_path:=stringdelim('-w'+escapefilename(extractfilepath(out_param),desk_env)); //output (preview in temp)
   2: work_path:='-w'; //let 7z determinating appropriated temp folder for all actions
   3: work_path:=stringdelim('-w'+escapefilename(custom_work_path,desk_env)); //custom for all actions
   //4: none, preview in temp
   //5: none for all actions (can't perform preview)
   end;
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:ansistring;
begin
compose_arc_cl:=-1;
fun:='ARC';
subfun:='archive';
btfun:='arc';
updatecontent(Form_peach.StringGrid1,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 Form_peach.ComboBoxARC2.ItemIndex=-1 then Form_peach.ComboBoxARC2.ItemIndex:=0;
case Form_peach.ComboBoxARC2.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 Form_peach.ComboBoxARCsolid.ItemIndex of
   0: solid_option:='';
   1: solid_option:='-s';
   2: solid_option:='-se';
   end;
//recovery records
if Form_peach.CheckBoxARC1.state=cbChecked then recovery_option:='-rr';
//sfx
if Form_peach.CheckBoxARC2.state=cbChecked then sfx_option:='-sfx'+Form_peach.Comboboxarcsfx.text;
//Compression level
compression_level:='-m'+inttostr(Form_peach.ComboBoxARC.ItemIndex);
//encryption
if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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.EditUn7zapw.Text;
   if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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 Form_peach.ComboBoxARCalgo.Visible=true then
   case Form_peach.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
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);
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 Form_peach.EditOParc.Text<>'' then cl:=cl+' '+Form_peach.EditOParc.Text;
getworkpath(work_path,out_param);
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(directoryexists(Form_peach.SelectDirectoryDialog1.FileName)) then Form_peach.SelectDirectoryDialog1.FileName:=local_desktop;
if Form_peach.SelectDirectoryDialog1.FileName='' then Form_peach.SelectDirectoryDialog1.FileName:=local_desktop;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      Form_peach.EditOpenOut.Text:=Form_peach.SelectDirectoryDialog1.FileName;
      if Form_peach.EditOpenOut.Text<>'' then
         if Form_peach.EditOpenOut.Text[length(Form_peach.EditOpenOut.Text)]<>directoryseparator then
            Form_peach.EditOpenOut.Text:=Form_peach.EditOpenOut.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:=Form_peach.EditOpenOut.Text
      else exit;
      end
   else exit;
   end;
control_outpath:=0;
end;

function select_outpath_archive:integer;
begin
select_outpath_archive:=-1;
if not(directoryexists(Form_peach.SelectDirectoryDialog1.FileName)) then Form_peach.SelectDirectoryDialog1.FileName:=local_desktop;
if Form_peach.SelectDirectoryDialog1.FileName='' then Form_peach.SelectDirectoryDialog1.FileName:=local_desktop;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      Form_peach.EditName3.Text:=Form_peach.SelectDirectoryDialog1.FileName;
      if Form_peach.EditName3.Text<>'' then
         if Form_peach.EditName3.Text[length(Form_peach.EditName3.Text)]<>directoryseparator then
            Form_peach.EditName3.Text:=Form_peach.EditName3.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:=Form_peach.Edit5.Text
      else exit;
      end
   else exit;
   end;
control_outpath_archive:=0;
end;

procedure set_output_option(var out_param:ansistring);
begin
if Form_peach.CheckBoxSameExt.State=cbChecked then
   begin
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then
      out_param:=extractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
   else
     out_param:=extractfilepath(Form_peach.EditOpenIn.Text);
   end
else out_param:=Form_peach.EditOpenOut.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 cutendspaces(var s1:ansistring); //if archive name ends with spaces (allowed, since they are before the extension) cut them to get a valid folder name (can't end with spaces)
var endwithspace:boolean;
begin
endwithspace:=true;
repeat
if s1<>'' then
   if s1[length(s1)]=' ' then setlength(s1,length(s1)-1)
   else endwithspace:=false;
until endwithspace=false;
if s1='' then s1:='noname';
end;

procedure cutenddot(var s1:ansistring); //if archive name ends with dot cut it to get a valid folder name (can't end with dot)
begin
if s1<>'' then if s1[length(s1)]='.' then s1[length(s1)]:='_';
if s1='' then s1:='noname';
end;

procedure cutendforbid(var s1:ansistring); //if archive name ends with non allowed characters cut them to get a valid folder name
var
  endwithchar:boolean;
begin
endwithchar:=true;
repeat
{$IFDEF MSWINDOWS}
if s1<>'' then
   if s1[length(s1)]='"' then setlength(s1,length(s1)-1)
{$ELSE}
if s1<>'' then
   if s1[length(s1)]='''' then setlength(s1,length(s1)-1)
{$ENDIF}
else endwithchar:=false;
until endwithchar=false;
if s1='' then s1:='noname';
end;

procedure cutenddelim(var s1:ansistring; inparam:ansistring); //if archive name ends with dot cut it to get a valid folder name (can't end with dot)
begin
if s1<>'' then if s1[length(s1)]=correctdelimiter(inparam) then setlength(s1,length(s1)-1);
if s1='' then s1:='noname';
end;

procedure set_output_folder(var out_param:ansistring; in_param:ansistring; real_extract:boolean; action:integer);
var
   s,s0,s1:ansistring;
   i:integer;
   out_created:boolean;
begin
out_created:=false;
origout:=out_param;
if Form_peach.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);
         s0:=out_param;
         if s0[length(s0)]<>directoryseparator then s0:=s0+directoryseparator;
         s:=s0+s1;
         i:=0;
         repeat
            if not(directoryexists(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 (form_peach.CheckBoxrelative.State=cbChecked) //extra path to extract and then move to relative path
   and (Form_peach.CheckBoxrelative.enabled=true)
   and (form_peach.RadioGroupAction.ItemIndex<2) //extraction operations
   and (Form_peach.labelstatus2.Caption<>'') //not for operations outside extraction screen e.g. conversion
   then willbemoved:=true;
if (forcewillbemoved=true) //require move
   and (form_peach.RadioGroupAction.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 (Form_peach.RadioGroupActionARC.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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
if mode<>'delete' then
   if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,Form_peach.RadioGroupActionARC.ItemIndex);
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 Form_peach.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;
outname:=out_param;
   pw:=FormPW.EditUn7zaPW.Text;
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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'; //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
//archive function
case mode of
   'neutral' :
   case Form_peach.RadioGroupActionARC.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<Form_peach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if Form_peach.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<Form_peach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if Form_peach.StringGridList.Cells[16,i]='1' then
            if Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[12,Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end;
   if Form_peach.StringGridList.Cells[2,Form_peach.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:=Form_peach.StringGridList.Cells[12,Form_peach.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:=Form_peach.StringGridList.Cells[12,Form_peach.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);
cl:=bin_name+' '+archive_function;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
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 Form_peach.EditUn7zaFilter.Text<>'' then
         begin
         if Form_peach.cbUn7zaRecursive.State=cbChecked then cl:=cl+' -r';
         filter1:=Form_peach.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 Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   begin
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         filter1:=Form_peach.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 Form_peach.StringGrid2.RowCount-1 do
      begin
      if checkfiledirname(Form_peach.StringGrid2.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGrid2.Cells[8,i]); exit; end;
      filter1:=Form_peach.StringGrid2.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]); exit; end;
   filter1:=Form_peach.StringGridList.Cells[12,Form_peach.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(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,false);
setspecialtsize;
//check for custom executable's name
if (Form_peach.EditnameCustom.Text='') or (Form_peach.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:=Form_peach.EditExtCustom.Text;
//output name
getarch_baseoutname(s);
if specialmoderar<>1 then out_param:=s+'.'+ext_param else out_param:=s;
specialmoderar:=0;
apply_timestamptoname(out_param,1,0,'file');
outname:=out_param;
getworkpath(work_path,out_param);
bin_name:=stringdelim(escapefilename(Form_peach.EditnameCustom.Text,desk_env));
//RAR parameters begin
if (havewinrar=true) and (userar=1) then
   begin
   case Form_peach.ComboBoxArchiveAct.ItemIndex of
   0: begin
      archive_function:='a';
      if Form_peach.ComboBoxArchive1.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 directoryexists(out_param+'.001') or directoryexists(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 directoryexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)+'.001') or directoryexists(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;
      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;
   Form_peach.EditOPcustom.Caption:=archive_function+' -ep1';
   //rar compression level
   case Form_peach.ComboBoxArchive9.ItemIndex of
      0: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -m0';
      1: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -m1';
      2: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -m2';
      3: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -m3';
      4: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -m4';
      5: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -m5';
   end;
   //rar encryption
   if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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.EditUn7zaPW.Text;
         if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
               begin
               pMessageErrorOK(FormPW.EditName3.Text+' '+txt_keyfile_not_found);
               exit;
               end;
         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 Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' '+pw;
   //rar split
   case Form_peach.ComboBoxArchive1.ItemIndex of
   0: vol_size:=0; //will trigger to not use -v(size) switch
   1: begin
      try
         vol_size:=Form_peach.SpinEditArchive1.Value;
         case Form_peach.ComboBoxArchive2.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
   end;
   if vol_size<>0 then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -v'+inttostr(vol_size)+'b';
   //peazip's work path
   if work_path<>'' then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' '+work_path;
   //advanced
   if Form_peach.cbRAR5.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -ma5'
   else Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -ma4';//RAR5 (default) or RAR4 if unchecked
   if Form_peach.cbRAR5.Checked=true then
      begin
      Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -md'+Form_peach.comboRARdict.Caption+'m';
      if Form_peach.cbRARBLAKE2.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -htb'
      else Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -htc'; //BLAKE2 hash if checked, CRC (default) if unchecked
      end;
   if Form_peach.cbRARsfx.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -sfx';
   if Form_peach.cbRARsolid.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -s';
   if Form_peach.cbRARrr.Checked=true then
      Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -rr'+inttostr(puserarrr)+'p';
   if Form_peach.cbRARsaveopen.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -dh';
   if Form_peach.cbRARsavesecurity.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -ow';
   if Form_peach.cbRARsavestreams.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -os';
   case Form_peach.cbRARlastmodtime.ItemIndex of
      1: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -tk';
      2: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -tl';
      end;
   if Form_peach.cbRARlock.Checked=true then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -k';
   if (storecreated=1) then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -ts';
   end;
//RAR rar 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
      Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -r';
param_param:=Form_peach.EditOPCustom.Caption;
if (havewinrar=true) and (userar=1) then
   cl:=bin_name+' '+param_param+' -- '+out_param+' '+in_param //fixed syntax style for Rar.exe
else
   case Form_peach.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
compose_rarspecfun_cl:=-1;
if (havewinrar<>true) or (userar<>1) then exit;
ext_param:='rar';
//output name
out_param:=Form_peach.EditOpenIn.Text;
outname:=out_param;
getworkpath(work_path,out_param);
bin_name:=stringdelim(escapefilename(Form_peach.EditnameCustom.Text,desk_env));
archive_function:=specfun;
Form_peach.EditOPcustom.Caption:=archive_function;
if archive_function='r' then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -y';
case Form_peach.cbRARlastmodtime.ItemIndex of
   1: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -tk';
   2: Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' -tl';
   end;
//encryption
if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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.EditUn7zaPW.Text;
   if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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) and (specfun<>'k') then //lock does not need password
   begin
   pforceconsole:=1;
   if (setencfn=1) then
      pw:='-hp'
   else
      pw:='-p';
   end;
if pw<>'' then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' '+pw;
//peazip's work path
if work_path<>'' then Form_peach.EditOPcustom.Caption:=Form_peach.EditOPcustom.Caption+' '+work_path;
out_param:=stringdelim(checkescapedoutname(escapefilename(out_param,desk_env)));
param_param:=Form_peach.EditOPCustom.Caption;
cl:=bin_name+' '+param_param+' -- '+out_param;
if archive_function='r' then cl:=cl+' '+stringdelim(escapefilename(extractfilepath(Form_peach.EditOpenIn.Text),desk_env));
if archive_function='d' then
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         filter1:=Form_peach.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;
compose_rarspecfun_cl:=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:=Form_peach.EditOpenIn.Text;
outname:=out_param;
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
archive_function:=specfun;
if archive_function='r' then archive_function:=archive_function+' -y';
cl:=bin_name+' '+archive_function;
//encryption
if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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.EditUn7zaPW.Text;
   if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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 (Form_peach.EditnameCustom1.Text='') or (Form_peach.EditnameCustom1.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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
set_output_folder(out_param,in_param,real_extract,0);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
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
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(Form_peach.EditnameCustom1.Text,desk_env));
if Form_peach.EditOPCustom1.Text<>'' then param_param:=Form_peach.EditOPCustom1.Text else param_param:='';
case Form_peach.ComboBoxArchiveCustom1.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 Form_peach.EditnameCustom1.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;
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 and extension is unknown;
begin
result:=0;
if forcecanbechanged=1 then
   begin
   if (testinput(s,false)=0) then result:=1;
   end;
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 checkchash(fname:ansistring; var hs:ansistring):boolean;
var
   fs: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;
result:=false; //only existing files raise errors
hs:=getchash(fs);
case hs of
 //pea 1.13
'E14C142D377060CD0C3BEC0932A50DD40773E2FE51839806B8FA1EB58ACC885E', //win64
'1BE1B22EF5A69AD86619E544EBC2C23A874400A6465F51113E5FEEE3EC7938C1', //win32
'702F4BBB54D560637BF8888C3C4E8E66C01AFCBEB48ECF70582F4F03C1C58F84', //lin x86_64 GTK2
'12690A6A8371A429084F0514E205F1DA2A708FE39A90FFFEFD4A81B8F2077142', //lin x86_64 Qt5
'1E40A2B6A2C172809C1A4DF50FAC8509612B0E0E88E51B8529B15C493DFB60BF', //macos aarch64
'A5E6D7EC1F6ED10C734F1BFF925429F6F0C078435D61D4744F876332593203B7', //macos Intel
'A4505EDBD61CE3B76EE13CE6AFC2479CE6E1798728D6B1557F1A57FBDA2FD167', //BSD x86_64
{$IFDEF MSWINDOWS}
'183820E5CA48CAAE5B393780115390F2621C222472B5FA540671A56042FF6BB3',//Configure PeaZip 9.2+ 64 bit
'288B4A40F0BDD9DCFC3F28FD1ED8C5B825ADA71971CBA7513F688D9F16B31444',//Configure PeaZip 9.2+ 32 bit
'8CEBB25E240DB3B6986FCAED6BC0B900FA09DAD763A56FB71273529266C5C525',//7z 23.01 64 bit
'3092F736F9F4FC0ECC00A4D27774F9E09B6F1D6EEE8ACC1B45667FE1808646A6',//7z 23.01 32 bit
'254CF6411D38903B2440819F7E0A847F0CFEE7F8096CFAD9E90FEA62F42B0C23',//7z 22.01 64 bit
'59CBFBA941D3AC0238219DAA11C93969489B40F1E8B38FABDB5805AC3DD72BFA',//7z 22.01 32 bit
'7135E78794C5CEACB094AFCADCA57755CC3801591552776F1A717BBDD65605A7',//7z 22.00 64 bit
'B8C3871A5D6A473A2E9D08684A481AEA7467A97D0A433CF55B127323EF61218F',//7z 22.00 32 bit
'ED24ED04B5D4A20B3F50FC088A455195C756D7B5315D1965E8C569472B43D939',//7z 21.07 64 bit
'9E2631C19B243C28B0980607CED2540E9447B1166572483475547C1A9DD4AC0E',//7z 21.07 32 bit
'B36B1BE0A3C329675AF4EECE3193F08CF343EDE57A6933033BF6004A50AB2A65',//arc 0.67
'F31FCF56B866DAA87B746DB5352AA6A557CBB60C590A27676AF66256BCC2E2EA',//balz 1.15
'C71B1970011AECF34946094100060324D336D18DB4289737E213A4BA9E4CE06D',//bcm 1.0 32 bit
'586CAD02BDEC4E7278A8C797FEC0A6275499086497CA12461DC85CAAF83BD15A',//bcm 1.0 64 bit
'4BDD56D53DCC4F5C325C8F84D0C9847F6527DFBF1F31BEB333148D856DE6BCBF',//brotli 1.0.7 64 bit
'08535672AA1D6323D18061365124B3F02F4365E0252C87F16950B189E48603A5',//brotli 1.0.7 32 bit
'FE32FC0FCE51ED295A367B8829B7B29F0E755F52C1C5AD23681A97A673CCBDD7',//lpaq1
'6374D2FA4AB190A39AA6459B54BC6C4FCB0381E5822628988C17B28C8BE7554D',//lpaq5
'52674DE2E06ECC07AE9C4101DE73203BB04A916B42EF2A4B71F403294441B227',//lpaq8
'14500A21A2AF760A648D100D93A109E28D82713851149490D9D32CB45005C112',//paq8f
'254C4714B672C51F0FDC2121AC17DAAA13A4A57DD680BB3126492A3CE96BF9BE',//paq8jd
'9A1C9C11FE5EE5DA84671E1A3E798293A44A817F25DFB907A8F78CC7FF227EB1',//paq8l
'C6CBCF5CF508FF8010313A1A251350E31A6BFADF217F0420D1CC32A394844B32',//paq8o
'087401A585B096411272CCBEC9CEE1C40FCD22A7D16A8832023700D288BE0D24',//quad 1.12
'B4EBE301E77A5B6A40E71776B921EFDB639BDC9011D2EF5A137DE9FA6F57E51E',//strip
'8ABB49B815A2F57E22F21967B9059DD3D4A22D75C8460AE893FF7FC5D30CFEC5',//unace
'E13A75A2936DB0E8BE3C5B72D19E0E9C6AB27BC37933490E2D847E189DBCA5EF',//unrar 5.21
'24624A9D3786D7BA93575383EDF694505453AF59B39B0463260A75C6344D0AE7',//upx 3.95 64 bit
'D634CDE09D1AA1320A1D4C589D35D306F8350129FAF225B2BCA394128C2C4442',//upx 3.95 32 bit
'7A94B4F1D6323A758C7B0B6344036F166BFF0FD44F1C3C86F05B3688023496CB',//zpaq 7.15 64 bit
'A0F127A70943B0262060498C1723C795A8E2980F1ACF0C42EE8C1DAE72AE54B5',//zpaq 7.15 32 bit
'F14E78C0651851A670F508561D2C5D647DA0BA08E6B73231F2E7539812BAE311',//zstd 1.5.2 64 bit
'824E2D777C96D5CFEBD1AF15775B5D95711A8F62EC4C2567477D8AEBB32F3C95'//zstd 1.5.2 32 bit
{$ELSE}
{$IFDEF DARWIN}
'FE4F31D6FFBD31DB042456A76544746EF647379E3AEC0A59F2A98A2EAC244C2F',//7z 23.01
'C194CD5B88D5CF5842DF4F6E5B082AC593780AABC221DE01558A4FA58850C43E',//7z 21.07
'0048D4C9BB80A07905B8ED74227348C58FF22D66A719B51B3DB2B8C020C70CE1',//brotli aarch64
'7A36C92389CB1A3121F110D95141C667F2EA9FC76A71C1D6C98FF496C0731A26',//zpaq aarch64
'3796CE883E03B33B00F54F229992A768E302B9C7B231B230EAC2A6F70B99EE03',//zstd aarch64
'F377F78291874F1FE33B769D8072BDC4BF54752CA34934B9089B49AFE3D28A42',//brotli x86_64
'CFB2AC44B1D0C672C503D8C0F1E0EAB3FF16B60E9F6B7942BA9D0EC4390C2B16',//zpaq x86_64
'44B6A7E6988D5AB1F3829428FA8D5A61E54FAC46D86D6DAAFA84058449498321',//zstd x86_64
{$ENDIF}
{$IFDEF FREEBSD}
'C1108D01249D960BE54AC517AD2267D2D8C8662ABC6101A48C75AEC4FCE1174B',//7z 21.07
'90A625C12427C4C2F27AB05A353978B24FF943CA0DC247CD5A2F8038260E29FB',//brotli x86_64
'989DFF2DC096C4D5A88B6850120038FFE095D18CFF3206D15F82FD63FE8D1B8C',//zstd x86_64
{$ENDIF}
//x86_64
'B81C37ACA9B7AF945916D84235DCB27BEAEF519417130A594915B6583A5B1710',//7z 23.01
'3ED12371D214C49F990CD705E6C773BA56A68480ED5CCDBECAFF9BAB4E3F79E4',//7z 22.01
'E8433C46FDFA207D5864E34B4C4D2C586BCBFA70F8929656B4BF142EA6453FCE',//7z 22.00
'758629C3D78A37B8A5524C2A9E08E5D1E210564FFACF1BD366B25B2993C017BA',//7z 21.07
'2BA0605AD4569BAA83F050ADED9C9EE52F02D9A0BDDAC37B1AEADFFD4D960F76',//arc (x86)
'4B69F1EAA187CA2A9733CEF266FE84052EA9DB2DCBC177A2D442466D9AD28CC2',//bcm
'4DE1C1A73B5467D2AAC4950BA4EF33C07C3DB46460F25BE2C4302EEB2CC3C21D',//brotli
'3FC1609793097868951CF1FD3179826301F7C7CE0204BD82159E0892B4786765',//lpaq8 (x86)
'7206FA4EB8C0110EC845CE2BA6FB42FEA1BA755CC6E3FA0DD7620050D6F5A8DF',//paq8o (x86)
'B97D182D9718FD7FD608FA2CE3375A15F479C73415B51999DCB5FEA72646F53C',//upx
'66AFE02EBC1DB1774451904DE1A13BBB3D1C45039B84E803348B7A9FF2B3C704',//zpaq
'D73EE542A1A44DDE9385BA94B4344EC9A6F3FC451A68BD95924517E528F66134',//zstd
//x86, legacy
'68970970669BD4E063483014C93A71688F366E824A0E595598EFE1082A1257AE',//7z 21.07
'F4BA82C046D6985C1B05B1ED670CED5BD9DEF724671952F26C4AC07F64AB5001',//bcm
'9F14A735312CC0B480C7F381F3D7E80C25B90514AA89F2E47AE7070C6C3762AC',//brotli
'9EB60114A40AFFDE70DDEA63BE7E37F9549DAB3E8948E21D2B65C4D7BAE9E000',//upx
'B4F8BAC2991CCC14543AC7967B0B2DD28C27420D35D68B32F64603978FA999A6',//zpaq
'2EBDF2C8D4B332491A471704468FE137F58C58F2B5FDEFB3D8B30F8B429A56C6' //zstd
{$ENDIF}
   : result:=true;
   end
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;
st:=(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'Configure PeaZip'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);//in case of alias, test the custom 7z binary against known hash values
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'arc'+DirectorySeparator+'arc'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'brotli'+DirectorySeparator+'brotli'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+'quad'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+'bcm'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'quad'+DirectorySeparator+'balz'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'unace'+DirectorySeparator+'unace'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'upx'+DirectorySeparator+'upx'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+'lpaq1'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+'lpaq5'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+'lpaq8'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+'paq8f'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+'paq8jd'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+'paq8l'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+'paq8o'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
st:=(escapefilename(binpath,desk_env)+'zstd'+DirectorySeparator+'zstd'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
{$IFDEF MSWINDOWS}
st:= (escapefilename(binpath,desk_env)+'upx'+DirectorySeparator+'strip'+EXEEXT);
if FileExists(st) then fexe:=fexe+1;
if checkchash(st,hs)=false then s:=s+st+' SHA256='+hs+char($0d)+char($0a)+char($0d)+char($0a);
{$ENDIF}
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;

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;
begin
compose_archive_cl:=-1;
fun:='7Z';
subfun:='archive';
btfun:='7z';
updatecontent(Form_peach.StringGrid1,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 (Form_peach.StringGrid1.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 (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.CheckBoxSeparate.Enabled=false) then
      begin
      pMessageWarningOK(archive_type+' '+txt_error_input_multi);
      exit;
      end;
   end;
//output name
getarch_baseoutname(s);
if (Form_peach.CheckBoxArchive6.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 (Form_peach.ComboBoxArchive3.Text<>'Deflate') and (Form_peach.ComboBoxArchive3.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(Form_peach.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 Form_peach.ComboBoxArchive7.ItemIndex of
   0: begin
      archive_function:='a';
      if Form_peach.ComboBoxArchive1.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 directoryexists(out_param+'.001') or directoryexists(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 directoryexists(s+NAMEVARSTR+inttostr(i)+extractfileext(out_param)+'.001') or directoryexists(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
if (archive_type='7z') or (archive_type='xz') then
   begin
   case Form_peach.ComboBoxArchiveSolid.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 Form_peach.CheckBoxMQS.State=cbChecked then
         if solid_option<>'-ms=off' then solid_option:=solid_option+' -mqs=on';
   end;
//archive open for writing files option
if Form_peach.CheckBoxArchiveOF.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 Form_peach.CheckBoxsnoi.State=cbChecked then snoi_option:='-snoi';
   if Form_peach.CheckBoxsnon.State=cbChecked then snon_option:='-snon';
   end;
case syntaxlevel7z of
1: 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.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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;
if pw_option<>'' then
   begin
   pw:=FormPW.EditUn7zaPW.Text;
   if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.Text+' '+txt_keyfile_not_found);
         exit;
         end;
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar(pw);
      pforceconsole:=1;
      pw:='-p';
      //exit;
      end;
   end;
//encryption algorithm
if Form_peach.ComboBox7zalgo.Visible=true then
   if archive_type='zip' then
      case Form_peach.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 (Form_peach.CheckBoxArchive4.Enabled=true) and (Form_peach.CheckBoxArchive4.State=cbChecked) then mail_option:='-seml' else mail_option:='';
if mail_option='-seml' then if Form_peach.CheckBoxMailKeep.State=cbUnChecked then mail_option:=mail_option+'.';
//multi volumes
case Form_peach.ComboBoxArchive1.ItemIndex of
   0: vol_size:=0; //will trigger to not use -v(size) switch
   1: begin
      try
         vol_size:=Form_peach.SpinEditArchive1.Value;
         case Form_peach.ComboBoxArchive2.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
   end;
//sfx (generate self extracting Windows executable)
if (Form_peach.CheckBoxArchive6.State=cbChecked) then
   begin
   sfx_option:='-sfx';
   if Form_peach.RadioGroupArchive.ItemIndex=1 then sfx_option:=sfx_option+'7z.sfx';
   if Form_peach.RadioGroupArchive.ItemIndex=2 then sfx_option:=sfx_option+'7zS2.sfx';
   if Form_peach.RadioGroupArchive.ItemIndex=3 then sfx_option:=sfx_option+'7zS2con.sfx';
   if Form_peach.RadioGroupArchive.ItemIndex=4 then sfx_option:=sfx_option+'7zSD.sfx';
   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 syntaxlevel7z of
1: paramtime:='';
end;
//Compression level
compression_level:=setarchivecomplevel(Form_peach.ComboBoxArchive3.Text,Form_peach.ComboBoxArchive4.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:='';
case syntaxlevel7z of
0: 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;
end;
// multithreading
thread_option:='';
try
s:=Form_peach.ComboBoxArchive3.Text;
except
s:='';
end;
if (archive_type='7z') or (archive_type='zip') or (archive_type='bz2') or (archive_type='xz') then
   begin
   if Form_peach.ComboBoxArchive8.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 Form_peach.ComboBoxArchive8.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='+Form_peach.ComboBoxArchivePasses.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 (Form_peach.ComboBoxArchive6.Enabled=true) then word_option:='-mfb='+Form_peach.ComboBoxArchive6.Text
      else word_option:='';
if (compressor_option='-m0=PPMd') or (compressor_option='-mm=PPMd') then word_option:='-mo='+Form_peach.ComboBoxArchive6.Text; //if PPMd Compression is used, use model order instead of fast bytes
//dictionary size
if (compression_level<>'-mx0') and (Form_peach.ComboBoxArchive5.Enabled=true) then
   begin
   s:=Form_peach.ComboBoxArchive5.Items[Form_peach.ComboBoxArchive5.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 (Form_peach.ComboBoxArchive5.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 Form_peach.ComboBoxArchive5.ItemIndex>0 then dictionary_option:='-md='+s+'m';
   if (type_option='-tzip') and (compressor_option='-mm=XZ') then if Form_peach.ComboBoxArchive5.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 Form_peach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+Form_peach.EditEncoding.Caption;
   end;
//path option
case Form_peach.ComboBoxArchivePaths.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;
case syntaxlevel7z of
0: 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
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);
{$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
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
   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 Form_peach.EditOP.Text<>'' then cl:=cl+' '+Form_peach.EditOP.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 syntaxlevel7z of
0: 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 syntaxlevel7z of
      0: cl:=cl+' -mtc=on -mta=on';
      1: cl:=cl+' -mtc=on';
      end;
if excludeef=1 then cl:=cl+' -xtd';
{$IFDEF MSWINDOWS}if updatingarchive_inarchive=true then if forcecanbechanged=1 then if ExtractFileExt(Form_peach.EditOpenIn.Caption)='' then out_param:=out_param+'.';{$ENDIF}
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 (Form_peach.RadioGroupAction.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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,Form_peach.RadioGroupAction.ItemIndex)
else
   if nffromdrag=true then set_output_folder(out_param,in_param,real_extract,Form_peach.RadioGroupAction.ItemIndex);
//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:=''; if zaout=2 then zaout:=1; end;//ask auto switch to GUI+console mode if needed
   end;
outname:=out_param;
   pw:=FormPW.EditUn7zaPW.Text;
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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 Form_peach.RadioGroupAction.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<Form_peach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if Form_peach.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<Form_peach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if Form_peach.StringGridList.Cells[16,i]='1' then
            if Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[12,Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end;
   if Form_peach.StringGridList.Cells[2,Form_peach.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:=Form_peach.StringGridList.Cells[12,Form_peach.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:=Form_peach.StringGridList.Cells[12,Form_peach.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);
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;
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 Form_peach.EditUn7zaFilter.Text<>'' then
         begin
         if Form_peach.cbUn7zaRecursive.State=cbChecked then cl:=cl+' -r';
         filter1:=Form_peach.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 Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   begin
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         filter1:=Form_peach.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 Form_peach.StringGrid2.RowCount-1 do
      begin
      if checkfiledirname(Form_peach.StringGrid2.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGrid2.Cells[8,i]); exit; end;
      filter1:=Form_peach.StringGrid2.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]); exit; end;
   filter1:=Form_peach.StringGridList.Cells[12,Form_peach.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 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:ansistring;
   i:integer;
   contains_folder,checksel:boolean;
begin
compose_un7z_cl:=-1;
//in_param
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)
else
   in_param:=escapefilename(Form_peach.EditOpenIn.Text,desk_env);
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 Form_peach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+Form_peach.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:='';
in_param:=stringdelim(in_param);
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 (Form_peach.RadioGroupAction.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 then
 if mode<>'delete' then
  if mode<>'preview' then
   if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,Form_peach.RadioGroupAction.ItemIndex)
   else
      if nffromdrag=true then set_output_folder(out_param,in_param,real_extract,Form_peach.RadioGroupAction.ItemIndex);
if (mode='ext') and (specialopen=true) then //specialopen switches to extract entire directory for some file types (exe, bat, html...)
   begin
   alt_tempstring:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row];
   {$IFDEF MSWINDOWS}alt_tempstring:=StringReplace(alt_tempstring,':','_', [rfReplaceAll]);{$ENDIF}
   if pstmpdir<>'' then if DirectoryExists(pstmpdir) then else CreateDir(pstmpdir);
   filesetattr(pstmpdir, faHidden);
   end;
if (willbemoved=true) and (real_extract=true) then
   if activelabel_extract<>Form_peach.LabelTitleExtract3 then
      begin
      if out_param<>'' then if DirectoryExists(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:=''; if zaout=2 then zaout:=1; end;//ask auto switch to GUI+console mode if needed
   end;
if Form_peach.RadioGroupAction.ItemIndex=3 then details:='-slt'
else details:='';
outname:=out_param;
pw:=FormPW.EditUn7zaPW.Text;
if FormPW.EditName3.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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'; //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
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 Form_peach.RadioGroupAction.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 pw:='-pdefault';//avoid hanging info based test process for password request
         end;
      4: begin
         archive_function:='t';
         subfun:='test';
         if pw='' then pw:='-pdefault';//avoid hanging test process for password request
         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 pw:='-pdefault';//avoid hanging info based test process for password request
   end;
   'test' :
   begin
   archive_function:='t';
   subfun:='test';
   if pw='' then pw:='-pdefault';//avoid hanging test process for password request
   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<Form_peach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if Form_peach.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<Form_peach.StringGridList.Rowcount) and (contains_folder=false) do
         begin
         if Form_peach.StringGridList.Cells[16,i]='1' then
            if Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[12,Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end;
   if Form_peach.StringGridList.Cells[2,Form_peach.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:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row];
      end;
   if selection='displayed' then tempstring:=ExtractFilePath(tempstring);
   if fileexists((out_param+tempstring)) or directoryexists((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:=Form_peach.StringGridList.Cells[12,Form_peach.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:=Form_peach.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 Form_peach.ComboBoxArchivePaths1.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);
{$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
cl:=bin_name+' '+archive_function;
if delcase<>'' then cl:=cl+' '+delcase;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
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 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;
if excludeef=1 then cl:=cl+' -xtd';
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 Form_peach.EditUn7zaFilter.Text<>'' then
         begin
         if Form_peach.cbUn7zaRecursive.State=cbChecked then cl:=cl+' -r';
         filter1:=Form_peach.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 Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   begin
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         filter1:=Form_peach.StringGridList.Cells[12,i];
         if archive_function='d' 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 copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+stringdelim('-i!'+escapefilename(filter1,desk_env));
         checksel:=true;
         end;
   end
   else
   for i:=1 to Form_peach.StringGrid2.RowCount-1 do
      begin
      if checkfiledirname(Form_peach.StringGrid2.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGrid2.Cells[8,i]); exit; end;
      filter1:=Form_peach.StringGrid2.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]); exit; end;
   filter1:=Form_peach.StringGridList.Cells[12,Form_peach.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: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 Form_peach.ComboBoxArchive1.ItemIndex of
      0: vol_size:=0; //trigger PEA to not split archive in volumes
      1: begin
         try
            vol_size:=Form_peach.SpinEditArchive1.Value;
            case Form_peach.ComboBoxArchive2.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
   end;
   if vol_size=0 then p_ext:='.pea' else p_ext:='.000001.pea';
   //out_param
   if Form_peach.CheckBoxTarBefore.State=cbChecked then out_param:=Form_peach.StringGrid1.Cells[8,1]
   else
   out_param:=Form_peach.Editname3.Text+Form_peach.Edit4.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 directoryexists(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 Form_peach.ComboBoxPEACompression1.ItemIndex of
      0: compr:='PCOMPRESS3';
      1: compr:='PCOMPRESS2';
      2: compr:='PCOMPRESS1';
      3: compr:='PCOMPRESS0';
      end;

pw:=FormPW.EditUn7zaPW.Text;
if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.Text<>'') then
   begin
   case Form_peach.ComboBoxPEA2.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: strm_algo:='TRIATS BATCH';
      1: strm_algo:='TRITSA BATCH';
      2: strm_algo:='TRISAT BATCH';
      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.EditUn7zaPW.Text<>'' then
      strm_algo:=strm_algo+' '+stringdelim(FormPW.EditUn7zaPW.Text)
   else
      strm_algo:=strm_algo+' default';
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)=0 then
         strm_algo:=strm_algo+' '+stringdelim(FormPW.EditName3.Text)
      else
         begin
         pMessageErrorOK(FormPW.EditName3.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 Form_peach.ComboBoxPEA2.ItemIndex of
      0: strm_algo:='TRIATS INTERACTIVE';
      1: strm_algo:='TRITSA INTERACTIVE';
      2: strm_algo:='TRISAT 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 Form_peach.ComboBoxPEA3.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 Form_peach.ComboBoxPEA4.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 Form_peach.StringGrid1.RowCount=1 then
      begin
      pMessageWarningOK(txt_split_noinput);
      exit;
      end
   else
      if (tdirs=0) and (Form_peach.StringGrid1.RowCount<3) then
      else
         begin
         if (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.CheckBoxSeparate.Enabled=false) then
            begin
            pMessageWarningOK(txt_split+' '+txt_error_input_multi);
            exit;
            end;
         if Form_peach.StringGrid1.Cells[2,Form_peach.StringGrid1.Row]=txt_list_isfolder then
            begin
            pMessageWarningOK(txt_split+' '+txt_error_input_multi);
            exit;
            end;
         end;
   //out_param
   out_param:=Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row];
   if (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.CheckBoxSeparate.Enabled=false) then out_param:=Form_peach.Editname3.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 directoryexists(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 Form_peach.ComboBoxArchive1.ItemIndex of
      0: vol_size:=0; //trigger PEA to not split archive in volumes
      1: begin
         try
            vol_size:=Form_peach.SpinEditArchive1.Value;
            case Form_peach.ComboBoxArchive2.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
      end;
   case Form_peach.ComboBoxSplit3.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(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.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(Form_peach.EditOpenIn.Text);
if (s='') or (s='<none>') or (s=txt_none) then s:=Form_peach.StringGrid2.Cells[1,Form_peach.StringGrid2.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;
outname:=out_param;
if Form_peach.CheckBoxUnPeaAttributes.State=cbChecked then attr_param:='SETATTR'
else attr_param:='RESETATTR';
out_param:=stringdelim(escapefilename(out_param,desk_env));
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
if fun='UNPEA' then
   begin
   pw:=FormPW.EditUn7zaPW.Text;
   if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.Text<>'') then
      begin
      cl:=bin_name+' '+fun+' '+in_param+' '+out_param+' RESETDATE '+attr_param+' EXTRACT2DIR BATCH';
      if FormPW.EditUn7zaPW.Text<>'' then
         cl:=cl+' '+stringdelim(FormPW.EditUn7zaPW.Text)
      else
         cl:=cl+' default';
      if FormPW.EditName3.Text<>'' then
         if prepend_keyfile(pw,FormPW.EditName3.Text)=0 then
            cl:=cl+' '+stringdelim(FormPW.EditName3.Text)
         else
            begin
            pMessageErrorOK(FormPW.EditName3.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 DirectoryExists(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 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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
set_output_folder(out_param,in_param,real_extract,0);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s1:=extractfilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   s1:=extractfilename(Form_peach.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);
outname:=out_param;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   lpaq_ver:=copy(extractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]),2,length(extractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]))-1)
else
   lpaq_ver:=copy(extractfileext(Form_peach.EditOpenIn.Text),2,length(extractfileext(Form_peach.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(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'lpaq'+DirectorySeparator+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 DirectoryExists(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 control_outpath(out_param)<>0 then exit;
//in_param
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
set_output_folder(out_param,in_param,real_extract,0);
if out_param<>'' then
   if out_param[length(out_param)]=directoryseparator then out_param:=copy(out_param,1,length(out_param)-1);
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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   paq_ver:=copy(extractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]),2,length(extractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]))-1)
else
   paq_ver:=copy(extractfileext(Form_peach.EditOpenIn.Text),2,length(extractfileext(Form_peach.EditOpenIn.Text))-1);
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'paq'+DirectorySeparator+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,paq_ver,pw:ansistring;
begin
compose_zpaq_cl:=-1;
fun:='PAQ';
btfun:='zpaq';
case Form_peach.RadioGroupPaq.ItemIndex of
   0: begin
      subfun:='archive';
      updatecontent(Form_peach.StringGrid1,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 (Form_peach.StringGrid1.RowCount<3) then begin end //single input file
      else //folder(s) and/or multiple files
         if (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.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;
      outname:=out_param;
      case Form_peach.ComboBoxPAQ1.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);
      cl:=bin_name+' '+compression_level+' '+in_param+' '+out_param;
      end;
   1: begin
      paq_ver:='paq8o';
      subfun:='archive';
      updatecontent(Form_peach.StringGrid1,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(Form_peach.ComboBoxPAQ1.ItemIndex);
      case Form_peach.ComboBoxPAQ1.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);
      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(Form_peach.StringGrid1,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 Form_peach.ComboBoxPAQ1.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;
      pw:=FormPW.EditUn7zaPW.Text;
      if FormPW.EditName3.Text<>'' then
         if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
            begin
            pMessageErrorOK(FormPW.EditName3.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);
      cl:=bin_name;
      //if intpw=1 then //not supported for zpaq
      if pw<>'' then cl:=cl+' '+pw;
      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:ansistring;
   fstate:boolean;
begin
compose_unzpaq_cl:=-1;
subfun:='extract';
btfun:='unzpaq';
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 DirectoryExists(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 control_outpath(out_param)<>0 then exit;
//in_param
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
if zpaqabsolute=0 then //remove nesting
   begin
   if Form_peach.CheckBoxFolder.State=cbChecked then fstate:=true
   else fstate:=false;
   Form_peach.CheckBoxFolder.State:=cbChecked;
   end;
if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,0);
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 Form_peach.CheckBoxFolder.State:=cbChecked
   else Form_peach.CheckBoxFolder.State:=cbUnchecked;
outname:=out_param+directoryseparator;
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 mode='list' then modefun:='l'
else modefun:='x';
pw:=FormPW.EditUn7zaPW.Text;
if FormPW.EditName3.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
      begin
      pMessageErrorOK(FormPW.EditName3.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
case mode of
   'list':
      cl:=cl+' '+modefun+' '+in_param;
   'test':
      begin
      cl:=cl+' '+modefun+' '+in_param+' -test';
      subfun:='test';
      end;
   else
      cl:=cl+' '+modefun+' '+in_param;
      if zpaqall=1 then cl:=cl+' -all';
      if zpaqforce=1 then cl:=cl+' -f';
      if zpaqabsolute=0 then cl:=cl+' -to '+out_param;
   end;
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:ansistring;
begin
compose_upx_cl:=-1;
fun:='UPX';
subfun:='archive';
btfun:='upx';
updatecontent(Form_peach.StringGrid1,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(Form_peach.StringGrid1.Cells[2,1]);
if (tdirs=0) and (Form_peach.StringGrid1.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='')) then //single input executable file
else //folder(s) and/or multiple files
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_upx);
   exit;
   end;
if (Form_peach.ComboBoxUPX.ItemIndex=0) and (Form_peach.CheckBoxUPX1.State=cbUnchecked) then
   begin
   pMessageWarningOK(txt_upxorstrip);
   exit;
   end;
if Form_peach.ComboBoxUPX.ItemIndex=10 then compression_level:='--best'
else compression_level:='-'+inttostr((Form_peach.ComboBoxUPX.ItemIndex));
get_in_param(in_param,sel);
outname:=escapefilename(Form_peach.StringGrid1.Cells[8,1],desk_env);
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'upx'+DirectorySeparator+'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 Form_peach.CheckBoxUPX2.State=cbChecked then
   begin
   assignfile(fin,Form_peach.StringGrid1.Cells[8,1]);
   filemode:=0;
   reset(fin);
   assignfile(fout,Form_peach.StringGrid1.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);
   end;
//strip (silent) before upx
if Form_peach.CheckBoxUPX1.State=cbChecked then
   begin
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}
   P.CommandLine:=('"'+binpath+'upx'+DirectorySeparator+'strip.exe" '+in_param);
   {$ELSE}//assuming generic unix coming with strip command
   P.CommandLine:=('strip '+in_param);
   {$ENDIF}
   if Form_peach.Visible=true then Application.ProcessMessages;
   P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
   s:=P.Commandline;
   if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
   P.Execute;
   P.Free;
   end;
if Form_peach.ComboBoxUPX.ItemIndex=0 then //exit with -1 exitcode, not triggering launch_cl
   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(Form_peach.StringGrid1,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 (Form_peach.StringGrid1.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   if (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.CheckBoxSeparate.Enabled=false) then
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_multi);
   exit;
   end;
//output name
getarch_baseoutname(s);
apply_timestamptoname(s,1,0,'file');
//max Compression mode on/off
exetype:=Form_peach.RadioGroupQuad.Items[Form_peach.RadioGroupQuad.ItemIndex];
out_param:=s+'.br';
get_new_archive_name(out_param);
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);
cl:=bin_name;
compression_level:='-'+Form_peach.ComboBoxArchive9.Text;
cl:=cl+' '+compression_level;
if Form_peach.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<>'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 DirectoryExists(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 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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
set_output_folder(out_param,in_param,real_extract,0);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s1:=extractfilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   s1:=extractfilename(Form_peach.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);
outname:=out_param;
if not(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'brotli'+DirectorySeparator+'brotli'+EXEEXT);
if mode<>'test' then
   begin
   cl:=bin_name+' -d '+in_param+' -o '+out_param;
   if zpaqforce=1 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(Form_peach.StringGrid1,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 (Form_peach.StringGrid1.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   if (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.CheckBoxSeparate.Enabled=false) then
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_multi);
   exit;
   end;
//output name
getarch_baseoutname(s);
apply_timestamptoname(s,1,0,'file');
//max Compression mode on/off
exetype:=Form_peach.RadioGroupQuad.Items[Form_peach.RadioGroupQuad.ItemIndex];
out_param:=s+'.zst';
get_new_archive_name(out_param);
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);
cl:=bin_name;
compression_level:='-'+Form_peach.ComboBoxArchive9.Text;
cl:=cl+' -T0 -q '+compression_level;
if Form_peach.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<>'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 DirectoryExists(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 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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
set_output_folder(out_param,in_param,real_extract,0);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s1:=extractfilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   s1:=extractfilename(Form_peach.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);
outname:=out_param;
if not(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
if out_param<>'' then out_param:=stringdelim(escapefilename(out_param,desk_env));
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'zstd'+DirectorySeparator+'zstd'+EXEEXT);
if mode<>'test' then
   begin
   cl:=bin_name+' -d '+in_param+' -o '+out_param;
   if zpaqforce=1 then cl:=cl+' -f';
   end
else cl:=bin_name+' -t '+in_param;
cl:=cl+' --long=31';
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(Form_peach.StringGrid1,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 (Form_peach.StringGrid1.RowCount<3) then begin end //single input file
else //folder(s) and/or multiple files
   if (Form_peach.CheckBoxSeparate.State=cbUnchecked) or (Form_peach.CheckBoxSeparate.Enabled=false) then
   begin
   pMessageWarningOK(archive_type+' '+txt_error_input_multi);
   exit;
   end;
//output name
getarch_baseoutname(s);
apply_timestamptoname(s,1,0,'file');
//max Compression mode on/off
exetype:=Form_peach.RadioGroupQuad.Items[Form_peach.RadioGroupQuad.ItemIndex];
btfun:=exetype;
out_param:=s+'.'+exetype;
get_new_archive_name(out_param);//issue: it adds progressive number after extension (it's however quite intuitive to remove)
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);
cl:=bin_name;
case Form_peach.RadioGroupQuad.ItemIndex of
   0: begin
      if Form_peach.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 Form_peach.CheckBoxQuadMax.State=cbChecked then compression_level:='x'
      else compression_level:='';
      cl:=cl+compression_level;
      end;
   2: begin
      cl:=cl+' -b';
      compression_level:=form_peach.Comboboxarchivesolid1.Items[Form_peach.Comboboxarchivesolid1.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 DirectoryExists(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 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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s_in:=Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]
else
   s_in:=Form_peach.EditOpenIn.Text;
in_param:=stringdelim(escapefilename(s_in,desk_env));
//folder policy
set_output_folder(out_param,in_param,real_extract,0);
if out_param<>'' then
   if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s1:=extractfilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   s1:=extractfilename(Form_peach.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);
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(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
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);
   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);
   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);
   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 (Form_peach.RadioGroupAction1.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 Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=stringdelim(escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env))
else
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
//folder policy
if mode<>'draganddrop' then set_output_folder(out_param,in_param,real_extract,Form_peach.RadioGroupAction1.ItemIndex);
outname:=out_param;
//archive function
case mode of
   'neutral' :
   case Form_peach.RadioGroupAction1.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row];
      end;
   if Form_peach.CheckBox4.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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
      end;
   if Form_peach.StringGridList.Cells[2,Form_peach.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:=Form_peach.StringGridList.Cells[12,Form_peach.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);
cl:=bin_name+' '+archive_function;
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 DirectoryExists(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 Form_peach.radiogroup1.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 Form_peach.RadioGroup3.ItemIndex of
         0: begin
            algo_list:='';
            ts:=UpCase(form_peach.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',form_peach.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;
cl:=bin_name+' CHECK '+disp_type+' '+algo_list+' ON '+in_param;
end;

procedure decode_7za_exitcode(i:integer; cl,s:ansistring);
begin
if Form_peach.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
//if "Extract to new folder" is unchecked, try moving the content to the parent of initial directory and delete the now empty initial directory, on failure (naming conflicts) keep the content in the initial directory (on failure, output is the same as if "Extract to new folder" switch was employed)
var
   fpath,ipath,npath,opath:ansistring;
   dfound:boolean;
begin
   fpath:=extractfilepath(spath);
   spath:=spath+DirectorySeparator;
   opath:=spath;
   ipath:='';
   if DirectoryExists(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 Form_peach.CheckBoxFolder.State=cbUnChecked then
         if movecontent_todir(opath,fpath,0)=0 then
            try
            if (opath<>fpath) then cleardirsimple(opath);
            except
            end;
      end;
end;

procedure movezpaq(cl:ansistring);
var
   spath:ansistring;
begin
if zpaqfull=1 then exit;
if (fun='UNZPAQ') and ((subfun='extract') or (subfun='convert')) and (zpaqabsolute=0) then
   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;

function launch_cl(cl,jobcode,outname:ansistring):integer; //control command line size then launch cl
var
   P: tprocessutf8;
   tsin,tsout:TTimeStamp;
   tdiff,speed,insize:qword;
   q:qword;
   s,s1,altoutpath:ansistring;
   i,jobtype:integer;
   keepopen:boolean;
   t: TextFile;

   procedure clean_after_launch;
   begin
   inputfile:='';
   unit_gwrap.pfromnativedrag:=false;
   end;

  procedure withconsole;
   var
      i:integer;
      cl: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+' '+Form_peach.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 Form_peach.StringGrid1.RowCount-1 do s1:=s1+Form_peach.StringGrid1.Cells[8,i]+char($0d)+char($0a)
   else s1:=s1+Form_peach.EditOpenIn.Text;
   tsin:=datetimetotimestamp(now);
   {$IFDEF MSWINDOWS}
   P.Options:=[poNewConsole,poWaitOnExit];
   {$ELSE}
   if ((subfun='extract') or (subfun='convert')) and (movetorelativepath=1) and (Form_peach.CheckBoxrelative.enabled=true) then //workaround for Linux
   P.Options:=[poWaitOnExit]
   else
      P.Options:=[poNewConsole,poWaitOnExit];
   {$ENDIF}
   cl:=P.Commandline;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   keepopen:=false;

   if (subfun='list') or (subfun='test') or (subfun='bench') then //unused
      begin
      {$IFDEF MSWINDOWS}
      P.Commandline:='cmd /k "'+cl+'"';
      {$ELSE}
      P.Commandline:='bash -c "'+cl+'; read line"';
      {$IFDEF DARWIN}
      P.Commandline:='open '+cl;
      {$ENDIF}
      {$ENDIF}
      keepopen:=true;
      end;

   P.Execute;
   while P.Running do
      begin
      if Form_peach.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:=true;
if length(cl)>max_cl then
   begin
   pMessageErrorOK(txt_cl_long);
   if pdrop=true then
      begin
      assignfile(t,peaziptmpdir+STR_TMPDROPE);
      rewrite(t);
      closefile(t);
      end;
   clean_after_launch;
   exit;
   end;
if intpw=1 then pforceconsole:=1;
P:=tprocessutf8.Create(nil);
if Form_peach.CheckBoxTarBefore.State=cbChecked then P.Options := [poWaitOnExit];
if needwaitupdating=true then P.Options := [poWaitOnExit];
P.CommandLine:=cl;
i:=validatecl(cl);
if i<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   if pdrop=true then
      begin
      assignfile(t,peaziptmpdir+STR_TMPDROPE);
      rewrite(t);
      closefile(t);
      end;
   clean_after_launch;
   exit;
   end;
s:=Form_peach.EditOpenIn.Text;
if (fun='PEA') or (fun='UNPEA') or (fun='RFJ') or (fun='RFS') then
   begin
   P.Options := [poWaitOnExit];
   P.Execute;
   result:=P.ExitStatus;
   if result=0 then setsequenceerror:=false
   else
      if pdrop=true then
         begin
         assignfile(t,peaziptmpdir+STR_TMPDROPE);
         rewrite(t);
         closefile(t);
         end;
   clean_after_launch;
   P.Free;
   end //launch Pea
else //launch either or pealauncher or ConsoleCreate application, depending on rules
   begin
   insize:=tsize;
   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:='';
      unit_gwrap.pfromnativedrag:=false;
      if result=0 then setsequenceerror:=false
      else
         if pdrop=true then
            begin
            assignfile(t,peaziptmpdir+STR_TMPDROPE);
            rewrite(t);
            closefile(t);
            end;
      P.Free;
      pforceconsole:=0;
      exit;
      end;
   if (zaout>0) or (subfun='list') or (subfun='test') or (subfun='bench') then
      begin
      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') then
            begin
            if ((extractfilename(Form_peach.EditOpenIn.Text)<>'') and (extractfilename(Form_peach.EditOpenIn.Text)<>txt_none)) then
               inputfile:=Form_peach.EditOpenIn.Text
            else
               inputfile:=Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.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;
      unit_gwrap.pprogn:='';
      unit_gwrap.pprogbar:=0;
      unit_gwrap.pproglast:=false;
      unit_gwrap.pprogfirst:=false;
      unit_gwrap.perrignore:=false;
      unit_gwrap.pcanignore:=false;
      unit_gwrap.ppsize:='0';
      case subfun of
         'archive','convert':
         begin
         if Form_peach.stringgrid1.row=1 then unit_gwrap.pprogfirst:=true;
         if Form_peach.ComboboxArchive7.Text<>'' then
            unit_gwrap.paction:=Form_peach.ComboboxArchive7.Text
         else
            unit_gwrap.paction:='';
         if (Form_peach.stringgrid1.rowcount-1>1) and (Form_peach.CheckBoxSeparate.State=cbChecked) then
            begin
            if Form_peach.Width<>0 then unit_gwrap.pprogbar:=Form_peach.Shape3.Width*Form_gwrap.Width div Form_peach.Width;
            unit_gwrap.pprogn:=(inttostr(Form_peach.stringgrid1.row)+'/'+inttostr(Form_peach.stringgrid1.rowcount-1));
            if Form_peach.stringgrid1.row=Form_peach.stringgrid1.rowcount-1 then unit_gwrap.pproglast:=true;
            end;
         unit_gwrap.ppsize:=Form_peach.stringgrid1.Cells[12,Form_peach.stringgrid1.row];
         end;
         'list','test','extract':
         begin
         if (subfun='extract') and (Form_peach.CheckBoxrelative.Checked=true) then unit_gwrap.pcanignore:=true;
         if Form_peach.stringgrid2.row=1 then unit_gwrap.pprogfirst:=true;
         if Form_peach.ComboBoxOverwrite.Caption<>'' then
            unit_gwrap.paction:=Form_peach.ComboBoxOverwrite.Caption
         else
            unit_gwrap.paction:='';
         if (Form_peach.CheckBoxrelative.Checked=true) and (Form_peach.CheckBoxrelative.enabled=true) then unit_gwrap.paction:=txt_7_8_rel;
         if (Form_peach.stringgrid2.rowcount-1>1) and (extsel='all') then
            begin
            if Form_peach.Width<>0 then unit_gwrap.pprogbar:=Form_peach.Shape4.Width*Form_gwrap.Width div Form_peach.Width;
            unit_gwrap.pprogn:=(inttostr(Form_peach.stringgrid2.row)+'/'+inttostr(Form_peach.stringgrid2.rowcount-1));
            if Form_peach.stringgrid2.row=Form_peach.stringgrid2.rowcount-1 then unit_gwrap.pproglast:=true;
            end;
         if psize=0 then unit_gwrap.ppsize:=Form_peach.stringgrid2.Cells[12,Form_peach.stringgrid2.row]
         else unit_gwrap.ppsize:=inttostr(psize);
         end;
      end;
      unit_gwrap.pjobtype:=inttostr(jobtype);
      unit_gwrap.pautoclose:=autoclosegwrap;
      unit_gwrap.ptsize:=inttostr(tsize);
      unit_gwrap.pinputfile:=escapefilename(inputfile,desk_env);
      unit_gwrap.poutname:=escapefilename(outname,desk_env);
      unit_gwrap.poutnamet:='';
      if subfun='extract' then
         begin
         if movetorelativepath=1 then unit_gwrap.poutnamet:=escapefilename(origouttf,desk_env);
         if DirectoryExists(origout) then
            unit_gwrap.poutname:=escapefilename(origout,desk_env)
         else
            unit_gwrap.poutname:=escapefilename(extractfiledir(copy(origout,1,length(origout)-1))+directoryseparator,desk_env);
         end;
      unit_gwrap.psubfun:=subfun;
      unit_gwrap.pcl:=cl;
      unit_gwrap.runelevated:=false;
      unit_gwrap.pfun:=fun;
      unit_gwrap.ppriority:=taskpriority;
      if updatingarchive_inarchive=false then unit_gwrap.autoopen:=autoopen else unit_gwrap.autoopen:=0;
      {$IFDEF MSWINDOWS}
      if (winver='nt6+') and
         (uacneeded=true) and
         ((subfun='archive') or (subfun='extract') or (subfun='convert')) then unit_gwrap.runelevated:=true;
      {$ENDIF}
      wasselected:=-1;
      wasselectedp:=-1;
      Form_peach.Enabled:=false;
      unit_gwrap.gwraplaunch;
      ws_gw_left:=unit_gwrap.ws_gw_left;
      ws_gw_top:=unit_gwrap.ws_gw_top;
      ws_gw_width:=unit_gwrap.ws_gw_width;
      ws_gw_height:=unit_gwrap.ws_gw_height;
      Form_peach.Enabled:=true;
      zaout:=zaout1;
      result:=unit_gwrap.exit_code;
      if result=0 then setsequenceerror:=false
      else
         if pdrop=true then
            begin
            assignfile(t,peaziptmpdir+STR_TMPDROPE);
            rewrite(t);
            closefile(t);
            end;
      if result<>0 then
         if unit_gwrap.perrignore=true then
            begin
            assignfile(t,peaziptmpdir+STR_TMPERRI);
            rewrite(t);
            closefile(t);
            end;
      clean_after_launch;
      end
   else
      begin
      withconsole;
      zaout:=zaout1;
      result:=P.ExitStatus;
      if result=0 then setsequenceerror:=false
      else
         if pdrop=true then
            begin
            assignfile(t,peaziptmpdir+STR_TMPDROPE);
            rewrite(t);
            closefile(t);
            end;
      clean_after_launch;
      P.Free;
      end;
   end;
movezpaq(cl);
end;

function archive_mainsequence(var sel,outname:ansistring; var clres:integer):integer;
var
   cl,jobcode,s,poutname:ansistring;
begin
archive_mainsequence:=-1;
s:=Form_peach.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 (Form_peach.cbcustext.Checked=true) and (Form_peach.editcustext.Caption<>'') then
      begin
      poutname:=outname;
      if Form_peach.editcustext.Caption[1]<>'.' then outname:=cutext(outname)+'.'+Form_peach.editcustext.Caption
      else outname:=cutext(outname)+Form_peach.editcustext.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 Form_peach.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 Form_peach.StringGrid1.Rowcount<2 then exit;
if Form_peach.StringGrid1.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=Form_peach.StringGrid1.Rowcount;
for i:=1 to rc-1 do
      begin
      nsel:=nsel+1;
      s:=Form_peach.StringGrid1.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 syntaxlevel7z of
1: type_option:='-ttar';
0: 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 Form_peach.CheckBoxArchiveOF.State=cbChecked then type_option:=type_option+' -ssw';//store files open for writing
   if Form_peach.CheckBoxsnoi.State=cbChecked then type_option:=type_option+' -snoi';//Linux, ids
   if Form_peach.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';
   if ssp7z=1 then type_option:=type_option+' -ssp';
   //path option
   case Form_peach.ComboBoxArchivePaths.ItemIndex of
      1: type_option:=type_option+' -spf2';
      2: type_option:=type_option+' -spf';
      end;
   if Form_peach.EditOP.Text<>'' then type_option:=type_option+' '+Form_peach.EditOP.Text;
   end;
end;
if excludeef=1 then type_option:=type_option+' -xtd';
// 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
outname:=out_param;
getworkpath(work_path,out_param);
out_param:=stringdelim(escapefilename(out_param,desk_env));
get_in_param(in_param,sel);
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
{$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
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;
Form_peach.StringGrid1.Cursor:=crHourGlass;
P:=tprocessutf8.Create(nil);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
{$IfDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF} //wait for tar to be finished before starting compression
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
   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.Execute;
i:=0;
while P.Running do
   begin
   i:=i+1;
   if i>100 then i:=1;
   Form_peach.Shape3.Width:=(Form_peach.Width*i) div 100;
   Application.ProcessMessages;
   Sleep(100);
   end;
{$IfDEF MSWINDOWS}
   end;
{$ENDIF}
end;
tberr:=P.ExitStatus;
P.Free;
//secure delete on tarbefore
if realtar=true then
 if Form_peach.CheckBoxDeleteInput1.Checked=true then
   begin
   checklistarchive(nsel, strsel);
   if tberr<>0 then
      pMessageErrorOk(txt_6_5_seqerr)
   else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletefilesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 Form_peach.cbdeleteinputmode1.Caption+' '+inttostr(nsel)+' '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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;
Form_peach.StringGrid1.Cursor:=crDefault;
Form_peach.StringGrid1.RowCount:=1;
addfilestr(Form_peach.StringGrid1,outname);
Form_peach.StringGrid1.AutoSizeColumns;
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
if Form_peach.Visible=true then Application.processmessages;
if tberr=0 then tarbeforenameexception:=false;
end;

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

quick PeaZip functions

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

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))), Form_peach.StringGrid1)=0 then
      if filegetattr(ExpandFileName((paramstr(i)))) > 0 then
         begin
         j:=j+1;
         if filegetattr(ExpandFileName((paramstr(i)))) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,ExpandFileName((paramstr(i))))
         else addfolderstr(Form_peach.StringGrid1,ExpandFileName((paramstr(i))));
         end
      else msg_not_accessible(i);
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
if j=0 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
test_in_params_7z:=0;
end;

{function test_in_singleparam:integer;
begin
test_in_singleparam:=-1;
if paramcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
if paramcount>3 then
   begin
   pMessageWarningOK(txt_split+' '+txt_error_input_multi);
   exit_nosave;
   exit;
   end;
if filegetattr(ExpandFileName((paramstr(2)))) <> 0 then
else
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
test_in_singleparam:=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(directoryexists(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 endmultimode;
begin
Form_peach.timer3.enabled:=false;
if dn<>'' then
   begin
   cleardir(dn,false, true);
   dn:='';
   end;
end;

procedure runmulti(P:tprocessutf8);
var
   mclosed:boolean;
begin
{$IFDEF MSWINDOWS}
P.Execute;
mclosed:=false;
while P.Running do
   begin
   Application.ProcessMessages;
   Sleep(100);
   if mclosed=false then
      if not(DirectoryExists(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}
Form_peach.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}
Form_peach.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 add2archivemulti;
begin
showpanel('archive');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
savetype:=true;
if completeshowpea=true then if enumd=1 then begin Form_peach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemulticonvert;
begin
showpanel('archive');
Form_peach.CheckBoxConvert.State:=cbChecked; Form_peach.CheckBoxConvertChange(nil);
Form_peach.CheckBoxSeparate.State:=cbChecked;
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
savetype:=true;
if completeshowpea=true then if enumd=1 then begin Form_peach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemultiseparate;
begin
showpanel('archive');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
form_peach.CheckBoxSeparate.State:=cbChecked;
on_checkboxseparateclick;
Form_peach.timer3.enabled:=true;
stayopen:=false;
savetype:=true;
if completeshowpea=true then if enumd=1 then begin Form_peach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemultisplit;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=10;
archive_type_select(txt_split);
multiaddupdating:=false;
dn:=((paramstr(2)));
getarccaption(txt_split);
Form_peach.timer3.enabled:=true;
stayopen:=false;
if completeshowpea=true then if enumd=1 then begin Form_peach.visible:=true; updatelayout(''); end;
end;

procedure add2archivemulti7z;
var
   level:ansistring;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=0;
archive_type_select('7Z');
multiaddupdating:=false;
level:=paramstr(2);
dontsavecustom7z:=true;
dlevel_7z:=level_7z;
dmethod_7z:=method_7z;
case level of
   'fastest' :
   begin
   Form_peach.ComboBoxArchive4.ItemIndex:=1;
   ComboBoxArchive4_onchange;
   end;
   'default' :
   begin
   //Form_peach.ComboBoxArchive4.ItemIndex:=3;
   //ComboBoxArchive4_onchange;
   end;
   'ultra' :
   begin
   Form_peach.ComboBoxArchive4.ItemIndex:=5;
   ComboBoxArchive4_onchange;
   end;
   'mail' :
   begin
   //Form_peach.ComboBoxArchive4.ItemIndex:=3;
   //ComboBoxArchive4_onchange;
   Form_peach.CheckBoxArchive4.Checked:=true;
   end;
   '7zencrypt' :
   begin
   //Form_peach.ComboBoxArchive4.ItemIndex:=3;
   //ComboBoxArchive4_onchange;
   Form_peach.ImagePassword1Click(nil);
   if (FormPW.EditUn7zaPW.Text='') and (FormPW.EditName3.Text='') then halt;
   end;
   end;
dn:=((paramstr(3)));
getarccaption(STR_7Z);
Form_peach.timer3.enabled:=true;
stayopen:=false;
go_semaphorearchive;
end;

procedure add2archivemultizip;
var
   level:ansistring;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=15;
archive_type_select(STR_ZIP);
multiaddupdating:=false;
level:=paramstr(2);
dontsavecustomzip:=true;
dlevel_zip:=level_zip;
dmethod_zip:=method_zip;
case level of
   'fastest' :
   begin
   Form_peach.ComboBoxArchive4.ItemIndex:=1;
   ComboBoxArchive4_onchange;
   end;
   'default' :
   begin
   //Form_peach.ComboBoxArchive4.ItemIndex:=3;
   //ComboBoxArchive4_onchange;
   end;
   'ultra' :
   begin
   Form_peach.ComboBoxArchive4.ItemIndex:=5;
   ComboBoxArchive4_onchange;
   end;
   'mail' :
   begin
   //Form_peach.ComboBoxArchive4.ItemIndex:=3;
   //ComboBoxArchive4_onchange;
   Form_peach.CheckBoxArchive4.Checked:=true;
   end;
   end;
dn:=((paramstr(3)));
getarccaption(STR_ZIP);
Form_peach.timer3.enabled:=true;
stayopen:=false;
go_semaphorearchive;
end;

procedure add2archivemultisfx;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=8;
archive_type_select(txt_sfx+' '+STR_7Z);
multiaddupdating:=false;
dn:=((paramstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
go_semaphorearchive;
end;

procedure ext2archivemulti;
begin
if Form_peach.mdefaultextract.Checked=false then Form_peach.EditOpenOut.Text:=local_desktop
else Form_peach.EditOpenOut.Text:=defaultextractpath;
list_toextractor('none','full');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
end;

procedure ext2archivemultidir(dirdirective:ansistring);
var
   tmpcheck:boolean;
begin
tmpcheck:=Form_peach.CheckBox1.Checked;
Form_peach.CheckBox1.Checked:=true;
if Form_peach.mdefaultextract.Checked=false then Form_peach.EditOpenOut.Text:=local_desktop
else Form_peach.EditOpenOut.Text:=defaultextractpath;
list_toextractor('none','full');
showpanel_trick;
multiaddupdating:=false;
dn:=((paramstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
settmpextnf:=true;
if Form_peach.CheckBoxFolder.State=cbChecked then tmpextnf:=true else tmpextnf:=false;
tmpremoveintdir:=removeintdir;
case dirdirective of
   'here': Form_peach.CheckBoxFolder.State:=cbUnchecked;
   'smart': begin Form_peach.CheckBoxFolder.State:=cbChecked; removeintdir:=1; end;
   'folder': begin Form_peach.CheckBoxFolder.State:=cbChecked; removeintdir:=0; end;
end;
go_semaphoreextract;
Form_peach.CheckBox1.Checked:=tmpcheck;
end;

procedure add2multi;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemulti '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2multiconvert;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemulticonvert '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2multiseparate;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addseparate',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultiseparate '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2multi7z(level:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add7z',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemulti7z '+level+' '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2multizip(level:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addzip',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultizip '+level+' '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2multisplit;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addsplit',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultisplit '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2multisfx;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('addsfx',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -add2archivemultisfx '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure ext2multi;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('neutral',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -ext2archivemulti '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure ext2multidirect(dirdirective:ansistring);
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('neutral',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
//-ext2archivemultihere extract here
//-ext2archivemultismart extract to new folder, smart folder management
//-ext2archivemultifolder extract to new folder
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' '+dirdirective+' '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
runmulti(P);
{$ENDIF}
end;

procedure add2pea(pmode,pbatch:ansistring); //directly create .pea archive with default parameters
//pmode "crypt" uses encryption, "standard" don't use encryption
//pbatch "complete" parses advanced peazip setting (delete after archiving/extraction), "ignore" ignores those directives
var
   i,j:integer;
   cl,s,jobcode,out_param,in_param,bin_name:ansistring;
   name_ok:boolean;
begin
if test_in_params(j)<>0 then begin exit_nosave; exit; end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+'PEA';
fun:='PEA';
fun_status:=fun;
subfun:='archive';
//out_param
out_param:=ExpandFileName((paramstr(2)));
if control_outparam(out_param)<>0 then exit;
if (paramcount=2) and (upcase(copy(out_param,length(out_param)-3,4))='.TAR') then //don't strip .tar extension
else
   if directoryexists((out_param)) then
   else cutextension(out_param);
if fileexists((out_param+'.pea')) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if fileexists(s+NAMEVARSTR+inttostr(i)+'.pea') or directoryexists(s+NAMEVARSTR+inttostr(i)+'.pea') then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i);
   end;
in_param:='';
out_param:=stringdelim(escapefilename(out_param,desk_env));
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);
if pmode='crypt' then
   cl:=bin_name+' '+fun+' '+out_param+' 0 PCOMPRESS2 SHA256 CRC64 TRIATS INTERACTIVE FROMCL '+in_param
else
   cl:=bin_name+' '+fun+' '+out_param+' 0 PCOMPRESS2 SHA256 CRC64 NOALGO BATCH FROMCL '+in_param;
launch_cl(cl,jobcode,out_param);
if (Form_peach.CheckBoxDeleteInput1.Checked=true) and (pbatch='complete') then
   if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
      pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
   else
      erase_fromname('archive',in_param);
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;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P.Execute;
      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);
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
cl:=bin_name+' COMPARE '+in_param;
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
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:=escapefilename(ExpandFileName(fname),desk_env);
in_param:=stringdelim(s);
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(out_param);
launch_cl(cl,jobcode,in_param);
fun:=s1;
fun_status:=fun;
end;

procedure add27z(pmode,mailfun,pbatch:ansistring);//directly create archive using 7z backend with default parameters
//pmode "7z" "zip" "sfz" sets archive format
//mailfun "mail" try to send archive as attachment from default mail application, "archive" simply creates the archive
//pbatch "complete" parses advanced peazip setting (delete after archiving/extraction), "ignore" ignores those directives
var
   i,j:integer;
   s,s0,cl,jobcode,work_path,out_param,in_param,bin_name,outname,compression_level,compmethodstr:ansistring;
   name_ok:boolean;
begin
if test_in_params_7z(j)<>0 then begin exit_nosave; exit; end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+'7z_archive';
fun:='7Z';
fun_status:=fun;
subfun:='archive';
//output name
s:=ExpandFileName((paramstr(2)));
if (paramcount=2) and (upcase(copy(s,length(s)-3,4))='.TAR') then //don't strip .tar extension
else
   if directoryexists((s)) then
   else cutextension(s);
if paramcount>2 then
   begin
   s0:=extractfilepath(s);
   if length(s0)>3 then
      begin
      if s0[length(s0)]=directoryseparator then setlength(s0,length(s0)-1);
      s0:=extractfilename(s0);
      end;
   s:=extractfilepath(s);
   if s[length(s)]<>directoryseparator then s:=s+DirectorySeparator;
   s:=s+s0;
   end;
case pmode of
   '7z': out_param:=s+'.7z';
   'zip': out_param:=s+'.zip';
   'sfx': out_param:=s+'.exe';
   end;
if control_outparam(out_param)<>0 then exit;
if fileexists((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 directoryexists(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;
in_param:='';
outname:=out_param;
getworkpath(work_path,out_param);
out_param:=stringdelim(escapefilename(out_param,desk_env));
for i:=2 to j+1 do in_param:=in_param+stringdelim(escapefilename(ExpandFileName((paramstr(i))),desk_env))+' ';
bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT);
{$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
if pmode='zip' then
   begin
   case level_zip of
   0: cl:=bin_name+' a -tzip -mm=Copy -mmt=on -mx0';
   1: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx1';
   2: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx3';
   3: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx5';
   4: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx7';
   5: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx9';
   end;
   end
else
   begin
   compression_level:=setarchivecompleveln(method_7z,level_7z);
   compmethodstr:=method_7z;
   if pos('Lizard',compmethodstr)<>0 then compmethodstr:='Lizard';
   case level_7z of
   0: cl:=bin_name+' a -t7z -m0=Copy -mmt=on -mx0';
   else cl:=bin_name+' a -t7z -m0='+compmethodstr+' -mmt=on '+compression_level;
   end;
   end;
if pmode='sfx' then cl:=cl+' -sfx7z.sfx';
if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
if mailfun='mail' then cl:=cl+' -seml';
if intpw=1 then //password is forced and mode is set to console consistently with other operations with this option
   begin
   cl:=cl+' -p';
   pforceconsole:=1;
   if (setencfn=1) and (pmode='7z') then cl:=cl+' -mhe=on';
   end;
if (pmode='7z') and (storecreated=1) then cl:=cl+' -mtc=on -mta=on';
if (pmode='zip') then
   if (storecreated=1) then
      case syntaxlevel7z of
      0:cl:=cl+' -mtc=on -mta=on';
      1:cl:=cl+' -mtc=on';
      end;
if excludeef=1 then cl:=cl+' -xtd';
if work_path<>'' then cl:=cl+' '+work_path;
cl:=cl+' '+out_param+' '+in_param;
launch_cl(cl,jobcode,outname);
if (Form_peach.CheckBoxDeleteInput1.Checked=true) and (pbatch='complete') then
   if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
      pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
   else
      erase_fromname('archive',in_param);
end;

procedure add2separate7z(pmode,pbatch:ansistring); //directly create separate archives using 7z backend, one for input object, with default parameters
var
   i,j:integer;
   s,cl,jobcode,work_path,out_param,in_param,bin_name,outname,compmethodstr:ansistring;
   name_ok:boolean;
begin
if paramcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
for i:=2 to paramcount do
   begin
   if filegetattr((paramstr(i))) > 0 then
      begin
      in_param:=ExpandFileName((paramstr(i)));
      jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+'7z_archive';
      fun:='7Z';
      fun_status:=fun;
      subfun:='archive';
      //output name
      s:=in_param;
      if (upcase(copy(s,length(s)-3,4))='.TAR') then //never strip .tar extension (since is archiving single objects)
      else
         if directoryexists((s)) then
         else cutextension(s);
      case pmode of
         '7z': out_param:=s+'.7z';
         'zip': out_param:=s+'.zip';
         end;
      if control_outparam(out_param)<>0 then exit;
      if fileexists((out_param)) then
         begin
         j:=1;
         name_ok:=false;
         s:=out_param;
         cutextension(s);
         repeat
            if fileexists((s+NAMEVARSTR+inttostr(i)+extractfileext(out_param))) then inc(j,1)
            else name_ok:=true;
         until name_ok = true;
         out_param:=s+NAMEVARSTR+inttostr(i)+extractfileext(out_param);
         end;
      outname:=out_param;
      getworkpath(work_path,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)+'7z'+DirectorySeparator+alias7z+EXEEXT);
      {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
      if pmode='zip' then
         begin
         case level_zip of
         0: cl:=bin_name+' a -tzip -mm=Copy -mmt=on -mx0';
         1: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx1';
         2: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx3';
         3: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx5';
         4: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx7';
         5: cl:=bin_name+' a -tzip -mm='+method_zip+' -mmt=on -mx9';
         end;
         end
      else
         begin
         compression_level:=setarchivecompleveln(method_7z,level_7z);
         compmethodstr:=method_7z;
         if pos('Lizard',compmethodstr)<>0 then compmethodstr:='Lizard';
         case level_7z of
         0: cl:=bin_name+' a -t7z -m0=Copy -mmt=on -mx0';
         else cl:=bin_name+' a -t7z -m0='+compmethodstr+' -mmt=on '+compression_level;
         end;
         end;
      if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
      if intpw=1 then //password is forced and mode is set to console consistently with other operations with this option
         begin
         cl:=cl+' -p';
         pforceconsole:=1;
         if (setencfn=1) and (pmode='7z') then cl:=cl+' -mhe=on';
         end;
      if (pmode='7z') and (storecreated=1) then cl:=cl+' -mtc=on -mta=on';
      if (pmode='zip') then
         if (storecreated=1) then
            case syntaxlevel7z of
            0: cl:=cl+' -mtc=on -mta=on';
            1: cl:=cl+' -mtc=on';
            end;
      if excludeef=1 then cl:=cl+' -xtd';
      if work_path<>'' then cl:=cl+' '+work_path;
      cl:=cl+' '+out_param+' '+in_param;
      launch_cl(cl,jobcode,outname);
      if (Form_peach.CheckBoxDeleteInput1.Checked=true) and (pbatch='complete') then
         if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
            pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
         else
            erase_fromname('archive',in_param);
      sleep(random(250)); //if multiple archives are submitted sequentially, let some times between accesses to configuration / backend programs etc
      end
   else msg_not_accessible(i);
   end;
end;

procedure setpwtotest(var pwtotest:ansistring);
begin
if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.Text<>'') then
   begin
   pwtotest:=FormPW.EditUn7zaPW.Text;
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pwtotest,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.Text+' '+txt_keyfile_not_found);
         exit;
         end;
   end
else pwtotest:='default';
end;

function directpw_pre_test(in_param:ansistring):integer;
//test archive for possible password protection simulating list operation, before direct extraction, list or test
var
   P:tprocessutf8;
   pwtotest,cl:ansistring;
begin
result:=-1;
P:=tprocessutf8.Create(nil);
setpwtotest(pwtotest);
P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
cl:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -ext2openpwtest '+stringdelim(pwtotest)+' '+stringdelim(escapefilename(in_param,desk_env));
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
result:=P.exitstatus;
P.Free;
end;

procedure reopen_7z;
var
   s1,s2:ansistring;
begin
s1:=Form_peach.EditUn7zaFilter.Text;
s2:=Form_peach.EditUn7zaFilterExclude.Text;
browse_special_cases;
do_prebrowse;
Form_peach.EditUn7zaFilter.Text:=s1;
Form_peach.EditUn7zaFilterExclude.Text:=s2;
if browsingmode7z=0 then
   begin
   list_un7z('browse');
   status0:=txt_list_browsing;
   end
else listun7z_expandall;
end;

function ask_pwkeyfile_core:integer;
var
   s1,s1b,s2:ansistring;
   encfn,eintpw,shp:boolean;
   keeppwt:integer;
begin
ask_pwkeyfile_core:=-1;
//read previous values
s1:=FormPW.EditUn7zaPW.Text;
s1b:=FormPW.EditUn7zaPW1.Text;
s2:=FormPW.EditName3.Text;
if setencfn=1 then FormPW.CheckBoxEncFn.State:=cbChecked;
if intpw=1 then
   begin
   FormPW.CheckBoxintpw.State:=cbChecked;
   FormPW.EditUn7zaPW.Text:='';
   FormPW.EditUn7zaPW1.Text:='';
   FormPW.PanelKF.Visible:=true;
   FormPW.EditUn7zaPW.Enabled:=false;
   FormPW.EditUn7zaPW1.Enabled:=false;
   FormPW.LableListPath2.Enabled:=false;
   FormPW.CheckBoxKeepPW.Enabled:=false;
   FormPW.CheckBoxShowPWField.Enabled:=false;
   end
else
   begin
   FormPW.CheckBoxintpw.State:=cbUnChecked;
   FormPW.EditUn7zaPW.Enabled:=true;
   FormPW.EditUn7zaPW1.Enabled:=true;
   FormPW.LableListPath2.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.EditUn7zaPW.PasswordChar:=#0;
   FormPW.lablelistPath3.Visible:=false;
   FormPW.EditUn7zaPW1.visible:=false;
   end
else
   begin
   FormPW.CheckBoxShowPWField.State:=cbUnChecked;
   FormPW.EditUn7zaPW.PasswordChar:='*';
   if hidepwconf=1 then
      begin
      FormPW.lablelistPath3.Visible:=false;
      FormPW.EditUn7zaPW1.visible:=false;
      end
   else
      begin
      FormPW.lablelistPath3.Visible:=true;
      FormPW.EditUn7zaPW1.visible:=true;
      end;
   end;
//show form
if (FormPW.EditUn7zaPW.Text='') then
   begin
   FormPW.Shape1.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.EditName3.Text)>16383 then
      begin
      ask_pwkeyfile_core:=-1;
      FormPW.EditName3.Text:=s2;
      pMessageWarningOK(txt_3_1_pathexc);
      exit;
      end;
   ask_pwkeyfile_core:=0;
   end
else
   begin
   if FormPW.ModalResult=mrAbort then ask_pwkeyfile_core:=-1 //if coming from password manager, reset previous changes on and return to password form
   else ask_pwkeyfile_core:=1;
   FormPW.EditUn7zaPW.Text:=s1;
   FormPW.EditUn7zaPW1.Text:=s1b;
   FormPW.EditName3.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.EditUn7zaPW.PasswordChar:=#0;
      FormPW.lablelistPath3.Visible:=false;
      FormPW.EditUn7zaPW1.visible:=false;
      FormPW.EditUn7zaPW1.Text:='';
      end
   else
      begin
      FormPW.EditUn7zaPW.PasswordChar:='*';
      FormPW.lablelistPath3.Visible:=true;
      FormPW.EditUn7zaPW1.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 ask_pwkeyfile_core=0 then //test only if confirmed with ok
begin
if showpwfield=0 then
   if FormPW.EditUn7zaPW1.visible=true then
      if FormPW.EditUn7zaPW.Text<>FormPW.EditUn7zaPW1.Text then
         begin
         FormPW.EditUn7zaPW.Text:=s1;
         FormPW.EditUn7zaPW1.Text:=s1b;
         pMessageWarningOK(txt_error_passwordnotmatch);
         ask_pwkeyfile_core:=-1;
         exit;
         end
      else
   else FormPW.EditUn7zaPW1.Text:=FormPW.EditUn7zaPW.Text; //if password confirmation field is hidden, hinerits password filed value opening the archive (the filed is shown when in compression / browser mode so needs to be valorized)
s1:=FormPW.EditUn7zaPW.Text;
s2:=FormPW.EditName3.Text;
if (s1='') and (s2='') and (seemencrypted=true) and (FormPW.CheckBoxEncFn.Visible=false) then
      begin
      pMessageWarningOK(txt_pw_empty);
      ask_pwkeyfile_core:=-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)<>0 then
      begin
      pMessageErrorOK(s2+' '+txt_keyfile_not_found);
      ask_pwkeyfile_core:=-1;
      exit;
      end;
if pw4cl('-p',s1)<>0 then
   begin
   msg_pw_errorchar(s1);
   ask_pwkeyfile_core:=-1;
   exit;
   end;
end
else
   begin
   if showpwfield=0 then
      if FormPW.EditUn7zaPW1.visible=true then
         if FormPW.EditUn7zaPW.Text<>FormPW.EditUn7zaPW1.Text then
            begin
            FormPW.EditUn7zaPW.Text:=s1;
            FormPW.EditUn7zaPW1.Text:=s1b;
            end;
   end;
setpwicons;
end;

function ask_pwkeyfile:integer;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
ask_pwkeyfile:=-1;
repeat
ask_pwkeyfile:=ask_pwkeyfile_core;
until ask_pwkeyfile>=0;
if ask_pwkeyfile=0 then
   try
      if form_peach.stringgridlist.Cells[1,1]='' then
         begin
         if fun='UN7Z' then reopen_7z;
         if fun='UNARC' then browse_arc('flat');
         if fun='UNZPAQ' then browse_zpaq;
         end;
   except
   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(form_peach.editopenin.caption)+' | '+txt_3_0_readablepw;
      hideconfirmation;
      end;
   2: begin
      if testtypeenc(form_peach.editopenin.caption)=true then exit;
      FormPW.Caption:=extractfilename(form_peach.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 directask_pwkeyfile_context(var pw:ansistring; ec:integer):integer; //on direct extraction/list/test, after testing archive, allows to try a password if the archive is not readable
begin
directask_pwkeyfile_context:=-1;
if ask_pwkeyfile_direct(ec)<>0 then exit;
pw:=FormPW.EditUn7zaPW.Text;
if FormPW.EditName3.Text<>'' then
   if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         pMessageErrorOK(FormPW.EditName3.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:='-pdefault';
directask_pwkeyfile_context:=0;
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 Form_peach.CheckBoxFolder.state=cbChecked then needwaitupdating:=true;
   case j of
      0: begin
         P:=tprocessutf8.Create(nil);
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
         cl:=bin_name+' -ext2open '+in_param; //ext2open handles a single input in open interface
         P.CommandLine:=cl;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P.Execute;
         P.Free;
         exit;
         end;
      1: begin
         out_param:=out_param+(extractfilename(in_param));
         cutextension(out_param);
         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);
         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);
         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;
         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 (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;
            Form_peach.Visible:=false;
            saverestartclosepeaapp;
            exit;
            end;
         fun:='UNACE';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         outname:=out_param;
         in_param:=stringdelim(escapefilename(in_param,desk_env));
         bin_name:=stringdelim(escapefilename(binpath,desk_env)+'unace'+DirectorySeparator+'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;
         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);
         cl:=bin_name+' d '+in_param+' '+out_param;
         launch_cl(cl,jobcode,outname);
         end;
      9: begin
         fun:='UNARC';
         fun_status:=fun;
         pw:='-p'+pwtotest;
         case extpw of
               1: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 100*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               2: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 2*1024*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               3: begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                  end;
               4: begin
                  if directask_pwkeyfile_context(pw,0)<>0 then exit;
                  end;
            end;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         //folder policy
         set_output_folder(out_param,in_param,true,0);
         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;
         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);
         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:=Form_peach.CheckBoxFolder.Checked;
         if optype='extract' then Form_peach.CheckBoxFolder.Checked:=true;
         set_output_folder(out_param,in_param,true,0);
         Form_peach.CheckBoxFolder.Checked:=infopt;
         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);
         pw:=FormPW.EditUn7zaPW.Text;
         if FormPW.EditName3.Text<>'' then
            if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
               begin
               pMessageErrorOK(FormPW.EditName3.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+' -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;
         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);
         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;
         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);
         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
            pw:='-p'+pwtotest;
            case extpw of
               1: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 100*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               2: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 2*1024*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               3: begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                  end;
               4: begin
                  if directask_pwkeyfile_context(pw,0)<>0 then exit;
                  end;
               end;
            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);
            //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:=''; if zaout=2 then zaout:=1; end;//ask auto switch to GUI+console mode if needed
            end;
            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);
            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
            pw:='-p'+pwtotest;
            case extpw of
               1: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 100*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               2: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 2*1024*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               3: begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                  end;
               4: begin
                  if directask_pwkeyfile_context(pw,0)<>0 then exit;
                  end;
               end;
            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);
            //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:=''; if zaout=2 then zaout:=1; end;//ask auto switch to GUI+console mode if needed
            end;
            outname:=out_param;
            if willbemoved=true then
               begin
               if out_param<>'' then if DirectoryExists(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);
            {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
            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 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 Form_peach.EditEncoding.Caption<>'' then mcu_option:='-mcp='+Form_peach.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;
            if excludeef=1 then cl:=cl+' -xtd';
            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 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 Form_peach.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));
   Form_peach.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
         Form_peach.SelectDirectoryDialog1.InitialDir:=local_desktop;
         if Form_peach.SelectDirectoryDialog1.Execute then
            if Form_peach.SelectDirectoryDialog1.FileName<>'' then
               begin
               out_param:=Form_peach.SelectDirectoryDialog1.FileName;
               end
            else exit
         else exit;
         end
      else //jump to handling custom file types
         begin
         directextractfromname(in_param,out_param,'extract','');
         if (Form_peach.CheckBoxDeleteInput.Checked=true) and (pbatch='complete') then
            if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
               pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
            else
               erase_fromname('archive',in_param);
         exit;
         end;
      end;
   'simple':
      begin
      out_param:=paramstr(3);
      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;
   Form_peach.CheckBoxFolder.State:=cbUnChecked;
   {if folderoption='askfolder' then //unused mode, for now
      begin
         if pMessageInfoYesNo(txt_autofolder)=6 then
         begin
         Form_peach.CheckBoxFolder.State:=cbChecked;
         end;
      end;}
   tmpremoveintdir:=removeintdir;
   if folderoption='newfolder' then
      begin
      Form_peach.CheckBoxFolder.State:=cbChecked;
      removeintdir:=0;
      end;
   if folderoption='smart' then
      begin
      Form_peach.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 (form_peach.CheckBoxrelative.State=cbChecked) and (Form_peach.CheckBoxrelative.enabled=true) then forcewillbemoved:=true;
   moverelpath:='*';
   directextractfromname(in_param,out_param,'extract','');
   moverelpath:='';
   move_out_param:='';
   forcewillbemoved:=false;
   if (Form_peach.CheckBoxDeleteInput.Checked=true) and (pbatch='complete') then
      if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
         pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
      else
         erase_fromname('archive',in_param);
   end;
if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure ext2lt(ltfun:ansistring); //directly list or test archive(s)
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)));
   j:=testinput(in_param,true);
   case j of
      0: begin
         pMessageWarningOK((paramstr(i))+' '+txt_type_unsupported+'. '+txt_type_unsupported_select+READE_LIST);
         break;
         end;
      1: begin
         pMessageWarningOK(STR_PEA+': '+txt_listtest);
         break;
         end;
      2: begin
         pMessageWarningOK(txt_split+': '+txt_listtest);
         break;
         end;
      5: begin
         pMessageWarningOK(STR_ZPAQ+': '+txt_listtest);
         break;
         end;
      6: begin
         pMessageWarningOK(STR_QUAD+': '+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;
            Form_peach.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);
         //archive function
         archive_function:=ltfun;
         cl:=bin_name+' '+archive_function;
         cl:=cl+' '+in_param;
         launch_cl(cl,jobcode,out_param);
         end;
      8: begin
         pMessageWarningOK('LPAQ: '+txt_listtest);
         break;
         end;
      9: begin
         fun:='UNARC';
         fun_status:=fun;
         pw:='-p'+pwtotest;
         case extpw of
               1: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 100*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               2: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 2*1024*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               3: begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                  end;
               4: begin
                  if directask_pwkeyfile_context(pw,0)<>0 then exit;
                  end;
            end;
         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);
         //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);
         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;
      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
            pw:='-p'+pwtotest;
            case extpw of
               1: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 100*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               2: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 2*1024*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               3: begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                  end;
               4: begin
                  if directask_pwkeyfile_context(pw,0)<>0 then exit;
                  end;
               end;
            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);
            //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
            pw:='-p'+pwtotest;
            case extpw of
               1: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 100*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               2: begin
                  try
                  srcfilesize_multipart(in_param,fsize);
                  if fsize < 2*1024*1024*1024 then
                     begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                     end;
                  except
                  end;
                  end;
               3: begin
                     ec:=directpw_pre_test(in_param);
                     if ec<>0 then
                        if directask_pwkeyfile_context(pw,ec)<>0 then exit;
                  end;
               4: begin
                  if directask_pwkeyfile_context(pw,0)<>0 then exit;
                  end;
               end;
            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);
            {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
            //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
            cl:=cl+' '+pw;
            if excludeef=1 then cl:=cl+' -xtd';
            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;
   P:=tprocessutf8.Create(nil);
   in_param:=stringdelim(escapefilename(in_param,desk_env));
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   cl:=bin_name+' -ext2open '+in_param; //ext2open handles a single input in open interface
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   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)));
   P:=tprocessutf8.Create(nil);
   in_param:=stringdelim(escapefilename(in_param,desk_env));
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   cl:=bin_name+' -ext2openasarchive '+in_param; //ext2openasarchive handles a single input in open interface with forceopenasarchive set true
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   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 directoryexists(in_param) then
      else in_param:=extractfilepath(in_param);
      P:=tprocessutf8.Create(nil);
      in_param:=stringdelim(escapefilename(in_param,desk_env));
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      cl:=bin_name+' -ext2open '+in_param; //ext2open handles a single input in open interface
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P.Execute;
      P.Free;
      end;
end;

procedure open_cp(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
P:=tprocessutf8.Create(nil);
{$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 --working-directory='+escapefilenamedelim(s,desk_env); end;//Gnome
   2: begin cl:='konsole --workdir '+escapefilenamedelim(s,desk_env); end;//KDE
   20: begin cl:='open -a Terminal '+escapefilenamedelim(s,desk_env); end;//macOS
   end;
{$ENDIF}
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.CommandLine:=cl;
P.Execute;
P.Free;
end;

procedure linlaunchconsole(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFNDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
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 Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.CommandLine:=cl;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure linlaunch(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFNDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=s;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.CommandLine:=cl;
try
P.Execute;
except
end;
P.Free;
{$ENDIF}
end;

procedure open_ps(s:ansistring);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
if winver='nt6+' then cl:='powershell.exe -NoExit -Command "Set-Location '''+s+'''"' else exit;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Executable:='powershell.exe';
P.Parameters.Add('-NoExit');
P.Parameters.Add('-Command "Set-Location '''+s+'''"');
if Form_peach.Visible=true then Application.ProcessMessages;
P.Execute;
P.Free;
{$ENDIF}
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 directoryexists(in_param) then
      else in_param:=extractfilepath(in_param);
      if in_param<>'' then open_cp(in_param);
      end;
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
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 (directoryexists(peaziptmpdir)) or (directoryexists(peaziptmpdirroot+STR_PZWORKTMP+directoryseparator)) then
      begin
      pMessageWarningOK(txt_8_3_lw);
      cp_open(peaziptmpdirroot,desk_env);
      end;
   end;
end;

procedure on_exit;
begin
try
if Form_peach.Visible=true then
   begin
   if pimmersive=0 then
      if Form_peach.WindowState=wsNormal then
         begin
         ws_status:=0;
         ws_left:=Form_peach.Left;
         ws_top:=Form_peach.Top;
         ws_width:=Form_peach.Width;
         ws_height:=Form_peach.Height;
         end
      else
         if Form_peach.WindowState=wsMaximized then ws_status:=1;
   end;
except
end;
form_peach.Visible:=false;
try
if ptmpcode<>'' then cleardir(ptmpdir,true,false);
if pstmpdir<>'' then cleardir(pstmpdir,true,false);
reset_temp(0);
endmultimode;
clearstopsequencefile;
endflag:=true;
addtofolderhistory(Form_peach.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_custedit; not needed, apps are saved exiting from the modal dialog
except
end;
end;

procedure restartpeaapp;
var
   P:tprocessutf8;
   cl:ansistring;
begin
cl:=stringdelim(executable_path+'peazip'+EXEEXT);
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.CommandLine:=cl;
P.Execute;
P.Free;
end;

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

procedure resetexttonewfolder;
begin
if settmpextnf=true then
   begin
   if tmpextnf= true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.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 changelanguage;
begin
Form_peach.OpenDialogLang.InitialDir:=sharepath+'lang'+directoryseparator;
if Form_peach.OpenDialogLang.execute then
   if Form_peach.OpenDialogLang.FileName<>'' then
      begin
      {$IFDEF MSWINDOWS}
      peaziplanguage(extractfilename(Form_peach.OpenDialogLang.FileName));
      restartclosepeaapp;
      {$ELSE}
      lang_file:=extractfilename(Form_peach.OpenDialogLang.FileName);
      saverestartclosepeaapp;
      {$ENDIF}
      end
   else exit
else exit;
end;

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(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit1)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   2: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit2)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   3: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit3)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   4: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit4)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   5: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit5)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   6: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit6)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   7: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit7)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   8: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit8)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   9: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit9)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   10: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit10)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   11: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit11)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   12: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit12)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   13: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit13)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   14: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit14)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   15: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit15)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   16: ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit16)+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
   end;
{$ELSE}
try
P:=tprocessutf8.Create(nil);
{$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}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
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(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit1)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit1)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   2: if isawebservice(custedit2) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit2)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit2)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   3: if isawebservice(custedit3) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit3)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit3)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   4: if isawebservice(custedit4) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit4)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit4)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   5: if isawebservice(custedit5) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit5)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit5)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   6: if isawebservice(custedit6) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit6)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit6)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   7: if isawebservice(custedit7) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit7)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit7)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   8: if isawebservice(custedit8) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit8)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit8)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   9: if isawebservice(custedit9) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit9)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit9)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   10: if isawebservice(custedit10) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit10)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit10)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   11: if isawebservice(custedit11) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit11)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit11)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   12: if isawebservice(custedit12) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit12)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit12)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   13: if isawebservice(custedit13) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit13)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit13)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   14: if isawebservice(custedit14) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit14)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit14)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   15: if isawebservice(custedit15) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit15)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit15)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   16: if isawebservice(custedit16) then
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit16)+w1+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
      else
         ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+utf8decode(custedit16)+'"'), PWideChar ('"'+w+'"'), PWideChar (''), SW_SHOWNORMAL);
   end;
{$ELSE}
try
P:=tprocessutf8.Create(nil);
{$IFDEF DARWIN}
case i of
   1: if isawebservice(custedit1) then
         cl:=stringdelim(custedit1+extractfilename(s))
      else
         cl:=(custedit1)+' '+stringdelim(s);
   2: if isawebservice(custedit2) then
         cl:=stringdelim(custedit2+extractfilename(s))
      else
         cl:=(custedit2)+' '+stringdelim(s);
   3: if isawebservice(custedit3) then
         cl:=stringdelim(custedit3+extractfilename(s))
      else
         cl:=(custedit3)+' '+stringdelim(s);
   4: if isawebservice(custedit4) then
         cl:=stringdelim(custedit4+extractfilename(s))
      else
         cl:=(custedit4)+' '+stringdelim(s);
   5: if isawebservice(custedit5) then
         cl:=stringdelim(custedit5+extractfilename(s))
      else
         cl:=(custedit5)+' '+stringdelim(s);
   6: if isawebservice(custedit6) then
         cl:=stringdelim(custedit6+extractfilename(s))
      else
         cl:=(custedit6)+' '+stringdelim(s);
   7: if isawebservice(custedit7) then
         cl:=stringdelim(custedit7+extractfilename(s))
      else
         cl:=(custedit7)+' '+stringdelim(s);
   8: if isawebservice(custedit8) then
         cl:=stringdelim(custedit8+extractfilename(s))
      else
         cl:=(custedit8)+' '+stringdelim(s);
   9: if isawebservice(custedit9) then
         cl:=stringdelim(custedit9+extractfilename(s))
      else
         cl:=(custedit9)+' '+stringdelim(s);
   10: if isawebservice(custedit10) then
         cl:=stringdelim(custedit10+extractfilename(s))
      else
         cl:=(custedit10)+' '+stringdelim(s);
   11: if isawebservice(custedit11) then
         cl:=stringdelim(custedit11+extractfilename(s))
      else
         cl:=(custedit11)+' '+stringdelim(s);
   12: if isawebservice(custedit12) then
         cl:=stringdelim(custedit12+extractfilename(s))
      else
         cl:=(custedit12)+' '+stringdelim(s);
   13: if isawebservice(custedit13) then
         cl:=stringdelim(custedit13+extractfilename(s))
      else
         cl:=(custedit13)+' '+stringdelim(s);
   14: if isawebservice(custedit14) then
         cl:=stringdelim(custedit14+extractfilename(s))
      else
         cl:=(custedit14)+' '+stringdelim(s);
   15: if isawebservice(custedit15) then
         cl:=stringdelim(custedit15+extractfilename(s))
      else
         cl:=(custedit15)+' '+stringdelim(s);
   16: if isawebservice(custedit16) then
         cl:=stringdelim(custedit16+extractfilename(s))
      else
         cl:=(custedit16)+' '+stringdelim(s);
   end;
{$ELSE}
case i of
   1: if isawebservice(custedit1) then
         cl:=stringdelim(custedit1+extractfilename(s))
      else
         cl:=stringdelim(custedit1)+' '+stringdelim(s);
   2: if isawebservice(custedit2) then
         cl:=stringdelim(custedit2+extractfilename(s))
      else
         cl:=stringdelim(custedit2)+' '+stringdelim(s);
   3: if isawebservice(custedit3) then
         cl:=stringdelim(custedit3+extractfilename(s))
      else
         cl:=stringdelim(custedit3)+' '+stringdelim(s);
   4: if isawebservice(custedit4) then
         cl:=stringdelim(custedit4+extractfilename(s))
      else
         cl:=stringdelim(custedit4)+' '+stringdelim(s);
   5: if isawebservice(custedit5) then
         cl:=stringdelim(custedit5+extractfilename(s))
      else
         cl:=stringdelim(custedit5)+' '+stringdelim(s);
   6: if isawebservice(custedit6) then
         cl:=stringdelim(custedit6+extractfilename(s))
      else
         cl:=stringdelim(custedit6)+' '+stringdelim(s);
   7: if isawebservice(custedit7) then
         cl:=stringdelim(custedit7+extractfilename(s))
      else
         cl:=stringdelim(custedit7)+' '+stringdelim(s);
   8: if isawebservice(custedit8) then
         cl:=stringdelim(custedit8+extractfilename(s))
      else
         cl:=stringdelim(custedit8)+' '+stringdelim(s);
   9: if isawebservice(custedit9) then
         cl:=stringdelim(custedit9+extractfilename(s))
      else
         cl:=stringdelim(custedit9)+' '+stringdelim(s);
   10: if isawebservice(custedit10) then
         cl:=stringdelim(custedit10+extractfilename(s))
      else
         cl:=stringdelim(custedit10)+' '+stringdelim(s);
   11: if isawebservice(custedit11) then
         cl:=stringdelim(custedit11+extractfilename(s))
      else
         cl:=stringdelim(custedit11)+' '+stringdelim(s);
   12: if isawebservice(custedit12) then
         cl:=stringdelim(custedit12+extractfilename(s))
      else
         cl:=stringdelim(custedit12)+' '+stringdelim(s);
   13: if isawebservice(custedit13) then
         cl:=stringdelim(custedit13+extractfilename(s))
      else
         cl:=stringdelim(custedit13)+' '+stringdelim(s);
   14: if isawebservice(custedit14) then
         cl:=stringdelim(custedit14+extractfilename(s))
      else
         cl:=stringdelim(custedit14)+' '+stringdelim(s);
   15: if isawebservice(custedit15) then
         cl:=stringdelim(custedit15+extractfilename(s))
      else
         cl:=stringdelim(custedit15)+' '+stringdelim(s);
   16: if isawebservice(custedit16) then
         cl:=stringdelim(custedit16+extractfilename(s))
      else
         cl:=stringdelim(custedit16)+' '+stringdelim(s);
   end;
{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
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
P:=tprocessutf8.Create(nil);
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(s)+advedit1after;
   2: cl:=advedit2before+stringdelim(s)+advedit2after;
   3: cl:=advedit3before+stringdelim(s)+advedit3after;
   4: cl:=advedit4before+stringdelim(s)+advedit4after;
   5: cl:=advedit5before+stringdelim(s)+advedit5after;
   6: cl:=advedit6before+stringdelim(s)+advedit6after;
   7: cl:=advedit7before+stringdelim(s)+advedit7after;
   8: cl:=advedit8before+stringdelim(s)+advedit8after;
   end;
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
except
   pMessageWarningOK(txt_2_5_cannotrun+' '+(cl));
end;
end;

procedure TForm_peach.aowcustom1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(1, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(1, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom10Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(2, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(2, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.abc1Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc1.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc2Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc2.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc3Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc3.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc4Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc4.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc5Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc5.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc6Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc6.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc7Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc7.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.abc8Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abc8.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.aowcustom11Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(3, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(3, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom12Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(4, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(4, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom13Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(5, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(5, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom14Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(6, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(6, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom15Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(7, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(7, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom16Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(8, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(8, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(2, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(2, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(3, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(3, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(4, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(4, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(5, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(5, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(6, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(6, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(7, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(7, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(8, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(8, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom9Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_advcustedit(1, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_advcustedit(1, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_10Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(10, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(10, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_11Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(11, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(11, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_12Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(12, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(12, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_13Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(13, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(13, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_14Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(14, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(14, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_15Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(15, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(15, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_16Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(16, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(16, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.aowcustom_9Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount>1 then open_custedit(9, StringGrid1.Cells[8,StringGrid1.Row])
   else
else
   if StringGrid2.Rowcount>1 then open_custedit(9, StringGrid2.Cells[8,StringGrid2.Row]);
end;

procedure TForm_peach.baboutbinClick(Sender: TObject);
begin
internalbincheck;
end;

procedure checkdom(var dom,s:ansistring);
{$IFDEF MSWINDOWS}var http1: variant;{$ENDIF}
begin
dom:=FIRSTDOM;
s:='';
{
{$IFDEF MSWINDOWS}
try
http1:=createoleobject('WinHttp.WinHttpRequest.5.1');
http1.open('GET', FIRSTDOM+'autoupdate.txt', false);
http1.send;
s:=http1.responsetext;
if length(s)<>5 then
begin
dom:=SECONDDOM;
http1:=createoleobject('WinHttp.WinHttpRequest.5.1');
http1.open('GET', SECONDDOM+'autoupdate.txt', false);
http1.send;
s:=http1.responsetext;
end;
except
end;
{$ENDIF}
}
end;

procedure TForm_peach.baboutchangelogClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'changelog.html',desk_env);
end;

procedure TForm_peach.baboutfaqClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help-faq.html',desk_env);
end;

procedure TForm_peach.baboutlocalhelpClick(Sender: TObject);
begin
cp_open(sharepath+'peazip_help.pdf',desk_env);
end;

procedure TForm_peach.baboutplugindirClick(Sender: TObject);
begin
cp_open(binpath,desk_env);
end;

procedure checkupdates;
var
   dom,s:ansistring;
   sint,pver:integer;
begin
showpanel('defaults');
clicklabel_options(Form_peach.LabelTitleOptions8, Form_peach.BevelTitleOptions8);
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(Form_peach.LabelTitleOptions8, Form_peach.BevelTitleOptions8);
checkdom(dom,s);
cp_open(dom+'peazip-add-ons.html',desk_env);
end;

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

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

procedure TForm_peach.baboutthemesClick(Sender: TObject);
begin
checkthemes;
end;

procedure TForm_peach.baboutpluginsClick(Sender: TObject);
begin
checkplugins;
end;

procedure TForm_peach.baboutremoveunaceClick(Sender: TObject);
var
   s:ansistring;
begin
s:=binpath+'unace'+DirectorySeparator;
cleardirsimple(s);
updatepluginstatus;
end;

procedure TForm_peach.baboutremoveunrarClick(Sender: TObject);
var
   s:ansistring;
begin
s:=binpath+'unrar'+DirectorySeparator;
cleardirsimple(s);
updatepluginstatus;
end;

procedure TForm_peach.baboutsupportClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help.html',desk_env);
end;

procedure TForm_peach.babouttosClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-tos-privacy.html',desk_env);
end;

procedure TForm_peach.babouttrackerClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-more.html',desk_env);
end;

procedure TForm_peach.babouttranslationsClick(Sender: TObject);
begin
checktranslations;
end;

procedure TForm_peach.baboutupClick(Sender: TObject);
begin
checkupdates;
end;

procedure TForm_peach.baboutwebClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'index.html',desk_env);
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 Form_peach do
begin
s:='schtasks /create /f';
//task name
if stype=0 then iname:=schedaddname.Caption
else iname:=schedaddname1.Caption;
s:=s+' /tn "PeaZip\'+iname+'"';
//scheduling
if stype=0 then isched:=schedaddschedule.ItemIndex
else isched:=schedaddschedule1.ItemIndex;
if stype=0 then ispinedit:=scheduleNN
else ispinedit:=scheduleNN1;
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:=CheckGroupW1;
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:=CheckGroupM2;
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:=ComboBoxM3;
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:=schedulehh1; ispinmm:=schedulemm1; 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 scheduleuser1.checked=true then
      if editscheduleuser1.Caption<>'' then
         begin
         s:=s+' /ru "'+editscheduleuser1.Caption+'"';
         if editschedulepassword1.Caption<>'' then s:=s+' /rp "'+editschedulepassword1.Caption+'"';
      end;
   end;
//define task
try
if stype=0 then
   begin
   mconsolecreate.Clear;
   if importjobcl(cl,jobcode,outname)<>1 then exit;
   end
else
   begin
   mconsolecreate1.Clear;
   if importjobcl_extract(cl,jobcode,outname)<>1 then exit;
   end;
if not(directoryexists(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 mconsolecreate1.Clear;
except
pMessageErrorOK(txt_5_1_schederr+char($0D)+char($0A)+s);
exit;
end;
//submit ScheduleAdd
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
cl:=s;
P.CommandLine:=cl;
P.Execute;
pMessageInfoOK(txt_5_1_schedok+char($0D)+char($0A)+s);
end;
{$ENDIF}
end;

procedure TForm_peach.BSchedule1Click(Sender: TObject);
begin
schedule_create(1);
end;

procedure TForm_peach.BScheduleClick(Sender: TObject);
begin
schedule_create(0);
end;

procedure TForm_peach.Button2Click(Sender: TObject);
begin
updateconf_modified;
set_custedit_fromtable;
set_custedit_menus;
save_custedit;
setspecialextensions;
activelabel_options:=LabelTitleOptions1;
clicklabel_options(LabelTitleoptions1,BevelTitleoptions1);
showpanel(prevpanel);
Caption:=prevcaption;
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];
Form_peach.OpenDialogArchive.Filename:=Form_peach.EditOpenIn.Text;
Form_peach.ListView1.beginupdate;
open_inputselect;
Form_peach.ListView1.endupdate;
Form_peach.EditUn7zaFilter1.Caption:=carcpath+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure tobrowser_fromarchiver;
begin
clearlist;
using_tarbefore:=false;
Form_peach.EditName3.Text:='';
Form_peach.Edit4.Text:='';
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
Form_peach.OpenDialogArchive.Filename:=Form_peach.EditOpenIn.Text;
showpanel('open');
case upcase(ExtractFileExt(Form_peach.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.EditUn7zaPW.Text:='';
      FormPW.EditUn7zaPW1.Text:='';
      FormPW.EditName3.Text:='';
      setpwicons;
      end;
   end;
end;

procedure tobrowser_fromextractor;
begin
clearlist_ext;
Form_peach.CheckBoxSameExt.State:=cbUnchecked; //consistently as similar switch is treated for archiving
on_checkboxsameextclick;
Form_peach.OpenDialogArchive.Filename:=Form_peach.EditOpenIn.Text;
showpanel('open');
if fun='FILEBROWSER' then
   begin
   open_inputselect; //on extraction refresh only if browsing filesystem
   if keeppw=0 then
      begin
      FormPW.EditUn7zaPW.Text:='';
      FormPW.EditUn7zaPW1.Text:='';
      FormPW.EditName3.Text:='';
      setpwicons;
      end;
   end;
end;

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

procedure TForm_peach.ButtonArchive1Click(Sender: TObject);
begin
if goarchiving=true then exit;
goarchiving:=true;
endmultimode;
gocancelarchive;
goarchiving:=false;
end;

procedure TForm_peach.ButtonDupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TForm_peach.ButtonEditName12Click(Sender: TObject);
var
   p:TPoint;
begin
p.x:=GroupBoxCreateOut.Left+ButtonEditName12.Left;
p.y:=Options.top+GroupBoxCreateOut.Top+ButtonEditName12.top+ButtonEditName12.Height+PanelTitleExtract.Height;
p:=clienttoscreen(p);
setrecenticons_extract_archive;
mpathreset1.Caption:=txt_lastused+' '+lastoutpath;
popupmenupath1.PopUp(p.x,p.y);
populatepcmenu;
end;

procedure TForm_peach.ButtonEditName13Click(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ButtonEditName13.Left;
p.y:=ButtonEditName13.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 TForm_peach.CheckBoxARC2Click(Sender: TObject);
begin
on_CheckBoxARC2Click;
end;

procedure TForm_peach.CheckBoxAutoOpenClick(Sender: TObject);
begin
on_CheckBoxAutoOpenClick;
end;

procedure TForm_peach.CheckBoxEncodingClick(Sender: TObject);
begin
on_CheckBoxEncodingClick;
end;

procedure TForm_peach.CheckBoxFolderClick(Sender: TObject);
begin
on_CheckBoxFolderClick;
end;

procedure TForm_peach.CheckBoxJobEncodingClick(Sender: TObject);
begin
on_CheckBoxJobEncodingClick;
end;

procedure TForm_peach.CheckBoxParallelArchivingClick(Sender: TObject);
begin
on_CheckBoxParallelArchivingClick;
end;

procedure on_checkboxseparateclick;
var
   s:ansistring;
begin
if form_peach.CheckBoxSeparate.State=cbChecked then
   begin
   form_peach.Edit4.Enabled:=false;
   form_peach.Edit5.ReadOnly:=true;
   end
else
   begin
   form_peach.Edit4.Enabled:=true;
   form_peach.Edit5.ReadOnly:=false;
   suggest_outname(s,Form_peach.cbType.Text,Form_peach.StringGrid1.Row);
   form_peach.Edit4.Text:=extractfilename(s);
   form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
   end;
end;

procedure TForm_peach.CheckBoxSeparateClick(Sender: TObject);
begin
on_checkboxseparateclick;
end;

procedure TForm_peach.CheckBoxAltgridcolClick(Sender: TObject);
begin
if CheckBoxAltgridcol.State=cbChecked then usealtcolor:=1 else usealtcolor:=0;
setgridaltcolor;
end;

procedure TForm_peach.CheckBoxzcopyClick(Sender: TObject);
begin
on_CheckBoxzcopyClick;
end;

procedure TForm_peach.CheckBoxzipxswitchClick(Sender: TObject);
begin
if Form_peach.CheckBoxzipxswitch.State=cbChecked then swzipx:=1 else swzipx:=0;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.CheckBoxzpaqforceClick(Sender: TObject);
begin
if CheckBoxzpaqforce.Checked=true then zpaqforce:=1 else zpaqforce:=0;
end;

procedure TForm_peach.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 TForm_peach.CheckBoxZstdClick(Sender: TObject);
begin
CheckBoxZstd_onClick;
end;

procedure checkmsched;
begin
with form_peach 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 checkmsched1;
begin
with form_peach do
begin
if (CheckGroupM2.Checked[0]=false) and
   (CheckGroupM2.Checked[1]=false) and
   (CheckGroupM2.Checked[2]=false) and
   (CheckGroupM2.Checked[3]=false) and
   (CheckGroupM2.Checked[4]=false) and
   (CheckGroupM2.Checked[5]=false) and
   (CheckGroupM2.Checked[6]=false) and
   (CheckGroupM2.Checked[7]=false) and
   (CheckGroupM2.Checked[8]=false) and
   (CheckGroupM2.Checked[9]=false) and
   (CheckGroupM2.Checked[10]=false) and
   (CheckGroupM2.Checked[11]=false)
   then Bschedule.Enabled:=false
else Bschedule.Enabled:=true;
end;
end;

procedure TForm_peach.CheckGroupM1ItemClick(Sender: TObject; Index: integer);
begin
checkmsched;
end;

procedure TForm_peach.CheckGroupM2ItemClick(Sender: TObject; Index: integer);
begin
checkmsched1;
end;

procedure checkwsched;
begin
with form_peach 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 checkwsched1;
begin
with form_peach do
begin
if (CheckGroupW1.Checked[0]=false) and
   (CheckGroupW1.Checked[1]=false) and
   (CheckGroupW1.Checked[2]=false) and
   (CheckGroupW1.Checked[3]=false) and
   (CheckGroupW1.Checked[4]=false) and
   (CheckGroupW1.Checked[5]=false) and
   (CheckGroupW1.Checked[6]=false)
   then Bschedule1.Enabled:=false
else Bschedule1.Enabled:=true;
end;
end;

procedure TForm_peach.CheckGroupWItemClick(Sender: TObject; Index: integer);
begin
checkwsched;
end;

procedure TForm_peach.ColorButton2ColorChanged(Sender: TObject);
begin
color2:=ColorToString(ColorButton2.ButtonColor);
if openstarted=true then apply_theme;
end;

procedure TForm_peach.ColorButton3ColorChanged(Sender: TObject);
begin
color3:=ColorToString(ColorButton3.ButtonColor);
if openstarted=true then apply_theme;
end;

procedure TForm_peach.CheckGroupW1ItemClick(Sender: TObject; Index: integer);
begin
checkwsched1;
end;

procedure TForm_peach.ComboBox1Change(Sender: TObject);
begin
on_ComboBox1Change;
end;

procedure TForm_peach.ComboBoxArchive2Change(Sender: TObject);
begin
spanunit:=ComboBoxArchive2.ItemIndex;
end;

procedure TForm_peach.ComboBoxArchive3CloseUp(Sender: TObject);
begin
ComboBoxArchive3_onchange;
end;

procedure TForm_peach.ComboBoxArchive4CloseUp(Sender: TObject);
begin
ComboBoxArchive4_onchange;
end;

procedure TForm_peach.ComboBoxBrowserChange(Sender: TObject);
begin
on_CheckBoxPrebrowse_click;
end;

procedure TForm_peach.ComboBoxDragChange(Sender: TObject);
begin
on_CheckBoxDrag_click;
end;

procedure TForm_peach.ComboBoxKiBChange(Sender: TObject);
begin
on_ComboBoxKiBChange;
end;

procedure TForm_peach.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 TForm_peach.ComboBoxMaxArgChange(Sender: TObject);
begin
on_CheckBoxmaxarg_click;
end;

procedure TForm_peach.ComboBoxmemuseChange(Sender: TObject);
begin
on_ComboBoxmemuseChange;
end;

procedure TForm_peach.ComboBoxPriorityChange(Sender: TObject);
begin
on_comboboxprioritychange;
end;

procedure TForm_peach.ComboBoxSyntaxLevelChange(Sender: TObject);
begin
on_ComboBoxSyntaxLevelChange;
end;

procedure TForm_peach.ComboBoxTAR1Change(Sender: TObject);
begin
tartime:=ComboBoxTAR1.ItemIndex;
end;

procedure TForm_peach.ComboBoxTARChange(Sender: TObject);
begin
tartype:=ComboBoxTAR.ItemIndex;
end;

procedure TForm_peach.ComboBoxWDChange(Sender: TObject);
begin
if pMessageInfoYesNo(txt_8_3_cw)=7 then begin Form_peach.ComboBoxWD.ItemIndex:=vopt12; exit; end;
reset_temp(1);
on_ComboBoxWDChange;
if work_dir=3 then
   if Form_peach.SelectDirectoryDialog1.Execute then
      if Form_peach.SelectDirectoryDialog1.FileName<>'' then
         begin
         custom_work_path:=Form_peach.SelectDirectoryDialog1.FileName;
         Form_peach.Labelcwd.Caption:=custom_work_path;
         end
      else
         begin
         if custom_work_path='' then
            begin
            work_dir:=2;
            Form_peach.ComboBoxWD.ItemIndex:=2;
            custom_work_path:='';
            Form_peach.Labelcwd.Caption:='';
            end
         end
   else
      begin
      if custom_work_path='' then
         begin
         work_dir:=2;
         Form_peach.ComboBoxWD.ItemIndex:=2;
         custom_work_path:='';
         Form_peach.Labelcwd.Caption:='';
         end
      end
else
   begin
   custom_work_path:='';
   Form_peach.Labelcwd.Caption:='';
   end;
saverestartclosepeaapp;
end;

procedure TForm_peach.ComboBoxARC2Change(Sender: TObject);
begin
on_ComboBoxARC2Change;
end;

procedure on_ComboBoxArchive7Change;
begin
if (Form_peach.CheckBoxArchive6.State=cbChecked) then
   getarccaption(txt_sfx+' '+STR_7Z)
else
   getarccaption(STR_7Z);
end;

procedure TForm_peach.ComboBoxArchive7Change(Sender: TObject);
begin
ComboBoxArchiveAct.ItemIndex:=ComboBoxArchive7.ItemIndex;
ComboBoxArchiveAct1.ItemIndex:=ComboBoxArchive7.ItemIndex;
on_ComboBoxArchive7Change;
end;

procedure TForm_peach.ComboBoxArchive8Change(Sender: TObject);
begin
on_ComboBoxArchive8Change;
end;

procedure on_ComboBoxArchive9Change;
begin
case fun of
   'ARC':
   begin
   Form_peach.ComboBoxARC.ItemIndex:=Form_peach.ComboBoxArchive9.ItemIndex;
   on_ComboBoxARCChange;
   end;
   '7Z':
   begin
   Form_peach.ComboBoxArchive4.ItemIndex:=Form_peach.ComboBoxArchive9.ItemIndex;
   ComboBoxArchive4_onchange;
   end;
   'BROTLI': level_brotli:=Form_peach.ComboBoxArchive9.ItemIndex;
   'ZSTD': level_zstd:=Form_peach.ComboBoxArchive9.ItemIndex;
end;
if (fun='CUSTOM') and (havewinrar=true) and (userar=1) then level_rar:=Form_peach.ComboBoxArchive9.ItemIndex;
end;

procedure TForm_peach.ComboBoxArchive9CloseUp(Sender: TObject);
begin
on_ComboBoxArchive9Change;
end;

procedure TForm_peach.ComboBoxArchiveAct1Change(Sender: TObject);
begin
ComboBoxArchive7.ItemIndex:=ComboBoxArchiveAct1.ItemIndex;
ComboBoxArchiveAct.ItemIndex:=ComboBoxArchiveAct1.ItemIndex;
on_ComboBoxArchive7Change;
end;

procedure TForm_peach.ComboBoxArchiveActChange(Sender: TObject);
begin
ComboBoxArchive7.ItemIndex:=ComboBoxArchiveAct.ItemIndex;
ComboBoxArchiveAct1.ItemIndex:=ComboBoxArchiveAct.ItemIndex;
on_ComboBoxArchive7Change;
end;

procedure TForm_peach.ctrlhistoryClick(Sender: TObject);
var p:tpoint;
begin
if browserbusy=true then exit;
p.x:=ctrlhistory.left;
p.y:=EditopenIn.top+EditopenIn.height+PanelBarOpen.height;
p:=clienttoscreen(p);
pmbreadcrumb.PopUp(p.x,p.y);
end;

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

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

procedure prepare_breadcrumbarchive(branode:integer);
var
   saddr,saddr2:ansistring;
   i:integer;
begin
inbcnode:=branode;
Form_peach.pmbcd1.visible:=false;
Form_peach.pmbcd2.visible:=false;
Form_peach.pmbcd3.visible:=false;
Form_peach.pmbcd4.visible:=false;
Form_peach.pmbcd5.visible:=false;
Form_peach.pmbcd6.visible:=false;
Form_peach.pmbcd7.visible:=false;
Form_peach.pmbcd8.visible:=false;
Form_peach.pmbcd9.visible:=false;
Form_peach.pmbcd10.visible:=false;
Form_peach.pmbcd11.visible:=false;
Form_peach.pmbcd12.visible:=false;
Form_peach.pmbcd13.visible:=false;
Form_peach.pmbcd14.visible:=false;
Form_peach.pmbcd15.visible:=false;
Form_peach.pmbcd16.visible:=false;
Form_peach.pmbcd17.visible:=false;
Form_peach.pmbcd18.visible:=false;
Form_peach.pmbcd19.visible:=false;
Form_peach.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 Form_peach.StringGridAddress1.RowCount-1 do
  begin
  if (pos(saddr,Form_Peach.StringGridAddress1.Cells[12,i])=1) or (saddr='') then
     if not(MatchesMask(Form_Peach.StringGridAddress1.Cells[12,i],saddr2,false)) then
        begin
        if Form_peach.pmbcd1.visible=false then
           begin
           Form_peach.pmbcd1.visible:=true;
           Form_peach.pmbcd1.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd1.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd2.visible=false then
           begin
           Form_peach.pmbcd2.visible:=true;
           Form_peach.pmbcd2.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd2.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd3.visible=false then
           begin
           Form_peach.pmbcd3.visible:=true;
           Form_peach.pmbcd3.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd3.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd4.visible=false then
           begin
           Form_peach.pmbcd4.visible:=true;
           Form_peach.pmbcd4.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd4.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd5.visible=false then
           begin
           Form_peach.pmbcd5.visible:=true;
           Form_peach.pmbcd5.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd5.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd6.visible=false then
           begin
           Form_peach.pmbcd6.visible:=true;
           Form_peach.pmbcd6.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd6.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd7.visible=false then
           begin
           Form_peach.pmbcd7.visible:=true;
           Form_peach.pmbcd7.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd7.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd8.visible=false then
           begin
           Form_peach.pmbcd8.visible:=true;
           Form_peach.pmbcd8.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd8.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd9.visible=false then
           begin
           Form_peach.pmbcd9.visible:=true;
           Form_peach.pmbcd9.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd9.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd10.visible=false then
           begin
           Form_peach.pmbcd10.visible:=true;
           Form_peach.pmbcd10.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd10.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd11.visible=false then
           begin
           Form_peach.pmbcd11.visible:=true;
           Form_peach.pmbcd11.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd11.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd12.visible=false then
           begin
           Form_peach.pmbcd12.visible:=true;
           Form_peach.pmbcd12.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd12.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd13.visible=false then
           begin
           Form_peach.pmbcd13.visible:=true;
           Form_peach.pmbcd13.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd13.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd14.visible=false then
           begin
           Form_peach.pmbcd14.visible:=true;
           Form_peach.pmbcd14.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd14.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd15.visible=false then
           begin
           Form_peach.pmbcd15.visible:=true;
           Form_peach.pmbcd15.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd15.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd16.visible=false then
           begin
           Form_peach.pmbcd16.visible:=true;
           Form_peach.pmbcd16.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd16.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd17.visible=false then
           begin
           Form_peach.pmbcd17.visible:=true;
           Form_peach.pmbcd17.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd17.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd18.visible=false then
           begin
           Form_peach.pmbcd18.visible:=true;
           Form_peach.pmbcd18.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd18.bitmap:=BFolder;
           end
        else
        if Form_peach.pmbcd19.visible=false then
           begin
           Form_peach.pmbcd19.visible:=true;
           Form_peach.pmbcd19.caption:=dirextractfilename(Form_peach.StringGridAddress1.Cells[12,i]);
           Form_peach.pmbcd19.bitmap:=BFolder;
           end
        else Form_peach.pmbcd0.visible:=true;
        end;
  end;
Form_peach.pmbcspacer.visible:=false;
Form_peach.pmquickdesk.visible:=false;
Form_peach.pmquickdownloads.visible:=false;
Form_peach.pmquickhome.visible:=false;
Form_peach.pmquickop.visible:=false;
Form_peach.pmquickoa.visible:=false;
Form_peach.pmquicksd.visible:=false;
end;

procedure TForm_peach.DateEdit1Change(Sender: TObject);
begin
if DateEdit2.Date<DateEdit1.Date then DateEdit2.Date:=DateEdit1.Date;
end;

procedure TForm_peach.DateEdit2Change(Sender: TObject);
begin
if DateEdit2.Date<DateEdit1.Date then DateEdit2.Date:=DateEdit1.Date;
end;

procedure TForm_peach.DateEdit3Change(Sender: TObject);
begin
if DateEdit4.Date<DateEdit3.Date then DateEdit4.Date:=DateEdit3.Date;
end;

procedure TForm_peach.DateEdit4Change(Sender: TObject);
begin
if DateEdit4.Date<DateEdit3.Date then DateEdit4.Date:=DateEdit3.Date;
end;

procedure TForm_peach.Edit5Change(Sender: TObject);
var
   s,sext:ansistring;
begin
checkoutpath_archive;
if Form_peach.Edit5.Text<>Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text) then
   begin
   s:=Edit5.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;
   EditName3.Text:=extractfilepath(s);
   if checkboxseparate.state=cbUnchecked then Edit4.Text:=extractfilename(s);
   end;
get_statuss(Form_peach.Edit5.Text);
Form_peach.labelstatusAr.Visible:=false;
Form_peach.labelstatusAr.Caption:=txt_3_1_workingdir+' '+Form_peach.ComboBoxWD.Caption+' '+Form_peach.Labelcwd.Caption;
end;

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

procedure TForm_peach.EditOpenIn1Exit(Sender: TObject);
begin
exit_fromaddress(0);
end;

procedure opendir(s:ansistring);
begin
fun:='FILEBROWSER';
fun_status:=fun;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
Form_peach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure browsefiledir(s:ansistring);
var
   s1:ansistring;
begin
if browserbusy=true then exit;
Form_peach.EditOpenIn1.Text:=s;
Form_peach.EditOpenIn.Text:=Form_peach.EditOpenIn1.Text;
Form_peach.EditUn7zaFilter.Text:='*';
{$IFDEF MSWINDOWS}
if Form_peach.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 directoryexists(Form_peach.EditOpenIn.Text) then
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   listdir(Form_peach.EditOpenIn.Text,false,false);
   addtohistory;
   end
else open_archive_fromname(s1);
end;

procedure TForm_peach.abc0Click(Sender: TObject);
begin
browsefiledir(form_peach.EditOpenIn1.Text);
end;

procedure filter_listaddress;
var
   i,rc:integer;
   cancontinue:boolean;
begin
if Form_peach.EditOpenIn1.Text=Form_peach.EditOpenIn.Text then exit;
rc:=Form_peach.StringGridAddress.Rowcount;
if rc<=1 then exit;
updatinglistview:=true;
Form_Peach.ImageListSearch1.visible:=true;
Form_Peach.Imagelistsearch1.Hint:=txt_reset;
Form_Peach.ListView1.Items.BeginUpdate;
Form_Peach.StringGridList.BeginUpdate;
{$IFDEF DARWIN}Form_peach.ListView1.Cursor:=crDefault;{$ELSE}Form_peach.ListView1.Cursor:=crHourglass;{$ENDIF}

cancontinue:=false;
if length(Form_peach.EditOpenIn1.Text)=1 then
   if prevlistfilter='' then cancontinue:=true;
if length(Form_peach.EditOpenIn1.Text)>1 then
   if (prevlistfilter=copy(Form_peach.EditOpenIn1.Text,1,length(Form_peach.EditOpenIn1.Text)-1))
      or (prevlistfilter=Form_peach.EditOpenIn1.Text) then
      cancontinue:=true;//filter current data

if cancontinue=false then //re-generate data
   begin
   Form_Peach.ListView1.Clear;
   for i:=0 to Form_Peach.ListAddress.Items.Count-1 do Form_Peach.ListView1.Items.Add.Assign(Form_Peach.ListAddress.Items[i]);
   Form_Peach.StringGridList.Clear;
   Form_Peach.StringGridList.RowCount:=rc;
   for i:=0 to rc-1 do Form_Peach.StringGridList.Rows[i].Assign(Form_Peach.StringGridAddress.Rows[i]);
   if Form_peach.EditOpenIn1.Text='' then
      begin
      Form_Peach.ListView1.Cursor:=crDefault;
      Form_Peach.ListView1.Items.EndUpdate;
      Form_Peach.StringGridList.EndUpdate;
      prevlistfilter:=Form_peach.EditOpenIn1.Text;
      updatinglistview:=false;
      exit;
      end;
   end;

i:=0;
while i<=(Form_Peach.ListView1.Items.Count-1) do
   begin
   if MatchesMask(Form_Peach.ListView1.Items[i].Caption,'*'+Form_peach.EditOpenIn1.Text+'*',false) then i:=i+1
   else
      begin
      Form_Peach.ListView1.Items[i].Delete;
      Form_Peach.StringGridList.DeleteRow(i+1);
      end;
   end;

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

Form_Peach.ListView1.Cursor:=crDefault;
Form_Peach.ListView1.Items.EndUpdate;
Form_Peach.StringGridList.EndUpdate;
prevlistfilter:=Form_peach.EditOpenIn1.Text;
updatinglistview:=false;
end;

procedure TForm_peach.EditOpenIn1KeyPress(Sender: TObject; var Key: char);
begin
if Key=char(13) then browsefiledir(Form_peach.EditOpenIn1.Text);
if Key=char(27) then exit_fromaddress(1);
end;

procedure TForm_peach.EditOpenIn1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
filter_listaddress;
end;

procedure TForm_peach.EditOpenInChange(Sender: TObject);
begin
EditOpenIn1.Text:=EditOpenIn.Text;
end;

procedure TForm_peach.EditOpenOutChange(Sender: TObject);
begin
checkoutpath_extract;
end;

procedure addtosearchhistory;
var
   sa: array[0..8] of ansistring;
   i,j:integer;
begin
with Form_peach do
begin
sa[0]:=EditUn7zaFilter1.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
   Form_peach.EditUn7zaFilterExclude.Text:=extractfilepath(Form_peach.EditUn7zaFilter.Text)+'*'+directoryseparator+'*';
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   is_searching:=true;
   filter_archivecontent;
   addtohistory;
   addtosearchhistory;
   end;
if fun='FILEBROWSER' then
   begin
   listdir(Form_peach.EditOpenIn.Text,false,false);
   addtohistory;
   addtosearchhistory;
   end;
end;

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

function pInputQuery ( const FCaption, FPrompt, Fwarning : ansistring; var UserValue : ansistring; chkb:boolean ) : Boolean;
var
   cbflag,i:integer;
begin
pInputQuery:=false;
unit6.tsstyle:=tsstyle;
unit6.dirn:=Form_peach.EditOpenIn.Text;
unit6.instr:=UserValue;
FormInput.CheckBox1.Caption:=txt_2_9_rec;
FormInput.BitBtn1.Caption:=txt_reset;
FormInput.Labelrenamereset.Caption:=txt_reset;
FormInput.BitBtn2.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.OpenDialog3.Title:=txt_open_file;
FormInput.buttonpanel1.OKButton.Glyph:=Btestall;
FormInput.buttonpanel1.CancelButton.Glyph:=Bstop;
FormInput.buttonpanel1.OKButton.Caption:=txt_2_7_ok;
FormInput.buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
FormInput.CheckBox1.Visible:=chkb;
FormInput.BitBtn1.Visible:=chkb;
if FCaption=txt_3_3_run then FormInput.BitBtn2.Visible:=true else FormInput.BitBtn2.Visible:=false;
if FCaption=txt_rename then
   begin
   FormInput.LabelLow.Visible:=true;
   FormInput.Labelspac2.Visible:=true;
   FormInput.LabelUp.Visible:=true;
   FormInput.Labelspac4.Visible:=true;
   FormInput.LabelTimestamp.Visible:=true;
   FormInput.Labelappdirn.Visible:=true;
   FormInput.Labelspac3.Visible:=true;
   FormInput.Labelprepdirn.Visible:=true;
   FormInput.Labelrenamereset.Visible:=true;
   end
else
   begin
   FormInput.LabelLow.Visible:=false;
   FormInput.Labelspac2.Visible:=false;
   FormInput.LabelUp.Visible:=false;
   FormInput.Labelspac4.Visible:=false;
   FormInput.LabelTimestamp.Visible:=false;
   FormInput.Labelappdirn.Visible:=false;
   FormInput.Labelspac3.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;
if (FCaption=txt_searchfor) or (FCaption=txt_searchfor+'...') then
   begin
   if Form_peach.pmshist1.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist1.Caption);
   if Form_peach.pmshist2.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist2.Caption);
   if Form_peach.pmshist3.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist3.Caption);
   if Form_peach.pmshist4.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist4.Caption);
   if Form_peach.pmshist5.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist5.Caption);
   if Form_peach.pmshist6.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist6.Caption);
   if Form_peach.pmshist7.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist7.Caption);
   if Form_peach.pmshist8.visible=true then FormInput.Editinputquery.Items.Add(Form_peach.pmshist8.Caption);
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
       FormInput.Editinputquery.Items.Add(Form_peach.StringGridList.Cells[1,i]);
   try FormInput.EditInputQuery.SetFocus; except end;
   end;

FormInput.editinputquery.hint:=FPrompt;
FormInput.EditInputQuery.Text:=UserValue;
FormInput.Labelwarning.caption:=FWarning;
if FormInput.CheckBox1.state=cbchecked then cbflag:=1 else cbflag:=0;
FormInput.Showmodal;
case FormInput.ModalResult of
   mrOk:
      begin
      UserValue:=FormInput.EditInputQuery.Text;
      pInputQuery:=true;
      end;
   mrCancel:
      begin
      UserValue:='';
      if cbflag=1 then FormInput.CheckBox1.state:=cbchecked else FormInput.CheckBox1.state:=cbunchecked;
      end;
   mrAbort:
      begin
      Form_peach.EditUn7zaFilter.Text:='*';
      Form_peach.EditUn7zaFilter1.Text:='*';
      UserValue:='';
      FormInput.CheckBox1.state:=cbchecked;
      resetsearch;
      end;
   end;
end;

procedure kp_EditUn7zaFilter1;
begin
Form_peach.EditUn7zaFilter.Text:=Form_peach.EditUn7zaFilter1.Text;
if FormInput.CheckBox1.State=cbChecked then rsearch
else nrsearch;
Form_Peach.ImageListSearch1.visible:=true;
end;

procedure kp_EditUn7zaFilter1_nr;
begin
Form_peach.EditUn7zaFilter.Text:=Form_peach.EditUn7zaFilter1.Text;
nrsearch;
end;

procedure TForm_peach.EditUn7zaFilter1KeyPress(Sender: TObject; var Key: char);
begin
if Key=char(13) then
   begin
   kp_EditUn7zaFilter1;
   end;
end;

procedure TForm_peach.EditUn7zaFilterChange(Sender: TObject);
begin
EditUn7zaFilter1.Text:=EditUn7zaFilter.Text;
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
   begin
   testencrypted:=0;
   exit;
   end;
if seemencrypted=true then
   if (FormPW.Editun7zaPW.Text='') and (FormPW.EditName3.Text='') then
      begin
      s:=FormPW.Caption;
      FormPW.Caption:=extractfilename(form_peach.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
testencrypted_open:=-1;
if Form_peach.StringGridList.RowCount<2 then exit;
if (fun<>'UNARC') and
   (fun<>'UN7Z') and
   (fun<>'UNZPAQ') then exit;
if isencsupported(Form_peach.EditOpenIn.Caption) = false then exit;
if lowercase(extractfileext(Form_peach.EditOpenIn.Caption))='.7z' then
   begin
   srcfilesize_multipart(Form_peach.EditOpenIn.Caption,sz);
   if sz<33 then exit;//empty 7z file
   end;
if (lowercase(extractfileext(Form_peach.EditOpenIn.Caption))='.zip') or (lowercase(extractfileext(Form_peach.EditOpenIn.Caption))='.zipx') then
   begin
   srcfilesize_multipart(Form_peach.EditOpenIn.Caption,sz);
   if sz<23 then exit;//empty zip file
   end;

if archive_content=txt_list_nomatch+txt_2_7_list_tryflatorpw then
   if isenctype(Form_peach.EditOpenIn.Caption)=true then seemencrypted:=true; //archive types supporting header encryption

if (seemencrypted=false) then
   if testencrypted_fromname(Form_peach.EditOpenIn.Caption,'open')=1 then seemencrypted:=true; //encryption not detected by prebrowse with list_l

if seemencrypted=true then
   begin
   if check7zvolume(Form_peach.EditOpenIn.Caption)=true then
      begin
      pMessageErrorOK(txt_2_8_uniterror);
      listingdir:=false;
      jumpto('root');
      exit;
      end;
   if (FormPW.Editun7zaPW.Text='') and (FormPW.EditName3.Text='') then
      begin
      if (Form_peach.StringGridList.Rowcount>1) and (Form_peach.StringGridList.Cells[1,1]='') then
            begin
            s:=FormPW.Caption;
            if testtypeenc(form_peach.editopenin.caption)=true then exit;
            FormPW.Caption:=extractfilename(form_peach.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;
testencrypted_open:=0;
end;

procedure TForm_peach.eowcustom10Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',2);
end;

procedure TForm_peach.eowcustom11Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',3);
end;

procedure TForm_peach.eowcustom12Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',4);
end;

procedure TForm_peach.eowcustom13Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',5);
end;

procedure TForm_peach.eowcustom14Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',6);
end;

procedure TForm_peach.eowcustom15Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',7);
end;

procedure TForm_peach.eowcustom16Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',8);
end;

procedure TForm_peach.eowcustom1Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',1);
end;

procedure TForm_peach.eowcustom2Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',2);
end;

procedure TForm_peach.eowcustom3Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',3);
end;

procedure TForm_peach.eowcustom4Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',4);
end;

procedure TForm_peach.eowcustom5Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',5);
end;

procedure TForm_peach.eowcustom6Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',6);
end;

procedure TForm_peach.eowcustom7Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',7);
end;

procedure TForm_peach.eowcustom8Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',8);
end;

procedure TForm_peach.eowcustom9Click(Sender: TObject);
begin
openwith_cust('extandrun','adv',1);
end;

procedure TForm_peach.eowcustom_10Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',10);
end;

procedure TForm_peach.eowcustom_11Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',11);
end;

procedure TForm_peach.eowcustom_12Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',12);
end;

procedure TForm_peach.eowcustom_13Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',13);
end;

procedure TForm_peach.eowcustom_14Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',14);
end;

procedure TForm_peach.eowcustom_15Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',15);
end;

procedure TForm_peach.eowcustom_16Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',16);
end;

procedure TForm_peach.eowcustom_9Click(Sender: TObject);
begin
openwith_cust('extandrun','cust',9);
end;

procedure TForm_peach.eowrunClick(Sender: TObject);
begin
openwith_cust('extandrun','run',0);
end;

procedure TForm_peach.extalllastClick(Sender: TObject);
begin
if (extractfilepath(pmqelast.Caption)<>'') then quickextract(lastextractionpath);
end;

procedure TForm_peach.fextallfav2Click(Sender: TObject);
begin
if (extractfilepath(pnb2.Caption)<>'') then quickextract(extractfilepath(pnb2.Caption));
end;

procedure TForm_peach.fextallfav3Click(Sender: TObject);
begin
if (extractfilepath(pnb3.Caption)<>'') then quickextract(extractfilepath(pnb3.Caption));
end;

procedure TForm_peach.fextallfav4Click(Sender: TObject);
begin
if (extractfilepath(pnb4.Caption)<>'') then quickextract(extractfilepath(pnb4.Caption));
end;

procedure TForm_peach.fextallfav5Click(Sender: TObject);
begin
if (extractfilepath(pnb5.Caption)<>'') then quickextract(extractfilepath(pnb5.Caption));
end;

procedure TForm_peach.fextallfav6Click(Sender: TObject);
begin
if (extractfilepath(pnb6.Caption)<>'') then quickextract(extractfilepath(pnb6.Caption));
end;

procedure TForm_peach.fextallfav7Click(Sender: TObject);
begin
if (extractfilepath(pnb7.Caption)<>'') then quickextract(extractfilepath(pnb7.Caption));
end;

procedure TForm_peach.fextallfav8Click(Sender: TObject);
begin
if (extractfilepath(pnb8.Caption)<>'') then quickextract(extractfilepath(pnb8.Caption));
end;

procedure TForm_peach.fextallfav1Click(Sender: TObject);
begin
if (extractfilepath(pnb1.Caption)<>'') then quickextract(extractfilepath(pnb1.Caption));
end;

procedure TForm_peach.fextalldefaultClick(Sender: TObject);
begin
if pmqedefault.visible=true then quickextract(defaultextractpath);
end;

function checkextinput:boolean;
var
   i,k,rc:integer;
   okfile:boolean;
begin
result:=false;
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
rc:=Form_peach.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 Form_peach.StringGridList.Cells[16,i]='1' then
      if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //no folders
         begin
         test_extfile(Form_peach.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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then exit;
rc:=Form_peach.StringGridList.RowCount;
if rc=1 then exit;
k:=0;
for i:=1 to rc-1 do
   if Form_peach.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 Form_peach.cbType.Text of
   STR_GZIP, STR_BZIP2, STR_XZ,STR_QUAD,STR_BROTLI,STR_ZSTD: result:=false;
   STR_ZPAQ: if Form_peach.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 Form_peach.StringGridList.Cells[16,i]='1' then
         if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then
            begin
            containfolder:=true;
            break;
            end;
if containfolder=false then result:=true;
end;

function checkextinput_noduplicatecheck:boolean;
var
   i,k,rc:integer;
   okfile:boolean;
begin
result:=false;
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
rc:=Form_peach.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 Form_peach.StringGridList.Cells[16,i]='1' then
      if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //no folders
         begin
         test_extfile_noduplicatecheck(Form_peach.StringGridList.Cells[12,i],okfile);
         if okfile=true then k:=k+1;
         end;
if k>0 then result:=true;
end;

procedure do_extallto;
var s:ansistring;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then
   {$IFDEF MSWINDOWS}if Form_peach.PanelExtract.visible=false{$ELSE}if Form_peach.PanelExtract.top<>0{$ENDIF} then exit;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then if checkextinput=false then exit;
if defaultextractpath='' then
   if length(Form_peach.EditOpenIn1.Caption)>1 then
      if Form_peach.EditOpenIn1.Caption[length(Form_peach.EditOpenIn1.Caption)] = directoryseparator then s:=Form_peach.EditOpenIn1.Caption
      else s:=extractfilepath(Form_peach.EditOpenIn1.Caption)
   else s:=local_desktop
else s:=defaultextractpath;
if not(directoryexists(s)) then s:=local_desktop;
Form_peach.SelectDirectoryDialog1.InitialDir:=s;
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 Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      lastoutpath:=Form_peach.SelectDirectoryDialog1.FileName;
      quickextract(Form_peach.SelectDirectoryDialog1.FileName);
      end
   else begin end
else begin end;
listingdir:=false;
end;

procedure TForm_peach.fextalltoClick(Sender: TObject);
begin
do_extallto;
end;

procedure TForm_peach.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
if needsave=true then on_exit;
completeshowpea:=false;
end;

procedure TForm_peach.FormResize(Sender: TObject);
begin
if Form_peach.Width <> 0 then
   if ShapeProgress.Visible=true then
      ShapeProgress.Width:=(Form_peach.Width*pperc) div 100;
if altbread=1 then setfontsbreadcrumb;
end;

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(directoryexists((t))) then //special folders with conventional name instead of path (documets etc)
            begin
            t:=home_path+'\'+t+'\';
            t:=(t);
            if not(directoryexists((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 Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then
         begin
         t_folders:=t_folders+1;
         if t_folders<4 then
            name_folder:=name_folder+Form_peach.StringGridList.Cells[1,i]+', ';
         end
      else
         begin
         t_files:=t_files+1;
         try s_files:=s_files+strtoqword(Form_peach.StringGridList.Cells[3,i]); except end;
         if t_files<4 then
            name_file:=name_file+Form_peach.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;

procedure TForm_peach.ImageInfoArchive3Click(Sender: TObject);
begin
pMessageInfoOK(ImageInfoArchive3.Hint);
end;

procedure TForm_peach.ImageInfoArchive4Click(Sender: TObject);
begin
pMessageInfoOK(ImageInfoArchive4.Hint);
end;

procedure TForm_peach.ImageInfoArchive5Click(Sender: TObject);
begin
pMessageInfoOK(ImageInfoArchive5.Hint);
end;

procedure TForm_peach.ImageInfoArchive6Click(Sender: TObject);
begin
pMessageInfoOK(ImageInfoArchive6.Hint);
end;

procedure TForm_peach.ImageInfoDefault1Click(Sender: TObject);
begin
pMessageInfoOK(txt_cl_hint);
end;

procedure TForm_peach.ImageInfoDefault2Click(Sender: TObject);
begin
pMessageInfoOK(txt_2_5_langhint);
end;

procedure TForm_peach.ImageListRootMouseEnter(Sender: TObject);
begin
  panel11.Color:=abactivecol;
  bctemp:=0;
end;

procedure TForm_peach.ImageListRootMouseLeave(Sender: TObject);
begin
  panel11.Color:=Panelclickaddress.Color;
end;

procedure do_resetsearch;
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilter1.Text:='*';
Form_peach.EditOpenIn1.Caption:=Form_peach.EditOpenIn.Caption;
Form_Peach.ImageListSearch1.visible:=false;
FormInput.CheckBox1.state:=cbchecked;
resetsearch;
end;

procedure TForm_peach.ImageListSearch1Click(Sender: TObject);
begin
do_resetsearch;
end;

procedure TForm_peach.ImageListSearch1MouseEnter(Sender: TObject);
begin
if ImageListSearch.Enabled=true then panel9.Color:=abactivecol;
end;

procedure TForm_peach.ImageListSearch1MouseLeave(Sender: TObject);
begin
panel9.Color:=Panelclickaddress.Color;
end;

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

procedure TForm_peach.ImageListSearchDblClick(Sender: TObject);
begin
if PanelSearch.Visible then setsearchbar(0)
else setsearchbar(1);
end;

procedure TForm_peach.ImageListSearchMouseEnter(Sender: TObject);
begin
if ImageListSearch.Enabled=true then panel8.Color:=abactivecol;
end;

procedure TForm_peach.ImageListSearchMouseLeave(Sender: TObject);
begin
if altbread=1 then
   Panel8.Color:=PanelListBar.Brush.Color
else
   panel8.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.Imageopenadvf1Click(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 TForm_peach.Imageopenadvf2Click(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 TForm_peach.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 TForm_peach.ImagePassword1Click(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
getarccaption(Form_peach.cbType.Text);
end;

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

procedure TForm_peach.Button1Click(Sender: TObject);
begin
restorestatus_defaults;
load_custedit;
showpanel(prevpanel);
Caption:=prevcaption;
end;

function getoname(var aname,oname:ansistring):integer;
var
   s,s1:ansistring;
   k:integer;
   out_created:boolean;
begin
getoname:=-1;
oname:=extractfilepath(aname);
if control_outpath(oname)<>0 then exit;
s1:=extractfilename(aname);
cutextension(s1);
s:=oname+s1;
k:=0;
out_created:=false;
repeat
   if not(directoryexists(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);
getoname:=0;
end;

procedure end_convert;
var
   i,rc,nsel:integer;
   oname,strsel:ansistring;
begin
if Form_peach.CheckBoxConvert.State=cbChecked then //remove directories created for conversion
   begin
   nsel:=0;
   strsel:='   ';
   rc:=Form_peach.StringGrid1.Rowcount;
   for i:=1 to rc-1 do
      begin
      case Form_peach.StringGrid1.Cells[7,i] of
         '+', '+++':
         begin
         nsel:=nsel+1;
         case nsel of
            1: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+char($0D)+char($0A)+'   ';
            2: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+char($0D)+char($0A)+'   ';
            3: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+char($0D)+char($0A)+'   ';
            4: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+char($0D)+char($0A)+'   ';
            5: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+char($0D)+char($0A)+'   ';
            6: strsel:=strsel+'...';
            end;
         end;
         end;
      end;
   if nsel=0 then exit;
   Form_peach.Enabled:=true;
   if form_peach.Visible=true then Form_peach.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;
   Form_peach.Enabled:=false;
   for i:=1 to rc-1 do
      begin
      oname:=Form_peach.StringGrid1.Cells[8,i];
      case Form_peach.StringGrid1.Cells[7,i] of
         '+' :
         begin
         oname:=extractfilepath(oname);
         cleardir(oname,false,false);
         end;
         '+++' :
         begin
         cleardir(oname,false,false);
         end;
         end;
      end;
   end;
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 recycle bin (Windows only)
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:=Form_peach.cbdeleteinputmode1.Caption;
   {$IFDEF MSWINDOWS}
   case Form_peach.cbdeleteinputmode1.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   {$IFDEF DARWIN}
   case Form_peach.cbdeleteinputmode1.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   case Form_peach.cbdeleteinputmode1.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:=Form_peach.cbdeleteinputmode.Caption;
   {$IFDEF MSWINDOWS}
   case Form_peach.cbdeleteinputmode.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   {$IFDEF DARWIN}
   case Form_peach.cbdeleteinputmode.ItemIndex of
      0: erasemode:=3;
      1: erasemode:=0;
      2: erasemode:=2;
      3: erasemode:=1;
   end;
   {$ELSE}
   case Form_peach.cbdeleteinputmode.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
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   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)
var
   P:tprocessutf8;
   bin_name,in_param,eraselevel,s:ansistring;
   i:integer;
begin
in_param:='';
if Form_peach.StringGrid1.Row=0 then exit;
if Form_peach.StringGrid1.Cells[1,1]='' then exit;
P:=tprocessutf8.Create(nil);
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
   begin
   s:=Form_peach.StringGrid1.Cells[8,i];
   if Form_peach.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)+Form_peach.StringGrid1.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';
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
if executemode=1 then P.Execute;
P.Free;
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:=Form_peach.Caption;
Form_peach.Caption:=txt_2_7_updating+' 1/4 '+txt_please_wait;
application.ProcessMessages;
if status0=txt_list_browsing then
   begin
   try inpath:=extractfilepath(Form_peach.StringGridList.Cells[12,1]); except inpath:=''; end;
   if inpath='' then inpath:=extractfilepath(Form_peach.EditUn7zaFilter.Text);//allow adding to empty folders
   end
else
   inpath:='';
s:=Form_peach.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 Form_peach.StringGridArchive.Rowcount-1 do
      for j:=1 to Form_peach.StringGrid1.RowCount-1 do
         if Form_peach.StringGridArchive.Cells[12,i]=inpath+Form_peach.StringGrid1.Cells[1,j] then
            begin
            namecollisionfound:=true;
            break;
            end;
if namecollisionfound= true then
   if (Form_peach.StringGridList.RowCount=2) and (Form_peach.StringGridList.Cells[1,1]='') then namecollisionfound:=false;//empty archive
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then
   begin
   result:=false;
   Form_peach.Caption:=dummystr;
   application.ProcessMessages;
   exit;
   end;
dummystr:=Form_peach.Caption;
Form_peach.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 Form_peach.StringGridArchive.Rowcount-1 do
         for j:=1 to Form_peach.StringGrid1.RowCount-1 do
            if Form_peach.StringGridArchive.Cells[12,i]=Form_peach.StringGrid1.Cells[1,j] then
               begin
               Form_peach.StringGridArchive.Cells[0,i]:='1';
               renamefileinarchive(Form_peach.StringGrid1.Cells[1,j],tempaddinarchive+DirectorySeparator+Form_peach.StringGrid1.Cells[1,j],false);
               application.ProcessMessages;
               end;
   end;
Form_peach.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:=Form_peach.Caption;
Form_peach.visible:=True;
Form_peach.Caption:=txt_2_7_updating+' 3/4 '+txt_please_wait;
Form_peach.Shape3.Width:=(Form_peach.Width*80) div 100;
application.ProcessMessages;
if status0=txt_list_browsing then
   begin
   try inpath:=extractfilepath(Form_peach.StringGridList.Cells[12,1]); except inpath:=''; end;
   if inpath='' then inpath:=extractfilepath(Form_peach.EditUn7zaFilter.Text);//allow adding to empty folders
   end
else
   inpath:='';
if inpath<>'' then
   begin
   s:=Form_peach.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 Form_peach.StringGrid1.RowCount-1 do
            begin
            renamefileinarchive(Form_peach.StringGrid1.Cells[1,i],inpath+Form_peach.StringGrid1.Cells[1,i],true);
            Form_peach.Shape3.Width:=((Form_peach.Width*80) + ((Form_peach.Width*i*10) div Form_peach.StringGrid1.RowCount)) div 100;
            application.ProcessMessages;
            end;
      Form_peach.Caption:=txt_2_7_updating+' 4/4 '+txt_please_wait;
      Form_peach.Shape3.Width:=(Form_peach.Width*92) div 100;
      application.ProcessMessages;
      for i:=1 to Form_peach.StringGridArchive.RowCount-1 do
         if Form_peach.StringGridArchive.Cells[0,i]='1' then
            begin
            Form_peach.StringGridArchive.Cells[0,i]:='';
            renamefileinarchive(tempaddinarchive+DirectorySeparator+Form_peach.StringGridArchive.Cells[12,i],Form_peach.StringGridArchive.Cells[12,i],false);
            application.ProcessMessages;
            end;
      end;
   end;
Form_peach.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:=Form_peach.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
Form_peach.EditOpenIn.Text:=fname;
testarctype(fname,j,fun);
srcfilesize_multipart(fname,tsize);

if lowercase(extractfileext(fname))='.7z' then
   if tsize<33 then
      begin
      pMessageWarningOK(fname+char($0D)+char($0A)+char($0D)+char($0A)+txt_8_9_empty);
      end;//empty 7z file

if (lowercase(extractfileext(fname))='.zip') or (lowercase(extractfileext(fname))='.zipx') then
   if tsize<23 then
      begin
      pMessageWarningOK(fname+char($0D)+char($0A)+char($0D)+char($0A)+txt_8_9_empty);
      end;//empty zip file

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;
Form_peach.EditOpenIn.Text:=s;
fun:=sfun;
fun_status:=sfuns;
autoclosegwrap:=tautoclosegwrap;
end;

procedure goarchive;
var
   sel,s,aname,oname,otest,strsel,dummycl,dummycltar,dummytitle,toname,totype,outname,aoutname:ansistring;
   i,iext,nsel,j,clres:integer;
   nf:boolean;
begin
Form_peach.enabled:=false;
setsequenceerror:=false;
clearstopsequencefile;
unit_gwrap.perrors:=0;
psize:=0;
clres:=0;
if Form_peach.StringGrid1.RowCount>1 then
   if (Form_peach.EditName3.Text='') or (Form_peach.Edit4.Text='') then setoutname(s,0);

if Form_peach.CheckBoxParallelArchiving.State=cbUnChecked then needwaitupdating:=true; //execute jobs sequentially (wait job completion) if not requested elsewhere
if (Form_peach.StringGrid1.RowCount<3) or (Form_peach.CheckBoxSeparate.State=cbUnChecked) then needwaitupdating:=false; //don't wait job completion if not needed (single input, or single output)
if Form_peach.labelstatus4.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 Form_peach.CheckBoxDeleteInput1.Checked=true then needwaitupdating:=true; //execute jobs sequentially, needed by delete original files options, replaces previous rules
if Form_peach.CheckBoxAutoHaltA.Checked=true then needwaitupdating:=true;

if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;

Form_peach.Shape3.Color:=PGREEN;
Form_peach.Shape3.Height:=pbarh;
Form_peach.Shape3.Width:=0;
application.ProcessMessages;

if Form_peach.CheckBoxConvert.State=cbChecked then
   begin
   subfun:='convert';
   dummytitle:=Form_peach.Caption;
   Form_peach.enabled:=false;
   Form_peach.visible:=false;
   needwaitupdating:=true; //execute jobs sequentially, needed by conversion, replaces previous rules
   Form_peach.CheckBoxFolder.State:=cbUnChecked; //override extract to new folder
   for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
      begin
      if checkstopsequencefile=true then
         begin
         subfun:='archive';
         Form_peach.enabled:=true;
         Form_peach.visible:=true;
         Form_peach.Caption:=dummytitle;
         clearstopsequencefile;
         break;
         end;
      if Form_peach.Width<>0 then unit_gwrap.pprogbarprev:=Form_peach.Shape3.Width*Form_gwrap.Width div Form_peach.Width;
      Form_peach.Shape3.Width:=(((Form_peach.Width*i)*100) div (Form_peach.StringGrid1.Rowcount-1))div 100;
      Form_peach.Caption:=txt_2_8_convertexisting+'... ('+inttostr(i)+'/'+inttostr(Form_peach.StringGrid1.Rowcount-1)+')';
      Form_peach.StringGrid1.Row:=i;
      Form_peach.StringGrid1.Cells[11,i]:='1';
      Application.ProcessMessages;
      otest:=extractfilepath(Form_peach.Edit5.Text);
      if control_outpath_archive(otest)<>0 then
         begin
         subfun:='archive';
         Form_peach.enabled:=true;
         Form_peach.visible:=true;
         exit;
         end;
      aname:=Form_peach.StringGrid1.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 Form_peach.StringGrid1.Cells[7,i]:=''; end;
         503: begin Form_peach.StringGrid1.Cells[7,i]:=''; end;
         502: begin Form_peach.StringGrid1.Cells[7,i]:=''; end;
         501: begin Form_peach.StringGrid1.Cells[7,i]:=''; end; //non-archives
         500: begin Form_peach.StringGrid1.Cells[7,i]:=''; end; //Windows executables, installers
         else
            begin
            if getoname(aname,oname)<0 then
               begin
               Form_peach.enabled:=true;
               Form_peach.visible:=true;
               subfun:='archive';
               pMessageWarningOK(txt_2_8_cannotconvert);
               end_convert;
               if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.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-pmccreated 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
            Form_peach.StringGrid1.Cells[8,i]:=oname;

            if (Form_peach.cbType.Text=STR_ARC) or
               (Form_peach.cbType.Text=txt_sfx+' '+STR_ARC) or
               (Form_peach.cbType.Text=STR_ZPAQ) or
               (Form_peach.cbType.Text=STR_QUAD) or
               (Form_peach.cbType.Text=STR_BROTLI) or
               (Form_peach.cbType.Text=STR_ZSTD) or
               (Form_peach.cbType.Text=STR_UPX) or
               (Form_peach.cbType.Text=txt_custom) or (Form_peach.cbType.Text=txt_custom+'/RAR') or
               (Form_peach.cbType.Text=txt_split) or
               (Form_peach.cbType.Text=STR_PEA) then
               totype:='no7z'
            else
               totype:='7z';

            if totype='7z' then
               if ((Form_peach.CheckBoxSeparate.Checked=true) or (Form_peach.StringGrid1.Rowcount=2)) then
                  begin
                  toname:=oname+directoryseparator+'*';
                  Form_peach.StringGrid1.Cells[7,i]:='+';
                  end
               else
                  begin
                  toname:=oname;
                  Form_peach.StringGrid1.Cells[7,i]:='+++';
                  end
            else
               begin
               toname:=oname;
               Form_peach.StringGrid1.Cells[7,i]:='+++';
               end;
            if iext=10001 then oname:=ExtractFilePath(oname);//PEA
            if iext=10000 then
               begin
               cutextension(oname);
               if (Form_peach.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
            Form_peach.StringGrid1.Cells[8,i]:=toname;
            end;
         end;
      Form_peach.StringGrid1.Cells[11,i]:='0';
      end;
   Form_peach.enabled:=true;
   Form_peach.visible:=true;
   if form_peach.Visible=true then Form_peach.SetFocus;
   if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
      if pMessageErrorYesNo(inttostr(unit_gwrap.perrors)+' '+txt_8_1_ed+char($0D)+char($0A)+txt_2_8_convertbegin)=7 then
         begin
         subfun:='archive';
         end_convert;
         ares:=0;
         if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
         if stayopen=false then exit_withsave
         else tobrowser_fromarchiver;
         exit;
         end;
   if convertverbose=1 then
      if pMessageInfoYesNo(txt_2_8_convertbegin)=7 then
         begin
         subfun:='archive';
         end_convert;
         ares:=0;
         if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.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;
   Form_peach.Caption:=dummytitle;
   Form_peach.Shape3.Width:=0;
   subfun:='archive';
   end;
if precheckaddinarchive=false then
   begin
   if stayopen=false then exit_withsave
   else tobrowser_fromarchiver;
   exit;
   end;
try
if Form_peach.CheckBoxSeparate.State=cbChecked then
   begin
   Form_peach.visible:=False;
   dummytitle:=Form_peach.Caption;
   for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
      begin
      if Form_peach.Width<>0 then unit_gwrap.pprogbarprev:=Form_peach.Shape3.Width*Form_gwrap.Width div Form_peach.Width;
      Form_peach.Shape3.Width:=(((Form_peach.Width*i)*100) div (Form_peach.StringGrid1.Rowcount-1))div 100;
      application.ProcessMessages;
      if checkstopsequencefile=true then
         begin
         clearstopsequencefile;
         break;
         end;
      Form_peach.Caption:=dummytitle+' ('+inttostr(i)+'/'+inttostr(Form_peach.StringGrid1.Rowcount-1)+')';
      Form_peach.StringGrid1.Row:=i;
      Form_peach.StringGrid1.Cells[11,i]:='1';
      application.processmessages;
      sel:=inttostr(i);
      suggest_outname(s,Form_peach.cbType.Text,i);
      if Form_peach.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
      Form_peach.Edit4.Text:=s;
      Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
      otest:=extractfilepath(Form_peach.Edit5.Text);
      if control_outpath_archive(otest)<>0 then begin Form_peach.enabled:=true; exit; end;
      ares:=archive_mainsequence(sel,aoutname,clres);
      Form_peach.StringGrid1.Cells[11,i]:='0';
      if autotest=1 then autotestarchive_fromname(aoutname);
      end;
   Form_peach.Caption:=dummytitle;
   //pf:=Form_peach.cbType.ItemIndex;
   lastoutpath:=extractfilepath(Form_peach.Editname3.Text);
   if needwaitupdating=false then sleep(random(500)); //let some time between jobs if launched in parallel
   end
else
   begin
   Form_peach.Shape3.Width:=(Form_peach.Width*50) div 100;
   application.ProcessMessages;
   sel:='all';
   otest:=extractfilepath(Form_peach.Edit5.Text);
   if control_outpath_archive(otest)<>0 then begin Form_peach.enabled:=true; exit; end;
   if Form_peach.CheckBoxTarBefore.State=cbChecked then
      begin
      dummytitle:=Form_peach.Caption;
      Form_peach.Caption:=txt_tarbefore+'... (1/1)';
      tarbefore(sel,outname,dummycltar,true);
      Form_peach.visible:=False;
      ares:=archive_mainsequence(sel,aoutname,clres);
      if stayopen=true then Form_peach.visible:=True;
      clearfile(outname);
      using_tarbefore:=false;
      //pf:=Form_peach.cbType.ItemIndex;
      lastoutpath:=extractfilepath(Form_peach.Editname3.Text);
      Form_peach.Caption:=dummytitle;
      end
   else
      begin
      Form_peach.visible:=False;
      ares:=archive_mainsequence(sel,aoutname,clres);
      //pf:=Form_peach.cbType.ItemIndex;
      lastoutpath:=extractfilepath(Form_peach.Editname3.Text);
      end;
   if autotest=1 then autotestarchive_fromname(aoutname);
   end;
checkaddinarchive(ares,clres);
finally
  if stayopen=true then Form_peach.visible:=True;
end;

Form_peach.Shape3.Width:=Form_peach.Width;
application.ProcessMessages;

end_convert;

application.ProcessMessages;

if Form_peach.CheckBoxTarBefore.State=cbUnChecked then //deletion of original files, if scheduled, is performed in tarbefore procedure after TAR creation
 if Form_peach.CheckBoxDeleteInput1.Checked=true then
   begin
   checklistarchive(nsel, strsel);
   if Form_peach.cbType.Text<>STR_UPX then
   if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
      pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
   else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletefilesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 Form_peach.cbdeleteinputmode1.Caption+' '+inttostr(nsel)+' '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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 Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
Form_peach.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;
end;

procedure phalstsystem_fromapp;
var
   P:tprocessutf8;
   cl:ansistring;
begin
   P:=tprocessutf8.Create(nil);
   P.Options := [poUsePipes{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
   {$IFDEF MSWINDOWS}
   begin
   cl:='shutdown /s /t 10';
   P.Executable:='shutdown';
   P.Parameters.Add('/s');
   P.Parameters.Add('/t 10');
   end;
   {$ELSE}
   begin P.Executable:='halt'; cl:='halt'; end;
   {$ENDIF}
   if Form_peach.Visible=true then Application.ProcessMessages;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   P.Free;
   exit_withsave;
end;

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

procedure on_buttonarchiveclick;
begin
if goarchiving=true then exit;
goarchiving:=true;
Form_peach.Enabled:=false;
endmultimode;
if checkfreespace<>0 then Form_peach.StringGrid1.RowCount:=1;
if Form_peach.StringGrid1.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;
Form_peach.Enabled:=true;
goarchiving:=false;
end;

procedure TForm_peach.ButtonArchiveClick(Sender: TObject);
begin
on_buttonarchiveclick;
end;

procedure TForm_peach.ButtonEditName3Click(Sender: TObject);
var
   s:ansistring;
begin
if getoutname(s,archive_type,0)=0 then
   begin
   EditName3.Text:=extractfilepath(s);
   if checkboxseparate.state=cbUnchecked then Edit4.Text:=extractfilename(s);
   s:=Edit4.Text;
   if extractfileext(s)='.tar' then begin cutextension(s); Edit4.Text:=s; end;
   Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
   end;
end;

procedure TForm_peach.ButtonEditName4Click(Sender: TObject);
begin
patheditor:=EditNameCustom1;
pcustom.popup();
end;

procedure TForm_peach.ButtonEditName5Click(Sender: TObject);
begin
if EditOpenOut.Text='' then Form_peach.SelectDirectoryDialog1.InitialDir:=local_desktop
else Form_peach.SelectDirectoryDialog1.InitialDir:=EditOpenOut.Text;
if SelectDirectoryDialog1.Execute then
   if SelectDirectoryDialog1.FileName<>'' then
      begin
      EditOpenOut.Text:=SelectDirectoryDialog1.FileName;
      if EditOpenOut.Text<>'' then
         if EditOpenOut.Text[length(EditOpenOut.Text)]<>directoryseparator then EditOpenOut.Text:=EditOpenOut.Text+directoryseparator;
      end;
end;

procedure TForm_peach.ButtonEditName8Click(Sender: TObject);
begin
patheditor:=EditNameCustom;
pcustom.popup();
end;

procedure TForm_peach.ButtonEditNameCustom1Click(Sender: TObject);
var
   s:ansistring;
begin
if Form_peach.SaveDialog2.Execute then
   if Form_peach.SaveDialog2.FileName<>'' then
      begin
      s:=Form_peach.SaveDialog2.FileName;
      addtocustomhistory(s);
      Form_peach.EditNameCustom1.Text:=s;
      end
   else exit
else exit;
end;

procedure gocancelextract;
begin
restorestatus_extractor;
if stayopen=false then exit_withsave
else tobrowser_fromextractor;
end;

procedure cancelbuttonextract;
begin
endmultimode;
Form_peach.RadioGroupAction.ItemIndex:=0; on_radiogroupactionchange;
gocancelextract;
end;

procedure TForm_peach.ButtonExtCancelClick(Sender: TObject);
begin
cancelbuttonextract;
end;

procedure TForm_peach.ButtonUn7za10Click(Sender: TObject);
var
   p:TPoint;
begin
p.x:=Groupbox4.left+ButtonUn7za10.Left;
p.y:=ButtonUn7za10.Height+ButtonUn7za10.top+Groupbox4.top+OptionsOpen.top+PanelTitleExtract.Height;
p:=clienttoscreen(p);
setrecenticons_extract_archive;
if lastoutpath='' then lastoutpath:=local_desktop;
MenuItemOpen_Last.Caption:=txt_lastused+' '+extractfilepath(lastoutpath);
popupopen1.PopUp(p.x,p.y);
populatepcmenu;
end;

procedure TForm_peach.ButtonUn7za11Click(Sender: TObject);
var
   p:tpoint;
begin
p.x:=buttonun7za11.left;
p.y:=buttonun7za11.top+buttonun7za11.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 TForm_peach.ButtonUn7za11MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=false;
pmttitle.caption:=txt_add;
end;

procedure TForm_peach.ButtonUn7za4MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=false;
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 (Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]='A:\') or (Form_peach.StringGridList.Cells[12,Form_peach.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 (Form_peach.StringGridList.Cells[12,i]='A:\') or (Form_peach.StringGridList.Cells[12,i]='B:\') then exit;
{$ENDIF}
checkfdwin_row:=0;
end;

procedure showfmmenu(menusrc:integer);
var
   p:tpoint;
begin
with form_peach do
begin
MenuItem14.visible:=true;
pmbookmarks.visible:=true;
pmorganizebookmarks.visible:=true;
pmcommand.visible:=true;
pmpowershell.visible:=true;
pmexplore.visible:=true;
pmquickdelete.visible:=true;
pmsecuredelete.Visible:=true;
pmzerofile.Visible:=true;
MenuItem79.visible:=false;//disabled
pmzerofree.visible:=false;//disabled
pmsecuredeletefree.visible:=false;//disabled
{$IFDEF MSWINDOWS}pmrecycle.Visible:=true;{$ENDIF}
{$IFDEF DARWIN}pmrecycle.Visible:=true;{$ENDIF}
MenuItem91.visible:=true;
MenuItem75.visible:=true;
pmcut.visible:=false;
pmcheck.visible:=true;
pmpdup.visible:=true;
pmws.visible:=true;
if fun='FILEBROWSER' then
   begin
   pmcpyto.Visible:=true;
   pmmvto.Visible:=true;
   pmnewfolder.Visible:=True;
   pmrename.Visible:=True;
   end
else
   begin
   pmcheck.visible:=false;
   pmpdup.visible:=false;
   pmcpyto.Visible:=false;
   pmmvto.Visible:=false;
   pmnewfolder.Visible:=False;
   pmrename.Visible:=false;
   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:=buttonun7za6.left;
p.y:=buttonun7za6.top+buttonun7za6.height;
end;
2: begin
p.x:=buttoncmto.left;
p.y:=buttoncmto.top+buttonun7za6.height;
pmsecuredelete.Visible:=false;
pmzerofile.Visible:=false;
{$IFDEF MSWINDOWS}pmrecycle.Visible:=false;{$ENDIF}
{$IFDEF DARWIN}pmrecycle.Visible:=false;{$ENDIF}
pmquickdelete.visible:=false;
pmnewfolder.Visible:=False;
pmbookmarks.visible:=false;
pmorganizebookmarks.visible:=false;
pmcommand.visible:=false;
pmpowershell.visible:=false;
pmexplore.visible:=false;
MenuItem14.visible:=false;
pmcheck.visible:=false;
pmpdup.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;
Separator17.visible:=false;
end;
3: begin
p.x:=buttonfmactions.left;
p.y:=buttonfmactions.top+buttonun7za6.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 TForm_peach.ButtonUn7za6Click(Sender: TObject);
begin
showfmmenu(1);
end;

procedure TForm_peach.ButtoncmtoClick(Sender: TObject);
begin
showfmmenu(2);
end;

procedure setnamingpolicymenu(enmenu:boolean);
begin
with form_peach 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 form_peach 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;

procedure TForm_peach.ButtonUn7za7Click(Sender: TObject);
var
   p:tpoint;
begin
p.x:=buttonun7za7.left;
p.y:=buttonun7za7.top+buttonun7za7.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 TForm_peach.ButtonUn7za8Click(Sender: TObject);
var
   p:tpoint;
begin
p.x:=buttonun7za8.left;
p.y:=buttonun7za8.top+buttonun7za8.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 TForm_peach.ButtonUn7za8MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=true;
pmttitle.caption:=txt_2_8_convert;
end;

procedure TForm_peach.ButtonUn7za9Click(Sender: TObject);
var
   p:tpoint;
begin
p.x:=buttonun7za9.left;
p.y:=buttonun7za9.top+buttonun7za9.height;
if swapbars=true then p.y:=p.y+PanelListBar.height+PanelTabBar.height;
p:=clienttoscreen(p);
pmtestinfolist.popup(p.x,p.y);
end;

procedure TForm_peach.CheckBox1Click(Sender: TObject);
begin
on_CheckBox1Click;
end;

procedure TForm_peach.CheckBox2Click(Sender: TObject);
begin
on_CheckBox2Click;
end;

procedure TForm_peach.CheckBox3Click(Sender: TObject);
begin
on_CheckBox3Click;
end;

procedure TForm_peach.CheckBoxNameAsParentFolderClick(Sender: TObject);
begin
on_CheckBoxnameasparentfolderclick;
end;

procedure on_checkboxnetworkinfoclick;
begin
if Form_peach.CheckBoxnetworkinfo.State=cbChecked then mappeddrivesinfo:=1 else mappeddrivesinfo:=0;
end;

procedure TForm_peach.CheckBoxnetworkinfoClick(Sender: TObject);
begin
  on_checkboxnetworkinfoclick;
end;

procedure on_checkboxsamearcclick;
begin
if form_peach.CheckBoxSameArc.State=cbChecked then
   begin
   form_peach.ButtonEditName12.Enabled:=false;
   form_peach.Edit5.Enabled:=false;
   form_peach.Edit6.Visible:=true;
   form_peach.ButtonEditName3.Enabled:=false;
   form_peach.CheckBoxSeparate.State:=cbChecked;
   form_peach.CheckBoxSeparate.Enabled:=false;
   end
else
   begin
   form_peach.ButtonEditName12.Enabled:=true;
   form_peach.Edit5.Enabled:=true;
   form_peach.Edit6.Visible:=false;
   form_peach.ButtonEditName3.Enabled:=true;
   form_peach.CheckBoxSeparate.State:=cbUnchecked;
   form_peach.CheckBoxSeparate.Enabled:=true;
   end;
on_checkboxseparateclick;
end;

procedure TForm_peach.CheckBoxSameArcClick(Sender: TObject);
begin
on_checkboxsamearcclick;
end;

procedure on_CheckBoxSameExtclick;
begin
if form_peach.CheckBoxSameExt.State=cbChecked then
   begin
   form_peach.ButtonUn7za10.Enabled:=false;
   form_peach.EditOpenOut.Enabled:=false;
   form_peach.EditOpenOut1.Visible:=true;
   form_peach.ButtonEditName5.Enabled:=false;
   end
else
   begin
   form_peach.ButtonUn7za10.Enabled:=true;
   form_peach.EditOpenOut.Enabled:=true;
   form_peach.EditOpenOut1.Visible:=false;
   form_peach.ButtonEditName5.Enabled:=true;
   end;
end;

procedure TForm_peach.CheckBoxSameExtClick(Sender: TObject);
begin
on_CheckBoxSameExtclick;
end;

procedure TForm_peach.CheckBoxShowVolatileClick(Sender: TObject);
begin
on_CheckBoxShowVolatileClick;
end;

procedure TForm_peach.CheckBoxSkipDelClick(Sender: TObject);
begin
on_CheckBoxSkipDel_click;
end;

procedure TForm_peach.CheckBoxSkipencClick(Sender: TObject);
begin
if Form_peach.CheckBoxSkipenc.State=cbChecked then skipenctest:=1 else skipenctest:=0;
end;

procedure TForm_peach.CheckBoxsnhClick(Sender: TObject);
begin
CheckBoxsnh_onclick;
end;

procedure TForm_peach.CheckBoxsni1Click(Sender: TObject);
begin
CheckBoxsni1_onclick;
end;

procedure TForm_peach.CheckBoxsniClick(Sender: TObject);
begin
CheckBoxsni_onclick;
end;

procedure TForm_peach.CheckBoxsnlClick(Sender: TObject);
begin
CheckBoxsnl_onclick;
end;

procedure TForm_peach.CheckBoxsnoiClick(Sender: TObject);
begin
CheckBoxsnoi_onclick;
end;

procedure TForm_peach.CheckBoxsnonClick(Sender: TObject);
begin
CheckBoxsnon_onclick;
end;

procedure TForm_peach.CheckBoxsns1Click(Sender: TObject);
begin
CheckBoxsns1_onclick;
end;

procedure TForm_peach.CheckBoxsnsClick(Sender: TObject);
begin
CheckBoxsns_onclick;
end;

procedure TForm_peach.CheckBoxsnz1Click(Sender: TObject);
begin
CheckBoxsnz_onclick;
end;

procedure TForm_peach.CheckBoxSolidAddressChange(Sender: TObject);
begin
solidaddressstyle:=CheckBoxSolidAddress.ItemIndex;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.CheckBoxsspClick(Sender: TObject);
begin
CheckBoxssp_onClick;
end;

procedure TForm_peach.CheckBoxstlClick(Sender: TObject);
begin
CheckBoxstl_onClick;
end;

procedure TForm_peach.ButtonEditNameCustomClick(Sender: TObject);
var
   s:ansistring;
begin
if Form_peach.SaveDialog2.Execute then
   if Form_peach.SaveDialog2.FileName<>'' then
      begin
      s:=Form_peach.SaveDialog2.FileName;
      addtocustomhistory(s);
      Form_peach.EditNameCustom.Text:=s;
      s:=extractfilename(s);
      cutextension(s);//default: extension = name of the executable
      Form_peach.EditExtCustom.Text:=s;
      end
   else exit
else exit;
end;

procedure calcseltsize;
var
   i:integer;
begin
tsize:=0;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      try
      tsize:=tsize+strtoqword(Form_peach.StringGridList.Cells[3,i]);
      except
      end;
end;

procedure calcdisptsize;
var
   i:integer;
begin
tsize:=0;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   try
   tsize:=tsize+strtoqword(Form_peach.StringGridList.Cells[3,i]);
   except
   end;
end;

procedure calcalltsize;
begin
tsize:=0;
try
srcfilesize_multipart(Form_peach.EditOpenIn.Text,tsize);
except
end;
end;

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

procedure archive_funsel(funct,select:ansistring);
var
   cl,jobcode,outname:ansistring;
begin
if select<>'all' then
   begin
   if Form_peach.StringGridList.RowCount<2 then exit;
   if Form_peach.StringGridList.Cells[1,1]='' then exit;
   if testencrypted<0 then exit;
   end;
resetminimizedlauncher;
Form_peach.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;
Form_peach.Visible:=true;
end;

procedure filebrowser_funall(funct:ansistring);//test, list, info, details (list and give info msg only)
var
   P:tprocessutf8;
   s,cl,jobcode,outname,strsel,funct1:ansistring;
   i,j,k,nsel:integer;
   scheduleclip:array of array [0..18] of ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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;
Form_peach.Visible:=false;
if funct='details' then
   begin
   funct:='list';
   funct1:='details';
   listmode:=0;
   end
else listmode:=1;
s:=Form_peach.EditOpenIn.Text;
k:=0;
setlength(scheduleclip,1);
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
      for j:=0 to Form_peach.StringGridList.ColCount-1 do
         scheduleclip[k,j]:=Form_peach.StringGridList.Cells[j,i];
      setlength(scheduleclip,length(scheduleclip)+1);
      k:=k+1;
      end;
for i:=0 to k-1 do
   begin
   Form_peach.EditOpenIn.Text:=scheduleclip[i,12];
   tsize:=strtoqword(scheduleclip[i,3]);//not exact for multivolumes
   testarctype(Form_peach.EditOpenIn.Text,j,fun);
   if (funct='test') and (fun='FILEBROWSER') then fun:='UN7Z'; //test inside directories
   fun_status:='FILEBROWSER';
   case fun of
   'UN7Z': if compose_un7z_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   'UNARC': if compose_unarc_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   'UNBROTLI': if funct='test' then if compose_unbrotli_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   'UNZPAQ': if funct='test' then if compose_unzpaq_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   'UNZSTD': if funct='test' then if compose_unzstd_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname);
   else
      if (funct1='details') then
         begin
         P:=tprocessutf8.Create(nil);
         cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' list info '+stringdelim(Form_peach.EditOpenIn.Text);
         P.CommandLine:=cl;
         if Form_peach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
         P.Execute;
         P.Free;
         end;
   end;
   if checkstopsequencefile=true then break;
   end;
setlength(scheduleclip,0);
Form_peach.EditOpenIn.Text:=s;
fun:='FILEBROWSER';
fun_status:=fun;
Form_peach.Visible:=true;
end;

procedure do_test;
begin
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('test')
else archive_funsel('test','all');
end;

procedure TForm_peach.ButtonUn7za1Click(Sender: TObject);
begin
do_test;
end;

procedure addtoarchive_selected;
var
   i:integer;
begin
Application.ProcessMessages;
resetminimizedlauncher;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      if Form_peach.StringGridList.Cells[12,i]<>'' then
         if checkfdwin_row(i)=0 then
            if testname(Form_peach.StringGridList.Cells[12,i], Form_peach.StringGrid1)=0 then
               begin
               Form_peach.Caption:=txt_2_4_adding+' '+Form_peach.StringGridList.Cells[12,i];
               Application.ProcessMessages;
               if filegetattr(Form_peach.StringGridList.Cells[12,i]) > 0 then
                  if filegetattr(Form_peach.StringGridList.Cells[12,i]) and faDirectory =0 then begin addfilestr(Form_peach.StringGrid1,Form_peach.StringGridList.Cells[12,i]); end
                  else addfolderstr(Form_peach.StringGrid1,Form_peach.StringGridList.Cells[12,i])
               else msg_not_accessible_list(Form_peach.StringGridList.Cells[12,i]);
               end;
Form_peach.StringGrid1.AutoSizeColumns;
showpanel('archive');
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
//Form_peach.ComboBoxArchive7.ItemIndex:=0;//since release 8.7.0 remember the archive creation mode
Form_peach.ComboBoxArchiveAct.Itemindex:=Form_peach.ComboboxArchive7.Itemindex;
Form_peach.comboboxarc2.ItemIndex:=0;
application.ProcessMessages;
if enumd=1 then updatelayout('enum');
end;

procedure resetmiscarchiveopt;
begin
Form_peach.comboboxarchive1.ItemIndex:=0;
ComboBoxArchive1_onchange;
end;

procedure setupdatecontrols(encnt:boolean);
begin
with Form_peach  do
begin
GroupBoxCreateOut.Enabled:=encnt;
GroupBoxCreateOut1.Enabled:=not(encnt);
GroupBoxCreateOut1.Visible:=not(encnt);
if GroupBoxCreateOut1.Visible = true then
   begin
   if status0=txt_list_browsing then
      begin
      try labelstatus9.caption:=extractfilepath(Form_peach.StringGridList.Cells[12,1]); except labelstatus9.caption:=''; end;
      if labelstatus9.caption='' then labelstatus9.caption:=extractfilepath(Form_peach.EditUn7zaFilter.Text);//allow adding to empty folders
      end
   else
      labelstatus9.caption:='';
   end;
labelstatus9.caption:=DirectorySeparator+labelstatus9.caption;
labelstatus9.Enabled:=false;
labelstatus10.Enabled:=false;
labelstatus7.Enabled:=false;
ButtonEditname14.Enabled:=false;
Edit7.Caption:=Edit5.Caption;
Edit7.Enabled:=false;
ButtonEditName6.Enabled:=false;
ImagePassword3.Caption:=Form_peach.ImagePassword1.Caption;
ImagePassword3.Hint:=Form_peach.ImagePassword1.Hint;
ImagePassword3.Visible:=Form_peach.ImagePassword1.Visible;
ImagePassword3.Glyph:=ImagePassword1.Glyph;
ComboBoxArchiveAct1.ItemIndex:=ComboBoxArchiveAct.ItemIndex;
//ComboBoxArchiveAct1.Enabled:=ComboBoxArchiveAct.Enabled;
end;
end;

function isarchiveeditable:integer;//-1 not an archive 0 can edit 1 will try to edited (forced) 2 cannot edit
var
   s,fextl:ansistring;
begin
result:=-1;
if fun='FILEBROWSER' then exit;
result:=0;
s:=Form_peach.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 //try only for unknown file types, avoid knwon file types not supporting this operation
      result:=1
   else
      result:=2;
   end;
end;
end;

function addtoarchive_inarchive(forceadd:boolean):boolean;
var
   s,fextl:ansistring;
begin
result:=true;
Form_peach.CheckBoxSameArc.State:=cbUnchecked;
Form_peach.CheckBoxSeparate.State:=cbUnchecked;
Form_peach.CheckBoxConvert.State:=cbUnchecked;
Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
resetminimizedlauncher;
resetmiscarchiveopt;
Form_peach.StringGrid1.AutoSizeColumns;
s:=Form_peach.EditOpenIn.Text;
Form_peach.EditName3.Text:=extractfilepath(s);
fextl:=upcase(extractfileext(s));
//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);
      '.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 Form_peach.ComboBoxArchive7.ItemIndex:=1 else Form_peach.ComboBoxArchive7.ItemIndex:=2;
   Form_peach.ComboBoxArchiveAct.Itemindex:=Form_peach.ComboboxArchive7.Itemindex;
   end
else
   if fextl='.ARC' then
      begin
      archive_type_select(STR_ARC);
      if forceadd=true then Form_peach.comboboxarc2.ItemIndex:=1 else Form_peach.comboboxarc2.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 //try only for unknown file types, avoid knwon file types not supporting this operation
         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 Form_peach.ComboBoxArchive7.ItemIndex:=1 else Form_peach.ComboBoxArchive7.ItemIndex:=2;
         Form_peach.ComboBoxArchiveAct.Itemindex:=Form_peach.ComboboxArchive7.Itemindex;
         end
      else
         begin
         pMessageWarningOK(txt_add_error);
         tobrowser_fromarchiver;
         result:=false;
         exit;
         end;
      end;
cutextension(s);
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
skipapstatus:=true;
showpanel('archive');
updatingarchive_inarchive:=true;
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
autosize_stringgrid1;
Form_peach.ButtonEditname13.Enabled:=false;
Form_peach.pmbrowser.Enabled:=false;
Form_peach.mgobrowser.Enabled:=false;
Form_peach.ButtonEditname12.Enabled:=false;
Form_peach.Edit5.enabled:=false;
Form_peach.ButtonEditname3.Enabled:=false;
setupdatecontrols(false);
Form_peach.LabelStatusAr2.Caption:=status1;
Form_peach.labelstatus4.Caption:=txt_2_7_updating;
Form_peach.edit5.Caption:=form_peach.editopenin.caption;
needwaitupdating:=true;
ares:=-1;
end;

procedure do_add;
var
   sz:qword;
begin
if check7zvolume(Form_peach.EditOpenIn.Caption)=true then exit;

if fun='FILEBROWSER' then
   begin
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.State:=cbUnchecked;
   Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   exit;
   end;

if (Form_peach.StringGridList.RowCount>1) then
   if (Form_peach.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
   srcfilesize_multipart(Form_peach.EditOpenIn.Caption,sz);
   if sz<33 then
      begin
      addtoarchive_inarchive(true);
      exit;
      end;
   end;

end;

procedure TForm_peach.ButtonUn7za4Click(Sender: TObject);
begin
do_add;
end;

procedure archive_convert;
var
   s:ansistring;
begin
if check7zvolume(Form_peach.EditOpenIn.Caption)=true then exit;
if fun='FILEBROWSER' then
   begin
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.State:=cbChecked;
   Form_peach.CheckBoxConvert.State:=cbChecked;
   Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   on_checkboxseparateclick;
   end
else
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   s:=Form_peach.EditOpenIn.Text;
   if s<>'' then
      if s[length(s)]=directoryseparator then setlength(s,length(s)-1);
   s:=extractfilepath(s);
   Form_peach.EditUn7zaFilter.Text:='*';
   listdir(s,false,false);
   addtohistory;
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.State:=cbChecked;
   Form_peach.CheckBoxConvert.State:=cbChecked;
   Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   on_checkboxseparateclick;
   end;
end;

procedure TForm_peach.ButtonUn7za5Click(Sender: TObject);
begin
archive_convert;
end;

procedure TForm_peach.ButtonUn7za5MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=true;
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;
      Form_peach.EditNameCustom1.Text:='Extrac32';
      Form_peach.ComboBoxArchiveCustom1.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 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;

{$IFDEF MSWINDOWS}
function fileop_fromnamelist(fnames: array of ansistring; fto:ansistring; fileopfun:integer; fileopflags:integer):integer;
var
   FStruct: TSHFILEOPSTRUCTW;
   tmpfnames: widestring;
   tmpfto: widestring;
   i:integer;
begin
if fto<>'' then
   if not(DirectoryExists(fto)) then ForceDirectories(fto);
//file already checked when the function is called
tmpfnames:='';
for i:=0 to (length(fnames)-1) do tmpfnames:=tmpfnames+WideString(expandfilename(fnames[i]))+#0;
if fto<>'' then tmpfto:=WideString(expandfilename(fto));
FStruct.wnd:=0;
case fileopfun of
   0: FStruct.wFunc:=FO_DELETE;
   1: FStruct.wFunc:=FO_MOVE;
   2: FStruct.wFunc:=FO_COPY;
   end;
FStruct.pFrom:=PWChar((tmpfnames)+#0);
if fto<>'' then FStruct.pTo:=PWChar((tmpfto)+#0#0)
else FStruct.pTo:=nil;
case fileopflags of
   0: FStruct.fFlags:= FOF_ALLOWUNDO;
   1: FStruct.fFlags:= FOF_ALLOWUNDO or FOF_RENAMEONCOLLISION;
   2: FStruct.fFlags:= FOF_ALLOWUNDO or FOF_NOCONFIRMATION;
   3: FStruct.fFlags:= FOF_NOCONFIRMATION;
   end;
FStruct.fAnyOperationsAborted := false;
FStruct.hNameMappings := nil;
Result:=ShFileOperationW(@FStruct);
end;
{$ENDIF}

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:='.r01';
   j:=0;
   if FindFirst(s_path + s_name + s_ext, faAnyFile, r)=0 then //multipart rar .rxx
      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
   else
      begin
      s_ext:='.rar';
      if pos('.part',lowercase(extractfileext(s_name)))<>0 then //multipart rar .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;

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 Form_peach.StringGrid2.Row=0 then exit;
if Form_peach.StringGrid2.Cells[1,1]='' then exit;
P:=tprocessutf8.Create(nil);
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
for i:=1 to Form_peach.StringGrid2.Rowcount-1 do
   begin
   s:=Form_peach.StringGrid2.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';
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
if executemode=1 then P.Execute;
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:='';
P:=tprocessutf8.Create(nil);
bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
s:=Form_peach.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';
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
if executemode=1 then P.Execute;
P.Free;
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 Form_peach.StringGrid2.Rowcount<2 then exit;
if Form_peach.StringGrid2.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=Form_peach.StringGrid2.Rowcount;
for i:=1 to rc-1 do
      begin
      nsel:=nsel+1;
      s:=Form_peach.StringGrid2.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 setsequenceerror=false then
begin
if (btfun='unquad') or (btfun='unbalz') or (btfun='unbcm') or (btfun='unbrotli') or (btfun='unzstd') or (btfun='unlpaq') then
   if (not(directoryexists(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 Form_peach.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 (Form_peach.CheckBoxFolder.state=cbChecked) or (btfun='unzpaq') then
      // check if the new folder contains a single object
      begin
      if (Form_peach.CheckBoxrelative.state=cbChecked) and (Form_peach.CheckBoxrelative.enabled=true) 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 DirectoryExists(origout) then
         sf:=origout
      else
         sf:=extractfiledir(copy(origout,1,length(origout)-1))+directoryseparator;
      if directoryexists(origoutnf) then sf:=origoutnf; //new folder
      if directoryexists(origoutmf) then sf:=origoutmf; //moved folder
      unit_gwrap.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 (form_peach.RadioGroupAction.ItemIndex<2) //extraction operations
   and (form_peach.CheckBoxrelative.State=cbChecked) //extract then move to relative paths
   and (Form_peach.CheckBoxrelative.enabled=true)
   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 DirectoryExists(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;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];//workaround, ponewconsole is working properly with powaitonexit in Lazarus for Linux
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P.Execute;
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=true then
   begin
   try
      setaltdest(outname,altdest);
      if (pos(STR_TMPEXT,outname)<>0) and (outname<>altdest) then
         begin
         cleardirsimple(outname);
         if form_peach.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 (form_peach.RadioGroupAction.ItemIndex<2) //extraction operations
   and (form_peach.CheckBoxrelative.State=cbChecked) //extract then move to relative paths
   and (Form_peach.CheckBoxrelative.enabled=true)
   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(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row],':','_',[rfReplaceAll]);
         relpath:=extractfilepath(relpath);
         end
      else
         relpath:='';//in flat or search mode, use root
      if Form_peach.labelstatus5.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 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
P:=tprocessutf8.Create(nil);
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';
{$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
if executemode=1 then P.Execute;
P.Free;
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,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=true then exit;
if checkstopsequencefile=true then exit;

testarctype(inname,i,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);

if (optype='') and (realuntar=true) then
   begin
   if Form_peach.visible=true then
      {$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
      begin
      dummyprogress:=Form_peach.Shape4.Width;
      dummytitle:=Form_peach.Caption;
      Form_peach.Caption:=txt_please_wait+' UNTAR '+extractfilename(in_param)+' ...';
      end;
   if Form_gwrap.visible=true then
      begin
      Form_gwrap.ButtonPause.enabled:=false;
      Form_gwrap.ButtonStop.enabled:=false;
      Form_gwrap.ButtonStopAll.enabled:=false;
      dummyprogressg:=Form_gwrap.ShapeProgress.Width;
      dummystr:=Form_gwrap.Caption;
      Form_gwrap.Caption:=txt_please_wait+' UNTAR '+extractfilename(in_param)+' ...';
      end;
   end;

star:=in_param;
starpath:=extractfilepath(in_param);
if upcase(extractfileext(in_param))='.TAR' then
   begin
   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:=''; if zaout=2 then zaout:=1; end;//ask auto switch to GUI+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);
   {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
   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
   if excludeef=1 then cl:=cl+' -xtd';
   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;
   cl:=cl+' '+in_param;

   P:=tprocessutf8.Create(nil);
   P.CommandLine:=cl;

   {$IfDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF} //wait for tar to be extracted before following steps
   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
         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.Execute;
         while P.Running do
            begin
            if (optype='') and (realuntar=true) then
               begin
               if Form_peach.visible=true then
               {$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
                  begin
                  if Form_peach.Shape4.Width>=Form_peach.Width then Form_peach.Shape4.Width:=0;
                  Form_peach.Shape4.Width:=Form_peach.Shape4.Width+3;
                  end;
               if Form_gwrap.visible=true then
                  begin
                  if Form_gwrap.ShapeProgress.Width>=Form_gwrap.Width then Form_gwrap.ShapeProgress.Width:=0;
                  Form_gwrap.ShapeProgress.Width:=Form_gwrap.ShapeProgress.Width+2;
                  end;
               end;
            Application.ProcessMessages;
            Sleep(100);
            end;
         {$IfDEF MSWINDOWS}
         end;
         {$ENDIF}

      uaerr:=P.ExitStatus;
      end;

   P.Free;
   fun:=fun1;
   fun_status:=fun_status1;

   if realuntar=true then
      begin
      if uaerr=0 then udeletefile(star);
      end
   else
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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}
      cl:=cl+char($0D)+char($0A)+clprog;
      end;
   cl:=clext+char($0D)+char($0A)+cl;
   {$IFDEF MSWINDOWS}SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(starpath),nil);{$ENDIF}
   end;
if (optype='') and (realuntar=true) then
   begin
   if Form_peach.visible=true then
   {$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
      begin
      Form_peach.Shape4.Width:=dummyprogress;
      Form_peach.Caption:=dummytitle;
      end;
   if Form_gwrap.visible=true then
      begin
      Form_gwrap.ButtonPause.enabled:=true;
      Form_gwrap.ButtonStop.enabled:=true;
      Form_gwrap.ButtonStopAll.enabled:=true;
      Form_gwrap.ShapeProgress.Width:=dummyprogressg;
      Form_gwrap.Caption:=dummystr;
      end;
   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:=false;
unit_gwrap.perrors:=0;
psize:=0;
el:=0;
if check_extraction_input<>0 then exit;
   if length(Form_peach.EditOpenOut.Text)>16383 then
      begin
      Form_peach.EditOpenOut.Text:='';
      pMessageWarningOK(txt_3_1_pathexc);
      exit;
      end;
Form_peach.enabled:=false;
if fun='' then fun:='FILEBROWSER';
goup:=false;
if Form_peach.EditOpenOut.Text='' then
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then
      Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
   else
      Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.EditOpenIn.Text);
if not(directoryexists(Form_peach.EditOpenOut.Text)) then
   if build_path(Form_peach.EditOpenOut.Text)<>0 then
      begin
      Form_peach.enabled:=true;
      exit;
      end;

Form_peach.Shape4.Color:=PGREEN;
Form_peach.Shape4.Height:=pbarh;
Form_peach.Shape4.Width:=0;
application.ProcessMessages;

if Form_peach.CheckBoxDeleteInput.Checked=true then needwaitupdating:=true; //need to execute jobs sequentially
if Form_peach.CheckBoxAutoHaltE.Checked=true then needwaitupdating:=true;

if removeintdir=1 then
   if Form_peach.CheckBoxFolder.state=cbChecked then needwaitupdating:=true;

try
Form_peach.visible:=False;
if fun='FILEBROWSER' then
   begin
   k:=Form_peach.StringGrid2.RowCount;
   isize:=0;
   ksize:=0;
   for i:=1 to k-1 do ksize:=ksize+StrToInt64(Form_peach.StringGrid2.Cells[12,i]);

   if k>2 then
      if Form_peach.CheckBoxParallelarchiving.State=cbUnChecked then needwaitupdating:=true; //execute jobs sequentially (wait job completion) if not requested elsewhere

   Form_peach.StringGrid2.Row:=1;
   Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='1';
   for i:=1 to k-1 do
      begin
      Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='0';
      end;
   Form_peach.StringGrid2.Repaint;
   dummytitle:=Form_peach.Caption;
   for i:=1 to k-1 do
      begin
      if checkstopsequencefile=true then
         begin
         clearstopsequencefile;
         break;
         end;
      try
      srcfilesize_multipart(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],psize); //expressed in B
      except
      end;
      isize:=isize+strtoint64(Form_peach.StringGrid2.Cells[12,Form_peach.StringGrid2.Row]);
      if Form_peach.Width<>0 then unit_gwrap.pprogbarprev:=Form_peach.Shape4.Width*Form_gwrap.Width div Form_peach.Width;
      if ksize<>0 then Form_peach.Shape4.Width:=(Form_peach.Width*(((isize*100)div ksize))) div 100;
      Form_peach.Caption:=dummytitle+' '+inttostr(i)+'/'+inttostr(k-1);
      application.ProcessMessages;
      if testencrypted_fromname(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],'closed')=2 then
      else
         begin
         el:=extract_finalize_bytype(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.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 Form_peach.visible:=True;
      if el<>0 then exit;
      if i=k-1 then if stayopen=true then form_peach.Enabled:=false;
      untarafter(outname,Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],dummycl,true,'');
      if i=k-1 then if stayopen=true then form_peach.Enabled:=true;
      moveafterextract(outname);
      extraction_checkintermediatedir(outname,'extract');
      Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='0';
      if Form_peach.StringGrid2.Row<k then Form_peach.StringGrid2.Row:=Form_peach.StringGrid2.Row+1;
      Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='1';
      Form_peach.StringGrid2.Repaint;
      if needwaitupdating=false then sleep(random(500)); //let some time between operations if launched in parallel
      end;
   Form_peach.Caption:=dummytitle;
   end
else
   begin
   Form_peach.Shape4.Width:=(Form_peach.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(Form_peach.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 tobrowser_fromextractor;
         end
   else
      begin
      el:=extract_finalize_bytype(Form_peach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,true);
      if el=0 then launch_cl(cl,jobcode,outname);//'ext'
      end;
   if stayopen=true then Form_peach.visible:=True;
   if el<>0 then exit;
   form_peach.Enabled:=false;
   untarafter(outname,Form_peach.EditOpenIn.Text,dummycl,true,'');
   form_peach.Enabled:=true;
   moveafterextract(outname);
   extraction_checkintermediatedir(outname,'extract');
   end;
finally
  if stayopen=true then Form_peach.visible:=True;
end;

Form_peach.Shape4.Width:=Form_peach.Width;
application.ProcessMessages;

if Form_peach.CheckBoxDeleteInput.Checked=true then
if Form_peach.RadioGroupAction.ItemIndex<2 then
   if fun='FILEBROWSER' then
   begin
   checklistextract(nsel, strsel);
   if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
      pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
   else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletearchivesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 Form_peach.cbdeleteinputmode.Caption+' '+inttostr(nsel)+' '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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 Form_peach.labelstatus5.Caption='' then //on extractall
      begin
      s_in:=Form_peach.EditOpenIn.Text;
      s_ext := extractfileext(s_in);
      s_in := extractfilename(s_in);
      if s_ext = '.001' then s_in:=s_in+'/xxx';
      if (setsequenceerror=true) or (unit_gwrap.perrors>0) then
         pMessageErrorOk(inttostr(unit_gwrap.perrors)+' '+txt_6_5_seqerr)
      else
      if (noconfdel=1) or (pMessageWarningYesNo(txt_5_4_deletearchivesconfirm+char($0D)+char($0A)+char($0D)+char($0A)+
                 Form_peach.cbdeleteinputmode.Caption+' 1 '+
                 txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+s_in)=6) then
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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:=Form_peach.EditOpenOut.Text;
lastextractionpath:=Form_peach.EditOpenOut.Text;
Form_peach.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 checkhaltsystem_fromE;
begin
if Form_peach.CheckBoxAutoHaltE.State=cbChecked then phalstsystem_fromapp;
end;

procedure on_buttonextokclick;
begin
Form_peach.Enabled:=false;
endmultimode;
if checkfreespace<>0 then Form_peach.StringGrid2.RowCount:=1;
if Form_peach.StringGrid2.RowCount=1 then
   begin
   Form_peach.RadioGroupAction.ItemIndex:=0; on_radiogroupactionchange;
   if stayopen=false then exit_withsave
   else tobrowser_fromextractor;
   end
else
   begin
   goextract;
   Form_peach.RadioGroupAction.ItemIndex:=0; on_radiogroupactionchange;
   checkhaltsystem_fromE;
   end;
Form_peach.Enabled:=true;
end;

procedure TForm_peach.ButtonExtOkClick(Sender: TObject);
begin
on_buttonextokclick;
end;

procedure TForm_peach.Buttonfmactions1Click(Sender: TObject);
var
   p:tpoint;
begin
with form_peach 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 TForm_peach.ButtonfmactionsClick(Sender: TObject);
begin
showfmmenu(3);
end;

procedure TForm_peach.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;

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 directoryexists(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 directoryexists(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 TForm_peach.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 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 Form_peach.StringGridList.Rowcount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=Form_peach.StringGridList.Rowcount;
for i:=1 to rc-1 do
   if (Form_peach.ListView1.Items[i-1].Selected=true) and (checkimgsupported(Form_peach.StringGridList.Cells[12,i])) then
      begin
      nsel:=nsel+1;
      case nsel of
         1: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         2: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         3: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         4: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         5: strsel:=strsel+Form_peach.ListView1.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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checkimglisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   s1:=Form_peach.EditOpenIn.Text;
   k:=0;
   setlength(scheduleclip,1);
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      begin
      if Form_peach.EditOpenIn.Text<>s1 then break;
      if (Form_peach.StringGridList.Cells[16,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[12,i])) then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         for j:=0 to Form_peach.StringGridList.ColCount-1 do
            scheduleclip[k,j]:=Form_peach.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:=Form_peach.Caption;
   enter_busy_status;
   for i:=0 to k-1 do
      begin
      if endflag=true then exit;
      s:=scheduleclip[i,12];
      Form_peach.Caption:=sfun+' ('+inttostr(i+1)+'/'+inttostr(k)+') '+s;
      browser_imgrotate(s,reporig,rfun);
      Application.ProcessMessages;
      end;
   exit_busy_status;
   Form_peach.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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checkimglisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   s1:=Form_peach.EditOpenIn.Text;
   k:=0;
   setlength(scheduleclip,1);
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      begin
      if Form_peach.EditOpenIn.Text<>s1 then break;
      if (Form_peach.StringGridList.Cells[16,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[12,i])) then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         for j:=0 to Form_peach.StringGridList.ColCount-1 do
            scheduleclip[k,j]:=Form_peach.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:=Form_peach.Caption;
   enter_busy_status;
   for i:=0 to k-1 do
      begin
      if endflag=true then exit;
      s:=scheduleclip[i,12];
      Form_peach.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;
   Form_peach.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');
buttonpanel1.OKButton.Glyph:=Btestall;
buttonpanel1.CancelButton.Glyph:=Bstop;
buttonpanel1.OKButton.Caption:=txt_2_7_ok;
buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
ImageInfoArchive4.Picture.Bitmap:=Binfo;
ImageInfoArchive4.Hint:='';
if checkimglisttotsel(nsel,strsel)=0 then ImageInfoArchive4.Hint:=inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel;
if ImageInfoArchive4.Hint='' then ImageInfoArchive4.Visible:=false else ImageInfoArchive4.Visible:=true;
//set context dependent values
ComboBoxAction.ItemIndex:=simgfun;
Unit9.setformaspect('action');
if simgper=1 then CheckBoxPercent.Checked:=true else CheckBoxPercent.Checked:=false;
Unit9.setformaspect('percent');
if CheckBoxPercent.Checked=true then
   begin
   SpinEditW.Value:=simgw;
   SpinEditH.Value:=simgh;
   end
else
   begin
   SpinEditW.Value:=Unit9.origw;
   SpinEditH.Value:=Unit9.origh;
   end;
if simgasp=1 then CheckBoxAspectRatio.Checked:=true else CheckBoxAspectRatio.Checked:=false;
ComboBoxConvert.ItemIndex:=simgconv;
SpinEditJ.Value:=simgj;
Unit9.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';
unit9.origw:=simgw;
unit9.origh:=simgh;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if (Form_peach.StringGridList.Cells[16,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[12,i])) then
      if load_imagefiletopicture(apicture,Form_peach.StringGridList.Cells[12,i])=0 then
         begin
         unit9.origw:=apicture.Bitmap.Width;
         unit9.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 TForm_peach.ButtonImgResizeClick(Sender: TObject);
begin
do_resize;
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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checkimglisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then
   begin
   s1:=Form_peach.EditOpenIn.Text;
   k:=0;
   setlength(scheduleclip,1);
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      begin
      if Form_peach.EditOpenIn.Text<>s1 then break;
      if (Form_peach.StringGridList.Cells[16,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[12,i])) then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         for j:=0 to Form_peach.StringGridList.ColCount-1 do
            scheduleclip[k,j]:=Form_peach.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:=Form_peach.Caption;
   enter_busy_status;
   for i:=0 to k-1 do
      begin
      if endflag=true then exit;
      s:=scheduleclip[i,12];
      Form_peach.Caption:=sfun+' ('+inttostr(i+1)+'/'+inttostr(k)+') '+s;
      browser_imgcrop(s,reporig,ct,cb,cl,cr,percent);
      Application.ProcessMessages;
      end;
   exit_busy_status;
   Form_peach.Caption:=stitle;
   do_forcerefresh;
   setlength(scheduleclip,0);
   end;
end;

procedure prepareFormCrop;
var
   nsel:integer;
   strsel:ansistring;
begin
with FormCrop do
begin
//set text
FormCrop.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;
buttonpanel1.OKButton.Glyph:=Btestall;
buttonpanel1.CancelButton.Glyph:=Bstop;
buttonpanel1.OKButton.Caption:=txt_2_7_ok;
buttonpanel1.CancelButton.Caption:=txt_2_7_cancel;
ImageInfoArchive4.Picture.Bitmap:=Binfo;
ImageInfoArchive4.Hint:='';
if checkimglisttotsel(nsel,strsel)=0 then ImageInfoArchive4.Hint:=inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel;
if ImageInfoArchive4.Hint='' then ImageInfoArchive4.Visible:=false else ImageInfoArchive4.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 FormCrop do
begin
prepareFormCrop;
FormCrop.Showmodal;
if FormCrop.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;

procedure TForm_peach.ButtonImgCropClick(Sender: TObject);
begin
do_crop;
end;

procedure TForm_peach.ButtonImgRLClick(Sender: TObject);
begin
frombrowser_imgrotate('left');
end;

procedure TForm_peach.ButtonImgRRClick(Sender: TObject);
begin
frombrowser_imgrotate('right');
end;

procedure TForm_peach.ButtonImg6Click(Sender: TObject);
begin
showfmmenu(4);
end;

procedure TForm_peach.ButtonopenactionsClick(Sender: TObject);
var
   p:tpoint;
begin
with form_peach 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);
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;
pmtopen.popup(p.x,p.y);
end;
end;

procedure browsehistory;
var
   i,selptab:integer;
   s1,s2:ansistring;
begin
browsinghistory:=true;
with Form_peach 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 Form_peach.TabBar.Sections.Count-1 do if Form_peach.TabBar.Sections.Items[selptab].ID=atabid then break;
      if Form_peach.TabBar.Sections.Items[selptab].ID<>0 then
          begin
          Form_peach.TabBar.Sections[selptab].Text:=gettabname(Form_peach.StringGridSessionHistory.Row);
          Form_peach.TabBar.Sections[selptab].ImageIndex:=drawtabicon(Form_peach.StringGridSessionHistory.Row);
          Form_peach.StringGridTabs.Rows[atabid]:=Form_peach.StringGridSessionHistory.Rows[Form_peach.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(directoryexists((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 Form_peach.TabBar.Sections.Count-1 do if Form_peach.TabBar.Sections.Items[selptab].ID=atabid then break;
   if Form_peach.TabBar.Sections.Items[selptab].ID<>0 then
       begin
       Form_peach.TabBar.Sections[selptab].Text:=gettabname(Form_peach.StringGridSessionHistory.Row);
       Form_peach.TabBar.Sections[selptab].ImageIndex:=drawtabicon(Form_peach.StringGridSessionHistory.Row);
       Form_peach.StringGridTabs.Rows[atabid]:=Form_peach.StringGridSessionHistory.Rows[Form_peach.StringGridSessionHistory.Row];
       end;
   browsinghistory:=false;
   end;
end;

procedure navrefresh;
var
   carcpath:ansistring;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if form_peach.PanelOpen.Visible=true then{$ELSE}if form_peach.PanelOpen.Top=0 then{$ENDIF}
begin
if fun='FILEBROWSER' then
   if Form_peach.StringGridSessionHistory.RowCount>1 then
      begin
      browsehistory;
      Form_peach.ShellTreeView1.Refresh(Form_peach.ShellTreeView1.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];
         Form_peach.EditUn7zaFilter1.Caption:=carcpath+'*';
         kp_EditUn7zaFilter1_nr;
         end;
      end
   else
      begin
      if (Form_peach.EditOpenIn.Text<>txt_none) and (Form_peach.EditOpenIn.Text<>'<none>') then
      open_archive_fromname(Form_peach.EditOpenIn.Text);
      end;
end;
end;

function set_extractto_path:integer;
begin
set_extractto_path:=-1;
Form_peach.SelectDirectoryDialog1.InitialDir:=local_desktop;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      Form_peach.EditOpenOut.Text:=Form_peach.SelectDirectoryDialog1.FileName;
      if Form_peach.EditOpenOut.Text<>'' then
         if Form_peach.EditOpenOut.Text[length(Form_peach.EditOpenOut.Text)] <> directoryseparator then Form_peach.EditOpenOut.Text:=Form_peach.EditOpenOut.Text+directoryseparator;
      end
   else exit
else exit;
set_extractto_path:=0;
end;

function set_extractto_pathto(s:ansistring):integer;
begin
set_extractto_pathto:=-1;
Form_peach.EditOpenOut.Text:=s;
if Form_peach.EditOpenOut.Text<>'' then
   if Form_peach.EditOpenOut.Text[length(Form_peach.EditOpenOut.Text)] <> directoryseparator then Form_peach.EditOpenOut.Text:=Form_peach.EditOpenOut.Text+directoryseparator;
set_extractto_pathto:=0;
end;

procedure setstatus5;
begin
Form_peach.labelstatus5.Caption:='['+txt_ext_all+']';
Form_peach.CheckBoxDeleteInput.Enabled:=false;
Form_peach.cbdeleteinputmode.Enabled:=false;
Form_peach.CheckBoxDeleteInput.Hint:=txt_7_3_clickextall;
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:qword;
begin
Form_peach.labelstatus5.Caption:='';
Form_peach.CheckBoxDeleteInput.Enabled:=true;
Form_peach.cbdeleteinputmode.Enabled:=true;
Form_peach.CheckBoxDeleteInput.Hint:='';
resetminimizedlauncher;
extselall:=false;
if (Form_peach.EditOpenIn.Caption=Form_peach.EditOpenIn1.Caption) and //no display filters
   (FormAdvf.CheckBoxAdvFilters.State=cbUnchecked) then //no advanced filters
   case act of
   'selected':
      begin
      allselected:=true;
      rc:=Form_peach.StringGridList.RowCount;
      for i:=1 to rc-1 do
         if Form_peach.StringGridList.Cells[16,i]='0' then
            begin
            allselected:=false;
            Break;
            end;
      if allselected=true then
         begin
         if Form_peach.EditUn7zaFilter1.Caption='*' then act:='all'
         else act:='displayed';
         end;
      end;
   'displayed': if Form_peach.EditUn7zaFilter1.Caption='*' then act:='all';
   end;
case act of
   'multi' :
   begin
   extsel:='all';
   Form_peach.StringGrid2.popupmenu:=Form_peach.popupmenu1;
   Form_peach.StringGrid2.Hint:=txt_2_7_exthint;
   Form_peach.labelstatus2.Caption:=txt_2_7_ext;
   Form_peach.LabelStatusex2.Hint:='';
   rc:=Form_peach.StringGridList.RowCount;
   k:=Form_peach.StringGrid2.RowCount;
   for i:=1 to rc-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //files
            begin
            test_extfile(Form_peach.StringGridList.Cells[12,i],okfile);
            if okfile=true then
               begin
               if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
               Form_peach.StringGrid2.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;
                 Form_peach.StringGrid2.Cells[c,k]:=Form_peach.StringGridList.Cells[d,i];
                 end;
               Form_peach.StringGrid2.Cells[12,k]:=Form_Peach.StringGridList.Cells[3,i];
               Form_peach.StringGrid2.Cells[3,k]:=nicenumber(Form_peach.StringGrid2.Cells[12,k],filesizebase);
               if Form_peach.StringGrid2.Cells[4,k]<>'' then Form_peach.StringGrid2.Cells[4,k]:=nicenumber(Form_peach.StringGrid2.Cells[4,k],filesizebase);
               k:=k+1;
               end;
            end
         else //folders (expand recursively)
            begin
            expand(Form_peach.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;
                     Form_peach.StringGrid2.RowCount:=k+1;
                     Form_peach.StringGrid2.Cells[8,k]:=exp_files[j];
                     Form_peach.StringGrid2.Cells[1,k]:=extractfilename(exp_files[j]);
                     Form_Peach.StringGrid2.Cells[9,k]:=prefixf+Form_peach.StringGrid2.Cells[1,k];
                     Form_peach.StringGrid2.Cells[2,k]:=ExtractFileExt(exp_files[j]);
                     Form_peach.StringGrid2.Cells[3,k]:=nicenumber(inttostr(exp_fsizes[j]),filesizebase);
                     Form_peach.StringGrid2.Cells[12,k]:=inttostr(exp_fsizes[j]);
                     if testext((exp_files[j]))>=0 then
                        if (testext((exp_files[j]))>=500) and (testext((exp_files[j]))<=503) then
                           Form_Peach.StringGrid2.Cells[4,k]:='.'
                        else
                            Form_Peach.StringGrid2.Cells[4,k]:='+';
                     Form_peach.StringGrid2.Cells[5,k]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(exp_ftimes[j]));
                     Form_peach.StringGrid2.Cells[6,k]:=exp_fattr_dec[j];
                     Form_Peach.StringGrid2.Cells[10,k]:=inttostr(length(inttostr(length(Form_peach.StringGrid2.Cells[3,k]))))+inttostr(length(Form_peach.StringGrid2.Cells[3,k]))+Form_Peach.StringGrid2.Cells[3,k];
                     Form_Peach.StringGrid2.Cells[11,k]:=Form_Peach.StringGrid2.Cells[4,k];
                     k:=k+1;
                     end;
                  end;
            end;
   Form_peach.StringGrid2.RowCount:=k;
   updatecontent_ext;
   end;
   'none' :
   begin
   extsel:='all';
   Form_peach.StringGrid2.popupmenu:=Form_peach.popupmenu1;
   Form_peach.StringGrid2.Hint:=txt_2_7_exthint;
   Form_peach.labelstatus2.Caption:=txt_2_7_ext;
   Form_peach.LabelStatusex2.Hint:='';
   updatecontent_ext;
   end;
   'all' :
   begin
   extsel:=act;
   extselall:=true;
   Form_peach.StringGrid2.popupmenu:=Form_peach.popupmenu2;
   Form_peach.StringGrid2.Hint:='';
   Form_peach.labelstatus2.Caption:=txt_2_7_extfrom+' '+Form_peach.EditOpenIn.Text;
   Form_peach.LabelStatusex2.Hint:='';
   Form_peach.StringGrid2.RowCount:=1;//clean previous records
   Form_peach.StringGrid2.RowCount:=2;
   Form_peach.StringGrid2.Cells[1,1]:='('+txt_all+')';
   autosize_stringgrid2;
   updatecontent_ext;
   end;
   'displayed' :
   begin
   setstatus5;
   extsel:=act;
   Form_peach.StringGrid2.popupmenu:=Form_peach.popupmenu2;
   Form_peach.StringGrid2.Hint:='';
   Form_peach.labelstatus2.Caption:=txt_2_7_extfrom+' '+Form_peach.EditOpenIn.Text;
   Form_peach.LabelStatusex2.Hint:=txt_2_7_dirsize;
   rc:=Form_peach.StringGridList.RowCount;
   Form_peach.StringGrid2.RowCount:=rc;
   k:=1;
   for i:=1 to rc-1 do
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
      Form_peach.StringGrid2.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;
        Form_peach.StringGrid2.Cells[c,k]:=Form_peach.StringGridList.Cells[d,i];
        end;
      Form_peach.StringGrid2.Cells[12,k]:=Form_Peach.StringGridList.Cells[3,i];
      Form_peach.StringGrid2.Cells[3,k]:=nicenumber(Form_peach.StringGrid2.Cells[12,k],filesizebase);
      if Form_peach.StringGrid2.Cells[4,k]<>'' then Form_peach.StringGrid2.Cells[4,k]:=nicenumber(Form_peach.StringGrid2.Cells[4,k],filesizebase);
      k:=k+1;
      end;
   Form_peach.StringGrid2.RowCount:=k;
   updatecontent_ext;
   end;
   'selected' :
   begin
   setstatus5;
   extsel:=act;
   checksel:=false;
   Form_peach.StringGrid2.popupmenu:=Form_peach.popupmenu2;
   Form_peach.StringGrid2.Hint:='';
   Form_peach.labelstatus2.Caption:=txt_2_7_extfrom+' '+Form_peach.EditOpenIn.Text;
   Form_peach.LabelStatusex2.Hint:=txt_2_7_dirsize;
   rc:=Form_peach.StringGridList.RowCount;
   Form_peach.StringGrid2.RowCount:=rc;
   k:=1;
   for i:=1 to rc-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         Form_peach.StringGrid2.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;
            Form_peach.StringGrid2.Cells[c,k]:=Form_peach.StringGridList.Cells[d,i];
            end;
         Form_peach.StringGrid2.Cells[12,k]:=Form_Peach.StringGridList.Cells[3,i];
         Form_peach.StringGrid2.Cells[3,k]:=nicenumber(Form_peach.StringGrid2.Cells[12,k],filesizebase);
         if Form_peach.StringGrid2.Cells[4,k]<>'' then Form_peach.StringGrid2.Cells[4,k]:=nicenumber(Form_peach.StringGrid2.Cells[4,k],filesizebase);
         k:=k+1;
         checksel:=true;
         end;
   Form_peach.StringGrid2.RowCount:=k;
   updatecontent_ext;
   if checksel=false then exit;
   end;
   end;
if Form_peach.StringGrid2.RowCount>1 then
   begin
   Form_peach.StringGrid2.Cells[11,1]:='1';
   Form_peach.StringGrid2.Row:=1;
   end;
if modeofuse='full' then showpanel('extract');
end;

procedure do_extract;
begin
{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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 Form_peach.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 TForm_peach.ButtonUn7zaToClick(Sender: TObject);
begin
do_extract;
end;

procedure TForm_peach.cbTypeChange(Sender: TObject);
begin
on_cbtypechange;
end;

procedure TForm_peach.ComboBox7zalgoChange(Sender: TObject);
begin
on_combobox7zalgochange;
end;

procedure TForm_peach.ComboBoxArchiveCustom1Change(Sender: TObject);
begin
customsyntax1:=ComboBoxArchiveCustom1.ItemIndex;
updateconf_modified;
end;

procedure TForm_peach.ComboBoxArchiveCustomChange(Sender: TObject);
begin
on_ComboBoxArchiveCustomChange;
end;

procedure TForm_peach.ComboBoxOverwriteARCChange(Sender: TObject);
begin
on_ComboBoxOverwriteARCChange;
end;

procedure TForm_peach.ComboBoxOverwriteChange(Sender: TObject);
begin
on_ComboBoxOverwriteChange;
end;

procedure TForm_peach.ComboBoxPassesChange(Sender: TObject);
begin
on_ComboBoxPassesChange;
end;

procedure TForm_peach.ImagePassword2Click(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
end;

procedure toggle_view;
begin
if browserbusy=true then exit;
Form_peach.EditOpenIn1.Caption:=Form_peach.EditOpenIn.Caption;
if fun='UN7Z' then
   if status0=txt_list_browsing then
      begin
      if nitems>64*1024 then
         if pMessageWarningYesNo(txt_8_1_togglearc)=6 then listun7z_expandall
         else
      else
         listun7z_expandall;
      end
   else list_root;
if fun='FILEBROWSER' then
   begin
   if Form_peach.EditOpenIn.Text=txt_mypc then exit;
   if status0=txt_list_browsing then
         if pMessageWarningYesNo(txt_toggle_warning)=6 then
            begin
            Form_peach.EditUn7zaFilter.Text:='*';
            listdir(Form_peach.EditOpenIn.Text,true,false);
            end
         else
   else
      begin
      Form_peach.EditUn7zaFilter.Text:='*';
      listdir(Form_peach.EditOpenIn.Text,false,false);
      end;
   addtohistory;
   end;
end;

procedure openpathp(p:AnsiString);
var
   s:ansistring;
begin
fun:='FILEBROWSER';
fun_status:=fun;
Form_peach.SelectDirectoryDialog1.InitialDir:=p;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      Form_peach.EditOpenIn.Text:=Form_peach.SelectDirectoryDialog1.FileName
   else exit
else exit;
s:=Form_peach.EditOpenIn.Text;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
Form_peach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure openpath;
var
   p:ansistring;
begin
if fileexists((Form_peach.EditOpenIn.Text)) then p:=extractfilepath(Form_peach.EditOpenIn.Text)
else p:=Form_peach.EditOpenIn.Text;
openpathp(p);
end;

procedure opendevice(s:ansistring);
var
   s1:ansistring;
begin
fun:='FILEBROWSER';
fun_status:=fun;
Form_peach.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>=Form_peach.StringGridBookmarks.Rowcount then exit;
s:=Form_peach.StringGridBookmarks.Cells[2,i];
if s='' then exit;
fun:='FILEBROWSER';
fun_status:=fun;
Form_peach.EditUn7zaFilter.Text:=Form_peach.StringGridBookmarks.Cells[4,i];
if savehistory=1 then
   begin
   Form_peach.StringGridBookmarks.Cells[8,i]:=FormatDateTime('yyyy-mm-dd hh:mm:ss',now);
   try
   Form_peach.StringGridBookmarks.Cells[7,i]:=inttostr(strtoint(Form_peach.StringGridBookmarks.Cells[7,i])+1);
   except
   Form_peach.StringGridBookmarks.Cells[7,i]:='1';
   end;
   Form_peach.StringGridBookmarks.Cells[10,i]:=inttostr(length(Form_peach.StringGridBookmarks.Cells[7,i]))+Form_peach.StringGridBookmarks.Cells[7,i];
   end
else
   begin
   Form_peach.StringGridBookmarks.Cells[7,i]:='';
   Form_peach.StringGridBookmarks.Cells[8,i]:='';
   Form_peach.StringGridBookmarks.Cells[10,i]:='';
   end;
Form_peach.StringGridBookmarks.AutoSizeColumns;
Form_peach.StringGridBookmarks.ColWidths[10]:=0;
Form_peach.StringGridBookmarks.ColWidths[11]:=0;
Form_peach.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 (directoryexists(s)=true) then
      begin
      if Form_peach.StringGridBookmarks.Cells[1,i]=txt_list_browsing then listdir(s,false,false)
      else listdir(s,true,false);
      addtohistory;
      status0:=Form_peach.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
         Form_peach.EditUn7zaFilter.Text:=Form_peach.StringGridBookmarks.Cells[4,i];
         if Form_peach.StringGridBookmarks.Cells[1,i]=txt_list_browsing then
            begin
            Form_peach.EditUn7zaFilterExclude.Text:=extractfilepath(Form_peach.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 Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
//preliminar tests
case jumpdest of
   'bookmark1': if Form_peach.StringGridBookmarks.Rowcount<2 then exit;
   'bookmark2': if Form_peach.StringGridBookmarks.Rowcount<3 then exit;
   'bookmark3': if Form_peach.StringGridBookmarks.Rowcount<4 then exit;
   'mostrecent': if Form_peach.mRecent1.Caption='' then exit;
   'mostrecent2': if Form_peach.mRecent2.Caption='' then exit;
   'mostrecent3': if Form_peach.mRecent3.Caption='' then exit;
   end;
fun:='FILEBROWSER';
fun_status:=fun;
case jumpdest of
   'root':
   begin
   {$IFDEF MSWINDOWS}
   listpc;
   {$ELSE}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'media':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/media/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'mnt':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/mnt/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'run/media':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/run/media/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'var/run/media':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/var/run/media/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'Volumes':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/Volumes/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'Applications':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/Applications/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'System Applications':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/System/Applications/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'Mobile Documents':
   begin
   {$IFNDEF MSWINDOWS}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=home_path+'Library/Mobile Documents/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   end;
   'dropbox':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=shared_dropbox;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'myboxfiles':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=shared_myboxfiles;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'googledrive':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=shared_googledrive;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'onedrive':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=shared_onedrive;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'sharepoint':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=shared_skydrive;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'yandexdisk':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=shared_ubuntuone;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'home':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=extractfilepath(home_path);
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'desktop':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=local_desktop;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'users':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=users_root;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrdocuments':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_documents;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrmusic':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_music;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrpictures':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_pictures;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'usrvideos':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_videos;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
  'publicdocuments':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=public_documents;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'publichome':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=public_home;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'sysrecent':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_recent;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'sysdownloads':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_downloads;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'syssearches':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_searches;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'syslibraries':
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   s:=usr_libraries;
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   end;
   'bookmark1': browsebookmark(1);
   'bookmark2': browsebookmark(2);
   'bookmark3': browsebookmark(3);
   'mostrecent': open_archive_fromname(Form_peach.mRecent1.Caption);
   'mostrecent2': open_archive_fromname(Form_peach.mRecent2.Caption);
   'mostrecent3': open_archive_fromname(Form_peach.mRecent3.Caption);
   end;
addtohistory;
end;

procedure TForm_peach.LabelAppPathClick(Sender: TObject);
begin
cp_open(executable_path,desk_env);
end;

procedure TForm_peach.Labelcb17Click(Sender: TObject);
begin
cp_open(EditDesk.Text,desk_env);
end;

procedure TForm_peach.Labelcb7Click(Sender: TObject);
begin
if pMessageInfoYesNo(txt_3_6_resetapps)=6 then
   begin
   reset_custedit;
   set_adveditcl(StringGridCustedit1.Row);
   set_custedit_fromtable;
   set_custedit_menus;
   save_custedit;
   end;
end;

procedure TForm_peach.LabelClickAdArchive1Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[1]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive1MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive1.Caption<>'' then PanelLCAa1.Brush.Color:=abactivecol;
PanelLCAa1.Pen.Color:=PanelLCAa1.Brush.Color;
bctemp:=8;
end;

procedure TForm_peach.LabelClickAdArchive1MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive1.Caption<>'' then PanelLCAa1.Brush.Color:=abarchivecol;
PanelLCAa1.Pen.Color:=PanelLCAa1.Brush.Color;
end;

procedure TForm_peach.LabelClickAdArchive2Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[2]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive2MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive2.Caption<>'' then PanelLCAa2.Brush.Color:=abactivecol;
PanelLCAa2.Pen.Color:=PanelLCAa2.Brush.Color;
bctemp:=8;
end;

procedure TForm_peach.LabelClickAdArchive2MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive2.Caption<>'' then PanelLCAa2.Brush.Color:=abarchivecol;
PanelLCAa2.Pen.Color:=PanelLCAa2.Brush.Color;
end;

procedure TForm_peach.LabelClickAdArchive3Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[3]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive3MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive3.Caption<>'' then PanelLCAa3.Brush.Color:=abactivecol;
PanelLCAa3.Pen.Color:=PanelLCAa3.Brush.Color;
bctemp:=8;
end;

procedure TForm_peach.LabelClickAdArchive3MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive3.Caption<>'' then PanelLCAa3.Brush.Color:=abarchivecol;
PanelLCAa3.Pen.Color:=PanelLCAa3.Brush.Color;
end;

procedure TForm_peach.LabelClickAdArchive4Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[4]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive4MouseEnter(Sender: TObject);
begin
if LabelClickAdArchive4.Caption<>'' then PanelLCAa4.Brush.Color:=abactivecol;
PanelLCAa4.Pen.Color:=PanelLCAa4.Brush.Color;
bctemp:=8;
end;

procedure TForm_peach.LabelClickAdArchive4MouseLeave(Sender: TObject);
begin
if LabelClickAdArchive4.Caption<>'' then PanelLCAa4.Brush.Color:=abarchivecol;
PanelLCAa4.Pen.Color:=PanelLCAa4.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress1Click(Sender: TObject);
begin
if LabelClickAddress1.Caption=' '+txt_mypc+' ' then jumpto('root')
else browsefiledir(pmbc8.caption);
end;

procedure TForm_peach.LabelClickAddress1MouseEnter(Sender: TObject);
begin
PanelLCA1.Brush.Color:=abactivecol;
PanelLCA1.Pen.Color:=PanelLCA1.Brush.Color;
bctemp:=1;
end;

procedure TForm_peach.LabelClickAddress1MouseLeave(Sender: TObject);
begin
PanelLCA1.Brush.Color:=Panelclickaddress.Color;
PanelLCA1.Pen.Color:=PanelLCA1.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress2Click(Sender: TObject);
begin
browsefiledir(pmbc7.caption);
end;

procedure TForm_peach.LabelClickAddress2MouseEnter(Sender: TObject);
begin
PanelLCA2.Brush.Color:=abactivecol;
PanelLCA2.Pen.Color:=PanelLCA2.Brush.Color;
bctemp:=2;
end;

procedure TForm_peach.LabelClickAddress2MouseLeave(Sender: TObject);
begin
PanelLCA2.Brush.Color:=Panelclickaddress.Color;
PanelLCA2.Pen.Color:=PanelLCA2.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress3Click(Sender: TObject);
begin
browsefiledir(pmbc6.caption);
end;

procedure TForm_peach.LabelClickAddress3MouseEnter(Sender: TObject);
begin
PanelLCA3.Brush.Color:=abactivecol;
PanelLCA3.Pen.Color:=PanelLCA3.Brush.Color;
bctemp:=3;
end;

procedure TForm_peach.LabelClickAddress3MouseLeave(Sender: TObject);
begin
PanelLCA3.Brush.Color:=Panelclickaddress.Color;
PanelLCA3.Pen.Color:=PanelLCA3.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress4Click(Sender: TObject);
begin
browsefiledir(pmbc5.caption);
end;

procedure TForm_peach.LabelClickAddress4MouseEnter(Sender: TObject);
begin
PanelLCA4.Brush.Color:=abactivecol;
PanelLCA4.Pen.Color:=PanelLCA4.Brush.Color;
bctemp:=4;
end;

procedure TForm_peach.LabelClickAddress4MouseLeave(Sender: TObject);
begin
PanelLCA4.Brush.Color:=Panelclickaddress.Color;
PanelLCA4.Pen.Color:=PanelLCA4.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress5Click(Sender: TObject);
begin
browsefiledir(pmbc4.caption);
end;

procedure TForm_peach.LabelClickAddress5MouseEnter(Sender: TObject);
begin
PanelLCA5.Brush.Color:=abactivecol;
PanelLCA5.Pen.Color:=PanelLCA5.Brush.Color;
bctemp:=5;
end;

procedure TForm_peach.LabelClickAddress5MouseLeave(Sender: TObject);
begin
PanelLCA5.Brush.Color:=Panelclickaddress.Color;
PanelLCA5.Pen.Color:=PanelLCA5.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress6Click(Sender: TObject);
begin
browsefiledir(pmbc3.caption);
end;

procedure TForm_peach.LabelClickAddress6MouseEnter(Sender: TObject);
begin
PanelLCA6.Brush.Color:=abactivecol;
PanelLCA6.Pen.Color:=PanelLCA6.Brush.Color;
bctemp:=6;
end;

procedure TForm_peach.LabelClickAddress6MouseLeave(Sender: TObject);
begin
PanelLCA6.Brush.Color:=Panelclickaddress.Color;
PanelLCA6.Pen.Color:=PanelLCA6.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress7Click(Sender: TObject);
begin
browsefiledir(pmbc2.caption);
end;

procedure TForm_peach.LabelClickAddress7MouseEnter(Sender: TObject);
begin
PanelLCA7.Brush.Color:=abactivecol;
PanelLCA7.Pen.Color:=PanelLCA7.Brush.Color;
bctemp:=7;
end;

procedure TForm_peach.LabelClickAddress7MouseLeave(Sender: TObject);
begin
PanelLCA7.Brush.Color:=Panelclickaddress.Color;
PanelLCA7.Pen.Color:=PanelLCA7.Brush.Color;
end;

procedure TForm_peach.LabelClickAddress8Click(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   begin
   EditUn7zaFilter1.Caption:='*';
   kp_EditUn7zaFilter1_nr;
   end
else
   browsefiledir(pmbc1.caption);
end;

procedure TForm_peach.LabelClickAddress8MouseEnter(Sender: TObject);
begin
PanelLCA8.Brush.Color:=abactivecol;
PanelLCA8.Pen.Color:=PanelLCA8.Brush.Color;
bctemp:=8;
end;

procedure TForm_peach.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 TForm_peach.LabelConf1Click(Sender: TObject);
begin
cp_open(LabelConf.Caption,desk_env);
end;

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

procedure TForm_peach.LabelConfigurePeaZipClick(Sender: TObject);
begin
configure_systemintegration(true);
restartpeaapp;
exit_nosave;
end;

procedure TForm_peach.LabelConfigureSendToClick(Sender: TObject);
begin
cp_open(usr_sendto,desk_env);
end;

procedure TForm_peach.LabelLang2Click(Sender: TObject);
begin
changelanguage;
end;

procedure TForm_peach.LabelLang4Click(Sender: TObject);
begin
pMessageInfoOK(txt_5_3_cmlmessage);
cp_open(sharepath+'lang-wincontext'+directoryseparator,desk_env);
end;

procedure TForm_peach.LabelPanelHintAddMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintadd;
end;

procedure TForm_peach.LabelPanelHintExtractMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintextract;
end;

procedure TForm_peach.LabelResetAppClick(Sender: TObject);
begin
if pMessageInfoYesNo(txt_3_6_resetapps)=6 then
   begin
   reset_custedit;
   set_adveditcl(StringGridCustedit1.Row);
   set_custedit_fromtable;
   set_custedit_menus;
   save_custedit;
   end;
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');
   Form_peach.StringGridBookmarks.RowCount:=1;
   restartpeaapp;
   case rmode of
      'reset': begin autobookmarks; exit_nosave; end;
      'delete': exit_withsave;
      end;
   end;
end;

procedure TForm_peach.LabelResetBookmarksClick(Sender: TObject);
begin
resetbookmarks('reset');
end;

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

procedure TForm_peach.LabelResetHistoryClick(Sender: TObject);
begin
dohistoryreset;
end;

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

procedure TForm_peach.LabelResetPMClick(Sender: TObject);
begin
resetpmmain;
end;

procedure TForm_peach.LabelResetPtmpClick(Sender: TObject);
begin
reset_temp(1);
end;

procedure TForm_peach.LabelStatus5Click(Sender: TObject);
var stitlestring:ansistring;
begin
stitlestring:=titlestring;
list_toextractor('all','full');
titlestring:=stitlestring;
end;

procedure TForm_peach.LabelTitleAdd1Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd1,ShapeTitleAddb1);
end;

procedure TForm_peach.LabelTitleAdd1MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd1,ShapeTitleAddb1);
end;

procedure TForm_peach.LabelTitleAdd1MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd1,ShapeTitleAddb1);
end;

procedure TForm_peach.LabelTitleAdd2Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd2,ShapeTitleAddb2);
end;

procedure TForm_peach.LabelTitleAdd2MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd2,ShapeTitleAddb2);
end;

procedure TForm_peach.LabelTitleAdd2MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd2,ShapeTitleAddb2);
end;

procedure TForm_peach.LabelTitleAdd3Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd3,ShapeTitleAddb3);
end;

procedure TForm_peach.LabelTitleAdd3MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd3,ShapeTitleAddb3);
end;

procedure TForm_peach.LabelTitleAdd3MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd3,ShapeTitleAddb3);
end;

procedure TForm_peach.LabelTitleAdd4Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd4,ShapeTitleAddb4);
end;

procedure TForm_peach.LabelTitleAdd4MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd4,ShapeTitleAddb4);
end;

procedure TForm_peach.LabelTitleAdd4MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd4,ShapeTitleAddb4);
end;

procedure TForm_peach.LabelTitleApps1Click(Sender: TObject);
begin
clicklabel_apps(LabelTitleApps1,ShapeTitleAppsb1);
end;

procedure TForm_peach.LabelTitleApps1MouseEnter(Sender: TObject);
begin
enterlabel_apps(LabelTitleApps1,ShapeTitleAppsb1);
end;

procedure TForm_peach.LabelTitleApps1MouseLeave(Sender: TObject);
begin
exitlabel_apps(LabelTitleApps1,ShapeTitleAppsb1);
end;

procedure TForm_peach.LabelTitleApps2Click(Sender: TObject);
begin
clicklabel_apps(LabelTitleApps2,ShapeTitleAppsb2);
end;

procedure TForm_peach.LabelTitleApps2MouseEnter(Sender: TObject);
begin
enterlabel_apps(LabelTitleApps2,ShapeTitleAppsb2);
end;

procedure TForm_peach.LabelTitleApps2MouseLeave(Sender: TObject);
begin
exitlabel_apps(LabelTitleApps2,ShapeTitleAppsb2);
end;

procedure TForm_peach.LabelTitleExtract1Click(Sender: TObject);
begin
if work_dir=5 then Form_peach.CheckBoxrelative.enabled:=false
else CheckBoxrelative.enabled:=true;
clicklabel_extract(LabelTitleExtract1,ShapeTitleExtractb1);
end;

procedure TForm_peach.LabelTitleExtract1MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract1,ShapeTitleExtractb1);
end;

procedure TForm_peach.LabelTitleExtract1MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract1,ShapeTitleExtractb1);
end;

procedure TForm_peach.LabelTitleExtract2Click(Sender: TObject);
begin
clicklabel_extract(LabelTitleExtract2,ShapeTitleExtractb2);
end;

procedure TForm_peach.LabelTitleExtract2MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract2,ShapeTitleExtractb2);
end;

procedure TForm_peach.LabelTitleExtract2MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract2,ShapeTitleExtractb2);
end;

procedure TForm_peach.LabelTitleExtract3Click(Sender: TObject);
begin
if disableintscript=1 then CheckBoxrelative.enabled:=false;
clicklabel_extract(LabelTitleExtract3,ShapeTitleExtractb3);
end;

procedure TForm_peach.LabelTitleExtract3MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract3,ShapeTitleExtractb3);
end;

procedure TForm_peach.LabelTitleExtract3MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract3,ShapeTitleExtractb3);
end;

procedure TForm_peach.LabelTitleExtract4Click(Sender: TObject);
begin
clicklabel_extract(LabelTitleExtract4,ShapeTitleExtractb4);
end;

procedure TForm_peach.LabelTitleExtract4MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract4,ShapeTitleExtractb4);
end;

procedure TForm_peach.LabelTitleExtract4MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract4,ShapeTitleExtractb4);
end;

procedure TForm_peach.LabelTitleOptions1Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions1, BevelTitleOptions1);
end;

procedure TForm_peach.LabelTitleOptions1MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions1, BevelTitleOptions1);
end;

procedure TForm_peach.LabelTitleOptions1MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions1, BevelTitleOptions1);
end;

procedure TForm_peach.LabelTitleOptions3Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions3, BevelTitleOptions3);
end;

procedure TForm_peach.LabelTitleOptions3MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions3, BevelTitleOptions3);
end;

procedure TForm_peach.LabelTitleOptions3MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions3, BevelTitleOptions3);
end;

procedure TForm_peach.LabelTitleOptions4Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions4, BevelTitleOptions4);
end;

procedure TForm_peach.LabelTitleOptions4MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions4, BevelTitleOptions4);
end;

procedure TForm_peach.LabelTitleOptions4MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions4, BevelTitleOptions4);
end;

procedure TForm_peach.LabelTitleOptions5Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions5, BevelTitleOptions5);
end;

procedure TForm_peach.LabelTitleOptions5MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions5, BevelTitleOptions5);
end;

procedure TForm_peach.LabelTitleOptions5MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions5, BevelTitleOptions5);
end;

procedure TForm_peach.LabelTitleOptions6Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions6, BevelTitleOptions6);
end;

procedure TForm_peach.LabelTitleOptions6MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions6, BevelTitleOptions6);
end;

procedure TForm_peach.LabelTitleOptions6MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions6, BevelTitleOptions6);
end;

procedure TForm_peach.LabelTitleOptions7Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions7, BevelTitleOptions7);
end;

procedure TForm_peach.LabelTitleOptions7MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions7, BevelTitleOptions7);
end;

procedure TForm_peach.LabelTitleOptions7MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions7, BevelTitleOptions7);
end;

procedure TForm_peach.LabelTitleOptions8Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions8, BevelTitleOptions8);
end;

procedure TForm_peach.LabelTitleOptions8MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions8, BevelTitleOptions8);
end;

procedure TForm_peach.LabelTitleOptions8MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions8, BevelTitleOptions8);
end;

procedure TForm_peach.ListView1ColumnClick(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 az=true then sort_za_stringgridlist(c)
      else sort_az_stringgridlist(c)
   else sort_az_stringgridlist(c);
   listsortcol:=c;
   update_listview;
   if fun='UN7Z' then generate_archive_breadcrumb;
end;

procedure TForm_peach.mAboutClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions8, BevelTitleOptions8);
end;

///tab controls

function gettabname(nrow:integer):ansistring;
var
   s:ansistring;
begin
with Form_peach 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 sortplustab;
var
   i:integer;
begin
with Form_peach 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 Form_peach do
begin
if TabBar.Sections.Count>256 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(Form_peach.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(Form_peach.StringGridSessionHistory.Row);
   StringGridTabs.RowCount:=StringGridTabs.RowCount+1;
   StringGridTabs.Rows[StringGridTabs.RowCount-1]:=StringGridSessionHistory.Rows[StringGridSessionHistory.Row];
   end
end;
end;

procedure TForm_peach.pmtabsnewClick(Sender: TObject);
begin
addptab;
sortplustab;
end;

procedure settabbar(i:integer);
begin
ptabbar:=i;
case i of
   0: begin
      Form_peach.mtoggletabbar.Caption:='─';
      Form_peach.PanelTabBar.height:=0;
      Form_peach.PanelTabBar.visible:=false;
      Form_peach.mtabs.Checked:=false;
      Form_peach.pmhtabs.Checked:=false;
      Form_peach.pmtabsm.Checked:=false;
      Form_peach.pmtab.Checked:=false;
      Form_peach.mtab.Checked:=false;
      end;
   1: begin
      Form_peach.mtoggletabbar.Caption:='─';
      Form_peach.PanelTabBar.height:=tabheight-4;
      Form_peach.PanelTabBar.visible:=true;
      Form_peach.mtabs.Checked:=true;
      Form_peach.pmhtabs.Checked:=true;
      Form_peach.pmtabsm.Checked:=true;
      Form_peach.pmtab.Checked:=true;
      Form_peach.mtab.Checked:=true;
      if Form_peach.TabBar.Sections.Count=1 then
         begin
         ptabid:=atabid;
         addptab;
         sortplustab;
         end;
      end;
   end;
end;

procedure do_closetab;
var
   i:integer;
begin
with Form_peach 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;
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 TForm_peach.pmtabscloseClick(Sender: TObject);
begin
do_closetab;
end;

procedure closeallothertabs;
var
   i:integer;
begin
with Form_peach 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 TForm_peach.pmtabscloseotherClick(Sender: TObject);
begin
closeallothertabs;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.pmtabsbookmarkorgClick(Sender: TObject);
begin
 do_organizebookmarks;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.TabBarMouseEnter(Sender: TObject);
begin
TabBar.Cursor:=crDefault;
end;

procedure TForm_peach.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 TForm_peach.TabBarSectionEndDrag(Sender: TObject);
begin
sortplustab;
end;

///end tab controls

procedure savecolreport(reptype:ansistring);
var
x,y:dword;
field_delim:string;
p,s:ansistring;
begin
if reptype='txt' then field_delim:=chr($09) //tab separated TXT
else field_delim:=Form_peach.EditCSVsep.Caption;
p:=local_desktop;
if p<>'' then
   if p[length(p)]<>directoryseparator then p:=p+directoryseparator;
if fun='FILEBROWSER' then s:=Form_peach.Caption
else s:=extractfilename(Form_peach.EditOpenIn.Text);
if s<>'' then
   if s[length(s)]=' ' then SetLength(s,length(s)-1);
if reptype='txt' then s:=s+'.txt'
else s:=s+'.csv';
Form_peach.SaveDialogPJ.FileName:=p+s;
if directoryexists(p) then Form_peach.SaveDialogPJ.InitialDir:=p;
if Form_peach.SaveDialogPJ.Execute then
begin
s:=Form_peach.SaveDialogPJ.FileName;
assignfile(t,s);
rewrite(t);
write_header(t);
for x:=1 to Form_peach.StringGridList.RowCount-1 do
   begin
   for y:=1 to 8 do
      write(t,Form_peach.StringGridList.Cells[y,x]+field_delim);
   writeln(t);
   end;
closefile(t);
end;
end;

procedure TForm_peach.MenuItemOpen_saveastxtClick(Sender: TObject);
begin
savecolreport('txt');
end;

procedure TForm_peach.mextractClick(Sender: TObject);
begin
do_extract;
end;

procedure TForm_peach.maddconvertClick(Sender: TObject);
begin
archive_convert;
end;

procedure TForm_peach.maddexistingClick(Sender: TObject);
begin
if open_archive<>1 then exit;
do_add;
end;

procedure TForm_peach.mlayoutsClick(Sender: TObject);
begin
if not(directoryexists(confpath+'Layouts'+DirectorySeparator)) then mkdir(confpath+'Layouts'+DirectorySeparator);
cp_open(confpath+'Layouts'+DirectorySeparator,desk_env);
end;

procedure TForm_peach.morgbookmarksClick(Sender: TObject);
begin
if stringgridbookmarks.visible=false then showbar('bookmarks') else showbar('statusbar');
end;

procedure TForm_peach.morghistoryClick(Sender: TObject);
begin
if stringgridrecent.visible=false then showbar('recent') else showbar('statusbar');
end;

procedure TForm_peach.morgsessionhistoryClick(Sender: TObject);
begin
if stringgridsessionhistory.visible=false then showbar('sessionrecent') else showbar('statusbar');
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 Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then
   begin
   sg:=Form_peach.StringGrid1;
   sr:=Form_peach.StringGrid1.Row;
   rc:=Form_peach.StringGrid1.RowCount;
   wsel:=11;
   wa:=7;
   wd:=6;
   wsz:=3;
   wpsz:=1;//not supported
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
   begin
   sg:=Form_peach.StringGrid2;
   sr:=Form_peach.StringGrid2.Row;
   rc:=Form_peach.StringGrid2.RowCount;
   wsel:=11;
   wa:=7;
   wd:=6;
   wsz:=3;
   wpsz:=1;//not supported
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.Top=0{$ENDIF} then
   begin
   if Form_peach.LabelClickAddress1.Caption=' '+txt_mypc+' ' then exit;
   if Form_peach.ListView1.Visible=false then exit;
   sg:=Form_peach.StringGridList;
   sr:=Form_peach.StringGridList.Row;
   rc:=Form_peach.StringGridList.Rowcount;
   wsel:=16;
   wa:=10;
   wd:=5;
   wsz:=3;
   wpsz:=4;
   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 Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.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 Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.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 Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.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 Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.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 Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.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 Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.Top=0{$ENDIF} then update_listview_sel
else sg.Repaint;
end;

procedure TForm_peach.mCharCaseClick(Sender: TObject);
begin
select_by('charcase','neutralsel');
end;

procedure TForm_peach.mCharClick(Sender: TObject);
begin
select_by('char','neutralsel');
end;

procedure TForm_peach.mDateMonthClick(Sender: TObject);
begin
select_by('datemonth','neutralsel');
end;

procedure TForm_peach.mDateDayClick(Sender: TObject);
begin
select_by('dateday','neutralsel');
end;

procedure TForm_peach.mDateHourClick(Sender: TObject);
begin
select_by('datehour','neutralsel');
end;

procedure TForm_peach.mDateWeekClick(Sender: TObject);
begin
select_by('dateweek','neutralsel');
end;

procedure TForm_peach.mDateYearClick(Sender: TObject);
begin
select_by('dateyear','neutralsel');
end;

procedure TForm_peach.mpacked100kClick(Sender: TObject);
begin
select_by('packed100k','neutralsel');
end;

procedure TForm_peach.mpacked100mClick(Sender: TObject);
begin
select_by('packed100m','neutralsel');
end;

procedure TForm_peach.mpacked10mClick(Sender: TObject);
begin
select_by('packed10m','neutralsel');
end;

procedure TForm_peach.mpackedemptyClick(Sender: TObject);
begin
select_by('packedempty','neutralsel');
end;

procedure TForm_peach.mpackedoverClick(Sender: TObject);
begin
select_by('packedover','neutralsel');
end;

procedure TForm_peach.mpackedsimilar50Click(Sender: TObject);
begin
select_by('packedsimilar50','neutralsel');
end;

procedure TForm_peach.mpackedsimilarClick(Sender: TObject);
begin
select_by('packedsimilar10','neutralsel');
end;

procedure setaddressbar(i:integer);
begin
addressbar:=i;
case i of
   0: begin
      Form_peach.PanelListBar.Height:=0;
      end;
   1: begin
      Form_peach.PanelListBar.Height:=barheight;
      end;
   end;
end;

procedure TForm_peach.mAdminClick(Sender: TObject);
var
   w:widestring;
begin
{$IFDEF MSWINDOWS}
w:=utf8decode('"'+executable_path+'peazip.exe"');
ShellExecuteW(Form_peach.Handle, PWideChar ('runas'), PWideChar(w), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
exit_withsave;
{$ENDIF}
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 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 Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.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;
Form_peach.cbadvf1.state:=FormAdvf.CheckBoxAdvFilters.State;
Form_peach.cbadvf2.state:=FormAdvf.CheckBoxAdvFilters.State;
end;

procedure TForm_peach.cbadvf1Click(Sender: TObject);
begin
try
if Form_peach.cbadvf1.state=cbchecked then
   begin
   set_advfilters;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   setfiltericon(false);
   Form_peach.cbadvf2.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure TForm_peach.cbadvf2Click(Sender: TObject);
begin
try
if Form_peach.cbadvf2.state=cbchecked then
   begin
   set_advfilters;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   setfiltericon(false);
   Form_peach.cbadvf1.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure TForm_peach.cbautoclosesingleextractClick(Sender: TObject);
begin
on_cbautoclosesingleextract_click;
end;

procedure TForm_peach.cbcustextClick(Sender: TObject);
begin
if Form_peach.cbcustext.State=cbChecked then repcustext:=1 else repcustext:=0;
end;

procedure TForm_peach.cbdefaultactionChange(Sender: TObject);
begin
on_cbdefaultactionchange;
end;

procedure TForm_peach.cbdeleteinputmode1Change(Sender: TObject);
begin
on_cbdeleteinputmode1Change;
end;

procedure TForm_peach.cbdeleteinputmodeChange(Sender: TObject);
begin
on_cbdeleteinputmodeChange;
end;

procedure TForm_peach.cbencextClick(Sender: TObject);
begin
if Form_peach.cbencext.State=cbChecked then addencext:=1 else addencext:=0;
end;

procedure TForm_peach.cbEncoding1Change(Sender: TObject);
begin
on_CBEncoding1Change;
end;

procedure TForm_peach.cbensmallChange(Sender: TObject);
begin
ensmall:=cbensmall.ItemIndex;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TForm_peach.cbRAR5Click(Sender: TObject);
begin
if Form_peach.cbRAR5.State=cbChecked then
   begin
   userar5:=1;
   Form_peach.cbRARBLAKE2.enabled:=true;
   Form_peach.labelRARdict.enabled:=true;
   Form_peach.comboRARdict.enabled:=true;
   end
else
   begin
   userar5:=0;
   Form_peach.cbRARBLAKE2.enabled:=false;
   Form_peach.labelRARdict.enabled:=false;
   Form_peach.comboRARdict.enabled:=false;
   end;
end;

procedure TForm_peach.cbRARmanualClick(Sender: TObject);
begin
if Form_peach.cbRARmanual.State=cbChecked then setrarmanual:=1 else setrarmanual:=0;
if setrarmanual=1 then ButtonEditNameCustomClick(nil);
testwinrar;
end;

procedure TForm_peach.cbRARBLAKE2Click(Sender: TObject);
begin
if Form_peach.cbRARBLAKE2.State=cbChecked then userarblake2:=1 else userarblake2:=0;
end;

procedure TForm_peach.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;
   Form_peach.EditOPcustom.Caption:='';
   end;
Form_peach.cbRAR5Click(nil);
end;

procedure TForm_peach.cbRARlastmodtimeChange(Sender: TObject);
begin
if cbRARlastmodtime.ItemIndex>=0 then userarlastmodtime:=cbRARlastmodtime.ItemIndex
else userarlastmodtime:=0;
end;

procedure TForm_peach.cbRARlockClick(Sender: TObject);
begin
if Form_peach.cbRARlock.State=cbChecked then userarlock:=1 else userarlock:=0;
end;

procedure TForm_peach.cbRARrrClick(Sender: TObject);
begin
if Form_peach.cbRARrr.State=cbChecked then userarrr:=1 else userarrr:=0;
end;

procedure TForm_peach.cbRARsaveopenClick(Sender: TObject);
begin
if Form_peach.cbRARsaveopen.State=cbChecked then userarsaveopen:=1 else userarsaveopen:=0;
end;

procedure TForm_peach.cbRARsavesecurityClick(Sender: TObject);
begin
if Form_peach.cbRARsavesecurity.State=cbChecked then userarsavesecurity:=1 else userarsavesecurity:=0;
end;

procedure TForm_peach.cbRARsavestreamsClick(Sender: TObject);
begin
if Form_peach.cbRARsavestreams.State=cbChecked then userarsavestreams:=1 else userarsavestreams:=0;
end;

procedure TForm_peach.cbRARsfxClick(Sender: TObject);
begin
if Form_peach.cbRARsfx.State=cbChecked then userarsfx:=1 else userarsfx:=0;
end;

procedure TForm_peach.cbRARsolidClick(Sender: TObject);
begin
if Form_peach.cbRARsolid.State=cbChecked then userarsolid:=1 else userarsolid:=0;
end;

procedure TForm_peach.cbtreeChange(Sender: TObject);
begin
on_cbtreechange;
end;

procedure TForm_peach.cbspacingChange(Sender: TObject);
begin
case cbspacing.ItemIndex of
   0: pspacing:=4;
   1: pspacing:=8;
   2: pspacing:=12;
   3: pspacing:=16;
   end;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TForm_peach.cbzoomingChange(Sender: TObject);
begin
case cbzooming.ItemIndex of
   0: pzooming:=50;
   1: pzooming:=67;
   2: pzooming:=80;
   3: pzooming:=87;
   5: pzooming:=115;
   6: pzooming:=125;
   7: pzooming:=150;
   8: pzooming:=200
   else pzooming:=100;
   end;
if openstarted=true then saverestartclosepeaapp;
end;

procedure TForm_peach.madvfiltersClick(Sender: TObject);
begin
try
if Form_peach.madvfilters.checked=false then
   begin
   set_advfilters;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   setfiltericon(false);
   Form_peach.cbadvf1.state:=cbunchecked;
   Form_peach.cbadvf2.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure do_alltasks;
begin
{$IFDEF MSWINDOWS}
shellexecutew(Form_peach.handle, PWideChar('open'), PWideChar('EXPLORER.EXE'), PWideChar('shell:::{ED7BA470-8E54-465E-825C-99712043E01C}'), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.mb0Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
showpanel('open');
addtobookmarks('*browser');
navrefresh;
end;

procedure TForm_peach.mb10Click(Sender: TObject);
begin
browsebookmark(10);
end;

procedure TForm_peach.mb11Click(Sender: TObject);
begin
browsebookmark(11);
end;

procedure TForm_peach.mb12Click(Sender: TObject);
begin
browsebookmark(12);
end;

procedure TForm_peach.mb13Click(Sender: TObject);
begin
browsebookmark(13);
end;

procedure TForm_peach.mb14Click(Sender: TObject);
begin
browsebookmark(14);
end;

procedure TForm_peach.mb15Click(Sender: TObject);
begin
browsebookmark(15);
end;

procedure TForm_peach.mb16Click(Sender: TObject);
begin
browsebookmark(16);
end;

procedure TForm_peach.mb17Click(Sender: TObject);
begin
browsebookmark(17);
end;

procedure TForm_peach.mb18Click(Sender: TObject);
begin
browsebookmark(18);
end;

procedure TForm_peach.mb19Click(Sender: TObject);
begin
browsebookmark(19);
end;

procedure TForm_peach.mb1Click(Sender: TObject);
begin
browsebookmark(1);
end;

procedure TForm_peach.mb20Click(Sender: TObject);
begin
browsebookmark(20);
end;

procedure TForm_peach.mb21Click(Sender: TObject);
begin
browsebookmark(21);
end;

procedure TForm_peach.mb22Click(Sender: TObject);
begin
browsebookmark(22);
end;

procedure TForm_peach.mb23Click(Sender: TObject);
begin
browsebookmark(23);
end;

procedure TForm_peach.mb24Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
showpanel('open');
if stringgridbookmarks.visible=false then showbar('bookmarks');
navrefresh;
end;

procedure TForm_peach.mb2Click(Sender: TObject);
begin
browsebookmark(2);
end;

procedure TForm_peach.mb3Click(Sender: TObject);
begin
browsebookmark(3);
end;

procedure TForm_peach.mb4Click(Sender: TObject);
begin
browsebookmark(4);
end;

procedure TForm_peach.mb5Click(Sender: TObject);
begin
browsebookmark(5);
end;

procedure TForm_peach.mb6Click(Sender: TObject);
begin
browsebookmark(6);
end;

procedure TForm_peach.mb7Click(Sender: TObject);
begin
browsebookmark(7);
end;

procedure TForm_peach.mb8Click(Sender: TObject);
begin
browsebookmark(8);
end;

procedure TForm_peach.mb9Click(Sender: TObject);
begin
browsebookmark(9);
end;

procedure TForm_peach.mbackaliasClick(Sender: TObject); //backspace from menu hotkey
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
navgoup;
end;

procedure TForm_peach.mbackClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
navgoback;
end;

procedure addarchive_tobookmarks;
var
   s:ansistring;
begin
if fileexists((Form_peach.EditOpenIn.Text)) then Form_peach.OpenDialogArchive.InitialDir:=extractfilepath(Form_peach.EditOpenIn.Text)
else Form_peach.OpenDialogArchive.InitialDir:=Form_peach.EditOpenIn.Text;
if Form_peach.OpenDialogArchive.Execute then
   if Form_peach.OpenDialogArchive.Filename<>'' then
      begin
      s:=Form_peach.OpenDialogArchive.Filename;
      addtobookmarks(s);
      end
   else exit
else exit;
end;

procedure TForm_peach.mbAddArchiveClick(Sender: TObject);
begin
addarchive_tobookmarks;
end;

procedure addpath_tobookmarks;
var
   s:ansistring;
begin
if fileexists((Form_peach.EditOpenIn.Text)) then Form_peach.SelectDirectoryDialog1.InitialDir:=extractfilepath(Form_peach.EditOpenIn.Text)
else Form_peach.SelectDirectoryDialog1.InitialDir:=Form_peach.EditOpenIn.Text;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      s:=Form_peach.SelectDirectoryDialog1.FileName;
      addtobookmarks(s);
      end
   else exit
else exit;
end;

procedure TForm_peach.mbAddPathClick(Sender: TObject);
begin
addpath_tobookmarks;
end;

procedure TForm_peach.mbc1Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc1.caption);
end;

procedure TForm_peach.mbc2Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc2.caption);
end;

procedure TForm_peach.mbc3Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc3.caption);
end;

procedure TForm_peach.mbc4Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc4.caption);
end;

procedure TForm_peach.mbc5Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc5.caption);
end;

procedure TForm_peach.mbc6Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc6.caption);
end;

procedure TForm_peach.mbc7Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc7.caption);
end;

procedure TForm_peach.mbc8Click(Sender: TObject);
begin
showpanel('open');
browsefiledir(mbc8.caption);
end;

procedure TForm_peach.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 TForm_peach.mbDeleteClick(Sender: TObject);
begin
if StringGridBookmarks.Rowcount<2 then exit;
StringGridBookmarks.DeleteColRow(false,StringGridBookmarks.Row);
populatebookmarks;
end;

procedure TForm_peach.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 addnote_tobookmarks;
var
   s:ansistring;
begin
with Form_peach 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 TForm_peach.mbNotesClick(Sender: TObject);
begin
if StringGridBookmarks.Rowcount<2 then exit;
addnote_tobookmarks;
end;

procedure TForm_peach.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;
Form_peach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure TForm_peach.mbresetClick(Sender: TObject);
begin
resetbookmarks('delete');
end;

procedure sortbrowser(c:integer);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
if refreshstatus<>0 then exit;
listcol:=c;
if c=listsortcol then
   if az=true then sort_za_stringgridlist(c)
   else sort_az_stringgridlist(c)
else sort_az_stringgridlist(c);
listsortcol:=c;
update_listview;
if fun='UN7Z' then generate_archive_breadcrumb;
end;

procedure TForm_peach.mbrowsercattClick(Sender: TObject);
begin
sortbrowser(10);
end;

procedure TForm_peach.mbrowserccrcClick(Sender: TObject);
begin
sortbrowser(11);
end;

procedure TForm_peach.mbrowsercdateClick(Sender: TObject);
begin
sortbrowser(5);
end;

procedure TForm_peach.mbrowsercnameClick(Sender: TObject);
begin
sortbrowser(13);
end;

procedure TForm_peach.mbrowsercpackedClick(Sender: TObject);
begin
sortbrowser(15);
end;

procedure TForm_peach.mbrowsercsizeClick(Sender: TObject);
begin
sortbrowser(14);
end;

procedure TForm_peach.mbrowserctypeClick(Sender: TObject);
begin
sortbrowser(2);
end;

procedure TForm_peach.mcancelClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then gocancelarchive
else
   {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.Top=0{$ENDIF} then gocancelextract;
end;

procedure TForm_peach.mcattClick(Sender: TObject);
begin
catt:=not(catt);
mcatt.Checked:=catt;
pmcatt.Checked:=catt;
set_listview_col;
end;

procedure TForm_peach.mccrcClick(Sender: TObject);
begin
ccrc:=not(ccrc);
mccrc.Checked:=ccrc;
pmccrc.Checked:=ccrc;
set_listview_col;
end;

procedure TForm_peach.mcdateClick(Sender: TObject);
begin
cdate:=not(cdate);
mcdate.Checked:=cdate;
pmcdate.Checked:=cdate;
set_listview_col;
end;

procedure TForm_peach.mcfreeClick(Sender: TObject);
begin
cfree:=not(cfree);
mcfree.Checked:=cfree;
pmcfree.Checked:=cfree;
set_listview_col;
end;

procedure TForm_peach.mcfsClick(Sender: TObject);
begin
cfs:=not(cfs);
mcfs.Checked:=cfs;
pmcfs.Checked:=cfs;
set_listview_col;
end;

procedure setbrowserch(i:integer);
begin
with Form_peach 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;
RadioGroup2.ItemIndex:=browserch-1;
end;
end;

procedure open_compmanagement;
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('compmgmt.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.mcpackedClick(Sender: TObject);
begin
cpacked:=not(cpacked);
mcpacked.Checked:=cpacked;
pmcpacked.Checked:=cpacked;
set_listview_col;
end;

procedure TForm_peach.mcpClick(Sender: TObject);
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then sg:=StringGrid1
else sg:=StringGrid2;
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 TForm_peach.mcsizeClick(Sender: TObject);
begin
csize:=not(csize);
mcsize.Checked:=csize;
pmcsize.Checked:=csize;
set_listview_col;
end;

procedure set_arcout;
var
   s:ansistring;
begin
with form_peach do
begin
if mdefaultarchive.checked=false then
   begin
   if EditName3.Text='' then Form_peach.SelectDirectoryDialog1.InitialDir:=local_desktop
   else Form_peach.SelectDirectoryDialog1.InitialDir:=EditName3.Text;
   if SelectDirectoryDialog1.Execute then
      if SelectDirectoryDialog1.FileName<>'' then
         begin
         EditName3.Text:=SelectDirectoryDialog1.FileName;
         if EditName3.Text<>'' then
           if EditName3.Text[length(EditName3.Text)]<>directoryseparator then EditName3.Text:=EditName3.Text+directoryseparator;
         defaultarchivepath:=EditName3.Text;
         mdefaultarchive.checked:=true;
         mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
         suggest_outname(s,Form_peach.cbType.Text,0);
         Form_peach.EditName3.Text:=defaultarchivepath;
         Form_peach.Edit4.Text:=extractfilename(s);
         Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
         end;
   end
else
   begin
   defaultarchivepath:='';
   mdefaultarchive.checked:=false;
   mdefaultarchive.caption:=txt_archive+' > '+txt_7_6_setdef;
   suggest_outname(s,Form_peach.cbType.Text,0);
   Form_peach.EditName3.Text:=extractfilepath(s);
   Form_peach.Edit4.Text:=extractfilename(s);
   Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
   end;
lsetdefaultout_arc.caption:=mdefaultarchive.caption;
end;
end;

procedure set_arcout_current;
var
   s:ansistring;
begin
with form_peach do
begin
if EditName3.Text='' then exit;
if EditName3.Text[length(EditName3.Text)]<>directoryseparator then EditName3.Text:=EditName3.Text+directoryseparator;
defaultarchivepath:=EditName3.Text;
mdefaultarchive.checked:=true;
mdefaultarchive.caption:=txt_archive+' > '+txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=defaultarchivepath;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;
end;

procedure TForm_peach.mdefaultarchiveClick(Sender: TObject);
begin
set_arcout;
end;

procedure set_extout;
begin
with form_peach do
begin
if mdefaultextract.checked=false then
   begin
   if EditOpenOut.Text='' then Form_peach.SelectDirectoryDialog1.InitialDir:=local_desktop
   else Form_peach.SelectDirectoryDialog1.InitialDir:=EditOpenOut.Text;
   if SelectDirectoryDialog1.Execute then
      if SelectDirectoryDialog1.FileName<>'' then
         begin
         EditOpenOut.Text:=SelectDirectoryDialog1.FileName;
         if EditOpenOut.Text<>'' then
           if EditOpenOut.Text[length(EditOpenOut.Text)]<>directoryseparator then EditOpenOut.Text:=EditOpenOut.Text+directoryseparator;
         defaultextractpath:=EditOpenOut.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 form_peach do
begin
if EditOpenOut.Text='' then exit;
if EditOpenOut.Text[length(EditOpenOut.Text)]<>directoryseparator then EditOpenOut.Text:=EditOpenOut.Text+directoryseparator;
defaultextractpath:=EditOpenOut.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 TForm_peach.mdefaultextractClick(Sender: TObject);
begin
set_extout;
end;

procedure setbrowsertype(btype:integer);
begin
clearicons;
with form_peach do
case btype of
   0: begin
   mDetails.checked:=true;
   mList.checked:=false;
   mSmallIcon.checked:=false;
   ListView1.ViewStyle:=vsReport;
   browsertype:=0;
   if openstarted=true then loadsmallicons(smalliconsize);
   {$IFNDEF MSWINDOWS} //Laz1.4 and Qt 4.5 bindings: report mode assumes large icon size
   ListView1.LargeImages.Height:=smalliconsize;
   ListView1.LargeImages.Width:=smalliconsize;
   {$ENDIF}
   end;
   1: begin
   mDetails.checked:=false;
   mList.checked:=true;
   mSmallIcon.checked:=false;
   ListView1.ViewStyle:=vsList;
   {$IFDEF MSWINDOWS}ListView_SetColumnWidth(Listview1.Handle, 0, 240);{$ENDIF}
   browsertype:=1;
   if openstarted=true then loadsmallicons(mediconsize);
   end;
   2: begin
   mDetails.checked:=false;
   mList.checked:=false;
   mSmallIcon.checked:=true;
   ListView1.ViewStyle:=vsIcon;
   browsertype:=2;
   if openstarted=true then loadlargeicons(largeiconsize);
   end;
   end;
{$IFDEF MSWINDOWS}
if Form_peach.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 form_peach do
begin
case bsize of
   0: begin
   mbrowsersizes.checked:=true;
   mbrowsersizem.checked:=false;
   mbrowsersizel.checked:=false;
   smalliconsize:=16;
   mediconsize:=16;
   largeiconsize:=48;
   end;
   1: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=true;
   mbrowsersizel.checked:=false;
   smalliconsize:=48;
   mediconsize:=48;
   largeiconsize:=96;
   end;
   2: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=false;
   mbrowsersizel.checked:=true;
   smalliconsize:=96;
   mediconsize:=96;
   largeiconsize:=192;
   end;
   end;
{$IFDEF MSWINDOWS}
if enlargeicons=true then
case bsize of
   0: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=true;
   mbrowsersizel.checked:=false;
   smalliconsize:=48;
   mediconsize:=48;
   largeiconsize:=96;
   end;
   1: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=false;
   mbrowsersizel.checked:=true;
   smalliconsize:=96;
   mediconsize:=96;
   largeiconsize:=192;
   end;
   2: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=false;
   mbrowsersizel.checked:=true;
   smalliconsize:=96;
   mediconsize:=96;
   largeiconsize:=192;
   end;
   end;
{$ENDIF}
end;
browsersize:=bsize;
setbrowsertype(browsertype);
end;

procedure TForm_peach.mbrowsersizelClick(Sender: TObject);
begin
setbrowsersize(2);
end;

procedure TForm_peach.mbrowsersizemClick(Sender: TObject);
begin
setbrowsersize(1);
end;

procedure TForm_peach.mbrowsersizesClick(Sender: TObject);
begin
setbrowsersize(0);
end;

procedure TForm_peach.mdetailsClick(Sender: TObject);
begin
setbrowsertype(0);
end;

procedure TForm_peach.mctypeClick(Sender: TObject);
begin
ctype:=not(ctype);
mctype.Checked:=ctype;
pmctype.Checked:=ctype;
set_listview_col;
end;

procedure TForm_peach.mpluginsClick(Sender: TObject);
begin
checkplugins;
end;

procedure TForm_peach.mPeaFAQClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help-faq.html',desk_env);
end;

procedure TForm_peach.mPeaSiteMirrorClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'index.html',desk_env);
end;

procedure TForm_peach.MenuItemArchive_dropboxClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_dropbox;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_googledriveClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_googledrive;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_musicClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_music;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_myboxfilesClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_myboxfiles;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_picturesClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_pictures;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_skydriveClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_skydrive;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_onedriveClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_onedrive;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_ubuntuoneClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_ubuntuone;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_videosClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_videos;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.menuitemopenhomeClick(Sender: TObject);
begin
jumpto('home');
end;

procedure TForm_peach.MenuItemOpen_dropboxClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(shared_dropbox);
end;

procedure TForm_peach.MenuItemOpen_googledriveClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(shared_googledrive);
end;

procedure TForm_peach.MenuItemOpen_musicClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(usr_music);
end;

procedure TForm_peach.MenuItemOpen_myboxfilesClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(shared_myboxfiles);
end;

procedure TForm_peach.MenuItemOpen_organizebookmarksClick(Sender: TObject);
begin
  do_organizebookmarks;
end;

procedure TForm_peach.MenuItemOpen_picturesClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(usr_pictures);
end;

procedure TForm_peach.MenuItemOpen_powershellClick(Sender: TObject);
begin
browser_commandprompt(1,1,'');
end;

procedure TForm_peach.MenuItemOpen_onedriveClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(shared_onedrive);
end;

procedure TForm_peach.MenuItemOpen_skydriveClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(shared_skydrive);
end;

procedure TForm_peach.MenuItemOpen_ubuntuoneClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(shared_ubuntuone);
end;

procedure TForm_peach.MenuItemOpen_videosClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(usr_videos);
end;

procedure TForm_peach.MenuItemPowerShellClick(Sender: TObject);
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then sg:=StringGrid1
else sg:=StringGrid2;
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 TForm_peach.mfwdClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
navgofwd;
end;

procedure TForm_peach.mPeaSupportClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help.html',desk_env);
end;

procedure TForm_peach.mpeautilsClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure togglestatusbar;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.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 TForm_peach.Panelnav5Click(Sender: TObject);
begin
lastbar:=1;
togglestatusbar;
end;

procedure TForm_peach.pmamr1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent1.Caption)
else addfile_ext_fromname(mRecent1.Caption);
end;

procedure TForm_peach.pmamr2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent2.Caption)
else addfile_ext_fromname(mRecent2.Caption);
end;

procedure TForm_peach.pmamr3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent3.Caption)
else addfile_ext_fromname(mRecent3.Caption);
end;

procedure TForm_peach.pmamr4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent4.Caption)
else addfile_ext_fromname(mRecent4.Caption);
end;

procedure TForm_peach.pmamr5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent5.Caption)
else addfile_ext_fromname(mRecent5.Caption);
end;

procedure TForm_peach.pmamr6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent6.Caption)
else addfile_ext_fromname(mRecent6.Caption);
end;

procedure TForm_peach.pmamr7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent7.Caption)
else addfile_ext_fromname(mRecent7.Caption);
end;

procedure TForm_peach.pmamr8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(mRecent8.Caption)
else addfile_ext_fromname(mRecent8.Caption);
end;

procedure TForm_peach.pmabc0Click(Sender: TObject);
begin
browsefiledir(form_peach.EditOpenIn1.Text);
end;

procedure do_click_breadmenu(i:integer; inbcnodestr:ansistring);
var
   Node: TTreeNode;
   s:ansistring;
begin
if inbcnode=-1 then
begin
if Form_peach.EditOpenIn1.Text=txt_mypc then i:=i-1
else i:=i+imod;
if i<Form_peach.ShellTreeView2.Items.Count then
   begin
   Node := Form_peach.ShellTreeView2.Items[i];
   s:=Form_peach.ShellTreeView2.GetPathFromNode(Node);
   browsefiledir(s);
   end;
end
else
   if fun='UN7Z' then
      begin
      if i<>0 then
      case inbcnode of
      0: Form_peach.EditUn7zaFilter1.Caption:=inbcnodestr+directoryseparator+'*';
      1: Form_peach.EditUn7zaFilter1.Caption:=abcrs[1]+inbcnodestr+directoryseparator+'*';
      2: Form_peach.EditUn7zaFilter1.Caption:=abcrs[2]+inbcnodestr+directoryseparator+'*';
      3: Form_peach.EditUn7zaFilter1.Caption:=abcrs[3]+inbcnodestr+directoryseparator+'*';
      end
      else
      case inbcnode of
      0: Form_peach.EditUn7zaFilter1.Caption:='*';
      1: Form_peach.EditUn7zaFilter1.Caption:=abcrs[1]+'*';
      2: Form_peach.EditUn7zaFilter1.Caption:=abcrs[2]+'*';
      3: Form_peach.EditUn7zaFilter1.Caption:=abcrs[3]+'*';
      end;
      kp_EditUn7zaFilter1_nr;
      end;
end;

procedure TForm_peach.pmbcd0Click(Sender: TObject);
begin
do_click_breadmenu(0,Form_peach.pmbcd0.Caption);
end;

procedure TForm_peach.pmbcd10Click(Sender: TObject);
begin
do_click_breadmenu(10,Form_peach.pmbcd10.Caption);
end;

procedure TForm_peach.pmbcd11Click(Sender: TObject);
begin
do_click_breadmenu(11,Form_peach.pmbcd11.Caption);
end;

procedure TForm_peach.pmbcd12Click(Sender: TObject);
begin
do_click_breadmenu(12,Form_peach.pmbcd12.Caption);
end;

procedure TForm_peach.pmbcd13Click(Sender: TObject);
begin
do_click_breadmenu(13,Form_peach.pmbcd13.Caption);
end;

procedure TForm_peach.pmbcd14Click(Sender: TObject);
begin
do_click_breadmenu(14,Form_peach.pmbcd14.Caption);
end;

procedure TForm_peach.pmbcd15Click(Sender: TObject);
begin
do_click_breadmenu(15,Form_peach.pmbcd15.Caption);
end;

procedure TForm_peach.pmbcd16Click(Sender: TObject);
begin
do_click_breadmenu(16,Form_peach.pmbcd16.Caption);
end;

procedure TForm_peach.pmbcd17Click(Sender: TObject);
begin
do_click_breadmenu(17,Form_peach.pmbcd17.Caption);
end;

procedure TForm_peach.pmbcd18Click(Sender: TObject);
begin
do_click_breadmenu(18,Form_peach.pmbcd18.Caption);
end;

procedure TForm_peach.pmbcd19Click(Sender: TObject);
begin
do_click_breadmenu(19,Form_peach.pmbcd19.Caption);
end;

procedure TForm_peach.pmbcd1Click(Sender: TObject);
begin
do_click_breadmenu(1,Form_peach.pmbcd1.Caption);
end;

procedure TForm_peach.pmbcd2Click(Sender: TObject);
begin
do_click_breadmenu(2,Form_peach.pmbcd2.Caption);
end;

procedure TForm_peach.pmbcd3Click(Sender: TObject);
begin
do_click_breadmenu(3,Form_peach.pmbcd3.Caption);
end;

procedure TForm_peach.pmbcd4Click(Sender: TObject);
begin
do_click_breadmenu(4,Form_peach.pmbcd4.Caption);
end;

procedure TForm_peach.pmbcd5Click(Sender: TObject);
begin
do_click_breadmenu(5,Form_peach.pmbcd5.Caption);
end;

procedure TForm_peach.pmbcd6Click(Sender: TObject);
begin
do_click_breadmenu(6,Form_peach.pmbcd6.Caption);
end;

procedure TForm_peach.pmbcd7Click(Sender: TObject);
begin
do_click_breadmenu(7,Form_peach.pmbcd7.Caption);
end;

procedure TForm_peach.pmbcd8Click(Sender: TObject);
begin
do_click_breadmenu(8,Form_peach.pmbcd8.Caption);
end;

procedure TForm_peach.pmbcd9Click(Sender: TObject);
begin
do_click_breadmenu(9,Form_peach.pmbcd9.Caption);
end;

procedure TForm_peach.pmbcexpandClick(Sender: TObject);
begin
if fun='UN7Z' then
  if Form_Peach.TreeView1.Items[0].Text=extractfilename(Form_Peach.EditOpenIn1.Text) then
     begin
     Form_Peach.TreeView1.Selected:=Form_Peach.TreeView1.Items[0];
     if aisexpanded then Form_Peach.TreeView1.Selected.Collapse(true)
     else Form_Peach.TreeView1.Selected.Expand(true);
     aisexpanded:=not(aisexpanded);
     end;
end;

procedure TForm_peach.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 TForm_peach.pmbcorganizebookmarksClick(Sender: TObject);
begin
do_organizebookmarks;
end;

procedure TForm_peach.pmbcpropertiesClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: s:=EditOpenIn1.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 getmainfiledirname(var s:ansistring);
begin
with form_peach do
begin
if EditOpenIn1.Caption=txt_mypc then s:=''
else
   begin
   s:=extractfilename(EditOpenIn1.Caption);
   if s='' then
      begin
      s:=copy(EditOpenIn1.Caption,0,length(EditOpenIn1.Caption)-1);
      s:=extractfilename(s);
      end;
   end;
end;
end;

function unpadaddress(s:ansistring):ansistring;
begin
result:=copy(s,2,length(s)-2);
end;

procedure TForm_peach.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 TForm_peach.pmemb1Click(Sender: TObject);
begin
cp_open(pnb1.Caption,desk_env);
end;

procedure TForm_peach.pmemb2Click(Sender: TObject);
begin
cp_open(pnb2.Caption,desk_env);
end;

procedure TForm_peach.pmemb3Click(Sender: TObject);
begin
cp_open(pnb3.Caption,desk_env);
end;

procedure TForm_peach.pmemb4Click(Sender: TObject);
begin
cp_open(pnb4.Caption,desk_env);
end;

procedure TForm_peach.pmemb5Click(Sender: TObject);
begin
cp_open(pnb5.Caption,desk_env);
end;

procedure TForm_peach.pmemb6Click(Sender: TObject);
begin
cp_open(pnb6.Caption,desk_env);
end;

procedure TForm_peach.pmemb7Click(Sender: TObject);
begin
cp_open(pnb7.Caption,desk_env);
end;

procedure TForm_peach.pmemb8Click(Sender: TObject);
begin
cp_open(pnb8.Caption,desk_env);
end;

procedure TForm_peach.pmemr1Click(Sender: TObject);
begin
  cp_open(pnr1.Caption,desk_env);
end;

procedure TForm_peach.pmemr2Click(Sender: TObject);
begin
  cp_open(pnr2.Caption,desk_env);
end;

procedure TForm_peach.pmemr3Click(Sender: TObject);
begin
  cp_open(pnr3.Caption,desk_env);
end;

procedure TForm_peach.pmemr4Click(Sender: TObject);
begin
  cp_open(pnr4.Caption,desk_env);
end;

procedure TForm_peach.pmemr5Click(Sender: TObject);
begin
  cp_open(pnr5.Caption,desk_env);
end;

procedure TForm_peach.pmemr6Click(Sender: TObject);
begin
  cp_open(pnr6.Caption,desk_env);
end;

procedure TForm_peach.pmemr7Click(Sender: TObject);
begin
  cp_open(pnr7.Caption,desk_env);
end;

procedure TForm_peach.pmemr8Click(Sender: TObject);
begin
  cp_open(pnr8.Caption,desk_env);
end;

procedure TForm_peach.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 TForm_peach.pmfun10Click(Sender: TObject);
begin
do_pmfun(pmfun10.caption);
end;

function bcaddress:ansistring;
var
   s:ansistring;
begin
s:='';
case bctemp of
0: s:=Form_peach.EditOpenIn1.Caption;
1: if Form_peach.LabelClickAddress1.Caption=' '+txt_mypc+' ' then s:=txt_mypc
   else s:=Form_peach.pmbc8.caption;
2: s:=Form_peach.pmbc7.caption;
3: s:=Form_peach.pmbc6.caption;
4: s:=Form_peach.pmbc5.caption;
5: s:=Form_peach.pmbc4.caption;
6: s:=Form_peach.pmbc3.caption;
7: s:=Form_peach.pmbc2.caption;
8: s:=Form_peach.pmbc1.caption;
end;
result:=s;
end;

procedure TForm_peach.pmfun11Click(Sender: TObject);
begin
if bctemp=0 then do_pmfun(pmfun11.caption)
else
   if fun='FILEBROWSER' then browser_commandprompt(0,0,bcaddress)
   else browser_commandprompt(0,0,extractfilepath(bcaddress));
end;

procedure TForm_peach.pmfun12Click(Sender: TObject);
begin
if bctemp=0 then do_pmfun(pmfun12.caption)
else
   if fun='FILEBROWSER' then browser_commandprompt(0,1,bcaddress)
   else browser_commandprompt(0,1,extractfilepath(bcaddress));
end;

procedure TForm_peach.pmfun13Click(Sender: TObject);
begin
do_pmfun(pmfun13.caption);
end;

procedure TForm_peach.pmfun14Click(Sender: TObject);
begin
if bctemp=0 then do_pmfun(pmfun14.caption)
else
   if fun='FILEBROWSER' then openwith_peazipnew(0,bcaddress)
   else openwith_peazipnew(0,extractfilepath(bcaddress));
end;

procedure TForm_peach.pmfun15Click(Sender: TObject);
begin
do_pmfun(pmfun15.caption);
end;

procedure TForm_peach.pmfun16Click(Sender: TObject);
begin
do_pmfun(pmfun16.caption);
end;

procedure TForm_peach.pmfun17Click(Sender: TObject);
begin
do_pmfun(pmfun17.caption);
end;

procedure TForm_peach.pmfun18Click(Sender: TObject);
begin
do_pmfun(pmfun18.caption);
end;

procedure TForm_peach.pmfun1Click(Sender: TObject);
begin
do_pmfun(pmfun1.caption);
end;

procedure TForm_peach.pmfun2Click(Sender: TObject);
begin
do_pmfun(pmfun2.caption);
end;

procedure TForm_peach.pmfun3Click(Sender: TObject);
begin
do_pmfun(pmfun3.caption);
end;

procedure TForm_peach.pmfun4Click(Sender: TObject);
begin
do_pmfun(pmfun4.caption);
end;

procedure TForm_peach.pmfun5Click(Sender: TObject);
begin
do_pmfun(pmfun5.caption);
end;

procedure TForm_peach.pmfun6Click(Sender: TObject);
begin
do_pmfun(pmfun6.caption);
end;

procedure TForm_peach.pmfun7Click(Sender: TObject);
begin
do_pmfun(pmfun7.caption);
end;

procedure TForm_peach.pmfun8Click(Sender: TObject);
begin
do_pmfun(pmfun8.caption);
end;

procedure TForm_peach.pmfun9Click(Sender: TObject);
begin
do_pmfun(pmfun9.caption);
end;

procedure TForm_peach.pmhr1fClick(Sender: TObject);
begin
opendir(pmhr1f.Caption);
end;

procedure TForm_peach.pmhr2fClick(Sender: TObject);
begin
opendir(pmhr2f.Caption);
end;

procedure TForm_peach.pmhr3fClick(Sender: TObject);
begin
opendir(pmhr3f.Caption);
end;

procedure TForm_peach.pmhr4fClick(Sender: TObject);
begin
opendir(pmhr4f.Caption);
end;

procedure TForm_peach.pmhr5fClick(Sender: TObject);
begin
opendir(pmhr5f.Caption);
end;

procedure TForm_peach.pmhr6fClick(Sender: TObject);
begin
opendir(pmhr6f.Caption);
end;

procedure TForm_peach.pmhr7fClick(Sender: TObject);
begin
opendir(pmhr7f.Caption);
end;

procedure TForm_peach.pmhr8fClick(Sender: TObject);
begin
opendir(pmhr8f.Caption);
end;

procedure TForm_peach.pmif1Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1024,768,2,'no',0);
end;

procedure TForm_peach.pmif2Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1280,800,2,'no',0);
end;

procedure TForm_peach.pmif3Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1080,2,'no',0);
end;

procedure TForm_peach.pmif4Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1200,2,'no',0);
end;

procedure TForm_peach.pmif5Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,2048,1536,2,'no',0);
end;

procedure TForm_peach.pmif6Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,3840,2160,2,'no',0);
end;

procedure TForm_peach.pmif7Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,4096,2160,2,'no',0);
end;

procedure TForm_peach.pmif8Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,7680,4320,2,'no',0);
end;

procedure TForm_peach.pmir180Click(Sender: TObject);
begin
frombrowser_imgrotate('180');
end;

procedure TForm_peach.pmiresize125Click(Sender: TObject);
begin
frombrowser_imgtransform(125,125,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize150Click(Sender: TObject);
begin
frombrowser_imgtransform(150,150,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize200Click(Sender: TObject);
begin
frombrowser_imgtransform(200,200,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize25Click(Sender: TObject);
begin
frombrowser_imgtransform(25,25,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize300Click(Sender: TObject);
begin
frombrowser_imgtransform(300,300,0,0,1,'no',80);
end;

procedure TForm_peach.pmiresize33Click(Sender: TObject);
begin
frombrowser_imgtransform(33,33,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize400Click(Sender: TObject);
begin
frombrowser_imgtransform(400,400,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize50Click(Sender: TObject);
begin
frombrowser_imgtransform(50,50,0,0,1,'no',0);
end;

procedure TForm_peach.pmiresize75Click(Sender: TObject);
begin
frombrowser_imgtransform(75,75,0,0,1,'no',0);
end;

procedure TForm_peach.pmirflipClick(Sender: TObject);
begin
frombrowser_imgrotate('flip');
end;

procedure TForm_peach.pmwsClick(Sender: TObject);
begin
websearch_sel;
end;

procedure TForm_peach.MenuItemopendesktopClick(Sender: TObject);
begin
jumpto('desktop');
end;

{$IFDEF MSWINDOWS}
function callSHMultiFileProperties(pDataObj: IDataObject; Flag: DWORD): HRESULT;
begin
      try
         hUser32prop := GetModuleHandle(PChar('shell32.dll'));
         if hUser32prop <> 0 then
            begin
            pointer(SHMultiFileProperties) := GetProcAddress(hUser32prop, 'SHMultiFileProperties');
            if @SHMultiFileProperties <> nil then
               SHMultiFileProperties(pDataObj,Flag);
            end;
      except
      end;
end;

function GetFileListDataObject(Files: TStrings): IDataObject;
type
   PArrayOfPItemIDList = ^TArrayOfPItemIDList;
   TArrayOfPItemIDList = array[0..0] of PItemIDList;
var
   Malloc: IMalloc;
   Root: IShellFolder;
   p: PArrayOfPItemIDList;
   chEaten, dwAttributes: ULONG;
   i, FileCount: Integer;
begin
   Result := nil;
   FileCount := Files.Count;
   if FileCount = 0 then Exit;

   OleCheck(SHGetMalloc(Malloc));
   OleCheck(SHGetDesktopFolder(Root));
   p := AllocMem(SizeOf(PItemIDList) * FileCount);
   try
     for i := 0 to FileCount - 1 do
       try
         //if not (DirectoryExists(Files[i]) or FileExists(Files[i])) then Continue;
         OleCheck(Root.ParseDisplayName(GetActiveWindow,
           nil,
           PWideChar(WideString(Files[i])),
           chEaten,
           p^[i],
           dwAttributes));
       except
       end;
     OleCheck(Root.GetUIObjectOf(GetActiveWindow,
       FileCount,
       p^[0],
       IDataObject,
       nil,
       Pointer(Result)));
   finally
     for i := 0 to FileCount - 1 do
     begin
       if p^[i] <> nil then Malloc.Free(p^[i]);
     end;
     FreeMem(p);
   end;
end;

procedure ShowFileProperties(Files: TStrings; aWnd: HWND);
type
   PArrayOfPItemIDList = ^TArrayOfPItemIDList;
   TArrayOfPItemIDList = array[0..0] of PItemIDList;
var
   Data: IDataObject;
begin
   if Files.Count = 0 then Exit;
   Data := GetFileListDataObject(Files);
   callSHMultiFileProperties(Data, 0);
end;
{$ENDIF}

procedure winsysproperties;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then
   ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('sysdm.cpl'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
else
   ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('systempropertiescomputername'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure browser_fileproperties(s_in:ansistring);
var
   spars: TStringList;
   sdest: ansistring;
   i:integer;
begin
with Form_peach 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(Form_peach.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(Form_peach.Handle, PWideChar ('open'), PWideChar('systempropertiescomputername'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
      spars.Free;
      exit;
      end;
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_peach.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 TForm_peach.MenuItemPropertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure TForm_peach.ButtonPropertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure TForm_peach.mfullscreenClick(Sender: TObject);
begin
pimmersive:=0;
if Form_peach.WindowState<>wsMaximized then Form_peach.WindowState:=wsMaximized
else Form_peach.WindowState:=wsNormal;
if Form_peach.BorderStyle=bsNone then Form_peach.BorderStyle:=bsSizeable;
end;

procedure set_pimmersive;
begin
Form_peach.BorderStyle:=bsNone;
Form_peach.WindowState:=wsMaximized;
end;

procedure TForm_peach.mimmersiveClick(Sender: TObject);
begin
if Form_peach.BorderStyle<>bsNone then
   begin
   set_pimmersive;
   pimmersive:=1;
   end
else
   begin
   Form_peach.BorderStyle:=bsSizeable;
   Form_peach.WindowState:=wsMaximized;
   Form_peach.WindowState:=wsNormal;
   Form_peach.Left:=DLEFT;
   Form_peach.Top:=DTOP;
   Form_peach.Width:=DWIDTH;
   Form_peach.Height:=DHEIGTH;
   pimmersive:=0;
   end;
end;

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
   unit8.clicklabel_pm(FormPM.LabelTitlePM2,FormPM.ShapeTitlePMb2);
   FormPM.LabelTitlePM1.Visible:=false;
   FormPM.ctrlpm.enabled:=false;
   FormPM.button1.enabled:=false;
   FormPM.button2.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;
   unit8.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.ShapeTitlePMb1);
   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.menuitem1.Visible:=false else FormPW.menuitem1.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;
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.EditUn7zaPW1.Text:=FormPW.EditUn7zaPW.Text;
if FormPM.EditName3.Text<>'' then
   if prepend_keyfile(pmpw,FormPM.EditName3.Text)<>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[0]:=rowsize;
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.button1.enabled:=true;
FormPM.button2.enabled:=true;
FormPM.LabelTitlePM1.Visible:=true;
if pmfun=1 then
   unit8.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.ShapeTitlePMb1)
else
   unit8.clicklabel_pm(FormPM.LabelTitlePM2,FormPM.ShapeTitlePMb2);
FormPM.PanelTitlePMTabAlign.Width:=FormPM.ShapeTitlePMb1.Width+FormPM.ShapeTitlePMb2.Width;
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;

procedure TForm_peach.mpmClick(Sender: TObject);
begin
setpm(1);
end;

procedure layout_fileproperties;
var
   spars: TStringList;
   i:integer;
begin
{$IFDEF MSWINDOWS}
spars:=TStringList.Create;
with Form_peach do
begin
if Form_peach.PanelArchiveMain.Visible=true then
   if StringGrid1.Rowcount=1 then exit
   else
      begin
      for i:=1 to Form_peach.StringGrid1.RowCount-1 do
         if Form_peach.StringGrid1.Cells[11,i]='1' then
            begin
            spars.Add(StringGrid1.Cells[8,i]);
            end;
      end
else
   if StringGrid2.Rowcount=1 then exit
   else
      begin
      for i:=1 to Form_peach.StringGrid2.RowCount-1 do
         if Form_peach.StringGrid2.Cells[11,i]='1' then
            begin
            spars.Add(StringGrid2.Cells[8,i]);
            end;
      end;
ShowFileProperties(spars, 0);
spars.Free;
end;
{$ENDIF}
end;

procedure TForm_peach.mPropertiesClick(Sender: TObject);
begin
layout_fileproperties;
end;

procedure TForm_peach.mpw2Click(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
end;

procedure setrecsearch(i:integer);
begin
recsearch:=i;
case i of
   0: begin
      Form_peach.mrecsearch.checked:=false;
      Form_peach.pmsrec.checked:=false;
      FormInput.CheckBox1.State:=cbUnchecked;
      end;
   1: begin
      Form_peach.mrecsearch.checked:=true;
      Form_peach.pmsrec.checked:=true;
      FormInput.CheckBox1.State:=cbChecked;
      end;
   end;
end;

procedure TForm_peach.mrecsearchClick(Sender: TObject);
begin
if recsearch=1 then setrecsearch(0) else setrecsearch(1);
end;

procedure TForm_peach.mscriptsClick(Sender: TObject);
begin
if not(directoryexists(confpath+'Scripts'+DirectorySeparator)) then mkdir(confpath+'Scripts'+DirectorySeparator);
cp_open(confpath+'Scripts'+DirectorySeparator,desk_env);
end;

procedure TForm_peach.pmsrecClick(Sender: TObject);
begin
pmsrec.checked:=not(pmsrec.checked);
if pmsrec.checked=true then FormInput.CheckBox1.State:=cbChecked else FormInput.CheckBox1.State:=cbUnchecked;
end;

procedure TForm_peach.pmzerofileClick(Sender: TObject);
begin
if fun='FILEBROWSER' then eraseselected_list(2)
else
   begin
      erase_fromname_list(2,Form_peach.EditOpenIn.Text);
      browsefiledir(extractfilepath(Form_peach.EditOpenIn.Text));
   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 Form_peach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if Form_peach.EditOpenIn.Text=txt_mypc then s:=copy(Form_peach.StringGridList.Cells[12, Form_peach.StringGridList.Row], 1, 2)
   else s:=copy(Form_peach.EditOpenIn.Text, 1, 2)
else s:=copy(Form_peach.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 Form_peach.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
      P:=tprocessutf8.Create(nil);
      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';
      P.Options := [poNoConsole];
      cl:=bin_name+' SANITIZE '+eraselevel+' '+s;
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P.Execute;
      P.Free;
      end;
{$ENDIF}
end;

procedure TForm_peach.pmzerofreeClick(Sender: TObject);
begin
sanitizedisk(2);
end;

procedure TForm_peach.pnabc1Click(Sender: TObject);
begin
archivemenu_name(pnabc1.Caption);
end;

procedure TForm_peach.pnabc2Click(Sender: TObject);
begin
archivemenu_name(pnabc2.Caption);
end;

procedure TForm_peach.pnabc3Click(Sender: TObject);
begin
archivemenu_name(pnabc3.Caption);
end;

procedure TForm_peach.pnabc4Click(Sender: TObject);
begin
archivemenu_name(pnabc4.Caption);
end;

procedure TForm_peach.pnabc5Click(Sender: TObject);
begin
archivemenu_name(pnabc5.Caption);
end;

procedure TForm_peach.pnabc6Click(Sender: TObject);
begin
archivemenu_name(pnabc6.Caption);
end;

procedure TForm_peach.pnabc7Click(Sender: TObject);
begin
archivemenu_name(pnabc7.Caption);
end;

procedure TForm_peach.pnabc8Click(Sender: TObject);
begin
archivemenu_name(pnabc8.Caption);
end;

procedure TForm_peach.pnbc1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc1.Caption;
end;

procedure TForm_peach.pnbc2Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc2.Caption;
end;

procedure TForm_peach.pnbc3Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc3.Caption;
end;

procedure TForm_peach.pnbc4Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc4.Caption;
end;

procedure TForm_peach.pnbc5Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc5.Caption;
end;

procedure TForm_peach.pnbc6Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc6.Caption;
end;

procedure TForm_peach.pnbc7Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc7.Caption;
end;

procedure TForm_peach.pnbc8Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnbc8.Caption;
end;

procedure TForm_peach.pob_adlerClick(Sender: TObject);
begin
setbrowserch(1);
end;

procedure TForm_peach.pob_crc16Click(Sender: TObject);
begin
setbrowserch(2);
end;

procedure TForm_peach.pob_crc24Click(Sender: TObject);
begin
setbrowserch(3);
end;

procedure TForm_peach.pob_crc32Click(Sender: TObject);
begin
setbrowserch(4);
end;

procedure TForm_peach.pob_crc64Click(Sender: TObject);
begin
setbrowserch(5);
end;

procedure TForm_peach.pob_edonkeyClick(Sender: TObject);
begin
setbrowserch(6);
end;

procedure TForm_peach.pob_md4Click(Sender: TObject);
begin
setbrowserch(7);
end;

procedure TForm_peach.pob_md5Click(Sender: TObject);
begin
setbrowserch(8);
end;

procedure TForm_peach.pob_ripemdClick(Sender: TObject);
begin
setbrowserch(9);
end;

procedure TForm_peach.pob_sha1Click(Sender: TObject);
begin
setbrowserch(10);
end;

procedure TForm_peach.pob_blake2sClick(Sender: TObject);
begin
setbrowserch(11);
end;

procedure TForm_peach.pob_sha256Click(Sender: TObject);
begin
setbrowserch(12);
end;

procedure TForm_peach.pob_sha3256Click(Sender: TObject);
begin
setbrowserch(13);
end;

procedure TForm_peach.pob_blake2bClick(Sender: TObject);
begin
setbrowserch(14);
end;

procedure TForm_peach.pob_sha3512Click(Sender: TObject);
begin
setbrowserch(16);
end;

procedure TForm_peach.pob_sha512Click(Sender: TObject);
begin
setbrowserch(15);
end;

procedure TForm_peach.pob_whirlpoolClick(Sender: TObject);
begin
setbrowserch(17);
end;

procedure TForm_peach.po_checksumClick(Sender: TObject);
begin
getcheck('neutral');
end;

procedure copypaths;
var
   strsel:ansistring;
   rc,nsel,i:integer;
begin
FormPaths.MemoPaths.Clear;
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then
begin
rc:=Form_peach.StringGrid1.RowCount;
for i:=1 to rc-1 do
   if Form_peach.StringGrid1.Cells[11,i]='1' then
      if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then
         FormPaths.MemoPaths.Lines.Add(Form_peach.StringGrid1.Cells[8,i]+directoryseparator)
      else
         FormPaths.MemoPaths.Lines.Add(Form_peach.StringGrid1.Cells[8,i]);
end;
{$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
begin
rc:=Form_peach.StringGrid2.RowCount;
for i:=1 to rc-1 do
   if Form_peach.StringGrid2.Cells[11,i]='1' then
      if Form_peach.StringGrid2.Cells[2,i]=txt_list_isfolder then
         FormPaths.MemoPaths.Lines.Add(Form_peach.StringGrid2.Cells[8,i]+directoryseparator)
      else
         FormPaths.MemoPaths.Lines.Add(Form_peach.StringGrid2.Cells[8,i]);
end;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.Top=0{$ENDIF} then
begin
rc:=Form_peach.StringGridList.RowCount;
if checklisttotsel(nsel,strsel)<>0 then FormPaths.MemoPaths.Lines.Add(Form_peach.EditOpenIn.Text)
else
   begin
   if fun<>'FILEBROWSER' then
      begin
      FormPaths.MemoPaths.Lines.Add(Form_peach.EditOpenIn.Text);
      FormPaths.MemoPaths.Lines.Add('');
      end;
   for i:=1 to rc-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then
            FormPaths.MemoPaths.Lines.Add(Form_peach.StringGridList.Cells[12,i]+directoryseparator)
         else
            FormPaths.MemoPaths.Lines.Add(Form_peach.StringGridList.Cells[12,i]);
   end;
end;
FormPaths.Visible:=true;
end;

procedure TForm_peach.pmCopyPathClick(Sender: TObject);
begin
copypaths;
end;

procedure TForm_peach.pmcpypathClick(Sender: TObject);
begin
copypaths;
end;

procedure TForm_peach.pmCustEditAdd1Click(Sender: TObject);
begin
if OpenDialogApps1.Execute then
   if OpenDialogApps1.Filename<>'' then
      begin
      StringGridCustedit1.Cells[2,StringGridCustedit1.Row]:=OpenDialogApps1.Filename;
      StringGridCustedit1.AutoSizeColumns;
      end
   else exit
else exit;
set_adveditcl(StringGridCustedit1.Row);
end;

procedure TForm_peach.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 TForm_peach.pmCustEditDesc1Click(Sender: TObject);
begin
setdescription_advcustedit;
end;

procedure TForm_peach.pmCustEditDescClick(Sender: TObject);
begin
setdescription_custedit;
end;

procedure TForm_peach.pmCustEditEdit1afterClick(Sender: TObject);
begin
editstring2_advcustedit;
end;

procedure TForm_peach.pmCustEditEdit1Click(Sender: TObject);
begin
editstring1_advcustedit;
end;

procedure TForm_peach.pmCustEditEditClick(Sender: TObject);
begin
editapp_custedit;
end;

procedure TForm_peach.pmCustEditRemove1Click(Sender: TObject);
begin
StringGridCustedit1.Cells[1,StringGridCustedit1.Row]:='';
StringGridCustedit1.Cells[2,StringGridCustedit1.Row]:='';
StringGridCustedit1.Cells[3,StringGridCustedit1.Row]:='';
StringGridCustedit1.Cells[4,StringGridCustedit1.Row]:='';
StringGridCustedit1.AutoSizeColumns;
set_adveditcl(StringGridCustedit1.Row);
end;

procedure TForm_peach.pmCustEditRemoveClick(Sender: TObject);
begin
StringGridCustedit.Cells[1,StringGridCustedit.Row]:='';
StringGridCustedit.Cells[2,StringGridCustedit.Row]:='';
StringGridCustedit.AutoSizeColumns;
end;

procedure TForm_peach.po_copypathClick(Sender: TObject);
begin
copypaths;
end;

procedure TForm_peach.msorttoggleClick(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 setshowthumbnails(i:integer);
begin
showthumbnails:=i;
case i of
   0: begin
      Form_peach.mthumbimages.Checked:=false;
      end;
   1: begin
      Form_peach.mthumbimages.Checked:=true;
      end;
   end;
end;

procedure setsimplesearch(i:integer);
begin
simplesearch:=i;
case i of
   0: Form_peach.msimplesearch.Checked:=false;
   1: Form_peach.msimplesearch.Checked:=true;
   end;
end;

procedure TForm_peach.msimplesearchClick(Sender: TObject);
begin
if simplesearch=1 then setsimplesearch(0) else setsimplesearch(1);
end;

procedure TForm_peach.ListView1Click(Sender: TObject);
begin
wasselectedp:=wasselected;
wasselected:=-1;
pclicked:=true;
if (fun<>'FILEBROWSER') and (fun<>'UN7Z') then exit;
if updatinglistview=true then exit;
if Form_peach.StringGridList.Rowcount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if Form_peach.ListView1.SelCount<>1 then exit;
if Form_peach.StringGridList.Cells[16,Form_peach.StringGridList.Row]<>'1' then exit;
try
   wasselected:=Form_peach.ListView1.ItemFocused.Index+1;
except
end;
if wasselectedp=wasselected then
   if Form_peach.ListView1.SelCount=1 then Timerrename.Enabled:=true;
end;

procedure TForm_peach.mupdateClick(Sender: TObject);
begin
checkupdates;
end;

procedure TForm_peach.owcustom10tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',2)
  else
     openadvappn(2);
end;

procedure TForm_peach.owcustom11tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',3)
  else
     openadvappn(3);
end;

procedure TForm_peach.owcustom12tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',4)
  else
     openadvappn(4);
end;

procedure TForm_peach.owcustom13tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',5)
  else
     openadvappn(5);
end;

procedure TForm_peach.owcustom14tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',6)
  else
     openadvappn(6);
end;

procedure TForm_peach.owcustom15tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',7)
  else
     openadvappn(7);
end;

procedure TForm_peach.owcustom16tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',8)
  else
     openadvappn(8);
end;

procedure TForm_peach.owcustom1tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',1)
  else
     openappn(1);
end;

procedure TForm_peach.owcustom2tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',2)
  else
     openappn(2);
end;

procedure TForm_peach.owcustom3tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',3)
  else
     openappn(3);
end;

procedure TForm_peach.owcustom4tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',4)
  else
     openappn(4);
end;

procedure TForm_peach.owcustom5tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',5)
  else
     openappn(5);
end;

procedure TForm_peach.owcustom6tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',6)
  else
     openappn(6);
end;

procedure TForm_peach.owcustom7tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',7)
  else
     openappn(7);
end;

procedure TForm_peach.owcustom8tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',8)
  else
     openappn(8);
end;

procedure TForm_peach.owcustom9tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     openwith_cust('preview','adv',1)
  else
     openadvappn(1);
end;

procedure openappn(n:integer);
var
   i:integer;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then
   begin
   open_custedit(n,'');
   exit;
   end;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      open_custedit(n,Form_peach.StringGridList.Cells[12,i])
end;

procedure TForm_peach.owcustom_10Click(Sender: TObject);
begin
openappn(10);
end;

procedure TForm_peach.owcustom_10tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',10)
  else
     openappn(10);
end;

procedure TForm_peach.owcustom_11Click(Sender: TObject);
begin
openappn(11);
end;

procedure TForm_peach.owcustom_11tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',11)
  else
     openappn(11);
end;

procedure TForm_peach.owcustom_12Click(Sender: TObject);
begin
openappn(12);
end;

procedure TForm_peach.owcustom_12tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',12)
  else
     openappn(12);
end;

procedure TForm_peach.owcustom_13Click(Sender: TObject);
begin
openappn(13);
end;

procedure TForm_peach.owcustom_13tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',13)
  else
     openappn(13);
end;

procedure TForm_peach.owcustom_14Click(Sender: TObject);
begin
openappn(14);
end;

procedure TForm_peach.owcustom_14tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',14)
  else
     openappn(14);
end;

procedure TForm_peach.owcustom_15Click(Sender: TObject);
begin
openappn(15);
end;

procedure TForm_peach.owcustom_15tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',15)
  else
     openappn(15);
end;

procedure TForm_peach.owcustom_16Click(Sender: TObject);
begin
openappn(16);
end;

procedure TForm_peach.owcustom_16tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',16)
  else
     openappn(16);
end;

procedure TForm_peach.owcustom_9Click(Sender: TObject);
begin
openappn(9);
end;

procedure TForm_peach.owcustom_9tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     openwith_cust('preview','cust',9)
  else
     openappn(9);
end;

procedure showtoolbar(ntoolbar:integer);
begin
if ntoolbar<>-1 then lasttoolbar:=ntoolbar;
case lasttoolbar of
1: begin
   Form_peach.PanelBarOpen1.Visible:=true;
   Form_peach.PanelBarOpen2.Visible:=false;
   Form_peach.PanelBarOpen3.Visible:=false;
   Form_peach.pmtool1.Checked:=true;
   Form_peach.pmtool2.Checked:=false;
   Form_peach.pmtool3.Checked:=false;
   end;
2:
   begin
   Form_peach.PanelBarOpen1.Visible:=false;
   Form_peach.PanelBarOpen2.Visible:=true;
   Form_peach.PanelBarOpen3.Visible:=false;
   Form_peach.pmtool1.Checked:=false;
   Form_peach.pmtool2.Checked:=true;
   Form_peach.pmtool3.Checked:=false;
   end;
3:
   begin
   Form_peach.PanelBarOpen1.Visible:=false;
   Form_peach.PanelBarOpen2.Visible:=false;
   Form_peach.PanelBarOpen3.Visible:=true;
   Form_peach.pmtool1.Checked:=false;
   Form_peach.pmtool2.Checked:=false;
   Form_peach.pmtool3.Checked:=true;
   end;
end;
settoolbar;
end;

procedure toggletoolbar;
begin
Form_peach.PanelBarOpen1.Visible:=false;
Form_peach.PanelBarOpen2.Visible:=false;
Form_peach.PanelBarOpen3.Visible:=false;
Form_peach.pmtool1.Checked:=false;
Form_peach.pmtool2.Checked:=false;
Form_peach.pmtool3.Checked:=false;
case lasttoolbar of
1: begin
   Form_peach.PanelBarOpen2.Visible:=true;
   lasttoolbar:=2;
   Form_peach.pmtool1.Checked:=true;
   end;
2: begin
   Form_peach.PanelBarOpen3.Visible:=true;
   lasttoolbar:=3;
   Form_peach.pmtool2.Checked:=true;
   end;
3: begin
   Form_peach.PanelBarOpen1.Visible:=true;
   lasttoolbar:=1;
   Form_peach.pmtool3.Checked:=true;
   end;
end;
settoolbar;
end;

procedure TForm_peach.pmcheckClick(Sender: TObject);
begin
  getcheck('neutral');
end;

procedure setusebreadcrumb(i,mode:integer);
begin
usebreadcrumb:=i;
Form_peach.mbtext.Checked:=false;
Form_peach.mbkde.Checked:=false;
Form_peach.mbgnome.Checked:=false;
Form_peach.mbgnome4.Checked:=false;
Form_peach.mbmac.Checked:=false;
case i of
   0: begin
      Form_peach.mbtext.Checked:=true;
      Form_peach.PanelClickAddress.Visible:=false;
      Form_peach.EditOpenIn1.Enabled:=true;
      altbread:=0;
      macbread:=0;
      end;
   1: begin
      Form_peach.mbkde.Checked:=true;
      Form_peach.PanelClickAddress.Visible:=true;
      Form_peach.EditOpenIn1.Enabled:=false;
      altbread:=0;
      macbread:=0;
      end;
   2: begin
      Form_peach.mbgnome.Checked:=true;
      Form_peach.PanelClickAddress.Visible:=true;
      Form_peach.EditOpenIn1.Enabled:=false;
      altbread:=1;
      macbread:=0;
      apply_theme;
      end;
   3: begin
      Form_peach.mbgnome4.Checked:=true;
      Form_peach.PanelClickAddress.Visible:=true;
      Form_peach.EditOpenIn1.Enabled:=false;
      altbread:=2;
      macbread:=0;
      apply_theme;
      end;
   4: begin
      Form_peach.mbmac.Checked:=true;
      Form_peach.PanelClickAddress.Visible:=true;
      Form_peach.EditOpenIn1.Enabled:=false;
      altbread:=1;
      macbread:=1;
      apply_theme;
      end;
   end;
if mode=1 then saverestartclosepeaapp;
end;

procedure TForm_peach.pmpropertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure do_showthumbs;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
if showthumbnails=1 then setshowthumbnails(0) else setshowthumbnails(1);
do_forcerefresh;
end;

procedure TForm_peach.mthumbimagesClick(Sender: TObject);
begin
do_showthumbs;
end;

procedure TForm_peach.pmpdupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TForm_peach.pmirmirrorClick(Sender: TObject);
begin
frombrowser_imgrotate('mirror');
end;

procedure TForm_peach.pmisBMPClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'BMP',0);
end;

procedure TForm_peach.pmisJPEG50Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',50);
end;

procedure TForm_peach.pmisJPEG75Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',75);
end;

procedure TForm_peach.pmisJPEGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',90);
end;

procedure TForm_peach.pmisPNGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'PNG',0);
end;

procedure TForm_peach.pmisTIFFClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'TIFF',0);
end;

procedure TForm_peach.pmjd10Click(Sender: TObject);
begin
opendevice(pmjd10.caption);
end;

procedure TForm_peach.pmjd11Click(Sender: TObject);
begin
opendevice(pmjd11.caption);
end;

procedure TForm_peach.pmjd12Click(Sender: TObject);
begin
opendevice(pmjd12.caption);
end;

procedure TForm_peach.pmjd13Click(Sender: TObject);
begin
opendevice(pmjd13.caption);
end;

procedure TForm_peach.pmjd14Click(Sender: TObject);
begin
opendevice(pmjd14.caption);
end;

procedure TForm_peach.pmjd15Click(Sender: TObject);
begin
opendevice(pmjd15.caption);
end;

procedure TForm_peach.pmjd16Click(Sender: TObject);
begin
opendevice(pmjd16.caption);
end;

procedure TForm_peach.pmjd17Click(Sender: TObject);
begin
opendevice(pmjd17.caption);
end;

procedure TForm_peach.pmjd18Click(Sender: TObject);
begin
opendevice(pmjd18.caption);
end;

procedure TForm_peach.pmjd19Click(Sender: TObject);
begin
opendevice(pmjd19.caption);
end;

procedure TForm_peach.pmjd1Click(Sender: TObject);
begin
opendevice(pmjd1.caption);
end;

procedure TForm_peach.pmjd20Click(Sender: TObject);
begin
opendevice(pmjd20.caption);
end;

procedure TForm_peach.pmjd21Click(Sender: TObject);
begin
opendevice(pmjd21.caption);
end;

procedure TForm_peach.pmjd22Click(Sender: TObject);
begin
opendevice(pmjd22.caption);
end;

procedure TForm_peach.pmjd23Click(Sender: TObject);
begin
opendevice(pmjd23.caption);
end;

procedure TForm_peach.pmjd24Click(Sender: TObject);
begin
opendevice(pmjd24.caption);
end;

procedure TForm_peach.pmjd25Click(Sender: TObject);
begin
opendevice(pmjd25.caption);
end;

procedure TForm_peach.pmjd26Click(Sender: TObject);
begin
opendevice(pmjd26.caption);
end;

procedure TForm_peach.pmjd2Click(Sender: TObject);
begin
opendevice(pmjd2.caption);
end;

procedure TForm_peach.pmjd3Click(Sender: TObject);
begin
opendevice(pmjd3.caption);
end;

procedure TForm_peach.pmjd4Click(Sender: TObject);
begin
opendevice(pmjd4.caption);
end;

procedure TForm_peach.pmjd5Click(Sender: TObject);
begin
opendevice(pmjd5.caption);
end;

procedure TForm_peach.pmjd6Click(Sender: TObject);
begin
opendevice(pmjd6.caption);
end;

procedure TForm_peach.pmjd7Click(Sender: TObject);
begin
opendevice(pmjd7.caption);
end;

procedure TForm_peach.pmjd8Click(Sender: TObject);
begin
opendevice(pmjd8.caption);
end;

procedure TForm_peach.pmjd9Click(Sender: TObject);
begin
opendevice(pmjd9.caption);
end;

procedure TForm_peach.MenuItemDonationsClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'donations.html',desk_env);
end;

procedure TForm_peach.MenuItemArchive_downloadsClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_downloads;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemExtAllHereClick(Sender: TObject);
begin
quickextract('');
end;

procedure TForm_peach.MenuItemExtAllToClick(Sender: TObject);
begin
do_extallto;
end;

procedure TForm_peach.MenuItemArchive_pubdocClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=public_documents;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_pubhomeClick(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=public_home;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemOpen_pubdocClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(public_documents);
end;

procedure TForm_peach.MenuItemOpen_pubhomeClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(public_home);
end;

procedure TForm_peach.MenuItemOpen_searchClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TForm_peach.mextalldesktopClick(Sender: TObject);
begin
quickextract(local_desktop);
end;

procedure TForm_peach.mextalldocumentsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}quickextract(usr_documents);{$ENDIF}
end;

procedure TForm_peach.mextallhereClick(Sender: TObject);
begin
quickextract('');
end;

procedure TForm_peach.mextalltoClick(Sender: TObject);
begin
do_extallto;
end;

procedure TForm_peach.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 TForm_peach.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 browsehistoryn(n:integer);
begin
if Form_peach.StringGridSessionHistory.RowCount>n then
   begin
   Form_peach.StringGridSessionHistory.Row:=Form_peach.StringGridSessionHistory.RowCount-n;
   browsehistory;
   end;
end;

procedure TForm_peach.mhistory1Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(1);
end;

procedure TForm_peach.mhistory2Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(2);
end;

procedure TForm_peach.mhistory3Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(3);
end;

procedure TForm_peach.mhistory4Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(4);
end;

procedure TForm_peach.mhistory5Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(5);
end;

procedure TForm_peach.mhistory6Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(6);
end;

procedure TForm_peach.mhistory7Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(7);
end;

procedure TForm_peach.mhistory8Click(Sender: TObject);
begin
showpanel('open');
browsehistoryn(8);
end;

procedure TForm_peach.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;
Form_peach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure shownavbar;
begin
with Form_peach do
begin
if splitter2size=0 then splitter2size:=180;
splitter2.Left:=splitter2size;
splitter2.Width:=1;
splitter2.enabled:=true;
end;
end;

procedure hidenavbar;
begin
with Form_peach do
begin
splitter2size:=0;
splitter2.Left:=splitter2size;
splitter2.Width:=0;
splitter2.enabled:=false;
end;
end;

procedure setnav(i:integer);
begin
navbar:=i;
Form_peach.MenuItemOrganizeNavbar.Checked:=true;
Form_peach.mshownavbar.Checked:=true;
Form_peach.pmsnav.Checked:=false;
Form_peach.pmstree.Checked:=false;
Form_peach.pmsnone.Checked:=false;
Form_peach.Treeview1.Visible:=false;
Form_peach.Shelltreeview1.Visible:=false;
Form_peach.Treeview2.Visible:=false;
Form_peach.mtogglesidebar.Caption:='←';
case i of
   0: begin
      shownavbar;
      Form_peach.Treeview1.Visible:=true;
      Form_peach.pmsnav.Checked:=true;
      end;
   1: begin
      shownavbar;
      Form_peach.Shelltreeview1.Visible:=true;
      Form_peach.pmstree.Checked:=true;
      end;
   2: begin
      shownavbar;
      Form_peach.Treeview1.Visible:=true;
      Form_peach.pmsnav.Checked:=true;
      end;
   3: begin
      hidenavbar;
      Form_peach.mtogglesidebar.Caption:='→';
      Form_peach.MenuItemOrganizeNavbar.Checked:=false;
      Form_peach.mshownavbar.Checked:=false;
      Form_peach.pmsnone.Checked:=true;
      end;
   end;
end;

procedure togglenavbar;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
case navbar of
   0: setnav(1);
   1: setnav(3);
   2: setnav(3);
   3: setnav(0);
   end;
end;

procedure TForm_peach.mtogglenavbarClick(Sender: TObject);
begin
togglenavbar;
end;

procedure TForm_peach.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 TForm_peach.MenuItemOrganizeNavbarClick(Sender: TObject);
begin
if navbar=3 then navbar:=0
else navbar:=3;
setnav(navbar);
end;

procedure TForm_peach.MenuItemOrganizeStatusbarClick(Sender: TObject);
begin
if lastbar=1 then showbar('statusbar')
else showbar('none');
end;

procedure TForm_peach.mtoggleopClick(Sender: TObject);
begin
if autoopen=0 then autoopen:=1 else autoopen:=0;
updateconf_modified;
end;

procedure TForm_peach.mtogglestatusbarClick(Sender: TObject);
begin
togglestatusbar;
end;

procedure openunitasarchive;
var
   s:ansistring;
begin
if fun='FILEBROWSER' then
   if Form_peach.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(Form_peach.StringGridList.Cells[12, Form_peach.StringGridList.Row], 1, 2);
      end
   else
      begin
      s:=copy(Form_peach.EditOpenIn.Text, 1, 2);
      if s='\\' then exit;
      end
else
   begin
   s:=copy(Form_peach.EditOpenIn.Text, 1, 2);
   if s='\\' then exit;
   end;
s:='\\.\'+s;
Form_peach.OpenDialogArchive.Filename:=s;
open_inputselect;
end;

procedure TForm_peach.mopenasarchiveClick(Sender: TObject);
begin
openunitasarchive;
end;

procedure TForm_peach.mgobrowserClick(Sender: TObject);
begin
stayopen:=true;
Form_peach.OpenDialogArchive.Filename:=EditOpenIn.Text;
showpanel('open');
open_inputselect;
end;

procedure TForm_peach.mextractarchiveClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then on_buttonarchiveclick
else
   {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.Top=0{$ENDIF} then on_buttonextokclick;
end;

procedure TForm_peach.MenuItemArchive_documents1Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_documents;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_home1Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=extractfilepath(home_path);
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemextexploreClick(Sender: TObject);
var
   s:ansistring;
begin
s:=EditOpenOut.Text;
if s='' then exit;
if s[1]='<' then exit;
cp_explorepath(s, desk_env);
end;

procedure TForm_peach.MenuItemOpen_LastClick(Sender: TObject);
begin
if lastoutpath='' then lastoutpath:=local_desktop;
Form_peach.EditOpenOut.Text:=extractfilepath(lastoutpath);
end;

procedure TForm_peach.mf8Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then jumpto('bookmark1');
end;

procedure TForm_peach.mgoextlayoutClick(Sender: TObject);
begin
list_toextractor('none','full');
end;

procedure TForm_peach.mgotype7zClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=0;
   archive_type_select('7Z');
   end;
end;

procedure TForm_peach.mgotype7zsfxClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=8;
   archive_type_select(txt_sfx+' '+STR_7Z);
   end;
end;

procedure TForm_peach.mgotypebz2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=3;
   archive_type_select('BZip2');
   end;
end;

procedure TForm_peach.mgotypegzClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=5;
   archive_type_select(STR_GZIP);
   end;
end;

procedure TForm_peach.mgotypetarClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=11;
   archive_type_select(STR_TAR);
   end;
end;

procedure TForm_peach.mgotypezipClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then
   begin
   cbType.ItemIndex:=15;
   archive_type_select(STR_ZIP);
   end;
end;

procedure TForm_peach.mLangClick(Sender: TObject);
begin
showpanel('defaults');//changelanguage;
clicklabel_options(LabelTitleOptions1, BevelTitleOptions1);
end;

procedure TForm_peach.mlistClick(Sender: TObject);
begin
setbrowsertype(1);
end;

procedure TForm_peach.mpathdesk1Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=local_desktop;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.mpathexplore1Click(Sender: TObject);
var
   s:ansistring;
begin
s:=EditName3.Text+Edit4.Text;
if s='' then exit;
if s=txt_mypc then exit;
if s[1]='<' then exit;
if ((archive_type='7z') and (Form_peach.CheckBoxArchive6.State=cbChecked)) or
   ((archive_type='arc') and (Form_peach.CheckBoxArc2.State=cbChecked))
then s:=s+'.exe'
else s:=s+'.'+archive_type;
cp_explorepath(s, desk_env);
end;

procedure TForm_peach.mpathreset1Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=lastoutpath;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.mpathself1Click(Sender: TObject);
var
   s:ansistring;
begin
if StringGrid1.Rowcount<2 then exit;
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=extractfilepath(s);
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.mPeaTrackerClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-more.html',desk_env);
end;

procedure TForm_peach.mr9Click(Sender: TObject);
begin
showpanel('open');
if stringgridrecent.visible=false then showbar('recent');
navrefresh;
end;

procedure set_rowselect;
begin
rowselect:=not(rowselect);
Form_peach.ListView1.Rowselect:=rowselect;
Form_peach.mrowselect.checked:=rowselect;
Form_peach.pmrow.checked:=rowselect;
end;

procedure TForm_peach.mrowselectClick(Sender: TObject);
begin
set_rowselect;
end;

procedure TForm_peach.msetpwClick(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 TForm_peach.mshiftf3Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then launch_rrsearch;
end;

procedure open_diskclean;
var
   P:tprocessutf8;
   s,cl:ansistring;
begin
{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if Form_peach.EditOpenIn.Text=txt_mypc then s:=copy(Form_peach.StringGridList.Cells[12, Form_peach.StringGridList.Row], 1, 2)
   else s:=copy(Form_peach.EditOpenIn.Text, 1, 2)
else s:=copy(Form_peach.EditOpenIn.Text, 1, 2);
P:=tprocessutf8.Create(nil);
if s<>'' then cl:='cleanmgr /d '+s
else cl:='cleanmgr';
P.Executable:='cleanmgr';
if s<>'' then P.Parameters.Add('/d '+s);
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure disk_convert;
var
   P:tprocessutf8;
   s,cl:ansistring;
begin
{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if Form_peach.EditOpenIn.Text=txt_mypc then s:=copy(Form_peach.StringGridList.Cells[12, Form_peach.StringGridList.Row], 1, 2)
   else s:=copy(Form_peach.EditOpenIn.Text, 1, 2)
else s:=copy(Form_peach.EditOpenIn.Text, 1, 2);
P:=tprocessutf8.Create(nil);
cl:='convert '+s+' /FS:NTFS';
P.Executable:='convert';
P.Parameters.Add(s);
P.Parameters.Add('/FS:NTFS');
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure open_cpl;
var
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
P.Executable:='control';
if Form_peach.Visible=true then Application.ProcessMessages;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure open_diskmanagement;
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('diskmgmt.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure open_defrag;
var
   s:ansistring;
begin
{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then
   if checklistsel<>0 then exit;
if fun='FILEBROWSER' then
   if Form_peach.EditOpenIn.Text=txt_mypc then s:=copy(Form_peach.StringGridList.Cells[12, Form_peach.StringGridList.Row], 1, 2)
   else s:=copy(Form_peach.EditOpenIn.Text, 1, 2)
else s:=copy(Form_peach.EditOpenIn.Text, 1, 2);
if validatecl(s)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+s); exit; end;
if winver='nt5' then ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('dfrg.msc'), PWideChar (s), PWideChar (''), SW_SHOWNORMAL)
else ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('dfrgui.exe'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
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;

procedure TForm_peach.MenuItemOpen_downloads1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(usr_downloads);
end;

procedure TForm_peach.MenuItemHistoryBookClick(Sender: TObject);
begin
case lastbar of
   3: addtobookmarks('*recent');
   4: addtobookmarks('*history');
   end;
end;

procedure TForm_peach.MenuItemNavigateClick(Sender: TObject);
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.Top=0{$ENDIF} then sg:=StringGrid1
else sg:=StringGrid2;
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;
Form_peach.EditUn7zaFilter.Text:='*';
showpanel('open');
listdir(s,false,false);
addtohistory;
end;

procedure TForm_peach.MenuItemOpen_desktop1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(local_desktop);
end;

procedure TForm_peach.MenuItemOpen_documents1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(usr_documents);
end;

procedure TForm_peach.MenuItemOpen_hereClick(Sender: TObject);
begin
if StringGrid2.Rowcount<2 then exit;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.EditOpenIn.Text);
end;

procedure TForm_peach.MenuItemOpen_home1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(home_path);
end;

procedure TForm_peach.MenuItemPWClick(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
end;

procedure hexpselected;
var
   cl,in_param:ansistring;
   P:tprocessutf8;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then sg:=Form_peach.StringGrid1
else sg:=Form_peach.StringGrid2;
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)+' HEXPREVIEW '+in_param;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.MenuItemToolhexpClick(Sender: TObject);
begin
hexpselected;
end;

procedure TForm_peach.mEnvstrClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' envstr';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.MenuItemBookmarksClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.Top=0{$ENDIF} then
   if StringGrid1.Rowcount=1 then exit
   else
else
   if StringGrid2.Rowcount=1 then exit;
addtobookmarks('*layout');
end;

procedure TForm_peach.MenuItemOpen_addtobookmarksClick(Sender: TObject);
begin
addtobookmarks('*browsercontext');
end;

function checklistsel:integer; //0 if current row is selected
begin
checklistsel:=-1;
if updatinglistview=true then exit;
if Form_peach.StringGridList.Rowcount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if Form_peach.StringGridList.Cells[16,Form_peach.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 Form_peach.StringGridList.Rowcount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if Form_peach.ListView1.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 Form_peach.StringGridList.Rowcount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
nsel:=0;
strsel:='';
rc:=Form_peach.StringGridList.Rowcount;
for i:=1 to rc-1 do
   if Form_peach.ListView1.Items[i-1].Selected=true then
      begin
      nsel:=nsel+1;
      case nsel of
         1: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         2: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         3: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         4: strsel:=strsel+Form_peach.ListView1.Items[i-1].Caption+char($0D)+char($0A);
         5: strsel:=strsel+Form_peach.ListView1.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 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:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]
      else {$IFDEF MSWINDOWS}s:='C:\';{$ELSE}s:=directoryseparator;{$ENDIF}
   end
else
begin
if fun='FILEBROWSER' then
   if Form_peach.EditOpenIn.Text=txt_mypc then
      if checklistsel=0 then s:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]
      else {$IFDEF MSWINDOWS}s:='C:\'{$ELSE}s:=directoryseparator{$ENDIF}
   else
      begin
      if iscontext=0 then s:=Form_peach.EditOpenIn1.Text
      else
         if checklistsel<>0 then s:=extractfilepath(Form_peach.EditOpenIn.Text)
         else
            if Form_peach.StringGridList.Cells[2,Form_peach.StringGridList.Row]=txt_list_isfolder then s:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]
            else
               begin
               s:=extractfilepath(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
               if s='' then s:=Form_peach.EditOpenIn.Text;
               end
      end
else s:=extractfilepath(Form_peach.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 TForm_peach.pmjumpmusicClick(Sender: TObject);
begin
jumpto('usrmusic');
end;

procedure do_organizebookmarks;
begin
if Form_peach.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 TForm_peach.pmjumppicturesClick(Sender: TObject);
begin
jumpto('usrpictures');
end;

procedure TForm_peach.pmjumpusersClick(Sender: TObject);
begin
  jumpto('users');
end;

procedure TForm_peach.pmjumpvideosClick(Sender: TObject);
begin
  jumpto('usrvideos');
end;

procedure TForm_peach.pmmore1Click(Sender: TObject);
begin
openadvappn(1);
end;

procedure TForm_peach.pmmore2Click(Sender: TObject);
begin
openadvappn(2);
end;

procedure TForm_peach.pmmore3Click(Sender: TObject);
begin
openadvappn(3);
end;

procedure TForm_peach.pmmore4Click(Sender: TObject);
begin
openadvappn(4);
end;

procedure TForm_peach.pmmore5Click(Sender: TObject);
begin
openadvappn(5);
end;

procedure TForm_peach.pmmore6Click(Sender: TObject);
begin
openadvappn(6);
end;

procedure TForm_peach.pmmore7Click(Sender: TObject);
begin
openadvappn(7);
end;

procedure TForm_peach.pmmore8Click(Sender: TObject);
begin
openadvappn(8);
end;

procedure TForm_peach.pmmorefun_detailsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('details')
else archive_funsel('details','all');
end;

procedure TForm_peach.pmmorefun_propertiesClick(Sender: TObject);
begin
browser_fileproperties('');
end;

procedure hexpselected_list;
var
   cl,in_param:ansistring;
   i:integer;
   P:tprocessutf8;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then
   begin
   if checkfiledirname(Form_peach.EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.EditOpenIn.Text); exit; end;
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
   cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' HEXPREVIEW '+in_param;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   P.Free;
   exit;
   end;
if checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
      in_param:=stringdelim(escapefilename(Form_peach.StringGridList.Cells[12,i],desk_env));
      cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' HEXPREVIEW '+in_param;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P.Execute;
      P.Free;
      end;
end;

procedure TForm_peach.pmmstatus_bookmarksClick(Sender: TObject);
begin
  showbar('bookmarks');
end;

procedure TForm_peach.pmmstatus_clipboardClick(Sender: TObject);
begin
  showbar('clip');
end;

procedure TForm_peach.pmmstatus_raClick(Sender: TObject);
begin
  showbar('recent');
end;

procedure TForm_peach.pmmstatus_rClick(Sender: TObject);
begin
  showbar('sessionrecent');
end;

procedure TForm_peach.pmmstatus_statusClick(Sender: TObject);
begin
  showbar('statusbar');
end;

procedure TForm_peach.pmorganizebookmarksClick(Sender: TObject);
begin
  do_organizebookmarks;
end;

procedure TForm_peach.pmpowershellClick(Sender: TObject);
begin
  browser_commandprompt(1,1,'');
end;

procedure TForm_peach.pmqjdropboxClick(Sender: TObject);
begin
jumpto('dropbox');
end;

procedure TForm_peach.pmqjgoogledriveClick(Sender: TObject);
begin
jumpto('googledrive');
end;

procedure TForm_peach.pmqjmyboxfilesClick(Sender: TObject);
begin
jumpto('myboxfiles');
end;

procedure TForm_peach.pmqjonedriveClick(Sender: TObject);
begin
jumpto('onedrive');
end;

procedure TForm_peach.pmqjskydriveClick(Sender: TObject);
begin
jumpto('sharepoint');
end;

procedure TForm_peach.pmqjubuntuoneClick(Sender: TObject);
begin
jumpto('yandexdisk');
end;

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

procedure TForm_peach.pmqnointdirClick(Sender: TObject);
begin
smartextclick;
end;

procedure TForm_peach.pmquickdeskClick(Sender: TObject);
begin
jumpto('desktop');
end;

procedure TForm_peach.pmquickhomeClick(Sender: TObject);
begin
jumpto('home');
end;

procedure TForm_peach.pmquickoaClick(Sender: TObject);
begin
open_archive;
end;

procedure TForm_peach.pmquickopClick(Sender: TObject);
begin
peazip_browse;
end;

procedure TForm_peach.pmquicksdClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TForm_peach.MenuItemOpen_commandpromptClick(Sender: TObject);
begin
browser_commandprompt(1,0,'');
end;

procedure removeunits;
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:='RUNDLL32 SHELL32.DLL,Control_RunDLL hotplug.dll';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.mshiftf8Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then jumpto('bookmark3');
end;

procedure togglemenubar;
begin
with form_peach do
begin
if showmenu=false then
   begin
   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;
   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;
   if (prevpanel='archive') or (prevpanel='extract') then
      begin
      mLayout.Visible:=true;
      mLayout.Enabled:=true;
      end;
   if prevpanel='open' then
      begin
      mEdit.Visible:=true;
      mBrowse.Visible:=true;
      mOrganize.Visible:=true;
      mEdit.Enabled:=true;
      mBrowse.Enabled:=true;
      mOrganize.Enabled:=true;
      end;
   end;
end;
Form_peach.Repaint;
end;

procedure TForm_peach.MenuItemOrganizeMbarClick(Sender: TObject);
begin
{$IFNDEF DARWIN}
showmenu:=not(showmenu);
togglemenubar;
showpanel('open');
{$ENDIF}
end;

procedure TForm_peach.mshowmenuClick(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 TForm_peach.msmalliconClick(Sender: TObject);
begin
setbrowsertype(2);
end;

procedure set_swapbars;
begin
with form_peach 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 TForm_peach.mswapbarsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
swapbars:=not(swapbars);
saverestartclosepeaapp;
end;

procedure TForm_peach.mSystemIntegrationClick(Sender: TObject);
begin
configure_systemintegration(true);
restartpeaapp;
exit_nosave;
end;

procedure setthl;
begin
Form_peach.ButtonUn7za1.Flat:=not(thighlight);
Form_peach.ButtonUn7za4.Flat:=not(thighlight);
Form_peach.ButtonUn7zaTo.Flat:=not(thighlight);
Form_peach.ButtonUn7za5.Flat:=not(thighlight);
Form_peach.ButtonUn7za6.Flat:=not(thighlight);
Form_peach.ButtonUn7za7.Flat:=not(thighlight);
Form_peach.ButtonUn7za8.Flat:=not(thighlight);
Form_peach.ButtonUn7za11.Flat:=not(thighlight);
Form_peach.ButtonDelete.Flat:=not(thighlight);
Form_peach.ButtonUn7za9.Flat:=not(thighlight);
Form_peach.ButtonCut.Flat:=not(thighlight);
Form_peach.ButtonPaste.Flat:=not(thighlight);
Form_peach.ButtonRename.Flat:=not(thighlight);
Form_peach.ButtonCopy.Flat:=not(thighlight);
Form_peach.Buttoncmto.Flat:=not(thighlight);
Form_peach.Buttonfmactions.Flat:=not(thighlight);
Form_peach.ButtonOpenWith.Flat:=not(thighlight);
Form_peach.ButtonOpenactions.Flat:=not(thighlight);
Form_peach.ButtonDup.Flat:=not(thighlight);
Form_peach.ButtonNF.Flat:=not(thighlight);
Form_peach.Buttonfmactions1.Flat:=not(thighlight);
Form_peach.ButtonImgRl.Flat:=not(thighlight);
Form_peach.ButtonImgResize.Flat:=not(thighlight);
Form_peach.ButtonImgRR.Flat:=not(thighlight);
Form_peach.ButtonImgCrop.Flat:=not(thighlight);
Form_peach.ButtonImg6.Flat:=not(thighlight);
Form_peach.ButtonImgR.Flat:=not(thighlight);
Form_peach.ButtonImgRes.Flat:=not(thighlight);
Form_peach.ButtonDup1.Flat:=not(thighlight);
Form_peach.ButtonRename1.Flat:=not(thighlight);

Form_peach.mthl.checked:=thighlight;
end;

procedure settoolbar;
begin
Form_peach.MenuItemOrganizeToolbar.checked:=true;
Form_peach.mshowtoolbar.checked:=true;
settoolbardisp;
Form_peach.mtoggletoolbar.Caption:='↑';
Form_peach.ImageFlat.visible:=false;
Form_peach.pmtoollarge.Checked:=false;
Form_peach.pmtoolmedium.Checked:=false;
Form_peach.pmtoolsmall.Checked:=false;
Form_peach.pmtoolcompact.Checked:=false;
Form_peach.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 Form_peach.pmtoollarge.Checked:=true
      else Form_peach.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;
      Form_peach.pmtoolsmall.Checked:=true;
      end;
   {5: begin
      setsmalltoolbar3;
      end;
   6: begin
      settexttoolbar;
      end;}
   7: begin
      Form_peach.MenuItemOrganizeToolbar.checked:=false;
      Form_peach.mshowtoolbar.checked:=false;
      form_peach.panelbaropen.height:=0;
      Form_peach.mtoggletoolbar.Caption:='↓';
      Form_peach.ImageFlat.visible:=true;
      if ntoolstyle=4 then Form_peach.pmtoolcompact.Checked:=true;
      if ntoolstyle=5 then Form_peach.pmtoolnone.Checked:=true;
      end;
   end;
Form_peach.pmmoretest.Visible:=Form_peach.ImageFlat.visible;
Form_peach.pmmoreadd.Visible:=false;
Form_peach.pmmoreconvert.Visible:=false;
Form_peach.pmmoreextract.Visible:=false;
if Form_peach.ImageFlat.visible=true then Form_peach.PanelSPaddress.Width:=1 else Form_peach.PanelSPaddress.Width:=8;
if ntoolstyle=4 then
   begin
   case lasttoolbar of
   1: begin
      Form_peach.ImageFlatadd.Visible:=true;
      Form_peach.ImageFlatconvert.Visible:=true;
      Form_peach.ImageFlatext.Visible:=true;
      Form_peach.ImageFlatdup.Visible:=false;
      Form_peach.ImageFlatfolder.Visible:=false;
      Form_peach.ImageFlatren.Visible:=false;
      Form_peach.ImageFlattransform.Visible:=false;
      Form_peach.ImageFlatcrop.Visible:=false;
      Form_peach.PanelSPaddress.AnchorSideRight.Control:=Form_peach.ImageFlatadd;
      end;
   2: begin
      Form_peach.ImageFlatadd.Visible:=false;
      Form_peach.ImageFlatconvert.Visible:=false;
      Form_peach.ImageFlatext.Visible:=false;
      Form_peach.ImageFlatdup.Visible:=true;
      Form_peach.ImageFlatfolder.Visible:=true;
      Form_peach.ImageFlatren.Visible:=true;
      Form_peach.ImageFlattransform.Visible:=false;
      Form_peach.ImageFlatcrop.Visible:=false;
      Form_peach.PanelSPaddress.AnchorSideRight.Control:=Form_peach.ImageFlatren;
      Form_peach.pmmoreadd.Visible:=true;
      Form_peach.pmmoreconvert.Visible:=true;
      Form_peach.pmmoreextract.Visible:=true;
      end;
   3: begin
      Form_peach.ImageFlatadd.Visible:=false;
      Form_peach.ImageFlatconvert.Visible:=false;
      Form_peach.ImageFlatext.Visible:=false;
      Form_peach.ImageFlatdup.Visible:=true;
      Form_peach.ImageFlatfolder.Visible:=false;
      Form_peach.ImageFlatren.Visible:=false;
      Form_peach.ImageFlattransform.Visible:=true;
      Form_peach.ImageFlatcrop.Visible:=true;
      Form_peach.PanelSPaddress.AnchorSideRight.Control:=Form_peach.ImageFlatcrop;
      Form_peach.pmmoreadd.Visible:=true;
      Form_peach.pmmoreconvert.Visible:=true;
      Form_peach.pmmoreextract.Visible:=true;
      end;
   end;
   Form_peach.ImageFlattestmore.Visible:=true;
   end
else
   begin
   Form_peach.ImageFlatadd.Visible:=false;
   Form_peach.ImageFlatconvert.Visible:=false;
   Form_peach.ImageFlatext.Visible:=false;
   Form_peach.ImageFlatdup.Visible:=false;
   Form_peach.ImageFlatfolder.Visible:=false;
   Form_peach.ImageFlatren.Visible:=false;
   Form_peach.ImageFlattransform.Visible:=false;
   Form_peach.ImageFlatcrop.Visible:=false;
   Form_peach.ImageFlattestmore.Visible:=false;
   end;
settoolbarw;
setthl;
settonewfolder(tonewfolder);
end;

procedure TForm_peach.MenuItemOrganizeToolbarClick(Sender: TObject);
begin
if toolsize=7 then toolsize:=0
else toolsize:=7;
ptoolsize:=toolsize;
settoolbar;
end;

procedure TForm_peach.mthlClick(Sender: TObject);
begin
thighlight:=not(thighlight);
setthl;
end;

procedure TForm_peach.mtogglenewClick(Sender: TObject);
begin
mtogglenew.checked:=not(mtogglenew.checked);
if mtogglenew.checked=true then tonewfolder:=1
else tonewfolder:=0;
updateconf_modified;
settonewfolder(tonewfolder);
end;

procedure TForm_peach.mTrayClick(Sender: TObject);
begin
TrayIcon1.visible:=true;
Form_peach.visible:=false;
end;

procedure settpreset(i:integer);
begin
Form_peach.ListView1.BeginUpdate;
{$IFDEF MSWINDOWS}
case i of
1: begin
setbrowsertype(0);
setbrowsersize(0);
setshowthumbnails(0);
end;
2: begin
setbrowsertype(0);
setbrowsersize(1);
setshowthumbnails(1);
end;
3: begin
setbrowsertype(1);
setbrowsersize(0);
setshowthumbnails(0);
end;
4: begin
setbrowsertype(1);
setbrowsersize(1);
setshowthumbnails(1);
end;
5: begin
setbrowsertype(2);
setbrowsersize(0);
setshowthumbnails(1);
end;
6: begin
setbrowsertype(2);
setbrowsersize(1);
setshowthumbnails(1);
end;
end;
{$ELSE}
case i of
1: begin
if (browsertype<>0) or (browsersize<>0) or (showthumbnails<>0) then
   begin
   browsertype:=0;
   smalliconsize:=16;
   mediconsize:=16;
   largeiconsize:=48;
   browsersize:=0;
   showthumbnails:=0;
   saverestartclosepeaapp;
   end;
end;
2: begin
setbrowsertype(0);
smalliconsize:=48;
mediconsize:=48;
largeiconsize:=96;
browsersize:=1;
showthumbnails:=0;
saverestartclosepeaapp;
end;
3: begin
setbrowsertype(1);
setbrowsersize(0);
setshowthumbnails(0);
saverestartclosepeaapp;
end;
4: begin
setbrowsertype(1);
setbrowsersize(1);
setshowthumbnails(0);
saverestartclosepeaapp;
end;
5: begin
setbrowsertype(2);
setbrowsersize(0);
setshowthumbnails(0);
saverestartclosepeaapp;
end;
end;
{$ENDIF}
Form_peach.ListView1.EndUpdate;
do_forcerefresh;
tpreset:=i;
end;

procedure TForm_peach.mprelistClick(Sender: TObject);
begin
  settpreset(4);
end;

procedure TForm_peach.mRecent1fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent1f.Caption);
end;

procedure TForm_peach.mRecent2fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent2f.Caption);
end;

procedure TForm_peach.mRecent3fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent3f.Caption);
end;

procedure TForm_peach.mRecent4fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent4f.Caption);
end;

procedure TForm_peach.mRecent5fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent5f.Caption);
end;

procedure TForm_peach.mRecent6fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent6f.Caption);
end;

procedure TForm_peach.mRecent7fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent7f.Caption);
end;

procedure TForm_peach.mRecent8fClick(Sender: TObject);
begin
showpanel('open');
opendir(mRecent8f.Caption);
end;

procedure TForm_peach.msamedayClick(Sender: TObject);
begin
select_by('datesameday','neutralsel');
end;

procedure TForm_peach.msamemonthClick(Sender: TObject);
begin
select_by('datesamemonth','neutralsel');
end;

procedure TForm_peach.msameweekClick(Sender: TObject);
begin
select_by('datesameweek','neutralsel');
end;

procedure TForm_peach.msameyearClick(Sender: TObject);
begin
select_by('datesameyear','neutralsel');
end;

procedure TForm_peach.msamehourClick(Sender: TObject);
begin
select_by('datesamehour','neutralsel');
end;

procedure TForm_peach.mscheduledscriptsClick(Sender: TObject);
begin
if not(directoryexists(confpath+'Scheduled scripts'+DirectorySeparator)) then mkdir(confpath+'Scheduled scripts'+DirectorySeparator);
cp_open(confpath+'Scheduled scripts'+DirectorySeparator,desk_env);
end;

procedure TForm_peach.mselectadvClick(Sender: TObject);
begin
advancedselect;
end;

procedure TForm_peach.msize0Click(Sender: TObject);
begin
select_by('sizeempty','neutralsel');
end;

procedure TForm_peach.msize100kClick(Sender: TObject);
begin
select_by('size100k','neutralsel');
end;

procedure TForm_peach.msize100mClick(Sender: TObject);
begin
select_by('size100m','neutralsel');
end;

procedure TForm_peach.msize10mClick(Sender: TObject);
begin
select_by('size10m','neutralsel');
end;

procedure TForm_peach.msizeoverClick(Sender: TObject);
begin
select_by('sizeover','neutralsel');
end;

procedure TForm_peach.msizesimilar50Click(Sender: TObject);
begin
select_by('sizesimilar50','neutralsel');
end;

procedure TForm_peach.msizesimilarClick(Sender: TObject);
begin
select_by('sizesimilar10','neutralsel');
end;

procedure TForm_peach.mtaskschedulerClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('taskschd.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.mtoggletbribClick(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 setdecostyle;
begin
with Form_peach do
begin
mtstyle_none.Checked:=false;
mtstyle_shadow.Checked:=false;
mtstyle_frame.Checked:=false;
case deco_style of
   0: mtstyle_none.Checked:=true;
   1: mtstyle_shadow.Checked:=true;
   2: mtstyle_frame.Checked:=true;
   end;
end;
end;

procedure TForm_peach.mtstyle_frameClick(Sender: TObject);
begin
deco_style:=2;
setdecostyle;
do_forcerefresh;
end;

procedure TForm_peach.mtstyle_noneClick(Sender: TObject);
begin
deco_style:=0;
setdecostyle;
do_forcerefresh;
end;

procedure TForm_peach.mtstyle_shadowClick(Sender: TObject);
begin
deco_style:=1;
setdecostyle;
do_forcerefresh;
end;

procedure TForm_peach.munpeaextractClick(Sender: TObject);
begin
select_all('0');
if open_archive<>1 then exit;
do_extract;
end;

procedure addextwebsearch;
var
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.Top=0{$ENDIF} then sg:=Form_peach.StringGrid1
else sg:=Form_peach.StringGrid2;
if sg.Rowcount=1 then exit;
s:=sg.Cells[1,sg.Row];
if s<>'' then run_websearch(s);
end;

procedure TForm_peach.mwebsClick(Sender: TObject);
begin
addextwebsearch;
end;

procedure getscheduledtaskname(stype:integer);
var
   s,s1:ansistring;
begin
with form_peach do
begin
if stype=0 then
   begin
   s:=txt_archive;
   s1:=extractfilename(Edit5.Text);
   cutextension(s1);
   if s1<>'' then s:=s+'_'+s1
   else s:=s+'_1';
   schedaddname.Text:=s;
   end
else
   begin
   s:=txt_caption_extract+'_1';
   schedaddname1.Text:=s;
   end;
end;
end;

procedure TForm_peach.PanelHintAddMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintadd;
end;

procedure TForm_peach.PanelHintExtractMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
hide_panelhintextract;
end;

procedure TForm_peach.mpreaverageClick(Sender: TObject);
begin
settpreset(5);
end;

procedure TForm_peach.mpredetailsClick(Sender: TObject);
begin
settpreset(2);
end;

procedure TForm_peach.mprelargeClick(Sender: TObject);
begin
settpreset(6);
end;

procedure TForm_peach.mprelightClick(Sender: TObject);
begin
settpreset(1);
end;

procedure TForm_peach.mprelightlistClick(Sender: TObject);
begin
settpreset(3);
end;

procedure TForm_peach.mpretoggleClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
tpreset:=tpreset+1;
if tpreset>6 then tpreset:=1;
settpreset(tpreset);
end;

procedure TForm_peach.mTutorialClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions7, BevelTitleOptions7);
end;

procedure checkcontextadd;
begin
if contextconvert_switch=true then archive_convert
else
   if fun='FILEBROWSER' then
      begin
      Form_peach.CheckBoxSameArc.State:=cbUnchecked;
      Form_peach.CheckBoxSeparate.State:=cbUnchecked;
      Form_peach.CheckBoxConvert.State:=cbUnchecked;
      Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
      Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
      addtoarchive_selected;
      end;
contextconvert_switch:=false;
end;

procedure TForm_peach.munsearchClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TForm_peach.mUserClick(Sender: TObject);
var
   P:tprocessutf8;
   cl,u:ansistring;
   r:boolean;
begin
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}
u:='Administrator';
r:=pInputQuery(txt_run_as, txt_user_name, '', u, false);
if not(r) then exit;
cl:='runas /env /user:'+u+' "'+executable_path+'peazip.exe"';
{$ELSE}//system needs to support sudo
u:='root';
r:=pInputQuery(txt_run_as, txt_user_name, '', u, false);
if not(r) then exit;
cl:='sudo -u '+u+' '''+executable_path+'peazip''';
{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
exit_withsave;
end;

procedure TForm_peach.mwebsearchClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=true{$ELSE}if PanelOpen.top=0{$ENDIF} then begin websearch_sel; exit; end;
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.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 openadvappn(n:integer);
var
   i:integer;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then
   begin
   open_advcustedit(n,'');
   exit;
   end;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      open_advcustedit(n,Form_peach.StringGridList.Cells[12,i])
end;

procedure TForm_peach.owcustom10Click(Sender: TObject);
begin
openadvappn(2);
end;

procedure TForm_peach.owcustom11Click(Sender: TObject);
begin
openadvappn(3);
end;

procedure TForm_peach.owcustom12Click(Sender: TObject);
begin
openadvappn(4);
end;

procedure TForm_peach.owcustom13Click(Sender: TObject);
begin
openadvappn(5);
end;

procedure TForm_peach.owcustom14Click(Sender: TObject);
begin
openadvappn(6);
end;

procedure TForm_peach.owcustom15Click(Sender: TObject);
begin
openadvappn(7);
end;

procedure TForm_peach.owcustom16Click(Sender: TObject);
begin
openadvappn(8);
end;

procedure TForm_peach.owcustom1Click(Sender: TObject);
begin
openappn(1);
end;

procedure TForm_peach.owcustom2Click(Sender: TObject);
begin
openappn(2);
end;

procedure TForm_peach.owcustom3Click(Sender: TObject);
begin
openappn(3);
end;

procedure TForm_peach.owcustom4Click(Sender: TObject);
begin
openappn(4);
end;

procedure TForm_peach.owcustom5Click(Sender: TObject);
begin
openappn(5);
end;

procedure TForm_peach.owcustom6Click(Sender: TObject);
begin
openappn(6);
end;

procedure TForm_peach.owcustom7Click(Sender: TObject);
begin
openappn(7);
end;

procedure TForm_peach.owcustom8Click(Sender: TObject);
begin
openappn(8);
end;

procedure TForm_peach.owcustom9Click(Sender: TObject);
begin
openadvappn(1);
end;

procedure TForm_peach.pajdn10Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn10.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn11Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn11.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn12Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn12.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn13Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn13.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn14Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn14.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn15Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn15.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn16Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn16.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn17Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn17.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn18Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn18.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn19Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn19.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn1Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn1.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn20Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn20.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn21Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn21.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn22Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn22.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn23Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn23.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn24Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn24.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn25Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn25.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn26Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn26.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn2Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn2.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn3Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn3.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn4Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn4.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn5Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn5.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn6Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn6.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn7Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn7.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn8Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn8.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pajdn9Click(Sender: TObject);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=extractfilename(s);
s:=pajdn9.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditName3.Text:=s;
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure showaddresstextfield;
begin
Form_peach.PanelClickAddress.Visible:=false;
if altbread=1 then Form_peach.Bevel20.Visible:=false;
Form_peach.EditOpenIn1.Enabled:=true;
if Form_peach.Visible=true then Form_peach.EditOpenIn1.SetFocus;
end;

procedure TForm_peach.PanelClickAddressClick(Sender: TObject);
begin
showaddresstextfield;
end;

procedure clear_clipboard;
var
   rc,i:integer;
begin
rc:=Form_peach.StringGridList.RowCount;
if rc>0 then
begin
   for i:=1 to rc-1 do
      begin
      Form_peach.StringGridList.Cells[16,i]:='0';
      Form_peach.StringGridList.Cells[0,i]:='';
      end;
   Form_peach.StringGridList.Cells[16,1]:='1';
   Form_peach.StringGridList.Row:=1;
   Form_peach.Refresh;
   end;
setlength(clipcontent,0);
Form_peach.StringGridClipboard.Rowcount:=1;
Form_peach.StringGridClipboard.Autosizecolumns;
update_listview_sel;
end;

procedure TForm_peach.CheckBoxClipClick(Sender: TObject);
begin
if CheckBoxClip.State=cbUnchecked then clipmode:=0
else clipmode:=1;
if clipmode=0 then clear_clipboard;
updateconf_modified;
end;

procedure TForm_peach.pclip_clearclipClick(Sender: TObject);
begin
clear_clipboard;
end;

procedure TForm_peach.pclip_removeitemClick(Sender: TObject);
var
   i:integer;
begin
if Form_peach.StringGridClipboard.Rowcount<2 then exit;
if Form_peach.StringGridClipboard.Row=0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]=Form_peach.StringGridClipboard.Cells[3,Form_peach.StringGridClipboard.Row] then
      begin
      Form_peach.StringGridList.Cells[0,i]:='';
      Form_peach.StringGridList.Cells[16,i]:='0';
      end;
Form_peach.Refresh;
//remove clipboard item
for i:=Form_peach.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
Form_peach.StringGridClipboard.Rowcount:=Form_peach.StringGridClipboard.Rowcount-1;
if Form_peach.StringGridClipboard.Rowcount>1 then
   for i:=0 to length(clipcontent)-1 do
      begin
      Form_peach.StringGridClipboard.Cells[0,i+1]:=clipcontent[i,3];
      Form_peach.StringGridClipboard.Cells[1,i+1]:=clipcontent[i,1];
      Form_peach.StringGridClipboard.Cells[2,i+1]:=clipcontent[i,2];
      Form_peach.StringGridClipboard.Cells[3,i+1]:=clipcontent[i,0];
      Form_peach.StringGridClipboard.Cells[4,i+1]:=clipcontent[i,4];
      Form_peach.StringGridClipboard.Cells[5,i+1]:=clipcontent[i,5];
      Form_peach.StringGridClipboard.Cells[6,i+1]:=clipcontent[i,6];
      end;
Form_peach.StringGridClipboard.Autosizecolumns;
update_listview_sel;
end;

procedure TForm_peach.pcustompathexploreClick(Sender: TObject);
var
   s:ansistring;
begin
s:=extractfilepath(patheditor.Text);
cp_open(s,desk_env);
end;

procedure TForm_peach.pmbc1Click(Sender: TObject);
begin
browsefiledir(pmbc1.caption);
end;

procedure TForm_peach.pmbc2Click(Sender: TObject);
begin
browsefiledir(pmbc2.caption);
end;

procedure TForm_peach.pmbc3Click(Sender: TObject);
begin
browsefiledir(pmbc3.caption);
end;

procedure TForm_peach.pmbc4Click(Sender: TObject);
begin
browsefiledir(pmbc4.caption);
end;

procedure TForm_peach.pmbc5Click(Sender: TObject);
begin
browsefiledir(pmbc5.caption);
end;

procedure TForm_peach.pmbc6Click(Sender: TObject);
begin
browsefiledir(pmbc6.caption);
end;

procedure TForm_peach.pmbc7Click(Sender: TObject);
begin
browsefiledir(pmbc7.caption);
end;

procedure TForm_peach.pmbc8Click(Sender: TObject);
begin
browsefiledir(pmbc8.caption);
end;

procedure TForm_peach.po_cplClick(Sender: TObject);
begin
open_cpl;
end;

procedure TForm_peach.po_detailsClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('details')
else archive_funsel('details','all');
end;

procedure dispenv;
var
   P:tprocessutf8;
   cl:ansistring;
begin
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' envstr';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.po_envstrClick(Sender: TObject);
begin
dispenv;
end;

procedure TForm_peach.po_flatClick(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 TForm_peach.po_hexpClick(Sender: TObject);
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
hexpselected_list;
end;

procedure TForm_peach.po_im_1024Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1024,768,2,'no',0);
end;

procedure TForm_peach.po_im_200Click(Sender: TObject);
begin
frombrowser_imgtransform(200,200,0,0,1,'no',0);
end;

procedure TForm_peach.po_im_4kcinemaClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,4096,2160,2,'no',0);
end;

procedure TForm_peach.po_im_4ktvClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,3840,2160,2,'no',0);
end;

procedure TForm_peach.po_im_50Click(Sender: TObject);
begin
frombrowser_imgtransform(50,50,0,0,1,'no',0);
end;

procedure TForm_peach.po_im_75Click(Sender: TObject);
begin
frombrowser_imgtransform(75,75,0,0,1,'no',0);
end;

procedure TForm_peach.po_im_BMPClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'BMP',0);
end;

procedure TForm_peach.po_im_cropClick(Sender: TObject);
begin
do_crop;
end;

procedure TForm_peach.po_im_hdClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1080,2,'no',0);
end;

procedure TForm_peach.po_im_JPEG50Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',50);
end;

procedure TForm_peach.po_im_JPEG75Click(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',75);
end;

procedure TForm_peach.po_im_JPEGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'JPEG',90);
end;

procedure TForm_peach.po_im_modifyClick(Sender: TObject);
begin
do_resize;
end;

procedure TForm_peach.po_im_PNGClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'PNG',0);
end;

procedure TForm_peach.po_im_rlClick(Sender: TObject);
begin
frombrowser_imgrotate('left');
end;

procedure TForm_peach.po_im_rrClick(Sender: TObject);
begin
frombrowser_imgrotate('right');
end;

procedure TForm_peach.po_im_TIFFClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,0,0,0,'TIFF',0);
end;

procedure TForm_peach.po_im_wuxgaClick(Sender: TObject);
begin
frombrowser_imgtransform(0,0,1920,1080,2,'no',0);
end;

procedure TForm_peach.po_manageClick(Sender: TObject);
begin
open_diskmanagement;
end;

procedure TForm_peach.po_removeunitsClick(Sender: TObject);
begin
removeunits;
end;

procedure TForm_peach.po_rename_addClick(Sender: TObject);
begin
rename_files('add');
end;

procedure TForm_peach.po_rename_appenddirClick(Sender: TObject);
begin
rename_files('dirappend');
end;

procedure TForm_peach.po_rename_extClick(Sender: TObject);
begin
rename_files('extension');
end;

procedure TForm_peach.po_rename_lowercaseClick(Sender: TObject);
begin
rename_files('lowercase');
end;

procedure TForm_peach.po_rename_deleteClick(Sender: TObject);
begin
rename_files('delete');
end;

procedure TForm_peach.po_rename_prependdirClick(Sender: TObject);
begin
rename_files('dirprepend');
end;

procedure TForm_peach.po_rename_replaceClick(Sender: TObject);
begin
rename_files('replace');
end;

procedure TForm_peach.po_rename_replace_caseClick(Sender: TObject);
begin
rename_files('replacecase');
end;

procedure TForm_peach.po_rename_timestampClick(Sender: TObject);
begin
rename_files('timestamp');
end;

procedure TForm_peach.po_rename_uppercaseClick(Sender: TObject);
begin
rename_files('uppercase');
end;

procedure TForm_peach.po_securedeletefreeClick(Sender: TObject);
begin
sanitizedisk(1);
end;

procedure TForm_peach.po_selectadvClick(Sender: TObject);
begin
advancedselect;
end;

procedure TForm_peach.po_selectallClick(Sender: TObject);
var
   i:integer;
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=true{$ELSE}if PanelOpen.top=0{$ENDIF} then
   if ListView1.Visible=true then
      begin
      if Form_peach.StringGridList.Rowcount<2 then exit;
      if Form_peach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to Form_peach.StringGridList.Rowcount-1 do
         Form_peach.StringGridList.Cells[16,i]:='1';
      update_listview_sel;
      end;
end;

procedure TForm_peach.po_setpwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TForm_peach.po_taskClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('taskschd.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure open_taskman;
var
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
P.Executable:='taskmgr';
if Form_peach.Visible=true then Application.ProcessMessages;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_taskmanClick(Sender: TObject);
begin
open_taskman;
end;

procedure TForm_peach.pmbookmarksClick(Sender: TObject);
begin
addtobookmarks('*browser');
end;

procedure TForm_peach.pmBrowserClick(Sender: TObject);
begin
stayopen:=true;
Form_peach.OpenDialogArchive.Filename:=EditOpenIn.Text;
showpanel('open');
open_inputselect;
end;

procedure TForm_peach.pmcommandClick(Sender: TObject);
begin
browser_commandprompt(1,0,'');
end;

procedure explorewinroot;
begin
{$IFDEF MSWINDOWS}
if winver<>'nt6+' then
   ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('Explorer'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL)
else
   ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('Explorer'), PWideChar ('/E,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}'), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure browser_explorepath(iscontext:integer);
var
   s:ansistring;
begin
if checkfdwin<>0 then exit;
with Form_peach do
begin
if iscontext=0 then
   begin
   if fun='FILEBROWSER' then
      begin
      s:=Form_peach.EditOpenIn1.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
else
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:=Form_peach.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;
end;

procedure TForm_peach.pmexploreClick(Sender: TObject);
begin
browser_explorepath(1);
end;

procedure TForm_peach.pmh1Click(Sender: TObject);
begin
browsehistoryn(1);
end;

procedure TForm_peach.pmh2Click(Sender: TObject);
begin
browsehistoryn(2);
end;

procedure TForm_peach.pmh3Click(Sender: TObject);
begin
browsehistoryn(3);
end;

procedure TForm_peach.pmh4Click(Sender: TObject);
begin
browsehistoryn(4);
end;

procedure TForm_peach.pmh5Click(Sender: TObject);
begin
browsehistoryn(5);
end;

procedure TForm_peach.pmh6Click(Sender: TObject);
begin
browsehistoryn(6);
end;

procedure TForm_peach.pmh7Click(Sender: TObject);
begin
browsehistoryn(7);
end;

procedure TForm_peach.pmh8Click(Sender: TObject);
begin
browsehistoryn(8);
end;

procedure TForm_peach.pmh9Click(Sender: TObject);
begin
if StringGridSessionHistory.visible=false then showbar('history');
end;

procedure TForm_peach.pmhr1Click(Sender: TObject);
begin
open_archive_fromname(pmhr1.Caption);
end;

procedure TForm_peach.pmhr2Click(Sender: TObject);
begin
open_archive_fromname(pmhr2.Caption);
end;

procedure TForm_peach.pmhr3Click(Sender: TObject);
begin
open_archive_fromname(pmhr3.Caption);
end;

procedure TForm_peach.pmhr4Click(Sender: TObject);
begin
open_archive_fromname(pmhr4.Caption);
end;

procedure TForm_peach.pmhr5Click(Sender: TObject);
begin
open_archive_fromname(pmhr5.Caption);
end;

procedure TForm_peach.pmhr6Click(Sender: TObject);
begin
open_archive_fromname(pmhr6.Caption);
end;

procedure TForm_peach.pmhr7Click(Sender: TObject);
begin
open_archive_fromname(pmhr7.Caption);
end;

procedure TForm_peach.pmhr8Click(Sender: TObject);
begin
open_archive_fromname(pmhr8.Caption);
end;

procedure TForm_peach.pmhr9Click(Sender: TObject);
begin
if stringgridrecent.visible=false then showbar('recent');
end;

procedure TForm_peach.pmiresetClick(Sender: TObject);
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilter1.Text:='*';
FormInput.CheckBox1.state:=cbchecked;
resetsearch;
end;

procedure TForm_peach.pmjb10Click(Sender: TObject);
begin
browsebookmark(10);
end;

procedure TForm_peach.pmjb11Click(Sender: TObject);
begin
browsebookmark(11);
end;

procedure TForm_peach.pmjb12Click(Sender: TObject);
begin
browsebookmark(12);
end;

procedure TForm_peach.pmjb13Click(Sender: TObject);
begin
browsebookmark(13);
end;

procedure TForm_peach.pmjb14Click(Sender: TObject);
begin
browsebookmark(14);
end;

procedure TForm_peach.pmjb15Click(Sender: TObject);
begin
browsebookmark(15);
end;

procedure TForm_peach.pmjb16Click(Sender: TObject);
begin
browsebookmark(16);
end;

procedure TForm_peach.pmjb17Click(Sender: TObject);
begin
browsebookmark(17);
end;

procedure TForm_peach.pmjb18Click(Sender: TObject);
begin
browsebookmark(18);
end;

procedure TForm_peach.pmjb19Click(Sender: TObject);
begin
browsebookmark(19);
end;

procedure TForm_peach.pmjb1Click(Sender: TObject);
begin
browsebookmark(1);
end;

procedure TForm_peach.pmjb20Click(Sender: TObject);
begin
browsebookmark(20);
end;

procedure TForm_peach.pmjb21Click(Sender: TObject);
begin
browsebookmark(21);
end;

procedure TForm_peach.pmjb22Click(Sender: TObject);
begin
browsebookmark(22);
end;

procedure TForm_peach.pmjb23Click(Sender: TObject);
begin
browsebookmark(23);
end;

procedure TForm_peach.pmjb24Click(Sender: TObject);
begin
if stringgridbookmarks.visible=false then showbar('bookmarks');
end;

procedure TForm_peach.pmjb2Click(Sender: TObject);
begin
browsebookmark(2);
end;

procedure TForm_peach.pmjb3Click(Sender: TObject);
begin
browsebookmark(3);
end;

procedure TForm_peach.pmjb4Click(Sender: TObject);
begin
browsebookmark(4);
end;

procedure TForm_peach.pmjb5Click(Sender: TObject);
begin
browsebookmark(5);
end;

procedure TForm_peach.pmjb6Click(Sender: TObject);
begin
browsebookmark(6);
end;

procedure TForm_peach.pmjb7Click(Sender: TObject);
begin
browsebookmark(7);
end;

procedure TForm_peach.pmjb8Click(Sender: TObject);
begin
browsebookmark(8);
end;

procedure TForm_peach.pmjb9Click(Sender: TObject);
begin
browsebookmark(9);
end;

procedure TForm_peach.MenuItemOpen_archiveClick(Sender: TObject);
begin
open_archive;
end;

procedure TForm_peach.MenuItemOpen_exploreClick(Sender: TObject);
begin
browser_explorepath(1);
end;

procedure TForm_peach.MenuItemOpen_pathClick(Sender: TObject);
begin
openpath;
end;

procedure TForm_peach.MenuItemOpen_refreshClick(Sender: TObject);
begin
navrefresh;
end;

procedure TForm_peach.mgolayoutClick(Sender: TObject);
begin
showpanel('archive');
showpanel_trick;
end;

procedure do_forcerefresh;
begin
updateid:='';
prevupdateid:='';
navrefresh;
end;

procedure TForm_peach.mRefreshClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
if (fun='UN7Z') and (EditUn7zaFilter1.Caption='*') then
   browsefiledir(pmbc1.caption)
else
   do_forcerefresh;
{$IFDEF MSWINDOWS}populatepcmenu;{$ENDIF}
end;

procedure removeselected;
var
   i,rc:integer;
begin
i:=1;
rc:=Form_peach.StringGrid1.RowCount;
while i<rc do
   begin
   if Form_peach.StringGrid1.Cells[11,i]='1' then
      begin
      Form_peach.StringGrid1.DeleteColRow(false,i);
      i:=i-1;
      rc:=Form_peach.StringGrid1.RowCount;
      end;
   i:=i+1;
   end;
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
end;

procedure removeselected_ext;
var
   i,rc:integer;
begin
i:=1;
rc:=Form_peach.StringGrid2.RowCount;
while i<rc do
   begin
   if Form_peach.StringGrid2.Cells[11,i]='1' then
      begin
      Form_peach.StringGrid2.DeleteColRow(false,i);
      i:=i-1;
      rc:=Form_peach.StringGrid2.RowCount;
      end;
   i:=i+1;
   end;
updatecontent_ext;
end;

function webopen(s:ansistring):integer;
var
   w:widestring;
begin
webopen:=-1;
if s='' then exit;
{$IFDEF MSWINDOWS}
w:=utf8decode(s);
webopen:=ShellExecuteW(Form_peach.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_websearch(s:ansistring);
var
   i:integer;
begin
FormWeb.EditInputQuery.Text:=s;
FormWeb.Showmodal;
case FormWeb.ModalResult of
   mrOk:
      begin
      s:=FormWeb.EditInputQuery.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.CheckGroup1.Checked[0]=true then webopen('https://www.amazon.com/s/field-keywords='+s);
         if FormWeb.CheckGroup1.Checked[1]=true then webopen('https://www.apple.com/search/?q='+s);
         if FormWeb.CheckGroup1.Checked[2]=true then webopen('https://www.bing.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[3]=true then webopen('https://www.britannica.com/bps/search?query='+s);
         if FormWeb.CheckGroup1.Checked[4]=true then webopen('https://duckduckgo.com/?q='+s+'&ia=web');
         if FormWeb.CheckGroup1.Checked[5]=true then webopen('https://shop.ebay.com/?_nkw='+s);
         if FormWeb.CheckGroup1.Checked[6]=true then webopen('https://www.facebook.com/search/?q='+s);
         if FormWeb.CheckGroup1.Checked[7]=true then webopen('https://github.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[8]=true then webopen('https://www.google.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[9]=true then webopen('https://maps.google.com/maps?q='+s);
         if FormWeb.CheckGroup1.Checked[10]=true then webopen('https://www.google.com/search?q='+s+'&tbs=nws:1');
         if FormWeb.CheckGroup1.Checked[11]=true then webopen('https://translate.google.com/#es|en|'+s);
         if FormWeb.CheckGroup1.Checked[12]=true then webopen('https://www.imdb.com/find?s=all&q='+s);
         if FormWeb.CheckGroup1.Checked[13]=true then webopen('https://www.instagram.com/explore/tags/'+s+'/');
         if FormWeb.CheckGroup1.Checked[14]=true then webopen('https://www.linkedin.com/vsearch/f?keywords='+s);
         if FormWeb.CheckGroup1.Checked[15]=true then webopen('https://osdn.net/search/?type_of_search=soft&words='+s);
         if FormWeb.CheckGroup1.Checked[16]=true then webopen('https://pinterest.com/search/pins/?q='+s);
         if FormWeb.CheckGroup1.Checked[17]=true then webopen('https://www.reddit.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[18]=true then webopen('https://sourceforge.net/directory/os:windows/?q='+s);
         if FormWeb.CheckGroup1.Checked[19]=true then webopen('https://stackoverflow.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[20]=true then webopen('https://twitter.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[21]=true then webopen('https://www.wikipedia.org/wiki/Special:Search?search='+s+'&fulltext=Search');
         if FormWeb.CheckGroup1.Checked[22]=true then webopen('https://www.wiktionary.org/wiki/Special:Search?search='+s+'&fulltext=Search');
         if FormWeb.CheckGroup1.Checked[23]=true then webopen('https://www.youtube.com/results?search_query='+s);
         end
      else
         begin
         if FormWeb.CheckGroup1.Checked[0]=true then webopen('https://www.amazon.com');
         if FormWeb.CheckGroup1.Checked[1]=true then webopen('https://www.apple.com/search/?q=');
         if FormWeb.CheckGroup1.Checked[2]=true then webopen('https://www.bing.com');
         if FormWeb.CheckGroup1.Checked[3]=true then webopen('https://www.britannica.com');
         if FormWeb.CheckGroup1.Checked[4]=true then webopen('https://duckduckgo.com/');
         if FormWeb.CheckGroup1.Checked[5]=true then webopen('https://www.ebay.com');
         if FormWeb.CheckGroup1.Checked[6]=true then webopen('https://www.facebook.com');
         if FormWeb.CheckGroup1.Checked[7]=true then webopen('https://github.com');
         if FormWeb.CheckGroup1.Checked[8]=true then webopen('https://www.google.com');
         if FormWeb.CheckGroup1.Checked[9]=true then webopen('https://maps.google.com');
         if FormWeb.CheckGroup1.Checked[10]=true then webopen('https://news.google.com');
         if FormWeb.CheckGroup1.Checked[11]=true then webopen('https://translate.google.com');
         if FormWeb.CheckGroup1.Checked[12]=true then webopen('https://www.imdb.com');
         if FormWeb.CheckGroup1.Checked[13]=true then webopen('https://www.instagram.com');
         if FormWeb.CheckGroup1.Checked[14]=true then webopen('https://www.linkedin.com');
         if FormWeb.CheckGroup1.Checked[15]=true then webopen('https://osdn.net/search/');
         if FormWeb.CheckGroup1.Checked[16]=true then webopen('https://pinterest.com');
         if FormWeb.CheckGroup1.Checked[17]=true then webopen('https://www.reddit.com');
         if FormWeb.CheckGroup1.Checked[18]=true then webopen('https://sourceforge.net');
         if FormWeb.CheckGroup1.Checked[19]=true then webopen('https://stackoverflow.com');
         if FormWeb.CheckGroup1.Checked[20]=true then webopen('https://twitter.com');
         if FormWeb.CheckGroup1.Checked[21]=true then webopen('https://www.wikipedia.org');
         if FormWeb.CheckGroup1.Checked[22]=true then webopen('https://www.wiktionary.org');
         if FormWeb.CheckGroup1.Checked[23]=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:=Form_peach.StringGridList.Cells[1,Form_peach.StringGridList.Row]
else getmainfiledirname(s);
run_websearch(s);
end;

procedure TForm_peach.MenuItemOpenWebClick(Sender: TObject);
begin
websearch_sel;
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:=Form_peach.StringGridList.Cells[12,Form_peach.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(Form_peach.Handle, PWideChar ('open'), PWideChar('"'+w+'"'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ELSE}
try
P:=tprocessutf8.Create(nil);
cl:=stringdelim(s);
{$IFDEF DARWIN}
if s[1] = '/' then cl:='open '+cl
else cl:='open -a '+cl;
{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
except
end;
{$ENDIF}
if s<>Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row] then prevrun:=s;
end;

procedure TForm_peach.pnb10Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb10.Caption);
end;

procedure TForm_peach.pnb11Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb11.Caption);
end;

procedure TForm_peach.pnb12Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb12.Caption);
end;

procedure TForm_peach.pnb13Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb13.Caption);
end;

procedure TForm_peach.pnb14Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb14.Caption);
end;

procedure TForm_peach.pnb15Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb15.Caption);
end;

procedure TForm_peach.pnb16Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb16.Caption);
end;

procedure TForm_peach.pnb17Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb17.Caption);
end;

procedure TForm_peach.pnb18Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb18.Caption);
end;

procedure TForm_peach.pnb19Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb19.Caption);
end;

procedure TForm_peach.pnb1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb1.Caption);
end;

procedure TForm_peach.pnb20Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb20.Caption);
end;

procedure TForm_peach.pnb21Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb21.Caption);
end;

procedure TForm_peach.pnb22Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb22.Caption);
end;

procedure TForm_peach.pnb23Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb23.Caption);
end;

procedure TForm_peach.pnb2Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb2.Caption);
end;

procedure TForm_peach.pnb3Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb3.Caption);
end;

procedure TForm_peach.pnb4Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb4.Caption);
end;

procedure TForm_peach.pnb5Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb5.Caption);
end;

procedure TForm_peach.pnb6Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb6.Caption);
end;

procedure TForm_peach.pnb7Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb7.Caption);
end;

procedure TForm_peach.pnb8Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb8.Caption);
end;

procedure TForm_peach.pnb9Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnb9.Caption);
end;

procedure archivemenu_name(pathpart:ansistring);
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=pathpart;
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.pnba10Click(Sender: TObject);
begin
archivemenu_name(pnba10.Caption);
end;

procedure TForm_peach.pnba11Click(Sender: TObject);
begin
archivemenu_name(pnba11.Caption);
end;

procedure TForm_peach.pnba12Click(Sender: TObject);
begin
archivemenu_name(pnba12.Caption);
end;

procedure TForm_peach.pnba13Click(Sender: TObject);
begin
archivemenu_name(pnba13.Caption);
end;

procedure TForm_peach.pnba14Click(Sender: TObject);
begin
archivemenu_name(pnba14.Caption);
end;

procedure TForm_peach.pnba15Click(Sender: TObject);
begin
archivemenu_name(pnba15.Caption);
end;

procedure TForm_peach.pnba16Click(Sender: TObject);
begin
archivemenu_name(pnba16.Caption);
end;

procedure TForm_peach.pnba17Click(Sender: TObject);
begin
archivemenu_name(pnba17.Caption);
end;

procedure TForm_peach.pnba18Click(Sender: TObject);
begin
archivemenu_name(pnba18.Caption);
end;

procedure TForm_peach.pnba19Click(Sender: TObject);
begin
archivemenu_name(pnba19.Caption);
end;

procedure TForm_peach.pnba1Click(Sender: TObject);
begin
archivemenu_name(pnba1.Caption);
end;

procedure TForm_peach.pnba20Click(Sender: TObject);
begin
archivemenu_name(pnba20.Caption);
end;

procedure TForm_peach.pnba21Click(Sender: TObject);
begin
archivemenu_name(pnba21.Caption);
end;

procedure TForm_peach.pnba22Click(Sender: TObject);
begin
archivemenu_name(pnba22.Caption);
end;

procedure TForm_peach.pnba23Click(Sender: TObject);
begin
archivemenu_name(pnba23.Caption);
end;

procedure TForm_peach.pnba2Click(Sender: TObject);
begin
archivemenu_name(pnba2.Caption);
end;

procedure TForm_peach.pnba3Click(Sender: TObject);
begin
archivemenu_name(pnba3.Caption);
end;

procedure TForm_peach.pnba4Click(Sender: TObject);
begin
archivemenu_name(pnba4.Caption);
end;

procedure TForm_peach.pnba5Click(Sender: TObject);
begin
archivemenu_name(pnba5.Caption);
end;

procedure TForm_peach.pnba6Click(Sender: TObject);
begin
archivemenu_name(pnba6.Caption);
end;

procedure TForm_peach.pnba7Click(Sender: TObject);
begin
archivemenu_name(pnba7.Caption);
end;

procedure TForm_peach.pnba8Click(Sender: TObject);
begin
archivemenu_name(pnba8.Caption);
end;

procedure TForm_peach.pnba9Click(Sender: TObject);
begin
archivemenu_name(pnba9.Caption);
end;

procedure TForm_peach.pnh1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh1.Caption);
end;

procedure TForm_peach.pnh2Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh2.Caption);
end;

procedure TForm_peach.pnh3Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh3.Caption);
end;

procedure TForm_peach.pnh4Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh4.Caption);
end;

procedure TForm_peach.pnh5Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh5.Caption);
end;

procedure TForm_peach.pnh6Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh6.Caption);
end;

procedure TForm_peach.pnh7Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh7.Caption);
end;

procedure TForm_peach.pnh8Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=extractfilepath(pnh8.Caption);
end;

procedure TForm_peach.pnha1Click(Sender: TObject);
begin
archivemenu_name(pnha1.Caption);
end;

procedure TForm_peach.pnha2Click(Sender: TObject);
begin
archivemenu_name(pnha2.Caption);
end;

procedure TForm_peach.pnha3Click(Sender: TObject);
begin
archivemenu_name(pnha3.Caption);
end;

procedure TForm_peach.pnha4Click(Sender: TObject);
begin
archivemenu_name(pnha4.Caption);
end;

procedure TForm_peach.pnha5Click(Sender: TObject);
begin
archivemenu_name(pnha5.Caption);
end;

procedure TForm_peach.pnha6Click(Sender: TObject);
begin
archivemenu_name(pnha6.Caption);
end;

procedure TForm_peach.pnha7Click(Sender: TObject);
begin
archivemenu_name(pnha7.Caption);
end;

procedure TForm_peach.pnha8Click(Sender: TObject);
begin
archivemenu_name(pnha8.Caption);
end;

procedure TForm_peach.pnr1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr1.Caption;
end;

procedure TForm_peach.pnr2Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr2.Caption;
end;

procedure TForm_peach.pnr3Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr3.Caption;
end;

procedure TForm_peach.pnr4Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr4.Caption;
end;

procedure TForm_peach.pnr5Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr5.Caption;
end;

procedure TForm_peach.pnr6Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr6.Caption;
end;

procedure TForm_peach.pnr7Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr7.Caption;
end;

procedure TForm_peach.pnr8Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=pnr8.Caption;
end;

procedure TForm_peach.pnra1Click(Sender: TObject);
begin
archivemenu_name(pnra1.Caption);
end;

procedure TForm_peach.pnra2Click(Sender: TObject);
begin
archivemenu_name(pnra2.Caption);
end;

procedure TForm_peach.pnra3Click(Sender: TObject);
begin
archivemenu_name(pnra3.Caption);
end;

procedure TForm_peach.pnra4Click(Sender: TObject);
begin
archivemenu_name(pnra4.Caption);
end;

procedure TForm_peach.pnra5Click(Sender: TObject);
begin
archivemenu_name(pnra5.Caption);
end;

procedure TForm_peach.pnra6Click(Sender: TObject);
begin
archivemenu_name(pnra6.Caption);
end;

procedure TForm_peach.pnra7Click(Sender: TObject);
begin
archivemenu_name(pnra7.Caption);
end;

procedure TForm_peach.pnra8Click(Sender: TObject);
begin
archivemenu_name(pnra8.Caption);
end;

procedure TForm_peach.pojdn10Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn10.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn11Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn11.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn12Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn12.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn13Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn13.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn14Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn14.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn15Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn15.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn16Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn16.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn17Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn17.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn18Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn18.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn19Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn19.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn1Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn1.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn20Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn20.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn21Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn21.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn22Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn22.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn23Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn23.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn24Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn24.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn25Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn25.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn26Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn26.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn2Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn2.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn3Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn3.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn4Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn4.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn5Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn5.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn6Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn6.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn7Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn7.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn8Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn8.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.pojdn9Click(Sender: TObject);
var
   s:ansistring;
begin
s:=pojdn9.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=extractfilepath(s);
end;

procedure TForm_peach.PopupOpenPopup(Sender: TObject);
begin
{$IFDEF MSWINDOWS}popupclosed:=true;{$ENDIF}
try
   shint:='';
   prevshint:='';
   h.hide;
except
end;
update_selstatus;
MenuItemExtAllTo.visible:=true;
MenuItemExtAllHere.visible:=true;
MenuItemExtAllHereSmart.visible:=true;
MenuItemExtAllHereNew.visible:=true;
if fun='FILEBROWSER' then
   begin
   if checkextinput_noduplicatecheck=false then
      begin
      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 TForm_peach.powcustom10Click(Sender: TObject);
begin
openwith_cust('preview','adv',2);
end;

procedure TForm_peach.powcustom11Click(Sender: TObject);
begin
openwith_cust('preview','adv',3);
end;

procedure TForm_peach.powcustom12Click(Sender: TObject);
begin
openwith_cust('preview','adv',4);
end;

procedure TForm_peach.powcustom13Click(Sender: TObject);
begin
openwith_cust('preview','adv',5);
end;

procedure TForm_peach.powcustom14Click(Sender: TObject);
begin
openwith_cust('preview','adv',6);
end;

procedure TForm_peach.powcustom15Click(Sender: TObject);
begin
openwith_cust('preview','adv',7);
end;

procedure TForm_peach.powcustom16Click(Sender: TObject);
begin
openwith_cust('preview','adv',8);
end;

procedure TForm_peach.powcustom1Click(Sender: TObject);
begin
openwith_cust('preview','cust',1);
end;

procedure TForm_peach.powcustom2Click(Sender: TObject);
begin
openwith_cust('preview','cust',2);
end;

procedure TForm_peach.powcustom3Click(Sender: TObject);
begin
openwith_cust('preview','cust',3);
end;

procedure TForm_peach.powcustom4Click(Sender: TObject);
begin
openwith_cust('preview','cust',4);
end;

procedure TForm_peach.powcustom5Click(Sender: TObject);
begin
openwith_cust('preview','cust',5);
end;

procedure TForm_peach.powcustom6Click(Sender: TObject);
begin
openwith_cust('preview','cust',6);
end;

procedure TForm_peach.powcustom7Click(Sender: TObject);
begin
openwith_cust('preview','cust',7);
end;

procedure TForm_peach.powcustom8Click(Sender: TObject);
begin
openwith_cust('preview','cust',8);
end;

procedure TForm_peach.powcustom_10Click(Sender: TObject);
begin
openwith_cust('preview','cust',10);
end;

procedure TForm_peach.powcustom_11Click(Sender: TObject);
begin
openwith_cust('preview','cust',11);
end;

procedure TForm_peach.powcustom_12Click(Sender: TObject);
begin
openwith_cust('preview','cust',12);
end;

procedure TForm_peach.powcustom_13Click(Sender: TObject);
begin
openwith_cust('preview','cust',13);
end;

procedure TForm_peach.powcustom_14Click(Sender: TObject);
begin
openwith_cust('preview','cust',14);
end;

procedure TForm_peach.powcustom_15Click(Sender: TObject);
begin
openwith_cust('preview','cust',15);
end;

procedure TForm_peach.powcustom_16Click(Sender: TObject);
begin
openwith_cust('preview','cust',16);
end;

procedure TForm_peach.powcustom_9Click(Sender: TObject);
begin
openwith_cust('preview','cust',9);
end;

procedure TForm_peach.po_alltasksClick(Sender: TObject);
begin
do_alltasks;
end;

procedure TForm_peach.powcustom9Click(Sender: TObject);
begin
openwith_cust('preview','adv',1);
end;

procedure TForm_peach.po_computerClick(Sender: TObject);
begin
open_compmanagement;
end;

procedure TForm_peach.po_convertarchiveClick(Sender: TObject);
begin
archive_convert;
end;

procedure TForm_peach.po_convertClick(Sender: TObject);
begin
disk_convert;
end;

procedure TForm_peach.CheckBox4Click(Sender: TObject);
begin
on_CheckBox4_click;
end;

procedure TForm_peach.CheckBoxARC1Click(Sender: TObject);
begin
on_CheckBoxARC1Click;
end;

procedure TForm_peach.CheckBoxArchiveHistoryClick(Sender: TObject);
begin
on_CheckBoxArchiveHistory_click;
saverestartclosepeaapp;
end;

procedure TForm_peach.CheckBoxArchiveOFClick(Sender: TObject);
begin
CheckBoxArchiveOF_onclick;
end;

procedure TForm_peach.CheckBoxIgnoreDispClick(Sender: TObject);
begin
on_CheckBoxIgnoreDisp_click;
end;

procedure TForm_peach.CheckBoxIgnoreSelClick(Sender: TObject);
begin
on_CheckBoxIgnoreSel_click;
end;

procedure TForm_peach.CheckBoxQuadMaxClick(Sender: TObject);
begin
on_CheckBoxQuadMax_click;
end;

procedure TForm_peach.CheckBoxShowHintsClick(Sender: TObject);
begin
on_CheckBoxShowHintsClick;
end;

procedure TForm_peach.CheckBoxTarBeforeClick(Sender: TObject);
var
   s:ansistring;
begin
if CheckBoxTarBefore.State=cbChecked then
   begin
   if CheckBoxSeparate.State=cbChecked then
      begin
      Edit4.Enabled:=true;
      suggest_outname(s,Form_peach.cbType.Text,Form_peach.StringGrid1.Row);
      Edit4.Text:=extractfilename(s);
      Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
      end;
   CheckBoxSeparate.State:=cbUnChecked;
   CheckBoxSeparate.Enabled:=false;
   CheckBoxSameArc.State:=cbUnChecked;
   CheckBoxSameArc.Enabled:=false;
   CheckBoxConvert.State:=cbUnChecked;
   CheckBoxConvert.Enabled:=false;
   CheckBoxConvert0.visible:=CheckBoxConvert.Checked;
   CheckBoxConvert1.visible:=CheckBoxConvert.Checked;
   end
else
   begin
   CheckBoxSameArc.Enabled:=true;
   CheckBoxSeparate.Enabled:=true;
   CheckBoxConvert.Enabled:=true;
   end;
end;

procedure on_CheckBoxWindowStatus_click;
begin
if Form_peach.CheckBoxWindowStatus.State=cbChecked then ws:=1 else ws:=0;
end;

procedure TForm_peach.CheckBoxWindowStatusClick(Sender: TObject);
begin
on_CheckBoxWindowStatus_click;
end;

procedure TForm_peach.ColorButton1ColorChanged(Sender: TObject);
begin
color1:=ColorToString(ColorButton1.ButtonColor);
BevelTitleOptions6.Color:=ColorButton1.ButtonColor;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.ComboBoxARCalgoChange(Sender: TObject);
begin
on_ComboBoxARCalgoChange;
getarccaption(Form_peach.cbType.Text);
end;

procedure TForm_peach.ComboBoxARCChange(Sender: TObject);
begin
on_ComboBoxARCChange;
end;

procedure TForm_peach.ComboBoxArchive1Change(Sender: TObject);
begin
ComboBoxArchive1_onchange;
end;

procedure ComboBoxArchive4_onchange;
begin
if settingvalues=false then
   with Form_peach do
      begin
      compression_level:=ComboBoxArchive4.Text;
      case cbType.Text of
         STR_7Z : level_7z:=ComboBoxArchive4.ItemIndex;
         STR_XZ : level_xz:=ComboBoxArchive4.ItemIndex;
         STR_BZIP2 : level_bzip2:=ComboBoxArchive4.ItemIndex;
         STR_GZIP : level_gz:=ComboBoxArchive4.ItemIndex;
         STR_ZIP : level_zip:=ComboBoxArchive4.ItemIndex;
         end;
      set_values(archive_type,compression_method,compression_level);
      getarccaption(Form_peach.cbType.Text);
      end;
setquickcompset('7Z');
end;

procedure TForm_peach.ComboBoxArcSolidChange(Sender: TObject);
begin
on_ComboBoxArcSolidChange;
end;

procedure TForm_peach.ComboBoxPAQ1Change(Sender: TObject);
begin
on_ComboBoxPAQ1Change;
end;

procedure TForm_peach.ComboBoxPEA2Change(Sender: TObject);
begin
ComboBoxPEA2_onchange;
getarccaption(Form_peach.cbType.Text);
end;

procedure TForm_peach.ComboBoxPEA3Change(Sender: TObject);
begin
ComboBoxPEA3_onchange;
end;

procedure TForm_peach.ComboBoxPEA4Change(Sender: TObject);
begin
ComboBoxPEA4_onchange;
end;

procedure TForm_peach.ComboBoxPEACompression1Change(Sender: TObject);
begin
ComboBoxPEACompression1_onchange;
end;

procedure TForm_peach.ComboBoxSplit3Change(Sender: TObject);
begin
ComboBoxSplit3_onchange;
end;

procedure extracttheme(var s:ansistring);
var
   cl,in_param,out_param,bin_name:ansistring;
   P:tprocessutf8;
begin
if s<>'' then
   begin
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
   if libre_directive=2 then if testifrar(escapefilename(s,desk_env))=1 then exit;
   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);
   {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z';{$ENDIF}
   cl:=bin_name+' x -aoa '+out_param+' '+in_param;
   P.CommandLine:=cl;
   if Form_peach.Visible=true then Application.ProcessMessages;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   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 Form_peach do
begin
case ComboBoxTheme.ItemIndex of
   0: begin
      try
         s:=sharepath+'themes'+directoryseparator+'main-embedded'+directoryseparator+'theme.txt';
         theme_name:='main-embedded';
         theme_path:=extractrelativepath(sharepath,s);
         load_theme;
         check_theme_failure;
      except
         theme_failure;
         exit;
      end;
      end;
   1: begin
      try
      s:=sharepath+'themes'+directoryseparator+'different.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+'droid.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+'main.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+'ten.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   5: begin
      try
      s:=sharepath+'themes'+directoryseparator+'tuxedo.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   6: 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));
      writeln(conf,pzoomingd);
      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;
pzooming:=pzoomingd;
ensmall:=ensmalld;
usealtcolor:=usealtcolord;
highlighttabs:=highlighttabsd;
accenttoolbar:=accenttoolbard;
toolcentered:=toolcenteredd;
altaddressstyle:=altaddressstyled;
solidaddressstyle:=solidaddressstyled;
alttabstyle:=alttabstyled;
temperature:=temperatured;
contrast:=contrastd;
imgloaded:=false;
apply_theme;
setbrowsertype(browsertype);
end;
settoolbar;
unit_gwrap.graphicsfolder:=graphicsfolder;
unit_gwrap.opacity:=opacity;
unit_gwrap.color1:=color1;
unit_gwrap.color2:=color2;
unit_gwrap.color3:=color3;
unit_gwrap.color4:=color4;
unit_gwrap.color5:=color5;
Unit_gwrap.settheme;
end;

procedure setwindowsopacity;
begin
if (opacity<100) or (spinchanged=true) then
   begin
   if opacity<100 then Form_peach.AlphaBlend:=true else Form_peach.AlphaBlend:=false;
   Form_peach.AlphaBlendValue:=255+opacity-100;
   end;
spinchanged:=false;
Form_peach.SpinEdit1.Value:=opacity;
end;

procedure TForm_peach.ComboBoxThemeChange(Sender: TObject);
begin
ComboBoxTheme_onchange;
setwindowsopacity;
settabs;
end;

procedure TForm_peach.ComboBoxUPXChange(Sender: TObject);
begin
on_ComboBoxUPXChange;
end;

procedure navgoback;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
if Form_peach.StringGridSessionHistory.RowCount>2 then
   begin
   Form_peach.StringGridSessionHistory.Row:=Form_peach.StringGridSessionHistory.Row-1;
   browsehistory;
   end;
end;

procedure TForm_peach.ctrlbackClick(Sender: TObject);
begin
navgoback;
end;

procedure navgofwd;
begin
if browserbusy=true then exit;
if Form_peach.StringGridSessionHistory.Row<Form_peach.StringGridSessionHistory.RowCount-1 then
   begin
   Form_peach.StringGridSessionHistory.Row:=Form_peach.StringGridSessionHistory.Row+1;
   browsehistory;
   end;
end;

procedure TForm_peach.ctrlfwdClick(Sender: TObject);
begin
navgofwd;
end;

procedure navgoup;
var
   s,s1:ansistring;
begin
if browserbusy=true then exit;
if (FormAdvf.CheckBoxAdvFilters.State=cbUnChecked) and (fun='UN7Z') and
   (Form_peach.StringGridSessionHistory.Cells[3,Form_peach.StringGridSessionHistory.Row]<>'*') and
   (Form_peach.StringGridSessionHistory.Cells[3,Form_peach.StringGridSessionHistory.Row]<>DirectorySeparator+DirectorySeparator+'*') then
   begin
   if (Form_peach.EditUn7zaFilter.Text='*') and (Form_peach.EditUn7zaFilterExclude.Text='*'+directoryseparator+'*') then exit;
   s:=extractfilepath(copy(extractfilepath(Form_peach.EditUn7zaFilter.Text),1,length(extractfilepath(Form_peach.EditUn7zaFilter.Text))-1));
   if s=DirectorySeparator+DirectorySeparator then s:='';
   if (length(s)=2) and (s[2]=':') then s:='';
   Form_peach.EditUn7zaFilter.Text:=s+'*';
   Form_peach.EditUn7zaFilterExclude.Text:=s+'*'+directoryseparator+'*';
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   filter_archivecontent;
   addtohistory;
   end
else
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   s:=Form_peach.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
         s:='';
         listpc;
         addtohistory;
         exit;
         end;
      end;
   {$IFDEF MSWINDOWS}
   if Form_peach.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}
   Form_peach.EditUn7zaFilter.Text:='*';
   listdir(s,false,false);
   addtohistory;
   end;
end;

procedure TForm_peach.ctrlupClick(Sender: TObject);
begin
navgoup;
end;

procedure TForm_peach.EditUn7zaFilterKeyPress(Sender: TObject; var Key: char);
begin
//if Key=char(13) then nrsearch;
end;

procedure prepare_GUI;
var
   i:integer;
begin
if showguihints=1 then Form_peach.ShowHint:=true else Form_peach.ShowHint:=false;
with Form_peach.PanelArchiveMain do begin Top:=0; Left:=0; Width:=Form_peach.Width; end;
with Form_peach.PanelOpen do begin Top:=0; Left:=0; Width:=Form_peach.Width; end;
with Form_peach.PanelDefaults do begin Top:=0; Left:=0; Width:=Form_peach.Width; end;
with Form_peach do
begin
{$IFDEF MSWINDOWS}
FormDrop.shape1.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 StringGridCustedit1.Cells[0,i]:=inttostr(i);
StringGridCustedit1.Cells[1,0]:=txt_description;
StringGridCustedit1.Cells[2,0]:=txt_2_5_strbefore;
StringGridCustedit1.Cells[3,0]:=txt_2_5_strafter;
StringGridCustedit1.Cells[4,0]:=txt_3_3_stralt;
StringGridCustedit1.AutoSizeColumns;
StringGrid1.Cells[1,0]:=txt_name;
StringGrid1.Cells[2,0]:=txt_type;
StringGrid1.Cells[3,0]:=txt_size;
StringGrid1.Cells[4,0]:=txt_nfolders;
StringGrid1.Cells[5,0]:=txt_nfiles;
StringGrid1.Cells[6,0]:=txt_8_2_tm;
StringGrid1.Cells[7,0]:=txt_attributes;
StringGrid1.Cells[8,0]:=txt_name_full;
StringGrid1.AutoSizeColumns;
StringGrid1.ColWidths[0]:=rowsize;
StringGrid1.ColWidths[1]:=COL1D;
StringGrid1.ColWidths[9]:=0;
StringGrid1.ColWidths[10]:=0;
StringGrid1.ColWidths[11]:=0;
StringGrid1.ColWidths[12]:=0;
StringGrid1.colwidths[13]:=0;
StringGrid1.colwidths[14]:=8;
StringGrid2.Cells[1,0]:=txt_name;
StringGrid2.Cells[2,0]:=txt_type;
StringGrid2.Cells[3,0]:=txt_size;
StringGrid2.Cells[4,0]:=txt_compressed_size;
StringGrid2.Cells[5,0]:=txt_8_2_tm;
StringGrid2.Cells[6,0]:=txt_attributes;
StringGrid2.Cells[7,0]:=txt_check_select;
StringGrid2.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,BevelTitleoptions1);
setpanel_extract(1);
StringGridRecent.ColWidths[0]:=rowsize;
StringGridRecent.Cells[1,0]:=txt_list_history;
Form_peach.StringGridRecent.AutosizeColumns;
Form_peach.StringGridRecent.ColWidths[0]:=rowsize;
Form_peach.StringGridRecent.ColWidths[2]:=0;
Form_peach.StringGridRecent.ColWidths[3]:=0;
Form_peach.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
      Form_peach.WindowState:=wsNormal;
      Form_peach.Left:=ws_left;
      Form_peach.Top:=ws_top;
      Form_peach.Width:=ws_width;
      Form_peach.Height:=ws_height;
      end
   else Form_peach.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;
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;
{$IFDEF LINUX}
Comboboxarcsfx.Itemindex:=0;
{$ELSE}
Comboboxarcsfx.Itemindex:=1;
{$ENDIF}
setsearchbar(showsearchbar);
end;
end;

procedure setbasevars;
begin
{$IFDEF MSWINDOWS}
max_cl:=32768;
{$ELSE}
max_cl:=131072;
{$ENDIF} //customized later in configuration
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;
az1:=true;
az2:=true;
azbook:=true;
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:='';
prebrowse_dirs:=-1;
prebrowse_records:=-1;
{$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);
Form_peach.pmqjmore.Visible:=false;
Form_peach.MenuItemArchive_pubdoc.Visible:=false;
Form_peach.MenuItemOpen_pubdoc.Visible:=false;
Form_peach.MenuItemArchive_pubhome.Visible:=false;
Form_peach.MenuItemOpen_pubhome.Visible:=false;
{$ENDIF}
if directoryexists(home_path) then
else home_path:=executable_path;
if directoryexists(desktop_path) then
else desktop_path:=home_path;
caption_release:='PeaZip '+PEAZIPVERSION+PEAZIPREVISION;
needwaitupdating:=false;
updatingarchive_inarchive:=false;
pcmenupopulated:=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:=false;
forcecanbechanged:=0;
forcetype:=0;
forcelayout:=0;
forcebrowse:=1;
forceconvert:=0;
settmpextnf:=false;
tmpextnf:=false;
psize:=0;
loadadvdefaults:=true;
end;

procedure open_noinput;
begin
showpanel('open');
if (indir<>txt_mypc) then
   if not(directoryexists(indir)) then indir:={$IFDEF MSWINDOWS}txt_mypc;{$ELSE}'/';{$ENDIF}
Form_peach.EditOpenIn.Text:=escapefilename(indir,desk_env); //indir not expanded with ExpandFileName
fun:='FILEBROWSER';
fun_status:=fun;
open_inputselect;
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(escapefilename(ExpandFileName(s),desk_env));
         //forceopenasarchive:=false;
         addtohistory;
         end;
      7: begin
         showpanel('archive');
         showpanel_trick;
         if filegetattr(escapefilename(ExpandFileName(s),desk_env)) > 0 then
            if filegetattr(escapefilename(ExpandFileName(s),desk_env)) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,escapefilename(s,desk_env))
            else addfolderstr(Form_peach.StringGrid1,escapefilename(ExpandFileName(s),desk_env))
         else msg_not_accessible_s(s);
         Form_peach.StringGrid1.AutoSizeColumns;
         updatecontent(Form_peach.StringGrid1,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(escapefilename(ExpandFileName(s),desk_env));
   addtohistory;
   end;
end;
end;

procedure fixbringtofront;
begin
{$IFDEF MSWINDOWS}
Form_peach.FormStyle:=fsStayOnTop;
Form_peach.FormStyle:=fsNormal;
{$ENDIF}
end;

function IsWindows64: boolean;
{$IFDEF WIN32}
type
  TIsWow64Process = function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall;
var
  IsWow64Result: Windows.BOOL;
  IsWow64Process: TIsWow64Process;
begin
IsWow64Process := TIsWow64Process(Windows.GetProcAddress(Windows.GetModuleHandle('kernel32'), 'IsWow64Process'));
if Assigned(IsWow64Process) then
   begin
   if not IsWow64Process(Windows.GetCurrentProcess, IsWow64Result) then
   raise SysUtils.Exception.Create('IsWindows64: bad process handle');
   Result := IsWow64Result;
   end
else
   Result := False;
{$ELSE} //if were running 64bit code, OS must be 64bit :)
begin
Result := True;
{$ENDIF}
end;

procedure add2custom(custype:ansistring);
var
  i:integer;
  cusparam:ansistring;
begin
showpanel('archive');
showpanel_trick;
for i:=3 to paramcount do
if testname(escapefilename(ExpandFileName((paramstr(i))),desk_env), Form_peach.StringGrid1)=0 then
         if filegetattr(escapefilename(ExpandFileName((paramstr(i))),desk_env)) > 0 then
            if filegetattr(escapefilename(ExpandFileName((paramstr(i))),desk_env)) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,escapefilename(ExpandFileName((paramstr(i))),desk_env))
            else addfolderstr(Form_peach.StringGrid1,escapefilename(ExpandFileName((paramstr(i))),desk_env))
         else msg_not_accessible(i);
Form_peach.StringGrid1.AutoSizeColumns;
updatecontent(Form_peach.StringGrid1,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 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(Form_peach.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);
Form_peach.Close;
end;

procedure condopenaction(s:utf8string);
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
case Form_peach.cbdefaultaction.ItemIndex of
               0: begin
                  open_noinput; Form_peach.ListView1.Clear;
                  Form_peach.visible:=true;
                  open_singleinput(s);//open
                  end;
               1://open as archive
                  begin
                  open_noinput; Form_peach.ListView1.Clear;
                  Form_peach.visible:=true;
                  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
                  Form_peach.EditOpenOut.Text:=local_desktop;
                  list_toextractor('none','full');
                  dirpresent:=false;
                  if directoryexists(escapefilename(ExpandFileName(s),desk_env)) then
                     begin
                     dirpresent:=true;
                     s0:=extractfilepath(escapefilename(ExpandFileName(s),desk_env));
                     expand(escapefilename(ExpandFileName(s),desk_env),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(Form_peach.StringGrid2);
                           addfilestr(Form_peach.StringGrid2,exp_files[j]);
                           end;
                        end;
                     end
                  else
                      begin
                      test_extfile(escapefilename(ExpandFileName(s),desk_env),okfile);
                      if okfile=true then
                         begin
                         if checkfiledirname(escapefilename(ExpandFileName(s),desk_env))<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+escapefilename(ExpandFileName(s),desk_env)); exit; end;
                         Form_peach.Caption:=txt_2_4_adding+' '+escapefilename(ExpandFileName(s),desk_env);
                         Application.ProcessMessages;
                         deselectingrid(Form_peach.StringGrid2);
                         addfilestr(Form_peach.StringGrid2,escapefilename(ExpandFileName(s),desk_env));
                         end;
                      end;
                  if Form_peach.StringGrid2.Rowcount>1 then
                     if dirpresent=false then
                        Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
                     else
                         Form_peach.EditOpenOut.Text:=s0//(last) directory's path
                  else
                     Form_peach.EditOpenOut.Text:=local_desktop;
                  updatecontent_ext;
                  stayopen:=false;
                  case Form_peach.cbdefaultaction.ItemIndex of
                     3:
                     begin
                     if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
                     Form_peach.CheckBoxFolder.State:=cbUnChecked;
                     on_buttonextokclick;
                     if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
                     save_conf;
                     end;
                     4:
                     begin
                     if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
                     sf:=removeintdir;
                     Form_peach.CheckBoxFolder.State:=cbChecked;
                     removeintdir:=1;
                     on_buttonextokclick;
                     if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
                     removeintdir:=sf;
                     save_conf;
                     end;
                     5:
                     begin
                     if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
                     sf:=removeintdir;
                     Form_peach.CheckBoxFolder.State:=cbChecked;
                     removeintdir:=0;
                     on_buttonextokclick;
                     if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
                     removeintdir:=sf;
                     save_conf;
                     end;
                  end;
                  exit;
                  end;
               end;
end;

procedure openstart;
var
   i,j,p,q,lerr,sf:integer;
   s,s0,fun_neutral,cl,jobcode,outname: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.EditUn7zaPW.Caption<>'') or (FormPW.EditName3.Caption<>''));
end;

with form_peach 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' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.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:='';
   unit_gwrap.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
   '-add2pea' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2pea('standard','complete');
   end;
   '-add2crypt' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2pea('crypt','complete');
   end;
   '-add2peai' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2pea('standard','ignore');
   end;
   '-add2crypti' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2pea('crypt','ignore');
   end;
   '-add27z' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('7z','archive','complete');
   end;
   '-add27zmail' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('7z','mail','complete');
   end;
   '-add2sfx7z' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('sfx','archive','complete');
   end;
   '-add2sfx7zmail' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('sfx','mail','complete');
   end;
   '-add2zip' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('zip','archive','complete');
   end;
   '-add2zipmail' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('zip','mail','complete');
   end;
   '-add27zi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('7z','archive','ignore');
   end;
   '-add27zmaili' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('7z','mail','ignore');
   end;
   '-add2sfx7zi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('sfx','archive','ignore');
   end;
   '-add2sfx7zmaili' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('sfx','mail','ignore');
   end;
   '-add2zipi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('zip','archive','ignore');
   end;
   '-add2zipmaili' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('zip','mail','ignore');
   end;
   //direct archive to multiple files
   '-add2separate7z' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2separate7z('7z','complete');
   end;
   '-add2separatezip' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2separate7z('zip','complete');
   end;
   '-add2separate7zi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2separate7z('7z','ignore');
   end;
   '-add2separatezipi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2separate7z('zip','ignore');
   end;
   //direct extract
   ///deprecated, replaced by new ext2here, ext2folder (ext2smart), ext2newfolder functions
   '-ext2here_' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','','complete');
   end;
   '-ext2smart_','-ext2folder_' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','smart','complete');
   end;
   '-ext2newfolder_' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','newfolder','complete');
   end;
   '-ext2simple' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','','complete');
   end;
   '-ext2simplesmart','-ext2simplefolder' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','smart','complete');
   end;
   '-ext2simplenewfolder' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','newfolder','complete');
   end;
   '-ext2to' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','','complete');
   end;
   '-ext2tosmart','-ext2tofolder' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('askto','smart','complete');
   end;
   '-ext2tonewfolder' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','newfolder','complete');
   end;
   '-ext2herei' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','','ignore');
   end;
   '-ext2smarti','-ext2folderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','smart','ignore');
   end;
   '-ext2newfolderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','newfolder','ignore');
   end;
   '-ext2simplei' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','','ignore');
   end;
   '-ext2simplesmarti','-ext2simplefolderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','smart','ignore');
   end;
   '-ext2simplenewfolderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('simple','newfolder','ignore');
   end;
   '-ext2toi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','','ignore');
   end;
   '-ext2tosmarti','-ext2tofolderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('askto','smart','ignore');
   end;
   '-ext2tonewfolderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','newfolder','ignore');
   end;
   ///end of deprecated ext2... functions
   //other
   '-add2wipe' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2wipe;
   end;
   '-add2compare' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2compare;
   end;
   '-ext2list' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2lt('l');
   end;
   '-ext2test' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2lt('t');
   end;
   '-ext2browse' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2browse;
   end;
   '-ext2browseasarchive' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2browseasarchive;
   end;
   '-ext2browsepath' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2browsepath;
   end;
   '-ext2commandprompt' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2commandprompt;
   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(Form_peach.cbType.Items[df])
   else archive_type_select(Form_peach.cbType.Items[pf])
else archive_type_select(Form_peach.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 ComboBoxArchive7.ItemIndex:=1; ComboBoxArchiveAct.Itemindex:=ComboboxArchive7.Itemindex; on_ComboBoxArchive7Change; end;
         if paramstr(1)='-add2archive-update' then begin ComboBoxArchive7.ItemIndex:=2; ComboBoxArchiveAct.Itemindex:=ComboboxArchive7.Itemindex; on_ComboBoxArchive7Change; end;
         if paramstr(1)='-add2convert' then
            begin
            Form_peach.CheckBoxConvert.State:=cbChecked; Form_peach.CheckBoxConvertChange(nil);
            Form_peach.CheckBoxSeparate.State:=cbChecked;
            end;
         StringGrid1.AutoSizeColumns;
         status1:='0 '+txt_dirs+' 0 '+txt_files+' 0 B';
         stayopen:=false;
         savetype:=true;
         exit;
         end;
         '-ext2main','-ext2full'://'-ext2here','-ext2smart','-ext2folder','-ext2newfolder':
         begin
         Form_peach.EditOpenOut.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 (paramstr(2))<>'' then
            if (directoryexists((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;
               Form_peach.EditUn7zaFilter.Text:='*';
               showpanel('open');
               listdir(s,false,false);
               addtohistory;
               end
            else
               begin
               open_noinput; Form_peach.ListView1.Clear;
               Form_peach.visible:=true;
               open_archive_fromname((paramstr(2)));
               end;
         exit;
         end;
         '-ext2openasarchive' : //force to open a single file as archive
         begin
         if (paramstr(2))<>'' then
            if directoryexists((paramstr(2))) then
               begin
               fun:='FILEBROWSER';
               fun_status:=fun;
               s:=(paramstr(2));
               if s<>'' then
                  if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
               Form_peach.EditUn7zaFilter.Text:='*';
               showpanel('open');
               listdir(s,false,false);
               addtohistory;
               end
            else
               begin
               open_noinput; Form_peach.ListView1.Clear;
               Form_peach.visible:=true;
               forceopenasarchive:=true;
               open_archive_fromname((paramstr(2)));
               //forceopenasarchive:=false;
               end;
         exit;
         end;
         '-ext2openpwtest' : //paramstr(2) is password (always delimited), paramstr(3) is the archive: try to open the archive exit code 0 = readable 1 = encrypted 2 = non readable (corrupted or with encrypted file list)
         begin
         Form_peach.visible:=false;
         Form_peach.Windowstate:=wsMinimized;
         autoopentar:=0;
         ExitCode:=-1;
         if (paramstr(2))<>'' then
            begin
            FormPW.EditUn7zapw.Text:=(paramstr(2));
            FormPW.EditUn7zapw1.Text:=(paramstr(2));
            end
         else
            begin
            FormPW.EditUn7zapw.Text:='default';
            FormPW.EditUn7zapw1.Text:='default';
            end;
         if (paramstr(3))<>'' then
            begin
            open_archive_fromname((paramstr(3))); //do not show form, it is used in automated test
            end;
         if seemencrypted=true then ExitCode:=1
         else ExitCode:=0;
         if status1=txt_list_nomatch+txt_2_7_list_tryflatorpw then ExitCode:=2;
         exit_nosave;
         exit;
         end;
         '-ext2main','-ext2full','-ext2here','-ext2smart','-ext2folder','-ext2newfolder':
         begin
         Form_peach.EditOpenOut.Text:=local_desktop;
         list_toextractor('none','full');
         dirpresent:=false;

         q:=0;
         cbignore:=CheckBoxDeleteInput.Checked;
         for i:=2 to paramcount do
            begin
            if paramstr(i)='-i' then
               begin
               CheckBoxDeleteInput.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.EditUn7zaPW.Text:=paramstr(i+1);
               FormPW.EditUn7zaPW1.Text:=paramstr(i+1);
               end;
            end;

         for i:=q+2 to paramcount do
            if directoryexists(escapefilename(ExpandFileName((paramstr(i))),desk_env)) then
               begin
               dirpresent:=true;
               s0:=extractfilepath(escapefilename(ExpandFileName((paramstr(i))),desk_env));
               expand(escapefilename(ExpandFileName((paramstr(i))),desk_env),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(Form_peach.StringGrid2);
                        addfilestr(Form_peach.StringGrid2,exp_files[j]);
                        end;
                     end;
               end
            else
               begin
               test_extfile(escapefilename(ExpandFileName((paramstr(i))),desk_env),okfile);
               if okfile=true then
                  begin
                  if checkfiledirname(escapefilename(ExpandFileName((paramstr(i))),desk_env))<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+escapefilename(ExpandFileName((paramstr(i))),desk_env)); exit; end;
                  Form_peach.Caption:=txt_2_4_adding+' '+escapefilename(ExpandFileName((paramstr(i))),desk_env);
                  Application.ProcessMessages;
                  deselectingrid(Form_peach.StringGrid2);
                  addfilestr(Form_peach.StringGrid2,escapefilename(ExpandFileName((paramstr(i))),desk_env));
                  end;
               end;
         if Form_peach.StringGrid2.Rowcount>1 then
            if dirpresent=false then
               Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
            else
               Form_peach.EditOpenOut.Text:=s0//(last) directory's path
         else
            Form_peach.EditOpenOut.Text:=local_desktop;
         updatecontent_ext;
         stayopen:=false;

         for i:=2 to paramcount do
            begin
            if paramstr(i)='-o' then
               begin
               EditOpenOut.Text:=paramstr(i+1);
               end;
            end;

         if ParamStr(1)='-ext2here' then
            begin
            if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
            Form_peach.CheckBoxFolder.State:=cbUnChecked;
            on_buttonextokclick;
            if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
            CheckBoxDeleteInput.Checked:=cbignore;
            save_conf;
            end;

         if (ParamStr(1)='-ext2smart') or (ParamStr(1)='-ext2folder') then
            begin
            if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
            sf:=removeintdir;
            Form_peach.CheckBoxFolder.State:=cbChecked;
            removeintdir:=1;
            on_buttonextokclick;
            if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
            removeintdir:=sf;
            CheckBoxDeleteInput.Checked:=cbignore;
            save_conf;
            end;

         if ParamStr(1)='-ext2newfolder' then
            begin
            if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
            sf:=removeintdir;
            Form_peach.CheckBoxFolder.State:=cbChecked;
            removeintdir:=0;
            on_buttonextokclick;
            if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
            removeintdir:=sf;
            CheckBoxDeleteInput.Checked:=cbignore;
            save_conf;
            end;

            {$IFDEF MSWINDOWS}
            SHChangeNotify(SHCNE_ALLEVENTS,SHCNF_PATH,pstring(outpath),nil);
            {$ENDIF}
         CheckBoxDeleteInput.Checked:=cbignore;
         exit;
         end;
         '-add2archivemulti' :
         begin
         add2archivemulti;
         exit;
         end;
         '-add2archivemulticonvert' :
         begin
         add2archivemulticonvert;
         exit;
         end;
         '-add2archivemultiseparate' :
         begin
         add2archivemultiseparate;
         exit;
         end;
         '-add2archivemulti7z' :
         begin
         add2archivemulti7z;
         exit;
         end;
         '-add2archivemultizip' :
         begin
         add2archivemultizip;
         exit;
         end;
         '-add2archivemultisplit' :
         begin
         add2archivemultisplit;
         exit;
         end;
         '-add2archivemultisfx' :
         begin
         add2archivemultisfx;
         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;
      end;
      showpanel('archive'); //otherwise, add to archive
      showpanel_trick;
      for i:=1 to paramcount do
         begin
         if (paramstr(i)='-add2archive') or (paramstr(i)='-add2split') or (paramstr(i)='-add2archive-add') or (paramstr(i)='-add2archive-update') or (paramstr(i)='-add2convert') or (paramstr(i)='-add2convimm') then
         else
            if testname(escapefilename(ExpandFileName((paramstr(i))),desk_env), StringGrid1)=0 then
               if filegetattr(escapefilename(ExpandFileName((paramstr(i))),desk_env)) > 0 then
                  if filegetattr(escapefilename(ExpandFileName((paramstr(i))),desk_env)) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,escapefilename(ExpandFileName((paramstr(i))),desk_env))
                  else addfolderstr(Form_peach.StringGrid1,escapefilename(ExpandFileName((paramstr(i))),desk_env))
               else msg_not_accessible(i);
         end;
      if paramstr(1)='-add2archive-add' then
         begin
         ComboBoxArchive7.ItemIndex:=1;
         ComboBoxArchiveAct.Itemindex:=ComboboxArchive7.Itemindex;
         on_ComboBoxArchive7Change;
         end;
      if paramstr(1)='-add2archive-update' then
         begin
         ComboBoxArchive7.ItemIndex:=2;
         ComboBoxArchiveAct.Itemindex:=ComboboxArchive7.Itemindex;
         on_ComboBoxArchive7Change;
         end;
      if paramstr(1)='-add2convert' then
         begin
         Form_peach.CheckBoxConvert.State:=cbChecked; Form_peach.CheckBoxConvertChange(nil);
         Form_peach.CheckBoxSeparate.State:=cbChecked;
         end;
      if paramstr(1)='-add2convimm' then
         begin
         Form_peach.CheckBoxConvert.State:=cbChecked; Form_peach.CheckBoxConvertChange(nil);
         Form_peach.CheckBoxSeparate.State:=cbChecked;
         on_buttonarchiveclick;
         exit_nosave;
         exit;
         end;
      if paramstr(1)='-add2split' then
         begin
         Form_peach.cbType.ItemIndex:=10;
         archive_type_select(txt_split);
         end;
      StringGrid1.AutoSizeColumns;
      updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
      if completeshowpea=true then if enumd=1 then begin Form_peach.visible:=true; updatelayout(''); end;
      stayopen:=false;
      savetype:=true;
      end;
end;
end;
end;

procedure TForm_peach.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(directoryexists(peaziptmpdir)) then ForceDirectories(peaziptmpdir);
peaziptmpdir_tmp:=peaziptmpdir;
{$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;
   '-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;
   '-ext2multi' :
   begin
   ext2multi;
   halt;
   end;
   '-ext2multihere' :
   begin
   ext2multidirect('-ext2archivemultihere');
   halt;
   end;
   '-ext2multismart' :
   begin
   ext2multidirect('-ext2archivemultismart');
   halt;
   end;
   '-ext2multifolder' :
   begin
   ext2multidirect('-ext2archivemultifolder');
   halt;
   end;
   end;
{$ENDIF}
end;

procedure imgshelltree;
var
  Node: TTreeNode;
  i: Integer;
  s:ansistring;
begin
  if Form_peach.ShellTreeView1.Items.Count > 0 then
  begin
    for i := 0 to Form_peach.ShellTreeView1.Items.Count - 1 do
    begin
      Node := Form_peach.ShellTreeView1.Items[i];
      s:=ExcludeTrailingPathDelimiter(Form_peach.ShellTreeView1.GetPathFromNode(Node));
      Node.ImageIndex:=getshelltreeicon_frompath(s);
      Node.SelectedIndex:=Node.ImageIndex;
    end;
   end;
end;

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

procedure apply_conf;
begin

if work_dir=3 then
   if (custom_work_path<>'') and DirectoryExists(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;

procedure TForm_peach.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}
Form_peach.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;
clearstopsequencefile;
prepare_apps_panel;
load_custedit;
apply_conf;
//showpanel_prepare;
prepare_GUI; //give starting positions to panels (that in the RAD may be misplaced)
if pimmersive=1 then set_pimmersive;
prepare_FormPW;
prepare_FormPM;
prepare_FormKF;
if spchar=1 then FormKF.CheckBoxSuggestPW.State:=cbChecked else FormKF.CheckBoxSuggestPW.State:=cbUnchecked;
prepare_FormAdvf;
prepare_FormWeb;
prepare_FormAbout;
prepare_FormDlg;
prepare_Form_gwrap;
FormPaths.Caption:=txt_5_5_copypath;
prepare_FormSelect;
populatefunmenu;
h := THintWindow.Create(self);
po_systemtools.Visible:=false;
po_linsystemtools.Visible:=false;
mUser.Visible:=false;
MenuItem33.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);
po_zerofree.Visible:=false;
po_securedeletefree.Visible:=false;
MenuItem56.Visible:=false;
pmzerofree.Visible:=false;
pmsecuredeletefree.Visible:=false;
MenuItem91.Visible:=false;
w7contextlang.Visible:=false;
setwindowsopacity;
{$IFDEF MSWINDOWS}
CheckBoxExtrac32.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;
mUser.Visible:=true;
MenuItem33.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);
   schedaddschedule1Change(nil);
   end;
   end;
{$ELSE}
po_linsystemtools.Visible:=true;
{$IFDEF DARWIN}
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;
mpretoggle.enabled:=false;
{$IFDEF DARWIN}//extended alternative browser styles currently work for Linux but not for Darwin
pmstyle2.Visible:=false;
pmstyle4.Visible:=false;
pmstyle5.Visible:=false;
mpredetails.Visible:=false;
mprelist.Visible:=false;
mpreaverage.Visible:=false;
mTray.Visible:=false;//tray icon/menu currently not working on macOS
{$ENDIF}
pmstyle6.Visible:=false;
mprelarge.Visible:=false;
mbrowsersizes.Visible:=false;
mbrowsersizem.Visible:=false;
mbrowsersizel.Visible:=false;
menuitem81.Visible:=false;
menuitem17.Visible:=false;
mwebs.Visible:=false;
mtstyle.Visible:=false;
LabelConfigurePeaZip.Visible:=false;
LabelConfigureSendTo.Visible:=false;
msystemintegration.visible:=false;
mthumbimages.Visible:=false;
pcustmakecab.Visible:=false;
pcustmakecabsep.Visible:=false;
{$ENDIF}
status1:=caption_build;
populatebookmarks;
populaterecenticons;
populaterecenticonsf;
{$IFDEF MSWINDOWS}
try
if winver='nt6+' then
   begin
   {if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'brotli.dll') then
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'brotli.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'brotli.dll');
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'flzma2.dll') then
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'flzma2.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'flzma2.dll');
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lizard.dll') then
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lizard.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lizard.dll');
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz4.dll') then
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz4.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz4.dll');
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz5.dll') then
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz5.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz5.dll');
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'zstd.dll') then
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'zstd.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'zstd.dll');
   }end
else
   begin //XP, ReactOS
   if not(DirectoryExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk')) then
      ForceDirectories(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk');
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'brotli.dll') then
      begin
      DeleteFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'brotli.dll');
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'brotli.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'brotli.dll');
      end;
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'flzma2.dll') then
      begin
      DeleteFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'flzma2.dll');
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'flzma2.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'flzma2.dll');
      end;
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lizard.dll') then
      begin
      DeleteFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lizard.dll');
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lizard.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lizard.dll');
      end;
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz4.dll') then
      begin
      DeleteFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz4.dll');
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz4.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz4.dll');
      end;
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz5.dll') then
      begin
      DeleteFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz5.dll');
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'lz5.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'lz5.dll');
      end;
   if FileExists(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'zstd.dll') then
      begin
      DeleteFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'zstd.dll');
      RenameFile(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'zstd.dll',
      escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+'Codecs'+DirectorySeparator+'bk'+DirectorySeparator+'zstd.dll');
      end;
   end;
except
end;
openstart;
if completeshowpea=true then Form_peach.visible:=true;
{$ELSE}
openstart;
finishlistview;
imgshelltree;
{$IFDEF DARWIN}
//replace some keyboard shortcuts at runtime to better fit macOS conventions
mf3.ShortCut := ($1000) + Ord('F');
mSelectAll.ShortCut := ($1000) + Ord('A');
po_copy.ShortCut := ($1000) + Ord('C');
po_cut.ShortCut := ($1000) + Ord('X');
po_paste.ShortCut := ($1000) + Ord('V');
po_recycle.ShortCut := ($1000) + $8;
mback.ShortCut := ($1000) + 37;
mf4up.ShortCut := ($1000) + 38;
mfwd.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}
if showthumbnails=1 then do_forcerefresh;//to correctly display thumbnails on startup
end;

procedure TForm_peach.ImageBCtextClick(Sender: TObject);
begin
showaddresstextfield;
end;

procedure TForm_peach.ImageBCtextMouseEnter(Sender: TObject);
begin
PanelAdArchive4.Color:=abactivecol;
end;

procedure TForm_peach.ImageBCtextMouseLeave(Sender: TObject);
begin
PanelAdArchive4.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageFlatcropClick(Sender: TObject);
begin
do_crop;
end;

procedure TForm_peach.ImageFlatdupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TForm_peach.ImageFlatrenClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TForm_peach.ImageFlattestmoreClick(Sender: TObject);
var
   p:tpoint;
begin
p.x:=Form_peach.ImageFlattestmore.left;
p.y:=Form_peach.PanelListBar.height+Form_peach.PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
if swaptab=true then p.y:=p.y-Form_peach.PanelTabBar.height;
p:=clienttoscreen(p);
pmtestinfolist.popup(p.x,p.y);
end;

procedure TForm_peach.ImageFlattransformClick(Sender: TObject);
begin
do_resize;
end;

procedure TForm_peach.Imagesp1Click(Sender: TObject);
begin
if Splitter3.Left=0 then Splitter3.left:=180 else Splitter3.left:=0;
end;

procedure TForm_peach.ImagespClick(Sender: TObject);
begin
if navbar=3 then setnav(0) else setnav(3);
end;

procedure TForm_peach.LabelWDClick(Sender: TObject);
begin
if Form_peach.ComboBoxWD.ItemIndex=0 then exit;
cp_open(peaziptmpdirroot,desk_env);
end;

procedure TForm_peach.LabelAddFilesClick(Sender: TObject);
begin
addfile;
end;

procedure TForm_peach.LabelAddFolderClick(Sender: TObject);
begin
addfolder;
end;

procedure TForm_peach.Labelcb19Click(Sender: TObject);
begin
EditDesk.visible:=not(EditDesk.visible);
ButtonDesk1.visible:=EditDesk.visible;
end;

procedure TForm_peach.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 TForm_peach.LabelConfigurePwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TForm_peach.LabelDefaultColor3Click(Sender: TObject);
begin
color3:=color3d;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.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 TForm_peach.LabelErrorsClick(Sender: TObject);
begin
if LabelErrors.Caption=txt_7_3_archiveerrors then pMessageInfoOK(txt_7_3_archiveerrorshint);
end;

procedure TForm_peach.LabelmoreoptClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions3, BevelTitleOptions3);
end;

procedure TForm_peach.cbqdupClick(Sender: TObject);
begin
on_cbqdupclick;
end;

procedure TForm_peach.LabelPMpwClick(Sender: TObject);
begin
setpm(2);
end;

procedure TForm_peach.LabelsetworkClick(Sender: TObject);
begin
showpanel('defaults');
end;

procedure do_fixpipechar(var s:AnsiString);//hint text is cut when pipe char is encountered in Lazarus 2.2.0
var
   i:integer;
begin
repeat
   i := pos('|', s);
   if i > 0 then
      s[pos('|', s)] := '/';
until i = 0;
end;

procedure do_calcstatusar;
begin
statushintar:=form_peach.Caption+char($0D)+char($0A)+typehint+char($0D)+char($0A)+char($0D)+char($0A);
statushintar:=statushintar+txt_input+' '+form_peach.LabelStatusAr2.Caption+char($0D)+char($0A)+char($0D)+char($0A);
statushintar:=statushintar+txt_2_7_output+' '+form_peach.Edit5.Caption+char($0D)+char($0A)+statuss+char($0D)+char($0A)+char($0D)+char($0A);
statushintar:=statushintar+form_peach.LabelStatusAr.Caption+char($0D)+char($0A)+statusw;
if form_peach.LabelStatusAr.Caption<>'' then statushintar:=statushintar;
do_fixpipechar(statushintar);
end;

procedure TForm_peach.LabelStatusArClick(Sender: TObject);
begin
do_calcstatusar;
pMessageInfoOK(statushintar);
end;

procedure TForm_peach.LabelStatusArMouseEnter(Sender: TObject);
begin
do_calcstatusar;
LabelStatusAr.Hint:=statushintar;
LabelStatusAr2.Hint:=statushintar;
end;

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

procedure TForm_peach.LabelStatusExClick(Sender: TObject);
begin
do_calcstatusex;
pMessageInfoOK(statushintex);
end;

procedure TForm_peach.LabelStatusExMouseEnter(Sender: TObject);
begin
do_calcstatusex;
LabelStatusEx.Hint:=statushintex;
LabelStatusEx2.Hint:=statushintex;
end;

procedure do_calcstatus;
var i,ir:integer;
begin
statushint:='';
with Form_peach do
begin
{$IFDEF MSWINDOWS}if status_curfilesystem<>'' then statushint:=status_curfilesystem+char($0D)+char($0A)+char($0D)+char($0A);{$ENDIF}
if Form_peach.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 Form_peach.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);
   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 TForm_peach.LabelStatusClick(Sender: TObject);
begin
  do_showstatus;
end;

procedure TForm_peach.LabelStatusdisplayedClick(Sender: TObject);
begin
  do_showstatus;
end;

procedure TForm_peach.LabelStatusdisplayedMouseEnter(Sender: TObject);
begin
set_statuss_nav;
end;

procedure TForm_peach.LabelStatusMouseEnter(Sender: TObject);
begin
set_statuss_nav;
end;

procedure TForm_peach.LabelThemeClick(Sender: TObject);
begin
if not(directoryexists(confpath+'themes')) then forcedirectories(confpath+'themes');
cp_open(confpath+'themes',desk_env);
end;

procedure TForm_peach.LabelTitleOptions2Click(Sender: TObject);
begin
clicklabel_options(LabelTitleOptions2, BevelTitleOptions2);
end;

procedure TForm_peach.LabelTitleOptions2MouseEnter(Sender: TObject);
begin
enterlabel_options(LabelTitleOptions2, BevelTitleOptions2);
end;

procedure TForm_peach.LabelTitleOptions2MouseLeave(Sender: TObject);
begin
exitlabel_options(LabelTitleOptions2, BevelTitleOptions2);
end;

procedure TForm_peach.lightdimClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(stringtocolor(color2),-16,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.ListView1ContextPopup(Sender: TObject; MousePos: TPoint;
  var Handled: Boolean);
begin
ListView1.PopupMenu:=PopupOpen;
{$IFDEF MSWINDOWS}
if (ListView1.ViewStyle=vsReport) and (MousePos.y<25) then ListView1.PopupMenu:=PopupHeader;
{$ELSE}
if (ListView1.ViewStyle=vsReport) and (MousePos.y<3) then ListView1.PopupMenu:=PopupHeader;
{$ENDIF}
end;

procedure TForm_peach.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
update_selstatus;
end;

procedure TForm_peach.lsetdefaultout_arcClick(Sender: TObject);
begin
set_arcout;
end;

procedure TForm_peach.lsetdefaultout_extClick(Sender: TObject);
begin
set_extout;
end;

procedure TForm_peach.mautoadjustClick(Sender: TObject);
begin
Listview1.Column[0].AutoSize:=true;
Listview1.Column[1].AutoSize:=true;
Listview1.Column[2].AutoSize:=true;
Listview1.Column[3].AutoSize:=true;
Listview1.Column[4].AutoSize:=true;
Listview1.Column[5].AutoSize:=true;
Listview1.Column[6].AutoSize:=true;
Listview1.Column[7].AutoSize:=true;
Listview1.Column[8].AutoSize:=true;
Listview1.Column[9].AutoSize:=true;
Listview1.Column[10].AutoSize:=true;
Listview1.Column[11].AutoSize:=true;
Listview1.Column[0].AutoSize:=false;
Listview1.Column[1].AutoSize:=false;
Listview1.Column[2].AutoSize:=false;
Listview1.Column[3].AutoSize:=false;
Listview1.Column[4].AutoSize:=false;
Listview1.Column[5].AutoSize:=false;
Listview1.Column[6].AutoSize:=false;
Listview1.Column[7].AutoSize:=false;
Listview1.Column[8].AutoSize:=false;
Listview1.Column[9].AutoSize:=false;
Listview1.Column[10].AutoSize:=false;
Listview1.Column[11].AutoSize:=false;
if EditOpenIn.Text=txt_mypc then
   begin
   ListView1.Column[0].Width:=COL1D;
   ListView1.Column[1].Width:=COL7D;
   ListView1.Column[2].Width:=COL2D;
   ListView1.Column[3].Width:=COL2D;
   ListView1.Column[4].Width:=COL5D;
   Listview1.Column[5].Width:=0;
   Listview1.Column[6].Width:=0;
   Listview1.Column[7].Width:=0;
   Listview1.Column[8].Width:=0;
   ListView1.Column[9].Width:=0;
   ListView1.Column[10].Width:=0;
   ListView1.Column[11].Width:=0;
   end
else
   begin
   if fun<>'UN7Z' then
      begin
      ListView1.Column[0].Width:=COL1D;
      ListView1.Column[1].Width:=COL2D;
      ListView1.Column[2].Width:=COL3D;
      ListView1.Column[3].Width:=COL4D;
      ListView1.Column[4].Width:=COL5D;
      ListView1.Column[5].Width:=0;
      ListView1.Column[6].Width:=0;
      ListView1.Column[7].Width:=0;
      ListView1.Column[8].Width:=0;
      ListView1.Column[9].Width:=COL6D;
      ListView1.Column[10].Width:=COL7D;
      end
   else
      begin
      ListView1.Column[0].Width:=COL1D;
      ListView1.Column[1].Width:=COL2D;
      ListView1.Column[2].Width:=COL3D;
      ListView1.Column[3].Width:=COL4D;
      ListView1.Column[4].Width:=COL5D;
      ListView1.Column[5].Width:=COL5D;
      ListView1.Column[6].Width:=COL5D;
      ListView1.Column[7].Width:=COL7D;
      ListView1.Column[8].Width:=COL7D;
      ListView1.Column[9].Width:=COL6D;
      ListView1.Column[10].Width:=COL7D;
      end;
   {$IFDEF MSWINDOWS}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[11].Width:=0
   else Form_Peach.ListView1.Column[11].Width:=384;
   {$ELSE}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[11].Visible:=false
   else begin Form_Peach.ListView1.Column[11].Visible:=true; Form_Peach.ListView1.Column[11].Width:=384; end;
   {$ENDIF}
   end;
col1size:=Form_Peach.ListView1.Column[0].Width;
if ctype=true then col2size:=Form_Peach.ListView1.Column[1].Width;
if csize=true then col3size:=Form_Peach.ListView1.Column[2].Width;
if cpacked=true then col4size:=Form_Peach.ListView1.Column[3].Width;
if cdate=true then col5size:=Form_Peach.ListView1.Column[4].Width;
if cmethod=true then colmethodsize:=Form_Peach.ListView1.Column[7].Width;
if ccomment=true then colcommentsize:=Form_Peach.ListView1.Column[8].Width;
if catt=true then col6size:=Form_Peach.ListView1.Column[9].Width;
if ccrc=true then col7size:=Form_Peach.ListView1.Column[10].Width;
end;

procedure TForm_peach.mBenchpeaClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
if pMessageInfoYesNo('PEA'+char($0D)+char($0A)+char($0D)+char($0A)+txt_benchmark)=7 then exit;
P:=tprocessutf8.Create(nil);
cl:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT)+' bench';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.mbgnome4Click(Sender: TObject);
begin
setusebreadcrumb(3,1);
end;

procedure TForm_peach.mbgnomeClick(Sender: TObject);
begin
setusebreadcrumb(2,1);
end;

procedure TForm_peach.mbkdeClick(Sender: TObject);
begin
setusebreadcrumb(1,1);
end;

procedure TForm_peach.mbmacClick(Sender: TObject);
begin
setusebreadcrumb(4,1);
end;

procedure TForm_peach.mbrowsercaccessedClick(Sender: TObject);
begin
sortbrowser(7);
end;

procedure TForm_peach.mbrowserccommentClick(Sender: TObject);
begin
sortbrowser(9);
end;

procedure TForm_peach.mbrowserccreatedClick(Sender: TObject);
begin
sortbrowser(6);
end;

procedure TForm_peach.mbrowsercmethodClick(Sender: TObject);
begin
sortbrowser(8);
end;

procedure TForm_peach.mbtextClick(Sender: TObject);
begin
setusebreadcrumb(0,1);
end;

procedure TForm_peach.mcaccessedClick(Sender: TObject);
begin
caccessed:=not(caccessed);
mcaccessed.Checked:=caccessed;
pmcaccessed.Checked:=caccessed;
set_listview_col;
end;

procedure selnone;
var
   i:integer;
begin
for i:=0 to Form_peach.StringGridList.RowCount-1 do Form_peach.StringGridList.Cells[16,i]:='0';
end;

procedure TForm_peach.marcoptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then navgoup;
selnone;
do_add;
end;

procedure TForm_peach.mccommentClick(Sender: TObject);
begin
ccomment:=not(ccomment);
mccomment.Checked:=ccomment;
pmccomment.Checked:=ccomment;
set_listview_col;
end;

procedure TForm_peach.mccreatedClick(Sender: TObject);
begin
ccreated:=not(ccreated);
mccreated.Checked:=ccreated;
pmccreated.Checked:=ccreated;
set_listview_col;
end;

procedure TForm_peach.mdefarcsetClick(Sender: TObject);
begin
set_arcout_current;
end;

procedure TForm_peach.mdefextsetClick(Sender: TObject);
begin
set_extout_current;
end;

procedure TForm_peach.mcmethodClick(Sender: TObject);
begin
cmethod:=not(cmethod);
mcmethod.Checked:=cmethod;
pmcmethod.Checked:=cmethod;
set_listview_col;
end;

procedure TForm_peach.lightlowClick(Sender: TObject);
begin
color2:=color2d;
color2:=colortostring(modpropcolor(stringtocolor(color2),-72,temperature));
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure set_dirbeforefiles(dmode:integer);
begin
case dmode of
   0:
   begin
   prefixd:='1';
   prefixf:='1';
   prefixdaz:='a ';
   prefixfaz:='a ';
   prefixdza:='a ';
   Form_peach.mdirbeforefiles.checked:=false;
   end;
   1:
   begin
   prefixd:='1';
   prefixf:='2';
   prefixdaz:='a ';
   prefixfaz:='b ';
   prefixdza:='c ';
   Form_peach.mdirbeforefiles.checked:=true;
   end;
   end;
end;

procedure TForm_peach.mdirbeforefilesClick(Sender: TObject);
begin
if mdirbeforefiles.Checked=true then dirbeforefiles:=0
else dirbeforefiles:=1;
set_dirbeforefiles(dirbeforefiles);
mRefreshClick(nil);
end;

procedure TForm_peach.mdownloadthemesClick(Sender: TObject);
begin
checkthemes;
end;

procedure TForm_peach.mfunaddClick(Sender: TObject);
begin
do_add;
end;

procedure TForm_peach.MenuItemShowColMenuClick(Sender: TObject);
var p:tpoint;
begin
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+Form_peach.PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
if swaptab=true then p.y:=p.y-Form_peach.PanelTabBar.height;
p:=Form_peach.clienttoscreen(p);
Form_peach.PopupHeader.PopUp(p.x,p.y);
end;

procedure popuptabmenu;
var p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+Form_peach.PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
if swaptab=true then p.y:=p.y-Form_peach.PanelTabBar.height;
p:=Form_peach.clienttoscreen(p);
Form_peach.pmbreadcrumb.PopUp(p.x,p.y);
end;

procedure TForm_peach.MenuItemToggleNavClick(Sender: TObject);
begin
togglenavbar;
popuptabmenu;
end;

procedure TForm_peach.mfunconvertClick(Sender: TObject);
begin
archive_convert;
end;

procedure TForm_peach.mfunextractClick(Sender: TObject);
begin
do_extract;
end;

procedure set_enlargeicons;
begin
enlargeicons:=not(enlargeicons);
Form_peach.mlargeicons.checked:=enlargeicons;
saverestartclosepeaapp;
end;

procedure TForm_peach.mlargeiconsClick(Sender: TObject);
begin
if openstarted=true then set_enlargeicons;
end;

procedure TForm_peach.mpeachangelogClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'changelog.html',desk_env);
end;

procedure TForm_peach.mpeatosClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-tos-privacy.html',desk_env);
end;

procedure TForm_peach.mswaptabClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
swaptab:=not(swaptab);
saverestartclosepeaapp;
end;

procedure TForm_peach.mtranslationsfaqClick(Sender: TObject);
begin
checktranslations;
end;

procedure TForm_peach.Panelnav4Click(Sender: TObject);
var
   p:TPoint;
begin
p.x:=Panelnav4.Left+Panelnav4.Width;
p.y:=Panelnav4.top;//+Panelnav4.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 TForm_peach.Panelnav4MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   p:TPoint;
begin
p.x:=Panelnav4.Left+Panelnav4.Width;
p.y:=Panelnav4.top;//+Panelnav4.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 TForm_peach.pmbccpClick(Sender: TObject);
begin
browser_commandprompt(1,0,'');
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;
   P:=tprocessutf8.Create(nil);
   instr:=stringdelim(escapefilename(instr,desk_env));
   bin_name:=stringdelim(escapefilename(executable_path+'peazip'+EXEEXT,desk_env))+' -ext2openasarchive';
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   cl:=bin_name+' '+instr;
   P.CommandLine:=cl;
   if Form_peach.Visible=true then Application.ProcessMessages;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   P.Free;
   end;
end;

procedure TForm_peach.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 TForm_peach.pmbcpsClick(Sender: TObject);
begin
browser_commandprompt(1,1,'');
end;

procedure TForm_peach.pmccommentClick(Sender: TObject);
begin
ccomment:=not(ccomment);
mccomment.Checked:=ccomment;
pmccomment.Checked:=ccomment;
set_listview_col;
end;

procedure toggleclip;
begin
if lastbar=5 then showbar('statusbar') else showbar('clip');
end;

procedure TForm_peach.pmclipClick(Sender: TObject);
begin
toggleclip;
end;

procedure TForm_peach.pmembf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf1.Caption)
else addfilefolder_ext_fromname(pmembf1.Caption);
end;

procedure TForm_peach.pmembf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf2.Caption)
else addfilefolder_ext_fromname(pmembf2.Caption);
end;

procedure TForm_peach.pmembf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf3.Caption)
else addfilefolder_ext_fromname(pmembf3.Caption);
end;

procedure TForm_peach.pmembf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf4.Caption)
else addfilefolder_ext_fromname(pmembf4.Caption);
end;

procedure TForm_peach.pmembf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf5.Caption)
else addfilefolder_ext_fromname(pmembf5.Caption);
end;

procedure TForm_peach.pmembf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf6.Caption)
else addfilefolder_ext_fromname(pmembf6.Caption);
end;

procedure TForm_peach.pmembf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf7.Caption)
else addfilefolder_ext_fromname(pmembf7.Caption);
end;

procedure TForm_peach.pmembf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pmembf8.Caption)
else addfilefolder_ext_fromname(pmembf8.Caption);
end;

procedure TForm_peach.pmemrf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr1.Caption)
else addfilefolder_ext_fromname(pnr1.Caption);
end;

procedure TForm_peach.pmemrf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr2.Caption)
else addfilefolder_ext_fromname(pnr2.Caption);
end;

procedure TForm_peach.pmemrf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr3.Caption)
else addfilefolder_ext_fromname(pnr3.Caption);
end;

procedure TForm_peach.pmemrf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr4.Caption)
else addfilefolder_ext_fromname(pnr4.Caption);
end;

procedure TForm_peach.pmemrf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr5.Caption)
else addfilefolder_ext_fromname(pnr5.Caption);
end;

procedure TForm_peach.pmemrf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr6.Caption)
else addfilefolder_ext_fromname(pnr6.Caption);
end;

procedure TForm_peach.pmemrf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr7.Caption)
else addfilefolder_ext_fromname(pnr7.Caption);
end;

procedure TForm_peach.pmemrf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnr8.Caption)
else addfilefolder_ext_fromname(pnr8.Caption);
end;

procedure TForm_peach.pmmoreaddClick(Sender: TObject);
begin
do_add;
end;

procedure TForm_peach.pmmoreconvertClick(Sender: TObject);
begin
archive_convert;
end;

procedure TForm_peach.pmmoreextractClick(Sender: TObject);
begin
do_extract;
end;

procedure TForm_peach.pmmoretestClick(Sender: TObject);
begin
do_test;
end;

procedure TForm_peach.pmshowstylemenuClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=Panelnav4.Left+Panelnav4.Width;
p.y:=Panelnav4.top;//+Panelnav4.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 TForm_peach.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 TForm_peach.pmtabsnewwindowClick(Sender: TObject);
begin
newwin(tabaddress.caption);
end;

procedure TForm_peach.pnbce1Click(Sender: TObject);
begin
cp_open(pnbce1.Caption,desk_env);
end;

procedure TForm_peach.pnbce2Click(Sender: TObject);
begin
cp_open(pnbce2.Caption,desk_env);
end;

procedure TForm_peach.pnbce3Click(Sender: TObject);
begin
cp_open(pnbce3.Caption,desk_env);
end;

procedure TForm_peach.pnbce4Click(Sender: TObject);
begin
cp_open(pnbce4.Caption,desk_env);
end;

procedure TForm_peach.pnbce5Click(Sender: TObject);
begin
cp_open(pnbce5.Caption,desk_env);
end;

procedure TForm_peach.pnbce6Click(Sender: TObject);
begin
cp_open(pnbce6.Caption,desk_env);
end;

procedure TForm_peach.pnbce7Click(Sender: TObject);
begin
cp_open(pnbce7.Caption,desk_env);
end;

procedure TForm_peach.pnbce8Click(Sender: TObject);
begin
cp_open(pnbce8.Caption,desk_env);
end;

procedure TForm_peach.pnbcf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf1.Caption)
else addfilefolder_ext_fromname(pnbcf1.Caption);
end;

procedure TForm_peach.pnbcf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf2.Caption)
else addfilefolder_ext_fromname(pnbcf2.Caption);
end;

procedure TForm_peach.pnbcf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf3.Caption)
else addfilefolder_ext_fromname(pnbcf3.Caption);
end;

procedure TForm_peach.pnbcf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf4.Caption)
else addfilefolder_ext_fromname(pnbcf4.Caption);
end;

procedure TForm_peach.pnbcf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf5.Caption)
else addfilefolder_ext_fromname(pnbcf5.Caption);
end;

procedure TForm_peach.pnbcf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf6.Caption)
else addfilefolder_ext_fromname(pnbcf6.Caption);
end;

procedure TForm_peach.pnbcf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf7.Caption)
else addfilefolder_ext_fromname(pnbcf7.Caption);
end;

procedure TForm_peach.pnbcf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnbcf8.Caption)
else addfilefolder_ext_fromname(pnbcf8.Caption);
end;

procedure TForm_peach.pnhe1Click(Sender: TObject);
begin
cp_open(pnh1.Caption,desk_env);
end;

procedure TForm_peach.pnhe2Click(Sender: TObject);
begin
cp_open(pnh2.Caption,desk_env);
end;

procedure TForm_peach.pnhe3Click(Sender: TObject);
begin
cp_open(pnh3.Caption,desk_env);
end;

procedure TForm_peach.pnhe4Click(Sender: TObject);
begin
cp_open(pnh4.Caption,desk_env);
end;

procedure TForm_peach.pnhe5Click(Sender: TObject);
begin
cp_open(pnh5.Caption,desk_env);
end;

procedure TForm_peach.pnhe6Click(Sender: TObject);
begin
cp_open(pnh6.Caption,desk_env);
end;

procedure TForm_peach.pnhe7Click(Sender: TObject);
begin
cp_open(pnh7.Caption,desk_env);
end;

procedure TForm_peach.pnhe8Click(Sender: TObject);
begin
cp_open(pnh8.Caption,desk_env);
end;

procedure TForm_peach.pnhf1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf1.Caption)
else addfilefolder_ext_fromname(pnhf1.Caption);
end;

procedure TForm_peach.pnhf2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf2.Caption)
else addfilefolder_ext_fromname(pnhf2.Caption);
end;

procedure TForm_peach.pnhf3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf3.Caption)
else addfilefolder_ext_fromname(pnhf3.Caption);
end;

procedure TForm_peach.pnhf4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf4.Caption)
else addfilefolder_ext_fromname(pnhf4.Caption);
end;

procedure TForm_peach.pnhf5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf5.Caption)
else addfilefolder_ext_fromname(pnhf5.Caption);
end;

procedure TForm_peach.pnhf6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf6.Caption)
else addfilefolder_ext_fromname(pnhf6.Caption);
end;

procedure TForm_peach.pnhf7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf7.Caption)
else addfilefolder_ext_fromname(pnhf7.Caption);
end;

procedure TForm_peach.pnhf8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfilefolder_fromname(pnhf8.Caption)
else addfilefolder_ext_fromname(pnhf8.Caption);
end;

procedure TForm_peach.po_addsepClick(Sender: TObject);
begin
if fun='FILEBROWSER' then
   begin
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.State:=cbChecked;
   Form_peach.CheckBoxConvert.State:=cbUnchecked;
   Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   on_checkboxseparateclick;
   end;
end;

procedure TForm_peach.MenuItemInfoClick(Sender: TObject);
begin
do_showstatus;
end;

procedure TForm_peach.MenuItemInfomenuClick(Sender: TObject);
begin
do_showstatus;
end;

procedure TForm_peach.msettingsClick(Sender: TObject);
begin
showpanel('defaults');
end;

procedure TForm_peach.mshownavbarClick(Sender: TObject);
begin
if navbar=3 then navbar:=0
else navbar:=3;
setnav(navbar);
end;

procedure TForm_peach.mshowstatusbarClick(Sender: TObject);
begin
if lastbar=1 then showbar('statusbar')
else showbar('none');
end;

procedure TForm_peach.mshowtoolbarClick(Sender: TObject);
begin
if toolsize=7 then toolsize:=0
else toolsize:=7;
ptoolsize:=toolsize;
settoolbar;
end;

procedure TForm_peach.pmquickdownloadsClick(Sender: TObject);
begin
  jumpto('sysdownloads');
end;

procedure TForm_peach.pmsnoClick(Sender: TObject);
begin
  showbar('none');
end;

procedure TForm_peach.pmsstatusClick(Sender: TObject);
begin
  showbar('statusbar');
end;

procedure TForm_peach.pmstatusnoneClick(Sender: TObject);
begin
showbar('none');
end;

procedure settoolstyle(n:integer);
begin
Form_peach.pmtoollarge.Checked:=false;
Form_peach.pmtoolmedium.Checked:=false;
Form_peach.pmtoolsmall.Checked:=false;
Form_peach.pmtoolcompact.Checked:=false;
Form_peach.pmtoolnone.Checked:=false;
case n of
   1: Form_peach.pmtoollarge.Checked:=true;
   2: Form_peach.pmtoolmedium.Checked:=true;
   3: Form_peach.pmtoolsmall.Checked:=true;
   4: Form_peach.pmtoolcompact.Checked:=true;
   5: Form_peach.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;

procedure TForm_peach.mttoggletoolbarClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
{case toolsize of
1: toolsize:=0;
0: toolsize:=2;
2: toolsize:=3;
3: toolsize:=4;
4: toolsize:=5;
5: toolsize:=6;
6: toolsize:=7;
7: toolsize:=1;
end;
ptoolsize:=toolsize;
settoolbar; }
ntoolstyle:=ntoolstyle+1;
if ntoolstyle>5 then ntoolstyle:=2;
settoolstyle(ntoolstyle);
end;

procedure TForm_peach.pmtoollargeClick(Sender: TObject);
begin
settoolstyle(1);
end;

procedure TForm_peach.pmtoolmediumClick(Sender: TObject);
begin
settoolstyle(2);
end;

procedure TForm_peach.pmtoolsmallClick(Sender: TObject);
begin
settoolstyle(3);
end;

procedure TForm_peach.pmtoolcompactClick(Sender: TObject);
begin
settoolstyle(4);
end;

procedure TForm_peach.pmtoolnoneClick(Sender: TObject);
begin
settoolstyle(5);
end;

procedure TForm_peach.pmshowmainmenuClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=Panelnav4.Left+Panelnav4.Width;
p.y:=Panelnav4.top;//+Panelnav4.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 TForm_peach.mverifyselfClick(Sender: TObject);
begin
internalbincheck;
end;

procedure TForm_peach.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 TForm_peach.MenuItemOpen_saveascsvClick(Sender: TObject);
begin
savecolreport('csv');
end;

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

procedure TForm_peach.mfilterbrowserClick(Sender: TObject);
begin
if filterbrowser=1 then setfilterbrowser(0) else setfilterbrowser(1);
end;

procedure TForm_peach.MenuItemColBeosClick(Sender: TObject);
begin
color3:=ColorToString($00005060);
color1:=ColorToString($0000C0FF);
BevelTitleOptions6.Color:=ColorButton1.ButtonColor;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.MenuItemColMintClick(Sender: TObject);
begin
color3:=ColorToString($00408068);
color1:=ColorToString($0070B090);
BevelTitleOptions6.Color:=ColorButton1.ButtonColor;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.MenuItemColUbuntuClick(Sender: TObject);
begin
color3:=ColorToString($00551466);
color1:=ColorToString($001444DD);
BevelTitleOptions6.Color:=ColorButton1.ButtonColor;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.MenuItemColWindowsClick(Sender: TObject);
begin
color3:=ColorToString(PTACOL);
color1:=ColorToString(PAPPCOL);
BevelTitleOptions6.Color:=ColorButton1.ButtonColor;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.menuitemopendocumentsClick(Sender: TObject);
begin
jumpto('usrdocuments');
end;

procedure TForm_peach.menuitemopendownloadsClick(Sender: TObject);
begin
jumpto('sysdownloads');
end;

procedure TForm_peach.mloadlayoutClick(Sender: TObject);
var
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then sg:=StringGrid1
 else
  {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.top=0{$ENDIF} then sg:=StringGrid2
  else sg:=nil;
loadlist(sg,'');
end;

procedure TForm_peach.mprofileimmediateClick(Sender: TObject);
begin
if immediate_execution=1 then immediate_execution:=0 else immediate_execution:=1;
if immediate_execution=1 then Form_peach.mprofileimmediate.Checked:=true else Form_peach.mprofileimmediate.Checked:=false;
end;

procedure TForm_peach.msamplescriptsClick(Sender: TObject);
begin
cp_open(sharepath+'batch'+DirectorySeparator,desk_env);
end;

procedure TForm_peach.msavelayoutClick(Sender: TObject);
var
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then sg:=StringGrid1
 else
  {$IFDEF MSWINDOWS}if PanelExtract.Visible=true{$ELSE}if PanelExtract.top=0{$ENDIF} then sg:=StringGrid2
  else sg:=nil;
savelist(sg);
end;

procedure TForm_peach.owrunClick(Sender: TObject);
begin
run_custom('');
end;

procedure setrenfilesonly(i:integer);
begin
renfilesonly:=i;
if i=0 then Form_peach.po_rename_filesonly.checked:=false
else Form_peach.po_rename_filesonly.checked:=true;
if i=0 then Form_peach.pmr_files.checked:=false
else Form_peach.pmr_files.checked:=true;
end;

procedure TForm_peach.pmr_filesClick(Sender: TObject);
begin
if renfilesonly=1 then setrenfilesonly(0) else setrenfilesonly(1);
end;

procedure TForm_peach.pmr_renClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TForm_peach.pmsaveascsvClick(Sender: TObject);
begin
savecolreport('csv');
end;

procedure TForm_peach.pmshowsearchClick(Sender: TObject);
begin
if PanelSearch.Visible then setsearchbar(0)
else setsearchbar(1);
end;

procedure TForm_peach.powRunClick(Sender: TObject);
begin
openwith_cust('preview','run',0);
end;

procedure TForm_peach.po_browserccommentClick(Sender: TObject);
begin
sortbrowser(9);
end;

procedure TForm_peach.po_cinnamonsettClick(Sender: TObject);
begin
linlaunch('cinnamon-settings');
end;

procedure TForm_peach.po_clipClick(Sender: TObject);
begin
toggleclip;
end;

procedure TForm_peach.po_dedupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TForm_peach.po_gnomeccClick(Sender: TObject);
begin
linlaunch('gnome-control-center');
end;

procedure TForm_peach.po_gnomeswClick(Sender: TObject);
begin
linlaunch('gnome-software');
end;

procedure TForm_peach.po_kdesyssettClick(Sender: TObject);
begin
linlaunch('systemsettings5');
end;

procedure TForm_peach.po_lindfhClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/bin/df'{$ELSE}'df -h'{$ENDIF});
end;

procedure TForm_peach.po_lindushClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/bin/du'{$ELSE}'du -sh /'{$ENDIF});
end;

procedure TForm_peach.po_linhistoryClick(Sender: TObject);
begin
linlaunchconsole('history');
end;

procedure TForm_peach.po_linidClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/bin/id'{$ELSE}'id'{$ENDIF});
end;

procedure TForm_peach.po_linipaddressClick(Sender: TObject);
begin
linlaunchconsole('ipaddress');
end;

procedure TForm_peach.po_linnetstatClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/sbin/netstat'{$ELSE}'netstat'{$ENDIF});
end;

procedure TForm_peach.po_linpsefClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/bin/ps'{$ELSE}'ps -ef'{$ENDIF});
end;

procedure TForm_peach.po_lintopClick(Sender: TObject);
begin
linlaunchconsole({$IFDEF DARWIN}'/usr/bin/top'{$ELSE}'top'{$ENDIF});
end;

procedure TForm_peach.po_macactClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Utilities/Activity Monitor.app"');
end;

procedure TForm_peach.po_macdiskClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Utilities/Disk Utility.app"');
end;

procedure TForm_peach.po_maclaunchClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Launchpad.app"');
end;

procedure TForm_peach.po_macsysClick(Sender: TObject);
begin
linlaunch('open "/System/Applications/Utilities/System Preferences.app');
end;

procedure TForm_peach.po_openunitasarchivelinClick(Sender: TObject);
begin
openunitasarchive;
end;

procedure TForm_peach.po_dispenvstrlinClick(Sender: TObject);
begin
dispenv;
end;

procedure TForm_peach.MenuItemOpen_runClick(Sender: TObject);
begin
run_custom('');
end;

procedure TForm_peach.pmcaccessedClick(Sender: TObject);
begin
caccessed:=not(caccessed);
mcaccessed.Checked:=caccessed;
pmcaccessed.Checked:=caccessed;
set_listview_col;
end;

procedure TForm_peach.pmccreatedClick(Sender: TObject);
begin
ccreated:=not(ccreated);
mccreated.Checked:=ccreated;
pmccreated.Checked:=ccreated;
set_listview_col;
end;

procedure TForm_peach.pmcmethodClick(Sender: TObject);
begin
cmethod:=not(cmethod);
mcmethod.Checked:=cmethod;
pmcmethod.Checked:=cmethod;
set_listview_col;
end;

procedure TForm_peach.po_ftpClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /c ftp';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_getmacClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k getmac';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.mtabClick(Sender: TObject);
begin
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TForm_peach.pmrowClick(Sender: TObject);
begin
set_rowselect;
end;

procedure TForm_peach.pmsnavClick(Sender: TObject);
begin
setnav(0);
end;

procedure TForm_peach.pmstreeClick(Sender: TObject);
begin
setnav(1);
end;

procedure TForm_peach.pmsnoneClick(Sender: TObject);
begin
setnav(3);
end;

procedure TForm_peach.mtencClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions2, BevelTitleOptions2);
end;

procedure TForm_peach.MenuItemExtAllHereNewClick(Sender: TObject);
begin
quickextract('*new');
end;

procedure TForm_peach.MenuItemExtAllHereSmartClick(Sender: TObject);
begin
quickextract('*smart');
end;

procedure TForm_peach.MenuItemTextEncodingClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions2, BevelTitleOptions2);
end;

procedure TForm_peach.mextallherenewClick(Sender: TObject);
begin
quickextract('*new');
end;

procedure TForm_peach.mextallheresmartClick(Sender: TObject);
begin
quickextract('*smart');
end;

procedure TForm_peach.mextoptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then navgoup;
selnone;
do_extract;
end;

procedure syncedit_archive;
begin
//if Form_peach.StringGridList.RowCount<2 then exit;
//if Form_peach.StringGridList.Cells[1,1]='' then exit;
if ptmpdir='' then exit;
updatingarchive_sync:=true;
if addtoarchive_inarchive(false)=true then
   begin
   Form_peach.Enabled:=false;
   Form_peach.StringGrid1.RowCount:=1;
   deselectingrid(Form_peach.StringGrid1);
   addfolderstr(Form_peach.StringGrid1,ptmpdir+DirectorySeparator+'*');
   Form_peach.StringGrid1.AutoSizeColumns;
   updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
   Form_peach.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;

procedure TForm_peach.mForceSynceditsClick(Sender: TObject);
var
   s,fextl:ansistring;
begin
s:=Form_peach.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 TForm_peach.mForceClearClick(Sender: TObject);
var
   s,fextl:ansistring;
begin
s:=Form_peach.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 TForm_peach.mForceSynceditsClearClick(Sender: TObject);
var
   s,fextl:ansistring;
begin
s:=Form_peach.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 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,Form_peach.cbType.Text+' '+datetimetostr(now));
      writeln(t,'');
      writeln(t,'GENERAL OPTIONS');
      writeln(t,'Type');
      writeln(t,Form_peach.cbType.Text);
      writeln(t,Form_peach.cbType.ItemIndex);
      writeln(t,'Compression level');
      writeln(t,inttostr(Form_peach.ComboBoxArchive9.ItemIndex));
      writeln(t,'Action');
      writeln(t,inttostr(Form_peach.ComboBoxArchiveAct.ItemIndex));
      writeln(t,'Spanning');
      writeln(t,inttostr(Form_peach.ComboBoxArchive1.ItemIndex));
      writeln(t,inttostr(Form_peach.SpinEditArchive1.Value));
      writeln(t,inttostr(Form_peach.ComboBoxArchive2.ItemIndex));
      writeln(t,'Add to separate archives');
      if Form_peach.checkboxseparate.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Archive to original path');
      if Form_peach.CheckBoxSameArc.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Convert');
      if Form_peach.CheckBoxConvert.Checked=true then writeln(t,'1') else writeln(t,'0');
      if Form_peach.CheckBoxConvert0.Checked=true then writeln(t,'1') else writeln(t,'0');
      if Form_peach.CheckBoxConvert1.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Delete files after archiving (be careful)');
      if Form_peach.CheckBoxDeleteInput1.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,inttostr(Form_peach.cbdeleteinputmode1.ItemIndex));
      writeln(t,'Open output path when task completes');
      if Form_peach.CheckBoxAutoOpen.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Send by mail');
      if Form_peach.CheckBoxArchive4.Checked=true then writeln(t,'1') else writeln(t,'0');
      if Form_peach.CheckBoxMailKeep.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'TAR before compressing/archiving');
      if Form_peach.CheckBoxTarBefore.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Close PeaZip when task completes');
      if Form_peach.CheckBoxClosePeaZip.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Halt system when task is completed');
      if Form_peach.CheckBoxAutoHaltA.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Add .enc suffix to encrypted archives');
      if Form_peach.cbencext.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Add timestamp to archive name');
      if Form_peach.CheckBoxDate.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,inttostr(Form_peach.RadioGroupTS.ItemIndex));

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: 7z/p7zip');//7Z
      writeln(t,'Method');
      writeln(t,inttostr(Form_peach.ComboBoxArchive3.ItemIndex));
      writeln(t,'Dictionary');
      writeln(t,inttostr(Form_peach.ComboBoxArchive5.ItemIndex));
      writeln(t,'Word');
      writeln(t,inttostr(Form_peach.ComboBoxArchive6.ItemIndex));
      writeln(t,'Passes');
      writeln(t,inttostr(Form_peach.ComboBoxArchivePasses.ItemIndex));
      writeln(t,'Solid block size');
      writeln(t,inttostr(Form_peach.ComboBoxArchiveSolid.ItemIndex));
      writeln(t,'Sort by name for solid compression');
      if Form_peach.CheckBoxMQS.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Compress files open for writing');
      if Form_peach.CheckBoxArchiveOF.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'SFX module');
      writeln(t,inttostr(Form_peach.RadioGroupArchive.ItemIndex));
      writeln(t,'Paths: relative, full, absolute');
      writeln(t,inttostr(Form_peach.ComboBoxArchivePaths.ItemIndex));
      writeln(t,'Threads');
      writeln(t,inttostr(Form_peach.ComboBoxArchive8.ItemIndex));
      writeln(t,'Other options');
      writeln(t,Form_peach.EditOP.Text);
      writeln(t,'Include NT secutity info (WIM)');
      if Form_peach.CheckBoxsni.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Include NTFS Alternate Data Stream (WIM)');
      if Form_peach.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(Form_peach.ComboBox7zalgo.ItemIndex));

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

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

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

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: PEA');//PEA
      writeln(t,'Compression');
      writeln(t,inttostr(Form_peach.ComboBoxPEACompression1.ItemIndex));
      writeln(t,'Object control algorithm');
      writeln(t,inttostr(Form_peach.ComboBoxPEA3.ItemIndex));
      writeln(t,'Volume control algorithm');
      writeln(t,inttostr(Form_peach.ComboBoxPEA4.ItemIndex));
      writeln(t,'Stream control algorithm');
      writeln(t,inttostr(Form_peach.ComboBoxPEA2.ItemIndex));

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

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

      writeln(t,'');
      writeln(t,'BACKEND OPTIONS: UPX');//UPX
      writeln(t,'Compression');
      writeln(t,inttostr(Form_peach.ComboBoxUPX.ItemIndex));
      writeln(t,'Run strip before UPX (recommended)');
      if Form_peach.CheckBoxUPX1.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Backup executable (recommended)');
      if Form_peach.CheckBoxUPX2.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 Form_peach.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 Form_peach.CheckBoxBrotli.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Maximize Zstandard compression using larger window size');
      if Form_peach.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 Form_peach.cbRAR.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Create RAR5');
      if Form_peach.cbRAR5.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR5 dictionary size');
      writeln(t,inttostr(Form_peach.comboRARdict.ItemIndex));
      writeln(t,'RAR5 use BLAKE2 instead of CRC');
      if Form_peach.cbRARBLAKE2.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR create sfx archive');
      if Form_peach.cbRARsfx.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR create solid archive');
      if Form_peach.cbRARsolid.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR create recovery records');
      if Form_peach.cbRARrr.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR recovery records %');
      writeln(t,inttostr(Form_peach.seRARrr.Value));
      writeln(t,'RAR save files open for writing');
      if Form_peach.cbRARsaveopen.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR save NT security info');
      if Form_peach.cbRARsavesecurity.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'RAR save NTFS streams');
      if Form_peach.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(Form_peach.cbRARlastmodtime.ItemIndex));
      writeln(t,'RAR lock archive');
      if Form_peach.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 Form_peach.cbcustext.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,Form_peach.editcustext.Caption);

      writeln(t,'');
      writeln(t,'8.2.0 EXTENSION');
      writeln(t,'Store Created and Last access timestamps in archive types supporting it');
      if Form_peach.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(Form_peach.ComboBoxTAR.ItemIndex));
      writeln(t,'Timestamp precision');
      writeln(t,inttostr(Form_peach.ComboBoxTAR1.ItemIndex));
      writeln(t,'TAR, Linux save owner/group ids');
      if Form_peach.CheckBoxsnoi.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'TAR, Linux save owner/group names');
      if Form_peach.CheckBoxsnon.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Test archives after creation');
      if Form_peach.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 Form_peach.CheckBoxssp.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Store hard links as links (WIM, TAR)');
      if Form_peach.CheckBoxsnh.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'Store symbolic links as links (WIM, TAR)');
      if Form_peach.CheckBoxsnl.Checked=true then writeln(t,'1') else writeln(t,'0');
      writeln(t,'7z/p7zip max memory usage');
      writeln(t,inttostr(Form_peach.ComboBoxmemuse.ItemIndex));

      //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
Form_Peach.SaveDialogPJ.DefaultExt:='.txt';
if not(DirectoryExists(confpath+'Compression settings'+DirectorySeparator)) then mkdir(confpath+'Compression settings'+DirectorySeparator);
Form_peach.SaveDialogPJ.InitialDir:=confpath+'Compression settings'+DirectorySeparator;
if Form_peach.SaveDialogPJ.Execute then
   if Form_peach.SaveDialogPJ.FileName<>'' then
      begin
      save_presets(Form_peach.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+'0.txt',s);
if s='0' then s:=txt_7_4_presetrar;
Form_peach.mprofilerar.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'1.txt',s);
if s='1' then s:=txt_7_2_extcompultra;
Form_peach.mprofileextremezpaq.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'2.txt',s);
if s='2' then s:=txt_7_2_extcomp;
Form_peach.mprofilebetterzpaq.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'3.txt',s);
if s='3' then s:=txt_5_3_profilebest;
Form_peach.mprofileultra7z.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'4.txt',s);
if s='4' then s:=txt_5_3_profileadvanced;
Form_peach.mprofilenormal7z.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'5.txt',s);
if s='5' then s:=txt_7_2_altcomp;
Form_peach.mprofilealtarc.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'6.txt',s);
if s='6' then s:=txt_7_3_profile7zfast;
Form_peach.mprofile7zfast.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'7.txt',s);
if s='7' then s:=txt_7_1_profileintermediate;
Form_peach.mprofilezipbz2.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'8.txt',s);
if s='8' then s:=txt_5_3_profilenormal;
Form_peach.mprofilenormalzip.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'9.txt',s);
if s='9' then s:=txt_7_3_profile7zfastest;
Form_peach.mprofile7zfastest.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'10.txt',s);
if s='10' then s:=txt_5_3_profileveryfast;
Form_peach.mprofilefastzip.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'11.txt',s);
if s='11' then s:=txt_7_4_7zfbrotlicomp;
Form_peach.mprofilebrotli.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'12.txt',s);
if s='12' then s:=txt_7_4_7zfzstandardcomp;
Form_peach.mprofilezstd.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'13.txt',s);
if s='13' then s:=txt_5_3_profilepassword;
Form_peach.mprofileencrypt7z.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'14.txt',s);
if s='14' then s:=txt_5_3_profile10mb;
Form_peach.mprofilesplitzip.Caption:=s;
check_presets_name(sharepath+'presets'+DirectorySeparator+'15.txt',s);
if s='15' then s:=txt_5_3_profilesfx;
Form_peach.mprofileauto.Caption:=s;
end;

procedure load_presets(presetfilename: ansistring);
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); Form_peach.cbType.Text:=s;
      readln(t,s); Form_peach.cbType.ItemIndex:=strtoint(s); Form_peach.cbTypeChange(nil);
      readln(t,s); //compression level
      readln(t,s); Form_peach.ComboBoxArchive9.itemindex:=strtoint(s); Form_peach.ComboBoxArchive9Closeup(nil);
      readln(t,s); //action
      readln(t,s); Form_peach.ComboBoxArchiveAct.itemindex:=strtoint(s); Form_peach.ComboBoxArchiveActChange(nil);
      readln(t,s); //split
      readln(t,s); Form_peach.ComboBoxArchive1.itemindex:=strtoint(s); ComboBoxArchive1_onchange;
      readln(t,s); Form_peach.SpinEditArchive1.Value:=strtoint(s); Form_peach.SpinEditArchive1Change(nil);
      readln(t,s); Form_peach.ComboBoxArchive2.itemindex:=strtoint(s); Form_peach.ComboBoxArchive2Change(nil);
      readln(t,s); //separate
      readln(t,s1); if s1='1' then Form_peach.checkboxseparate.Checked:=true else Form_peach.checkboxseparate.Checked:=false; on_checkboxseparateclick;
      readln(t,s); //original path
      readln(t,s2); if s2='1' then Form_peach.CheckBoxSameArc.Checked:=true else Form_peach.CheckBoxSameArc.Checked:=false; on_checkboxsamearcclick;
      readln(t,s); //convert
      readln(t,s4); if s4='1' then Form_peach.CheckBoxConvert.Checked:=true else Form_peach.CheckBoxConvert.Checked:=false; Form_peach.CheckBoxConvertChange(nil);
      readln(t,s); if s='1' then Form_peach.CheckBoxConvert0.Checked:=true else Form_peach.CheckBoxConvert0.Checked:=false; Form_peach.CheckBoxConvert0Change(nil);
      readln(t,s); if s='1' then Form_peach.CheckBoxConvert1.Checked:=true else Form_peach.CheckBoxConvert1.Checked:=false; Form_peach.CheckBoxConvert1Change(nil);
      readln(t,s); //delete
      readln(t,s); if s='1' then Form_peach.CheckBoxDeleteInput1.Checked:=true else Form_peach.CheckBoxDeleteInput1.Checked:=false; Form_peach.CheckBoxDeleteInput1Click(nil);
      readln(t,s); Form_peach.cbdeleteinputmode1.itemindex:=strtoint(s); Form_peach.cbdeleteinputmode1Change(nil);
      readln(t,s); //auto open
      readln(t,s); if s='1' then Form_peach.CheckBoxAutoOpen.Checked:=true else Form_peach.CheckBoxAutoOpen.Checked:=false; Form_peach.CheckBoxAutoOpenClick(nil);
      readln(t,s); //send by mail
      readln(t,s); if s='1' then Form_peach.CheckBoxArchive4.Checked:=true else Form_peach.CheckBoxArchive4.Checked:=false; Form_peach.CheckBoxArchive4Click(nil);
      readln(t,s); if s='1' then Form_peach.CheckBoxMailKeep.Checked:=true else Form_peach.CheckBoxMailKeep.Checked:=false; Form_peach.CheckBoxMailKeepClick(nil);
      readln(t,s); //tar before
      readln(t,s3); if s3='1' then Form_peach.CheckBoxTarBefore.Checked:=true else Form_peach.CheckBoxTarBefore.Checked:=false; Form_peach.CheckBoxTarBeforeClick(nil);
      readln(t,s); //auto close PeaZip
      readln(t,s); if s='1' then Form_peach.CheckBoxClosePeaZip.Checked:=true else Form_peach.CheckBoxClosePeaZip.Checked:=false; Form_peach.CheckBoxClosePeaZipClick(nil);
      readln(t,s); //auto halt
      readln(t,s); if s='1' then Form_peach.CheckBoxAutoHaltA.Checked:=true else Form_peach.CheckBoxAutoHaltA.Checked:=false;
      readln(t,s); //add .enc suffix
      readln(t,s); if s='1' then Form_peach.cbencext.Checked:=true else Form_peach.cbencext.Checked:=false; Form_peach.cbencextClick(nil);
      readln(t,s); //timestamp
      readln(t,s); if s='1' then Form_peach.CheckBoxDate.Checked:=true else Form_peach.CheckBoxDate.Checked:=false; Form_peach.CheckBoxDateClick(nil);
      readln(t,s); Form_peach.RadioGroupTS.itemindex:=strtoint(s); Form_peach.RadioGroupTSChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND 7z/p7zip
      readln(t,s); //method
      readln(t,s); Form_peach.ComboBoxArchive3.itemindex:=strtoint(s); Form_peach.ComboBoxArchive3CloseUp(nil);
      readln(t,s); //dictionary
      readln(t,s); Form_peach.ComboBoxArchive5.itemindex:=strtoint(s);
      readln(t,s); //word
      readln(t,s); Form_peach.ComboBoxArchive6.itemindex:=strtoint(s);
      readln(t,s); //passes
      readln(t,s); Form_peach.ComboBoxArchivePasses.itemindex:=strtoint(s);
      readln(t,s); //solidsize
      readln(t,s); Form_peach.ComboBoxArchiveSolid.itemindex:=strtoint(s);
      readln(t,s); //sort by name
      readln(t,s); if s='1' then Form_peach.CheckBoxMQS.Checked:=true else Form_peach.CheckBoxMQS.Checked:=false; Form_peach.CheckBoxMQSClick(nil);
      readln(t,s); //compress open for writing
      readln(t,s); if s='1' then Form_peach.CheckBoxArchiveOF.Checked:=true else Form_peach.CheckBoxArchiveOF.Checked:=false; Form_peach.CheckBoxArchiveOFClick(nil);
      readln(t,s); //sfx module
      readln(t,s); Form_peach.RadioGroupArchive.itemindex:=strtoint(s);
      readln(t,s); //paths
      readln(t,s); Form_peach.ComboBoxArchivePaths.itemindex:=strtoint(s);
      readln(t,s); //threads
      readln(t,s); Form_peach.ComboBoxArchive8.itemindex:=strtoint(s); Form_peach.ComboBoxArchive8Change(nil);
      readln(t,s); //other
      readln(t,s); Form_peach.EditOP.Text:=s;
      readln(t,s); //nt security
      readln(t,s); if s='1' then Form_peach.CheckBoxsni.Checked:=true else Form_peach.CheckBoxsni.Checked:=false; Form_peach.CheckBoxsniClick(nil);
      readln(t,s); //ntfs stream
      readln(t,s); if s='1' then Form_peach.CheckBoxsns.Checked:=true else Form_peach.CheckBoxsns.Checked:=false; Form_peach.CheckBoxsnsClick(nil);
      readln(t,s); //encryption algorithm
      readln(t,s); Form_peach.ComboBox7zalgo.itemindex:=strtoint(s); Form_peach.ComboBox7zalgoChange(nil);

      readln(t,s);
      readln(t,s); //BACKEND arc
      readln(t,s); //solid mode
      readln(t,s); Form_peach.ComboBoxArcSolid.itemindex:=strtoint(s); Form_peach.ComboBoxArcSolidChange(nil);
      readln(t,s); //recovery records
      readln(t,s); if s='1' then Form_peach.CheckBoxARC1.Checked:=true else Form_peach.CheckBoxARC1.Checked:=false; Form_peach.CheckBoxARC1Click(nil);
      readln(t,s); //sfx
      readln(t,s); if s='1' then Form_peach.CheckBoxARC2.Checked:=true else Form_peach.CheckBoxARC2.Checked:=false; Form_peach.CheckBoxARC2Click(nil);
      readln(t,s); Form_peach.ComboBoxArcSfx.itemindex:=strtoint(s);
      readln(t,s); //other
      readln(t,s); Form_peach.EditOParc.Text:=s;
      readln(t,s); //absolute paths
      readln(t,s); if s='1' then Form_peach.CheckBoxARC3.Checked:=true else Form_peach.CheckBoxARC3.Checked:=false; Form_peach.CheckBoxARC3Click(nil);
      readln(t,s); //encryption algorithm
      readln(t,s); Form_peach.ComboBoxARCalgo.itemindex:=strtoint(s); Form_peach.ComboBoxARCalgoChange(nil);

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

      readln(t,s);
      readln(t,s); //BACKEND paq lpaq zpaq
      readln(t,s); //exe
      readln(t,s); Form_peach.RadioGroupPaq.itemindex:=strtoint(s); Form_peach.RadioGroupPaqClick(nil);
      readln(t,s); //compression
      readln(t,s); Form_peach.ComboBoxPAQ1.itemindex:=strtoint(s); Form_peach.ComboBoxPAQ1Change(nil);

      readln(t,s);
      readln(t,s); //BACKEND pea
      readln(t,s); //compression
      readln(t,s); Form_peach.ComboBoxPEACompression1.itemindex:=strtoint(s); Form_peach.ComboBoxPEACompression1Change(nil);
      readln(t,s); //object control
      readln(t,s); Form_peach.ComboBoxPEA3.itemindex:=strtoint(s); Form_peach.ComboBoxPEA3Change(nil);
      readln(t,s); //volume control
      readln(t,s); Form_peach.ComboBoxPEA4.itemindex:=strtoint(s); Form_peach.ComboBoxPEA4Change(nil);
      readln(t,s); //stream control
      readln(t,s); Form_peach.ComboBoxPEA2.itemindex:=strtoint(s); Form_peach.ComboBoxPEA2Change(nil);

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

      readln(t,s);
      readln(t,s); //BACKEND split
      readln(t,s); //integrity check
      readln(t,s); Form_peach.ComboBoxSplit3.itemindex:=strtoint(s); Form_peach.ComboBoxSplit3Change(nil);

      readln(t,s);
      readln(t,s); //BACKEND upx
      readln(t,s); //level
      readln(t,s); Form_peach.ComboBoxUPX.itemindex:=strtoint(s); Form_peach.ComboBoxUPXChange(nil);
      readln(t,s); //strip exe
      readln(t,s); if s='1' then Form_peach.CheckBoxUPX1.Checked:=true else Form_peach.CheckBoxUPX1.Checked:=false;
      readln(t,s); //backup exe
      readln(t,s); if s='1' then Form_peach.CheckBoxUPX2.Checked:=true else Form_peach.CheckBoxUPX2.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 Form_peach.CheckBoxstl.Checked:=true else Form_peach.CheckBoxstl.Checked:=false; Form_peach.CheckBoxstlClick(nil);
      readln(t,s); //maximize Brotli compression
      readln(t,s); if s='1' then Form_peach.CheckBoxBrotli.Checked:=true else Form_peach.CheckBoxBrotli.Checked:=false; Form_peach.CheckBoxBrotliClick(nil);
      readln(t,s); //maximize Zstandard compression
      readln(t,s); if s='1' then Form_peach.CheckBoxZstd.Checked:=true else Form_peach.CheckBoxZstd.Checked:=false; Form_peach.CheckBoxZstdClick(nil);

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

      //8.8 extension
      readln(t,s);
      readln(t,s); //8.8.0 EXTENSION
      readln(t,s); //TAR standard
      readln(t,s); Form_peach.ComboBoxTAR.itemindex:=strtoint(s); Form_peach.ComboBoxTARChange(nil);
      readln(t,s); //TAR/pax timestamp precision
      readln(t,s); Form_peach.ComboBoxTAR1.itemindex:=strtoint(s); Form_peach.ComboBoxTAR1Change(nil);
      readln(t,s); //snoi
      readln(t,s); if s='1' then Form_peach.CheckBoxsnoi.Checked:=true else Form_peach.CheckBoxsnoi.Checked:=false; Form_peach.CheckBoxsnoiClick(nil);
      readln(t,s); //snon
      readln(t,s); if s='1' then Form_peach.CheckBoxsnon.Checked:=true else Form_peach.CheckBoxsnon.Checked:=false; Form_peach.CheckBoxsnonClick(nil);
      readln(t,s); //auto test
      readln(t,s); if s='1' then Form_peach.CheckBoxAutoTest.Checked:=true else Form_peach.CheckBoxAutoTest.Checked:=false; Form_peach.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 Form_peach.CheckBoxssp.Checked:=true else Form_peach.CheckBoxssp.Checked:=false; Form_peach.CheckBoxsspClick(nil);
      readln(t,s); //hard links
      readln(t,s); if s='1' then Form_peach.CheckBoxsnh.Checked:=true else Form_peach.CheckBoxsnh.Checked:=false; Form_peach.CheckBoxsnhClick(nil);
      readln(t,s); //sym links
      readln(t,s); if s='1' then Form_peach.CheckBoxsnl.Checked:=true else Form_peach.CheckBoxsnl.Checked:=false; Form_peach.CheckBoxsnlClick(nil);
      readln(t,s); //max memory use
      readln(t,s); Form_peach.ComboBoxmemuse.itemindex:=strtoint(s); Form_peach.ComboBoxmemuseChange(nil);

      Form_peach.cbTypeChange(nil);

      //re-apply special settings which conditionally enables/disables other settings
      if s3='1' then Form_peach.CheckBoxTarBefore.Checked:=true else Form_peach.CheckBoxTarBefore.Checked:=false; Form_peach.CheckBoxTarBeforeClick(nil);
      if s2='1' then Form_peach.CheckBoxSameArc.Checked:=true else Form_peach.CheckBoxSameArc.Checked:=false; on_checkboxsamearcclick;
      if s1='1' then Form_peach.checkboxseparate.Checked:=true else Form_peach.checkboxseparate.Checked:=false; on_checkboxseparateclick;
      if s3='1' then Form_peach.checkboxseparate.Enabled:=false;
      //convert status is no 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 Form_peach.ImagePassword1Click(nil);
   except
      try closefile(t); except end;
   end;
end;

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

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

procedure TForm_peach.mloadcompsettingsClick(Sender: TObject);
begin
load_presets_interactive;
end;

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

procedure TForm_peach.mprofile7zfastClick(Sender: TObject);
begin
applypreset('6.txt');
end;

procedure TForm_peach.mprofilealtarcClick(Sender: TObject);
begin
applypreset('5.txt');
end;

procedure TForm_peach.mprofilebetterzpaqClick(Sender: TObject);
begin
applypreset('2.txt');
end;

procedure TForm_peach.mprofilebrotliClick(Sender: TObject);
begin
applypreset('11.txt');
end;

procedure TForm_peach.mprofilezipbz2Click(Sender: TObject);
begin
applypreset('7.txt');
end;

procedure TForm_peach.mprofilezstdClick(Sender: TObject);
begin
applypreset('12.txt');
end;

procedure TForm_peach.mprofileextremezpaqClick(Sender: TObject);
begin
applypreset('1.txt');
end;

procedure TForm_peach.mprofile7zfastestClick(Sender: TObject);
begin
applypreset('9.txt');
end;

procedure TForm_peach.mprofileautoClick(Sender: TObject);
begin
applypreset('15.txt');
end;

procedure TForm_peach.mprofileencrypt7zClick(Sender: TObject);
begin
applypreset('13.txt');
end;

procedure TForm_peach.mprofilefastzipClick(Sender: TObject);
begin
applypreset('10.txt');
end;

procedure TForm_peach.mprofilenormal7zClick(Sender: TObject);
begin
applypreset('4.txt');
end;

procedure TForm_peach.mprofilenormalzipClick(Sender: TObject);
begin
applypreset('8.txt');
end;

procedure TForm_peach.mprofilesplitzipClick(Sender: TObject);
begin
applypreset('14.txt');
end;

procedure TForm_peach.mprofileultra7zClick(Sender: TObject);
begin
applypreset('3.txt');
end;

procedure TForm_peach.mprofileloadClick(Sender: TObject);
begin
load_presets_interactive;
end;

procedure TForm_peach.mprofilerarClick(Sender: TObject);
begin
applypreset('0.txt');
end;

procedure TForm_peach.mprofilesaveClick(Sender: TObject);
begin
save_presets_interactive;
end;

procedure TForm_peach.msavecompsettingsClick(Sender: TObject);
begin
save_presets_interactive;
end;

procedure TForm_peach.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 TForm_peach.mtogglesidebarClick(Sender: TObject);
begin
if navbar=3 then setnav(0) else setnav(3);
end;

procedure TForm_peach.mtoggletabbarClick(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 TForm_peach.mtoggletoolbarClick(Sender: TObject);
begin
if toolsize=7 then mtoggletoolbar.Caption:='↓'
else mtoggletoolbar.Caption:='↑';
if toolsize=7 then
   if ptoolsize<>7 then toolsize:=ptoolsize
   else toolsize:=0
else toolsize:=7;
settoolbar;
end;

procedure TForm_peach.PanelClickAddressMouseEnter(Sender: TObject);
begin
bctemp:=0;
end;

procedure TForm_peach.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 dospecfun(sf:ansistring);
var
   s,cl,jobcode,outname,dummyfun,dummysubfun,dummyinf:ansistring;
begin
dummyfun:=fun;
dummysubfun:=subfun;
dummyinf:=Form_peach.EditOpenIn.Text;
if fun='FILEBROWSER' then
   s:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]
else
   s:=Form_peach.EditOpenIn.Text;
Form_peach.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;
Form_peach.EditOpenIn.Text:=dummyinf;
end;

procedure rarspeclock;
var
   cl,jobcode,outname:ansistring;
   P:TProcess;
begin
if upcase(extractfileext(Form_peach.EditOpenIn.Text))='.RAR' then
   if pMessageInfoYesNo(extractfilename(Form_peach.EditOpenIn.Text)+char($0D)+char($0A)+char($0D)+char($0A)+txt_7_4_lockconfirm)=6 then
      if compose_rarspecfun_cl(cl,jobcode,outname,'k')=0 then
         begin
         P:=tprocessutf8.Create(nil);
         P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
         P.CommandLine:=cl;
         P.Execute;
         P.Free;
         do_forcerefresh;
         end;
end;

procedure TForm_peach.pmmorecommentClick(Sender: TObject);
begin
dospecfun('c');
end;

procedure TForm_peach.pmmorelockClick(Sender: TObject);
begin
rarspeclock;
end;

procedure TForm_peach.pmmorerecoverClick(Sender: TObject);
begin
dospecfun('r');
end;

procedure TForm_peach.pmmorerrClick(Sender: TObject);
begin
dospecfun('rr');
end;

procedure TForm_peach.pmpanalyzefoldersClick(Sender: TObject);
begin
analyzefolders('displayed');
end;

procedure TForm_peach.pmqeherenewClick(Sender: TObject);
begin
quickextract('*new');
end;

procedure TForm_peach.pmqeheresmartClick(Sender: TObject);
begin
quickextract('*smart');
end;

procedure TForm_peach.pmrshClick(Sender: TObject);
begin
Form_peach.pmshist1.Caption:='';
Form_peach.pmshist2.Caption:='';
Form_peach.pmshist3.Caption:='';
Form_peach.pmshist4.Caption:='';
Form_peach.pmshist5.Caption:='';
Form_peach.pmshist6.Caption:='';
Form_peach.pmshist7.Caption:='';
Form_peach.pmshist8.Caption:='';
setsearchhistorymenu;
end;

procedure TForm_peach.pmr_123Click(Sender: TObject);
begin
rename_files('123');
end;

procedure TForm_peach.pmr_appenddirnameClick(Sender: TObject);
begin
rename_files('dirappend');
end;

procedure TForm_peach.pmr_appendtsClick(Sender: TObject);
begin
rename_files('timestamp');
end;

procedure TForm_peach.pmr_asciiClick(Sender: TObject);
begin
rename_files('keepasci');
end;

procedure TForm_peach.pmr_cutClick(Sender: TObject);
begin
rename_files('cutlen');
end;

procedure TForm_peach.pmr_prependdirnameClick(Sender: TObject);
begin
rename_files('dirprepend');
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:=Form_peach.Caption;
for i := 0 to High(FileNames) do
   begin
   if directoryexists(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(Form_peach.StringGrid2);
               addfilestr(Form_peach.StringGrid2,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;
         Form_peach.Caption:=txt_2_4_adding+' '+FileNames[i];
         Application.ProcessMessages;
         deselectingrid(Form_peach.StringGrid2);
         addfilestr(Form_peach.StringGrid2,escapefilename(FileNames[i],desk_env));
         end;
      end;
   end;
updatecontent_ext;
Form_peach.Caption:=s;
end;

procedure TForm_peach.pms2a_extClick(Sender: TObject);
begin
list_toextractor('none','full');
drag_addtolayoutext(dfilenames);
end;

procedure TForm_peach.pmstyle1Click(Sender: TObject);
begin
settpreset(1);
end;

procedure TForm_peach.pmstyle2Click(Sender: TObject);
begin
settpreset(2);
end;

procedure TForm_peach.pmstyle3Click(Sender: TObject);
begin
settpreset(3);
end;

procedure TForm_peach.pmstyle4Click(Sender: TObject);
begin
settpreset(4);
end;

procedure TForm_peach.pmstyle5Click(Sender: TObject);
begin
settpreset(5);
end;

procedure TForm_peach.pmstyle6Click(Sender: TObject);
begin
settpreset(6);
end;

procedure TForm_peach.pmtabClick(Sender: TObject);
begin
if ptabbar=1 then settabbar(0) else settabbar(1);
end;

procedure TForm_peach.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 TForm_peach.pmtestcontextallClick(Sender: TObject);
begin
archive_funsel('test','all');
end;

procedure TForm_peach.pmtestcontextdisplayedClick(Sender: TObject);
begin
archive_funsel('test','displayed');
end;

procedure TForm_peach.pmtestcontextselectedClick(Sender: TObject);
begin
archive_funsel('test','selected');
end;

procedure TForm_peach.pmtextencClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions2, BevelTitleOptions2);
end;

procedure TForm_peach.pmthemesClick(Sender: TObject);
begin
showpanel('defaults');
end;

procedure TForm_peach.pmtool1Click(Sender: TObject);
begin
showtoolbar(1);
if ntoolstyle=5 then settoolstyle(2);
end;

procedure TForm_peach.pmtool2Click(Sender: TObject);
begin
showtoolbar(2);
if ntoolstyle=5 then settoolstyle(2);
end;

procedure TForm_peach.pmtool3Click(Sender: TObject);
begin
showtoolbar(3);
if ntoolstyle=5 then settoolstyle(2);
end;

procedure TForm_peach.po_analyzefoldersClick(Sender: TObject);
begin
analyzefolders('displayed');
end;

procedure TForm_peach.po_commentClick(Sender: TObject);
begin
dospecfun('c');
end;

procedure TForm_peach.po_hostnameClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k hostname';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_ipconfigClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k ipconfig';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_lockClick(Sender: TObject);
begin
rarspeclock;
end;

procedure TForm_peach.po_openfilesClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k openfiles';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_pdupClick(Sender: TObject);
begin
findduplicate('neutral');
end;

procedure TForm_peach.po_quserClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k quser';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_qwinstaClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k qwinsta';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_recoverClick(Sender: TObject);
begin
dospecfun('r');
end;

procedure TForm_peach.po_rename_123Click(Sender: TObject);
begin
rename_files('123');
end;

procedure TForm_peach.po_rename_asciiClick(Sender: TObject);
begin
rename_files('keepascii');
end;

procedure TForm_peach.po_rename_cutlenClick(Sender: TObject);
begin
rename_files('cutlen');
end;

procedure TForm_peach.po_rename_filesonlyClick(Sender: TObject);
begin
if renfilesonly=1 then setrenfilesonly(0) else setrenfilesonly(1);
end;

procedure TForm_peach.po_rrClick(Sender: TObject);
begin
dospecfun('rr');
end;

procedure TForm_peach.po_setappstClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(form_peach.LabelTitleOptions5, form_peach.BevelTitleOptions5);
end;

procedure TForm_peach.po_showquicknavmenuClick(Sender: TObject);
begin
popuptabmenu;
end;

procedure TForm_peach.po_smartClick(Sender: TObject);
var
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
if winver<>'nt6+' then
   P.CommandLine:='cmd /K wmic diskdrive get Status, DeviceID, InterfaceType, Model, Size'
else
   P.CommandLine:='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';
if Form_peach.Visible=true then Application.ProcessMessages;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_synapticClick(Sender: TObject);
begin
linlaunch('gksudo synaptic');
end;

procedure TForm_peach.po_systeminfoClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k systeminfo';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.iadvextractClick(Sender: TObject);
begin
pMessageInfoOK(iadvextract.Hint);
end;

procedure TForm_peach.ImageAdArchive0Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.PanelAdArchive0.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(0);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAdArchive0MouseEnter(Sender: TObject);
begin
PanelAdArchive0.Color:=abactivecol;
bctemp:=8;
end;

procedure TForm_peach.ImageAdArchive0MouseLeave(Sender: TObject);
begin
PanelAdArchive0.Color:=abarchivecol;
end;

procedure TForm_peach.ImageAdArchive1Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.PanelAdArchive1.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(1);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAdArchive1MouseEnter(Sender: TObject);
begin
PanelAdArchive1.Color:=abactivecol;
bctemp:=8;
end;

procedure TForm_peach.ImageAdArchive1MouseLeave(Sender: TObject);
begin
PanelAdArchive1.Color:=abarchivecol;
end;

procedure TForm_peach.ImageAdArchive2Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.PanelAdArchive2.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(2);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAdArchive2MouseEnter(Sender: TObject);
begin
PanelAdArchive2.Color:=abactivecol;
bctemp:=8;
end;

procedure TForm_peach.ImageAdArchive2MouseLeave(Sender: TObject);
begin
PanelAdArchive2.Color:=abarchivecol;
end;

procedure TForm_peach.ImageAdArchive3Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.PanelAdArchive3.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbarchive(3);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAdArchive3MouseEnter(Sender: TObject);
begin
PanelAdArchive3.Color:=abactivecol;
bctemp:=8;
end;

procedure TForm_peach.ImageAdArchive3MouseLeave(Sender: TObject);
begin
PanelAdArchive3.Color:=abarchivecol;
end;

procedure TForm_peach.ImageAddress0Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress0.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
{$IFDEF MSWINDOWS}prepare_breadcrumbdir(txt_mypc);{$ELSE}prepare_breadcrumbdir(directoryseparator);{$ENDIF}
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress0MouseEnter(Sender: TObject);
begin
PanelAddress0.Color:=abactivecol;
bctemp:=1;
end;

procedure TForm_peach.ImageAddress0MouseLeave(Sender: TObject);
begin
PanelAddress0.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress1Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress1.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc8.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress1MouseEnter(Sender: TObject);
begin
PanelAddress1.Color:=abactivecol;
bctemp:=2;
end;

procedure TForm_peach.ImageAddress1MouseLeave(Sender: TObject);
begin
PanelAddress1.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress2Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress2.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc7.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress2MouseEnter(Sender: TObject);
begin
PanelAddress2.Color:=abactivecol;
bctemp:=3;
end;

procedure TForm_peach.ImageAddress2MouseLeave(Sender: TObject);
begin
PanelAddress2.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress3Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress3.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc6.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress3MouseEnter(Sender: TObject);
begin
PanelAddress3.Color:=abactivecol;
bctemp:=4;
end;

procedure TForm_peach.ImageAddress3MouseLeave(Sender: TObject);
begin
PanelAddress3.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress4Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress4.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc5.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress4MouseEnter(Sender: TObject);
begin
PanelAddress4.Color:=abactivecol;
bctemp:=5;
end;

procedure TForm_peach.ImageAddress4MouseLeave(Sender: TObject);
begin
PanelAddress4.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress5Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress5.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc4.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress5MouseEnter(Sender: TObject);
begin
PanelAddress5.Color:=abactivecol;
bctemp:=6;
end;

procedure TForm_peach.ImageAddress5MouseLeave(Sender: TObject);
begin
PanelAddress5.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress6Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress6.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc3.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress6MouseEnter(Sender: TObject);
begin
PanelAddress6.Color:=abactivecol;
bctemp:=7;
end;

procedure TForm_peach.ImageAddress6MouseLeave(Sender: TObject);
begin
PanelAddress6.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddress7Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.paneladdress7.left;
pp.y:=Form_peach.PanelListBar.height+PanelTabBar.height+Form_peach.PanelBarOpen.height-4;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
if swaptab=true then pp.y:=pp.y-Form_peach.PanelTabBar.height;
pp:=clienttoscreen(pp);
prepare_breadcrumbdir(Form_peach.pmbc2.caption);
Form_peach.pmbcdir.PopUp(pp.x,pp.y);
end;

procedure TForm_peach.ImageAddress7MouseEnter(Sender: TObject);
begin
PanelAddress7.Color:=abactivecol;
bctemp:=8;
end;

procedure TForm_peach.ImageAddress7MouseLeave(Sender: TObject);
begin
PanelAddress7.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddressClick(Sender: TObject);
begin
jumpto('root');
end;

procedure TForm_peach.ImageFlatClick(Sender: TObject);
begin

end;

procedure drag_addtolayout(FileNames:array of string);
var
   i: integer;
   s: ansistring;
begin
s:=Form_peach.Caption;
for i := 0 to High(FileNames) do
   if testname(escapefilename(FileNames[i],desk_env), Form_peach.StringGrid1)=0 then
      begin
      Form_peach.Caption:=txt_2_4_adding+' '+FileNames[i];
      Application.ProcessMessages;
      deselectingrid(Form_peach.StringGrid1);
      if (filegetattr(escapefilename(FileNames[i],desk_env)) and faDirectory) <> 0 then addfolderstr(Form_peach.StringGrid1,escapefilename(FileNames[i],desk_env))
      else addfilestr(Form_peach.StringGrid1,escapefilename(FileNames[i],desk_env));
      end;
Form_peach.StringGrid1.AutoSizeColumns;
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
Form_peach.Caption:=s;
application.ProcessMessages;
if enumd=1 then updatelayout('enum');
end;

procedure setdragarchivename;
var
   s:ansistring;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
if Form_peach.mdefaultarchive.Checked=true then Form_peach.EditName3.Text:=defaultarchivepath
else Form_peach.EditName3.Text:=extractfilepath(s);
Form_peach.Edit4.Text:=extractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.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 Form_peach.labelstatus2.Caption<>txt_2_7_ext then exit;
s:=Form_peach.Caption;
for i := 0 to High(FileNames) do
   begin
   if directoryexists(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(Form_peach.StringGrid2);
               addfilestr(Form_peach.StringGrid2,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;
         Form_peach.Caption:=txt_2_4_adding+' '+FileNames[i];
         Application.ProcessMessages;
         deselectingrid(Form_peach.StringGrid2);
         addfilestr(Form_peach.StringGrid2,escapefilename(FileNames[i],desk_env));
         end;
      end;
   end;
updatecontent_ext;
Form_peach.Caption:=s;
end;

procedure drag_addtobookmarks;
var
   i: integer;
begin
for i := 0 to High(FileNames) do
   addtobookmarks(escapefilename(FileNames[i],desk_env));
end;

procedure drag_addtoarchive;
var
   dfn,s:ansistring;
   i:integer;
begin
if (status0<>txt_list_browsing) and (Form_peach.StringGridList.Cells[1,1]='') then exit;
addtoarchive_inarchive(true);
for i := 0 to High(FileNames) do
   begin
   dfn:=escapefilename(FileNames[i],desk_env);
   if (filegetattr(dfn) and faDirectory) <> 0 then
      begin
      s:=Form_peach.Caption;
      if dfn<>'' then
         if testname(dfn, Form_peach.StringGrid1)=0 then
            begin
            Form_peach.StringGrid1.Cursor:=crHourGlass;
            Form_peach.Caption:=txt_2_4_adding+' '+dfn;
            Application.ProcessMessages;
            deselectingrid(Form_peach.StringGrid1);
            addfolderstr(Form_peach.StringGrid1,dfn);
            Form_peach.StringGrid1.Cursor:=crDefault;
         end;
      Form_peach.Caption:=s;
      end
   else
      begin
      if dfn<>'' then
         begin
         Form_peach.StringGrid1.Cursor:=crHourGlass;
         deselectingrid(Form_peach.StringGrid1);
         if testname(dfn, Form_peach.StringGrid1)=0 then
            begin
            //show names of items being added is not implemented here since adding files is very fast
            addfilestr(Form_peach.StringGrid1,dfn);
            end;
         Form_peach.StringGrid1.Cursor:=crDefault;
         end;
      end;
   end;
Form_peach.StringGrid1.AutoSizeColumns;
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
end;

var
   i:integer;
   lpPoint: TPoint;
begin
{$IFDEF MSWINDOWS}
if nativedrag=1 then
   if disdrag=true then exit;
{$ENDIF}
dfilenames:=@FileNames;
if Form_peach.visible=false then exit;
if (PanelArchiveMain.Visible=true)  and (PanelArchiveMain.Top<10000) then
   begin
   drag_addtolayout(FileNames);
   setdragarchivename;
   end;
if (PanelExtract.Visible=true)  and (PanelExtract.Top<10000) then drag_addtoextlayout;
if (PanelOpen.Visible=true)  and (PanelOpen.Top<10000) then
   begin
   {$IFDEF MSWINDOWS}
   lpPoint := Splitter1.ScreenToClient(Mouse.CursorPos);
   if (lpPoint.y>0) and (stringgridbookmarks.visible=true) then
      begin
      if stringgridbookmarks.visible=false then showbar('bookmarks');
      drag_addtobookmarks;
      exit;
      end;
   {$ENDIF}
   if High(FileNames)=0 then
      begin
      {$IFDEF DARWIN}
      if darwinsimulatedrop=true then
         begin
         condopenaction(FileNames[0]);
         exit;
         end;
      {$ENDIF}
      i:=testext(escapefilename(FileNames[0],desk_env));
      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 (GetKeyShiftState=[ssCtrl]) then pmsystoapp.popup()
            else
               begin
               showpanel('archive');
               Form_peach.CheckBoxSameArc.State:=cbUnchecked;
               Form_peach.CheckBoxSeparate.State:=cbUnchecked;
               drag_addtolayout(FileNames);
               setdragarchivename;
               end;
            end
         else
            drag_addtoarchive
      else
         if fun='FILEBROWSER' then
            begin
            if GetKeyShiftState=[ssCtrl] then pmsystoapp.popup()
            else
               if (testinput(escapefilename(FileNames[0],desk_env),true)>0) and (testinput(escapefilename(FileNames[0],desk_env),true)<>1000) then
                  open_archive_fromname(escapefilename(FileNames[0],desk_env))
               else
                  begin
                  showpanel('archive');
                  Form_peach.CheckBoxSameArc.State:=cbUnchecked;
                  Form_peach.CheckBoxSeparate.State:=cbUnchecked;
                  drag_addtolayout(FileNames);
                  setdragarchivename;
                  end;
            end
         else
            begin
            if (testinput(escapefilename(FileNames[0],desk_env),true)>0) and (testinput(escapefilename(FileNames[0],desk_env),true)<>1000) then
               case pMessageInfoYesNo(txt_dis+' '+txt_2_7_drag_archive) of //executed only when the form is visible
                  6: open_archive_fromname(escapefilename(FileNames[0],desk_env));
                  7: drag_addtoarchive;
               end
            else
               drag_addtoarchive;
            end;
      end
   else
      if fun='FILEBROWSER' then
         begin
         if GetKeyShiftState=[ssCtrl] then pmsystoapp.popup()
         else
            begin
            showpanel('archive');
            Form_peach.CheckBoxSameArc.State:=cbUnchecked;
            Form_peach.CheckBoxSeparate.State:=cbUnchecked;
            drag_addtolayout(FileNames);
            setdragarchivename;
            end;
         end
      else
         drag_addtoarchive;
   end;
end;

procedure TForm_peach.iConsoleCreateImport1Click(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
importjobcl_extract(cl,jobcode,outname);
end;

procedure TForm_peach.iConsoleCreateImportClick(Sender: TObject);
var
cl,jobcode,outname:ansistring;
begin
importjobcl(cl,jobcode,outname);
end;

function importjobcl_convert(var cl,jobcode,outname:ansistring):integer;
var
   clprog:ansistring;
   i:integer;
begin
result:=0;
jobcode:='';
outname:='';
clprog:='';
Form_peach.mConsoleCreate.Clear;
Form_peach.lConsoleCreate_jobcode.Caption:='';
Form_peach.lConsoleCreate_outname.Caption:='';
for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
   clprog:=clprog+stringdelim(escapefilename(Form_peach.StringGrid1.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;
Form_peach.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 Form_peach 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 Form_peach.CheckBoxDeleteInput1.Checked=true then
   begin
   if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletefilesconfirm)=6 then
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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;
   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 Form_peach.StringGrid1.Rowcount-1 do
         begin
         Form_peach.StringGrid1.Row:=i;
         Form_peach.StringGrid1.Cells[11,i]:='1';
         application.processmessages;
         sel:=inttostr(i);
         suggest_outname(s,Form_peach.cbType.Text,i);
         s:=extractfilename(s); //keep only filename, set path to last used
         Form_peach.Edit4.Text:=s;
         Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.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;
         Form_peach.StringGrid1.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+cl+char($0D)+char($0A);
   erase_fromarchiving(0,0,cl);
   clprog:=clprog+cl;
   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 Form_peach.CheckBoxDeleteInput1.Checked=true then
   begin
   if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletefilesconfirm)=6 then
      begin
      {$IFDEF MSWINDOWS}
      case Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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 Form_peach.cbdeleteinputmode1.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 importjobcl_extract(var cl,jobcode,outname:ansistring):integer;
var
   i,k:integer;
   clprog:ansistring;
begin
importjobcl_extract:=0;
with Form_peach do
begin
mConsoleCreate1.Clear;
lConsoleCreate_jobcode1.Caption:='';
lConsoleCreate_outname1.Caption:='';
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   begin
   clprog:='';
   k:=Form_peach.StringGrid2.RowCount;
   Form_peach.StringGrid2.Row:=1;
   Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='1';
   for i:=1 to k-1 do
      begin
      Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='0';
      end;
   Form_peach.StringGrid2.Repaint;
   for i:=1 to k-1 do
      begin
      if extract_finalize_bytype(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],'neutral',cl,jobcode,outname,extsel,false)<>0 then exit;
      fun:='FILEBROWSER';
      untarafter(outname,Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],cl,false,'');
      Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='0';
      if Form_peach.StringGrid2.Row<k then Form_peach.StringGrid2.Row:=Form_peach.StringGrid2.Row+1;
      Form_peach.StringGrid2.Cells[11,Form_peach.StringGrid2.Row]:='1';
      Form_peach.StringGrid2.Repaint;
      clprog:=clprog+cl+char($0D)+char($0A);
      end;
   cl:=clprog;
   if Form_peach.CheckBoxDeleteInput.Checked=true then
      if Form_peach.RadioGroupAction.ItemIndex<2 then
            if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletearchivesconfirm)=6 then
               begin
               {$IFDEF MSWINDOWS}
               case Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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;
   mConsoleCreate1.Clear;
   mConsoleCreate1.Append(cl);
   lConsoleCreate_jobcode1.Caption:=jobcode;
   lConsoleCreate_outname1.Caption:=outname;
   end
else
   begin
   if extract_finalize_bytype(Form_peach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,false)<>0 then exit;
   untarafter(outname,Form_peach.EditOpenIn.Text,cl,false,'');
   if Form_peach.CheckBoxDeleteInput.Checked=true then
      if Form_peach.RadioGroupAction.ItemIndex<2 then
            if pMessageWarningYesNo(txt_5_4_deleteoriginal+' '+txt_5_4_deletearchivesconfirm)=6 then
               begin
               {$IFDEF MSWINDOWS}
               case Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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 Form_peach.cbdeleteinputmode.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;
   mConsoleCreate1.Clear;
   mConsoleCreate1.Append(cl);
   lConsoleCreate_jobcode1.Caption:=jobcode;
   lConsoleCreate_outname1.Caption:=outname;
end;
end;
if cl<>'' then
   begin
   importjobcl_extract:=1;
   end;
end;

procedure save_pj(cl:ansistring);
begin
{$IFDEF MSWINDOWS}Form_Peach.SaveDialogPJ.DefaultExt:='.bat';{$ELSE}Form_Peach.SaveDialogPJ.DefaultExt:='.sh';{$ENDIF}
if not(DirectoryExists(confpath+'Scripts'+DirectorySeparator)) then mkdir(confpath+'Scripts'+DirectorySeparator);
Form_peach.SaveDialogPJ.InitialDir:=confpath+'Scripts'+DirectorySeparator;
if Form_peach.SaveDialogPJ.Execute then
   if Form_peach.SaveDialogPJ.FileName<>'' then
      begin
      assignfile(t,Form_peach.SaveDialogPJ.FileName);
      rewrite(t);
      if jobdefenc=1 then write_header(t);
      write(t,cl);
      closefile(t);
      end;
end;

procedure layout_savejob;
var
   cl,jobcode,outname:ansistring;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.Top=0{$ENDIF} then
begin
cl:=Form_peach.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:=Form_peach.mConsoleCreate1.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 TForm_peach.mJobClick(Sender: TObject);
begin
layout_savejob;
end;

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

{$IFDEF MSWINDOWS}
function tbh: integer;
var
  hTB: HWND;
  TBRect: TRect;
begin
hTB:= FindWindow('Shell_TrayWnd', '');
if hTB = 0 then
   Result := 0
else
   begin
   GetWindowRect(hTB, TBRect);
   Result := TBRect.Bottom - TBRect.Top;
   end;
end;
{$ENDIF}

procedure TForm_peach.moblClick(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;
Form_peach.Top:=Screen.Height-fh-tbh;
Form_peach.Left:=0;
{$ENDIF}
end;

procedure TForm_peach.mobrClick(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;
Form_peach.Top:=Screen.Height-fh-tbh;
Form_peach.Left:=Screen.Width-fw;
{$ENDIF}
end;

procedure TForm_peach.modefaultClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
movepform;
Form_peach.Top:=64;
Form_peach.Left:=64;
{$ENDIF}
end;

procedure TForm_peach.mobClick(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;
Form_peach.Top:=Screen.Height-fh-tbh;
Form_peach.Left:=0;
Form_peach.Width:=Screen.Width-fw+Form_peach.Width;
{$ENDIF}
end;

procedure TForm_peach.molClick(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;
Form_peach.Top:=0;
Form_peach.Left:=0;
Form_peach.Height:=Screen.Height-fh+Form_peach.Height-tbh;
{$ENDIF}
end;

procedure TForm_peach.morClick(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;
Form_peach.Top:=0;
Form_peach.Left:=Screen.Width-fw;
Form_peach.Height:=Screen.Height-fh+Form_peach.Height-tbh;
{$ENDIF}
end;

procedure TForm_peach.motClick(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;
Form_peach.Top:=0;
Form_peach.Left:=0;
Form_peach.Width:=Screen.Width-fw+Form_peach.Width;
{$ENDIF}
end;

procedure TForm_peach.motlClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
movepform;
Form_peach.Top:=0;
Form_peach.Left:=0;
{$ENDIF}
end;

procedure TForm_peach.motrClick(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;
Form_peach.Top:=0;
Form_peach.Left:=Screen.Width-fw;
{$ENDIF}
end;

procedure TForm_peach.mjob2Click(Sender: TObject);
begin
layout_savejob;
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);
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit];
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   P.Free;
   end;
until length(s)<3;
end;

procedure TForm_peach.Image7zPj1Click(Sender: TObject);
var
   s:ansistring;
begin
s:=mConsoleCreate.Text;
launchpjmulti(s);
end;

procedure TForm_peach.Image7zPj3Click(Sender: TObject);
var
   s:ansistring;
begin
s:=mConsoleCreate1.Text;
launchpjmulti(s);
end;

procedure TForm_peach.Image7zPjClick(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 peazipdoreset;
begin
defaultarchiveaction:=0;
form_peach.ComboBoxArchive7.ItemIndex:=0;
archive_type_select(STR_7Z);
archive_type_select(STR_ZIP);
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');
   assignfile(conf,GetTempDir+'peazip-reset.txt');
   rewrite(conf);
   writeln(conf,' ');
   CloseFile(conf);
   Form_peach.WindowState:=wsNormal;
   Form_peach.Left:=DLEFT;
   Form_peach.Top:=DTOP;
   Form_peach.Width:=DWIDTH;
   Form_peach.Height:=DHEIGTH;
   load_conf;
   end;
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;

procedure TForm_peach.ImageDefaults2Click(Sender: TObject);
begin
peazipreset;
end;

procedure TForm_peach.MenuItemToggleStatusClick(Sender: TObject);
begin
togglestatusbar;
popuptabmenu;
end;

procedure TForm_peach.menupwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TForm_peach.ImageListRootClick(Sender: TObject);
begin
popuptabmenu;
end;

procedure TForm_peach.mf4Click(Sender: TObject);
begin
popuptabmenu;
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(Form_peach.EditOpenIn.Text,true,false);
   statusr:='';
   addtohistory;
   addtosearchhistory;
   end;
end;

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

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

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

procedure TForm_peach.mctrlf3Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then launch_nrsearch;
end;

procedure TForm_peach.mctrlf8Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then jumpto('bookmark2');
end;

procedure TForm_peach.ImageListSearchClick(Sender: TObject);
var
   p:TPoint;
begin
case refreshstatus of
   0: begin
      p.x:=Panel8.Left+Panel8.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-Form_peach.PanelTabBar.height;
      p:=clienttoscreen(p);
      pmresetsearch.PopUp(p.x,p.y);
      end;
   //1 wait
   2: begin
      Form_peach.visible:=false;
      Form_peach.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 TForm_peach.ImagePasswordClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TForm_peach.ImageUn7zPjClick(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
cl:=mConsoleCreate1.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 TForm_peach.LabelDefaultColor1Click(Sender: TObject);
begin
color1:=color1d;
if openstarted=true then apply_theme;
end;

procedure TForm_peach.LabelDefaultColor2Click(Sender: TObject);
begin
color2:=color2d;
temperature:=0;
if openstarted=true then apply_theme;
saverestartclosepeaapp;
end;

procedure TForm_peach.LabelDefaultOpacityClick(Sender: TObject);
begin
SpinEdit1.Value:=opacityd;
SpinEdit1Change(sender);
end;

procedure TForm_peach.mAttributesClick(Sender: TObject);
begin
select_by('attributes','neutralsel');
end;

procedure TForm_peach.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';
{$IFNDEF MSWINDOWS}if sys7zlin=1 then cl:='7z b';{$ENDIF}
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 TForm_peach.mDateEOlderClick(Sender: TObject);
begin
select_by('dateolderequal','neutralsel');
end;

procedure TForm_peach.mDateEqualClick(Sender: TObject);
begin
select_by('dateequal','neutralsel');
end;

procedure TForm_peach.mDateERecentClick(Sender: TObject);
begin
select_by('daterecentequal','neutralsel');
end;

procedure TForm_peach.mDateOlderClick(Sender: TObject);
begin
select_by('dateolder','neutralsel');
end;

procedure TForm_peach.mDateRecentClick(Sender: TObject);
begin
select_by('daterecent','neutralsel');
end;

procedure TForm_peach.mDefaultsClick(Sender: TObject);
begin
showpanel('defaults');
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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if Form_peach.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:=Form_peach.EditOpenIn.Text;
      k:=0;
      setlength(scheduleclip,1);
      for i:=1 to Form_peach.StringGridList.RowCount-1 do
         begin
         if Form_peach.EditOpenIn.Text<>s1 then break;
         if Form_peach.StringGridList.Cells[16,i]='1' then
            begin
            if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
            for j:=0 to Form_peach.StringGridList.ColCount-1 do
               scheduleclip[k,j]:=Form_peach.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 (test_canbechanged(Form_peach.EditOpenIn.Text)=1) or (test_forcechanged(Form_peach.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(Form_peach.EditOpenIn.Text)) of
         '.RAR':
            if compose_rarspecfun_cl(cl,jobcode,outname,'d')=0 then
               if execute_cl(cl,'delete')=0 then reloadandbrowse
               else pMessageWarningOK(txt_add_error);
         else
            if compose_un7z_cl(cl,jobcode,outname,false,'delete','selected')=0 then
               if execute_cl(cl,'delete')=0 then reloadandbrowse
               else pMessageWarningOK(txt_add_error); //issue with some archives, starting with \\
         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;

procedure TForm_peach.ButtonDeleteClick(Sender: TObject);
begin
if fun='FILEBROWSER' then eraseselected_list(1)
else deleteselected_frombrowser;
end;

procedure TForm_peach.MenuItem1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then removeselected
else removeselected_ext;
end;

procedure TForm_peach.MenuItem3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then clearlist
else clearlist_ext;
end;

procedure TForm_peach.pmExplorepathClick(Sender: TObject);
var
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then sg:=StringGrid1
else sg:=StringGrid2;
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 TForm_peach.MenuItemERAssociatedClick(Sender: TObject);
begin
openwith_base('extandrun','associated');
end;

procedure TForm_peach.MenuItemERCustomClick(Sender: TObject);
begin
openwith_base('extandrun','custom');
end;

procedure TForm_peach.MenuItemERPeaZipClick(Sender: TObject);
begin
openwith_base('extandrun','peazip');
end;

procedure TForm_peach.MenuItemOpen_backClick(Sender: TObject);
begin
if StringGridSessionHistory.RowCount>2 then
   begin
   StringGridSessionHistory.Row:=StringGridSessionHistory.Row-1;
   browsehistory;
   end;
end;

{//unused: direct extraction superseded by full extraction
procedure extractdisplayed;
var
   cl,jobcode,outname:ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'neutral','displayed')=0 then launch_cl(cl,jobcode,outname);
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'neutral','displayed')=0 then launch_cl(cl,jobcode,outname);
end;

procedure extractselected;
var
   cl,jobcode,outname:ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if (fun='UNARC') then
   if compose_unarc_cl(cl,jobcode,outname,true,'neutral','selected')=0 then launch_cl(cl,jobcode,outname);
if (fun='UN7Z') then
   if compose_un7z_cl(cl,jobcode,outname,true,'neutral','selected')=0 then launch_cl(cl,jobcode,outname);
end;}

procedure context_extall;
begin
{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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 Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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 Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   list_toextractor('none','full');
   exit;
   end;
{$ENDIF}
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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 TForm_peach.pmextcontextallClick(Sender: TObject);
begin
context_extall;
end;

procedure TForm_peach.MenuItemOpen_ext_allClick(Sender: TObject);
begin
context_extall;
end;

procedure TForm_peach.pmqeallClick(Sender: TObject);
begin
context_extall;
end;

procedure TForm_peach.pmqedisplayedClick(Sender: TObject);
begin
context_extdisplayed;
end;

procedure TForm_peach.pmqeselectedClick(Sender: TObject);
begin
context_extselected;
end;

procedure TForm_peach.pmextcontextdisplayedClick(Sender: TObject);
begin
context_extdisplayed;
end;

procedure TForm_peach.pmextcontextselectedClick(Sender: TObject);
begin
context_extselected;
end;

procedure TForm_peach.MenuItemOpen_ext_displayedClick(Sender: TObject);
begin
context_extdisplayed;
end;

procedure TForm_peach.MenuItemOpen_ext_selectedClick(Sender: TObject);
begin
context_extselected;
end;

procedure extractdisplayedto;
var
   cl,jobcode,outname:ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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 TForm_peach.MenuItemOpen_FlatClick(Sender: TObject);
begin
toggle_view;
end;

procedure TForm_peach.MenuItemOpen_fwdClick(Sender: TObject);
begin
if StringGridSessionHistory.Row<StringGridSessionHistory.RowCount-1 then
   begin
   StringGridSessionHistory.Row:=StringGridSessionHistory.Row+1;
   browsehistory;
   end;
end;

procedure TForm_peach.MenuItemOpen_info_allClick(Sender: TObject);
begin
archive_funsel('info','all');
end;

procedure TForm_peach.MenuItemOpen_info_displayedClick(Sender: TObject);
begin
archive_funsel('info','displayed')
end;

procedure TForm_peach.MenuItemOpen_info_selectedClick(Sender: TObject);
begin
archive_funsel('info','selected')
end;

procedure TForm_peach.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;
   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 TForm_peach.MenuItemOpen_list_allClick(Sender: TObject);
begin
archive_funsel('list','all');
end;

procedure TForm_peach.MenuItemOpen_list_displayedClick(Sender: TObject);
begin
archive_funsel('list','displayed');
end;

procedure TForm_peach.MenuItemOpen_list_selectedClick(Sender: TObject);
begin
archive_funsel('list','selected');
end;

procedure TForm_peach.MenuItemOpen_rootClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
jumpto('root');
end;

procedure TForm_peach.MenuItemOpen_test_allClick(Sender: TObject);
begin
archive_funsel('test','all');
end;

procedure TForm_peach.MenuItemOpen_test_displayedClick(Sender: TObject);
begin
archive_funsel('test','displayed');
end;

procedure TForm_peach.MenuItemOpen_test_selectedClick(Sender: TObject);
begin
archive_funsel('test','selected');
end;

procedure TForm_peach.MenuItemOpen_upClick(Sender: TObject);
begin
navgoup;
end;

procedure TForm_peach.MenuItemPreAssociatedClick(Sender: TObject);
begin
openwith_base('preview','associated');
end;

procedure TForm_peach.MenuItemPreCustomClick(Sender: TObject);
begin
openwith_base('preview','custom');
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:ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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(Form_peach.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+Form_peach.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 Form_peach.StringGridList.RowCount-1 do
       if Form_peach.StringGridList.Cells[16,i]='1' then
          begin
          Form_peach.StringGridList.Row:=i;
          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+Form_peach.StringGridList.Cells[12,i];
                   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+Form_peach.StringGridList.Cells[12,i];
                   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;
   end;
end;

procedure openwith_base(act,target:ansistring);
//act preview, extandrun
//target peazip, associated, custom
var
   i:integer;
   cl,jobcode,outname,sel:ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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);
               '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);
               'associated': execute_obj(4,outname);
               'custom': openw_obj(outname);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   end
else
   begin
   sel:='single';
   for i:=1 to Form_peach.StringGridList.RowCount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         Form_peach.StringGridList.Row:=i;
         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);
                     '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);
                     'associated': execute_obj(4,outname);
                     'custom': openw_obj(outname);
                  end
               else
                  pMessageWarningOK(txt_extraction_error);
         end;
   end;
end;

procedure TForm_peach.MenuItemPrePeaZipClick(Sender: TObject);
begin
openwith_base('preview','peazip');
end;

procedure checkselected(oper:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
   i:integer;
   sg:TStringGrid;
begin
in_param:='';
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then sg:=Form_peach.StringGrid1
else sg:=Form_peach.StringGrid2;
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);
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure checkselected_list(oper:ansistring);
var
   cl,in_param:ansistring;
   P:tprocessutf8;
   i:integer;
begin
in_param:='';
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if fun<>'FILEBROWSER' then
   begin
   if checkfiledirname(Form_peach.EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.EditOpenIn.Text); exit; end;
   in_param:=stringdelim(escapefilename(Form_peach.EditOpenIn.Text,desk_env));
   check_files(in_param,cl,oper);
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   P.Free;
   exit;
   end;
if checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.Rowcount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
      in_param:=in_param+stringdelim(escapefilename(Form_peach.StringGridList.Cells[12,i],desk_env))+' ';
      end;
check_files(in_param,cl,oper);
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.pmmorecheckClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('check');
end;

procedure TForm_peach.po_analyzeClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('list');
end;

procedure TForm_peach.po_checkClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('check');
end;

procedure TForm_peach.pmmorehexClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
hexpselected_list;
end;

procedure TForm_peach.pmmorepreviewClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('preview');
end;

procedure TForm_peach.pmmoreanalysisClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('list');
end;

procedure TForm_peach.MenuItemToolCheckClick(Sender: TObject);
begin
checkselected('check');
end;

procedure TForm_peach.po_previewClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('preview');
end;

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

procedure compareselected_list;
var
   cl,bin_name,filea,fileb:ansistring;
   P:tprocessutf8;
begin
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]='' then exit;
if checklistsel<>0 then exit;
if checkfiledirname(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]); exit; end;
if Form_peach.OpenDialogArchive.Execute then
   if Form_peach.OpenDialogArchive.FileName<>'' then
      begin
      filea:=stringdelim(escapefilename(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row],desk_env));
      fileb:=stringdelim(escapefilename(Form_peach.OpenDialogArchive.Filename,desk_env));
      P:=tprocessutf8.Create(nil);
      bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      cl:=bin_name+' COMPARE '+filea+' '+fileb;
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P.Execute;
      P.Free;
      end;
end;

procedure TForm_peach.MenuItemToolCompareClick(Sender: TObject);
begin
compareselected;
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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}if Form_peach.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 Form_peach.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
   P:=tprocessutf8.Create(nil);
   bin_name:=stringdelim(escapefilename(executable_path,desk_env)+'pea'+EXEEXT);
   for i:=1 to Form_peach.StringGridList.Rowcount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         in_param:=in_param+stringdelim(escapefilename((Form_peach.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';
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   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 Form_peach.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 Form_peach.visible=true then
   if pMessageWarningYesNo(s+char($0D)+char($0A)+char($0D)+char($0A)+s_in)=6 then
   begin
   P:=tprocessutf8.Create(nil);
   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';
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole, poWaitOnExit];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
   cl:=bin_name+' WIPE '+eraselevel+' '+in_param;
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
if Form_peach.EditOpenIn.Text=txt_mypc then exit;
if Form_peach.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 Form_peach.StringGridList.Rowcount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         in_param:=escapefilename(Form_peach.StringGridList.Cells[12,i],desk_env);
         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 Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
if Form_peach.visible=true then
   begin
   for i:=1 to Form_peach.StringGridList.Rowcount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         in_param:=Form_peach.StringGridList.Cells[12,i];//in_param:=escapefilename(Form_peach.StringGridList.Cells[12,i],desk_env);
         mac_movetotrash(in_param);
         end;
   end;
{$ENDIF}
end;

procedure TForm_peach.pmsecuredeleteClick(Sender: TObject);
begin
if fun='FILEBROWSER' then eraseselected_list(1)
else
   begin
      erase_fromname_list(1,Form_peach.EditOpenIn.Text);
      browsefiledir(extractfilepath(Form_peach.EditOpenIn.Text));
   end;
end;

procedure TForm_peach.pmrecycleClick(Sender: TObject);
begin
if fun='FILEBROWSER' then recycleselected_list
else
   begin
   {$IFDEF MSWINDOWS}
   if Form_peach.visible=true then
      begin
      fileop_fromnamelist(Form_peach.EditOpenIn.Text,'',0,0);
      end;
   {$ENDIF}
   {$IFDEF DARWIN}
   if Form_peach.visible=true then
      begin
      mac_movetotrash(Form_peach.EditOpenIn.Text);
      end;
   {$ENDIF}
   end;
end;

procedure TForm_peach.pmrsearchClick(Sender: TObject);
begin
editun7zafilter.caption:='*';
launch_rsearch;
end;

procedure TForm_peach.pmr_addClick(Sender: TObject);
begin
rename_files('add');
end;

procedure TForm_peach.pmr_deleteClick(Sender: TObject);
begin
rename_files('delete');
end;

procedure TForm_peach.pmr_extClick(Sender: TObject);
begin
rename_files('extension');
end;

procedure TForm_peach.pmr_lowercaseClick(Sender: TObject);
begin
rename_files('lowercase');
end;

procedure TForm_peach.pmr_replacecaseClick(Sender: TObject);
begin
rename_files('replacecase');
end;

procedure TForm_peach.pmr_replaceClick(Sender: TObject);
begin
rename_files('replace');
end;

procedure TForm_peach.pmr_uppercaseClick(Sender: TObject);
begin
rename_files('uppercase');
end;

procedure TForm_peach.pmsearchdragClick(Sender: TObject);
begin
  cp_search(desk_env);
end;

procedure TForm_peach.pmsearchwebClick(Sender: TObject);
begin
  run_websearch(EditUn7zaFilter1.Caption);
end;

procedure TForm_peach.pmsecuredeletefreeClick(Sender: TObject);
begin
sanitizedisk(1);
end;

procedure TForm_peach.pmselectadvClick(Sender: TObject);
begin
advancedselect;
end;

procedure TForm_peach.pmtypeswapClick(Sender: TObject);
begin
if CheckBoxConvert.State=cbChecked then CheckBoxConvert.State:=cbUnchecked
else CheckBoxConvert.State:=cbChecked;
CheckBoxConvertChange(nil);
end;

procedure TForm_peach.pmshist1Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist1.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist2Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist2.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist3Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist3.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist4Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist4.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist5Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist5.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist6Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist6.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist7Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist7.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmshist8Click(Sender: TObject);
begin
editun7zafilter.caption:=pmshist8.Caption;
launch_rsearch;
end;

procedure TForm_peach.pmusedefaultClick(Sender: TObject);
begin
set_extout;
end;

procedure TForm_peach.mFlatClick(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 select_invert;
var
   i:integer;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then
   begin
   for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
      if Form_peach.StringGrid1.Cells[11,i]='0' then Form_peach.StringGrid1.Cells[11,i]:='1'
      else Form_peach.StringGrid1.Cells[11,i]:='0';
   Form_peach.StringGrid1.Repaint;
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
   begin
   for i:=1 to Form_peach.StringGrid2.Rowcount-1 do
      if Form_peach.StringGrid2.Cells[11,i]='0' then Form_peach.StringGrid2.Cells[11,i]:='1'
      else Form_peach.StringGrid2.Cells[11,i]:='0';
   Form_peach.StringGrid2.Repaint;
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   if Form_peach.ListView1.Visible=true then
      begin
      if Form_peach.StringGridList.Rowcount<2 then exit;
      if Form_peach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to Form_peach.StringGridList.Rowcount-1 do
         if Form_peach.StringGridList.Cells[16,i]='0' then Form_peach.StringGridList.Cells[16,i]:='1'
         else Form_peach.StringGridList.Cells[16,i]:='0';
      update_listview_sel;
      end;
end;

procedure TForm_peach.mInvertSelectionClick(Sender: TObject);
begin
select_invert;
end;

procedure TForm_peach.mKeyFileClick(Sender: TObject);
begin
get_fingerprint (fingerprint,false);
Whirl_Init(ment);
Whirl_Init(kent);
Whirl_Init(fent);
FormKF.Showmodal;
end;

procedure TForm_peach.mOptionsClick(Sender: TObject);
begin
showpanel('options');
end;

procedure TForm_peach.mPEAClick(Sender: TObject);
begin
do_add;
end;

procedure TForm_peach.mPSELargerClick(Sender: TObject);
begin
select_by('packedlargerequal','neutralsel');
end;

procedure TForm_peach.mPSEqualClick(Sender: TObject);
begin
select_by('packedequal','neutralsel');
end;

procedure TForm_peach.mPSESmallerClick(Sender: TObject);
begin
select_by('packedsmallerequal','neutralsel');
end;

procedure TForm_peach.mPSLargerClick(Sender: TObject);
begin
select_by('packedlarger','neutralsel');
end;

procedure TForm_peach.mPSSmallerClick(Sender: TObject);
begin
select_by('packedsmaller','neutralsel');
end;

procedure TForm_peach.mQuitClick(Sender: TObject);
begin
exit_withsave;
end;

procedure TForm_peach.mRecent1Click(Sender: TObject);
begin
open_archive_fromname(mRecent1.Caption);
end;

procedure TForm_peach.mRecent2Click(Sender: TObject);
begin
open_archive_fromname(mRecent2.Caption);
end;

procedure TForm_peach.mRecent3Click(Sender: TObject);
begin
open_archive_fromname(mRecent3.Caption);
end;

procedure TForm_peach.mRecent4Click(Sender: TObject);
begin
open_archive_fromname(mRecent4.Caption);
end;

procedure TForm_peach.mRecent5Click(Sender: TObject);
begin
open_archive_fromname(mRecent5.Caption);
end;

procedure TForm_peach.mRecent6Click(Sender: TObject);
begin
open_archive_fromname(mRecent6.Caption);
end;

procedure TForm_peach.mRecent7Click(Sender: TObject);
begin
open_archive_fromname(mRecent7.Caption);
end;

procedure TForm_peach.mRecent8Click(Sender: TObject);
begin
open_archive_fromname(mRecent8.Caption);
end;

procedure select_all(allnone:ansistring);
var
   i:integer;
begin
if (allnone<>'1') and (allnone<>'0') then exit;
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then
   begin
   if Form_peach.StringGrid1.Rowcount<2 then exit;
   for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
      Form_peach.StringGrid1.Cells[11,i]:=allnone;
   Form_peach.StringGrid1.Refresh;
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
   if Form_peach.StringGrid2.Visible=true then
      begin
      if Form_peach.StringGrid2.Rowcount<2 then exit;
      for i:=1 to Form_peach.StringGrid2.Rowcount-1 do
         Form_peach.StringGrid2.Cells[11,i]:=allnone;
      Form_peach.StringGrid2.Repaint;
      end;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   if Form_peach.ListView1.Visible=true then
      begin
      if Form_peach.StringGridList.Rowcount<2 then exit;
      if Form_peach.StringGridList.Cells[1,1]='' then exit;
      for i:=1 to Form_peach.StringGridList.Rowcount-1 do
         Form_peach.StringGridList.Cells[16,i]:=allnone;
      update_listview_sel;
      end;
end;

procedure TForm_peach.mSelectAllClick(Sender: TObject);
begin
select_all('1');
end;

procedure TForm_peach.mSizeELargerClick(Sender: TObject);
begin
select_by('sizelargerequal','neutralsel');
end;

procedure TForm_peach.mSizeEqualClick(Sender: TObject);
begin
select_by('sizeequal','neutralsel');
end;

procedure TForm_peach.mSizeESmallerClick(Sender: TObject);
begin
select_by('sizesmallerequal','neutralsel');
end;

procedure TForm_peach.mSizeLargerClick(Sender: TObject);
begin
select_by('sizelarger','neutralsel');
end;

procedure TForm_peach.mSizeSmallerClick(Sender: TObject);
begin
select_by('sizesmaller','neutralsel');
end;

procedure sort_az_stringgrid1(c:integer);
begin
Form_peach.StringGrid1.SortColRow(true,c);
az1:=true;
Form_peach.StringGrid1.Repaint;
end;

procedure sort_za_stringgrid1;
var
   i,rc:integer;
begin
Form_peach.StringGridTmp.ColCount:=Form_peach.StringGrid1.ColCount;
Form_peach.StringGridTmp.RowCount:=Form_peach.StringGrid1.RowCount;
rc:=Form_peach.StringGrid1.Rowcount;
for i:=1 to Form_peach.StringGrid1.Rowcount-1 do Form_peach.StringGridTmp.Rows[i]:=Form_peach.StringGrid1.Rows[rc-i];
for i:=1 to Form_peach.StringGrid1.Rowcount-1 do Form_peach.StringGrid1.Rows[i]:=Form_peach.StringGridTmp.Rows[i];
az1:=false;
Form_peach.StringGridTmp.Clear;
Form_peach.StringGrid1.Repaint;
end;

procedure sort_az_stringgrid2(c:integer);
begin
Form_peach.StringGrid2.SortColRow(true,c);
az2:=true;
Form_peach.StringGrid2.Repaint;
end;

procedure sort_za_stringgrid2;
var
   i,rc:integer;
begin
Form_peach.StringGridTmp.ColCount:=Form_peach.StringGrid2.ColCount;
Form_peach.StringGridTmp.RowCount:=Form_peach.StringGrid2.RowCount;
rc:=Form_peach.StringGrid2.Rowcount;
for i:=1 to Form_peach.StringGrid2.Rowcount-1 do Form_peach.StringGridTmp.Rows[i]:=Form_peach.StringGrid2.Rows[rc-i];
for i:=1 to Form_peach.StringGrid2.Rowcount-1 do Form_peach.StringGrid2.Rows[i]:=Form_peach.StringGridTmp.Rows[i];
az2:=false;
Form_peach.StringGridTmp.Clear;
Form_peach.StringGrid2.Repaint;
end;

procedure sort_az_stringgridbookmarks(c:integer);
begin
if c=7 then c:=10;
Form_peach.StringGridBookmarks.SortColRow(true,c);
azbook:=true;
Form_peach.StringGridBookmarks.Repaint;
end;

procedure sort_za_stringgridbookmarks;
var
   i,rc:integer;
begin
Form_peach.StringGridTmp.ColCount:=Form_peach.StringGridBookmarks.ColCount;
Form_peach.StringGridTmp.RowCount:=Form_peach.StringGridBookmarks.RowCount;
rc:=Form_peach.StringGridBookmarks.Rowcount;
for i:=1 to Form_peach.StringGridBookmarks.Rowcount-1 do Form_peach.StringGridTmp.Rows[i]:=Form_peach.StringGridBookmarks.Rows[rc-i];
for i:=1 to Form_peach.StringGridBookmarks.Rowcount-1 do Form_peach.StringGridBookmarks.Rows[i]:=Form_peach.StringGridTmp.Rows[i];
azbook:=false;
Form_peach.StringGridTmp.Clear;
Form_peach.StringGridBookmarks.Repaint;
end;

procedure updatelayout(enumdir:ansistring);
var
   i:integer;
   objectname:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then sg:=Form_peach.StringGrid1
else sg:=Form_peach.StringGrid2;
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 Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true)
else updatecontent_ext;
sg.Cursor:=crDefault;
end;

procedure TForm_peach.CheckBoxEnumdClick(Sender: TObject);
begin
if Form_peach.CheckBoxEnumd.State=cbChecked then enumd:=1 else enumd:=0;
updatelayout('');
end;

procedure TForm_peach.CheckBoxExcludeEFClick(Sender: TObject);
begin
on_CheckBoxExcludeEFClick;
end;

procedure TForm_peach.CheckBoxExtAndClick(Sender: TObject);
begin
on_CheckBoxExtAnd_click;
end;

procedure TForm_peach.CheckBoxExtrac32Click(Sender: TObject);
begin
on_CheckBoxExtrac32_click;
end;

procedure TForm_peach.CheckBoxFolder1Click(Sender: TObject);
begin
on_CheckBoxFolder1_click;
end;

procedure TForm_peach.CheckBoxForceBrowseClick(Sender: TObject);
begin
on_CheckBoxForceBrowseClick;
end;

procedure TForm_peach.CheckBoxForceConvertClick(Sender: TObject);
begin
on_CheckBoxForceConvertClick;
end;

procedure TForm_peach.CheckBoxForceEditClick(Sender: TObject);
begin
on_CheckBoxForceEditClick;
end;

procedure TForm_peach.CheckBoxForceLayoutClick(Sender: TObject);
begin
on_CheckBoxForceLayoutClick;
if (Form_peach.Visible=true) and (forcelayout=1) then
   if Form_peach.LabelForceLayout.Caption='' then
      begin
      plistfile:='';
      loadlist(nil,'');
      Form_peach.LabelForceLayout.Caption:=plistfile;
      end;
end;

procedure TForm_peach.CheckBoxForceOpenClick(Sender: TObject);
begin
on_checkboxforceopenclick;
end;

procedure TForm_peach.CheckBoxIntDirClick(Sender: TObject);
begin
on_CheckBoxIntDir_click;
end;

procedure TForm_peach.MenuItemEnumerateClick(Sender: TObject);
begin
updatelayout('enum');
end;

procedure TForm_peach.MenuItemRefreshClick(Sender: TObject);
begin
updatelayout('');
end;

procedure TForm_peach.mf3Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then launch_rsearch
else cp_search(desk_env);
end;

procedure TForm_peach.mf4upClick(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 TForm_peach.mpeahelpofflineClick(Sender: TObject);
begin
cp_open(sharepath+'peazip_help.pdf',desk_env);
end;

procedure TForm_peach.mRecent9Click(Sender: TObject);
begin
showpanel('open');
if StringGridSessionHistory.visible=false then showbar('history');
navrefresh;
end;

procedure select_sortby;
var
   Column:integer;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then
   begin
   Column:=11;
   if Column=listsortcol1 then
      if az1=true then sort_za_stringgrid1
      else sort_az_stringgrid1(Column)
   else sort_az_stringgrid1(Column);
   listsortcol1:=Column;
   Form_peach.StringGrid1.Repaint;
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
   begin
   Column:=11;
   if Column=listsortcol2 then
      if az2=true then sort_za_stringgrid2
      else sort_az_stringgrid2(Column)
   else sort_az_stringgrid2(Column);
   listsortcol2:=Column;
   Form_peach.StringGrid2.Repaint;
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then
   if Form_peach.ListView1.Visible=true then
      begin
      Column:=16;
      if Column=listsortcol then
         if az=true then sort_za_stringgridlist(Column)
         else sort_az_stringgridlist(Column)
      else sort_az_stringgridlist(Column);
      listsortcol:=16;
      update_listview;
      if fun='UN7Z' then generate_archive_breadcrumb;
      end;
end;

procedure TForm_peach.mSortBySelectionClick(Sender: TObject);
begin
select_sortby;
end;

procedure advancedselect;
var
   cba,cbb:integer;
   sa,sb:ansistring;
begin
FormSelect.Showmodal;
cba:=FormSelect.ComboBox1.ItemIndex;
cbb:=FormSelect.ComboBox2.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.ComboBox1.ItemIndex:=cba;
   FormSelect.ComboBox2.ItemIndex:=cbb;
   end;
end;
end;

procedure TForm_peach.pmrselectClick(Sender: TObject);
begin
advancedselect;
end;

procedure TForm_peach.mTypeClick(Sender: TObject);
begin
select_by('ext','neutralsel');
end;

procedure peazip_browse;
var
   s:ansistring;
begin
fun:='FILEBROWSER';
fun_status:=fun;
if fileexists((Form_peach.EditOpenIn.Text)) then Form_peach.SelectDirectoryDialog1.InitialDir:=extractfilepath(Form_peach.EditOpenIn.Text)
else Form_peach.SelectDirectoryDialog1.InitialDir:=Form_peach.EditOpenIn.Text;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      Form_peach.EditOpenIn.Text:=Form_peach.SelectDirectoryDialog1.FileName
   else exit
else exit;
s:=Form_peach.EditOpenIn.Text;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
Form_peach.EditUn7zaFilter.Text:='*';
showpanel('open');
listdir(s,false,false);
addtohistory;
end;

procedure TForm_peach.mUnPEAbrowseClick(Sender: TObject); //custom version of openpath procedure, adding showpanel('open') in proper place
begin
peazip_browse;
end;

procedure TForm_peach.mUnPEAClick(Sender: TObject);
begin
open_archive;
end;

procedure open_associated;
var
   i:integer;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.top=0{$ENDIF} then sg:=Form_peach.StringGrid1
else sg:=Form_peach.StringGrid2;
i:=sg.Row;
if i>0 then cp_open(sg.Cells[8,i],desk_env);
end;

procedure TForm_peach.openwithassociatedClick(Sender: TObject);
begin
open_associated;
end;

procedure TForm_peach.openwithcustomClick(Sender: TObject);
var
   i:integer;
   wname:widestring;
   s:ansistring;
   sg:TStringGrid;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then sg:=Form_peach.StringGrid1
else sg:=Form_peach.StringGrid2;
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(Form_peach.handle,PWideChar('open'),PWideChar('RUNDLL32.EXE'),PWideChar('shell32.dll,OpenAs_RunDLL '+wname),PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.openwithpeazipClick(Sender: TObject);
var
   i,j:integer;
   P:tprocessutf8;
   sg:TStringGrid;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then sg:=StringGrid1
else sg:=StringGrid2;
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;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poWaitOnExit];{$ENDIF}
      P.CommandLine:=(stringdelim(escapefilename(executable_path,desk_env)+'peazip'+EXEEXT)+' -ext2open '+stringdelim(escapefilename(sg.Cells[8,i],desk_env)));
      if Form_peach.Visible=true then Application.ProcessMessages;
      cl:=P.CommandLine;
      if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
      P.Execute;
      P.Free;
      end;
   end;
end;

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

procedure TForm_peach.pcustom1Click(Sender: TObject);
begin
clickcustom(pcustom1.caption);
end;

procedure TForm_peach.pcustom2Click(Sender: TObject);
begin
clickcustom(pcustom2.caption);
end;

procedure TForm_peach.pcustom3Click(Sender: TObject);
begin
clickcustom(pcustom3.caption);
end;

procedure TForm_peach.pcustom4Click(Sender: TObject);
begin
clickcustom(pcustom4.caption);
end;

procedure TForm_peach.pcustom5Click(Sender: TObject);
begin
clickcustom(pcustom5.caption);
end;

procedure TForm_peach.pcustom6Click(Sender: TObject);
begin
clickcustom(pcustom6.caption);
end;

procedure TForm_peach.pcustom7Click(Sender: TObject);
begin
clickcustom(pcustom7.caption);
end;

procedure TForm_peach.pcustom8Click(Sender: TObject);
begin
clickcustom(pcustom8.caption);
end;

procedure TForm_peach.pmAddFileClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile
else addfile_ext;
end;

procedure TForm_peach.pmAddFolderClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfolder
else addfolder_ext;
end;

procedure TForm_peach.pmJump3Click(Sender: TObject);
begin
jumpto('home');
end;

procedure TForm_peach.pmJumpDocumentsClick(Sender: TObject);
begin
jumpto('usrdocuments');
end;

procedure TForm_peach.pmjumpdownloadsClick(Sender: TObject);
begin
jumpto('sysdownloads');
end;

procedure TForm_peach.pmjumplibrariesClick(Sender: TObject);
begin
jumpto('syslibraries');
end;

procedure TForm_peach.pmjumppubdocClick(Sender: TObject);
begin
jumpto('publicdocuments');
end;

procedure TForm_peach.pmjumppubhomeClick(Sender: TObject);
begin
jumpto('publichome');
end;

procedure TForm_peach.pmjumprecentClick(Sender: TObject);
begin
jumpto('sysrecent');
end;

procedure TForm_peach.pmjumpsearchClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TForm_peach.pmjumpsearchesClick(Sender: TObject);
begin
jumpto('syssearches');
end;

procedure TForm_peach.pmmorefun_infoClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('info')
else archive_funsel('info','all');
end;

procedure TForm_peach.pmmorefun_listClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if fun='FILEBROWSER' then filebrowser_funall('list')
else archive_funsel('list','all');
end;

procedure TForm_peach.pmJump2Click(Sender: TObject);
begin
jumpto('desktop');
end;

procedure TForm_peach.pmJumpArchiveClick(Sender: TObject);
begin
open_archive;
end;

procedure TForm_peach.pmJumpPathClick(Sender: TObject);
begin
openpath;
end;

procedure TForm_peach.pmLoadListClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then loadlist(StringGrid1,'')
else loadlist(StringGrid2,'');
end;

procedure display_cl(var cl,jobcode,outname:ansistring);
begin
with form_peach do
   begin
   mConsoleCreate1.Clear;
   mConsoleCreate1.Append(cl);
   lConsoleCreate_jobcode1.Caption:=jobcode;
   lConsoleCreate_outname1.Caption:=outname;
   end;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.pmSaveListClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then savelist(StringGrid1)
else savelist(StringGrid2);
end;

procedure TForm_peach.pmSearchAddClick(Sender: TObject);
begin
cp_search(desk_env);
end;

procedure TForm_peach.po_addtoarchiveClick(Sender: TObject);
begin
if fun='FILEBROWSER' then
   begin
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.State:=cbUnchecked;
   Form_peach.CheckBoxConvert0.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   end;
if Form_peach.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 TForm_peach.po_compareClick(Sender: TObject);
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
compareselected_list;
end;

procedure update_clipboard;
var
   i:integer;
begin
Form_peach.StringGridClipboard.Rowcount:=length(clipcontent)+1;
for i:=0 to length(clipcontent)-1 do
   begin
   Form_peach.StringGridClipboard.Cells[0,i+1]:=clipcontent[i,3];
   Form_peach.StringGridClipboard.Cells[1,i+1]:=clipcontent[i,1];
   Form_peach.StringGridClipboard.Cells[2,i+1]:=clipcontent[i,2];
   Form_peach.StringGridClipboard.Cells[3,i+1]:=clipcontent[i,0];
   Form_peach.StringGridClipboard.Cells[4,i+1]:=clipcontent[i,4];
   Form_peach.StringGridClipboard.Cells[5,i+1]:=clipcontent[i,5];
   Form_peach.StringGridClipboard.Cells[6,i+1]:=clipcontent[i,6];
   end;
Form_peach.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 Form_peach.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 Form_peach.StringGridList.RowCount-1 do
         if Form_peach.StringGridList.Cells[16,i]='1' then
            begin
            if clipmode=1 then
               if test_clip(Form_peach.StringGridList.Cells[12,i])=1 then
               else
                  begin
                  Form_peach.StringGridList.Cells[0,i]:='';
                  setlength(clipcontent,length(clipcontent)+1);
                  clipcontent[k,0]:=Form_peach.StringGridList.Cells[12,i];
                  clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
                  clipcontent[k,2]:=Form_peach.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]:=Form_peach.EditOpenIn.Caption
                  else clipcontent[k,4]:=txt_fs;
                  clipcontent[k,5]:=Form_peach.StringGridList.Cells[3,i];
                  clipcontent[k,6]:=Form_peach.StringGridList.Cells[5,i];
                  k:=k+1;
                  end
            else
               begin
               Form_peach.StringGridList.Cells[0,i]:='';
               setlength(clipcontent,length(clipcontent)+1);
               clipcontent[k,0]:=Form_peach.StringGridList.Cells[12,i];
               clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
               clipcontent[k,2]:=Form_peach.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]:=Form_peach.EditOpenIn.Caption
               else clipcontent[k,4]:=txt_fs;
               clipcontent[k,5]:=Form_peach.StringGridList.Cells[3,i];
               clipcontent[k,6]:=Form_peach.StringGridList.Cells[5,i];
               k:=k+1;
               end;
            end
         else Form_peach.StringGridList.Cells[0,i]:='';
      update_clipboard;
      update_listview_sel;
      end;
end;

procedure TForm_peach.po_copyClick(Sender: TObject);
begin
list_copy;
end;

procedure list_cut;
var
   i,k:integer;
begin
   if fun='FILEBROWSER' then
      begin
      {$IFDEF MSWINDOWS}if Form_peach.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 Form_peach.StringGridList.RowCount-1 do
         if Form_peach.StringGridList.Cells[16,i]='1' then
            begin
            if clipmode=1 then
               if test_clip(Form_peach.StringGridList.Cells[12,i])=1 then
               else
                  begin
                  Form_peach.StringGridList.Cells[0,i]:=' ';
                  setlength(clipcontent,length(clipcontent)+1);
                  clipcontent[k,0]:=Form_peach.StringGridList.Cells[12,i];
                  clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
                  clipcontent[k,2]:=Form_peach.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]:=Form_peach.EditOpenIn.Caption
                  else clipcontent[k,4]:=txt_fs;
                  clipcontent[k,5]:=Form_peach.StringGridList.Cells[3,i];
                  clipcontent[k,6]:=Form_peach.StringGridList.Cells[5,i];
                  k:=k+1;
                  end
            else
               begin
               Form_peach.StringGridList.Cells[0,i]:=' ';
               setlength(clipcontent,length(clipcontent)+1);
               clipcontent[k,0]:=Form_peach.StringGridList.Cells[12,i];
               clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
               clipcontent[k,2]:=Form_peach.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]:=Form_peach.EditOpenIn.Caption
               else clipcontent[k,4]:=txt_fs;
               clipcontent[k,5]:=Form_peach.StringGridList.Cells[3,i];
               clipcontent[k,6]:=Form_peach.StringGridList.Cells[5,i];
               k:=k+1;
               end;
            end
         else Form_peach.StringGridList.Cells[0,i]:='';
      update_clipboard;
      update_listview_sel;
      end;
end;

procedure TForm_peach.po_cutClick(Sender: TObject);
begin
list_cut;
end;

procedure TForm_peach.pmcutClick(Sender: TObject);
begin
list_cut;
end;

procedure TForm_peach.ButtonCopyClick(Sender: TObject);
begin
  list_copy;
end;

procedure TForm_peach.ButtonCutClick(Sender: TObject);
begin
  list_cut;
end;

procedure TForm_peach.ButtonDesk1Click(Sender: TObject);
begin
   if Form_peach.SelectDirectoryDialog1.Execute then
      if Form_peach.SelectDirectoryDialog1.FileName<>'' then local_desktop:=Form_peach.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 TForm_peach.po_defragClick(Sender: TObject);
begin
open_defrag;
end;

procedure TForm_peach.po_deleteClick(Sender: TObject);
begin
deleteselected_frombrowser;
end;

procedure TForm_peach.po_diskcleanClick(Sender: TObject);
begin
open_diskclean;
end;

procedure TForm_peach.po_exthereClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
if Form_peach.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 TForm_peach.po_infoClick(Sender: TObject);
begin
filebrowser_funall('info');
end;

procedure do_join;
var
   fname:ansistring;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Row=0 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklistsel<>0 then exit;
if checkfiledirname(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]); exit; end;
fname:=Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row];
direct_join(fname);
end;

procedure TForm_peach.po_joinClick(Sender: TObject);
begin
do_join;
end;

procedure TForm_peach.po_listClick(Sender: TObject);
begin
filebrowser_funall('list');
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 Form_peach do
begin
{$IFDEF MSWINDOWS}
if EditOpenIn.Text=txt_mypc then exit;
s:=txt_cnewfolder;
{$ELSE}
s:='Newfolder';
{$ENDIF}
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 Form_peach.StringGridList.RowCount-1 do
   if s=Form_peach.StringGridList.Cells[1,i] then exit;
if fun='UN7Z' then
   begin
   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(Form_peach.EditOpenIn.Text+s);
   ShellExecuteW(0, nil , PWideChar ('cmd'), PWideChar ('/c mkdir "'+w+'"'), PWideChar (''), SW_HIDE);
   {$ELSE}//system needs to support mkdir command
   P:=tprocessutf8.Create(nil);
   P.Options := [poWaitOnExit];
   cl:='mkdir '''+Form_peach.EditOpenIn.Text+s+'''';
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
   P.Execute;
   P.Free;
   {$ENDIF}
   end;
//navrefresh; //deactivated, refresh is now automatic
end;
end;

procedure TForm_peach.ImageFlatfolderClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TForm_peach.po_newfolderClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TForm_peach.pmnewfolderClick(Sender: TObject);
begin
createnewfolder;
end;

procedure TForm_peach.ButtonNFClick(Sender: TObject);
begin
createnewfolder;
end;

procedure menu_openwith(optype:ansistring);
var
   i:integer;
begin
with form_peach 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(Form_peach.EditOpenIn1.Caption);
      'associated': execute_obj(4,Form_peach.EditOpenIn1.Caption);
      end;
   exit;
   end;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      case optype of
      'custom': openw_obj(StringGridList.Cells[12,i]);
      'associated': execute_obj(4,Form_peach.StringGridList.Cells[12,i]);
      end;
end;
end;

procedure TForm_peach.po_open_associatedClick(Sender: TObject);
begin
menu_openwith('associated');
end;

procedure TForm_peach.po_open_customClick(Sender: TObject);
begin
menu_openwith('custom');
end;

procedure TForm_peach.ButtonOpenWithClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   openwith_base('preview','custom')
else
   menu_openwith('custom');
end;

procedure openwith_peazipnew(iscontext:integer; s:ansistring);
var
   i:integer;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.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,Form_peach.EditOpenIn1.Caption)
      else
         for i:=1 to Form_peach.StringGridList.RowCount-1 do
            if Form_peach.StringGridList.Cells[16,i]='1' then
               begin
               execute_obj(2,Form_peach.StringGridList.Cells[12,i]);
               end;
      end
   else
      execute_obj(2,extractfilepath(Form_peach.EditOpenIn1.Caption));
   end;
end;

procedure TForm_peach.po_open_peazipClick(Sender: TObject);
begin
openwith_peazipnew(1,'');
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 Form_peach.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
      Form_peach.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;
Form_peach.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:='';
      P:=tprocessutf8.Create(nil);
      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
      P.Options := [poWaitOnExit];
      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+clipcontent[i,1];
         if src=dest then
            if getnewdestname(dest)<>0 then
               begin
               filecopying:=false;
               exit_busy_status;
               exit;
               end;
         if directoryexists(dest) then
            if overall=true then
            else
                  case pMessageInfoAllYesNoCancel('"'+extractfilename(dest)+'" '+txt_overwrite) of
                     2: break;
                     6: cl:=opcommand+'-f '+stringdelim(src)+' '+stringdelim(dest);
                     7: cl:=opcommand+stringdelim(src)+' '+stringdelim(dest);
                     10: begin overall:=true; cl:=opcommand+'-f '+stringdelim(src)+' '+stringdelim(dest); end;
                     end;
         if cl='' then cl:=opcommand+'-f '+stringdelim(src)+' '+stringdelim(dest);
         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(src)+' '+stringdelim(destf);
                     7: continue;
                     10: begin overall:=true; cl:=opcommand+'-f '+stringdelim(src)+' '+stringdelim(destf); end;
                     end;
         if cl='' then cl:=opcommand+'-f '+stringdelim(src)+' '+stringdelim(destf);
         end;
      if cl='' then break;
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then
         begin
         pMessageWarningOK(txt_2_7_validatecl+' '+cl);
         exit_busy_status;
         filecopying:=false;
         exit;
         end;
      P.Execute;
      while P.Running do
         begin
         if Form_peach.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 TForm_peach.pms2a_addClick(Sender: TObject);
begin
showpanel('archive');
drag_addtolayout(dfilenames);
setdragarchivename;
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 directoryexists(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:=Form_peach.EditOpenOut.Text;
if j>0 then
   if clipcontent1[0,0]<>'' then cp_copy_filedir(clipcontent1,destdir);
end;

procedure TForm_peach.pms2a_copyClick(Sender: TObject);
begin
mass_cp_copy_toapp(txt_copy);
end;

procedure TForm_peach.pms2a_moveClick(Sender: TObject);
begin
mass_cp_copy_toapp(txt_cut);
end;

procedure TForm_peach.pms2a_openClick(Sender: TObject);
begin
open_archive_fromname(dfilenames[0]);
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:=Form_peach.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);
                  Form_peach.StringGridClipboard.Rowcount:=1;
                  Form_peach.StringGridClipboard.Autosizecolumns;
                  end;
      end;
end;

procedure TForm_peach.po_pasteClick(Sender: TObject);
begin
   if Form_peach.StringGridList.RowCount-1<length(clipcontent) then
      begin
      Form_peach.StringGridList.RowCount:=length(clipcontent)+1;
      end;
list_paste;
end;


procedure TForm_peach.ButtonPasteClick(Sender: TObject);
begin
     if Form_peach.StringGridList.RowCount-1<length(clipcontent) then
      begin
      Form_peach.StringGridList.RowCount:=length(clipcontent)+1;
      end;
list_paste;
end;

procedure clickcopyto;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
list_copy;
if Form_peach.StringGridClipboard.rowcount=1 then exit;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      listdir(Form_peach.SelectDirectoryDialog1.FileName,false,false);
      addtohistory;
      list_paste;
      end;
end;

procedure renamefileinarchive(nameold,namenew:ansistring; cleardestname:boolean);
var
   P:TProcessUTF8;
   cl,bin_name,fextl,pw,pw_option,pw2_option,out_param:ansistring;
begin
fextl:=upcase(extractfileext(Form_peach.EditOpenIn.Caption));
//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
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
if (fextl='.RAR') and (havewinrar=true) and (userar=1) then
   begin
   bin_name:=stringdelim(escapefilename(Form_peach.EditnameCustom.Text,desk_env))+' d -y';
   case Form_peach.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';
   {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z d -y -ssc';{$ENDIF}
   if stl7z=1 then bin_name:=bin_name+' -stl';
   case syntaxlevel7z of
   0: if ssp7z=1 then bin_name:=bin_name+' -ssp';
   end;
   end;

if (fextl='.RAR') and (havewinrar=true) and (userar=1) then
   begin
   //rar encryption
   if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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.EditUn7zaPW.Text;
         if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
               begin
               pMessageErrorOK(FormPW.EditName3.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;
   if pw<>'' then bin_name:=bin_name+' '+pw;
   end
else
   begin
   //encryption
   if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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;
   if pw_option<>'' then
      begin
      pw:=FormPW.EditUn7zaPW.Text;
      if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
         if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
            begin
            pMessageErrorOK(FormPW.EditName3.Text+' '+txt_keyfile_not_found);
            exit;
            end;
      if pw4cl('-p',pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         pforceconsole:=1;
         pw:='-p';
         end;
      end;
   if pw<>'' then
      begin
      bin_name:=bin_name+' '+pw;
      if pw2_option<>'' then bin_name:=bin_name+' '+pw2_option;
      end;
   end;
out_param:=Form_peach.EditOpenIn.Caption;
{$IFDEF MSWINDOWS}if forcecanbechanged=1 then if ExtractFileExt(out_param)='' then out_param:=out_param+'.';{$ENDIF}
cl:=bin_name+' -- '+stringdelim(out_param)+' '+stringdelim(namenew);
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
if length(namenew)>1 then
   if (namenew[1]+namenew[2]<>'\\') and (namenew[2]<>':') then P.Execute
   else
else P.Execute;
P.Free;
end;
//rename item from old name to new name
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit{$IFDEF MSWINDOWS}, poNoConsole{$ENDIF}];
if (fextl='.RAR') and (havewinrar=true) and (userar=1) then
   begin
   bin_name:=stringdelim(escapefilename(Form_peach.EditnameCustom.Text,desk_env))+' rn';
   case Form_peach.cbRARlastmodtime.ItemIndex of
      1: bin_name:=bin_name+' -tk';
      2: bin_name:=bin_name+' -tl';
      end;
   //rar encryption
   if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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.EditUn7zaPW.Text;
         if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
            if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
               begin
               pMessageErrorOK(FormPW.EditName3.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;
   if pw<>'' then bin_name:=bin_name+' '+pw;
   end
else
   begin
   bin_name:=stringdelim(escapefilename(binpath,desk_env)+'7z'+DirectorySeparator+alias7z+EXEEXT)+' rn';
   {$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z rn';{$ENDIF}
   if stl7z=1 then bin_name:=bin_name+' -stl';
   case syntaxlevel7z of
   0: if ssp7z=1 then bin_name:=bin_name+' -ssp';
   end;
   //encryption
   if (FormPW.EditUn7zaPW.Text<>'') or (FormPW.EditName3.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;
   if pw_option<>'' then
      begin
      pw:=FormPW.EditUn7zaPW.Text;
      if (disable_twofactor=false) and (FormPW.EditName3.Text<>'') then
         if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
            begin
            pMessageErrorOK(FormPW.EditName3.Text+' '+txt_keyfile_not_found);
            exit;
            end;
      if pw4cl('-p',pw)<>0 then
         begin
         msg_pw_errorchar(pw);
         pforceconsole:=1;
         pw:='-p';
         end;
      end;
   if pw<>'' then
      begin
      bin_name:=bin_name+' '+pw;
      if pw2_option<>'' then bin_name:=bin_name+' '+pw2_option;
      end;
   end;
out_param:=Form_peach.EditOpenIn.Caption;
{$IFDEF MSWINDOWS}if forcecanbechanged=1 then if ExtractFileExt(out_param)='' then out_param:=out_param+'.';{$ENDIF}
cl:=bin_name+' -- '+stringdelim(out_param)+' '+stringdelim(nameold)+' '+stringdelim(namenew);
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
if extractfilepath(namenew)<>'\\' then P.Execute;
P.Free;
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
   s:ansistring;
   rc,i,j:integer;
   namecollisionfound:boolean;
begin
if fun='FILEBROWSER' then
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
list_cut;
if Form_peach.StringGridClipboard.rowcount=1 then exit;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      listdir(Form_peach.SelectDirectoryDialog1.FileName,false,false);
      addtohistory;
      list_paste;
      end;
end;
if fun='UN7Z' then
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then exit;
s:=Form_peach.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:=Form_peach.StringGridList.RowCount;

namecollisionfound:=false;
for i:=1 to Form_peach.StringGridArchive.Rowcount-1 do
   for j:=1 to rc-1 do
      if Form_peach.StringGridList.Cells[16,j]='1' then
         if Form_peach.StringGridArchive.Cells[12,i]=s+Form_peach.StringGridList.Cells[1,j] then
            begin
            namecollisionfound:=true;
            break;
            end;
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then exit;

for i:=1 to rc-1 do
   begin
   if Form_peach.StringGridList.Cells[16,i]='1' then
      begin
      renamefileinarchive(Form_peach.StringGridList.Cells[12,i],s+Form_peach.StringGridList.Cells[1,i],true);
      Application.ProcessMessages;
      end;
   end;
reloadandbrowse;
end;
end;

procedure TForm_peach.pmcpytoClick(Sender: TObject);
begin
clickcopyto;
end;

procedure TForm_peach.pmmvtoClick(Sender: TObject);
begin
clickmoveto;
end;

procedure TForm_peach.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 quickextract(dest:ansistring);
var
   olddest:ansistring;
   tempextnew,tempextsmart,needresttemp:boolean;
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then
   {$IFDEF MSWINDOWS}if Form_peach.PanelExtract.visible=false{$ELSE}if Form_peach.PanelExtract.top<>0{$ENDIF} then exit;

{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then exit;
{$ENDIF}
if stayopen=true then
   begin
   if Form_peach.StringGridList.RowCount<2 then exit;
   if Form_peach.StringGridList.Cells[1,1]='' then exit;
   end;

{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then if checkextinput=false then exit;
olddest:=Form_peach.EditOpenOut.Text;

tempextnew:=Form_peach.pmqenewfolder.Checked;
tempextsmart:=Form_peach.pmqnointdir.Checked;
needresttemp:=false;

if dest='' then
   begin
   dest:='';
   needresttemp:=true;
   if Form_peach.pmqenewfolder.Checked=true then newextclick;
   if Form_peach.pmqnointdir.Checked=true then smartextclick;
   end;

if dest='*new' then
   begin
   dest:='';
   needresttemp:=true;
   if Form_peach.pmqenewfolder.Checked=false then newextclick;
   if Form_peach.pmqnointdir.Checked=true then smartextclick;
   end;

if dest='*smart' then
   begin
   dest:='';
   needresttemp:=true;
   if Form_peach.pmqenewfolder.Checked=false then newextclick;
   if Form_peach.pmqnointdir.Checked=false then smartextclick;
   end;

if dest='' then
   if (fun='FILEBROWSER') then Form_peach.EditOpenOut.Text:=Form_peach.EditOpenIn.Text
   else Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.EditOpenIn.Text)
else Form_peach.EditOpenOut.Text:=dest;
if Form_peach.EditOpenOut.Text<>'' then
   if Form_peach.EditOpenOut.Text[length(Form_peach.EditOpenOut.Text)] <> directoryseparator then Form_peach.EditOpenOut.Text:=Form_peach.EditOpenOut.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 Form_peach.PanelOpen.visible=true{$ELSE}if Form_peach.PanelOpen.top=0{$ENDIF} then list_toextractor('multi','quick')
   else
   begin
      {$IFDEF MSWINDOWS}if Form_peach.PanelExtract.visible=true{$ELSE}if Form_peach.PanelExtract.top=0{$ENDIF} then
         begin
         goextract;
         lastoutpath:=dest;
         Form_peach.EditOpenOut.Text:=olddest;
         exit;
         end;
   end;
   end
else
   list_toextractor('all','quick');

goextract;
lastoutpath:=dest;
Form_peach.EditOpenOut.Text:=olddest;

if needresttemp=true then
   begin
   if Form_peach.pmqenewfolder.Checked<>tempextnew then newextclick;
   if Form_peach.pmqnointdir.Checked<>tempextsmart  then smartextclick;
   end;

end;

procedure TForm_peach.pmqe1favClick(Sender: TObject);
begin
if (extractfilepath(pnb1.Caption)<>'') then quickextract(extractfilepath(pnb1.Caption));
end;

procedure TForm_peach.pmqe2favClick(Sender: TObject);
begin
if (extractfilepath(pnb2.Caption)<>'') then quickextract(extractfilepath(pnb2.Caption));
end;

procedure TForm_peach.pmqe3favClick(Sender: TObject);
begin
if (extractfilepath(pnb3.Caption)<>'') then quickextract(extractfilepath(pnb3.Caption));
end;

procedure TForm_peach.pmqedefaultClick(Sender: TObject);
begin
quickextract(defaultextractpath);
end;

procedure TForm_peach.pmqedeskClick(Sender: TObject);
begin
quickextract(local_desktop);
end;

procedure TForm_peach.pmqedocumentsClick(Sender: TObject);
begin
quickextract(usr_documents);
end;

procedure TForm_peach.pmqehereClick(Sender: TObject);
begin
quickextract('');
end;

procedure TForm_peach.pmqelastClick(Sender: TObject);
begin
quickextract(lastextractionpath);
end;

procedure TForm_peach.pmqen1Click(Sender: TObject);
begin
extopt7z:=0;
updateconf_modified;
end;

procedure TForm_peach.pmqen2Click(Sender: TObject);
begin
extopt7z:=1;
updateconf_modified;
end;

procedure TForm_peach.pmqen3Click(Sender: TObject);
begin
extopt7z:=2;
updateconf_modified;
end;

procedure TForm_peach.pmqen4Click(Sender: TObject);
begin
extopt7z:=3;
updateconf_modified;
end;

procedure TForm_peach.pmqen5Click(Sender: TObject);
begin
extopt7z:=4;
updateconf_modified;
end;

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

procedure TForm_peach.pmqenewfolderClick(Sender: TObject);
begin
newextclick;
end;

procedure TForm_peach.pmqenopathClick(Sender: TObject);
begin
if extaction7z=1 then extaction7z:=0
else extaction7z:=1;
updateconf_modified;
end;

procedure TForm_peach.pmqesetpwClick(Sender: TObject);
begin
ask_pwkeyfile;
end;

procedure TForm_peach.pmqetoClick(Sender: TObject);
begin
do_extallto;
end;

procedure TForm_peach.pmquickdeleteClick(Sender: TObject);
begin
if fun='FILEBROWSER' then deleteselected_frombrowser
else
   begin
   if pMessageWarningYesNo(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+Form_peach.EditOpenIn.Text)=6 then
      begin
      clearfile(Form_peach.EditOpenIn.Text);
      browsefiledir(extractfilepath(Form_peach.EditOpenIn.Text));
      end;
   end;
end;

procedure TForm_peach.po_copytoClick(Sender: TObject);
begin
clickcopyto;
end;

procedure TForm_peach.po_movetoClick(Sender: TObject);
begin
clickmoveto;
end;

procedure TForm_peach.po_mrtClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('mrt'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.po_msconfigClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('msconfig'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.po_msinfo32Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('msinfo32'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure do_openasarchive;
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if Form_peach.StringGridList.Cells[2,Form_peach.StringGridList.Row]=txt_list_isfolder then exit;
if checklistanysel<>0 then exit;
forceopenasarchive:=true;
open_archive_fromname(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
//forceopenasarchive:=false;
end;

procedure TForm_peach.po_open_asarchiveClick(Sender: TObject);
begin
do_openasarchive;
end;

procedure TForm_peach.po_open_asarchivetClick(Sender: TObject);
begin
do_openasarchive;
end;

procedure TForm_peach.po_open_associatedtClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   openwith_base('preview','associated')
else menu_openwith('associated');
end;

procedure TForm_peach.po_open_peaziptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
  openwith_base('preview','peazip')
else openwith_peazipnew(1,'');
end;

procedure TForm_peach.po_recycleClick(Sender: TObject);
begin
  recycleselected_list;
end;

procedure TForm_peach.po_regeditClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('regedit'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
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 (fun<>'FILEBROWSER') and (fun<>'UN7Z') then exit;
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if renselonly=1 then if checklisttotsel(nsel,strsel)<>0 then exit;
{$IFDEF MSWINDOWS}
s:=Form_peach.StringGridList.Cells[1,Form_peach.StringGridList.Row];
{$ELSE}
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   begin
   if Form_peach.StringGridList.Cells[16,i]='1' then s:=Form_peach.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 directoryexists(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]) then
   sextorig:=extractfileext(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]);
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:=Form_peach.EditOpenIn.Text;
s0:=s;
sextchanged:='';
if not directoryexists(Form_peach.StringGridList.Cells[12,Form_peach.StringGridList.Row]) then
   begin
   if sextorig<>extractfileext(s) then sextchanged:=extractfileext(s);
   cutextension(s0);
   end;
enter_busy_status;
rc:=Form_peach.StringGridList.RowCount;

namecollisionfound:=false;
if fun='UN7Z' then
   for i:=1 to Form_peach.StringGridArchive.Rowcount-1 do
     for j:=1 to rc-2 do
        if Form_peach.StringGridList.Cells[16,j]='1' then
            if Form_peach.StringGridArchive.Cells[12,i]=extractfilepath(Form_peach.StringGridList.Cells[12,j])+s then
               begin
               namecollisionfound:=true;
               break;
               end;
if namecollisionfound=true then
   if pMessageInfoYesNo(txt_6_9_overarch)=7 then exit;

for i:=1 to rc-1 do
   begin
   if (Form_peach.EditOpenIn.Text<>s1) or (endflag=true) then break;//break if no longer in the original directory
   if (Form_peach.StringGridList.Cells[16,i]='1') or (renselonly=0) then
      if (Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder) or (renfilesonly=0) then
      begin
      Form_peach.Caption:=txt_rename+' ('+inttostr(k+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...';
      if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin exit_busy_status; pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); navrefresh; exit; end;
      k:=k+1;
      sext:='';
      if not directoryexists(Form_peach.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(Form_peach.StringGridList.Cells[12,i]);
      if nsel>1 then s:=s0+NAMEVARSTR+numstr(k,nsel)+sext;
      if s<>Form_peach.StringGridList.Cells[1,i] then
         begin
         if fun='FILEBROWSER' then renamefile(Form_peach.StringGridList.Cells[12,i],extractfilepath(Form_peach.StringGridList.Cells[12,i])+s);
         if fun='UN7Z' then renamefileinarchive(Form_peach.StringGridList.Cells[12,i],extractfilepath(Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.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(Form_peach.StringGridList.Cells[12,Form_peach.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:=Form_peach.EditOpenIn.Text;
enter_busy_status;
k:=0;
rc:=Form_peach.StringGridList.RowCount;
for i:=1 to rc-1 do
   begin
   if (Form_peach.EditOpenIn.Text<>s1) or (endflag=true) then break;//break if no longer in the original directory
   if (Form_peach.StringGridList.Cells[16,i]='1') or (renselonly=0) then
      if (Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder) or (renfilesonly=0) then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then
         begin
         exit_busy_status;
         pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]);
         navrefresh;
         exit;
         end;
      if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then fmode:='folder'
      else fmode:='file';
      Form_peach.Caption:=txt_rename+' '+sti+' ('+inttostr(k+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...';
      if mode='uppercase' then
         s:=upcase(extractfilename(Form_peach.StringGridList.Cells[12,i]));
      if mode='lowercase' then
         s:=lowercase(extractfilename(Form_peach.StringGridList.Cells[12,i]));
      if mode='keepascii' then
         begin
         s:=extractfilename(Form_peach.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(Form_peach.StringGridList.Cells[12,i]);
         apply_timestamptoname(s,0,1,fmode);
         end;
      if mode='123' then
         begin s:=numstrext(i,rc-1)+' '+extractfilename(Form_peach.StringGridList.Cells[12,i]); end;
      if mode='dirappend' then
         begin
         s:=Form_peach.StringGridList.Cells[12,i];
         apply_dirnametoname(s,'append',fmode);
         end;
      if mode='dirprepend' then
         begin
         s:=Form_peach.StringGridList.Cells[12,i];
         apply_dirnametoname(s,'prepend',fmode);
         end;
      if mode='cutlen' then
         begin
         s:=extractfilename(Form_peach.StringGridList.Cells[12,i]);
         sext:='';
         if not directoryexists(Form_peach.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(Form_peach.StringGridList.Cells[12,i]);
         sext:='';
         if not directoryexists(Form_peach.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(Form_peach.StringGridList.Cells[12,i]);
         sext:='';
         if not directoryexists(Form_peach.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(Form_peach.StringGridList.Cells[12,i]);
         sext:='';
         if not directoryexists(Form_peach.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(Form_peach.StringGridList.Cells[12,i]);
         if not directoryexists(Form_peach.StringGridList.Cells[12,i]) then
            begin //it is a file
            cutextension(s);
            if snew<>'' then s:=s+'.'+snew;
            end;
         if s='' then s:=extractfilename(Form_peach.StringGridList.Cells[12,i]);
         end;
      //check if name is unique
      if Form_peach.StringGridList.Cells[12,i]<>(extractfilepath(Form_peach.StringGridList.Cells[12,i])+s) then
         begin
         {$IFDEF MSWINDOWS}if (mode<>'uppercase') and (mode<>'lowercase') then{$ENDIF}
         if (fileexists(extractfilepath(Form_peach.StringGridList.Cells[12,i])+s)) or (directoryexists(extractfilepath(Form_peach.StringGridList.Cells[12,i])+s)) then
            begin
            s:=extractfilepath(Form_peach.StringGridList.Cells[12,i])+s;
            get_new_archive_name(s);
            s:=extractfilename(s);
            end;
         k:=k+1;
         if fun='FILEBROWSER' then renamefile(Form_peach.StringGridList.Cells[12,i],extractfilepath(Form_peach.StringGridList.Cells[12,i])+s);
         if fun='UN7Z' then renamefileinarchive(Form_peach.StringGridList.Cells[12,i],extractfilepath(Form_peach.StringGridList.Cells[12,i])+s,true);
         end;
      Application.ProcessMessages;
      end;
   end;
exit_busy_status;
end;
if fun='UN7Z' then
   reloadandbrowse
else
   navrefresh;
end;

procedure TForm_peach.mf2Click(Sender: TObject);
begin
if {$IFDEF MSWINDOWS}PanelOpen.Visible=true{$ELSE}PanelOpen.Top<>10000{$ENDIF} then rename_files('rename');
end;

procedure TForm_peach.po_renameClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TForm_peach.ButtonRenameClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TForm_peach.pmrenameClick(Sender: TObject);
begin
rename_files('rename');
end;

procedure TForm_peach.po_securedeleteClick(Sender: TObject);
begin
eraseselected_list(1);
end;

procedure do_split;
begin
checkcontextadd;
Form_peach.cbType.ItemIndex:=10;
archive_type_select(txt_split);
end;

procedure TForm_peach.po_splitClick(Sender: TObject);
begin
do_split;
end;

procedure TForm_peach.po_testClick(Sender: TObject);
begin
filebrowser_funall('test');
end;

procedure TForm_peach.po_zerofileClick(Sender: TObject);
begin
eraseselected_list(2);
end;

procedure TForm_peach.po_zerofreeClick(Sender: TObject);
begin
sanitizedisk(2);
end;

procedure TForm_peach.RadioGroup0Change(Sender: TObject);
begin
on_RadioGroup0Change;
end;

procedure TForm_peach.cbExtEvForHowChange(Sender: TObject);
begin
on_cbExtEvForHowChange;
end;

procedure TForm_peach.cbExtEvForWhenChange(Sender: TObject);
begin
on_cbExtEvForWhenChange;
end;

procedure TForm_peach.cbforcetypeChange(Sender: TObject);
begin
on_cbforcetypeChange;
end;

procedure TForm_peach.RadioGroup1Change(Sender: TObject);
begin
on_RadioGroup1Click;
end;

procedure TForm_peach.RadioGroup2Change(Sender: TObject);
begin
on_RadioGroup2Click;
end;

procedure TForm_peach.RadioGroup4Change(Sender: TObject);
begin
on_RadioGroup4Change;
end;

procedure TForm_peach.RadioGroup6Change(Sender: TObject);
begin
on_RadioGroup6Change;
end;

procedure TForm_peach.RadioGroupAction1Change(Sender: TObject);
begin
on_RadioGroupAction1Change;
end;

procedure TForm_peach.RadioGroupActionArcChange(Sender: TObject);
begin
on_RadioGroupActionArcChange;
end;

procedure TForm_peach.RadioGroupActionChange(Sender: TObject);
begin
on_radiogroupactionchange;
end;

procedure TForm_peach.RadioGroupBrowserChange(Sender: TObject);
begin
on_RadioGroupBrowserChange;
end;

procedure TForm_peach.RadioGroupPaqClick(Sender: TObject);
begin
on_RadioGroupPaqClick;
end;

procedure TForm_peach.RadioGrouppwrequestChange(Sender: TObject);
begin
on_RadioGrouppwrequestChange;
end;

procedure TForm_peach.RadioGroupQuadClick(Sender: TObject);
begin
on_RadioGroupQuadClick;
end;

procedure TForm_peach.RadioGroupTSChange(Sender: TObject);
begin
on_RadioGroupTSClick;
end;

procedure TForm_peach.schedaddschedule1Change(Sender: TObject);
begin
Dateedit3.Date:=Now;
panelHDW1.visible:=false;
panelweekly1.visible:=false;
panelmonthly1.visible:=false;
lsa6.Visible:=true;
schedulehh1.Visible:=true;
schedulemm1.Visible:=true;
schedulenn1.value:=1;
Bschedule1.Enabled:=true;
case schedaddschedule1.itemindex of
   0: //hourly
   begin
   panelHDW1.visible:=true;
   LabelEveryUnit1.Caption:=txt_5_1_hours;
   schedulenn1.maxvalue:=24;
   end;
   1: //daily
   begin
   panelHDW1.visible:=true;
   LabelEveryUnit1.Caption:=txt_5_1_days;
   schedulenn1.maxvalue:=365;
   end;
   2: //weekly
   begin
   panelHDW1.visible:=true;
   panelweekly1.visible:=true;
   LabelEveryUnit1.Caption:=txt_5_1_weeks;
   schedulenn1.maxvalue:=52;
   checkwsched1;
   end;
   3: //monthly
   begin
   panelmonthly1.visible:=true;
   checkmsched1;
   end;
   4: //once
   begin
   end;
   else //on start, on login
   begin
   lsa6.Visible:=false;
   schedulehh1.Visible:=false;
   schedulemm1.Visible:=false;
   end;
   end;
end;

procedure TForm_peach.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 TForm_peach.scheduleend1Change(Sender: TObject);
begin
DateEdit4.Enabled:=scheduleend1.Checked;
end;

procedure TForm_peach.scheduleendChange(Sender: TObject);
begin
DateEdit2.Enabled:=scheduleend.Checked;
end;

procedure TForm_peach.schedulestart1Change(Sender: TObject);
begin
DateEdit3.Enabled:=schedulestart1.Checked;
end;

procedure TForm_peach.schedulestartChange(Sender: TObject);
begin
DateEdit1.Enabled:=schedulestart.Checked;
end;

procedure TForm_peach.scheduleuser1Change(Sender: TObject);
begin
Editscheduleuser1.Enabled:=scheduleuser1.Checked;
Editschedulepassword1.Enabled:=scheduleuser1.Checked;
end;

procedure TForm_peach.scheduleuserChange(Sender: TObject);
begin
Editscheduleuser.Enabled:=scheduleuser.Checked;
Editschedulepassword.Enabled:=scheduleuser.Checked;
end;

procedure TForm_peach.ShellTreeView1CustomDraw(Sender: TCustomTreeView;
  const ARect: TRect; var DefaultDraw: Boolean);
begin
  imgshelltree;
end;

procedure TForm_peach.ShellTreeView1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  fromtree:=true;
end;

procedure TForm_peach.ShellTreeView1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  fromtree:=true;
end;

procedure TForm_peach.ShellTreeView1MouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
begin
  ShellTreeView1.ShowButtons:=true;
end;

procedure TForm_peach.ShellTreeView1MouseUp(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
   s:ansistring;
begin
if fromtree=true then
   begin
   s:=ShellTreeView1.Path;
   if s='' then exit;
   fun:='FILEBROWSER';
   fun_status:=fun;
   Form_peach.EditUn7zaFilter.Text:='*';
   listdir(s,false,true);
   addtohistory;
   end;
end;

procedure TForm_peach.SpinEdit1Change(Sender: TObject);
begin
spinchanged:=true;
opacity:=SpinEdit1.Value;
setwindowsopacity;
end;

procedure TForm_peach.Splitter1Moved(Sender: TObject);
begin
splittersize:=PanelFilters.Height-splitter1.top;
end;

procedure TForm_peach.Splitter2Moved(Sender: TObject);
begin
splitter2size:=splitter2.left;
end;

procedure TForm_peach.Splitter3Moved(Sender: TObject);
begin
splitter3size:=splitter3.left;
end;

procedure TForm_peach.StringGrid1DblClick(Sender: TObject);
begin
if currow1=0 then
else open_associated;
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;

procedure TForm_peach.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
  aRect: TRect; aState: TGridDrawState);
var
   rowcol:TColor;
begin
if (arow and 1)=0 then rowcol:=StringGrid1.Color
else rowcol:=StringGrid1.AlternateColor;
if (gdFixed in aState) then
   begin
   //if aCol=0 then StringGrid1.Canvas.Draw(StringGrid1.CellRect(0,arow).Left+2,StringGrid1.CellRect(0,arow).Top+1,Brefresh_up);
   exit;
   end;
if aCol=0 then drawcellicon(StringGrid1,arow);

{$IFDEF MSWINDOWS}
if aCol=9 then StringGrid1.Canvas.Font.Color := rowcol;
if aCol=10 then StringGrid1.Canvas.Font.Color := rowcol;
if aCol=11 then StringGrid1.Canvas.Font.Color := rowcol;
{$ENDIF}
end;

procedure TForm_peach.StringGrid1HeaderClick(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
var
   Column:integer;
begin
if StringGrid1.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 az1=true then sort_za_stringgrid1
      else sort_az_stringgrid1(Column)
   else sort_az_stringgrid1(Column);
   listsortcol1:=Column;
   Form_peach.StringGrid1.Repaint;
end;

procedure TForm_peach.StringGrid1HeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGrid1.ColWidths[0]:=rowsize;
end;

procedure TForm_peach.StringGrid1KeyDown(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,Form_peach.StringGrid1.RowCount-1);
   for i:=1 to Form_peach.StringGrid1.RowCount-1 do
      for j:=0 to StringGrid1.ColCount-1 do patchclip[i-1,j]:=StringGrid1.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,Form_peach.StringGrid1.RowCount-1);
   for i:=1 to Form_peach.StringGrid1.RowCount-1 do
      for j:=0 to StringGrid1.ColCount-1 do patchclip[i-1,j]:=StringGrid1.Cells[j,i];
   Form_peach.StringGrid1.RowCount:=2048;
   Form_peach.StringGrid1.AutoSizeColumns;
   Form_peach.StringGrid1.ColWidths[0]:=rowsize;
   Form_peach.StringGrid1.ColWidths[1]:=COL1D;
   Form_peach.StringGrid1.ColWidths[9]:=0;
   Form_peach.StringGrid1.ColWidths[10]:=0;
   Form_peach.StringGrid1.ColWidths[11]:=0;
   Form_peach.StringGrid1.ColWidths[12]:=0;
   Form_peach.StringGrid1.colwidths[13]:=0;
   Form_peach.StringGrid1.colwidths[14]:=8;
   end;
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 TForm_peach.StringGrid1KeyPress(Sender: TObject; var Key: char);
var
   i:integer;
begin
//patch for Ctrl+X behaviour
if Key=char(24) then
   patch_stringgrid(StringGrid1);

//patch Ctrl+V
if Key=char(22) then
   begin
   StringGrid1.RowCount:=length(patchclip)+1;
   patch_stringgrid(StringGrid1);
   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:=StringGrid1.Row+1 to StringGrid1.Rowcount-1 do
   if upcase(copy(StringGrid1.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGrid1.Row:=i;
      exit;
      end;
for i:=1 to StringGrid1.Row do
   if upcase(copy(StringGrid1.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGrid1.Row:=i;
      exit;
      end;
end;

procedure TForm_peach.StringGrid1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if Key=46 then //Cancel
   if shift=[] then removeselected;
end;

procedure TForm_peach.StringGrid1MouseDown(Sender: TOBject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  Column, Row,i: Integer;
begin
hide_panelhintadd;
if StringGrid1.RowCount=1 then exit;
StringGrid1.MouseToCell(X, Y, Column, Row);
currow1:=Row;
case Button of
   mbRight:
      begin
      Form_peach.StringGrid1.Row:=Row;
      if Form_peach.StringGrid1.Cells[11,Row]='0' then
         begin
         for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
            Form_peach.StringGrid1.Cells[11,i]:='0';
         Form_peach.StringGrid1.Cells[11,Row]:='1';
         Form_peach.StringGrid1.Repaint;
         end;
      exit;
      end;
   end;
end;

procedure TForm_peach.StringGrid1MouseUp(Sender: TOBject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   i,Column,Row:integer;
begin
if StringGrid1.Rowcount<2 then exit;
StringGrid1.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:=Form_peach.StringGrid1.Selection.Top to Form_peach.StringGrid1.Selection.Bottom do
               if Form_peach.StringGrid1.Cells[11,i]='1' then Form_peach.StringGrid1.Cells[11,i]:='0'
               else Form_peach.StringGrid1.Cells[11,i]:='1'
         else
            begin
            for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
               Form_peach.StringGrid1.Cells[11,i]:='0';
            for i:=Form_peach.StringGrid1.Selection.Top to Form_peach.StringGrid1.Selection.Bottom do
               Form_peach.StringGrid1.Cells[11,i]:='1';
            end;
         Form_peach.StringGrid1.Repaint;
      end;
   end;
end;

procedure TForm_peach.StringGrid2DblClick(Sender: TObject);
begin
if currow1=0 then
else
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then open_associated;
end;

procedure TForm_peach.StringGrid2DrawCell(Sender: TObject; aCol, aRow: Integer;
  aRect: TRect; aState: TGridDrawState);
var
   rowcol:TColor;
begin
if (arow and 1)=0 then rowcol:=StringGrid2.Color
else rowcol:=StringGrid2.AlternateColor;
if (gdFixed in aState) then
   begin
   //if aCol=0 then StringGrid2.Canvas.Draw(StringGrid2.CellRect(0,arow).Left+2,StringGrid2.CellRect(0,arow).Top+1,Brefresh_up);
   exit;
   end;
if aCol=0 then drawcellicon(StringGrid2,arow);
{$IFDEF MSWINDOWS}
if aCol=9 then StringGrid2.Canvas.Font.Color := rowcol;
if aCol=10 then StringGrid2.Canvas.Font.Color := rowcol;
if aCol=11 then StringGrid2.Canvas.Font.Color := rowcol;
{$ENDIF}
end;

procedure TForm_peach.StringGrid2HeaderClick(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
var
   Column:integer;
begin
if StringGrid2.Rowcount<2 then exit;
Column:=Index;
if (Column=0) then //force MenuItemRefresh of layout content (update number of files, folders and total size)
   if Form_peach.labelstatus2.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 az2=true then sort_za_stringgrid2
   else sort_az_stringgrid2(Column)
else sort_az_stringgrid2(Column);
listsortcol2:=Column;
Form_peach.StringGrid2.Repaint;
end;

procedure TForm_peach.StringGrid2HeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGrid2.ColWidths[0]:=rowsize;
end;

procedure TForm_peach.StringGrid2KeyDown(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,Form_peach.StringGrid2.RowCount-1);
   for i:=1 to Form_peach.StringGrid2.RowCount-1 do
      for j:=0 to StringGrid2.ColCount-1 do patchclip[i-1,j]:=StringGrid2.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,Form_peach.StringGrid2.RowCount-1);
   for i:=1 to Form_peach.StringGrid2.RowCount-1 do
      for j:=0 to StringGrid2.ColCount-1 do patchclip[i-1,j]:=StringGrid2.Cells[j,i];
   Form_peach.StringGrid2.RowCount:=2048;
   autosize_stringgrid2;
   end;

end;

procedure TForm_peach.StringGrid2KeyPress(Sender: TObject; var Key: char);
var
   i:integer;
begin
//patch for Ctrl+X behaviour
if Key=char(24) then
   patch_stringgrid(StringGrid2);

//patch Ctrl+V
if Key=char(22) then
   begin
   StringGrid2.RowCount:=length(patchclip)+1;
   patch_stringgrid(StringGrid2);
   end;

if Key=char(127) then
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then removeselected_ext;//ctrl+backspace

if Key=char(13) then
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then open_associated;//enter

if key='?' then
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then checkselected('check');//checksum/hash selected
if key='=' then
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then compareselected;//compare selected

for i:=StringGrid2.Row+1 to StringGrid2.Rowcount-1 do
   if upcase(copy(StringGrid2.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGrid2.Row:=i;
      exit;
      end;
for i:=1 to StringGrid2.Row do
   if upcase(copy(StringGrid2.Cells[1,i],1,1))=upcase(Key) then
      begin
      StringGrid2.Row:=i;
      exit;
      end;
end;

procedure TForm_peach.StringGrid2KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if Key=46 then //Cancel
   if shift=[] then
      if Form_peach.labelstatus2.Caption= txt_2_7_ext then removeselected_ext;
end;

procedure TForm_peach.StringGrid2MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  Column, Row,i: Integer;
begin
hide_panelhintextract;
if StringGrid2.RowCount=1 then exit;
StringGrid2.MouseToCell(X, Y, Column, Row);
currow1:=Row;
case Button of
   mbRight:
      begin
      Form_peach.StringGrid2.Row:=Row;
      if Form_peach.StringGrid2.Cells[11,Row]='0' then
         begin
         for i:=1 to Form_peach.StringGrid2.Rowcount-1 do
            Form_peach.StringGrid2.Cells[11,i]:='0';
         Form_peach.StringGrid2.Cells[11,Row]:='1';
         Form_peach.StringGrid2.Repaint;
         end;
      exit;
      end;
   end;
end;

procedure TForm_peach.StringGrid2MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
   i,Column,Row:integer;
begin
if StringGrid2.Rowcount<2 then exit;
StringGrid2.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:=Form_peach.StringGrid2.Selection.Top to Form_peach.StringGrid2.Selection.Bottom do
               if Form_peach.StringGrid2.Cells[11,i]='1' then Form_peach.StringGrid2.Cells[11,i]:='0'
               else Form_peach.StringGrid2.Cells[11,i]:='1'
         else
            begin
            for i:=1 to Form_peach.StringGrid2.Rowcount-1 do
               Form_peach.StringGrid2.Cells[11,i]:='0';
            for i:=Form_peach.StringGrid2.Selection.Top to Form_peach.StringGrid2.Selection.Bottom do
               Form_peach.StringGrid2.Cells[11,i]:='1';
            end;
         Form_peach.StringGrid2.Repaint;

      end;
   end;
end;

procedure TForm_peach.StringGridBookmarksColRowMoved(Sender: TObject;
  IsColumn: Boolean; sIndex, tIndex: Integer);
begin
populatebookmarks;
end;

procedure TForm_peach.StringGridBookmarksDblClick(Sender: TObject);
begin
if StringGridBookmarks.Rowcount<2 then exit;
browsebookmark(StringGridBookmarks.Row);
end;

procedure drawbarcellicon(sg:tstringgrid; arow:integer);
var
   s,s1,fulltype:ansistring;
   l,t,i,cellfilter:integer;
begin
if sg.RowCount<2 then exit;
if arow>=sg.rowcount then exit;
if sg=Form_peach.StringGridBookmarks then cellfilter:=4
else cellfilter:=3;
l:=sg.CellRect(0,arow).Left+intcellhw;
t:=sg.CellRect(0,arow).Top+intcellhw;
if sg=Form_peach.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<>Form_peach.stringgridrecent then
   begin
   if sg.Cells[1,arow] = txt_list_found then
      begin
      sg.Canvas.Draw(l,t,Bsearch);
      exit;
      end;
   if sg.Cells[1,arow] = txt_list_flat then
      begin
      sg.Canvas.Draw(l,t,Bexpand);
      exit;
      end;
   s1:=sg.Cells[cellfilter,arow];
   if s1<>'' then
      s1:=s1[length(s1)];
   if s1<>'*' then
      begin
      sg.Canvas.Draw(l,t,Bgopath);
      exit;
      end;
   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_myboxfiles) or (s = shared_googledrive)
   or (s = shared_onedrive) or (s = shared_skydrive) or (s = shared_ubuntuone)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;

procedure TForm_peach.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 TForm_peach.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 azbook=true then begin if pMessageInfoYesNo(txt_3_7_sort+' > '+Form_peach.StringGridBookmarks.Cells[Column,0])<>6 then exit; end
   else begin if pMessageInfoYesNo(txt_3_7_sort+' < '+Form_peach.StringGridBookmarks.Cells[Column,0])<>6 then exit; end
else begin if pMessageInfoYesNo(txt_3_7_sort+' < '+Form_peach.StringGridBookmarks.Cells[Column,0])<>6 then exit; end;
if Column=listsortbook then
   if azbook=true then sort_za_stringgridbookmarks
   else sort_az_stringgridbookmarks(Column)
else 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 TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.StringGridClipboardDblClick(Sender: TObject);
begin
if StringGridClipboard.Row>0 then cp_open(StringGridClipboard.Cells[3,StringGridClipboard.Row],desk_env);
end;

procedure TForm_peach.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 Timer1
      begin
      clear_clipboard;
      end;
end;

procedure TForm_peach.StringGridCustEdit1ColRowMoved(Sender: TObject;
  IsColumn: Boolean; sIndex, tIndex: Integer);
var
   i:integer;
begin
for i:=1 to 8 do StringGridCustedit1.Cells[0,i]:=inttostr(i);
end;

procedure TForm_peach.StringGridCustEdit1DblClick(Sender: TObject);
begin
case StringGridCustedit1.Col of
   1: setdescription_advcustedit;
   2: editstring1_advcustedit;
   3: editstring2_advcustedit;
   4: editstring3_advcustedit;
   end;
end;

procedure TForm_peach.StringGridCustEdit1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
   Column,Row:integer;
begin
StringGridCustedit1.MouseToCell(X, Y, Column, Row);
StringGridCustedit1.Row:=Row;
set_adveditcl(Row);
end;

procedure TForm_peach.StringGridCustEdit1SelectCell(Sender: TObject; aCol,
  aRow: Integer; var CanSelect: Boolean);
begin
set_adveditcl(aRow);
end;

procedure TForm_peach.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 TForm_peach.StringGridCustEditDblClick(Sender: TObject);
begin
case StringGridCustedit.Col of
   1: setdescription_custedit;
   2: editapp_custedit;
   end;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.StringGridSessionHistoryHeaderSized(Sender: TObject;
  IsColumn: Boolean; Index: Integer);
begin
if index=0 then StringGridSessionHistory.ColWidths[0]:=rowsize;
end;

procedure TForm_peach.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 TForm_peach.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 TForm_peach.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 TForm_peach.tbcontrastChange(Sender: TObject);
begin
if openstarted=true then
   begin
   contrast:=4+tbcontrast.Position;
   apply_theme;
   end;
end;

procedure grid_dir_open;
begin
with Form_peach do
begin
listrow:=StringgridList.Row;
if ListRow=0 then exit;
{$IFDEF MSWINDOWS}
if Form_peach.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:boolean;
begin
with Form_peach 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 Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   listdir(StringGridList.Cells[12,StringGridList.Row],false,false);
   addtohistory;
   exit;
   end;
{$ENDIF}

//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);

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(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.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 (StringGridList.Rowcount<3) and (zpaqabsolute=0) and (zpaqfull=0) then //partial extraction not implemented, so this method is allowed only if a single object is contained (useful for .tar.*)
            begin
            tfparam:=Form_peach.CheckBoxFolder.Checked;
            Form_peach.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);
                  Form_peach.CheckBoxFolder.Checked:=tfparam;
                  execute_obj(3,outname);
                  end
               else
                  pMessageWarningOK(txt_extraction_error);
               end
            else
               begin
               end;
            Form_peach.CheckBoxFolder.Checked:=tfparam;
            end
         else
            pMessageWarningOK(txt_error_partial);
         exit;
         end;
         'UNPEA' :
         begin
         if extract_finalize_bytype(Form_peach.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) //file types usually not handled as archives
         then cp_open(StringGridList.Cells[12,StringGridList.Row],desk_env)
         else
            begin
            {$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(Form_peach.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(Form_peach.EditOpenIn.Caption)>=17 then
               if copy(Form_peach.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(3,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;

procedure TForm_peach.po_tabsopenClick(Sender: TObject);
begin
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;
settabbar(1);
ptabbar:=1;
ptabid:=atabid;
addptab;
sortplustab;
if checklistanysel<>0 then exit;
{$IFDEF MSWINDOWS}
if Form_peach.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 TForm_peach.po_verClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k ver';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.po_whoamiClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:=wincomspec+' /k whoami';
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.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 TForm_peach.po_xfcesmClick(Sender: TObject);
begin
linlaunch('xfce4-settings-manager');
end;

procedure TForm_peach.RadioGroup3Change(Sender: TObject);
begin
on_cbcheckallClick;
end;

procedure TForm_peach.seRARrrChange(Sender: TObject);
begin
puserarrr:=seRARrr.Value;
end;

procedure TForm_peach.ShellTreeView1MouseEnter(Sender: TObject);
begin
bctemp:=0;
end;

procedure TForm_peach.SpinEditArchive1Change(Sender: TObject);
begin
spansize:=SpinEditArchive1.Value;
end;

procedure TForm_peach.splitsearchMoved(Sender: TObject);
begin
splitsearchsize:=splitsearch.left;
end;

procedure TForm_peach.StringGridSessionHistoryDblClick(Sender: TObject);
begin
if StringGridSessionHistory.RowCount<2 then exit;
browsehistoryn(StringGridSessionHistory.RowCount-StringGridSessionHistory.Row);
end;

function set_grid:boolean;
var
   rc,i:integer;
begin
try
set_grid:=false;
rc:=Form_peach.Stringgridlist.Rowcount;
if rc<2 then exit;
if Form_peach.StringgridList.Cells[1,1]='' then exit;
if Form_peach.ListView1.Items.Count<1 then exit;
{$IFDEF MSWINDOWS}//works properly on Lazarus 0.9.30
if Form_peach.ListView1.Selected<>nil then i:=Form_peach.ListView1.Selected.Index
else exit;
if Form_peach.ListView1.Items[i].selected=true then Form_peach.StringGridList.Row:=i+1;
set_grid:=true;
{$ELSE}
if rc>1 then
   for i:=1 to rc-1 do
      try
      if Form_peach.ListView1.Items[i-1].selected=true then
         begin
         Form_peach.Stringgridlist.Row:=i;
         set_grid:=true;
         break;
         end;
      except
      end;
{$ENDIF}
except
end;
end;

procedure TForm_peach.ListView1DblClick(Sender: TObject);
begin
wasselected:=-1;
ListView1.begindrag(false);
dragcancelled:=true;
if set_grid=false then exit;
//singleextract:=false;
listrow:=StringgridList.Row;
grid_obj_open;
end;

procedure TForm_peach.ListView1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
wasselected:=-1;
Accept:=true;
end;

procedure TForm_peach.ListView1KeyDown(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 Form_peach.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 Form_peach.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:=Form_peach.EditOpenIn.Text;
         for i:=1 to Form_peach.StringGridList.RowCount-1 do
            begin
            if Form_peach.EditOpenIn.Text<>sref then begin k:=0; break; end;
            if Form_peach.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
                        Form_peach.StringGridList.Row:=i;
                        grid_obj_open;
                        end
                     else
                        begin
                        if k=0 then k:=i;
                        end;
                  end;
               end;
            end;
         if k>0 then
            begin
            Form_peach.StringGridList.Row:=k;
            grid_obj_open;
            end;
         end;
end;

procedure TForm_peach.ListView1KeyPress(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 Form_peach.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 Form_peach.StringGridList.Cells[1,1]<>'' then
            if length(clipcontent)>0 then
               begin
               addtoarchive_inarchive(true);
               Form_peach.StringGrid1.Cursor:=crHourGlass;
               deselectingrid(Form_peach.StringGrid1);
               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(Form_peach.StringGrid1,clipcontent[i,0])
                     else addfilestr(Form_peach.StringGrid1,clipcontent[i,0]);
                  end;
               Form_peach.StringGrid1.AutoSizeColumns;
               updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
               Form_peach.StringGrid1.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 Timer1
      begin
      clear_clipboard;
      dragcancelled:=true;
      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
   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;
      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;
      exit;
      end;
end;

procedure TForm_peach.ListView1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
   i:integer;
begin
update_selstatus;
wasselected:=-1;
if Form_peach.ListView1.Selected<>nil then
   begin
   i:=Form_peach.ListView1.Selected.Index;
   Form_peach.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;
end;

procedure TForm_peach.ListView1MouseDown(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
if Form_peach.ListView1.ItemIndex=-1 then wasselected:=-1;
case button of
   mbMiddle: navgoup;//rename_files('rename');
   mbExtra1: navgoback;
   mbExtra2: navgofwd;
   end;
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 Form_peach.StringGridList.RowCount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         setlength(sarr,length(sarr)+1);
         sarr[j]:=Form_peach.StringGridList.Cells[12,i];
         j:=j+1;
         end;
   disdrag:=true;
   dodropfiles(ListView1, sarr, 2);
   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(Form_peach.ListView1, vpath, 2);
   //MyThreaddrop.Terminate;
   vpatha:=vpath;
   vpathb:=vpath2;
   if imdel=true then cleandragtmp;
   threadextracting:=false;
   end
end
else //custom drag and drop
   begin
   case button of
   mbleft:
      begin
      popupclosed:=false;
      if Form_peach.EditOpenIn.Caption<>txt_mypc then
         try
         if ListView1.GetItemAt(x,y)<>nil then
            if ListView1.GetItemAt(x,y).Caption<>'' then
               begin
               ListView1.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 Form_peach.EditOpenIn.Caption<>txt_mypc then
         try
         if ListView1.GetItemAt(x,y)<>nil then
            if ListView1.GetItemAt(x,y).Caption<>'' then
               begin
               ListView1.begindrag(false);
               dragcancelled:=false;
               rightdropbutton:=true;
               end;
         except
         end;
      end;
   end;
   end;
{$ENDIF}
end;

procedure TForm_peach.ListView1MouseEnter(Sender: TObject);
begin
ShellTreeView1.ShowButtons:=false;
TreeView1.ShowButtons:=false;
end;

procedure TForm_peach.ListView1MouseLeave(Sender: TObject);
begin
wasselected:=-1;
wasselectedp:=-1;
if checkboxshowhints.Checked=false then exit;
try
   shint:='';
   prevshint:='';
   h.hide;
except
end;
end;

procedure TForm_peach.ListView1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
   p:TPoint;
   i:integer;
   s:ansistring;
begin
if shift=[ssLeft] then wasselected:=-1;
pclicked:=false;
if openstarted=false then exit;
if checkboxshowhints.Checked=false then exit;
s:='';
try
if ListView1.GetItemAt(x,y)<>nil then i:=ListView1.GetItemAt(x,y).Index else
   begin
   shint:=s;
   exit;
   end;
if i>-1 then
  begin
  if ListView1.Items[i].Caption<>'' then
     begin
     if ListView1.Items[i].SubItems[0]=txt_list_isfolder then
        s:=ListView1.Items[i].Caption+char($0D)+char($0A)
        +ListView1.Column[1].Caption+' - '+ListView1.Items[i].SubItems[0]+char($0D)+char($0A)
        +ListView1.Column[4].Caption+' - '+ListView1.Items[i].SubItems[3]
     else
        begin
        s:=ListView1.Items[i].Caption+char($0D)+char($0A)
        +ListView1.Column[1].Caption+' - '+ListView1.Items[i].SubItems[0]+char($0D)+char($0A)
        +ListView1.Column[2].Caption+' - '+ListView1.Items[i].SubItems[1];
        if ListView1.Items[i].SubItems[2]<>'' then
           case ListView1.Items[i].SubItems[2] of
           '.': s:=s+char($0D)+char($0A)+ListView1.Column[3].Caption+' - '+txt_6_2_container;
           '+': s:=s+char($0D)+char($0A)+ListView1.Column[3].Caption+' - '+txt_6_2_archive;
           else
              s:=s+char($0D)+char($0A)+ListView1.Column[3].Caption+' - '+ListView1.Items[i].SubItems[2];
           end;
        if ListView1.Items[i].SubItems[8]<>'' then s:=s+char($0D)+char($0A)+ListView1.Column[10].Caption+' - '+ListView1.Items[i].SubItems[9];
        if ListView1.Items[i].SubItems[3]<>'' then s:=s+char($0D)+char($0A)+ListView1.Column[4].Caption+' - '+ListView1.Items[i].SubItems[3];
        end;
     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+splitter2.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 TForm_peach.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
var
   i{$IFNDEF MSWINDOWS},rc{$ENDIF}:integer;
begin
if updatinglistview=true then exit;
if updatingsel=true then exit;
if browserbusy=true then exit;
updatingsel:=true;
{$IFDEF MSWINDOWS} //selectitem 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
i:=Item.index+1;
if ListView1.Items[i-1].Selected<>true then StringGridList.Cells[16,i]:='0' else StringGridList.Cells[16,i]:='1';
{$ELSE} //the previous code doesn't currently work on Qt, making necessary to update the whole grid
rc:=StringGridList.Rowcount;
for i:=1 to rc-1 do
   if ListView1.Items[i-1].Selected<>true then StringGridList.Cells[16,i]:='0' else StringGridList.Cells[16,i]:='1';
{$ENDIF}
//set_grid; //Lazarus 0.9.30: no longer needed, selection is always updated before action is launched
//update_selstatus; associated to onmouseup and onkeyup
if Form_peach.ListView1.SelCount>1 then wasselected:=-1;
updatingsel:=false;
end;

procedure TForm_peach.ListView1StartDrag(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 := Button1.ScreenToClient(Pt);
  //Pass info to drag object
  FDragObject := TControlDragObject.CreateWithHotSpot(Button1, Pt.X, Pt.Y);
  //Modify the var parameter
  DragObject := FDragObject;
  {$ENDIF}
end;

procedure TForm_peach.Lmanageschedule1Click(Sender: TObject);
begin
if not(directoryexists(confpath+'Scheduled scripts'+DirectorySeparator)) then mkdir(confpath+'Scheduled scripts'+DirectorySeparator);
cp_open(confpath+'Scheduled scripts'+DirectorySeparator,desk_env);
end;

procedure TForm_peach.Lmanageschedule2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
ShellExecuteW(Form_peach.Handle, PWideChar ('open'), PWideChar('taskschd.msc'), PWideChar (''), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
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
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 Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[16,i]='1' then
      begin
      setlength(clipcontent1,length(clipcontent1)+1);
      clipcontent1[j,0]:=Form_peach.StringGridList.Cells[12,i];
      clipcontent1[j,1]:=Form_peach.StringGridList.Cells[1,i];
      clipcontent1[j,2]:=Form_peach.StringGridList.Cells[2,i];
      clipcontent1[j,3]:=cpact;
      clipcontent1[j,4]:=txt_fs;
      j:=j+1;
      end;
if cpdestdir<>'' then destdir:=cpdestdir;//Form_peach.EditOpenOut.Text;
if j>0 then
   if clipcontent1[0,0]<>'' then cp_copy_filedir(clipcontent1,destdir);
end;

procedure TForm_peach.pma2s_copyClick(Sender: TObject);
begin
mass_cp_copy_filedir(txt_copy,'');
end;

procedure TForm_peach.pma2s_extallnew1Click(Sender: TObject);
var
   nf:boolean;
   cl,jobcode,outname:ansistring;
begin
if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
Form_peach.CheckBoxFolder.State:=cbChecked;
Form_peach.EditOpenOut.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 Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TForm_peach.pma2s_extnew1Click(Sender: TObject);
var
   nf:boolean;
   cl,jobcode,outname:ansistring;
begin
if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
Form_peach.CheckBoxFolder.State:=cbChecked;
Form_peach.EditOpenOut.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 Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TForm_peach.pma2s_extnewClick(Sender: TObject);
var
   nf:boolean;
begin
if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
Form_peach.CheckBoxFolder.State:=cbChecked;
lastoutpath:=destdir;
quickextract(destdir);
if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TForm_peach.pma2s_extract1Click(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
Form_peach.EditOpenOut.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 TForm_peach.pma2s_extractall1Click(Sender: TObject);
var
   cl,jobcode,outname:ansistring;
begin
Form_peach.EditOpenOut.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 TForm_peach.pma2s_extractClick(Sender: TObject);
var
   nf:boolean;
begin
if Form_peach.CheckBoxFolder.State=cbChecked then nf:=true else nf:=false;
Form_peach.CheckBoxFolder.State:=cbUnChecked;
lastoutpath:=destdir;
quickextract(destdir);
if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure TForm_peach.pma2s_moveClick(Sender: TObject);
begin
mass_cp_copy_filedir(txt_cut,'');
end;

procedure TForm_peach.theme_label1Click(Sender: TObject);
begin
reset_theme_btn;
end;

procedure save_new_theme;
var
   cl,work_path,bin_name,in_param,out_param:ansistring;
   P:tprocessutf8;
begin
themedir:='themes'+directoryseparator+Form_peach.edit1.text+directoryseparator;
theme_path:=themedir+'theme.txt';
graphicsfolder:=themedir;
try
if not(directoryexists(confpath+themedir)) then
   forcedirectories(confpath+themedir)
else
   begin
   pMessageErrorOK(confpath+themedir+' '+txt_theme_exists);
   exit;
   end;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /c xcopy '+stringdelim(Form_peach.LabelTheme1.hint+'*.*')+' '+stringdelim(confpath+themedir)+' /S /Y';
{$ELSE}
cl:='cp -p -r -f '+stringdelim(Form_peach.LabelTheme1.hint+'.')+' '+stringdelim(confpath+themedir);
{$ENDIF}
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P.Execute;
P.Free;
assignfile(conf,(confpath+theme_path));
rewrite(conf);
write_header(conf);
writeln(conf,Form_peach.Edit1.text);
writeln(conf,Form_peach.Edit2.text);
if Form_peach.Edit3.text='' then Form_peach.Edit3.text:='LGPLv3';
writeln(conf,Form_peach.Edit3.text);
writeconf_colors;
closefile(conf);
Form_peach.labeltheme1.hint:=confpath+themedir;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
in_param:=stringdelim(escapefilename(confpath+themedir,desk_env));
out_param:=local_desktop+Form_peach.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';
{$IFNDEF MSWINDOWS}if sys7zlin=1 then bin_name:='7z a -t7z -m0=LZMA -mmt=on -mx5 -md=16m -mfb=32 -ms=2g';{$ENDIF}
if work_path<>'' then cl:=cl+' '+work_path;
cl:=bin_name+' '+out_param+' '+in_param;
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P.Execute;
P.Free;
pMessageInfoOK(txt_done+' '+local_desktop+Form_peach.Edit1.text+'.theme.7z');
except
   pMessageErrorOK(txt_theme_create_error);
   exit;
end;
end;

procedure TForm_peach.themesave_labelClick(Sender: TObject);
begin
if edit1.text='' then
   begin
   pMessageWarningOK(txt_no_theme_name);
   exit;
   end;
save_new_theme;
end;

procedure finishlistview;
begin
   {$IFDEF MSWINDOWS}
   if form_peach.Visible=true then
      if Form_peach.StringgridList.Rowcount>1 then
         if Form_peach.StringgridList.Cells[1,1]<>'' then
            begin
            try
            Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1].Focused:=true;
            Form_peach.ListView1.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}
      Form_peach.ListView1.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
      Form_peach.mDetails.checked:=true;
      Form_peach.mList.checked:=false;
      Form_peach.mSmallIcon.checked:=false;
      Form_peach.ListView1.ViewStyle:=vsReport;
      end;
   1: begin
      //Form_peach.ListView1.ViewStyle:=vsReport; //was needed to set correct size for list items
      Form_peach.mDetails.checked:=false;
      Form_peach.mList.checked:=true;
      Form_peach.mSmallIcon.checked:=false;
      Form_peach.ListView1.ViewStyle:=vsList;
      end;
   2: begin
      Form_peach.mDetails.checked:=false;
      Form_peach.mList.checked:=false;
      Form_peach.mSmallIcon.checked:=true;
      Form_peach.ListView1.ViewStyle:=vsIcon;
      end;
   end;
   Form_peach.mctype.checked:=ctype;
   Form_peach.mcsize.checked:=csize;
   Form_peach.mcpacked.checked:=cpacked;
   Form_peach.mcdate.checked:=cdate;
   Form_peach.mcatt.checked:=catt;
   Form_peach.mccrc.checked:=ccrc;
   Form_peach.mcfree.checked:=cfree;
   Form_peach.mcfs.checked:=cfs;
   Form_peach.pmctype.checked:=ctype;
   Form_peach.pmcsize.checked:=csize;
   Form_peach.pmcpacked.checked:=cpacked;
   Form_peach.pmcdate.checked:=cdate;
   Form_peach.pmcatt.checked:=catt;
   Form_peach.pmccrc.checked:=ccrc;
   Form_peach.pmcfree.checked:=cfree;
   Form_peach.pmcfs.checked:=cfs;
   Form_peach.mccreated.checked:=ccreated;
   Form_peach.mcaccessed.checked:=caccessed;
   Form_peach.mcmethod.checked:=cmethod;
   Form_peach.pmccreated.checked:=ccreated;
   Form_peach.pmcaccessed.checked:=caccessed;
   Form_peach.pmcmethod.checked:=cmethod;
   Form_peach.mccomment.checked:=ccomment;
   Form_peach.pmccomment.checked:=ccomment;
   Form_peach.ListView1.Rowselect:=rowselect;
   Form_peach.mrowselect.checked:=rowselect;
   Form_peach.mlargeicons.checked:=enlargeicons;
   {$IFNDEF MSWINDOWS}Form_peach.mlargeicons.visible:=false;{$ENDIF}
   {$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;
   Form_peach.Splitter2.Left:=splitter2size;
   Form_peach.splitsearch.Left:=splitsearchsize;
   setshowthumbnails(showthumbnails);
   setbrowserch(browserch);
   setsimplesearch(simplesearch);
   setrecsearch(recsearch);
   setrenfilesonly(renfilesonly);
   setusebreadcrumb(usebreadcrumb,0);
   set_listview_cnames;
   setdecostyle;
   hideintro;
end;

procedure doprogress2;
begin
if Form_peach.ProgressBar2.Visible=false then
   if pcount<25 then
      pcount:=pcount+1
   else
      begin
      Form_peach.ProgressBar2.width:=0;
      Form_peach.ProgressBar2.Visible:=true;
      Form_peach.ProgressBar2.Brush.Color:=PGREEN;
      Form_peach.Panel10.Visible:=true;
      refreshstatus:=2;
      Form_peach.ImageListSearch.Picture.Bitmap:=Bwipe;
      end
else
   begin
   Form_peach.Progressbar2.width:=Form_peach.Progressbar2.width+1;
   if Form_peach.Progressbar2.width>=64 then Form_peach.Progressbar2.width:=0;
   end;
end;

procedure doprogress;
begin
if (browserbusy=true) then doprogress2;
end;

procedure TForm_peach.Timer1Timer(Sender: TObject);
begin
doprogress;
{$IFDEF MSWINDOWS}
if PanelOpen.Visible=true then
   if (getkeystate(27)<>1) and (getkeystate(27)<>0) then
      begin dragcancelled:=true; end;
if form_peach.Visible=true then
   if pcmenupopulated=true then exit
   else
      begin
      pcmenupopulated:=true;
      finishlistview;
      populatepcmenu;
      imgshelltree;
      end
else exit;
{$ENDIF}
if waitdrawok=false then waitdrawok:=true;
end;

procedure TForm_peach.Timer2Timer(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:ansistring;
   {$IFDEF MSWINDOWS}MyThreadexe:TMyThreadexe;{$ENDIF}
begin
{$IFDEF DARWIN}Form_peach.ListView1.Cursor:=crDefault;{$ENDIF}//temporary macOS workaround for the mouse pointer changing unexpectedly
if Form_peach.StringGridList.RowCount<2 then exit;
{$IFDEF MSWINDOWS}if panelopen.visible=true then{$ELSE}if panelopen.top=0 then{$ENDIF}
   if fun='FILEBROWSER' then
      begin
      if listingdir=true then exit; //skip if a directory is being listed
      if EditOpenIn1.Caption<>EditOpenIn.Caption then exit;
      if control_listingdir=true then begin timer2.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;
      Timer2.Interval:=1000;
      if length(EditOpenIn1.Caption)>=2 then
         if EditOpenIn1.Caption[1]=DirectorySeparator then
            if EditOpenIn1.Caption[2]=DirectorySeparator then Timer2.Interval:=4000;//remote unit
      if rc>4*1024 then Timer2.Interval:=Timer2.Interval*2;
      if rc>8*1024 then Timer2.Interval:=Timer2.Interval*4;
      if rc>16*1024 then begin Timer2.enabled:=false; exit; end;
      sc:=0;
      for i:=1 to rc-1 do try sc:=sc+strtoqword(StringGridList.Cells[3,i]); except end;
      if EditOpenIn.Text<>txt_mypc then
         begin
         if directoryexists(EditOpenIn.Text) then
            begin
            nfiles:=0;
            ndirs:=0;
            tsize:=0;
            if (simplesearch=1) then rcountsize(EditOpenIn.Text,'*'+Form_peach.EditUn7zaFilter.Text+'*',faAnyFile,recmode,nfiles,ndirs,tsize)
            else rcountsize(EditOpenIn.Text,EditUn7zaFilter.Text,faAnyFile,recmode,nfiles,ndirs,tsize);
            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
               if tsize<>sc then navrefresh;

            {$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}
         Timer2.Interval:=2000;
         countunits(nunits);
         if nunits+1<>rc then
            begin
            navrefresh;
            populatepcmenu;
            end;
         {$ENDIF}
         end;
      control_listingdir:=false;
      end
   else
      if (autosync=1) and (browserbusy=false) then
      begin
      fextl:=upcase(extractfileext(Form_peach.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(Form_peach.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;
            Timer2.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;
            Timer2.enabled:=true;
            end;
      end;
end;

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 Form_peach.PanelArchiveMain.Visible=true{$ELSE}if Form_peach.PanelArchiveMain.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, Form_peach.StringGrid1)=0 then
         if filegetattr(s1) > 0 then
            if filegetattr(s1) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,s1)
            else addfolderstr(Form_peach.StringGrid1,s1)
         else msg_not_accessible_s(s1);
      end;
   Form_peach.StringGrid1.AutoSizeColumns;
   updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
   end;
{$IFDEF MSWINDOWS}if Form_peach.PanelExtract.Visible=true{$ELSE}if Form_peach.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 directoryexists(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(Form_peach.StringGrid2);
                  addfilestr(Form_peach.StringGrid2,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(Form_peach.StringGrid2);
            addfilestr(Form_peach.StringGrid2,s1);
            end;
         end;
      end;

   if Form_peach.EditOpenOut.Text<>defaultextractpath then
      if Form_peach.StringGrid2.Rowcount>1 then
         if dirpresent=false then
            Form_peach.EditOpenOut.Text:=extractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
         else
            Form_peach.EditOpenOut.Text:=s0//(last) directory's path
      else
         Form_peach.EditOpenOut.Text:=local_desktop;

   updatecontent_ext;
   end;
multiaddupdating:=false;
end;

procedure TForm_peach.Timer3StartTimer(Sender: TObject);
begin
addmultiupdate;
end;

procedure TForm_peach.Timer3Timer(Sender: TObject);
begin
addmultiupdate;
end;

procedure TForm_peach.Timer4Timer(Sender: TObject);
begin
if (browserbusy=true) then
   begin
   {$IFDEF DARWIN}Form_peach.ListView1.Cursor:=crDefault;{$ELSE}Form_peach.ListView1.Cursor:=crHourglass;{$ENDIF}
   end;
end;

procedure TForm_peach.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 TForm_peach.TimerrenameTimer(Sender: TObject);
begin
Timerrename.Enabled:=false;
if Form_peach.ListView1.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 TForm_peach.tmconvertClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
select_all('0');
archive_convert;
end;

procedure TForm_peach.tmcreateClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
select_all('0');
do_add;
end;

procedure TForm_peach.tmextractClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
select_all('0');
if open_archive<>1 then exit;
do_extract;
end;

procedure TForm_peach.tmopenarchiveClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
open_archive;
end;

procedure TForm_peach.tmopenpathClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
peazip_browse;
end;

procedure TForm_peach.tmpeazipClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
end;

procedure TForm_peach.tmquitClick(Sender: TObject);
begin
Form_peach.visible:=true;
exit_withsave;
end;

procedure TForm_peach.tmupdateClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
fixbringtofront;
select_all('0');
if open_archive<>1 then exit;
do_add;
end;

procedure TForm_peach.tbtemperatureChange(Sender: TObject);
begin
if openstarted=true then
   begin
   temperature:=tbtemperature.Position;
   color2:=color2d;
   apply_theme;
   end;
end;

procedure TForm_peach.TrayIcon1Click(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
end;

procedure TForm_peach.TrayIcon1DblClick(Sender: TObject);
begin
TrayIcon1.visible:=false;
Form_peach.visible:=true;
end;

procedure TForm_peach.TreeView1ContextPopup(Sender: TObject; MousePos: TPoint;
  var Handled: Boolean);
begin

end;

procedure dotreeviewaction(TargetNode : TTreeNode);
var
   s:ansistring;
   i,appsnodes:integer;
begin
if TargetNode=nil then
   begin
   Form_peach.treeview1.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='My Box Files' then begin jumpto('myboxfiles'); 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='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 Form_peach.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;
       end;

   if TargetNode.Parent.Text=txt_open then
       begin
       case TargetNode.Index of
          0: do_add;
          1: archive_convert;
          2: do_extract;
          3: openpath;
          4: open_archive;
          5: cp_search(desk_env);
          6: begin
             if checklistsel=0 then s:=Form_peach.StringGridList.Cells[1,Form_peach.StringGridList.Row];
             run_websearch(s);
             end;
          7: browser_explorepath(1);
          8: browser_commandprompt(1,0,'');
          {$IFDEF MSWINDOWS}
          9: browser_commandprompt(1,1,'');
          10: browser_fileproperties('');
          {$ENDIF}
          end;
       exit;
       end;

   if TargetNode.Parent.Text=txt_4_8_fun then
       begin
       do_pmfun(TargetNode.Text);
       end;

   if TargetNode.Parent.Text=txt_3_3_apps then
       begin
       appsnodes:=0;
       case TargetNode.Index of
          0: run_custom('');
          else
             begin
             if Form_peach.StringGridList.RowCount<2 then exit;
             if Form_peach.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 Form_peach.StringGridList.RowCount-1 do
                if Form_peach.StringGridList.Cells[16,i]='1' then
                   if TargetNode.Index<=appentries1+appsnodes then
                      open_custedit(appdb[TargetNode.Index-appsnodes],Form_peach.StringGridList.Cells[12,i])
                   else
                      open_advcustedit(appdb2[TargetNode.Index-appentries1-appsnodes],Form_peach.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 Form_peach.StringGridSessionHistory.Cells[2,Form_peach.StringGridSessionHistory.RowCount-TargetNode.Index-1]<>Form_peach.EditOpenIn.Text then
            browsehistoryn(TargetNode.Index+1);
         end
      else
         if Form_peach.StringGridRecent.Cells[0,TargetNode.Index+1-hnum]='' then opendir(Form_peach.StringGridRecent.Cells[1,TargetNode.Index+1-hnum])
         else open_archive_fromname(Form_peach.StringGridRecent.Cells[1,TargetNode.Index+1-hnum]);
      exit;
      end;

   try if Form_peach.treeview1.Selected.text<>TargetNode.text then exit; except exit; end;
   if fun='UN7Z' then
      begin
      if (FormAdvf.CheckBoxAdvFilters.State=cbChecked) and (filterbrowser=1) then exit;
      Form_peach.EditUn7zaFilter.Text:=Form_peach.StringGridAddress1.Cells[12,TargetNode.AbsoluteIndex]+directoryseparator+'*';
      Form_peach.EditUn7zaFilterExclude.Text:=Form_peach.StringGridAddress1.Cells[12,TargetNode.AbsoluteIndex]+directoryseparator+'*'+directoryseparator+'*';
      listun7z_go;
      end;
   end
else
   begin
   end;
end;

{procedure dotreeviewstatus(TargetNode : TTreeNode);
begin
if TargetNode=nil then
   begin
   Form_peach.treeview1.selected:=nil;
   exit;
   end;
if (targetnode.parent=nil) then
   begin
   if TargetNode.Text=txt_fs then
      if TargetNode.Expanded=true then expandfs:=1
      else
         begin
         expandfs:=0;
         expandmore:=0;
         end;
   if TargetNode.Text=txt_bookmarks then
      if TargetNode.Expanded=true then expandbook:=1
      else expandbook:=0;
   if TargetNode.Text=txt_list_history then
      if TargetNode.Expanded=true then expandhistory:=1
      else expandhistory:=0;
   if TargetNode.Text=txt_open then
      if TargetNode.Expanded=true then expandrun:=1
      else expandrun:=0;
   end;
if targetnode.parent<>nil then
   begin
   if TargetNode.parent.Text=txt_fs then
      if TargetNode.Text='...' then
         if TargetNode.Expanded=true then expandmore:=1
         else expandmore:=0;
   if TargetNode.Text=txt_3_3_apps then
      if TargetNode.Expanded=true then expandapps:=1
      else expandapps:=0;
   if TargetNode.Text=txt_4_8_fun then
      if TargetNode.Expanded=true then expandfun:=1
      else expandfun:=0;
   end;
if targetnode.parent<>nil then
   begin
   if TargetNode.parent.Text=txt_fs then
      if TargetNode.Text=txt_mypc then
         if TargetNode.Expanded=true then expandroot:=1
         else expandroot:=0;
   end;
end;}

procedure dotreeviewstatus(TargetNode : TTreeNode);
var
   i:integer;
   n:TTreeNode;
begin
n:=form_peach.TreeView1.Items.GetFirstNode;
for i:=1 to form_peach.TreeView1.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 Form_peach.treeview1.selected:=nil;
end;

procedure TForm_peach.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if button<>mbLeft then exit;
fromtree:=true;
if (treeview1.GetHitTestInfoAt(X, Y) <= [htOnItem, htOnIcon, htOnLabel, htOnStateIcon, htOnButton]) then TargetNode := TreeView1.GetNodeAt(X,Y)
else TargetNode :=nil;

if (treeview1.GetHitTestInfoAt(X, Y) <= [htOnItem, htOnIcon, htOnLabel, htOnStateIcon]) then treeonbutton:=true else treeonbutton:=false;
end;

procedure TForm_peach.TreeView1MouseEnter(Sender: TObject);
begin
TreeView1.ShowButtons:=true;
bctemp:=0;
end;

procedure TForm_peach.TreeView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if button<>mbLeft then exit;
dotreeviewstatus(TargetNode);
dotreeviewaction(TargetNode);
end;

procedure populatetree2;
begin
with Form_peach do
begin
treeview2.Items.Clear;
treeview2.Items.Add(nil,txt_add);
treeview2.Items.Add(nil,txt_2_8_convert);
treeview2.Items.Add(nil,txt_caption_extract);
treeview2.Items.Add(nil,txt_ext_allto+'...');
treeview2.Items.Add(nil,txt_caption_test);
treeview2.Items.Add(nil,txt_4_1_duplicatesfind);
treeview2.Items.Add(nil,txt_copyto);
treeview2.Items.Add(nil,txt_moveto);
treeview2.Items.Add(nil,txt_join);
treeview2.Items.Add(nil,txt_split);
treeview2.Items.Add(nil,txt_4_3_pwman);
treeview2.Items.Add(nil,txt_2_7_setpw);
treeview2.Items.Add(nil,txt_4_8_rl);
treeview2.Items.Add(nil,txt_4_8_rr);
treeview2.Items.Add(nil,txt_2_5_help);
treeview2.Items.Add(nil,txt_peazip_new);
treeview2.Items.Add(nil,txt_cphere);
treeview2.Items.Add(nil,txt_explore_path);
treeview2.CustomSort(nil);
end;
end;

procedure populatefunmenu;
begin
with Form_peach do
begin
pmfun1.caption:=treeview2.Items[0].Text;
pmfun2.caption:=treeview2.Items[1].Text;
pmfun3.caption:=treeview2.Items[2].Text;
pmfun4.caption:=treeview2.Items[3].Text;
pmfun5.caption:=treeview2.Items[4].Text;
pmfun6.caption:=treeview2.Items[5].Text;
pmfun7.caption:=treeview2.Items[6].Text;
pmfun8.caption:=treeview2.Items[7].Text;
pmfun9.caption:=treeview2.Items[8].Text;
pmfun10.caption:=treeview2.Items[9].Text;
pmfun11.caption:=treeview2.Items[10].Text;
pmfun12.caption:=treeview2.Items[11].Text;
pmfun13.caption:=treeview2.Items[12].Text;
pmfun14.caption:=treeview2.Items[13].Text;
pmfun15.caption:=treeview2.Items[14].Text;
pmfun16.caption:=treeview2.Items[15].Text;
pmfun17.caption:=treeview2.Items[16].Text;
pmfun18.caption:=treeview2.Items[17].Text;
end;
end;

procedure do_pmfun(capt:ansistring);
begin
if capt=txt_add then begin do_add; exit; end;
if capt=txt_2_5_help then
   begin
   showpanel('defaults');
   clicklabel_options(form_peach.LabelTitleOptions7, form_peach.BevelTitleOptions7);
   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; exit; end;
if capt=txt_caption_test then begin do_test; exit; end;
if capt=txt_4_1_duplicatesfind then begin findduplicate('neutral'); exit; end;
if capt=txt_copyto then begin clickcopyto; exit; end;
if capt=txt_moveto then begin clickmoveto; exit; end;
if capt=txt_join then begin do_join; exit; end;
if capt=txt_split 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_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;
end;

procedure TForm_peach.w7contextlangClick(Sender: TObject);
begin
pMessageInfoOK(txt_5_3_cmlmessage);
cp_open(sharepath+'lang-wincontext'+directoryseparator,desk_env);
end;

procedure TForm_peach.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<Form_peach.left-8) or (lpPoint.y<Form_peach.top-8) or (lpPoint.x>Form_peach.left+Form_peach.width+12) or (lpPoint.y>Form_peach.top+Form_peach.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;

{$IFDEF MSWINDOWS}
//custom drag and drop
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:=Form_peach.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(Form_peach.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;
Form_peach.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 Form_peach.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
if nativedrag=1 then exit;
Form_peach.Timerdrag.enabled:=false;
FormDrop.Visible:=false;
totrow:=Form_peach.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;
Form_peach.ListView1.begindrag(false);
if Form_peach.EditOpenIn.Caption=txt_mypc then begin FDragObject.Destroy; exit; end;
GetCursorPos(lpPoint);
if (lpPoint.x<Form_peach.left-8) or (lpPoint.y<Form_peach.top-8) or (lpPoint.x>Form_peach.left+Form_peach.width+12) or (lpPoint.y>Form_peach.top+Form_peach.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:=Form_peach.EditOpenOut.Text;
      end;
   resetminimizedlauncher;
   olddest:=Form_peach.EditOpenOut.Text;
   Form_peach.EditOpenOut.Text:=dragdest;
   if Form_peach.EditOpenOut.Text<>'' then
      if Form_peach.EditOpenOut.Text[length(Form_peach.EditOpenOut.Text)] <> directoryseparator then Form_peach.EditOpenOut.Text:=Form_peach.EditOpenOut.Text+directoryseparator;
   calcseltsize;

   sizefreeint:=tsize;
   if checkfreespace<>0 then exit;
   Form_peach.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:=Form_peach.EditOpenOut.Text;
         if form_peach.Visible=true then form_peach.SetFocus;
         form_peach.pmapptosys.popup();
         end
      else mass_cp_copy_filedir(txt_copy,Form_peach.EditOpenOut.Text);
      end;
   if testencrypted=0 then
      begin
      if (fun='UNARC') then
         if (GetKeyShiftState=[ssCtrl]) or (rightdropbutton=true) then
            begin
            destdir:=Form_peach.EditOpenOut.Text;
            if form_peach.Visible=true then form_peach.SetFocus;
            form_peach.pmapptosys1.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:=Form_peach.EditOpenOut.Text;
            if form_peach.Visible=true then form_peach.SetFocus;
            form_peach.pmapptosys1.popup();
            end
         else
            if compose_un7z_cl(cl,jobcode,outname,true,'draganddrop','selected')=0 then launch_cl(cl,jobcode,outname); //'ext'
      end;
   Form_peach.Visible:=true;
   if (fun<>'FILEBROWSER') then lastextractionpath:=Form_peach.EditOpenOut.Text;
   lastoutpath:=Form_peach.EditOpenOut.Text;
   Form_peach.EditOpenOut.Text:=olddest;
   end
else
begin
{$IFDEF MSWINDOWS}
lpPoint := Form_peach.Splitter1.ScreenToClient(Mouse.CursorPos);
if (lpPoint.y>0) and (Form_peach.stringgridbookmarks.visible=true) then
   begin
   if Form_peach.stringgridbookmarks.visible=false then showbar('bookmarks');
   j:=0;
   for i:=1 to Form_peach.StringGridList.Rowcount-1 do
      if Form_peach.StringGridList.Cells[16,i]='1' then
         begin
         j:=j+1;
         if j>100 then break;//prevent adding too many bookmarks by error, may be improved (ask confirmation)
         if checkfiledirname(Form_peach.StringGridList.Cells[12,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[12,i]); exit; end;
         if fun='FILEBROWSER' then addtobookmarks(escapefilename(Form_peach.StringGridList.Cells[12,i],desk_env))
         else addtobookmarks('*current');
         end;
   end;
{$ENDIF}
end;
FDragObject.Destroy;
end;

{$ENDIF}

initialization
  {$I peach.lrs}

  {$IFDEF MSWINDOWS}
  OleInitialize(nil);
  {$ENDIF}

finalization
  {$IFDEF MSWINDOWS}
  OleUninitialize();
  {$ENDIF}

end.
