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 ./res/ path
                    third parts executables in ./res/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

BACKEND
Zstd 1.4.5

CODE
Various fixes

FILE MANAGER
Fixed folder sorting, now folders are always grouped before files
Improved theming, window and toolbar colors can now be customized
 New Graphite, Mocha, and Senape themes with intermediate color tones
 (cross-platform limitation) System-rendered widgetsets are not affected by theme colors as native drawing methods were not bypassed by theme implementation
 (Windows 10 limitation) Dark Mode colors are not passed from system to application, as workaround it is possible to use an High Contrast theme, which passes colors consistent with Dark Mode UI, until a complete API is made available to developers

EXTRACTION and ARCHIVING
Added support for .zstd extension, as used in compressed cpo in new rpm installers
(Linux) Updated sfx module for p7zip

WINDOWS & LINUX INSTALLERS


197 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.
--------------------------------------------------------------------------------

(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+}

interface

uses
{$IFDEF MSWINDOWS}
Windows, activex, ShlObj, ComObj, shellapi, windirs,
{$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;

   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..3] of ansistring;
   Thistarray = array[1..8]of ansistring;

   { TForm_peach }

   TForm_peach = class(TForm)
     baboutfaq: TSpeedButton;
     baboutlocalhelp: TSpeedButton;
     baboutremoveunace: TSpeedButton;
     baboutremoveunrar: TSpeedButton;
     baboutsupport: TSpeedButton;
     babouttracker: TSpeedButton;
     baboutweb: TSpeedButton;
     baboutremoveadditional: TSpeedButton;
     Bevel1: TShape;
     Bevel10: TShape;
     Bevel11: TShape;
     Bevel12: TShape;
     Bevel13: TShape;
     Bevel14: TShape;
     Bevel15: TShape;
     Bevel16: TShape;
     Bevel17: TShape;
     Bevel18: TShape;
     Bevel19: 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;
     cbcheckall: TCheckBox;
     cbdeleteinputmode: TComboBox;
     cbdeleteinputmode1: TComboBox;
     cbencext: TCheckBox;
     cbType: TComboBox;
     CheckBox1: TCheckBox;
     CheckBox2: TCheckBox;
     CheckBox3: TCheckBox;
     CheckBoxNoConf: TCheckBox;
     CheckBoxZstd: TCheckBox;
     CheckBoxClosePeaZip1: TCheckBox;
     CheckBoxConvert0: TCheckBox;
     CheckBoxDragDrop: TCheckBox;
     CheckBoxEncoding: TCheckBox;
     CheckBoxEncoding1: TCheckBox;
     CheckBoxForceEdit: TCheckBox;
     CheckBoxAutoOpenTar: TCheckBox;
     CheckBoxJobEncoding: TCheckBox;
     CheckBoxForceOpen: TCheckBox;
     CheckBoxPrebrowse: TLabel;
     CheckBoxBrotli: TCheckBox;
     CheckBoxShowVolatile: TCheckBox;
     CheckBoxEditArchives: TCheckBox;
     CheckBoxsni: TCheckBox;
     CheckBox4: TCheckBox;
     CheckBoxsni1: TCheckBox;
     CheckBoxzpaqabsolute: TCheckBox;
     CheckBoxzpaqforce: TCheckBox;
     CheckBoxzpaqall: TCheckBox;
     CheckBoxsns: TCheckBox;
     CheckBox7zunrar5: TCheckBox;
     CheckBoxARC1: TCheckBox;
     CheckBoxARC2: TCheckBox;
     CheckBoxARC3: TCheckBox;
     CheckBoxArchive4: TCheckBox;
     CheckBoxArchive6: TCheckBox;
     CheckBoxArchiveHistory: TCheckBox;
     CheckBoxArchiveOF: TCheckBox;
     CheckBoxAutoHaltA: TCheckBox;
     CheckBoxAutoHaltE: TCheckBox;
     CheckBoxAutoOpen: TCheckBox;
     CheckBoxAutoOpen1: TCheckBox;
     CheckBoxBrowseNotVerbose: TCheckBox;
     CheckBoxConvert: TCheckBox;
     CheckBoxConvert1: TCheckBox;
     CheckBoxDate: TCheckBox;
     CheckBoxDeleteInput: TCheckBox;
     CheckBoxDeleteInput1: TCheckBox;
     CheckBoxEnumd: TCheckBox;
     CheckBoxFolder: TCheckBox;
     CheckBoxFolder1: 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;
     CheckBoxClosePeaZip: TCheckBox;
     CheckBoxTBW: TCheckBox;
     CheckBoxThemeBars: TCheckBox;
     CheckBoxUnPeaAttributes: TCheckBox;
     CheckBoxUPX1: TCheckBox;
     CheckBoxUPX2: TCheckBox;
     CheckBoxWindowStatus: TCheckBox;
     CheckBoxzcopy: TCheckBox;
     CheckBoxstl: TCheckBox;
     CheckGroupM1: TCheckGroup;
     CheckGroupM2: TCheckGroup;
     CheckGroupW: TCheckGroup;
     CheckGroupW1: TCheckGroup;
     ColorButton1: TColorButton;
     ColorButton2: TColorButton;
     ColorButton3: TColorButton;
     ComboBox1: 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;
     ComboBoxTheme: TComboBox;
     ComboBoxUPX: TComboBox;
     ComboBoxBrowser: TComboBox;
     CompressionARC: TPanel;
     CompressionCustom: TPanel;
     CompressionCustom1: TPanel;
     ConsoleCreate: TScrollBox;
     ConsoleOpen: TScrollBox;
     ctrlext: TSpeedButton;
     ctrlarc: TSpeedButton;
     DateEdit1: TDateEdit;
     DateEdit2: TDateEdit;
     DateEdit3: TDateEdit;
     DateEdit4: TDateEdit;
     Edit1: TEdit;
     Edit2: TEdit;
     Edit3: TEdit;
     Edit4: TEdit;
     Edit5: 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;
     gbConsoleCreate: TPanel;
     gbConsoleCreate1: TPanel;
     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;
     Label6: TLabel;
     Labeladvextace: TLabel;
     Labeladvextzpaq: TLabel;
     LabelColor2: TLabel;
     LabelColor3: TLabel;
     LabelConfigurePeaZip1: 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;
     Labelo2: TLabel;
     Labeloaenc: TLabel;
     Labeloaui: TLabel;
     Labelogpaths: TLabel;
     LabelOpacity: TLabel;
     Labelspac13: TLabel;
     Labelspac14: TLabel;
     Labelspac4: TLabel;
     LabelErrors: TLabel;
     LabelStatus7: TLabel;
     LabelTitleOptions2: TLabel;
     MenuItem102: TMenuItem;
     MenuItem111: TMenuItem;
     MenuItem114: TMenuItem;
     MenuItem115: TMenuItem;
     MenuItem116: TMenuItem;
     MenuItem117: TMenuItem;
     MenuItem119: TMenuItem;
     MenuItem120: TMenuItem;
     MenuItem121: TMenuItem;
     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;
     org_rowselect: TMenuItem;
     pmpanalyzefolders: TMenuItem;
     po_analyzefolders: TMenuItem;
     mForceSyncedits: TMenuItem;
     Panel10: TPanel;
     pms2a_ext: TMenuItem;
     MenuItem118: TMenuItem;
     po_rename_separator: TMenuItem;
     pmdeduplicate: 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;
     RadioGroup4: TComboBox;
     RadioGroup6: TComboBox;
     RadioGroupAction1: TComboBox;
     ShapeFStotal: TShape;
     ShapeFSfree: TShape;
     ShapeTitleAddb1: TShape;
     ShapeTitleAddb2: TShape;
     ShapeTitleAddb3: TShape;
     ShapeTitleAddb4: TShape;
     ShapeTitleAppsb1: TShape;
     ShapeTitleAppsb2: TShape;
     ShapeTitleExtractb1: TShape;
     ShapeTitleExtractb2: TShape;
     ShapeTitleExtractb3: TShape;
     ShapeTitleExtractb4: TShape;
     SpinEdit1: TSpinEdit;
     StringGridArchive: TStringGrid;
     StringGridTabs: TStringGrid;
     Subtitleschopt: TLabel;
     Subtitleschopt1: TLabel;
     TabBar: THeaderControl;
     iConsoleCreateImport: TImage;
     iConsoleCreateImport1: TImage;
     Image7zPj: TBitBtn;
     Image7zPj1: TBitBtn;
     Image7zPj3: TBitBtn;
     ImageAdArchive3: TImage;
     ImageAddress0: TImage;
     ImageAddress1: TImage;
     ImageAddress2: TImage;
     ImageAddress3: TImage;
     ImageAddress4: TImage;
     ImageAddress5: TImage;
     ImageAddress6: TImage;
     ImageAddress7: TImage;
     ImageAdArchive0: TImage;
     ImageAdArchive1: TImage;
     ImageAdArchive2: TImage;
     Imagemn1: TImage;
     ImageDefaults2: TBitBtn;
     ImageInfoArchive2: TImage;
     ImageInfoArchive3: TImage;
     ImageInfoArchive4: TImage;
     ImageInfoArchive5: TImage;
     ImageInfoArchive6: TImage;
     ImageListSearch1: TImage;
     Imagemn2: TImage;
     Imagemn3: TImage;
     Imageopenadvf: TImage;
     Imageopenadvf1: TImage;
     Imageopenadvf2: TImage;
     ImagePassword1: TSpeedButton;
     ImagePassword2: TSpeedButton;
     ImageSplit: TImage;
     ImageUn7zPj: TBitBtn;
     Label10: TLabel;
     Label7za14: TLabel;
     Label7za18: TLabel;
     Label7za8: TLabel;
     Labeladvext7z: TLabel;
     Labeladvextfreearc: TLabel;
     LabelArcSub3: TLabel;
     Labelo1: TLabel;
     Labelo3: TLabel;
     Labelo4: TLabel;
     Labelo5: TLabel;
     Labelo6: TLabel;
     Labelo7: TLabel;
     Labelo8: TLabel;
     Labelogperf: TLabel;
     Label7: 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;
     LabelAbout2: 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;
     Labelpasses: TLabel;
     LabelPEA6: TLabel;
     LabelPEA7: TLabel;
     LabelPEA8: TLabel;
     LabelResetApp1: TLabel;
     LabelResetBookmarks: TLabel;
     LabelResetHistory: TLabel;
     LabelResetPM: TLabel;
     LabelResetPtmp: TLabel;
     LabelResetTheme: TLabel;
     Labelspac1: TLabel;
     Labelspac3: TLabel;
     Labelspac5: TLabel;
     Labelspac8: TLabel;
     LabelSplit: TLabel;
     LabelStatus2: TLabel;
     LabelStatus4: TLabel;
     LabelStatus5: TLabel;
     LabelStatus6: TLabel;
     LabelTheme: TLabel;
     LabelTheme1: TLabel;
     LabelTheme2: TLabel;
     LabelTheme3: TLabel;
     LabelThemeLoaded: TLabel;
     LabelTitleApps1: TLabel;
     LabelTitleApps2: TLabel;
     LabelUpdates: TLabel;
     LabelTitleExtract2: TLabel;
     LabelTitleExtract3: TLabel;
     LabelTitleExtract4: TLabel;
     LabelTitleExtract1: TLabel;
     LabelTitleOptions6: TLabel;
     LabelTitleOptions7: TLabel;
     LabelTitleOptions8: TLabel;
     LabelDonations: TLabel;
     lConsoleCreate_jobcode: TLabel;
     lConsoleCreate_jobcode1: TLabel;
     lConsoleCreate_outname: TLabel;
     lConsoleCreate_outname1: 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;
     mConsoleCreate: TMemo;
     mConsoleCreate1: TMemo;
     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;
     panelspaceradd1: TPanel;
     panelspaceradd2: TPanel;
     RadioGroupActionArc: TComboBox;
     ShapeTitleAdd2: TShape;
     ShapeTitleAdd3: TShape;
     ShapeTitleExtract1: TShape;
     ShapeTitleExtract2: TShape;
     ShapeTitleExtract3: TShape;
     panelspacerextract1: TPanel;
     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;
     po_browseralgo: 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;
     pmamr0: TMenuItem;
     pmamr1: TMenuItem;
     pmamb2: TMenuItem;
     pmamb3: TMenuItem;
     pmamb4: TMenuItem;
     pmamb5: TMenuItem;
     pmamb6: TMenuItem;
     pmamb7: TMenuItem;
     pmamb8: TMenuItem;
     pmamspacer: TMenuItem;
     pmamb0: TMenuItem;
     pmamb1: TMenuItem;
     pmArchivemenu: 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;
     Shape1: TShape;
     Shape5: TShape;
     ShapeAddress: TPanel;
     ShapeTitleAdd1: TShape;
     ShapeTitleApps1: TShape;
     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;
     themesave_label: TLabel;
     themes_download: TLabel;
     theme_label: TLabel;
     theme_label1: TImage;
     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;
     MenuItem30: TMenuItem;
     pmbreadfs: TMenuItem;
     pmbreadfun: TMenuItem;
     mPeaFB: TMenuItem;
     mPeaTW: TMenuItem;
     MenuItem112: 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;
     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;
     ButtonUn7zaTo1: TSpeedButton;
     ButtonPaste: TSpeedButton;
     ButtonImgRL: TSpeedButton;
     ButtonImgRR: TSpeedButton;
     cbUn7zaRecursive: TCheckBox;
     cbUn7zaRecursiveExclude: TCheckBox;
     LabelTitleOptions5: TLabel;
     LabelTitleAdd1: TLabel;
     LabelTitleAdd2: TLabel;
     LabelTitleAdd3: TLabel;
     LabelTitleAdd4: TLabel;
     pmrsh: TMenuItem;
     MenuItem103: TMenuItem;
     PanelTitleAdd: TPanel;
     pmfunsweb: TMenuItem;
     pmmorefun_properties: TMenuItem;
     pmfun17: TMenuItem;
     pmfun18: TMenuItem;
     pmfun19: TMenuItem;
     pmbcorganizebookmarks: TMenuItem;
     pmbcaddbookmark: TMenuItem;
     pmfunop: TMenuItem;
     pmfunoa: TMenuItem;
     pmfunsd: TMenuItem;
     pmfunex: TMenuItem;
     pmfunpr: TMenuItem;
     pmfunaz: TMenuItem;
     pmfunfun: TMenuItem;
     pmfunhistory: TMenuItem;
     pmfunfs: TMenuItem;
     pmfunb: TMenuItem;
     pmtabbfun: TMenuItem;
     pmtabhfun: TMenuItem;
     mtabsffun: TMenuItem;
     pmsearchdrag: TMenuItem;
     pmsearchweb: TMenuItem;
     Shape3: TPanel;
     Shape4: TPanel;
     ShellTreeView2: TShellTreeView;
     LabelTitleOptions1: TLabel;
     LabelTitleOptions3: TLabel;
     LabelTitleOptions4: TLabel;
     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;
     mv5b: TMenuItem;
     pmmstatus_r: TMenuItem;
     mtabsfhistory: TMenuItem;
     mtabsffs: TMenuItem;
     mtabsfbookmarks: TMenuItem;
     MenuItem96: TMenuItem;
     pmjd27: TMenuItem;
     pmjd28: TMenuItem;
     pmjd29: TMenuItem;
     pmjd30: TMenuItem;
     pmjd31: TMenuItem;
     pmjd32: TMenuItem;
     pmjd33: TMenuItem;
     pmjd34: TMenuItem;
     pmjd35: TMenuItem;
     pmjd36: TMenuItem;
     pmjd37: TMenuItem;
     pmjd38: TMenuItem;
     pmjd39: TMenuItem;
     pmjd40: TMenuItem;
     pmjd41: TMenuItem;
     pmjd42: TMenuItem;
     pmjd43: TMenuItem;
     pmjd44: TMenuItem;
     pmjd45: TMenuItem;
     pmjd46: TMenuItem;
     pmjd47: TMenuItem;
     pmjd48: TMenuItem;
     pmjd49: TMenuItem;
     pmjd50: TMenuItem;
     pmjd51: TMenuItem;
     pmjd52: TMenuItem;
     pmtabsfs: TPopupMenu;
     pmJump5: TMenuItem;
     pmJump6: TMenuItem;
     pmJump7: TMenuItem;
     pmJumpDocuments1: TMenuItem;
     pmjumpdownloads1: TMenuItem;
     pmjumplibraries1: TMenuItem;
     pmjumpmusic1: TMenuItem;
     pmjumppictures1: TMenuItem;
     pmjumppubdoc1: TMenuItem;
     pmjumppubhome1: TMenuItem;
     pmjumprecent1: TMenuItem;
     pmjumpsearches1: TMenuItem;
     pmjumpusers1: TMenuItem;
     pmjumpvideos1: TMenuItem;
     pmqjdropbox1: TMenuItem;
     pmqjgoogledrive1: TMenuItem;
     pmqjmore1: TMenuItem;
     pmqjmyboxfiles1: TMenuItem;
     pmqjonedrive1: TMenuItem;
     pmqjskydrive1: TMenuItem;
     pmqjubuntuone1: TMenuItem;
     pmtaborganizebookmarks: TMenuItem;
     MenuItem101: TMenuItem;
     pmtabaddbookmarks: TMenuItem;
     pmtabhhistory: TMenuItem;
     pmtabhfilesystem: TMenuItem;
     pmtabhbookmarks: TMenuItem;
     MenuItem97: TMenuItem;
     MenuItem98: TMenuItem;
     MenuItem99: TMenuItem;
     pmbc10: TMenuItem;
     pmbc11: TMenuItem;
     pmbc12: TMenuItem;
     pmbc13: TMenuItem;
     pmbc14: TMenuItem;
     pmbc15: TMenuItem;
     pmbc16: TMenuItem;
     pmbc17: TMenuItem;
     pmtabshistory: TPopupMenu;
     pmh0s1: TMenuItem;
     pmh10: TMenuItem;
     pmh11: TMenuItem;
     pmh12: TMenuItem;
     pmh13: TMenuItem;
     pmh14: TMenuItem;
     pmh15: TMenuItem;
     pmh16: TMenuItem;
     pmh17: TMenuItem;
     pmhbc1: TMenuItem;
     pmhr11: TMenuItem;
     pmhr12: TMenuItem;
     pmhr13: TMenuItem;
     pmhr14: TMenuItem;
     pmhr15: TMenuItem;
     pmhr16: TMenuItem;
     pmhr17: TMenuItem;
     pmhr18: TMenuItem;
     pmhr1f1: TMenuItem;
     pmhr2f1: TMenuItem;
     pmhr3f1: TMenuItem;
     pmhr4f1: TMenuItem;
     pmhr5f1: TMenuItem;
     pmhr6f1: TMenuItem;
     pmhr7f1: TMenuItem;
     pmhr8f1: TMenuItem;
     pmtabb13: TMenuItem;
     pmtabb14: TMenuItem;
     pmtabb15: TMenuItem;
     pmtabb16: TMenuItem;
     pmtabb17: TMenuItem;
     pmtabb18: TMenuItem;
     pmtabb19: TMenuItem;
     pmtabb20: TMenuItem;
     pmtabb21: TMenuItem;
     pmtabb22: TMenuItem;
     pmtabb23: TMenuItem;
     MenuItem95: TMenuItem;
     pmtabb9: TMenuItem;
     pmtabb10: TMenuItem;
     pmtabb11: TMenuItem;
     pmtabb12: TMenuItem;
     pmtabbhistory: TMenuItem;
     pmtabbfilesystem: TMenuItem;
     pmtabbbookmarks: TMenuItem;
     pmtabb6: TMenuItem;
     pmtabb7: TMenuItem;
     pmtabb8: TMenuItem;
     pmtabb1: TMenuItem;
     pmtabb2: TMenuItem;
     pmtabb3: TMenuItem;
     pmtabb4: TMenuItem;
     pmtabb5: 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;
     pmfun: TPopupMenu;
     pmtabsbookmarks: TPopupMenu;
     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;
     ImageInfoOpen4: TSpeedButton;
     ImageListRoot: TImage;
     ImagePassword: TSpeedButton;
     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;
     MenuItem83: TMenuItem;
     mb0: TMenuItem;
     MenuItem84: TMenuItem;
     po_sysmore: TMenuItem;
     po_msinfo32: TMenuItem;
     po_msconfig: TMenuItem;
     po_regedit: TMenuItem;
     po_mrt: TMenuItem;
     pmmisc: TMenuItem;
     pmbcmisc: TMenuItem;
     pmpowershell: TMenuItem;
     pmbcps: TMenuItem;
     MenuItemPowerShell: TMenuItem;
     MenuItemOpen_powershell: TMenuItem;
     pmbcweb: TMenuItem;
     pmbcproperties: TMenuItem;
     pmnewinst: TMenuItem;
     pmbcnewinst: TMenuItem;
     pmbccp: 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;
     org_aprelist: 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;
     MenuItem40: TMenuItem;
     MenuItem73: TMenuItem;
     pmorganizebookmarks: TMenuItem;
     pmrsearch: TMenuItem;
     MenuItemOpen_organizebookmarks: TMenuItem;
     Panelnav5: TPanel;
     MenuItem74: TMenuItem;
     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;
     org_a: TMenuItem;
     org_aprelightlist: TMenuItem;
     org_aprelight: TMenuItem;
     org_apredetails: TMenuItem;
     org_apreaverage: TMenuItem;
     org_aprelarge: TMenuItem;
     pmImageRotate: TPopupMenu;
     pmImageResize: TPopupMenu;
     po_alltasks: TMenuItem;
     mnavfun: TMenuItem;
     pmmtool_image: TMenuItem;
     mtimage: TMenuItem;
     pmpdup: TMenuItem;
     PanelBarOpen3: TPanel;
     po_recycle: TMenuItem;
     pmrecycle: TMenuItem;
     po_open_asarchivet: TMenuItem;
     MenuItem77: TMenuItem;
     org_thumb: TMenuItem;
     MenuItem38: TMenuItem;
     pmmstatus_clipboard: TMenuItem;
     pmmstatus_ra: TMenuItem;
     pmmstatus_bookmarks: TMenuItem;
     pmmstatus: TPopupMenu;
     pmmtool_archive: TMenuItem;
     pmmstatus_status: TMenuItem;
     pmmtool_file: TMenuItem;
     pmjumpusers: TMenuItem;
     pmmstatus_details: TMenuItem;
     pmws: TMenuItem;
     MenuItem47t: TMenuItem;
     MenuItem9t: TMenuItem;
     owseparator2t: TMenuItem;
     pmcheck: TMenuItem;
     mtspacer: TMenuItem;
     mtarchive: TMenuItem;
     mtfile: TMenuItem;
     Panelnav4: TPanel;
     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;
     pmmtool: TPopupMenu;
     po_flat: TMenuItem;
     MenuItemOrganizeStatusbar: TMenuItem;
     MenuItemOrganizeNavbar: TMenuItem;
     MenuItemOrganizeAddressbar: 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;
     ImageFlat: TSpeedButton;
     ImageListSearch: TImage;
     il_nonthemed: TImageList;
     ImageTheme: TImage;
     LabelClickAddress1: TLabel;
     LabelClickAddress2: TLabel;
     LabelClickAddress3: TLabel;
     LabelClickAddress4: TLabel;
     LabelClickAddress5: TLabel;
     LabelClickAddress6: TLabel;
     LabelClickAddress7: TLabel;
     LabelClickAddress8: TLabel;
     LabelInfo4: TLabel;
     LabelStatus: TLabel;
     LabelStatusEx2: TLabel;
     LabelStatusdisplayed: TLabel;
     fextallto: TMenuItem;
     fextallfav1: TMenuItem;
     org_details: TMenuItem;
     mwebs: TMenuItem;
     org_large: TMenuItem;
     org_medium: TMenuItem;
     org_small: TMenuItem;
     MenuItem80: TMenuItem;
     org_icons: TMenuItem;
     org_list: TMenuItem;
     po_fm: TMenuItem;
     MenuItem34: TMenuItem;
     fextallfav2: TMenuItem;
     fextallfav3: TMenuItem;
     fextallfav4: TMenuItem;
     fextallfav5: TMenuItem;
     fextallfav6: TMenuItem;
     fextallfav7: TMenuItem;
     fextallfav8: TMenuItem;
     extalllast: TMenuItem;
     mbrowsersort: TMenuItem;
     MenuItem49: 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;
     Panelnav3: TPanel;
     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;
     po_deduplicatesel: TMenuItem;
     msimplesearch: TMenuItem;
     MenuItemopendesktop: TMenuItem;
     mfullscreen: TMenuItem;
     po_checksumsel: TMenuItem;
     po_checksum: TMenuItem;
     po_deduplicate: 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;
     Panelnav2: TPanel;
     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;
     mstatusbar: TMenuItem;
     PanelClickAddress: TPanel;
     Panel8: TPanel;
     PanelListBar: TPanel;
     pmqelast: TMenuItem;
     pmqe2fav: TMenuItem;
     pmqe3fav: TMenuItem;
     mextalldocuments: TMenuItem;
     pmqedocuments: TMenuItem;
     pmqesetpw: TMenuItem;
     MenuItem42: 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;
     maddress: 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;
     mts2: TMenuItem;
     mts3: TMenuItem;
     pmusedefault: TMenuItem;
     pmqedefault: TMenuItem;
     pmqe1fav: TMenuItem;
     MenuItem66: TMenuItem;
     pmqenewfolder: TMenuItem;
     pmqedesk: TMenuItem;
     pmqeto: TMenuItem;
     pmqehere: TMenuItem;
     mSystemIntegration: TMenuItem;
     pma2s_extractall1: TMenuItem;
     mtm1: 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;
     MenuItem60: TMenuItem;
     MenuItemArchive_pubhome: TMenuItem;
     MenuItemOpen_pubhome: TMenuItem;
     mbrowser: TMenuItem;
     MenuItem53: TMenuItem;
     MenuItem55: TMenuItem;
     MenuItem57: TMenuItem;
     MenuItem58: TMenuItem;
     MenuItem59: TMenuItem;
     mnavnone: TMenuItem;
     mtn: TMenuItem;
     morganize: TMenuItem;
     mv1: 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;
     mnavigation: TMenuItem;
     mtree: TMenuItem;
     mnavbar: TMenuItem;
     MenuItem9: TMenuItem;
     mshowmenu: TMenuItem;
     mv2: TMenuItem;
     mv3: TMenuItem;
     mv5: TMenuItem;
     mv6: TMenuItem;
     mv0: TMenuItem;
     mtoolbar: TMenuItem;
     mthl: TMenuItem;
     MenuItem43: TMenuItem;
     mtvs: TMenuItem;
     mtm2: TMenuItem;
     mts: 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;
     PanelInfo: TPanel;
     LabelStatusAr2: TLabel;
     LabelInfo3: TLabel;
     LabelInfo1: TLabel;
     LabelInfo2: TLabel;
     ListView1: TListView;
     mctrlf3: TMenuItem;
     mcancel: TMenuItem;
     mbcl: TMenuItem;
     MenuItem10: TMenuItem;
     MenuItem13: TMenuItem;
     MenuItem14: TMenuItem;
     mbpea: TMenuItem;
     mbexplore: TMenuItem;
     MenuItem23: TMenuItem;
     mdefaultarchive: TMenuItem;
     MenuItem25: TMenuItem;
     mtt: 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;
     Shape2: TShape;
     ShapeIO6: TShape;
     ShapeIO7: TShape;
     ShapeIO8: TShape;
     ShapeIO9: TShape;
     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;
     mdefaultextract: TMenuItem;
     pmh9: TMenuItem;
     mshiftf3: TMenuItem;
     MenuItem41: TMenuItem;
     po_hidden: TMenuItem;
     mopenasarchive: TMenuItem;
     po_openasarchive: TMenuItem;
     pmbookmarks: TMenuItem;
     po_convertarchive: TMenuItem;
     mrowselect: TMenuItem;
     po_selectall: TMenuItem;
     mlist: TMenuItem;
     MenuItem35: 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;
     mgotoextlayout: 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;
     EditUn7zaFilterExclude: TEdit;
     pmmorefun_info: TMenuItem;
     pmmorefun_list: TMenuItem;
     aowseparator2: TMenuItem;
     eowseparator2: TMenuItem;
     MemoList: TMemo;
     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;
     powseparator2: TMenuItem;
     owseparator2: 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;
      MenuItem18: TMenuItem;
      MenuItem19: TMenuItem;
      mEnvstr: 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;
      MenuItem8: TMenuItem;
      po_diskclean: TMenuItem;
      po_defrag: TMenuItem;
      po_systemtools: TMenuItem;
      mgotolayout: 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;
      mArchive: 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;
      mPeaSite: TMenuItem;
      Notebook1: TPanel;
      PanelArchiveMain: TPanel;
      PanelBarOpen: TPanel;
      PanelDefaults: TPanel;
      PanelOpen: TPanel;
      pmSaveList: TMenuItem;
      pmLoadList: TMenuItem;
      pmAddFolder: TMenuItem;
      pmAddFile: TMenuItem;
      MenuItem3: TMenuItem;
      pmSpacer4: 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 baboutfaqClick(Sender: TObject);
      procedure baboutlocalhelpClick(Sender: TObject);
      procedure baboutremoveadditionalClick(Sender: TObject);
      procedure baboutremoveunaceClick(Sender: TObject);
      procedure baboutremoveunrarClick(Sender: TObject);
      procedure baboutsupportClick(Sender: TObject);
      procedure babouttrackerClick(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 ButtonUn7zaTo1Click(Sender: TObject);
      procedure cbadlerChange(Sender: TObject);
      procedure cbadvf1Click(Sender: TObject);
      procedure cbadvf2Click(Sender: TObject);
      procedure cbcheckallClick(Sender: TObject);
      procedure cbdeleteinputmode1Change(Sender: TObject);
      procedure cbdeleteinputmodeChange(Sender: TObject);
      procedure cbencextClick(Sender: TObject);
      procedure CheckBox1Click(Sender: TObject);
      procedure CheckBox2Click(Sender: TObject);
      procedure CheckBox3Click(Sender: TObject);
      procedure CheckBox7zunrar5Click(Sender: TObject);
      procedure CheckBoxARC3Click(Sender: TObject);
      procedure CheckBoxArchive4Click(Sender: TObject);
      procedure CheckBoxAutoOpenTarClick(Sender: TObject);
      procedure CheckBoxBrotliClick(Sender: TObject);
      procedure CheckBoxBrowseNotVerboseClick(Sender: TObject);
      procedure CheckBoxClosePeaZip1Click(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 CheckBoxFolder1Click(Sender: TObject);
      procedure CheckBoxForceEditClick(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 CheckBoxSameArcClick(Sender: TObject);
      procedure CheckBoxSameExtClick(Sender: TObject);
      procedure CheckBoxShowVolatileClick(Sender: TObject);
      procedure CheckBoxsni1Click(Sender: TObject);
      procedure CheckBoxsniClick(Sender: TObject);
      procedure CheckBoxsns1Click(Sender: TObject);
      procedure CheckBoxsnsClick(Sender: TObject);
      procedure CheckBoxstlClick(Sender: TObject);
      procedure CheckBoxThemeBarsClick(Sender: TObject);
      procedure CheckBoxARC2Click(Sender: TObject);
      procedure CheckBoxAutoOpen1Click(Sender: TObject);
      procedure CheckBoxAutoOpenClick(Sender: TObject);
      procedure CheckBoxClipClick(Sender: TObject);
      procedure CheckBoxEncoding1Click(Sender: TObject);
      procedure CheckBoxEncodingClick(Sender: TObject);
      procedure CheckBoxFolderClick(Sender: TObject);
      procedure CheckBoxJobEncodingClick(Sender: TObject);
      procedure CheckBoxParallelArchivingClick(Sender: TObject);
      procedure CheckBoxSeparateClick(Sender: TObject);
      procedure CheckBoxTBWClick(Sender: TObject);
      procedure CheckBoxzcopyClick(Sender: TObject);
      procedure CheckBoxzpaqabsoluteClick(Sender: TObject);
      procedure CheckBoxzpaqallClick(Sender: TObject);
      procedure CheckBoxzpaqforceClick(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 ComboBoxBrowserChange(Sender: TObject);
      procedure ComboBoxWDChange(Sender: TObject);
      procedure ComboBoxARC2Change(Sender: TObject);
      procedure ComboBoxArchive7Change(Sender: TObject);
      procedure ComboBoxArchive8Change(Sender: TObject);
      procedure ComboBoxArchive9Change(Sender: TObject);
      procedure ComboBoxArchiveAct1Change(Sender: TObject);
      procedure ComboBoxArchiveActChange(Sender: TObject);
      procedure ComboBoxLibreChange(Sender: TObject);
      procedure ComboBoxprivacyChange(Sender: TObject);
      procedure ComboBoxSDChange(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 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 FormShow(Sender: TObject);
      procedure Imagesp1Click(Sender: TObject);
      procedure ImagespClick(Sender: TObject);
      procedure LabelDefaultColor3Click(Sender: TObject);
      procedure LabelErrorsClick(Sender: TObject);
      procedure LabelTitleOptions2Click(Sender: TObject);
      procedure LabelTitleOptions2MouseEnter(Sender: TObject);
      procedure LabelTitleOptions2MouseLeave(Sender: TObject);
      procedure ListView1ContextPopup(Sender: TObject; MousePos: TPoint;
        var Handled: Boolean);
      procedure MenuItemExtAllHereNewClick(Sender: TObject);
      procedure MenuItemExtAllHereSmartClick(Sender: TObject);
      procedure mextallherenewClick(Sender: TObject);
      procedure mextallheresmartClick(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 mprofilesaveClick(Sender: TObject);
      procedure mprofilezipbz2Click(Sender: TObject);
      procedure mprofilezstdClick(Sender: TObject);
      procedure msavecompsettingsClick(Sender: TObject);
      procedure mtabsClick(Sender: TObject);
      procedure mTypeBrotliClick(Sender: TObject);
      procedure mTypeZstandardClick(Sender: TObject);
      procedure org_rowselectClick(Sender: TObject);
      procedure PanelExtractClick(Sender: TObject);
      procedure pmdeduplicateClick(Sender: TObject);
      procedure pmhtabsClick(Sender: TObject);
      procedure pmpanalyzefoldersClick(Sender: TObject);
      procedure pmqeherenewClick(Sender: TObject);
      procedure pmqeheresmartClick(Sender: TObject);
      procedure pmrshClick(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 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 pob_blake2bClick(Sender: TObject);
      procedure pob_blake2sClick(Sender: TObject);
      procedure po_analyzefoldersClick(Sender: TObject);
      procedure po_pdupClick(Sender: TObject);
      procedure po_rename_123Click(Sender: TObject);
      procedure po_rename_filesonlyClick(Sender: TObject);
      procedure po_smartClick(Sender: TObject);
      procedure po_tabsopenClick(Sender: TObject);
      procedure SpinEditArchive1Change(Sender: TObject);
      procedure TabBarContextPopup(Sender: TObject; MousePos: TPoint;
        var Handled: Boolean);
      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 ImageInfoArchive2Click(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 ImageInfoOpen4Click(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 LabelAbout2Click(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 LabelDonationsClick(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 LabelResetThemeClick(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 LabelUpdatesClick(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 mPeaFBClick(Sender: TObject);
      procedure mPeaTWClick(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 maddressClick(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 mdefaultextractClick(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 mv5bClick(Sender: TObject);
      procedure mwebsClick(Sender: TObject);
      procedure mDateMonthClick(Sender: TObject);
      procedure org_aprelistClick(Sender: TObject);
      procedure org_autoadjustClick(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 pmamb1Click(Sender: TObject);
      procedure pmamb2Click(Sender: TObject);
      procedure pmamb3Click(Sender: TObject);
      procedure pmamb4Click(Sender: TObject);
      procedure pmamb5Click(Sender: TObject);
      procedure pmamb6Click(Sender: TObject);
      procedure pmamb7Click(Sender: TObject);
      procedure pmamb8Click(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 pmbccpClick(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 pmbcnewinstClick(Sender: TObject);
      procedure pmbcorganizebookmarksClick(Sender: TObject);
      procedure pmbcpropertiesClick(Sender: TObject);
      procedure pmbcpsClick(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 pmfun19Click(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 pmfunexClick(Sender: TObject);
      procedure pmfunprClick(Sender: TObject);
      procedure pmfunswebClick(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 pmhrefreshClick(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 mtimageClick(Sender: TObject);
      procedure org_thumbClick(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_detailsClick(Sender: TObject);
      procedure pmmstatus_raClick(Sender: TObject);
      procedure pmmstatus_rClick(Sender: TObject);
      procedure pmmstatus_statusClick(Sender: TObject);
      procedure pmmtool_archiveClick(Sender: TObject);
      procedure pmmtool_fileClick(Sender: TObject);
      procedure pmmtool_imageClick(Sender: TObject);
      procedure pmnewinstClick(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 pmtabaddbookmarksClick(Sender: TObject);
      procedure pmtabbbookmarksClick(Sender: TObject);
      procedure pmtabbfilesystemClick(Sender: TObject);
      procedure pmtabbfunClick(Sender: TObject);
      procedure pmtabbhistoryClick(Sender: TObject);
      procedure pmtaborganizebookmarksClick(Sender: TObject);
      procedure pmtypeswapClick(Sender: TObject);
      procedure pmwsClick(Sender: TObject);
      procedure mtfileClick(Sender: TObject);
      procedure MenuItemopendesktopClick(Sender: TObject);
      procedure MenuItemOrganizeAddressbarClick(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 mtarchiveClick(Sender: TObject);
      procedure mupdateClick(Sender: TObject);
      procedure org_detailsClick(Sender: TObject);
      procedure org_iconsClick(Sender: TObject);
      procedure org_largeClick(Sender: TObject);
      procedure org_listClick(Sender: TObject);
      procedure org_mediumClick(Sender: TObject);
      procedure org_smallClick(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 Panelnav3Click(Sender: TObject);
      procedure Panelnav3MouseEnter(Sender: TObject);
      procedure Panelnav3MouseLeave(Sender: TObject);
      procedure Panelnav4Click(Sender: TObject);
      procedure Panelnav4MouseEnter(Sender: TObject);
      procedure Panelnav4MouseLeave(Sender: TObject);
      procedure pmcheckClick(Sender: TObject);
      procedure pmjumpbreadcrumbClick(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_checksumselClick(Sender: TObject);
      procedure po_copypathClick(Sender: TObject);
      procedure po_deduplicateClick(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 mnavigationClick(Sender: TObject);
      procedure mnavnoneClick(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 mgotoextlayoutClick(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 mtm1Click(Sender: TObject);
      procedure mtm2Click(Sender: TObject);
      procedure mtnClick(Sender: TObject);
      procedure mtogglenewClick(Sender: TObject);
      procedure mTrayClick(Sender: TObject);
      procedure mtreeClick(Sender: TObject);
      procedure mts2Click(Sender: TObject);
      procedure mts3Click(Sender: TObject);
      procedure mtsClick(Sender: TObject);
      procedure mttClick(Sender: TObject);
      procedure mTutorialClick(Sender: TObject);
      procedure mtvsClick(Sender: TObject);
      procedure mTypeSfxArcClick(Sender: TObject);
      procedure mTypeWIMClick(Sender: TObject);
      procedure mTypeXZClick(Sender: TObject);
      procedure munsearchClick(Sender: TObject);
      procedure mUserClick(Sender: TObject);
      procedure mv0Click(Sender: TObject);
      procedure mv1Click(Sender: TObject);
      procedure mv2Click(Sender: TObject);
      procedure mv3Click(Sender: TObject);
      procedure mv5Click(Sender: TObject);
      procedure mv6Click(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 Panelnav2Click(Sender: TObject);
      procedure Panelnav2MouseEnter(Sender: TObject);
      procedure Panelnav2MouseLeave(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_deduplicateselClick(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_openasarchiveClick(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 mgotolayoutClick(Sender: TObject);
      procedure mRefreshClick(Sender: TObject);
      procedure mTypeSfxClick(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 ComboBoxArchive3Change(Sender: TObject);
      procedure ComboBoxArchive4Change(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 mPeaSiteClick(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 mType7zClick(Sender: TObject);
      procedure mTypeARCClick(Sender: TObject);
      procedure mTypebzip2Click(Sender: TObject);
      procedure mTypeClick(Sender: TObject);
      procedure mTypeCustomClick(Sender: TObject);
      procedure mTypegzClick(Sender: TObject);
      procedure mTypePAQClick(Sender: TObject);
      procedure mTypePEAClick(Sender: TObject);
      procedure mTypeQUADClick(Sender: TObject);
      procedure mTypeSplitClick(Sender: TObject);
      procedure mTypeTARClick(Sender: TObject);
      procedure mTypeUPXClick(Sender: TObject);
      procedure mTypeZIPClick(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 themes_downloadClick(Sender: TObject);
      procedure theme_label1Click(Sender: TObject);
      procedure themesave_labelClick(Sender: TObject);
      procedure theme_labelClick(Sender: TObject);
      procedure Timer1Timer(Sender: TObject);
      procedure Timer2Timer(Sender: TObject);
      procedure Timer3StartTimer(Sender: TObject);
      procedure Timer3Timer(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 TrayIcon1Click(Sender: TObject);
      procedure TrayIcon1DblClick(Sender: TObject);
      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: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):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 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 enter_busy_minor_status;
procedure exit_busy_minor_status;
procedure eraseselected_list(erasemode:integer);
procedure loadpm;
procedure setpm;
procedure on_checkboxseparateclick;
procedure ComboBoxArchive1_onchange;
procedure powcustom(j:integer; custmode:ansistring);
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;

const
  MAX_CL        = 31744; //most of modern OSes handle about up to 32KB command line, checked conservatively at 31KB
  WS_EX_LAYERED = $80000;
  LWA_ALPHA     = $2;
  INTVERSION    = '1.42';
  PEAZIPVERSION = '7.3';
  PEAZIPREVISION= '.1';
  PEAZIPSINTVER = '731';
  FIRSTDOM      = 'https://www.peazip.org/';
  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
  DEFAULT_THEME = 'ten-embedded';
  DLEFT         = 64;
  DTOP          = 64;
  DWIDTH        = 960;
  DHEIGTH       = 600;
  DGWLEFT       = 92;
  DGWTOP        = 92;
  DGWWIDTH      = 640;
  DGWHEIGTH     = 320;
  NAMEVARSTR    = ' - ';
  {$IFDEF MSWINDOWS}
  COL1D         = 240;
  COL2D         = 80;
  COL3D         = 88;
  COL4D         = 88;
  COL5D         = 120;
  COL6D         = 48;
  COL7D         = 88;
  {$ELSE}
  COL1D         = 240;
  COL2D         = 80;
  COL3D         = 96;
  COL4D         = 96;
  COL5D         = 144;
  COL6D         = 64;
  COL7D         = 96;
  {$ENDIF}
  ZCHAR         = '+';
  ZSTRING       = '----------';
  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 0.70 (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';
  STR_TMP       = '.ptmp';
  STR_TESTOUT   = '.ptestout';
  STR_STOPALL   = '.pstopall';
  {$IFDEF MSWINDOWS}
  EXEEXT        = '.exe';
  UNRARNAME     = 'unrar';
  APPLICATION2  = '7z 19.00 (LGPL, Igor Pavlov);';
  APPLICATION3  = 'PAQ8F/JD/L/O, LPAQ1/5/8, ZPAQ 7.15 [Matt Mahoney et al. (GPL)];';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = 'QUAD 1.12 (LGPL) / BALZ 1.15, 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.4.5 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF LINUX}
  EXEEXT        = '';
  UNRARNAME     = 'unrar-nonfree';
  APPLICATION2  = 'p7zip POSIX 7z 16.02 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  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, 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.7 (MIT License, Jyrki Alakuijala, Eugene Kliuchnikov, Robert Obryk, Zoltán Szabadka, Lode Vandevenne)';
  APPLICATION10 = 'Zstd 1.4.5 (Dual license BSD / GPLv2, Yann Collet, Przemysław Skibiński)';
  {$ENDIF}
  {$IFDEF FREEBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'p7zip POSIX 7z 16.02 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  APPLICATION3  = '';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.96 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = '';
  APPLICATION10 = '';
  {$ENDIF}
  {$IFDEF NETBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'p7zip POSIX 7z 16.02 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  APPLICATION3  = '';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.96 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = '';
  APPLICATION10 = '';
  {$ENDIF}
  {$IFDEF DARWIN}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'p7zip POSIX 7z 16.02 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  APPLICATION3  = '';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.96 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  APPLICATION8  = '';
  APPLICATION9  = '';
  APPLICATION10 = '';
  {$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:integer;
   abcrs: array [1..4] of ansistring;

   //scaling
   il16,ilsmall,il48,il96,il192: TImageList;
   qscale,qscaleimages:integer;
   icon_sizeplus:integer;

   //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,epzall,epzabs,epzfor:integer;

   //status archiver
   apdefault,apformat,apfilters,apenum,apencext,apappend,apsplit,apspin,apsize,apdelete,apverbose,appw,apdopt:integer;
   apdefaultarchivepath:ansistring;
   v7z1,v7z2,v7z3,v7z4,v7z5,v7z6,v7z7,v7z7b,v7z8,v7z9,v7z10,v7z11,v7z13,v7z13b,v7z14,v7z15,v7z16,v7z17,v7zpaths,vlevel_7z,vlevel_bzip2,vlevel_gz,vlevel_zip,vlevel_xz,v9b,v9z,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,vopt7c,vopt12t:ansistring;
   vopt2,vopt3,vopt4,vopt4b,vopt4c,vopt4d,vopt4e,vopt5,vopt5b,vopt5c,vopt5d,vopt5e,
   vopt5f,vopt5g,vopt5h,vopt6,vopt7,vopt7b,vopt8,vopt9,vopt10,vopt11,vopt12,voptlibre,
   voptprivacy,vopt13,voptts,vopt14,vopt15c,vopt15d,vopt15e,vopt16,vopt17,vopt18,
   vopt19,vopt20,vopt20b,vopt21,vopt22,vopt23,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,Bextractallto,Bextractallto_big,
   Bextractalln_big,Bextractallton_big,Bextractalln,Bextractallton,
   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,
   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,Bfm,
   Bnonthemed0,Bnonthemed1,Bnonthemed2,Bnonthemed3,Bnonthemed4,Bnonthemed5,Bnonthemed6,
   Bnonthemed7,Bnonthemed8,Bnonthemed9,Bnonthemed10,Bnonthemed11,
   Bp1,Bp2,Bp3,Bp4,Bp5,Bp6,Bp7,Bp8,Bpriority1,Bpriority2,Bpriority3,Bpriority4,
   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,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,
   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,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,statust,statusr,
   checkver,extsel,defaultextractpath,defaultarchivepath,dn,
   prevrun,titlestring,sortstatusstring,updateid,prevupdateid,prevarchive,inputfile,
   peaziptmpdir,basedragtitle,unacepluginstatus,unrar5pluginstatus,addformatspluginstatus,
   prevlistfilter,browsersdir,custom_work_path,tempaddinarchive,beingpreviewed:ansistring;

   tvolumes,tdirs,tfiles,psize,tsize,infosize1,infosize2:qword;

   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,
   barheight,mbarheight,lbarheight,intcellhw,expandfs,expandroot,expandbook,expandhistory,expandmore,expandrun,expandapps,expandfun,
   secgroupheight,listcol,ares,esna,euns,col1size,col2size,col3size,col4size,col5size,col6size,col7size,
   toolsize,navbar,addressbar,ptabbar,work_dir,prebrowse_dirs,prebrowse_records,rootdirrecord,mappeddrivesinfo,session_mappeddrivesinfo,
   appentries1,pcount,refreshstatus,themetoolbars,themetoolbarsd,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,euns1,
   autosync,i16res,i32res,i48res,i96res,tabheight,tabheightl,pbarh,autoopentar,spansize,advopdictionary,
   advopword,advoppasses,advopblocksize,noconfdel: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_bzip2,level_arc,solid_arc,rr_arc,algo_arc,algo_zipenc,level_gz,level_paq,paqver,
   level_quad,level_upx,level_zip,dlevel_zip,openw_all7z,showpwfield,setencfn,hidepwconf,
   autoclosegwrap,mailkeep,autoopen,autoclosepeazip,
   browserstyle,desk_env,prebrowse,ignorepathdisp,enc7zscc,sni7z,sns7z,stl7z,maxbrotli,maxzstd,
   ignorepathsel,removeintdir,ignorepathdd,savehistory,fav7z,favARC,favbz,favcustom,favgz,favpea,favquad,favsfx,
   favsfxarc,favsplit,favtar,favupx,favzip,favzpaq,favwim,favxz,favbrotli,favzstandard,
   extpw,algodisp,algoall,algoadler,algocrc16,
   algocrc24,algocrc32,algocrc64,algoed2k,algomd4,algomd5,algoripemd160,algosha1,
   algosha3_256,algosha256,algosha3_512,algosha512,algowhirl,showguihints,customsyntax,
   customsyntax1,erasepasses,extopt7z,extoptarc,extaction7z,extactionarc,extactionace,
   autosizetoolbarbutton,autosizetoolbarbuttond,clipmode,jobdefenc,
   archivenameenc,tonewfolder,parallelarchive,zcopy,mcuzip,nameaspartent,spchar,enumd,addencext,addtstext,
   defaulttabsmenu,multi_option,nonverboselog,use7zunrar5,sort7zbytype,browsersd,
   tmpremoveintdir,renselonly,renfilesonly,defaultspanning,spanunit,zpaqall,zpaqabsolute,zpaqforce: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,waitdrawok,needwaitupdating,updatingarchive_inarchive,goarchiving,updatingarchive_sync,
   stayopen,savetype,pcmenupopulated,updatinglistview,updatingsel,rowselect,showmenu,
   thighlight,ctype,csize,cpacked,cdate,catt,ccrc,cfree,cfs,multiaddupdating,dontsavecustom7z,
   dontsavecustomzip,forceopenasarchive,skipapstatus,browserbusy,browserbusy_minor,fromtree,spinchanged,
   swapbars,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:boolean;

   activelabel_options,activelabel_add,activelabel_extract,activelabel_apps:TLabel;

   //system drag and drop
   disdrag,threadextracting:boolean;
   nativedrag:integer;
   {$IFDEF MSWINDOWS}
   vpath2:ansistring;
   //used for transparence
   hUser32prop: HMODULE;
   SHMultiFileProperties: TSHMultiFileProperties;
   //drag and drop
   FDragObject:TDragObject;
   //semaphore
   psem,psemwait: THandle;
   {$ENDIF}

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

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

custom tabs

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

///add
procedure exitlabel_add(var a: TLabel; var b:TShape);
begin
if activelabel_add=a then exit;
b.visible:=false;
a.Font.Color:=clgray;
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;
a.Font.Color:=clDefault;
b.visible:=true;
setlabelpanel_add(a);
end;

procedure enterlabel_add(var a: TLabel; var b:TShape);
begin
if activelabel_add=a then exit;
b.visible:=true;
a.Font.Color:=clDefault;
end;

///extract
procedure exitlabel_extract(var a: TLabel; var b:TShape);
begin
if activelabel_extract=a then exit;
b.visible:=false;
a.Font.Color:=clgray;
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;
a.Font.Color:=clDefault;
b.visible:=true;
setlabelpanel_extract(a);
end;

procedure enterlabel_extract(var a: TLabel; var b:TShape);
begin
if activelabel_extract=a then exit;
b.visible:=true;
a.Font.Color:=clDefault;
end;

///apps subpage
procedure exitlabel_apps(var a: TLabel; var b:TShape);
begin
if activelabel_apps=a then exit;
b.visible:=false;
a.Font.Color:=clgray;
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;
b.visible:=true;
a.Font.Color:=clDefault;
setlabelpanel_apps(a);
end;

procedure enterlabel_apps(var a: TLabel; var b:TShape);
begin
if activelabel_apps=a then exit;
b.visible:=true;
a.Font.Color:=clDefault;
end;

///options
procedure exitlabel_options(var a: TLabel; var b: TPanel);
begin
if activelabel_options=a then exit;
a.Font.Color:=clgray;
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(executable_path+'res'+DirectorySeparator+'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(executable_path+'res'+DirectorySeparator+'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(executable_path+'res'+DirectorySeparator+'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)
        +Form_peach.LabelLang2.Hint+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:=PLBLUE;
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:=PVLBLUE;
end;

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

text and translation

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

function valorize_text:integer;
var
   s:ansistring;
begin
valorize_text:=-1;
try
readln(t,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 get_fallback_text(s:ansistring);
begin
if copy(s,0,pos(':',s)-1)='txt_4_9_frame' then begin txt_4_9_frame:=copy(s,pos(':',s)+2,length(s)-pos(':',s)); exit; end;
//removed, shown only as example
end;

function fallback_valorize_text:integer;
var
   s:ansistring;
begin
fallback_valorize_text:=-1;
repeat
readln(t,s);
get_fallback_text(s);
until eof(t) or (s='=== end PeaZip text group ===');
if eof(t)=false then fallback_valorize_text:=0;
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;
ButtonUn7zaTo1.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;
ButtonUn7zaTo1.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;
ButtonUn7zaTo1.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;
ButtonUn7zaTo1.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;
ButtonUn7zaTo1.Glyph:=Bextractallto_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;
ButtonUn7zaTo1.Glyph:=Bextractallto;
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 settoolnilicon;
begin
with Form_peach do
begin
ButtonUn7za1.Glyph:=nil;
ButtonUn7za4.Glyph:=nil;
ButtonUn7zaTo.Glyph:=nil;
ButtonUn7zaTo1.Glyph:=nil;
ButtonUn7za5.Glyph:=nil;
ButtonCut.Glyph:=nil;
ButtonCopy.Glyph:=nil;
ButtonPaste.Glyph:=nil;
ButtonOpenWith.Glyph:=nil;
ButtonProperties.Glyph:=nil;
ButtonRename.Glyph:=nil;
ButtonRename1.Glyph:=nil;
ButtonDelete.Glyph:=nil;
ButtonDup.Glyph:=nil;
ButtonNF.Glyph:=nil;
ButtonDup1.Glyph:=nil;
ButtonImgResize.Glyph:=nil;
ButtonImgCrop.Glyph:=nil;
ButtonImgRL.Glyph:=nil;
ButtonImgRR.Glyph:=nil;
end;
end;

procedure settooltext;
begin
with Form_peach do
begin
ButtonUn7zaTo.Caption:=txt_caption_extract;
ButtonUn7zaTo1.Caption:=txt_ext_allto+'...';
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_6_6_pdupfind;
ButtonNF.Caption:=txt_cnewfolder;
ButtonDup1.Caption:=txt_6_6_pdupfind;
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 settooltextnil;
begin
with Form_peach do
begin
ButtonUn7zaTo.Caption:='';
ButtonUn7zaTo1.Caption:='';
ButtonUn7za1.Caption:='';
ButtonUn7za4.Caption:='';
ButtonUn7za5.Caption:='';
ButtonCut.Caption:='';
ButtonCopy.Caption:='';
ButtonPaste.Caption:='';
ButtonProperties.Caption:='';
ButtonRename.Caption:='';
ButtonRename1.Caption:='';
ButtonDup.Caption:='';
ButtonNF.Caption:='';
ButtonDup1.Caption:='';
ButtonImgResize.Caption:='';
ButtonImgCrop.Caption:='';
ButtonImgRL.Caption:='';
ButtonImgRR.Caption:='';
ButtonCut.Hint:=txt_cut;
ButtonCopy.Hint:=txt_copy;
ButtonPaste.Hint:=txt_paste;
ButtonOpenWith.Hint:=ButtonOpenWith.Caption; ButtonOpenWith.Caption:='';
ButtonProperties.Hint:=txt_4_5_properties;
ButtonRename.Hint:=txt_rename;
ButtonRename1.Hint:=txt_rename;
ButtonDelete.Hint:=ButtonDelete.Caption; ButtonDelete.Caption:='';
ButtonDup.Hint:=txt_6_6_pdupfind;
ButtonNF.Hint:=txt_cnewfolder;
ButtonDup1.Hint:=txt_6_6_pdupfind;
ButtonImgResize.Hint:=txt_4_8_t;
ButtonImgCrop.Hint:=txt_4_8_crop;
ButtonImgRL.Hint:=txt_4_8_rl;
ButtonImgRR.Hint:=txt_4_8_rr;
end;
end;

procedure settoolbtnw(refw:integer; glyph_on_side:boolean);
begin
with Form_peach do
begin
psetbuttonwidth(ButtonUn7zato,refw,glyph_on_side);
psetbuttonwidth(ButtonUn7zato1,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;
ButtonUn7zaTo1.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 setlargetoolbar1;
begin
with Form_peach do
begin
PanelBarOpen.Height:=lbarheight;
PanelBarOpen2.Height:=lbarheight;
PanelBarOpen3.Height:=lbarheight;
settoolglyphtop;
settoolmargin;
settoolspacing(1);
settoolbigicon;
settooltext;
settoolbtnw((20*qscaleimages) div 100,false);
end;
toolsize:=1;
end;

procedure setlargetoolbar2;
begin
with Form_peach do
begin
PanelBarOpen.Height:=mbarheight;
PanelBarOpen2.Height:=mbarheight;
PanelBarOpen3.Height:=mbarheight;
settoolglyphleft;
settoolmargin;
settoolspacing((6*qscaleimages) div 100);
settoolbigicon;
settooltext;
settoolbtnw((24*qscaleimages) div 100,true);
end;
toolsize:=0;
end;

procedure setlargetoolbar3;
begin
with Form_peach do
begin
PanelBarOpen.Height:=mbarheight;
PanelBarOpen2.Height:=mbarheight;
PanelBarOpen3.Height:=mbarheight;
settoolglyphtop;
settoolmargin;
settoolspacing(1);
settoolbigicon;
settooltextnil;
settoolbtnw((16*qscaleimages) div 100,false);
end;
toolsize:=2;
end;

procedure setsmalltoolbar1;
begin
with Form_peach do
begin
PanelBarOpen.Height:=mbarheight;
PanelBarOpen2.Height:=mbarheight;
PanelBarOpen3.Height:=mbarheight;
settoolglyphtop;
settoolmargin;
settoolspacing(1);
settoolsmallicon;
settooltext;
settoolbtnw((12*qscaleimages) div 100,false);
end;
toolsize:=3;
end;

procedure setsmalltoolbar2;
var
   smallheight:integer;
begin
with Form_peach do
begin
smallheight:=PanelListBar.Height;
if smallheight=0 then smallheight:=barheight;
PanelBarOpen.Height:=smallheight;
PanelBarOpen2.Height:=smallheight;
PanelBarOpen3.Height:=smallheight;
ButtonUn7za4.Height:=ctrlback.height;
settoolglyphleft;
settoolmargin;
settoolspacing((3*qscaleimages) div 100);
settoolsmallicon;
settooltext;
settoolbtnw((16*qscaleimages) div 100,true);
end;
toolsize:=4;
end;

procedure setsmalltoolbar3;
var
   smallheight:integer;
begin
with Form_peach do
begin
smallheight:=PanelListBar.Height;
if smallheight=0 then smallheight:=barheight;
PanelBarOpen.Height:=smallheight;
PanelBarOpen2.Height:=smallheight;
PanelBarOpen3.Height:=smallheight;
ButtonUn7za4.Height:=ctrlback.height;
settoolglyphtop;
settoolmargin;
settoolspacing(1);
settoolsmallicon;
settooltextnil;
settoolbtnwfixed;
end;
toolsize:=5;
end;

procedure settexttoolbar;
var
   smallheight:integer;
begin
with Form_peach do
begin
smallheight:=PanelListBar.Height;
if smallheight=0 then smallheight:=barheight;
PanelBarOpen.Height:=smallheight;
PanelBarOpen2.Height:=smallheight;
PanelBarOpen3.Height:=smallheight;
ButtonUn7za4.Height:=ctrlback.height;
settoolglyphleft;
settoolmargin;
settoolspacing((4*qscaleimages) div 100);
settoolnilicon;
settooltext;
settoolbtnw(16,false);
end;
toolsize:=6;
end;

procedure set_adveditcl(i:integer);
begin
case i of
   1: Form_peach.Labelcbsampleadvanced.caption:=advedit1before+delimiter+'%f'+delimiter+advedit1after;
   2: Form_peach.Labelcbsampleadvanced.caption:=advedit2before+delimiter+'%f'+delimiter+advedit2after;
   3: Form_peach.Labelcbsampleadvanced.caption:=advedit3before+delimiter+'%f'+delimiter+advedit3after;
   4: Form_peach.Labelcbsampleadvanced.caption:=advedit4before+delimiter+'%f'+delimiter+advedit4after;
   5: Form_peach.Labelcbsampleadvanced.caption:=advedit5before+delimiter+'%f'+delimiter+advedit5after;
   6: Form_peach.Labelcbsampleadvanced.caption:=advedit6before+delimiter+'%f'+delimiter+advedit6after;
   7: Form_peach.Labelcbsampleadvanced.caption:=advedit7before+delimiter+'%f'+delimiter+advedit7after;
   8: Form_peach.Labelcbsampleadvanced.caption:=advedit8before+delimiter+'%f'+delimiter+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_desktop) do
   begin
   ImageIndex:=36;
   SelectedIndex:=36;
   end;
with treeview1.Items.Add(treeview1.selected,txt_2_9_home) do
   begin
   ImageIndex:=42;
   SelectedIndex:=42;
   end;
with treeview1.Items.Add(treeview1.selected,txt_2_4_documents) do
   begin
   ImageIndex:=2;
   SelectedIndex:=2;
   end;
if usr_downloads<>'' then
   with treeview1.Items.Add(treeview1.selected,txt_3_1_downloads) do
      begin
      ImageIndex:=43;
      SelectedIndex:=43;
      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_desktop) do
   begin
   ImageIndex:=36;
   SelectedIndex:=36;
   end;
with treeview1.Items.AddChild(treeview1.selected,txt_2_9_home) do
   begin
   ImageIndex:=42;
   SelectedIndex:=42;
   end;
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_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;

   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

Form_peach.treeview1.Items.Beginupdate;

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
      Form_peach.treeview1.Items.Clear
   else
      for i:=Form_peach.TreeView1.Items.Count-1 downto Form_Peach.StringGridAddress1.RowCount+1 do Form_peach.TreeView1.Items[i].Delete;
   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:=0;
   SelectedIndex:=0;
   end;

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

Form_Peach.StringGridAddress1.Beginupdate;
Form_Peach.StringGridAddress1.SortColRow(true,8);
with Form_peach.TreeView1.Items.AddChild(Form_peach.treeview1.selected,Form_Peach.StringGridAddress1.Cells[8,1]) do
   begin
   Form_Peach.StringGridAddress1.Cells[9,1]:='1';
   Selected:=true;
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
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[8,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[8,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[8,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[8,i]) do
         begin
         Selected:=true;
         ImageIndex:=3;
         SelectedIndex:=3;
         end;
   end;

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[8,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,'');
treeview1.selected:=nil;
Form_peach.TreeView1.TopItem:=Form_peach.TreeView1.Items[0];

treeview1.Items.Endupdate;
end;
end;

procedure assign_guitext; //set text
var
   i:integer;
begin
Form_peach.Caption:=APPMAIN;
with Form_peach do
begin
try
CheckBoxNoConf.Caption:=txt_7_3_noconfdel;
CheckBoxBrotli.Caption:=txt_7_3_maxbr;
CheckBoxZstd.Caption:=txt_7_3_maxzstd;
CheckBoxstl.Caption:=txt_7_3_stl;
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;
pmtabsm.Caption:=txt_6_4_tabbar;
pmtabsnew.Caption:=txt_6_4_new;
pmtabsclose.Caption:=txt_3_6_close;
pmtabscloseother.Caption:=txt_6_4_closeallother;
pmtabscloseright.Caption:=txt_6_4_closeright;
pmtabscollapse.Caption:=txt_6_4_collapse;
pmtabsexpand.Caption:=txt_6_4_expand;
po_tabsopen.Caption:=txt_6_4_openintab;
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';
po_browseralgo.Caption:=txt_algo;
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;
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;
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_lowercase.Caption:=txt_5_5_lower;
po_rename_filesonly.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;
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;
ButtonUn7zaTo1.Hint:=txt_ext_allto+'... (Ctrl+E / F12)';
ButtonUn7za1.Hint:=txt_caption_test;
ButtonUn7za5.Hint:=txt_2_8_convert;
pmjumpmusic.caption:=txt_5_0_music;
pmjumpmusic1.caption:=txt_5_0_music;
pmjumppictures.caption:=txt_5_0_pictures;
pmjumppictures1.caption:=txt_5_0_pictures;
pmjumpvideos.caption:=txt_5_0_videos;
pmjumpvideos1.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;
pmhbc1.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;
pmh0s1.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_3_1_more;
po_sysmore.Caption:=txt_3_1_more;
pmbcmisc.Caption:=txt_misc;
pmmisc.Caption:=txt_misc;
menuitemopen_powershell.Caption:=txt_5_0_ps;
MenuItemPowerShell.Caption:=txt_5_0_ps;
pmbcps.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;
pmbccp.Caption:=txt_cphere;
pmbcnewinst.Caption:=txt_peazip_new;
pmnewinst.Caption:=txt_peazip_new;
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;
mprelist.Caption:=txt_4_9_listth;
imagesp.Hint:=txt_2_9_navbar;
mbrowsersizes.Caption:=txt_2_9_st;
mbrowsersizem.Caption:=txt_2_9_mt;
mbrowsersizel.Caption:=txt_2_9_lt;
org_small.Caption:=txt_2_9_st;
org_medium.Caption:=txt_2_9_mt;
org_large.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)';
org_a.Caption:=txt_browser;
mprelightlist.Caption:=txt_4_8_listno;
mprelight.Caption:=txt_4_8_detailsno;
mpredetails.Caption:=txt_4_8_details;
mpreaverage.Caption:=txt_4_8_iconm;
mprelarge.Caption:=txt_4_8_iconl;
org_aprelist.Caption:=txt_4_9_listth;
org_aprelightlist.Caption:=txt_4_8_listno;
org_aprelight.Caption:=txt_4_8_detailsno;
org_apredetails.Caption:=txt_4_8_details;
org_apreaverage.Caption:=txt_4_8_iconm;
org_aprelarge.Caption:=txt_4_8_iconl;
pmstyle1.Caption:=txt_4_8_detailsno;
pmstyle2.Caption:=txt_4_8_details;
pmstyle3.Caption:=txt_4_8_listno;
pmstyle4.Caption:=txt_4_9_listth;
pmstyle5.Caption:=txt_4_8_iconm;
pmstyle6.Caption:=txt_4_8_iconl;
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;
themes_download.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+' (Ctrl+Shift+Alt+E)';
MenuItemExtAllHereSmart.caption:=txt_7_1_smart+' (Ctrl+Shift+Alt+S)';
MenuItemExtAllHereNew.caption:=txt_7_1_new+' (Ctrl+Shift+Alt+N)';
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+'   ';
imageflat.hint:=txt_browser;
morganize.Caption:=txt_2_9_organize;
mlayout.Caption:=txt_layout;
maddress.Caption:=txt_2_9_address+' (Alt+3)';
mv0.Caption:=txt_2_9_none;
mv1.Caption:=txt_2_8_statusbar;
mv2.Caption:=txt_2_8_details;
mv3.Caption:=txt_bookmarks;
mv5.Caption:=txt_list_history;
mv5b.Caption:=txt_5_0_sh;
mv6.Caption:=txt_2_7_clipboard;
pmmstatus_status.Caption:=txt_2_8_statusbar;
pmmstatus_details.Caption:=txt_2_8_details;
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;
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;
po_openasarchive.Caption:=txt_2_8_viewasarchive+' '+txt_2_8_experimental;
mopenasarchive.Caption:=txt_2_8_viewasarchive+' '+txt_2_8_experimental;
mbrowser.Caption:=txt_browser;
mswapbars.Caption:=txt_3_7_swapbars;
mstatusbar.Caption:=txt_2_8_statusbar+' (Alt+8)';
mnavbar.Caption:=txt_2_9_navbar+' (Alt+4)';
mnavigation.Caption:=txt_2_9_nav;
mtree.Caption:=txt_2_9_tree;
mnavfun.Caption:=txt_4_8_fun;
mnavnone.Caption:=txt_2_9_none;
mDetails.Caption:=txt_2_8_details;
mrowselect.Caption:=txt_2_8_rowselect;
org_rowselect.Caption:=txt_2_8_rowselect;
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_path;
pmArchivemenu.Caption:=txt_file;
pmAdvanced.Caption:=txt_2_6_advanced;
pmemb0.Caption:=txt_bookmarks;
pmemr0.Caption:=txt_list_history;
pmamb0.Caption:=txt_bookmarks;
pmamr0.Caption:=txt_list_history;
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;
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+'...';
pmtabbbookmarks.Caption:=txt_bookmarks;
mtabsfbookmarks.Caption:=txt_bookmarks;
pmtabhbookmarks.Caption:=txt_bookmarks;
pmfunb.Caption:=txt_bookmarks;
pmtabbfilesystem.Caption:=txt_fs;
mtabsffs.Caption:=txt_fs;
pmtabhfilesystem.Caption:=txt_fs;
pmfunfs.Caption:=txt_fs;
pmtabbhistory.Caption:=txt_list_history;
mtabsfhistory.Caption:=txt_list_history;
pmtabhhistory.Caption:=txt_list_history;
pmfunhistory.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;
pmJumpDocuments1.Caption:=txt_2_4_documents;
pmJumpusers.Caption:=txt_4_6_users;
pmJumpusers1.Caption:=txt_4_6_users;
pmquickhome.Caption:=txt_2_9_home;
pmquickdesk.Caption:=txt_desktop;
pmquickop.Caption:=txt_open_path;
pmquickoa.Caption:=txt_openarchive;
pmquicksd.Caption:=txt_searchanddrag;
pmJumppubhome.Caption:=txt_2_9_home+' - '+txt_2_9_public;
pmJumppubhome1.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;
pmJumppubdoc1.Caption:=txt_2_4_documents+' - '+txt_2_9_public;
pmjumprecent.Caption:=txt_list_history;
pmjumprecent1.Caption:=txt_list_history;
pmjumpdownloads.Caption:=txt_3_1_downloads;
pmjumpdownloads1.Caption:=txt_3_1_downloads;
pmjumpsearches.Caption:=txt_3_1_src;
pmjumpsearches1.Caption:=txt_3_1_src;
pmjumplibraries.Caption:=txt_3_1_lib;
pmjumplibraries1.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;
CheckBoxTBW.Caption:=txt_2_4_tb;
mEnvstr.Caption:=txt_2_3_envstr;
po_Envstr.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[4]:=txt_custom;
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;
ImageInfoArchive2.Hint:=txt_archive_hint;
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;
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;
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;
Labelstatus4.Caption:='';
Labelstatus6.Caption:=txt_2_7_output;
Labelstatus7.Caption:=txt_2_7_output;
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}
cbdeleteinputmode.DropDownCount:=3;
cbdeleteinputmode.Items.Append(txt_quickdelete);
cbdeleteinputmode.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode.Items.Append(txt_securedelete);
{$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}
cbdeleteinputmode1.DropDownCount:=3;
cbdeleteinputmode1.Items.Append(txt_quickdelete);
cbdeleteinputmode1.Items.Append(txt_5_2_zerofiles);
cbdeleteinputmode1.Items.Append(txt_securedelete);
{$ENDIF}
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+'      ';
cbdeleteinputmode1.ItemIndex:=0;
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;
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;
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;
CheckBoxAutoOpen.Caption:=txt_2_7_oop;
CheckBoxAutoOpen1.Caption:=txt_2_7_oop;
CheckBoxSameArc.Caption:=txt_5_2_oadd;
CheckBoxSameExt.Caption:=txt_5_2_oext;
CheckBoxnameasparentfolder.Caption:=txt_3_7_nameasparent;
CheckBoxzpaqall.Caption:=txt_7_2_zpaqall;
CheckBoxzpaqabsolute.Caption:=txt_6_4_absolute;
CheckBoxzpaqforce.Caption:=txt_overwrite;
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+'   ';
LabelTitleOptions2.Caption:=txt_2_6_advanced+'   ';
Labeloaenc.Caption:=txt_2_5_encoding;
Label6.Caption:=txt_3_1_sccenc;
CheckBoxEncoding1.Caption:=txt_3_2_7zutf8nonascii;
CheckBoxJobEncoding.Caption:=txt_2_5_encpj;
CheckBoxDragDrop.Caption:=txt_6_8_ndrop;
CheckBoxEditArchives.Caption:=txt_6_9_autou;
mForceSyncedits.Caption:=txt_6_9_forceu;
mForceSynceditsClear.Caption:=txt_7_2_updateclear;
mForceClear.Caption:=txt_7_2_clearnoupdate;
CheckBoxClosePeaZip.Caption:=txt_7_2_autoclosepeazip;
CheckBoxClosePeaZip1.Caption:=txt_7_2_autoclosepeazip;
{$IFNDEF MSWINDOWS}CheckBoxDragDrop.Enabled:=false;{$ENDIF}
CheckBoxShowVolatile.Caption:=txt_6_5_showvolatile;
CheckBoxAutoOpenTar.Caption:=txt_7_0_autoopentar;
CheckBoxForceOpen.Caption:=txt_6_5_force;
CheckBoxForceEdit.Caption:=txt_6_6_forcemodify;
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;
Labelogreset.Caption:=txt_6_5_privacy+' / '+txt_reset;
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;
CheckBoxIgnoreSel.Caption:=txt_ignore_sel;
CheckBoxIgnoreDisp.Caption:=txt_ignore_disp;
CheckBoxIntDir.Caption:=txt_5_5_intdir;
CheckBoxPrebrowse.Caption:=txt_browser;
CheckBoxBrowseNotVerbose.Caption:='7z / p7zip -bb0 '+txt_faster;
CheckBoxPrebrowse.Hint:=txt_quickbrowse_hint;
Labeloamext.Caption:=txt_caption_extract;
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+'   ';
LabelOptsub1.Caption:=txt_check;
Labeloptsub3.Caption:=txt_dispaly;
Labeloptsub4.Caption:=txt_browser;
cbcheckall.Caption:=txt_performall;
LabelOptsub2.Caption:=txt_erase_hint;
Labelpasses.Caption:=txt_passes;
theme_label1.Hint:=txt_reset_theme;
LabelResetTheme.Caption:=txt_3_5_managecustomthemes;
LabelConfigurePeaZip.Caption:=txt_3_0_configure;
LabelConfigurePeaZip1.Caption:=txt_3_0_configure;
LabelConf1.Caption:=txt_3_2_conf;
LabelConfigureSendTo.Caption:=txt_3_1_sendto;
LabelAppPath.Caption:=txt_3_3_apppath;
LabelLang2.Caption:=txt_localization;
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;
Label7.Caption:=txt_3_1_workingdir;
ComboBoxBrowser.Items.Strings[0]:=txt_level_normal;
ComboBoxBrowser.Items.Strings[1]:=txt_level_fast;
ComboBoxBrowser.Items.Strings[2]:=txt_level_fastest;
ComboBoxWD.Items.Strings[0]:=txt_2_7_output;
ComboBoxWD.Items.Strings[1]:=txt_3_1_systmp;
ComboBoxWD.Items.Strings[2]:=txt_custom;
ComboBoxWD.Items.Strings[3]:=txt_2_9_none;
ComboBoxWD.Items.Strings[4]:=txt_2_9_none+' '+txt_6_7_nop;
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_2_6_plsmart;
RadioGroup6.Items.Strings[2]:=txt_autoclose;
LabelResetBookmarks.Hint:=txt_hard_reset_hint;
LabelTheme1.Caption:=txt_themename;
LabelTheme2.Caption:=txt_author;
LabelTheme3.Caption:=txt_license;
themesave_label.Caption:=txt_create_theme;
CheckBoxThemeBars.Caption:=txt_3_7_themedbars;
LabelColor1.Caption:=txt_pea_appcolor;
LabelDefaultColor1.Caption:=txt_reset;
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_reset+' '+'peazip-tmp';
LabelResetPM.Caption:=txt_reset+' '+txt_4_3_pwman;
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;
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;
pmhrefresh.Caption:=txt_fefreshf5;
mf3.caption:=txt_searchfor;
mf4up.caption:=txt_up;
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;
mArchive.Caption:=txt_browser;
mtoolbar.Caption:=txt_2_9_toolbar+' (Alt+2)';
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_datetime;
mcatt.Caption:=txt_attributes;
mccrc.Caption:=txt_check_select;
mcfree.Caption:=txt_free;
mcfs.Caption:=txt_fs;
mbrowsersort.Caption:=txt_3_7_sort+' (Alt+5)';
mthumbimages.Caption:=txt_4_0_thim;
org_thumb.Caption:=txt_4_0_thim;
msimplesearch.Caption:=txt_4_1_simplesearch;
mrecsearch.Caption:=txt_4_3_recsrc;
pmjumpbreadcrumb.Caption:=txt_4_3_breadcrumb;
po_sortby.Caption:=txt_3_7_sort;
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;
mtt.Caption:=txt_2_9_lt+' 1';
mtm1.Caption:=txt_2_9_lt+' 2';
mtm2.Caption:=txt_2_9_lt+' 3';
mts.Caption:=txt_2_9_st+' 1';
mts2.Caption:=txt_2_9_st+' 2';
mts3.Caption:=txt_2_9_st+' 3';
mtvs.Caption:=txt_2_9_vst;
mtn.Caption:=txt_2_9_none;
mshowmenu.Caption:=txt_2_9_showmenu+' (Alt+1)';
MenuItemOrganizeMbar.Caption:=txt_2_9_showmenu;
MenuItemOrganizeToolbar.Caption:=txt_4_5_shtool;
MenuItemOrganizeAddressbar.Caption:=txt_4_5_shaddress;
MenuItemOrganizeNavbar.Caption:=txt_4_5_shnav;
MenuItemOrganizeStatusbar.Caption:=txt_4_5_shstatus;
org_details.Caption:=txt_2_8_details;
org_list.Caption:=txt_caption_list;
org_icons.Caption:=txt_3_4_smallicons;
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;
mgotolayout.Caption:=txt_2_7_goarclayout;
mgotoextlayout.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;
mBench.Caption:=txt_sysbenchmark;
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;
mprofilebrotli.Caption:=txt_7_2_fbrotlicomp;
mprofilezstd.Caption:=txt_7_2_fzstandardcomp;
mprofilesave.Caption:=txt_7_2_savecompsettings;
mprofileload.Caption:=txt_7_2_loadcompsettings;
msavecompsettings.Caption:=txt_7_2_savecompsettings;
mloadcompsettings.Caption:=txt_7_2_loadcompsettings;
pmtabbfun.Caption:=txt_open;
mtabsffun.Caption:=txt_open;
pmtabhfun.Caption:=txt_open;
pmfunfun.Caption:=txt_open;
mDefaults.Caption:=txt_settings;
mHelp.Caption:=txt_2_5_help;
mAbout.Caption:=txt_about+'...';
mupdate.caption:=txt_4_5_update;
mplugins.caption:=txt_5_5_plugin;
labelabout2.caption:=txt_5_5_plugin;
mPeaSiteMirror.Caption:=txt_peazip_web;
mPeaSupport.Caption:=txt_peazip_help;
mPeaFAQ.Caption:='FAQ';
mPeaTracker.Caption:=txt_3_7_tracker;
MenuItemDonations.Caption:=txt_3_7_donations;
mpeahelpoffline.Caption:=txt_2_5_offline_help+' (EN, .pdf)';
LabelUpdates.Caption:=txt_4_5_update;
LabelDonations.Caption:=txt_3_7_donations;
mtutorial.Caption:=txt_2_5_offline_help;
po_addtoarchive.Caption:=txt_add;
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;
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;
pmtabaddbookmarks.Caption:=txt_add_tobookmarks;
pmbcorganizebookmarks.Caption:=txt_2_9_organize;
pmtaborganizebookmarks.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;
pmrecycle.Caption:=txt_4_7_recycle;
pmfunaz.Caption:=txt_4_8_fun;
pmfunop.Caption:=txt_open_path;
pmfunoa.Caption:=txt_openarchive;
pmfunsd.Caption:=txt_searchanddrag;
pmfunex.Caption:=txt_explore_path;
pmfunpr.Caption:=txt_4_5_properties;
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;
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:='CRC32';
pmcheck.Caption:='CRC32';
po_checksumsel.Caption:='CRC32 '+txt_4_1_selected;
po_pdup.Caption:=txt_6_6_pdupfind;
pmpdup.Caption:=txt_6_6_pdupfind;
po_analyzefolders.Caption:=txt_7_0_af;
pmpanalyzefolders.Caption:=txt_7_0_af;
po_deduplicate.Caption:=txt_4_1_duplicatesfind+', CRC32';
pmdeduplicate.Caption:=txt_4_1_duplicatesfind+', CRC32';
po_deduplicatesel.Caption:=txt_4_1_duplicatesfind+', CRC32 '+txt_4_1_selected;
po_systemtools.Caption:=txt_systools;
po_fm.Caption:=txt_4_6_fm;
mtarchive.Caption:=txt_4_6_am;
mtfile.Caption:=txt_4_6_fm;
pmmtool_archive.Caption:=txt_4_6_am;
pmmtool_file.Caption:=txt_4_6_fm;
pmmtool_image.Caption:=txt_4_8_imagemanager;
mtimage.Caption:=txt_4_8_imagemanager;
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)';
po_renmenu.Caption:=txt_rename;
pmrename.Caption:=txt_rename+' (F2)';
po_copyto.Caption:=txt_copyto;
po_moveto.Caption:=txt_moveto;
po_copy.Caption:=txt_copy+' (Ctrl+C)';
po_cut.Caption:=txt_cut+' (Ctrl+X)';;
po_paste.Caption:=txt_paste+' (Ctrl+V)';
po_setpw.Caption:=txt_2_7_setpw;
msetpw.Caption:=txt_2_7_setpw;
pmqesetpw.Caption:=txt_2_7_setpw;
madvfilters.caption:=txt_advfilters;
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;
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;
pmfunsweb.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;
pmJump1.Caption:=txt_mypc;
pmJump5.Caption:=txt_mypc;
MenuItemOpen_pc.Caption:=txt_mypc;
MenuItemArchive_pc.Caption:=txt_mypc;
pmJump3.Caption:=txt_2_9_home;
pmJump7.Caption:=txt_2_9_home;
pmJump2.Caption:=txt_desktop;
pmJump6.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;
ComboBoxUPX.Text:=txt_best;
ComboBoxPEACompression1.Text:=txt_default_compression;
ComboBoxArchive7.Text:=txt_newarchive;
ComboBoxArchive8.Text:=txt_singlethread;
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;
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[7]:=txt_custom;
ComboBoxTheme.Items.Strings[8]:=txt_3_6_ethemes;
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;
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[4]:=txt_custom;
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;
except end;
end;
end;

function valorize_headers:integer;
var
   s:ansistring;
begin
valorize_headers:=-1;
readln(t,s);//translator(s)
Form_peach.LabelLang2.Hint:=Form_peach.LabelLang2.Hint+' - '+s;
readln(t,s);//last revision's translator(s)
Form_peach.LabelLang2.Hint:=Form_peach.LabelLang2.Hint+' - '+s;
readln(t,s);//last revision date
Form_peach.LabelLang2.Hint:=Form_peach.LabelLang2.Hint+' - '+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,(executable_path+'res'+directoryseparator+'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
   Form_peach.LabelLang2.Hint:=s;
   readln(t,s); //version; PEAZIPREVISION is ignored since revisions are meant to share the same text
   Form_peach.LabelLang2.Hint:=Form_peach.LabelLang2.Hint+' - '+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_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 edited files in archive, and 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 tar archive in 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 possible duplicates';
txt_6_6_forcemodify:='Try to edit non explicitly supported file types';
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';
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 plugin and addon';
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 plugin and addon';
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 fastest';
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, Password Manager)?';
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 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:='Download 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 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:='System 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:='System integration';
txt_3_0_resettmp:='Reset peazip-tmp';
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:='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 each object to a separate archive';
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:='Enter 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 selection options';
txt_2_7_exthint:='Drag here archives to extract, or right-click for more selection 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 keep open to inspect task''s report';
txt_2_6_plsmart:='Keep open only if needed (error, list or test reports)';
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. 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 cannot be used by PeaZip GUI in passwords under current system, please change password or chose Console mode in Backend binaries user interface in Options > Settings';
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" fileds 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 file(s)';
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 user interface';
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:='Close PeaLauncher when task completes';
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 objects';
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 / archive 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 policy';
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 do:';
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:='Pea application 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 (F5)';
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';
txt_savejobdefinition:='Save task definition';
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 objects';
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 history/bookmarks';
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 contruction. 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 below. 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;
var
   errchar:ansistring;
begin
{$IFDEF MSWINDOWS}
errchar:='"';
{$ELSE}
errchar:='''';
{$ENDIF}
pMessageWarningOK(errchar+' '+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, custome 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:=executable_path+'res'+directoryseparator;
end;

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

procedure loadlargeicons(icon_size:integer);
var
   abitmap:TBitmap;
   icon_sizep,icon_sizepp:integer;
begin
with form_peach do
   begin
   icon_sizep:=(icon_size*qscaleimages) div 100;
   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);
   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);
   ListView1.LargeImages:=il96;
   end;
   192: begin
   clearimagelist(il192);
   abitmap:=Tbitmap.Create;
   setpbitmap_tobitmap(Barchivesupported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bexesupported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bfilesupported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(BFolder96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Blink96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bunsupported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdvd_supported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bfd_supported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bhd_supported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bram_supported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bremote_supported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bremovable_supported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Baudio96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bspreadsheet96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Btxt96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bvideo96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bweb96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bimage96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bpresentation96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bpdf96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bbat96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bsupported96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdll96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bmail96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdb96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bgif96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bico96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bvector96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Binfo,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bsearch,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bbookmark,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Broot,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bsystemtools,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bexpand,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bgopath,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bjpeg96,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bdesk,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bplaceshistory,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bbookmarkadd,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Brun,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bpreview,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   setpbitmap_tobitmap(Bapps,abitmap,icon_sizep);
   il192.Add(abitmap,nil);
   ListView1.LargeImages:=il192;
   end;
   end;
   end;
end;

procedure loadsmallicons(icon_size:integer);
var
   abitmap:TBitmap;
   icon_sizep:integer;
begin
with form_peach do
   begin
   icon_sizep:=(icon_size*qscaleimages) div 100;
   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);
   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);
   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);
   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);
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;
i16res:=(16*qscaleimages) div 100;
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;
   Bnonthemed2:=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;
   Bpriority1:=TBitmap.Create;
   Bpriority2:=TBitmap.Create;
   Bpriority3:=TBitmap.Create;
   Bpriority4:=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,Bnonthemed2);
   il_nonthemed.getbitmap(3,Bnonthemed3);
   il_nonthemed.getbitmap(4,Bnonthemed4);
   il_nonthemed.getbitmap(5,Bnonthemed5);
   il_nonthemed.getbitmap(6,Bnonthemed6);
   il_nonthemed.getbitmap(7,Bnonthemed7);
   il_nonthemed.getbitmap(8,Bnonthemed8);
   il_nonthemed.getbitmap(9,Bnonthemed9);
   il_nonthemed.getbitmap(10,Bnonthemed10);
   il_nonthemed.getbitmap(11,Bnonthemed11);
   il_nonthemed.getbitmap(12,Bpriority1);
   il_nonthemed.getbitmap(13,Bpriority2);
   il_nonthemed.getbitmap(14,Bpriority3);
   il_nonthemed.getbitmap(15,Bpriority4);
   il_nonthemed.getbitmap(16,Bp1);
   il_nonthemed.getbitmap(17,Bp2);
   il_nonthemed.getbitmap(18,Bp3);
   il_nonthemed.getbitmap(19,Bp4);
   il_nonthemed.getbitmap(20,Bp5);
   il_nonthemed.getbitmap(21,Bp6);
   il_nonthemed.getbitmap(22,Bp7);
   il_nonthemed.getbitmap(23,Bp8);
   ImageListDlg.getbitmap(0,binfodlg);
   ImageListDlg.getbitmap(1,bwarningdlg);
   ImageListDlg.getbitmap(2,berrordlg);
   setpbitmap(Bnonthemed0,i16res);
   setpbitmap(Bnonthemed1,i16res);
   setpbitmap(Bnonthemed2,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(Bpriority1,i16res);
   setpbitmap(Bpriority2,i16res);
   setpbitmap(Bpriority3,i16res);
   setpbitmap(Bpriority4,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;
   mtoolbar.Bitmap:=Bnonthemed1;
   mnavbar.Bitmap:=Bnonthemed3;
   mstatusbar.Bitmap:=Bnonthemed4;
   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;
   mAdmin.Bitmap:=Bnonthemed7;
   ctrlext.Glyph:=Bnonthemed8;
   ctrlarc.Glyph:=Bnonthemed8;
   imagemn1.Width:=i16res;
   imagemn1.Height:=i16res;
   imagemn1.Picture.Bitmap:=Bnonthemed8;
   imagemn2.Width:=i16res;
   imagemn2.Height:=i16res;
   imagemn2.Picture.Bitmap:=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;
   imagemn3.Width:=i16res;
   imagemn3.Height:=i16res;
   imagemn3.Picture.Bitmap:=Bnonthemed10;
   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;
   Bextractallto:=TBitmap.Create;
   Bextractalln:=TBitmap.Create;
   Bextractallton:=TBitmap.Create;
   Bextractall_big:=TBitmap.Create;
   Bextractallto_big:=TBitmap.Create;
   Bextractalln_big:=TBitmap.Create;
   Bextractallton_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;
   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,Bextractallton);
   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,Bextractalln);
   il_dtheme_16.getbitmap(74,Bextractallto);
   il_dtheme_16.getbitmap(75,Bbrowserdetails);
   il_dtheme_16.getbitmap(76,Bbrowserlist);
   il_dtheme_16.getbitmap(77,Bbrowsericons);
   il_dtheme_16.getbitmap(78,Bbrowserdetailslarge);
   il_dtheme_16.getbitmap(79,Bbrowserlistlarge);
   il_dtheme_16.getbitmap(80,Bbrowsericonslarge);
   il_dtheme_16.getbitmap(81,Bhomefolder);
   il_dtheme_16.getbitmap(82,Bdownloadfolder);
   il_dtheme_16.getbitmap(83,Bcloudfolder);
   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_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_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,Bextractallton_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);
   il_dtheme_tool32.getbitmap(18,Bextractalln_big);
   il_dtheme_tool32.getbitmap(19,Bextractallto_big);
   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,Bextractallton);
   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,Bextractalln);
   il_nonthemed.getbitmap(6,Bextractallto);
   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,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,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,Bdetailsfs);
   il_nonthemed.getbitmap(6,BArchive_big);
   il_nonthemed.getbitmap(6,Bconvert_big);
   il_nonthemed.getbitmap(6,Bextractall_big);
   il_nonthemed.getbitmap(6,Bextractallton_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);
   il_nonthemed.getbitmap(6,Bextractalln_big);
   il_nonthemed.getbitmap(6,Bextractallto_big);
   end;
   if (upcase(theme_name)<>'NOGRAPHIC-EMBEDDED') and (upcase(theme_name)<>'TEN-EMBEDDED') then
   begin
   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(Bextractallton,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extractall-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(Bextractalln,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extract-tonew.png');
   getthemedbitmap(Bextractallto,thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extractall.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(Bextractallton_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extractall-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(Bextractalln_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extract-tonew.png');
   getthemedbitmap(Bextractallto_big,thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extractall.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(Bextractallton,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(Bextractalln,i16res);
   setpbitmap(Bextractallto,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(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(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(Bdetailsfs,i32res);
   setpbitmap(BArchive_big,i32res);
   setpbitmap(Bconvert_big,i32res);
   setpbitmap(Bextractall_big,i32res);
   setpbitmap(Bextractallton_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);
   setpbitmap(Bextractalln_big,i32res);
   setpbitmap(Bextractallto_big,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;
   org_aprelight.Bitmap:=Bbrowserdetails;
   org_apredetails.Bitmap:=Bbrowserdetailslarge;
   org_aprelightlist.Bitmap:=Bbrowserlist;
   org_aprelist.Bitmap:=Bbrowserlistlarge;
   org_apreaverage.Bitmap:=Bbrowsericons;
   org_aprelarge.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;
   ImageAddress.Width:=i16res;
   ImageAddress.Height:=i16res;
   ImageAddress.Picture.Bitmap:=Bsystemtools;
   MenuItemOpen_root.Bitmap:=Bsystemtools;
   po_systemtools.Bitmap:=Bsystemtools;
   po_filetools.Bitmap:=BDefaults;
   //pmcbroot.Bitmap:=Bsystemtools;
   MenuItemopendesktop.Bitmap:=Bdesk;
   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;
   ImageInfoOpen4.Width:=i96res;
   ImageInfoOpen4.Height:=i96res;
   ImageInfoOpen4.Transparent:=true;
   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;
   ImageInfoArchive2.Width:=i16res;
   ImageInfoArchive2.Height:=i16res;
   ImageInfoArchive2.Picture.Bitmap:=Binfo;
   ImageInfoArchive2.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;
   pmJumppubhome1.Bitmap:=bfolder;
   pmJumpusers.Bitmap:=bfolder;
   pmJumpusers1.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;
   MenuItemOpen_documents1.Bitmap:=bfilesupported;
   MenuItemOpen_downloads1.Bitmap:=Bdownloadfolder;
   MenuItemOpen_music.Bitmap:=baudio;
   MenuItemOpen_pictures.Bitmap:=bimage;
   MenuItemOpen_videos.Bitmap:=bvideo;
   MenuItemOpen_pubdoc.Bitmap:=bfolder;
   //pmjumpsbook.Bitmap:=BBookmark;
   pmjump3.Bitmap:=Bhomefolder;
   pmjump7.Bitmap:=Bhomefolder;
   pmjumpdocuments.Bitmap:=BFileSupported;
   pmjumpdocuments1.Bitmap:=BFileSupported;
   pmjumppubdoc.Bitmap:=bfolder;
   pmjumppubdoc1.Bitmap:=bfolder;
   pmjumprecent.Bitmap:=bfolder;
   pmjumprecent1.Bitmap:=bfolder;
   pmjumpsearches.Bitmap:=bfolder;
   pmjumpsearches1.Bitmap:=bfolder;
   pmjumplibraries.Bitmap:=bfolder;
   pmjumplibraries1.Bitmap:=bfolder;
   pmjumpdownloads.Bitmap:=Bdownloadfolder;
   pmjumpdownloads1.Bitmap:=Bdownloadfolder;
   pmjumpmusic.Bitmap:=baudio;
   pmjumpmusic1.Bitmap:=baudio;
   pmjumppictures.Bitmap:=bimage;
   pmjumppictures1.Bitmap:=bimage;
   pmjumpvideos.Bitmap:=bvideo;
   pmjumpvideos1.Bitmap:=bvideo;
   MenuItem3.Bitmap:=Bclearlayout;
   pmrecycle.Bitmap:=Bclearlayout;
   po_recycle.Bitmap:=Bclearlayout;
   pmbookmarks.Bitmap:=BBookmarkadd;
   mb0.Bitmap:=BBookmarkadd;
   mb24.Bitmap:=BBookmark;
   pmbcaddbookmark.Bitmap:=BBookmarkadd;
   pmtabaddbookmarks.Bitmap:=BBookmarkadd;
   pmbcorganizebookmarks.Bitmap:=BBookmark;
   pmtaborganizebookmarks.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;
   po_setpw.Bitmap:=Blocker2;
   pmqesetpw.Bitmap:=Blocker2;
   imageflat.Glyph:=Bbrowserdetails;
   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;
   mFlat.Bitmap:=Bexpand;
   pmFlat.Bitmap:=Bexpand;
   po_flat.Bitmap:=Bexpand;
   mGotolayout.Bitmap:=Bnav;
   mPeaSite.Bitmap:=BWeb;
   mPeaSiteMirror.Bitmap:=BWeb;
   mPeaSupport.Bitmap:=BWeb;
   mPeafaq.Bitmap:=BWeb;
   mPeaTracker.Bitmap:=BWeb;
   mpeahelpoffline.Bitmap:=BPdf;
   mRefresh.Bitmap:=Brefresh;
   //mSystem.Bitmap:=Bsystemtools;
   pmBrowser.Bitmap:=Bnav;
   mgoBrowser.Bitmap:=Bnav;
   pmAddFile.Bitmap:=Bunsupported;
   pmAddFolder.Bitmap:=Bfolder;
   pmLoadList.Bitmap:=Bloadlayout;
   pmSaveList.Bitmap:=Bsavelayout;
   //pmSearchAdd.Bitmap:=Bsearch;
   po_addtoarchive.Bitmap:=BArchive;
   mgotoextlayout.Bitmap:=Bnav;
   po_delete.Bitmap:=Bdelete;
   pmquickdelete.Bitmap:=Bdelete;
   po_zerofile.Bitmap:=Bwipe;
   pmzerofile.Bitmap:=Bwipe;
   po_exthere.Bitmap:=Bextractall;
   pmqeto.Bitmap:=Bextractallto;
   MenuItemExtAllTo.Bitmap:=Bextractallto;
   po_securedelete.Bitmap:=Bstop;
   pmsecuredelete.Bitmap:=Bstop;
   //pmcbroot.Bitmap:=Bsystemtools;
   //pmcbdesk.Bitmap:=Bdesk;
   //pmbchome.Bitmap:=Bfolder;
   pmjump1.Bitmap:=Bsystemtools;
   pmjump5.Bitmap:=Bsystemtools;
   pmqjmore.Bitmap:=bfolder;
   pmqjmore1.Bitmap:=bfolder;
   pmjump2.Bitmap:=Bdesk;
   pmjump6.Bitmap:=Bdesk;
   pmqjdropbox.Bitmap:=Bcloudfolder;
   pmqjdropbox1.Bitmap:=Bcloudfolder;
   pmqjmyboxfiles.Bitmap:=Bcloudfolder;
   pmqjmyboxfiles1.Bitmap:=Bcloudfolder;
   pmqjgoogledrive.Bitmap:=Bcloudfolder;
   pmqjgoogledrive1.Bitmap:=Bcloudfolder;
   pmqjonedrive.Bitmap:=Bcloudfolder;
   pmqjonedrive1.Bitmap:=Bcloudfolder;
   pmqjskydrive.Bitmap:=Bcloudfolder;
   pmqjskydrive1.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;
   pmbc.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;
   Form_peach.theme_label.Caption:=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:=1; //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:='';
autoopen:=0; //don't open output dir by default when job completes
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 EAX AES 256
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
{$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)
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
work_dir:=0;
custom_work_path:='';
extoptarc:=2; //overwrite policy for extraction with arc (skip existing files)
ignorepathextand:=1; //extract and... extracts to current path ignoring internal archive's path: on (all ignore paths irectives 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
removeintdir:=1;//remove intermediate dir on extract to new folder: on
prebrowse:=1; //stop browsing if archive is listed in more than prebrowsesize*1M blocks of memory (dramatically faster for very much populated archives): on by default
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+)
enumd:=1; //do not enumerate content of directories added for archiving operations
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
defaulttabsmenu:=2;//address bar menu 1 bookmarks 2 filesystem (default) 3 history 4 functions
multi_option:=1; //generic multithreading
favdelete:=0; //default delete mode for delete option concatenated with archive/extract operations 0 Recycle (Windows) 1 Quick 2 Zero 3 Secure
doptadd:=0;// do not delete originals after archiving by default
doptext:=0;// do not delete originals after extraction by default
prebrowsesize:=128; //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:=3;  //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:=3; //default Compression level for zip: average
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
sni7z:=0; //manage NT security information default off
sns7z:=1; //manage NTFS alternate streams default on
stl7z:=0;//set 7z/p7zip archive time from most recent file time
algodisp:=0; //default way to display checksum/hash
algoall:=0; //default don't use all algorithms for file check; below are specified algorithms to be used
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:=1;
{$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:=0; //encode non ascii chars as utf8 in 7z
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;
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:=9;
az:=true;
col1size:=COL1D;
col2size:=COL2D;
col3size:=COL3D;
col4size:=COL4D;
col5size:=COL5D;
col6size:=COL6D;
col7size:=COL7D;
tonewfolder:=0;
parallelarchive:=0;
defaultextractpath:='';
defaultarchivepath:='';
rowselect:=false;
thighlight:=false;
ctype:=true;
csize:=true;
cpacked:=true;
cdate:=true;
catt:=true;
ccrc:=true;
cfree:=true;
cfs:=true;
toolsize:=0;
swapbars:=false;
showmenu:=true;
navbar:=0;
addressbar:=1;
ptabbar:=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;
noconfdel:=0;
tryopenwerrors:=1;
forcecanbechanged:=0;
nativedrag:=1;
autosync:=1;
ignorepathdd:=0;
level_brotli:=3;
level_zstd:=2;
renselonly:=1;//fixed to 1, 0 would to allow rename all displayed items regarldess selection
renfilesonly:=0;
defaultspanning:=0;//single volume, do not split output
spansize:=100;
spanunit:=2;
autoclosepeazip:=0;
zpaqall:=0;
zpaqabsolute:=0;
zpaqforce:=0;
advopdictionary:=0;
advopword:=4;
advoppasses:=0;
advopblocksize:=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 (themetoolbarsd<0) or (themetoolbarsd>1) then themetoolbarsd:=0;
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 environemnt 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 (dafault 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.pmJumppubdoc1.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.pmJumppubhome1.Visible:=false;
   Form_peach.MenuItemArchive_pubdoc.Visible:=false;
   Form_peach.MenuItemOpen_pubdoc.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;
   Form_peach.pmJumpdownloads1.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;
   Form_peach.pmJumpsearches1.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;
   Form_peach.pmJumplibraries1.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.pmqjdropbox1.visible:=Form_peach.pmqjdropbox.visible;
Form_peach.pmqjmyboxfiles1.visible:=Form_peach.pmqjmyboxfiles.visible;
Form_peach.pmqjgoogledrive1.visible:=Form_peach.pmqjgoogledrive.visible;
Form_peach.pmqjonedrive1.visible:=Form_peach.pmqjonedrive.visible;
Form_peach.pmqjskydrive1.visible:=Form_peach.pmqjskydrive.visible;
Form_peach.pmqjubuntuone1.visible:=Form_peach.pmqjubuntuone.visible;
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>2) then autoclosegwrap:=1;
if (enc7zscc>2) then enc7zscc:=0;
if (browsersd>4) then browsersd:=0;
if (autoopen>1) then autoopen:=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>6) 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 (showpwfield>1) then showpwfield:=0;
if (setencfn>1) then setencfn:=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>4) then work_dir:=0;
if (extoptarc>2) then extoptarc:=0;
if (ignorepathextand>1) then ignorepathextand:=1;
if (ignorepathdisp>1) then ignorepathdisp:=0;
if (ignorepathsel>1) then ignorepathsel:=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>2) then prebrowse:=1;
if (nonverboselog>1) then nonverboselog:=1;
if (use7zunrar5>1) then use7zunrar5:=1;
if (enumd>1) then enumd:=1;
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 (defaulttabsmenu<1) or (defaulttabsmenu>4) then defaulttabsmenu:=2;
if (multi_option>6) then multi_option:=1;
{$IFDEF MSWINDOWS}if (favdelete<0) or (favdelete>3) then favdelete:=0;{$ELSE}if (favdelete<1) or (favdelete>3) then favdelete:=1; {$ENDIF}
if (prebrowsesize<1) or (prebrowsesize>200) then prebrowsesize:=128; //200 roughly allows to parse in memory 1 million files
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>1024) 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>768) 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>1024) then ws_gw_left:=DGWLEFT;
if (ws_gw_top<0) or (ws_gw_top>768) 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') 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') then method_zip:='Deflate';
if (openw_all7z>1) then openw_all7z:=0;
if (sni7z>1) then sni7z:=0;
if (sns7z>1) then sns7z:=1;
if (stl7z>1) then stl7z:=0;
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>1) then algoall:=0;
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:=1;
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>1) then mcuzip:=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 (lastbar<0) or (lastbar>6) 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>13) then listsortcol:=9;
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 (tonewfolder>1) then tonewfolder:=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;
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 (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>1) 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 (noconfdel<0) or (noconfdel>1) then noconfdel:=0;
if (tryopenwerrors<0) or (tryopenwerrors>1) then tryopenwerrors:=1;
if (forcecanbechanged<0) or (forcecanbechanged>1) then forcecanbechanged:=0;
if (level_brotli>=7) then level_brotli:=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 (zpaqall>1) then zpaqall:=0;
if (zpaqabsolute>1) then zpaqabsolute:=0;
if (zpaqforce>1) then zpaqforce:=0;
end;

procedure set_items_height;
var
   refsize: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);
//bars
pbarh:=(8*qscale div 100);
pbarhsmall:=(4*qscale div 100);
barheight:=(32*qscale div 100);//32
mbarheight:=(48*qscale div 100);//48
lbarheight:=(60*qscale div 100);//60
PanelBottom.Height:=barheight;
PanelListBar.Height:=barheight;
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;
//shapes
shapeFStotal.Width:=8*qscale div 100;
shapeFStotal.Height:=12*qscale div 100;
shapeFSfree.Width:=shapeFStotal.Width;
//tabs
tabheight:=36*qscale div 100;//36
tabheightl:=mbarheight;//48
PanelTitleAdd.Height:=tabheight;
PanelTitleExtract.Height:=tabheight;
PanelTitleApps.Height:=tabheight;
PanelActAdd.Height:=tabheightl;
PanelActExt.Height:=tabheightl;
PanelActDefaults.Height:=tabheightl;
FormPM.PanelTitlePM.Height:=tabheight;
//grid
rowsize:=22*qscale div 100;
intcellhw:=3*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;
//graphics
icon_sizeplus:=(20*qscaleimages) div 100;
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*qscaleimages) div 100;
il48.Width:=(48*qscaleimages) div 100;
il96 := TimageList.Create(owner);
il96.Height:=(96*qscaleimages) div 100;
il96.Width:=(96*qscaleimages) div 100;
il192 := TimageList.Create(owner);
il192.Height:=(192*qscaleimages) div 100;
il192.Width:=(192*qscaleimages) div 100;
end;
end;

procedure apply_theme; //apply colors but not opacity
begin
getpcolors(stringtocolor(color1),stringtocolor(color2),stringtocolor(color3));
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.PanelFileBrowserOptions.Color:=stringtocolor(color3);
Form_peach.PanelBarOpen.Color:=Form_peach.PanelFileBrowserOptions.Color;
Form_peach.Panelnav4.Color:=Form_peach.PanelFileBrowserOptions.Color;
Form_peach.PanelListBar.Color:=StringToColor(collow);
Form_peach.Panelnav5.Color:=StringToColor(colbtnhigh);
Form_peach.Splitter2.Color:=StringToColor(colmid);
Form_peach.Splitter3.Color:=Form_peach.Splitter2.Color;
Form_peach.Shape5.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Bevel10.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Shape1.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Bevel1.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Bevel11.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Bevel15.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Bevel17.Pen.Color:=Form_peach.Splitter2.Color;
Form_peach.Bevel19.Pen.Color:=Form_peach.Splitter2.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.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;
Form_peach.BevelTitleOpt1.Color:=PLBLUE;
Form_peach.BevelTitleOpt2.Color:=PLBLUE;
Form_peach.BevelTitleOpt3.Color:=PLBLUE;
Form_peach.BevelTitleOpt4.Color:=PLBLUE;
Form_peach.BevelTitleOpt5.Color:=PLBLUE;
Form_peach.BevelTitleOpt6.Color:=PLBLUE;
Form_peach.BevelTitleOpt7.Color:=PLBLUE;
Form_peach.BevelTitleOpt8.Color:=PLBLUE;
if lastbar=0 then
   Form_peach.Splitter1.Color:=stringtocolor(color2)
else
   Form_peach.Splitter1.Color:=stringtocolor(colbtnhigh);
update_info;
Form_peach.Panelnav2MouseLeave(nil);
//Grayed fonts
Form_peach.labelinfo1.Font.Color:=clGray;
Form_peach.labelinfo2.Font.Color:=clGray;
Form_peach.labelinfo3.Font.Color:=clGray;
Form_peach.labelinfo4.Font.Color:=clGray;
Form_peach.labelStatus.Font.Color:=clGray;
Form_peach.LabelStatusdisplayed.Font.Color:=clGray;
//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.ColorButton3.Color:=stringtocolor(color3);
Form_peach.ColorButton3.ButtonColor:=stringtocolor(color3);
if autosizetoolbarbutton=1 then
   Form_peach.CheckBoxTBW.State:=cbChecked
else
   Form_peach.CheckBoxTBW.State:=cbUnchecked;
if themetoolbars=1 then
   Form_peach.CheckBoxThemeBars.State:=cbChecked
else
   Form_peach.CheckBoxThemeBars.State:=cbUnchecked;
load_icons;
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);
readln(conf,color1);
readln(conf,color2);
readln(conf,color3);
readln(conf,color4);
readln(conf,color5);
readln(conf,s);
themetoolbars:=strtoint(s);//themetoolbar replaces unused rowheigh variable
readln(conf,s);
//itemheight:=strtoint(s);
readln(conf,s);
//autosizeitemheight:=strtoint(s);
readln(conf,s);
autosizetoolbarbutton:=strtoint(s);
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);
themetoolbarsd:=strtoint(s);
readln(conf,s);
//itemheightd:=strtoint(s);
readln(conf,s);
//autosizeitemheightd:=strtoint(s);
readln(conf,s);
autosizetoolbarbuttond:=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+delimiter+'%f'+delimiter+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then owcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else owcustom10.Caption:=advedit2before+delimiter+'%f'+delimiter+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then owcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else owcustom11.Caption:=advedit3before+delimiter+'%f'+delimiter+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then owcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else owcustom12.Caption:=advedit4before+delimiter+'%f'+delimiter+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then owcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else owcustom13.Caption:=advedit5before+delimiter+'%f'+delimiter+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then owcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else owcustom14.Caption:=advedit6before+delimiter+'%f'+delimiter+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then owcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else owcustom15.Caption:=advedit7before+delimiter+'%f'+delimiter+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then owcustom16.Caption:=StringGridCustedit1.Cells[1,8]
else owcustom16.Caption:=advedit8before+delimiter+'%f'+delimiter+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;
if advedit1before+advedit2before+advedit3before+advedit4before+advedit5before+advedit6before+advedit7before+advedit8before+
   advedit1after+advedit2after+advedit3after+advedit4after+advedit5after+advedit6after+advedit7after+advedit8after<>'' then owseparator2.visible:=true else owseparator2.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;
pmmoreseparator.visible:=owseparator2.visible;
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;
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+delimiter+'%f'+delimiter+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then eowcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else eowcustom10.Caption:=advedit2before+delimiter+'%f'+delimiter+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then eowcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else eowcustom11.Caption:=advedit3before+delimiter+'%f'+delimiter+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then eowcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else eowcustom12.Caption:=advedit4before+delimiter+'%f'+delimiter+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then eowcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else eowcustom13.Caption:=advedit5before+delimiter+'%f'+delimiter+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then eowcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else eowcustom14.Caption:=advedit6before+delimiter+'%f'+delimiter+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then eowcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else eowcustom15.Caption:=advedit7before+delimiter+'%f'+delimiter+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then eowcustom16.Caption:=StringGridCustedit1.Cells[1,8]
else eowcustom16.Caption:=advedit8before+delimiter+'%f'+delimiter+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;
//if custedit1+custedit2+custedit3+custedit4+custedit5+custedit6+custedit7+custedit8<>'' then eowseparator1.visible:=true else eowseparator1.visible:=false;
if advedit1before+advedit2before+advedit3before+advedit4before+advedit5before+advedit6before+advedit7before+advedit8before+
   advedit1after+advedit2after+advedit3after+advedit4after+advedit5after+advedit6after+advedit7after+advedit8after<>'' then eowseparator2.visible:=true else eowseparator2.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+delimiter+'%f'+delimiter+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then powcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else powcustom10.Caption:=advedit2before+delimiter+'%f'+delimiter+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then powcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else powcustom11.Caption:=advedit3before+delimiter+'%f'+delimiter+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then powcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else powcustom12.Caption:=advedit4before+delimiter+'%f'+delimiter+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then powcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else powcustom13.Caption:=advedit5before+delimiter+'%f'+delimiter+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then powcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else powcustom14.Caption:=advedit6before+delimiter+'%f'+delimiter+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then powcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else powcustom15.Caption:=advedit7before+delimiter+'%f'+delimiter+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then powcustom16.Caption:=StringGridCustedit1.Cells[1,8]
else powcustom16.Caption:=advedit8before+delimiter+'%f'+delimiter+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;
//if custedit1+custedit2+custedit3+custedit4+custedit5+custedit6+custedit7+custedit8<>'' then powseparator1.visible:=true else powseparator1.visible:=false;
if advedit1before+advedit2before+advedit3before+advedit4before+advedit5before+advedit6before+advedit7before+advedit8before+
   advedit1after+advedit2after+advedit3after+advedit4after+advedit5after+advedit6after+advedit7after+advedit8after<>'' then powseparator2.visible:=true else powseparator2.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+delimiter+'%f'+delimiter+advedit1after;
if StringGridCustedit1.Cells[1,2]<>'' then aowcustom10.Caption:=StringGridCustedit1.Cells[1,2]
else aowcustom10.Caption:=advedit2before+delimiter+'%f'+delimiter+advedit2after;
if StringGridCustedit1.Cells[1,3]<>'' then aowcustom11.Caption:=StringGridCustedit1.Cells[1,3]
else aowcustom11.Caption:=advedit3before+delimiter+'%f'+delimiter+advedit3after;
if StringGridCustedit1.Cells[1,4]<>'' then aowcustom12.Caption:=StringGridCustedit1.Cells[1,4]
else aowcustom12.Caption:=advedit4before+delimiter+'%f'+delimiter+advedit4after;
if StringGridCustedit1.Cells[1,5]<>'' then aowcustom13.Caption:=StringGridCustedit1.Cells[1,5]
else aowcustom13.Caption:=advedit5before+delimiter+'%f'+delimiter+advedit5after;
if StringGridCustedit1.Cells[1,6]<>'' then aowcustom14.Caption:=StringGridCustedit1.Cells[1,6]
else aowcustom14.Caption:=advedit6before+delimiter+'%f'+delimiter+advedit6after;
if StringGridCustedit1.Cells[1,7]<>'' then aowcustom15.Caption:=StringGridCustedit1.Cells[1,7]
else aowcustom15.Caption:=advedit7before+delimiter+'%f'+delimiter+advedit7after;
if StringGridCustedit1.Cells[1,8]<>'' then aowcustom16.Caption:=StringGridCustedit1.Cells[1,8]
else aowcustom16.Caption:=advedit8before+delimiter+'%f'+delimiter+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 readconf_defaults;
var
   s:ansistring;
   srec,srecf:Thistarray;
begin
readln(conf,s);
readln(conf,s);
readln(conf,s); autoclosegwrap:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); autoopen:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); zaout:=strtoint(s); zaout1:=zaout;
readln(conf,s);
readln(conf,s);
readln(conf,s); clipmode:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); indir:=s;
readln(conf,s);
readln(conf,s);
readln(conf,s); df:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pf:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pcompr:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pobj:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pvol:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); pstream:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); salgo:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); showguihints:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); showpwfield:=strtoint(s);
readln(conf,s);
readln(conf,s);
readln(conf,s); 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;
Form_peach.pmhr11.Caption:=Form_peach.mRecent1.Caption;
Form_peach.pmhr12.Caption:=Form_peach.mRecent2.Caption;
Form_peach.pmhr13.Caption:=Form_peach.mRecent3.Caption;
Form_peach.pmhr14.Caption:=Form_peach.mRecent4.Caption;
Form_peach.pmhr15.Caption:=Form_peach.mRecent5.Caption;
Form_peach.pmhr16.Caption:=Form_peach.mRecent6.Caption;
Form_peach.pmhr17.Caption:=Form_peach.mRecent7.Caption;
Form_peach.pmhr18.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);
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);
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;
Form_peach.pmhr1f1.Caption:=Form_peach.mRecent1f.Caption;
Form_peach.pmhr2f1.Caption:=Form_peach.mRecent2f.Caption;
Form_peach.pmhr3f1.Caption:=Form_peach.mRecent3f.Caption;
Form_peach.pmhr4f1.Caption:=Form_peach.mRecent4f.Caption;
Form_peach.pmhr5f1.Caption:=Form_peach.mRecent5f.Caption;
Form_peach.pmhr6f1.Caption:=Form_peach.mRecent6f.Caption;
Form_peach.pmhr7f1.Caption:=Form_peach.mRecent7f.Caption;
Form_peach.pmhr8f1.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);
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);
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,themetoolbars);
writeln(conf,'');
writeln(conf,'');
writeln(conf,inttostr(autosizetoolbarbutton));
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,themetoolbarsd);
writeln(conf,'');
writeln(conf,'');
writeln(conf,inttostr(autosizetoolbarbuttond));
end;

procedure writeconf_defaults;
begin
writeln(conf,'[language]');
writeln(conf,lang_file);
writeln(conf,'');
writeln(conf,'[pealauncher: 0: always keep open for inspection 1: (default) keep open only if errors are detected 2: always close when task ends]');
writeln(conf,inttostr(autoclosegwrap));
writeln(conf,'');
writeln(conf,'[pealauncher: open output directory when job 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 optimization: 0 no optimization 1 fast open routine, stop prebrowsing archives containing large number of files to preserve performances 2 do not prebrowse (may non correctly list some out of standard archives)]');
writeln(conf,inttostr(prebrowse));
writeln(conf,'');
writeln(conf,'[prebrowse size: don''t pre-browse 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, use all algorithms, single algorithms to be used]');
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[5].Width));
   if ccrc=false then writeln(conf,inttostr(col7size)) else writeln(conf,inttostr(Form_Peach.ListView1.Column[6].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 -mcu use UTF8 for file names that contain non-ASCII symbols 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 successfull 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 (slow): 1 no (default) 0 yes]');
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 explicitly supported file 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 single 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 --long=27]');
writeln(conf,inttostr(maxzstd));
writeln(conf,'');
writeln(conf,'[do not ask confirmation to delete after extraction / archiving]');
writeln(conf,inttostr(noconfdel));
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': result:=2;
'.xls','.xlt','.xlsx','.xltm','.xltx','.ods','.gnm','.gnumeric','.csv','.123',
'.sxc','.gsheet','.numbers','.numbers-tef','.dif': result:=13;
'.pps','.ppt','.pot','.pptx','.ppsx','.potx','.odp','.gslides': 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': 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;
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;//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;
   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 pmhr11.visible=true then pmhr11.Bitmap:=mRecent1.Bitmap;
if pmhr12.visible=true then pmhr12.Bitmap:=mRecent2.Bitmap;
if pmhr13.visible=true then pmhr13.Bitmap:=mRecent3.Bitmap;
if pmhr14.visible=true then pmhr14.Bitmap:=mRecent4.Bitmap;
if pmhr15.visible=true then pmhr15.Bitmap:=mRecent5.Bitmap;
if pmhr16.visible=true then pmhr16.Bitmap:=mRecent6.Bitmap;
if pmhr17.visible=true then pmhr17.Bitmap:=mRecent7.Bitmap;
if pmhr18.visible=true then pmhr18.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;
if pmhr1f1.visible=true then pmhr1f1.Bitmap:=mRecent1f.Bitmap;
if pmhr2f1.visible=true then pmhr2f1.Bitmap:=mRecent2f.Bitmap;
if pmhr3f1.visible=true then pmhr3f1.Bitmap:=mRecent3f.Bitmap;
if pmhr4f1.visible=true then pmhr4f1.Bitmap:=mRecent4f.Bitmap;
if pmhr5f1.visible=true then pmhr5f1.Bitmap:=mRecent5f.Bitmap;
if pmhr6f1.visible=true then pmhr6f1.Bitmap:=mRecent6f.Bitmap;
if pmhr7f1.visible=true then pmhr7f1.Bitmap:=mRecent7f.Bitmap;
if pmhr8f1.visible=true then pmhr8f1.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;
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;
Form_peach.pmhr1f1.Caption:=Form_peach.mRecent1f.Caption;
Form_peach.pmhr2f1.Caption:=Form_peach.mRecent2f.Caption;
Form_peach.pmhr3f1.Caption:=Form_peach.mRecent3f.Caption;
Form_peach.pmhr4f1.Caption:=Form_peach.mRecent4f.Caption;
Form_peach.pmhr5f1.Caption:=Form_peach.mRecent5f.Caption;
Form_peach.pmhr6f1.Caption:=Form_peach.mRecent6f.Caption;
Form_peach.pmhr7f1.Caption:=Form_peach.mRecent7f.Caption;
Form_peach.pmhr8f1.Caption:=Form_peach.mRecent8f.Caption;
Form_peach.pmhr1f1.Visible:=Form_peach.mRecent1f.Visible;
Form_peach.pmhr2f1.Visible:=Form_peach.mRecent2f.Visible;
Form_peach.pmhr3f1.Visible:=Form_peach.mRecent3f.Visible;
Form_peach.pmhr4f1.Visible:=Form_peach.mRecent4f.Visible;
Form_peach.pmhr5f1.Visible:=Form_peach.mRecent5f.Visible;
Form_peach.pmhr6f1.Visible:=Form_peach.mRecent6f.Visible;
Form_peach.pmhr7f1.Visible:=Form_peach.mRecent7f.Visible;
Form_peach.pmhr8f1.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.pmhr11.Caption:=Form_peach.mRecent1.Caption;
Form_peach.pmhr12.Caption:=Form_peach.mRecent2.Caption;
Form_peach.pmhr13.Caption:=Form_peach.mRecent3.Caption;
Form_peach.pmhr14.Caption:=Form_peach.mRecent4.Caption;
Form_peach.pmhr15.Caption:=Form_peach.mRecent5.Caption;
Form_peach.pmhr16.Caption:=Form_peach.mRecent6.Caption;
Form_peach.pmhr17.Caption:=Form_peach.mRecent7.Caption;
Form_peach.pmhr18.Caption:=Form_peach.mRecent8.Caption;
Form_peach.pmhr11.Visible:=Form_peach.mRecent1.Visible;
Form_peach.pmhr12.Visible:=Form_peach.mRecent2.Visible;
Form_peach.pmhr13.Visible:=Form_peach.mRecent3.Visible;
Form_peach.pmhr14.Visible:=Form_peach.mRecent4.Visible;
Form_peach.pmhr15.Visible:=Form_peach.mRecent5.Visible;
Form_peach.pmhr16.Visible:=Form_peach.mRecent6.Visible;
Form_peach.pmhr17.Visible:=Form_peach.mRecent7.Visible;
Form_peach.pmhr18.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.pmhr11.Visible:=Form_peach.mRecent1.Visible;
   Form_peach.pmhr12.Visible:=Form_peach.mRecent2.Visible;
   Form_peach.pmhr13.Visible:=Form_peach.mRecent3.Visible;
   Form_peach.pmhr14.Visible:=Form_peach.mRecent4.Visible;
   Form_peach.pmhr15.Visible:=Form_peach.mRecent5.Visible;
   Form_peach.pmhr16.Visible:=Form_peach.mRecent6.Visible;
   Form_peach.pmhr17.Visible:=Form_peach.mRecent7.Visible;
   Form_peach.pmhr18.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.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;
   Form_peach.pmhr1f1.Visible:=Form_peach.mRecent1f.Visible;
   Form_peach.pmhr2f1.Visible:=Form_peach.mRecent2f.Visible;
   Form_peach.pmhr3f1.Visible:=Form_peach.mRecent3f.Visible;
   Form_peach.pmhr4f1.Visible:=Form_peach.mRecent4f.Visible;
   Form_peach.pmhr5f1.Visible:=Form_peach.mRecent5f.Visible;
   Form_peach.pmhr6f1.Visible:=Form_peach.mRecent6f.Visible;
   Form_peach.pmhr7f1.Visible:=Form_peach.mRecent7f.Visible;
   Form_peach.pmhr8f1.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:=Bextractallto;
     MenuItemExtAllTo.Bitmap:=Bextractallto;
     ButtonUn7zaTo.Hint:=txt_ext_sel;
     ButtonUn7zaTo1.Hint:=txt_ext_allto;
     if toolsize<3 then
        begin
        ButtonUn7zaTo.Glyph:=Bextractall_big;
        ButtonUn7zaTo1.Glyph:=Bextractallto_big;
        end
     else
        if toolsize<6 then
           begin
           ButtonUn7zaTo.Glyph:=Bextractall;
           ButtonUn7zaTo1.Glyph:=Bextractallto;
           end;
     end;
  1: begin
     MenuItemOpen_ExtractHere.Bitmap:=Bextractalln;
     po_exthere.Bitmap:=Bextractalln;
     pmqeto.Bitmap:=Bextractallton;
     MenuItemExtAllTo.Bitmap:=Bextractallton;
     ButtonUn7zaTo.Hint:=txt_caption_extract+' '+txt_newfolder;
     ButtonUn7zaTo1.Hint:=txt_ext_allto+' '+txt_newfolder;
     if toolsize<3 then
        begin
        ButtonUn7zaTo.Glyph:=Bextractalln_big;
        ButtonUn7zaTo1.Glyph:=Bextractallton_big;
        end
     else
        if toolsize<6 then
           begin
           ButtonUn7zaTo.Glyph:=Bextractalln;
           ButtonUn7zaTo1.Glyph:=Bextractallton;
           end;
     end;
  end;
end;
end;

procedure updateconf;
begin
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;
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.CheckBoxAutoOpen1.State:=cbChecked;
   Form_peach.pmopenout.Checked:=true;
   Form_peach.mtoggleop.Checked:=true;
   end
else
   begin
   Form_peach.CheckBoxAutoOpen.State:=cbUnChecked;
   Form_peach.CheckBoxAutoOpen1.State:=cbUnChecked;
   Form_peach.pmopenout.Checked:=false;
   Form_peach.mtoggleop.Checked:=false;
   end;
if autoclosepeazip=1 then
   begin
   Form_peach.CheckBoxClosePeaZip.State:=cbChecked;
   Form_peach.CheckBoxClosePeaZip1.State:=cbChecked;
   end
else
   begin
   Form_peach.CheckBoxClosePeaZip.State:=cbUnChecked;
   Form_peach.CheckBoxClosePeaZip1.State:=cbUnChecked;
   end;
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}favdelete-1;{$ENDIF}
Form_peach.cbdeleteinputmode1.ItemIndex:={$IFDEF MSWINDOWS}favdelete;{$ELSE}favdelete-1;{$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;
if autosync=1 then Form_peach.CheckBoxEditArchives.State:=cbChecked else Form_peach.CheckBoxEditArchives.State:=cbUnChecked;
if ignorepathextand=1 then Form_peach.CheckBox4.State:=cbChecked else Form_peach.CheckBox4.State:=cbUnChecked;
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 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 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 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 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;
if nonverboselog=1 then Form_peach.CheckBoxBrowseNotVerbose.State:=cbChecked else Form_peach.CheckBoxBrowseNotVerbose.State:=cbUnChecked;
if use7zunrar5=1 then Form_peach.CheckBox7zunrar5.State:=cbChecked else Form_peach.CheckBox7zunrar5.State:=cbUnChecked;
if enumd=0 then Form_peach.CheckBoxEnumd.State:=cbChecked else Form_peach.CheckBoxEnumd.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 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 noconfdel=1 then Form_peach.CheckBoxNoConf.State:=cbChecked else Form_peach.CheckBoxNoConf.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;
if archivenameenc=1 then Form_peach.CheckBoxEncoding.State:=cbChecked else Form_peach.CheckBoxEncoding.State:=cbUnChecked;
if mcuzip=1 then Form_peach.CheckBoxEncoding1.State:=cbChecked else Form_peach.CheckBoxEncoding1.State:=cbUnChecked;
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;
if algoall=1 then
   begin
   Form_peach.cbcheckall.State:=cbChecked;
   end
else
   begin
   Form_peach.cbcheckall.State:=cbUnChecked;
   end;
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;
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 Form_peach.mdefaultextract.checked:=false else Form_peach.mdefaultextract.checked:=true;
Form_peach.mdefaultextract.caption:=txt_2_8_usedefaultoutpath+' '+defaultextractpath;
if defaultextractpath='' then Form_peach.pmusedefault.checked:=false else Form_peach.pmusedefault.checked:=true;
Form_peach.pmusedefault.caption:=txt_2_8_usedefaultoutpath+' '+defaultextractpath;
if defaultarchivepath='' then Form_peach.mdefaultarchive.checked:=false else Form_peach.mdefaultarchive.checked:=true;
Form_peach.mdefaultarchive.caption:=txt_2_8_usedefaultoutpath+' '+defaultarchivepath;
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:='ten-embedded';
   theme_author:='Giorgio Tani';
   theme_license:='LGPLv3';
   graphicsfolderd:='themes\ten-embedded\';
   dodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=ColorToString(PAPPCOL);
   color2d:=ColorToString(clWindow);
   color3d:=ColorToString(clForm);
   color4d:=ColorToString(clAppWorkspace);
   color5d:=ColorToString(clWindowText);
   themetoolbarsd:=0;
   //itemheightd:=1;
   //autosizeitemheightd:=0;
   autosizetoolbarbuttond:=0;
   end;
if (upcase(theme_name)=upcase('nographic-embedded')) then
   begin
   theme_name:='nographic-embedded';
   theme_author:='Giorgio Tani';
   theme_license:='LGPLv3';
   graphicsfolderd:='themes\nographic-embedded\';
   dodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=ColorToString(PAPPCOL);
   themetoolbarsd:=0;
   //itemheightd:=1;
   //autosizeitemheightd:=0;
   autosizetoolbarbuttond:=0;
   end;
if upcase(theme_name)='TEN-EMBEDDED' then Form_peach.ComboBoxTheme.ItemIndex:=0
else
   if upcase(theme_name)='NOGRAPHIC-EMBEDDED' then Form_peach.ComboBoxTheme.ItemIndex:=1
   else
      if upcase(theme_name)='CLASSIC' then Form_peach.ComboBoxTheme.ItemIndex:=2
      else
         if upcase(theme_name)='EXPERIENCE' then Form_peach.ComboBoxTheme.ItemIndex:=3
         else
            if upcase(theme_name)='FIRECRYSTAL' then Form_peach.ComboBoxTheme.ItemIndex:=4
            else
               if upcase(theme_name)='SEVEN' then Form_peach.ComboBoxTheme.ItemIndex:=5
               else
                  if upcase(theme_name)='TEN' then Form_peach.ComboBoxTheme.ItemIndex:=6
                  else
                     Form_peach.ComboBoxTheme.ItemIndex:=7;
end;

procedure load_default_theme;
begin
theme_name:='ten-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, ovveride 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;

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}
if desk_env=1 then custedit1:='gedit'
else
   if desk_env=2 then custedit1:='kedit';
StringGridCustedit.Cells[1,2]:='OpenOffice Writer';
custedit2:='oowriter';
StringGridCustedit.Cells[1,3]:='VLC Media Player';
custedit3:='vlc';
StringGridCustedit.Cells[1,4]:='Totem Movie Player';
custedit4:='totem';
StringGridCustedit.Cells[1,5]:='Amarok Audio Player';
custedit5:='amarock';
StringGridCustedit.Cells[1,6]:='Mozilla Firefox';
custedit6:='firefox';
StringGridCustedit.Cells[1,7]:='Gimp';
custedit7:='gimp';
StringGridCustedit1.Cells[1,1]:='F-Spot Photo Browser';
advedit1before:='f-spot -v ';
advedit1after:='';
advedit1alt:='f-spot -v';
{$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='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[12,i]='0' then
               begin
               Form_peach.StringGridList.Cells[7,i]:='';
               continue;
               end;
         filemode:=0;
         try
         assignfile(f,Form_peach.StringGridList.Cells[8,i]);
         filemode:=0;
         reset(f);
         except
         Form_peach.StringGridList.Cells[7,i]:='';
         continue;
         end;
         if mode='selected' then Form_peach.Caption:=Form_Peach.ListView1.Column[6].Caption+' ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...'
         else Form_peach.Caption:=Form_Peach.ListView1.Column[6].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[7,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[7,i]:=upcase(hexstr(@adler,sizeof(Adler)));
            2: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@CRC16,sizeof(CRC16)));
            4: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
            5: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@CRC64,sizeof(CRC64)));
            6: begin
               Form_peach.StringGridList.Cells[7,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[7,i]:=upcase(hexstr(@MD4Digest,sizeof(MD4Digest)));
            8: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@MD5Digest,sizeof(MD5Digest)));
            9: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@RMD160Digest,sizeof(RMD160Digest)));
           10: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA1Digest,sizeof(SHA1Digest)));
           11: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@Blake2sDigest,sizeof(Blake2sDigest)));
           12: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           13: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA3_256Digest,sizeof(SHA3_256Digest)));
           14: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@Blake2bDigest,sizeof(Blake2bDigest)));
           15: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           16: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA3_512Digest,sizeof(SHA3_512Digest)));
           17: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@WhirlDigest,sizeof(WhirlDigest)));
            end;
         Form_Peach.ListView1.Items[i-1].SubItems[5]:=Form_Peach.StringGridList.Cells[7,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[7,i];
   duplicate:=false;
   for j:=1 to Form_peach.StringGridList.Rowcount-1 do
      if (Form_peach.StringGridList.Cells[7,j]<>'')
      and (s=Form_peach.StringGridList.Cells[7,j])
      and (i<>j) then
         begin
         duplicate:=true;
         break;
         end;
   if duplicate=false then Form_peach.StringGridList.Cells[7,i]:=''
   else
      result:=result+1;
   Form_Peach.ListView1.Items[i-1].SubItems[5]:=Form_Peach.StringGridList.Cells[7,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[7,i];
   for j:=i+1 to Form_peach.StringGridList.Rowcount-1 do
      if (Form_peach.StringGridList.Cells[7,j]<>'')
      and (s=Form_peach.StringGridList.Cells[7,j]) then
         begin
         Form_peach.StringGridList.Cells[4,i]:='D';
         Form_peach.StringGridList.Cells[11,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[7,i]<>'' then result:=result+1;
end;

//procedure to deduplicate files, mode displayed: all in current folder / search filter; selected: all selected
procedure deduplicate(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='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[12,i]='0' then
               begin
               Form_peach.StringGridList.Cells[7,i]:='';
               continue;
               end;
         if countsize(Form_peach.StringGridList.Cells[3,i])<2 then continue;
         filemode:=0;
         try
         assignfile(f,Form_peach.StringGridList.Cells[8,i]);
         filemode:=0;
         reset(f);
         except
         continue;
         end;
         if mode='selected' then Form_peach.Caption:=txt_4_1_duplicatesfind+', '+Form_Peach.ListView1.Column[6].Caption+' ('+inttostr(t+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...'
         else Form_peach.Caption:=txt_4_1_duplicatesfind+', '+Form_Peach.ListView1.Column[6].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[7,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[7,i]:=upcase(hexstr(@adler,sizeof(Adler)));
            2: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@CRC16,sizeof(CRC16)));
            4: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
            5: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@CRC64,sizeof(CRC64)));
            6: begin
               Form_peach.StringGridList.Cells[7,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[7,i]:=upcase(hexstr(@MD4Digest,sizeof(MD4Digest)));
            8: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@MD5Digest,sizeof(MD5Digest)));
            9: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@RMD160Digest,sizeof(RMD160Digest)));
           10: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA1Digest,sizeof(SHA1Digest)));
           11: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@Blake2sDigest,sizeof(Blake2sDigest)));
           12: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA3_256Digest,sizeof(SHA3_256Digest)));
           13: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           14: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@Blake2bDigest,sizeof(Blake2bDigest)));
           15: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA3_512Digest,sizeof(SHA3_512Digest)));
           16: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           17: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@WhirlDigest,sizeof(WhirlDigest)));
            end;
         Form_peach.StringGridList.Cells[7,i]:=Form_peach.StringGridList.Cells[3,i]+'/'+Form_peach.StringGridList.Cells[7,i];
         Form_Peach.ListView1.Items[i-1].SubItems[5]:=Form_Peach.StringGridList.Cells[7,i];
         end;
   Form_peach.Caption:=txt_4_1_duplicatesfind+', '+Form_Peach.ListView1.Column[6].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;

//procedure to find possibly duplicate files
procedure possiblyduplicate(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='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[12,i]='0' then
               begin
               Form_peach.StringGridList.Cells[7,i]:='';
               continue;
               end;
         if countsize2(Form_peach.StringGridList.Cells[3,i])<2 then continue;
         filemode:=0;
         try
         assignfile(f,Form_peach.StringGridList.Cells[8,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[7,i]:=upcase(hexstr(@CRC32,sizeof(CRC32)));
         Form_peach.StringGridList.Cells[7,i]:=Form_peach.StringGridList.Cells[3,i]+'/'+Form_peach.StringGridList.Cells[7,i];
         Form_Peach.ListView1.Items[i-1].SubItems[5]:=Form_Peach.StringGridList.Cells[7,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;

//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[12,i]='0' then
               begin
               Form_peach.StringGridList.Cells[7,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[8,i]+directoryseparator,'*',faAnyFile,true,nfiles,ndirs,ctsize);
         Form_peach.StringGridList.Cells[7,i]:=inttostr(ndirs-1)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(ctsize));
         Form_Peach.ListView1.Items[i-1].SubItems[5]:=Form_Peach.StringGridList.Cells[7,i];
         if ndirs-1+nfiles=0 then //mark empty folders
            begin
            Form_Peach.StringGridList.Cells[4,i]:='E';
            Form_peach.StringGridList.Cells[11,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,'');
wingetdesk;
writeln(book,'0');
writeln(book,desktop_path);
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,'');
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,'');
{$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, ovveride 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;
   themetoolbars:=themetoolbarsd;
   autosizetoolbarbutton:=autosizetoolbarbuttond;
   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;
themetoolbars:=themetoolbarsd;
autosizetoolbarbutton:=autosizetoolbarbuttond;
//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-created 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;
try
   assignfile(aconf,executable_path+'res'+directoryseparator+'altconf.txt'); //load alternative configuration path (for conf and bookmarks)
   filemode:=0;
   reset(aconf);
   read_header(aconf);
   readln(aconf,s);
   readln(aconf,confpath);
   CloseFile(aconf);
if (confpath='same') or (confpath='"same"') or (confpath='''same''') or (confpath=' ') or (confpath='') then confpath:=executable_path+'res'+directoryseparator; //if confpath parameter is set to 'same' or empty use classic conf location (in res folder)
{$IFDEF MSWINDOWS}
if (confpath='appdata') or (confpath='"appdata"') or (confpath='''appdata''') or (confpath='%appdata%') then
   if wingetappdata(confpath)<>0 then confpath:=(GetEnvironmentVariable('APPDATA'))+'\PeaZip\'; //if wingetappdata fails use env variables
{$ENDIF}
{$IFDEF LINUX}
if (confpath='appdata') or (confpath='"appdata"') or (confpath='''appdata''') or (confpath='%appdata%') then confpath:=GetEnvironmentVariable('HOME')+'/.PeaZip/';
{$ENDIF}
{$IFDEF FREEBSD}
if (confpath='appdata') or (confpath='"appdata"') or (confpath='''appdata''') or (confpath='%appdata%') then confpath:=GetEnvironmentVariable('HOME')+'/.PeaZip/';
{$ENDIF}
{$IFDEF NETBSD}
if (confpath='appdata') or (confpath='"appdata"') or (confpath='''appdata''') or (confpath='%appdata%') then confpath:=GetEnvironmentVariable('HOME')+'/.PeaZip/';
{$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:=executable_path+'res'+directoryseparator; //if alternative configuration directory does not exist or is not accessible, use res path
result:=0;
except
   result:=-1;
   try CloseFile(aconf); except end;
end;
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<>'ten-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;
//this code for updating ComboBoxes content and ItemIndex (for 7za) at runtime works properly on Windows, on Linux the code seem not working properly, maybe basically because different graphical libraries are used by the very same code on the two systems so different cares should be taken in account.
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:=4;
   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.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:=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='LZMA2' then
      begin
      set_multi('on');
      Form_peach.ComboBoxArchive3.ItemIndex:=1;
      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='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 KB');
      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:=3;
         Form_peach.ComboBoxArchive6.ItemIndex:=2;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=10;
         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:=11;//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:=14;
         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 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:=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:=0;
         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:=1;
         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:=2;
         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:=3;
         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:=4;
         Form_peach.ComboBoxArchive5.ItemIndex:=12;
         Form_peach.ComboBoxArchive6.ItemIndex:=6;
         Form_peach.ComboBoxArchiveSolid.ItemIndex:=13;
         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;
   Form_peach.ComboBoxArchive3.DropDownCount:=5;
   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.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:=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;
         end;
      if compression_level=txt_level_fast then
         begin
         Form_peach.ComboBoxArchive4.ItemIndex:=2;
         Form_peach.ComboBoxArchive5.ItemIndex:=1;
         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;
   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 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,bname,f_ext: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;
   f_ext:=extractfileext(aname);
   cutextension(aname); //aname has the extension cut
   bname:=aname+f_ext; //bname has extension
   if directoryexists(str) then s:=bname //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_QUAD) or (t=STR_BROTLI) or (t=STR_ZSTD) then s:=bname;
   //full name if using split, to have filename.ext.001
   //full name if using Bzip2, 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:=bname; //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:=bname; //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(bname,length(bname)-3,4))='.TAR') then s:=bname; //don't strip .tar extension if compressing a single tar, to have filename.tar.compression
   if usefoldername=true then s:=bname;//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: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);
   sg.Cells[3,rc-1]:=nicenumber(inttostr(fsize));
   sg.Cells[4,rc-1]:='0';
   sg.Cells[5,rc-1]:='1';
   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;
   sg.Cells[8,rc-1]:=filename;
   sg.Cells[9,rc-1]:='2'+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));
   sg.Cells[4,rc-1]:='';
   if sg=Form_Peach.Stringgrid2 then
      if testext(filename)>=0 then
         if (testext(filename)>=500) and (testext(filename)<=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]:='2'+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;

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]:='1'+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 (enumd=1) and (tmpenumd=false) then
if (enumd=1) then
else
begin
//enumerate content
if sg=Form_peach.StringGrid1 then DirSizetc(foldername,'*',FaAnyFile,true,true,nfiles,ndirs,size,tpcompsize)
   else DirSize(foldername,'*',FaAnyFile,true,true,nfiles,ndirs,size);
sg.Cells[3,rc-1]:=nicenumber(inttostr(size));
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);
begin
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
   Form_peach.CheckBoxTarBefore.State:=cbChecked;
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 then begin 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;

procedure checkoutpath_archive;
begin
if form_peach.visible=true then
   if pos(STR_TMP,Form_peach.Edit5.Text)<>0 then
      Form_peach.Edit5.Color:=StringToColor(COLLOW)
   else
      Form_peach.Edit5.Color:=stringtocolor(color2);
end;

function detect_tmpintmp(testedpath:ansistring): boolean;
var
   s:ansistring;
begin
result:=false;
s:=testedpath;
if pos(STR_TMP,s)<>0 then
   begin
   s:=copy(s,pos(STR_TMP,s)+6,length(s)-pos(STR_TMP,s)-5);
   if pos(STR_TMP,s)<>0 then result:=true;
   end;
end;

procedure checkoutpath_extract;
begin
if form_peach.visible=true then
   if pos(STR_TMP,Form_peach.EditOpenOut.Text)<>0 then
      begin
      Form_peach.EditOpenOut.Color:=StringToColor(COLLOW);
      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]:=Form_peach.StringGrid1.ColWidths[1]+48;
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;
//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
   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;
status1:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize));
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)+'%';//' '+nicenumber(inttostr(tpcompsize div 100))+' ('+inttostr(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)+'%';//' '+nicenumber(inttostr(tpcompsize div 100))+' ('+inttostr(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]:=StringGrid2.ColWidths[1]+48;
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 updatecontent_ext;
var
   i,rc:integer;
begin
tfiles:=0;
tdirs:=0;
tsize:=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));
   end
else
   Form_peach.labelstatusex2.Caption:=inttostr(tdirs)+' '+txt_dirs+' '+inttostr(tfiles)+' '+txt_files+' '+nicenumber(inttostr(tsize));
if statuss<>'' then
   begin
   Form_peach.labelstatusEx.Visible:=true;
   Form_peach.labelstatusEx.Caption:=status_curfilesystem;
   end
else
   begin
   Form_peach.labelstatusEx.Visible:=false;
   Form_peach.labelstatusEx.Caption:='';
   end;
autosize_stringgrid2;
if Form_peach.StringGrid2.RowCount>1 then Form_peach.StringGrid2.Cells[11,1]:='1';
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]);
            Form_peach.StringGrid1.AutoSizeColumns;
            updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
            end;
      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 addfolder_ext;
var
   j:integer;
   okfile:boolean;
   exp_files:TFoundList;
   exp_fsizes:TFoundListSizes;
   exp_ftimes:TFoundListAges;
   exp_fattr:TFoundListAttrib;
   exp_fattr_dec:TFoundList;
   nfound:qword;
begin
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      begin
      Form_peach.StringGrid2.Cursor:=crHourGlass;
      deselectingrid(Form_peach.StringGrid2);
      expand(Form_peach.SelectDirectoryDialog1.FileName,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;
      Form_peach.StringGrid2.Cursor:=crDefault;
      end;
end;

procedure addfolder;
var
   s:ansistring;
begin
s:=Form_peach.Caption;
if Form_peach.SelectDirectoryDialog1.Execute then
   if Form_peach.SelectDirectoryDialog1.FileName<>'' then
      if testname(Form_peach.SelectDirectoryDialog1.FileName, Form_peach.StringGrid1)=0 then
         begin
         Form_peach.StringGrid1.Cursor:=crHourGlass;
         Form_peach.Caption:=txt_2_4_adding+' '+Form_peach.SelectDirectoryDialog1.FileName;
         Application.ProcessMessages;
         deselectingrid(Form_peach.StringGrid1);
         addfolderstr(Form_peach.StringGrid1,Form_peach.SelectDirectoryDialog1.Filename);
         Form_peach.StringGrid1.AutoSizeColumns;
         updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
         Form_peach.StringGrid1.Cursor:=crDefault;
         end;
Form_peach.Caption:=s;
end;

procedure setsearch_disabled;
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilter.Enabled:=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.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 fun='UN7Z' then setsearch_disabled;
   status0:=txt_list_found;
   madvfilters.checked:=true;
   end
else
   begin
   setsearch_enabled;
   status0:=txt_list_browsing;
   madvfilters.checked:=false;
   browsingmode7z:=0;
   end;
end;
end;

procedure loadlist(sg:TStringGrid);
var
   in_param:TFoundlist;
   listfile:ansistring;
   i:integer;
begin
Form_peach.OpenDialogLayout.InitialDir:=confpath+'Layouts'+DirectorySeparator;
if Form_peach.OpenDialogLayout.Execute then
   if Form_peach.OpenDialogLayout.FileName<>'' then
      begin
      listfile:=Form_peach.OpenDialogLayout.FileName;
      read_filelist(listfile,in_param);
      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);
               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);
                  advfiltersupdate;
                  end;
               end
            else
               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=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';
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);
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 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.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') 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.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') 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<>'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='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 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 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';
   Form_peach.ImageInfoArchive2.Hint:=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;
   Form_peach.ImageInfoArchive2.Hint:=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';
   Form_peach.ImageInfoArchive2.Hint:=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 then
   begin
   Form_peach.PanelCustom.Visible:=true;
   archive_type:=txt_custom;
   fun:='CUSTOM';
   Form_peach.ComboBoxArchive1.ItemIndex:=0;
   change_imagesplit;
   Form_peach.ComboBoxArchive1.Enabled:=false;
   Form_peach.SpinEditArchive1.Visible:=false;
   Form_peach.ComboBoxArchive2.Visible:=false;
   Form_peach.ImageInfoArchive2.Hint:=txt_type_description_custom;
   getarccaption(s);
   Form_peach.CheckBoxSameArc.Enabled:=false;
   Form_peach.CheckBoxSameArc.State:=cbUnchecked;
   Form_peach.CheckBoxSeparate.Enabled:=false;
   Form_peach.CheckBoxSeparate.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   Form_peach.EditNameCustom.Caption:=Form_peach.pcustom1.caption;
   s1:=extractfilename(Form_peach.pcustom1.caption);
   cutextension(s1);
   Form_peach.EditExtCustom.Caption:=s1;
   Form_peach.CheckBoxArchive4.Enabled:=false;
   Form_peach.ComboBoxArchiveAct.Enabled:=false;
   end;
if s=STR_GZIP then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.Enabled:=true;
   archive_type:='gz';
   fun:='7Z';
   Form_peach.ImageInfoArchive2.Hint:=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';
   Form_peach.ImageInfoArchive2.Hint:=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:=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_XZ then
   begin
   Form_peach.Panel7za.Visible:=true;
   Form_peach.cbadvf1.Enabled:=true;
   archive_type:='xz';
   fun:='7Z';
   Form_peach.ImageInfoArchive2.Hint:=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;
   Form_peach.ImageInfoArchive2.Hint:=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';
   Form_peach.ImageInfoArchive2.Hint:=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);
   Form_peach.ImageInfoArchive2.Hint:=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:='bz';
   Form_peach.ComboBoxArchive9.ItemIndex:=level_brotli;
   getarccaption(s);
   Form_peach.ImageInfoArchive2.Hint:=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);
   Form_peach.ImageInfoArchive2.Hint:=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;
   Form_peach.ImageInfoArchive2.Hint:=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;
   Form_peach.ImageInfoArchive2.Hint:=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';
   Form_peach.ImageInfoArchive2.Hint:=txt_type_description_split;
   getarccaption(s);
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   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';
   Form_peach.ImageInfoArchive2.Hint:=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';
   Form_peach.ImageInfoArchive2.Hint:=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';
   Form_peach.ImageInfoArchive2.Hint:=txt_type_description_zip;
   if (compression_method='') or (prev_type<>'zip') then compression_method:=method_zip;//'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;
   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;
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[8,i]=lastobjarch then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then i:=1;
Form_peach.StringGridList.Cells[12,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:='a '+Form_peach.StringGridList.Cells[c,i]+' '+Form_peach.StringGridList.Cells[1,i]
      else
         s:='b '+Form_peach.StringGridList.Cells[c,i]+' '+Form_peach.StringGridList.Cells[1,i];
      if length(s)>256 then setlength(s,256);
      Form_peach.StringGridList.Cells[13,i]:=s;
      end;
Form_peach.StringGridList.SortColRow(true,13);
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:='a '+Form_peach.StringGridList.Cells[c,i]+' '+Form_peach.StringGridList.Cells[1,i]
      else
         s:='b '+Form_peach.StringGridList.Cells[c,i]+' '+Form_peach.StringGridList.Cells[1,i];
      if length(s)>256 then setlength(s,256);
      Form_peach.StringGridList.Cells[13,i]:=s;
      end;
Form_peach.StringGridList.SortColRow(true,13);
end;

procedure sort_za_stringgridlist;
var
   i,rc:integer;
begin
//if refreshstatus<>0 then exit;
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 smartsortable(s:ansistring):ansistring;
var
   i,firstpos,nnumb:Integer;
   firstnumber:boolean;
   snumb:string;
begin
result:=s;
if s='' then exit;
if pos('.',result)<>0 then
   result:=copy(result,1,pos('.',result)-1)+' '+copy(result,pos('.',result),length(result)+1-pos('.',result));
result:=result+' ';
firstnumber:=false;
firstpos:=0;
nnumb:=0;
snumb:='';
for i:=1 to length(s) do
   begin
   if s[i] in ['0'..'9'] then
      if firstnumber=false then
         begin
         firstnumber:=true;
         firstpos:=i;
         nnumb:=1;
         snumb:='9';
         end
      else
         begin
         nnumb:=nnumb+1;
         snumb:=snumb+'9';
         end
   else
      if firstnumber=false then
         begin
         end
      else
         break;
   end;
if firstnumber=true then
   result:=copy(result,1,firstpos-1)+snumb+copy(result,firstpos,length(result)+1-firstpos);
end;

procedure list_l(mode:ansistring); //special formats through 7z
var
   i,k:integer;
   size,csize,rsize:qword;
   s:ansistring;
begin
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
      k:=i-title_lines_7z+1;
      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[8,k]:=s;
         Form_peach.StringGridList.Cells[9,k]:='1'+smartsortable(Form_peach.StringGridList.Cells[1,k]);
         end
      else
         begin
         Form_peach.StringGridList.Cells[2,k]:=extractfileext(Form_peach.StringGridList.Cells[1,k]);
         Form_peach.StringGridList.Cells[8,k]:=s;
         Form_peach.StringGridList.Cells[9,k]:='2'+smartsortable(Form_peach.StringGridList.Cells[1,k]);
         end;
      Form_peach.StringGridList.Cells[3,k]:=trimleft(copy(Form_peach.MemoList.Lines[i],27,12));
      Form_peach.StringGridList.Cells[10,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));
      Form_peach.StringGridList.Cells[11,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[6,k]:=copy(Form_peach.MemoList.Lines[i],21,5);
      Form_peach.StringGridList.Cells[12,k]:='0';
      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;
      end;
   end;
i:=Form_peach.MemoList.Lines.Count-NDLINES;
status1:=copy(Form_peach.MemoList.Lines[i+2],54,length(Form_peach.MemoList.Lines[i+2])-53)+'; '+nicenumber(trimleft(copy(Form_peach.MemoList.Lines[i+2],27,12)))+' > '+nicenumber(trimleft(copy(Form_peach.MemoList.Lines[i+2],40,12)));
size:=0;
csize:=0;
rsize:=0;
try
   size:=strtoqword(trimleft(copy(Form_peach.MemoList.Lines[i+2],27,12)));
   csize:=strtoqword(trimleft(copy(Form_peach.MemoList.Lines[i+2],40,12)));
   if size<>0 then rsize:=((csize) *100) div (size);
   infosize2:=48 * rsize div 100;
except
   infosize2:=0;
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';
if Form_peach.StringGridList.RowCount<2 then status1:=txt_list_nomatch+txt_2_7_list_tryflatorpw;

if (mode='silent') then Form_peach.StringGridArchive.RowCount:=1;//unused for formats supported through list_l

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; //dinamically 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; //dinamically 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:integer;
   s1:ansistring;
begin
result:=0;
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; //dinamically find title and comment lines
if i>=Form_peach.MemoList.Lines.Count then result:=-1 else result:=1;
end;

procedure list_slt(mode:ansistring);
var
   i,j,k,nfiles,nfolders,rc,rc2,ll:integer;
   size,csize,rsize:qword;
   s1,s2,s3,s,cmethod:ansistring;
   stopped_prebrowse,found: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;
cmethod:='';
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;
Form_peach.StringGridList.RowCount:=ll;
repeat
   if j<ll then
   else
      Form_peach.StringGridList.RowCount:=Form_peach.StringGridList.RowCount+1;
   repeat
      s1:=Form_peach.MemoList.Lines[i];
      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[8,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[9,j]:='1'+smartsortable(dirExtractFileName(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+smartsortable(dirExtractFileName(s3));
            end;
         'Size':
         begin
         Form_peach.StringGridList.Cells[3,j]:=copy(s1,8,length(s1)-7);
         Form_peach.StringGridList.Cells[10,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[11,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);
         'CRC': Form_peach.StringGridList.Cells[7,j]:=copy(s1,7,length(s1)-6);
         'SHA-1': if Form_peach.StringGridList.Cells[7,j]='' then Form_peach.StringGridList.Cells[7,j]:=copy(s1,12,length(s1)-11);
         'Checksum': if Form_peach.StringGridList.Cells[7,j]='' then Form_peach.StringGridList.Cells[7,j]:=copy(s1,12,length(s1)-11);
         'Attributes':
         begin
         Form_peach.StringGridList.Cells[6,j]:=copy(s1,14,length(s1)-13);
         if pos('D',Form_peach.StringGridList.Cells[6,j])<>0 then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[9,j]:='1'+smartsortable(dirExtractFileName(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+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
         if cmethod='' then
            if Form_peach.StringGridList.Cells[2,j]<>txt_list_isfolder then cmethod:=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;
      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[8,j])=0 then rootdirrecord:=1;
         end;
      Form_peach.StringGridList.Cells[12,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 Form_peach.Visible=true then if j and 31 = 0 then Application.ProcessMessages;
until i>=k-1;
if j<1 then j:=1;
Form_peach.StringGridList.RowCount:=j;

if mode='silent' then
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;
Form_Peach.StringGridAddress2.RowCount:=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 (Form_peach.StringGridList.RowCount<prebrowsesize*1024) or (prebrowse=0) then //if fast prebrowsing is enabled, limit omitted folders test to reasonable performances
begin
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   begin
   s:=Form_peach.StringGridList.Cells[8,i];
   if dirExtractFilePath(Form_peach.StringGridList.Cells[8,i])=dirExtractFilePath(Form_peach.StringGridList.Cells[8,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;
         for j:=1 to Form_peach.StringGridAddress1.RowCount-1 do
            begin
            if s<>Form_peach.StringGridAddress1.Cells[8,j] then
            else
               begin
               found:=true;
               break;
               end;
            end;
         if found=true then
         else //add virtual folder
            begin
            h_folders:=true;
            rc:=Form_peach.StringGridAddress1.RowCount;
            rc2:=Form_peach.StringGridAddress2.RowCount;
            Form_peach.StringGridAddress1.RowCount:=rc+1;
            Form_peach.StringGridAddress2.RowCount:=rc2+1;
            Form_peach.StringGridAddress1.Cells[1,rc]:=dirextractfilename(s);
            Form_peach.StringGridAddress1.Cells[2,rc]:=txt_list_isfolder;
            Form_peach.StringGridAddress1.Cells[8,rc]:=s;
            Form_peach.StringGridAddress1.Cells[9,rc]:='1'+dirextractfilename(s);
            Form_peach.StringGridAddress1.Cells[3,rc]:='0';
            Form_peach.StringGridAddress1.Cells[10,rc]:=inttostr(length(inttostr(length(Form_peach.StringGridAddress1.Cells[3,j]))))+inttostr(length(Form_peach.StringGridAddress1.Cells[3,j]))+Form_peach.StringGridAddress1.Cells[3,j];
            Form_peach.StringGridAddress1.Cells[4,rc]:='0';
            Form_peach.StringGridAddress1.Cells[11,rc]:=inttostr(length(inttostr(length(Form_peach.StringGridAddress1.Cells[4,j]))))+inttostr(length(Form_peach.StringGridAddress1.Cells[4,j]))+Form_peach.StringGridAddress1.Cells[4,j];
            Form_peach.StringGridAddress1.Cells[6,rc]:='D';
            Form_peach.StringGridAddress1.Cells[12,rc]:='0';
            Form_peach.StringGridAddress2.Rows[rc2].Assign(Form_peach.StringGridAddress1.Rows[rc]);
            nfolders:=nfolders+1;
            end;
         end;
      until (s='') or (s='\') or (s='/') or (s=DirectorySeparator) or (s=DirectorySeparator+DirectorySeparator);
   if Form_peach.Visible=true then if i and 31 = 0 then Application.ProcessMessages;
   end;
end;

prebrowse_dirs:=nfolders;
prebrowse_records:=j;
Form_Peach.StringGridAddress1.EndUpdate;
Form_Peach.StringGridAddress2.EndUpdate;
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
   if cmethod<>'' then status1:=cmethod+' | '
   else status1:='';
   status1:=status1+inttostr(nfolders)+' '+txt_dirs+' '+inttostr(nfiles)+' '+txt_files+' '+nicenumber(inttostr(size))+' > '+nicenumber(inttostr(csize));
   end;
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
   infosize2:=48 * rsize div 100;
except
   infosize2:=0;
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;
   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;

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:=262144;
repeat
   if j<262142 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[8,j]:=s3;
         end;
         'Type':
         if rar5str='Directory' then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[9,j]:='1'+smartsortable(extractfilename(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+smartsortable(extractfilename(s3));
            end;
         'Size':
         begin
         Form_peach.StringGridList.Cells[3,j]:=rar5str;
         Form_peach.StringGridList.Cells[10,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[11,j]:=inttostr(length(inttostr(length(Form_peach.StringGridList.Cells[3,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[7,j]:=rar5str;
         'Attributes':
         begin
         Form_peach.StringGridList.Cells[6,j]:=rar5str;
         if pos('D',Form_peach.StringGridList.Cells[6,j])<>0 then
            begin
            Form_peach.StringGridList.Cells[2,j]:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[9,j]:='1'+smartsortable(extractfilename(s3));
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=extractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+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[8,j])=0 then rootdirrecord:=1;
         end;
      Form_peach.StringGridList.Cells[12,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))+' > '+nicenumber(inttostr(csize));
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
   infosize2:=48 * rsize div 100;
except
   infosize2:=0;
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;
   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.ListView1.Cursor:=crHourglass;
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;

procedure enter_busy_minor_status;//block browser and address bar context menus, and sorting while file manager is being updated
begin
Form_peach.ListView1.Cursor:=crHourglass;
Form_peach.ListView1.PopupMenu:=nil;
Form_peach.ImageListSearch.Picture.Bitmap:=Bgopath;
refreshstatus:=1;
pcount:=1;
browserbusy_minor:=true;
end;

procedure exit_busy_minor_status;
begin
browserbusy_minor:=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;
refreshstatus:=0;
end;

function execute_cl(cl,mode:ansistring):integer;
var
  P: tprocessutf8;
  i,BytesRead:integer;
  skipped_prebrowse:boolean;
  M:TmemoryStream;
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;
if (mode='extandrun') or (mode='delete') or (mode='add')  or (mode='preview') then P.Options := [poNoConsole]
else P.Options := [poUsePipes, poNoConsole];
if fun='UNARC' then P.Options := [poUsePipes, poNoConsole];
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
M.SetSize(32*1024*1024);
while P.Running do
   begin
   if BytesRead+4*1024>=M.Size then M.SetSize(BytesRead + 4*1024);
   if prebrowse=1 then
      begin
      if M.Size>(prebrowsesize*1024*1024) then //limit memorystream size to 1M*prebrowsesize blocks
         begin
         if mode<>'silent' then pMessageErrorOK(txt_aborted_error);
         status0:=txt_aborted;
         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)^, 2*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 tryopenwerrors=0 then execute_cl:=P.ExitStatus else execute_cl:=0;
if P.ExitStatus<>0 then Form_peach.LabelErrors.Caption:=txt_7_3_archiveerrors;
P.Free;
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 (mode='silent') and (skipped_prebrowse=true) then
      begin
      M.Free;
      exit_busy_status;
      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[12,1]:='1';
      Form_peach.StringGridList.Row:=1;
      status0:=txt_list_flat;
      update_listview;
      end;
   end
else //error
   begin
   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 testencrypted_fromname(fname:ansistring):integer; //-1 unchecked 0 not encrypted 1 encrypted
var
  P: tprocessutf8;
  i,k,ec,BytesRead:integer;
  enc:boolean;
  s,s1,s2,fun:ansistring;
  jobcode,outname:ansistring;
  M:TmemoryStream;
begin
result:=-1;
testarctype(fname,i,fun);
if (fun<>'UNARC') and
   (fun<>'UN7Z') then exit;
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;
end;
if cl='' then exit;
i:=0;
P:=tprocessutf8.Create(nil);
P.CommandLine:=cl;
M := TMemoryStream.Create;
BytesRead := 0;
P.Options := [poUsePipes, poNoConsole];
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
M.SetSize(32*1024*1024);
while P.Running do
   begin
   if BytesRead+2*1024>=M.Size then M.SetSize(BytesRead + 2*1024);
   if prebrowse=1 then
      begin
      if M.Size>(prebrowsesize*1024*1024) then
         begin
         P.Terminate(255);
         break;
         end;
      end;
   i := P.Output.Read((M.Memory + BytesRead)^, 2*1024);
   if i > 0 then Inc(BytesRead, i)
   else Sleep(100);
   if Form_peach.Visible=true then Application.ProcessMessages;
   end;
repeat
   M.SetSize(BytesRead + 2*1024);
   i := P.Output.Read((M.Memory + BytesRead)^, 2*1024);
   if i > 0 then Inc(BytesRead, i)
   else Sleep(100);
until i <= 0;
M.SetSize(BytesRead);
ec:=P.ExitCode;
P.Free;
Form_peach.MemoList.Clear;
enc:=false;
Form_peach.MemoList.Lines.LoadFromStream(M);
k:=Form_peach.MemoList.Lines.Count;
if ec<>0 then enc:=true;
if k=0 then enc:=true;
if enc=false then
   if fun='UN7Z' then
      begin
      case btfun of
         'unrar5': if find_rar5_titles<>1 then enc:=true;
         else if find_7z_titles<>1 then enc:=true;
         end;
      if enc=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 enc:=true;
               'Method': if pos('AES',s1)<>0 then enc:=true;
            end;
            i:=i+1;
            if enc=true then break;
            until i>=k-1;
         end;
      end;
M.Free;
if enc=true then result:=1 else result:=0;
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;
         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}
end;

procedure cp_search(desk_env:byte);
begin
{$IFDEF MSWINDOWS}
if winver='nt6+' then
   shellexecutew(Form_peach.handle, PWideChar('find'), PWideChar(''), PWideChar(''), PWideChar (''), SW_SHOWNORMAL)
else
   cp_open(executable_path+'res'+directoryseparator+'empty.fnd',desk_env);
{$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}
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:=delimiter+escapefilename(outname+tempstring,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -ext2open';
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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 exit;
            end;
         {$ENDIF}
         save_conf;
         save_bookmarks;
         dodirseparators(tempstring);
         outname:=delimiter+escapefilename(outname+tempstring,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter;
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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+' '+delimiter+'-xr!'+escapefilename(s,desk_env)+delimiter
      else extract_excludes:=extract_excludes+' '+delimiter+'-x!'+escapefilename(s,desk_env)+delimiter;
      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+' '+delimiter+'-x'+escapefilename(s,desk_env)+delimiter;
      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+' '+delimiter+escapefilename(s,desk_env)+delimiter;
      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+' '+delimiter+escapefilename(s,desk_env)+delimiter;
      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+' '+delimiter+'-x!'+escapefilename(s1,desk_env)+delimiter;
if Form_peach.EditUn7zaFilter.Text<>'' then cl:=cl+' -r -- '+delimiter+escapefilename(s2,desk_env)+delimiter;
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+' '+delimiter+'-x'+escapefilename(s1,desk_env)+directoryseparator+'**'+directoryseparator+'**'+directoryseparator+delimiter+' '+delimiter+'-x'+escapefilename(s1,desk_env)+directoryseparator+'**'+directoryseparator+'*'+delimiter;
if Form_peach.EditUn7zaFilter.Text<>'' then cl:=cl+' -- '+delimiter+escapefilename(s2,desk_env)+delimiter;
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);
   blockread (f_in,sbuf,8,numread);
   if IOResult<>0 then
      begin
      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(executable_path+'res'+DirectorySeparator+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT) then
   else
   begin
   result:=0;
   if unrar5shown=false then
      begin
      pMessageInfoOK('PeaZip UNRAR5 '+txt_5_7_plugin);
      unrar5shown:=true;
      end;
   end;
end;

function testifrar(s:ansistring):integer; //test 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:ansistring;
begin
result:=-1;
in_param:=delimiter+escapefilename((Form_peach.EditOpenIn.Text),desk_env)+delimiter;
if fun='UN7Z' then exe_name:='7z';
bin_name:=delimiter+escapefilename((executable_path),desk_env)+'res'+DirectorySeparator+exe_name+DirectorySeparator+exe_name+EXEEXT+delimiter;
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;
      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 fun='UN7Z' then
   if browse_option='slt' then cl:=cl+' -slt';
cl:=cl+' -bb0 -bse0 -bsp0';
cl:=cl+' '+pw+' '+in_param;
//filter(s)
if FormAdvf.CheckBoxAdvFilters.State=cbChecked 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:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
if fun='UN7Z' then exe_name:=UNRARNAME;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unrar'+DirectorySeparator+exe_name+EXEEXT+delimiter;
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;
      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.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.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.pmbce.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;
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.LabelClickAdArchive1.Color:=StringToColor(COLMID);
Form_peach.LabelClickAdArchive2.Color:=StringToColor(COLMID);
Form_peach.LabelClickAdArchive3.Color:=StringToColor(COLMID);
Form_peach.LabelClickAdArchive4.Color:=StringToColor(COLMID);
Form_peach.LabelClickaddress8.Color:=StringToColor(COLMID);
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;

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.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.pmbce.Visible:=Form_peach.abc0.Visible;
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);
   if rc>1 then pmh10.caption:=StringGridSessionHistory.Cells[2,rc-1]+' '+StringGridSessionHistory.Cells[3,rc-1] else pmh10.caption:='';
   if rc>2 then pmh11.caption:=StringGridSessionHistory.Cells[2,rc-2]+' '+StringGridSessionHistory.Cells[3,rc-2] else pmh11.caption:='';
   if rc>3 then pmh12.caption:=StringGridSessionHistory.Cells[2,rc-3]+' '+StringGridSessionHistory.Cells[3,rc-3] else pmh12.caption:='';
   if rc>4 then pmh13.caption:=StringGridSessionHistory.Cells[2,rc-4]+' '+StringGridSessionHistory.Cells[3,rc-4] else pmh13.caption:='';
   if rc>5 then pmh14.caption:=StringGridSessionHistory.Cells[2,rc-5]+' '+StringGridSessionHistory.Cells[3,rc-5] else pmh14.caption:='';
   if rc>6 then pmh15.caption:=StringGridSessionHistory.Cells[2,rc-6]+' '+StringGridSessionHistory.Cells[3,rc-6] else pmh15.caption:='';
   if rc>7 then pmh16.caption:=StringGridSessionHistory.Cells[2,rc-7]+' '+StringGridSessionHistory.Cells[3,rc-7] else pmh16.caption:='';
   if rc>8 then pmh17.caption:=StringGridSessionHistory.Cells[2,rc-8]+' '+StringGridSessionHistory.Cells[3,rc-8] else pmh17.caption:='';
   if pmh17.caption='' then pmh17.visible:=false else pmh17.visible:=true;
   if pmh16.caption='' then pmh16.visible:=false else pmh16.visible:=true;
   if pmh15.caption='' then pmh15.visible:=false else pmh15.visible:=true;
   if pmh14.caption='' then pmh14.visible:=false else pmh14.visible:=true;
   if pmh13.caption='' then pmh13.visible:=false else pmh13.visible:=true;
   if pmh12.caption='' then pmh12.visible:=false else pmh12.visible:=true;
   if pmh11.caption='' then pmh11.visible:=false else pmh11.visible:=true;
   if pmh10.visible=true then pmh10.Bitmap:=pmh1.Bitmap;
   if pmh11.visible=true then pmh11.Bitmap:=pmh2.Bitmap;
   if pmh12.visible=true then pmh12.Bitmap:=pmh3.Bitmap;
   if pmh13.visible=true then pmh13.Bitmap:=pmh4.Bitmap;
   if pmh14.visible=true then pmh14.Bitmap:=pmh5.Bitmap;
   if pmh15.visible=true then pmh15.Bitmap:=pmh6.Bitmap;
   if pmh16.visible=true then pmh16.Bitmap:=pmh7.Bitmap;
   if pmh17.visible=true then pmh17.Bitmap:=pmh8.Bitmap;
   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;
   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
{$IFDEF MSWINDOWS}
{$ELSE} //In Lazarus 0.9.24 under GTK and GTK2 the panel need to be visible while working on its objects; before, the panel is resized in order to reduce "flashing" effect
{$ENDIF}
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: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;
pmamb1.caption:='';
pmamb2.caption:='';
pmamb3.caption:='';
pmamb4.caption:='';
pmamb5.caption:='';
pmamb6.caption:='';
pmamb7.caption:='';
pmamb8.caption:='';
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];
      if length(s)>0 then
         if s[length(s)]=directoryseparator then s1:=s
            else
               begin
               s1:=extractfilepath(s);
               if k<8 then
               if FileExists(s) then
               begin
               k:=k+1;
               case k of
                  1:begin
                  pmamb1.caption:=(s);
                  pmamb1.Bitmap:=drawmenuicon(s);
                  end;
                  2:begin
                  pmamb2.caption:=(s);
                  pmamb2.Bitmap:=drawmenuicon(s);
                  end;
                  3:begin
                  pmamb3.caption:=(s);
                  pmamb3.Bitmap:=drawmenuicon(s);
                  end;
                  4:begin
                  pmamb4.caption:=(s);
                  pmamb4.Bitmap:=drawmenuicon(s);
                  end;
                  5:begin
                  pmamb5.caption:=(s);
                  pmamb5.Bitmap:=drawmenuicon(s);
                  end;
                  6:begin
                  pmamb6.caption:=(s);
                  pmamb6.Bitmap:=drawmenuicon(s);
                  end;
                  7:begin
                  pmamb7.caption:=(s);
                  pmamb7.Bitmap:=drawmenuicon(s);
                  end;
                  8:begin
                  pmamb8.caption:=(s);
                  pmamb8.Bitmap:=drawmenuicon(s);
                  end;
               end;
               end;
               end;
      translatespecialfolders(s);
      case i of
         1: begin
            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
            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
         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
         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
         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
         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
         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
         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;
pmtabb1.caption:=mb1.caption;
pmtabb2.caption:=mb2.caption;
pmtabb3.caption:=mb3.caption;
pmtabb4.caption:=mb4.caption;
pmtabb5.caption:=mb5.caption;
pmtabb6.caption:=mb6.caption;
pmtabb7.caption:=mb7.caption;
pmtabb8.caption:=mb8.caption;
pmtabb9.caption:=mb9.caption;
pmtabb10.caption:=mb10.caption;
pmtabb11.caption:=mb11.caption;
pmtabb12.caption:=mb12.caption;
pmtabb13.caption:=mb13.caption;
pmtabb14.caption:=mb14.caption;
pmtabb15.caption:=mb15.caption;
pmtabb16.caption:=mb16.caption;
pmtabb17.caption:=mb17.caption;
pmtabb18.caption:=mb18.caption;
pmtabb19.caption:=mb19.caption;
pmtabb20.caption:=mb20.caption;
pmtabb21.caption:=mb21.caption;
pmtabb22.caption:=mb22.caption;
pmtabb23.caption:=mb23.caption;
pmtabb1.visible:=mb1.visible;
pmtabb2.visible:=mb2.visible;
pmtabb3.visible:=mb3.visible;
pmtabb4.visible:=mb4.visible;
pmtabb5.visible:=mb5.visible;
pmtabb6.visible:=mb6.visible;
pmtabb7.visible:=mb7.visible;
pmtabb8.visible:=mb8.visible;
pmtabb9.visible:=mb9.visible;
pmtabb10.visible:=mb10.visible;
pmtabb11.visible:=mb11.visible;
pmtabb12.visible:=mb12.visible;
pmtabb13.visible:=mb13.visible;
pmtabb14.visible:=mb14.visible;
pmtabb15.visible:=mb15.visible;
pmtabb16.visible:=mb16.visible;
pmtabb17.visible:=mb17.visible;
pmtabb18.visible:=mb18.visible;
pmtabb19.visible:=mb19.visible;
pmtabb20.visible:=mb20.visible;
pmtabb21.visible:=mb21.visible;
pmtabb22.visible:=mb22.visible;
pmtabb23.visible:=mb23.visible;
pmtabb1.Bitmap:=mb1.Bitmap;
pmtabb2.Bitmap:=mb2.Bitmap;
pmtabb3.Bitmap:=mb3.Bitmap;
pmtabb4.Bitmap:=mb4.Bitmap;
pmtabb5.Bitmap:=mb5.Bitmap;
pmtabb6.Bitmap:=mb6.Bitmap;
pmtabb7.Bitmap:=mb7.Bitmap;
pmtabb8.Bitmap:=mb8.Bitmap;
pmtabb9.Bitmap:=mb9.Bitmap;
pmtabb10.Bitmap:=mb10.Bitmap;
pmtabb11.Bitmap:=mb11.Bitmap;
pmtabb12.Bitmap:=mb12.Bitmap;
pmtabb13.Bitmap:=mb13.Bitmap;
pmtabb14.Bitmap:=mb14.Bitmap;
pmtabb15.Bitmap:=mb15.Bitmap;
pmtabb16.Bitmap:=mb16.Bitmap;
pmtabb17.Bitmap:=mb17.Bitmap;
pmtabb18.Bitmap:=mb18.Bitmap;
pmtabb19.Bitmap:=mb19.Bitmap;
pmtabb20.Bitmap:=mb20.Bitmap;
pmtabb21.Bitmap:=mb21.Bitmap;
pmtabb22.Bitmap:=mb22.Bitmap;
pmtabb23.Bitmap:=mb23.Bitmap;
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;
if pmamb1.caption='' then pmamb1.visible:=false else pmamb1.visible:=true;
if pmamb2.caption='' then pmamb2.visible:=false else pmamb2.visible:=true;
if pmamb3.caption='' then pmamb3.visible:=false else pmamb3.visible:=true;
if pmamb4.caption='' then pmamb4.visible:=false else pmamb4.visible:=true;
if pmamb5.caption='' then pmamb5.visible:=false else pmamb5.visible:=true;
if pmamb6.caption='' then pmamb6.visible:=false else pmamb6.visible:=true;
if pmamb7.caption='' then pmamb7.visible:=false else pmamb7.visible:=true;
if pmamb8.caption='' then pmamb8.visible:=false else pmamb8.visible:=true;
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[8,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;
if fun='UN7Z' then po_renmenu.visible:=true;
po_rename.visible:=cond;
if fun='UN7Z' then po_rename.visible:=true;
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_separator.visible:=cond;
MenuItem119.visible:=cond;
po_rename_filesonly.visible:=cond;
MenuItem7.visible:=cond;
if fun='UN7Z' then MenuItem7.visible:=true;
{$IFDEF MSWINDOWS}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_exthere.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_analyzefolders.Visible:=true;
   pmpanalyzefolders.Visible:=true;
   po_deduplicate.Visible:=true;
   po_deduplicatesel.Visible:=true;
   po_checksum.Visible:=true;
   po_checksumsel.Visible:=true;
   po_browseralgo.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;
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;
MenuItemOpen_extandopenwith.visible:=true;
MenuItem120.Visible:=true;
mForceSyncedits.Visible:=true;
mForceSynceditsClear.Visible:=true;
mForceClear.Visible:=true;
pmmorefun_details.Enabled:=true;
pmmorefun_list.Enabled:=true;
pmmorefun_info.Enabled:=true;
end;
end;

procedure set_extcontext_off;
begin
Form_peach.pmextcontextdisplayed.enabled:=false;
Form_peach.pmextcontextselected.enabled:=false;
end;

procedure set_extcontext_on;
begin
Form_peach.pmextcontextdisplayed.enabled:=true;
Form_peach.pmextcontextselected.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_test.visible:=false;
po_info.visible:=false;
po_list.visible:=false;
po_open.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_analyzefolders.Visible:=false;
pmpanalyzefolders.Visible:=false;
po_deduplicate.Visible:=false;
po_deduplicatesel.Visible:=false;
po_checksum.Visible:=false;
po_checksumsel.Visible:=false;
po_browseralgo.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;
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[8,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[8,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.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.mbrowsercatt.Caption:=Form_Peach.ListView1.Column[5].Caption;
Form_Peach.mbrowserccrc.Caption:=Form_Peach.ListView1.Column[6].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.mbrowsercatt.Checked:=true; end;
   6: 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_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_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: qword;
begin
sizefree:=0;
perfree:=0;
with Form_peach do
begin
statuss:='';
{$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;
   statuss:=nicenumber(inttostr(sizefree))+' '+txt_free2+' ('+inttostr(perfree)+'%)';
   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
{$IFDEF MSWINDOWS}
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   Form_peach.ShapeFSfree.Visible:=false;
   Form_peach.ShapeFStotal.Visible:=false;
   end
else
   begin
   Form_peach.ShapeFSfree.Visible:=true;
   Form_peach.ShapeFStotal.Visible:=true;
   Form_peach.ShapeFSfree.Hint:=status_curfilesystem;
   Form_peach.ShapeFStotal.Hint:=status_curfilesystem;
   end;
s:=count_clipboard;
Form_peach.LabelStatusdisplayed.Hint:=s;
Form_peach.LabelStatus.Hint:=s;
Form_peach.LabelClipinfo.Caption:=s;
{$ELSE}
Form_peach.ShapeFStotal.visible:=false;
Form_peach.ShapeFSfree.visible:=false;
{$ENDIF}
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_checksumsel.Caption:=chstr+' '+txt_4_1_selected;
Form_Peach.po_checksum.Caption:=chstr;
Form_Peach.pmcheck.Caption:=chstr;
Form_Peach.po_deduplicate.Caption:=txt_4_1_duplicatesfind+', '+chstr;
Form_Peach.pmdeduplicate.Caption:=txt_4_1_duplicatesfind+', '+chstr;
Form_Peach.po_deduplicatesel.Caption:=txt_4_1_duplicatesfind+', '+chstr+' '+txt_4_1_selected;
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[5].Caption:=txt_attributes;
   Form_Peach.ListView1.Column[6].Caption:=txt_check_select;
   Form_Peach.ListView1.Column[7].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_datetime;
   Form_Peach.ListView1.Column[5].Caption:=txt_attributes;
   if fun<>'FILEBROWSER' then Form_Peach.ListView1.Column[6].Caption:=txt_check_select else Form_Peach.ListView1.Column[6].Caption:=chstr;
   Form_Peach.ListView1.Column[7].Caption:=txt_name_full;
   end;
c:=listsortcol;
if c=9 then c:=1;
if c=10 then c:=3;
if c=11 then c:=4;
if c>8 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;
   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[5].Width:=0; end;
   if ccrc=false then begin Form_Peach.ListView1.Column[6].Width:=0; 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:=112;
   Form_Peach.ListView1.Column[2].Width:=104;
   Form_Peach.ListView1.Column[3].Width:=104;
   Form_Peach.ListView1.Column[4].Width:=136;
   Form_Peach.ListView1.Column[5].Width:=0;
   Form_Peach.ListView1.Column[6].Width:=0;
   Form_Peach.ListView1.Column[7].Width:=0;
   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:=col6size;
   Form_Peach.ListView1.Column[6].Width:=col7size;
   {$IFDEF MSWINDOWS}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[7].Width:=0
   else Form_Peach.ListView1.Column[7].Width:=384;
   {$ELSE}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[7].Visible:=false
   else begin Form_Peach.ListView1.Column[7].Visible:=true; Form_Peach.ListView1.Column[7].Width:=384; end;
   {$ENDIF}
   end;
set_listview_visiblecol;
end;
{$IFDEF MSWINDOWS}
{$ELSE}
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;
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 pos(STR_TMP,EditOpenIn.Text)<>0 then
   ShapeAddress.Brush.Color:=StringToColor(COLLOW)
else
   ShapeAddress.Brush.Color:=stringtocolor(color2);
Panelclickaddress.Color:=ShapeAddress.Brush.Color;
EditOpenIn.Color:=ShapeAddress.Brush.Color;
EditOpenIn1.Color:=ShapeAddress.Brush.Color;
EditUn7zafilter.Color:=ShapeAddress.Brush.Color;
EditUn7zafilter1.Color:=ShapeAddress.Brush.Color;
Panel8.Color:=ShapeAddress.Brush.Color;
Panel9.Color:=ShapeAddress.Brush.Color;
Panel11.Color:=ShapeAddress.Brush.Color;
PanelSearch.Color:=ShapeAddress.Brush.Color;
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;
PanelAdArchive0.Color:=ShapeAddress.Brush.Color;
PanelAdArchive1.Color:=ShapeAddress.Brush.Color;
PanelAdArchive2.Color:=ShapeAddress.Brush.Color;
PanelAdArchive3.Color:=ShapeAddress.Brush.Color;
LabelClickAddress1.Color:=ShapeAddress.Brush.Color;
LabelClickAddress2.Color:=ShapeAddress.Brush.Color;
LabelClickAddress3.Color:=ShapeAddress.Brush.Color;
LabelClickAddress4.Color:=ShapeAddress.Brush.Color;
LabelClickAddress5.Color:=ShapeAddress.Brush.Color;
LabelClickAddress6.Color:=ShapeAddress.Brush.Color;
LabelClickAddress7.Color:=ShapeAddress.Brush.Color;
LabelClickAddress8.Color:=ShapeAddress.Brush.Color;
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   {$IFDEF MSWINDOWS}
   try
   LabelInfo1.Caption:=status1+', '+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);
   infosize1:=48 * (100-b) div 100;
   LabelInfo2.Caption:=nicenumber(inttostr(memory.dwTotalPhys))+' RAM, '+nicenumber(inttostr(memory.dwAvailPhys))+' '+txt_free2+' ('+inttostr(a)+'%); '+nicenumber(inttostr(memory.dwTotalPageFile))+' '+txt_2_4_totalmem+' '+nicenumber(inttostr(memory.dwAvailPageFile))+' '+txt_free2+' ('+inttostr(b)+'%)';
   LabelInfo3.Caption:=statust;
   ImageInfoOpen4.Glyph:=Bhd_supported96;
   ShapeIO6.Visible:=true;
   ShapeIO7.Visible:=true;
   ShapeIO8.Visible:=true;
   ShapeIO9.Visible:=true;
   if infosize1>48 then infosize1:=48;
   if infosize2>48 then infosize2:=48;
   ShapeIO6.Width:=infosize1;
   ShapeIO7.Width:=infosize2;
   except
   end;
   {$ENDIF}
   end
else
   if fun='FILEBROWSER' then
      begin
      LabelInfo1.Caption:=EditOpenIn.Text;
      LabelInfo2.Caption:=status_curfilesystem;//+', '+statust;
      LabelInfo3.Caption:=status0+' '+status1;
      ImageInfoOpen4.Glyph:=BFolder96;
      ShapeIO6.Visible:=true;
      ShapeIO7.Visible:=false;
      ShapeIO8.Visible:=true;
      ShapeIO9.Visible:=false;
      if infosize1>48 then infosize1:=48;
      ShapeIO6.Width:=infosize1;
      end
   else
      begin
      LabelInfo1.Caption:=EditOpenIn.Text;//+' '+statust;
      LabelInfo2.Caption:=status_curarchive;//status2+', '+nicenumber(inttostr(tsize));
      if archive_content<>'' then LabelInfo2.Caption:=LabelInfo2.Caption+', '+archive_content;
      LabelInfo3.Caption:=status0+' '+status1;
      ImageInfoOpen4.Glyph:=BArchiveSupported96;
      if archive_content<>'' then ShapeIO6.Visible:=true else ShapeIO6.Visible:=false;
      ShapeIO7.Visible:=true;
      if archive_content<>'' then ShapeIO8.Visible:=true else ShapeIO8.Visible:=false;
      ShapeIO9.Visible:=true;
      if infosize1>48 then infosize1:=48;
      if infosize2>48 then infosize2:=48;
      if archive_content<>'' then ShapeIO6.Width:=infosize1;
      ShapeIO7.Width:=infosize2;
      end;
end;
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[12,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));
Form_peach.LabelInfo4.Caption:=Form_peach.LabelStatus.Caption;
if selcsize<>0 then Form_peach.LabelStatus.Caption:=Form_peach.LabelStatus.Caption+' > '+nicenumber(inttostr(selcsize));
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: integer;
  s: array [1..8] of ansistring;
begin
{$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.pmbc10.visible:=false;
   Form_peach.pmbc11.visible:=false;
   Form_peach.pmbc12.visible:=false;
   Form_peach.pmbc13.visible:=false;
   Form_peach.pmbc14.visible:=false;
   Form_peach.pmbc15.visible:=false;
   Form_peach.pmbc16.visible:=false;
   Form_peach.pmbc17.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;
   exit;
   end;
{$ENDIF}
if not directoryexists(apath) then
   if not fileexists(apath) then exit;
clean_archive_breadcrumb;
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;

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.pmbc10.visible:=Form_peach.pmbc1.visible;
Form_peach.pmbc11.visible:=Form_peach.pmbc2.visible;
Form_peach.pmbc12.visible:=Form_peach.pmbc3.visible;
Form_peach.pmbc13.visible:=Form_peach.pmbc4.visible;
Form_peach.pmbc14.visible:=Form_peach.pmbc5.visible;
Form_peach.pmbc15.visible:=Form_peach.pmbc6.visible;
Form_peach.pmbc16.visible:=Form_peach.pmbc7.visible;
Form_peach.pmbc17.visible:=Form_peach.pmbc8.visible;
Form_peach.pmbc10.caption:=Form_peach.pmbc1.caption;
Form_peach.pmbc11.caption:=Form_peach.pmbc2.caption;
Form_peach.pmbc12.caption:=Form_peach.pmbc3.caption;
Form_peach.pmbc13.caption:=Form_peach.pmbc4.caption;
Form_peach.pmbc14.caption:=Form_peach.pmbc5.caption;
Form_peach.pmbc15.caption:=Form_peach.pmbc6.caption;
Form_peach.pmbc16.caption:=Form_peach.pmbc7.caption;
Form_peach.pmbc17.caption:=Form_peach.pmbc8.caption;
Form_peach.pmbc10.bitmap:=Form_peach.pmbc1.bitmap;
Form_peach.pmbc11.bitmap:=Form_peach.pmbc2.bitmap;
Form_peach.pmbc12.bitmap:=Form_peach.pmbc3.bitmap;
Form_peach.pmbc13.bitmap:=Form_peach.pmbc4.bitmap;
Form_peach.pmbc14.bitmap:=Form_peach.pmbc5.bitmap;
Form_peach.pmbc15.bitmap:=Form_peach.pmbc6.bitmap;
Form_peach.pmbc16.bitmap:=Form_peach.pmbc7.bitmap;
Form_peach.pmbc17.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;
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;

procedure threadextract(vpath:ansistring);
{$IFDEF MSWINDOWS}
var
   fres,totrow:integer;
   cl,jobcode,outname,dragdest,relpath,prevout:ansistring;
   P:tprocessutf8;
   lpPoint:TPoint;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
fres:=-1;
if threadextracting=true then exit;
threadextracting:=true;
vpath2:=vpath;
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
   if dragtowin(dragdest)<>0 then begin FDragObject.Destroy; exit; end;
   if dragdest<>'' then
      if dragdest<>'<unsupported>' then
         begin
         vpath2:=dragdest+'.tmp'+inttohex(random(16000000),6)+'\';
         CreateDir(vpath2);
         CreateDir(vpath2+'virtual\');
         CreateDir(vpath2+'source\');
         filesetattr(vpath2, faHidden);
         changevpath(vpath2);
         end;
   end;
Form_peach.EditOpenOut.Text:=vpath2+'virtual\';
calcseltsize;
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;
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);
   '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');
   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
   Form_peach.Visible:=false;
   P:=tprocessutf8.Create(nil);
   P.Options := [poNoConsole, poWaitOnExit];
   P.CommandLine:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+
                  ' -pdrop '+fun+' '+inttostr(tsize)+' '+delimiter+Form_peach.EditOpenIn.Text+delimiter+' '+cl;
   P.Execute;
   P.Free;
   if status0=txt_list_browsing then
      begin
      relpath:=StringReplace(Form_peach.StringGridList.Cells[8,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\');
   movecontent_todir(Form_peach.EditOpenOut.Text+relpath,vpath2+'source\',1);
   Form_peach.Visible:=true;
   end;
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 TMyThreadexe.ReadStatus;
var
   i,p,x,y,k,eisize:integer;
   abitmap:Tbitmap;
   icon:TIcon;
   s:AnsiString;
   {$IFDEF MSWINDOWS}fileinfo: SHFILEINFO;{$ENDIF}
   MyThread1: TMyThread1;
   MyThread2: TMyThread2;
   MyThread3: TMyThread3;
   MyThread4: TMyThread4;
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
      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[8,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, (48*qscaleimages) div 100, DECO_NONE);
               il48.Add(abitmap,nil);
               Form_Peach.ListView1.Items[i-1].ImageIndex:=il48.Count-1;
               end;
               96:
               begin
               setsize_bitmap(abitmap, (96*qscaleimages) div 100, DECO_NONE);
               il96.Add(abitmap,nil);
               Form_Peach.ListView1.Items[i-1].ImageIndex:=il96.Count-1;
               end;
               192:
               begin
               setsize_bitmap(abitmap, (192*qscaleimages) div 100, 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}
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 TMyThread1.ReadStatus;
begin
fread:=Form_Peach.StringGridList.Cells[8,imlistindex[fi]];
end;

procedure TMyThreadexe.ShowStatus;
begin
end;

procedure TMyThread1.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      192: il192.Replace(41+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: il16.Replace(41+fi,fbitmap,nil);
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: il16.Replace(41+fi,fbitmap,nil);
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      end;
   end;
   end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=41+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[11,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[14,imlistindex[fi]]:=inttostr(41+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[14,imlistindex[fi]]);
   end;
end;

procedure TMyThreadexe.Execute;
begin
Synchronize(@Readstatus);
end;

procedure TMyThread1.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid,smsize: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);
   if smalliconsize=16 then smsize:=20 else smsize:=smalliconsize;
   if browsertype=2 then
      load_bitmap(abitmap, fread, (largeiconsize*qscaleimages) div 100, deco_style, s)
   else
      load_bitmap(abitmap, fread, (smsize*qscaleimages) div 100, deco_style, s);
   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 TMyThreadexe.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

constructor TMyThread1.Create(CreateSuspended: boolean);
begin
  FreeOnTerminate := True;
  inherited Create(CreateSuspended);
end;

procedure TMyThread2.ReadStatus;
begin
fread:=Form_Peach.StringGridList.Cells[8,imlistindex[fi]];
end;

procedure TMyThread2.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      192: il192.Replace(41+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: il16.Replace(41+fi,fbitmap,nil);
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: il16.Replace(41+fi,fbitmap,nil);
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      end;
   end;
   end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=41+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[11,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[14,imlistindex[fi]]:=inttostr(41+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[14,imlistindex[fi]]);
   end;
end;

procedure TMyThread2.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid,smsize: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);
   if smalliconsize=16 then smsize:=20 else smsize:=smalliconsize;
   if browsertype=2 then
      load_bitmap(abitmap, fread, (largeiconsize*qscaleimages) div 100, deco_style, s)
   else
      load_bitmap(abitmap, fread, (smsize*qscaleimages) div 100, deco_style, s);
   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[8,imlistindex[fi]];
end;

procedure TMyThread3.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
      2:
      begin
      case largeiconsize of
         48: il48.Replace(41+fi,fbitmap,nil);
         96: il96.Replace(41+fi,fbitmap,nil);
         192: il192.Replace(41+fi,fbitmap,nil);
         end;
      end;
      1:
      begin
      case mediconsize of
         16: il16.Replace(41+fi,fbitmap,nil);
         48: il48.Replace(41+fi,fbitmap,nil);
         96: il96.Replace(41+fi,fbitmap,nil);
         end;
      end;
      0:
      begin
      case smalliconsize of
         16: il16.Replace(41+fi,fbitmap,nil);
         48: il48.Replace(41+fi,fbitmap,nil);
         96: il96.Replace(41+fi,fbitmap,nil);
         end;
      end;
      end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=41+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[11,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[14,imlistindex[fi]]:=inttostr(41+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[14,imlistindex[fi]]);
   end;
end;

procedure TMyThread3.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid,smsize: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);
   if smalliconsize=16 then smsize:=20 else smsize:=smalliconsize;
   if browsertype=2 then
      load_bitmap(abitmap, fread, (largeiconsize*qscaleimages) div 100, deco_style, s)
   else
      load_bitmap(abitmap, fread, (smsize*qscaleimages) div 100, deco_style, s);
   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[8,imlistindex[fi]];
end;

procedure TMyThread4.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      192: il192.Replace(41+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: il16.Replace(41+fi,fbitmap,nil);
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: il16.Replace(41+fi,fbitmap,nil);
      48: il48.Replace(41+fi,fbitmap,nil);
      96: il96.Replace(41+fi,fbitmap,nil);
      end;
   end;
   end;
Form_Peach.ListView1.Items[imlistindex[fi]-1].ImageIndex:=41+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[11,imlistindex[fi]]:=fs;
Form_Peach.StringGridList.Cells[14,imlistindex[fi]]:=inttostr(41+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[14,imlistindex[fi]]);
   end;
end;

procedure TMyThread4.Execute;
var
  s : ansistring;
  abitmap:tbitmap;
  i,threadsyncid,smsize: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);
   if smalliconsize=16 then smsize:=20 else smsize:=smalliconsize;
   if browsertype=2 then
      load_bitmap(abitmap, fread, (largeiconsize*qscaleimages) div 100, deco_style, s)
   else
      load_bitmap(abitmap, fread, (smsize*qscaleimages) div 100, deco_style, s);
   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[12,i]:='0';
      end;
end;

procedure update_listview;
var
   i,j,rc:integer;
   MyThreadexe: TMyThreadexe;
   abitmap:TBitmap;
   redoi:boolean;
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]));
      Form_Peach.ListView1.Items[i-1].SubItems.Add(nicenumber(Form_Peach.StringGridList.Cells[4,i]));
      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]);
      if Form_Peach.StringGridList.Cells[12,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
            MyThreadexe := TMyThreadexe.Create(True);
            if Assigned(MyThreadexe.FatalException) then
               raise MyThreadexe.FatalException;
            MyThreadexe.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;
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;
{$IFDEF MSWINDOWS} if form_peach.Visible=true then try Form_peach.ListView1.SetFocus; except end;{$ENDIF}
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;
updatinglistview:=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[12,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}
{$IFDEF MSWINDOWS} if form_peach.Visible=true then try Form_peach.ListView1.SetFocus; except end;{$ENDIF}
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[12,i]='0' then
   else Form_peach.StringGridList.Cells[12,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[8,i]=lastobj then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then //i:=1;
else
   begin
   Form_peach.StringGridList.Cells[12,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[12,i]='0' then
   else Form_peach.StringGridList.Cells[12,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[8,i]=lastobj then
         begin
         lastobjfound:=true;
         break;
         end;
if lastobjfound=false then i:=1;
Form_peach.StringGridList.Cells[12,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+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;
end;
end;

procedure settoolbardisp;
begin
with Form_peach do
begin
if lasttoolbar=1 then
   begin
   if fun='FILEBROWSER' then ButtonDelete.Caption:=txt_securedelete
   else ButtonDelete.Caption:=txt_2_5_delete_fromarchive;
   {$IFDEF MSWINDOWS}
   {$ELSE}
   ButtonProperties.Visible:=false;
   MenuItemProperties.Visible:=false;
   mProperties.Visible:=false;
   pmProperties.Visible:=false;
   pmbcProperties.Visible:=false;
   {$ENDIF}
   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;
      if (fun='UN7Z') or (fun='UNARC') then
         begin
         ButtonOpenWith.Enabled:=true;
         Buttonopenactions.Enabled:=true;
         end
      else
         begin
         ButtonOpenWith.Enabled:=false;
         Buttonopenactions.Enabled:=false;
         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;
      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;
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;
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;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
sz:=0;
sz1:=0;
if listingdir=true then exit;
listingdir:=true;
keeppreview:=false;
beingpreviewed:='';
recpmem;
Form_peach.LabelErrors.Caption:='';
Form_peach.ImageListSearch.Enabled:=false;
settoolbar;
clean_archive_breadcrumb;
seemencrypted:=false;
if ptmpcode<>'' then cleardir(ptmpdir,true);
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[5].Width;
   if ccrc=true then col7size:=Form_Peach.ListView1.Column[6].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>2 then
         begin
         //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;
         //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[10,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[11,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[8,k]:=s1+directoryseparator;
         Form_peach.StringGridList.Cells[9,k]:=Form_peach.StringGridList.Cells[1,k];
         Form_peach.StringGridList.Cells[12,k]:='0';
         end
      else
         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[10,k]:='';
         Form_peach.StringGridList.Cells[11,k]:='';
         Form_peach.StringGridList.Cells[5,k]:='';
         Form_peach.StringGridList.Cells[8,k]:=s1+directoryseparator;
         Form_peach.StringGridList.Cells[9,k]:=Form_peach.StringGridList.Cells[1,k];
         Form_peach.StringGridList.Cells[12,k]:='0';
         end;
         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;
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))+', '+nicenumber(inttostr(sizefree))+' '+txt_free2+' ('+inttostr(i)+'%)';
infosize2:=48 * (100-i) div 100;
infosize1:=0;//valorized during update
update_listview;
Form_peach.Caption:=txt_mypc;
indir:=txt_mypc;
listingdir:=false;
{$ENDIF}
end;

procedure filter_archivecontent;
var
   i, nfolders,nfiles,size,csize,rsize,rc:integer;
   sfilter,sfilterf,stemp,stempf:ansistring;
begin

if status0=txt_list_browsing then list_un7z('browse')
else list_un7z('flat');

if h_folders=true then
begin

Form_Peach.ListView1.Items.BeginUpdate;
Form_Peach.StringGridList.BeginUpdate;
Form_Peach.StringGridAddress2.BeginUpdate;
Form_Peach.ListView1.Cursor:=crHourGlass;
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[8,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[8,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[8,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+strtoint(Form_peach.StringGridList.Cells[3,i]); except end;
        try csize:=csize+strtoint(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))+' > '+nicenumber(inttostr(csize));
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
   infosize2:=48 * rsize div 100;
except
   infosize2:=0;
end;
if (rsize>1) and (rsize<200) then status1:=status1+' ('+inttostr(rsize)+'%)';

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;

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[12,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))+' > '+nicenumber(inttostr(csize));
   try if size<>0 then cratio:=((csize) *100) div (size); except end;
   infosize2:=cratio * 48 div 100;
   infosize1:=0;
except
   status1:=txt_list_na;
   cratio:=0;
   infosize2:=0;
   infosize1:=0;
end
else
begin
try
   status1:=inttostr(i)+' '+txt_dirs+' '+inttostr(j)+' '+txt_files+' '+nicenumber(inttostr(size));
   cratio:=0;
   infosize2:=0;
   infosize1:=0;
except
   status1:=txt_list_na;
   cratio:=0;
   infosize2:=0;
   infosize1:=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[6,1]:='';
Form_peach.StringGridList.Cells[8,1]:=s;
Form_peach.StringGridList.Cells[9,1]:='';
Form_peach.StringGridList.Cells[10,1]:='';
Form_peach.StringGridList.Cells[11,1]:='';
Form_peach.StringGridList.Cells[12,1]:='1';
if Form_peach.StringGridList.RowCount>1 then Form_peach.StringGridList.Cells[12,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[10,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[8,i]:=ansitoutf8(copy(s,pos(char($09),s)+1,length(s)));
   Form_peach.StringGridList.Cells[1,i]:=extractfilename(Form_peach.StringGridList.Cells[8,i]);
   Form_peach.StringGridList.Cells[2,i]:=extractfileext(Form_peach.StringGridList.Cells[1,i]);
   Form_peach.StringGridList.Cells[12,i]:='0';
   blockread(f,b,1);
until end_browse=true;
closefile(f);
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.Cells[12,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: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:=1 to Form_peach.MemoList.Lines.Count-1 do
   begin
   s:=Form_peach.MemoList.Lines[i];
   if s<>'' then
      if s[1]='-' then
         begin
         k:=k+1;
         s:=copy(Form_peach.MemoList.Lines[i],42,length(Form_peach.MemoList.Lines[i])-41);//name
         s1:=extractfileext(s);
         s2:=copy(Form_peach.MemoList.Lines[i],23,12);//size
         s4:=copy(Form_peach.MemoList.Lines[i],3,19);//datetime
         s5:=copy(Form_peach.MemoList.Lines[i],36,6);//attributes
         Form_peach.StringGridList.Cells[8,k]:=s;
         Form_peach.StringGridList.Cells[1,k]:=extractfilename(s);
         Form_peach.StringGridList.Cells[2,k]:=s1;
         Form_peach.StringGridList.Cells[9,k]:='2'+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[6,k]:=s5;
         Form_peach.StringGridList.Cells[12,k]:='0';
         if s5='D     ' then
            begin
            s:=copy(Form_peach.MemoList.Lines[i],42,length(Form_peach.MemoList.Lines[i])-41);
            if s<>'' then
               if s[length(s)]='/' then setlength(s,length(s)-1);
            s1:=txt_list_isfolder;
            Form_peach.StringGridList.Cells[8,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[9,k]:='1'+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;
try
Form_peach.StringGridList.SortColRow(true,listsortcol);
sort_az_stringgridlist_special(listsortcol);
if az=false then sort_za_stringgridlist;
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.Cells[12,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[8,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[9,i-title_lines_ace+1]:='2'+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[10,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[11,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[9,i-title_lines_ace+1]:='1'+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[6,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[8,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[9,i-title_lines_ace+1]:='2'+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[10,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[11,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[9,i-title_lines_ace+1]:='1'+smartsortable(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
      end;
   Form_peach.StringGridList.Cells[6,i-title_lines_ace+1]:='';//attributes (not featured by the executable)
   {$ENDIF}
   Form_peach.StringGridList.Cells[12,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;
if Form_peach.StringGridList.RowCount>1 then
   begin
   Form_peach.StringGridList.Cells[12,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[8,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=txt_list_isfolder;
            nfolders:=nfolders+1;
            Form_peach.StringGridList.Cells[9,h]:='1'+smartsortable(Form_peach.StringGridList.Cells[1,h]);
            end
         else
            begin
            Form_peach.StringGridList.Cells[8,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=extractfileext(Form_peach.StringGridList.Cells[8,h]);
            nfiles:=nfiles+1;
            Form_peach.StringGridList.Cells[9,h]:='2'+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[10,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[11,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[6,h]:=copy(Form_peach.MemoList.Lines[i],21,7);
         Form_peach.StringGridList.Cells[7,h]:=copy(Form_peach.MemoList.Lines[i],61,8);
         Form_peach.StringGridList.Cells[12,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;
   Form_peach.StringGridList.Cells[12,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))+' > '+nicenumber(inttostr(csize));
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
   infosize2:=rsize * 48 div 100;
except
   infosize2:=0;
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[8,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=txt_list_isfolder;
            nfolders:=nfolders+1;
            Form_peach.StringGridList.Cells[9,h]:='1'+smartsortable(Form_peach.StringGridList.Cells[1,h]);
            end
         else
            begin
            Form_peach.StringGridList.Cells[8,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=extractfileext(Form_peach.StringGridList.Cells[8,h]);
            nfiles:=nfiles+1;
            Form_peach.StringGridList.Cells[9,h]:='2'+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[10,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[11,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[6,h]:=copy(Form_peach.MemoList.Lines[i],21,7);
         Form_peach.StringGridList.Cells[7,h]:=copy(Form_peach.MemoList.Lines[i],61,8);
         Form_peach.StringGridList.Cells[12,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;
   Form_peach.StringGridList.Cells[12,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))+' > '+nicenumber(inttostr(csize));
rsize:=0;
try
   if size<>0 then rsize:=((csize) *100) div (size);
   infosize2:=rsize * 48 div 100;
except
   infosize2:=0;
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 cleardir(var s:ansistring; cleardirname:boolean):integer;
//if directory is not cleared at first attempt (i.e. some objects temporary locked by system or security process), sleep 500 milliseconds and retry; from the second attempt ask for user intervention as probably there are some files locked by the user
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 := [poNoConsole, poWaitOnExit];
cl:='rm -r '+''''+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(50));
   {$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(50));
      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 := [poNoConsole, poWaitOnExit];
   cl:='rm -r '+''''+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=ptmpdir then
      if cleardir<>0 then
         if pMessageWarningOKAbort(txt_not_removable+char($0D)+char($0A)+s+char($0D)+char($0A)+txt_tempdir)=3 then break
         else
      else
   else
      if cleardir<>0 then
         if pMessageWarningOKAbort(txt_not_removable+char($0D)+char($0A)+s)=3 then break
         else
      else;
   end
else
   if cleardir<>0 then sleep(200+random(50));
until cleardir=0;
if cleardirname=true then s:='';
ptmpcode:='';
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
         if pMessageWarningOKAbort(txt_not_removable_file+char($0D)+char($0A)+s)=3 then break
         else
   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;
   c:char;
   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;{$ENDIF}
begin
{$IFDEF MSWINDOWS}
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>2 then
         begin
         //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
      else
         begin
         s1:=s;
         setlength(s1,length(s1)-1);
         devname[k]:='('+s1+') '+txt_unit_floppy;
         devtype[k]:=1;
         devicon[j]:=setpcmenuicon(devtype[k]);
         end;
      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.pmjd27.Visible:=true;
   Form_peach.pmjd27.Caption:=devname[1];
   Form_peach.pmjd27.bitmap:=Form_peach.pmjd1.bitmap;
   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.pmjd27.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.pmjd28.Visible:=true;
   Form_peach.pmjd28.Caption:=devname[2];
   Form_peach.pmjd28.bitmap:=Form_peach.pmjd2.bitmap;
   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.pmjd28.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.pmjd29.Visible:=true;
   Form_peach.pmjd29.Caption:=devname[3];
   Form_peach.pmjd29.bitmap:=Form_peach.pmjd3.bitmap;
   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.pmjd29.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.pmjd30.Visible:=true;
   Form_peach.pmjd30.Caption:=devname[4];
   Form_peach.pmjd30.bitmap:=Form_peach.pmjd4.bitmap;
   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.pmjd30.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.pmjd31.Visible:=true;
   Form_peach.pmjd31.Caption:=devname[5];
   Form_peach.pmjd31.bitmap:=Form_peach.pmjd5.bitmap;
   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.pmjd31.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.pmjd32.Visible:=true;
   Form_peach.pmjd32.Caption:=devname[6];
   Form_peach.pmjd32.bitmap:=Form_peach.pmjd6.bitmap;
   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.pmjd32.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.pmjd33.Visible:=true;
   Form_peach.pmjd33.Caption:=devname[7];
   Form_peach.pmjd33.bitmap:=Form_peach.pmjd7.bitmap;
   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.pmjd33.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.pmjd34.Visible:=true;
   Form_peach.pmjd34.Caption:=devname[8];
   Form_peach.pmjd34.bitmap:=Form_peach.pmjd8.bitmap;
   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.pmjd34.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.pmjd35.Visible:=true;
   Form_peach.pmjd35.Caption:=devname[9];
   Form_peach.pmjd35.bitmap:=Form_peach.pmjd9.bitmap;
   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.pmjd35.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.pmjd36.Visible:=true;
   Form_peach.pmjd36.Caption:=devname[10];
   Form_peach.pmjd36.bitmap:=Form_peach.pmjd10.bitmap;
   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.pmjd36.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.pmjd37.Visible:=true;
   Form_peach.pmjd37.Caption:=devname[11];
   Form_peach.pmjd37.bitmap:=Form_peach.pmjd11.bitmap;
   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.pmjd37.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.pmjd38.Visible:=true;
   Form_peach.pmjd38.Caption:=devname[12];
   Form_peach.pmjd38.bitmap:=Form_peach.pmjd12.bitmap;
   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.pmjd38.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.pmjd39.Visible:=true;
   Form_peach.pmjd39.Caption:=devname[13];
   Form_peach.pmjd39.bitmap:=Form_peach.pmjd13.bitmap;
   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.pmjd39.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.pmjd40.Visible:=true;
   Form_peach.pmjd40.Caption:=devname[14];
   Form_peach.pmjd40.bitmap:=Form_peach.pmjd14.bitmap;
   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.pmjd40.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.pmjd41.Visible:=true;
   Form_peach.pmjd41.Caption:=devname[15];
   Form_peach.pmjd41.bitmap:=Form_peach.pmjd15.bitmap;
   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.pmjd41.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.pmjd42.Visible:=true;
   Form_peach.pmjd42.Caption:=devname[16];
   Form_peach.pmjd42.bitmap:=Form_peach.pmjd16.bitmap;
   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.pmjd42.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.pmjd43.Visible:=true;
   Form_peach.pmjd43.Caption:=devname[17];
   Form_peach.pmjd43.bitmap:=Form_peach.pmjd17.bitmap;
   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.pmjd43.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.pmjd44.Visible:=true;
   Form_peach.pmjd44.Caption:=devname[18];
   Form_peach.pmjd44.bitmap:=Form_peach.pmjd18.bitmap;
   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.pmjd44.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.pmjd45.Visible:=true;
   Form_peach.pmjd45.Caption:=devname[19];
   Form_peach.pmjd45.bitmap:=Form_peach.pmjd19.bitmap;
   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.pmjd45.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.pmjd46.Visible:=true;
   Form_peach.pmjd46.Caption:=devname[20];
   Form_peach.pmjd46.bitmap:=Form_peach.pmjd20.bitmap;
   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.pmjd46.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.pmjd47.Visible:=true;
   Form_peach.pmjd47.Caption:=devname[21];
   Form_peach.pmjd47.bitmap:=Form_peach.pmjd21.bitmap;
   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.pmjd47.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.pmjd48.Visible:=true;
   Form_peach.pmjd48.Caption:=devname[22];
   Form_peach.pmjd48.bitmap:=Form_peach.pmjd22.bitmap;
   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.pmjd48.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.pmjd49.Visible:=true;
   Form_peach.pmjd49.Caption:=devname[23];
   Form_peach.pmjd49.bitmap:=Form_peach.pmjd23.bitmap;
   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.pmjd49.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.pmjd50.Visible:=true;
   Form_peach.pmjd50.Caption:=devname[24];
   Form_peach.pmjd50.bitmap:=Form_peach.pmjd24.bitmap;
   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.pmjd50.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.pmjd51.Visible:=true;
   Form_peach.pmjd51.Caption:=devname[25];
   Form_peach.pmjd51.bitmap:=Form_peach.pmjd25.bitmap;
   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.pmjd51.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.pmjd52.Visible:=true;
   Form_peach.pmjd52.Caption:=devname[26];
   Form_peach.pmjd52.bitmap:=Form_peach.pmjd26.bitmap;
   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.pmjd52.Visible:=false;
   Form_peach.pojdn26.Visible:=false;
   Form_peach.pajdn26.Visible:=false;
   end;
//set up to date icons to bookmarked units
populatebookmarks;
populaterecenticonsf;
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:integer;
begin
Form_peach.Timer2.Interval:=2000;
statuss:='';
set_archivetree:=false;
Form_peach.LabelClickAddress8.Color:=clNone;
Form_peach.ImageListSearch.Enabled:=true;
{$IFDEF MSWINDOWS}
if (s=txt_mypc) or (s='Computer''s root\') then
   begin
   listpc;
   exit;
   end;
{$ENDIF}
if listingdir=true then exit;
listingdir:=true;
keeppreview:=false;
beingpreviewed:='';
wasselected:=-1;
wasselectedp:=-1;
{$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);
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[9,i]:='1'+smartsortable(extractfilename(fname));
         end
      else
         begin
         Form_Peach.StringGridList.Cells[2,i]:=extractfileext(fname);
         Form_Peach.StringGridList.Cells[9,i]:='2'+smartsortable(extractfilename(fname));
         end;
   Form_Peach.StringGridList.Cells[1,i]:=extractfilename(fname);
   Form_Peach.StringGridList.Cells[8,i]:=(fname);
   Form_Peach.StringGridList.Cells[3,i]:=inttostr(fsizes[i-1]);
   size:=size+fsizes[i-1];
   if testext((fname))>=0 then
      if (testext((fname))>=500) and (testext((fname))<=503) then
         Form_Peach.StringGridList.Cells[4,i]:='.'
      else
         Form_Peach.StringGridList.Cells[4,i]:='+';
   Form_Peach.StringGridList.Cells[10,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[11,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[6,i]:=fname;
   Form_peach.StringGridList.Cells[12,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));
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))+', '+nicenumber(IntToStr(sizefree))+' '+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;
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))+', '+nicenumber(inttostr(sizefree))+' '+txt_free2;
   statuss:=nicenumber(inttostr(sizefree))+' '+txt_free2+' ('+inttostr(perfree)+'%)';
   end
else //unmapped network unit
   begin
   statust:=Form_peach.EditOpenIn.Caption;
   statuss:='';
   end;
infosize1:=48 * (100-perfree) div 100;
infosize2:=0;
{$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': browse_paq;
   'UNZPAQ': browse_zpaq;
   'UNACE': browse_ace;
   'UNARC':
      begin
      browse_arc('browse');//presently supported only flat browsing
      testencrypted_open;
      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;
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:='';
i:=list_un7z('silent');//don't add to history
teststatus(i,statust);
archive_content:=status1;
infosize1:=infosize2;
end;

procedure browse_special_cases_checkextension(s:ansistring);
var sl:ansistring;
begin
sl:=extractfileext(s);
if (sl='.z') or
(sl='.xz') 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
end;

procedure open_7z;
begin
browse_special_cases;
if prebrowse<2 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;
end;

procedure open_supported;
begin
stime:=(DateTimeToFileDate(now));
Form_peach.Timer2.Interval:=500;
Form_peach.ImageListSearch.Enabled:=true;
h_folders:=false;
nomatch:=false;
set_extcontext_off;
setsearch_disabled;
currentcomp:=upcase(extractfileext(Form_peach.OpenDialogArchive.Filename));
currentcomp:=copy(currentcomp,2,length(currentcomp)-1);
currentfs:='';
statust:='';
statuss:='';
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);
seemencrypted:=false;
fun:='';
fun_status:='';
subfun:='';
if keeppreview=false then create_ptmpcode(ptmpcode);
setpanel_extract(1);
try
   srcfilesize_multipart(Form_peach.OpenDialogArchive.Filename,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((executable_path+'res'+directoryseparator+'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;
   mv0.Checked:=false;
   mv1.Checked:=false;
   mv2.Checked:=false;
   mv3.Checked:=false;
   mv5.Checked:=false;
   mv5b.Checked:=false;
   mv6.Checked:=false;
   pmmstatus_status.Checked:=false;
   pmmstatus_details.Checked:=false;
   pmmstatus_bookmarks.Checked:=false;
   pmmstatus_ra.Checked:=false;
   pmmstatus_r.Checked:=false;
   pmmstatus_clipboard.Checked:=false;
   splitter1.Enabled:=true;
   Splitter1.Color:=stringtocolor(colbtnhigh);
   case s of
      'none' :
      begin
      Form_peach.MenuItemOrganizeStatusbar.Checked:=false;
      splitter1.top:=PanelFilters.Height;
      lastbar:=1;
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      panelfilebrowseroptions.visible:=false;
      panelinfo.visible:=false;
      mv0.Checked:=true;
      end;
      'statusbar' :
      begin
      splitter1.top:=PanelFilters.Height-PanelBottom.Height;
      splitter1.Enabled:=false;
      Splitter1.Color:=stringtocolor(color2);
      lastbar:=0;
      PanelBottom.visible:=true;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      panelfilebrowseroptions.visible:=false;
      panelinfo.visible:=false;
      mv1.Checked:=true;
      pmmstatus_status.Checked:=true;
      end;
      'details' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=false;
      panelfilebrowseroptions.visible:=false;
      panelinfo.visible:=true;
      Form_peach.StringGridClipboard.Autosizecolumns;
      lastbar:=2;
      splitter1.top:=PanelFilters.Height-splittersize;
      mv2.Checked:=true;
      pmmstatus_details.Checked:=true;
      LabelInfoGeneral.Caption:=txt_2_8_details;
      end;
      'bookmarks' :
      begin
      PanelBottom.visible:=false;
      stringgridrecent.visible:=false;
      StringGridSessionHistory.visible:=false;
      stringgridbookmarks.visible:=true;
      panelfilebrowseroptions.visible:=false;
      panelinfo.visible:=false;
      lastbar:=3;
      splitter1.top:=PanelFilters.Height-splittersize;
      mv3.Checked:=true;
      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;
      panelinfo.visible:=false;
      lastbar:=4;
      splitter1.top:=PanelFilters.Height-splittersize;
      mv5.Checked:=true;
      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;
      panelinfo.visible:=false;
      lastbar:=5;
      splitter1.top:=PanelFilters.Height-splittersize;
      mv5b.Checked:=true;
      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;
      panelinfo.visible:=false;
      Form_peach.StringGridClipboard.Autosizecolumns;
      lastbar:=6;
      splitter1.top:=PanelFilters.Height-splittersize;
      mv6.Checked:=true;
      pmmstatus_clipboard.Checked:=true;
      LabelInfoGeneral.Caption:=txt_2_7_clipboard;
      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;
   mPackedSize.Visible:=false;
   mArchive.Visible:=false;
   mOrganize.Visible:=false;
   mLayout.Visible:=false;
   mEdit.Enabled:=false;
   mArchive.Enabled:=false;
   mOrganize.Enabled:=false;
   mLayout.Enabled:=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.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.baboutweb.Caption:=txt_peazip_web;
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.baboutweb.Glyph:=Bweb;
psetbuttonwidth(Form_peach.baboutweb,16,true);
Form_peach.baboutweb.Height:=barheight;
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.baboutremoveadditional.Caption:=txt_2_5_remove+' Additional Formats Plugin';
psetbuttonwidth(Form_peach.baboutremoveadditional,16,true);
Form_peach.baboutremoveadditional.Height:=barheight;
Form_peach.baboutremoveunace.Caption:=txt_2_5_remove+' UNACE Plugin';
psetbuttonwidth(Form_peach.baboutremoveunace,16,true);
Form_peach.baboutremoveunace.Height:=barheight;
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.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.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.pbackground:=txt_2_5_tray;
unit_gwrap.pfromnativedrag:=false;
unit_gwrap.Barchive:=TBitmap.Create;
unit_gwrap.BArchive.Assign(BFolder96);
unit_gwrap.Bpriority1:=TBitmap.Create;
unit_gwrap.Bpriority1.Assign(Bpriority1);
unit_gwrap.Bpriority2:=TBitmap.Create;
unit_gwrap.Bpriority2.Assign(Bpriority2);
unit_gwrap.Bpriority3:=TBitmap.Create;
unit_gwrap.Bpriority3.Assign(Bpriority3);
unit_gwrap.Bpriority4:=TBitmap.Create;
unit_gwrap.Bpriority4.Assign(Bpriority4);
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.Imagefixed.Height:=i96res;
Form_gwrap.Imagefixed.Width:=i96res;
Form_gwrap.left:=ws_gw_left;
Form_gwrap.top:=ws_gw_top;
Form_gwrap.height:=ws_gw_height;
Form_gwrap.width:=ws_gw_width;
Form_gwrap.PanelTitle.Height:=tabheight;
Form_gwrap.Panel5.Height:=tabheightl;
Form_gwrap.StringGrid1.DefaultRowHeight:=rowsize;
unit_gwrap.pbarh:=pbarh;
unit_gwrap.pbarhsmall:=pbarhsmall;
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;
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_5_0_resetpm:=txt_5_0_resetpm;
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_reset;
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[9]:=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 CheckBoxAutoOpen.State=cbchecked then vopt4:=1 else vopt4:=0;
if CheckBoxClosePeaZip.State=cbchecked then vopt4d:=1 else vopt4d:=0;
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 cbencext.State=cbchecked then apencext:=1 else apencext:=0;
if CheckBoxdate.State=cbchecked then apappend:=1 else apappend:=0;
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='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 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 Checkboxstl.State=cbchecked then v7z17:=1 else v7z17:=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;
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;
//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='7Z' then method_7z:=compression_method;
      if cbType.Text='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 CheckBoxstl_onClick;
begin
if Form_peach.CheckBoxstl.State=cbChecked then stl7z:=1 else stl7z:=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_CheckBoxAutoOpen1Click;
begin
   if Form_peach.CheckBoxAutoOpen1.State=cbChecked then autoopen:=1 else autoopen:=0;
   Form_peach.CheckBoxAutoOpen.State:=Form_peach.CheckBoxAutoOpen1.State;
   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 on_CheckBoxAutoOpenClick;
begin
   if Form_peach.CheckBoxAutoOpen.State=cbChecked then autoopen:=1 else autoopen:=0;
   Form_peach.CheckBoxAutoOpen1.State:=Form_peach.CheckBoxAutoOpen.State;
   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 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_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.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;
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_cbdeleteinputmode1Change;
begin
favdelete:=Form_peach.cbdeleteinputmode1.ItemIndex;
Form_peach.cbdeleteinputmode.ItemIndex:=Form_peach.cbdeleteinputmode1.ItemIndex;
end;

procedure restorestatus_archiver;
begin
with form_peach do
begin
CheckBoxAutoHaltA.State:=cbUnchecked;
if vopt4=1 then CheckBoxAutoOpen.State:=cbchecked
else CheckBoxAutoOpen.State:=cbunchecked;
on_CheckBoxAutoOpenClick;
if vopt4d=1 then CheckBoxClosePeaZip.State:=cbchecked
else CheckBoxClosePeaZip.State:=cbunchecked;
form_peach.CheckBoxClosePeaZipClick(nil);
if apdefault=1 then mdefaultarchive.checked:=true else mdefaultarchive.checked:=false;
defaultarchivepath:=apdefaultarchivepath;
if mdefaultarchive.checked=true then
   mdefaultarchive.caption:=txt_2_8_usedefaultoutpath+' '+defaultarchivepath
else
   mdefaultarchive.caption:=txt_2_8_usedefaultoutpath;
//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 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_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 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 v7z17=1 then Checkboxstl.State:=cbchecked else Checkboxstl.State:=cbunchecked; CheckBoxstl_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;
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;
//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
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 CheckBoxAutoOpen1.State=cbchecked then vopt4b:=1 else vopt4b:=0;
if CheckBoxClosePeaZip1.State=cbchecked then vopt4e:=1 else vopt4e:=0;
if CheckBoxFolder.State=cbchecked then epfolder:=1
else epfolder:=0;
if CheckBoxFolder1.State=cbchecked then epfolder1:=1
else epfolder1:=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 CheckBoxzpaqall.State=cbchecked then epzall:=1
else epzall:=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 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 epfolder1=1 then CheckBoxFolder1.State:=cbchecked
else CheckBoxFolder1.State:=cbunchecked; on_CheckBoxFolder1_click;
if vopt4b=1 then CheckBoxAutoOpen1.State:=cbchecked
else CheckBoxAutoOpen1.State:=cbunchecked;
on_CheckBoxAutoOpen1Click;
if vopt4e=1 then CheckBoxClosePeaZip1.State:=cbchecked
else CheckBoxClosePeaZip1.State:=cbunchecked;
form_peach.CheckBoxClosePeaZip1Click(nil);
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_2_8_usedefaultoutpath+' '+defaultextractpath;
   pmusedefault.caption:=txt_2_8_usedefaultoutpath+' '+defaultextractpath;
   end
else
   begin
   mdefaultextract.caption:=txt_2_8_usedefaultoutpath;
   pmusedefault.caption:=txt_2_8_usedefaultoutpath;
   end;
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 epzall=1 then CheckBoxzpaqall.State:=cbchecked
else CheckBoxzpaqall.State:=cbunchecked; CheckBoxzpaqallClick(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;
vopt2:=RadioGroup4.ItemIndex;
vopt3:=RadioGroup6.ItemIndex;
voptlibre:=ComboBoxLibre.ItemIndex;
voptprivacy:=ComboBoxPrivacy.ItemIndex;
if CheckBoxnameasparentfolder.State=cbchecked then vopt4c:=1 else vopt4c:=0;
if CheckBoxDragDrop.State=cbchecked then vopt5e:=1 else vopt5e:=0;
if CheckBoxEditArchives.State=cbchecked then vopt5f:=1 else vopt5f:=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 CheckBoxNoConf.State=cbchecked then vopt5h:=1 else vopt5h:=0;
if CheckBoxForceOpen.State=cbchecked then vopt5c:=1 else vopt5c:=0;
if CheckBoxForceEdit.State=cbchecked then vopt5d:=1 else vopt5d:=0;
if CheckBoxEncoding.State=cbchecked then vopt6:=1 else vopt6:=0;
if CheckBoxEncoding1.State=cbchecked then vopt23:=1 else vopt23:=0;
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;
if CheckBoxBrowseNotVerbose.State=cbchecked then vopt15d:=1 else vopt15d:=0;
if CheckBox7zunrar5.State=cbchecked then vopt15e:=1 else vopt15e:=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 CheckBox4.State=cbchecked then vopt19:=1 else vopt19:=0;
vopt20:=RadioGroup1.ItemIndex;
vopt20b:=RadioGroup2.ItemIndex;
if cbcheckall.State=cbchecked then vopt21:=1 else vopt21:=0;
vopt22:=ComboBoxPasses.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_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_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_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.CheckBoxClosePeaZip1Click(Sender: TObject);
begin
if Form_peach.CheckBoxClosePeaZip1.State=cbChecked then autoclosepeazip:=1 else autoclosepeazip:=0;
Form_peach.CheckBoxClosePeaZip.State:=Form_peach.CheckBoxClosePeaZip1.State;
end;

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

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

procedure on_CheckBoxPrebrowse_click;
begin
prebrowse:=Form_peach.ComboBoxBrowser.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_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
if Form_peach.cbcheckall.State=cbChecked then
   begin
   algoall:=1;
   end
else
   begin
   algoall:=0;
   end;
end;

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

procedure on_CheckBoxEncoding1Click;
begin
if Form_peach.CheckBoxEncoding1.State=cbChecked then mcuzip:=1 else mcuzip:=0;
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.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);
popupmenu1.Alignment:=paRight;
popupmenu1.PopUp(p.x,p.y);
popupmenu1.Alignment:=paLeft;
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 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_CheckBoxForceEditClick;
begin
if Form_peach.CheckBoxForceEdit.State=cbChecked then forcecanbechanged:=1 else forcecanbechanged:=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 restorestatus_defaults;
begin
with form_peach do
begin
EditDesk.Caption:=vopt1; local_desktop:=vopt1;
RadioGroup4.ItemIndex:=vopt2; on_RadioGroup4Change;
RadioGroup6.ItemIndex:=vopt3; on_RadioGroup6Change;
ComboBoxLibre.ItemIndex:=voptlibre; on_ComboBoxLibreChange;
ComboBoxPrivacy.ItemIndex:=voptprivacy; on_ComboBoxPrivacyChange;
if vopt4c=1 then CheckBoxnameasparentfolder.State:=cbchecked
else CheckBoxnameasparentfolder.State:=cbunchecked;
on_CheckBoxnameasparentfolderclick;
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 vopt5h=1 then CheckBoxNoConf.State:=cbchecked else CheckBoxNoConf.State:=cbunchecked; on_CheckBoxNoConfClick;
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;
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 vopt6=1 then CheckBoxEncoding.State:=cbchecked else CheckBoxEncoding.State:=cbunchecked; on_CheckBoxEncodingClick;
if vopt23=1 then CheckBoxEncoding1.State:=cbchecked else CheckBoxEncoding1.State:=cbunchecked; on_CheckBoxEncoding1Click;
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  vopt15e=1 then CheckBox7zunrar5.State:=cbchecked else CheckBox7zunrar5.State:=cbunchecked; on_CheckBox7zunrar5_click;
ComboBoxBrowser.ItemIndex:=vopt15c; on_CheckBoxPrebrowse_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 vopt19=1 then CheckBox4.State:=cbchecked else CheckBox4.State:=cbunchecked; on_CheckBox4_click;
RadioGroup1.ItemIndex:=vopt20; on_RadioGroup1Click;
RadioGroup2.ItemIndex:=vopt20b; on_RadioGroup2Click;
if vopt21=1 then cbcheckall.State:=cbchecked else cbcheckall.State:=cbunchecked; on_cbcheckallClick;
Comboboxpasses.ItemIndex:=vopt22; on_ComboBoxPassesChange;
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) 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
      mEdit.Visible:=true;
      mLayout.Visible:=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));
   LabelStatusAr2.Caption:=status1;
   Form_peach.labelstatus4.Caption:='';
   setpanel_add(1);
   ButtonEditname12.Enabled:=true;
   Edit5.enabled:=true;
   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;
   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;
      mArchive.Visible:=true;
      mOrganize.Visible:=true;
      end;
   mPackedSize.Visible:=true;
   end;
   'extract' :
   begin
   prevpanel:='extract';
   updateid:='';
   prevupdateid:='';
   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
      mEdit.Visible:=true;
      mLayout.Visible:=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;
   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;
   updatepluginstatus;
   if savehistory=1 then Form_peach.LabelResetHistory.enabled:=true else Form_peach.LabelResetHistory.enabled:=false;
   savestatus_defaults;
   end;
   end;
mEdit.Enabled:=mEdit.Visible;
mArchive.Enabled:=mArchive.Visible;
mOrganize.Enabled:=mOrganize.Visible;
mLayout.Enabled:=mLayout.Visible;
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
{$IFDEF MSWINDOWS}
{$ELSE}
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
      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 (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+' '+delimiter+srec+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+FormAdvf.MemoAdvInclude.Lines[j]+delimiter+' ';
      end
   else
      begin
      i:=strtoint(sel);
      if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then in_param:=delimiter+srec+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+FormAdvf.MemoAdvInclude.Lines[j]+delimiter+' ';
      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+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' '
      else
         if (FormAdvf.MemoAdvInclude.Lines.Count=0) then
            in_param:=in_param+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' ';
   end
else
   begin
   i:=strtoint(sel);
   if Form_peach.StringGrid1.Cells[2,i]<>txt_list_isfolder then
      in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' '
   else
      if (FormAdvf.MemoAdvInclude.Lines.Count=0) then
         in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' ';
   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+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' '
else
   begin
   i:=strtoint(sel);
   in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' ';
   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+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+'*'+delimiter+' '
        {$ELSE}in_param:=in_param+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+delimiter+' '{$ENDIF}
     else
        in_param:=in_param+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' ';
     end
else
   begin
   i:=strtoint(sel);
   if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then
      {$IFDEF MSWINDOWS}in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+'*'+delimiter+' '
      {$ELSE}in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+DirectorySeparator+delimiter+' '{$ENDIF}
   else
      in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' ';
   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:=delimiter+'-dp'+ipath+delimiter+' ';
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+delimiter+escapefilename(iname,desk_env)+delimiter+' ';
      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+delimiter+escapefilename(iname,desk_env)+delimiter+' ';
   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];
   cutextension(s);
   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;

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: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:='';
   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;
            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 occour and filenames are not checked for that condition
outname:=out_param;
out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
{$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+' '+delimiter+'-x'+FormAdvf.MemoAdvExclude.Lines[i]+delimiter+' ';
      end;
   for i:=0 to FormAdvf.MemoAdvIncludeAlso.Lines.Count-1 do
      if extractfilepath(FormAdvf.MemoAdvIncludeAlso.Lines[i])<>'' then
         begin
         include_param:=include_param+' '+delimiter+'-n'+FormAdvf.MemoAdvIncludeAlso.Lines[i]+delimiter+' ';
         end;
end;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'arc'+DirectorySeparator+'arc'+EXEEXT+delimiter;
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 zaout=2 then if (pw='-p') or (pw=delimiter+'-p'+delimiter) or (pw='-hp') or (pw=delimiter+'-hp'+delimiter) then pw:='';//never pass empty password to pipe mode
if pw<>'' then cl:=cl+' '+pw;
if encalgo<>'' then cl:=cl+' '+encalgo;
if Form_peach.EditOParc.Text<>'' then cl:=cl+' '+Form_peach.EditOParc.Text;
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: get_usrtmp_path(out_param);
   2: out_param:=custom_work_path+DirectorySeparator;
   //3: "none" not apply to preview, uses output path, 4: "none (no preview)" disallow preview (checked in main function)
   end;
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);
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);
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 set_output_folder(var out_param:ansistring; in_param:ansistring; real_extract:boolean; action:integer);
var
   s,s1:ansistring;
   i:integer;
   out_created:boolean;
begin
out_created:=false;
if Form_peach.CheckBoxFolder.State=cbChecked then
      begin
      if action<2 then
         begin
         forcedirectories(out_param);
         s1:=extractfilename(in_param);
         if extractfileext(s1)<>'' then cutextension(s1) else cutendforbid(s1);
         cutendspaces(s1);
         cutenddot(s1);
         s:=out_param+s1;
         i:=0;
         repeat
            if not(directoryexists(s) or fileexists(s)) then
               begin
               if forcedirectories(s)=false then s:=out_param+'output';
               out_created:=true;
               end
            else
               begin
               i:=i+1;
               s:=out_param+s1+NAMEVARSTR+inttostr(i);
               if i=1000 then //to break recursivity if filename is not valid (ie unsupported character encoding)
                  begin
                  s:=out_param+'output';
                  out_created:=true;
                  end;
               end;
         until out_created=true;
         if copy(s,length(s)-1,1)<>directoryseparator then s:=s+directoryseparator;
         out_param:=s;
         removedir(s); //output folder is created on the fly
         end;
      end;
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=4 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, swithc 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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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;
if pw<>'' then
   begin
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar;
      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[12,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[8,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[8,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[8,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[8,Form_peach.StringGridList.Row];
      end;
   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[8,Form_peach.StringGridList.Row];
   {$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:=delimiter+'-dp'+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'arc'+DirectorySeparator+'arc'+EXEEXT+delimiter;
cl:=bin_name+' '+archive_function;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
cl:=cl+' '+in_param;
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+' -- '+delimiter+escapefilename(filter1,desk_env)+delimiter;
         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[12,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         filter1:=Form_peach.StringGridList.Cells[8,i];
         if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+delimiter+escapefilename(filter1,desk_env)+delimiter;
         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+' '+delimiter+escapefilename(filter1,desk_env)+delimiter;
      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[8,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]); exit; end;
   filter1:=Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row];
   if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
   cl:=cl+' -- '+delimiter+escapefilename(filter1,desk_env)+delimiter;
   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:ansistring;
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);
out_param:=s+'.'+ext_param;
apply_timestamptoname(out_param,1,0,'file');
outname:=out_param;
out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
get_in_param(in_param,sel);
bin_name:=delimiter+escapefilename(Form_peach.EditnameCustom.Text,desk_env)+delimiter;
if Form_peach.EditOPCustom.Text<>'' then param_param:=Form_peach.EditOPCustom.Text else param_param:='';
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_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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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 pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
      else
         if real_extract=true then clearfile(out_param); //avoid overwriting existing files since some programs will and return error exit code
if out_param<>'' then out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(Form_peach.EditnameCustom1.Text,desk_env)+delimiter;
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;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_uncustom_cl:=0;
end;

procedure getworkpath(var work_path:ansistring; out_param:ansistring);
begin
work_path:='';
case work_dir of
   {$IFDEF MSWINDOWS}
   0: work_path:=delimiter+'-w'+escapefilename(extractfilepath(out_param),desk_env)+delimiter;
   1: work_path:='-w'; //let 7z determinating appropriated temp folder
   2: work_path:=delimiter+'-w'+escapefilename(custom_work_path,desk_env)+delimiter;
   {$ELSE}
   0: work_path:=delimiter+'-w'+escapefilename(extractfilepath(out_param),desk_env)+delimiter;
   1: work_path:='-w';
   2: work_path:=delimiter+'-w'+escapefilename(custom_work_path,desk_env)+delimiter;
   {$ENDIF}
   end;
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;
   '.TAR': result:=1;
   '.ZIP': result:=1;
   '.ARC': result:=1;
   '.ZPAQ': 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 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,thread_option,dictionary_option,
   word_option,passes_option,compression_level,encalgo,openfiles_option,sccenc,work_path,mcu_option,path_option,psni,psns: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
      begin
      pMessageWarningOK(archive_type+' '+txt_error_input_multi);
      exit;
      end;
   end;
//output name
getarch_baseoutname(s);
if (Form_peach.CheckBoxArchive6.State=cbChecked) then out_param:=s+'.exe'
else out_param:=s+'.'+archive_type;
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') 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 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
{$IFDEF MSWINDOWS}
if Form_peach.CheckBoxArchiveOF.State=cbChecked then openfiles_option:='-ssw' else openfiles_option:='';
if keeppreview=true then openfiles_option:='-ssw';
{$ELSE}
openfiles_option:='';
{$ENDIF}
{$IFDEF MSWINDOWS}
case enc7zscc of
   0: sccenc:='-sccUTF-8';
   1: sccenc:='-sccWIN';
   2: sccenc:='-sccDOS';
   end;
//if archive_type='wim' then sccenc:=''; //seems supported or ignored
{$ELSE}
sccenc:='';
{$ENDIF}
//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;

   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;
            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 explicitely 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';
//Compression level
if Form_peach.ComboBoxArchive4.Text=txt_level_store then compression_level:='-mx0';
if Form_peach.ComboBoxArchive4.Text=txt_level_fastest then compression_level:='-mx1';
if Form_peach.ComboBoxArchive4.Text=txt_level_fast then compression_level:='-mx3';
if Form_peach.ComboBoxArchive4.Text=txt_level_normal then compression_level:='-mx5';
if Form_peach.ComboBoxArchive4.Text=txt_level_maximum then compression_level:='-mx7';
if Form_peach.ComboBoxArchive4.Text=txt_level_ultra then compression_level:='-mx9';
//compressor type
if compression_level<>'-mx0' then
   begin
   if type_option='-t7z' then compressor_option:='-m0='+compression_method;
   if type_option='-tzip' then compressor_option:='-mm='+compression_method;
   //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';
   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') then
   {$IFDEF MSWINDOWS}
   if (s='Deflate') or (s='Deflate64') or (s='LZMA') or (s='LZMA2') or (s='BZip2') then
   {$ELSE}
   if (s='Deflate') or (s='Deflate64') or (s='LZMA') or (s='LZMA2') or (s='BZip2') then
   //if (s='LZMA') or (s='LZMA2') or (s='BZip2') then
   {$ENDIF}
      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'; //maybe excessive
      6: thread_option:='-mmt=32'; //maybe excessive
      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' 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' 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='-m0=LZMA2')) and (Form_peach.ComboBoxArchive5.ItemIndex>0) then dictionary_option:='-md='+s+'m'; //only in 7z format, all LZMA dictionary sizes but the first are expressed in MB
   if (type_option='-tgzip') or (type_option='-tzip') then dictionary_option:=''; //zip/gzip doesn't need dictionary size param
   end
else dictionary_option:='';
//zip mcu uses UTF8 for file names that contain non-ASCII symbols
if (archive_type='zip') then
   if mcuzip=1 then mcu_option:='-mcu=on'
   else mcu_option:='';
//path option
case Form_peach.ComboBoxArchivePaths.ItemIndex of
   0: path_option:='';
   1: path_option:='-spf2';
   2: path_option:='-spf';
   end;
//NT, NTFS options (WIM only for now)
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;
//7za uses -- as tag to distinguish a filename starting with - from a switch, however since PeaZip uses absolute filenames it should never occour 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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
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+' '+delimiter+'-xr0!'+FormAdvf.MemoAdvExclude.Lines[i]+delimiter+' '
      else
         exclude_param:=exclude_param+' '+delimiter+'-x!'+FormAdvf.MemoAdvExclude.Lines[i]+delimiter+' ';
      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+' '+delimiter+'-ir0!'+FormAdvf.MemoAdvIncludeAlso.Lines[i]+delimiter+' '
          else
            include_param:=include_param+' '+delimiter+'-i!'+FormAdvf.MemoAdvIncludeAlso.Lines[i]+delimiter+' ';
      end;
end;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
cl:=bin_name+' '+archive_function+' '+type_option;
if compressor_option<>'' then cl:=cl+' '+compressor_option;
if thread_option<>'' then cl:=cl+' '+thread_option;
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 sccenc<>'' then cl:=cl+' '+sccenc;
if mcu_option<>'' then cl:=cl+' '+mcu_option;
if zaout=2 then if (pw='-p') or (pw=delimiter+'-p'+delimiter) then pw:='';//never pass empty password to pipe mode
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 stl7z=1 then cl:=cl+' -stl';
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=4 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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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;
      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[12,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[8,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[8,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[8,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[8,Form_peach.StringGridList.Row];
      end;
   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[8,Form_peach.StringGridList.Row];
   {$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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT+delimiter;
cl:=bin_name+' '+archive_function;
if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
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+' -- '+delimiter+escapefilename(filter1,desk_env)+delimiter;
         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[12,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         filter1:=Form_peach.StringGridList.Cells[8,i];
         if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+delimiter+escapefilename(filter1,desk_env)+delimiter;
         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+' '+delimiter+escapefilename(filter1,desk_env)+delimiter;
      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[8,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]); exit; end;
   filter1:=Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row];
   if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
   cl:=cl+' -- '+delimiter+escapefilename(filter1,desk_env)+delimiter;
   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,work_path,path_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;
//NT, NTFS options
esni:='';
esns:='';
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;
in_param:=delimiter+in_param+delimiter;
subfun:='extract';
btfun:='un7z';
//out_param
set_output_option(out_param);
if mode='preview' then
   begin
   if work_dir=4 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;
//folder policy
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);
//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;
if pw<>'' then
   begin
   if pw4cl('-p',pw)<>0 then
      begin
      msg_pw_errorchar;
      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
{$IFDEF MSWINDOWS}
case enc7zscc of
   0: sccenc:='-sccUTF-8';
   1: sccenc:='-sccWIN';
   2: sccenc:='-sccDOS';
   end;
{$ENDIF}
//archive function
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:='';
   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[12,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[8,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[8,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[8,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[8,Form_peach.StringGridList.Row];
      end;
   if fileexists((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[8,Form_peach.StringGridList.Row];
   {$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:=delimiter+'-o'+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
cl:=bin_name+' '+archive_function;
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 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
if pw<>'' then cl:=cl+' '+pw;
cl:=cl+' '+sccenc;
if path_option<>'' then cl:=cl+' '+path_option;
if esni<>'' then cl:=cl+' '+esni;
if esns<>'' then cl:=cl+' '+esns;
if (details<>'') and (archive_function='l') then cl:=cl+' '+details;
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+' -- '+delimiter+escapefilename(filter1,desk_env)+delimiter;
         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[12,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         filter1:=Form_peach.StringGridList.Cells[8,i];
         if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
         cl:=cl+' '+delimiter+escapefilename(filter1,desk_env)+delimiter;
         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+' '+delimiter+escapefilename(filter1,desk_env)+delimiter;
      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[8,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]); exit; end;
   filter1:=Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row];
   if copy(filter1,1,1)='.' then filter1:='*'+copy(filter1,2,length(filter1)-1);
   cl:=cl+' -- '+delimiter+escapefilename(filter1,desk_env)+delimiter;
   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:='EAX256 BATCH';
      1: strm_algo:='TF256 BATCH';
      2: strm_algo:='SP256 BATCH';
      3: strm_algo:='EAX BATCH';
      4: strm_algo:='TF BATCH';
      5: strm_algo:='SP BATCH';
      6: strm_algo:='HMAC BATCH';
      end;
   if FormPW.EditUn7zaPW.Text<>'' then
      strm_algo:=strm_algo+' '+delimiter+FormPW.EditUn7zaPW.Text+delimiter
   else
      strm_algo:=strm_algo+' default';
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)=0 then
         strm_algo:=strm_algo+' '+delimiter+FormPW.EditName3.Text+delimiter
      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;
      exit;
      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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
   get_in_param(in_param,sel);
   in_param:='FROMCL '+in_param;
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
   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
         pMessageWarningOK(txt_split+' '+txt_error_input_multi);
         exit;
         end;
   //out_param
   out_param:=Form_peach.StringGrid1.Cells[8,1];
   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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
   in_param:=delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,1],desk_env)+delimiter;
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
   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';
outname:='';//unused
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;
if Form_peach.CheckBoxUnPeaAttributes.State=cbChecked then attr_param:='SETATTR'
else attr_param:='RESETATTR';
out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
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+' '+delimiter+FormPW.EditUn7zaPW.Text+delimiter
      else
         cl:=cl+' default';
      if FormPW.EditName3.Text<>'' then
         if prepend_keyfile(pw,FormPW.EditName3.Text)=0 then
            cl:=cl+' '+delimiter+FormPW.EditName3.Text+delimiter
         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;
         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=4 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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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 pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
   else
      if real_extract=true then clearfile(out_param);
if not(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
if out_param<>'' then out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'lpaq'+DirectorySeparator+lpaq_ver+EXEEXT+delimiter;
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):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 control_outpath(out_param)<>0 then exit;
//in_param
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'paq'+DirectorySeparator+paq_ver+EXEEXT+delimiter;
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
         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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
      get_in_param(in_param,sel);
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'lpaq'+DirectorySeparator+paq_ver+EXEEXT+delimiter;
      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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
      get_in_param(in_param,sel);
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'paq'+DirectorySeparator+paq_ver+EXEEXT+delimiter;
      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;
            exit;
            end;
         pw:='-key '+pw;
         end;
      outname:=out_param+'.zpaq';
      out_param:=delimiter+escapefilename(out_param,desk_env)+'.zpaq'+delimiter;
      get_in_param_zpaq(in_param,sel);
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT+delimiter;
      cl:=bin_name;
      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;
begin
compose_unzpaq_cl:=-1;
subfun:='extract';
btfun:='unzpaq';
set_output_option(out_param);
if control_outpath(out_param)<>0 then exit;
//in_param
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   in_param:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//folder policy
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);
outname:=out_param;
if out_param<>'' then out_param:=delimiter+escapefilename(out_param,desk_env)+'/'+delimiter; //was needed by 4.04
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT+delimiter;
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;
      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 zpaqabsolute=0 then cl:=cl+' -to '+out_param;
      if zpaqall=1 then cl:=cl+' -all';
      if zpaqforce=1 then cl:=cl+' -f';
   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:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'upx'+DirectorySeparator+'upx'+EXEEXT+delimiter;
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:=('"'+executable_path+'res'+DirectorySeparator+'upx'+DirectorySeparator+'strip.exe" '+in_param);
   {$ENDIF}
   {$IFDEF UNIX}//assuming generic unix coming qith strip command
   P.CommandLine:=('strip '+in_param);
   {$ENDIF}
   if Form_peach.Visible=true then Application.ProcessMessages;
   P.Options := [poNoConsole, poWaitOnExit];
   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
   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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
get_in_param(in_param,sel);
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'brotli'+DirectorySeparator+'brotli'+EXEEXT+delimiter;
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=4 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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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 mode<>'test' then
   if fileexists((out_param)) then
      if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
      else
         if real_extract=true then clearfile(out_param);
if not(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
if out_param<>'' then out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'brotli'+DirectorySeparator+'brotli'+EXEEXT+delimiter;
if mode<>'test' then cl:=bin_name+' -d '+in_param+' -o '+out_param
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
   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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
get_in_param(in_param,sel);
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'zstd'+DirectorySeparator+'zstd'+EXEEXT+delimiter;
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=27';
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=4 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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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 mode<>'test' then
   if fileexists((out_param)) then
      if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
      else
         if real_extract=true then clearfile(out_param);
if not(DirectoryExists(extractfilepath(out_param))) then CreateDir(extractfilepath(out_param));
if out_param<>'' then out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'zstd'+DirectorySeparator+'zstd'+EXEEXT+delimiter;
if mode<>'test' then cl:=bin_name+' -d '+in_param+' -o '+out_param
else cl:=bin_name+' -t '+in_param;
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
   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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
get_in_param(in_param,sel);
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'quad'+DirectorySeparator+exetype+EXEEXT+delimiter;
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=4 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:=delimiter+escapefilename(s_in,desk_env)+delimiter;
//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 pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
   else
      if real_extract=true then 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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
if extractfileext(s_in)='.quad' then
   begin
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'quad'+DirectorySeparator+'quad'+EXEEXT+delimiter;
   cl:=bin_name+' -d '+in_param+' '+out_param;
   btfun:='unquad';
   end;
if extractfileext(s_in)='.bcm' then
   begin
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'quad'+DirectorySeparator+'bcm'+EXEEXT+delimiter;
   cl:=bin_name+' -d '+in_param+' '+out_param;
   btfun:='unbcm';
   end;
if extractfileext(s_in)='.balz' then
   begin
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'quad'+DirectorySeparator+'balz'+EXEEXT+delimiter;
   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:=delimiter+escapefilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],desk_env)+delimiter
else
   in_param:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
//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[8,Form_peach.StringGridList.Row]);
      end
   else
      begin
      archive_function:='x';
      tempstring:=Form_peach.StringGridList.Cells[8,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[8,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[8,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;
//if out_param<>'' then out_param:=delimiter+escapefilename(out_param)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unace'+DirectorySeparator+'unace'+EXEEXT+delimiter;
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 implicitely 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:ansistring;
begin
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
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
   if Form_peach.cbcheckall.state=cbchecked then algo_list:='ALL'
   else
   begin
   algo_list:='CRC32 CRC64 MD5 RIPEMD160 SHA1 BLAKE2S SHA256 SHA3_256';
   end;
cl:=bin_name+' CHECK '+disp_type+' '+algo_list+' ON '+in_param;
end;

procedure decode_7za_exitcode(i,insize:integer; cl,s,outname:ansistring);
begin
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
      s:=inttostr(i)+txt_7z_exitcodeunknown+' '+s+char($0d)+char($0a)+' - '+txt_cl+' '+cl;
      pMessageErrorOK(s);
      end;
   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:ansistring;
   i,jobtype:integer;

   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))
   else
      begin
      s:=s+' - '+txt_input+' '+Form_peach.EditOpenIn.Text;
      s:=s+', '+nicenumber(inttostr(tsize));
      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);
   P.Options:=[poNewConsole];
   cl:=P.Commandline;
   if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; 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';
   decode_7za_exitcode(P.ExitStatus,insize,cl,s,outname);
   end;

begin
result:=-1;
if length(cl)>MAX_CL then
   begin
   pMessageErrorOK(txt_cl_long);
   inputfile:='';
   exit;
   end;
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); 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; end //launch Pea
else //launch either or pealauncher or ConsoleCreate application, depending on rules
   begin
   insize:=tsize;
   if (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;
      inputfile:='';
      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:=[poNewConsole];{$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.ppsize:='0';
      case subfun of
         'archive':
         begin
         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 Form_peach.ComboBoxOverwrite.Caption<>'' then
            unit_gwrap.paction:=' ('+Form_peach.ComboBoxOverwrite.Caption+')'
         else
            unit_gwrap.paction:='';
         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.psubfun:=subfun;
      unit_gwrap.pcl:=cl;
      unit_gwrap.runelevated:=false;
      unit_gwrap.pfun:=fun;
      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')) 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;
      inputfile:='';
      zaout:=zaout1;
      result:=unit_gwrap.exit_code;
      if result<>0 then setsequenceerror:=true;
      unit_gwrap.pfromnativedrag:=false;
      end
   else
      begin
      withconsole;
      inputfile:='';
      zaout:=zaout1;
      result:=P.ExitCode;
      if result<>0 then setsequenceerror:=true;
      unit_gwrap.pfromnativedrag:=false;
      P.Free;
      end;
   end;
end;

function archive_mainsequence(var sel:ansistring; var clres:integer):integer;
var
   cl,jobcode,outname,s:ansistring;
begin
archive_mainsequence:=-1;
s:=Form_peach.cbType.Text;
if s=txt_sfx+' '+STR_ARC then s:='arcsfx';
if s=txt_custom 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);
   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;

procedure tarbefore(var sel,outname:ansistring);
var
   P:tprocessutf8;
   cl,s,work_path,out_param,in_param,archive_function,bin_name,type_option:ansistring;
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
type_option:='-ttar';
// 7za uses -- as tag to distinguish a filename starting with - from a switch, however since Peach uses absolute filenames it should never occour and filenames are not checked for that condition
outname:=out_param;
getworkpath(work_path,out_param);
out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
get_in_param(in_param,sel);
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
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;
P.Options := [poNoConsole, poWaitOnExit]; //wait for tar to be finished before starting compression
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
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;
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,dn: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:=false
else pkeep:=true;
s:=peaziptmpdir;
s1:=optype+FormatDateTime('yymmdd',now)+GetPathDigest(paramstr(2));
dn:=s+s1;
if not(directoryexists(dn)) then
   begin
   randomize;
   if forcedirectories(dn)=false then
      begin
      sleep(50+random(50));
      if forcedirectories(dn)=false then
         begin
         sleep(100+random(100));
         forcedirectories(dn);
         end;
      end;
   filesetattr(dn, 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(50+random(50));
   try
      assignfile(t,fn);
      rewrite(t);
      writeln(t,(paramstr(2)));
      closefile(t);
   except
      sleep(100+random(100));
      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
   begin
   multis:='"'+dn+'"';
   nf:=1;
   nok:=0;
   ndone:=0;
   sleep(200+random(50));
   repeat
      listdetails(dn,'*',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 if taking too much time
      sleep(200+random(50));
   until nok>4;
   CloseHandle(psem);
   end;
{$ENDIF}
end;

procedure endmultimode;
begin
Form_peach.timer3.enabled:=false;
if dn<>'' then
   begin
   removedir(dn);
   dn:='';
   end;
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 sleep(50)
   else
      begin
      CloseHandle(psemwait);
      pgoti:=pgoti+1;
      end;
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 sleep(50)
   else
      begin
      CloseHandle(psemwait);
      pgoti:=pgoti+1;
      end;
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;
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;
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;
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);
   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 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;
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);
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;
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;
end;

procedure add2multi;
var
   s,cl:ansistring;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('add',s);
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemulti '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemulticonvert '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemultiseparate '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemulti7z '+level+' '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemultizip '+level+' '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemultisplit '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -add2archivemultisfx '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -ext2archivemulti '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' '+dirdirective+' '+s;
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P.Execute;
P.Free;
{$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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
for i:=2 to j+1 do in_param:=in_param+delimiter+escapefilename(ExpandFileName((paramstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
if pmode='crypt' then
   cl:=bin_name+' '+fun+' '+out_param+' 0 PCOMPRESS2 SHA256 CRC64 EAX256 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 pbatch='complete' then 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+delimiter+escapefilename(ExpandFileName((paramstr(i))),desk_env)+delimiter+' ';
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
      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];{$ELSE}P.Options := [poNoConsole, 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+delimiter+escapefilename(ExpandFileName((paramstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+s+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
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 '+delimiter+out_param+delimiter;
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,cl,jobcode,work_path,out_param,in_param,bin_name,outname: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);
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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
for i:=2 to j+1 do in_param:=in_param+delimiter+escapefilename(ExpandFileName((paramstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
if pmode='zip' then
   begin
   {$IFDEF MSWINDOWS}
   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;
   {$ELSE}
   case level_zip of
   0: cl:=bin_name+' a -tzip -mm=Copy -mx0';
   1: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx1';
   2: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx3';
   3: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx5';
   4: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx7';
   5: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx9';
   end;
   {$ENDIF}
   end
else
   case level_7z of
   0: cl:=bin_name+' a -t7z -m0=Copy -mmt=on -mx0';
   1: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx1';
   2: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx3';
   3: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx5';
   4: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx7';
   5: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx9';
   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 work_path<>'' then cl:=cl+' '+work_path;
cl:=cl+' '+out_param+' '+in_param;
launch_cl(cl,jobcode,outname);
if pbatch='complete' then 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: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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
      in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
      if pmode='zip' then
         begin
         {$IFDEF MSWINDOWS}
         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;
         {$ELSE}
         case level_zip of
         0: cl:=bin_name+' a -tzip -mm=Copy -mx0';
         1: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx1';
         2: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx3';
         3: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx5';
         4: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx7';
         5: cl:=bin_name+' a -tzip -mm='+method_zip+' -mx9';
         end;
         {$ENDIF}
         end
      else
         case level_7z of
         0: cl:=bin_name+' a -t7z -m0=Copy -mmt=on -mx0';
         1: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx1';
         2: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx3';
         3: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx5';
         4: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx7';
         5: cl:=bin_name+' a -t7z -m0='+method_7z+' -mmt=on -mx9';
         end;
      if nonverboselog=1 then cl:=cl+' -bb0 -bse0 -bsp2' else cl:=cl+' -bb1 -bse1 -bsp2';//requires v15.x
      if work_path<>'' then cl:=cl+' '+work_path;
      cl:=cl+' '+out_param+' '+in_param;
      launch_cl(cl,jobcode,outname);
      if pbatch='complete' then 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 := [poNoConsole, poWaitOnExit];
cl:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -ext2openpwtest '+delimiter+pwtotest+delimiter+' '+delimiter+escapefilename(in_param,desk_env)+delimiter;
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,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 FormPW.CheckBoxEncFn.State=cbChecked then encfn:=true else encfn:=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;
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 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 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;
   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');
         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;
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 (extractfileext(s1)<>'.7z') and
   (extractfileext(s1)<>'.rar') and
   (extractfileext(s1)<>'.arc') then
      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;
      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);
var
   j,ec:integer;
   P:tprocessutf8;
   s,cl,jobcode,bin_name,overwrite_policy,archive_function,paq_ver,lpaq_ver,outname,pw,pwtotest,ext,desni,desns:ansistring;
   fsize:qword;
begin
   setpwtotest(pwtotest);
   inputfile:=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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
            bin_name:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter;
            {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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);
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
         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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'paq'+DirectorySeparator+paq_ver+EXEEXT+delimiter;
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         if fileexists((out_param)) then
            if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
            else clearfile(out_param);
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'quad'+DirectorySeparator+ext+EXEEXT+delimiter;
         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((executable_path+'res'+directoryseparator+'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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unace'+DirectorySeparator+'unace'+EXEEXT+delimiter;
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         if fileexists((out_param)) then
            if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
            else clearfile(out_param);
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'lpaq'+DirectorySeparator+lpaq_ver+EXEEXT+delimiter;
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         out_param:=delimiter+'-dp'+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'arc'+DirectorySeparator+'arc'+EXEEXT+delimiter;
         cl:=bin_name+' x '+overwrite_policy+' '+in_param;
         if pw<>'' then cl:=cl+' '+pw;
         cl:=cl+' '+out_param;
         launch_cl(cl,jobcode,outname);
         end;
     10: begin
         fun:='UNZPAQ';
         fun_status:=fun;
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         outname:=out_param;
         if out_param<>'' then
            if out_param[length(out_param)]=directoryseparator then setlength(out_param,length(out_param)-1);
         in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'zpaq'+DirectorySeparator+'zpaq'+EXEEXT+delimiter;
         cl:=bin_name+' x '+in_param;
         launch_cl(cl,jobcode,outname);
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         if fileexists((out_param)) then
            if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
            else clearfile(out_param);
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'brotli'+DirectorySeparator+'brotli'+EXEEXT+delimiter;
         cl:=bin_name+' -d '+in_param+' -o '+out_param;
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         if fileexists((out_param)) then
            if pMessageWarningYesNo(out_param+' '+txt_confirm_overwrite)<>6 then exit
            else clearfile(out_param);
         out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'zstd'+DirectorySeparator+'zstd'+EXEEXT+delimiter;
         cl:=bin_name+' -d '+in_param+' -o '+out_param;
         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:=delimiter+escapefilename(out_param,desk_env)+delimiter;
            in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
            bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT+delimiter;
            archive_function:='x';
            cl:=bin_name+' '+archive_function;
            cl:=cl+' '+in_param;
            if overwrite_policy<>'' then cl:=cl+' '+overwrite_policy;
            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:='';
            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;
            //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;
            out_param:=delimiter+'-o'+escapefilename(out_param,desk_env)+delimiter;
            in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
            bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
            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;
            cl:=cl+' '+pw;
            if desni<>'' then cl:=cl+' '+desni;
            if desns<>'' then cl:=cl+' '+desns;
            cl:=cl+' '+in_param;
            launch_cl(cl,jobcode,outname);
            end;
         end;
      end;
   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;
   testencrypted_fromname(in_param);
   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 pbatch='complete' then erase_fromname('extract',in_param);
         exit;
         end;
      end;
   'simple':
      begin
      out_param:=paramstr(3);
      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;
   if folderoption='newfolder' then
      begin
      Form_peach.CheckBoxFolder.State:=cbChecked;
      end;
   if out_param<>'' then
      if out_param[length(out_param)]<>directoryseparator then out_param:=out_param+directoryseparator;
   //end determination of out_param
   directextractfromname(in_param,out_param,'extract');
   if pbatch='complete' then erase_fromname('extract',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((executable_path+'res'+directoryseparator+'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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unace'+DirectorySeparator+'unace'+EXEEXT+delimiter;
         //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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
         bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'arc'+DirectorySeparator+'arc'+EXEEXT+delimiter;
         //archive function
         archive_function:=ltfun;
         cl:=bin_name+' '+archive_function;
         cl:=cl+' '+in_param;
         cl:=cl+' '+pw;
         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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
            bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT+delimiter;
            //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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
            bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
            //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;
            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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter;
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter;
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+escapefilename(in_param,desk_env)+delimiter;
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter;
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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}
P.Executable:=wincomspec;
P.Parameters.Add('/k');
P.Parameters.Add('cd');
P.Parameters.Add('/d');
P.Parameters.Add('"'+s+'"');
cl:=wincomspec+' /k cd /d "'+s+'"';
{$ELSE}//system needs to mPeaSupport konsole, gnome-tem or xterm
case desk_env of
   0: begin P.Executable:='xterm'; cl:='xterm'; end;//unknown, not win or osx
   1: begin P.Executable:='gnome-terminal'; P.Parameters.Add('--working-directory='''+s+''''); cl:='gnome-terminal --working-directory='''+s+''''; end;//Gnome
   2: begin P.Executable:='konsole'; P.Parameters.Add('--workdir '''+s+''''); cl:='konsole --workdir '''+s+''''; end;//KDE
   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;
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_wintemp;
var
   s:ansistring;
begin
{$IFDEF MSWINDOWS}
s:=peaziptmpdir;
cleardir(s,true);
{$ENDIF}
end;

procedure on_exit;
begin
try
if Form_peach.Visible=true then
   begin
   if ((ws_width>=Screen.Width) or (ws_height>=screen.height)) then
      begin
      ws_status:=1;
      Form_peach.WindowState:=wsMaximized;
      end
   else
      if Form_peach.WindowState=wsNormal then
      begin
      ws_left:=Form_peach.Left;
      ws_top:=Form_peach.Top;
      ws_width:=Form_peach.Width;
      ws_height:=Form_peach.Height;
      end;
   end;
except
end;
form_peach.Visible:=false;
try
if ptmpcode<>'' then cleardir(ptmpdir,true);
reset_wintemp;
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
{$IFDEF MSWINDOWS}
cl:=delimiter+executable_path+'peazip'+EXEEXT+delimiter;
{$ELSE}
cl:=executable_path+'peazip'+EXEEXT;
{$ENDIF}
if validatecl(cl)<>0 then begin pMessageWarningOK(txt_2_7_validatecl+' '+cl); exit; end;
P:=tprocessutf8.Create(nil);
P.Executable:=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:=executable_path+'res'+directoryseparator+'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);
{$IFDEF MSWINDOWS}
{$ELSE}
   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);
case i of
   1: cl:=delimiter+custedit1+delimiter;
   2: cl:=delimiter+custedit2+delimiter;
   3: cl:=delimiter+custedit3+delimiter;
   4: cl:=delimiter+custedit4+delimiter;
   5: cl:=delimiter+custedit5+delimiter;
   6: cl:=delimiter+custedit6+delimiter;
   7: cl:=delimiter+custedit7+delimiter;
   8: cl:=delimiter+custedit8+delimiter;
   9: cl:=delimiter+custedit9+delimiter;
   10: cl:=delimiter+custedit10+delimiter;
   11: cl:=delimiter+custedit11+delimiter;
   12: cl:=delimiter+custedit12+delimiter;
   13: cl:=delimiter+custedit13+delimiter;
   14: cl:=delimiter+custedit14+delimiter;
   15: cl:=delimiter+custedit15+delimiter;
   16: cl:=delimiter+custedit16+delimiter;
   end;
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);
case i of
   1: if isawebservice(custedit1) then
         cl:=delimiter+custedit1+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit1+delimiter+' '+delimiter+s+delimiter;
   2: if isawebservice(custedit2) then
         cl:=delimiter+custedit2+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit2+delimiter+' '+delimiter+s+delimiter;
   3: if isawebservice(custedit3) then
         cl:=delimiter+custedit3+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit3+delimiter+' '+delimiter+s+delimiter;
   4: if isawebservice(custedit4) then
         cl:=delimiter+custedit4+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit4+delimiter+' '+delimiter+s+delimiter;
   5: if isawebservice(custedit5) then
         cl:=delimiter+custedit5+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit5+delimiter+' '+delimiter+s+delimiter;
   6: if isawebservice(custedit6) then
         cl:=delimiter+custedit6+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit6+delimiter+' '+delimiter+s+delimiter;
   7: if isawebservice(custedit7) then
         cl:=delimiter+custedit7+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit7+delimiter+' '+delimiter+s+delimiter;
   8: if isawebservice(custedit8) then
         cl:=delimiter+custedit8+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit8+delimiter+' '+delimiter+s+delimiter;
   9: if isawebservice(custedit9) then
         cl:=delimiter+custedit9+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit9+delimiter+' '+delimiter+s+delimiter;
   10: if isawebservice(custedit10) then
         cl:=delimiter+custedit10+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit10+delimiter+' '+delimiter+s+delimiter;
   11: if isawebservice(custedit11) then
         cl:=delimiter+custedit11+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit11+delimiter+' '+delimiter+s+delimiter;
   12: if isawebservice(custedit12) then
         cl:=delimiter+custedit12+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit12+delimiter+' '+delimiter+s+delimiter;
   13: if isawebservice(custedit13) then
         cl:=delimiter+custedit13+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit13+delimiter+' '+delimiter+s+delimiter;
   14: if isawebservice(custedit14) then
         cl:=delimiter+custedit14+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit14+delimiter+' '+delimiter+s+delimiter;
   15: if isawebservice(custedit15) then
         cl:=delimiter+custedit15+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit15+delimiter+' '+delimiter+s+delimiter;
   16: if isawebservice(custedit16) then
         cl:=delimiter+custedit16+extractfilename(s)+delimiter
      else
         cl:=delimiter+custedit16+delimiter+' '+delimiter+s+delimiter;
   end;
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+delimiter+s+delimiter+advedit1after;
   2: cl:=advedit2before+delimiter+s+delimiter+advedit2after;
   3: cl:=advedit3before+delimiter+s+delimiter+advedit3after;
   4: cl:=advedit4before+delimiter+s+delimiter+advedit4after;
   5: cl:=advedit5before+delimiter+s+delimiter+advedit5after;
   6: cl:=advedit6before+delimiter+s+delimiter+advedit6after;
   7: cl:=advedit7before+delimiter+s+delimiter+advedit7after;
   8: cl:=advedit8before+delimiter+s+delimiter+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 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.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(executable_path+'peazip_help.pdf',desk_env);
end;

procedure TForm_peach.baboutremoveadditionalClick(Sender: TObject);
begin
//unused
end;

procedure TForm_peach.baboutremoveunaceClick(Sender: TObject);
var
   s:ansistring;
begin
s:=executable_path+'res'+DirectorySeparator+'unace'+DirectorySeparator;
cleardir(s,true);
updatepluginstatus;
end;

procedure TForm_peach.baboutremoveunrarClick(Sender: TObject);
var
   s:ansistring;
begin
s:=executable_path+'res'+DirectorySeparator+'unrar'+DirectorySeparator;
cleardir(s,true);
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.babouttrackerClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-more.html',desk_env);
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;
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;
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');
if fun='7Z' then reloadandbrowse
else open_inputselect;
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
  possiblyduplicate('displayed');
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.CheckBoxAutoOpen1Click(Sender: TObject);
begin
on_CheckBoxAutoOpen1Click;
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.CheckBoxTBWClick(Sender: TObject);
begin //oddly buttons are not correctly rendered after autosize is set to false (height is not autosized, while width is) until application restarts
if CheckBoxTBW.State=cbChecked then autosizetoolbarbutton:=1 else autosizetoolbarbutton:=0;
restartclosepeaapp;
end;

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

procedure TForm_peach.CheckBoxzpaqabsoluteClick(Sender: TObject);
begin
if CheckBoxzpaqabsolute.Checked=true then
   begin
   zpaqabsolute:=1;
   CheckBoxzpaqall.enabled:=false;
   end
else
   begin
   zpaqabsolute:=0;
   CheckBoxzpaqall.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.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.ComboBoxBrowserChange(Sender: TObject);
begin
on_CheckBoxPrebrowse_click;
end;

procedure TForm_peach.ComboBoxWDChange(Sender: TObject);
begin
on_ComboBoxWDChange;
if work_dir=2 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:=0;
            Form_peach.ComboBoxWD.ItemIndex:=0;
            custom_work_path:='';
            Form_peach.Labelcwd.Caption:='';
            end
         end
   else
      begin
      if custom_work_path='' then
         begin
         work_dir:=0;
         Form_peach.ComboBoxWD.ItemIndex:=0;
         custom_work_path:='';
         Form_peach.Labelcwd.Caption:='';
         end
      end
else
   begin
   custom_work_path:='';
   Form_peach.Labelcwd.Caption:='';
   end
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;
end;

procedure TForm_peach.ComboBoxArchive9Change(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;
Form_peach.pmbcspacer.visible:=false;
Form_peach.pmquickdesk.visible:=false;
Form_peach.pmquickhome.visible:=false;
Form_peach.pmquickop.visible:=false;
Form_peach.pmquickoa.visible:=false;
Form_peach.pmquicksd.visible:=false;
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.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[8,i])=1) or (saddr='') then
     if not(MatchesMask(Form_Peach.StringGridAddress1.Cells[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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[8,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.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='.paq8o') or (sext='.lpaq8')
      or (sext='.zpaq') 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);
if statuss<>'' then
   begin
   Form_peach.labelstatusAr.Visible:=true;
   Form_peach.labelstatusAr.Caption:=status_curfilesystem;
   end
else
   begin
   Form_peach.labelstatusAr.Visible:=false;
   Form_peach.labelstatusAr.Caption:='';
   end;
end;

procedure exit_fromaddress(exitmode:integer);
begin
if usebreadcrumb=0 then exit;
Form_peach.PanelClickAddress.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;
Form_Peach.ListView1.Cursor:=crHourGlass;

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 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;
   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: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.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;
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 (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;
begin
testencrypted_open:=-1;
if Form_peach.StringGridList.RowCount<2 then exit;
if (fun<>'UNARC') and
   (fun<>'UN7Z') then exit;
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 then
         if 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_nonreadableorpw;
            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 eowcustom(j:integer; custmode:ansistring);
var
   i:integer;
   cl,jobcode,outname,s: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 exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then
            begin
            s:=outname;
            if s<>'' then
               if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
            s:=s+Form_peach.StringGridList.Cells[8,i];
            if custmode='cust' then open_custedit(j, s)
            else open_advcustedit(j, s);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then
            begin
            s:=outname;
            if s<>'' then
               if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
            s:=s+Form_peach.StringGridList.Cells[8,i];
            if custmode='cust' then open_custedit(j, s)
            else open_advcustedit(j, s);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

procedure TForm_peach.eowcustom_9Click(Sender: TObject);
begin
eowcustom(9,'cust');
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[12,i]='1' then
      if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //no folders
         begin
         test_extfile(Form_peach.StringGridList.Cells[8,i],okfile);
         if okfile=true then k:=k+1;
         end;
if k>0 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[12,i]='1' then
      if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //no folders
         begin
         test_extfile_noduplicatecheck(Form_peach.StringGridList.Cells[8,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 created 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;
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[12,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.ImageInfoArchive2Click(Sender: TObject);
begin
pMessageInfoOK(ImageInfoArchive2.Hint);
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.ImageInfoOpen4Click(Sender: TObject);
begin
pmbreadcrumb.PopUp;
end;

procedure TForm_peach.ImageListRootMouseEnter(Sender: TObject);
begin
  panel11.Color:=StringToColor(COLHIGH);
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:=StringToColor(COLHIGH);
end;

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

procedure TForm_peach.ImageListSearchDblClick(Sender: TObject);
begin
  PanelSearch.Visible:=not(PanelSearch.Visible);
  if PanelSearch.Visible=true then try EditUn7zaFilter1.SetFocus; except end;
end;

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

procedure TForm_peach.ImageListSearchMouseLeave(Sender: TObject);
begin
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;
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
      begin
      if forcedirectories(s)=false then 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);
         end;
         '+++' :
         begin
         cleardir(oname,false);
         end;
         end;
      end;
   end;
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 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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
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}
   case Form_peach.cbdeleteinputmode1.ItemIndex of
      0: erasemode:=0;
      1: erasemode:=2;
      2: erasemode:=1;
   end;
   {$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}
   case Form_peach.cbdeleteinputmode.ItemIndex of
      0: erasemode:=0;
      1: erasemode:=2;
      2: erasemode:=1;
   end;
   {$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];{$ELSE}P.Options := [poNoConsole, 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 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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
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+delimiter+escapefilename(s,desk_env)+delimiter+' ';
   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];{$ELSE}P.Options := [poNoConsole, 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
   inpath:=extractfilepath(Form_peach.StringGridList.Cells[8,1]);
   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') 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[8,i]=inpath+Form_peach.StringGrid1.Cells[1,j] then
            begin
            namecollisionfound:=true;
            break;
            end;
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') 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[8,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
   inpath:=extractfilepath(Form_peach.StringGridList.Cells[8,1]);
   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') 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[8,i],Form_peach.StringGridArchive.Cells[8,i],false);
            application.ProcessMessages;
            end;
      end;
   end;
Form_peach.Caption:=dummystr;
application.ProcessMessages;
tempaddinarchive:='';
end;

procedure goarchive;
var
   sel,s,aname,oname,otest,strsel,dummycl,dummytitle,toname,totype,outname: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 completition) if not requested elsewhere
if (Form_peach.StringGrid1.RowCount<3) or (Form_peach.CheckBoxSeparate.State=cbUnChecked) then needwaitupdating:=false; //don't wait job completition if not needed (single input, or single output)
if Form_peach.labelstatus4.Caption=txt_2_7_updating then needwaitupdating:=true; //restore wait job completition, 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
   dummytitle:=Form_peach.Caption;
   Form_peach.Shape3.Width:=(Form_peach.Width*50) div 100;
   Form_peach.enabled:=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
         Form_peach.Caption:=dummytitle;
         clearstopsequencefile;
         break;
         end;
      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 Form_peach.enabled:=true; exit; end;
      aname:=Form_peach.StringGrid1.Cells[8,i];
      iext:=testext(aname);
      case iext of
         -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;
               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); except end; //if input format is pea, delete dir that will be re-created by pea (otherwise it will skip it and create a new fresh directory)
            if iext=10000 then try cleardir(oname,false); 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_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;
            //if iext=10000 then Form_peach.StringGrid1.Cells[7,i]:='+++';
            end;
         end;
      Form_peach.StringGrid1.Cells[11,i]:='0';
      end;
   Form_peach.Enabled:=true;
   if form_peach.Visible=true then Form_peach.SetFocus;
   if convertverbose=1 then
      if pMessageInfoYesNo(txt_2_8_convertbegin)=7 then
         begin
         end_convert;
         ares:=0;
         if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
         Form_peach.enabled:=true;
         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;
   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,clres);
      Form_peach.StringGrid1.Cells[11,i]:='0';
      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);
      Form_peach.visible:=False;
      ares:=archive_mainsequence(sel,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,clres);
      //pf:=Form_peach.cbType.ItemIndex;
      lastoutpath:=extractfilepath(Form_peach.Editname3.Text);
      end;
   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.CheckBoxDeleteInput1.Checked=true then
   begin
   checklistarchive(nsel, strsel);
   if Form_peach.cbType.Text<>STR_UPX then
   if setsequenceerror=true 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}
      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}
      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, poNoConsole];
   {$IFDEF MSWINDOWS}
   begin
   cl:='shutdown /s /t 10';
   P.Executable:='shutdown';
   P.Parameters.Add('/s');
   P.Parameters.Add('/t 10');
   end;
   {$ENDIF}
   {$IFDEF LINUX}begin P.Executable:='halt'; cl:='halt'; end;{$ENDIF}
   {$IFDEF FREEBSD}begin P.Executable:='halt'; cl:='halt'; end;{$ENDIF}
   {$IFDEF NETBSD}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 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 TForm_peach.ButtonExtCancelClick(Sender: TObject);
begin
endmultimode;
Form_peach.RadioGroupAction.ItemIndex:=0; on_radiogroupactionchange;
gocancelextract;
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+TabBar.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 rised exceptions difficult and slow to handle
begin
checkfdwin:=-1;
{$IFDEF MSWINDOWS}
if (Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]='A:\') or (Form_peach.StringGridList.Cells[8,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 rised exceptions difficult and slow to handle
begin
checkfdwin_row:=-1;
{$IFDEF MSWINDOWS}
if i>0 then
   if (Form_peach.StringGridList.Cells[8,i]='A:\') or (Form_peach.StringGridList.Cells[8,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;
MenuItem79.visible:=true;
pmbookmarks.visible:=true;
pmorganizebookmarks.visible:=true;
pmcommand.visible:=true;
pmexplore.visible:=true;
pmproperties.visible:=true;
pmquickdelete.visible:=true;
pmzerofree.visible:=true;
pmsecuredeletefree.visible:=true;
{$IFDEF MSWINDOWS}pmrecycle.Visible:=true;{$ENDIF}
pmmisc.visible:=true;
MenuItem91.visible:=true;
MenuItem75.visible:=true;
pmcut.visible:=false;
{$IFDEF MSWINDOWS}
{$ELSE}
pmproperties.visible:=false;;
{$ENDIF}
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;
   if fun='UN7Z' then pmmvto.Visible:=true else pmmvto.Visible:=false;
   pmnewfolder.Visible:=False;
   if fun='UN7Z' then pmrename.Visible:=true else pmrename.Visible:=false;
   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}
pmquickdelete.visible:=false;
pmnewfolder.Visible:=False;
pmbookmarks.visible:=false;
pmorganizebookmarks.visible:=false;
pmcommand.visible:=false;
pmexplore.visible:=false;
pmproperties.visible:=false;
MenuItem14.visible:=false;
MenuItem79.visible:=false;
pmcheck.visible:=false;
pmpdup.visible:=false;
pmws.visible:=false;
pmzerofree.visible:=false;
pmsecuredeletefree.visible:=false;
pmmisc.visible:=false;
MenuItem91.visible:=false;
MenuItem75.visible:=false;
pmrename.Visible:=false;
pmcut.visible:=true;
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+TabBar.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+TabBar.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+TabBar.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+TabBar.height;
p:=clienttoscreen(p);
pmtestinfolist.popup(p.x,p.y);
end;

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

procedure TForm_peach.cbadlerChange(Sender: TObject);
begin

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.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.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.ButtonEditName5.Enabled:=false;
   end
else
   begin
   form_peach.ButtonUn7za10.Enabled:=true;
   form_peach.EditOpenOut.Enabled:=true;
   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.CheckBoxsni1Click(Sender: TObject);
begin
CheckBoxsni1_onclick;
end;

procedure TForm_peach.CheckBoxsniClick(Sender: TObject);
begin
CheckBoxsni_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.CheckBoxstlClick(Sender: TObject);
begin
CheckBoxstl_onClick;
end;

procedure TForm_peach.CheckBoxThemeBarsClick(Sender: TObject);
begin
if Form_peach.CheckBoxThemeBars.State=cbChecked then themetoolbars:=1 else themetoolbars:=0;
imgloaded:=false;
apply_theme;
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[12,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;
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;
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..14] 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;
resetminimizedlauncher;
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[12,i]='1' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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,8];
   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 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,'all')=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);
   else
      if (funct1='details') then
         begin
         P:=tprocessutf8.Create(nil);
         cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter+' list info '+delimiter+Form_peach.EditOpenIn.Text+delimiter;
         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;
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[12,i]='1' then
      if Form_peach.StringGridList.Cells[8,i]<>'' then
         if checkfdwin_row(i)=0 then
            if testname(Form_peach.StringGridList.Cells[8,i], Form_peach.StringGrid1)=0 then
               begin
               Form_peach.Caption:=txt_2_4_adding+' '+Form_peach.StringGridList.Cells[8,i];
               Application.ProcessMessages;
               if filegetattr(Form_peach.StringGridList.Cells[8,i]) > 0 then
                  if filegetattr(Form_peach.StringGridList.Cells[8,i]) and faDirectory =0 then begin addfilestr(Form_peach.StringGrid1,Form_peach.StringGridList.Cells[8,i]); end
                  else addfolderstr(Form_peach.StringGrid1,Form_peach.StringGridList.Cells[8,i])
               else msg_not_accessible_list(Form_peach.StringGridList.Cells[8,i]);
               end;
Form_peach.StringGrid1.AutoSizeColumns;
showpanel('archive');
updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
Form_peach.ComboBoxArchive7.ItemIndex:=0;
Form_peach.ComboBoxArchiveAct.Itemindex:=Form_peach.ComboboxArchive7.Itemindex;
Form_peach.comboboxarc2.ItemIndex:=0;
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);
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 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='.TAR') or (fextl='.ZIP') or (fextl='.WIM') then
   begin
   case fextl of
      '.7Z' : archive_type_select(STR_7Z);
      '.TAR' : archive_type_select(STR_TAR);
      '.ZIP' : 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 forcecanbechanged=1 then
         begin
         archive_type_select(STR_ZIP);
         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');
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;
updatingarchive_inarchive:=true;
ares:=-1;
end;

procedure do_add;
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;
   end;
if Form_peach.StringGridList.RowCount<2 then exit;
if Form_peach.StringGridList.Cells[1,1]='' then exit;//check only for adding to existing archives
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.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;
begin
if fun='FILEBROWSER' then testarctype(fn,extract_finalize_bytype,fun);
extract_finalize_bytype:=-1;
case fun of
'UNCUSTOM':
   begin
   if euns1=1 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)<>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
//file already checked when the funtion 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;
   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+delimiter+escapefilename(s,desk_env)+delimiter+' ';//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+delimiter+escapefilename(s_path + s_name + s_ext,desk_env)+delimiter+' ';
      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+delimiter+escapefilename(s_path + s_name + s_ext,desk_env)+delimiter+' ';
         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+delimiter+escapefilename(s_path + s_name + s_ext,desk_env)+delimiter+' ';
         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+delimiter+escapefilename(s_path + s_name + s_ext,desk_env)+delimiter+' ';
         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+delimiter+escapefilename(s_path + sh_name + sh_ext + s_ext,desk_env)+delimiter+' ';
            FindClose(r);
         until k <> 0;
         end;
      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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
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];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
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];{$ELSE}P.Options := [poNoConsole, 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,tmpoutname,rname,tmponame:ansistring;
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':
if removeintdir=1 then
   if Form_peach.CheckBoxFolder.state=cbChecked then
      // check if the new folder contains a single object
      if checksingle_obj(outname,oname)= true then
         begin
         rname:=extractfiledir(copy(outname,1,length(outname)-1))+directoryseparator;
         tmpoutname:=rname+STR_TMP+'dir'+inttohex(random(16000000),6)+directoryseparator;
         renamefile(outname, tmpoutname);
         if movecontent_todir(tmpoutname,rname,1)<>0 then renamefile(tmpoutname, outname);
         end;
end;
end;

procedure goextract;
var
   i,k,nsel: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;
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 completition) 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;
      testencrypted_fromname(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]);
      if extract_finalize_bytype(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row],'neutral',cl,jobcode,outname,extsel,true)=0 then launch_cl(cl,jobcode,outname);//'ext'
      fun:='FILEBROWSER';
      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;
      extraction_checkintermediatedir(outname,'extract');
      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
         if extract_finalize_bytype(Form_peach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,true)=0 then launch_cl(cl,jobcode,outname)//'ext'
         end
      else
         begin
         if stayopen=false then exit_withsave
         else tobrowser_fromextractor;
         end
   else
      if extract_finalize_bytype(Form_peach.EditOpenIn.Text,'neutral',cl,jobcode,outname,extsel,true)=0 then launch_cl(cl,jobcode,outname);//'ext'
   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 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}
      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}
      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 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}
      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}
      goup:=true;
      end;
      end;
psize:=0;
application.ProcessMessages;
lastoutpath:=Form_peach.EditOpenOut.Text;
lastextractionpath:=Form_peach.EditOpenOut.Text;
Form_peach.enabled:=true;
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 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+TabBar.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+TabBar.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+TabBar.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[8,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..14] 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[12,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[8,i])) then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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,8];
      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..14] 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[12,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[8,i])) then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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,8];
      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[12,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[8,i])) then
      if load_imagefiletopicture(apicture,Form_peach.StringGridList.Cells[8,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..14] 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[12,i]='1') and (checkimgsupported(Form_peach.StringGridList.Cells[8,i])) then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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,8];
      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+TabBar.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 open_archive_fromname(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]);
      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,k:integer;
   okfile,checksel: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;
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[12,i]='1' then
         if Form_peach.StringGridList.Cells[2,i]<>txt_list_isfolder then  //files
            begin
            test_extfile(Form_peach.StringGridList.Cells[8,i],okfile);
            if okfile=true then
               begin
               if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
               Form_peach.StringGrid2.RowCount:=k+1;
               for c:=1 to 13 do Form_peach.StringGrid2.Cells[c,k]:=Form_peach.StringGridList.Cells[c,i];
               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]);
               if Form_peach.StringGrid2.Cells[4,k]<>'' then Form_peach.StringGrid2.Cells[4,k]:=nicenumber(Form_peach.StringGrid2.Cells[4,k]);
               k:=k+1;
               end;
            end
         else //folders (expand recursively)
            begin
            expand(Form_peach.StringGridList.Cells[8,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]:='2'+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]));
                     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[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
      Form_peach.StringGrid2.RowCount:=k+1;
      for c:=1 to 13 do Form_peach.StringGrid2.Cells[c,k]:=Form_peach.StringGridList.Cells[c,i];
      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]);
      if Form_peach.StringGrid2.Cells[4,k]<>'' then Form_peach.StringGrid2.Cells[4,k]:=nicenumber(Form_peach.StringGrid2.Cells[4,k]);
      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[12,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         Form_peach.StringGrid2.RowCount:=k+1;
         for c:=1 to 13 do Form_peach.StringGrid2.Cells[c,k]:=Form_peach.StringGridList.Cells[c,i];
         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]);
         if Form_peach.StringGrid2.Cells[4,k]<>'' then Form_peach.StringGrid2.Cells[4,k]:=nicenumber(Form_peach.StringGrid2.Cells[4,k]);
         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');
   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 TForm_peach.LabelAbout2Click(Sender: TObject);
var dom,s:ansistring;
begin
updatepluginstatus;
checkdom(dom,s);
cp_open(dom+'peazip-add-ons.html',desk_env);
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 listun7z_expandall
   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);
      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;
   '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
LabelClickAdArchive1.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.LabelClickAdArchive1MouseLeave(Sender: TObject);
begin
LabelClickAdArchive1.Color:=StringToColor(COLMID);
end;

procedure TForm_peach.LabelClickAdArchive2Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[2]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive2MouseEnter(Sender: TObject);
begin
LabelClickAdArchive2.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.LabelClickAdArchive2MouseLeave(Sender: TObject);
begin
LabelClickAdArchive2.Color:=StringToColor(COLMID);
end;

procedure TForm_peach.LabelClickAdArchive3Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[3]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive3MouseEnter(Sender: TObject);
begin
LabelClickAdArchive3.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.LabelClickAdArchive3MouseLeave(Sender: TObject);
begin
LabelClickAdArchive3.Color:=StringToColor(COLMID);
end;

procedure TForm_peach.LabelClickAdArchive4Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=abcrs[4]+'*';
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.LabelClickAdArchive4MouseEnter(Sender: TObject);
begin
LabelClickAdArchive4.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.LabelClickAdArchive4MouseLeave(Sender: TObject);
begin
LabelClickAdArchive4.Color:=StringToColor(COLMID);
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
LabelClickAddress1.Color:=StringToColor(COLHIGH);
bctemp:=1;
end;

procedure TForm_peach.LabelClickAddress1MouseLeave(Sender: TObject);
begin
LabelClickAddress1.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress2Click(Sender: TObject);
begin
browsefiledir(pmbc7.caption);
end;

procedure TForm_peach.LabelClickAddress2MouseEnter(Sender: TObject);
begin
LabelClickAddress2.Color:=StringToColor(COLHIGH);
bctemp:=2;
end;

procedure TForm_peach.LabelClickAddress2MouseLeave(Sender: TObject);
begin
LabelClickAddress2.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress3Click(Sender: TObject);
begin
browsefiledir(pmbc6.caption);
end;

procedure TForm_peach.LabelClickAddress3MouseEnter(Sender: TObject);
begin
LabelClickAddress3.Color:=StringToColor(COLHIGH);
bctemp:=3;
end;

procedure TForm_peach.LabelClickAddress3MouseLeave(Sender: TObject);
begin
LabelClickAddress3.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress4Click(Sender: TObject);
begin
browsefiledir(pmbc5.caption);
end;

procedure TForm_peach.LabelClickAddress4MouseEnter(Sender: TObject);
begin
LabelClickAddress4.Color:=StringToColor(COLHIGH);
bctemp:=4;
end;

procedure TForm_peach.LabelClickAddress4MouseLeave(Sender: TObject);
begin
LabelClickAddress4.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress5Click(Sender: TObject);
begin
browsefiledir(pmbc4.caption);
end;

procedure TForm_peach.LabelClickAddress5MouseEnter(Sender: TObject);
begin
LabelClickAddress5.Color:=StringToColor(COLHIGH);
bctemp:=5;
end;

procedure TForm_peach.LabelClickAddress5MouseLeave(Sender: TObject);
begin
LabelClickAddress5.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress6Click(Sender: TObject);
begin
browsefiledir(pmbc3.caption);
end;

procedure TForm_peach.LabelClickAddress6MouseEnter(Sender: TObject);
begin
LabelClickAddress6.Color:=StringToColor(COLHIGH);
bctemp:=6;
end;

procedure TForm_peach.LabelClickAddress6MouseLeave(Sender: TObject);
begin
LabelClickAddress6.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress7Click(Sender: TObject);
begin
browsefiledir(pmbc2.caption);
end;

procedure TForm_peach.LabelClickAddress7MouseEnter(Sender: TObject);
begin
LabelClickAddress7.Color:=StringToColor(COLHIGH);
bctemp:=7;
end;

procedure TForm_peach.LabelClickAddress7MouseLeave(Sender: TObject);
begin
LabelClickAddress7.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelClickAddress8Click(Sender: TObject);
begin
browsefiledir(pmbc1.caption);
end;

procedure TForm_peach.LabelClickAddress8MouseEnter(Sender: TObject);
begin
LabelClickAddress8.Color:=StringToColor(COLHIGH);
bctemp:=8;
end;

procedure TForm_peach.LabelClickAddress8MouseLeave(Sender: TObject);
begin
if extractfilename(EditOpenIn.Text)<>'' then
   LabelClickaddress8.Color:=StringToColor(COLMID)
else
   LabelClickAddress8.Color:=clNone;
bctemp:=0;
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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'peazip-configuration'+EXEEXT+delimiter+' /DIR='+delimiter+escapefilename(executable_path,desk_env)+delimiter;
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.LabelDonationsClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'donations.html',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(executable_path+'res'+directoryseparator+'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_wintemp;
if directoryexists(peaziptmpdir) then cp_open(peaziptmpdir,desk_env);
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
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
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;
   c:=Column.Index+1;
   listcol:=c;
   if c=1 then c:=9;
   if c=3 then c:=10;
   if c=4 then c:=11;
   if c=13 then c:=8;
   if c=listsortcol then
      if az=true then sort_za_stringgridlist
      else sort_az_stringgridlist(c)
   else sort_az_stringgridlist(c);
   listsortcol:=c;
   update_listview;
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 TForm_peach.pmtabscloseClick(Sender: TObject);
var
   i:integer;
begin
if TabBar.Sections.Count<=2 then exit;
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;

procedure TForm_peach.pmtabscloseotherClick(Sender: TObject);
var
   i:integer;
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;

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
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
   ptabid:=TabBar.Sections.Items[currentptab].ID; //selected inactive tab
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 TForm_peach.MenuItemOpen_saveastxtClick(Sender: TObject);
var
x,y:dword;
field_delim:string;
p,s:ansistring;
begin
field_delim:=chr($09);//tab separated TXT
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(EditOpenIn.Text);
if s<>'' then
   if s[length(s)]=' ' then SetLength(s,length(s)-1);
s:=s+'.txt';
SaveDialogPJ.FileName:=p+s;
if directoryexists(p) then SaveDialogPJ.InitialDir:=p;
if SaveDialogPJ.Execute then
begin
s:=SaveDialogPJ.FileName;
assignfile(t,s);
rewrite(t);
write_header(t);
for x:=1 to StringGridList.RowCount-1 do
   begin
   for y:=1 to 8 do
      write(t,StringGridList.Cells[y,x]+field_delim);
   writeln(t);
   end;
closefile(t);
end;
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 TForm_peach.mPeaFBClick(Sender: TObject);
begin
cp_open('https://www.facebook.com/pages/PeaZip/21089924985',desk_env);
end;

procedure TForm_peach.mPeaTWClick(Sender: TObject);
begin
cp_open('https://twitter.com/peazip_software',desk_env);
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: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;
   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;
   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:=12;
   wa:=6;
   wd:=5;
   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[3,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[3,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[3,i])>102400) and (strtoqword(sg.Cells[3,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[3,i])>10485760) and (strtoqword(sg.Cells[3,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[3,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[3,i])*10)>=(strtoqword(sg.Cells[3,sr])*9)) and ((strtoqword(sg.Cells[3,i])*10)<=(strtoqword(sg.Cells[3,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[3,i])*10)>=(strtoqword(sg.Cells[3,sr])*5)) and ((strtoqword(sg.Cells[3,i])*10)<=(strtoqword(sg.Cells[3,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
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[10,i]<sg.Cells[10,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'sizesmallerequal':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[10,i]<=sg.Cells[10,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'sizeequal':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[10,i]=sg.Cells[10,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'sizelargerequal':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[10,i]>=sg.Cells[10,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   'sizelarger':
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[10,i]>sg.Cells[10,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      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[4,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[4,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[4,i])>102400) and (strtoqword(sg.Cells[4,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[4,i])>10485760) and (strtoqword(sg.Cells[4,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[4,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[4,i])*10)>=(strtoqword(sg.Cells[4,sr])*9)) and ((strtoqword(sg.Cells[4,i])*10)<=(strtoqword(sg.Cells[4,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[4,i])*10)>=(strtoqword(sg.Cells[4,sr])*5)) and ((strtoqword(sg.Cells[4,i])*10)<=(strtoqword(sg.Cells[4,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;
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[11,i]<sg.Cells[11,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'packedsmallerequal':
   begin
   {$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[11,i]<=sg.Cells[11,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'packedequal':
   begin
   {$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[11,i]=sg.Cells[11,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'packedlargerequal':
   begin
   {$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if (sg.Cells[2,i]<>txt_list_isfolder) and (sg.Cells[11,i]>=sg.Cells[11,sr]) then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      end;
   end;
   'packedlarger':
   begin
   {$IFDEF MSWINDOWS}if Form_peach.PanelOpen.Visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
   for i:=1 to rc-1 do
      begin
      istr:=sg.Cells[wsel,i];
      if sg.Cells[11,i]>sg.Cells[11,sr] then apply_select(istr,'1',op)
      else apply_select(istr,'0',op);
      sg.Cells[wsel,i]:=istr;
      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;
      Form_peach.maddress.Checked:=false;
      Form_peach.MenuItemOrganizeAddressbar.Checked:=false;
      end;
   1: begin
      Form_peach.PanelListBar.Height:=barheight;
      Form_peach.maddress.Checked:=true;
      Form_peach.MenuItemOrganizeAddressbar.Checked:=true;
      end;
   end;
end;

procedure settabbar(i:integer);
begin
ptabbar:=i;
case i of
   0: begin
      Form_peach.TabBar.height:=0;
      Form_peach.TabBar.visible:=false;
      Form_peach.mtabs.Checked:=false;
      Form_peach.pmhtabs.Checked:=false;
      Form_peach.pmtabsm.Checked:=false;
      end;
   1: begin
      Form_peach.TabBar.height:=barheight-2;
      Form_peach.TabBar.visible:=true;
      Form_peach.mtabs.Checked:=true;
      Form_peach.pmhtabs.Checked:=true;
      Form_peach.pmtabsm.Checked:=true;
      if Form_peach.TabBar.Sections.Count=1 then
         begin
         ptabid:=atabid;
         addptab;
         sortplustab;
         end;
      end;
   end;
end;

procedure TForm_peach.maddressClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
if addressbar=1 then setaddressbar(0) else setaddressbar(1);
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(opt:integer);
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];

if opt=1 then
   begin
   FormAdvf.Checkboxadvfilters.state:=cbchecked;
   set_advfilters_enabled(true);
   end;

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);
      end
   else
      begin
      FormAdvf.CheckBoxAdvFilters.State:=cbUnChecked;
      set_advfilters_enabled(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(1);
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(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(1);
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   Form_peach.cbadvf1.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure TForm_peach.cbcheckallClick(Sender: TObject);
begin
on_cbcheckallClick;
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.madvfiltersClick(Sender: TObject);
begin
try
if Form_peach.madvfilters.checked=false then
   begin
   set_advfilters(1);
   Form_peach.Imageopenadvf.visible:=true;
   Form_peach.Imageopenadvf1.visible:=true;
   Form_peach.Imageopenadvf2.visible:=true;
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   Form_peach.cbadvf1.state:=cbunchecked;
   Form_peach.cbadvf2.state:=cbunchecked;
   Form_peach.Imageopenadvf.visible:=false;
   Form_peach.Imageopenadvf1.visible:=false;
   Form_peach.Imageopenadvf2.visible:=false;
   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);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
navgoback;
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;
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
cp_open(extractfilepath(s),desk_env);
{$ENDIF}
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
   else sort_az_stringgridlist(c)
else sort_az_stringgridlist(c);
listsortcol:=c;
update_listview;
end;

procedure TForm_peach.mbrowsercattClick(Sender: TObject);
begin
sortbrowser(6);
end;

procedure TForm_peach.mbrowserccrcClick(Sender: TObject);
begin
sortbrowser(7);
end;

procedure TForm_peach.mbrowsercdateClick(Sender: TObject);
begin
sortbrowser(5);
end;

procedure TForm_peach.mbrowsercnameClick(Sender: TObject);
begin
sortbrowser(9);
end;

procedure TForm_peach.mbrowsercpackedClick(Sender: TObject);
begin
sortbrowser(11);
end;

procedure TForm_peach.mbrowsercsizeClick(Sender: TObject);
begin
sortbrowser(10);
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 TForm_peach.mdefaultarchiveClick(Sender: TObject);
var
   s:ansistring;
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_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_2_8_usedefaultoutpath;
   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;
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_2_8_usedefaultoutpath+' '+defaultextractpath;
         pmusedefault.caption:=txt_2_8_usedefaultoutpath+' '+defaultextractpath;
         end;
   end
else
   begin
   defaultextractpath:='';
   mdefaultextract.checked:=false;
   pmusedefault.checked:=false;
   mdefaultextract.caption:=txt_2_8_usedefaultoutpath;
   pmusedefault.caption:=txt_2_8_usedefaultoutpath;
   end;
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;
   org_details.checked:=true;
   org_list.checked:=false;
   org_icons.checked:=false;
   ListView1.ViewStyle:=vsReport;
   browsertype:=0;
   if openstarted=true then loadsmallicons(smalliconsize);
   {$IFDEF MSWINDOWS}
   {$ELSE} //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;
   org_details.checked:=false;
   org_list.checked:=true;
   org_icons.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;
   org_details.checked:=false;
   org_list.checked:=false;
   org_icons.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
case bsize of
   0: begin
   mbrowsersizes.checked:=true;
   mbrowsersizem.checked:=false;
   mbrowsersizel.checked:=false;
   org_small.checked:=true;
   org_medium.checked:=false;
   org_large.checked:=false;
   smalliconsize:=16;
   mediconsize:=16;
   largeiconsize:=48;
   end;
   1: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=true;
   mbrowsersizel.checked:=false;
   org_small.checked:=false;
   org_medium.checked:=true;
   org_large.checked:=false;
   smalliconsize:=48;
   mediconsize:=48;
   largeiconsize:=96;
   end;
   2: begin
   mbrowsersizes.checked:=false;
   mbrowsersizem.checked:=false;
   mbrowsersizel.checked:=true;
   org_small.checked:=false;
   org_medium.checked:=false;
   org_large.checked:=true;
   smalliconsize:=96;
   mediconsize:=96;
   largeiconsize:=192;
   end;
   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);
var dom,s:ansistring;
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions8, BevelTitleOptions8);
checkdom(dom,s);
cp_open(dom+'peazip-add-ons.html',desk_env);
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:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
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('details');
2: showbar('bookmarks');
3: showbar('recent');
4: showbar('sessionrecent');
5: showbar('clip');
6: showbar('none');
end;
end;

procedure TForm_peach.Panelnav5Click(Sender: TObject);
begin
lastbar:=1;
togglestatusbar;
end;

procedure TForm_peach.pmamb1Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb1.Caption)
else addfile_ext_fromname(pmamb1.Caption);
end;

procedure TForm_peach.pmamb2Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb2.Caption)
else addfile_ext_fromname(pmamb2.Caption);
end;

procedure TForm_peach.pmamb3Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb3.Caption)
else addfile_ext_fromname(pmamb3.Caption);
end;

procedure TForm_peach.pmamb4Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb4.Caption)
else addfile_ext_fromname(pmamb4.Caption);
end;

procedure TForm_peach.pmamb5Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb5.Caption)
else addfile_ext_fromname(pmamb5.Caption);
end;

procedure TForm_peach.pmamb6Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb6.Caption)
else addfile_ext_fromname(pmamb6.Caption);
end;

procedure TForm_peach.pmamb7Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb7.Caption)
else addfile_ext_fromname(pmamb7.Caption);
end;

procedure TForm_peach.pmamb8Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelArchiveMain.Visible=true{$ELSE}if PanelArchiveMain.top=0{$ENDIF} then addfile_fromname(pmamb8.Caption)
else addfile_ext_fromname(pmamb8.Caption);
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 TForm_peach.pmbccpClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: s:=EditOpenIn1.Caption;
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;
if fun='FILEBROWSER' then browser_commandprompt(0,0,s)
else browser_commandprompt(0,0,extractfilepath(s));
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
   {$IFDEF MSWINDOWS}
   if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
   winexplorepath(s);
   {$ELSE}
   cp_open(extractfilepath(s),desk_env);
   {$ENDIF}
   end;
end;

procedure TForm_peach.pmbcnewinstClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: s:=EditOpenIn1.Caption;
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;
if fun='FILEBROWSER' then openwith_peazipnew(0,s)
else openwith_peazipnew(0,extractfilepath(s));
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 TForm_peach.pmbcpsClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: s:=EditOpenIn1.Caption;
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;
if fun='FILEBROWSER' then browser_commandprompt(0,1,s)
else browser_commandprompt(0,1,extractfilepath(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;

procedure TForm_peach.pmfun11Click(Sender: TObject);
begin
do_pmfun(pmfun11.caption);
end;

procedure TForm_peach.pmfun12Click(Sender: TObject);
begin
do_pmfun(pmfun12.caption);
end;

procedure TForm_peach.pmfun13Click(Sender: TObject);
begin
do_pmfun(pmfun13.caption);
end;

procedure TForm_peach.pmfun14Click(Sender: TObject);
begin
do_pmfun(pmfun14.caption);
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.pmfun19Click(Sender: TObject);
begin
do_pmfun(pmfun19.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.pmfunexClick(Sender: TObject);
begin
  browser_explorepath(1);
end;

procedure TForm_peach.pmfunprClick(Sender: TObject);
begin
  browser_fileproperties('');
end;

procedure TForm_peach.pmfunswebClick(Sender: TObject);
begin
websearch_sel;
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.pmhrefreshClick(Sender: TObject);
begin
  do_forcerefresh;
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;

procedure TForm_peach.MenuItemOrganizeAddressbarClick(Sender: TObject);
begin
if addressbar=1 then setaddressbar(0) else setaddressbar(1);
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;
   i:integer;
begin
{$IFDEF MSWINDOWS}
if checkfdwin<>0 then exit;
spars:=TStringList.Create;
with Form_peach do
begin
if s_in<>'' then
   begin
   if s_in<>txt_mypc then spars.Add((s_in))
   else
      if checklistsel=0 then
         spars.Add((StringGridList.Cells[8,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[8,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[12,i]='1' then
         begin
         spars.Add((StringGridList.Cells[8,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;
end;
{$ENDIF}
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.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;
var
   i:integer;
begin
repeat
i:=prepm;
until (i>=0);
if i>0 then exit;
FormPM.LabelTitlePM1.Visible:=true;
unit8.clicklabel_pm(FormPM.LabelTitlePM1,FormPM.ShapeTitlePMb1);
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;
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[8, 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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
      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('displayed');
end;

procedure TForm_peach.po_checksumselClick(Sender: TObject);
begin
getcheck('selected');
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
   for i:=1 to rc-1 do
      if Form_peach.StringGridList.Cells[12,i]='1' then
         if Form_peach.StringGridList.Cells[2,i]=txt_list_isfolder then
            FormPaths.MemoPaths.Lines.Add(Form_peach.StringGridList.Cells[8,i]+directoryseparator)
         else
            FormPaths.MemoPaths.Lines.Add(Form_peach.StringGridList.Cells[8,i]);
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.po_deduplicateClick(Sender: TObject);
begin
deduplicate('displayed');
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);
9: sortbrowser(2);
2: sortbrowser(10);
3: sortbrowser(11);
10: sortbrowser(11);
4: sortbrowser(5);
11: sortbrowser(5);
5: sortbrowser(6);
6: sortbrowser(7);
7: sortbrowser(9);
end;
end;

procedure setshowthumbnails(i:integer);
begin
showthumbnails:=i;
case i of
   0: begin
      Form_peach.mthumbimages.Checked:=false;
      Form_peach.org_thumb.Checked:=false;
      end;
   1: begin
      Form_peach.mthumbimages.Checked:=true;
      Form_peach.org_thumb.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 checkupdates;
var dom,s:ansistring;
begin
checkdom(dom,s);
if s='' then
   cp_open(dom,desk_env)
else
   begin
{$IFDEF MSWINDOWS}
try
if s=PEAZIPVERSION+PEAZIPREVISION 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 TForm_peach.LabelUpdatesClick(Sender: TObject);
begin
checkupdates;
end;

procedure TForm_peach.ListView1Click(Sender: TObject);
begin
wasselectedp:=wasselected;
wasselected:=-1;
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[12,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.org_detailsClick(Sender: TObject);
begin
  setbrowsertype(0);
end;

procedure TForm_peach.org_iconsClick(Sender: TObject);
begin
  setbrowsertype(2);
end;

procedure TForm_peach.org_largeClick(Sender: TObject);
begin
  setbrowsersize(2);
end;

procedure TForm_peach.org_listClick(Sender: TObject);
begin
  setbrowsertype(1);
end;

procedure TForm_peach.org_mediumClick(Sender: TObject);
begin
  setbrowsersize(1);
end;

procedure TForm_peach.org_smallClick(Sender: TObject);
begin
  setbrowsersize(0);
end;

procedure TForm_peach.owcustom10tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(2,'adv')
  else
     openadvappn(2);
end;

procedure TForm_peach.owcustom11tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(3,'adv')
  else
     openadvappn(3);
end;

procedure TForm_peach.owcustom12tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(4,'adv')
  else
     openadvappn(4);
end;

procedure TForm_peach.owcustom13tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(5,'adv')
  else
     openadvappn(5);
end;

procedure TForm_peach.owcustom14tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(6,'adv')
  else
     openadvappn(6);
end;

procedure TForm_peach.owcustom15tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(7,'adv')
  else
     openadvappn(7);
end;

procedure TForm_peach.owcustom16tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(8,'adv')
  else
     openadvappn(8);
end;

procedure TForm_peach.owcustom1tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     powcustom(1,'cust')
  else
     openappn(1);
end;

procedure TForm_peach.owcustom2tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(2,'cust')
  else
     openappn(2);
end;

procedure TForm_peach.owcustom3tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(3,'cust')
  else
     openappn(3);
end;

procedure TForm_peach.owcustom4tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(4,'cust')
  else
     openappn(4);
end;

procedure TForm_peach.owcustom5tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(5,'cust')
  else
     openappn(5);
end;

procedure TForm_peach.owcustom6tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(6,'cust')
  else
     openappn(6);
end;

procedure TForm_peach.owcustom7tClick(Sender: TObject);
begin
    if fun<>'FILEBROWSER' then
     powcustom(7,'cust')
  else
     openappn(7);
end;

procedure TForm_peach.owcustom8tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     powcustom(8,'cust')
  else
     openappn(8);
end;

procedure TForm_peach.owcustom9tClick(Sender: TObject);
begin
  if fun<>'FILEBROWSER' then
     powcustom(1,'adv')
  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[12,i]='1' then
      open_custedit(n,Form_peach.StringGridList.Cells[8,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
     powcustom(10,'cust')
  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
     powcustom(11,'cust')
  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
     powcustom(12,'cust')
  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
     powcustom(13,'cust')
  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
     powcustom(14,'cust')
  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
     powcustom(15,'cust')
  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
     powcustom(16,'cust')
  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
     powcustom(9,'cust')
  else
     openappn(9);
end;

procedure TForm_peach.Panelnav3Click(Sender: TObject);
var
   p:TPoint;
begin
p.x:=Panelnav3.Left+Panelnav3.Width;
p.y:=Panelfilters.top+Panelnav3.top;
p:=clienttoscreen(p);
pmmstatus.PopUp(p.x,p.y);
end;

procedure TForm_peach.Panelnav3MouseEnter(Sender: TObject);
begin
  Panelnav3.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.Panelnav3MouseLeave(Sender: TObject);
begin
   Panelnav3.Color:=stringtocolor(color2);
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.mtarchive.Checked:=true;
   Form_peach.mtfile.Checked:=false;
   Form_peach.mtimage.Checked:=false;
   Form_peach.pmmtool_archive.Checked:=true;
   Form_peach.pmmtool_file.Checked:=false;
   Form_peach.pmmtool_image.Checked:=false;
   end;
2:
   begin
   Form_peach.PanelBarOpen1.Visible:=false;
   Form_peach.PanelBarOpen2.Visible:=true;
   Form_peach.PanelBarOpen3.Visible:=false;
   Form_peach.mtarchive.Checked:=false;
   Form_peach.mtfile.Checked:=true;
   Form_peach.mtimage.Checked:=false;
   Form_peach.pmmtool_archive.Checked:=false;
   Form_peach.pmmtool_file.Checked:=true;
   Form_peach.pmmtool_image.Checked:=false;
   end;
3:
   begin
   Form_peach.PanelBarOpen1.Visible:=false;
   Form_peach.PanelBarOpen2.Visible:=false;
   Form_peach.PanelBarOpen3.Visible:=true;
   Form_peach.mtarchive.Checked:=false;
   Form_peach.mtfile.Checked:=false;
   Form_peach.mtimage.Checked:=true;
   Form_peach.pmmtool_archive.Checked:=false;
   Form_peach.pmmtool_file.Checked:=false;
   Form_peach.pmmtool_image.Checked:=true;
   end;
end;
settoolbar;
end;

procedure TForm_peach.mtarchiveClick(Sender: TObject);
begin
showtoolbar(1);
end;

procedure TForm_peach.mtfileClick(Sender: TObject);
begin
showtoolbar(2);
end;

procedure TForm_peach.mtimageClick(Sender: TObject);
begin
showtoolbar(3);
end;

procedure toggletoolbar;
begin
Form_peach.PanelBarOpen1.Visible:=false;
Form_peach.PanelBarOpen2.Visible:=false;
Form_peach.PanelBarOpen3.Visible:=false;
Form_peach.mtarchive.Checked:=false;
Form_peach.mtfile.Checked:=false;
Form_peach.mtimage.Checked:=false;
Form_peach.pmmtool_archive.Checked:=false;
Form_peach.pmmtool_file.Checked:=false;
Form_peach.pmmtool_image.Checked:=false;
case lasttoolbar of
1: begin
   Form_peach.PanelBarOpen2.Visible:=true;
   lasttoolbar:=2;
   Form_peach.mtfile.Checked:=true;
   Form_peach.pmmtool_file.Checked:=true;
   end;
2: begin
   Form_peach.PanelBarOpen3.Visible:=true;
   lasttoolbar:=3;
   Form_peach.mtimage.Checked:=true;
   Form_peach.pmmtool_image.Checked:=true;
   end;
3: begin
   Form_peach.PanelBarOpen1.Visible:=true;
   lasttoolbar:=1;
   Form_peach.mtarchive.Checked:=true;
   Form_peach.pmmtool_archive.Checked:=true;
   end;
end;
settoolbar;
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+TabBar.height;
p:=clienttoscreen(p);
pmmtool.PopUp(p.x,p.y);
end;

procedure TForm_peach.Panelnav4MouseEnter(Sender: TObject);
begin
  Panelnav4.Color:=StringToColor(colbtnhigh);
end;

procedure TForm_peach.Panelnav4MouseLeave(Sender: TObject);
begin
  Panelnav4.Color:=Form_peach.PanelFileBrowserOptions.Color;
end;

procedure TForm_peach.pmcheckClick(Sender: TObject);
begin
  getcheck('displayed');
end;

procedure setusebreadcrumb(i:integer);
begin
usebreadcrumb:=i;
case i of
   0: begin
      Form_peach.pmjumpbreadcrumb.Checked:=false;
      Form_peach.PanelClickAddress.Visible:=false;
      Form_peach.EditOpenIn1.Enabled:=true;
      end;
   1: begin
      Form_peach.pmjumpbreadcrumb.Checked:=true;
      Form_peach.PanelClickAddress.Visible:=true;
      Form_peach.EditOpenIn1.Enabled:=false;
      end;
   end;
end;

procedure TForm_peach.pmjumpbreadcrumbClick(Sender: TObject);
begin
if usebreadcrumb=1 then setusebreadcrumb(0) else setusebreadcrumb(1);
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.org_thumbClick(Sender: TObject);
begin
do_showthumbs;
end;

procedure TForm_peach.pmpdupClick(Sender: TObject);
begin
possiblyduplicate('displayed');
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
   4: begin
      if StringGridRecent.Rowcount<2 then exit;
      s:=StringGridRecent.Cells[1,StringGridRecent.Row];
      end;
   5: 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
   4: begin
      if StringGridRecent.Rowcount<2 then exit;
      s:=StringGridRecent.Cells[1,StringGridRecent.Row];
      end;
   5: 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;
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
cp_open(extractfilepath(s),desk_env);
{$ENDIF}
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
   4: begin
      if StringGridRecent.Rowcount<2 then exit;
      s:=StringGridRecent.Cells[1,StringGridRecent.Row];
      end;
   5: 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.mnavigation.Checked:=false;
Form_peach.mtree.Checked:=false;
Form_peach.mnavfun.Checked:=false;
Form_peach.mnavnone.Checked:=false;
Form_peach.Treeview1.Visible:=false;
Form_peach.Shelltreeview1.Visible:=false;
Form_peach.Treeview2.Visible:=false;
case i of
   0: begin
      shownavbar;
      Form_peach.Treeview1.Visible:=true;
      Form_peach.mnavigation.Checked:=true;
      end;
   1: begin
      shownavbar;
      Form_peach.Shelltreeview1.Visible:=true;
      Form_peach.mtree.Checked:=true;
      end;
   2: begin
      shownavbar;
      Form_peach.Treeview1.Visible:=true;
      Form_peach.mnavigation.Checked:=true;
      end;
   3: begin
      hidenavbar;
      Form_peach.MenuItemOrganizeNavbar.Checked:=false;
      Form_peach.mnavnone.Checked:=true;
      end;
   end;
end;

procedure TForm_peach.mtogglenavbarClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if 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.pmbcaddbookmarkClick(Sender: TObject);
var
   s:ansistring;
begin
case bctemp of
0: begin addtobookmarks('*browser'); 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 TForm_peach.mnavigationClick(Sender: TObject);
begin
setnav(0);
end;

procedure TForm_peach.mnavnoneClick(Sender: TObject);
begin
setnav(3);
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[8, 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;
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
cp_open(extractfilepath(s),desk_env);
{$ENDIF}
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.mgotoextlayoutClick(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
changelanguage;
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;
{$IFDEF MSWINDOWS}
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;
winexplorepath(s);
{$ELSE}
cp_open(extractfilepath(s),desk_env);
{$ENDIF}
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.org_rowselect.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[8, 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[8, 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[8, 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
   4: addtobookmarks('*recent');
   5: 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:=delimiter+escapefilename(sg.Cells[8,sg.Row],desk_env)+delimiter;
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter+' HEXPREVIEW '+in_param;
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter+' 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; //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[12,Form_peach.StringGridList.Row]<>'1' then exit;
checklistsel:=0;
end;

function checklistanysel:integer; //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[8,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[8,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[8,Form_peach.StringGridList.Row]
            else
               begin
               s:=extractfilepath(Form_peach.StringGridList.Cells[8,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:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
   cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter+' HEXPREVIEW '+in_param;
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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[12,i]='1' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]); exit; end;
      in_param:=delimiter+escapefilename(Form_peach.StringGridList.Cells[8,i],desk_env)+delimiter;
      cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter+' HEXPREVIEW '+in_param;
      P:=tprocessutf8.Create(nil);
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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_detailsClick(Sender: TObject);
begin
  showbar('details');
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.pmmtool_archiveClick(Sender: TObject);
begin
  showtoolbar(1);
end;

procedure TForm_peach.pmmtool_fileClick(Sender: TObject);
begin
  showtoolbar(2);
end;

procedure TForm_peach.pmmtool_imageClick(Sender: TObject);
begin
  showtoolbar(3);
end;

procedure TForm_peach.pmnewinstClick(Sender: TObject);
begin
  openwith_peazipnew(1,'');
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;
   MenuItemOrganizeMbar.checked:=false;
   mfeatures.visible:=false;
   medit.visible:=false;
   marchive.visible:=false;
   mOrganize.Visible:=false;
   mlayout.visible:=false;
   moptionsmenu.visible:=false;
   moptions.visible:=false;
   mhelp.visible:=false;
   end
else
   begin
   mshowmenu.checked:=true;
   MenuItemOrganizeMbar.checked:=true;
   mfeatures.visible:=true;
   moptionsmenu.visible:=true;
   moptions.visible:=true;
   mhelp.visible:=true;
   if (prevpanel='archive') or (prevpanel='extract') then
      begin
      mEdit.Visible:=true;
      mLayout.Visible:=true;
      end;
   if prevpanel='open' then
      begin
      mEdit.Visible:=true;
      mArchive.Visible:=true;
      mOrganize.Visible:=true;
      end;
   end;
end;
Form_peach.Repaint;
end;

procedure TForm_peach.MenuItemOrganizeMbarClick(Sender: TObject);
begin
showmenu:=not(showmenu);
togglemenubar;
end;

procedure TForm_peach.mshowmenuClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then exit;
showmenu:=not(showmenu);
togglemenubar;
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;
   TabBar.AnchorSideTop.Control:=PanelBarOpen;
   TabBar.AnchorSideTop.Side:=asrBottom;
   PanelFilters.AnchorSideTop.Control:=PanelListBar;
   PanelFilters.AnchorSideTop.Side:=asrBottom;
   mswapbars.checked:=false;
   end
else
   begin
   TabBar.AnchorSideTop.Control:=PanelOpen;
   TabBar.AnchorSideTop.Side:=asrTop;
   PanelBarOpen.AnchorSideTop.Control:=PanelListBar;
   PanelBarOpen.AnchorSideTop.Side:=asrBottom;
   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.ButtonUn7zaTo1.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.mtt.checked:=false;
Form_peach.mtm1.checked:=false;
Form_peach.mtm2.checked:=false;
Form_peach.mts.checked:=false;
Form_peach.mts2.checked:=false;
Form_peach.mts3.checked:=false;
Form_peach.mtvs.checked:=false;
Form_peach.mtn.checked:=false;
Form_peach.MenuItemOrganizeToolbar.checked:=true;
settoolbardisp;
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
      Form_peach.mtm1.checked:=true;
      setlargetoolbar2;
      end;
   1: begin //1 becomes large icons + text below mode to change previos standard mode for existing installations
      Form_peach.mtt.checked:=true;
      setlargetoolbar1;
      end;
   2: begin
      Form_peach.mtm2.checked:=true;
      setlargetoolbar3;
      end;
   3: begin
      Form_peach.mts.checked:=true;
      setsmalltoolbar1;
      end;
   4: begin
      Form_peach.mts2.checked:=true;
      setsmalltoolbar2;
      end;
   5: begin
      Form_peach.mts3.checked:=true;
      setsmalltoolbar3;
      end;
   6: begin
      Form_peach.mtvs.checked:=true;
      settexttoolbar;
      end;
   7: begin
      Form_peach.mtn.checked:=true;
      Form_peach.MenuItemOrganizeToolbar.checked:=false;
      form_peach.panelbaropen.height:=0;
      end;
   end;
settoolbarw;
setthl;
settonewfolder(tonewfolder);
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;
settoolbar;
end;

procedure TForm_peach.MenuItemOrganizeToolbarClick(Sender: TObject);
begin
if toolsize=7 then toolsize:=1
else toolsize:=7;
settoolbar;
end;

procedure TForm_peach.mthlClick(Sender: TObject);
begin
thighlight:=not(thighlight);
setthl;
end;

procedure TForm_peach.mtm1Click(Sender: TObject);
begin
toolsize:=0;
settoolbar;
end;

procedure TForm_peach.mtm2Click(Sender: TObject);
begin
toolsize:=2;
settoolbar;
end;

procedure TForm_peach.mtnClick(Sender: TObject);
begin
toolsize:=7;
settoolbar;
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);
form_peach.imageflat.Glyph:=Bbrowserdetails;
end;
2: begin
setbrowsertype(0);
setbrowsersize(1);
setshowthumbnails(1);
form_peach.imageflat.Glyph:=Bbrowserdetailslarge;
end;
3: begin
setbrowsertype(1);
setbrowsersize(0);
setshowthumbnails(0);
form_peach.imageflat.Glyph:=Bbrowserlist;
end;
4: begin
setbrowsertype(1);
setbrowsersize(1);
setshowthumbnails(1);
form_peach.imageflat.Glyph:=Bbrowserlistlarge;
end;
5: begin
setbrowsertype(2);
setbrowsersize(1);
setshowthumbnails(1);
form_peach.imageflat.Glyph:=Bbrowsericons;
end;
6: begin
setbrowsertype(2);
setbrowsersize(2);
setshowthumbnails(1);
form_peach.imageflat.Glyph:=Bbrowsericonslarge;
end;
end;
{$ELSE}
case i of
1: begin
setbrowsertype(0);
setbrowsersize(0);
setshowthumbnails(0);
form_peach.imageflat.Glyph:=Bbrowserdetails;
end;
3: begin
setbrowsertype(1);
setbrowsersize(0);
setshowthumbnails(0);
form_peach.imageflat.Glyph:=Bbrowserlist;
end;
5: begin
setbrowsertype(2);
setbrowsersize(0);
setshowthumbnails(0);
form_peach.imageflat.Glyph:=Bbrowsericons;
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 TForm_peach.mv5bClick(Sender: TObject);
begin
showbar('sessionrecent');
end;

procedure TForm_peach.mwebsClick(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;
s:=sg.Cells[1,sg.Row];
if s<>'' then run_websearch(s);
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.org_aprelistClick(Sender: TObject);
begin
settpreset(4);
end;

procedure TForm_peach.org_autoadjustClick(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[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;
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   Form_Peach.ListView1.Column[0].Width:=COL1D;
   Form_Peach.ListView1.Column[1].Width:=112;
   Form_Peach.ListView1.Column[2].Width:=104;
   Form_Peach.ListView1.Column[3].Width:=104;
   Form_Peach.ListView1.Column[4].Width:=136;
   Form_Peach.ListView1.Column[5].Width:=0;
   Form_Peach.ListView1.Column[6].Width:=0;
   Form_Peach.ListView1.Column[7].Width:=0;
   end
else
   begin
   Form_Peach.ListView1.Column[0].Width:=COL1D;
   Form_Peach.ListView1.Column[1].Width:=COL2D;
   Form_Peach.ListView1.Column[2].Width:=COL3D;
   Form_Peach.ListView1.Column[3].Width:=COL4D;
   Form_Peach.ListView1.Column[4].Width:=COL5D;
   Form_Peach.ListView1.Column[5].Width:=COL6D;
   Form_Peach.ListView1.Column[6].Width:=COL7D;
   {$IFDEF MSWINDOWS}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[7].Width:=0
   else Form_Peach.ListView1.Column[7].Width:=384;
   {$ELSE}
   if status0=txt_list_browsing then Form_Peach.ListView1.Column[7].Visible:=false
   else begin Form_Peach.ListView1.Column[7].Visible:=true; Form_Peach.ListView1.Column[7].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 catt=true then col6size:=Form_Peach.ListView1.Column[5].Width;
if ccrc=true then col7size:=Form_Peach.ListView1.Column[6].Width;
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.ImageFlatClick(Sender: TObject);
var
   p:TPoint;
begin
p.x:=ImageFlat.Left+ImageFlat.Width;
p.y:=Panelfilters.top+Panelnav3.top;
p:=clienttoscreen(p);
pmstyle.PopUp(p.x,p.y);
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.mtreeClick(Sender: TObject);
begin
setnav(1);
end;

procedure TForm_peach.mts2Click(Sender: TObject);
begin
toolsize:=4;
settoolbar;
end;

procedure TForm_peach.mts3Click(Sender: TObject);
begin
toolsize:=5;
settoolbar;
end;

procedure TForm_peach.mtsClick(Sender: TObject);
begin
toolsize:=3;
settoolbar;
end;

procedure TForm_peach.mttClick(Sender: TObject);
begin
toolsize:=1;
settoolbar;
end;

procedure TForm_peach.mTutorialClick(Sender: TObject);
begin
showpanel('defaults');
clicklabel_options(LabelTitleOptions7, BevelTitleOptions7);
end;

procedure TForm_peach.mtvsClick(Sender: TObject);
begin
toolsize:=6;
settoolbar;
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.mTypeSfxArcClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=9;
archive_type_select(txt_sfx+' '+STR_ARC);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeWIMClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=12;
archive_type_select(STR_WIM);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeXZClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=13;
archive_type_select(STR_XZ);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
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 mPeaSupport 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.mv0Click(Sender: TObject);
begin
showbar('none');
end;

procedure TForm_peach.mv1Click(Sender: TObject);
begin
showbar('statusbar');
end;

procedure TForm_peach.mv2Click(Sender: TObject);
begin
showbar('details');
end;

procedure TForm_peach.mv3Click(Sender: TObject);
begin
showbar('bookmarks');
end;

procedure TForm_peach.mv5Click(Sender: TObject);
begin
showbar('recent');
end;

procedure TForm_peach.mv6Click(Sender: TObject);
begin
showbar('clip');
end;

procedure TForm_peach.mwebsearchClick(Sender: TObject);
begin
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[12,i]='1' then
      open_advcustedit(n,Form_peach.StringGridList.Cells[8,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 TForm_peach.PanelClickAddressClick(Sender: TObject);
begin
PanelClickAddress.Visible:=false;
EditOpenIn1.Enabled:=true;
if form_peach.Visible=true then EditOpenIn1.SetFocus;
end;

procedure TForm_peach.Panelnav2Click(Sender: TObject);
begin
case navbar of
   0: setnav(1);
   1: setnav(0);
   end;
end;

procedure TForm_peach.Panelnav2MouseEnter(Sender: TObject);
begin
Panelnav2.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.Panelnav2MouseLeave(Sender: TObject);
begin
Panelnav2.Color:=stringtocolor(color2);
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[12,i]:='0';
      Form_peach.StringGridList.Cells[0,i]:='';
      end;
   Form_peach.StringGridList.Cells[12,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.CheckBoxEncoding1Click(Sender: TObject);
begin
on_CheckBoxEncoding1Click;
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[8,i]=Form_peach.StringGridClipboard.Cells[3,Form_peach.StringGridClipboard.Row] then
      begin
      Form_peach.StringGridList.Cells[0,i]:='';
      Form_peach.StringGridList.Cells[12,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];
   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];
      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_deduplicateselClick(Sender: TObject);
begin
deduplicate('selected');
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 TForm_peach.po_envstrClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:ansistring;
begin
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter+' 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_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[12,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[8,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[8,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[8,StringGridList.Row],desk_env) //open folder
   else //go to object's path
      begin
      s:=(StringGridList.Cells[8,StringGridList.Row]);
      if s='' then s:=Form_peach.EditOpenIn.Text;
      {$IFDEF MSWINDOWS}
      if checkfiledirname(s)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s); exit; end;
      winexplorepath(s);
      {$ELSE}
      cp_open(extractfilepath(s),desk_env);
      {$ENDIF}
      end
   else cp_open(EditOpenIn.Text,desk_env);
   end
else
   {$IFDEF MSWINDOWS}
   begin
   if checkfiledirname(EditOpenIn.Text)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+EditOpenIn.Text); exit; end;
   winexplorepath(EditOpenIn.Text);
   end;
   {$ELSE}
   cp_open(extractfilepath(EditOpenIn.Text),desk_env);
   {$ENDIF}
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.mgotolayoutClick(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;
do_forcerefresh;
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}
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 checklistsel=0 then s:=Form_peach.StringGridList.Cells[1,Form_peach.StringGridList.Row];
      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://download.cnet.com/1770-20_4-0.html?query='+s+'&tag=srch&searchtype=downloads');
         if FormWeb.CheckGroup1.Checked[5]=true then webopen('https://duckduckgo.com/?q='+s+'&ia=web');
         if FormWeb.CheckGroup1.Checked[6]=true then webopen('https://shop.ebay.com/?_nkw='+s);
         if FormWeb.CheckGroup1.Checked[7]=true then webopen('https://www.facebook.com/search/?q='+s);
         if FormWeb.CheckGroup1.Checked[8]=true then webopen('https://www.flickr.com/search/?q='+s);
         if FormWeb.CheckGroup1.Checked[9]=true then webopen('https://www.google.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[10]=true then webopen('https://maps.google.com/maps?q='+s);
         if FormWeb.CheckGroup1.Checked[11]=true then webopen('https://www.google.com/search?q='+s+'&tbs=nws:1');
         if FormWeb.CheckGroup1.Checked[12]=true then webopen('https://translate.google.com/#es|en|'+s);
         if FormWeb.CheckGroup1.Checked[13]=true then webopen('https://www.imdb.com/find?s=all&q='+s);
         if FormWeb.CheckGroup1.Checked[14]=true then webopen('https://www.instagram.com/explore/tags/'+s+'/');
         if FormWeb.CheckGroup1.Checked[15]=true then webopen('https://www.linkedin.com/vsearch/f?keywords='+s);
         if FormWeb.CheckGroup1.Checked[16]=true then webopen('https://osdn.net/search/?type_of_search=soft&words='+s);
         if FormWeb.CheckGroup1.Checked[17]=true then webopen('https://pinterest.com/search/pins/?q='+s);
         if FormWeb.CheckGroup1.Checked[18]=true then webopen('https://www.reddit.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[19]=true then webopen('https://sourceforge.net/directory/os:windows/?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://download.cnet.com');
         if FormWeb.CheckGroup1.Checked[5]=true then webopen('https://duckduckgo.com/');
         if FormWeb.CheckGroup1.Checked[6]=true then webopen('https://www.ebay.com');
         if FormWeb.CheckGroup1.Checked[7]=true then webopen('https://www.facebook.com');
         if FormWeb.CheckGroup1.Checked[8]=true then webopen('https://www.flickr.com');
         if FormWeb.CheckGroup1.Checked[9]=true then webopen('https://www.google.com');
         if FormWeb.CheckGroup1.Checked[10]=true then webopen('https://maps.google.com');
         if FormWeb.CheckGroup1.Checked[11]=true then webopen('https://news.google.com');
         if FormWeb.CheckGroup1.Checked[12]=true then webopen('https://translate.google.com');
         if FormWeb.CheckGroup1.Checked[13]=true then webopen('https://www.imdb.com');
         if FormWeb.CheckGroup1.Checked[14]=true then webopen('https://www.instagram.com');
         if FormWeb.CheckGroup1.Checked[15]=true then webopen('https://www.linkedin.com');
         if FormWeb.CheckGroup1.Checked[16]=true then webopen('https://osdn.net/search/');
         if FormWeb.CheckGroup1.Checked[17]=true then webopen('https://pinterest.com');
         if FormWeb.CheckGroup1.Checked[18]=true then webopen('https://www.reddit.com');
         if FormWeb.CheckGroup1.Checked[19]=true then webopen('https://sourceforge.net');
         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;
var
   s,tmpprevrun:ansistring;
   {$IFDEF MSWINDOWS}
   w:widestring;
   {$ELSE}
   P:tprocessutf8;
   cl:ansistring;
   {$ENDIF}
begin
if checklistsel=0 then tmpprevrun:=Form_peach.StringGridList.Cells[8,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:=delimiter+s+delimiter;
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[8,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.enabled:=true;
MenuItemExtAllHere.enabled:=true;
MenuItemExtAllHereSmart.enabled:=true;
MenuItemExtAllHereNew.enabled:=true;
if fun='FILEBROWSER' then
   if checkextinput_noduplicatecheck=false then
      begin
      MenuItemExtAllTo.enabled:=false;
      MenuItemExtAllHere.enabled:=false;
      MenuItemExtAllHereSmart.enabled:=false;
      MenuItemExtAllHereNew.enabled:=false;
      end;
end;

procedure powcustom(j:integer; custmode:ansistring);
var
   i:integer;
   cl,jobcode,outname,s: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 exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
            begin
            s:=outname;
            if s<>'' then
               if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
            s:=s+Form_peach.StringGridList.Cells[8,i];
            if custmode='cust' then open_custedit(j, s)
            else open_advcustedit(j, s);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
            begin
            s:=outname;
            if s<>'' then
               if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
            s:=s+Form_peach.StringGridList.Cells[8,i];
            if custmode='cust' then open_custedit(j, s)
            else open_advcustedit(j, s);
            end
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.powcustom10Click(Sender: TObject);
begin
powcustom(2,'adv');
end;

procedure TForm_peach.powcustom11Click(Sender: TObject);
begin
powcustom(3,'adv');
end;

procedure TForm_peach.powcustom12Click(Sender: TObject);
begin
powcustom(4,'adv');
end;

procedure TForm_peach.powcustom13Click(Sender: TObject);
begin
powcustom(5,'adv');
end;

procedure TForm_peach.powcustom14Click(Sender: TObject);
begin
powcustom(6,'adv');
end;

procedure TForm_peach.powcustom15Click(Sender: TObject);
begin
powcustom(7,'adv');
end;

procedure TForm_peach.powcustom16Click(Sender: TObject);
begin
powcustom(8,'adv');
end;

procedure TForm_peach.powcustom1Click(Sender: TObject);
begin
powcustom(1,'cust');
end;

procedure TForm_peach.powcustom2Click(Sender: TObject);
begin
powcustom(2,'cust');
end;

procedure TForm_peach.powcustom3Click(Sender: TObject);
begin
powcustom(3,'cust');
end;

procedure TForm_peach.powcustom4Click(Sender: TObject);
begin
powcustom(4,'cust');
end;

procedure TForm_peach.powcustom5Click(Sender: TObject);
begin
powcustom(5,'cust');
end;

procedure TForm_peach.powcustom6Click(Sender: TObject);
begin
powcustom(6,'cust');
end;

procedure TForm_peach.powcustom7Click(Sender: TObject);
begin
powcustom(7,'cust');
end;

procedure TForm_peach.powcustom8Click(Sender: TObject);
begin
powcustom(8,'cust');
end;

procedure TForm_peach.powcustom_10Click(Sender: TObject);
begin
powcustom(10,'cust');
end;

procedure TForm_peach.powcustom_11Click(Sender: TObject);
begin
powcustom(11,'cust');
end;

procedure TForm_peach.powcustom_12Click(Sender: TObject);
begin
powcustom(12,'cust');
end;

procedure TForm_peach.powcustom_13Click(Sender: TObject);
begin
powcustom(13,'cust');
end;

procedure TForm_peach.powcustom_14Click(Sender: TObject);
begin
powcustom(14,'cust');
end;

procedure TForm_peach.powcustom_15Click(Sender: TObject);
begin
powcustom(15,'cust');
end;

procedure TForm_peach.powcustom_16Click(Sender: TObject);
begin
powcustom(16,'cust');
end;

procedure TForm_peach.powcustom_9Click(Sender: TObject);
begin
powcustom(9,'cust');
end;

procedure TForm_peach.po_alltasksClick(Sender: TObject);
begin
do_alltasks;
end;

procedure TForm_peach.powcustom9Click(Sender: TObject);
begin
powcustom(1,'adv');
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.mTypeSfxClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=8;
archive_type_select(txt_sfx+' '+STR_7Z);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
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 TForm_peach.ComboBoxArchive3Change(Sender: TObject);
begin
ComboBoxArchive3_onchange;
end;

procedure ComboBoxArchive4_onchange;
begin
if settingvalues=false then
   with Form_peach do
      begin
      compression_level:=ComboBoxArchive4.Text;
      case cbType.Text of
         '7Z' : level_7z:=ComboBoxArchive4.ItemIndex;
         'XZ' : level_xz:=ComboBoxArchive4.ItemIndex;
         'BZip2' : level_bzip2:=ComboBoxArchive4.ItemIndex;
         'GZip' : level_gz:=ComboBoxArchive4.ItemIndex;
         '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.ComboBoxArchive4Change(Sender: TObject);
begin
ComboBoxArchive4_onchange;
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 := [poNoConsole,poWaitOnExit];
   if libre_directive=2 then if testifrar(escapefilename(s,desk_env))=1 then exit;
   in_param:=delimiter+escapefilename(s,desk_env)+delimiter;
   out_param:=delimiter+'-o'+escapefilename(confpath+'themes'+directoryseparator,desk_env)+delimiter;
   bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
   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:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'ten-embedded'+directoryseparator+'theme.txt';
         theme_name:='ten-embedded';
         theme_path:=extractrelativepath(executable_path+'res'+directoryseparator,s);
         load_theme;
         check_theme_failure;
      except
         theme_failure;
         exit;
      end;
      end;
   1: begin
      try
         s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'nographic-embedded'+directoryseparator+'theme.txt';
         theme_name:='nographic-embedded';
         theme_path:=extractrelativepath(executable_path+'res'+directoryseparator,s);
         load_theme;
         check_theme_failure;
      except
         theme_failure;
         exit;
      end;
      end;
   2: begin
      try
      s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'classic.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   3: begin
      try
      s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'experience.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   4: begin
      try
      s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'firecrystal.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   5: begin
      try
      s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'seven.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   6: begin
      try
      s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'ten.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   7: begin
      OpenDialogTheme.initialdir:=local_desktop;
      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;
   8: begin
      SelectDirectoryDialog2.initialdir:=confpath+'themes'+directoryseparator;
      SelectDirectoryDialog2.execute;
      if SelectDirectoryDialog2.FileName<>'' then
         try
            s:=SelectDirectoryDialog2.FileName;
            if pos(upcase(confpath+'themes'),upcase(s))=0 then
               begin
               theme_failure;
               exit;
               end;
            s1:=s;
            theme_path:='themes'+directoryseparator+extractfilename(s1)+directoryseparator+'theme.txt';
            theme_name:=extractfilename(s1);
            load_theme;
            check_theme_failure;
         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(themetoolbarsd));
      writeln(conf,'');
      writeln(conf,'');
      writeln(conf,autosizetoolbarbuttond);
      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;
themetoolbars:=themetoolbarsd;
autosizetoolbarbutton:=autosizetoolbarbuttond;
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;
end;

procedure TForm_peach.LabelResetThemeClick(Sender: TObject);
begin
if not(directoryexists(confpath+'themes')) then forcedirectories(confpath+'themes');
cp_open(confpath+'themes',desk_env);
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_datetime;
StringGrid1.Cells[7,0]:=txt_attributes;
StringGrid1.Cells[8,0]:=txt_name_full;
StringGrid1.AutoSizeColumns;
StringGrid1.ColWidths[0]:=rowsize;
StringGrid1.ColWidths[1]:=StringGrid1.ColWidths[1]+48;
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_datetime;
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.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;
pmjd27.Visible:=false;
pmjd28.Visible:=false;
pmjd29.Visible:=false;
pmjd30.Visible:=false;
pmjd31.Visible:=false;
pmjd32.Visible:=false;
pmjd33.Visible:=false;
pmjd34.Visible:=false;
pmjd35.Visible:=false;
pmjd36.Visible:=false;
pmjd37.Visible:=false;
pmjd38.Visible:=false;
pmjd39.Visible:=false;
pmjd40.Visible:=false;
pmjd41.Visible:=false;
pmjd42.Visible:=false;
pmjd43.Visible:=false;
pmjd44.Visible:=false;
pmjd45.Visible:=false;
pmjd46.Visible:=false;
pmjd47.Visible:=false;
pmjd48.Visible:=false;
pmjd49.Visible:=false;
pmjd50.Visible:=false;
pmjd51.Visible:=false;
pmjd52.Visible:=false;
pea.Visible:=false;
{$IFDEF LINUX}
Comboboxarcsfx.Itemindex:=0;
{$ELSE}
Comboboxarcsfx.Itemindex:=1;
{$ENDIF}
end;
end;

procedure setbasevars;
begin
updatingarchive_sync:=false;
goarchiving:=false;
disdrag:=false;
threadextracting:=false;
launchwithsemaphore:=false;
keeppreview:=false;
beingpreviewed:='';
setbs:=false;
endflag:=false;
browserbusy:=false;
browserbusy_minor:=false;
executable_path:=extractfilepath((paramstr(0))); //valorize application's paths
if ((executable_path='') or (executable_path='..\')) then executable_path:=extractfilepath((paramstr(0)));
if executable_path<>'' then
   if executable_path[length(executable_path)]<>directoryseparator then executable_path:=executable_path+directoryseparator;
setcurrentdir(executable_path);
archiveopened:=false;
browsinghistory:=false;
imgloaded:=false;
openstarted:=false;
done_quickfunctions:=false;
dragcancelled:=true;
popupclosed:=false;
listingdir:=false;
control_listingdir:=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; 2 KDE; 10 Windows; 20; 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);
Form_peach.pmjumprecent.Visible:=false;
Form_peach.pmjumprecent1.Visible:=false;
Form_peach.pmjumpsearches.Visible:=false;
Form_peach.pmjumpsearches1.Visible:=false;
Form_peach.pmjumplibraries.Visible:=false;
Form_peach.pmjumplibraries1.Visible:=false;
Form_peach.pmjumppubdoc.Visible:=false;
Form_peach.pmjumppubdoc1.Visible:=false;
Form_peach.MenuItemArchive_pubdoc.Visible:=false;
Form_peach.MenuItemOpen_pubdoc.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;
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 peaziplanguage(s: ansistring);
{$IFDEF MSWINDOWS} var exepath,langreg,forcereg:widestring;{$ENDIF}
begin
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
   begin
   exepath:=utf8decode(executable_path);
   cutextension(s);
   langreg:=utf8decode(s)+'.reg';
   forcereg:='';
   if FileExists(executable_path+'res\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+'res\lang-wincontext\'+langreg+'"'+forcereg), PWideChar (''), SW_SHOWNORMAL);
      end;
   end;
{$ENDIF}
Form_peach.Close;
end;

procedure openstart;
//on Windows it is executed during formshow, on other platform it is delayed
//being launched by a timer to allow form to be completely draw before those
//operations, which otherwise will result in different errors depending on the
//platform and the compiler revision
var
   i,j,p:integer;
   s,s0,fun_neutral,cl,jobcode,outname:ansistring;
   okfile,termfunopen,dirpresent: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
   subfun:='extract';
   fun:=paramstr(2);
   try tsize:=strtoint(paramstr(3)); except tsize:=0; end;
   inputfile:=paramstr(4);
   outname:='';
   unit_gwrap.pfromnativedrag:=true;
   for i:=5 to paramcount do cl:=cl+delimiter+paramstr(i)+delimiter+' ';
   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
   '-ext2here' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','','complete');
   end;
   '-ext2folder' :
   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;
   '-ext2simplefolder' :
   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;
   '-ext2tofolder' :
   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;
   '-ext2folderi' :
   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;
   '-ext2simplefolderi' :
   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;
   '-ext2tofolderi' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','newfolder','ignore');
   end;
   //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;
//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':
         begin
         Form_peach.EditOpenOut.Text:=local_desktop;
         list_toextractor('none','full');
         stayopen:=false;
         end;
         '-ext2openasarchive':
         begin
         open_noinput;
         end;
         else open_singleinput(paramstr(1))
         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
               open_archive_fromname((paramstr(2)));
         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
               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)));
            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':
         begin
         Form_peach.EditOpenOut.Text:=local_desktop;
         list_toextractor('none','full');
         dirpresent:=false;
         for i:=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;
         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') 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)='-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);
      stayopen:=false;
      savetype:=true;
      end;
end;
end;
end;

procedure TForm_peach.FormCreate(Sender: TObject);
var
   s:ansistring;
begin
{$IFDEF MSWINDOWS}getwinenvadv(wincomspec,winver,majmin);{$ENDIF}
setbasevars;
{$IFDEF MSWINDOWS}
peaziptmpdir:=GetTempDir;
if peaziptmpdir='' then peaziptmpdir:=getcurrentdir;
if peaziptmpdir<>'' then
   if peaziptmpdir[length(peaziptmpdir)]<>directoryseparator then peaziptmpdir:=peaziptmpdir+directoryseparator;
peaziptmpdir:=peaziptmpdir+'peazip-tmp'+directoryseparator;
s:=peaziptmpdir;
if not(directoryexists(s)) then mkdir(s);
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 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 created (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;
Form_peach.visible:=true;
randomize;
{$IFDEF MSWINDOWS}
FixControlStyles(Self);
//load_dummy;
{$ELSE}
{$ENDIF}
set_items_height;
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;
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;
mUser.Visible:=false;
mDate.Visible:=false;
MenuItem33.Visible:=false;
pmJumpDocuments.Visible:=false;
pmJumpDocuments1.Visible:=false;
pmqedocuments.Visible:=false;
MenuItem11.Visible:=false;
mAdmin.Visible:=false;
menuitemopen_powershell.Visible:=false;
MenuItemPowerShell.Visible:=false;
pmbcps.Visible:=false;
pmpowershell.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}
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;
mDate.Visible:=true;
MenuItem33.Visible:=true;
pmJumpDocuments.Visible:=true;
pmJumpDocuments1.Visible:=true;
pmqedocuments.Visible:=true;
MenuItem11.Visible:=true;
openwithcustom.Visible:=true;
po_open_custom.Visible:=true;
MenuItemPreCustom.Visible:=true;
MenuItemERCustom.Visible:=true;
menvstr.visible:=false;
mopenasarchive.visible:=false;
po_task.Visible:=false;
mscheduledscripts.Visible:=false;
mtaskscheduler.Visible:=false;
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;
   pmbcps.Visible:=true;
   pmpowershell.Visible:=true;
   po_task.Visible:=true;
   mscheduledscripts.Visible:=true;
   mtaskscheduler.Visible:=true;
   setschedulevisible(true);
   schedaddscheduleChange(nil);
   schedaddschedule1Change(nil);
   end;
   end;
{$ELSE}
LabelTitleExtract4.Visible:=false;
ShapeTitleExtract3.Visible:=false;
LabelTitleAdd4.Visible:=false;
ShapeTitleAdd3.Visible:=false;
Labelspac1.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;
MenuItem80.Visible:=false;
mpretoggle.enabled:=false;
org_apredetails.Visible:=false;
org_aprelist.Visible:=false;
org_aprelarge.Visible:=false;
mpredetails.Visible:=false;
mprelist.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;
org_small.Visible:=false;
org_medium.Visible:=false;
org_large.Visible:=false;
Labelspac8.Visible:=false;
LabelResetPtmp.Visible:=false;
LabelConfigurePeaZip.Visible:=false;
LabelConfigurePeaZip1.Visible:=false;
LabelConfigureSendTo.Visible:=false;
Label6.Visible:=false;
Combobox1.Visible:=false;
mupdate.Visible:=false;
msystemintegration.visible:=false;
menuitem42.visible:=false;
mthumbimages.Visible:=false;
org_thumb.Visible:=false;
{$ENDIF}
status1:=caption_build;
populatebookmarks;
populaterecenticons;
populaterecenticonsf;
{$IFDEF MSWINDOWS}
openstart;
{$ELSE}
openstart;
finishlistview;
imgshelltree;
{$ENDIF}
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.LabelDefaultColor3Click(Sender: TObject);
begin
color3:=color3d;
apply_theme;
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.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.ListView1ContextPopup(Sender: TObject; MousePos: TPoint;
  var Handled: Boolean);
begin
ListView1.PopupMenu:=PopupOpen;
if (ListView1.ViewStyle=vsReport) and (MousePos.y<25) then ListView1.PopupMenu:=PopupHeader;
end;

procedure TForm_peach.MenuItemExtAllHereNewClick(Sender: TObject);
begin
quickextract('*new');
end;

procedure TForm_peach.MenuItemExtAllHereSmartClick(Sender: TObject);
begin
quickextract('*smart');
end;

procedure TForm_peach.mextallherenewClick(Sender: TObject);
begin
quickextract('*new');
end;

procedure TForm_peach.mextallheresmartClick(Sender: TObject);
begin
quickextract('*smart');
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);
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\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 agorithm');
      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');
      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(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'1.txt',s);
if s='1' then s:=txt_7_2_extcompultra;
Form_peach.mprofileextremezpaq.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'2.txt',s);
if s='2' then s:=txt_7_2_extcomp;
Form_peach.mprofilebetterzpaq.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'3.txt',s);
if s='3' then s:=txt_5_3_profilebest;
Form_peach.mprofileultra7z.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'4.txt',s);
if s='4' then s:=txt_5_3_profileadvanced;
Form_peach.mprofilenormal7z.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'5.txt',s);
if s='5' then s:=txt_7_2_altcomp;
Form_peach.mprofilealtarc.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'6.txt',s);
if s='6' then s:=txt_7_3_profile7zfast;
Form_peach.mprofile7zfast.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'7.txt',s);
if s='7' then s:=txt_7_1_profileintermediate;
Form_peach.mprofilezipbz2.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'8.txt',s);
if s='8' then s:=txt_5_3_profilenormal;
Form_peach.mprofilenormalzip.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'9.txt',s);
if s='9' then s:=txt_7_3_profile7zfastest;
Form_peach.mprofile7zfastest.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'10.txt',s);
if s='10' then s:=txt_5_3_profileveryfast;
Form_peach.mprofilefastzip.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'11.txt',s);
if s='11' then s:=txt_7_2_fbrotlicomp;
Form_peach.mprofilebrotli.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'12.txt',s);
if s='12' then s:=txt_7_2_fzstandardcomp;
Form_peach.mprofilezstd.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'13.txt',s);
if s='13' then s:=txt_5_3_profilepassword;
Form_peach.mprofileencrypt7z.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'presets'+DirectorySeparator+'14.txt',s);
if s='14' then s:=txt_5_3_profile10mb;
Form_peach.mprofilesplitzip.Caption:=s;
check_presets_name(executable_path+'res'+DirectorySeparator+'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: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.ComboBoxArchive9Change(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,s); if s='1' then Form_peach.checkboxseparate.Checked:=true else Form_peach.checkboxseparate.Checked:=false; on_checkboxseparateclick;
      readln(t,s); //original path
      readln(t,s); if s='1' then Form_peach.CheckBoxSameArc.Checked:=true else Form_peach.CheckBoxSameArc.Checked:=false; Form_peach.CheckBoxSameArcClick(nil);
      readln(t,s); //convert
      readln(t,s); if s='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,s); if s='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.ComboBoxArchive3Change(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); //compression
      readln(t,s); Form_peach.EditNameCustom.text:=s;
      readln(t,s); //object control
      readln(t,s); Form_peach.EditExtCustom.text:=s;
      readln(t,s); //volume control
      readln(t,s); Form_peach.EditOPcustom.text:=s;
      readln(t,s); //stream control
      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);
      Form_peach.cbTypeChange(nil);
      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;
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(executable_path+'res'+DirectorySeparator+'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.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.mTypeBrotliClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=2;
archive_type_select(STR_BROTLI);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeZstandardClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=16;
archive_type_select(STR_ZSTD);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.org_rowselectClick(Sender: TObject);
begin
set_rowselect;
end;

procedure TForm_peach.PanelExtractClick(Sender: TObject);
begin

end;

procedure TForm_peach.pmdeduplicateClick(Sender: TObject);
begin
deduplicate('displayed');
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 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 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.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.po_analyzefoldersClick(Sender: TObject);
begin
analyzefolders('displayed');
end;

procedure TForm_peach.po_pdupClick(Sender: TObject);
begin
possiblyduplicate('displayed');
end;

procedure TForm_peach.po_rename_123Click(Sender: TObject);
begin
rename_files('123');
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;
end;

procedure TForm_peach.po_rename_filesonlyClick(Sender: TObject);
begin
if renfilesonly=1 then setrenfilesonly(0) else setrenfilesonly(1);
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.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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
end;

procedure TForm_peach.ImageAdArchive0MouseLeave(Sender: TObject);
begin
PanelAdArchive0.Color:=Panelclickaddress.Color;
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
end;

procedure TForm_peach.ImageAdArchive1MouseLeave(Sender: TObject);
begin
PanelAdArchive1.Color:=Panelclickaddress.Color;
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
end;

procedure TForm_peach.ImageAdArchive2MouseLeave(Sender: TObject);
begin
PanelAdArchive2.Color:=Panelclickaddress.Color;
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
end;

procedure TForm_peach.ImageAdArchive3MouseLeave(Sender: TObject);
begin
PanelAdArchive3.Color:=Panelclickaddress.Color;
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
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+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.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:=StringToColor(COLHIGH);
end;

procedure TForm_peach.ImageAddress7MouseLeave(Sender: TObject);
begin
PanelAddress7.Color:=Panelclickaddress.Color;
end;

procedure TForm_peach.ImageAddressClick(Sender: TObject);
begin
jumpto('root');
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));
      Form_peach.StringGrid1.AutoSizeColumns;
      updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
      end;
Form_peach.Caption:=s;
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.AutoSizeColumns;
            updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
            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);
            Form_peach.StringGrid1.AutoSizeColumns;
            updatecontent(Form_peach.StringGrid1,tvolumes,tdirs,tfiles,tsize,true);
            end;
         Form_peach.StringGrid1.Cursor:=crDefault;
         end;
      end;
   end;
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
      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');
               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
                  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: begin
                        showpanel('archive');
                        drag_addtolayout(FileNames);
                        setdragarchivename;
                        end;
                  end
               else
                  begin
                  showpanel('archive');
                  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');
            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(var cl,jobcode,outname:ansistring):integer;
var
   sel,s,clprog:ansistring;
   i:integer;
begin
importjobcl:=0;
with Form_peach do
begin
mConsoleCreate.Clear;
lConsoleCreate_jobcode.Caption:='';
lConsoleCreate_outname.Caption:='';
if CheckBoxTarBefore.State=cbChecked then
   begin
   pMessageWarningOK(txt_tarbefore+char($0D)+char($0A)+txt_4_5_upxpj);
   exit;
   end;
if CheckBoxConvert.State=cbChecked then
   begin
   pMessageWarningOK(txt_2_8_convertexisting+char($0D)+char($0A)+txt_4_5_upxpj);
   exit;
   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) 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) 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;
{$IFDEF MSWINDOWS}
mConsoleCreate.Append(cl);
{$ELSE}
mConsoleCreate.Append(cl+char($0D)+char($0A));
{$ENDIF}
lConsoleCreate_jobcode.Caption:=jobcode;
lConsoleCreate_outname.Caption:=outname;
end;

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}
      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}
      mConsoleCreate.Append('');
      mConsoleCreate.Append(cl);
      end;
   end;
end;
importjobcl:=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,true)<>0 then exit;
      fun:='FILEBROWSER';
      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}
               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}
               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;
   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}
               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}
               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:='.txt';{$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
if ptmpcode<>'' then cleardir(ptmpdir,true);
reset_wintemp;
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 confpath<>executable_path+'res'+directoryseparator then //if windows instalable version
   if pMessageInfoYesNo(txt_5_3_resetsi)=6 then configure_systemintegration(true);
{$ENDIF}
restartpeaapp;
exit_nosave; //don't use Close to skip on form close event
end;

procedure peaziptotalreset;//as peazipreset, but without launching the application
begin
peazipdoreset;
exit_nosave;
end;

procedure TForm_peach.ImageDefaults2Click(Sender: TObject);
begin
peazipreset;
end;

procedure TForm_peach.ImageListRootClick(Sender: TObject);
var p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
p:=clienttoscreen(p);
case defaulttabsmenu of
   1: Form_peach.pmtabsbookmarks.PopUp(p.x,p.y);
   2: Form_peach.pmtabsfs.PopUp(p.x,p.y);
   3: Form_peach.pmtabshistory.PopUp(p.x,p.y);
   4: Form_peach.pmfun.PopUp(p.x,p.y);
   end;
end;

procedure TForm_peach.mf4Click(Sender: TObject);
var p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.ImageListRoot.left+Form_peach.EditopenIn.left;
p.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.height+Form_peach.PanelBarOpen.height;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
p:=clienttoscreen(p);
case defaulttabsmenu of
   1: Form_peach.pmtabsbookmarks.PopUp(p.x,p.y);
   2: Form_peach.pmtabsfs.PopUp(p.x,p.y);
   3: Form_peach.pmtabshistory.PopUp(p.x,p.y);
   4: Form_peach.pmfun.PopUp(p.x,p.y);
   end;
end;

procedure rsearch;
begin
issearching:=2;
if fun='UN7Z' then
   begin
   statusr:=txt_list_found;
   list_un7z_search;
   statusr:='';
   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;
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+TabBar.height+PanelBarOpen.height;
      if swapbars=true then p.y:=p.y-PanelBarOpen.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;
apply_theme;
end;

procedure TForm_peach.LabelDefaultColor2Click(Sender: TObject);
begin
color2:=color2d;
apply_theme;
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(txt_benchmark)=7 then exit;
s:=fun;
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter+' b';
fun:='7Z';
fun_status:=fun;
subfun:='bench';
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
launch_cl(cl,jobcode,'');
fun:=s;
fun_status:=fun;
end;

procedure 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..14] 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[12,i]='1' then
            begin
            if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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,8];
         if scheduleclip[i,2]=txt_list_isfolder then cleardir(s,false)
         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
         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);
   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
   {$IFDEF MSWINDOWS}
   if checkfiledirname(sg.Cells[8,sg.Row])<>0 then
      begin pMessageWarningOK(txt_2_7_validatefn+' '+sg.Cells[8,sg.Row]); exit; end;
   winexplorepath(sg.Cells[8,sg.Row]);
   {$ELSE}
   cp_open(extractfilepath(sg.Cells[8,sg.Row]),desk_env);
   {$ENDIF}
   end;
end;

procedure TForm_peach.MenuItemERAssociatedClick(Sender: TObject);
var
   i:integer;
   cl,jobcode,outname:ansistring;
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then execute_obj(4,outname)
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then execute_obj(4,outname)
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.MenuItemERCustomClick(Sender: TObject);
var
   i:integer;
   cl,jobcode,outname:ansistring;
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then openw_obj(outname)
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then openw_obj(outname)
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.MenuItemERPeaZipClick(Sender: TObject);
var
   i:integer;
   cl,jobcode,outname:ansistring;
begin
if StringGridList.RowCount<2 then exit;
if StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
if checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then execute_obj(2,outname)
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'extandrun','single')=0 then
         if execute_cl(cl,'extandrun')=0 then execute_obj(2,outname)
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.MenuItemOpen_backClick(Sender: TObject);
begin
if StringGridSessionHistory.RowCount>2 then
   begin
   StringGridSessionHistory.Row:=StringGridSessionHistory.Row-1;
   browsehistory;
   end;
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 TForm_peach.pmextcontextallClick(Sender: TObject);
begin
context_extall;
end;

procedure TForm_peach.MenuItemOpen_ext_allClick(Sender: TObject);
begin
context_extall;
end;

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 TForm_peach.pmextcontextdisplayedClick(Sender: TObject);
begin
extractdisplayed;
end;

procedure TForm_peach.pmextcontextselectedClick(Sender: TObject);
begin
extractselected;
end;

procedure TForm_peach.MenuItemOpen_ext_displayedClick(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('displayed','full');
end;

procedure TForm_peach.MenuItemOpen_ext_selectedClick(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('selected','full');
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[8,StringGridList.Row]
   else //go to object's path
      s:=extractfilepath(StringGridList.Cells[8,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[8,StringGridList.Row]+directoryseparator+'*';
      EditUn7zaFilterExclude.Text:=StringGridList.Cells[8,StringGridList.Row]+directoryseparator+'*'+directoryseparator+'*';
      listun7z_go;
      end
   else //go to object's path
      begin
      EditUn7zaFilter.Text:=extractfilepath(StringGridList.Cells[8,StringGridList.Row])+'*';
      EditUn7zaFilterExclude.Text:=extractfilepath(StringGridList.Cells[8,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 preview_associated;
var
   i:integer;
   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 checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
         begin
         execute_obj(4,outname);
         end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
         begin
         execute_obj(4,outname);
         end
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.MenuItemPreAssociatedClick(Sender: TObject);
begin
preview_associated;
end;

procedure preview_custom;
var
   i:integer;
   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 checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
         begin
         openw_obj(outname);
         end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
         begin
         openw_obj(outname);
         end
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.MenuItemPreCustomClick(Sender: TObject);
begin
preview_custom;
end;

procedure preview_peazipnew;
var
   i:integer;
   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 checklistanysel<>0 then exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
   begin
   Form_peach.StringGridList.Row:=i;
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
         begin
         execute_obj(2,outname);
         end
         else
            pMessageWarningOK(txt_extraction_error);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then
         begin
         execute_obj(2,outname);
         end
         else
            pMessageWarningOK(txt_extraction_error);
   end;
end;

procedure TForm_peach.MenuItemPrePeaZipClick(Sender: TObject);
begin
preview_peazipnew;
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+delimiter+escapefilename(sg.Cells[8,i],desk_env)+delimiter+' ';
check_files(in_param,cl,oper);
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+escapefilename(Form_peach.EditOpenIn.Text,desk_env)+delimiter;
   check_files(in_param,cl,oper);
   P:=tprocessutf8.Create(nil);
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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[12,i]='1' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
      in_param:=in_param+delimiter+escapefilename(Form_peach.StringGridList.Cells[8,i],desk_env)+delimiter+' ';
      end;
check_files(in_param,cl,oper);
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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:=delimiter+escapefilename(sg.Cells[8,sg.Row],desk_env)+delimiter;
      fileb:=delimiter+escapefilename(Form_peach.OpenDialogArchive.Filename,desk_env)+delimiter;
      P:=tprocessutf8.Create(nil);
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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[8,Form_peach.StringGridList.Row]='' then exit;
if checklistsel<>0 then exit;
if checkfiledirname(Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]); exit; end;
if Form_peach.OpenDialogArchive.Execute then
   if Form_peach.OpenDialogArchive.FileName<>'' then
      begin
      filea:=delimiter+escapefilename(Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row],desk_env)+delimiter;
      fileb:=delimiter+escapefilename(Form_peach.OpenDialogArchive.Filename,desk_env)+delimiter;
      P:=tprocessutf8.Create(nil);
      bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
      {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, 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;

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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
   for i:=1 to Form_peach.StringGridList.Rowcount-1 do
      if Form_peach.StringGridList.Cells[12,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         in_param:=in_param+delimiter+escapefilename((Form_peach.StringGridList.Cells[8,i]),desk_env)+delimiter+' ';
         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];{$ELSE}P.Options := [poNoConsole, 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 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:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pea'+EXEEXT+delimiter;
   if checkfiledirname(s_in)<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+s_in); exit; end;
   in_param:=delimiter+escapefilename((s_in),desk_env)+delimiter;
   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];{$ELSE}P.Options := [poNoConsole, 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 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[12,i]='1' then
         begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         in_param:=escapefilename(Form_peach.StringGridList.Cells[8,i],desk_env);
         setlength(s,length(s)+1);
         s[j] := in_param;
         j:=j+1;
         end;
   fileop_fromnamelist(s,'',0,0);
   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);
      browsefiledir(extractfilepath(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.pmtabaddbookmarksClick(Sender: TObject);
begin
addtobookmarks('*browsercontext');
end;

procedure TForm_peach.pmtabbbookmarksClick(Sender: TObject);
var
   p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
p:=clienttoscreen(p);
defaulttabsmenu:=1;
Form_peach.pmtabsbookmarks.PopUp(p.x,p.y);
end;

procedure TForm_peach.pmtabbfilesystemClick(Sender: TObject);
var
   p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
p:=clienttoscreen(p);
defaulttabsmenu:=2;
Form_peach.pmtabsfs.PopUp(p.x,p.y);
end;

procedure TForm_peach.pmtabbfunClick(Sender: TObject);
var
   p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
p:=clienttoscreen(p);
defaulttabsmenu:=4;
Form_peach.pmfun.PopUp(p.x,p.y);
end;

procedure TForm_peach.pmtabbhistoryClick(Sender: TObject);
var
   p:tpoint;
begin
if browserbusy=true then exit;
p.x:=Form_peach.Panel11.left;
p.y:=Form_peach.PanelListBar.height+TabBar.height+Form_peach.PanelBarOpen.height;
if swapbars=true then p.y:=p.y-Form_peach.PanelBarOpen.height;
p:=clienttoscreen(p);
defaulttabsmenu:=3;
Form_peach.pmtabshistory.PopUp(p.x,p.y);
end;

procedure TForm_peach.pmtaborganizebookmarksClick(Sender: TObject);
begin
do_organizebookmarks;
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[12,i]='0' then Form_peach.StringGridList.Cells[12,i]:='1'
         else Form_peach.StringGridList.Cells[12,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.mPeaSiteClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom,desk_env);
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.Repaint;
   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[12,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;
//if enumdir='enum' then tmpenumd:=true;
for i:=1 to sg.rowcount-1 do
   begin
   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);
   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:=0 else enumd:=1;
updatelayout('');
end;

procedure TForm_peach.CheckBoxFolder1Click(Sender: TObject);
begin
on_CheckBoxFolder1_click;
end;

procedure TForm_peach.CheckBoxForceEditClick(Sender: TObject);
begin
on_CheckBoxForceEditClick;
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(executable_path+'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:=12;
      if Column=listsortcol then
         if az=true then sort_za_stringgridlist
         else sort_az_stringgridlist(Column)
      else sort_az_stringgridlist(Column);
      listsortcol:=12;
      update_listview;
      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.mType7zClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=0;
archive_type_select('7Z');
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeARCClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=1;
archive_type_select('ARC');
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypebzip2Click(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=3;
archive_type_select('BZip2');
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeClick(Sender: TObject);
begin
select_by('ext','neutralsel');
end;

procedure TForm_peach.mTypeCustomClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=4;
archive_type_select(txt_custom);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypegzClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=5;
archive_type_select(STR_GZIP);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypePAQClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=17;
archive_type_select(STR_ZPAQ);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypePEAClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=6;
archive_type_select(STR_PEA);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeQUADClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=7;
archive_type_select(STR_QUAD);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeSplitClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=10;
archive_type_select(txt_split);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeTARClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=11;
archive_type_select(STR_TAR);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeUPXClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=14;
archive_type_select(STR_UPX);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mTypeZIPClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=15;
archive_type_select(STR_ZIP);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
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 := [poNoConsole, poWaitOnExit];{$ENDIF}
      P.CommandLine:=(delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -ext2open '+delimiter+escapefilename(sg.Cells[8,i],desk_env)+delimiter);
      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];
   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' 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[12,i]='1' then
            begin
            if clipmode=1 then
               if test_clip(Form_peach.StringGridList.Cells[8,i])=1 then
               else
                  begin
                  Form_peach.StringGridList.Cells[0,i]:='';
                  setlength(clipcontent,length(clipcontent)+1);
                  clipcontent[k,0]:=Form_peach.StringGridList.Cells[8,i];
                  clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
                  clipcontent[k,2]:=Form_peach.StringGridList.Cells[2,i];
                  clipcontent[k,3]:=txt_copy;
                  k:=k+1;
                  end
            else
               begin
               Form_peach.StringGridList.Cells[0,i]:='';
               setlength(clipcontent,length(clipcontent)+1);
               clipcontent[k,0]:=Form_peach.StringGridList.Cells[8,i];
               clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
               clipcontent[k,2]:=Form_peach.StringGridList.Cells[2,i];
               clipcontent[k,3]:=txt_copy;
               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[12,i]='1' then
            begin
            if clipmode=1 then
               if test_clip(Form_peach.StringGridList.Cells[8,i])=1 then
               else
                  begin
                  Form_peach.StringGridList.Cells[0,i]:=' ';
                  setlength(clipcontent,length(clipcontent)+1);
                  clipcontent[k,0]:=Form_peach.StringGridList.Cells[8,i];
                  clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
                  clipcontent[k,2]:=Form_peach.StringGridList.Cells[2,i];
                  clipcontent[k,3]:=txt_cut;
                  k:=k+1;
                  end
            else
               begin
               Form_peach.StringGridList.Cells[0,i]:=' ';
               setlength(clipcontent,length(clipcontent)+1);
               clipcontent[k,0]:=Form_peach.StringGridList.Cells[8,i];
               clipcontent[k,1]:=Form_peach.StringGridList.Cells[1,i];
               clipcontent[k,2]:=Form_peach.StringGridList.Cells[2,i];
               clipcontent[k,3]:=txt_cut;
               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[8,Form_peach.StringGridList.Row])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]); exit; end;
fname:=Form_peach.StringGridList.Cells[8,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:ansistring;
   w:widestring;
   i:integer;
begin
if fun<>'FILEBROWSER' 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;
{$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 mPeaSupport mkdir command
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, 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}

//navrefresh; //deactivated, refresh is now automatic
end;
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 openwith_associated;
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 exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
      begin
      execute_obj(4,Form_peach.StringGridList.Cells[8,i]);
      end;
end;

procedure TForm_peach.po_open_associatedClick(Sender: TObject);
begin
openwith_associated;
end;

procedure menu_openwith;
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 exit;
for i:=1 to Form_peach.StringGridList.RowCount-1 do
   if Form_peach.StringGridList.Cells[12,i]='1' then
      begin
      openw_obj(StringGridList.Cells[8,i]);
      end;
end;
end;

procedure TForm_peach.po_open_customClick(Sender: TObject);
begin
menu_openwith;
end;

procedure TForm_peach.ButtonOpenWithClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
   preview_custom
else
   menu_openwith;
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[12,i]='1' then
               begin
               execute_obj(2,Form_peach.StringGridList.Cells[8,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}ech,ecode:integer;
   overall:boolean;
   cl,src,dest,destf,opcommand:ansistring;
   P:tprocessutf8;{$ENDIF}
   i,j,k:integer;
   cparr,mvarr:array of ansistring;
   {$IFNDEF MSWINDOWS}label 1;{$ENDIF}
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;
{$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_cut then
      begin
      setlength(cparr,length(cparr)+1);
      cparr[j]:=clipcontent[i,0];
      j:=j+1;
      end
   else
      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}
ech:=0;//standard error check, changed conditionally if needed;
overall:=false; //overwrite all, default false;
for i:=0 to length(clipcontent)-1 do
   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 cp command
      P.Options := [poWaitOnExit];
      if clipcontent[i,3]=txt_cut then opcommand:='mv '
      else 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: goto 1;
                     6: cl:=opcommand+'-f '+delimiter+src+delimiter+' '+delimiter+dest+delimiter;
                     7: cl:=opcommand+delimiter+src+delimiter+' '+delimiter+dest+delimiter;
                     10: begin overall:=true; cl:=opcommand+'-f '+delimiter+src+delimiter+' '+delimiter+dest+delimiter; end;
                     end;
         if cl='' then cl:=opcommand+'-f '+delimiter+src+delimiter+' '+delimiter+dest+delimiter;
         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 clearfile(destf)
            else
                  case pMessageInfoAllYesNoCancel('"'+extractfilename(destf)+'" '+txt_overwrite) of
                     2: goto 1;
                     6: clearfile(destf);
                     7: goto 1;
                     10: begin clearfile(destf); overall:=true; end;
                     end;
         cl:=opcommand+'-f '+delimiter+src+delimiter+' '+delimiter+destf+delimiter;
         end;
      if cl='' then goto 1;
      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;
      setcurrentdir((executable_path));
      ecode:=P.ExitStatus;
      if ech=0 then
         if ecode<>0 then
               if pMessageErrorYesNo(cl+char($0D)+char($0A)+txt_copy_error+' '+inttostr(ecode)+'. '+txt_abort)=6 then
                  begin
                  break;
                  end
               else goto 1
         else result:=0;
      if ech=1 then
         if (ecode>3) then
               if pMessageErrorYesNo(cl+char($0D)+char($0A)+txt_copy_error+' '+inttostr(ecode)+'. '+txt_abort)=6 then
                  begin
                  break;
                  end
               else goto 1
         else result:=0;
      1:
      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;
      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:ansistring;
begin
//remove existing item with new destination name
if cleardestname=true then
begin
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, poWaitOnExit];
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter+' d -y';
cl:=bin_name+' '+delimiter+Form_peach.EditOpenIn.Caption+delimiter+' '+delimiter+namenew+delimiter;
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
P.Execute;
P.Free;
end;
//rename item from old name to new name
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole, poWaitOnExit];
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter+' rn';
cl:=bin_name+' '+delimiter+Form_peach.EditOpenIn.Caption+delimiter+' '+delimiter+nameold+delimiter+' '+delimiter+namenew+delimiter;
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   pMessageWarningOK(txt_2_7_validatecl+' '+cl);
   exit;
   end;
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[12,j]='1' then
         if Form_peach.StringGridArchive.Cells[8,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[12,i]='1' then
      begin
      renamefileinarchive(Form_peach.StringGridList.Cells[8,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 TForm_peach.po_openasarchiveClick(Sender: TObject);
begin
openunitasarchive;
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[8,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
   preview_associated
else openwith_associated;
end;

procedure TForm_peach.po_open_peaziptClick(Sender: TObject);
begin
if fun<>'FILEBROWSER' then
  preview_peazipnew
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,sext,sextorig,sextchanged,strsel,s1,sadd,sold,snew,sti,snchar,snpos,fmode:ansistring;
   i,j,k,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[12,i]='1' then s:=Form_peach.StringGridList.Cells[1,i];
   end;
{$ENDIF}
if mode='rename' then //replace entire file name string
begin
sextorig:='';
if not directoryexists(Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]) then
   sextorig:=extractfileext(Form_peach.StringGridList.Cells[8,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[8,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[12,j]='1' then
            if Form_peach.StringGridArchive.Cells[8,i]=extractfilepath(Form_peach.StringGridList.Cells[8,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[12,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[8,i])<>0 then begin exit_busy_status; pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); navrefresh; exit; end;
      k:=k+1;
      sext:='';
      if not directoryexists(Form_peach.StringGridList.Cells[8,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[8,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[8,i],extractfilepath(Form_peach.StringGridList.Cells[8,i])+s);
         if fun='UN7Z' then renamefileinarchive(Form_peach.StringGridList.Cells[8,i],extractfilepath(Form_peach.StringGridList.Cells[8,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') then //special modes
begin
case mode of
   '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[8,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[8,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[12,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[8,i])<>0 then
         begin
         exit_busy_status;
         pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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[8,i]));
      if mode='lowercase' then
         s:=lowercase(extractfilename(Form_peach.StringGridList.Cells[8,i]));
      if mode='timestamp' then
         begin
         s:=extractfilename(Form_peach.StringGridList.Cells[8,i]);
         apply_timestamptoname(s,0,1,fmode);
         end;
      if mode='123' then
         begin s:=numstrext(i,rc-1)+' '+extractfilename(Form_peach.StringGridList.Cells[8,i]); end;
      if mode='dirappend' then
         begin
         s:=Form_peach.StringGridList.Cells[8,i];
         apply_dirnametoname(s,'append',fmode);
         end;
      if mode='dirprepend' then
         begin
         s:=Form_peach.StringGridList.Cells[8,i];
         apply_dirnametoname(s,'prepend',fmode);
         end;
      if mode='add' then
         begin
         s:=extractfilename(Form_peach.StringGridList.Cells[8,i]);
         sext:='';
         if not directoryexists(Form_peach.StringGridList.Cells[8,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[8,i]);
         sext:='';
         if not directoryexists(Form_peach.StringGridList.Cells[8,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[8,i]);
         sext:='';
         if not directoryexists(Form_peach.StringGridList.Cells[8,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[8,i]);
         if not directoryexists(Form_peach.StringGridList.Cells[8,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[8,i]);
         end;
      //check if name is unique
      if Form_peach.StringGridList.Cells[8,i]<>(extractfilepath(Form_peach.StringGridList.Cells[8,i])+s) then
         begin
         {$IFDEF MSWINDOWS}if (mode<>'uppercase') and (mode<>'lowercase') then{$ENDIF}
         if (fileexists(extractfilepath(Form_peach.StringGridList.Cells[8,i])+s)) or (directoryexists(extractfilepath(Form_peach.StringGridList.Cells[8,i])+s)) then
            begin
            s:=extractfilepath(Form_peach.StringGridList.Cells[8,i])+s;
            get_new_archive_name(s);
            s:=extractfilename(s);
            end;
         k:=k+1;
         if fun='FILEBROWSER' then renamefile(Form_peach.StringGridList.Cells[8,i],extractfilepath(Form_peach.StringGridList.Cells[8,i])+s);
         if fun='UN7Z' then renamefileinarchive(Form_peach.StringGridList.Cells[8,i],extractfilepath(Form_peach.StringGridList.Cells[8,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.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;//col2
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]:=Form_peach.StringGrid1.ColWidths[1]+48;
   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;//col2
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.themes_downloadClick(Sender: TObject);
var dom,s:ansistring;
begin
checkdom(dom,s);
cp_open(dom+'peazip-themes.html',desk_env);
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[8,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 then exit;
      EditUn7zaFilter.Text:=StringGridList.Cells[8,StringGridList.Row]+directoryseparator+'*';
      EditUn7zaFilterExclude.Text:=StringGridList.Cells[8,StringGridList.Row]+directoryseparator+'*'+directoryseparator+'*';
      listun7z_go;
      end;
   if fun='FILEBROWSER' then
      begin
      EditUn7zaFilter.Text:='*';
      listdir(StringGridList.Cells[8,StringGridList.Row],false,false);
      addtohistory;
      end;
   end;
end;
end;

procedure grid_obj_open;
var
   mri,i,j:integer;
   cl,jobcode,outname,s:ansistring;
   w:widestring;
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[8,StringGridList.Row],false,false);
   addtohistory;
   exit;
   end;
{$ENDIF}
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[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,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)=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,'extandrun')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
               end
            else
         else
            pMessageWarningOK(txt_error_partial);
         exit;
         end;
         'UNZPAQ' :
         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_unzpaq_cl(cl,jobcode,outname,true,'extandrun','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,'extandrun')=0 then execute_obj(3,outname)
               else
                  pMessageWarningOK(txt_extraction_error);
               end
            else
         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 execute_obj(3,outname)
               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[8,StringGridList.Row]);
         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[8,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[8,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[8,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[8,StringGridList.Row]))='.fat')
                  or (lowercase(extractfileext(StringGridList.Cells[8,StringGridList.Row]))='.ntfs') then
                     begin
                     pMessageInfoOK(txt_2_8_unitrecommend);
                     exit;
                     end;
            if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
               if execute_cl(cl,'preview')=0 then
                  begin
                  execute_obj(3,outname);
                  end
               else
                  pMessageWarningOK(txt_extraction_error);
         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
                  begin
                  execute_obj(3,outname);
                  end
               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;
TabBar.height:=barheight-2;
TabBar.visible:=true;
mtabs.Checked:=true;
pmhtabs.Checked:=true;
pmtabsm.Checked:=true;
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.SpinEditArchive1Change(Sender: TObject);
begin
spansize:=SpinEditArchive1.Value;
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;
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[12,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[8,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;
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}
      list_paste;
      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,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 Key=char(8) then navgoback;  //backspace

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);
begin
update_selstatus;
if checklistanysel<>0 then exit;
if Key=46 then //Cancel
   begin
   {$IFDEF MSWINDOWS}
   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 recycleselected_list
      else deleteselected_frombrowser;
   {$ELSE}
   if shift=[ssShift] then
      if fun='FILEBROWSER' then eraseselected_list(1)
      else
   else deleteselected_frombrowser;
   {$ENDIF}
   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;
cldir: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[12,i]='1' then
         begin
         setlength(sarr,length(sarr)+1);
         sarr[j]:=Form_peach.StringGridList.Cells[8,i];
         j:=j+1;
         end;
   disdrag:=true;
   dodropfiles(ListView1, sarr, 2);
   end
else
   begin
   vpath:=peaziptmpdir+'drop'+inttohex(random(16000000),6)+'\';
   vpath2:='';
   CreateDir(vpath);
   CreateDir(vpath+'virtual\');
   CreateDir(vpath+'source\');
   //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
      raise MyThreaddrop.FatalException;
   MyThreaddrop.vpath:=vpath;
   MyThreaddrop.Resume;
   disdrag:=true;
   dodropvfiles(Form_peach.ListView1, vpath, 0);
   MyThreaddrop.Terminate;
   cldir:=vpath+'virtual\';
   if removedir(cldir)=false then cleardir(cldir,true);
   cldir:=vpath+'source\';
   if removedir(cldir)=false then cleardir(cldir,true);
   if removedir(vpath)=false then cleardir(vpath,true);
   if vpath2<>'' then
      if vpath2<>vpath then
         begin
         cldir:=vpath2+'virtual\';
         if removedir(cldir)=false then cleardir(cldir,true);
         cldir:=vpath2+'source\';
         if removedir(cldir)=false then cleardir(cldir,true);
         if removedir(vpath2)=false then cleardir(vpath2,true);
         end;
   SHChangeNotify(SHCNE_RMDIR,SHCNF_PATH,pstring(vpath2),nil);
   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
      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
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;
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[5]<>'' then s:=s+char($0D)+char($0A)+ListView1.Column[6].Caption+' - '+ListView1.Items[i].SubItems[5];
        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[12,i]:='0' else StringGridList.Cells[12,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[12,i]:='0' else StringGridList.Cells[12,i]:='1';
{$ENDIF}
//set_grid; //Lazarus 0.9.30: no longer needed, selection is always updated before action is launched
update_selstatus;
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;
//mPeaSupport
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[12,i]='1' then
      begin
      setlength(clipcontent1,length(clipcontent1)+1);
      clipcontent1[j,0]:=Form_peach.StringGridList.Cells[8,i];
      clipcontent1[j,1]:=Form_peach.StringGridList.Cells[1,i];
      clipcontent1[j,2]:=Form_peach.StringGridList.Cells[2,i];
      clipcontent1[j,3]:=cpact;
      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+'themes')) then
   begin
   forcedirectories(confpath+themedir);
   end
else
   begin
   pMessageErrorOK(confpath+themedir+' '+txt_theme_exists);
   exit;
   end;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
{$IFDEF MSWINDOWS}
cl:=wincomspec+' /c copy '+delimiter+Form_peach.theme_label.caption+'*.*'+delimiter+' '+delimiter+confpath+themedir+delimiter+' /Y';
{$ELSE}
cl:='cp -p -r -f '+delimiter+Form_peach.theme_label.caption+'.'+delimiter+' '+delimiter+confpath+themedir+delimiter;
{$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.theme_label.caption:=confpath+themedir;
P:=tprocessutf8.Create(nil);
P.Options := [poWaitOnExit];
in_param:=delimiter+escapefilename(confpath+themedir,desk_env)+delimiter;
out_param:=local_desktop+Form_peach.Edit1.text+'.theme.7z';
getworkpath(work_path,out_param);
out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter+' a -t7z -m0=LZMA -mmt=on -mx5 -md=16m -mfb=32 -ms=2g'; // -sccUTF-8 not supported by p7zip 9.13
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 TForm_peach.theme_labelClick(Sender: TObject);
begin
cp_open(theme_label.caption,desk_env);
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}
   //0.9.30 disabled vsIcon mode on Linux since it caused various problems
   Form_peach.ListView1.ViewStyle:=vsIcon;//0.9.30, Linux: this workaround is needed to correctly load small and large icons on tested machines
   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.ListView1.Rowselect:=rowselect;
   Form_peach.mrowselect.checked:=rowselect;
   Form_peach.org_rowselect.checked:=rowselect;
   togglemenubar;
   setnav(navbar);
   setaddressbar(addressbar);
   settabbar(ptabbar);
   settoolbar;
   showtoolbar(-1);
   setbrowsersize(browsersize);
   if (browsertype=0) and (browsersize=1) then Form_peach.imageflat.Glyph:=Bbrowserdetailslarge;
   if (browsertype=1) and (browsersize=0) then Form_peach.imageflat.Glyph:=Bbrowserlist;
   if (browsertype=1) and (browsersize=1) then Form_peach.imageflat.Glyph:=Bbrowserlistlarge;
   if (browsertype=2) and (browsersize=1) then Form_peach.imageflat.Glyph:=Bbrowsericons;
   if (browsertype=2) and (browsersize=2) then Form_peach.imageflat.Glyph:=Bbrowsericonslarge;
   set_swapbars;
   case lastbar of
      1: showbar('none');
      0: showbar('statusbar');
      2: showbar('details');
      3: showbar('bookmarks');
      4: showbar('recent');
      5: showbar('sessionrecent');
      6: showbar('clip');
   end;
   Form_peach.Splitter2.Left:=splitter2size;
   setshowthumbnails(showthumbnails);
   setbrowserch(browserch);
   setsimplesearch(simplesearch);
   setrecsearch(recsearch);
   setrenfilesonly(renfilesonly);
   setusebreadcrumb(usebreadcrumb);
   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) or (browserbusy_minor=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;
begin
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:=2000;
      if length(EditOpenIn1.Caption)>=2 then
         if EditOpenIn1.Caption[1]=DirectorySeparator then
            if EditOpenIn1.Caption[2]=DirectorySeparator then Timer2.Interval:=4000;
      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;
            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 then
      begin
      fextl:=upcase(extractfileext(Form_peach.EditOpenIn.Caption));
      if (fextl='.7Z') or (fextl='.TAR') or (fextl='.ZIP') or (fextl='.WIM') then //not arc
         if (ptmpcode<>'') and (extractfilename(prevarchive)<>'') and (ptmpdir<>'') then
            begin
            Timer2.enabled:=false;
            ltime:=0;
            rLast(ptmpdir+directoryseparator,'*',faAnyFile,true,ltime);
            if ltime>stime then
               case pMessagePreview(txt_6_9_uconf) of
                  6: syncedit_archive;
                  1: begin
                     syncedit_archive;
                     do_discardpreview;
                     end;
                  else
                     begin
                     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.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.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 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;
      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: openpath;
          1: open_archive;
          2: cp_search(desk_env);
          3: begin
             if checklistsel=0 then s:=Form_peach.StringGridList.Cells[1,Form_peach.StringGridList.Row];
             run_websearch(s);
             end;
          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[12,i]='1' then
                   if TargetNode.Index<=appentries1+appsnodes then
                      open_custedit(appdb[TargetNode.Index-appsnodes],Form_peach.StringGridList.Cells[8,i])
                   else
                      open_advcustedit(appdb2[TargetNode.Index-appentries1-appsnodes],Form_peach.StringGridList.Cells[8,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 then exit;
      Form_peach.EditUn7zaFilter.Text:=Form_peach.StringGridAddress1.Cells[8,TargetNode.AbsoluteIndex]+directoryseparator+'*';
      Form_peach.EditUn7zaFilterExclude.Text:=Form_peach.StringGridAddress1.Cells[8,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 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;
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_6_6_pdupfind);
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);
{$IFDEF MSWINDOWS}
treeview2.Items.Add(nil,txt_controlpanel);
treeview2.Items.Add(nil,txt_5_0_ps);
{$ENDIF}
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;
{$IFDEF MSWINDOWS}
pmfun18.caption:=treeview2.Items[17].Text;
pmfun19.caption:=treeview2.Items[18].Text;
{$ELSE}
pmfun18.visible:=false;
pmfun19.visible:=false;
{$ENDIF}
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_6_6_pdupfind then begin possiblyduplicate('displayed'); 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; 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;
end;

procedure TForm_peach.w7contextlangClick(Sender: TObject);
begin
pMessageInfoOK(txt_5_3_cmlmessage);
cp_open(executable_path+'res'+directoryseparator+'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));
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;
{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;
   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)=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[12,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[8,i])<>0 then begin pMessageWarningOK(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i]); exit; end;
         if fun='FILEBROWSER' then addtobookmarks(escapefilename(Form_peach.StringGridList.Cells[8,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.
