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

BACKEND
(Windows) 7z 15.12
(Linux) p7zip 15.09
 can now extract RAR5 files without resorting on separate UNRAR5 Plugin (still available as optional alternative extraction engine)
Pea 0.52

CODE
Improved UTF-8 support in Windows
Improved application startup and configuration process to make it more robust in case of random / system errors
 last good configuration is saved and automatically used as first restore attempt if configuration fails to load
 if configuration errors are detected anyway, volatile mode (using embedded configuration) is automatically activated

FILE MANAGER
Improved secure delete, free space delete, and hashing / analysis functions
 operations can be stopped by users
 more information and is shown while running the task and progress is more accurate, based on input size
 more information is provided by hashing / analysis tool
  for each subdirectory it is reported the content in files, folders and bytes (hinting possible duplicate directories)
  first / last 32 bytes of files are shown for a quick preview (for hashing and content preview modes)
 report can be sorted for any column and can be exported to tabbed txt or to csv
File hashing / analysis tools added in Test dropdown group in application tool bar

EXTRACTION and ARCHIVING
Automatically removes redundant intermediate directory when extracting to new folder
 for better visibility option is also shown in main extraction form and in Extract dropdown group (in application tool bar)

WINDOWS INSTALLER

LINUX INSTALLERS
Transformed various backend into additional plugin in order to reduce dependencies of main software package

188 file extensions supported

Translations updated and replaced in the package

--------------------------------------------------------------------------------
Status of UTF8 support (tested on Lazarus 1.4.0)
1 - Get UTF8 paramstrings > implemented, complete
2 - Handle UTF8 strings and filenames > implemented, work in  progress, some
functions seems still limited to ansi
3 - Replace tprocess with tprocessutf8 > implemented, not fully working on Windows
due Execute procedure relying on CreateProcess which calls kernel32.dll ansi function
CreateProcessA (redef.inc), that will fail if extended characters outside oemcodepage
are used
Workaround 1: launch process with system's ShellExecuteW
Shortcomings
code is not cross-platform
needs to be integrated with custom methods to sync with / read from underlying Process pipe if possible
Workaround 2: conver filenames to short paths 8.3, which works with CreateProcessA
Shortcomings:
can reference existing file/dir names, but cannot handle cases where it is asked to create new UTF-8 filenames
not a good solution when command are meant to be saved as scripts due poor readability
--------------------------------------------------------------------------------

(C) Copyright 2006 Giorgio Tani giorgio.tani.software@gmail.com
Official PeaZip site http://www.peazip.org
The program is released under GNU LGPL http://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,
{$ENDIF}
LResources, Forms, Controls, Graphics, Dialogs, EditBtn,
StdCtrls, Buttons, ExtCtrls, ComCtrls, Grids, Menus, Spin, ShellCtrls,
hash, adler32, CRC16, CRC24, CRC32, CRC64, ED2K, MD4, MD5, RMD160, SHA1, SHA224,
SHA256, SHA384, SHA512, Whirl512, mem_util, AES_EAX, FCAES256,
list_utils,pea_utils,ansiutf8_utils,img_utils,
unit1,unit2,unit3,unit5,unit6,Unit8,Unit9,Unit10,Unit11,Unit12,Unit13,Unit14,
Classes, SysUtils, Process, UTF8Process, dateutils, fileutil;

type

   { TMyThread }

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

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

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

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

   TClipContent = array of array [0..3] of utf8string;
   Thistarray = array[1..8]of utf8string;

   { TForm_peach }

   TForm_peach = class(TForm)
     baboutfaq: TSpeedButton;
     baboutlocalhelp: TSpeedButton;
     baboutsupport: TSpeedButton;
     babouttracker: TSpeedButton;
     baboutweb: TSpeedButton;
     Bevel1: TShape;
     Bevel10: TShape;
     Bevel11: TShape;
     Bevel12: TShape;
     Bevel13: TShape;
     Bevel14: TShape;
     Bevel15: TShape;
     Bevel16: TShape;
     Bevel17: TShape;
     Bevel18: TShape;
     BevelTitleOpt10: TShape;
     BevelTitleOpt11: TShape;
     BevelTitleOpt2: TShape;
     BevelTitleOpt4: TShape;
     BevelTitleOpt5: TShape;
     BevelTitleOptions6: TPanel;
     BevelTitleOptions7: TPanel;
     BevelTitleOptions8: TPanel;
     ButtonDesk: TButton;
     ButtonDesk1: TButton;
     Buttonfmactions1: TSpeedButton;
     CheckBoxArchiveHistory: TCheckBox;
     CheckBoxAutoHaltA: TCheckBox;
     CheckBoxAutoHaltE: TCheckBox;
     CheckBoxBrowseNotVerbose: TCheckBox;
     CheckBox7zunrar5: TCheckBox;
     CheckBoxConvert1: TCheckBox;
     CheckBoxFolder1: TCheckBox;
     CheckBoxIntDir: TCheckBox;
     ComboBoxLibre: TComboBox;
     ComboBoxArchiveSolid1: TComboBox;
     EditDesk: TEdit;
     EditUn7zaFilter: TEdit;
     EditUn7zaFilter1: TEdit;
     GroupBoxOptPaths: TPanel;
     GroupBoxOptPaths1: TPanel;
     GroupBoxOptReset: TPanel;
     ImageAdArchive3: TImage;
     ImageAddress0: TImage;
     ImageAddress1: TImage;
     ImageAddress2: TImage;
     ImageAddress3: TImage;
     ImageAddress4: TImage;
     ImageAddress5: TImage;
     ImageAddress6: TImage;
     ImageAddress7: TImage;
     ImageAdArchive0: TImage;
     ImageAdArchive1: TImage;
     ImageAdArchive2: TImage;
     ImageInfoDefault1: TImage;
     ImageListSearch1: TImage;
     Imageopenutf: TImage;
     Imageopenutf1: TImage;
     Imageopenutf2: TImage;
     LabelAppPath: TLabel;
     Labelcb17: TLabel;
     Labelcb19: TLabel;
     LabelClipInfo: TLabel;
     LabelAbout2: TLabel;
     Labelcb21: TLabel;
     LabelClickAdArchive1: TLabel;
     LabelClickAdArchive2: TLabel;
     LabelClickAdArchive3: TLabel;
     LabelClickAdArchive4: TLabel;
     LabelConf1: TLabel;
     LabelConfigureSendTo: TLabel;
     LabelLibre: TLabel;
     LabelAbout1: TLabel;
     LabelAbout: TLabel;
     LabelHelp: TLabel;
     Labelbcmblock: TLabel;
     Labelcb20: TLabel;
     Labelcb4: TLabel;
     Labelcb7: TLabel;
     Labelcbadvanced: TLabel;
     Labelcbbasic: TLabel;
     Labelcbsample: TLabel;
     Labelcbsampleadvanced: TLabel;
     LabelResetPtmp: TLabel;
     Labelspac2: TLabel;
     Labelspac3: TLabel;
     Labelspac5: TLabel;
     Labelspac6: TLabel;
     Labelspac7: TLabel;
     Labelspac8: TLabel;
     LabelUpdates: TLabel;
     LabelPanelHintAdd: TLabel;
     LabelPanelHintExtract: TLabel;
     LabelResetApp1: TLabel;
     LabelResetBookmarks: TLabel;
     LabelResetHistory: TLabel;
     LabelResetPM: TLabel;
     LabelTitleApps1: TLabel;
     LabelTitleApps2: TLabel;
     LabelTitleExtract2: TLabel;
     LabelTitleExtract3: TLabel;
     LabelTitleExtract4: TLabel;
     LabelTitleExtract1: TLabel;
     LabelTitleOptions6: TLabel;
     LabelTitleOptions7: TLabel;
     LabelTitleOptions8: TLabel;
     LabelDonations: TLabel;
     MemoAbout: TMemo;
     MenuItem104: TMenuItem;
     mCharCase: TMenuItem;
     mChar: TMenuItem;
     MenuItem105: TMenuItem;
     mDateYear: TMenuItem;
     mDateMonth: TMenuItem;
     mDateDay: TMenuItem;
     mDateHour: TMenuItem;
     mDateWeek: TMenuItem;
     MenuItem109: TMenuItem;
     maddexisting: TMenuItem;
     maddconvert: TMenuItem;
     MenuItem110: TMenuItem;
     abc4: TMenuItem;
     abc3: TMenuItem;
     abc2: TMenuItem;
     abc1: TMenuItem;
     abc8: TMenuItem;
     abc7: TMenuItem;
     abc6: TMenuItem;
     abc5: TMenuItem;
     MenuItem48: TMenuItem;
     po_preview: TMenuItem;
     po_analyze: TMenuItem;
     pmmorepreview: TMenuItem;
     pmmorehex: TMenuItem;
     pmqnointdir: TMenuItem;
     pmmoreanalysis: TMenuItem;
     po_rename_timestamp: TMenuItem;
     Panel9: TPanel;
     PanelSearch: TPanel;
     pmabc5: TMenuItem;
     pmabc6: TMenuItem;
     pmabc7: TMenuItem;
     pmabc8: TMenuItem;
     pmabc1: TMenuItem;
     pmabc2: TMenuItem;
     pmabc3: TMenuItem;
     pmabc4: TMenuItem;
     mextract: TMenuItem;
     MenuItem47: TMenuItem;
     mtoggletbrib: TMenuItem;
     mf4: TMenuItem;
     OpenDialogApps1: TOpenDialog;
     PageOpt5: TPanel;
     PageOpt8: TPanel;
     PageOpt7: TPanel;
     PanelAdArchive0: TPanel;
     PanelAdArchive3: TPanel;
     PanelApps1: TPanel;
     PanelApps2: TPanel;
     PanelAdArchive1: TPanel;
     PanelAdArchive2: TPanel;
     PanelTitleApps: TPanel;
     pmCustEditAdd: TMenuItem;
     pmCustEditAdd1: TMenuItem;
     pmCustEditApps: TPopupMenu;
     pmCustEditApps1: TPopupMenu;
     pmCustEditDesc: TMenuItem;
     pmCustEditDesc1: TMenuItem;
     pmCustEditEdit: TMenuItem;
     pmCustEditEdit1: TMenuItem;
     pmCustEditEdit1after: TMenuItem;
     pmCustEditRemove: TMenuItem;
     pmCustEditRemove1: TMenuItem;
     pmabc: TPopupMenu;
     RadioGroupTS: TComboBox;
     RadioGroup4: TComboBox;
     RadioGroup6: TComboBox;
     Shape1: TShape;
     ShapeAddress: TShape;
     ShapeTitleApps1: TShape;
     StringGridCustEdit: TStringGrid;
     StringGridCustEdit1: TStringGrid;
     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;
     pmquickroot: TMenuItem;
     pmquickdesk: TMenuItem;
     pmquickhome: TMenuItem;
     pmquick: TPopupMenu;
     pmbcdir: TPopupMenu;
     po_renmenu: TMenuItem;
     MenuItem30: TMenuItem;
     pmbreadfs: TMenuItem;
     pmbreadfun: TMenuItem;
     mPeaFB: TMenuItem;
     mPeaTW: TMenuItem;
     mPeaGP: TMenuItem;
     MenuItem112: TMenuItem;
     mselectadv: TMenuItem;
     PanelHintAdd: TPanel;
     PanelHintExtract: TPanel;
     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;
     BevelTitleAddadv4: TShape;
     BevelTitleAddadv5: TShape;
     BevelTitleAddadv6: TShape;
     BevelTitleExtractadvopt1: TShape;
     BevelTitleExtractadvopt2: TShape;
     BevelTitleAddAdv1: TShape;
     BevelTitleAddadv2: TShape;
     BevelTitleAddAdv3: TShape;
     BevelTitleOpt1: TShape;
     BevelTitleOpt3: TShape;
     BevelTitleOpt6: TShape;
     BevelTitleOpt7: TShape;
     BevelTitleOpt8: TShape;
     BevelTitleOptions1: TPanel;
     BevelTitleOptions2: TPanel;
     BevelTitleOptions3: TPanel;
     BevelTitleOptions4: TPanel;
     BevelTitleOptions5: TPanel;
     ShapeTitleAdd1: TShape;
     BSchedule: TBitBtn;
     BSchedule1: TBitBtn;
     Button1: TBitBtn;
     Button2: TBitBtn;
     ButtonArchive: TBitBtn;
     ButtonArchive1: TBitBtn;
     ButtonDelete: TSpeedButton;
     ButtonDup: TSpeedButton;
     ButtonDup1: TSpeedButton;
     ButtonEditName12: TSpeedButton;
     ButtonEditName3: TButton;
     ButtonEditName4: TSpeedButton;
     ButtonEditName5: TButton;
     ButtonEditName8: TSpeedButton;
     ButtonEditNameCustom: TButton;
     ButtonEditNameCustom1: TButton;
     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;
     ButtonUn7za10: 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;
     cbadler: TCheckBox;
     cbadvf1: TCheckBox;
     cbadvf2: TCheckBox;
     cbcheckall: TCheckBox;
     cbcrc16: TCheckBox;
     cbcrc24: TCheckBox;
     cbcrc32: TCheckBox;
     cbcrc64: TCheckBox;
     cbdeleteinputmode1: TComboBox;
     cbed2k: TCheckBox;
     cbf1: TCheckBox;
     cbf10: TCheckBox;
     cbf11: TCheckBox;
     cbf2: TCheckBox;
     cbf3: TCheckBox;
     cbf5: TCheckBox;
     cbf6: TCheckBox;
     cbf7: TCheckBox;
     cbf8: TCheckBox;
     cbf9: TCheckBox;
     cbfARC: TCheckBox;
     cbfCustom: TCheckBox;
     cbfSfx: TCheckBox;
     cbfSfx1: TCheckBox;
     cbfWIM: TCheckBox;
     cbfXZ: TCheckBox;
     cbmd4: TCheckBox;
     cbmd5: TCheckBox;
     cbrmd: TCheckBox;
     cbsha1: TCheckBox;
     cbsha224: TCheckBox;
     cbsha256: TCheckBox;
     cbsha384: TCheckBox;
     cbsha512: TCheckBox;
     cbType: TComboBox;
     cbUn7zaRecursive: TCheckBox;
     cbUn7zaRecursiveExclude: TCheckBox;
     cbwhirlpool: TCheckBox;
     CheckBox1: TCheckBox;
     CheckBox2: TCheckBox;
     CheckBox4: TCheckBox;
     CheckBox5: TCheckBox;
     CheckBoxARC1: TCheckBox;
     CheckBoxARC2: TCheckBox;
     CheckBoxARC3: TCheckBox;
     CheckBoxArchive4: TCheckBox;
     CheckBoxArchive6: TCheckBox;
     CheckBoxArchiveOF: TCheckBox;
     CheckBoxAutoOpen: TCheckBox;
     CheckBoxAutoOpen1: TCheckBox;
     CheckBoxConvert: TCheckBox;
     CheckBoxDate: TCheckBox;
     CheckBoxDeleteInput1: TCheckBox;
     CheckBoxEncoding: TCheckBox;
     CheckBoxEncoding1: TCheckBox;
     CheckBoxEnumd: TCheckBox;
     CheckBoxFolder: TCheckBox;
     CheckBoxDeleteInput: TCheckBox;
     CheckBoxIgnoreDisp: TCheckBox;
     CheckBoxIgnoreSel: TCheckBox;
     CheckBoxJobEncoding: TCheckBox;
     CheckBoxMailKeep: TCheckBox;
     CheckBoxnetworkinfo: TCheckBox;
     CheckBoxParallelArchiving: TCheckBox;
     CheckBoxPEAEncryption: TCheckBox;
     CheckBoxPrebrowse: TCheckBox;
     CheckBoxQuadMax: TCheckBox;
     CheckBoxSameArc: TCheckBox;
     CheckBoxSameExt: TCheckBox;
     CheckBoxSeparate: TCheckBox;
     CheckBoxTarBefore: TCheckBox;
     CheckBoxTBW: TCheckBox;
     CheckBoxThemeBars: TCheckBox;
     CheckBoxUPX1: TCheckBox;
     CheckBoxUPX2: TCheckBox;
     CheckBoxWindowStatus: TCheckBox;
     CheckBoxzcopy: TCheckBox;
     CheckGroupM1: TCheckGroup;
     CheckGroupM2: TCheckGroup;
     CheckGroupW: TCheckGroup;
     CheckGroupW1: TCheckGroup;
     ColorButton1: TColorButton;
     ColorButton2: TColorButton;
     ComboBox1: TComboBox;
     ComboBox2: TComboBox;
     ComboBox7zalgo: TComboBox;
     ComboBoxARC: TComboBox;
     ComboBoxARC2: TComboBox;
     ComboBoxARCalgo: TComboBox;
     ComboBoxArchive1: TComboBox;
     ComboBoxArchive2: TComboBox;
     ComboBoxArchive3: TComboBox;
     ComboBoxArchive4: TComboBox;
     ComboBoxArchive5: TComboBox;
     ComboBoxArchive6: TComboBox;
     ComboBoxArchive7: TComboBox;
     ComboBoxArchive8: TComboBox;
     ComboBoxArchive9: TComboBox;
     ComboBoxArchiveCustom: TComboBox;
     ComboBoxArchiveCustom1: TComboBox;
     ComboBoxArchivePasses: TComboBox;
     ComboBoxArchiveSolid: 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;
     ComboBoxSplit3: TComboBox;
     ComboBoxTheme: TComboBox;
     ComboBoxUPX: TComboBox;
     CompressionARC: TPanel;
     CompressionCustom: TPanel;
     CompressionCustom1: TPanel;
     ConsoleCreate: TPanel;
     DateEdit1: TDateEdit;
     DateEdit2: TDateEdit;
     DateEdit3: TDateEdit;
     DateEdit4: TDateEdit;
     Edit1: TEdit;
     Edit2: TEdit;
     Edit3: TEdit;
     Edit4: TEdit;
     Edit5: 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;
     gbConsoleCreate: TPanel;
     Group7za1: TPanel;
     Group7za2: TPanel;
     GroupBox1: TPanel;
     GroupBox10: TPanel;
     GroupBox11: TPanel;
     GroupBox7: TPanel;
     GroupBox8: TPanel;
     GroupBoxCheck: TPanel;
     GroupBoxpr: TPanel;
     GroupBox4: TPanel;
     GroupBoxFav: TPanel;
     GroupBox7za3: TPanel;
     GroupBox7za4: TPanel;
     GroupBoxCreateOut: TPanel;
     GroupBoxEnc: TPanel;
     GroupBoxPEAAdvanced1: TPanel;
     iConsoleCreateImport: TImage;
     iadvextract: TImage;
     Image7zPj: TBitBtn;
     Image7zPj1: TBitBtn;
     ImageInfoArchive2: TImage;
     ImageInfoArchive3: TImage;
     ImageInfoArchive5: TImage;
     ImageInfoArchive6: TImage;
     ImageInfoDefault2: TImage;
     ImagePassword1: TSpeedButton;
     ImagePassword2: TSpeedButton;
     ImageSplit: TImage;
     Label8: TLabel;
     LabelColor1: TLabel;
     LabelColor2: TLabel;
     LabelConfigurePeaZip: TLabel;
     LabelDefaultColor1: TLabel;
     LabelDefaultColor2: TLabel;
     LabelDefaultOpacity: TLabel;
     Labelspac1: TLabel;
     LabelLang4: TLabel;
     LabelOpacity: TLabel;
     Labeloptsub2: TLabel;
     Label10: TLabel;
     Label11: TLabel;
     Labeloptsub1: TLabel;
     Labeloptsub3: TLabel;
     Labelpasses: TLabel;
     Label6: TLabel;
     Label7: TLabel;
     Label7za1: TLabel;
     Label7za10: TLabel;
     Label7za11: TLabel;
     Label7za12: TLabel;
     LabelArcSub1: TLabel;
     Label7za14: TLabel;
     Label7za18: TLabel;
     Label7za2: TLabel;
     Label7za3: TLabel;
     Label7za4: TLabel;
     Label7za5: TLabel;
     Label7za6: TLabel;
     Label7za7: TLabel;
     Label7za9: TLabel;
     Label7zaPasses: TLabel;
     Label7zsolidblock: TLabel;
     Labeladvextfreearc: TLabel;
     Labeladvextace: TLabel;
     LabelArchiveOther1: TLabel;
     LabelArchiveOther2: TLabel;
     LabelArchiveOther3: TLabel;
     LabelArchiveOther4: TLabel;
     LabelArchiveOther8: TLabel;
     LabelARCsolidblock: TLabel;
     LabelArcSub2: TLabel;
     LabelArcSub3: TLabel;
     Labelcb15: TLabel;
     Labelcb16: TLabel;
     Labelcb18: TLabel;
     LabelCustom: TLabel;
     LabelPEA6: TLabel;
     LabelPEA7: TLabel;
     LabelPEA8: TLabel;
     LabelResetTheme: TLabel;
     LabelSplit: TLabel;
     LabelTheme: TLabel;
     LabelTheme1: TLabel;
     LabelTheme2: TLabel;
     LabelTheme3: TLabel;
     LabelThemeLoaded: TLabel;
     LabelTitleOptions5: TLabel;
     LabelTitleAdd1: TLabel;
     LabelTitleAdd2: TLabel;
     LabelTitleAdd3: TLabel;
     LabelTitleAdd4: TLabel;
     MenuItem102: 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;
     OptionsARC: TPanel;
     Panel1: TPanel;
     Panel2: TPanel;
     PageOpt6: TPanel;
     PanelSplitFile: TPanel;
     RadioGroup1: TComboBox;
     cbdeleteinputmode: TComboBox;
     RadioGroupPaq: TRadioGroup;
     RadioGroupQuad: TRadioGroup;
     Shape3: TPanel;
     Shape4: TPanel;
     ShapeTitleAdd2: TShape;
     ShapeTitleAdd3: TShape;
     ShapeTitleExt1: TShape;
     ShapeTitleExt2: TShape;
     ShapeTitleExt3: TShape;
     ShellTreeView2: TShellTreeView;
     SpinEdit1: TSpinEdit;
     Subtitle7zaopt: TLabel;
     LabelArchiveOther: TLabel;
     LabelArchiveOther5: TLabel;
     LabelArchiveOther6: TLabel;
     LabelArchiveOther7: TLabel;
     LabelEvery: TLabel;
     LabelEveryUnit: TLabel;
     LabelStatus2: TLabel;
     LabelStatus5: TLabel;
     LabelEvery1: TLabel;
     LabelEveryUnit1: TLabel;
     LabelStatus4: TLabel;
     LabelStatus6: TLabel;
     LabelTitleOptions1: TLabel;
     LabelTitleOptions2: TLabel;
     LabelTitleOptions3: TLabel;
     LabelTitleOptions4: TLabel;
     lConsoleCreate_jobcode: TLabel;
     lConsoleCreate_outname: TLabel;
     Lmanageschedule1: TLabel;
     Lmanageschedule2: TLabel;
     Lmanageschedule3: TLabel;
     Lmanageschedule4: TLabel;
     lsa1: TLabel;
     lsa2: TLabel;
     lsa3: TLabel;
     lsa4: TLabel;
     lsa5: TLabel;
     lsa6: TLabel;
     lsspc: TLabel;
     lsaday: TLabel;
     lsaday1: TLabel;
     lsp: TLabel;
     lsp1: TLabel;
     lsspc1: TLabel;
     mConsoleCreate: TMemo;
     MenuItem100: TMenuItem;
     mprofileultra7z: TMenuItem;
     mprofilenormal7z: TMenuItem;
     mprofilenormalzip: TMenuItem;
     mprofilefastzip: TMenuItem;
     mprofileencrypt7z: TMenuItem;
     mprofilesplitzip: TMenuItem;
     mprofileauto: TMenuItem;
     NotebookAdd: TPanel;
     Options: TPanel;
     OptionsAdv: TPanel;
     OptionsOpen: TPanel;
     Panel7za: TPanel;
     PanelARC: TPanel;
     PanelArchive2: TPanel;
     PanelCustom: TPanel;
     PanelHDW: TPanel;
     PanelMonthly: TPanel;
     PanelPAQ: TPanel;
     PanelPEA: TPanel;
     PanelQuad: TPanel;
     PanelScheduleAdd: TPanel;
     PanelTitleOptions: TPanel;
     PanelUPX: TPanel;
     PanelWeekly: 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;
     pmjumpfs1: 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;
     RadioGroupAction: TComboBox;
     RadioGroupAction1: TComboBox;
     RadioGroupActionArc: TComboBox;
     RadioGroupArchive: TRadioGroup;
     schedaddname: TEdit;
     schedaddschedule: TComboBox;
     ScheduleAdd: TPanel;
     scheduleend: TCheckBox;
     schedulehh: TSpinEdit;
     schedulemm: TSpinEdit;
     scheduleNN: TSpinEdit;
     schedulepassword: TLabel;
     schedulestart: TCheckBox;
     scheduleuser: TCheckBox;
     SpinEditArchive1: TSpinEdit;
     StringGrid1: TStringGrid;
     StringGrid2: TStringGrid;
     Subtitle7zaopt1: TLabel;
     Subtitle7zaopt2: TLabel;
     themesave_label: TLabel;
     themes_download: TLabel;
     theme_label: TLabel;
     theme_label1: TImage;
     w7contextlang: TMenuItem;
     mpeaextractor: 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;
     PanelHDW1: TPanel;
     PanelMonthly1: TPanel;
     PanelScheduleAdd1: TPanel;
     PanelWeekly1: TPanel;
     schedaddname1: TEdit;
     schedaddschedule1: TComboBox;
     scheduleend1: TCheckBox;
     schedulehh1: TSpinEdit;
     schedulemm1: TSpinEdit;
     scheduleNN1: TSpinEdit;
     schedulepassword1: TLabel;
     CheckBoxNameAsParentFolder: TCheckBox;
     CheckBoxShowHints: TCheckBox;
     CheckBoxClip: TCheckBox;
     CheckBoxUnPeaAttributes: TCheckBox;
     ConsoleOpen: TPanel;
     ctrlback: TSpeedButton;
     iConsoleCreateImport1: TImage;
     il_dtheme_96: TImageList;
     ImagePanel5: TImage;
     ImageFlat2: TSpeedButton;
     ImageFlat1: TSpeedButton;
     ImageInfoOpen4: TSpeedButton;
     ImageListRoot: TImage;
     ImagePassword: TSpeedButton;
     Labelbsize: TLabel;
     LabelConf: TLabel;
     LabelLang2: TLabel;
     LabelStatusAr: TLabel;
     LabelStatusEx: TLabel;
     LabelStatusdisplayed1: 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;
     pmdeduplicate: 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;
     gbConsoleCreate1: TPanel;
     GroupBox12: TPanel;
     il_dtheme_48: TImageList;
     Image7zPj3: TBitBtn;
     il_dtheme_16: TImageList;
     il_dtheme_tool32: TImageList;
     ImageAddress: TImage;
     ImageFlat: TSpeedButton;
     ImageInfoArchive4: TImage;
     ImageList48px: TImageList;
     ImageList16px: TImageList;
     ImageList96px: TImageList;
     ImageList192px: TImageList;
     ImageListSearch: TImage;
     ImageList2: TImageList;
     ImageTheme: TImage;
     ImageUn7zPj: TBitBtn;
     LabelClickAddress1: TLabel;
     Label5: TLabel;
     LabelClickAddress2: TLabel;
     LabelClickAddress3: TLabel;
     LabelClickAddress4: TLabel;
     LabelClickAddress5: TLabel;
     LabelClickAddress6: TLabel;
     LabelClickAddress7: TLabel;
     LabelClickAddress8: TLabel;
     LabelInfo4: TLabel;
     LabelStatus: TLabel;
     LabelStatusEx2: TLabel;
     LabelStatusdisplayed: TLabel;
     lConsoleCreate_jobcode1: TLabel;
     lConsoleCreate_outname1: TLabel;
     mConsoleCreate1: TMemo;
     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;
     MenuItem71: TMenuItem;
     mch: TMenuItem;
     mchadler32: TMenuItem;
     mchcrc16: TMenuItem;
     mchcrc24: TMenuItem;
     mchcrc32: TMenuItem;
     mchcrc64: TMenuItem;
     mchedonkey: TMenuItem;
     mchmd4: TMenuItem;
     mchmd5: TMenuItem;
     mchripemd160: TMenuItem;
     mchsha1: TMenuItem;
     mchsha224: TMenuItem;
     mchsha256: TMenuItem;
     mchsha384: TMenuItem;
     mchsha512: TMenuItem;
     mchwhirlpool512: TMenuItem;
     MenuItem72: 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;
     MenuItemMore: TMenuItem;
     PanelBarOpen1: TPanel;
     mpm: TMenuItem;
     Panelnav3: TPanel;
     PanelSide: TPanel;
     PEA: TGroupBox;
     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;
     mTypeWIM: TMenuItem;
     mTypeXZ: 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;
     Panel3: TPanel;
     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;
     ImageList1: TImageList;
     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;
     ProgressBar2: TProgressBar;
     RadioGroupBrowser: TComboBox;
     RadioGrouppwrequest: TComboBox;
     schedulestart1: TCheckBox;
     scheduleuser1: TCheckBox;
     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;
     mType7z: TMenuItem;
     mTypeARC: TMenuItem;
     mTypebzip2: TMenuItem;
     mTypeCustom: TMenuItem;
     mTypegz: TMenuItem;
     mTypePAQ: TMenuItem;
     mTypePEA: TMenuItem;
     mTypeQUAD: TMenuItem;
     mTypeSfx: TMenuItem;
     mTypeSfxArc: TMenuItem;
     mTypeSplit: TMenuItem;
     mTypeTAR: TMenuItem;
     mTypeUPX: TMenuItem;
     mTypeZIP: TMenuItem;
     NotebookOpen: TPanel;
     PageExtAdv: TPanel;
     Panel5: TPanel;
     Panel6: TPanel;
     PanelExtract: TPanel;
     PanelFileBrowserOptions: TPanel;
     PopupMenuType: TPopupMenu;
     pmBrowser: TMenuItem;
     mpathself1: TMenuItem;
     MenuItemArchive_home1: TMenuItem;
     MenuItemArchive_documents: 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;
     Labelcb14: TLabel;
     aowseparator2: TMenuItem;
     eowseparator2: TMenuItem;
     MemoList: TMemo;
     PanelFilters: TPanel;
     pmjumpspacer2: TMenuItem;
     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;
     smOpen1: 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;
     PageOpt1: TPanel;
     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;
     RadioGroup0: TComboBox;
     SpinEditPrebrowse: TSpinEdit;
     Splitter1: TSplitter;
     Splitter2: TSplitter;
     StringGridBookmarks: TStringGrid;
     StringGridClipboard: TStringGrid;
     StringGridSessionHistory: TStringGrid;
     StringGridRecent: TStringGrid;
     StringGridList: TStringGrid;
     ScheduleExtract: TPanel;
     Timer2: TTimer;
     Timer3: TTimer;
     Timerdrag: TTimer;
     TimerHintStart: TTimer;
     TimerHintStop: 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;
     cbRememberIOin1: TCheckBox;
     CheckBoxARCpw: TCheckBox;
     CheckBoxARCpw2: TCheckBox;
     CheckBoxArchiveAES1: TCheckBox;
      ComboBoxARC1: TComboBox;
      ComboBoxARC3: TComboBox;
      EditARCpw3: TEdit;
      EditARCpw4: TEdit;
      GroupBox7za5: TGroupBox;
      ImageDefaults2: TBitBtn;
      ImageExploreIn1: TImage;
      LabelARCsolidblock1: TLabel;
      LabelPAQ2: TLabel;
      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;
      OptionsARC1: TGroupBox;
      PageOpt2: TPanel;
      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;
      PageOpt4: TPanel;
      pCustom: TPopupMenu;
      RadioGroupPaq1: TRadioGroup;
      LabelSplit1: TLabel;
      ImagePEA6: TImage;
      ImagePEA7: TImage;
      ImageListExpandAll1: TImage;
      LabelPEAVolumes: TLabel;
      LabelMain3: TLabel;
      LabelMain4: TLabel;
      LabelMainWrite1: TLabel;
      LabelUnPeaExplore2: TLabel;
      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;
      PageOpt3: TPanel;
      PanelArchiveMain: TPanel;
      PanelBarOpen: TPanel;
      PanelDefaults: TPanel;
      PanelBack: 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 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 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 ButtonDeskClick(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 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 ButtonUn7za9Click(Sender: TObject);
      procedure ButtonUn7zaTo1Click(Sender: TObject);
      procedure cbadvf1Click(Sender: TObject);
      procedure cbadvf2Click(Sender: TObject);
      procedure cbdeleteinputmode1Change(Sender: TObject);
      procedure cbdeleteinputmodeChange(Sender: TObject);
      procedure cbfSfx1Click(Sender: TObject);
      procedure cbfWIMClick(Sender: TObject);
      procedure cbfXZClick(Sender: TObject);
      procedure CheckBox1Click(Sender: TObject);
      procedure CheckBox2Click(Sender: TObject);
      procedure CheckBox7zunrar5Click(Sender: TObject);
      procedure CheckBoxARC3Click(Sender: TObject);
      procedure CheckBoxArchive4Click(Sender: TObject);
      procedure CheckBoxBrowseNotVerboseClick(Sender: TObject);
      procedure CheckBoxConvert1Change(Sender: TObject);
      procedure CheckBoxConvertChange(Sender: TObject);
      procedure CheckBoxDeleteInput1Click(Sender: TObject);
      procedure CheckBoxDeleteInputClick(Sender: TObject);
      procedure CheckBoxEnumdClick(Sender: TObject);
      procedure CheckBoxFolder1Click(Sender: TObject);
      procedure CheckBoxIntDirClick(Sender: TObject);
      procedure CheckBoxMailKeepClick(Sender: TObject);
      procedure CheckBoxNameAsParentFolderClick(Sender: TObject);
      procedure CheckBoxnetworkinfoClick(Sender: TObject);
      procedure CheckBoxSameArcClick(Sender: TObject);
      procedure CheckBoxSameExtClick(Sender: TObject);
      procedure CheckBoxThemeBarsClick(Sender: TObject);
      procedure CheckBox5Click(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 CheckGroupM1ItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupM2ItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupW1ItemClick(Sender: TObject; Index: integer);
      procedure CheckGroupWItemClick(Sender: TObject; Index: integer);
      procedure ComboBox1Change(Sender: TObject);
      procedure ComboBox2Change(Sender: TObject);
      procedure ComboBoxARC2Change(Sender: TObject);
      procedure ComboBoxArchive7Change(Sender: TObject);
      procedure ComboBoxArchive8Change(Sender: TObject);
      procedure ComboBoxArchive9Change(Sender: TObject);
      procedure ComboBoxLibreChange(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 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 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 ImageFlat1Click(Sender: TObject);
      procedure ImageFlat2Click(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 Imageopenutf1Click(Sender: TObject);
      procedure Imageopenutf2Click(Sender: TObject);
      procedure ImageopenutfClick(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 cbadlerClick(Sender: TObject);
      procedure cbcheckallClick(Sender: TObject);
      procedure cbcrc16Click(Sender: TObject);
      procedure cbcrc24Click(Sender: TObject);
      procedure cbcrc32Click(Sender: TObject);
      procedure cbcrc64Click(Sender: TObject);
      procedure cbed2kClick(Sender: TObject);
      procedure cbf11Click(Sender: TObject);
      procedure cbf1Click(Sender: TObject);
      procedure cbf2Click(Sender: TObject);
      procedure cbf3Click(Sender: TObject);
      procedure cbf5Click(Sender: TObject);
      procedure cbf6Click(Sender: TObject);
      procedure cbf7Click(Sender: TObject);
      procedure cbf8Click(Sender: TObject);
      procedure cbf9Click(Sender: TObject);
      procedure cbf10Click(Sender: TObject);
      procedure cbfARCClick(Sender: TObject);
      procedure cbfCustomClick(Sender: TObject);
      procedure cbfSfxClick(Sender: TObject);
      procedure cbmd4Click(Sender: TObject);
      procedure cbmd5Click(Sender: TObject);
      procedure cbrmdClick(Sender: TObject);
      procedure cbsha1Click(Sender: TObject);
      procedure cbsha224Click(Sender: TObject);
      procedure cbsha256Click(Sender: TObject);
      procedure cbsha384Click(Sender: TObject);
      procedure cbsha512Click(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 LabelTitleOptions2Click(Sender: TObject);
      procedure LabelTitleOptions2MouseEnter(Sender: TObject);
      procedure LabelTitleOptions2MouseLeave(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 ListView1MouseUp(Sender: TObject; Button: TMouseButton;
        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 mextractClick(Sender: TObject);
      procedure maddconvertClick(Sender: TObject);
      procedure maddexistingClick(Sender: TObject);
      procedure mf4Click(Sender: TObject);
      procedure mlayoutsClick(Sender: TObject);
      procedure mPeaFBClick(Sender: TObject);
      procedure mPeaGPClick(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 mchadler32Click(Sender: TObject);
      procedure mchcrc16Click(Sender: TObject);
      procedure mchcrc24Click(Sender: TObject);
      procedure mchcrc32Click(Sender: TObject);
      procedure mchcrc64Click(Sender: TObject);
      procedure mchedonkeyClick(Sender: TObject);
      procedure mchmd4Click(Sender: TObject);
      procedure mchmd5Click(Sender: TObject);
      procedure mchripemd160Click(Sender: TObject);
      procedure mchsha1Click(Sender: TObject);
      procedure mchsha224Click(Sender: TObject);
      procedure mchsha256Click(Sender: TObject);
      procedure mchsha384Click(Sender: TObject);
      procedure mchsha512Click(Sender: TObject);
      procedure mchwhirlpool512Click(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 mpeaextractorClick(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 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 Panelnav5MouseEnter(Sender: TObject);
      procedure Panelnav5MouseLeave(Sender: TObject);
      procedure PanelTitleOptionsClick(Sender: TObject);
      procedure pmabc1Click(Sender: TObject);
      procedure pmabc2Click(Sender: TObject);
      procedure pmabc3Click(Sender: TObject);
      procedure pmabc4Click(Sender: TObject);
      procedure pmabc5Click(Sender: TObject);
      procedure pmabc6Click(Sender: TObject);
      procedure pmabc7Click(Sender: TObject);
      procedure pmabc8Click(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 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 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 mnavfunClick(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 pmdeduplicateClick(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 pmquickrootClick(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 pmtabbbookmarksClick(Sender: TObject);
      procedure pmtabbfilesystemClick(Sender: TObject);
      procedure pmtabbfunClick(Sender: TObject);
      procedure pmtabbhistoryClick(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 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 mwebsearchpClick(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_extClick(Sender: TObject);
      procedure po_rename_lowercaseClick(Sender: TObject);
      procedure po_rename_deleteClick(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 cbwhirlpoolClick(Sender: TObject);
      procedure CheckBox4Click(Sender: TObject);
      procedure CheckBoxARC1Click(Sender: TObject);
      procedure CheckBoxArchive6Click(Sender: TObject);
      procedure CheckBoxArchiveHistoryClick(Sender: TObject);
      procedure CheckBoxArchiveOFClick(Sender: TObject);
      procedure CheckBoxIgnoreDispClick(Sender: TObject);
      procedure CheckBoxIgnoreSelClick(Sender: TObject);
      procedure CheckBoxPrebrowseClick(Sender: TObject);
      procedure CheckBoxQuadMaxClick(Sender: TObject);
      procedure CheckBoxShowHintsClick(Sender: TObject);
      procedure CheckBoxTarBeforeClick(Sender: TObject);
      procedure CheckBoxWindowStatusClick(Sender: TObject);
      procedure ColorButton1ColorChanged(Sender: TObject);
      procedure ColorButton2ColorChanged(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 RadioGroup1Click(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 SpinEditPrebrowseChange(Sender: TObject);
      procedure Splitter1Moved(Sender: TObject);
      procedure Splitter2Moved(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 StringGridSessionHistoryDblClick(Sender: TObject);
      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 TimerHintStopTimer(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 transparence
   TSetLayeredWindowAttributes = function(hwnd: HWND; crKey: COLORREF; bAlpha: Byte; dwFlags: Longint): Longint;
   stdcall;

type //used for transparence
   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);
{$ENDIF}

function cleardir(var s:utf8string; cleardirname:boolean):integer;
function compose_unace_cl(var cl,jobcode,outname:utf8string; real_extract:boolean; mode,selection:utf8string):integer;
function compose_unarc_cl(var cl,jobcode,outname:utf8string; real_extract:boolean; mode,selection:utf8string):integer;
function compose_unzpaq_cl(var cl,jobcode,outname:utf8string; real_extract:boolean; mode,selection:utf8string):integer;
function setoutname(var s,archive_type:utf8string; i:integer):integer;
function control_outpath(var out_param:utf8string):integer;
function testencrypted:integer;
function testencrypted_open:integer;
function checklistsel:integer;
function checklistanysel:integer;
function checklisttotsel(var nsel:integer; var strsel:utf8string):integer;
function gettreeicon(sg:TStringGrid; arow:integer):integer;
//function getrecenticon(s:utf8string):integer;
//function gethistoryicon(n:integer):integer;
function getpcmenuicon(b:TBitmap):integer;
function setpcmenuicon(i:integer):TBitmap;
procedure browsehistoryn(n:integer);
procedure jumpto(jumpdest:utf8string);
procedure launch_rsearch;
procedure launch_nrsearch;
procedure launch_rrsearch;
procedure listdir(s:utf8string; recmode,treemode:boolean);
procedure list_toextractor(act,modeofuse:utf8string);
procedure navrefresh;
procedure navgoup;
procedure rsearch;
procedure setquickextractmenu;
procedure update_listview;
procedure ComboBoxArchive4_onchange;
procedure run_websearch(s:utf8string);
procedure quickextract(dest:utf8string);
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:utf8string);
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 navgoback;
procedure navgofwd;
procedure setrecenticons_extract_archive;
procedure browser_explorepath(iscontext:integer);
procedure openwith_peazipnew(iscontext:integer; s:utf8string);
procedure browser_commandprompt(iscontext,isps:integer; s_in:utf8string);
procedure browser_fileproperties(s_in:utf8string);
procedure get_statuss(s:utf8string);
procedure updatecontent_ext;
procedure archivemenu_name(pathpart:utf8string);
procedure load_bookmarks;
function importjobcl(var cl,jobcode,outname:utf8string):integer;
function importjobcl_extract(var cl,jobcode,outname:utf8string):integer;
procedure on_checkboxsamearcclick;
procedure on_checkboxsameextclick;
procedure restartpeaapp;
procedure restartclosepeaapp;
procedure saverestartclosepeaapp;
procedure imgshelltree;
procedure do_pmfun(capt:utf8string);
procedure settpreset(i:integer);
procedure getscheduledtaskname(stype:integer);
procedure ComboBoxTheme_onchange;
procedure setmswindowsopacity;
procedure setpanel_extract(ipanel:integer);
procedure populatetree2;
procedure setpanel_add(ipanel:integer);
procedure rename_files(mode:utf8string);
procedure extraction_checkintermediatedir(outname:utf8string);
procedure advancedselect;
procedure select_all(allnone:utf8string);
procedure kp_EditUn7zaFilter1;
procedure kp_EditUn7zaFilter1_nr;
procedure exit_withsave;
procedure exit_nosave;
function wingetdesk:integer;
procedure set_listview_col;

const
  COMPQT        = 0; //no longer needed on Lazarus 1.0.6 or more recent, use if experiencing problems with application compiled for Qt, set it to 1: on Linux some Qt versions does not correctly handle multiple panel layers so the result is visually and functionally different than on GTK2 and Win32
  MAX_CL        = 31744; //most of modern OSes handle about up to 32KB command line, checked conservatively at 31KB
  BARH          = 4;
  WS_EX_LAYERED = $80000;
  LWA_ALPHA     = $2;
  INTVERSION    = '1.09';
  PEAZIPVERSION = '5.9';
  PEAZIPREVISION= '.0';
  FIRSTDOM      = 'http://www.peazip.org/';
  SECONDDOM     = 'http://peazip.sourceforge.net/';
  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)
  DEFAULT_THEME = 'seven-embedded';
  SIDESIZE      = 0;
  ROWSIZE       = 20;
  DLEFT         = 64;
  DTOP          = 64;
  DWIDTH        = 910;
  DHEIGTH       = 552;
  LBH           = 32;
  NAMEVARSTR    = ' - ';
  {$IFDEF MSWINDOWS}
  COL1D         = 232;
  COL2D         = 64;
  COL3D         = 88;
  COL4D         = 88;
  COL5D         = 120;
  COL6D         = 38;
  COL7D         = 76;
  {$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, 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...';
  WRITEE_LIST   = '7Z, 7Z-sfx, ARC, ARC-sfx, BZ2, GZ, *PAQ, PEA, QUAD/BALZ/BCM, split, TAR, UPX, WIM, XZ, ZIP';
  APPMAIN       = 'PeaZip';
  APPLICATION1  = 'Pea 0.52 (LGPLv3, Giorgio Tani);';
  STR_7Z        = '7Z';
  STR_ARC       = 'ARC';
  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_CRC       = 'CRC';
  STR_TMP       = '.ptmp';
  STR_TESTOUT   = '.ptestout';
  STR_STOPALL   = '.pstopall';
  COL1          = 'clWindow';
  COL2          = 'clForm';
  COL3          = 'clForm';
  COL4          = '$00669999';
  COL5          = 'clWindowText';
  {COLBOX        = '$00BBFFFF';
  COLGROUP1     = '$00C0F8F8';
  COLGROUP2     = '$00C0F8E8';
  COLFOLDERROW  = '$00DDFFFF';
  COLARCHIVEROW = '$00DDFFF8';}
  COLMID        = '$00fff4e8';
  COLHIGH       = '$00fff0e0';
  COLLOW        = '$00fff8f0';
  {$IFDEF MSWINDOWS}
  EXEEXT        = '.exe';
  UNRARNAME     = 'unrar';
  APPLICATION2  = '7z 15.12 (LGPL, Igor Pavlov);';
  APPLICATION3  = 'PAQ8F/JD/L/O, LPAQ1/5/8, ZPAQ 7.05 [Matt Mahoney et al. (GPL)];';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.91 (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);';
  APPLICATION7  = 'FreeArc 0.67 alpha (GPL, Bulat Ziganshin).';
  APPLICATION6  = 'UNACEV2.DLL 2.6.0.0 (royalty-free UNACEV2.DLL license, ACE Compression Software)';
  APPLICATION8  = 'UNRAR 5.21 (freeware, royalty-free, source available with unrar restriction, Alexander Roshal)';
  {$ENDIF}
  {$IFDEF LINUX}
  EXEEXT        = '';
  UNRARNAME     = 'unrar-nonfree';
  APPLICATION2  = 'p7zip POSIX 7z 15.09 (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.91 (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);';
  APPLICATION7  = 'FreeArc 0.60 (GPL, Bulat Ziganshin).';
  APPLICATION6  = 'UNACE (royalty-free UNACE for Linux license, Marcel Lemke, ACE Compression Software)';
  APPLICATION8  = 'UNRAR 5.21 beta 2 (freeware, royalty-free, source available with unrar restriction, Alexander Roshal, Petr Cech)';
  {$ENDIF}
  {$IFDEF FREEBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'p7zip POSIX 7z 15.09 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  APPLICATION3  = '';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.91 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  {$ENDIF}
  {$IFDEF NETBSD}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'p7zip POSIX 7z 15.09 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  APPLICATION3  = '';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.91 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  {$ENDIF}
  {$IFDEF DARWIN}
  EXEEXT        = '';
  UNRARNAME     = '';
  APPLICATION2  = 'p7zip POSIX 7z 15.09 (LGPL, Myspace, based on Igor Pavlov''s 7z);';
  APPLICATION3  = '';
  APPLICATION4  = 'Strip (GPL, GNU binutils), UPX 3.91 (GPL, Markus F.X.J. Oberhumer, Laszlo Molnar and John F. Reiser);';
  APPLICATION5  = '';
  APPLICATION6  = '';
  APPLICATION7  = '';
  {$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:integer;
   abcrs: array [1..4] of utf8string;

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

   //status extractor
   epfolder,epfolder1,epdefault,epextract,epskip,epdelete,epfilters,eparcextract,eparcskip,epaceextract,epsupp,epunsupp,vexcustom3:integer;
   epdefaultextractpath,vexcustom1,vexcustom2,vexc1,vexc2,vexc3,vexc4,vexc5,vexc6,vexc7,vexc8:utf8string;

   //status archiver
   apdefault,apformat,apfilters,apenum,apappend,apsplit,apspin,apsize,apdelete,apverbose:integer;
   apdefaultarchivepath:utf8string;
   v7z1,v7z2,v7z3,v7z4,v7z5,v7z6,v7z7,v7z8,v7z9,v7z10,v7z11,v7z13,v7z13b,v7z14,vlevel_7z,vlevel_bzip2,vlevel_gz,vlevel_zip,vlevel_xz:integer;
   v7z12,vmethod_7z,vmethod_zip,varc7,vcustom1,vcustom2,vcustom3:utf8string;
   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:utf8string;
   vopt2,vopt3,vopt4,vopt4b,vopt4c,vopt5,vopt6,vopt7,vopt8,vopt9,vopt10,vopt11,vopt12,voptlibre,
   vfav1,vfav2,vfav3,vfav4,vfav5,vfav6,vfav7,vfav8,vfav9,vfav10,vfav11,vfav12,vfav13,vfav14,vfav15,vfav16,
   vopt13,voptts,vopt14,vopt15,vopt15c,vopt15d,vopt15e,vopt16,vopt17,vopt18,vopt19,vopt20,vopt21,vopt22,vopt23,vopt24,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,Bdetailssystem,
   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,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
   : TBitmap;

   dfilenames:array of string;

   devname:array [1..26] of utf8string;
   patchclip:array of array [0..15] of utf8string;
   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,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,winappdatafolder,fun_status,lastoutpath,status0,status1,lastextractionpath,
   status2,statuss,statust,statusr,checkver,extsel,defaultextractpath,defaultarchivepath,dn,
   prevrun,titlestring,sortstatusstring,updateid,prevupdateid,prevarchive,inputfile,
   peaziptmpdir,basedragtitle,unacepluginstatus,unrar5pluginstatus,addformatspluginstatus:utf8string;

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

   devtype:array [1..26] of integer;
   appdb:array [1..16] of integer;
   appdb2:array [1..8] of integer;
   imlistindex,imtodo:array of integer;
   listrow,listsortcol,listsortcol1,listsortcol2,listsortbook,title_lines_7z,
   currow1,browsingmode7z,splittersize,splitter2size,lastbar,lasttoolbar,prevbar,splitter3size,
   editheight,stdbtnheight,rowheight,expandfs,expandroot,expandbook,expandhistory,expandmore,expandrun,expandapps,expandfun,
   secgroupheight,listcol,ares,esna,euns,col1size,col2size,col3size,col4size,col5size,col6size,col7size,
   toolsize,navbar,addressbar,work_dir,prebrowse_dirs,prebrowse_records,rootdirrecord,mappeddrivesinfo,session_mappeddrivesinfo,
   appentries1,pcount,refreshstatus,themetoolbars,themetoolbarsd,ws_top,ws_left,
   ws_height,ws_width,archive_type_selected,prebrowsesize,smalliconsize,mediconsize,largeiconsize,browsersize,browsertype,
   sync,imindex,showthumbnails,simplesearch,recsearch,issearching,browserch,arcabspath,keeppw,usebreadcrumb,
   pmnotdecrypted,pimmersive,hnum,tpcomp,tpreset,prevdrbutton,bctemp,listmode,favdelete,convertverbose,
   libre_directive,tsstyle,updatingcontent,wasselected,wasselectedp:integer;

   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_bzip2,level_arc,solid_arc,rr_arc,algo_arc,level_gz,level_paq,paqver,
   level_quad,level_upx,level_zip,dlevel_zip,openw_all7z,showpwfield,setencfn,hidepwconf,autoclosegwrap,mailkeep,autoopen,
   browserstyle,desk_env,prebrowse,ignorepathdisp,enc7zscc,
   ignorepathsel,removeintdir,ignorepathdd,savehistory,fav7z,favARC,favbz,favcustom,favgz,favpea,favquad,favsfx,
   favsfxarc,favsplit,favtar,favupx,favzip,favzpaq,favwim,favxz,
   extpw,algodisp,algoall,algoadler,algocrc16,
   algocrc24,algocrc32,algocrc64,algoed2k,algomd4,algomd5,algoripemd160,algosha1,
   algosha224,algosha256,algosha384,algosha512,algowhirl,showguihints,customsyntax,
   customsyntax1,erasepasses,extopt7z,extoptarc,extaction7z,extactionarc,extactionace,
   autosizetoolbarbutton,autosizetoolbarbuttond,clipmode,jobdefenc,
   archivenameenc,tonewfolder,parallelarchive,zcopy,mcuzip,nameaspartent,spchar,enumd,
   defaulttabsmenu,multi_option,nonverboselog,use7zunrar5: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,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:boolean;

   activelabel_options,activelabel_add,activelabel_extract,activelabel_apps:TLabel;

   {$IFDEF MSWINDOWS}
   //used for transparence
   hUser32: HMODULE;
   hUser32prop: HMODULE;
   SetLayeredWindowAttributes: TSetLayeredWindowAttributes;
   SHMultiFileProperties: TSHMultiFileProperties;
   osVerInfo: TOSVersionInfo;
   FDragObject:TDragObject;
   //semaphore
   psem,psemwait: THandle;
   {$ENDIF}
   lang_file:utf8string;
   //text strings
   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:utf8string;

implementation

{ TForm_peach }

procedure conf_critical_error_msg; //hardcoded
begin
MessageDlg('PeaZip cannot find or parse critical configuration files (probably because deleted, moved or corrupted) and should be reinstalled', mtError, [mbOK], 0);
end;

procedure lang_critical_error_msg; //hardcoded
begin
MessageDlg('PeaZip cannot parse language file '+lang_file+' and will now try to fall back to default language file default.txt', mtError, [mbOK], 0)
end;

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

custom tabs

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

///add
procedure exitlabel_add(var a: TLabel);
begin
if activelabel_add=a then exit;
a.Font.Color:=clgray;
a.Font.Size:=0;
end;

procedure deselectlabels_add;
begin
with Form_peach do
begin
exitlabel_add(LabelTitleAdd1);
exitlabel_add(LabelTitleAdd2);
exitlabel_add(LabelTitleAdd3);
exitlabel_add(LabelTitleAdd4);
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);
begin
activelabel_add:=a;
deselectlabels_add;
a.Font.Color:=clDefault;
a.Font.Size:=11;
setlabelpanel_add(a);
end;

procedure enterlabel_add(var a: TLabel);
begin
if activelabel_add=a then exit;
a.Font.Color:=clDefault;
a.Font.Size:=0;
end;

///extract
procedure exitlabel_extract(var a: TLabel);
begin
if activelabel_extract=a then exit;
a.Font.Color:=clgray;
a.Font.Size:=0;
end;

procedure deselectlabels_extract;
begin
with Form_peach do
begin
exitlabel_extract(LabelTitleextract1);
exitlabel_extract(LabelTitleextract2);
exitlabel_extract(LabelTitleextract3);
exitlabel_extract(LabelTitleextract4);
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);
begin
activelabel_extract:=a;
deselectlabels_extract;
a.Font.Color:=clDefault;
a.Font.Size:=11;
setlabelpanel_extract(a);
end;

procedure enterlabel_extract(var a: TLabel);
begin
if activelabel_extract=a then exit;
a.Font.Color:=clDefault;
a.Font.Size:=0;
end;

///options
procedure exitlabel_options(var a: TLabel; var b: TPanel);
begin
if activelabel_options=a then exit;
a.Font.Color:=clgray;
//a.Font.Size:=0;
b.Color:=clWindow;
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 ufileexists(executable_path+'res'+DirectorySeparator+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT) then
unrar5pluginstatus:=txt_5_7_pinstalled
else
unrar5pluginstatus:=txt_5_7_pmissing;
if ufileexists(executable_path+'res'+DirectorySeparator+'unace'+DirectorySeparator+'unace'+EXEEXT) then
unacepluginstatus:=txt_5_7_pinstalled
else
unacepluginstatus:=txt_5_7_pmissing;
if ufileexists(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)
        +char($0d)+char($0a)
        +'Plugin:'+char($0d)+char($0a)
        +'PeaZip Additional Formats Plugin (LGPLv3) - '+addformatspluginstatus+char($0d)+char($0a)
        +APPLICATION8+' - '+unrar5pluginstatus+char($0d)+char($0a)
        +APPLICATION6+' - '+unacepluginstatus;
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;
//a.Font.Size:=11;
b.Color:=$20FF9933;
setlabelpanel_options(a);
end;

procedure enterlabel_options(var a: TLabel; var b: TPanel);
begin
if activelabel_options=a then exit;
a.Font.Color:=clDefault;
//a.Font.Size:=11;
b.Color:=$20FFEECC;
end;

///apps subpage
procedure exitlabel_apps(var a: TLabel);
begin
if activelabel_apps=a then exit;
a.Font.Color:=clgray;
a.Font.Size:=0;
end;

procedure deselectlabels_apps;
begin
with Form_peach do
begin
exitlabel_apps(LabelTitleapps1);
exitlabel_apps(LabelTitleapps2);
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);
begin
activelabel_apps:=a;
deselectlabels_apps;
a.Font.Color:=clDefault;
a.Font.Size:=11;
setlabelpanel_apps(a);
end;

procedure enterlabel_apps(var a: TLabel);
begin
if activelabel_apps=a then exit;
a.Font.Color:=clDefault;
a.Font.Size:=0;
end;

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

text and translation

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

function valorize_text:integer;
var
   s:utf8string;
begin
valorize_text:=-1;
try
readln(t,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));
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:utf8string);
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:utf8string;
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;
ButtonUn7za5.Caption:=txt_2_8_convert;
ButtonCut.Caption:=txt_cut;
ButtonCopy.Caption:=txt_copy;
ButtonPaste.Caption:=txt_paste;
ButtonProperties.Caption:=txt_4_5_properties;
ButtonRename.Caption:=txt_rename;
ButtonRename1.Caption:=txt_rename;
ButtonDup.Caption:=txt_4_1_duplicatesfind;
ButtonNF.Caption:=txt_cnewfolder;
ButtonDup1.Caption:=txt_4_1_duplicatesfind;
ButtonImgResize.Caption:=txt_4_8_t;
ButtonImgCrop.Caption:=txt_4_8_crop;
ButtonImgRL.Caption:=txt_4_8_rl;
ButtonImgRR.Caption:=txt_4_8_rr;
ButtonCut.Hint:='';
ButtonCopy.Hint:='';
ButtonPaste.Hint:='';
ButtonOpenWith.Hint:='';
ButtonProperties.Hint:='';
ButtonRename.Hint:='';
ButtonRename1.Hint:='';
ButtonDelete.Hint:='';
ButtonDup.Hint:='';
ButtonNF.Hint:='';
ButtonDup1.Hint:='';
ButtonImgResize.Hint:='';
ButtonImgCrop.Hint:='';
ButtonImgRL.Hint:='';
ButtonImgRR.Hint:='';
end;
end;

procedure 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_4_1_duplicatesfind;
ButtonNF.Hint:=txt_cnewfolder;
ButtonDup1.Hint:=txt_4_1_duplicatesfind;
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;
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;
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:=60;
PanelBarOpen2.Height:=60;
PanelBarOpen3.Height:=60;
settoolglyphtop;
settoolmargin;
settoolspacing(1);
settoolbigicon;
settooltext;
settoolbtnw(20,false);
end;
toolsize:=1;
end;

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

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

procedure setsmalltoolbar1;
var
   refw:integer;
begin
with Form_peach do
begin
PanelBarOpen.Height:=48;
PanelBarOpen2.Height:=48;
PanelBarOpen3.Height:=48;
settoolglyphtop;
settoolmargin;
settoolspacing(1);
settoolsmallicon;
settooltext;
settoolbtnw(12,false);
end;
toolsize:=3;
end;

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

procedure setsmalltoolbar3;
var
   smallheight:integer;
begin
with Form_peach do
begin
smallheight:=PanelListBar.Height;
if smallheight=0 then smallheight:=editheight+4;
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:=editheight+4;
PanelBarOpen.Height:=smallheight;
PanelBarOpen2.Height:=smallheight;
PanelBarOpen3.Height:=smallheight;
ButtonUn7za4.Height:=ctrlback.height;
settoolglyphleft;
settoolmargin;
settoolspacing(4);
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:utf8string;
   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:utf8string;
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:utf8string;
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:utf8string;
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:utf8string;
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:utf8string;
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:utf8string; const s1:utf8string);
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: utf8string):boolean;
begin
result:=false;
if s = 'Computer''s root' then begin s:=txt_mypc; result:=true; end;
if s = desktop_path then begin s:=txt_desktop; result:=true; end;
if s = home_path then begin s:=txt_2_9_home; result:=true; end;
if s = usr_documents then begin s:=txt_2_4_documents; result:=true; end;
if s = usr_downloads then begin s:=txt_3_1_downloads; result:=true; end;
if s = usr_music then begin s:=txt_5_0_music; result:=true; end;
if s = usr_pictures then begin s:=txt_5_0_pictures; result:=true; end;
if s = usr_videos then begin s:=txt_5_0_videos; result:=true; end;
end;

procedure populatetree;
var
   s:utf8string;
   i,j:integer;
   anode:TTreeNode;

   {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:utf8string;
      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;
var i:integer;
begin
with Form_peach do
begin
i:=treeview1.Items.Count;
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(devicon[devtype[12]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd13.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[13]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[13]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd14.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[14]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[14]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd15.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[15]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[15]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd16.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[16]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[16]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd17.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[17]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[17]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd18.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[18]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[18]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd19.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[19]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[19]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd20.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[20]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[20]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd21.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[21]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[21]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd22.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[22]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[22]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd23.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[23]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[23]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd24.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[24]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[24]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd25.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[25]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[devtype[25]]);
      SelectedIndex:=ImageIndex;
      end;
   end;
if pmjd26.visible=true then
   begin
   with treeview1.Items.AddChild(treeview1.selected,devname[26]) do
      begin
      ImageIndex:=getpcmenuicon(devicon[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:=16;
      SelectedIndex:=16;
      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:=3;
      SelectedIndex:=3;
      end;
if shared_myboxfiles<>'' then
   with treeview1.Items.Add(treeview1.selected,'My Box Files') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if shared_googledrive<>'' then
   with treeview1.Items.Add(treeview1.selected,'Google Drive') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if shared_onedrive<>'' then
   with treeview1.Items.Add(treeview1.selected,'OneDrive') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if shared_skydrive<>'' then
   with treeview1.Items.Add(treeview1.selected,'Sharepoint Workspaces') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      end;
if shared_ubuntuone<>'' then
   with treeview1.Items.Add(treeview1.selected,'Yandex Disk') do
      begin
      ImageIndex:=3;
      SelectedIndex:=3;
      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;
{with treeview1.Items.Add(treeview1.selected,'') do
   begin
   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_oldwindows;
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;
with treeview1.Items.AddChild(treeview1.selected,txt_2_4_documents) do
   begin
   ImageIndex:=3;
   SelectedIndex:=3;
   end;
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;

   {with treeview1.Items.AddChild(treeview1.selected,txt_add_tobookmarks) do
      begin
      ImageIndex:=38;
      SelectedIndex:=38;
      end;
   with treeview1.Items.AddChild(treeview1.selected,txt_2_9_organize) do
      begin
      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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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
   hrc,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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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 uextractfilename(s)<>'' then s:=uextractfilename(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;

begin
with Form_peach do
begin
treeview1.Items.Beginupdate;
treeview1.Items.Clear;

populate_bookmarks;

treeview1.Items.Add(nil,'');
with treeview1.Items.Add(nil,txt_fs) do
   begin
   Selected:=true;
   ImageIndex:=31;
   SelectedIndex:=31;
   end;
{$IFDEF MSWINDOWS}
if (winver='nt6+') or (winver='nt5') then
   populate_fs_windows
else
   populate_fs_oldwindows;
{$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
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;
LabelLibre.Caption:=txt_5_8_fs;
ComboBoxLibre.Items.Clear;
ComboBoxLibre.Items.Add('0 '+txt_5_8_l0);
ComboBoxLibre.Items.Add('1 '+txt_5_8_l1);
ComboBoxLibre.Items.Add('2 1+'+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;
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_uppercase.Caption:=txt_5_5_upper;
po_rename_timestamp.Caption:=txt_timestamp;
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;
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_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;
org_aprelist.Caption:=txt_4_9_listth;
ImageFlat1.Hint:=txt_4_9_listth;
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_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;
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+' (Shift+Ctrl+O)';
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+' (Shift+Ctrl+N)';
pmqnointdir.caption:=txt_5_5_intdir;
CheckBoxFolder1.caption:=txt_5_5_intdir;
MenuItemExtAllTo.caption:=txt_ext_allto+'... (Ctrl+E / F12)';
MenuItemExtAllHere.caption:=txt_ext_allhere+' (Ctrl+Alt+E)';
mmore.Caption:=txt_3_1_more;
MenuItemExtAllHere.visible:=false;//currently hidden, seems reduntant to show the item also in context menu
pmqeto.caption:=txt_ext_allto+'... (Ctrl+E / F12)';
pmqehere.caption:=txt_ext_allhere+' (Ctrl+Alt+E)';
pmqedesk.caption:=txt_ext_allto+' '+txt_desktop+' (Ctrl+Shift+E)';
pmqedocuments.caption:=txt_ext_allto+' '+txt_2_4_documents+' (Ctrl+Shift+Alt+E)';
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_4_8_iconm;
imageflat2.Hint:=txt_4_8_detailsno;
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_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;
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;
pmAdvanced.Caption:=txt_2_6_advanced;
pmemb0.Caption:=txt_bookmarks;
pmemr0.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;
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_BZIP2;
cbType.Items[3]:=txt_custom;
cbType.Items[4]:=STR_GZIP;
cbType.Items[5]:=STR_PEA;
cbType.Items[6]:=STR_QUAD;
cbType.Items[7]:=txt_sfx+' '+STR_7Z;
cbType.Items[8]:=txt_sfx+' '+STR_ARC;
cbType.Items[9]:=txt_split;
cbType.Items[10]:=STR_TAR;
cbType.Items[11]:=STR_UPX;
cbType.Items[12]:=STR_WIM;
cbType.Items[13]:=STR_XZ;
cbType.Items[14]:=STR_ZIP;
cbType.Items[15]:=STR_ZPAQ;
RadioGroup0.Items[0]:=STR_7Z;
RadioGroup0.Items[1]:=STR_ARC;
RadioGroup0.Items[2]:=STR_BZIP2;
RadioGroup0.Items[3]:=txt_custom;
RadioGroup0.Items[4]:=STR_GZIP;
RadioGroup0.Items[5]:=STR_PEA;
RadioGroup0.Items[6]:=STR_QUAD;
RadioGroup0.Items[7]:=txt_sfx+' '+STR_7Z;
RadioGroup0.Items[8]:=txt_sfx+' '+STR_ARC;
RadioGroup0.Items[9]:=txt_split;
RadioGroup0.Items[10]:=STR_TAR;
RadioGroup0.Items[11]:=STR_UPX;
RadioGroup0.Items[12]:=STR_WIM;
RadioGroup0.Items[13]:=STR_XZ;
RadioGroup0.Items[14]:=STR_ZIP;
RadioGroup0.Items[15]:=STR_ZPAQ;
RadioGroup0.Items[16]:=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;
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_stream_control;
LabelPEA7.Caption:=txt_peaobj;
LabelPEA8.Caption:=txt_volumepea;
LabelSplit.Caption:=txt_integrity;
LabelSplit.Hint:=txt_check_hint;
CheckBoxPEAEncryption.Caption:=txt_stream;
Subtitle7zaopt1.Caption:=txt_options;
Label7za1.Caption:=txt_function;
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;
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;
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;
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;
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;
Label5.Caption:=txt_2_9_extconsole;
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;
Labelcb4.Caption:=txt_backend;
Labelcb17.Caption:=txt_desktop;
Labeltitleoptions7.Caption:=txt_2_5_help;
Labeltitleoptions8.Caption:=txt_about;
LabelAbout.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;
Label11.Caption:=txt_5_0_perf;
Labelcb7.Caption:=txt_reset+' '+txt_3_3_apps;
LabelTitleOptions1.Caption:=txt_general+'   ';
labelcb18.Caption:=txt_2_5_encoding;
Label6.Caption:=txt_3_1_sccenc;
CheckBoxEncoding1.Caption:=txt_3_2_7zutf8nonascii;
CheckBoxJobEncoding.Caption:=txt_2_5_encpj;
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;
Labelcb20.Caption:=txt_reset;
Labelcb19.Caption:=txt_path;
Labelcb14.Caption:=txt_default_format;
Labelcb15.Caption:=txt_favformats;
cbf8.Caption:=txt_split;
cbfCustom.Caption:=txt_custom;
cbfSfx.Caption:=txt_sfx+' '+STR_7Z;
cbfSfx1.Caption:=txt_sfx+' '+STR_ARC;
RadioGroupBrowser.Items.Strings[0]:=txt_browser;
RadioGroupBrowser.Items.Strings[1]:=txt_flat;
RadioGroupBrowser.Items.Strings[2]:=txt_lastused;
CheckBox4.Caption:=txt_ignore_ext;
CheckBox5.Caption:=txt_3_6_ignoredd;
CheckBoxIgnoreSel.Caption:=txt_ignore_sel;
CheckBoxIgnoreDisp.Caption:=txt_ignore_disp;
CheckBoxIntDir.Caption:=txt_5_5_intdir;
CheckBoxPrebrowse.Caption:=txt_fastopen;
CheckBoxBrowseNotVerbose.Caption:='7z/p7zip -bb0 '+txt_faster;
CheckBoxPrebrowse.Hint:=txt_quickbrowse_hint;
Labelcb16.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_filetools+'   ';
LabelOptsub1.Caption:=txt_check;
Labeloptsub3.Caption:=txt_dispaly;
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;
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;
LabelTitleOptions2.Caption:=txt_2_6_advanced+'   ';
CheckBoxParallelarchiving.Caption:=txt_2_8_parallel;
CheckBoxzcopy.Caption:=txt_2_8_zcopy;
CheckBoxnetworkinfo.Caption:=txt_3_3_skipunits;
Label7.Caption:=txt_3_1_workingdir;
Combobox2.Items.Strings[0]:=txt_2_7_output;
Combobox2.Items.Strings[1]:=txt_3_1_systmp;
Combobox2.Items.Strings[2]:=txt_2_9_none;
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_3_1_plsmartmin;
RadioGroup6.Items.Strings[3]:=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;
LabelColor2.Caption:=txt_toolbarscolor;
CheckBoxThemeBars.Caption:=txt_3_7_themedbars;
LabelColor1.Caption:=txt_gridaltcolor;
LabelDefaultColor2.Caption:=txt_reset;
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:=STR_CRC;
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;
mch.Caption:=txt_check_select;
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:=STR_CRC;
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:=STR_CRC;
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;
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;
LabelLang4.Caption:=txt_5_3_cml;
mprofileultra7z.Caption:=txt_5_3_profilebest;
mprofilenormal7z.Caption:=txt_5_3_profileadvanced;
mprofilenormalzip.Caption:=txt_5_3_profilenormal;
mprofilefastzip.Caption:=txt_5_3_profileveryfast;
mprofileencrypt7z.Caption:=txt_5_3_profilepassword;
mprofilesplitzip.Caption:=txt_5_3_profile10mb;
mprofileauto.Caption:=txt_5_3_profilesfx;
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;//txt_3_2_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_info;
po_details.Caption:=txt_info;
pmcpyto.Caption:=txt_copyto;
pmmvto.Caption:=txt_moveto;
pmexplore.Caption:=txt_explore_path;
pmbookmarks.Caption:=txt_add_tobookmarks;
pmbcaddbookmark.Caption:=txt_add_tobookmarks;
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+' (Ctrl+Del)';{$ELSE}pmquickdelete.Caption:=txt_quickdelete;{$ENDIF}
pmsecuredelete.Caption:=txt_securedelete+' (Shift+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_deduplicate.Caption:=txt_4_1_duplicatesfind;
pmdeduplicate.Caption:=txt_4_1_duplicatesfind;
po_deduplicatesel.Caption:=txt_4_1_duplicatesfind+' '+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+' (Ctrl+Del)';{$ELSE}po_delete.Caption:=txt_quickdelete;{$ENDIF}
po_securedelete.Caption:=txt_securedelete+' (Shift+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;
mTypeCustom.Caption:=txt_custom;
mTypeSfx.Caption:=txt_sfx+' '+STR_7Z;
mTypeSfxArc.Caption:=txt_sfx+' '+STR_ARC;
mTypeSplit.Caption:=txt_split;
pmJump1.Caption:=txt_mypc;
pmJump5.Caption:=txt_mypc;
MenuItemOpen_pc.Caption:=txt_mypc;
MenuItemArchive_pc.Caption:=txt_mypc;
pmquickroot.Caption:=txt_mypc;
pmJump3.Caption:=txt_2_9_home;
pmquickhome.Caption:=txt_2_9_home;
pmJump7.Caption:=txt_2_9_home;
pmJump2.Caption:=txt_desktop;
pmquickdesk.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;
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;
ComboBoxPEA2.Items.Strings[12]:=txt_none2;
ComboBoxPEA3.Items.Strings[9]:=txt_none2;
ComboBoxPEA4.Items.Strings[9]:=txt_none2;
ComboBoxSplit3.Items.Strings[9]:=txt_none2;
ComboBoxArchive7.Items.Strings[0]:=txt_newarchive;
ComboBoxArchive7.Items.Strings[1]:=txt_add_existing_archive;
ComboBoxArchive7.Items.Strings[2]:=txt_update;
ComboBoxArchive8.Items.Strings[0]:=txt_singlethread;
ComboBoxArchive8.Items.Strings[1]:=txt_multithreading;
ComboBox7zalgo.Items.Strings[1]:=txt_zipcrypto_hint;
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[3]:=txt_custom;
cbType.Items.Strings[7]:=txt_sfx+' '+STR_7Z;
cbType.Items.Strings[8]:=txt_sfx+' '+STR_ARC;
cbType.Items.Strings[9]:=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[3]:=txt_custom;
RadioGroup0.Items[7]:=txt_sfx+' '+STR_7Z;
RadioGroup0.Items[8]:=txt_sfx+' '+STR_ARC;
RadioGroup0.Items.Strings[9]:=txt_split;
RadioGroup0.Items.Strings[16]:=txt_lastused;
cbUn7zaRecursive.Hint:=txt_search_hint;
cbUn7zaRecursiveExclude.Hint:=txt_search_hint;
ComboBoxOverwrite.Hint:=txt_naming;
ComboBoxOverwriteARC.Hint:=txt_naming;
EditOPcustom1.Hint:=txt_otherparams;
LabelColor2.Hint:=txt_col_hint;
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;
mcancel.caption:=txt_2_7_cancel;
mgotype.caption:=txt_type;
ComboBoxTheme.Items.Strings[4]:=txt_custom;
ComboBoxTheme.Items.Strings[5]:=txt_3_6_ethemes;
//except end; //try..except removed, was added in old releases compiled with older Lazarus versions since some of those instruction goes in error for unknown reason under some circumstances
end;
end;

function valorize_headers:integer;
var
   s:utf8string;
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:utf8string):integer; //valorize localized text strings
var
   s:utf8string;
   i:integer;
begin
load_texts:=-1;
try
   uassigntext(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
   Form_peach.LabelLang2.Hint:=Form_peach.LabelLang2.Hint+' - '+s;
   i:=-1;
   {if s<>PEAZIPVERSION then //PEAZIPREVISION is ignored since revisions are meant to share the same text and doesn't need to load localizations out of order as a different release will do
      if valorize_headers=0 then i:=fallback_valorize_text
      else
   else}
      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_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:='Best compression, 7Z format Ultra level';
txt_5_3_profileadvanced:='Advanced compression, 7Z format';
txt_5_3_profilenormal:='Normal ZIP compression, compatible with most extractors';
txt_5_3_profileveryfast:='Very fast ZIP compression, recommended for large multimedia files';
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. 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:utf8string):integer;
begin
load_default_texts;
if lang='volatile' then begin assign_guitext; texts:=0; exit; end;
{//preload default language file to valorize possibly untranslated strings (i.e. older translations)
texts:=load_texts('default.txt');
//fallback to english if default language file is not ok
if texts<>0 then texts:=load_texts('en.txt');
//fallback to british english if even english language file is not ok
if texts<>0 then texts:=load_texts('en-gb.txt');
if lang<>'default.txt' then}
   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;
{if texts<>0 then
   begin
   //conf_critical_error_msg;
   exit_nosave;
   end;}//use compile time text strings if no valid text file is found
end;

procedure msg_not_accessible(i:integer);
begin
MessageDlg(envtoutf8(wparamstr(i))+' '+txt_not_accessible, mtWarning, [mbOK], 0);
end;

procedure msg_not_accessible_s(s:utf8string);
begin
MessageDlg(s+' '+txt_not_accessible, mtWarning, [mbOK], 0);
end;

procedure msg_not_accessible_list(s:utf8string);
begin
MessageDlg(s+' '+txt_not_accessible_list, mtWarning, [mbOK], 0);
end;

procedure msg_no_input;
begin
MessageDlg(txt_noinput, mtError, [mbOK], 0);
end;

procedure msg_pw_errorchar;
var
   errchar:utf8string;
begin
{$IFDEF MSWINDOWS}
errchar:='"';
{$ELSE}
errchar:='''';
{$ENDIF}
MessageDlg(errchar+' '+txt_2_3_pw_errorchar, mtWarning, [mbOK], 0);
end;

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

configuration and theming

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

procedure getthemepath(var thpath:utf8string);
var
   s:utf8string;
begin
if theme_name='' then
   begin
   s:=uextractfilepath(theme_path);
   if s<>'' then setlength(s,length(s)-1);
   theme_name:=uextractfilename(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 loadlargeicons(icon_size:integer);
var
   abitmap:TBitmap;
begin
with form_peach do
   begin
   case icon_size of
   48: begin
   ImageList48px.Clear;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bexesupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bfilesupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(BFolder48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Blink48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bunsupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bfd_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bhd_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bram_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bremote_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Baudio48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Btxt48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bvideo48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bweb48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bimage48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bpresentation48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bpdf48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bbat48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bsupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdll48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bmail48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdb48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bgif48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bico48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bvector48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bjpeg48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   ListView1.LargeImages:=ImageList48px;
   end;
   96: begin
   ImageList96px.Clear;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bexesupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bfilesupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(BFolder96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Blink96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bunsupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bfd_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bhd_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bram_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bremote_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Baudio96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Btxt96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bvideo96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bweb96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bimage96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bpresentation96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bpdf96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bbat96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bsupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdll96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bmail96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdb96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bgif96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bico96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bvector96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bjpeg96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   ListView1.LargeImages:=ImageList96px;
   end;
   192: begin
   ImageList192px.Clear;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bexesupported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bfilesupported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(BFolder96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Blink96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bunsupported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bfd_supported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bhd_supported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bram_supported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bremote_supported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Baudio96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Btxt96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bvideo96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bweb96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bimage96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bpresentation96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bpdf96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bbat96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bsupported96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bdll96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bmail96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bdb96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bgif96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bico96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bvector96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bjpeg96,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_size);
   ImageList192px.Add(abitmap,nil);
   ListView1.LargeImages:=ImageList192px;
   end;
   end;
   end;
end;

procedure loadsmallicons(icon_size:integer); //due to some problems in changing TImageList size and apply it to TListViev at runtime (Lazarus 0.9.30) so different size imagelists are used
var
   abitmap:TBitmap;
   icon_sizeplus:integer;
begin
with form_peach do
   begin
   case icon_size of
   16: begin
   icon_sizeplus:=20;
   ImageList16px.Clear;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bexesupported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bfilesupported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(BFolder,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Blink,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bunsupported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bfd_supported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bhd_supported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bram_supported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bremote_supported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Baudio,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Btxt,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bvideo,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bweb,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bimage,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bpresentation,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bpdf,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bbat,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bsupported,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bdll,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bmail,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bdb,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bgif,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bico,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bvector,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bjpeg,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   loadlargeicon(Bhomefolder,abitmap,icon_sizeplus);
   ImageList16px.Add(abitmap,nil);
   ListView1.SmallImages:=ImageList16px;
   end;
   48: begin
   ImageList48px.Clear;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bexesupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bfilesupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(BFolder48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Blink48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bunsupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bfd_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bhd_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bram_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bremote_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Baudio48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Btxt48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bvideo48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bweb48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bimage48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bpresentation48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bpdf48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bbat48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bsupported48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdll48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bmail48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdb48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bgif48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bico48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bvector48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bjpeg48,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_size);
   ImageList48px.Add(abitmap,nil);
   ListView1.SmallImages:=ImageList48px;
   end;
   96: begin
   ImageList96px.Clear;
   abitmap:=Tbitmap.Create;
   loadlargeicon(Barchivesupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bexesupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bfilesupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(BFolder96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Blink96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bunsupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdvd_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bfd_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bhd_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bram_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bremote_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bremovable_supported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Baudio96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bspreadsheet96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Btxt96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bvideo96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bweb96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bimage96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bpresentation96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bpdf96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bbat96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bsupported96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdll96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bmail96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdb96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bgif96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bico96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bvector96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Binfo,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bsearch,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bbookmark,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Broot,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bsystemtools,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bexpand,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bgopath,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bjpeg96,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bdesk,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bplaceshistory,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bbookmarkadd,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Brun,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bpreview,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   loadlargeicon(Bapps,abitmap,icon_size);
   ImageList96px.Add(abitmap,nil);
   ListView1.SmallImages:=ImageList96px;
   end;
   end;
   end;
end;

procedure loadimglist1icons;
var
   abitmap:TBitmap;
   icon_sizeplus:integer;
begin
with Form_peach do
begin
icon_sizeplus:=20;
abitmap:=Tbitmap.Create;
Imagelist1.Clear;
loadlargeicon(Barchivesupported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bexesupported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bfilesupported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(BFolder,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Blink,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bunsupported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bdvd_supported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bfd_supported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bhd_supported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bram_supported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bremote_supported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bremovable_supported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Baudio,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bspreadsheet,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Btxt,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bvideo,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bweb,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bimage,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bpresentation,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bpdf,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bbat,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bsupported,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bdll,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bmail,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bdb,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bgif,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bico,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bvector,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Binfo,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bsearch,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bbookmark,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Broot,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bsystemtools,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bexpand,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bgopath,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bjpeg,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bdesk,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bplaceshistory,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bbookmarkadd,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Brun,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bpreview,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bapps,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
loadlargeicon(Bhomefolder,abitmap,icon_sizeplus);
ImageList1.Add(abitmap,nil);
end;
end;

procedure load_icons; //load icons from bitmaps
var
   i:integer;
   thpath:utf8string;
begin
if imgloaded=true then exit;
if imgloading=true then exit;
imgloading:=true;
with Form_peach do
   begin
   try
   //set non-themed graphic
   Imagelist2.getbitmap(0,ButtonUn7za6.Glyph);
   Imagelist2.getbitmap(0,ButtonUn7za7.Glyph);
   Imagelist2.getbitmap(0,ButtonUn7za8.Glyph);
   Imagelist2.getbitmap(0,ButtonUn7za9.Glyph);
   Imagelist2.getbitmap(0,Buttoncmto.Glyph);
   Imagelist2.getbitmap(0,Buttonopenactions.Glyph);
   Imagelist2.getbitmap(0,Buttonfmactions.Glyph);
   Imagelist2.getbitmap(0,Buttonfmactions1.Glyph);
   Imagelist2.getbitmap(0,ButtonImg6.Glyph);
   Imagelist2.getbitmap(0,ButtonImgR.Glyph);
   Imagelist2.getbitmap(0,ButtonImgRes.Glyph);
   Imagelist2.getbitmap(0,Imagelistroot.Picture.Bitmap);
   Imagelist2.getbitmap(0,ButtonEditname12.Glyph);
   Imagelist2.getbitmap(0,ButtonEditname8.Glyph);
   Imagelist2.getbitmap(0,ButtonEditname13.Glyph);
   Imagelist2.getbitmap(0,ButtonUn7za10.Glyph);
   Imagelist2.getbitmap(0,ButtonEditname4.Glyph);
   Imagelist2.getbitmap(1,mtoolbar.Bitmap);
   Imagelist2.getbitmap(3,mnavbar.Bitmap);
   Imagelist2.getbitmap(4,mstatusbar.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress0.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress1.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress2.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress3.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress4.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress5.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress6.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAddress7.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAdArchive0.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAdArchive1.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAdArchive2.Picture.Bitmap);
   Imagelist2.getbitmap(5,ImageAdArchive3.Picture.Bitmap);
   Imagelist2.getbitmap(7,mAdmin.Bitmap);
   Imagelist2.getbitmap(8,ImagePanel5.Picture.Bitmap);
   //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;
   Bdetailssystem:=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;
   getthemepath(thpath);
   panel2.visible:=true;
   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_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,Bdetailssystem);
   il_dtheme_tool32.getbitmap(2,BArchive_big);
   il_dtheme_tool32.getbitmap(3,Bconvert_big);
   il_dtheme_tool32.getbitmap(4,Bextractall_big);
   il_dtheme_tool32.getbitmap(5,Bextractallton_big);
   il_dtheme_tool32.getbitmap(6,Btestall_big);
   il_dtheme_tool32.getbitmap(7,Btool_cut);
   il_dtheme_tool32.getbitmap(8,Btool_copy);
   il_dtheme_tool32.getbitmap(9,Btool_paste);
   il_dtheme_tool32.getbitmap(10,Btool_openw);
   il_dtheme_tool32.getbitmap(11,Btool_properties);
   il_dtheme_tool32.getbitmap(12,Btool_rename);
   il_dtheme_tool32.getbitmap(13,Btool_delete);
   il_dtheme_tool32.getbitmap(14,Btool_dup);
   il_dtheme_tool32.getbitmap(15,Btool_resize);
   il_dtheme_tool32.getbitmap(16,Btool_crop);
   il_dtheme_tool32.getbitmap(17,BTool_rl);
   il_dtheme_tool32.getbitmap(18,BTool_rr);
   il_dtheme_tool32.getbitmap(19,Bextractalln_big);
   il_dtheme_tool32.getbitmap(20,Bextractallto_big);
   end;
   if upcase(theme_name)='NOGRAPHIC-EMBEDDED' then
   begin
   ImageList2.getbitmap(6,Bbookmarkadd);
   ImageList2.getbitmap(6,Bapps);
   ImageList2.getbitmap(6,BArchive);
   ImageList2.getbitmap(6,Bclearlayout);
   ImageList2.getbitmap(6,Bconvert);
   ImageList2.getbitmap(6,Bdelete);
   ImageList2.getbitmap(6,Bextractall);
   ImageList2.getbitmap(6,Bextractallton);
   ImageList2.getbitmap(6,Bloadlayout);
   ImageList2.getbitmap(6,Bpreview);
   ImageList2.getbitmap(6,Brun);
   ImageList2.getbitmap(6,Bsavelayout);
   ImageList2.getbitmap(6,Bwipe);
   ImageList2.getbitmap(6,Btestall);
   ImageList2.getbitmap(6,Bdvd_supported);
   ImageList2.getbitmap(6,Bfd_supported);
   ImageList2.getbitmap(6,Bhd_supported);
   ImageList2.getbitmap(6,Bram_supported);
   ImageList2.getbitmap(6,Bremote_supported);
   ImageList2.getbitmap(6,Bremovable_supported);
   ImageList2.getbitmap(6,BArchiveSupported);
   ImageList2.getbitmap(6,Baudio);
   ImageList2.getbitmap(6,Bdll);
   ImageList2.getbitmap(6,Bdb);
   ImageList2.getbitmap(6,BFileSupported);
   ImageList2.getbitmap(6,BExeSupported);
   ImageList2.getbitmap(6,Bimage);
   ImageList2.getbitmap(6,Bico);
   ImageList2.getbitmap(6,Bjpeg);
   ImageList2.getbitmap(6,Bgif);
   ImageList2.getbitmap(6,Bvector);
   ImageList2.getbitmap(6,Blink);
   ImageList2.getbitmap(6,Bmail);
   ImageList2.getbitmap(6,Bpdf);
   ImageList2.getbitmap(6,Bpresentation);
   ImageList2.getbitmap(6,Bbat);
   ImageList2.getbitmap(6,Bspreadsheet);
   ImageList2.getbitmap(6,Bsupported);
   ImageList2.getbitmap(6,Btxt);
   ImageList2.getbitmap(6,BUnsupported);
   ImageList2.getbitmap(6,Bvideo);
   ImageList2.getbitmap(6,Bweb);
   ImageList2.getbitmap(6,BFolder);
   ImageList2.getbitmap(6,Binfo);
   ImageList2.getbitmap(6,Bnav);
   ImageList2.getbitmap(6,Bkeyfile);
   ImageList2.getbitmap(6,Blocker);
   ImageList2.getbitmap(6,Blocker2);
   ImageList2.getbitmap(6,Bback);
   ImageList2.getbitmap(6,Bexpand);
   ImageList2.getbitmap(6,Bgo);
   ImageList2.getbitmap(6,Brefresh);
   ImageList2.getbitmap(6,Bsearch);
   ImageList2.getbitmap(6,Bgopath);
   ImageList2.getbitmap(6,Bresetpath);
   ImageList2.getbitmap(6,Bgoup);
   ImageList2.getbitmap(6,Bp0);
   ImageList2.getbitmap(6,Bbookmark);
   ImageList2.getbitmap(6,Bdesk);
   ImageList2.getbitmap(6,Bplaceshistory);
   ImageList2.getbitmap(6,Broot);
   ImageList2.getbitmap(6,Bsystemtools);
   ImageList2.getbitmap(6,BDefaults);
   ImageList2.getbitmap(6,Bstop);
   ImageList2.getbitmap(6,BTool_cut_small);
   ImageList2.getbitmap(6,BTool_copy_small);
   ImageList2.getbitmap(6,BTool_dup_small);
   ImageList2.getbitmap(6,Btool_properties_small);
   ImageList2.getbitmap(6,Btool_rename_small);
   ImageList2.getbitmap(6,Btool_resize_small);
   ImageList2.getbitmap(6,Btool_crop_small);
   ImageList2.getbitmap(6,BTool_rl_small);
   ImageList2.getbitmap(6,BTool_rr_small);
   ImageList2.getbitmap(6,Bextractalln);
   ImageList2.getbitmap(6,Bextractallto);
   ImageList2.getbitmap(6,Bbrowserdetails);
   ImageList2.getbitmap(6,Bbrowserlist);
   ImageList2.getbitmap(6,Bbrowsericons);
   ImageList2.getbitmap(6,Bbrowserdetailslarge);
   ImageList2.getbitmap(6,Bbrowserlistlarge);
   ImageList2.getbitmap(6,Bbrowsericonslarge);
   ImageList2.getbitmap(6,Bhomefolder);
   ImageList2.getbitmap(6,Bdvd_supported48);
   ImageList2.getbitmap(6,Bfd_supported48);
   ImageList2.getbitmap(6,Bhd_supported48);
   ImageList2.getbitmap(6,Bram_supported48);
   ImageList2.getbitmap(6,Bremote_supported48);
   ImageList2.getbitmap(6,Bremovable_supported48);
   ImageList2.getbitmap(6,BArchiveSupported48);
   ImageList2.getbitmap(6,Baudio48);
   ImageList2.getbitmap(6,Bdll48);
   ImageList2.getbitmap(6,Bdb48);
   ImageList2.getbitmap(6,BFileSupported48);
   ImageList2.getbitmap(6,BExeSupported48);
   ImageList2.getbitmap(6,Bimage48);
   ImageList2.getbitmap(6,Bico48);
   ImageList2.getbitmap(6,Bjpeg48);
   ImageList2.getbitmap(6,Bgif48);
   ImageList2.getbitmap(6,Bvector48);
   ImageList2.getbitmap(6,Blink48);
   ImageList2.getbitmap(6,Bmail48);
   ImageList2.getbitmap(6,Bpdf48);
   ImageList2.getbitmap(6,Bpresentation48);
   ImageList2.getbitmap(6,Bbat48);
   ImageList2.getbitmap(6,Bspreadsheet48);
   ImageList2.getbitmap(6,Bsupported48);
   ImageList2.getbitmap(6,Btxt48);
   ImageList2.getbitmap(6,BUnsupported48);
   ImageList2.getbitmap(6,Bvideo48);
   ImageList2.getbitmap(6,Bweb48);
   ImageList2.getbitmap(6,BFolder48);
   ImageList2.getbitmap(6,Bdvd_supported96);
   ImageList2.getbitmap(6,Bfd_supported96);
   ImageList2.getbitmap(6,Bhd_supported96);
   ImageList2.getbitmap(6,Bram_supported96);
   ImageList2.getbitmap(6,Bremote_supported96);
   ImageList2.getbitmap(6,Bremovable_supported96);
   ImageList2.getbitmap(6,BArchiveSupported96);
   ImageList2.getbitmap(6,Baudio96);
   ImageList2.getbitmap(6,Bdll96);
   ImageList2.getbitmap(6,Bdb96);
   ImageList2.getbitmap(6,BFileSupported96);
   ImageList2.getbitmap(6,BExeSupported96);
   ImageList2.getbitmap(6,Bimage96);
   ImageList2.getbitmap(6,Bico96);
   ImageList2.getbitmap(6,Bjpeg96);
   ImageList2.getbitmap(6,Bgif96);
   ImageList2.getbitmap(6,Bvector96);
   ImageList2.getbitmap(6,Blink96);
   ImageList2.getbitmap(6,Bmail96);
   ImageList2.getbitmap(6,Bpdf96);
   ImageList2.getbitmap(6,Bpresentation96);
   ImageList2.getbitmap(6,Bbat96);
   ImageList2.getbitmap(6,Bspreadsheet96);
   ImageList2.getbitmap(6,Bsupported96);
   ImageList2.getbitmap(6,Btxt96);
   ImageList2.getbitmap(6,BUnsupported96);
   ImageList2.getbitmap(6,Bvideo96);
   ImageList2.getbitmap(6,Bweb96);
   ImageList2.getbitmap(6,BFolder96);
   ImageList2.getbitmap(6,Bdetailsfs);
   ImageList2.getbitmap(6,Bdetailssystem);
   ImageList2.getbitmap(6,BArchive_big);
   ImageList2.getbitmap(6,Bconvert_big);
   ImageList2.getbitmap(6,Bextractall_big);
   ImageList2.getbitmap(6,Bextractallton_big);
   ImageList2.getbitmap(6,Btestall_big);
   ImageList2.getbitmap(6,Btool_cut);
   ImageList2.getbitmap(6,Btool_copy);
   ImageList2.getbitmap(6,Btool_paste);
   ImageList2.getbitmap(6,Btool_openw);
   ImageList2.getbitmap(6,Btool_properties);
   ImageList2.getbitmap(6,Btool_rename);
   ImageList2.getbitmap(6,Btool_delete);
   ImageList2.getbitmap(6,Btool_dup);
   ImageList2.getbitmap(6,Btool_resize);
   ImageList2.getbitmap(6,Btool_crop);
   ImageList2.getbitmap(6,BTool_rl);
   ImageList2.getbitmap(6,BTool_rr);
   ImageList2.getbitmap(6,Bextractalln_big);
   ImageList2.getbitmap(6,Bextractallto_big);
   end;
   if (upcase(theme_name)<>'NOGRAPHIC-EMBEDDED') and (upcase(theme_name)<>'SEVEN-EMBEDDED') then
   begin
   panel2.visible:=false;
   Bbrowserdetails.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-browser-details.bmp');
   Bbrowserlist.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-browser-list.bmp');
   Bbrowsericons.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-browser-icons.bmp');
   Bbrowserdetailslarge.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-browser-details-large.bmp');
   Bbrowserlistlarge.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-browser-list-large.bmp');
   Bbrowsericonslarge.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-browser-icons-large.bmp');
   Bhomefolder.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-home.bmp');
   Bbookmarkadd.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-bookmarks-add.bmp');
   Bapps.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-run-with.bmp');
   BArchive.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-archive-add.bmp');
   Bclearlayout.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-delete-clear.bmp');
   Bconvert.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-archive-convert.bmp');
   Bdelete.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-delete.bmp');
   Bextractall.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extract.bmp');
   Bextractallton.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extractall-tonew.bmp');
   Bloadlayout.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-paste.bmp');
   Bpreview.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-run-preview.bmp');
   Brun.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-run.bmp');
   Bsavelayout.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-save.bmp');
   Bwipe.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-delete-secure.bmp');
   Btestall.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-test.bmp');
   BFolder.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-folder.bmp');
   Binfo.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-info.bmp');
   Bnav.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation.bmp');
   Bkeyfile.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-keyfile.bmp');
   Blocker.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-password-set.bmp');
   Blocker2.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-password-notset.bmp');
   Bback.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-back.bmp');
   Bexpand.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-flat.bmp');
   Bgo.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-forward.bmp');
   Brefresh.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-refresh.bmp');
   Bsearch.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-search.bmp');
   Bgopath.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-search-here.bmp');
   Bresetpath.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-undo.bmp');
   Bgoup.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-up.bmp');
   Bp0.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-navigation-refreshing.bmp');
   Bbookmark.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-bookmarks.bmp');
   Bdesk.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-desktop.bmp');
   Bplaceshistory.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-history.bmp');
   Broot.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-folder-special.bmp');
   Bsystemtools.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-computer.bmp');
   BDefaults.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-options.bmp');
   Bstop.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-stop.bmp');
   BTool_cut_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-cut.bmp');
   BTool_copy_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-copy.bmp');
   BTool_dup_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-find-duplicates.bmp');
   Btool_properties_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-properties.bmp');
   Btool_rename_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-rename.bmp');
   Btool_resize_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-picture-modify.bmp');
   Btool_crop_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-picture-crop.bmp');
   BTool_rl_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-picture-rl.bmp');
   BTool_rr_small.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-picture-rr.bmp');
   Bextractalln.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extract-tonew.bmp');
   Bextractallto.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-archive-extractall.bmp');
   Bdll.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-file-library.bmp');
   BExeSupported.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-file-executable.bmp');
   Bbat.LoadFromFile(thpath+graphicsfolder+'16'+directoryseparator+'16-file-script.bmp');
   Bdetailsfs.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-folder.bmp');
   BArchive_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-archive-add.bmp');
   Bconvert_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-archive-convert.bmp');
   Bextractall_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extract.bmp');
   Bextractallton_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extractall-tonew.bmp');
   Btestall_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-test.bmp');
   Btool_cut.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-cut.bmp');
   Btool_copy.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-copy.bmp');
   Btool_paste.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-paste.bmp');
   Btool_openw.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-run-with.bmp');
   Btool_properties.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-properties.bmp');
   Btool_rename.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-rename.bmp');
   Btool_delete.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-delete-secure.bmp');
   Btool_dup.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-find-duplicates.bmp');
   Btool_resize.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-picture-modify.bmp');
   Btool_crop.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-picture-crop.bmp');
   BTool_rl.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-picture-rl.bmp');
   BTool_rr.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-picture-rr.bmp');
   Bextractalln_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extract-tonew.bmp');
   Bextractallto_big.LoadFromFile(thpath+graphicsfolder+'32'+directoryseparator+'32-archive-extractall.bmp');
   BFolder48.LoadFromFile(thpath+graphicsfolder+'48'+directoryseparator+'48-folder.bmp');
   Bdll48.LoadFromFile(thpath+graphicsfolder+'48'+directoryseparator+'48-file-library.bmp');
   BExeSupported48.LoadFromFile(thpath+graphicsfolder+'48'+directoryseparator+'48-file-executable.bmp');
   Bbat48.LoadFromFile(thpath+graphicsfolder+'48'+directoryseparator+'48-file-script.bmp');
   BFolder96.LoadFromFile(thpath+graphicsfolder+'96'+directoryseparator+'96-folder.bmp');
   Bdll96.LoadFromFile(thpath+graphicsfolder+'96'+directoryseparator+'96-file-library.bmp');
   BExeSupported96.LoadFromFile(thpath+graphicsfolder+'96'+directoryseparator+'96-file-executable.bmp');
   Bbat96.LoadFromFile(thpath+graphicsfolder+'96'+directoryseparator+'96-file-script.bmp');
   end;
   Bbrowserdetails.Transparent:=True;
   Bbrowserlist.Transparent:=True;
   Bbrowsericons.Transparent:=True;
   Bbrowserdetailslarge.Transparent:=True;
   Bbrowserlistlarge.Transparent:=True;
   Bbrowsericonslarge.Transparent:=True;
   Bhomefolder.Transparent:=True;
   Bapps.Transparent:=True;
   Bplaceshistory.Transparent:=True;
   Bdb.Transparent:=True;
   Bgif.Transparent:=True;
   Bico.Transparent:=True;
   Bvector.Transparent:=True;
   Bsupported.Transparent:=True;
   Bbat.Transparent:=True;
   Bdll.Transparent:=True;
   Bimage.Transparent:=True;
   Bjpeg.Transparent:=True;
   Bpresentation.Transparent:=True;
   Bpdf.Transparent:=True;
   Btxt.Transparent:=True;
   Bspreadsheet.Transparent:=True;
   Bvideo.Transparent:=True;
   Baudio.Transparent:=True;
   Barchive_bigger2.Transparent:=True;
   Bconvert.Transparent:=True;
   Bconvert_big.Transparent:=True;
   Barchive_big.Transparent:=True;
   BArchive.Transparent:=True;
   BArchiveSupported.Transparent:=True;
   BFileSupported.Transparent:=True;
   Bunsupported.Transparent:=True;
   for i:=1 to 26 do devicon[i]:=Bunsupported;//show "unsupported" icon if the bookmarked unit is not mounted
   BExeSupported.Transparent:=True;
   Bback.Transparent:=True;
   Bbookmark.Transparent:=True;
   Bbookmarkadd.Transparent:=True;
   Bclearlayout.Transparent:=True;
   Bdefaults.Transparent:=True;
   Bdelete.Transparent:=True;
   Bdvd_supported.Transparent:=True;
   Bexpand.Transparent:=True;
   Bextractall.Transparent:=True;
   Bextractallto.Transparent:=True;
   Bextractalln.Transparent:=True;
   Bextractallton.Transparent:=True;
   Bextractall_big.Transparent:=True;
   Bextractallto_big.Transparent:=True;
   Bextractalln_big.Transparent:=True;
   Bextractallton_big.Transparent:=True;
   Bfd_supported.Transparent:=True;
   BFolder.Transparent:=True;
   Bgo.Transparent:=True;
   Bgopath.Transparent:=True;
   Bgoup.Transparent:=True;
   Bhd_supported.Transparent:=True;
   Binfo.Transparent:=True;
   Bkeyfile.Transparent:=True;
   Bloadlayout.Transparent:=True;
   Blocker.Transparent:=True;
   Blocker2.Transparent:=True;
   Bmail.Transparent:=True;
   Bnav.Transparent:=True;
   Bp0.Transparent:=True;
   Bpreview.Transparent:=True;
   Brefresh.Transparent:=True;
   Bremote_supported.Transparent:=True;
   Bremovable_supported.Transparent:=True;
   Bresetpath.Transparent:=True;
   Broot.Transparent:=True;
   Brun.Transparent:=True;
   Bsavelayout.Transparent:=True;
   Bsearch.Transparent:=True;
   Bdesk.Transparent:=True;
   Bsystemtools.Transparent:=True;
   Bdetailssystem.Transparent:=True;
   Bdetailsfs.Transparent:=True;
   Bstop.Transparent:=True;
   Btestall.Transparent:=True;
   Bweb.Transparent:=True;
   Bwipe.Transparent:=True;
   Blink.Transparent:=True;
   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;
   mlang.Bitmap:=Binfo;
   imageflat2.Glyph:=Bbrowserdetails;
   imageflat1.Glyph:=Bbrowserlistlarge;
   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.Transparent:=true;
   iConsoleCreateImport.Picture.Bitmap:=Bresetpath;
   iConsoleCreateImport1.Picture.Bitmap:=Bresetpath;
   iadvextract.Picture.Bitmap:=Binfo;
   iadvextract.Transparent:=true;
   ImageInfoArchive2.Picture.Bitmap:=Binfo;
   ImageInfoArchive2.Transparent:=true;
   ImageInfoArchive3.Picture.Bitmap:=Binfo;
   ImageInfoArchive3.Transparent:=true;
   ImageInfoArchive4.Picture.Bitmap:=Binfo;
   ImageInfoArchive4.Transparent:=true;
   ImageInfoArchive5.Picture.Bitmap:=Binfo;
   ImageInfoArchive5.Transparent:=true;
   ImageInfoArchive6.Picture.Bitmap:=Binfo;
   ImageInfoArchive6.Transparent:=true;
   ImageInfoDefault1.Picture.Bitmap:=Binfo;
   ImageInfoDefault1.Transparent:=true;
   ImageInfoDefault2.Picture.Bitmap:=Binfo;
   ImageInfoDefault2.Transparent:=true;
   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:=bweb;
   MenuItemArchive_music.Bitmap:=baudio;
   MenuItemArchive_pictures.Bitmap:=bimage;
   MenuItemArchive_videos.Bitmap:=bvideo;
   MenuItemArchive_pubdoc.Bitmap:=bfolder;
   MenuItemOpenhome.Bitmap:=Bhomefolder;
   MenuItemOpen_home1.Bitmap:=bhomefolder;
   MenuItemOpen_documents1.Bitmap:=bfilesupported;
   MenuItemOpen_downloads1.Bitmap:=bweb;
   MenuItemOpen_music.Bitmap:=baudio;
   MenuItemOpen_pictures.Bitmap:=bimage;
   MenuItemOpen_videos.Bitmap:=bvideo;
   MenuItemOpen_pubdoc.Bitmap:=bfolder;
   //pmjumpsbook.Bitmap:=BBookmark;
   pmjump3.Bitmap:=Bhomefolder;
   pmquickhome.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:=bweb;
   pmjumpdownloads1.Bitmap:=bweb;
   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:=Bjpeg;
   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;
   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;
   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;
   pmquickroot.Bitmap:=Bsystemtools;
   pmqjmore.Bitmap:=bfolder;
   pmqjmore1.Bitmap:=bfolder;
   pmjump2.Bitmap:=Bdesk;
   pmquickdesk.Bitmap:=Bdesk;
   pmjump6.Bitmap:=Bdesk;
   pmqjdropbox.Bitmap:=bfolder;
   pmqjdropbox1.Bitmap:=bfolder;
   pmqjmyboxfiles.Bitmap:=bfolder;
   pmqjmyboxfiles1.Bitmap:=bfolder;
   pmqjgoogledrive.Bitmap:=bfolder;
   pmqjgoogledrive1.Bitmap:=bfolder;
   pmqjonedrive.Bitmap:=bfolder;
   pmqjonedrive1.Bitmap:=bfolder;
   pmqjskydrive.Bitmap:=bfolder;
   pmqjskydrive1.Bitmap:=bfolder;
   pmqjubuntuone.Bitmap:=bfolder;
   MenuItemOpen_dropbox.Bitmap:=bfolder;
   MenuItemOpen_myboxfiles.Bitmap:=bfolder;
   MenuItemOpen_googledrive.Bitmap:=bfolder;
   MenuItemOpen_onedrive.Bitmap:=bfolder;
   MenuItemOpen_skydrive.Bitmap:=bfolder;
   MenuItemOpen_ubuntuone.Bitmap:=bfolder;
   MenuItemArchive_dropbox.Bitmap:=bfolder;
   MenuItemArchive_myboxfiles.Bitmap:=bfolder;
   MenuItemArchive_googledrive.Bitmap:=bfolder;
   MenuItemArchive_onedrive.Bitmap:=bfolder;
   MenuItemArchive_skydrive.Bitmap:=bfolder;
   MenuItemArchive_ubuntuone.Bitmap:=bfolder;
   MenuItemOpen_desktop1.Bitmap:=Bdesk;
   mpathdesk1.Bitmap:=Bdesk;
   mhistory.Bitmap:=Bplaceshistory;
   pmbc.Bitmap:=Bplaceshistory;
   smhistorya1.Bitmap:=Bplaceshistory;
   smhistory1.Bitmap:=Bplaceshistory;
   po_test.Bitmap:=Btestall;
   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+uextractfilepath(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
autoopen:=0; //don't open output dir by default when job completes
convertverbose:=0; //no verbose confirmation for conversion steps
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:=16; //default format: last used
tsstyle:=0;//default timestamp style
pf:=14; //previous format, by default zip
pcompr:=1; //pea default Compression: average
pobj:=6; //pea default object control algorithm CRC64
pvol:=2; //pea default volume control algorithm SHA256
pstream:=0; //pea default stream control algorithm EAX AES 256
salgo:=9; //file split default integrity check algorithm: none
zaout:=2; //ConsoleCreate 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:=local_desktop;//txt_mypc;
{$ELSE}
indir:=home_path;//later replaced using local_desktop
if indir<>'' then if indir[length(indir)]<>directoryseparator then indir:=indir+directoryseparator;
//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;
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
ignorepathdd:=1; //ignore paths on drag and drop operations: on
removeintdir:=1;//remove intermediate dir on extract to new folder: on
prebrowse:=1; //stop browsing if archive is listed in more than prebrowse*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
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
prebrowsesize:=50; //max M blocks of memory allowed to list archive content in the browser - 50 is roughly enough for 250K files
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;
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;
level_7z:=3;  //default Compression level for .7z: average
level_xz:=2;
method_7z:='LZMA'; //default method for .7z: LZMA
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)
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
openw_all7z:=0; //default archive files open for writing for 7z binary: off
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:=1;
algocrc16:=1;
algocrc24:=1;
algocrc32:=1;
algocrc64:=1;
algoed2k:=1;
algomd4:=0;
algomd5:=1;
algoripemd160:=1;
algosha1:=1;
algosha224:=0;
algosha256:=1;
algosha384:=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:=160; form_peach.splitter1.Cursor:=crSizeNS;
splitter2size:=180; form_peach.splitter2.Cursor:=crSizeWE;
lastbar:=0;//status bar
esna:=0;
euns:=0;
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;
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;
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:=COL1;
if color2d='' then color2d:=COL2;
if color3d='' then color3d:=COL3;
if color4d='' then color4d:=COL4;
if color5d='' then color5d:=COL5;
//if (rowheightd<12) or (rowheightd>32) then rowheightd:=DROWHEIGHT;
if (themetoolbarsd<0) or (themetoolbarsd>1) then themetoolbarsd:=0;
//if (itemheightd<12) or (itemheightd>32) then itemheightd:=DROWHEIGHT+3;
//if (autosizeitemheightd<0) or (autosizeitemheightd>1) then autosizeitemheightd:=1;
//if (autosizetoolbarbuttond<0) or (autosizetoolbarbuttond>1) then autosizetoolbarbuttond:=0;
end;

{function wingetprogramsfolder_old:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
Result:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$0026,pidl)) then // is CSIDL_PROGRAM_FILES numerical hex value
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         winpfolder:=envtoutf8(Buf);
         if winpfolder<>'' then if winpfolder[length(winpfolder)]<>directoryseparator then winpfolder:=winpfolder+directoryseparator;
         CoTaskMemFree(pidl);
         Result:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(winpfolder)) then
   begin
   winpfolder:='';
   Result:=1;
   end;
{$ENDIF}
end; }

function wingetprogramsfolder:integer;
begin
Result:=-1;
{$IFDEF MSWINDOWS}
winpfolder:='';
winpfolder32:='';
winpfolder:=envtoutf8(GetEnvironmentVariable('ProgramW6432'));
if winpfolder='' then //XP and older
   begin
   winpfolder:=envtoutf8(GetEnvironmentVariable('ProgramFiles'));
   winpfolder32:=winpfolder;
   end
else //Vista and newer
   begin
   winpfolder:=envtoutf8(GetEnvironmentVariable('ProgramFiles'));
   winpfolder32:=envtoutf8(GetEnvironmentVariable('ProgramFiles(x86)'));
   if winpfolder=winpfolder32 then winpfolder:=envtoutf8(GetEnvironmentVariable('ProgramW6432'));
   end;
Result:=0;
if not(udirectoryexists(winpfolder)) then
   begin
   winpfolder:='';
   Result:=1;
   end;
if not(udirectoryexists(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 wingetdesk:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetdesk:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,0,pidl)) then //0 is CSIDL_DESKTOP numerical value
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         desktop_path:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if desktop_path<>'' then if desktop_path[length(desktop_path)]<>directoryseparator then desktop_path:=desktop_path+directoryseparator;
         wingetdesk:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(desktop_path)) then
   begin
   desktop_path:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetuserprofile:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetuserprofile:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,0,pidl)) then //0 is CSIDL_DESKTOP numerical value
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         home_path:=envtoutf8(Buf);
         if home_path<>'' then if home_path[length(home_path)]=directoryseparator then setlength(home_path,length(home_path)-1);
         home_path:=uextractfilepath(home_path);
         if home_path<>'' then if home_path[length(home_path)]=directoryseparator then setlength(home_path,length(home_path)-1);
         usr_name:=uextractfilename(home_path);
         users_root:=uextractfilepath(home_path);
         home_path:=home_path+directoryseparator;
         if users_root<>'' then if users_root[length(users_root)]<>directoryseparator then users_root:=users_root+directoryseparator;
         CoTaskMemFree(pidl);
         wingetuserprofile:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(home_path)) then
   begin
   home_path:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetappdatafolder:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetappdatafolder:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,26,pidl)) then //26 is CSIDL_APPDATA numerical value
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         winappdatafolder:=envtoutf8(Buf);
         if winappdatafolder<>'' then if winappdatafolder[length(winappdatafolder)]<>directoryseparator then winappdatafolder:=winappdatafolder+directoryseparator;
         CoTaskMemFree(pidl);
         wingetappdatafolder:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(winappdatafolder)) then
   begin
   winappdatafolder:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetappdata(var s:utf8string):integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetappdata:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,26,pidl)) then //26 is CSIDL_APPDATA numerical value
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         s:=envtoutf8(Buf)+'\PeaZip\';
         CoTaskMemFree(pidl);
         wingetappdata:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
{$ENDIF}
end;

function wingetdocuments:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetdocuments:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$0005,pidl)) then //5 is CSIDL_PERSONAL (user's documents) numerical value
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         usr_documents:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if usr_documents<>'' then if usr_documents[length(usr_documents)]<>directoryseparator then usr_documents:=usr_documents+directoryseparator;
         wingetdocuments:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(usr_documents)) then
   begin
   usr_documents:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetmusic:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetmusic:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$000d,pidl)) then
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         usr_music:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if usr_music<>'' then if usr_music[length(usr_music)]<>directoryseparator then usr_music:=usr_music+directoryseparator;
         wingetmusic:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(usr_music)) then
   begin
   usr_music:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetpictures:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetpictures:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$0027,pidl)) then
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         usr_pictures:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if usr_pictures<>'' then if usr_pictures[length(usr_pictures)]<>directoryseparator then usr_pictures:=usr_pictures+directoryseparator;
         wingetpictures:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(usr_pictures)) then
   begin
   usr_pictures:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetvideos:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetvideos:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$000e,pidl)) then
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         usr_videos:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if usr_videos<>'' then if usr_videos[length(usr_videos)]<>directoryseparator then usr_videos:=usr_videos+directoryseparator;
         wingetvideos:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(usr_videos)) then
   begin
   usr_videos:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetsendto:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetsendto:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$0009,pidl)) then
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         usr_sendto:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if usr_sendto<>'' then if usr_sendto[length(usr_sendto)]<>directoryseparator then usr_sendto:=usr_sendto+directoryseparator;
         wingetsendto:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(usr_sendto)) then
   begin
   usr_sendto:='';
   Result:=1;
   end;
{$ENDIF}
end;

function wingetpublicdocuments:integer;
begin
wingetpublicdocuments:=-1;
{$IFDEF MSWINDOWS}
try
public_documents:=envtoutf8(GetEnvironmentVariable('PUBLIC'));
if public_documents='' then
   begin
   end
else
   public_documents:=public_documents+'\Documents\';
wingetpublicdocuments:=0;
except
end;
if not(udirectoryexists(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;
{$ENDIF}
end;

function wingetpublichome:integer;
begin
wingetpublichome:=-1;
{$IFDEF MSWINDOWS}
try
public_home:=envtoutf8(GetEnvironmentVariable('PUBLIC'));
if public_home='' then
   begin
   end
else
   if public_home[length(public_home)]<>directoryseparator then public_home:=public_home+directoryseparator;
wingetpublichome:=0;
except
end;
if not(udirectoryexists(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;
{$ENDIF}
end;

function wingetrecent:integer;
{$IFDEF MSWINDOWS}
var
  pidl: PItemIDList;
  Buf: array [0..MAX_PATH] of Char;
{$ENDIF}
begin
wingetrecent:=-1;
{$IFDEF MSWINDOWS}
try
   if Succeeded(ShGetSpecialFolderLocation(Form_peach.Handle,$0008,pidl)) then
      if ShGetPathfromIDList(pidl, Buf ) then
         begin
         usr_recent:=envtoutf8(Buf);
         CoTaskMemFree(pidl);
         if usr_recent<>'' then if usr_recent[length(usr_recent)]<>directoryseparator then usr_recent:=usr_recent+directoryseparator;
         wingetrecent:=0;
         end
      else CoTaskMemFree(pidl);
except
end;
if not(udirectoryexists(usr_recent)) then
   begin
   usr_recent:='';
   Result:=1;
   end;
{$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 udirectoryexists(home_path+'Dropbox') then
   begin
   shared_dropbox:=home_path+'Dropbox\';
   Form_peach.pmqjdropbox.visible:=true;
   end;
if udirectoryexists(usr_documents+'My Box Files') then
   begin
   shared_myboxfiles:=usr_documents+'My Box Files\';
   Form_peach.pmqjmyboxfiles.visible:=true;
   end;
if udirectoryexists(home_path+'Google Drive') then
   begin
   shared_googledrive:=home_path+'Google Drive\';
   Form_peach.pmqjgoogledrive.visible:=true;
   end;
if udirectoryexists(home_path+'OneDrive') then
   begin
   shared_onedrive:=home_path+'OneDrive\';
   Form_peach.pmqjonedrive.visible:=true;
   end;
if udirectoryexists(home_path+'Workspaces') then
   begin
   shared_skydrive:=home_path+'Workspaces\';
   Form_peach.pmqjskydrive.visible:=true;
   end;
if udirectoryexists(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;

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\';
wingetdownloads:=0;
if not(udirectoryexists(usr_downloads)) then
   begin
   usr_downloads:='';
   Result:=1;
   end;
{$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\';
wingetsearches:=0;
if not(udirectoryexists(usr_searches)) then
   begin
   usr_searches:='';
   Result:=1;
   end;
{$ENDIF}
end;

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

procedure check_defaults_failure;
begin
//no control on lang_file name
if (autoclosegwrap<0) or (autoclosegwrap>3) then autoclosegwrap:=1;
if (enc7zscc<0) or (enc7zscc>2) then enc7zscc:=0;
if (autoopen<0) or (autoopen>1) then autoopen:=0;
if (convertverbose<0) or (convertverbose>1) then convertverbose:=0;
if (libre_directive<0) or (libre_directive>2) then libre_directive:=0;
if (mailkeep<0) or (mailkeep>1) then mailkeep:=0;
if (nameaspartent<0) or (nameaspartent>1) then nameaspartent:=1;
if (df<0) or (df>16) then df:=16;
if (tsstyle<0) or (tsstyle>3) then tsstyle:=0;
if (pf<0) or (pf>15) then pf:=14;
if (pcompr<0) or (pcompr>3) then pcompr:=1;
if (pobj<0) or (pobj>9) then pobj:=6;
if (pvol<0) or (pvol>9) then pvol:=2;
if (pstream<0) or (pstream>12) then pstream:=0;
if (salgo<0) or (salgo>9) then salgo:=9;
if (zaout<0) or (zaout>2) then zaout:=2;
zaout1:=zaout;
if (clipmode<0) or (clipmode>1) then clipmode:=0;
if indir='' then
   begin
   {$IFDEF MSWINDOWS}
   indir:=local_desktop;
   {$ELSE}
   indir:=home_path;
   if indir<>'' then if indir[length(indir)]<>directoryseparator then indir:=indir+directoryseparator;
   {$ENDIF}
   end;
if indir<>txt_mypc then
   if not(udirectoryexists((indir))) then
      begin
      {$IFDEF MSWINDOWS}
      indir:=local_desktop;
      {$ELSE}
      indir:=home_path;
      if indir<>'' then if indir[length(indir)]<>directoryseparator then indir:=indir+directoryseparator;
      {$ENDIF}
      end;
if (showguihints<0) or (showguihints>1) then showguihints:=1;
if (showpwfield<0) or (showpwfield>1) then showpwfield:=0;
if (setencfn<0) or (setencfn>1) then setencfn:=0;
if (extpw<0) or (extpw>4) then extpw:=3;
if (extopt7z<0) or (extopt7z>4) then extopt7z:=0;
if (extaction7z<0) or (extaction7z>4) then extaction7z:=0;
if (extactionarc<0) or (extactionarc>5) then extactionarc:=0;
if (extactionace<0) or (extactionace>3) then extactionace:=0;
if (work_dir<0) or (work_dir>2) then work_dir:=0;
if (extoptarc<0) or (extoptarc>2) then extoptarc:=0;
if (ignorepathextand<0) or (ignorepathextand>1) then ignorepathextand:=1;
if (ignorepathdisp<0) or (ignorepathdisp>1) then ignorepathdisp:=0;
if (ignorepathsel<0) or (ignorepathsel>1) then ignorepathsel:=0;
if (ignorepathdd<0) or (ignorepathdd>1) then ignorepathdd:=1;
if (removeintdir<0) or (removeintdir>1) then removeintdir:=1;
if (prebrowse<0) or (prebrowse>1) then prebrowse:=1;
if (nonverboselog<0) or (nonverboselog>1) then nonverboselog:=1;
if (use7zunrar5<0) or (use7zunrar5>1) then use7zunrar5:=1;
if (enumd<0) or (enumd>1) then enumd:=1;
if (defaulttabsmenu<1) or (defaulttabsmenu>4) then defaulttabsmenu:=2;
if (multi_option<0) or (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>100) then prebrowsesize:=50;
if (savehistory<0) or (savehistory>1) then savehistory:=1;
if (customsyntax<0) or (customsyntax>5) then customsyntax:=1;
if (customsyntax1<0) or (customsyntax1>5) then customsyntax:=1;
if (ws<0) or (ws>1) then ws:=1;
if (ws_status<0) or (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 (fav7z<0) or (fav7z>1) then fav7z:=1;
if (favARC<0) or (favARC>1) then favARC:=0;
if (favbz<0) or (favbz>1) then favbz:=1;
if (favcustom<0) or (favcustom>1) then favcustom:=0;
if (favgz<0) or (favgz>1) then favgz:=1;
if (favpea<0) or (favpea>1) then favpea:=0;
if (favquad<0) or (favquad>1) then favquad:=0;
if (favsplit<0) or (favsplit>1) then favsplit:=0;
if (favtar<0) or (favtar>1) then favtar:=0;
if (favsfx<0) or (favsfx>1) then favsfx:=1;
if (favsfxarc<0) or (favsfxarc>1) then favsfxarc:=0;
if (favupx<0) or (favupx>1) then favupx:=0;
if (favzip<0) or (favzip>1) then favzip:=1;
if (favwim<0) or (favwim>1) then favwim:=0;
if (favxz<0) or (favxz>1) then favxz:=0;
if (favzpaq<0) or (favzpaq>1) then favzpaq:=0;
if (level_7z<0) or (level_7z>5) then level_7z:=3;
if (level_xz<0) or (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<0) or (level_arc>9) then level_arc:=4;
if (solid_arc<0) or (solid_arc>2) then solid_arc:=1;
if (rr_arc<0) or (rr_arc>1) then rr_arc:=1;
if (algo_arc<0) or (algo_arc>3) then algo_arc:=0;
if (level_bzip2<0) or (level_bzip2>4) then level_bzip2:=2;
if (level_gz<0) or (level_gz>4) then level_gz:=2;
if (level_paq<0) or (level_paq>3) then level_paq:=1;
if (paqver<0) or (paqver>2) then paqver:=2;
if (level_quad<0) or (level_quad>1) then level_quad:=0;
if (level_upx<0) or (level_upx>10) then level_upx:=10;
if (level_zip<0) or (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<0) or (openw_all7z>1) then openw_all7z:=0;
if (algodisp<0) or (algodisp>2) then algodisp:=0;
if (algoall<0) or (algoall>1) then algoall:=0;
if (algoadler<0) or (algoadler>1) then algoadler:=1;
if (algocrc16<0) or (algocrc16>1) then algocrc16:=0;
if (algocrc24<0) or (algocrc24>1) then algocrc24:=0;
if (algocrc32<0) or (algocrc32>1) then algocrc32:=1;
if (algocrc64<0) or (algocrc64>1) then algocrc64:=0;
if (algoed2k<0) or (algoed2k>1) then algoed2k:=0;
if (algomd4<0) or (algomd4>1) then algomd4:=0;
if (algomd5<0) or (algomd5>1) then algomd5:=1;
if (algoripemd160<0) or (algoripemd160>1) then algoripemd160:=1;
if (algosha1<0) or (algosha1>1) then algosha1:=1;
if (algosha224<0) or (algosha224>1) then algosha224:=0;
if (algosha256<0) or (algosha256>1) then algosha256:=1;
if (algosha384<0) or (algosha384>1) then algosha384:=0;
if (algosha512<0) or (algosha512>1) then algosha512:=0;
if (algowhirl<0) or (algowhirl>1) then algowhirl:=0;
if (erasepasses<0) or (erasepasses>4) then erasepasses:=1;
if (jobdefenc<0) or (jobdefenc>1) then {$IFDEF MSWINDOWS}jobdefenc:=0;{$ELSE}jobdefenc:=1;{$ENDIF}
if (archivenameenc<0) or (archivenameenc>1) then archivenameenc:=1;
if (mcuzip<0) or (mcuzip>1) then mcuzip:=0;
if (mappeddrivesinfo<0) or (mappeddrivesinfo>1) then mappeddrivesinfo:=0;
if (local_desktop='') or (not(udirectoryexists(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:=160;
if (splitter2size<0) then splittersize:=180;
if (splitter3size<0) then splittersize:=656;
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 (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<0) or (tonewfolder>1) then tonewfolder:=0;
if (parallelarchive<0) or (parallelarchive>1) then parallelarchive:=1;
if not(udirectoryexists(defaultextractpath)) then defaultextractpath:='';
if not(udirectoryexists(defaultarchivepath)) then defaultarchivepath:='';
if (zcopy<0) or (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 (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 (browserch<1) or (browserch>15) 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<0) or (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>6) 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;
end;

procedure set_items_height;
begin
with Form_peach do
begin
editheight:=ctrlup.height; //this item's height is determined by tedit height
if editheight>26 then stdbtnheight:=editheight+2 else stdbtnheight:=26;
PanelSide.Height:=ctrlback.Height+6;//ctrlup.height;//+4;
//PanelListBar.Height:=ctrlup.height+4;
rowheight:=editheight-4;
Imagepassword1.Height:=stdbtnheight;
Imagepassword2.Height:=stdbtnheight;
Image7zPj.Height:=stdbtnheight;
Image7zPj1.Height:=stdbtnheight;
ImageUn7zPj.Height:=stdbtnheight;
Image7zPj3.Height:=stdbtnheight;
Button1.Height:=stdbtnheight;
Button2.Height:=stdbtnheight;
ImageDefaults2.Height:=stdbtnheight;
buttoneditname13.height:=stdbtnheight;
buttonarchive.height:=stdbtnheight;
buttonarchive1.height:=stdbtnheight;
buttonextok.height:=stdbtnheight;
buttonextcancel.height:=stdbtnheight;
StringGrid1.DefaultRowHeight:=rowheight;
StringGrid2.DefaultRowHeight:=rowheight;
StringGridSessionHistory.DefaultRowHeight:=rowheight;
StringGridBookmarks.DefaultRowHeight:=rowheight;
StringGridClipboard.DefaultRowHeight:=rowheight;
StringGridRecent.DefaultRowHeight:=rowheight;
end;
end;

function modcolor(col:TColor; dr,dg,db:Single):TColor;
var
  r, g, b: Byte;
begin
  col := ColorToRGB(col);
  r := BYTE(col);
  g := BYTE((WORD(col)) shr 8);
  b := BYTE(col shr 16);
  r := trunc( r * dr);
  g := trunc( g * dg);
  b := trunc( b * db);
  result := DWORD(((DWORD(BYTE(r))) or ((DWORD(WORD(g))) shl 8)) or ((DWORD(BYTE(b))) shl 16));
end;

procedure apply_theme; //apply colors but not opacity
var
   modp,modl:single;
begin
//grids
Form_peach.StringGrid1.AlternateColor:=stringtocolor(color1);
Form_peach.StringGrid2.AlternateColor:=stringtocolor(color1);
Form_peach.StringGridSessionHistory.AlternateColor:=stringtocolor(color1);
Form_peach.StringGridBookmarks.AlternateColor:=stringtocolor(color1);
Form_peach.StringGridRecent.AlternateColor:=stringtocolor(color1);
Form_peach.StringGridClipboard.AlternateColor:=stringtocolor(color1);
//bars
modl:=0.96;
Form_peach.Splitter2.Color:=modcolor(stringtocolor(color1),modl,modl,modl);
Form_peach.PanelBarOpen.Color:=Form_peach.Splitter2.Color;
Form_peach.PanelListBar.Color:=Form_peach.Splitter2.Color;
Form_peach.Panelnav4.Color:=Form_peach.Splitter2.Color;
Form_peach.PanelSide.Color:=clWindow;
Form_peach.PanelInfo.Color:=clWindow;
Form_peach.Panelnav3.Color:=clWindow;
Form_peach.PanelFileBrowserOptions.Color:=stringtocolor(color2);
Form_peach.Panelnav5.Color:=stringtocolor(color2);
modp:=0.90;
Form_peach.Splitter1.Color:=modcolor(stringtocolor(color1),modp,modp,modp);
Form_peach.ShapeAddress.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Shape1.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel1.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel10.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel11.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel15.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel17.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel13.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel16.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel12.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel14.Pen.Color:=Form_peach.Splitter1.Color;
Form_peach.Bevel18.Pen.Color:=Form_peach.Splitter1.Color;
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;
Form_peach.LabelStatusdisplayed1.Font.Color:=clGray;
//PanelDefaults
Form_peach.ColorButton1.ButtonColor:=stringtocolor(color1);
Form_peach.ColorButton2.ButtonColor:=stringtocolor(color2);
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;
//PanelOpen
   //PanelFilters
//PanelArchiveMain
//PanelArchive
//PanelArchive2
//PanelKeyFile
load_icons;
end;

procedure readconf_colors;
var
   s:utf8string;
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
//rowheight:=strtoint(s);
readln(conf,s);
//itemheight:=strtoint(s);
readln(conf,s);
//autosizeitemheight:=strtoint(s);
readln(conf,s);
autosizetoolbarbutton:=strtoint(s);
end;

procedure readconf_default_colors;
var
   s:utf8string;
begin
readln(conf,graphicsfolderd);
udodirseparators(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);
//rowheightd:=strtoint(s);
readln(conf,s);
//itemheightd:=strtoint(s);
readln(conf,s);
//autosizeitemheightd:=strtoint(s);
readln(conf,s);
autosizetoolbarbuttond:=strtoint(s);
end;

function isawebservice(s:utf8string):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 uextractfilename(custedit1)<>'' then owcustom1.Caption:=uextractfilename(custedit1)
   else owcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then owcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if uextractfilename(custedit2)<>'' then owcustom2.Caption:=uextractfilename(custedit2)
   else owcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then owcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if uextractfilename(custedit3)<>'' then owcustom3.Caption:=uextractfilename(custedit3)
   else owcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then owcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if uextractfilename(custedit4)<>'' then owcustom4.Caption:=uextractfilename(custedit4)
   else owcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then owcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if uextractfilename(custedit5)<>'' then owcustom5.Caption:=uextractfilename(custedit5)
   else owcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then owcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if uextractfilename(custedit6)<>'' then owcustom6.Caption:=uextractfilename(custedit6)
   else owcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then owcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if uextractfilename(custedit7)<>'' then owcustom7.Caption:=uextractfilename(custedit7)
   else owcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then owcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if uextractfilename(custedit8)<>'' then owcustom8.Caption:=uextractfilename(custedit8)
   else owcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then owcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if uextractfilename(custedit9)<>'' then owcustom_9.Caption:=uextractfilename(custedit9)
   else owcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then owcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if uextractfilename(custedit10)<>'' then owcustom_10.Caption:=uextractfilename(custedit10)
   else owcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then owcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if uextractfilename(custedit11)<>'' then owcustom_11.Caption:=uextractfilename(custedit11)
   else owcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then owcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if uextractfilename(custedit12)<>'' then owcustom_12.Caption:=uextractfilename(custedit12)
   else owcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then owcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if uextractfilename(custedit13)<>'' then owcustom_13.Caption:=uextractfilename(custedit13)
   else owcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then owcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if uextractfilename(custedit14)<>'' then owcustom_14.Caption:=uextractfilename(custedit14)
   else owcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then owcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if uextractfilename(custedit15)<>'' then owcustom_15.Caption:=uextractfilename(custedit15)
   else owcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then owcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if uextractfilename(custedit16)<>'' then owcustom_16.Caption:=uextractfilename(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 custedit1+custedit2+custedit3+custedit4+custedit5+custedit6+custedit7+custedit8<>'' then owseparator1.visible:=true else owseparator1.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 uextractfilename(custedit1)<>'' then eowcustom1.Caption:=uextractfilename(custedit1)
   else eowcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then eowcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if uextractfilename(custedit2)<>'' then eowcustom2.Caption:=uextractfilename(custedit2)
   else eowcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then eowcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if uextractfilename(custedit3)<>'' then eowcustom3.Caption:=uextractfilename(custedit3)
   else eowcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then eowcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if uextractfilename(custedit4)<>'' then eowcustom4.Caption:=uextractfilename(custedit4)
   else eowcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then eowcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if uextractfilename(custedit5)<>'' then eowcustom5.Caption:=uextractfilename(custedit5)
   else eowcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then eowcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if uextractfilename(custedit6)<>'' then eowcustom6.Caption:=uextractfilename(custedit6)
   else eowcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then eowcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if uextractfilename(custedit7)<>'' then eowcustom7.Caption:=uextractfilename(custedit7)
   else eowcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then eowcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if uextractfilename(custedit8)<>'' then eowcustom8.Caption:=uextractfilename(custedit8)
   else eowcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then eowcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if uextractfilename(custedit9)<>'' then eowcustom_9.Caption:=uextractfilename(custedit9)
   else eowcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then eowcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if uextractfilename(custedit10)<>'' then eowcustom_10.Caption:=uextractfilename(custedit10)
   else eowcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then eowcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if uextractfilename(custedit11)<>'' then eowcustom_11.Caption:=uextractfilename(custedit11)
   else eowcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then eowcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if uextractfilename(custedit12)<>'' then eowcustom_12.Caption:=uextractfilename(custedit12)
   else eowcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then eowcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if uextractfilename(custedit13)<>'' then eowcustom_13.Caption:=uextractfilename(custedit13)
   else eowcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then eowcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if uextractfilename(custedit14)<>'' then eowcustom_14.Caption:=uextractfilename(custedit14)
   else eowcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then eowcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if uextractfilename(custedit15)<>'' then eowcustom_15.Caption:=uextractfilename(custedit15)
   else eowcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then eowcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if uextractfilename(custedit16)<>'' then eowcustom_16.Caption:=uextractfilename(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 uextractfilename(custedit1)<>'' then powcustom1.Caption:=uextractfilename(custedit1)
   else powcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then powcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if uextractfilename(custedit2)<>'' then powcustom2.Caption:=uextractfilename(custedit2)
   else powcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then powcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if uextractfilename(custedit3)<>'' then powcustom3.Caption:=uextractfilename(custedit3)
   else powcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then powcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if uextractfilename(custedit4)<>'' then powcustom4.Caption:=uextractfilename(custedit4)
   else powcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then powcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if uextractfilename(custedit5)<>'' then powcustom5.Caption:=uextractfilename(custedit5)
   else powcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then powcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if uextractfilename(custedit6)<>'' then powcustom6.Caption:=uextractfilename(custedit6)
   else powcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then powcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if uextractfilename(custedit7)<>'' then powcustom7.Caption:=uextractfilename(custedit7)
   else powcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then powcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if uextractfilename(custedit8)<>'' then powcustom8.Caption:=uextractfilename(custedit8)
   else powcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then powcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if uextractfilename(custedit9)<>'' then powcustom_9.Caption:=uextractfilename(custedit9)
   else powcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then powcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if uextractfilename(custedit10)<>'' then powcustom_10.Caption:=uextractfilename(custedit10)
   else powcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then powcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if uextractfilename(custedit11)<>'' then powcustom_11.Caption:=uextractfilename(custedit11)
   else powcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then powcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if uextractfilename(custedit12)<>'' then powcustom_12.Caption:=uextractfilename(custedit12)
   else powcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then powcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if uextractfilename(custedit13)<>'' then powcustom_13.Caption:=uextractfilename(custedit13)
   else powcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then powcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if uextractfilename(custedit14)<>'' then powcustom_14.Caption:=uextractfilename(custedit14)
   else powcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then powcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if uextractfilename(custedit15)<>'' then powcustom_15.Caption:=uextractfilename(custedit15)
   else powcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then powcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if uextractfilename(custedit16)<>'' then powcustom_16.Caption:=uextractfilename(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 uextractfilename(custedit1)<>'' then aowcustom1.Caption:=uextractfilename(custedit1)
   else aowcustom1.Caption:=custedit1;
if StringGridCustedit.Cells[1,2]<>'' then aowcustom2.Caption:=StringGridCustedit.Cells[1,2]
else
   if uextractfilename(custedit2)<>'' then aowcustom2.Caption:=uextractfilename(custedit2)
   else aowcustom2.Caption:=custedit2;
if StringGridCustedit.Cells[1,3]<>'' then aowcustom3.Caption:=StringGridCustedit.Cells[1,3]
else
   if uextractfilename(custedit3)<>'' then aowcustom3.Caption:=uextractfilename(custedit3)
   else aowcustom3.Caption:=custedit3;
if StringGridCustedit.Cells[1,4]<>'' then aowcustom4.Caption:=StringGridCustedit.Cells[1,4]
else
   if uextractfilename(custedit4)<>'' then aowcustom4.Caption:=uextractfilename(custedit4)
   else aowcustom4.Caption:=custedit4;
if StringGridCustedit.Cells[1,5]<>'' then aowcustom5.Caption:=StringGridCustedit.Cells[1,5]
else
   if uextractfilename(custedit5)<>'' then aowcustom5.Caption:=uextractfilename(custedit5)
   else aowcustom5.Caption:=custedit5;
if StringGridCustedit.Cells[1,6]<>'' then aowcustom6.Caption:=StringGridCustedit.Cells[1,6]
else
   if uextractfilename(custedit6)<>'' then aowcustom6.Caption:=uextractfilename(custedit6)
   else aowcustom6.Caption:=custedit6;
if StringGridCustedit.Cells[1,7]<>'' then aowcustom7.Caption:=StringGridCustedit.Cells[1,7]
else
   if uextractfilename(custedit7)<>'' then aowcustom7.Caption:=uextractfilename(custedit7)
   else aowcustom7.Caption:=custedit7;
if StringGridCustedit.Cells[1,8]<>'' then aowcustom8.Caption:=StringGridCustedit.Cells[1,8]
else
   if uextractfilename(custedit8)<>'' then aowcustom8.Caption:=uextractfilename(custedit8)
   else aowcustom8.Caption:=custedit8;
if StringGridCustedit.Cells[1,9]<>'' then aowcustom_9.Caption:=StringGridCustedit.Cells[1,9]
else
   if uextractfilename(custedit9)<>'' then aowcustom_9.Caption:=uextractfilename(custedit9)
   else aowcustom_9.Caption:=custedit9;
if StringGridCustedit.Cells[1,10]<>'' then aowcustom_10.Caption:=StringGridCustedit.Cells[1,10]
else
   if uextractfilename(custedit10)<>'' then aowcustom_10.Caption:=uextractfilename(custedit10)
   else aowcustom_10.Caption:=custedit10;
if StringGridCustedit.Cells[1,11]<>'' then aowcustom_11.Caption:=StringGridCustedit.Cells[1,11]
else
   if uextractfilename(custedit11)<>'' then aowcustom_11.Caption:=uextractfilename(custedit11)
   else aowcustom_11.Caption:=custedit11;
if StringGridCustedit.Cells[1,12]<>'' then aowcustom_12.Caption:=StringGridCustedit.Cells[1,12]
else
   if uextractfilename(custedit12)<>'' then aowcustom_12.Caption:=uextractfilename(custedit12)
   else aowcustom_12.Caption:=custedit12;
if StringGridCustedit.Cells[1,13]<>'' then aowcustom_13.Caption:=StringGridCustedit.Cells[1,13]
else
   if uextractfilename(custedit13)<>'' then aowcustom_13.Caption:=uextractfilename(custedit13)
   else aowcustom_13.Caption:=custedit13;
if StringGridCustedit.Cells[1,14]<>'' then aowcustom_14.Caption:=StringGridCustedit.Cells[1,14]
else
   if uextractfilename(custedit14)<>'' then aowcustom_14.Caption:=uextractfilename(custedit14)
   else aowcustom_14.Caption:=custedit14;
if StringGridCustedit.Cells[1,15]<>'' then aowcustom_15.Caption:=StringGridCustedit.Cells[1,15]
else
   if uextractfilename(custedit15)<>'' then aowcustom_15.Caption:=uextractfilename(custedit15)
   else aowcustom_15.Caption:=custedit15;
if StringGridCustedit.Cells[1,16]<>'' then aowcustom_16.Caption:=StringGridCustedit.Cells[1,16]
else
   if uextractfilename(custedit16)<>'' then aowcustom_16.Caption:=uextractfilename(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 custedit1+custedit2+custedit3+custedit4+custedit5+custedit6+custedit7+custedit8<>'' then aowseparator1.visible:=true else aowseparator1.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:utf8string):boolean;
begin
check7zvolume:=false;
if length(s)>=4 then
   if copy(s,1,4)='\\.\' then check7zvolume:=true;
end;

function checkUNCpath(s:utf8string):boolean;
begin
checkUNCpath:=false;
if length(s)>=2 then
   if copy(s,1,2)='\\' 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 menuitem70.Visible:=true else menuitem70.Visible:=false;
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 ufileexists(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 udirectoryexists(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 readconf_defaults;
var
   s:utf8string;
   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;
if check7zvolume(indir)=true then indir:=local_desktop;
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); algosha224:=strtoint(s);
readln(conf,s); algosha256:=strtoint(s);
readln(conf,s); algosha384:=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); local_desktop:=s;
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(udirectoryexists(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);
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
   begin
   libre_directive:=HLIBRE_DIR;
   Form_peach.LabelLibre.visible:=false;
   Form_peach.ComboBoxLibre.visible:=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);
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: close when job 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,'[pre-browse archive to give statistical information about all content]');
writeln(conf,inttostr(prebrowse));
writeln(conf,'');
writeln(conf,'[don''t pre-browse archives over this 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 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(algosha224));
writeln(conf,inttostr(algosha256));
writeln(conf,inttostr(algosha384));
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 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,'[address bar 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));
end;

function geticon(fullname,fulltype:utf8string; pc:boolean):integer;
var
   s,ext:utf8string;
begin
if pc=true then
   begin
   if fulltype = txt_unit_removable then result:=11; //Bremovable_supported
   if fulltype = txt_unit_hd then result:=8; //Bhd_supported
   if fulltype = txt_unit_remote then result:=10; //Bremote_supported
   if fulltype = txt_unit_cd then result:=6; //Bdvd_supported
   if fulltype = txt_unit_ram then result:=9; //Bram_supported
   if fulltype = txt_unit_floppy then result:=7; //Bfd_supported
   exit;
   end;
s:=fullname;
ext:=lowercase(fulltype);
if ext=txt_list_isfolder then begin result:=3; exit; end;
case ext of
'.lnk': result:=4;
'.txt','.rtf','.wri','.ini','.log': result:=14;
'.doc','.dot','.docx','.odt': result:=2;
'.xls','.xlt','.xlsx','.ods','.gnm','.csv': result:=13;
'.pps','.ppt','.odp': result:=18;
'.pdf': result:=19;
'.gif': result:=25;
'.ani','.cur','.ico','.icl': result:=26;
'.db','.dbf','.mdb','.nsf': result:=24;
'.svg','.ps','.eps','.cdr','.ai','.psd','.psp': result:=27;
'.jpg','.jpe','.jpeg','.jif', '.jfif', '.jfi','.jpx','.jp2','.j2k': result:=35;
'.png','.bmp','.tga','.tif','.tiff': result:=17;
'.avi','.mpg','.mpeg','.xvid','.divx','.mp4','.mov','.3gp','.wmv','.swf','.flv','.fla': result:=15;
'.wav','.mp3','.mid','.wma','.aiff','.ogg': result:=12;
'.htm','.html','.xml','.mht','.url': result:=16;
'.bat','.pif','.scr','.vbs','.cmd','.reg': result:=20;
'.dll','.sys','.so': result:=22;
'.eml': result:=23;
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:utf8string):TBitmap;
var
   fulltype:utf8string;
   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:=Bweb;
   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;
{$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[length(s1)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=uextractfileext(s1);
result:=pgetbitmap(geticon(s1,fulltype,false));
end;
end;

function drawhistoryicon(n:integer):TBitmap;
var
   s1,s2:utf8string;
   i:integer;
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:utf8string):TBitmap;
var
   fulltype:utf8string;
   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[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=uextractfileext(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;
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:utf8string);
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:utf8string);
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;
addtofolderhistory(uextractfilepath(s));
populaterecenticons;
populaterecentpanel;
populatetree;
end;

procedure addtocustomhistory(s:utf8string);
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;
   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 setaddconvert_menu;
begin
if fav7z=1 then
   begin
   Form_peach.cbf1.State:=cbChecked;
   Form_peach.mType7z.Visible:=true;
   end
else
   begin
   Form_peach.cbf1.State:=cbUnChecked;
   Form_peach.mType7z.Visible:=false;
   end;
if favARC=1 then
   begin
   Form_peach.cbfARC.State:=cbChecked;
   Form_peach.mTypeARC.Visible:=true;
   end
else
   begin
   Form_peach.cbfARC.State:=cbUnChecked;
   Form_peach.mTypeARC.Visible:=false;
   end;
if favcustom=1 then
   begin
   Form_peach.cbfCustom.State:=cbChecked;
   Form_peach.mTypeCustom.Visible:=true;
   end
else
   begin
   Form_peach.cbfCustom.State:=cbUnChecked;
   Form_peach.mTypeCustom.Visible:=false;
   end;
if favsfx=1 then
   begin
   Form_peach.cbfsfx.State:=cbChecked;
   Form_peach.mTypesfx.Visible:=true;
   end
else
   begin
   Form_peach.cbfsfx.State:=cbUnChecked;
   Form_peach.mTypesfx.Visible:=false;
   end;
if favsfxarc=1 then
   begin
   Form_peach.cbfsfx1.State:=cbChecked;
   Form_peach.mTypesfxarc.Visible:=true;
   end
else
   begin
   Form_peach.cbfsfx1.State:=cbUnChecked;
   Form_peach.mTypesfxarc.Visible:=false;
   end;
if favbz=1 then
   begin
   Form_peach.cbf2.State:=cbChecked;
   Form_peach.mTypeBZip2.Visible:=true;
   end
else
   begin
   Form_peach.cbf2.State:=cbUnChecked;
   Form_peach.mTypeBZip2.Visible:=false;
   end;
if favgz=1 then
   begin
   Form_peach.cbf3.State:=cbChecked;
   Form_peach.mTypeGZ.Visible:=true;
   end
else
   begin
   Form_peach.cbf3.State:=cbUnChecked;
   Form_peach.mTypeGZ.Visible:=false;
   end;
if favzpaq=1 then
   begin
   Form_peach.cbf5.State:=cbChecked;
   Form_peach.mTypePAQ.Visible:=true;
   end
else
   begin
   Form_peach.cbf5.State:=cbUnChecked;
   Form_peach.mTypePAQ.Visible:=false;
   end;
if favpea=1 then
   begin
   Form_peach.cbf6.State:=cbChecked;
   Form_peach.mTypePEA.Visible:=true;
   end
else
   begin
   Form_peach.cbf6.State:=cbUnChecked;
   Form_peach.mTypePEA.Visible:=false;
   end;
if favquad=1 then
   begin
   Form_peach.cbf7.State:=cbChecked;
   Form_peach.mTypeQUAD.Visible:=true;
   end
else
   begin
   Form_peach.cbf7.State:=cbUnChecked;
   Form_peach.mTypeQUAD.Visible:=false;
   end;
if favsplit=1 then
   begin
   Form_peach.cbf8.State:=cbChecked;
   Form_peach.mTypeSplit.Visible:=true;
   end
else
   begin
   Form_peach.cbf8.State:=cbUnChecked;
   Form_peach.mTypeSplit.Visible:=false;
   end;
if favtar=1 then
   begin
   Form_peach.cbf9.State:=cbChecked;
   Form_peach.mTypeTAR.Visible:=true;
   end
else
   begin
   Form_peach.cbf9.State:=cbUnChecked;
   Form_peach.mTypeTAR.Visible:=false;
   end;
if favupx=1 then
   begin
   Form_peach.cbf10.State:=cbChecked;
   Form_peach.mTypeUPX.Visible:=true;
   end
else
   begin
   Form_peach.cbf10.State:=cbUnChecked;
   Form_peach.mTypeUPX.Visible:=false;
   end;
if favzip=1 then
   begin
   Form_peach.cbf11.State:=cbChecked;
   Form_peach.mTypeZIP.Visible:=true;
   end
else
   begin
   Form_peach.cbf11.State:=cbUnChecked;
   Form_peach.mTypeZIP.Visible:=false;
   end;
if favwim=1 then
   begin
   Form_peach.cbfwim.State:=cbChecked;
   Form_peach.mTypeWIM.Visible:=true;
   end
else
   begin
   Form_peach.cbfwim.State:=cbUnChecked;
   Form_peach.mTypeWIM.Visible:=false;
   end;
if favxz=1 then
   begin
   Form_peach.cbfxz.State:=cbChecked;
   Form_peach.mTypeXZ.Visible:=true;
   end
else
   begin
   Form_peach.cbfxz.State:=cbUnChecked;
   Form_peach.mTypeXZ.Visible:=false;
   end;

if contextconvert_switch=true then
begin
Form_peach.mTypeBZip2.Visible:=false;
Form_peach.mTypeGZ.Visible:=false;
Form_peach.mTypeQUAD.Visible:=false;
Form_peach.mTypeSplit.Visible:=false;
Form_peach.mTypeUPX.Visible:=false;
Form_peach.mTypeXZ.Visible:=false;
end;

end;

procedure settonewfolder(i:integer);
begin
with form_peach do
begin
case i of
  0: begin
     MenuItemOpen_ExtractHere.Bitmap:=Bextractall;
     po_exthere.Bitmap:=Bextractall;
     MenuItemExtAllTo.Bitmap:=Bextractallto;
     ButtonUn7zaTo.Hint:=txt_ext_sel;
     ButtonUn7zaTo1.Hint:=txt_ext_allto+'... (Ctrl+E / F12)';
     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;
     MenuItemExtAllTo.Bitmap:=Bextractallton;
     ButtonUn7zaTo.Hint:=txt_ext_sel+' '+txt_newfolder;
     ButtonUn7zaTo1.Hint:=txt_ext_allto+'... (Ctrl+E / F12) '+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.ComboBox1.ItemIndex:=enc7zscc;
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 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 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}
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.ComboBox2.Itemindex:=work_dir;
Form_peach.ComboBoxOverwriteARC.Itemindex:=extoptarc;
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 ignorepathdd=1 then Form_peach.CheckBox5.State:=cbChecked else Form_peach.CheckBox5.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 prebrowse=1 then Form_peach.CheckBoxPrebrowse.State:=cbChecked else Form_peach.CheckBoxPrebrowse.State:=cbUnChecked;
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;
Form_peach.SpinEditPrebrowse.Value:=prebrowsesize;
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 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;
setaddconvert_menu;
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;
if algoall=1 then
   begin
   Form_peach.cbcheckall.State:=cbChecked;
   Form_peach.groupboxcheck.enabled:=false;
   end
else
   begin
   Form_peach.cbcheckall.State:=cbUnChecked;
   Form_peach.groupboxcheck.enabled:=true;
   end;
if algoadler=1 then Form_peach.cbadler.State:=cbChecked else Form_peach.cbadler.State:=cbUnChecked;
if algocrc16=1 then Form_peach.cbcrc16.State:=cbChecked else Form_peach.cbcrc16.State:=cbUnChecked;
if algocrc24=1 then Form_peach.cbcrc24.State:=cbChecked else Form_peach.cbcrc24.State:=cbUnChecked;
if algocrc32=1 then Form_peach.cbcrc32.State:=cbChecked else Form_peach.cbcrc32.State:=cbUnChecked;
if algocrc64=1 then Form_peach.cbcrc64.State:=cbChecked else Form_peach.cbcrc64.State:=cbUnChecked;
if algoed2k=1 then Form_peach.cbed2k.State:=cbChecked else Form_peach.cbed2k.State:=cbUnChecked;
if algomd4=1 then Form_peach.cbmd4.State:=cbChecked else Form_peach.cbmd4.State:=cbUnChecked;
if algomd5=1 then Form_peach.cbmd5.State:=cbChecked else Form_peach.cbmd5.State:=cbUnChecked;
if algoripemd160=1 then Form_peach.cbrmd.State:=cbChecked else Form_peach.cbrmd.State:=cbUnChecked;
if algosha1=1 then Form_peach.cbsha1.State:=cbChecked else Form_peach.cbsha1.State:=cbUnChecked;
if algosha224=1 then Form_peach.cbsha224.State:=cbChecked else Form_peach.cbsha224.State:=cbUnChecked;
if algosha256=1 then Form_peach.cbsha256.State:=cbChecked else Form_peach.cbsha256.State:=cbUnChecked;
if algosha384=1 then Form_peach.cbsha384.State:=cbChecked else Form_peach.cbsha384.State:=cbUnChecked;
if algosha512=1 then Form_peach.cbsha512.State:=cbChecked else Form_peach.cbsha512.State:=cbUnChecked;
if algowhirl=1 then Form_peach.cbwhirlpool.State:=cbChecked else Form_peach.cbwhirlpool.State:=cbUnChecked;
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.CompressionCustom1.Enabled:=true;
   end
else
   begin
   Form_peach.checkbox2.State:=cbUnChecked;
   Form_peach.CompressionCustom1.Enabled:=false;
   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:utf8string;
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
   uassigntext(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:='seven-embedded';
   theme_author:='Giorgio Tani';
   theme_license:='LGPLv3';
   graphicsfolderd:='themes\seven-embedded\';
   udodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=COL1;
   color2d:=COL2;
   color3d:=COL3;
   color4d:=COL4;
   color5d:=COL5;
   themetoolbarsd:=0;
   //rowheightd:=21;
   //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\';
   udodirseparators(graphicsfolderd);
   opacityd:=100;
   color1d:=COL1;
   color2d:=COL2;
   color3d:=COL3;
   color4d:=COL4;
   color5d:=COL5;
   themetoolbarsd:=0;
   //rowheightd:=21;
   //itemheightd:=1;
   //autosizeitemheightd:=0;
   autosizetoolbarbuttond:=0;
   end;
if upcase(theme_name)='SEVEN-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)='FIRECRYSTAL' then Form_peach.ComboBoxTheme.ItemIndex:=2
      else
         if upcase(theme_name)='SEVEN' then Form_peach.ComboBoxTheme.ItemIndex:=3
         else
            Form_peach.ComboBoxTheme.ItemIndex:=4;
end;

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

procedure save_bookmarks;
var
   i,rc:integer;
begin
try
uassigntext(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
      //writeln(book,Form_peach.StringGridBookmarks.Cells[1,i]);
      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
uassigntext(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:utf8string;
  astr,bstr,cstr,dstr:array [1..8] of utf8string;
begin
{$IFDEF MSWINDOWS}
istr:=0;
if ufileexists(winpfolder32+'Windows Defender\MSASCui.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]:='"';
   dstr[istr]:=winpfolder32+'Windows Defender\MSASCui.exe';
   end;
if ufileexists(winpfolder+'Windows Defender\MSASCui.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]:='"';
   dstr[istr]:=winpfolder+'Windows Defender\MSASCui.exe';
   end;
if ufileexists(winpfolder32+'Microsoft Security Client\msseces.exe') then
   begin
   //uses same slot as up to Windows 8 MSE disables Defender, in W8 and more recent it is not supported
   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 ufileexists(winpfolder+'Microsoft Security Client\msseces.exe') then
   begin
   //uses same slot as up to Windows 8 MSE disables Defender, in W8 and more recent it is not supported
   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;

if ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(winpfolder32+'Comodo\CCE\CCE.exe') then comodopath:=winpfolder32+'Comodo\CCE\CCE.exe';
if ufileexists(winpfolder32+'CCE\CCE.exe') then comodopath:=winpfolder32+'CCE\CCE.exe';
if ufileexists(winpfolder+'Comodo\CCE\CCE.exe') then comodopath:=winpfolder+'Comodo\CCE\CCE.exe';
if ufileexists(winpfolder+'CCE\CCE.exe') then comodopath:=winpfolder+'CCE\CCE.exe';
if ufileexists('C:\Comodo\CCE\CCE.exe') then comodopath:='C:\Comodo\CCE\CCE.exe';
if ufileexists('C:\CCE\CCE.exe') then comodopath:='C:\CCE\CCE.exe';
if ufileexists(local_desktop+'Comodo\CCE\CCE.exe') then comodopath:=local_desktop+'Comodo\CCE\CCE.exe';
if ufileexists(local_desktop+'CCE\CCE.exe') then comodopath:=local_desktop+'CCE\CCE.exe';
if ufileexists(home_path+'Comodo\CCE\CCE.exe') then comodopath:=home_path+'Comodo\CCE\CCE.exe';
if ufileexists(home_path+'CCE\CCE.exe') then comodopath:=home_path+'CCE\CCE.exe';
if ufileexists(usr_documents+'Comodo\CCE\CCE.exe') then comodopath:=usr_documents+'Comodo\CCE\CCE.exe';
if ufileexists(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 ufileexists(winpfolder32+'ESET\ESET Smart Security\ecls.exe') then esetdir:=winpfolder32+'ESET\ESET Smart Security\';
if ufileexists(winpfolder32+'ESET\ESET NOD32 Antivirus\ecls.exe') then esetdir:=winpfolder32+'ESET\ESET NOD32 Antivirus\';
if ufileexists(winpfolder+'ESET\ESET Smart Security\ecls.exe') then esetdir:=winpfolder+'ESET\ESET Smart Security\';
if ufileexists(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 ufileexists(winpfolder32+'Malwarebytes'' Anti-Malware\mbam.exe') then mbampath:=winpfolder32+'Malwarebytes'' Anti-Malware\mbam.exe';
if ufileexists(winpfolder32+'MALWAREBYTES ANTI-MALWARE\mbam.exe') then mbampath:=winpfolder32+'MALWAREBYTES ANTI-MALWARE\mbam.exe';
if ufileexists(winpfolder+'Malwarebytes'' Anti-Malware\mbam.exe') then mbampath:=winpfolder+'Malwarebytes'' Anti-Malware\mbam.exe';
if ufileexists(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 (requires UAC elevation)';
   bstr[istr]:='"'+mbampath+'" ';  //MBAM free version 2 does not yet support scripting scan
   cstr[istr]:='';
   dstr[istr]:='"'+mbampath+'"';
   end;

if ufileexists(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 ufileexists(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 ufileexists(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 ufileexists(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;

//AdAware Command Line Scan lack GUI option and change location with version name
//Bitdefender currently (2014) non supporting scan from cmd
{possible free online services:
antimalware
http://www.virustotal.com/
http://www.pandasecurity.com/homeusers/solutions/activescan/
http://onlinescan.avast.com/
http://www.eset.com/us/online-scanner/
http://housecall.trendmicro.com/
http://www.bitdefender.com/scanner/online/free.html
url scan
http://www.google.com/safebrowsing/diagnostic?site=
http://www.webutation.net/go/review/
http://www.urlvoid.com/
http://www.avg.com.au/resources/web-page-scanner/
http://www.mcafee.com/threat-intelligence/domain/default.aspx?domain=}
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: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;
wingetappdatafolder;
StringGridCustedit.Cells[1,1]:='Google';
custedit1:='http://www.google.com/search?q=';
StringGridCustedit.Cells[1,2]:='Notepad';
custedit2:='notepad.exe';
{StringGridCustedit.Cells[1,2]:='Wordpad';
custedit2:='wordpad.exe';}
StringGridCustedit.Cells[1,3]:='Windows Media Player';
custedit3:='wmplayer.exe';
if ufileexists(winpfolder+'VideoLAN\VLC\vlc.exe') then
   begin
   StringGridCustedit.Cells[1,4]:='VLC Media Player';
   custedit4:=winpfolder+'VideoLAN\VLC\vlc.exe';
   end
else
   if ufileexists(winpfolder+'Winamp\winamp.exe') then
      begin
      StringGridCustedit.Cells[1,4]:='Winamp';
      custedit6:=winpfolder+'Winamp\winamp.exe';
      end;
StringGridCustedit.Cells[1,5]:='Internet Explorer';
custedit5:='iexplore.exe';
if ufileexists(winpfolder+'Mozilla Firefox\firefox.exe') then
   begin
   StringGridCustedit.Cells[1,6]:='Mozilla Firefox';
   custedit6:=winpfolder+'Mozilla Firefox\firefox.exe';
   end;
if ufileexists(uextractfilepath(envtoutf8(GetEnvironmentVariable('APPDATA')))+'Local\Google\Chrome\Application\chrome.exe') then
   begin
   StringGridCustedit.Cells[1,7]:='Chrome';
   custedit7:=uextractfilepath(envtoutf8(GetEnvironmentVariable('APPDATA')))+'Local\Google\Chrome\Application\chrome.exe';
   end;
if ufileexists(winpfolder+'Opera\opera.exe') then
   begin
   StringGridCustedit.Cells[1,8]:='Opera';
   custedit8:=winpfolder+'Opera\opera.exe';
   end;
if ufileexists(winpfolder+'FastStone Image Viewer\FSViewer.exe') then
   begin
   StringGridCustedit.Cells[1,9]:='FastStone Image Viewer';
   custedit9:=winpfolder+'FastStone Image Viewer\FSViewer.exe';
   end
else
   if ufileexists(winpfolder+'Google\Picasa3\Picasa3.exe') then
      begin
      StringGridCustedit.Cells[1,9]:='Picasa';
      custedit9:=winpfolder+'Google\Picasa3\Picasa3.exe';
      end
   else
      if ufileexists(winpfolder+'IrfanView\i_view32.exe') then
         begin
         StringGridCustedit.Cells[1,9]:='IrfanView';
         custedit9:=winpfolder+'IrfanView\i_view32.exe';
         end;
if ufileexists(winpfolder+'Paint.NET\PaintDotNet.exe') then
   begin
   StringGridCustedit.Cells[1,10]:='Paint.NET';
   custedit10:=winpfolder+'Paint.NET\PaintDotNet.exe';
   end
else
   begin
   StringGridCustedit.Cells[1,10]:='MS Paint';
   custedit10:='mspaint.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:utf8string);
var
   sbuf:array [1..32767] of byte;
   i,t,n,nsel,rc:integer;
   k,f_size:qword;
   indir,s,strsel:utf8string;
   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;
   SHA224Context:THashContext;
   SHA224Digest:TSHA224Digest;
   SHA256Context:THashContext;
   SHA256Digest:TSHA256Digest;
   SHA384Context:THashContext;
   SHA384Digest:TSHA384Digest;
   SHA512Context:THashContext;
   SHA512Digest:TSHA512Digest;
   WhirlContext:THashContext;
   WhirlDigest:TWhirlDigest;
   f:file of byte;
begin
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;
indir:=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) 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;
         filemode:=0;
         try
         uassignfile(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: SHA224Init(SHA224Context);
           12: SHA256Init(SHA256Context);
           13: SHA384Init(SHA384Context);
           14: SHA512Init(SHA512Context);
           15: 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: SHA224Update(SHA224Context,@sbuf,n);
                 12: SHA256Update(SHA256Context,@sbuf,n);
                 13: SHA384Update(SHA384Context,@sbuf,n);
                 14: SHA512Update(SHA512Context,@sbuf,n);
                 15: Whirl_Update(WhirlContext,@sbuf,n);
                  end;
               Application.ProcessMessages;
               if (indir<>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: SHA224Final(SHA224Context,SHA224Digest);
           12: SHA256Final(SHA256Context,SHA256Digest);
           13: SHA384Final(SHA384Context,SHA384Digest);
           14: SHA512Final(SHA512Context,SHA512Digest);
           15: 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(@SHA224Digest,sizeof(SHA224Digest)));
           12: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           13: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA384Digest,sizeof(SHA384Digest)));
           14: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           15: 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:utf8string):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 checkduplicates:integer;
var
   i,j:integer;
   duplicate:boolean;
   s:utf8string;
begin
result:=0;
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;
end;

//procedure to deduplicate files, mode displayed: all in current folder / search filter; selected: all selected
procedure deduplicate(mode:utf8string);
var
   sbuf:array [1..32767] of byte;
   dup,i,n,t,rc,nsel:integer;
   k,f_size:qword;
   indir,s,strsel:utf8string;
   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;
   SHA224Context:THashContext;
   SHA224Digest:TSHA224Digest;
   SHA256Context:THashContext;
   SHA256Digest:TSHA256Digest;
   SHA384Context:THashContext;
   SHA384Digest:TSHA384Digest;
   SHA512Context:THashContext;
   SHA512Digest:TSHA512Digest;
   WhirlContext:THashContext;
   WhirlDigest:TWhirlDigest;
   f:file of byte;
begin
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;
indir:=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[12,i]='1' then
      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
         uassignfile(f,Form_peach.StringGridList.Cells[8,i]);
         filemode:=0;
         reset(f);
         except
         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: SHA224Init(SHA224Context);
           12: SHA256Init(SHA256Context);
           13: SHA384Init(SHA384Context);
           14: SHA512Init(SHA512Context);
           15: 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: SHA224Update(SHA224Context,@sbuf,n);
                 12: SHA256Update(SHA256Context,@sbuf,n);
                 13: SHA384Update(SHA384Context,@sbuf,n);
                 14: SHA512Update(SHA512Context,@sbuf,n);
                 15: Whirl_Update(WhirlContext,@sbuf,n);
                  end;
               Application.ProcessMessages;
               if (indir<>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: SHA224Final(SHA224Context,SHA224Digest);
           12: SHA256Final(SHA256Context,SHA256Digest);
           13: SHA384Final(SHA384Context,SHA384Digest);
           14: SHA512Final(SHA512Context,SHA512Digest);
           15: 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(@SHA224Digest,sizeof(SHA224Digest)));
           12: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA256Digest,sizeof(SHA256Digest)));
           13: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA384Digest,sizeof(SHA384Digest)));
           14: Form_peach.StringGridList.Cells[7,i]:=upcase(hexstr(@SHA512Digest,sizeof(SHA512Digest)));
           15: 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+' '+s+'...';
   dup:=checkduplicates;
   exit_busy_status;
   Form_peach.Caption:=s;
   //update_listview;
   if dup=0 then MessageDlg(inttostr(dup)+' '+txt_4_1_duplicatesfound, mtInformation, [mbOK], 0)
   else MessageDlg(inttostr(dup)+' '+txt_4_1_duplicatesfound+'; '+txt_4_1_duplicateshint, mtInformation, [mbOK], 0);
   end;
end;

procedure autobookmarks;
var
   s:utf8string;
begin
try
uassigntext(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:utf8string):utf8string;
var s1:utf8string;
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 uextractfilename(s1)<>'' then s1:=uextractfilename(s1);
   end;
result:=s1;
end;

procedure load_bookmarks;
var
   s:utf8string;
   rc,i:integer;
begin
try
uassigntext(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:utf8string;
begin
if ufileexists(confpath+'custedit.txt')=false then
   begin
   reset_custedit;
   exit;
   end;
try
uassigntext(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
      uassigntext(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;
   //rowheight:=rowheightd;
   //itemheight:=itemheightd;
   //autosizeitemheight:=autosizeitemheightd;
   autosizetoolbarbutton:=autosizetoolbarbuttond;
   imgloaded:=false;
   apply_theme;
   try
      CloseFile(conf);
   except
   end;
end;

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

procedure clearstopsequencefile;
begin
if ufileexists(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:utf8string;

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:=local_desktop;
end;

procedure writeerror_file;
begin
try
uassigntext(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;
uassigntext(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:utf8string;
begin
result:=-1;
uassigntext(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);
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:utf8string;
begin
result:=-1;
try
   uassigntext(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:=envtoutf8(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(udirectoryexists(confpath)) then uforcedirectories(confpath);
confpath:=uexpandfilename(confpath);
if confpath<>'' then if confpath[length(confpath)]<>directoryseparator then confpath:=confpath+directoryseparator;
if not(udirectoryexists(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 (wparamstr(1)='-peazipreset') or (wparamstr(1)='-peaziptotalreset') then //eliminate issues that may not allow even to read configuration file
   begin
   uassigntext(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 ufileexists(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 configurationand 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 ufileexists(GetTempDir+'peazip-reset.txt') then udeletefile(GetTempDir+'peazip-reset.txt');
   end;
//load theme
s:=uextractfilepath(theme_path);
if s<>'' then setlength(s,length(s)-1);
theme_name:=uextractfilename(s);
if theme_name<>'seven-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:utf8string); //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:utf8string);
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.BevelTitleAddAdv3.Visible:=false;
if archive_type='7z' then
   begin
   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.BevelTitleAddAdv3.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:=15;
      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.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:=15;
      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.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:=15;
      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.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.BevelTitleAddAdv3.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:=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;
      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:=15;
      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.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;
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:utf8string; t:utf8string; i:integer); //suggest output name, without extension (if applicable)
var
   str,pname,aname,bname,f_ext:utf8string;
   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:=uextractfilepath(Form_peach.StringGrid1.Cells[8,i]);
         if str[length(str)]=directoryseparator then setlength(str,length(str)-1);
         pname:=uextractfilename(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:=uextractfileext(aname);
   cutextension(aname); //aname has the extension cut
   bname:=aname+f_ext; //bname has extension
   if udirectoryexists(str) then s:=bname //never cut after last dot for directories
   else s:=aname; //else cut extension by default
   //exceptions:
   if t=txt_split then s:=bname; //full name if using split, to have filename.ext.001
   if t=STR_BZIP2 then s:=bname; //full name if using Bzip2, since otherwhise bz2 format will not store original filename
   if t=STR_QUAD then s:=bname; //full name if using QUAD/BALZ/BCM, 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 uextractfilename(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:utf8string; sg:TStringGrid):integer; //test if an object is jet listed in the stringgrid
var
   i:integer;
begin
testname:=1;
if checkfiledirname(name)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+name, mtWarning, [mbOK], 0); 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
for i:=1 to sg.Rowcount-1 do
   sg.Cells[11,i]:='0';
end;

procedure addfilestr(sg:TStringGrid; filename:utf8string);
var
   fsize:qword;
   s:utf8string;
   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]:=uextractfilename(filename);
   sg.Cells[2,rc-1]:=uextractfileext(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(ufileage(filename)));
   dword2decodedFileAttributes(ufilegetattr(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]:=uextractfilename(filename);
   sg.Cells[2,rc-1]:=uextractfileext(filename);
   sg.Cells[3,rc-1]:=nicenumber(inttostr(fsize));
   sg.Cells[4,rc-1]:='';
   sg.Cells[5,rc-1]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(ufileage(filename)));
   dword2decodedFileAttributes(ufilegetattr(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:utf8string);
var
   r:TSearchRec;
   s:utf8string;
   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]:=uextractfilename(foldername);
if (uextractfilename(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 uFindFirst(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.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:utf8string):utf8string;
begin
if Form_peach.CheckBoxTarBefore.State=cbChecked then
   if uextractfileext(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.Visible=true) 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:=clWindow;
end;

procedure checkoutpath_extract;
begin
if form_peach.visible=true then
   if pos(STR_TMP,Form_peach.EditOpenOut.Text)<>0 then
      Form_peach.EditOpenOut.Color:=StringToColor(COLLOW)
   else
      Form_peach.EditOpenOut.Color:=clWindow;
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,cl,jobcode,outname:utf8string;
   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=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,archive_type,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;
   cl,jobcode,outname:utf8string;
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:=statuss;
   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';
//importjobcl_extract(cl,jobcode,outname);
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:utf8string; 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:utf8string; 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.OpenDialogList.Files[i], mtWarning, [mbOK], 0); exit; end;
            addfilestr(Form_peach.StringGrid2,Form_peach.OpenDialogList.Files[i]);
            end;
         end;
      updatecontent_ext;
      Form_peach.StringGrid2.Cursor:=crDefault;
      end;
end;

procedure addfolder;
var
   s:utf8string;
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:utf8string;
   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 ufilegetattr(in_param[i]) > 0 then
                        if ufilegetattr(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 ufilegetattr(in_param[i]) > 0 then
                        if ufilegetattr(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
      //MessageDlg(txt_archive_noinput_tolist, mtWarning, [mbOK], 0);
      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
      MessageDlg(txt_2_7_noinput, mtWarning, [mbOK], 0);
      exit;
      end;
check_extraction_input:=0;
end;

procedure savelist(sg:TStringGrid);
var
   x:dword;
   tname:utf8string;
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;
uassigntext(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 on_CheckBoxArchive6_click;
begin
{with Form_peach do
begin
if CheckBoxArchive6.State=cbChecked then
   begin
   ComboBoxArchive1.ItemIndex:=0;
   ComboBoxArchive1.Enabled:=false;
   SpinEditArchive1.Visible:=false;
   ComboBoxArchive2.Visible:=false;
   RadioGroupArchive.Visible:=true;
   CheckBoxArchive4.enabled:=true;
   end
else
   begin
   ComboBoxArchive1.Enabled:=true;
   RadioGroupArchive.Visible:=false;
   end;
change_imagesplit;
end;}
end;

procedure setpwicons;
var
   s:utf8string;
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 (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:='';
      Form_peach.ImagePassword1.Visible:=true;
      end;
   Form_peach.ImagePassword2.Caption:=txt_2_7_setpw;
   Form_peach.Shape3.Color:=clWindow;
   Form_peach.Shape4.Color:=clWindow;
   Form_peach.Shape3.Height:=0;
   Form_peach.Shape4.Height:=0;
   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 (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;
      Form_peach.Shape3.Color:=clWindow;
      Form_peach.Shape3.Height:=0;
      end
   else
      begin
      Form_peach.ImagePassword1.Caption:=txt_2_7_setpw;
      Form_peach.ImagePassword1.Hint:='';
      Form_peach.ImagePassword1.Visible:=true;
      Form_peach.Shape3.Color:=FormPW.Shape1.Color;
      Form_peach.Shape3.Height:=BARH;
      end;
   Form_peach.ImagePassword2.Caption:=txt_2_7_setpw;//txt_2_7_pwextset;
   Form_peach.Shape4.Color:=FormPW.Shape1.Color;
   Form_peach.Shape4.Height:=BARH;
   end;
except
end;
end;

procedure setquickcompset(s:utf8string);
var
   i:integer;
begin
Form_peach.ComboBoxArchive9.Clear;
if (s<>'7Z') and (s<>'ARC') 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;
end;

procedure archive_type_select(s:utf8string);
var
   i:integer;
   s1,s2,fnm:utf8string;
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.PanelUPX.Visible:=false;
Form_peach.cbadvf1.Enabled:=false;
subfun:='';
disable_twofactor:=false;
{FormPW.ButtonEditName4.enabled:=true;
FormPW.EditName3.enabled:=true;
FormPW.ButtonEditName3.enabled:=true;}
Form_peach.ComboBoxArchive1.ItemIndex:=0;//reset to single volume by default
ComboBoxArchive1_onchange;
Form_peach.CheckBoxSeparate.Enabled:=true;
Form_peach.CheckBoxSameArc.Enabled:=true;
Form_peach.CheckBoxDate.Enabled:=true;
Form_peach.CheckBoxDeleteInput1.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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+compression_level+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=true;
   Form_peach.CheckBoxArchive6.State:=cbUnchecked;
   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;
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboboxARC2.Text;
   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;
   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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=false;
   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;
   Form_peach.Caption:=txt_custom;
   //Form_peach.CheckBoxTarBefore.Enabled:=false; TAR before is enabled, but is not autochecked because it is not know if the custom program will be an archiver or single file compressor; the decision is let to the user
   //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:=true;
   Form_peach.EditNameCustom.Caption:=Form_peach.pcustom1.caption;
   s1:=uextractfilename(Form_peach.pcustom1.caption);
   cutextension(s1);
   Form_peach.EditExtCustom.Caption:=s1;
   Form_peach.CheckBoxArchive4.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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=false;
   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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=false;
   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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=false;
   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;
   Form_peach.Caption:=txt_create+' .'+archive_type;
   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;
   end;
if s=STR_PEA then
   begin
   Form_peach.PanelPea.Visible:=true;
   Form_peach.ComboBoxPeaCompression1.ItemIndex:=pcompr;
   Form_peach.ComboBoxPea2.ItemIndex:=pstream;
   if pstream<3 then Form_peach.CheckBoxPeaEncryption.State:=cbChecked
   else Form_peach.CheckBoxPeaEncryption.State:=cbUnchecked;
   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;
   Form_peach.Caption:=txt_create+' .pea';
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   Form_peach.CheckBoxTarBefore.State:=cbUnchecked;
   Form_peach.CheckBoxConvert.Enabled:=true;
   Form_peach.CheckBoxArchive4.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;
   Form_peach.Caption:=txt_create+' .'+archive_type;
   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;
   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;
   {FormPW.ButtonEditName4.enabled:=false;
   FormPW.EditName3.enabled:=false;
   FormPW.ButtonEditName3.enabled:=false;}
   //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_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);
   Form_peach.Caption:=txt_create+' '+txt_sfx+' ('+STR_7Z+') | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=true;
   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;
   //on_CheckBoxArchive6_click;
   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;
   {FormPW.ButtonEditName4.enabled:=false;
   FormPW.EditName3.enabled:=false;
   FormPW.ButtonEditName3.enabled:=false;}
   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;
   Form_peach.Caption:=txt_create+' '+txt_sfx+' ('+STR_ARC+') | '+Form_peach.ComboboxARC2.Text;
   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;
   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;
   Form_peach.Caption:=txt_split;
   Form_peach.CheckBoxTarBefore.Enabled:=true;
   check_tarbefore(tdirs);
   Form_peach.ComboBoxArchive1.ItemIndex:=1;
   ComboBoxArchive1_onchange;
   Form_peach.CheckBoxArchive4.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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=false;
   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.CheckBoxDate.Enabled:=false;
   Form_peach.CheckBoxDeleteInput1.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;
   Form_peach.Caption:=txt_compress_executable;
   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.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   Form_peach.CheckBoxArchive4.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);
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
   Form_peach.CheckBoxArchive6.Visible:=false;
   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.Visible) and (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;
//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:=uextractfilename(fnm);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(fnm);
//Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
setpwicons;
setquickcompset(fun);
end;

procedure testarctype(s:utf8string; var i:integer; var fun:utf8string);
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';
   1000: fun:='FILEBROWSER';
   end;
fun_status:=fun;
end;

procedure set_lastobjarch;
var
   i:integer;
   lastobjfound:boolean;
begin
lastobjfound:=false;
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:utf8string;
  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
      s:=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:utf8string;
  i,rc:integer;
begin
rc:=Form_peach.StringGridList.Rowcount;
if rc>1 then
   for i:=1 to rc-1 do
      begin
      s:=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_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:utf8string);
//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:utf8string);
//optionally replace characters over ASCII 126 (~) with ? wildcard to avoid issues in translation of extended characters;
//otherwise, displays characters as utf-8; on Windows characters comes encoded in console's codepage (to memory stream reading backend stdout)
var
   i:integer;
begin
{$IFDEF MSWINDOWS}
convertwincp(s);
{$ENDIF}
if archivenameenc=0 then
   for i:=1 to length(s) do
      begin
      if comparestr(s[i],'~')>0 then s[i]:='?';
      end;
end;

procedure list_l(mode:utf8string); //special formats through 7z
var
   i,k:integer;
   size,csize,rsize:qword;
   s:utf8string;
begin
if (mode='browse') or (mode='flat') or (mode='silent') 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]:=uextractfilename(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'+Form_peach.StringGridList.Cells[1,k];
         end
      else
         begin
         Form_peach.StringGridList.Cells[2,k]:=uextractfileext(Form_peach.StringGridList.Cells[1,k]);
         Form_peach.StringGridList.Cells[8,k]:=s;
         Form_peach.StringGridList.Cells[9,k]:='2'+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;
      //Form_peach.StringGridList.Cells[12,1]:='1';
      //Form_peach.StringGridList.Row:=1;
      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:=32 * 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;
end;

function identify_field(s:utf8string):utf8string;
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:utf8string; var ipos:integer):utf8string;
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
   status2:=currentcomp+', '+txt_encrypted;
   end;
end;

procedure find_7z_titles;
var
   i:integer;
   s1:utf8string;
begin
i:=0;
repeat
   s1:=Form_peach.MemoList.Lines[i];
   i:=i+1;
until s1=ZSTRING;
title_lines_7z:=i+1; //dinamically find title and comment lines
end;

procedure find_rar5_titles;
var
   i:integer;
   s1:utf8string;
begin
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;
title_lines_7z:=i+1; //dinamically find title and comment lines
end;

procedure find_7zl_titles;
var
   i:integer;
   s1:utf8string;
begin
i:=0;
repeat
   s1:=Form_peach.MemoList.Lines[i];
   i:=i+1;
until s1=ZSTRINGL;
title_lines_7z:=i; //dinamically find title and comment lines
end;

procedure list_slt(mode:utf8string);
var
   i,j,k,nfiles,nfolders:integer;
   size,csize,rsize:qword;
   s1,s2,s3:utf8string;
   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;
//if Form_peach.visible=true then Application.Processmessages;
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(s1);
      case s2 of
         'Path':
         begin
         s3:=copy(s1,8,length(s1)-7);
         tempcharcodefix(s3);
         Form_peach.StringGridList.Cells[1,j]:=uextractfilename(s3);
         Form_peach.StringGridList.Cells[2,j]:=uextractfileext(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'+uextractfilename(s3);
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=uextractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+uextractfilename(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[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;
         '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);
         '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'+uextractfilename(s3);
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=uextractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+uextractfilename(s3);
            end;
         end;
         'Encrypted':
         if copy(s1,length(s1),1)=ZCHAR then
            begin
            Form_peach.StringGridList.Cells[1,j]:=uextractfilename(s3)+' *';
            seemencrypted:=true;
            set_pw;
            end;
         'Method':
         if pos('AES',s1)<>0 then
            begin
            Form_peach.StringGridList.Cells[1,j]:=uextractfilename(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:=32 * 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 list_rar5(mode:utf8string);
var
   i,j,k,nfiles,nfolders,ipos:integer;
   size,csize,rsize:qword;
   s1,s2,s3,rar5str:utf8string;
   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;
//if Form_peach.visible=true then Application.Processmessages;
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]:=uextractfilename(s3);
         Form_peach.StringGridList.Cells[2,j]:=uextractfileext(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'+uextractfilename(s3);
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=uextractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+uextractfilename(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'+uextractfilename(s3);
            end
         else
            begin
            Form_peach.StringGridList.Cells[2,j]:=uextractfileext(s3);
            Form_peach.StringGridList.Cells[9,j]:='2'+uextractfilename(s3);
            end;
         end;
         'Flags':
         if pos('encrypted',rar5str)<>0 then
            begin
            Form_peach.StringGridList.Cells[1,j]:=uextractfilename(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:=32 * 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:utf8string);
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;
Form_peach.imageaddress.PopupMenu:=nil;
refreshstatus:=1;
pcount:=1;
browserbusy:=true;
end;

procedure exit_busy_status;
begin
browserbusy:=false;
Form_peach.ProgressBar2.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_fefreshf5;
Form_peach.imageaddress.PopupMenu:=Form_peach.pmquick;
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;
Form_peach.imageaddress.PopupMenu:=nil;
refreshstatus:=1;
pcount:=1;
browserbusy_minor:=true;
end;

procedure exit_busy_minor_status;
begin
browserbusy_minor:=false;
Form_peach.ProgressBar2.Visible:=false;
Form_peach.ListView1.PopupMenu:=Form_peach.PopupOpen;
Form_peach.ListView1.Cursor:=crDefault;
Form_peach.ImageListSearch.Picture.Bitmap:=Bsearch;
Form_peach.imageaddress.PopupMenu:=Form_peach.pmquick;
refreshstatus:=0;
end;

function execute_cl(cl,mode:utf8string):integer;
var
  P: tprocessutf8;
  i,BytesRead:integer;
  skipped_prebrowse:boolean;
  M:TmemoryStream;
begin
execute_cl:=-1;
zaout:=zaout1;
if cl='' then
   begin
   MessageDlg(txt_error_emptycl, mtError, [mbOK], 0);
   exit_nosave;
   end;
enter_busy_status;
if Form_peach.Visible=true then Application.ProcessMessages;
skipped_prebrowse:=false;
i:=0;
P:=tprocessutf8.Create(nil);
cl:=utf8toenv(cl); //on Windows it is passed to command line as ansi
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 MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
while P.Running do
   begin
   M.SetSize(BytesRead + MAX_CL);
   if prebrowse=1 then
      begin
      if M.Size>(prebrowsesize*1024*1024) then //limit memorystream size to 1M*prebrowsesize blocks
         begin
         if mode<>'silent' then MessageDlg(txt_aborted_error, mtError, [mbOK], 0);
         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)^, MAX_CL);
   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 + MAX_CL);
      i := P.Output.Read((M.Memory + BytesRead)^, MAX_CL);
      if i > 0 then Inc(BytesRead, i)
      else Sleep(100);
   until i <= 0;
M.SetSize(BytesRead);
execute_cl:=P.ExitStatus;
P.Free;
if ugetcurrentdir<>executable_path then usetcurrentdir((executable_path));
if mode='preview' then uFileSetAttr(ptmpdir, faHidden);
if (mode='extandrun') or (mode='delete') or (mode='add')  or (mode='preview') then
   begin
   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;
   if Form_peach.MemoList.Lines.Count<i then //no matches
      begin
      status1:=txt_list_nomatch;
      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:=uextractfilepath(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 exit;
   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:=uextractfilepath(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 openw_obj(outname:utf8string):integer;
var
   s:utf8string;
   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 MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
woutname:=utf8decode(outname);
wtempstring:=utf8decode(tempstring);
if validatecl(s)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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:utf8string; desk_env:byte):integer;
var
   w:widestring;
   //P:tprocessutf8;
begin
cp_open:=-1;
if s='' then exit;
if validatecl(s)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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);
{P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
if w[1]=utf8decode(delimiter) then
else w:=utf8encode(delimiter)+w+utf8encode(delimiter);
if winver<>'9x' then P.CommandLine:=wincomspec+' /c start "" '+w
else P.CommandLine:=wincomspec+' /c start '+w;
if Form_peach.Visible=true then Application.ProcessMessages;
P.Execute;
P.Free;
cp_open:=0;}
{$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:utf8string):integer;
var
  mri,i:integer;
  P: tprocessutf8;
  cl,bin_name,s:utf8string;
  woutname,wtempstring:widestring;
begin
execute_obj:=-1;
if checkfiledirname(outname)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+outname, mtWarning, [mbOK], 0); 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
      udodirseparators(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);
         udodirseparators(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;
         cl:=utf8toenv(cl);
         P.CommandLine:=cl;
         if Form_peach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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
      udodirseparators(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
         udodirseparators(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
            udodirseparators(tempstring);
            mri:=MessageDlg(txt_dis+' '+tempstring+' '+txt_type_exe, mtWarning,[mbYes, mbNo, mbCancel],0);
            if mri=6 then
               begin
               P.Free;
               udodirseparators(tempstring);
               woutname:=utf8decode(outname);
               wtempstring:=utf8decode(tempstring);
               s:=outname+tempstring;
               if validatecl(s)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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;
         udodirseparators(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;
         cl:=utf8toenv(cl);
         P.CommandLine:=cl;
         if Form_peach.Visible=true then Application.ProcessMessages;
         if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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
      udodirseparators(tempstring);
      i:=cp_open(outname+tempstring,desk_env);
      execute_obj:=0;
      tempstring:='';
      end;
   end;
end;

function extract_excludes:utf8string;
var
   i:integer;
   s:utf8string;
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:utf8string;
var
   i:integer;
   s:utf8string;
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:utf8string;
var
   i:integer;
   s:utf8string;
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:utf8string;
var
   i:integer;
   s:utf8string;
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:utf8string);
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:utf8string);
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:utf8string);
var
   s1,s2:utf8string;
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"
{if (simplesearch=1) and (issearching<>0) then s2:='*'+Form_peach.EditUn7zaFilter.Text //simple search not fit for being used in archives (internal directory structure is applied as filter)
else} 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:utf8string);
var
   s1,s2:utf8string;
begin
s1:=Form_peach.EditUn7zaFilterExclude.Text;
if pos('*\*',s1)<>0 then s1:=copy(s1,1,pos('*\*',s1)-2);
s2:=Form_peach.EditUn7zaFilter.Text;
if Form_peach.EditUn7zaFilterExclude.Text<>'' then cl:=cl+' '+delimiter+'-x'+escapefilename(s1,desk_env)+'\**\**\'+delimiter+' '+delimiter+'-x'+escapefilename(s1,desk_env)+'\**\*'+delimiter;
if Form_peach.EditUn7zaFilter.Text<>'' then cl:=cl+' -- '+delimiter+escapefilename(s2,desk_env)+delimiter;
end;

procedure reportnotsupported(sfo:utf8string);
var
   s:utf8string;
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;
MessageDlg(s, mtInformation,[mbOK],0);
Form_peach.Visible:=false;
saverestartclosepeaapp;
end;

procedure reportnotsupported_info(sfo:utf8string);
var
   s:utf8string;
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;
MessageDlg(s, mtInformation,[mbOK],0);
end;

function testifrar5(s:utf8string):integer; //test RAR5 special case
var
   ext:utf8string;
   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:=uextractfileext(s);
if upcase(ext)='.RAR' then
   try
   uassignfile(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 ufileexists(executable_path+'res'+DirectorySeparator+'unrar'+DirectorySeparator+UNRARNAME+EXEEXT) then
   else
   begin
   result:=0;
   if unrar5shown=false then
      begin
      MessageDlg('PeaZip UNRAR5 '+txt_5_7_plugin, mtInformation,[mbOK],0);
      unrar5shown:=true;
      end;
   end;
end;

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

function list_un7z_do(mode:utf8string):integer;
var
   cl,in_param,bin_name,exe_name,pw:utf8string;
begin
in_param:=delimiter+escapefilename(usetfsname(Form_peach.EditOpenIn.Text),desk_env)+delimiter;
if fun='UN7Z' then exe_name:='7z';
bin_name:=delimiter+escapefilename(usetfsname(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
      MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
      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+' '+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:utf8string):integer;
var
   cl,in_param,bin_name,exe_name,pw:utf8string;
begin
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
      MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
      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.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.pmabc1.Caption:='';
Form_peach.pmabc2.Caption:='';
Form_peach.pmabc3.Caption:='';
Form_peach.pmabc4.Caption:='';
Form_peach.pmabc5.Caption:='';
Form_peach.pmabc6.Caption:='';
Form_peach.pmabc7.Caption:='';
Form_peach.pmabc8.Caption:='';
Form_peach.pmabc1.Visible:=false;
Form_peach.pmabc2.Visible:=false;
Form_peach.pmabc3.Visible:=false;
Form_peach.pmabc4.Visible:=false;
Form_peach.pmabc5.Visible:=false;
Form_peach.pmabc6.Visible:=false;
Form_peach.pmabc7.Visible:=false;
Form_peach.pmabc8.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:='';
end;

procedure generate_archive_breadcrumb;
var
  Str: TStringList;
  i, j, sc: integer;
  s: array [1..8] of utf8string;
  ars: array [1..4] of utf8string;
  abcs: array [1..4] of utf8string;
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 8 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];
      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.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;

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.pmabc1.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc2.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc3.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc4.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc5.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc6.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc7.Bitmap:=Form_peach.abc1.Bitmap;
Form_peach.pmabc8.Bitmap:=Form_peach.abc1.Bitmap;
if s[8]<>'' then Form_peach.abc1.Caption:=s[8]+'*';
if s[7]<>'' then Form_peach.abc2.Caption:=s[7]+'*';
if s[6]<>'' then Form_peach.abc3.Caption:=s[6]+'*';
if s[5]<>'' then Form_peach.abc4.Caption:=s[5]+'*';
if s[4]<>'' then Form_peach.abc5.Caption:=s[4]+'*';
if s[3]<>'' then Form_peach.abc6.Caption:=s[3]+'*';
if s[2]<>'' then Form_peach.abc7.Caption:=s[2]+'*';
if s[1]<>'' then Form_peach.abc8.Caption:=s[1]+'*';
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 s[8]<>'' then Form_peach.pmabc1.Caption:=s[8]+'*';
if s[7]<>'' then Form_peach.pmabc2.Caption:=s[7]+'*';
if s[6]<>'' then Form_peach.pmabc3.Caption:=s[6]+'*';
if s[5]<>'' then Form_peach.pmabc4.Caption:=s[5]+'*';
if s[4]<>'' then Form_peach.pmabc5.Caption:=s[4]+'*';
if s[3]<>'' then Form_peach.pmabc6.Caption:=s[3]+'*';
if s[2]<>'' then Form_peach.pmabc7.Caption:=s[2]+'*';
if s[1]<>'' then Form_peach.pmabc8.Caption:=s[1]+'*';
if Form_peach.pmabc1.Caption='' then Form_peach.pmabc1.Visible:=false else Form_peach.pmabc1.Visible:=true;
if Form_peach.pmabc2.Caption='' then Form_peach.pmabc2.Visible:=false else Form_peach.pmabc2.Visible:=true;
if Form_peach.pmabc3.Caption='' then Form_peach.pmabc3.Visible:=false else Form_peach.pmabc3.Visible:=true;
if Form_peach.pmabc4.Caption='' then Form_peach.pmabc4.Visible:=false else Form_peach.pmabc4.Visible:=true;
if Form_peach.pmabc5.Caption='' then Form_peach.pmabc5.Visible:=false else Form_peach.pmabc5.Visible:=true;
if Form_peach.pmabc6.Caption='' then Form_peach.pmabc6.Visible:=false else Form_peach.pmabc6.Visible:=true;
if Form_peach.pmabc7.Caption='' then Form_peach.pmabc7.Visible:=false else Form_peach.pmabc7.Visible:=true;
if Form_peach.pmabc8.Caption='' then Form_peach.pmabc8.Visible:=false else Form_peach.pmabc8.Visible:=true;
end;

function list_un7z(mode:utf8string):integer;
var
   cl,in_param,bin_name,exe_name,pw:utf8string;
begin
if libre_directive=2 then if testifrar(Form_peach.EditOpenIn.Text)=1 then reportnotsupported('RAR');
if libre_directive=1 then list_un7z_do(mode)
else
   if testifrar5(Form_peach.EditOpenIn.Text)=1 then list_unrar5_do(mode)
   else result:=list_un7z_do(mode);
generate_archive_breadcrumb;
end;

procedure addtohistorypopup;
var
   s:utf8string;
   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:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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: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;
{$IFDEF MSWINDOWS}
{$ELSE}
{$ENDIF}
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:utf8string;
   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:=16;
   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;
{$IFDEF MSWINDOWS}
if length(s) = 3 then
   begin
   i:=ord(s[1])-64;
   result:=getpcmenuicon(devicon[i]);
   exit;
   end;
{$ENDIF}
if s[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=uextractfileext(s);
if sg.Cells[1,arow]<>'' then
   result:=geticon(s,fulltype,false);
end;
end;

function getshelltreeicon_frompath(s:utf8string):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:=16;
   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;
{$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:integer;
   s,s1:utf8string;
begin
with Form_peach do
begin
mb1.visible:=false;
mb2.visible:=false;
mb3.visible:=false;
mb4.visible:=false;
mb5.visible:=false;
mb6.visible:=false;
mb7.visible:=false;
mb8.visible:=false;
mb9.visible:=false;
mb10.visible:=false;
mb11.visible:=false;
mb12.visible:=false;
mb13.visible:=false;
mb14.visible:=false;
mb15.visible:=false;
mb16.visible:=false;
mb17.visible:=false;
mb18.visible:=false;
mb19.visible:=false;
mb20.visible:=false;
mb21.visible:=false;
mb22.visible:=false;
mb23.visible:=false;
pnb1.visible:=false;
pnb2.visible:=false;
pnb3.visible:=false;
pnb4.visible:=false;
pnb5.visible:=false;
pnb6.visible:=false;
pnb7.visible:=false;
pnb8.visible:=false;
pnb9.visible:=false;
pnb10.visible:=false;
pnb11.visible:=false;
pnb12.visible:=false;
pnb13.visible:=false;
pnb14.visible:=false;
pnb15.visible:=false;
pnb16.visible:=false;
pnb17.visible:=false;
pnb18.visible:=false;
pnb19.visible:=false;
pnb20.visible:=false;
pnb21.visible:=false;
pnb22.visible:=false;
pnb23.visible:=false;
pnba1.visible:=false;
pnba2.visible:=false;
pnba3.visible:=false;
pnba4.visible:=false;
pnba5.visible:=false;
pnba6.visible:=false;
pnba7.visible:=false;
pnba8.visible:=false;
pnba9.visible:=false;
pnba10.visible:=false;
pnba11.visible:=false;
pnba12.visible:=false;
pnba13.visible:=false;
pnba14.visible:=false;
pnba15.visible:=false;
pnba16.visible:=false;
pnba17.visible:=false;
pnba18.visible:=false;
pnba19.visible:=false;
pnba20.visible:=false;
pnba21.visible:=false;
pnba22.visible:=false;
pnba23.visible:=false;
pmjb1.visible:=false;
pmjb2.visible:=false;
pmjb3.visible:=false;
pmjb4.visible:=false;
pmjb5.visible:=false;
pmjb6.visible:=false;
pmjb7.visible:=false;
pmjb8.visible:=false;
pmjb9.visible:=false;
pmjb10.visible:=false;
pmjb11.visible:=false;
pmjb12.visible:=false;
pmjb13.visible:=false;
pmjb14.visible:=false;
pmjb15.visible:=false;
pmjb16.visible:=false;
pmjb17.visible:=false;
pmjb18.visible:=false;
pmjb19.visible:=false;
pmjb20.visible:=false;
pmjb21.visible:=false;
pmjb22.visible:=false;
pmjb23.visible:=false;
j:=StringGridBookmarks.RowCount;
if j>24 then j:=24;
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 s1:=uextractfilepath(s);
      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;
end;
populatetree;
end;

function check_duplicated_bookmark(s,s1,s2,s3:utf8string):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:utf8string);
var
   i,rc:integer;
   s1,s2,s3:utf8string;
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 ufilegetattr(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: utf8string): utf8string;
var
  BufferSize: DWord;
  LocalPath: widestring;
  s:utf8string;
  wb: array of wchar;
  ws:widestring;
  DummyBuffer: wchar;
  Error: DWord;
  i:integer;
begin
{$IFDEF MSWINDOWS}
Result:='';
localpath:=utf8decode(ulocalpath);
if (winver='9x') or (winver='nt4') then exit;
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+utf8encode(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_rename.visible:=cond;
po_renmenu.visible:=cond;
po_rename_lowercase.visible:=cond;
po_rename_uppercase.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;
MenuItem7.visible:=cond;
{$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;
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;
   po_im.visible:=true;
   set_group_fm(true);
   set_group_fm(true);
   end;
MenuItemOpen_ExtractHere.Visible:=false;
end;
end;

procedure advancedarchivebrowsermenus;
begin
with Form_peach do
begin
MenuItemOpen_ExtractHere.Visible:=true;
MenuItemOpen_test.Visible:=true;
MenuItemOpen_list.Visible:=true;
MenuItemOpen_preview.visible:=true;
MenuItemOpen_extandopenwith.visible:=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;
ButtonUn7za6.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;
po_im.visible:=false;
MenuItemOpen_preview.visible:=false;
MenuItemOpen_test.Visible:=false;
MenuItemOpen_info.Visible:=false;
MenuItemOpen_list.Visible:=false;
MenuItemOpen_extandopenwith.visible:=false;
case fun of
   'FILEBROWSER':
   begin
   ButtonUn7za1.Enabled:=true;
   ButtonUn7za6.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_tolayout;
   filebrowsermenus;
   sbBrowse.Visible:=true;
   end;
   'UN7Z':
   begin
   ButtonUn7za1.Enabled:=true;
   ButtonUn7za6.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   sbBrowse.Visible:=true;
   MenuItemOpen_info.Visible:=true;
   end;
   'UNARC':
   begin
   ButtonUn7za1.Enabled:=true;
   ButtonUn7za6.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   end;
   'UNZPAQ':
   begin
   ButtonUn7za1.Enabled:=true;
   ButtonUn7za6.Enabled:=true;
   po_addtoarchive.Enabled:=true;
   ButtonUn7za4.Enabled:=true;
   ButtonUn7za4.Hint:=txt_add_toarchive;
   advancedarchivebrowsermenus;
   end;
   end;
end;
end;

procedure prepare_filebrowser;
begin
setpanel_extract(1);
Form_peach.Label5.visible:=true;
set_extcontext_off;
{$IFDEF MSWINDOWS}Form_peach.po_delete.Caption:=txt_quickdelete+' (Ctrl+Del)';{$ELSE}Form_peach.po_delete.Caption:=txt_quickdelete;{$ENDIF}
end;

procedure getcurrentfs(var s,sfs:utf8string);
var
   sdrive:utf8string;
   bufVolumeName, bufFSName: array[0..255] of Char;
   sn,mc,flags:dword;
begin
{$IFDEF MSWINDOWS}
if (winver<>'nt6+') and (winver<>'nt5') then
   begin
   sfs:=txt_fs;
   exit;
   end;
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:utf8string;
   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:utf8string;
   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
   begin
if (fulltype=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:=16;
   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;
end;
   result:=geticon(fullname,fulltype,pc);
   end;
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:utf8string);
var
   d:char;
   j:integer;
   sizefree,sizetotal,perfree: qword;
begin
with Form_peach do
begin
statuss:='';
{$IFDEF MSWINDOWS}
if s='' then exit;
if uextractfilepath(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:utf8string;
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[length(result)]=',' then setlength(result,length(result)-1);
end;
end;

procedure set_statuss_nav;
var s:utf8string;
begin
{$IFDEF MSWINDOWS}
Form_peach.LabelStatusdisplayed1.Caption:=statuss;
s:=count_clipboard;
Form_peach.LabelStatusdisplayed1.Hint:=s;
Form_peach.LabelStatusdisplayed.Hint:=s;
Form_peach.LabelStatus.Hint:=s;
Form_peach.LabelClipinfo.Caption:=s;
if statuss<>'' then Form_peach.LabelStatusdisplayed1.Visible:=true
else Form_peach.LabelStatusdisplayed1.Visible:=false;
{$ENDIF}
end;

procedure set_listview_cnames;
var
   c,i:integer;
   chstr:utf8string;
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:='SHA224';
  12: chstr:='SHA256';
  13: chstr:='SHA384';
  14: chstr:='SHA512';
  15: chstr:='Whirlpool512';
   end;
Form_Peach.po_checksumsel.Caption:=chstr+' '+txt_4_1_selected;
Form_Peach.po_checksum.Caption:=chstr;
Form_Peach.pmcheck.Caption:=chstr;
if Form_peach.EditOpenIn.Text=txt_mypc then
   begin
   Form_Peach.ListView1.Column[0].Caption:=txt_name;
   Form_Peach.ListView1.Column[1].Caption:=txt_type;
   Form_Peach.ListView1.Column[2].Caption:=txt_size;
   Form_Peach.ListView1.Column[3].Caption:=txt_free;
   Form_Peach.ListView1.Column[4].Caption:=txt_fs;
   Form_Peach.ListView1.Column[5].Caption:=txt_attributes;
   Form_Peach.ListView1.Column[6].Caption:=STR_CRC;
   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:=STR_CRC 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;
var
   i:integer;
begin
{case browsertype of //note: was called to fix issues in resizing ListView elements
   1: begin
      Form_peach.ListView1.ViewStyle:=vsReport;
      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.ListView1.ViewStyle:=vsReport;
      Form_peach.mDetails.checked:=false;
      Form_peach.mList.checked:=false;
      Form_peach.mSmallIcon.checked:=true;
      Form_peach.ListView1.ViewStyle:=vsIcon;
      end;
   end;}
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:utf8string;
   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 uextractfilename(stitle1)<>'' then stitle1:=uextractfilename(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;
//moved after sorting update Form_peach.LabelStatusdisplayed.Caption:=status0+' '+status1+', '+txt_3_7_sort+' '+sortstatusstring;
//stitle2:='- '+status0+' '+status1;
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
   begin
   EditOpenIn.Color:=StringToColor(COLLOW);
   EditOpenIn1.Color:=StringToColor(COLLOW);
   EditUn7zafilter.Color:=StringToColor(COLLOW);
   EditUn7zafilter1.Color:=StringToColor(COLLOW);
   Panel8.Color:=StringToColor(COLLOW);
   Panel9.Color:=StringToColor(COLLOW);
   Panel11.Color:=StringToColor(COLLOW);
   Panelclickaddress.Color:=StringToColor(COLLOW);
   PanelSearch.Color:=StringToColor(COLLOW);
   ShapeAddress.Brush.Color:=StringToColor(COLLOW);
   PanelAddress0.Color:=StringToColor(COLLOW);
   PanelAddress1.Color:=StringToColor(COLLOW);
   PanelAddress2.Color:=StringToColor(COLLOW);
   PanelAddress3.Color:=StringToColor(COLLOW);
   PanelAddress4.Color:=StringToColor(COLLOW);
   PanelAddress5.Color:=StringToColor(COLLOW);
   PanelAddress6.Color:=StringToColor(COLLOW);
   PanelAddress7.Color:=StringToColor(COLLOW);
   PanelAdArchive0.Color:=StringToColor(COLLOW);
   PanelAdArchive1.Color:=StringToColor(COLLOW);
   PanelAdArchive2.Color:=StringToColor(COLLOW);
   PanelAdArchive3.Color:=StringToColor(COLLOW);
   end
else
   begin
   EditOpenIn.Color:=clWindow;
   EditOpenIn1.Color:=clWindow;
   EditUn7zafilter.Color:=clWindow;
   EditUn7zafilter1.Color:=clWindow;
   Panel8.Color:=clWindow;
   Panel9.Color:=clWindow;
   Panel11.Color:=clWindow;
   Panelclickaddress.Color:=clWindow;
   PanelSearch.Color:=clWindow;
   ShapeAddress.Brush.Color:=clWindow;
   PanelAddress0.Color:=clWindow;
   PanelAddress1.Color:=clWindow;
   PanelAddress2.Color:=clWindow;
   PanelAddress3.Color:=clWindow;
   PanelAddress4.Color:=clWindow;
   PanelAddress5.Color:=clWindow;
   PanelAddress6.Color:=clWindow;
   PanelAddress7.Color:=clWindow;
   PanelAdArchive0.Color:=clWindow;
   PanelAdArchive1.Color:=clWindow;
   PanelAdArchive2.Color:=clWindow;
   PanelAdArchive3.Color:=clWindow;
   end;
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:=32 * (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_supported48;
   ShapeIO6.Visible:=true;
   ShapeIO7.Visible:=true;
   ShapeIO8.Visible:=true;
   ShapeIO9.Visible:=true;
   //if infosize1<0 then infosize1:=0;
   if infosize1>32 then infosize1:=32;
   //if infosize2<0 then infosize2:=0;
   if infosize2>32 then infosize2:=32;
   ShapeIO6.Width:=infosize1;
   ShapeIO7.Width:=infosize2;
   except
   end;
   {$ENDIF}
   end
else
   if fun='FILEBROWSER' then
      begin
      LabelInfo1.Caption:=EditOpenIn.Text;
      LabelInfo2.Caption:=status2+', '+statust;
      LabelInfo3.Caption:=status0+' '+status1;
      ImageInfoOpen4.Glyph:=BFolder48;
      ShapeIO6.Visible:=true;
      ShapeIO7.Visible:=false;
      ShapeIO8.Visible:=true;
      ShapeIO9.Visible:=false;
      //if infosize1<0 then infosize1:=0;
      if infosize1>32 then infosize1:=32;
      ShapeIO6.Width:=infosize1;
      end
   else
      begin
      LabelInfo1.Caption:=EditOpenIn.Text;//+' '+statust;
      LabelInfo2.Caption:=status2+', '+nicenumber(inttostr(tsize));
      if archive_content<>'' then LabelInfo2.Caption:=LabelInfo2.Caption+', '+archive_content;
      LabelInfo3.Caption:=status0+' '+status1;
      ImageInfoOpen4.Glyph:=BArchiveSupported48;
      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<0 then infosize1:=0;
      if infosize1>32 then infosize1:=32;
      //if infosize2<0 then infosize2:=0;
      if infosize2>32 then infosize2:=32;
      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:utf8string);
var
  Str: TStringList;
  i, j, sc: integer;
  s: array [1..8] of utf8string;
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 uDirectoryExists(apath) then
   if not ufileexists(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
form_peach.Imagelist16px.Clear;
form_peach.Imagelist48px.Clear;
form_peach.Imagelist96px.Clear;
form_peach.Imagelist192px.Clear;
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 form_peach.Imagelist48px.Clear;
   if largeiconsize=96 then form_peach.Imagelist96px.Clear;
   if largeiconsize=192 then form_peach.Imagelist192px.Clear;
   loadlargeicons(largeiconsize);
   end;
   1:
   begin
   if mediconsize=16 then form_peach.Imagelist16px.Clear;
   if mediconsize=48 then form_peach.Imagelist48px.Clear;
   if mediconsize=96 then form_peach.Imagelist96px.Clear;
   loadsmallicons(mediconsize);
   end;
   0:
   begin
   if smalliconsize=16 then form_peach.Imagelist16px.Clear;
   if smalliconsize=48 then form_peach.Imagelist48px.Clear;
   if smalliconsize=96 then form_peach.Imagelist96px.Clear;
   loadsmallicons(smalliconsize);
   end;
   end;
end;

function supportedimgtype(s:utf8string):boolean;
var
  sl:utf8string;
begin
sl:=lowercase(s);
case sl of
'.bmp',
//'.xbm', //not supported 1.0.8
'.xpm',
'.pbm',
'.pgm',
//'.ppm', //partially supported in 1.0.8
//'.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 TMyThread1.ReadStatus;
begin
fread:=Form_Peach.StringGridList.Cells[8,imlistindex[fi]];
end;

procedure TMyThread1.ShowStatus;
begin
if prevupdateid<>updateid then
   begin
   case browsertype of
   2:
   begin
   case largeiconsize of
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
      192: Form_peach.Imagelist192px.Replace(41+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.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]]);
   //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]);
   end;
end;

procedure TMyThread1.Execute;
var
  s : utf8string;
  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, deco_style, s)
   else
      load_bitmap(abitmap, fread, smsize, 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 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: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
      192: Form_peach.Imagelist192px.Replace(41+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.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]]);
   //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]);
   end;
end;

procedure TMyThread2.Execute;
var
  s : utf8string;
  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, deco_style, s)
   else
      load_bitmap(abitmap, fread, smsize, 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: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
         96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
         192: Form_peach.Imagelist192px.Replace(41+fi,fbitmap,nil);
         end;
      end;
      1:
      begin
      case mediconsize of
         16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
         48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
         96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
         end;
      end;
      0:
      begin
      case smalliconsize of
         16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
         48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
         96: Form_peach.Imagelist96px.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]]);
   //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]);
   end;
end;

procedure TMyThread3.Execute;
var
  s : utf8string;
  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, deco_style, s)
   else
      load_bitmap(abitmap, fread, smsize, 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: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
      192: Form_peach.Imagelist192px.Replace(41+fi,fbitmap,nil);
      end;
   end;
   1:
   begin
   case mediconsize of
      16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.Replace(41+fi,fbitmap,nil);
      end;
   end;
   0:
   begin
   case smalliconsize of
      16: Form_peach.Imagelist16px.Replace(41+fi,fbitmap,nil);
      48: Form_peach.Imagelist48px.Replace(41+fi,fbitmap,nil);
      96: Form_peach.Imagelist96px.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]]);
   //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]);
   end;
end;

procedure TMyThread4.Execute;
var
  s : utf8string;
  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, deco_style, s)
   else
      load_bitmap(abitmap, fread, smsize, 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;

function testutf8needed_browser:integer;
begin
result:=testutf8needed(Form_peach.EditOpenIn1.Caption+Form_peach.EditUn7zaFilter1.Caption);
with Form_peach do
begin
Imageopenutf.hint:='';
case result of
   0: Imageopenutf.visible:=false;
   1: Imageopenutf.visible:=false;
   else
      if fun='FILEBROWSER' then Imageopenutf.visible:=false
      else
         begin
         Imageopenutf.hint:=txt_5_8_utf;
         ImageList2.GetBitmap(11,Imageopenutf.Picture.Bitmap);
         Imageopenutf.visible:=true;
         end;
   end;
end;
end;

function testutf8needed_archive(s:utf8string):integer;
begin
result:=testutf8needed(s);
with Form_peach do
begin
ImageList2.GetBitmap(10,Imageopenutf2.Picture.Bitmap);
Imageopenutf2.visible:=true;
case result of
   0: Imageopenutf2.hint:=txt_5_8_ascii;
   {$IFDEF MSWINDOWS}1: Imageopenutf2.hint:='OEM CP'+inttostr(GetOEMCP)+' '+txt_5_8_cp;{$ENDIF}
   else
      begin
      Imageopenutf2.hint:=txt_5_8_utf;
      ImageList2.GetBitmap(11,Imageopenutf2.Picture.Bitmap);
      end;
   end;
end;
end;

function testutf8needed_extract(s:utf8string):integer;
begin
result:=testutf8needed(s);
with Form_peach do
begin
ImageList2.GetBitmap(10,Imageopenutf1.Picture.Bitmap);
Imageopenutf1.visible:=true;
case result of
   0: Imageopenutf1.hint:=txt_5_8_ascii;
   {$IFDEF MSWINDOWS}1: Imageopenutf1.hint:='OEM CP'+inttostr(GetOEMCP)+' '+txt_5_8_cp;{$ENDIF}
   else
      begin
      Imageopenutf1.hint:=txt_5_8_utf;
      ImageList2.GetBitmap(11,Imageopenutf1.Picture.Bitmap);
      end;
   end;
end;
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,rc:integer;
   MyThread1: TMyThread1;
   MyThread2: TMyThread2;
   MyThread3: TMyThread3;
   MyThread4: TMyThread4;
   abitmap:TBitmap;
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;
issearching:=0;
rc:=Form_peach.StringGridList.Rowcount;
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;
testutf8needed_browser;
{$IFDEF MSWINDOWS}
if prevupdateid<>updateid then rebuildicons(true) else rebuildicons(false);
{$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.Insert(i-1);
      Form_Peach.ListView1.Items.Add;
      Form_Peach.ListView1.Items[i-1].Caption:=Form_Peach.StringGridList.Cells[1,i];
      if ((browsertype=0) 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 showthumbnails=1 then
         if fun='FILEBROWSER' then
            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: Form_peach.Imagelist48px.Add(abitmap,nil);
               96: Form_peach.Imagelist96px.Add(abitmap,nil);
               192: Form_peach.Imagelist192px.Add(abitmap,nil);
               end;
               end;
            1:
            begin
            case mediconsize of
                 16: Form_peach.Imagelist16px.Add(abitmap,nil);
                 48: Form_peach.Imagelist48px.Add(abitmap,nil);
                 96: Form_peach.Imagelist96px.Add(abitmap,nil);
                 end;
                 end;
            0:
            begin
            case smalliconsize of
                 16: Form_peach.Imagelist16px.Add(abitmap,nil);
                 48: Form_peach.Imagelist48px.Add(abitmap,nil);
                 96: Form_peach.Imagelist96px.Add(abitmap,nil);
                 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
            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;
      {$ENDIF}
   end
else
   begin
   set_listview_col;
   Form_Peach.ListView1.Items.Endupdate;
   //Form_Peach.ListView1.Enabled:=true;
   update_addressbar(form_peach.EditOpenIn1.Text);
   update_selstatus;
   updatinglistview:=false;
   exit;
   end;
set_listview_col;
Form_Peach.ListView1.Items.Endupdate;
//Form_Peach.ListView1.Enabled:=true;
//Form_Peach.ListView1.Visible:=true;
{$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];
      //if Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1].selected=true then
         //Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1].Focused:=true;
      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}
//application.processmessages;
if (rc>1) and (Form_Peach.StringGridList.Cells[1,1]<>'') then
   begin
   for i:=1 to rc-1 do
      begin
      //Form_Peach.ListView1.Items[i-1].ImageIndex:=drawlisticon(i); not needed, since update_listview_sel is used to update selection status, not content
      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}
   //Form_Peach.ListView1.Enabled:=true;
   update_selstatus;
   updatinglistview:=false;
   exit;
   end;
set_listview_col;
{$IFDEF MSWINDOWS}Form_Peach.ListView1.Items.Endupdate;{$ENDIF}
//Form_Peach.ListView1.Enabled:=true;
//Form_Peach.ListView1.Visible:=true;
{$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];
      //if Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1].selected=true then
         //Form_peach.ListView1.Items[Form_peach.StringGridList.Row-1].Focused:=true;
      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;
Form_peach.StringGridList.Cells[12,i]:='1';
Form_peach.StringGridList.Row:=i;
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:utf8string; 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;
//if not(udirectoryexists(s)) then exit; //would raise a system dialog in case of drives containing non accessible removable units, and the control would not detect a disconnected drive the first time
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+ButtonUn7za9.Width+
ButtonUn7zaTo1.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}
   if (winver='9x') or (winver='nt4') or ((winver='nt5') and (majmin='5.0')) then
      begin
      ButtonProperties.Visible:=false;
      MenuItemProperties.Visible:=false;
      mProperties.Visible:=false;
      pmProperties.Visible:=false;
      pmbcProperties.Visible:=false;
      end;
   {$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;
      //Buttonfmactions.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;
      //Buttonfmactions.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;
      //ButtonImg6.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;
      //ButtonImg6.enabled:=true;
      end;
end;
end;

procedure addmenuenable(enmode:integer);
begin
case enmode of
0: Form_peach.ButtonUn7za8.enabled:=false;
1: Form_peach.ButtonUn7za8.enabled:=true;
end;
end;

procedure listpc;
{$IFDEF MSWINDOWS}
var
   s:string;
   s1,dtype,dname,fsname,uncname:utf8string;
   w:widestring;
   c:char;
   sz,sz1:int64;
   i,j,t,sizetotal,sizefree:qword;
   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}
if (winver<>'nt6+') and (winver<>'nt5') then
   begin
   listdir(local_desktop,false,false);
   exit;
   end;
if listingdir=true then exit;
listingdir:=true;
settoolbar;
clean_archive_breadcrumb;
seemencrypted:=false;
if ptmpcode<>'' then cleardir(ptmpdir,true);
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:=envtoutf8(GetEnvironmentVariable('COMPUTERNAME'));
status2:=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:=utf8encode(ws); end
         else dname:=dtype;
         ws:=bufFSName; fsname:=utf8encode(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=txt_mypc then Form_peach.StringGridList.RowCount:=k+2 //possible workaround, 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
else
   begin
   Form_peach.StringGridList.RowCount:=k+1;
   Form_peach.StringGridList.SortColRow(true,listsortcol);
   sort_az_stringgridlist_special(listsortcol);
   if az=false then sort_za_stringgridlist;
   end;}
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:=32 * (100-i) div 100;
infosize1:=0;//valorized during update
update_listview;
Form_peach.Caption:=txt_mypc;
indir:=txt_mypc;
listingdir:=false;
{$ENDIF}
end;

procedure list_root;
var
   i:integer;
   {$IFNDEF MSWINDOWS}s:utf8string;{$ENDIF}
begin
if fun='UN7Z' then
   begin
   Form_peach.EditUn7zaFilter.Text:='*';
   Form_peach.EditUn7zaFilterExclude.Text:='*'+directoryseparator+'*';
   i:=list_un7z('browse');
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   teststatus(i,statust);
   //archive_content:=status1;
   //Form_peach.Caption:=uextractfilename(Form_peach.OpenDialogArchive.Filename)+'; '+archive_content+'; '+s;
   addtohistory;
   end;
if fun='FILEBROWSER' then
   begin
   {$IFDEF MSWINDOWS}
   listpc;
   {$ELSE}
   Form_peach.EditUn7zaFilter.Text:='*';
   s:='/';
   Form_peach.EditOpenIn.Text:=s;
   listdir(s,false,false);
   {$ENDIF}
   addtohistory;
   end;
end;

procedure list_un7z_expandall;
var
   i:integer;
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilterExclude.Text:='';
i:=list_un7z('flat');
status0:=txt_list_flat;
browsingmode7z:=1;
teststatus(i,statust);
addtohistory;
end;

procedure list_un7z_expandall_silent; //don't add to history
var
   i:integer;
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilterExclude.Text:='';
i:=list_un7z('silent');
teststatus(i,statust);
end;

procedure list_un7z_search;
begin
Form_peach.EditUn7zaFilterExclude.Text:='';
list_un7z('browse');
status0:=txt_list_found;
if FormAdvf.CheckBoxAdvFilters.State=cbUnChecked then addtohistory;
end;

procedure list_un7z_do;
begin
list_un7z('browse');
status0:=txt_list_browsing;
browsingmode7z:=0;
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 * 32 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:utf8string;
   f:file of byte;
   b:byte;
   size,csize:int64;
   ucsize:qword;
begin
Form_peach.StringGridList.RowCount:=2;
s:=uextractfilename(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]:=uextractfileext(Form_peach.StringGridList.Cells[1,1]);
size:=-1;
csize:=-1;
Form_peach.StringGridList.Cells[3,1]:='';
Form_peach.StringGridList.Cells[4,1]:='';
try
uassignfile(f,Form_peach.EditOpenIn.Text);
filemode:=0;
reset(f);
if fun='UNQUAD' then
   begin
   size:=0;
   if uextractfileext(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;
ucsize:=csize;
srcfilesize(Form_peach.EditOpenIn.Text,ucsize);
csize:=ucsize;
closefile(f);
except
end;
if size<>-1 then Form_peach.StringGridList.Cells[3,1]:=inttostr(size); //expressed in B
if csize<>-1 then 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;
end;

procedure open_prepare_unpea;
begin
//Form_peach.Caption:=uextractfilename(Form_peach.OpenDialogArchive.Filename);
browse_single;
addtohistory;
end;

procedure browse_paq;
var
   f:file of byte;
   b:byte;
   s:utf8string;
   i:integer;
   size,csize:qword;
   end_browse:boolean;
begin
try
uassignfile(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;
   MessageDlg(txt_list_error, mtWarning, [mbOK], 0);
   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]:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
   Form_peach.StringGridList.Cells[2,i]:=uextractfileext(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,s3,s4,s5,cl,jobcode,outname:utf8string;
   size,csize,ratiosize:qword;
   i,k,ks,ks1:integer;
   startlist:boolean;
begin
//compose cl to list zpaq
compose_unzpaq_cl(cl,jobcode,outname,false,'list','all');
//execute cl
execute_cl(cl,'list');
//list content in stringgrid
size:=0;
csize:=0;
k:=0;
Form_peach.StringGridList.RowCount:=Form_peach.MemoList.Lines.Count;
startlist:=false;
for i:=1 to Form_peach.MemoList.Lines.Count-1 do
   begin
   s:=Form_peach.MemoList.Lines[i];
   //if startlist=true then
   //   begin
      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:=uextractfileext(s);
         s2:=copy(Form_peach.MemoList.Lines[i],23,12);//size
         //ratiosize:=strtoqword(copy(Form_peach.MemoList.Lines[i],49,4));
         //if ratiosize=0 then ratiosize:=1000;
         //s3:=inttostr(strtoqword(s2)*ratiosize div(1000));
         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]:=uextractfilename(s);
         Form_peach.StringGridList.Cells[2,k]:=s1;
         Form_peach.StringGridList.Cells[9,k]:='2'+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[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]:=uextractfilename(s);
            Form_peach.StringGridList.Cells[2,k]:=s1;
            Form_peach.StringGridList.Cells[3,k]:='';
            Form_peach.StringGridList.Cells[9,k]:='1'+Form_peach.StringGridList.Cells[1,k];
            end;
         try
         size:=size+strtoqword(Form_peach.StringGridList.Cells[3,k]);
         //csize:=csize+strtoqword(Form_peach.StringGridList.Cells[4,k]);
         except
         end;
         end;
      //end
   //else
   //   if s='----- ---------- -------- ------ ------------ ------ ----' then startlist:=true;

   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
   MessageDlg(txt_list_error, mtWarning, [mbOK], 0);
   ratio_info_reduced(0,0,0,0);
end;
end;

procedure browse_ace;
var
   {$IFDEF LINUX}lincontrol,{$ENDIF}s,cl,jobcode,outname:utf8string;
   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]:=uextractfilename(s);
   Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]:=uextractfileext(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
   nfiles:=nfiles+1;
   Form_peach.StringGridList.Cells[9,i-title_lines_ace+1]:='2'+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'+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]:=uextractfilename(s);
   Form_peach.StringGridList.Cells[2,i-title_lines_ace+1]:=uextractfileext(Form_peach.StringGridList.Cells[1,i-title_lines_ace+1]);
   Form_peach.StringGridList.Cells[9,i-title_lines_ace+1]:='2'+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'+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
   MessageDlg(txt_list_error, mtWarning, [mbOK], 0);
   ratio_info_reduced(0,0,0,0);
end;
end;

procedure browse_arc060(mode:utf8string);
var
   cl,jobcode,outname,dummy,s:utf8string;
   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]:=uextractfilename(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'+Form_peach.StringGridList.Cells[1,h];
            end
         else
            begin
            Form_peach.StringGridList.Cells[8,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=uextractfileext(Form_peach.StringGridList.Cells[8,h]);
            nfiles:=nfiles+1;
            Form_peach.StringGridList.Cells[9,h]:='2'+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 * 32 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:utf8string);
var
   cl,jobcode,outname,dummy,s:utf8string;
   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]:=uextractfilename(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'+Form_peach.StringGridList.Cells[1,h];
            end
         else
            begin
            Form_peach.StringGridList.Cells[8,h]:=s;
            Form_peach.StringGridList.Cells[2,h]:=uextractfileext(Form_peach.StringGridList.Cells[8,h]);
            nfiles:=nfiles+1;
            Form_peach.StringGridList.Cells[9,h]:='2'+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 * 32 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:utf8string);
begin
{$IFDEF MSWINDOWS}
browse_arc067(mode);
{$ELSE}
browse_arc060(mode);
{$ENDIF}
end;

function cleardir(var s:utf8string; 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:utf8string;
  {$IFDEF MSWINDOWS}
  w:widestring;
  sei: TShellExecuteInfoW;
  {$ENDIF}
  ntry:integer;
begin
cleardir:=-1;
if s='' then
   begin
   cleardir:=0;
   exit;
   end;
if not(udirectoryexists((s))) then
   begin
   cleardir:=0;
   exit;
   end;
if validatecl(s)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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 s<>'' then
   begin
   {$IFDEF MSWINDOWS}
   w:=utf8decode(s);
   FillChar(sei, SizeOf(sei), 0);
   sei.cbSize := SizeOf(sei);
   sei.Wnd := 0;
   sei.fMask := SEE_MASK_NOCLOSEPROCESS;
   sei.lpVerb := nil;
   sei.lpFile := PWideChar('cmd');
   sei.lpParameters := PWideChar('/c rmdir "'+w+'" /s /q');
   sei.nShow := SW_HIDE;
   ShellExecuteExW(@sei);
   while WaitForSingleObject(sei.hProcess, 50) <> WAIT_OBJECT_0 do
     Application.ProcessMessages;
   {$ELSE} //system needs to mPeaSupport rm command
   P:=tprocessutf8.Create(nil);
   P.Options := [poNoConsole, poWaitOnExit];
   cl:='rm -r '+''''+s+'''';
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   P.Execute;
   cleardir:=P.ExitStatus;
   P.Free;
   {$ENDIF}
   end;
if udirectoryexists((s)) then cleardir:=-1
else cleardir:=0;
if winver='9x' then 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 MessageDlg(txt_not_removable+char($0D)+char($0A)+s+char($0D)+char($0A)+txt_tempdir, mtWarning, [mbOK,mbAbort], 0)=3 then break
         else
      else
   else
      if cleardir<>0 then
         if MessageDlg(txt_not_removable+char($0D)+char($0A)+s, mtWarning, [mbOK,mbAbort], 0)=3 then break
         else
      else;
   end
else
   if cleardir<>0 then sleep(500);
until cleardir=0;
if cleardirname=true then s:='';
ptmpcode:='';
end;

function clearfile(s:utf8string):integer;
begin
clearfile:=-1;
if s='' then
   begin
   clearfile:=0;
   exit;
   end;
if not(ufileexists((s))) then
   begin
   clearfile:=0;
   exit;
   end;
if Form_peach.Visible=true then Application.ProcessMessages;
repeat
   if udeletefile((s))=false then
         if MessageDlg(txt_not_removable_file+char($0D)+char($0A)+s, mtWarning, [mbOK,mbAbort], 0)=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:utf8string;
   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:utf8string;
   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}
if (winver<>'nt6+') and (winver<>'nt5') then
else
begin
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:=utf8encode(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;
end;
//set up to date icons to bookmarked units
populatebookmarks;
populaterecenticonsf;
Form_peach.StringGridBookmarks.Repaint;
{$ELSE}
{$ENDIF}
end;

procedure checkpatherrors(var s:utf8string);
var
   s1:utf8string;
   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:utf8string; recmode,treemode:boolean);
var
   nfiles,ndirs,size,sizefree,sizetotal,perfree: qword;
   flist: TFoundList;
   fsizes: TFoundListSizes;
   ftimes: TFoundListAges;
   fattr: TFoundListAttrib;
   fattr_dec: TFoundList;
   fname:utf8string;
   s1,scap:utf8string;
   d:char;
   i,j:integer;
begin
Form_peach.Timer2.Interval:=1000;
statuss:='';
{$IFDEF MSWINDOWS}
if (s=txt_mypc) or (s='Computer''s root\') then
   begin
   listpc;
   exit;
   end;
{$ENDIF}
if listingdir=true then exit;
listingdir:=true;
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);
addmenuenable(1);
if (uextractfilename(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(udirectoryexists((s))) then
   begin
   s1:=s;
   setlength(s1,length(s1)-1);
   s1:=uextractfilepath(s1);
   if s1=directoryseparator+directoryseparator then listpc
   else
      MessageDlg(s+' '+txt_not_accessible, mtWarning, [mbOK], 0);
      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;
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'+uextractfilename(fname);
      end
   else
      begin
      Form_Peach.StringGridList.Cells[2,i]:=uextractfileext(fname);
      Form_Peach.StringGridList.Cells[9,i]:='2'+uextractfilename(fname);
      end;
   Form_Peach.StringGridList.Cells[1,i]:=uextractfilename(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(uextractfileext(fname))>=0 then
      if (testext(uextractfileext(fname))>=500) and (testext(uextractfileext(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];
   Form_Peach.StringGridList.Cells[5,i]:=FormatDateTime('yyyy-mm-dd hh:mm:ss', filedatetodatetime(ftimes[i-1]));
   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);
{$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+', '+inttostr(perfree)+'% '+txt_free2;
   end;
{$ENDIF}
status2:=currentfs;
if recmode=true then Form_peach.labelstatus.Caption:=status0+' '+status1+' ['+status2+']';
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+' ['+status2+']';
{$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;
{$ENDIF}
infosize1:=32 * (100-perfree) div 100;
infosize2:=0;
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;
//Form_peach.Caption:=uextractfilename(Form_peach.OpenDialogArchive.Filename);
status0:=txt_list_browsing;
status1:=txt_list_na;
if fun='FILEBROWSER' then listdir(Form_peach.OpenDialogArchive.Filename, false,false)
else
   begin
   indir:=uextractfilepath(Form_peach.OpenDialogArchive.Filename);
   end;
case fun of
   'UNCUSTOM': browse_single;
   'UNLPAQ': browse_single;
   'UNPAQ': browse_paq;
   'UNZPAQ': browse_zpaq;
   'UNQUAD': browse_single;
   '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;
begin
list_un7z_expandall_silent;
archive_content:=status1;
infosize1:=infosize2;
end;

procedure browse_special_cases_checkextension(s:utf8string);
var sl:utf8string;
begin
sl:=uextractfileext(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:utf8string;
begin
browse_option:='slt'; //default
s:=lowercase(Form_peach.OpenDialogArchive.Filename);
browse_special_cases_checkextension(s);
if (uextractfileext(s)='.001') then //check for same extensions before .001
   begin
   cutextension(s);
   browse_special_cases_checkextension(s);
   end;
cutextension(s);
if uextractfileext(s)='.cpio' then browse_option:='l'; //cpio.gz in rpm archives
end;

procedure check_hidden_dirs;
begin
if Form_peach.StringGridList.Cells[1,1]='' then
   if archive_content<>txt_list_nomatch+txt_2_7_list_tryflatorpw then
      begin
      list_un7z_expandall;
      exit;
      end;
if (prebrowse_dirs<>-1) and (prebrowse_records<>-1) then
   if prebrowse_records<>Form_peach.StringGridList.Rowcount-1 then
      if prebrowse_dirs=0 then
         begin
         list_un7z_expandall;
         exit;
         end;
if (prebrowse_dirs<>-1) and (prebrowse_records<>-1) then
   if prebrowse_dirs>0 then
      if rootdirrecord=0 then list_un7z_expandall;
end;

procedure open_7z;
begin
browse_special_cases;
do_prebrowse;
open_7z_prepare;
if browsingmode7z=0 then list_root
else list_un7z_expandall;
check_hidden_dirs;
testencrypted_open;
end;

procedure open_supported;
begin
Form_peach.Label5.visible:=false;
set_extcontext_off;
setsearch_disabled;
currentcomp:=upcase(uextractfileext(Form_peach.OpenDialogArchive.Filename));
currentcomp:=copy(currentcomp,2,length(currentcomp)-1);
currentfs:='';
statust:='';
statuss:='';
archive_content:='';
status2:=currentcomp;
addmenuenable(0);
if (fun='UN7Z') or (fun='FILEBROWSER') then
   begin
   Form_peach.mFlat.Visible:=true;
   end
else
   begin
   Form_peach.mFlat.Visible:=false;
   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 (uextractfilename(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:utf8string);
begin
s:=STR_TMP+inttostr(random(1000000));
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:=uextractfilepath(Form_peach.OpenDialogArchive.Filename);
if {$IFDEF MSWINDOWS}not(Form_peach.OpenDialogArchive.Filename=txt_mypc) and{$ENDIF}
   not(ufileexists((Form_peach.OpenDialogArchive.Filename))) and
   not(udirectoryexists((Form_peach.OpenDialogArchive.Filename))) then
   begin
   if (Form_peach.OpenDialogArchive.Filename=txt_none) or (Form_peach.OpenDialogArchive.Filename='<none>') then
      begin
      if udirectoryexists((uextractfilepath(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row]))) then
         Form_peach.OpenDialogArchive.Filename:=uextractfilepath(Form_peach.StringGrid1.Cells[8,Form_peach.StringGrid1.Row])
      else
         Form_peach.OpenDialogArchive.Filename:=indir;
      end
   else
      begin
         MessageDlg(Form_peach.OpenDialogArchive.Filename+' '+txt_not_accessible, mtWarning, [mbOK], 0);
         listingdir:=false;
         exit;
      end;
   end;
   end;
if Form_peach.OpenDialogArchive.Filename<>'\' then
   if ufileexists((Form_peach.OpenDialogArchive.Filename)) then
      {$IFNDEF MSWINDOWS}if uextractfileext(Form_peach.OpenDialogArchive.Filename)<>'' then{$ENDIF}
      addtoarchivehistory(Form_peach.OpenDialogArchive.Filename); //add only archive files
archiveopened:=true;
lastobj:=Form_peach.OpenDialogArchive.Filename;
if ptmpcode<>'' then cleardir(ptmpdir,true);
seemencrypted:=false;
fun:='';
fun_status:='';
subfun:='';
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' :
   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;
'UNPAQ' :
   begin
   open_supported;
   open_prepare_reduced;
   end;
'UNZPAQ' :
   begin
   open_supported;
   open_prepare_reduced;
   end;
'UNQUAD' :
   begin
   open_supported;
   open_prepare_reduced;
   end;
'UNACE' :
   begin
   if libre_directive>0 then begin reportnotsupported('ACE'); exit; end
   else
      if not(ufileexists((executable_path+'res'+directoryseparator+'unace'+directoryseparator+'unace'+EXEEXT))) then
         begin
         if unaceshown=false then
            begin
            MessageDlg('PeaZip UNACE '+txt_5_7_plugin, mtInformation,[mbOK],0);
            unaceshown:=true;
            end;
         Form_peach.Visible:=false;
         saverestartclosepeaapp;
         exit;
         end;
   open_supported;
   open_prepare_reduced;
   end;
'UNLPAQ' :
   begin
   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,uextractfilepath(Form_peach.EditOpenIn.Text))=1 then ShellTreeViewSetTextPath(form_peach.shelltreeview1,uextractfilepath(Form_peach.EditOpenIn.Text));

listingdir:=false;
end;

procedure showbar(s:utf8string);
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:=modcolor(stringtocolor(color2),0.90,0.90,0.90);
   case s of
      'none' :
      begin
      Form_peach.MenuItemOrganizeStatusbar.Checked:=false;
      splitter1.top:=PanelFilters.Height;
      lastbar:=1;
      panelside.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-PanelSide.Height;
      splitter1.Enabled:=false;
      Splitter1.Color:=clWindow;
      lastbar:=0;
      panelside.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
      panelside.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-56;
      splitter1.Enabled:=false;
      Splitter1.Color:=clWindow;
      mv2.Checked:=true;
      pmmstatus_details.Checked:=true;
      end;
      'bookmarks' :
      begin
      panelside.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;
      end;
      'recent' :
      begin
      panelside.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;
      end;
      'sessionrecent' :
      begin
      panelside.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;
      end;
      'clip' :
      begin
      panelside.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;
      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;
FormPW.mpwreset.Caption:=txt_keyfile+' | '+txt_reset;
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.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:=stdbtnheight+5;
Form_peach.baboutsupport.Glyph:=Bweb;
psetbuttonwidth(Form_peach.baboutsupport,16,true);
Form_peach.baboutsupport.Height:=stdbtnheight+5;
Form_peach.baboutfaq.Glyph:=Bweb;
psetbuttonwidth(Form_peach.baboutfaq,16,true);
Form_peach.baboutfaq.Height:=stdbtnheight+5;
Form_peach.babouttracker.Glyph:=Bweb;
psetbuttonwidth(Form_peach.babouttracker,16,true);
Form_peach.babouttracker.Height:=stdbtnheight+5;
Form_peach.baboutlocalhelp.Glyph:=Bpdf;
psetbuttonwidth(Form_peach.baboutlocalhelp,16,true);
Form_peach.baboutlocalhelp.Height:=stdbtnheight+5;
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.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_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;
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.AlternateColor:=stringtocolor(color1);
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.Button1.Height:=stdbtnheight;
FormPM.Button2.Height:=stdbtnheight;
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;
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;
ButtonKF.Height:=stdbtnheight;
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.ButtonClearFilters.Height:=stdbtnheight;
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);
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;
StringGridCustEdit.AlternateColor:=stringtocolor(color1);
StringGridCustEdit1.AlternateColor:=stringtocolor(color1);
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 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 CheckBoxdate.State=cbchecked then apappend:=1 else apappend:=0;
if CheckBoxConvert1.State=cbchecked then apverbose:=1 else apverbose:=0;
apsplit:=comboboxarchive1.ItemIndex;
apspin:=Spineditarchive1.Value;
apsize:=comboboxarchive2.ItemIndex;
apdelete:=cbdeleteinputmode1.ItemIndex;
//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;
v7z1:=ComboboxArchive4.Itemindex;
v7z2:=ComboboxArchive3.Itemindex;
v7z3:=ComboboxArchive5.Itemindex;
v7z4:=ComboboxArchive6.Itemindex;
v7z5:=ComboboxArchivePasses.Itemindex;
v7z6:=ComboboxArchiveSolid.Itemindex;
if CheckboxArchiveOF.State=cbchecked then v7z7:=1 else v7z7:=0;
if CheckboxArchive6.State=cbchecked then v7z8:=1 else v7z8:=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;
//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 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;
end;
end;

procedure ComboBoxArchive3_onchange;
begin
//if prev_type='' then exit; //may be needed in rare cases: at first run, on some platform/compilers combination, avoid the compression method to be altered from combobok onchange function possibly invoked at startup
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);
      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 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;
Form_peach.Caption:=txt_create+' .'+archive_type;
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:utf8string;
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:=uextractfilename(fnm);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(fnm);
Form_peach.Caption:=txt_create+' .'+archive_type;
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
   Form_peach.Caption:=txt_create+' '+txt_sfx+' ('+STR_ARC+') | '+Form_peach.ComboboxARC2.Text
else
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboboxARC2.Text;
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;
if Form_peach.ComboBoxPEA2.ItemIndex<3 then Form_peach.CheckBoxPEAEncryption.State:=cbChecked
else Form_peach.CheckBoxPEAEncryption.State:=cbUnchecked;
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_checkboxconvert1;
begin
if Form_peach.CheckBoxConvert1.Checked=true then convertverbose:=1 else convertverbose:=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+'      ';
   CheckBoxConvert1.visible:=true;
   end
else
   begin
   LabelTitleAdd1.Caption:='      '+txt_archive+'      ';
   CheckBoxConvert1.visible:=false;
   end;
end;

procedure TForm_peach.CheckBoxDeleteInput1Click(Sender: TObject);
begin
if Form_peach.CheckBoxDeleteInput1.State=cbChecked then Form_peach.cbdeleteinputmode1.Visible:=true
else Form_peach.cbdeleteinputmode1.Visible:=false;
end;

procedure TForm_peach.CheckBoxDeleteInputClick(Sender: TObject);
begin
if Form_peach.CheckBoxDeleteInput.State=cbChecked then Form_peach.cbdeleteinputmode.Visible:=true
else Form_peach.cbdeleteinputmode.Visible:=false;
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 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 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 apappend=1 then CheckBoxdate.State:=cbchecked else CheckBoxdate.State:=cbunchecked;
if apverbose=1 then CheckBoxConvert1.State:=cbchecked else CheckBoxConvert1.State:=cbunchecked; on_checkboxconvert1;
CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
comboboxarchive1.ItemIndex:=apsplit;
Spineditarchive1.Value:=apspin;
comboboxarchive2.ItemIndex:=apsize;
ComboBoxArchive1_onchange;
//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 v7z7=1 then CheckboxArchiveOF.State:=cbchecked else CheckboxArchiveOF.State:=cbunchecked; CheckBoxArchiveOF_onclick;
if v7z8=1 then CheckboxArchive6.State:=cbchecked else CheckboxArchive6.State:=cbunchecked; on_CheckBoxArchive6_click;
RadiogroupArchive.Itemindex:=v7z9;
ComboboxArchive7.Itemindex:=v7z10;
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;
//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;
restorecustlist;
end;
end;

procedure savestatus_extractor;
begin
with form_peach do
begin
if CheckBoxAutoOpen1.State=cbchecked then vopt4b:=1 else vopt4b:=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 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 checkbox2.State=cbchecked then epunsupp:=1
else epunsupp:=0;
vexcustom1:=EditNameCustom1.Text;
vexcustom2:=EditOPcustom1.Text;
vexcustom3:=ComboBoxArchiveCustom1.ItemIndex;
savecustlist;
end;
end;

function getextcaption:utf8string;
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_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 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 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 epunsupp=1 then checkbox2.State:=cbchecked
else checkbox2.State:=cbunchecked; on_CheckBox2Click;
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;
if CheckBoxnameasparentfolder.State=cbchecked then vopt4c:=1 else vopt4c:=0;
if CheckBoxJobEncoding.State=cbchecked then vopt5:=1 else vopt5:=0;
if CheckBoxEncoding.State=cbchecked then vopt6:=1 else vopt6:=0;
if CheckBoxEncoding1.State=cbchecked then vopt23:=1 else vopt23:=0;
vopt7:=Combobox1.ItemIndex;
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:=Combobox2.ItemIndex;
if cbf1.State=cbchecked then vfav1:=1 else vfav1:=0;
if cbf2.State=cbchecked then vfav2:=1 else vfav2:=0;
if cbf3.State=cbchecked then vfav3:=1 else vfav3:=0;
if cbf5.State=cbchecked then vfav4:=1 else vfav4:=0;
if cbf6.State=cbchecked then vfav5:=1 else vfav5:=0;
if cbf7.State=cbchecked then vfav6:=1 else vfav6:=0;
if cbf8.State=cbchecked then vfav7:=1 else vfav7:=0;
if cbf9.State=cbchecked then vfav8:=1 else vfav8:=0;
if cbf10.State=cbchecked then vfav9:=1 else vfav9:=0;
if cbf11.State=cbchecked then vfav10:=1 else vfav10:=0;
if cbfARC.State=cbchecked then vfav11:=1 else vfav11:=0;
if cbfCustom.State=cbchecked then vfav12:=1 else vfav12:=0;
if cbfSfx.State=cbchecked then vfav13:=1 else vfav13:=0;
if cbfSfx1.State=cbchecked then vfav14:=1 else vfav14:=0;
if cbfwim.State=cbchecked then vfav15:=1 else vfav15:=0;
if cbfxz.State=cbchecked then vfav16:=1 else vfav16:=0;
vopt13:=RadioGroup0.ItemIndex;
voptts:=RadioGroupTS.ItemIndex;
vopt14:=RadioGroupBrowser.ItemIndex;
if CheckBoxPrebrowse.State=cbchecked then vopt15c:=1 else vopt15c:=0;
if CheckBoxBrowseNotVerbose.State=cbchecked then vopt15d:=1 else vopt15d:=0;
if CheckBox7zunrar5.State=cbchecked then vopt15e:=1 else vopt15e:=0;
vopt15:=SpinEditPrebrowse.Value;
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;
if CheckBox5.State=cbchecked then vopt24:=1 else vopt24:=0;
vopt20:=RadioGroup1.ItemIndex;
if cbcheckall.State=cbchecked then vopt21:=1 else vopt21:=0;
if cbadler.State=cbchecked then valg1:=1 else valg1:=0;
if cbcrc24.State=cbchecked then valg2:=1 else valg2:=0;
if cbcrc32.State=cbchecked then valg3:=1 else valg3:=0;
if cbcrc64.State=cbchecked then valg4:=1 else valg4:=0;
if cbcrc16.State=cbchecked then valg5:=1 else valg5:=0;
if cbed2k.State=cbchecked then valg6:=1 else valg6:=0;
if cbmd4.State=cbchecked then valg7:=1 else valg7:=0;
if cbmd5.State=cbchecked then valg8:=1 else valg8:=0;
if cbrmd.State=cbchecked then valg9:=1 else valg9:=0;
if cbsha1.State=cbchecked then valg10:=1 else valg10:=0;
if cbsha224.State=cbchecked then valg11:=1 else valg11:=0;
if cbsha256.State=cbchecked then valg12:=1 else valg12:=0;
if cbsha384.State=cbchecked then valg13:=1 else valg13:=0;
if cbsha512.State=cbchecked then valg14:=1 else valg14:=0;
if cbwhirlpool.State=cbchecked then valg15:=1 else valg15:=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_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_ComboBox2Change;
begin
work_dir:=Form_peach.ComboBox2.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_cbf11Click;
begin
if Form_peach.cbf11.State=cbChecked then favzip:=1 else favzip:=0;
end;

procedure on_cbfwimClick;
begin
if Form_peach.cbfwim.State=cbChecked then favwim:=1 else favwim:=0;
end;

procedure on_cbfxzClick;
begin
if Form_peach.cbfxz.State=cbChecked then favxz:=1 else favxz:=0;
end;

procedure on_cbf1Click;
begin
if Form_peach.cbf1.State=cbChecked then fav7z:=1 else fav7z:=0;
end;

procedure on_cbf2Click;
begin
if Form_peach.cbf2.State=cbChecked then favbz:=1 else favbz:=0;
end;

procedure on_cbf3Click;
begin
if Form_peach.cbf3.State=cbChecked then favgz:=1 else favgz:=0;
end;

procedure on_cbf5Click;
begin
if Form_peach.cbf5.State=cbChecked then favzpaq:=1 else favzpaq:=0;
end;

procedure on_cbf6Click;
begin
if Form_peach.cbf6.State=cbChecked then favpea:=1 else favpea:=0;
end;

procedure on_cbf7Click;
begin
if Form_peach.cbf7.State=cbChecked then favquad:=1 else favquad:=0;
end;

procedure on_cbf8Click;
begin
if Form_peach.cbf8.State=cbChecked then favsplit:=1 else favsplit:=0;
end;

procedure on_cbf9Click;
begin
if Form_peach.cbf9.State=cbChecked then favtar:=1 else favtar:=0;
end;

procedure on_cbf10Click;
begin
if Form_peach.cbf10.State=cbChecked then favupx:=1 else favupx:=0;
end;

procedure on_cbfarcClick;
begin
if Form_peach.cbfARC.State=cbChecked then favARC:=1 else favARC:=0;
end;

procedure on_cbfCustomClick;
begin
if Form_peach.cbfCustom.State=cbChecked then favCustom:=1 else favCustom:=0;
end;

procedure on_cbfSfxClick;
begin
if Form_peach.cbfsfx.State=cbChecked then favsfx:=1 else favsfx:=0;
end;

procedure on_cbfSfx1Click;
begin
if Form_peach.cbfsfx1.State=cbChecked then favsfxarc:=1 else favsfxarc:=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 on_CheckBoxPrebrowse_click;
begin
if Form_peach.CheckBoxPrebrowse.State=cbChecked then prebrowse:=1 else prebrowse:=0;
prebrowsesize:=Form_peach.SpinEditPrebrowse.Value;
end;

procedure on_SpinEditPrebrowseChange;
begin
prebrowsesize:=Form_peach.SpinEditPrebrowse.Value;
prebrowse:=1;
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_cbcheckallClick;
begin
if Form_peach.cbcheckall.State=cbChecked then
   begin
   algoall:=1;
   Form_peach.groupboxcheck.Enabled:=false;
   end
else
   begin
   algoall:=0;
   Form_peach.groupboxcheck.Enabled:=true;
   end;
end;

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

procedure on_cbadlerClick;
begin
if Form_peach.cbadler.State=cbChecked then algoadler:=1 else algoadler:=0;
end;

procedure on_cbcrc16Click;
begin
if Form_peach.cbcrc16.State=cbChecked then algocrc16:=1 else algocrc16:=0;
end;

procedure on_cbcrc24Click;
begin
if Form_peach.cbcrc24.State=cbChecked then algocrc24:=1 else algocrc24:=0;
end;

procedure on_cbcrc32Click;
begin
if Form_peach.cbcrc32.State=cbChecked then algocrc32:=1 else algocrc32:=0;
end;

procedure on_cbcrc64Click;
begin
if Form_peach.cbcrc64.State=cbChecked then algocrc64:=1 else algocrc64:=0;
end;

procedure on_cbed2kClick;
begin
if Form_peach.cbed2k.State=cbChecked then algoed2k:=1 else algoed2k:=0;
end;

procedure on_cbmd4Click;
begin
if Form_peach.cbmd4.State=cbChecked then algomd4:=1 else algomd4:=0;
end;

procedure on_cbmd5Click;
begin
if Form_peach.cbmd5.State=cbChecked then algomd5:=1 else algomd5:=0;
end;

procedure on_cbrmdClick;
begin
if Form_peach.cbrmd.State=cbChecked then algoripemd160:=1 else algoripemd160:=0;
end;

procedure on_cbsha1Click;
begin
if Form_peach.cbsha1.State=cbChecked then algosha1:=1 else algosha1:=0;
end;

procedure on_cbsha224Click;
begin
if Form_peach.cbsha224.State=cbChecked then algosha224:=1 else algosha224:=0;
end;

procedure on_cbsha256Click;
begin
if Form_peach.cbsha256.State=cbChecked then algosha256:=1 else algosha256:=0;
end;

procedure on_cbsha384Click;
begin
if Form_peach.cbsha384.State=cbChecked then algosha384:=1 else algosha384:=0;
end;

procedure on_cbsha512Click;
begin
if Form_peach.cbsha512.State=cbChecked then algosha512:=1 else algosha512:=0;
end;

procedure on_cbwhirlpoolClick;
begin
if Form_peach.cbwhirlpool.State=cbChecked then algowhirl:=1 else algowhirl:=0;
end;

procedure on_CheckBoxEncoding1Click;
begin
if Form_peach.CheckBoxEncoding1.State=cbChecked then mcuzip:=1 else mcuzip:=0;
end;

procedure on_CheckBox5_click;
begin
if Form_peach.CheckBox5.State=cbChecked then ignorepathdd:=1 else ignorepathdd:=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 TForm_peach.ComboBoxLibreChange(Sender: TObject);
begin
on_ComboBoxLibreChange;
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 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;
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 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;
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;
Combobox2.ItemIndex:=vopt12; on_ComboBox2Change;
if vfav1=1 then cbf1.State:=cbchecked else cbf1.State:=cbunchecked; on_cbf1Click;
if vfav2=1 then cbf2.State:=cbchecked else cbf2.State:=cbunchecked; on_cbf2Click;
if vfav3=1 then cbf3.State:=cbchecked else cbf3.State:=cbunchecked; on_cbf3Click;
if vfav4=1 then cbf5.State:=cbchecked else cbf5.State:=cbunchecked; on_cbf5Click;
if vfav5=1 then cbf6.State:=cbchecked else cbf6.State:=cbunchecked; on_cbf6Click;
if vfav6=1 then cbf7.State:=cbchecked else cbf7.State:=cbunchecked; on_cbf7Click;
if vfav7=1 then cbf8.State:=cbchecked else cbf8.State:=cbunchecked; on_cbf8Click;
if vfav8=1 then cbf9.State:=cbchecked else cbf9.State:=cbunchecked; on_cbf9Click;
if vfav9=1 then cbf10.State:=cbchecked else cbf10.State:=cbunchecked; on_cbf10Click;
if vfav10=1 then cbf11.State:=cbchecked else cbf11.State:=cbunchecked; on_cbf11Click;
if vfav11=1 then cbfARC.State:=cbchecked else cbfARC.State:=cbunchecked; on_cbfarcClick;
if vfav12=1 then cbfCustom.State:=cbchecked else cbfCustom.State:=cbunchecked; on_cbfcustomClick;
if vfav13=1 then cbfSfx.State:=cbchecked else cbfSfx.State:=cbunchecked; on_cbfsfxClick;
if vfav14=1 then cbfSfx1.State:=cbchecked else cbfSfx1.State:=cbunchecked; on_cbfsfx1Click;
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;
if  vopt15c=1 then CheckBoxPrebrowse.State:=cbchecked else CheckBoxPrebrowse.State:=cbunchecked; on_CheckBoxPrebrowse_click;
SpinEditPrebrowse.Value:=vopt15; on_SpinEditPrebrowseChange;
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;
if vopt24=1 then CheckBox5.State:=cbchecked else CheckBox5.State:=cbunchecked; on_CheckBox5_click;
RadioGroup1.ItemIndex:=vopt20; on_RadioGroup1Click;
if vopt21=1 then cbcheckall.State:=cbchecked else cbcheckall.State:=cbunchecked; on_cbcheckallClick;
if valg1=1 then cbadler.State:=cbchecked else cbadler.State:=cbunchecked; on_cbadlerClick;
if valg2=1 then cbcrc24.State:=cbchecked else cbcrc24.State:=cbunchecked; on_cbcrc24Click;
if valg3=1 then cbcrc32.State:=cbchecked else cbcrc32.State:=cbunchecked; on_cbcrc32Click;
if valg4=1 then cbcrc64.State:=cbchecked else cbcrc64.State:=cbunchecked; on_cbcrc64Click;
if valg5=1 then cbcrc16.State:=cbchecked else cbcrc16.State:=cbunchecked; on_cbcrc16Click;
if valg6=1 then cbed2k.State:=cbchecked else cbed2k.State:=cbunchecked; on_cbed2kClick;
if valg7=1 then cbmd4.State:=cbchecked else cbmd4.State:=cbunchecked; on_cbmd4Click;
if valg8=1 then cbmd5.State:=cbchecked else cbmd5.State:=cbunchecked; on_cbmd5Click;
if valg9=1 then cbrmd.State:=cbchecked else cbrmd.State:=cbunchecked; on_cbrmdClick;
if valg10=1 then cbsha1.State:=cbchecked else cbsha1.State:=cbunchecked; on_cbsha1Click;
if valg11=1 then cbsha224.State:=cbchecked else cbsha224.State:=cbunchecked; on_cbsha224Click;
if valg12=1 then cbsha256.State:=cbchecked else cbsha256.State:=cbunchecked; on_cbsha256Click;
if valg13=1 then cbsha384.State:=cbchecked else cbsha384.State:=cbunchecked; on_cbsha384Click;
if valg14=1 then cbsha512.State:=cbchecked else cbsha512.State:=cbunchecked; on_cbsha512Click;
if valg15=1 then cbwhirlpool.State:=cbchecked else cbwhirlpool.State:=cbunchecked; on_cbwhirlpoolClick;
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:utf8string;
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;
   try ButtonArchive.Setfocus; except end;
   end;
end;
end;

procedure setpanel_extract(ipanel:integer);
var
cl,jobcode,outname:utf8string;
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;
   try ButtonExtOk.Setfocus; except end;
   end;
end;
end;

procedure showpanel(panelname:utf8string); //make all panels invisible (showpanel_prepare) then make visible the called panel
var
   s:utf8string;
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+'      ';
   CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   PanelArchiveMain.Top:=0;
   PanelArchiveMain.Visible:=true;
   clicklabel_add(LabelTitleAdd1);
   pmaddfolder.enabled:=true;
   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;
   mextractarchive.Caption:=txt_archive;
   if archive_type_selected=-1 then
      if df<14 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;
   GroupBoxCreateOut.Enabled:=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 try Form_peach.cbType.Setfocus; except end;
   if form_peach.Visible=true then
      if Form_peach.ButtonArchive.enabled=true then
         try Form_peach.ButtonArchive.Setfocus; except end;
   end;
   'open' :
   begin
   prevpanel:='open';
   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 status2:=''
         else
            if seemencrypted=true then status2:=currentcomp+', '+txt_encrypted
            else status2:=currentcomp
      else status2:=currentfs;
   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;
   pmaddfolder.enabled:=false;
   Caption:=getextcaption;
   mConsoleCreate1.Text:='';
   PanelExtract.Top:=0;
   clicklabel_extract(LabelTitleExtract1);
   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;
   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
         try Form_peach.ButtonExtOk.Setfocus; except end;
   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;
   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 MessageDlg(Form_peach.OpenDialogArchive.Filename+' '+txt_2_8_custom, mtConfirmation, [mbYes,mbNo], 0)=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:utf8string);
begin
if check7zvolume(s)=true then
else
if not(ufileexists(s)) then
   begin
      if testutf8needed(s)=5 then MessageDlg(s+' '+txt_not_accessible, mtWarning, [mbOK], 0);
      exit;
   end;
Form_peach.OpenDialogArchive.Filename:=s;
open_archive_do;
end;

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

compose command line

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

procedure get_new_archive_name(var out_param:utf8string);
var
   i:integer;
   s,s1:utf8string;
   name_ok:boolean;
begin
s1:='';
if (ufileexists(out_param) or udirectoryexists(out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   if uextractfileext(s)='.tar' then begin cutextension(s); s1:='.tar'; end;
   repeat
      if (ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param))) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+s1+uextractfileext(out_param);
   end;
end;

procedure apply_timestamptoname(var s:utf8string; checktar,forceapply:integer);
var
   dt_stamp,s0,s1,s2:utf8string;
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:=uextractfilepath(s);
s1:=uextractfilename(s);
cutextension(s1);
s2:=uextractfileext(s);
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;
end;

function getoutname(var s,archive_type:utf8string; i:integer):integer;
begin
getoutname:=-1;
suggest_outname(s,Form_peach.cbType.Text,i);
   s:=uextractfilename(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:=uextractfilepath(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:=uextractfilepath(Form_peach.SaveDialog2.FileName);
getoutname:=0;
end;

function setoutname(var s,archive_type:utf8string; i:integer):integer;
begin
setoutname:=-1;
suggest_outname(s,Form_peach.cbType.Text,i);
s:=uextractfilename(s); //keep only filename, set path to last used
if Form_peach.StringGrid1.RowCount>1 then s:=uextractfilepath(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:=uextractfilepath(s);
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
setoutname:=0;
end;

{procedure get_in_param_arc(var in_param,sel:utf8string);
var
   dstring:utf8string;
   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
         begin
         dstring:=Form_peach.StringGrid1.Cells[8,i];
         if dstring<>'' then if dstring[length(dstring)]<>'/'then dstring:=dstring+'/' //directoryseparator sometimes don't work as expected here
         end
      else dstring:=Form_peach.StringGrid1.Cells[8,i];
      in_param:=in_param+delimiter+escapefilename(dstring,desk_env)+delimiter+' ';
      end
else
   begin
   i:=strtoint(sel);
   if Form_peach.StringGrid1.Cells[2,i]=txt_list_isfolder then
      begin
      dstring:=Form_peach.StringGrid1.Cells[8,i];
      if dstring<>'' then if dstring[length(dstring)]<>'/'then dstring:=dstring+'/' //directoryseparator sometimes don't work as expected here
      end
   else dstring:=Form_peach.StringGrid1.Cells[8,i];
   in_param:=delimiter+escapefilename(dstring,desk_env)+delimiter+' ';
   end;
end;}

procedure checkadvf(var in_param,sel:utf8string);
var
   i,j:integer;
   srec:utf8string;
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+' ';
   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+' ';
   end;
end;

procedure get_in_param(var in_param,sel:utf8string);
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') or (fun='ARC')) then checkadvf(in_param,sel)
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:utf8string);
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:utf8string);
var
   i:integer;
   ipath,iname:utf8string;
begin
ipath:=form_peach.editname3.Caption;
if ipath[length(ipath)]=directoryseparator then setlength(ipath,length(ipath)-1);//ARC error if relative path ends with directory separator
in_param:='-dp'+delimiter+ipath+delimiter+' ';
ipath:=ipath+directoryseparator;
if sel='all' then
   for i:=1 to Form_peach.StringGrid1.RowCount-1 do
      begin
      iname:=uextractrelativepath(ipath,uextractfilepath(Form_peach.StringGrid1.Cells[8,i]))+uextractfilename(Form_peach.StringGrid1.Cells[8,i]);
      in_param:=in_param+delimiter+escapefilename(iname,desk_env)+delimiter+' ';
      end
else
   begin
   i:=strtoint(sel);
   in_param:=in_param+delimiter+escapefilename(Form_peach.StringGrid1.Cells[8,i],desk_env)+delimiter+' ';
   end;
end;

procedure getarch_baseoutname(var s:utf8string);
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:utf8string):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:utf8string;
begin
compose_arc_cl:=-1;
fun:='ARC';
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);
out_param:=s+'.'+archive_type;
apply_timestamptoname(out_param,1,0);
//archive function
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 zaout>0 then
   begin
   end
else
   if pw_option<>'' then pw:=pw_option;}//removed in 4.5, password is passed also to console mode
   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
               MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
               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}
get_in_param(in_param,sel);
//for arc 0.666 absolute path option seems not working correctly in Linux
{$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 uextractfilepath(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 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:utf8string);
var
   ptestf:file of byte;
   ptest:utf8string;
begin
if work_dir=1 then get_usrtmp_path(out_param);
ptest:=out_param;
if check7zvolume(ptest)=true then //when browsing units as archive, use a default temp output location
   begin
   {$IFDEF MSWINDOWS}
   out_param:=local_desktop;
   {$ELSE}
   get_usrtmp_path(out_param);
   {$ENDIF}
   exit;
   end;
if ptest<>'' then if ptest[length(ptest)]<>directoryseparator then ptest:=ptest+directoryseparator;
ptest:=ptest+STR_TESTOUT+inttostr(random(1000000));
try
   assignfile(ptestf,ptest);//do not use uassignfile as preview is launched as TProcess and does not work with UFF-8 at current level
   {$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:utf8string):integer;
var
   ptestf:file of byte;
   ptest:utf8string;
   d:char;
   j:integer;
begin
test_outpath:=-1;
if testutf8needed(out_param)=5 then begin test_outpath:=0; exit; end;
ptest:=out_param;
if ptest<>'' then if ptest[length(ptest)]<>directoryseparator then ptest:=ptest+directoryseparator;
ptest:=ptest+STR_TESTOUT+inttostr(random(1000000));
{$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
   uassignfile(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 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:utf8string):integer;
var
   s:utf8string;
   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+' then s:=out_param+' '+txt_2_4_path+char($0D)+char($0A)+char($0D)+char($0A)+txt_4_1_adminhint;
   if (winver='nt6+') and (i<0) then
      begin
      uacneeded:=true;
      control_outpath:=0;
      exit;
      end;
   {$ENDIF}
   s:=out_param+' '+txt_2_4_path;
   if MessageDlg(s, mtWarning,[mbYes, mbNo],0)=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 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:utf8string):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:utf8string):integer;
var
   s:utf8string;
   i:integer;
begin
control_outpath_archive:=-1;
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+' then s:=out_param+' '+txt_2_4_path+char($0D)+char($0A)+char($0D)+char($0A)+txt_4_1_adminhint;
   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 MessageDlg(s, mtWarning,[mbYes, mbNo],0)=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:utf8string);
begin
if Form_peach.CheckBoxSameExt.State=cbChecked then
   begin
   if Form_peach.labelstatus2.Caption= txt_2_7_ext then
      out_param:=uextractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
   else
     out_param:=uextractfilepath(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:utf8string); //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[length(s1)]=' ' then setlength(s1,length(s1)-1)
else endwithspace:=false;
until endwithspace=false;
if s1='' then s1:='noname';
end;

procedure set_output_folder(var out_param:utf8string; in_param:utf8string; real_extract:boolean; action:integer);
var
   s,s1:utf8string;
   i:integer;
   out_created:boolean;
begin
out_created:=false;
if Form_peach.CheckBoxFolder.State=cbChecked then
      begin
      if action<2 then
         begin
         try uforcedirectories(out_param); except end;
         s1:=uextractfilename(in_param);
         cutextension(s1);
         cutendspaces(s1);
         s:=out_param+s1;
         i:=0;
         repeat
            if not(udirectoryexists(s)) then
               try
                  uforcedirectories(s);
                  out_created:=true;
               except
                  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;
            {try //no longer works with Lazarus 0.9.30, exception is not returned by mkdir
               umkdir(s);
               out_created:=true;
            except
               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;
         urmdir(s); //output folder is created on the fly
         {if real_extract=false then
            try
               urmdir(s); //simulated operation mode for composing command line
            except
            end;}
         end;
      end;
end;

function compose_unarc_cl(var cl,jobcode,outname:utf8string; real_extract:boolean; mode,selection:utf8string):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:utf8string;
   i:integer;
   contains_folder,checksel:boolean;
begin
compose_unarc_cl:=-1;
subfun:='extract';
set_output_option(out_param);
if mode='preview' then
   begin
   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<>'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;
{if zaout>0 then
   begin
   end
else pw:='';}//removed in 4.5, password is passed also to console mode
   pw:=FormPW.EditUn7zaPW.Text;
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
         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 (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:=uextractfilename(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:=uextractfilename(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 ufileexists((out_param+tempstring)) then
         if MessageDlg(out_param+tempstring+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>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];
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGrid2.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row], mtWarning, [mbOK], 0); 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:utf8string):integer;
var
   s,out_param,in_param,param_param,bin_name,ext_param:utf8string;
begin
compose_custom_cl:=-1;
fun:='CUSTOM';
subfun:='archive';
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
   MessageDlg(txt_custom_executable_missing, mtWarning, [mbOK], 0);
   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);
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:utf8string; real_extract:boolean):integer;
var
   out_param,in_param,param_param,bin_name:utf8string;
begin
compose_uncustom_cl:=-1;
//check for custom executable's name
if (Form_peach.EditnameCustom1.Text='') or (Form_peach.EditnameCustom1.Text=' ') then
   begin
   MessageDlg(txt_custom_executable_missing, mtWarning, [mbOK], 0);
   exit;
   end;
subfun:='extract';
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 ufileexists((out_param)) then
      if MessageDlg(out_param+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>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:utf8string; out_param:utf8string);
begin
work_path:='';
case work_dir of
   {$IFDEF MSWINDOWS}
   0: work_path:=delimiter+'-w'+escapefilename(uextractfilepath(out_param),desk_env)+delimiter;
   1: work_path:='-w'; //let 7z determinating appropriated temp folder
   {$ELSE}
   0: work_path:=delimiter+'-w'+escapefilename(uextractfilepath(out_param),desk_env)+delimiter;
   1: work_path:='-w';
   2: work_path:='-w'; //on p7zip 9.13 the lack of -w param would result in error for the instalable versions, so option 2 is not recommended
   {$ENDIF}
   end;
end;

function compose_archive_cl(var cl,jobcode,outname,sel:utf8string):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:utf8string;
   vol_size:qword;
   name_ok:boolean;
begin
compose_archive_cl:=-1;
fun:='7Z';
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
   if (archive_type='bz2') or (archive_type='gz')  or (archive_type='xz') then
      begin
      MessageDlg(archive_type+' '+txt_error_input_multi, mtWarning, [mbOK], 0);
      exit;
      end;
   end;
//output name
getarch_baseoutname(s);
if (Form_peach.CheckBoxArchive6.Visible=true) and (Form_peach.CheckBoxArchive6.State=cbChecked) then out_param:=s+'.exe'
else out_param:=s+'.'+archive_type;
apply_timestamptoname(out_param,1,0);
//archive function
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 (ufileexists(out_param+'.001') or ufileexists(out_param) or udirectoryexists(out_param+'.001') or udirectoryexists(out_param)) then
            begin
            i:=1;
            name_ok:=false;
            s:=out_param;
            cutextension(s);
            repeat
               if (ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)+'.001') or ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)+'.001') or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param))) then inc(i,1)
               else name_ok:=true;
            until name_ok = true;
            out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param);
            end;
         end;
      end;
   1: archive_function:='a';
   2: archive_function:='u';
   end;
//solid archive
if (archive_type='7z') then
   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;
//archive open for writing files option
{$IFDEF MSWINDOWS}
if Form_peach.CheckBoxArchiveOF.State=cbChecked then openfiles_option:='-ssw' else openfiles_option:='';
{$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 zaout>0 then
   begin
   end
else
   if pw_option<>'' then pw:='-p';}
   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
               MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
               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
         MessageDlg(txt_chunk_size, mtWarning, [mbOK], 0);
         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.Visible=true) and (Form_peach.CheckBoxArchive6.State=cbChecked) then
   begin
   sfx_option:='-sfx';
   if Form_peach.RadioGroupArchive.ItemIndex=1 then sfx_option:=sfx_option+'7z.sfx';
   end
else sfx_option:='';
//if sfx_option<>'' then vol_size:=0; //sfx cannot be spanned on multiple archives
//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 archive_type='wim' then compression_level:=''; //seems supported or ignored
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:='';
//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 uextractfilepath(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 pw<>'' then cl:=cl+' '+pw;
if pw2_option<>'' then cl:=cl+' '+pw2_option;
if encalgo<>'' then cl:=cl+' '+encalgo;
if nonverboselog=1 then cl:=cl+' -bb0' else cl:=cl+' -bb1';//requires 7z/p7zip 15.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;
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:utf8string; real_extract:boolean; mode,selection:utf8string):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,work_path:utf8string;
   i:integer;
   contains_folder,checksel:boolean;
begin
result:=-1;
subfun:='extract';
//out_param
set_output_option(out_param);
if mode='preview' then
   begin
   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
         MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
         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';
   details:='';
   subfun:='list';
   end;
   'info' :
   begin
   archive_function:='lt';
   details:='';
   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 (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:=uextractfilename(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:=uextractfilename(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 ufileexists((out_param+tempstring)) then
         if MessageDlg(out_param+tempstring+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>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];
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGrid2.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row], mtWarning, [mbOK], 0); 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:utf8string; real_extract:boolean; mode,selection:utf8string):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,work_path:utf8string;
   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;
in_param:=delimiter+in_param+delimiter;
subfun:='extract';
//out_param
set_output_option(out_param);
if mode='preview' then
   begin
   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<>'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;
{if zaout>0 then
   begin
   end
else pw:='';}
   pw:=FormPW.EditUn7zaPW.Text;
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
         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';
         end;
      4: begin
         archive_function:='t';
         subfun:='test';
         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';
   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 (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:=uextractfilename(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:=uextractfilename(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 ufileexists((out_param+tempstring)) then
         if MessageDlg(out_param+tempstring+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>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];
   overwrite_policy:='-aoa';
   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
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' else cl:=cl+' -bb1';//requires v15.x
if pw<>'' then cl:=cl+' '+pw;
cl:=cl+' '+sccenc;
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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGrid2.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row], mtWarning, [mbOK], 0); 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:utf8string):integer;
var
   i:integer;
   out_param,s,in_param,compr,vol_algo,obj_algo,strm_algo,bin_name,p_ext,pw:utf8string;
   vol_size:qword;
   name_ok:boolean;
begin
compose_pea_cl:=-1;
subfun:='archive';
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
            MessageDlg(txt_chunk_size, mtWarning, [mbOK], 0);
            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);
   if ufileexists((out_param+p_ext)) then
      begin
      i:=1;
      name_ok:=false;
      s:=out_param;
      cutextension(s);
      repeat
         if ufileexists(s+NAMEVARSTR+inttostr(i)+p_ext) or udirectoryexists(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
   strm_algo:='EAX256 BATCH';
   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
         MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
         exit;
         end
   else strm_algo:=strm_algo+' NOKEYFILE';
   end
else strm_algo:='SHA256 BATCH';
if pw<>'' then
   if pw4cl('',pw)<>0 then
      begin
      msg_pw_errorchar;
      exit;
      end;
{   case Form_peach.ComboBoxPEA2.ItemIndex of //stream check
      0: strm_algo:='EAX256 INTERACTIVE';
      1: strm_algo:='EAX INTERACTIVE';
      2: strm_algo:='HMAC INTERACTIVE';
      3: strm_algo:='WHIRLPOOL BATCH';
      4: strm_algo:='SHA512 BATCH';
      5: strm_algo:='SHA256 BATCH';
      6: strm_algo:='RIPEMD160 BATCH';
      7: strm_algo:='SHA1 BATCH';
      8: strm_algo:='MD5 BATCH';
      9: strm_algo:='CRC64 BATCH';
      10: strm_algo:='CRC32 BATCH';
      11: strm_algo:='ADLER32 BATCH';
      12: strm_algo:='NOALGO BATCH';
      end;}//from 4.6 stream check is context sensitive: if password is set uses eax256 (takes password from PeaZip GUI), else uses sha256 hash
   case Form_peach.ComboBoxPEA3.ItemIndex of //object check
      0: obj_algo:='WHIRLPOOL';
      1: obj_algo:='SHA512';
      2: obj_algo:='SHA256';
      3: obj_algo:='RIPEMD160';
      4: obj_algo:='SHA1';
      5: obj_algo:='MD5';
      6: obj_algo:='CRC64';
      7: obj_algo:='CRC32';
      8: obj_algo:='ADLER32';
      9: obj_algo:='NOALGO';
      end;
   case Form_peach.ComboBoxPEA4.ItemIndex of //volume check
      0: vol_algo:='WHIRLPOOL';
      1: vol_algo:='SHA512';
      2: vol_algo:='SHA256';
      3: vol_algo:='RIPEMD160';
      4: vol_algo:='SHA1';
      5: vol_algo:='MD5';
      6: vol_algo:='CRC64';
      7: vol_algo:='CRC32';
      8: vol_algo:='ADLER32';
      9: 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:utf8string):integer;
var
   i:integer;
   out_param,s,in_param,vol_algo,bin_name:utf8string;
   vol_size:qword;
   name_ok:boolean;
begin
compose_rfs_cl:=-1;
subfun:='archive';
fun:='RFS';
   if Form_peach.StringGrid1.RowCount=1 then
      begin
      MessageDlg(txt_split_noinput, mtWarning, [mbOK], 0);
      exit;
      end
   else
      if (tdirs=0) and (Form_peach.StringGrid1.RowCount<3) then
      else
         begin
         MessageDlg(txt_split+' '+txt_error_input_multi, mtWarning, [mbOK], 0);
         exit;
         end;
   //out_param
   out_param:=Form_peach.StringGrid1.Cells[8,1];
   out_param:=Form_peach.Editname3.Text;
   if ufileexists((out_param+'.001')) then
      begin
      i:=1;
      name_ok:=false;
      s:=out_param;
      cutextension(s);
      repeat
         if ufileexists(s+NAMEVARSTR+inttostr(i)+'.001') or udirectoryexists(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
            MessageDlg(txt_chunk_size, mtWarning, [mbOK], 0);
            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:='SHA512';
      2: vol_algo:='SHA256';
      3: vol_algo:='RIPEMD160';
      4: vol_algo:='SHA1';
      5: vol_algo:='MD5';
      6: vol_algo:='CRC64';
      7: vol_algo:='CRC32';
      8: vol_algo:='ADLER32';
      9: 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:utf8string):integer;
var
   attr_param,out_param,in_param,bin_name,s,pw:utf8string;
begin
compose_unpea_cl:=-1;
subfun:='extract';
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:=uextractfilename(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
            MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
            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
   MessageDlg(txt_error_function, mtError, [mbOK], 0);
   exit;
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
compose_unpea_cl:=0;
end;

function compose_unlpaq_cl(var cl,jobcode,outname:utf8string; real_extract:boolean):integer;
var
   s1,out_param,in_param,bin_name,lpaq_ver:utf8string;
begin
compose_unlpaq_cl:=-1;
subfun:='extract';
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;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s1:=uextractfilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   s1:=uextractfilename(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(uextractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]),2,length(uextractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]))-1)
else
   lpaq_ver:=copy(uextractfileext(Form_peach.EditOpenIn.Text),2,length(uextractfileext(Form_peach.EditOpenIn.Text))-1);
if ufileexists((out_param)) then
      if MessageDlg(out_param+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>6 then exit
      else
         if real_extract=true then clearfile(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:utf8string; real_extract:boolean):integer;
var
   out_param,in_param,bin_name,paq_ver:utf8string;
begin
compose_unpaq_cl:=-1;
fun:='PAQ';
subfun:='extract';
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(uextractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]),2,length(uextractfileext(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row]))-1)
else
   paq_ver:=copy(uextractfileext(Form_peach.EditOpenIn.Text),2,length(uextractfileext(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:utf8string):integer;
var
   s,out_param,in_param,bin_name,compression_level,paq_ver:utf8string;
begin
compose_zpaq_cl:=-1;
fun:='PAQ';
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
         MessageDlg(archive_type+' '+txt_error_input_multi, mtWarning, [mbOK], 0);
         exit;
         end;
      paq_ver:='lpaq8';
      //output name
      getarch_baseoutname(s);
      s:=s+'.'+paq_ver;
      apply_timestamptoname(s,1,0);
      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);
      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);
      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 0 a';
         1: compression_level:='-method 1 a';
         2: compression_level:='-method 3 a';
         3: compression_level:='-method 5 a';
         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+' '+compression_level+' '+out_param;
      cl:=cl+' '+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:utf8string; real_extract:boolean; mode,selection:utf8string):integer;
var
   out_param,in_param,bin_name,modefun:utf8string;
begin
compose_unzpaq_cl:=-1;
subfun:='extract';
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';
//selection is currently unused
if mode='list' then
   cl:=bin_name+' '+modefun+' '+in_param
else
   cl:=bin_name+' '+modefun+' '+in_param+' -to '+out_param;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unzpaq_cl:=0;
end;

function compose_upx_cl(var cl,jobcode,outname,sel:utf8string):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:utf8string;
begin
compose_upx_cl:=-1;
fun:='UPX';
subfun:='archive';
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
   MessageDlg(archive_type+' '+txt_error_input_upx, mtWarning, [mbOK], 0);
   exit;
   end;
if (Form_peach.ComboBoxUPX.ItemIndex=0) and (Form_peach.CheckBoxUPX1.State=cbUnchecked) then
   begin
   MessageDlg(txt_upxorstrip, mtWarning, [mbOK], 0);
   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
   uassignfile(fin,Form_peach.StringGrid1.Cells[8,1]);
   filemode:=0;
   reset(fin);
   uassignfile(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:=utf8toenv('"'+executable_path+'res'+DirectorySeparator+'upx'+DirectorySeparator+'strip.exe" '+in_param);
   {$ENDIF}
   {$IFDEF UNIX}//assuming generic unix coming qith strip command
   P.CommandLine:=utf8toenv('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 MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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_quad_cl(var cl,jobcode,outname,sel:utf8string):integer;
var
   s,out_param,in_param,bin_name,compression_level,exetype:utf8string;
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
   MessageDlg(archive_type+' '+txt_error_input_multi, mtWarning, [mbOK], 0);
   exit;
   end;
//output name
getarch_baseoutname(s);
apply_timestamptoname(s,1,0);
//max Compression mode on/off
exetype:=Form_peach.RadioGroupQuad.Items[Form_peach.RadioGroupQuad.ItemIndex];
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:utf8string; real_extract:boolean):integer;
var
   s1,out_param,in_param,bin_name:utf8string;
begin
compose_unquad_cl:=-1;
subfun:='extract';
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;
if Form_peach.labelstatus2.Caption= txt_2_7_ext then
   s1:=uextractfilename(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   s1:=uextractfilename(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 ufileexists((out_param)) then
      if MessageDlg(out_param+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>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 out_param<>'' then out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
if uextractfileext(Form_peach.EditOpenIn.Text)='.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;
   end;
if uextractfileext(Form_peach.EditOpenIn.Text)='.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;
   end;
if uextractfileext(Form_peach.EditOpenIn.Text)='.quad' 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;
   end;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unquad_cl:=0;
end;

function compose_unace_cl(var cl,jobcode,outname:utf8string; real_extract:boolean; mode,selection:utf8string):integer;
var
   out_param,in_param,bin_name,archive_function:utf8string;
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';
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:=uextractfilename(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:=uextractfilename(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 ufileexists((out_param+tempstring)) then
         if MessageDlg(out_param+tempstring+' '+txt_confirm_overwrite,mtWarning,[mbYes, mbNo],0)<>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 usetcurrentdir((out_param));
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms_',now)+fun;
compose_unace_cl:=0;
end;

procedure check_files(var in_param,cl,oper:utf8string);
var bin_name,disp_type,algo_list:utf8string;
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:='';
   if Form_peach.cbadler.state=cbchecked then algo_list:=algo_list+'ADLER32 ';
   if Form_peach.cbcrc16.state=cbchecked then algo_list:=algo_list+'CRC16 ';
   if Form_peach.cbcrc24.state=cbchecked then algo_list:=algo_list+'CRC24 ';
   if Form_peach.cbcrc32.state=cbchecked then algo_list:=algo_list+'CRC32 ';
   if Form_peach.cbcrc64.state=cbchecked then algo_list:=algo_list+'CRC64 ';
   if Form_peach.cbed2k.state=cbchecked then algo_list:=algo_list+'ED2K ';
   if Form_peach.cbmd4.state=cbchecked then algo_list:=algo_list+'MD4 ';
   if Form_peach.cbmd5.state=cbchecked then algo_list:=algo_list+'MD5 ';
   if Form_peach.cbrmd.state=cbchecked then algo_list:=algo_list+'RIPEMD160 ';
   if Form_peach.cbsha1.state=cbchecked then algo_list:=algo_list+'SHA1 ';
   if Form_peach.cbsha224.state=cbchecked then algo_list:=algo_list+'SHA224 ';
   if Form_peach.cbsha256.state=cbchecked then algo_list:=algo_list+'SHA256 ';
   if Form_peach.cbsha384.state=cbchecked then algo_list:=algo_list+'SHA384 ';
   if Form_peach.cbsha512.state=cbchecked then algo_list:=algo_list+'SHA512 ';
   if Form_peach.cbwhirlpool.state=cbchecked then algo_list:=algo_list+'WHIRLPOOL ';
   end;
cl:=bin_name+' CHECK '+disp_type+' '+algo_list+' ON '+in_param;
end;

procedure decode_7za_exitcode(i,insize:integer; cl,s,outname:utf8string);
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;
      MessageDlg(s,mtWarning, [mbOK], 0);
      end;
   2: begin
      s:=txt_7z_exitcode2+s+char($0d)+char($0a)+' - '+txt_cl+' '+cl;
      MessageDlg(s,mtError, [mbOK], 0);
      end;
   7: begin
      s:=txt_7z_exitcode7+s+char($0d)+char($0a)+' - '+txt_cl+' '+cl;
      MessageDlg(s,mtError, [mbOK], 0);
      end;
   8: begin
      s:=txt_7z_exitcode8+s+char($0d)+char($0a)+' - '+txt_cl+' '+cl;
      MessageDlg(s,mtError, [mbOK], 0);
      end;
   255:
      begin
      s:=txt_7z_exitcode255+s;
      MessageDlg(s,mtWarning, [mbOK], 0);
      end;
   else
      begin
      s:=inttostr(i)+txt_7z_exitcodeunknown+' '+s+char($0d)+char($0a)+' - '+txt_cl+' '+cl;
      MessageDlg(s,mtError, [mbOK], 0);
      end;
   end;
end;

procedure launch_cl(cl,jobcode,outname:utf8string); //control command line size then launch cl
var
   P: tprocessutf8;
   tsin,tsout:TTimeStamp;
   tdiff,speed,insize:qword;
   q:qword;
   s,s1,fe:utf8string;
   {$IFDEF MSWINDOWS}
   w,w1:widestring;
   sei: TShellExecuteInfoW;
   {$ENDIF}
   i,jobtype:integer;

   procedure withconsole;
   var
      i:integer;
      cl:utf8string;
   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 MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   {$IFDEF MSWINDOWS}if testutf8needed(cl)=5 then //execute cl needing utf8 using shellexecutew instead of process
      begin
      w:=utf8decode(copy(cl,1,pos(EXEEXT,cl)+4));
      w1:=utf8decode(copy(cl,pos(EXEEXT,cl)+5,length(cl)-pos(EXEEXT,cl)-5));
      ShellExecuteW(0, PWideChar ('open'), PWideChar(w), PWideChar (w1), PWideChar (''), SW_SHOWNORMAL);
      end
   else {$ENDIF} 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
//CharToOem(@cl,@cl2) and similar commands seem crashing (0.9.26)
if length(cl)>MAX_CL then
   begin
   MessageDlg(txt_cl_long, mtError, [mbOK], 0);
   inputfile:='';
   exit;
   end;
//save_conf; //not needed: options relevant to PeaLauncher are saved exiting from Settings interface
P:=tprocessutf8.Create(nil);
if Form_peach.CheckBoxTarBefore.State=cbChecked then P.Options := [poWaitOnExit];
if needwaitupdating=true then P.Options := [poWaitOnExit];
cl:=utf8toenv(cl); //passed to command line as ansi if needed
P.CommandLine:=cl;
i:=validatecl(cl);
if i<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
s:=Form_peach.EditOpenIn.Text;
if (fun='PEA') or (fun='UNPEA') or (fun='RFJ') or (fun='RFS') then P.Execute //launch Pea
else //launch either or pealauncher or ConsoleCreate application, depending on rules
   begin
   insize:=tsize;
   (*{$IFDEF MSWINDOWS}
   if testutf8needed(cl)=5 then
      begin
      withconsole;
      inputfile:='';
      exit;
      end;
   {$ENDIF}*) //option: send cl needing utf8 directly to console
   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') then
            begin
            if ((uextractfilename(Form_peach.EditOpenIn.Text)<>'') and (uextractfilename(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;
      P.CommandLine:=utf8encode(utf8toenv(delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pealauncher'+EXEEXT+delimiter+' '+inttostr(jobtype)+' '+inttostr(tsize)+' '+delimiter+escapefilename(inputfile,desk_env)+delimiter+' '+delimiter+escapefilename(outname,desk_env)+delimiter+' ')+cl);
      {$IFDEF MSWINDOWS}
      if (winver='nt6+') and (uacneeded=true) and (testutf8needed(cl)<>5) then
         begin
         uacneeded:=false;
         fe:='0';
         w:=utf8decode(utf8toenv(delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pealauncher'+EXEEXT+delimiter));
         w1:=utf8decode(utf8toenv(inttostr(jobtype)+' '+inttostr(tsize)+' '+delimiter+escapefilename(inputfile,desk_env)+delimiter+' '+delimiter+escapefilename(outname,desk_env)+delimiter+' ')+cl);
         FillChar(sei, SizeOf(sei), 0);
         sei.cbSize := SizeOf(sei);
         sei.Wnd := 0;
         sei.fMask := SEE_MASK_NOCLOSEPROCESS;
         sei.lpVerb := PWideChar ('runas');
         sei.lpFile := PWideChar (w);
         sei.lpParameters := PWideChar (w1);
         sei.nShow := SW_HIDE;
         ShellExecuteExW(@sei);
         while WaitForSingleObject(sei.hProcess, 50) <> WAIT_OBJECT_0 do
            begin
            fe:=inttostr(GetLastError);
            if fe='6' then break;
            Application.ProcessMessages;
            end;
         //ShellExecuteW(0, PWideChar ('runas'), PWideChar(w), PWideChar (w1), PWideChar (''), SW_SHOWNORMAL);
         end
      else {$ENDIF} P.Execute;
      inputfile:='';
      end
   else
      begin
      withconsole;
      inputfile:='';
      end;
   end;
zaout:=zaout1;
//sleep(500);
P.Free;
end;

function archive_mainsequence(var sel:utf8string):integer;
var
   cl,jobcode,outname:utf8string;
begin
archive_mainsequence:=-1;
if Form_peach.cbType.Text=STR_ZPAQ then
   begin
   if compose_zpaq_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   exit;
   end;
if Form_peach.cbType.Text=STR_QUAD then
   begin
   if compose_quad_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   exit;
   end;
if Form_peach.cbType.Text=STR_UPX then
   begin
   if compose_upx_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end
   else archive_mainsequence:=0;//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 completed anyway
   exit;
   end;
if (Form_peach.cbType.Text=STR_ARC) or (Form_peach.cbType.Text=txt_sfx+' '+STR_ARC) then
   begin
   if compose_arc_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   exit;
   end;
if Form_peach.cbType.Text=txt_custom then
   begin
   if compose_custom_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   exit;
   end;
if Form_peach.cbType.Text=txt_split  then
   begin
   if compose_rfs_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   exit;
   end;
if Form_peach.cbType.Text=STR_PEA then
   begin
   if compose_pea_cl(cl,jobcode,outname,sel)=0 then
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   end
else
   begin
   if compose_archive_cl(cl,jobcode,outname,sel)=0 then //7z types (including sfx 7z menu entry)
      begin
      launch_cl(cl,jobcode,outname);
      addtoarchivehistory(outname);
      archive_mainsequence:=0;
      end;
   end;
end;

procedure tarbefore(var sel:utf8string);
var
   P:tprocessutf8;
   cl,s,outname,work_path,out_param,in_param,archive_function,bin_name,type_option:utf8string;
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);
//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;
cl:=cl+' '+out_param+' '+in_param;
Form_peach.StringGrid1.Cursor:=crHourGlass;
P:=tprocessutf8.Create(nil);
cl:=utf8toenv(cl);
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 MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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;
ares:=archive_mainsequence(sel);
using_tarbefore:=false;
clearfile(outname);
end;

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

quick PeaZip functions

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

function test_in_params(var j:integer):integer;
var i:integer;
begin
test_in_params:=-1;
if wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
j:=0;
for i:=2 to wparamcount do
   if ufilegetattr(uexpandfilename(envtoutf8(wparamstr(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 wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
j:=0;
for i:=2 to wparamcount do
   if testname(uexpandfilename(envtoutf8(wparamstr(i))), Form_peach.StringGrid1)=0 then
      if ufilegetattr(uexpandfilename(envtoutf8(wparamstr(i)))) > 0 then
         begin
         j:=j+1;
         if ufilegetattr(uexpandfilename(envtoutf8(wparamstr(i)))) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,uexpandfilename(envtoutf8(wparamstr(i))))
         else addfolderstr(Form_peach.StringGrid1,uexpandfilename(envtoutf8(wparamstr(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 wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
if wparamcount>3 then
   begin
   MessageDlg(txt_split+' '+txt_error_input_multi, mtWarning, [mbOK], 0);
   exit_nosave;
   exit;
   end;
if ufilegetattr(uexpandfilename(envtoutf8(wparamstr(2)))) <> 0 then
else
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
test_in_singleparam:=0;
end;

function control_outparam(var out_param:utf8string):integer; //as control_outpath, but takes a filename instead of dirname as input
var
   out_path,out_name:utf8string;
begin
control_outparam:=-1;
out_path:=uextractfilepath(out_param);
out_name:=uextractfilename(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: utf8string): ansistring;
var i:integer;
begin
result:='default';
i:=length(uextractfilepath(envtoutf8(wparamstr(2))));
result:=inttostr(i);
end;

procedure get_unique_name(var out_param:utf8string);
var
   i:integer;
   s:utf8string;
   name_ok:boolean;
begin
if ufileexists(out_param) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   repeat
      if ufileexists(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:utf8string; var multis:utf8string); //used in Windows to pass multiple parameters per instance through a simple registry entry
var
   t:text;
   s,s1,s2,fn,dn,dummystr:utf8string;
   pkeep,pgot:boolean;
   nf,nok,ndone:integer;
   nfiles,ndirs,tsize: 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');
if ((psem<>0) and (GetLastError=ERROR_ALREADY_EXISTS)) then pkeep:=false
else pkeep:=true;
s:=peaziptmpdir;
s1:=optype+FormatDateTime('yymmdd',now)+GetPathDigest(wparamstr(2));
dn:=s+s1;
if not(udirectoryexists(dn)) then
   try
      umkdir(dn);
      uFileSetAttr(dn, faHidden);
   except
      exit;
   end
else pkeep:=false;
s2:=FormatDateTime('sszzz',now)+inttostr(GetProcessID);
fn:=s+s1+directoryseparator+s2;
get_unique_name(fn);
try
   uassigntext(t,fn);
   rewrite(t);
   writeln(t,envtoutf8(wparamstr(2)));
   closefile(t);
except
   randomize;
   sleep(50+random(100));
   try
      uassigntext(t,fn);
      rewrite(t);
      writeln(t,envtoutf8(wparamstr(2)));
      closefile(t);
   except
      exit;
   end;
end;
if pkeep=false then exit
else
   begin
   multis:='"'+dn+'"';
   nf:=1;
   nok:=0;
   ndone:=0;
   sleep(50);
   {Application.CreateForm(TFormSem, FormSem);//dialog showing items being queued for operation from multiple instances
   dummystr:=uextractfilepath(wparamstr(2));
   if dummystr<>'' then dummystr:=copy(dummystr,0,length(dummystr)-1);
   FormSem.Label1.Caption:=directoryseparator+uextractfilename(dummystr)+' -> ';}
   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>=3 then
      begin
      FormSem.Label2.Caption:=inttostr(nf);
      if FormSem.Label3.Caption=' ...' then FormSem.Label3.Caption:=' ..' else FormSem.Label3.Caption:=' ...';
      if FormSem.Visible=false then FormSem.Visible:=True;
      Application.ProcessMessages;
      end;}//qrchiving queue dialog currently unused
   if ndone>100 then exit;//guarantee termination if taking too much time
   sleep(500);
   until nok>=2;
   end;
{$ENDIF}
end;

procedure endmultimode;
begin
Form_peach.timer3.enabled:=false;
if dn<>'' then try urmdir(dn); dn:=''; except; end;
end;

procedure go_semaphorearchive;
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 add2archivemulti;
begin
showpanel('archive');
showpanel_trick;
multiaddupdating:=false;
dn:=(envtoutf8(wparamstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
savetype:=true;
end;

procedure add2archivemultiseparate;
begin
showpanel('archive');
showpanel_trick;
multiaddupdating:=false;
dn:=(envtoutf8(wparamstr(2)));
form_peach.CheckBoxSeparate.State:=cbChecked;
on_checkboxseparateclick;
Form_peach.timer3.enabled:=true;
stayopen:=false;
savetype:=true;
end;

procedure add2archivemulti7z;
var
   level:utf8string;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=0;
archive_type_select('7Z');
multiaddupdating:=false;
level:=wparamstr(2);
if (level<>'normal') then
   begin
   dontsavecustom7z:=true;
   dlevel_7z:=level_7z;
   dmethod_7z:=method_7z;
   end;
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:=(envtoutf8(wparamstr(3)));
Form_peach.Caption:=txt_create+' .'+archive_type+' | '+compression_level+', '+Form_peach.ComboboxArchive7.Text;
Form_peach.timer3.enabled:=true;
stayopen:=false;
go_semaphorearchive;
end;

procedure add2archivemultizip;
var
   level:utf8string;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=12;
archive_type_select(STR_ZIP);
multiaddupdating:=false;
level:=wparamstr(2);
if (level<>'normal') then
   begin
   dontsavecustomzip:=true;
   dlevel_zip:=level_zip;
   dmethod_zip:=method_zip;
   end;
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:=(envtoutf8(wparamstr(3)));
Form_peach.Caption:=txt_create+' .'+archive_type+' | '+compression_level+', '+Form_peach.ComboboxArchive7.Text;
Form_peach.timer3.enabled:=true;
stayopen:=false;
go_semaphorearchive;
end;

procedure add2archivemultisplit;
var
   level:utf8string;
begin
showpanel('archive');
showpanel_trick;
Form_peach.cbType.ItemIndex:=9;
archive_type_select(txt_split);
multiaddupdating:=false;
dn:=(envtoutf8(wparamstr(2)));
Form_peach.Caption:=txt_split;
Form_peach.timer3.enabled:=true;
stayopen:=false;
//go_semaphorearchive; //interaction expected to specify chunck size
end;

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

procedure ext2archivemulti;
begin
Form_peach.EditOpenOut.Text:=local_desktop;
list_toextractor('none','full');
showpanel_trick;
multiaddupdating:=false;
dn:=(envtoutf8(wparamstr(2)));
Form_peach.timer3.enabled:=true;
stayopen:=false;
end;

procedure add2multi;
var
   s,cl:utf8string;
   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;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure add2multiseparate;
var
   s,cl:utf8string;
   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;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure add2multi7z(level:utf8string);
var
   s,cl:utf8string;
   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;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure add2multizip(level:utf8string);
var
   s,cl:utf8string;
   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;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure add2multisplit;
var
   s,cl:utf8string;
   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;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure add2multisfx;
var
   s,cl:utf8string;
   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;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure ext2multi;
var
   s,cl:utf8string;
   P:tprocessutf8;
begin
{$IFDEF MSWINDOWS}
getmulti('neutral',s); //'ext'
if s='' then exit;
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'peazip'+EXEEXT+delimiter+' -ext2archivemulti '+s;
cl:=utf8toenv(cl);
P.Options := [poNoConsole];
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure add2pea; //directly create .pea archive with default parameters
var
   i,j:integer;
   cl,s,jobcode,out_param,in_param,bin_name:utf8string;
   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:=uexpandfilename(envtoutf8(wparamstr(2)));
if control_outparam(out_param)<>0 then exit;
if (wparamcount=2) and (upcase(copy(out_param,length(out_param)-3,4))='.TAR') then //don't strip .tar extension
else
   if udirectoryexists((out_param)) then
   else cutextension(out_param);
if ufileexists((out_param+'.pea')) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if ufileexists(s+NAMEVARSTR+inttostr(i)+'.pea') or udirectoryexists(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(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
cl:=bin_name+' '+fun+' '+out_param+' 0 PCOMPRESS2 SHA256 CRC64 NOALGO BATCH FROMCL '+in_param;
launch_cl(cl,jobcode,out_param);
end;

procedure add2wipe;
var
   i,j:integer;
   P:tprocessutf8;
   cl,in_param,eraselevel,bin_name:utf8string;
begin
in_param:='';
if test_in_params(j)<>0 then begin exit_nosave; exit; end;
   if MessageDlg(txt_wipe,mtWarning,[mbYes,mbNo], 0)=6 then
      begin
      for i:=2 to j+1 do in_param:=in_param+delimiter+escapefilename(uexpandfilename(envtoutf8(wparamstr(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;
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
      P.Execute;
      P.Free;
      end;
end;

procedure add2compare;
var
   i,j:integer;
   P:tprocessutf8;
   cl,in_param,bin_name:utf8string;
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(uexpandfilename(envtoutf8(wparamstr(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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
end;

{procedure direct_split(var fname: UTF8string);
var
   i:integer;
   cl,s,s1,jobcode,out_param,in_param,bin_name:utf8string;
   name_ok:boolean;
begin
s1:=fun;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+'RFS';
fun:='RFS';
fun_status:='FILEBROWSER';
subfun:='archive';
//out_param
out_param:=uexpandfilename(fname);
if control_outparam(out_param)<>0 then exit;
if ufileexists((out_param+'.001')) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if ufileexists(s+NAMEVARSTR+inttostr(i)+'.001') or udirectoryexists(s+NAMEVARSTR+inttostr(i)+'.001') 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;
in_param:=delimiter+escapefilename(uexpandfilename(fname),desk_env)+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
cl:=bin_name+' '+fun+' '+out_param+' ASK NOALGO BATCH '+in_param;
launch_cl(cl,jobcode,out_param);
fun:=s1;
fun_status:=fun;
end;}

procedure direct_join(var fname: UTF8string);
var
   cl,s,s1,jobcode,in_param,out_param,bin_name:utf8string;
begin
s1:=fun;
jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+'RFS';
fun:='RFJ';
fun_status:='FILEBROWSER';
subfun:='extract';
s:=escapefilename(uexpandfilename(fname),desk_env);
in_param:=delimiter+s+delimiter;
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
out_param:=uextractfilepath(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:=uextractfilename(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 add2split; //directly split file asking for MB size, from 4.5 it is superseeded by add2multisplit
var
   fname:UTF8string;
begin
if test_in_singleparam<>0 then begin exit_nosave; exit; end;
fname:=envtoutf8(wparamstr(2));
direct_split(fname);
end; }

procedure add2crypt; //directly create encrypted .pea archive with default parameters
var
   i,j:integer;
   cl,s,jobcode,out_param,in_param,bin_name:utf8string;
   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:=uexpandfilename(envtoutf8(wparamstr(2)));
if control_outparam(out_param)<>0 then exit;
if (wparamcount=2) and (upcase(copy(out_param,length(out_param)-3,4))='.TAR') then //don't strip .tar extension
else
   if udirectoryexists((out_param)) then
   else cutextension(out_param);
if ufileexists((out_param+'.pea')) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if ufileexists(s+NAMEVARSTR+inttostr(i)+'.pea') or udirectoryexists(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(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
cl:=bin_name+' '+fun+' '+out_param+' 0 PCOMPRESS2 SHA256 CRC64 EAX256 INTERACTIVE FROMCL '+in_param;
launch_cl(cl,jobcode,out_param);
end;

procedure add27z(mailfun:utf8string); //directly create .7z archive with default parameters
var
   i,j:integer;
   s,cl,jobcode,work_path,out_param,in_param,bin_name,outname:utf8string;
   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:=uexpandfilename(envtoutf8(wparamstr(2)));
if (wparamcount=2) and (upcase(copy(s,length(s)-3,4))='.TAR') then //don't strip .tar extension
else
   if udirectoryexists((s)) then
   else cutextension(s);
out_param:=s+'.7z';
if control_outparam(out_param)<>0 then exit;
if ufileexists((out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(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(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
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 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);
end;

procedure add2separate7z; //directly create separate .7z archives, one for input object, with default parameters
var
   i,j:integer;
   s,cl,jobcode,work_path,out_param,in_param,bin_name,outname:utf8string;
   name_ok:boolean;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
for i:=2 to wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
      begin
      in_param:=uexpandfilename(envtoutf8(wparamstr(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 udirectoryexists((s)) then
         else cutextension(s);
      out_param:=s+'.7z';
      if control_outparam(out_param)<>0 then exit;
      if ufileexists((out_param)) then
         begin
         j:=1;
         name_ok:=false;
         s:=out_param;
         cutextension(s);
         repeat
            if ufileexists((s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param))) then inc(j,1)
            else name_ok:=true;
         until name_ok = true;
         out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(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;
      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 work_path<>'' then cl:=cl+' '+work_path;
      cl:=cl+' '+out_param+' '+in_param;
      launch_cl(cl,jobcode,outname);
      sleep(random(500)); //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 add2sfx7z(mailfun:utf8string); //directly create sfx self extracting 7z archive with default parameters
var
   i,j:integer;
   s,cl,work_path,jobcode,out_param,in_param,bin_name,outname:utf8string;
   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
//if (wparamcount=2) and (upcase(copy(s,length(s)-3,4))='.TAR') then //don't strip .tar extension
//else... mechanism not used for sfx
s:=uexpandfilename(envtoutf8(wparamstr(2)));
if udirectoryexists((s)) then
else cutextension(s);
out_param:=s+'.exe';
if control_outparam(out_param)<>0 then exit;
if ufileexists((out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(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(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
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;
cl:=cl+' -sfx7z.sfx';
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);
end;

procedure add2zip(mailfun:utf8string); //directly create .zip archive with default parameters, optionally send by mail (Outlook/OE)
var
   i,j:integer;
   s,cl,jobcode,work_path,out_param,in_param,bin_name,outname:utf8string;
   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:=uexpandfilename(envtoutf8(wparamstr(2)));
if (wparamcount=2) and (upcase(copy(s,length(s)-3,4))='.TAR') then //don't strip .tar extension
else
   if udirectoryexists((s)) then
   else cutextension(s);
out_param:=s+'.zip';
if control_outparam(out_param)<>0 then exit;
if ufileexists((out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(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(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)+delimiter+' ';
bin_name:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'7z'+DirectorySeparator+'7z'+EXEEXT+delimiter;
{$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}
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);
end;

procedure add2separatezip; //directly create separate .zip archives, one for input object, with default parameters
var
   i,j:integer;
   s,cl,jobcode,work_path,out_param,in_param,bin_name,outname:utf8string;
   name_ok:boolean;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
for i:=2 to wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
      begin
      in_param:=uexpandfilename(envtoutf8(wparamstr(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 udirectoryexists((s)) then
         else cutextension(s);
      out_param:=s+'.zip';
      if control_outparam(out_param)<>0 then exit;
      if ufileexists((out_param)) then
         begin
         j:=1;
         name_ok:=false;
         s:=out_param;
         cutextension(s);
         repeat
            if ufileexists((s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param))) then inc(j,1)
            else name_ok:=true;
         until name_ok = true;
         out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(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;
{$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}
      if work_path<>'' then cl:=cl+' '+work_path;
      cl:=cl+' '+out_param+' '+in_param;
      launch_cl(cl,jobcode,outname);
      sleep(random(500));
      end
   else msg_not_accessible(i);
   end;
end;

procedure setpwtotest(var pwtotest:utf8string);
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
         MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
         exit;
         end;
   end
else pwtotest:='default';
end;

function directpw_pre_test(in_param:utf8string):integer;
//test archive for possible password protection simulating list operation, before direct extraction, list or test
var
   P:tprocessutf8;
   pwtotest,cl:utf8string;
begin
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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
directpw_pre_test:=P.exitstatus;
P.Free;
end;

procedure reopen_7z;
var
   s1,s2:utf8string;
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 list_un7z_expandall;
end;

function ask_pwkeyfile_core:integer;
var
   s1,s1b,s2:utf8string;
   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:=clWindow;
   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;
      MessageDlg(txt_3_1_pathexc, mtWarning, [mbOK], 0);
      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;
         MessageDlg(txt_error_passwordnotmatch, mtWarning, [mbOK], 0);
         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
      MessageDlg(txt_pw_empty, mtWarning, [mbOK], 0);
      ask_pwkeyfile_core:=-1;
      exit;
      end; //mandatory ask for password when the dialog is invoked for operating on encrypted or unreadable file
{if (s1='') and (s2<>'') then
   begin
   MessageDlg(txt_pw_empty, mtWarning, [mbOK], 0);
   ask_pwkeyfile_core:=-1;
   exit;
   end;}//allow either keyfile or password only, consistently with password manager encryption
if s2<>'' then
   if prepend_keyfile(s1,s2)<>0 then
      begin
      MessageDlg(s2+' '+txt_keyfile_not_found, mtError,[mbOk],0);
      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
ask_pwkeyfile:=-1;
repeat
ask_pwkeyfile:=ask_pwkeyfile_core;
until ask_pwkeyfile>=0;
if ask_pwkeyfile=0 then
   //if form_peach.visible=true then //deactivated and replaced by try except, or it will not update archive's content before the form is visible (i.e. when opening with PeaZip in a new instance)
   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:utf8string):boolean;
var
   s1:utf8string;
begin
result:=false;
s1:=s;
if s1=txt_none then
   begin
   if MessageDlg(txt_3_0_nonreadableorpw, mtConfirmation, [mbYes,mbNo], 0)=7 then result:=true;
   end
else
   begin
   if (uextractfileext(s1)='.001') then cutextension(s1);
   if (uextractfileext(s1)<>'.7z') and
   (uextractfileext(s1)<>'.rar') and
   (uextractfileext(s1)<>'.arc') then
      if MessageDlg(uextractfilename(s)+char($0D)+char($0A)+char($0D)+char($0A)+txt_3_0_nonreadableorpw, mtConfirmation, [mbYes,mbNo], 0)=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:utf8string;
begin
ask_pwkeyfile_direct:=-1;
s:=FormPW.Caption;
case ec of
   1: begin
      FormPW.Caption:=uextractfilename(form_peach.editopenin.caption)+' | '+txt_3_0_readablepw;
      hideconfirmation;
      end;
   2: begin
      if testtypeenc(form_peach.editopenin.caption)=true then exit;
      FormPW.Caption:=uextractfilename(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:utf8string; 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;
{if zaout>0 then
   begin}
   pw:=FormPW.EditUn7zaPW.Text;
   if FormPW.EditName3.Text<>'' then
      if prepend_keyfile(pw,FormPW.EditName3.Text)<>0 then
         begin
         MessageDlg(FormPW.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
         exit;
         end;
   {end
else pw:='';}
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:utf8string);
var
   j,ec:integer;
   P:tprocessutf8;
   s,cl,jobcode,bin_name,overwrite_policy,archive_function,paq_ver,lpaq_ver,outname,pw,pwtotest,ext:utf8string;
   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
            cl:=utf8toenv(cl);
            P.CommandLine:=cl;
            if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
            P.Execute;
            P.Free;
            exit;
         end;
      1: begin
         out_param:=out_param+(uextractfilename(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 uextractfilename(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(uextractfileext(in_param),2,length(uextractfileext(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(uextractfileext(in_param),2,length(uextractfileext(in_param))-1);
         s:=uextractfilename(in_param);
         cutextension(s);
         out_param:=out_param+s;
         outname:=out_param;
         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+'quad'+DirectorySeparator+ext+EXEEXT+delimiter;
         if ext='quad' 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(ufileexists((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
               MessageDlg('PeaZip UNACE '+txt_5_7_plugin, mtInformation,[mbOK],0);
               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 usetcurrentdir((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(uextractfileext(in_param),2,length(uextractfileext(in_param))-1);
         s:=uextractfilename(in_param);
         cutextension(s);
         out_param:=out_param+s;
         outname:=out_param;
         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+'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;
         {if zaout>0 then
            begin}
            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;
            //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;
      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;
            //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;
            cl:=cl+' '+out_param;
            cl:=cl+' '+pw;
            cl:=cl+' '+in_param;
            launch_cl(cl,jobcode,outname);
            end;
         end;
      end;
   extraction_checkintermediatedir(outname);
end;

procedure ext2here(tooption,folderoption:utf8string); //directly extract archive's content in archive's folder
var
   i:integer;
   out_param,in_param:utf8string;
   nf:boolean;
   label 1;
begin
if wparamcount<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 wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      goto 1;
      end;
   subfun:='extract';
   in_param:=uexpandfilename(envtoutf8(wparamstr(i)));
   Form_peach.EditOpenIn.Caption:=in_param;
   //determination of out_param
   if tooption='askto' then
      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);
         exit;
         end;
      end
   else
      begin
      out_param:=uextractfilepath(in_param);
      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;
   Form_peach.CheckBoxFolder.State:=cbUnChecked;
   if folderoption='askfolder' then //unused mode, for now
      begin
         if MessageDlg(txt_autofolder, mtConfirmation,[mbYes, mbNo],0)=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);
   1:
   end;
if nf=true then Form_peach.CheckBoxFolder.State:=cbChecked else Form_peach.CheckBoxFolder.State:=cbUnChecked;
end;

procedure ext2full;
var
   P:tprocessutf8;
   cl,bin_name,in_param,out_param,s:utf8string;
   i:integer;
   label 1;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
for i:=2 to wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      goto 1;
      end;
   subfun:='extract';
   in_param:=uexpandfilename(envtoutf8(wparamstr(i)));
   try
      srcfilesize_multipart(in_param,tsize); //expressed in B
   except
   end;
   out_param:=uextractfilepath(in_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;
   case testinput(in_param,true) of //custom handled by -ext2open, pea and rfj handled by pea
      0: begin
         directextractfromname(in_param,out_param);
         exit;
         end;
      1: begin
         P:=tprocessutf8.Create(nil);
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, poWaitOnExit];{$ENDIF}
         out_param:=out_param+(uextractfilename(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';
         cl:=utf8toenv(cl);
         P.CommandLine:=cl;
         if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
         P.Execute;
         P.Free;
         exit;
         end;
      2: begin
         P:=tprocessutf8.Create(nil);
         {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, poWaitOnExit];{$ENDIF}
         //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 AUTONAME';
         cl:=utf8toenv(cl);
         P.CommandLine:=cl;
         if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
         P.Execute;
         P.Free;
         exit;
         end;
      7: begin
         if not(ufileexists((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
               MessageDlg('PeaZip UNACE '+txt_5_7_plugin, mtInformation,[mbOK],0);
               unaceshown:=true;
               end;
            exit;
            end;
         end;
      end;
   P:=tprocessutf8.Create(nil);
   in_param:=delimiter+escapefilename(in_param,desk_env)+delimiter;
   out_param:=delimiter+escapefilename(out_param,desk_env)+delimiter;
   {$IFDEF MSWINDOWS}P.Options := [poNoConsole];{$ELSE}P.Options := [poNoConsole, poWaitOnExit];{$ENDIF}
   if (zaout=1) then s:='120' else s:='100'; //jobtype/modeofuse for extraction only, in PeaLauncher's fullmode
   cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+directoryseparator+'pealauncher'+EXEEXT+delimiter+' '+s+' '+inttostr(tsize);
   cl:=cl+' '+out_param+' '+in_param;
   P.CommandLine:=utf8toenv(cl);
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   1:
   end;
end;

procedure ext2lt(ltfun:utf8string); //directly list or test archive(s)
var
   i,j,ec:integer;
   cl,jobcode,out_param,in_param,bin_name,archive_function,pw,pwtotest:utf8string;
   fsize:qword;
   label 1;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   exit_nosave;
   exit;
   end;
setpwtotest(pwtotest);
for i:=2 to wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      goto 1;
      end;
   in_param:=uexpandfilename(envtoutf8(wparamstr(i)));
   j:=testinput(in_param,true);
   case j of
      0: begin
         MessageDlg(envtoutf8(wparamstr(i))+' '+txt_type_unsupported+'. '+txt_type_unsupported_select+READE_LIST, mtWarning, [mbOK], 0);
         goto 1;
         end;
      1: begin
         MessageDlg(STR_PEA+': '+txt_listtest, mtWarning, [mbOK], 0);
         goto 1;
         end;
      2: begin
         MessageDlg(txt_split+': '+txt_listtest, mtWarning, [mbOK], 0);
         goto 1;
         end;
      5: begin
         MessageDlg(STR_ZPAQ+': '+txt_listtest, mtWarning, [mbOK], 0);
         goto 1;
         end;
      6: begin
         MessageDlg(STR_QUAD+': '+txt_listtest, mtWarning, [mbOK], 0);
         goto 1;
         end;
      7: begin
         if not(ufileexists((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
               MessageDlg('PeaZip UNACE '+txt_5_7_plugin, mtInformation,[mbOK],0);
               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:=uextractfilepath(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
         MessageDlg('LPAQ: '+txt_listtest, mtWarning, [mbOK], 0);
         goto 1;
         end;
      9: begin
         fun:='UNARC';
         fun_status:=fun;
         pw:='-p'+pwtotest;
         {if zaout>0 then
            begin}
            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;
            //end;
         if ltfun='l' then subfun:='list'
         else subfun:='test';
         jobcode:=formatdatetime('yyyymmdd_hh.nn.ss.ms',now)+fun;
         out_param:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(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;
            cl:=cl+' '+pw;
            cl:=cl+' '+in_param;
            launch_cl(cl,jobcode,out_param);
            end;
         end;
      end;
   1:
   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:utf8string;
label 1;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   goto 1;
   end;
for i:=2 to wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      break;
      end;
   in_param:=uexpandfilename(envtoutf8(wparamstr(i)));
   j:=testinput(in_param,true);
   case j of
      0: if MessageDlg(envtoutf8(wparamstr(i))+' '+txt_2_8_custom, mtConfirmation, [mbYes,mbNo], 0)=7 then goto 1;
      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
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   1:
   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:utf8string;
label 1;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   goto 1;
   end;
for i:=2 to wparamcount do
   begin
   if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
   else
      begin
      msg_not_accessible(i);
      break;
      end;
   in_param:=uexpandfilename(envtoutf8(wparamstr(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
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   1:
   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:utf8string;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   end
else
   for i:=2 to wparamcount do
      begin
      if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
         else
         begin
         msg_not_accessible(i);
         break;
         end;
      in_param:=uexpandfilename(envtoutf8(wparamstr(i)));
      if udirectoryexists(in_param) then
      else in_param:=uextractfilepath(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
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
      P.Execute;
      P.Free;
      end;
end;

procedure open_cp(s:utf8string);
var
   P:tprocessutf8;
   cl:utf8string;
begin
P:=tprocessutf8.Create(nil);
{$IFDEF MSWINDOWS}
if winver='9x' then cl:=wincomspec+' /k cd "'+s+'"'
else cl:=wincomspec+' /k cd /d "'+s+'"';
{$ELSE}//system needs to mPeaSupport konsole, gnome-tem or xterm
case desk_env of
   0: cl:='xterm';//unknown, not win or osx
   1: cl:='gnome-terminal --working-directory='''+s+'''';//Gnome
   2: cl:='konsole --workdir '''+s+'''';//KDE
   end;
{$ENDIF}
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
end;

procedure open_ps(s:utf8string);
var
   P:tprocessutf8;
   cl:utf8string;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
if winver='nt6+' then cl:='powershell.exe -NoExit -Command Set-Location -LiteralPath '''+s+'''';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
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:utf8string;
begin
if wparamcount<2 then
   begin
   msg_no_input;
   end
else
   for i:=2 to wparamcount do
      begin
      if ufilegetattr(envtoutf8(wparamstr(i))) > 0 then
         else
         begin
         msg_not_accessible(i);
         break;
         end;
      in_param:=uexpandfilename(envtoutf8(wparamstr(i)));
      if udirectoryexists(in_param) then
      else in_param:=uextractfilepath(in_param);
      if in_param<>'' then open_cp(in_param);
      end;
end;

procedure reset_wintemp;
var
   s:utf8string;
begin
{$IFDEF MSWINDOWS}
{s:=envtoutf8(GetEnvironmentVariable('TMP'));
if s='' then s:=ugetcurrentdir;
if s<>'' then
   if s[length(s)]<>directoryseparator then s:=s+directoryseparator;
s:=s+'peazip-tmp'+directoryseparator;}
s:=peaziptmpdir;
cleardir(s,true);
{$ENDIF}
end;

procedure on_exit;
begin
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;
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;
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:utf8string;
begin
P:=tprocessutf8.Create(nil);
cl:=delimiter+executable_path+'peazip'+EXEEXT+delimiter;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
end;

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

procedure exit_withsave;
begin
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
      lang_file:=uextractfilename(Form_peach.OpenDialogLang.FileName);
      //texts(lang_file);
      saverestartclosepeaapp;
      end
   else exit
else exit;
end;

procedure open_custedit_empty(i:integer);
{$IFDEF MSWINDOWS}
{$ELSE}
   var
   P:tprocessutf8;
   cl:utf8string;
   {$ENDIF}
begin
{$IFDEF MSWINDOWS}
case i of
   1: if validatecl(custedit1)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit1, mtWarning, [mbOK], 0); exit; end;
   2: if validatecl(custedit2)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit2, mtWarning, [mbOK], 0); exit; end;
   3: if validatecl(custedit3)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit3, mtWarning, [mbOK], 0); exit; end;
   4: if validatecl(custedit4)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit4, mtWarning, [mbOK], 0); exit; end;
   5: if validatecl(custedit5)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit5, mtWarning, [mbOK], 0); exit; end;
   6: if validatecl(custedit6)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit6, mtWarning, [mbOK], 0); exit; end;
   7: if validatecl(custedit7)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit7, mtWarning, [mbOK], 0); exit; end;
   8: if validatecl(custedit8)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit8, mtWarning, [mbOK], 0); exit; end;
   9: if validatecl(custedit9)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit9, mtWarning, [mbOK], 0); exit; end;
   10: if validatecl(custedit10)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit10, mtWarning, [mbOK], 0); exit; end;
   11: if validatecl(custedit11)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit11, mtWarning, [mbOK], 0); exit; end;
   12: if validatecl(custedit12)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit12, mtWarning, [mbOK], 0); exit; end;
   13: if validatecl(custedit13)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit13, mtWarning, [mbOK], 0); exit; end;
   14: if validatecl(custedit14)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit14, mtWarning, [mbOK], 0); exit; end;
   15: if validatecl(custedit15)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit15, mtWarning, [mbOK], 0); exit; end;
   16: if validatecl(custedit16)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit16, mtWarning, [mbOK], 0); 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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
except
end;
{$ENDIF}
end;

procedure open_custedit(i:integer; s:utf8string);
var
   {$IFDEF MSWINDOWS}
   w,w1:widestring;
   {$ELSE}
   P:tprocessutf8;
   cl:utf8string;
   {$ENDIF}
begin
if s='' then
   begin
   open_custedit_empty(i);
   exit;
   end;
if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
{$IFDEF MSWINDOWS}
case i of
   1: if validatecl(custedit1)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit1, mtWarning, [mbOK], 0); exit; end;
   2: if validatecl(custedit2)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit2, mtWarning, [mbOK], 0); exit; end;
   3: if validatecl(custedit3)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit3, mtWarning, [mbOK], 0); exit; end;
   4: if validatecl(custedit4)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit4, mtWarning, [mbOK], 0); exit; end;
   5: if validatecl(custedit5)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit5, mtWarning, [mbOK], 0); exit; end;
   6: if validatecl(custedit6)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit6, mtWarning, [mbOK], 0); exit; end;
   7: if validatecl(custedit7)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit7, mtWarning, [mbOK], 0); exit; end;
   8: if validatecl(custedit8)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit8, mtWarning, [mbOK], 0); exit; end;
   9: if validatecl(custedit9)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit9, mtWarning, [mbOK], 0); exit; end;
   10: if validatecl(custedit10)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit10, mtWarning, [mbOK], 0); exit; end;
   11: if validatecl(custedit11)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit11, mtWarning, [mbOK], 0); exit; end;
   12: if validatecl(custedit12)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit12, mtWarning, [mbOK], 0); exit; end;
   13: if validatecl(custedit13)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit13, mtWarning, [mbOK], 0); exit; end;
   14: if validatecl(custedit14)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit14, mtWarning, [mbOK], 0); exit; end;
   15: if validatecl(custedit15)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit15, mtWarning, [mbOK], 0); exit; end;
   16: if validatecl(custedit16)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+custedit16, mtWarning, [mbOK], 0); exit; end;
   end;
w:=utf8decode(s);
w1:=utf8decode(uextractfilename(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+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit1+delimiter+' '+delimiter+s+delimiter;
   2: if isawebservice(custedit2) then
         cl:=delimiter+custedit2+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit2+delimiter+' '+delimiter+s+delimiter;
   3: if isawebservice(custedit3) then
         cl:=delimiter+custedit3+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit3+delimiter+' '+delimiter+s+delimiter;
   4: if isawebservice(custedit4) then
         cl:=delimiter+custedit4+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit4+delimiter+' '+delimiter+s+delimiter;
   5: if isawebservice(custedit5) then
         cl:=delimiter+custedit5+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit5+delimiter+' '+delimiter+s+delimiter;
   6: if isawebservice(custedit6) then
         cl:=delimiter+custedit6+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit6+delimiter+' '+delimiter+s+delimiter;
   7: if isawebservice(custedit7) then
         cl:=delimiter+custedit7+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit7+delimiter+' '+delimiter+s+delimiter;
   8: if isawebservice(custedit8) then
         cl:=delimiter+custedit8+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit8+delimiter+' '+delimiter+s+delimiter;
   9: if isawebservice(custedit9) then
         cl:=delimiter+custedit9+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit9+delimiter+' '+delimiter+s+delimiter;
   10: if isawebservice(custedit10) then
         cl:=delimiter+custedit10+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit10+delimiter+' '+delimiter+s+delimiter;
   11: if isawebservice(custedit11) then
         cl:=delimiter+custedit11+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit11+delimiter+' '+delimiter+s+delimiter;
   12: if isawebservice(custedit12) then
         cl:=delimiter+custedit12+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit12+delimiter+' '+delimiter+s+delimiter;
   13: if isawebservice(custedit13) then
         cl:=delimiter+custedit13+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit13+delimiter+' '+delimiter+s+delimiter;
   14: if isawebservice(custedit14) then
         cl:=delimiter+custedit14+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit14+delimiter+' '+delimiter+s+delimiter;
   15: if isawebservice(custedit15) then
         cl:=delimiter+custedit15+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit15+delimiter+' '+delimiter+s+delimiter;
   16: if isawebservice(custedit16) then
         cl:=delimiter+custedit16+uextractfilename(s)+delimiter
      else
         cl:=delimiter+custedit16+delimiter+' '+delimiter+s+delimiter;
   end;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
except
end;
{$ENDIF}
end;

procedure open_advcustedit(i:integer; s:utf8string);
var
   P:tprocessutf8;
   cl:utf8string;
begin
if s='' then
else
   if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); 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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
except
   MessageDlg(txt_2_5_cannotrun+' '+envtoutf8(cl), mtWarning, [mbOK], 0);
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:utf8string);
{$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:utf8string;
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.baboutsupportClick(Sender: TObject);
var dom,s:utf8string;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help.html',desk_env);
end;

procedure TForm_peach.babouttrackerClick(Sender: TObject);
begin
cp_open('https://sourceforge.net/p/peazip/tickets/',desk_env);
end;

procedure TForm_peach.baboutwebClick(Sender: TObject);
var dom,s:utf8string;
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:utf8string;
   i,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[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[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;
{//start date and end date
if schedulestart.Checked=true then s:=s+' /sd '+FormatDateTime('dd/mm/yyyy', dateedit1.Date);
if (scheduleend.Checked=true) and (scheduleend.Visible=true) then s:=s+' /ed '+FormatDateTime('dd/mm/yyyy', dateedit2.Date);
}//requires locale date format
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(udirectoryexists(confpath+'Scheduled scripts'+DirectorySeparator)) then umkdir(confpath+'Scheduled scripts'+DirectorySeparator);
schscrname:=confpath+'Scheduled scripts'+DirectorySeparator+iname+'.bat';
s:=s+' /tr "\"'+schscrname+'""';
uassigntext(t,schscrname);
rewrite(t);
write(t,cl);
closefile(t);
if stype=0 then mconsolecreate.Clear
else mconsolecreate1.Clear;
except
MessageDlg(txt_5_1_schederr+char($0D)+char($0A)+s,mtError,[mbOk], 0);
exit;
end;
//submit ScheduleAdd
P:=tprocessutf8.Create(nil);
P.Options := [poNoConsole];
cl:=s;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
P.Execute;
{i:=P.ExitStatus;
if i<>0 then MessageDlg(txt_5_1_schederr+char($0D)+char($0A)+s,mtError,[mbOk], 0);}//no disclosed existatus in official documentation, even GetLastError and GetLastOSError does not recover meaningful information about the operation
MessageDlg(txt_5_1_schedok+char($0D)+char($0A)+s,mtInformation,[mbOk], 0);
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 tobrowser_fromarchiver;
begin
clearlist;
Form_peach.CheckBoxDeleteInput1.State:=cbUnchecked;
Form_peach.CBDeleteInputMode1.Visible:=False;
Form_peach.EditName3.Text:='';
Form_peach.Edit4.Text:='';
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
Form_peach.OpenDialogArchive.Filename:=Form_peach.EditOpenIn.Text;
showpanel('open');
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.CheckBoxDeleteInput.State:=cbUnchecked;
Form_peach.CBDeleteInputMode.Visible:=False;
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
endmultimode;
gocancelarchive;
end;

procedure TForm_peach.ButtonDeskClick(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.ButtonDupClick(Sender: TObject);
begin
  deduplicate('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+Panel5.top;
p:=clienttoscreen(p);
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:utf8string;
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:=uextractfilename(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 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.CheckGroupW1ItemClick(Sender: TObject; Index: integer);
begin
checkwsched1;
end;

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

procedure TForm_peach.ComboBox2Change(Sender: TObject);
begin
on_ComboBox2Change;
end;

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

procedure on_ComboBoxArchive7Change;
begin
if ((Form_peach.CheckBoxArchive6.Visible=true) and (Form_peach.CheckBoxArchive6.State=cbChecked)) then
   Form_peach.Caption:=txt_create+' '+txt_sfx+' ('+STR_7Z+') | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text
else
   Form_peach.Caption:=txt_create+' .'+archive_type+' | '+Form_peach.ComboBoxArchive4.Text+', '+Form_peach.ComboboxArchive7.Text;
end;

procedure TForm_peach.ComboBoxArchive7Change(Sender: TObject);
begin
on_ComboBoxArchive7Change;
end;

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

procedure on_ComboBoxArchive9Change;
begin
if fun='ARC' then
   begin
   Form_peach.ComboBoxARC.ItemIndex:=Form_peach.ComboBoxArchive9.ItemIndex;
   on_ComboBoxARCChange;
   end
else
   begin
   Form_peach.ComboBoxArchive4.ItemIndex:=Form_peach.ComboBoxArchive9.ItemIndex;
   ComboBoxArchive4_onchange;
   end;
end;

procedure TForm_peach.ComboBoxArchive9Change(Sender: TObject);
begin
on_ComboBoxArchive9Change;
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:utf8string;
begin
menudir.Caption:=Form_peach.shelltreeview2.Items[i].Text;
menudir.visible:=true;
Node := Form_peach.ShellTreeView2.Items[i];
s:=Form_peach.ShellTreeView2.GetPathFromNode(Node)+directoryseparator;
menudir.Bitmap:=drawmenuicon(s);
end;

procedure prepare_breadcrumbdir(inroot:utf8string);
begin
if inroot='' then Form_peach.EditOpenIn1.Text;
imod:=0;
try
Form_peach.ShellTreeView2.Root:=inroot;
except
Form_peach.ShellTreeView2.Root:='';
if (Form_peach.EditOpenIn1.Text=txt_mypc) or (inroot=txt_mypc) then imod:=-1;
end;
if Form_peach.shelltreeview2.Items.Count>1 then
   begin
   draw_breadmenuicon(1+imod,Form_peach.pmbcd1);
   end
else
   begin
   Form_peach.pmbcd1.visible:=false;
   end;
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;
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:utf8string;
begin
checkoutpath_archive;
if Form_peach.Edit5.Text<>Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text) then
   begin
   s:=Edit5.Text;
   sext:=lowercase(uextractfileext(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(uextractfileext(s))='.tar' then cutextension(s);
      end;
   EditName3.Text:=uextractfilepath(s);
   if checkboxseparate.state=cbUnchecked then Edit4.Text:=uextractfilename(s);
   end;
get_statuss(Form_peach.Edit5.Text);
if statuss<>'' then
   begin
   Form_peach.labelstatusAr.Visible:=true;
   Form_peach.labelstatusAr.Caption:=statuss;
   end
else
   begin
   Form_peach.labelstatusAr.Visible:=false;
   Form_peach.labelstatusAr.Caption:='';
   end;
end;

procedure TForm_peach.EditOpenIn1Exit(Sender: TObject);
begin
if COMPQT=1 then exit;
if usebreadcrumb=0 then exit;
PanelClickAddress.Visible:=true;
EditOpenIn1.Enabled:=false;
end;

procedure opendir(s:utf8string);
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:utf8string);
var
   s1:utf8string;
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}
if checkUNCpath(s) then
   begin
   s1:=copy(s,1,length(s)-1);
   if (uextractfilepath(s1)='\\') or (uextractfilepath(s1)='\') or (uextractfilepath(s1)='') then
      begin
      listpc;
      addtohistory;
      exit;
      end;
   end;
if udirectoryexists(Form_peach.EditOpenIn.Text) then
   begin
   fun:='FILEBROWSER';
   fun_status:=fun;
   listdir(Form_peach.EditOpenIn.Text,false,false);
   addtohistory;
   end
else open_archive_fromname(Form_peach.EditOpenIn.Text);
end;

procedure TForm_peach.EditOpenIn1KeyPress(Sender: TObject; var Key: char);
begin
if Key=char(13) then
   begin
   browsefiledir(Form_peach.EditOpenIn1.Text);
   end;
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 utf8string;
   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:=uextractfilepath(Form_peach.EditUn7zaFilter.Text)+'*'+directoryseparator+'*';
   list_un7z('browse');
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   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 : utf8string; var UserValue : utf8string; chkb:boolean ) : Boolean;
var
   cbflag:integer;
begin
pInputQuery:=false;
unit6.tsstyle:=tsstyle;
FormInput.CheckBox1.Caption:=txt_2_9_rec;
FormInput.BitBtn1.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.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.LabelUp.Visible:=true;
   FormInput.LabelTimestamp.Visible:=true;
   end
else
   begin
   FormInput.LabelLow.Visible:=false;
   FormInput.LabelUp.Visible:=false;
   FormInput.LabelTimestamp.Visible:=false;
   end;
if FormInput.BitBtn1.Visible=true then FormInput.BitBtn1.Height:=stdbtnheight;
if FormInput.BitBtn2.Visible=true then FormInput.BitBtn2.Height:=stdbtnheight;
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:utf8string;
begin
testencrypted:=-1;
if (fun<>'UNARC') and
   (fun<>'UN7Z') then exit;
if seemencrypted=true then
   if (FormPW.Editun7zaPW.Text='') and (FormPW.EditName3.Text='') then
      begin
      s:=FormPW.Caption;
      FormPW.Caption:=uextractfilename(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:utf8string;
begin
testencrypted_open:=-1;
if (fun<>'UNARC') and
   (fun<>'UN7Z') then exit;
if seemencrypted=true then
   begin
   if check7zvolume(Form_peach.EditOpenIn.Caption)=true then
      begin
      MessageDlg(txt_2_8_uniterror,mtError,[mbOk], 0);
      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:=uextractfilename(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;
            end;
      end;
   end;
testencrypted_open:=0;
end;

procedure eowcustom(j:integer; custmode:utf8string);
var
   i:integer;
   cl,jobcode,outname,s:utf8string;
begin
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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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 (uextractfilepath(pmqelast.Caption)<>'') then quickextract(lastextractionpath);
end;

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

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

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

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

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

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

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

procedure TForm_peach.fextallfav1Click(Sender: TObject);
begin
if (uextractfilepath(pnb1.Caption)<>'') then quickextract(uextractfilepath(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.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.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:utf8string;
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:=uextractfilepath(Form_peach.EditOpenIn1.Caption)
   else s:=local_desktop
else s:=defaultextractpath;
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:utf8string):integer;
{$IFDEF MSWINDOWS}
var
   j:integer;
   lpPoint: TPoint;
   TextLength: Integer;
   tw: PWideChar;
   tws: WideString;
   t:utf8string;
   s:array[0..256] of Char;
   st:utf8string;
   haddress,htest:HWND;
   {$ENDIF}
begin
   {$IFDEF MSWINDOWS}
   dragtowin:=-1;
   dragdest:='<unsupported>';
   GetCursorPos(lpPoint);
   //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
         '9x': //works with both browse and explore window type
         begin
         haddress := FindWindowEx(haddress, 0, 'Worker', 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;
         'nt4','nt5': //(not sure it is ok for NT4)
         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:=utf8encode(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(udirectoryexists(envtoutf8(t))) then //special folders with conventional name instead of path (documets etc)
            begin
            if winver='9x' then t:=uextractfilepath(GetEnvironmentVariable('WINDIR'))+t+'\'
            else t:=home_path+'\'+t+'\';
            t:=utf8toenv(t);
            if not(udirectoryexists(envtoutf8(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
         '9x':
         if st='SysListView32' then //activedesktop not supported
            t:=GetEnvironmentVariable('WINDIR')+'\Desktop\';
         'nt4','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:=utf8toenv(t);
      end;
   dragdest:=envtoutf8(t);
   dragtowin:=0;
   {$ENDIF}
end;

procedure get_drag_information(var s_files:qword; var t_files,t_folders:integer; var name_file,name_folder:utf8string);
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
MessageDlg(ImageInfoArchive2.Hint,mtInformation,[mbOk], 0);
end;

procedure TForm_peach.ImageInfoArchive3Click(Sender: TObject);
begin
MessageDlg(ImageInfoArchive3.Hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImageInfoArchive4Click(Sender: TObject);
begin
MessageDlg(ImageInfoArchive4.Hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImageInfoArchive5Click(Sender: TObject);
begin
MessageDlg(ImageInfoArchive5.Hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImageInfoArchive6Click(Sender: TObject);
begin
MessageDlg(ImageInfoArchive6.Hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImageInfoDefault1Click(Sender: TObject);
begin
MessageDlg(txt_cl_hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImageInfoDefault2Click(Sender: TObject);
begin
MessageDlg(txt_2_5_langhint, mtInformation, [mbOK], 0);
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 TForm_peach.ImageListSearch1Click(Sender: TObject);
begin
Form_peach.EditUn7zaFilter.Text:='*';
Form_peach.EditUn7zaFilter1.Text:='*';
FormInput.CheckBox1.state:=cbchecked;
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.Imageopenutf1Click(Sender: TObject);
begin
if Imageopenutf1.hint=txt_5_8_utf then
   MessageDlg(Imageopenutf1.hint, mtWarning, [mbOK], 0)
else
   MessageDlg(Imageopenutf1.hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.Imageopenutf2Click(Sender: TObject);
begin
if Imageopenutf2.hint=txt_5_8_utf then
   MessageDlg(Imageopenutf2.hint, mtWarning, [mbOK], 0)
else
   MessageDlg(Imageopenutf2.hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImageopenutfClick(Sender: TObject);
begin
if Imageopenutf.hint=txt_5_8_utf then
   MessageDlg(Imageopenutf.hint, mtWarning, [mbOK], 0)
else
   MessageDlg(Imageopenutf.hint, mtInformation, [mbOK], 0);
end;

procedure TForm_peach.ImagePassword1Click(Sender: TObject);
var
   i:integer;
begin
repeat
i:=ask_pwkeyfile_core;
until i>=0;
end;

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

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

function getoname(var aname,oname:utf8string):integer;
var
   s,s1:utf8string;
   k:integer;
   out_created:boolean;
begin
getoname:=-1;
oname:=uextractfilepath(aname);
if control_outpath(oname)<>0 then exit;
s1:=uextractfilename(aname);
cutextension(s1);
s:=oname+s1;
k:=0;
out_created:=false;
repeat
   if not(udirectoryexists(s)) then
      try
         uforcedirectories(s);
         out_created:=true;
      except
         s:=oname+s1+'output';
         out_created:=true;
      end
   else
      begin
      k:=k+1;
      s:=oname+s1+NAMEVARSTR+inttostr(k);
      if k=1000 then //to break recursivity if filename is not valid (ie unsupported character encoding)
         begin
         s:=oname+s1+'output';
         out_created:=true;
         end;
      end;
  {try
   umkdir(s);
   out_created:=true;
   except
   out_created:=false;
   s:=oname+s1+NAMEVARSTR+inttostr(k);
   k:=k+1;
   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:utf8string;
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]+directoryseparator+char($0D)+char($0A)+'   ';
            2: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+directoryseparator+char($0D)+char($0A)+'   ';
            3: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+directoryseparator+char($0D)+char($0A)+'   ';
            4: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+directoryseparator+char($0D)+char($0A)+'   ';
            5: strsel:=strsel+Form_peach.StringGrid1.Cells[8,i]+directoryseparator+char($0D)+char($0A)+'   ';
            6: strsel:=strsel+'...';
            end;
         end;
         '++' :
         begin
         nsel:=nsel+1;
         case nsel of
            1: strsel:=strsel+uextractfilepath(Form_peach.StringGrid1.Cells[8,i])+char($0D)+char($0A)+'   ';
            2: strsel:=strsel+uextractfilepath(Form_peach.StringGrid1.Cells[8,i])+char($0D)+char($0A)+'   ';
            3: strsel:=strsel+uextractfilepath(Form_peach.StringGrid1.Cells[8,i])+char($0D)+char($0A)+'   ';
            4: strsel:=strsel+uextractfilepath(Form_peach.StringGrid1.Cells[8,i])+char($0D)+char($0A)+'   ';
            5: strsel:=strsel+uextractfilepath(Form_peach.StringGrid1.Cells[8,i])+char($0D)+char($0A)+'   ';
            6: strsel:=strsel+'...';
            end;
         end;
         '+++' :
         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;
   Form_peach.SetFocus;
   if convertverbose=1 then
      if MessageDlg(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, mtConfirmation, [mbYes,mbNo], 0)=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
         '+' : cleardir(oname,false);
         '+++' : clearfile(oname);
         '++' :
         begin
         oname:=uextractfilepath(oname);
         cleardir(oname,false);
         end;
         end;
      end;
   end;
end;

function checklistarchive(var nsel:integer; var strsel:utf8string):integer; //number of archived objects, and formatted string with first 5 names
var
   rc,i:integer;
   s:utf8string;
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_fromarchiving(erasemode:integer; executemode:integer; var cl:utf8string);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows)
var
   P:tprocessutf8;
   r:TSearchRec;
   bin_name,in_param,eraselevel,strsel,s:utf8string;
   i,nsel: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 checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
   in_param:=in_param+delimiter+escapefilename(s,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:='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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
if executemode=1 then P.Execute;
P.Free;
end;

procedure goarchive;
var
   sel,s,aname,oname,otest,strsel,dummycl,dummytitle:utf8string;
   i,iext,nsel:integer;
   nfiles,ndirs:qword;
   nf:boolean;
begin
Form_peach.enabled:=false;
clearstopsequencefile;
if Form_peach.StringGrid1.RowCount>1 then
   if (Form_peach.EditName3.Text='') or (Form_peach.Edit4.Text='') then setoutname(s,archive_type,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;

if Form_peach.CheckBoxConvert.State=cbChecked then
   begin
   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
         clearstopsequencefile;
         break;
         end;
      Form_peach.StringGrid1.Row:=i;
      Form_peach.StringGrid1.Cells[11,i]:='1';
      application.processmessages;
      otest:=uextractfilepath(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
               MessageDlg(txt_2_8_cannotconvert, mtWarning,[mbOk],0);
               end_convert;
               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;
            //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 e 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;
            Form_peach.StringGrid1.Cells[7,i]:='+';
            directextractfromname(aname,oname);//oname will be changed accordingly to the backend's conventions about output parameter
            //if the archive contains a single file or folder in its root, compress it (avoids adding a root folder at each passage); remember the cange so the original temporary folder can be deleted at the end of conversion
            nfiles:=0;
            ndirs:=0;
            checksingle(Form_peach.StringGrid1.Cells[8,i]+directoryseparator,'*',faAnyFile,nfiles,ndirs,oname);
            if nfiles=1 then
               begin
               Form_peach.StringGrid1.Cells[8,i]:=Form_peach.StringGrid1.Cells[8,i]+directoryseparator+oname;
               Form_peach.StringGrid1.Cells[7,i]:='++';
               end;
            if iext=10000 then Form_peach.StringGrid1.Cells[7,i]:='+++';
            end;
         end;
      Form_peach.StringGrid1.Cells[11,i]:='0';
      end;
   Form_peach.Enabled:=true;
   Form_peach.SetFocus;
   if convertverbose=1 then
      if MessageDlg(txt_2_8_convertbegin, mtConfirmation, [mbYes,mbNo], 0)=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;
   Form_peach.Enabled:=false;
   end;

if Form_peach.CheckBoxSeparate.State=cbChecked then
   begin
   dummytitle:=Form_peach.Caption;
   for i:=1 to Form_peach.StringGrid1.Rowcount-1 do
      begin
      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);
      s:=uextractfilename(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:=uextractfilepath(Form_peach.Edit5.Text);
      if control_outpath_archive(otest)<>0 then begin Form_peach.enabled:=true; exit; end;
      ares:=archive_mainsequence(sel);
      Form_peach.StringGrid1.Cells[11,i]:='0';
      end;
   Form_peach.Caption:=dummytitle;
   //pf:=Form_peach.cbType.ItemIndex;
   lastoutpath:=uextractfilepath(Form_peach.Editname3.Text);
   if needwaitupdating=false then sleep(random(500)); //let some time between jobs if launched in parallel
   end
else
   begin
   sel:='all';
   otest:=uextractfilepath(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
      tarbefore(sel);
      //pf:=Form_peach.cbType.ItemIndex;
      lastoutpath:=uextractfilepath(Form_peach.Editname3.Text);
      end
   else
      begin
      ares:=archive_mainsequence(sel);
      //pf:=Form_peach.cbType.ItemIndex;
      lastoutpath:=uextractfilepath(Form_peach.Editname3.Text);
      end;
   end;

end_convert;

if Form_peach.CheckBoxDeleteInput1.Checked=true then
   begin
   checklistarchive(nsel, strsel);
   if MessageDlg(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,
                 mtWarning,[mbYes, mbNo],0)=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;

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 then exit_withsave
   else tobrowser_fromarchiver;
end;

procedure checkhaltsystem_fromA;
var
   P:tprocessutf8;
   cl:utf8string;
begin
if Form_peach.CheckBoxAutoHaltA.State=cbChecked then
   begin
   P:=tprocessutf8.Create(nil);
   P.Options := [poUsePipes, poNoConsole];
   {$IFDEF MSWINDOWS}P.CommandLine:='shutdown /s /t 10';{$ENDIF}
   {$IFDEF LINUX}P.CommandLine:='halt';{$ENDIF}
   {$IFDEF FREEBSD}P.CommandLine:='halt';{$ENDIF}
   {$IFDEF NETBSD}P.CommandLine:='halt';{$ENDIF}
   if Form_peach.Visible=true then Application.ProcessMessages;
   cl:=P.Commandline;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   exit_withsave;
   end;
end;

procedure on_buttonarchiveclick;
begin
Form_peach.Enabled:=false;
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;
endmultimode;
Form_peach.Enabled:=true;
end;

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

procedure TForm_peach.ButtonEditName3Click(Sender: TObject);
var
   s,s1:utf8string;
begin
if getoutname(s,archive_type,0)=0 then
   begin
   EditName3.Text:=uextractfilepath(s);
   if checkboxseparate.state=cbUnchecked then Edit4.Text:=uextractfilename(s);
   s:=Edit4.Text;
   if uextractfileext(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:utf8string;
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
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+' '+uextractfilepath(lastoutpath);
popupopen1.PopUp(p.x,p.y);
populatepcmenu;
end;

procedure TForm_peach.ButtonUn7za4MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
contextconvert_switch:=false;
setaddconvert_menu;
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;
pmquickdelete.visible:=true;
pmbookmarks.visible:=true;
pmorganizebookmarks.visible:=true;
pmcommand.visible:=true;
pmexplore.visible:=true;
pmproperties.visible:=true;
pmzerofree.visible:=true;
pmsecuredeletefree.visible:=true;
pmmisc.visible:=true;
MenuItem91.visible:=true;
MenuItem75.visible:=true;
pmcut.visible:=false;
{$IFDEF MSWINDOWS}
if (winver='9x') or (winver='nt4') or ((winver='nt5') and (majmin='5.0')) then
   pmproperties.visible:=false;
{$ELSE}
pmproperties.visible:=false;;
{$ENDIF}
pmcheck.visible:=true;
pmdeduplicate.visible:=true;
pmws.visible:=true;
if fun='FILEBROWSER' then
   begin
   pmsecuredelete.Visible:=true;
   pmzerofile.Visible:=true;
   {$IFDEF MSWINDOWS}pmrecycle.Visible:=true;{$ENDIF}
   pmcpyto.Visible:=true;
   pmmvto.Visible:=true;
   pmquickdelete.Visible:=true;
   pmnewfolder.Visible:=True;
   pmrename.Visible:=True;
   end
else
   begin
   pmcheck.visible:=false;
   pmdeduplicate.visible:=false;
   pmsecuredelete.Visible:=false;
   pmzerofile.Visible:=false;
   {$IFDEF MSWINDOWS}pmrecycle.Visible:=false;{$ENDIF}
   pmcpyto.Visible:=false;
   pmmvto.Visible:=false;
   pmquickdelete.Visible:=false;
   pmnewfolder.Visible:=False;
   MenuItem14.visible:=false;
   MenuItem79.visible:=false;
   pmrename.Visible:=false;
   end;
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;
pmdeduplicate.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;
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:utf8string;
begin
with form_peach do
begin
if EditOpenIn.Text<>txt_mypc then
   if (fun='FILEBROWSER') then curpath:=EditOpenIn.Text
   else curpath:=uextractfilepath(EditOpenIn.Text)
else curpath:='';
if curpath<>'' then
   if curpath[length(curpath)] <> directoryseparator then curpath:=curpath+directoryseparator;

//set quick extraction menu
if (defaultextractpath<>'')
   {and (defaultextractpath<>curpath)
   and (defaultextractpath<>local_desktop)
   and (defaultextractpath<>usr_documents)
   and (defaultextractpath<>uextractfilepath(pnb1.Caption))} 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 (uextractfilepath(pnb1.Caption)<>'') then
      begin
      pmqe1fav.visible:=true;
      pmqe1fav.caption:=txt_ext_allto+' '+uextractfilepath(pnb1.Caption)+' (Ctrl+1)';
      end
   else pmqe1fav.visible:=false;
if (uextractfilepath(pnb2.Caption)<>'') then
      begin
      pmqe2fav.visible:=true;
      pmqe2fav.caption:=txt_ext_allto+' '+uextractfilepath(pnb2.Caption)+' (Ctrl+2)';
      end
   else pmqe2fav.visible:=false;
if (uextractfilepath(pnb3.Caption)<>'') then
      begin
      pmqe3fav.visible:=true;
      pmqe3fav.caption:=txt_ext_allto+' '+uextractfilepath(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;
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;
p:=clienttoscreen(p);
PopupMenuType.popup(p.x,p.y);
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;
p:=clienttoscreen(p);
pmtestinfolist.popup(p.x,p.y);
end;

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

procedure TForm_peach.cbfSfx1Click(Sender: TObject);
begin
on_cbfSfx1Click;
end;

procedure TForm_peach.cbfWIMClick(Sender: TObject);
begin
on_cbfwimClick;
end;

procedure TForm_peach.cbfXZClick(Sender: TObject);
begin
on_cbfxzClick;
end;

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

procedure TForm_peach.CheckBox2Click(Sender: TObject);
begin
on_CheckBox2Click;
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.CheckBoxThemeBarsClick(Sender: TObject);
begin
if Form_peach.CheckBoxThemeBars.State=cbChecked then themetoolbars:=1 else themetoolbars:=0;
imgloaded:=false;
apply_theme;
end;

procedure TForm_peach.CheckBox5Click(Sender: TObject);
begin
on_CheckBox5_click;
end;

procedure TForm_peach.ButtonEditNameCustomClick(Sender: TObject);
var
   s:utf8string;
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:=uextractfilename(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;
var
   i:integer;
begin
tsize:=0;
try
srcfilesize_multipart(Form_peach.EditOpenIn.Text,tsize);
except
end;
end;

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

procedure archive_funsel(funct,select:utf8string);
var
   cl,jobcode,outname:utf8string;
begin
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if testencrypted<0 then exit;
resetminimizedlauncher;
if funct='details' then
   begin
   funct:='list';
   listmode:=0;
   end
else listmode:=1;
case select of
   'all' : calcalltsize;
   'displayed' : calcdisptsize;
   'selected' : calcseltsize;
   end;
if fun='UN7Z' then
   if compose_un7z_cl(cl,jobcode,outname,false,funct,select)=0 then launch_cl(cl,jobcode,outname);
if fun='UNARC' then
   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;
end;

procedure filebrowser_funall(funct:utf8string);//test, list, info, details (list and give info msg only)
var
   P:tprocessutf8;
   s,cl,jobcode,outname,strsel,funct1:utf8string;
   i,j,k,nsel:integer;
   scheduleclip:array of array [0..14] of utf8string;
begin
if Form_peach.StringGridList.Cells[1,1]='' then exit;
if checkfdwin<>0 then exit;
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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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);
   fun_status:='FILEBROWSER';
   if fun='UN7Z' then
      if compose_un7z_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname)
         else
      else
         if fun='UNARC' then
            if compose_unarc_cl(cl,jobcode,outname,false,funct,'all')=0 then launch_cl(cl,jobcode,outname)
            else
         else
            begin
            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;
               cl:=utf8toenv(cl);
               P.CommandLine:=cl;
               if Form_peach.Visible=true then Application.ProcessMessages;
               if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
               P.Execute;
               P.Free;
               end;
            end;
   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;

function test_shouldnotbechanged:integer; //test if it's a known modified format similar to read/write supported ones; it can be read but write operation should be disabled
begin
test_shouldnotbechanged:=0;
case testext(Form_peach.EditOpenIn.Text) of
   503: test_shouldnotbechanged:=1;
   502: test_shouldnotbechanged:=1;
   501: test_shouldnotbechanged:=1; //non-archives
   //500: result:=BExeSupported; //Windows executables, installers
   22: test_shouldnotbechanged:=1;//Puppy Linux packages
   23: test_shouldnotbechanged:=1;//PK* packages
   25: test_shouldnotbechanged:=1;//content of RPM and SLP packages
   28: test_shouldnotbechanged:=1;//U3P app package
   10001: test_shouldnotbechanged:=1;//PEA archive, don't support update
   end;
end;

procedure addtoarchive_selected;
var
   i:integer;
begin
Application.ProcessMessages;
resetminimizedlauncher;
{if Form_peach.EditOpenIn.Text=txt_mypc then
   if checklistanysel=0 then
      if checkfdwin_row(Form_peach.StringGridList.Row)=0 then
         if MessageDlg(txt_2_8_addvol, mtConfirmation, [mbYes,mbNo], 0)=7 then exit;}
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 ufilegetattr(Form_peach.StringGridList.Cells[8,i]) > 0 then
                  if ufilegetattr(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.comboboxarc2.ItemIndex:=0;
end;

procedure resetmiscarchiveopt;
begin
Form_peach.CheckBoxDate.State:=cbUnchecked;
Form_peach.comboboxarchive1.ItemIndex:=0;
ComboBoxArchive1_onchange;
end;

procedure addtoarchive_inarchive;
var
   s,fext,fextl:utf8string;
begin
Form_peach.CheckBoxSameArc.State:=cbUnchecked;
Form_peach.CheckBoxSeparate.State:=cbUnchecked;
Form_peach.CheckBoxConvert.State:=cbUnchecked;
Form_peach.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
resetminimizedlauncher;
resetmiscarchiveopt;
Form_peach.StringGrid1.AutoSizeColumns;
s:=Form_peach.EditOpenIn.Text;
Form_peach.EditName3.Text:=uextractfilepath(s);
fext:=upcase(uextractfileext(s));
//set type, set action to update
fextl:=upcase(fext);
if (fextl='.7Z') or (fextl='.TAR') or (fextl='.ZIP') then
   begin
   case fextl of
      '.7Z' : archive_type_select(STR_7Z);
      '.TAR' : archive_type_select(STR_TAR);
      '.ZIP' : archive_type_select(STR_ZIP);
      end;
   Form_peach.ComboBoxArchive7.ItemIndex:=2;
   end
else
   if fextl='.ARC' then
      begin
      archive_type_select(STR_ARC);
      Form_peach.comboboxarc2.ItemIndex:=2;
      end
   else
   if fextl='.ZPAQ' then
      begin
      archive_type_select(STR_ZPAQ);
      archive_type:='zpaq';
      Form_peach.comboboxarc2.ItemIndex:=2;
      end
   else
      begin
      MessageDlg(txt_add_error, mtWarning, [mbOK], 0);
      tobrowser_fromarchiver;
      exit;
      end;
cutextension(s);
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
skipapstatus:=true;
showpanel('archive');
autosize_stringgrid1;
Form_peach.ButtonEditname12.Enabled:=false;
Form_peach.Edit5.enabled:=false;
Form_peach.ButtonEditname3.Enabled:=false;
Form_peach.GroupBoxCreateOut.Enabled:=false;
Form_peach.ButtonEditname13.Enabled:=false;
Form_peach.pmbrowser.Enabled:=false;
Form_peach.mgobrowser.Enabled:=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.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   end;
if Form_peach.StringGridList.Cells[1,1]='' then exit;//check only for adding to existing archives
if fun='UN7Z' then addtoarchive_inarchive;
if fun='UNARC' then addtoarchive_inarchive;
if fun='UNZPAQ' then addtoarchive_inarchive;
end;

procedure TForm_peach.ButtonUn7za4Click(Sender: TObject);
begin
do_add;
end;

procedure archive_convert;
var
   s:utf8string;
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.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:=uextractfilepath(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.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;
setaddconvert_menu;
end;

function extract_finalize_bytype(fn,s:utf8string; var cl,jobcode,outname,mode:utf8string; realext:boolean): integer;
begin
if fun='FILEBROWSER' then testarctype(fn,extract_finalize_bytype,fun);
extract_finalize_bytype:=-1;
case fun of
'UNCUSTOM': if compose_uncustom_cl(cl,jobcode,outname,realext)<>0 then exit;
'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)<>0 then exit;
'UNQUAD': if compose_unquad_cl(cl,jobcode,outname,realext)<>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:utf8string):integer; //try to build the output path if it does not exists
begin
build_path:=-1;
try
uForceDirectories(s);
except
if control_outpath(s)<>0 then exit;
end;
build_path:=0;
end;

{$IFDEF MSWINDOWS}
function recyclefile_fromname(fname:utf8string):integer;
var
   FStruct: TSHFileOpStruct;
   fnamearr: array[0..255] of char;
   tmpfname: utf8string;
begin
//file already checked when the funtion is called
tmpfname:=usetfsname(fname);
fillchar(fnamearr,sizeof(fnamearr),0) ;
StrPcopy(fnamearr,expandfilename(tmpfname)+#0#0) ;
FStruct.wnd:=0;
FStruct.wFunc:=FO_DELETE;
FStruct.pFrom:=fnamearr;
FStruct.pTo:=nil;
FStruct.fFlags:= FOF_ALLOWUNDO or FOF_NOCONFIRMATION or FOF_SILENT;
FStruct.fAnyOperationsAborted := false;
FStruct.hNameMappings := nil;
Result:=ShFileOperation(FStruct);
end;
{$ENDIF}

procedure erase_fromextraction(erasemode:integer; executemode:integer; var cl:utf8string);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows)
var
   P:tprocessutf8;
   r:TSearchRec;
   bin_name,in_param,eraselevel,strsel,s,s_ext,s_name,s_path:utf8string;
   i,j,k,nsel: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];
   s_ext := uextractfileext(s);
   s_name := uextractfilename(s);
   setlength(s_name, length(s_name) - length(s_ext));
   s_path := uextractfilepath(s);
   if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
   j:=1;
   if s_ext = '.001' then
      repeat
        k := uFindFirst(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);
        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);
      until k <> 0
   else
      in_param:=in_param+delimiter+escapefilename(s,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:='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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
if executemode=1 then P.Execute;
P.Free;
end;

procedure erase_fromextractarc(erasemode:integer; executemode:integer; var cl:utf8string);//0: quick delete 1: secure delete 2: zero delete 3: recycle (Windows)
var
   P:tprocessutf8;
   r:TSearchRec;
   bin_name,in_param,eraselevel,strsel,s,s_ext,s_name,s_path:utf8string;
   i,j,k,nsel:integer;
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;
s_ext := uextractfileext(s);
s_name := uextractfilename(s);
setlength(s_name, length(s_name) - length(s_ext));
s_path := uextractfilepath(s);
if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
j:=1;
if s_ext = '.001' then
   repeat
     k := uFindFirst(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);
     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);
   until k <> 0
else
   in_param:=in_param+delimiter+escapefilename(s,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:='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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
if executemode=1 then P.Execute;
P.Free;
end;

function checklistextract(var nsel:integer; var strsel:utf8string):integer; //number of extracted objects, and formatted string with first 5 names
var
   rc,i:integer;
   s,s_ext:utf8string;
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 := uextractfileext(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(outname:utf8string);//needs waiting the extraction to complete.
var
   oname:utf8string;
begin
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
      movecontent_todir(outname+oname+directoryseparator,outname,1);
      end;
end;

procedure goextract;
var
   i,k,nsel:integer;
   cl,dummycl,jobcode,outname,s,in_param,strsel,s_in,s_ext,dummytitle:utf8string;
   sr:TSearchRec;
   goup:boolean;
begin
clearstopsequencefile;
if check_extraction_input<>0 then exit;
   if length(Form_peach.EditOpenOut.Text)>16383 then
      begin
      Form_peach.EditOpenOut.Text:='';
      MessageDlg(txt_3_1_pathexc, mtWarning, [mbOK], 0);
      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:=uextractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
   else
      Form_peach.EditOpenOut.Text:=uextractfilepath(Form_peach.EditOpenIn.Text);
if not(udirectoryexists(Form_peach.EditOpenOut.Text)) then
   if build_path(Form_peach.EditOpenOut.Text)<>0 then
      begin
      Form_peach.enabled:=true;
      exit;
      end;

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;

if fun='FILEBROWSER' then
   begin
   k:=Form_peach.StringGrid2.RowCount;

   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],tsize); //expressed in B
      except
      end;
      Form_peach.Caption:=dummytitle+' '+inttostr(i)+'/'+inttostr(k-1);
      application.ProcessMessages;
      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);
      if needwaitupdating=false then sleep(random(500)); //let some time between operations if launched in parallel
      end;
   Form_peach.Caption:=dummytitle;
   end
else
   begin
   //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);
   end;

if Form_peach.CheckBoxDeleteInput.Checked=true then
if Form_peach.RadioGroupAction.ItemIndex<2 then
   if fun='FILEBROWSER' then
   begin
   checklistextract(nsel, strsel);
   if MessageDlg(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,
                 mtWarning,[mbYes, mbNo],0)=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
   begin
      s_in:=Form_peach.EditOpenIn.Text;
      s_ext := uextractfileext(s_in);
      s_in := uextractfilename(s_in);
      if s_ext = '.001' then s_in:=s_in+'/xxx';
      if MessageDlg(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,
                 mtWarning,[mbYes, mbNo],0)=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;
lastoutpath:=Form_peach.EditOpenOut.Text;
lastextractionpath:=Form_peach.EditOpenOut.Text;
Form_peach.enabled:=true;
if stayopen=false then exit_withsave
else tobrowser_fromextractor;
if goup=true then navgoup;
end;

procedure checkhaltsystem_fromE;
var
   P:tprocessutf8;
   cl:utf8string;
begin
if Form_peach.CheckBoxAutoHaltE.State=cbChecked then
   begin
   P:=tprocessutf8.Create(nil);
   P.Options := [poUsePipes, poNoConsole];
   {$IFDEF MSWINDOWS}P.CommandLine:='shutdown /s /t 10';{$ENDIF}
   {$IFDEF LINUX}P.CommandLine:='halt';{$ENDIF}
   {$IFDEF FREEBSD}P.CommandLine:='halt';{$ENDIF}
   {$IFDEF NETBSD}P.CommandLine:='halt';{$ENDIF}
   if Form_peach.Visible=true then Application.ProcessMessages;
   cl:=P.Commandline;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   exit_withsave;
   end;
end;

procedure on_buttonextokclick;
begin
Form_peach.Enabled:=false;
if Form_peach.StringGrid2.RowCount=1 then
   begin
   if stayopen=false then exit_withsave
   else tobrowser_fromextractor;
   end
else
   begin
   goextract;
   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;
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;
p:=clienttoscreen(p);
pmImageRotate.popup(p.x,p.y);
end;

function checkimgsupported(s:utf8string):boolean;
var
   ext:utf8string;
begin
result:=false;
ext:=lowercase(uextractfileext(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:utf8string);
var
   i:integer;
   s:utf8string;
   name_ok:boolean;
begin
if (ufileexists(out_param) or udirectoryexists(out_param)) then
   begin
   i:=1;
   name_ok:=false;
   s:=out_param;
   cutextension(s);
   repeat
      if (ufileexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param)) or udirectoryexists(s+NAMEVARSTR+inttostr(i)+uextractfileext(out_param))) then inc(i,1)
      else name_ok:=true;
   until name_ok = true;
   out_param:=s+NAMEVARSTR+inttostr(i)+uextractfileext(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;
p:=clienttoscreen(p);
pmImageResize.popup(p.x,p.y);
end;

procedure browser_imgrotate(fname:utf8string; reporig:boolean; rfun:utf8string);
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:utf8string):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:utf8string);
var
   i,j,k,nsel:integer;
   s,s1,cl,jobcode,outname,strsel,stitle,sfun,rfunl:utf8string;
   reporig:boolean;
   scheduleclip:array of array [0..14] of utf8string;
begin
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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_4_8_replace+char($0D)+char($0A)+char($0D)+char($0A)+sfun+' '+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel, mtConfirmation, [mbYes,mbNo,mbCancel], 0) 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:utf8string; reporig:boolean; percentw,percenth:integer; w,h:int64; resfun:integer; convext:utf8string; 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:utf8string;
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:utf8string; convopt:integer);
var
   i,j,k,nsel:integer;
   s,s1,cl,jobcode,outname,strsel,stitle,sfun:utf8string;
   reporig:boolean;
   scheduleclip:array of array [0..14] of utf8string;
begin
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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_4_8_replace+char($0D)+char($0A)+char($0D)+char($0A)+sfun+' '+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel, mtConfirmation, [mbYes,mbNo,mbCancel], 0) 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:utf8string;
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('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:utf8string;
   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:utf8string; 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,outname,strsel,stitle,sfun:utf8string;
   reporig:boolean;
   scheduleclip:array of array [0..14] of utf8string;
begin
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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_4_8_replace+char($0D)+char($0A)+char($0D)+char($0A)+sfun+' '+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel, mtConfirmation, [mbYes,mbNo,mbCancel], 0) 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:utf8string;
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;
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:integer;
   s1,s2:utf8string;
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;
      exit;
      end;
   {$ENDIF}
   if check7zvolume(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row])=true then
   else
      if not(ufileexists((StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]))) and
      not(udirectoryexists((StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]))) then
         begin
         MessageDlg(StringGridSessionHistory.Cells[2,StringGridSessionHistory.Row]+' '+txt_not_accessible, mtWarning, [mbOK], 0);
         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;
      list_un7z('browse');
      status0:=StringGridSessionHistory.Cells[1,StringGridSessionHistory.Row];
      //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;
   browsinghistory:=false;
   end;
end;

procedure navrefresh;
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 list_un7z_expandall
      else
         begin
         list_un7z('browse');
         status0:=txt_list_browsing;
         browsingmode7z:=0;
         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:utf8string):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;
//menuitemopen_ext_caption; //will change session output path to user-selected path (all functions will point to the new path: extract, ext&run, preview)
set_extractto_pathto:=0;
end;

procedure setstatus5;
begin
Form_peach.labelstatus5.Caption:=txt_ext_all;
end;

procedure list_toextractor(act,modeofuse:utf8string);
var
   i,rc,c,k:integer;
   okfile,checksel:boolean;
begin
Form_peach.labelstatus5.Caption:='';
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  //no folders
            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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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;
   Form_peach.StringGrid2.RowCount:=k;
   updatecontent_ext;
   //if k=1 then exit; //deactivated, allows to swich to empty extraction interface form browser, like for archiving interface
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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.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.cbadlerClick(Sender: TObject);
begin
on_cbadlerClick;
end;

procedure TForm_peach.cbcheckallClick(Sender: TObject);
begin
on_cbcheckallClick;
end;

procedure TForm_peach.cbcrc16Click(Sender: TObject);
begin
on_cbcrc16Click;
end;

procedure TForm_peach.cbcrc24Click(Sender: TObject);
begin
on_cbcrc24Click;
end;

procedure TForm_peach.cbcrc32Click(Sender: TObject);
begin
on_cbcrc32Click;
end;

procedure TForm_peach.cbcrc64Click(Sender: TObject);
begin
on_cbcrc64Click;
end;

procedure TForm_peach.cbed2kClick(Sender: TObject);
begin
on_cbed2kClick;
end;

procedure TForm_peach.cbf11Click(Sender: TObject);
begin
on_cbf11Click;
end;

procedure TForm_peach.cbf1Click(Sender: TObject);
begin
on_cbf1Click;
end;

procedure TForm_peach.cbf2Click(Sender: TObject);
begin
on_cbf2Click;
end;

procedure TForm_peach.cbf3Click(Sender: TObject);
begin
on_cbf3Click;
end;

procedure TForm_peach.cbf5Click(Sender: TObject);
begin
on_cbf5Click;
end;

procedure TForm_peach.cbf6Click(Sender: TObject);
begin
on_cbf6Click;
end;

procedure TForm_peach.cbf7Click(Sender: TObject);
begin
on_cbf7Click;
end;

procedure TForm_peach.cbf8Click(Sender: TObject);
begin
on_cbf8Click;
end;

procedure TForm_peach.cbf9Click(Sender: TObject);
begin
on_cbf9Click;
end;

procedure TForm_peach.cbf10Click(Sender: TObject);
begin
on_cbf10Click;
end;

procedure TForm_peach.cbfARCClick(Sender: TObject);
begin
on_cbfarcClick;
end;

procedure TForm_peach.cbfCustomClick(Sender: TObject);
begin
on_cbfCustomClick;
end;

procedure TForm_peach.cbfSfxClick(Sender: TObject);
begin
on_cbfSfxClick;
end;

procedure TForm_peach.cbmd4Click(Sender: TObject);
begin
on_cbmd4Click;
end;

procedure TForm_peach.cbmd5Click(Sender: TObject);
begin
on_cbmd5Click;
end;

procedure TForm_peach.cbrmdClick(Sender: TObject);
begin
on_cbrmdClick;
end;

procedure TForm_peach.cbsha1Click(Sender: TObject);
begin
on_cbsha1Click;
end;

procedure TForm_peach.cbsha224Click(Sender: TObject);
begin
on_cbsha224Click;
end;

procedure TForm_peach.cbsha256Click(Sender: TObject);
begin
on_cbsha256Click;
end;

procedure TForm_peach.cbsha384Click(Sender: TObject);
begin
on_cbsha384Click;
end;

procedure TForm_peach.cbsha512Click(Sender: TObject);
begin
on_cbsha512Click;
end;

procedure TForm_peach.cbTypeChange(Sender: TObject);
begin
on_cbtypechange;
end;

procedure TForm_peach.ComboBox7zalgoChange(Sender: TObject);
begin
//no action taken; AES256 is provided as standard algorithm from the frontend and ZypCrypto is provided only as legacy
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:utf8string;
begin
updatepluginstatus;
checkdom(dom,s);
cp_open(dom+'peazip-add-ons.html',desk_env);
end;

procedure toggle_view;
begin
if browserbusy=true then exit;
if fun='UN7Z' then
   if status0=txt_list_browsing then list_un7z_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 MessageDlg(txt_toggle_warning, mtWarning,[mbYes, mbNo],0)=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 openpath;
var
   s:utf8string;
begin
fun:='FILEBROWSER';
fun_status:=fun;
if ufileexists((Form_peach.EditOpenIn.Text)) then Form_peach.SelectDirectoryDialog1.InitialDir:=uextractfilepath(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.EditOpenIn.Text:=s;
Form_peach.EditUn7zaFilter.Text:='*';
listdir(s,false,false);
addtohistory;
end;

procedure opendevice(s:utf8string);
var
   s1:utf8string;
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:utf8string;
   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 listpc
else {$ENDIF}
   begin
   if (check7zvolume(s)=false) and (udirectoryexists(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 ufileexists(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:=uextractfilepath(Form_peach.EditUn7zaFilter.Text)+'*'+directoryseparator+'*';
            list_un7z('browse');
            status0:=txt_list_browsing;
            browsingmode7z:=0;
            addtohistory;
            end
         else
            begin
            list_un7z_search;
            end;
         end;
      end;
   end;
end;

procedure jumpto(jumpdest:utf8string);
var
   s:utf8string;
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:=uextractfilepath(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 MessageDlg(txt_3_6_resetapps, mtInformation,[mbYes, mbNo],0)=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
LabelClickAddress8.Color:=clNone;
bctemp:=0;
end;

procedure TForm_peach.LabelConf1Click(Sender: TObject);
begin
cp_open(LabelConf.Caption,desk_env);
end;

procedure configure_systemintegration;
var
   P:tprocessutf8;
   cl:utf8string;
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;
P.Options := [poNoConsole];
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure TForm_peach.LabelConfigurePeaZipClick(Sender: TObject);
begin
configure_systemintegration;
end;

procedure TForm_peach.LabelConfigureSendToClick(Sender: TObject);
begin
cp_open(usr_sendto,desk_env);
end;

procedure TForm_peach.LabelDonationsClick(Sender: TObject);
var dom,s:utf8string;
begin
checkdom(dom,s);
cp_open(dom+'donations.html',desk_env);
end;

procedure TForm_peach.LabelLang2Click(Sender: TObject);
begin
changelanguage; //cp_open(executable_path+'res'+directoryseparator+'lang'+directoryseparator,desk_env);
end;

procedure TForm_peach.LabelLang4Click(Sender: TObject);
begin
MessageDlg(txt_5_3_cmlmessage, mtInformation, [mbOk], 0);
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 MessageDlg(txt_3_6_resetapps, mtInformation,[mbYes, mbNo],0)=6 then
   begin
   reset_custedit;
   set_adveditcl(StringGridCustedit1.Row);
   set_custedit_fromtable;
   set_custedit_menus;
   save_custedit;
   end;
end;

procedure resetbookmarks(rmode:utf8string);
var
   s:utf8string;
begin
case rmode of
   'reset': s:=txt_5_0_resetbookmarks;
   'delete': s:=txt_2_4_deletebookmarks;
   end;
if MessageDlg(s, mtInformation,[mbYes, mbNo],0)=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;
end;

procedure TForm_peach.LabelResetHistoryClick(Sender: TObject);
begin
dohistoryreset;
end;

procedure resetpmmain;
begin
if MessageDlg(txt_5_0_resetpm, mtWarning,[mbYes, mbNo],0)=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 udirectoryexists(peaziptmpdir) then cp_open(peaziptmpdir,desk_env);
end;

procedure TForm_peach.LabelStatus5Click(Sender: TObject);
var stitlestring:utf8string;
begin
stitlestring:=titlestring;
list_toextractor('all','full');
titlestring:=stitlestring;
end;

procedure TForm_peach.LabelTitleAdd1Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd1);
end;

procedure TForm_peach.LabelTitleAdd1MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd1);
end;

procedure TForm_peach.LabelTitleAdd1MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd1);
end;

procedure TForm_peach.LabelTitleAdd2Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd2);
end;

procedure TForm_peach.LabelTitleAdd2MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd2);
end;

procedure TForm_peach.LabelTitleAdd2MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd2);
end;

procedure TForm_peach.LabelTitleAdd3Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd3);
end;

procedure TForm_peach.LabelTitleAdd3MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd3);
end;

procedure TForm_peach.LabelTitleAdd3MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd3);
end;

procedure TForm_peach.LabelTitleAdd4Click(Sender: TObject);
begin
clicklabel_add(LabelTitleAdd4);
end;

procedure TForm_peach.LabelTitleAdd4MouseEnter(Sender: TObject);
begin
enterlabel_add(LabelTitleAdd4);
end;

procedure TForm_peach.LabelTitleAdd4MouseLeave(Sender: TObject);
begin
exitlabel_add(LabelTitleAdd4);
end;

procedure TForm_peach.LabelTitleApps1Click(Sender: TObject);
begin
clicklabel_apps(LabelTitleApps1);
end;

procedure TForm_peach.LabelTitleApps1MouseEnter(Sender: TObject);
begin
enterlabel_apps(LabelTitleApps1);
end;

procedure TForm_peach.LabelTitleApps1MouseLeave(Sender: TObject);
begin
exitlabel_apps(LabelTitleApps1);
end;

procedure TForm_peach.LabelTitleApps2Click(Sender: TObject);
begin
clicklabel_apps(LabelTitleApps2);
end;

procedure TForm_peach.LabelTitleApps2MouseEnter(Sender: TObject);
begin
enterlabel_apps(LabelTitleApps2);
end;

procedure TForm_peach.LabelTitleApps2MouseLeave(Sender: TObject);
begin
exitlabel_apps(LabelTitleApps2);
end;

procedure TForm_peach.LabelTitleExtract1Click(Sender: TObject);
begin
clicklabel_extract(LabelTitleExtract1);
end;

procedure TForm_peach.LabelTitleExtract1MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract1);
end;

procedure TForm_peach.LabelTitleExtract1MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract1);
end;

procedure TForm_peach.LabelTitleExtract2Click(Sender: TObject);
begin
clicklabel_extract(LabelTitleExtract2);
end;

procedure TForm_peach.LabelTitleExtract2MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract2);
end;

procedure TForm_peach.LabelTitleExtract2MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract2);
end;

procedure TForm_peach.LabelTitleExtract3Click(Sender: TObject);
begin
clicklabel_extract(LabelTitleExtract3);
end;

procedure TForm_peach.LabelTitleExtract3MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract3);
end;

procedure TForm_peach.LabelTitleExtract3MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract3);
end;

procedure TForm_peach.LabelTitleExtract4Click(Sender: TObject);
begin
clicklabel_extract(LabelTitleExtract4);
end;

procedure TForm_peach.LabelTitleExtract4MouseEnter(Sender: TObject);
begin
enterlabel_extract(LabelTitleExtract4);
end;

procedure TForm_peach.LabelTitleExtract4MouseLeave(Sender: TObject);
begin
exitlabel_extract(LabelTitleExtract4);
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.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.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;

procedure TForm_peach.mextractClick(Sender: TObject);
begin
do_extract;
end;

procedure TForm_peach.maddconvertClick(Sender: TObject);
begin
//select_all('0');
archive_convert;
end;

procedure TForm_peach.maddexistingClick(Sender: TObject);
begin
//select_all('0');
if open_archive<>1 then exit;
do_add;
end;

procedure TForm_peach.mlayoutsClick(Sender: TObject);
begin
if not(udirectoryexists(confpath+'Layouts'+DirectorySeparator)) then umkdir(confpath+'Layouts'+DirectorySeparator);
cp_open(confpath+'Layouts'+DirectorySeparator,desk_env);
end;

procedure TForm_peach.mPeaFBClick(Sender: TObject);
begin
cp_open('http://www.facebook.com/pages/PeaZip/21089924985',desk_env);
end;

procedure TForm_peach.mPeaGPClick(Sender: TObject);
begin
cp_open('https://plus.google.com/111732716723327086523',desk_env);
end;

procedure TForm_peach.mPeaTWClick(Sender: TObject);
begin
cp_open('http://twitter.com/peazip_software',desk_env);
end;

procedure apply_select(var istr:utf8string; val,op:utf8string);
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:utf8string; op:utf8string);
var
   i,rc,sr,wsel,wa,wd:integer;
   ci,cs,sdt,sdtr,istr:utf8string;
   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)+dateseparator+copy(sg.Cells[wd,i],6,2)+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)+dateseparator+copy(sg.Cells[wd,sr],6,2)+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)+dateseparator+copy(sg.Cells[wd,i],6,2)+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:=editheight+4;
      if Form_peach.PanelListBar.Height<LBH then Form_peach.PanelListBar.Height:=LBH;
      Form_peach.maddress.Checked:=true;
      Form_peach.MenuItemOrganizeAddressbar.Checked:=true;
      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
LabelAdvIncludeAlso.visible:=statalso;
CheckBoxAdvRecurseAlso.visible:=statalso;
MemoAdvIncludeAlso.visible:=statalso;
if statalso=true then Height:=390
else Height:=290;
end;
end;

procedure set_advfilters(opt:integer);
var
   a1,a1also,a2:array of utf8string;
   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.cbdeleteinputmode1Change(Sender: TObject);
begin
on_cbdeleteinputmode1Change;
end;

procedure TForm_peach.cbdeleteinputmodeChange(Sender: TObject);
begin
on_cbdeleteinputmodeChange;
end;

procedure TForm_peach.madvfiltersClick(Sender: TObject);
begin
try
if Form_peach.madvfilters.checked=false then
   begin
   set_advfilters(1);
   end
else
   begin
   FormAdvf.Checkboxadvfilters.state:=cbunchecked;
   set_advfilters_enabled(false);
   Form_peach.cbadvf1.state:=cbunchecked;
   Form_peach.cbadvf2.state:=cbunchecked;
   advfiltersupdate;
   end;
except
end;
end;

procedure do_alltasks;
begin
{$IFDEF MSWINDOWS}
shellexecutew(Form_peach.handle, PWideChar('open'), PWideChar('EXPLORER.EXE'), PWideChar('shell:::{ED7BA470-8E54-465E-825C-99712043E01C}'), PWideChar (''), SW_SHOWNORMAL);
{$ENDIF}
end;

procedure TForm_peach.mb0Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
showpanel('open');
addtobookmarks('*browser');
navrefresh;
end;

procedure TForm_peach.mb10Click(Sender: TObject);
begin
browsebookmark(10);
end;

procedure TForm_peach.mb11Click(Sender: TObject);
begin
browsebookmark(11);
end;

procedure TForm_peach.mb12Click(Sender: TObject);
begin
browsebookmark(12);
end;

procedure TForm_peach.mb13Click(Sender: TObject);
begin
browsebookmark(13);
end;

procedure TForm_peach.mb14Click(Sender: TObject);
begin
browsebookmark(14);
end;

procedure TForm_peach.mb15Click(Sender: TObject);
begin
browsebookmark(15);
end;

procedure TForm_peach.mb16Click(Sender: TObject);
begin
browsebookmark(16);
end;

procedure TForm_peach.mb17Click(Sender: TObject);
begin
browsebookmark(17);
end;

procedure TForm_peach.mb18Click(Sender: TObject);
begin
browsebookmark(18);
end;

procedure TForm_peach.mb19Click(Sender: TObject);
begin
browsebookmark(19);
end;

procedure TForm_peach.mb1Click(Sender: TObject);
begin
browsebookmark(1);
end;

procedure TForm_peach.mb20Click(Sender: TObject);
begin
browsebookmark(20);
end;

procedure TForm_peach.mb21Click(Sender: TObject);
begin
browsebookmark(21);
end;

procedure TForm_peach.mb22Click(Sender: TObject);
begin
browsebookmark(22);
end;

procedure TForm_peach.mb23Click(Sender: TObject);
begin
browsebookmark(23);
end;

procedure TForm_peach.mb24Click(Sender: TObject);
begin
{$IFDEF MSWINDOWS}if Form_peach.PanelOpen.visible=false{$ELSE}if Form_peach.PanelOpen.top<>0{$ENDIF} then exit;
showpanel('open');
if stringgridbookmarks.visible=false then showbar('bookmarks');
navrefresh;
end;

procedure TForm_peach.mb2Click(Sender: TObject);
begin
browsebookmark(2);
end;

procedure TForm_peach.mb3Click(Sender: TObject);
begin
browsebookmark(3);
end;

procedure TForm_peach.mb4Click(Sender: TObject);
begin
browsebookmark(4);
end;

procedure TForm_peach.mb5Click(Sender: TObject);
begin
browsebookmark(5);
end;

procedure TForm_peach.mb6Click(Sender: TObject);
begin
browsebookmark(6);
end;

procedure TForm_peach.mb7Click(Sender: TObject);
begin
browsebookmark(7);
end;

procedure TForm_peach.mb8Click(Sender: TObject);
begin
browsebookmark(8);
end;

procedure TForm_peach.mb9Click(Sender: TObject);
begin
browsebookmark(9);
end;

procedure TForm_peach.mbackaliasClick(Sender: TObject);
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:utf8string;
begin
if ufileexists((Form_peach.EditOpenIn.Text)) then Form_peach.OpenDialogArchive.InitialDir:=uextractfilepath(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:utf8string;
begin
if ufileexists((Form_peach.EditOpenIn.Text)) then Form_peach.SelectDirectoryDialog1.InitialDir:=uextractfilepath(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:utf8string;
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[length(s)]=directoryseparator then //folder
else //get object's path
   s:=uextractfilepath(s);
if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); 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:utf8string;
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 MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
cp_open(uextractfilepath(s),desk_env);
{$ENDIF}
end;

procedure addnote_tobookmarks;
var
   s:utf8string;
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:utf8string;
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[length(s)]=directoryseparator then //open folder
else //go to object's path
   s:=uextractfilepath(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;
set_listview_col;
end;

procedure TForm_peach.mccrcClick(Sender: TObject);
begin
ccrc:=not(ccrc);
mccrc.Checked:=ccrc;
set_listview_col;
end;

procedure TForm_peach.mcdateClick(Sender: TObject);
begin
cdate:=not(cdate);
mcdate.Checked:=cdate;
set_listview_col;
end;

procedure TForm_peach.mcfreeClick(Sender: TObject);
begin
cfree:=not(cfree);
mcfree.Checked:=cfree;
set_listview_col;
end;

procedure TForm_peach.mcfsClick(Sender: TObject);
begin
cfs:=not(cfs);
mcfs.Checked:=cfs;
set_listview_col;
end;

procedure setbrowserch(i:integer);
begin
with Form_peach do begin
mchadler32.Checked:=false;
mchcrc16.Checked:=false;
mchcrc24.Checked:=false;
mchcrc32.Checked:=false;
mchcrc64.Checked:=false;
mchedonkey.Checked:=false;
mchmd4.Checked:=false;
mchmd5.Checked:=false;
mchripemd160.Checked:=false;
mchsha1.Checked:=false;
mchsha224.Checked:=false;
mchsha256.Checked:=false;
mchsha384.Checked:=false;
mchsha512.Checked:=false;
mchwhirlpool512.Checked:=false;
case i of
   1: mchadler32.Checked:=true;
   2: mchcrc16.Checked:=true;
   3: mchcrc24.Checked:=true;
   4: mchcrc32.Checked:=true;
   5: mchcrc64.Checked:=true;
   6: mchedonkey.Checked:=true;
   7: mchmd4.Checked:=true;
   8: mchmd5.Checked:=true;
   9: mchripemd160.Checked:=true;
  10: mchsha1.Checked:=true;
  11: mchsha224.Checked:=true;
  12: mchsha256.Checked:=true;
  13: mchsha384.Checked:=true;
  14: mchsha512.Checked:=true;
  15: mchwhirlpool512.Checked:=true;
   end;
browserch:=i;
set_listview_cnames;
end;
end;

procedure TForm_peach.mchadler32Click(Sender: TObject);
begin
setbrowserch(1);
end;

procedure TForm_peach.mchcrc16Click(Sender: TObject);
begin
setbrowserch(2);
end;

procedure TForm_peach.mchcrc24Click(Sender: TObject);
begin
setbrowserch(3);
end;

procedure TForm_peach.mchcrc32Click(Sender: TObject);
begin
setbrowserch(4);
end;

procedure TForm_peach.mchcrc64Click(Sender: TObject);
begin
setbrowserch(5);
end;

procedure TForm_peach.mchedonkeyClick(Sender: TObject);
begin
setbrowserch(6);
end;

procedure TForm_peach.mchmd4Click(Sender: TObject);
begin
setbrowserch(7);
end;

procedure TForm_peach.mchmd5Click(Sender: TObject);
begin
setbrowserch(8);
end;

procedure TForm_peach.mchripemd160Click(Sender: TObject);
begin
setbrowserch(9);
end;

procedure TForm_peach.mchsha1Click(Sender: TObject);
begin
setbrowserch(10);
end;

procedure TForm_peach.mchsha224Click(Sender: TObject);
begin
setbrowserch(11);
end;

procedure TForm_peach.mchsha256Click(Sender: TObject);
begin
setbrowserch(12);
end;

procedure TForm_peach.mchsha384Click(Sender: TObject);
begin
setbrowserch(13);
end;

procedure TForm_peach.mchsha512Click(Sender: TObject);
begin
setbrowserch(14);
end;

procedure TForm_peach.mchwhirlpool512Click(Sender: TObject);
begin
setbrowserch(15);
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;
set_listview_col;
end;

procedure TForm_peach.mcpClick(Sender: TObject);
var
   s:utf8string;
   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:=uextractfilepath(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;
set_listview_col;
end;

procedure TForm_peach.mdefaultarchiveClick(Sender: TObject);
var
   s:utf8string;
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:=uextractfilename(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:=uextractfilepath(s);
   Form_peach.Edit4.Text:=uextractfilename(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
if winver='9x' then if btype=2 then btype:=0;
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;
   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;
   browsertype:=1;
   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;
   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;
set_listview_col;
end;

procedure TForm_peach.mpeaextractorClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:utf8string;
begin
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pealauncher'+EXEEXT+delimiter;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.mpluginsClick(Sender: TObject);
var dom,s:utf8string;
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:utf8string;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help-faq.html',desk_env);
end;

procedure TForm_peach.mPeaSiteMirrorClick(Sender: TObject);
var dom,s:utf8string;
begin
checkdom(dom,s);
cp_open(dom+'index.html',desk_env);
end;

procedure TForm_peach.MenuItemArchive_dropboxClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_dropbox;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_googledriveClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_googledrive;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_musicClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_music;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_myboxfilesClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_myboxfiles;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_picturesClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_pictures;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_skydriveClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_skydrive;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_onedriveClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_onedrive;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_ubuntuoneClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=shared_ubuntuone;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_videosClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_videos;
Form_peach.Edit4.Text:=uextractfilename(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:=uextractfilepath(shared_dropbox);
end;

procedure TForm_peach.MenuItemOpen_googledriveClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(shared_googledrive);
end;

procedure TForm_peach.MenuItemOpen_musicClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(usr_music);
end;

procedure TForm_peach.MenuItemOpen_myboxfilesClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(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:=uextractfilepath(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:=uextractfilepath(shared_onedrive);
end;

procedure TForm_peach.MenuItemOpen_skydriveClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(shared_skydrive);
end;

procedure TForm_peach.MenuItemOpen_ubuntuoneClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(shared_ubuntuone);
end;

procedure TForm_peach.MenuItemOpen_videosClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(usr_videos);
end;

procedure TForm_peach.MenuItemPowerShellClick(Sender: TObject);
var
   s:utf8string;
   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:=uextractfilepath(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:utf8string;
begin
checkdom(dom,s);
cp_open(dom+'peazip-help.html',desk_env);
end;

procedure TForm_peach.mpeautilsClick(Sender: TObject);
var
   P:tprocessutf8;
   cl:utf8string;
begin
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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.Panelnav5MouseEnter(Sender: TObject);
begin
  Panelnav5.Color:=StringToColor(COLHIGH);
end;

procedure TForm_peach.Panelnav5MouseLeave(Sender: TObject);
begin
  Panelnav5.Color:=stringtocolor(color2);
end;

procedure TForm_peach.PanelTitleOptionsClick(Sender: TObject);
begin

end;

procedure TForm_peach.pmabc1Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc1.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc2Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc2.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc3Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc3.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc4Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc4.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc5Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc5.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc6Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc6.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc7Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc7.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmabc8Click(Sender: TObject);
begin
EditUn7zaFilter1.Caption:=pmabc8.Caption;
kp_EditUn7zaFilter1_nr;
end;

procedure TForm_peach.pmbccpClick(Sender: TObject);
var
   s:utf8string;
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,uextractfilepath(s));
end;

procedure do_click_breadmenu(i:integer);
var
   Node: TTreeNode;
   s:utf8string;
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;

procedure TForm_peach.pmbcd0Click(Sender: TObject);
begin
do_click_breadmenu(0);
end;

procedure TForm_peach.pmbcd10Click(Sender: TObject);
begin
do_click_breadmenu(10);
end;

procedure TForm_peach.pmbcd11Click(Sender: TObject);
begin
do_click_breadmenu(11);
end;

procedure TForm_peach.pmbcd12Click(Sender: TObject);
begin
do_click_breadmenu(12);
end;

procedure TForm_peach.pmbcd13Click(Sender: TObject);
begin
do_click_breadmenu(13);
end;

procedure TForm_peach.pmbcd14Click(Sender: TObject);
begin
do_click_breadmenu(14);
end;

procedure TForm_peach.pmbcd15Click(Sender: TObject);
begin
do_click_breadmenu(15);
end;

procedure TForm_peach.pmbcd16Click(Sender: TObject);
begin
do_click_breadmenu(16);
end;

procedure TForm_peach.pmbcd17Click(Sender: TObject);
begin
do_click_breadmenu(17);
end;

procedure TForm_peach.pmbcd18Click(Sender: TObject);
begin
do_click_breadmenu(18);
end;

procedure TForm_peach.pmbcd19Click(Sender: TObject);
begin
do_click_breadmenu(19);
end;

procedure TForm_peach.pmbcd1Click(Sender: TObject);
begin
do_click_breadmenu(1);
end;

procedure TForm_peach.pmbcd2Click(Sender: TObject);
begin
do_click_breadmenu(2);
end;

procedure TForm_peach.pmbcd3Click(Sender: TObject);
begin
do_click_breadmenu(3);
end;

procedure TForm_peach.pmbcd4Click(Sender: TObject);
begin
do_click_breadmenu(4);
end;

procedure TForm_peach.pmbcd5Click(Sender: TObject);
begin
do_click_breadmenu(5);
end;

procedure TForm_peach.pmbcd6Click(Sender: TObject);
begin
do_click_breadmenu(6);
end;

procedure TForm_peach.pmbcd7Click(Sender: TObject);
begin
do_click_breadmenu(7);
end;

procedure TForm_peach.pmbcd8Click(Sender: TObject);
begin
do_click_breadmenu(8);
end;

procedure TForm_peach.pmbcd9Click(Sender: TObject);
begin
do_click_breadmenu(9);
end;

procedure TForm_peach.pmbcexploreClick(Sender: TObject);
var
   s:utf8string;
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 MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
   winexplorepath(s);
   {$ELSE}
   cp_open(uextractfilepath(s),desk_env);
   {$ENDIF}
   end;
end;

procedure TForm_peach.pmbcnewinstClick(Sender: TObject);
var
   s:utf8string;
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,uextractfilepath(s));
end;

procedure TForm_peach.pmbcorganizebookmarksClick(Sender: TObject);
begin
do_organizebookmarks;
end;

procedure TForm_peach.pmbcpropertiesClick(Sender: TObject);
var
   s:utf8string;
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:utf8string;
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,uextractfilepath(s));
end;

procedure getmainfiledirname(var s:utf8string);
begin
with form_peach do
begin
if EditOpenIn1.Caption=txt_mypc then s:=''
else
   begin
   s:=uextractfilename(EditOpenIn1.Caption);
   if s='' then
      begin
      s:=copy(EditOpenIn1.Caption,0,length(EditOpenIn1.Caption)-1);
      s:=uextractfilename(s);
      end;
   end;
end;
end;

function unpadaddress(s:utf8string):utf8string;
begin
result:=copy(s,2,length(s)-2);
end;

procedure TForm_peach.pmbcwebClick(Sender: TObject);
var
   s:utf8string;
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.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
if (winver='9x') or (winver='nt4') or ((winver='nt5') and (majmin='5.0')) then exit
else
   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;
end;

//function SHMultiFileProperties(pDataObj: IDataObject; Flag: DWORD): HRESULT;
//   stdcall; external 'shell32.dll';

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:utf8string);
var
   s:utf8string;
   spars: TStringList;
   i:integer;
begin
{$IFDEF MSWINDOWS}
if checkfdwin<>0 then exit;
if (winver='9x') or (winver='nt4') or ((winver='nt5') and (majmin='5.0')) then exit; //supported on Win2K and higher, errors reported on 2K so on this system version is disallowed
spars:=TStringList.Create;
with Form_peach do
begin
if s_in<>'' then
   begin
   if s_in<>txt_mypc then spars.Add(utf8decode(usetfsname(s_in)))
   else
      if checklistsel=0 then
         spars.Add(utf8decode(usetfsname(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(utf8decode(usetfsname(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(utf8decode(usetfsname(StringGridList.Cells[8,i])));
         end;
   if checklistsel=0 then ShowFileProperties(spars, 0)
   else
      begin
      spars.Add(utf8decode(usetfsname(EditOpenIn.Text)));
      ShowFileProperties(spars, 0);
      end;
   end
else
   begin
   spars.Add(utf8decode(usetfsname(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.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);
   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:utf8string):integer;
var
   s1,s2:utf8string;
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
   MessageDlg(txt_error_passwordnotmatch, mtWarning, [mbOK], 0);
   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
      MessageDlg(FormPM.EditName3.Text+' '+txt_keyfile_not_found, mtError,[mbOk],0);
      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:utf8string;

procedure exitloadpm;
begin
pmnotdecrypted:=1;
CloseFile(pmfileb);
setpwmanmenus(0);
end;

begin
setpwmanmenus(0);
if ufileexists(confpath+'pm')=false then exit;
try
uassignfile(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 MessageDlg(txt_4_3_pwmancorr, mtInformation,[mbYes, mbNo],0)=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:utf8string;
   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
uassignfile(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.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
   s:utf8string;
   spars: TStringList;
   i:integer;
begin
{$IFDEF MSWINDOWS}
if (winver='9x') or (winver='nt4') then exit; //supported on Win2K and higher
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(udirectoryexists(confpath+'Scripts'+DirectorySeparator)) then umkdir(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
eraseselected_list(2);
end;

procedure sanitizedisk(smode:integer); //1:secure delete free space 2: zero free space
var
   s,s0,sdrive,fstype,s1,eraselevel,cl,bin_name:utf8string;
   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);
if (winver='nt6+') or (winver='nt5') then
   begin
   sdrive:=s+'\';
   GetVolumeInformation(Pchar(sdrive),
   @bufVolumeName, sizeof(bufVolumeName),
   @sn, mc, flags,
   @bufFSName, sizeof(bufFSName));
   fstype:=bufFSName;
   end
else fstype:='';
if fstype<>'' then s0:=s+' ('+fstype+')' else s0:=s;

if Form_peach.visible=true then
   if MessageDlg(s0+char($0D)+char($0A)+char($0D)+char($0A)+s1+char($0D)+char($0A)+char($0D)+char($0A)+txt_5_2_free,mtConfirmation,[mbYes,mbNo], 0)=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;
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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.po_checksumClick(Sender: TObject);
begin
getcheck('displayed');
end;

procedure TForm_peach.po_checksumselClick(Sender: TObject);
begin
getcheck('selected');
end;

procedure copypaths;
var
   strsel:utf8string;
   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:utf8string;
begin
checkdom(dom,s);
if s='' then
   cp_open(dom,desk_env)
else
   begin
{$IFDEF MSWINDOWS}
try
if s=PEAZIPVERSION+PEAZIPREVISION then
   MessageDlg(s+' - '+txt_4_5_noupdate, mtInformation,[mbOk],0)
else
   if MessageDlg(s+' - '+txt_4_5_goupdate, mtInformation,[mbYes, mbNo],0)=6 then
      cp_open(dom,desk_env);
except
MessageDlg(txt_4_5_koupdate, mtWarning,[mbOk],0)
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' 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;
wasselected:=Form_peach.StringGridList.Row;
if wasselectedp=Form_peach.StringGridList.Row 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.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);
var
   i:integer;
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:=clWindow;
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;
p:=clienttoscreen(p);
pmmtool.PopUp(p.x,p.y);
end;

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

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

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

procedure setusebreadcrumb(i:integer);
begin
if COMPQT=1 then exit;
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.pmdeduplicateClick(Sender: TObject);
begin
deduplicate('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:utf8string;
begin
checkdom(dom,s);
cp_open(dom+'donations.html',desk_env);
end;

procedure TForm_peach.MenuItemArchive_downloadsClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_downloads;
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=public_documents;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_pubhomeClick(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=public_home;
Form_peach.Edit4.Text:=uextractfilename(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:=uextractfilepath(public_documents);
end;

procedure TForm_peach.MenuItemOpen_pubhomeClick(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(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:utf8string;
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[length(s)]=directoryseparator then //folder
else //get object's path
   s:=uextractfilepath(s);
if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
open_cp(s);
end;

procedure TForm_peach.mhexploreClick(Sender: TObject);
var
   s:utf8string;
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 MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
cp_open(uextractfilepath(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:utf8string;
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[length(s)]=directoryseparator then //open folder
else //go to object's path
   s:=uextractfilepath(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.Treeview2.Visible:=true;
      Form_peach.mnavfun.Checked:=true;}
      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:utf8string;
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:utf8string;
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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=usr_documents;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemArchive_home1Click(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=uextractfilepath(home_path);
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.MenuItemextexploreClick(Sender: TObject);
var
   s:utf8string;
begin
s:=EditOpenOut.Text;
if s='' then exit;
if s[1]='<' then exit;
{$IFDEF MSWINDOWS}
winexplorepath(s);
{$ELSE}
cp_open(uextractfilepath(s),desk_env);
{$ENDIF}
end;

procedure TForm_peach.MenuItemOpen_LastClick(Sender: TObject);
begin
if lastoutpath='' then lastoutpath:=local_desktop;
Form_peach.EditOpenOut.Text:=uextractfilepath(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:=7;
   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:=2;
   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:=4;
   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:=10;
   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:=12;
   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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=local_desktop;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.mpathexplore1Click(Sender: TObject);
var
   s:utf8string;
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.Visible=true) 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(uextractfilepath(s),desk_env);
{$ENDIF}
end;

procedure TForm_peach.mpathreset1Click(Sender: TObject);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=lastoutpath;
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.mpathself1Click(Sender: TObject);
var
   s:utf8string;
begin
if StringGrid1.Rowcount<2 then exit;
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=uextractfilepath(s);
Form_peach.Edit4.Text:=uextractfilename(s);
Form_peach.Edit5.Text:=Form_peach.EditName3.Text+addext(Form_peach.Edit4.Text);
end;

procedure TForm_peach.mPeaTrackerClick(Sender: TObject);
begin
cp_open('https://sourceforge.net/p/peazip/tickets/',desk_env);
end;

procedure TForm_peach.mr9Click(Sender: TObject);
begin
showpanel('open');
if stringgridrecent.visible=false then showbar('recent');
navrefresh;
end;

procedure TForm_peach.mrowselectClick(Sender: TObject);
begin
rowselect:=not(rowselect);
Form_peach.ListView1.Rowselect:=rowselect;
if rowselect=true then mrowselect.checked:=true else mrowselect.checked:=false;
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:utf8string;
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';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure disk_convert;
var
   P:tprocessutf8;
   s,cl:utf8string;
begin
{$IFDEF MSWINDOWS}
if winver='9x' then exit;
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';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
{$ENDIF}
end;

procedure open_cpl;
var
   P:tprocessutf8;
   cl:utf8string;
begin
{$IFDEF MSWINDOWS}
P:=tprocessutf8.Create(nil);
cl:='control';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
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:utf8string;
begin
{$IFDEF MSWINDOWS}
if winver='nt4' then exit;
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 MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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:utf8string):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:=uextractfilepath(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:utf8string;
   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:=uextractfilepath(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:=uextractfilepath(local_desktop);
end;

procedure TForm_peach.MenuItemOpen_documents1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(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:=uextractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
else
   Form_peach.EditOpenOut.Text:=uextractfilepath(Form_peach.EditOpenIn.Text);
end;

procedure TForm_peach.MenuItemOpen_home1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(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:utf8string;
   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}
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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:utf8string;
begin
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter+' envstr';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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
var
   rc,i:integer;
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;
{rc:=Form_peach.StringGridList.Rowcount;
for i:=1 to rc-1 do
   if Form_peach.ListView1.Items[i-1].Selected=true then
      begin
      checklistanysel:=0;
      break;
      end;}
end;

function checklisttotsel(var nsel:integer; var strsel:utf8string):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:utf8string);
var
   s:utf8string;
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:=uextractfilepath(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:=uextractfilepath(Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]);
               if s='' then s:=Form_peach.EditOpenIn.Text;
               end
      end
else s:=uextractfilepath(Form_peach.EditOpenIn.Text);
end;
if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); 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');//showbar('bookmarks'); resets to status bar if the status area is already showing bookmarks
   //4: showbar('history');
   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:utf8string;
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.EditOpenIn.Text, mtWarning, [mbOK], 0); 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}
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row], mtWarning, [mbOK], 0); 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}
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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 TForm_peach.pmqnointdirClick(Sender: TObject);
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.pmquickdeskClick(Sender: TObject);
begin
jumpto('desktop');
end;

procedure TForm_peach.pmquickhomeClick(Sender: TObject);
begin
jumpto('home');
end;

procedure TForm_peach.pmquickrootClick(Sender: TObject);
begin
jumpto('root');
end;

procedure TForm_peach.MenuItemOpen_commandpromptClick(Sender: TObject);
begin
browser_commandprompt(1,0,'');
end;

procedure removeunits;
var
   P:tprocessutf8;
   cl:utf8string;
begin
{$IFDEF MSWINDOWS}
if (winver='9x') or (winver='nt4') then exit;
P:=tprocessutf8.Create(nil);
cl:='RUNDLL32 SHELL32.DLL,Control_RunDLL hotplug.dll';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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;
   PanelListBar.AnchorSideTop.Control:=PanelBarOpen;
   PanelListBar.AnchorSideTop.Side:=asrBottom;
   PanelFilters.AnchorSideTop.Control:=PanelListBar;
   PanelFilters.AnchorSideTop.Side:=asrBottom;
   mswapbars.checked:=false;
   end
else
   begin
   PanelListBar.AnchorSideTop.Control:=PanelOpen;
   PanelListBar.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;
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.ButtonUn7za9.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 TForm_peach.mnavfunClick(Sender: TObject);
begin
//setnav(2);
end;

procedure settpreset(i:integer);
begin
Form_peach.ListView1.BeginUpdate;
{$IFDEF MSWINDOWS}
case i of
1: begin
setbrowsertype(0);
setbrowsersize(0);
setshowthumbnails(0);
end;
2: begin
setbrowsertype(0);
setbrowsersize(1);
setshowthumbnails(1);
end;
3: begin
setbrowsertype(1);
setbrowsersize(0);
setshowthumbnails(0);
end;
4: begin
setbrowsertype(1);
setbrowsersize(1);
setshowthumbnails(1);
end;
5: begin
setbrowsertype(2);
setbrowsersize(1);
setshowthumbnails(1);
end;
6: begin
setbrowsertype(2);
setbrowsersize(2);
setshowthumbnails(1);
end;
end;
{$ELSE}
case i of
1: begin
setbrowsertype(0);
setbrowsersize(0);
setshowthumbnails(0);
end;
3: begin
setbrowsertype(1);
setbrowsersize(0);
setshowthumbnails(0);
end;
5: begin
setbrowsertype(2);
setbrowsersize(0);
setshowthumbnails(0);
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(udirectoryexists(confpath+'Scheduled scripts'+DirectorySeparator)) then umkdir(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:utf8string;
   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:utf8string;
begin
with form_peach do
begin
if stype=0 then
   begin
   s:=txt_archive;
   s1:=uextractfilename(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.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);
begin
settpreset(5);
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.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
      addtoarchive_selected;
      end;
contextconvert_switch:=false;
end;

procedure TForm_peach.mTypeSfxArcClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=8;
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:utf8string;
   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}
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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 TForm_peach.mwebsearchpClick(Sender: TObject);
begin
cp_open('http://www.peazip.org/web-search.html',desk_env);
end;

procedure openadvappn(n:integer);
var
   i:integer;
begin
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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.Edit4.Text:=uextractfilename(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;
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:=clWindow;
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:utf8string;
begin
s:=uextractfilepath(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:utf8string;
begin
P:=tprocessutf8.Create(nil);
cl:=delimiter+escapefilename(executable_path,desk_env)+'res'+DirectorySeparator+'pea'+EXEEXT+delimiter+' envstr';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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 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_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_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;
   cl:utf8string;
begin
{$IFDEF MSWINDOWS}
if winver='9x' then exit;
P:=tprocessutf8.Create(nil);
cl:='taskmgr';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if Form_peach.Visible=true then Application.ProcessMessages;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
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:utf8string;
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:=uextractfilepath(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:=usetfsname(StringGridList.Cells[8,StringGridList.Row]);
      if s='' then s:=Form_peach.EditOpenIn.Text;
      {$IFDEF MSWINDOWS}
      if checkfiledirname(s)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s, mtWarning, [mbOK], 0); exit; end;
      winexplorepath(s);
      {$ELSE}
      cp_open(uextractfilepath(s),desk_env);
      {$ENDIF}
      end
   else cp_open(EditOpenIn.Text,desk_env);
   end
else
   {$IFDEF MSWINDOWS}
   begin
   if checkfiledirname(EditOpenIn.Text)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+EditOpenIn.Text, mtWarning, [mbOK], 0); exit; end;
   winexplorepath(EditOpenIn.Text);
   end;
   {$ELSE}
   cp_open(uextractfilepath(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:utf8string):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);
{if webopen<33 then
   webopen:=shellexecuteW(Form_peach.handle,PWideChar('open'),PWideChar('RUNDLL32.EXE'),PWideChar('shell32.dll,OpenAs_RunDLL '+w),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:utf8string);
var
   i:integer;
   r:boolean;
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('http://search.about.com/fullsearch.htm?terms='+s);
         if FormWeb.CheckGroup1.Checked[1]=true then webopen('http://www.amazon.com/s/field-keywords='+s);
         if FormWeb.CheckGroup1.Checked[2]=true then webopen('http://www.apple.com/search/?q='+s);
         if FormWeb.CheckGroup1.Checked[3]=true then webopen('http://www.bing.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[4]=true then webopen('http://www.britannica.com/bps/search?query='+s);
         if FormWeb.CheckGroup1.Checked[5]=true then webopen('http://download.cnet.com/1770-20_4-0.html?query='+s+'&tag=srch&searchtype=downloads');
         if FormWeb.CheckGroup1.Checked[6]=true then webopen('http://shop.ebay.com/?_nkw='+s);
         if FormWeb.CheckGroup1.Checked[7]=true then webopen('http://www.facebook.com/search/?q='+s);
         //if FormWeb.CheckGroup1.Checked[8]=true then webopen('http://www.filestube.com/search.html?q='+s+'&select=All');
         if FormWeb.CheckGroup1.Checked[8]=true then webopen('http://www.flickr.com/search/?q='+s);
         if FormWeb.CheckGroup1.Checked[9]=true then webopen('http://www.google.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[10]=true then webopen('https://plus.google.com/s/'+s);
         if FormWeb.CheckGroup1.Checked[11]=true then webopen('http://maps.google.com/maps?q='+s);
         if FormWeb.CheckGroup1.Checked[12]=true then webopen('http://www.google.com/search?q='+s+'&tbs=nws:1');
         if FormWeb.CheckGroup1.Checked[13]=true then webopen('http://translate.google.com/#es|en|'+s);
         if FormWeb.CheckGroup1.Checked[14]=true then webopen('http://www.imdb.com/find?s=all&q='+s);
         //if FormWeb.CheckGroup1.Checked[16]=true then webopen('http://isohunt.com/torrents/?ihq='+s);
         if FormWeb.CheckGroup1.Checked[15]=true then webopen('http://www.linkedin.com/vsearch/f?keywords='+s);
         if FormWeb.CheckGroup1.Checked[16]=true then webopen('http://www.mininova.org/search/'+s);
         if FormWeb.CheckGroup1.Checked[17]=true then webopen('http://pinterest.com/search/pins/?q='+s);
         if FormWeb.CheckGroup1.Checked[18]=true then webopen('http://www.reddit.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[19]=true then webopen('http://sourceforge.net/directory/os:windows/?q='+s);
         //if FormWeb.CheckGroup1.Checked[20]=true then webopen('http://www.torrentz.eu/search?f='+s);
         if FormWeb.CheckGroup1.Checked[20]=true then webopen('https://twitter.com/search?q='+s);
         if FormWeb.CheckGroup1.Checked[21]=true then webopen('http://www.wikipedia.org/wiki/Special:Search?search='+s+'&fulltext=Search');
         if FormWeb.CheckGroup1.Checked[22]=true then webopen('http://www.wiktionary.org/wiki/Special:Search?search='+s+'&fulltext=Search');
         if FormWeb.CheckGroup1.Checked[23]=true then webopen('http://www.search.yahoo.com/search?p='+s);
         if FormWeb.CheckGroup1.Checked[24]=true then webopen('http://answers.yahoo.com/search/search_result;_ylv=3?p='+s);
         if FormWeb.CheckGroup1.Checked[25]=true then webopen('http://www.youtube.com/results?search_query='+s);
         end
      else
         begin
         if FormWeb.CheckGroup1.Checked[0]=true then webopen('http://www.about.com');
         if FormWeb.CheckGroup1.Checked[1]=true then webopen('http://www.amazon.com');
         if FormWeb.CheckGroup1.Checked[2]=true then webopen('http://www.apple.com/search/?q=');
         if FormWeb.CheckGroup1.Checked[3]=true then webopen('http://www.bing.com');
         if FormWeb.CheckGroup1.Checked[4]=true then webopen('http://www.britannica.com');
         if FormWeb.CheckGroup1.Checked[5]=true then webopen('http://download.cnet.com');
         if FormWeb.CheckGroup1.Checked[6]=true then webopen('http://www.ebay.com');
         if FormWeb.CheckGroup1.Checked[7]=true then webopen('http://www.facebook.com');
         //if FormWeb.CheckGroup1.Checked[8]=true then webopen('http://www.filestube.com');
         if FormWeb.CheckGroup1.Checked[8]=true then webopen('http://www.flickr.com');
         if FormWeb.CheckGroup1.Checked[9]=true then webopen('http://www.google.com');
         if FormWeb.CheckGroup1.Checked[10]=true then webopen('https://plus.google.com');
         if FormWeb.CheckGroup1.Checked[11]=true then webopen('http://maps.google.com');
         if FormWeb.CheckGroup1.Checked[12]=true then webopen('http://news.google.com');
         if FormWeb.CheckGroup1.Checked[13]=true then webopen('http://translate.google.com');
         if FormWeb.CheckGroup1.Checked[14]=true then webopen('http://www.imdb.com');
         //if FormWeb.CheckGroup1.Checked[16]=true then webopen('http://isohunt.com');
         if FormWeb.CheckGroup1.Checked[15]=true then webopen('http://www.linkedin.com');
         if FormWeb.CheckGroup1.Checked[16]=true then webopen('http://www.mininova.org');
         if FormWeb.CheckGroup1.Checked[17]=true then webopen('http://pinterest.com');
         if FormWeb.CheckGroup1.Checked[18]=true then webopen('http://www.reddit.com');
         if FormWeb.CheckGroup1.Checked[19]=true then webopen('http://sourceforge.net');
         //if FormWeb.CheckGroup1.Checked[20]=true then webopen('http://www.torrentz.eu');
         if FormWeb.CheckGroup1.Checked[20]=true then webopen('https://twitter.com');
         if FormWeb.CheckGroup1.Checked[21]=true then webopen('http://www.wikipedia.org');
         if FormWeb.CheckGroup1.Checked[22]=true then webopen('http://www.wiktionary.org');
         if FormWeb.CheckGroup1.Checked[23]=true then webopen('http://www.yahoo.com');
         if FormWeb.CheckGroup1.Checked[24]=true then webopen('http://answers.yahoo.com');
         if FormWeb.CheckGroup1.Checked[25]=true then webopen('http://www.youtube.com');
         end;
      end;
   mrCancel:
      begin
      end;
   end;
end;

procedure websearch_sel;
var
   s:utf8string;
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:utf8string;
   {$IFDEF MSWINDOWS}
   w:widestring;
   {$ELSE}
   P:tprocessutf8;
   cl:utf8string;
   {$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 MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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:=uextractfilepath(pnb10.Caption);
end;

procedure TForm_peach.pnb11Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb11.Caption);
end;

procedure TForm_peach.pnb12Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb12.Caption);
end;

procedure TForm_peach.pnb13Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb13.Caption);
end;

procedure TForm_peach.pnb14Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb14.Caption);
end;

procedure TForm_peach.pnb15Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb15.Caption);
end;

procedure TForm_peach.pnb16Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb16.Caption);
end;

procedure TForm_peach.pnb17Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb17.Caption);
end;

procedure TForm_peach.pnb18Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb18.Caption);
end;

procedure TForm_peach.pnb19Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb19.Caption);
end;

procedure TForm_peach.pnb1Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb1.Caption);
end;

procedure TForm_peach.pnb20Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb20.Caption);
end;

procedure TForm_peach.pnb21Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb21.Caption);
end;

procedure TForm_peach.pnb22Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb22.Caption);
end;

procedure TForm_peach.pnb23Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb23.Caption);
end;

procedure TForm_peach.pnb2Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb2.Caption);
end;

procedure TForm_peach.pnb3Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb3.Caption);
end;

procedure TForm_peach.pnb4Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb4.Caption);
end;

procedure TForm_peach.pnb5Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb5.Caption);
end;

procedure TForm_peach.pnb6Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb6.Caption);
end;

procedure TForm_peach.pnb7Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb7.Caption);
end;

procedure TForm_peach.pnb8Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb8.Caption);
end;

procedure TForm_peach.pnb9Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnb9.Caption);
end;

procedure archivemenu_name(pathpart:utf8string);
var
   s:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=pathpart;
Form_peach.Edit4.Text:=uextractfilename(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:=uextractfilepath(pnh1.Caption);
end;

procedure TForm_peach.pnh2Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnh2.Caption);
end;

procedure TForm_peach.pnh3Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnh3.Caption);
end;

procedure TForm_peach.pnh4Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnh4.Caption);
end;

procedure TForm_peach.pnh5Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnh5.Caption);
end;

procedure TForm_peach.pnh6Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnh6.Caption);
end;

procedure TForm_peach.pnh7Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(pnh7.Caption);
end;

procedure TForm_peach.pnh8Click(Sender: TObject);
begin
Form_peach.EditOpenOut.Text:=uextractfilepath(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:utf8string;
begin
s:=pojdn10.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn11Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn11.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn12Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn12.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn13Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn13.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn14Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn14.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn15Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn15.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn16Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn16.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn17Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn17.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn18Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn18.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn19Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn19.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn1Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn1.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn20Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn20.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn21Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn21.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn22Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn22.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn23Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn23.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn24Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn24.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn25Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn25.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn26Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn26.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn2Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn2.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn3Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn3.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn4Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn4.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn5Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn5.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn6Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn6.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn7Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn7.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn8Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn8.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(s);
end;

procedure TForm_peach.pojdn9Click(Sender: TObject);
var
   s:utf8string;
begin
s:=pojdn9.Caption;
s:=copy(s,2,2)+directoryseparator;
Form_peach.EditOpenOut.Text:=uextractfilepath(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;
po_test.enabled:=true;
po_info.enabled:=true;
po_exthere.enabled:=true;
if fun='FILEBROWSER' then
   if checkextinput_noduplicatecheck=false then
      begin
      MenuItemExtAllTo.enabled:=false;
      MenuItemExtAllHere.enabled:=false;
      po_test.enabled:=false;
      po_info.enabled:=false;
      po_exthere.enabled:=false;
      end;
end;

procedure powcustom(j:integer; custmode:utf8string);
var
   i:integer;
   cl,jobcode,outname,s:utf8string;
begin
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];
            uFileSetAttr(outname+tempstring, faReadOnly);
            if custmode='cust' then open_custedit(j, s)
            else open_advcustedit(j, s);
            end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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];
            uFileSetAttr(outname+directoryseparator+tempstring, faReadOnly);
            if custmode='cust' then open_custedit(j, s)
            else open_advcustedit(j, s);
            end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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:=7;
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.cbwhirlpoolClick(Sender: TObject);
begin
on_cbwhirlpoolClick;
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.CheckBoxArchive6Click(Sender: TObject);
begin
//on_CheckBoxArchive6_click;
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.CheckBoxPrebrowseClick(Sender: TObject);
begin
on_CheckBoxPrebrowse_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:utf8string;
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:=uextractfilename(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;
   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);
apply_theme;
end;

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

procedure TForm_peach.ComboBoxARCalgoChange(Sender: TObject);
begin
on_ComboBoxARCalgoChange;
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);
      Form_peach.Caption:=txt_create+' .'+archive_type+' | '+compression_level+', '+Form_peach.ComboboxArchive7.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;
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:utf8string);
var
   cl,in_param,out_param,bin_name:utf8string;
   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;
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   if Form_peach.Visible=true then Application.ProcessMessages;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   cutextension(s);
   s:=s+directoryseparator+'theme.txt';
   end;
end;

function loadthemefile(s:utf8string):integer;
var
   s1:utf8string;
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+uextractfilename(s1)+directoryseparator+'theme.txt';
theme_name:=uextractfilename(s1);
if (upcase(uextractfileext(s))='.ZIP') or (upcase(uextractfileext(s))='.7Z') or (upcase(uextractfileext(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:utf8string;
begin
with Form_peach do
begin
case ComboBoxTheme.ItemIndex of
   0: begin
      try
         s:=executable_path+'res'+directoryseparator+'themes'+directoryseparator+'seven-embedded'+directoryseparator+'theme.txt';
         theme_name:='seven-embedded';
         theme_path:=uextractrelativepath(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:=uextractrelativepath(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+'firecrystal.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+'seven.theme.7z';
      if loadthemefile(s)<>0 then
         begin
         theme_failure;
         exit;
         end;
      except
         theme_failure;
         exit;
      end;
      end;
   4: 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;
   5: begin
      SelectDirectoryDialog2.initialdir:=confpath+'themes';
      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+uextractfilename(s1)+directoryseparator+'theme.txt';
            theme_name:=uextractfilename(s1);
            load_theme;
            check_theme_failure;
         except
            theme_failure;
            exit;
         end
      else exit;
      end;
   end;
if ((s<>'') and (theme_path<>'')) then
   try
      uassigntext(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
      MessageDlg(txt_conf_cannotsave, mtWarning, [mbOK], 0);
      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;
end;

procedure setmswindowsopacity;
begin
{$IFDEF MSWINDOWS}
osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(osVerInfo) then
   begin
   if osVerInfo.dwMajorVersion>4 then //the system is NTx and most recent than NT4
      begin
      {following code make problems on Win9x: while it correctly avoid importing
      user32.dll if SetLayeredWindowAttributes is not supported, it raises randomic
      errors on 9x systems, so the code is made unreachable for those systems and
      for NT4 that will not mPeaSupport that function anyway}
      Form_peach.Panel1.Visible:=true;
      if (opacity<100) or (spinchanged=true) then
         begin
         try
            hUser32 := GetModuleHandle(PChar('USER32.DLL'));
            if hUser32 <> 0 then
               begin
               pointer(SetLayeredWindowAttributes) := GetProcAddress(hUser32, 'SetLayeredWindowAttributes');
               if @SetLayeredWindowAttributes <> nil then
                  begin
                  SetWindowLongPtr(Form_peach.Handle, GWL_EXSTYLE, GetWindowLong(Form_peach.Handle, GWL_EXSTYLE) OR WS_EX_LAYERED);
                  SetLayeredWindowAttributes(Form_peach.Handle, 0, 255+opacity-100, LWA_ALPHA);//not supported on 98 and NT4, called dynamically since has no meaning checking it at compile time
                  end;
               end;
         except
            Form_peach.Panel1.Visible:=false;
         end;
         end;
      spinchanged:=false;
      end;
   end;
Form_peach.SpinEdit1.Value:=opacity;
{$ENDIF}
end;

procedure TForm_peach.ComboBoxThemeChange(Sender: TObject);
begin
ComboBoxTheme_onchange;
setmswindowsopacity;
end;

procedure TForm_peach.LabelResetThemeClick(Sender: TObject);
begin
if not(udirectoryexists(confpath+'themes')) then uForceDirectories(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:utf8string;
begin
if browserbusy=true then exit;
if (FormAdvf.CheckBoxAdvFilters.State=cbUnChecked) and (fun='UN7Z') and (Form_peach.StringGridSessionHistory.Cells[3,Form_peach.StringGridSessionHistory.Row]<>'*') then
   begin
   if (Form_peach.EditUn7zaFilter.Text='*') and (Form_peach.EditUn7zaFilterExclude.Text='*'+directoryseparator+'*') then exit;
   s:=uextractfilepath(copy(uextractfilepath(Form_peach.EditUn7zaFilter.Text),1,length(uextractfilepath(Form_peach.EditUn7zaFilter.Text))-1));
   Form_peach.EditUn7zaFilter.Text:=s+'*';
   Form_peach.EditUn7zaFilterExclude.Text:=s+'*'+directoryseparator+'*';
   list_un7z('browse');
   status0:=txt_list_browsing;
   browsingmode7z:=0;
   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:=uextractfilepath(s);
   if checkUNCpath(s) then
      begin
      s1:=copy(s,1,length(s)-1);
      if (uextractfilepath(s1)='\\') or (uextractfilepath(s1)='\') or (uextractfilepath(s1)='') then
         begin
         s:='';
         listpc;
         addtohistory;
         exit;
         end;
      end;
   {$IFDEF MSWINDOWS}
   if Form_peach.EditOpenIn.Text=txt_mypc then
      begin
      openpath;
      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}
//if winver='nt6+' then FormDrop.shape1.Brush.Color:=clInactiveCaption
//else FormDrop.shape1.Brush.Color:=clWindow;
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]:=STR_CRC;
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
Panel1.Visible:=false; //it gives access to transparence control, obtained using Windows-specific 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
launchwithsemaphore:=false;
setbs:=false;
endflag:=false;
browserbusy:=false;
browserbusy_minor:=false;
executable_path:=uextractfilepath(envtoutf8(wparamstr(0))); //valorize application's paths
if ((executable_path='') or (executable_path='..\')) then executable_path:=uextractfilepath(envtoutf8(paramstr(0)));
if executable_path<>'' then if executable_path[length(executable_path)]<>directoryseparator then executable_path:=executable_path+directoryseparator;
usetcurrentdir(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 udirectoryexists(home_path) then
else home_path:=executable_path;
if udirectoryexists(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;
TimeSeparator:=':';
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;
libre_directive:=0;
unrar5shown:=false;
unaceshown:=false;
restartingapp:=false;
needsave:=true;
updatingcontent:=0;
wasselected:=-1;
wasselectedp:=-1;
end;

procedure open_singleinput(s:utf8string);
var
   i:integer;
begin
case testinput(s,true) of
   0: begin
      showpanel('archive');
      showpanel_trick;
      if ufilegetattr(escapefilename(uexpandfilename(s),desk_env)) > 0 then
         if ufilegetattr(escapefilename(uexpandfilename(s),desk_env)) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,escapefilename(s,desk_env))
         else addfolderstr(Form_peach.StringGrid1,escapefilename(uexpandfilename(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;
   else
      begin
      i:=testext(s);
      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
         begin
         showpanel('archive');
         showpanel_trick;
         if ufilegetattr(escapefilename(uexpandfilename(s),desk_env)) > 0 then
            if ufilegetattr(escapefilename(uexpandfilename(s),desk_env)) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,escapefilename(s,desk_env))
            else addfolderstr(Form_peach.StringGrid1,escapefilename(uexpandfilename(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
      else
         begin
         showpanel('open');
         Form_peach.EditOpenIn.Text:=escapefilename(uexpandfilename(s),desk_env);
         open_inputselect;
         end;
      end;
   end;
end;

procedure fixbringtofront;
begin
{$IFDEF MSWINDOWS}
Form_peach.FormStyle:=fsStayOnTop;
Form_peach.FormStyle:=fsNormal;
{$ENDIF}
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:integer;
   s,fun_neutral:utf8string;
   okfile,termfunopen:boolean;
begin
openstarted:=true;
stayopen:=true;
savetype:=false;
resetminimizedlauncher;
termfunopen:=true;
with form_peach do
begin
//shell integration: if program is called with one of the following parameter as wparamstr(1) use quick procedures without prompting PeaZip interface
case wparamstr(1) of
   '-add2pea' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2pea;
   end;
   '-add2crypt' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2crypt;
   end;
   '-add2wipe' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2wipe;
   end;
   '-add2compare' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2compare;
   end;
{'-add2split' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2split;
   exit_nosave;
   exit;
   end;}
   '-add27z' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('archive');
   end;
   '-add27zmail' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add27z('mail');
   end;
   '-add2separate7z' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2separate7z;
   end;
   '-add2sfx7z' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2sfx7z('archive');
   end;
   '-add2sfx7zmail' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2sfx7z('mail');
   end;
   '-add2zip' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2zip('archive');
   end;
   '-add2zipmail' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2zip('mail');
   end;
   '-add2separatezip' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   add2separatezip;
   end;
   '-ext2full' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   Application.ProcessMessages;
   ext2full;
   end;
   '-ext2here' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','');
   end;
   '-ext2folder' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   launchwithsemaphore:=true;
   ext2here('','newfolder');
   end;
   '-ext2to' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','');
   end;
   '-ext2tofolder' :
   begin
   Form_peach.Windowstate:=wsMinimized;
   Form_peach.Visible:=false;
   ext2here('askto','newfolder');
   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;
   '-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<14 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 wparamcount=0 then
   begin
   showpanel('open');
   if not(udirectoryexists(indir)) then indir:=local_desktop;
   Form_peach.EditOpenIn.Text:=escapefilename(indir,desk_env); //indir not expanded with uexpandfilename
   fun:='FILEBROWSER';
   fun_status:=fun;
   open_inputselect;
   end
else
   if (wparamcount=1) then //single input
      begin
      addtohistorypopup;
      case wparamstr(1) of
         '-add2archive','-add2archive-add','-add2archive-update': //directly calling -add2archive shortcut open archive panel
         begin
         showpanel('archive');
         showpanel_trick;
         if wparamstr(1)='-add2archive-add' then begin ComboBoxArchive7.ItemIndex:=1; on_ComboBoxArchive7Change; end;
         if wparamstr(1)='-add2archive-update' then begin ComboBoxArchive7.ItemIndex:=2; on_ComboBoxArchive7Change; end;
         StringGrid1.AutoSizeColumns;
         status1:='0 '+txt_dirs+' 0 '+txt_files+' 0 B';
         stayopen:=false;
         savetype:=true;
         exit;
         end;
         '-ext2main' :
         begin
         Form_peach.EditOpenOut.Text:=local_desktop;
         list_toextractor('none','full');
         stayopen:=false;
         end
         else open_singleinput(envtoutf8(wparamstr(1)));
         end;
      end
   else //multiple input
      begin
      addtohistorypopup;
      case wparamstr(1) of
         '-ext2open' : //open a single file as archive, if type is supported
         begin
         if envtoutf8(wparamstr(2))<>'' then
            if (udirectoryexists(envtoutf8(wparamstr(2)))) or (envtoutf8(wparamstr(2))='Computer''s root') then
               begin
               fun:='FILEBROWSER';
               fun_status:=fun;
               s:=envtoutf8(wparamstr(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(envtoutf8(wparamstr(2)));
         exit;
         end;
         '-ext2openasarchive' : //force to open a single file as archive
         begin
         if envtoutf8(wparamstr(2))<>'' then
            if udirectoryexists(envtoutf8(wparamstr(2))) then
               begin
               fun:='FILEBROWSER';
               fun_status:=fun;
               s:=envtoutf8(wparamstr(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(envtoutf8(wparamstr(2)));
               forceopenasarchive:=false;
               end;
         exit;
         end;
         '-ext2openpwtest' : //wparamstr(2) is password (always delimited), wparamstr(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;
         ExitCode:=-1;
         if envtoutf8(wparamstr(2))<>'' then
            begin
            FormPW.EditUn7zapw.Text:=envtoutf8(wparamstr(2));
            FormPW.EditUn7zapw1.Text:=envtoutf8(wparamstr(2));
            end
         else
            begin
            FormPW.EditUn7zapw.Text:='default';
            FormPW.EditUn7zapw1.Text:='default';
            end;
         if envtoutf8(wparamstr(3))<>'' then
            begin
            open_archive_fromname(envtoutf8(wparamstr(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' :
         begin
         Form_peach.EditOpenOut.Text:=local_desktop;
         list_toextractor('none','full');
         for i:=2 to wparamcount do
            begin
            test_extfile(escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env),okfile);
            if okfile=true then
               begin
               if checkfiledirname(escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env))<>0 then begin MessageDlg(txt_2_7_validatefn+' '+escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env), mtWarning, [mbOK], 0); exit; end;
               deselectingrid(Form_peach.StringGrid2);
               addfilestr(Form_peach.StringGrid2,escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env));
               end;
            end;
         if Form_peach.StringGrid2.Rowcount>1 then
            Form_peach.EditOpenOut.Text:=uextractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
         else
            Form_peach.EditOpenOut.Text:=local_desktop;
         updatecontent_ext;
         stayopen:=false;
         exit;
         end;
         '-add2archivemulti' :
         begin
         add2archivemulti;
         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;
      end;
      showpanel('archive'); //otherwise, add to archive
      showpanel_trick;
      for i:=1 to wparamcount do
         begin
         if (wparamstr(i)='-add2archive') or (wparamstr(i)='-add2archive-add') or (wparamstr(i)='-add2archive-update') then
         else
            if testname(escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env), StringGrid1)=0 then
               if ufilegetattr(escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)) > 0 then
                  if ufilegetattr(escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env)) and faDirectory =0 then addfilestr(Form_peach.StringGrid1,escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env))
                  else addfolderstr(Form_peach.StringGrid1,escapefilename(uexpandfilename(envtoutf8(wparamstr(i))),desk_env))
               else msg_not_accessible(i);
         end;
      if wparamstr(1)='-add2archive-add' then begin ComboBoxArchive7.ItemIndex:=1; on_ComboBoxArchive7Change; end;
      if wparamstr(1)='-add2archive-update' then begin ComboBoxArchive7.ItemIndex:=2; on_ComboBoxArchive7Change; 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:utf8string;
begin
{$IFDEF MSWINDOWS}getwinenvadv(wincomspec,winver,majmin);{$ENDIF}
setbasevars;
{$IFDEF MSWINDOWS}
peaziptmpdir:=GetTempDir;
if peaziptmpdir='' then peaziptmpdir:=ugetcurrentdir;
if peaziptmpdir<>'' then
   if peaziptmpdir[length(peaziptmpdir)]<>directoryseparator then peaziptmpdir:=peaziptmpdir+directoryseparator;
peaziptmpdir:=peaziptmpdir+'peazip-tmp'+directoryseparator;
s:=peaziptmpdir;
if not(udirectoryexists(s)) then umkdir(s);
case wparamstr(1) of
   '-add2multi' :
   begin
   add2multi;
   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;
   '-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;
   end;
{$ENDIF}
end;

{procedure getnodepath(node:ttreenode; var s:utf8string);
var
   anode:ttreenode;
   rfound:boolean;
begin
if node=nil then exit;
anode:=node;
s:='';
rfound:=false;
repeat
if anode.parent<>nil then
   begin
   if anode.parent.text[length(anode.parent.text)]<>directoryseparator then
      s:=anode.parent.text+directoryseparator+s
   else
      s:=anode.parent.text+s;
   anode:=anode.parent;
   end
else rfound:=true;
until rfound=true;
if s<>'' then
   if s[length(s)]<>directoryseparator then
      s:=s+node.Text+directoryseparator
   else
      s:=s+node.Text
else
   s:=s+node.Text;
{$IFNDEF MSWINDOWS}s:=directoryseparator+s;{$ENDIF}
end;}

procedure imgshelltree;
var
  Node: TTreeNode;
  i: Integer;
  s:utf8string;
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:=Form_peach.ShellTreeView1.GetPathFromNode(Node);
      //getnodepath(node, s);
      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);
var
   s:utf8string;
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);
{$ELSE}
{$ENDIF}
load_conf; //parse conf.txt in res folder for GUI theming and default operation parameters
load_bookmarks;
clearstopsequencefile;
prepare_apps_panel;
load_custedit;
showpanel_prepare;
prepare_GUI; //give starting positions to panels (that in the RAD may be misplaced)
set_items_height;
if pimmersive=1 then set_pimmersive;
Application.CreateForm(TFormPW, FormPW);
prepare_FormPW;
Application.CreateForm(TFormPM, FormPM);
prepare_FormPM;
Application.CreateForm(TFormKF, FormKF);
prepare_FormKF;
if spchar=1 then FormKF.CheckBoxSuggestPW.State:=cbChecked else FormKF.CheckBoxSuggestPW.State:=cbUnchecked;
Application.CreateForm(TFormInput, FormInput);
Application.CreateForm(TFormAdvf, FormAdvf);
prepare_FormAdvf;
Application.CreateForm(TFormWeb, FormWeb);
prepare_FormWeb;
Application.CreateForm(TFormImgRes, FormImgRes);
prepare_FormAbout;
Application.CreateForm(TFormCrop, FormCrop);
Application.CreateForm(TFormPaths, FormPaths);
FormPaths.Caption:=txt_5_5_copypath;
Application.CreateForm(TFormSelect, FormSelect);
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;
{$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;
setmswindowsopacity;
menvstr.visible:=false;
mopenasarchive.visible:=false;
po_task.Visible:=false;
mscheduledscripts.Visible:=false;
mtaskscheduler.Visible:=false;
case winver of
   '9x' :
   begin
   local_desktop:=GetEnvironmentVariable('WINBOOTDIR')+'\Desktop\'; //fixes desktop path for 9x
   MenuItem11.Visible:=false;
   mUser.Visible:=false;
   MenuItem33.Visible:=false;
   po_alltasks.Visible:=false;
   po_taskman.Visible:=false;
   po_removeunits.Visible:=false;
   po_diskclean.Visible:=false;
   po_convert.Visible:=false;
   po_mrt.Visible:=false;
   end;
   'nt4' :
   begin
   MenuItem11.Visible:=false;
   mUser.Visible:=false;
   MenuItem33.Visible:=false;
   po_alltasks.Visible:=false;
   po_removeunits.Visible:=false;
   po_diskclean.Visible:=false;
   po_mrt.Visible:=false;
   end;
   '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;
ShapeTitleExt3.Visible:=false;
LabelTitleAdd4.Visible:=false;
ShapeTitleAdd3.Visible:=false;
Labelspac1.Visible:=false;
LabelLang4.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;
Labelspac2.Visible:=false;
Labelspac7.Visible:=false;
Labelspac8.Visible:=false;
LabelResetPtmp.Visible:=false;
LabelConfigurePeaZip.Visible:=false;
LabelConfigureSendTo.Visible:=false;
Label6.Visible:=false;
Combobox1.Visible:=false;
mupdate.Visible:=false;
//mcolumns.visible:=false; 0.9.30 hiding columns is now possible
msystemintegration.visible:=false;
menuitem42.visible:=false;
mthumbimages.Visible:=false;
org_thumb.Visible:=false;
if COMPQT=1 then
   begin
   PanelClickAddress.Visible:=false;
   Panelnav5.Caption:='';
   end;
{$ENDIF}
status1:=caption_build;
populatebookmarks;
populaterecenticons;
populaterecenticonsf;
{$IFDEF MSWINDOWS}
openstart;
//populatepcmenu;
{$ENDIF}
end;

procedure TForm_peach.iadvextractClick(Sender: TObject);
begin
MessageDlg(iadvextract.Hint,mtInformation,[mbOk], 0);
end;

procedure TForm_peach.ImageAdArchive0Click(Sender: TObject);
var
   pp:TPoint;
begin
pp.x:=Form_peach.PanelClickAddress.Left+Form_peach.PanelAdArchive0.left-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
pp:=clienttoscreen(pp);
Form_peach.pmabc.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
pp:=clienttoscreen(pp);
Form_peach.pmabc.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
pp:=clienttoscreen(pp);
Form_peach.pmabc.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.height+Form_peach.PanelBarOpen.height;
if swapbars=true then pp.y:=pp.y-Form_peach.PanelBarOpen.height;
pp:=clienttoscreen(pp);
Form_peach.pmabc.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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-24;
pp.y:=Form_peach.EditopenIn.top+Form_peach.EditopenIn.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
//{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
jumpto('root');
end;

procedure TForm_peach.ImageFlat1Click(Sender: TObject);
begin
  {$IFDEF MSWINDOWS}settpreset(4);{$ELSE}settpreset(3);{$ENDIF}
end;

procedure TForm_peach.ImageFlat2Click(Sender: TObject);
begin
  settpreset(1);
end;

procedure drag_addtolayout(FileNames:array of string);
var
   i: integer;
   s: utf8string;
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 (ufilegetattr(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:utf8string;
begin
suggest_outname(s,Form_peach.cbType.Text,0);
Form_peach.EditName3.Text:=uextractfilepath(s);
Form_peach.Edit4.Text:=uextractfilename(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: integer;
   s: utf8string;
   okfile:boolean;
begin
if Form_peach.labelstatus2.Caption<>txt_2_7_ext then exit;
s:=Form_peach.Caption;
for i := 0 to High(FileNames) do
      begin
      test_extfile(FileNames[i],okfile);
      if okfile=true then
         begin
         if checkfiledirname(FileNames[i])<>0 then begin MessageDlg(txt_2_7_validatefn+' '+FileNames[i], mtWarning, [mbOK], 0); 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;
updatecontent_ext;
Form_peach.Caption:=s;
end;

procedure drag_addtobookmarks;
var
   i: integer;
begin
for i := 0 to High(FileNames) do
   //if testname(escapefilename(FileNames[i],desk_env), Form_peach.StringGrid1)=0 then
      //begin
      addtobookmarks(escapefilename(FileNames[i],desk_env));
      //end;
end;

procedure drag_addtoarchive;
var
   dfn,s:utf8string;
   i:integer;
begin
if Form_peach.StringGridList.Cells[1,1]='' then exit;
addtoarchive_inarchive;
for i := 0 to High(FileNames) do
   begin
   dfn:=escapefilename(FileNames[i],desk_env);
   if (ufilegetattr(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;

function isdrbutton:boolean;
var
   j:integer;
begin
result:=false;
{//unreliable
{$IFDEF MSWINDOWS}
j:=GetKeyState(VK_rBUTTON);
if (prevdrbutton<>j) then result:=true; // ((prevdrbutton=-1) and (j=1))
prevdrbutton:=j;
{$ENDIF}
}
end;

var
   i:integer;
   lpPoint: TPoint;
begin
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]) or (isdrbutton=true) 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 MessageDlg(txt_dis+' '+txt_2_7_drag_archive, mtWarning,[mbYes, mbNo],0) 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 MessageDlg(txt_dis+' '+txt_2_7_drag_archive, mtWarning,[mbYes, mbNo],0) 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:utf8string;
begin
importjobcl_extract(cl,jobcode,outname);
end;

procedure TForm_peach.iConsoleCreateImportClick(Sender: TObject);
var
cl,jobcode,outname:utf8string;
begin
importjobcl(cl,jobcode,outname);
end;

function importjobcl(var cl,jobcode,outname:utf8string):integer;
var
   sel,s,clprog:utf8string;
   i:integer;
begin
importjobcl:=0;
with Form_peach do
begin
mConsoleCreate.Clear;
lConsoleCreate_jobcode.Caption:='';
lConsoleCreate_outname.Caption:='';
if CheckBoxTarBefore.State=cbChecked then
   begin
   MessageDlg(txt_tarbefore+char($0D)+char($0A)+txt_4_5_upxpj, mtWarning, [mbOK], 0);
   exit;
   end;
if CheckBoxConvert.State=cbChecked then
   begin
   MessageDlg(txt_2_8_convertexisting+char($0D)+char($0A)+txt_4_5_upxpj, mtWarning, [mbOK], 0);
   exit;
   end;
if (cbType.Text=STR_UPX) then
   begin
   MessageDlg('UPX'+char($0D)+char($0A)+txt_4_5_upxpj, mtWarning, [mbOK], 0);
   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:=uextractfilename(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_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;
         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_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;
mConsoleCreate.Append(cl);
lConsoleCreate_jobcode.Caption:=jobcode;
lConsoleCreate_outname.Caption:=outname;
end;

if Form_peach.CheckBoxDeleteInput1.Checked=true then
   begin
   if MessageDlg(txt_5_4_deleteoriginal+' '+txt_5_4_deletefilesconfirm,mtWarning,[mbYes, mbNo],0)=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;
if cl<>'' then testutf8needed_archive(cl);
importjobcl:=1;
end;

function importjobcl_extract(var cl,jobcode,outname:utf8string):integer;
var
   i,k:integer;
   clprog:utf8string;
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 MessageDlg(txt_5_4_deleteoriginal+' '+txt_5_4_deletearchivesconfirm,mtWarning,[mbYes, mbNo],0)=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 MessageDlg(txt_5_4_deleteoriginal+' '+txt_5_4_deletearchivesconfirm,mtWarning,[mbYes, mbNo],0)=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
   testutf8needed_extract(cl);
   importjobcl_extract:=1;
   end;
end;

procedure save_pj(cl:utf8string);
begin
{$IFDEF MSWINDOWS}Form_Peach.SaveDialogPJ.DefaultExt:='.bat';{$ELSE}Form_Peach.SaveDialogPJ.DefaultExt:='.txt';{$ENDIF}
if not(DirectoryExists(confpath+'Scripts'+DirectorySeparator)) then umkdir(confpath+'Scripts'+DirectorySeparator);
Form_peach.SaveDialogPJ.InitialDir:=confpath+'Scripts'+DirectorySeparator;
if Form_peach.SaveDialogPJ.Execute then
   if Form_peach.SaveDialogPJ.FileName<>'' then
      begin
      uassigntext(t,Form_peach.SaveDialogPJ.FileName);
      rewrite(t);
      if jobdefenc=1 then write_header(t);
      write(t,cl);
      closefile(t);
      end;
//Form_peach.mConsoleCreate.Clear;
//Form_peach.mConsoleCreate1.Clear;
end;

procedure layout_savejob;
var
   cl,jobcode,outname:utf8string;
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;
fw,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:utf8string);
var
   cl:utf8string;
   P:tprocessutf8;
begin
repeat
if pos(char($0d)+char($0a),s)<>0 then
   begin
   cl:=copy(s,1,pos(char($0d)+char($0a),s));
   s:=copy(s,pos(char($0d)+char($0a),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 MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   end;
until length(s)<3;
end;

procedure TForm_peach.Image7zPj1Click(Sender: TObject);
var
   s:utf8string;
begin
s:=mConsoleCreate.Text;
launchpjmulti(s);
end;

procedure TForm_peach.Image7zPj3Click(Sender: TObject);
var
   s:utf8string;
begin
s:=mConsoleCreate1.Text;
launchpjmulti(s);
end;

procedure TForm_peach.Image7zPjClick(Sender: TObject);
var
   cl,jobcode,outname:utf8string;
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
reset_wintemp;
clearstopsequencefile;
if MessageDlg(txt_4_4_confremove, mtInformation,[mbYes, mbNo],0)=6 then
   begin
   dohistoryreset;
   udeletefile(confpath+'conf.txt');
   uassigntext(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 MessageDlg(txt_4_4_confremoveall, mtInformation,[mbYes, mbNo],0)=6 then
   begin
   udeletefile(confpath+'bookmarks.txt');
   autobookmarks;
   udeletefile(confpath+'custedit.txt');
   if MessageDlg(txt_5_0_resetpm, mtWarning,[mbYes, mbNo],0)=6 then udeletefile(confpath+'pm');
   end;
{$IFDEF MSWINDOWS}
if confpath<>executable_path+'res'+directoryseparator then //if windows instalable version
   if MessageDlg(txt_5_3_resetsi, mtInformation,[mbYes, mbNo],0)=6 then configure_systemintegration;
{$ENDIF}
end;

procedure peazipreset;
begin
peazipdoreset;
sleep(100);
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.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);
//pmjump.PopUp(p.x,p.y);
//populatepcmenu;
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);
//pmjump.PopUp(p.x,p.y);
//populatepcmenu;
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:utf8string;
begin
if browserbusy=true then exit;
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
s:=Form_peach.EditUn7zaFilter1.Text;
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_nrsearch;
var
   s:utf8string;
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:utf8string;
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:=EditOpenIn.Left+EditOpenIn.Width;
      p.y:=EditopenIn.top+EditopenIn.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:utf8string;
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:utf8string;
begin
if MessageDlg(txt_benchmark, mtConfirmation, [mbYes,mbNo], 0)=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:utf8string;
   scheduleclip:array of array [0..14] of utf8string;
begin
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 eraseselected_list(0);//optionally (working) launch as external procedure
if fun='FILEBROWSER' then
   begin
   if MessageDlg(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel,mtWarning,[mbYes,mbNo], 0)=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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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);
      //if Form_peach.EditOpenIn.Text=s1 then navrefresh; //deactivated, refresh is now automatic //MenuItemRefresh only if browser is still in the same dir
      end;
   exit;
   end;
if test_shouldnotbechanged=1 then
   begin
   MessageDlg(txt_add_error, mtWarning, [mbOK], 0);
   exit;
   end;
if fun='UN7Z' then
   begin
   if testencrypted<0 then exit;
      if MessageDlg(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel,mtWarning,[mbYes,mbNo], 0)=6 then
         if compose_un7z_cl(cl,jobcode,outname,false,'delete','selected')=0 then
            if execute_cl(cl,'delete')=0 then
               begin
               //list_un7z('browse');
               Form_peach.OpenDialogArchive.Filename:=Form_peach.EditOpenIn.Text;
               open_inputselect;
               end
            else MessageDlg(txt_add_error, mtWarning, [mbOK], 0);
   end;
if fun='UNARC' then
   begin
   //if StringGridList.Rowcount=2 then exit; //prevent to delete last object into archive (empty archive gets deleted by freearc)
   //if testencrypted<0 then exit;
      if MessageDlg(txt_delete+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel,mtWarning,[mbYes,mbNo], 0)=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 MessageDlg(txt_add_error, mtWarning, [mbOK], 0);
   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 MessageDlg(txt_2_7_validatefn+' '+sg.Cells[8,sg.Row], mtWarning, [mbOK], 0); exit; end;
   winexplorepath(sg.Cells[8,sg.Row]);
   {$ELSE}
   cp_open(uextractfilepath(sg.Cells[8,sg.Row]),desk_env);
   {$ENDIF}
   end;
end;

procedure TForm_peach.MenuItemERAssociatedClick(Sender: TObject);
var
   i:integer;
   cl,jobcode,outname:utf8string;
begin
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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   end;
end;

procedure TForm_peach.MenuItemERCustomClick(Sender: TObject);
var
   i:integer;
   cl,jobcode,outname:utf8string;
begin
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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   end;
end;

procedure TForm_peach.MenuItemERPeaZipClick(Sender: TObject);
var
   i:integer;
   cl,jobcode,outname:utf8string;
begin
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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   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.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:utf8string;
begin
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:utf8string;
begin
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.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.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:utf8string;
begin
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:utf8string;
begin
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:utf8string;
begin
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:=uextractfilepath(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+'*';
      list_un7z_do;
      end
   else //go to object's path
      begin
      EditUn7zaFilter.Text:=uextractfilepath(StringGridList.Cells[8,StringGridList.Row])+'*';
      EditUn7zaFilterExclude.Text:=uextractfilepath(StringGridList.Cells[8,StringGridList.Row])+'*'+directoryseparator+'*';
      list_un7z_do;
      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');
//if fun='FILEBROWSER' then list_root
//else open_archive_fromname(EditOpenIn.Text);
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:utf8string;
begin
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 uFileSetAttr(outname+tempstring, faReadOnly); execute_obj(4,outname); end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then begin uFileSetAttr(outname+directoryseparator+tempstring, faReadOnly); execute_obj(4,outname); end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   end;
end;

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

procedure preview_custom;
var
   i:integer;
   cl,jobcode,outname:utf8string;
begin
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 uFileSetAttr(outname+tempstring, faReadOnly); openw_obj(outname); end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then begin uFileSetAttr(outname+directoryseparator+tempstring, faReadOnly); openw_obj(outname); end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   end;
end;

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

procedure preview_peazipnew;
var
   i:integer;
   cl,jobcode,outname:utf8string;
begin
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 uFileSetAttr(outname+tempstring, faReadOnly); execute_obj(2,outname); end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   if fun='UNARC' then
      if compose_unarc_cl(cl,jobcode,outname,true,'preview','single')=0 then
         if execute_cl(cl,'preview')=0 then begin uFileSetAttr(outname+directoryseparator+tempstring, faReadOnly); execute_obj(2,outname); end
         else
            MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
   end;
end;

procedure TForm_peach.MenuItemPrePeaZipClick(Sender: TObject);
begin
preview_peazipnew;
end;

procedure checkselected(oper:utf8string);
var
   cl,in_param:utf8string;
   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}
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
end;

procedure checkselected_list(oper:utf8string);
var
   cl,in_param:utf8string;
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.EditOpenIn.Text, mtWarning, [mbOK], 0); 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}
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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}
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
P.Execute;
P.Free;
end;

procedure TForm_peach.pmmorecheckClick(Sender: TObject);
begin
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('check');
end;

procedure TForm_peach.po_analyzeClick(Sender: TObject);
begin
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('list');
end;

procedure TForm_peach.po_checkClick(Sender: TObject);
begin
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('check');
end;

procedure TForm_peach.pmmorehexClick(Sender: TObject);
begin
if StringGridList.Cells[1,1]='' then exit;
hexpselected_list;
end;

procedure TForm_peach.pmmorepreviewClick(Sender: TObject);
begin
if StringGridList.Cells[1,1]='' then exit;
checkselected_list('preview');
end;

procedure TForm_peach.pmmoreanalysisClick(Sender: TObject);
begin
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.Cells[1,1]='' then exit;
checkselected_list('preview');
end;

procedure compareselected;
var
   cl,bin_name,filea,fileb:utf8string;
   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;
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
      P.Execute;
      P.Free;
      end;
end;

procedure compareselected_list;
var
   cl,bin_name,filea,fileb:utf8string;
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row], mtWarning, [mbOK], 0); 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;
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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:utf8string;
   i,nsel:integer;
begin
in_param:='';
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 MessageDlg(s+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+char($0D)+char($0A)+strsel,mtWarning,[mbYes,mbNo], 0)=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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); exit; end;
         in_param:=in_param+delimiter+escapefilename(usetfsname(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;
   cl:=utf8toenv(cl);
   P.CommandLine:=cl;
   //s:=Form_peach.EditOpenIn.Text;
   if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
   P.Execute;
   P.Free;
   end;
end;

procedure recycleselected_list;
var
   in_param,strsel,s:utf8string;
   sr: TSearchRec;
   i,nsel:integer;
begin
{$IFDEF MSWINDOWS}
in_param:='';
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 MessageDlg(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,mtWarning,[mbYes,mbNo], 0)=6 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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); exit; end;
         in_param:=escapefilename(Form_peach.StringGridList.Cells[8,i],desk_env);
         s := in_param;
         recyclefile_fromname(s);
         end;{begin
         if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); exit; end;
         in_param:=escapefilename(Form_peach.StringGridList.Cells[8,i],desk_env);
         UFindFirst(in_param, faAnyFile, sr);
         s := StrPas(sr.FindData.cAlternateFileName);
         if s='' then s:= uextractfilename(in_param);
         s := uExtractFilePath(in_param) + s;
         FindClose(sr);
         recyclefile_fromname(s);
         end;}
   end;
{$ENDIF}
end;

procedure TForm_peach.pmsecuredeleteClick(Sender: TObject);
begin
eraseselected_list(1);
end;

procedure TForm_peach.pmrecycleClick(Sender: TObject);
begin
recycleselected_list;
end;

procedure TForm_peach.pmrsearchClick(Sender: TObject);
begin
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.pmtabbbookmarksClick(Sender: TObject);
var
   p:tpoint;
begin
if browserbusy=true then exit;
p.x:=ImageListRoot.left+EditopenIn.left;
p.y:=EditopenIn.top+EditopenIn.height+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:=ImageListRoot.left+EditopenIn.left;
p.y:=EditopenIn.top+EditopenIn.height+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:=ImageListRoot.left+EditopenIn.left;
p.y:=EditopenIn.top+EditopenIn.height+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:=ImageListRoot.left+EditopenIn.left;
p.y:=EditopenIn.top+EditopenIn.height+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.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
//select_all('0');
do_add;
//showpanel('archive');
//showpanel_trick;
end;

procedure TForm_peach.mPeaSiteClick(Sender: TObject);
begin
cp_open('http://www.peazip.org',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:utf8string);
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:utf8string);
var
   i:integer;
   objectname:utf8string;
   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 ufilegetattr(objectname) > 0 then
      if ufilegetattr(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.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('http://www.peazip.org/peazip_help.pdf',desk_env);
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:utf8string;
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.mprofileautoClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=7;
archive_type_select(txt_sfx+' '+STR_7Z);
Form_peach.ComboBoxArchive4.ItemIndex:=3;
ComboBoxArchive4_onchange;
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mprofileencrypt7zClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=0;
archive_type_select('7Z');
Form_peach.ComboBoxArchive4.ItemIndex:=3;
ComboBoxArchive4_onchange;
ImagePassword1Click(self);
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

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

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

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

procedure TForm_peach.mprofilesplitzipClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=14;
archive_type_select(STR_ZIP);
Form_peach.ComboBoxArchive4.ItemIndex:=3;
ComboBoxArchive4_onchange;
ComboBoxArchive1.ItemIndex:=4;
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
end;

procedure TForm_peach.mprofileultra7zClick(Sender: TObject);
begin
checkcontextadd;
cbType.ItemIndex:=0;
archive_type_select('7Z');
Form_peach.ComboBoxArchive4.ItemIndex:=5;
ComboBoxArchive4_onchange;
{$IFDEF MSWINDOWS}if PanelOpen.Visible=false{$ELSE}if PanelOpen.top<>0{$ENDIF} then on_buttonarchiveclick;
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:=2;
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:=3;
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:=4;
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:=15;
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:=5;
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:=6;
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:=9;
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:=10;
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:=11;
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:=14;
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:utf8string;
begin
fun:='FILEBROWSER';
fun_status:=fun;
if ufileexists((Form_peach.EditOpenIn.Text)) then Form_peach.SelectDirectoryDialog1.InitialDir:=uextractfilepath(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:utf8string;
   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 MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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:utf8string;
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:=utf8toenv(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 MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); exit; end;
      P.Execute;
      P.Free;
      end;
   end;
end;

procedure clickcustom(s:utf8string);
var
   s1:utf8string;
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:=uextractfilename(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
addfolder;
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:utf8string);
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:utf8string;
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:utf8string;
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:utf8string;
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.CheckBoxConvert1.visible:=Form_peach.CheckBoxConvert.Checked;
   addtoarchive_selected;
   end;
if StringGridList.Cells[1,1]='' then exit;
if fun='UN7Z' then addtoarchive_inarchive;
if fun='UNARC' then addtoarchive_inarchive;
if fun='UNZPAQ' then addtoarchive_inarchive;
end;

procedure TForm_peach.po_compareClick(Sender: TObject);
begin
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:utf8string):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
         MessageDlg(txt_copy_wait, mtInformation, [mbOK], 0);
         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
         MessageDlg(txt_copy_wait, mtInformation, [mbOK], 0);
         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.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.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:utf8string;
begin
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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row], mtWarning, [mbOK], 0); 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
   P:tprocessutf8;
   cl,s:utf8string;
   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
   MessageDlg('"'+s+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
   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+'''';
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0); 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.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.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:utf8string);
var
   i:integer;
begin
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,uextractfilepath(Form_peach.EditOpenIn1.Caption));
   end;
end;

procedure TForm_peach.po_open_peazipClick(Sender: TObject);
begin
openwith_peazipnew(1,'');
end;

function getnewdestname(var s:utf8string):integer;
var
   s1,s2:utf8string;
begin
getnewdestname:=-1;
s1:=uextractfilename(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
   MessageDlg('"'+s1+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
   exit;
   end;
s2:=uextractfilepath(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:utf8string):integer;
var
   ech,ecode,i:integer;
   overall:boolean;
   cl,src,dest,destf,zparam{$IFNDEF MSWINDOWS},opcommand{$ENDIF}:utf8string;
   P:tprocessutf8;
   label 1;
begin
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;
//if destdir=prev_destdir then samedir:=true else samedir:=false; //ask new name if pasting src and destination are the same dir
filecopying:=true;
cp_copy_filedir:=-1;
if zcopy=1 then zparam:=' /Z' else zparam:='';
//enter_busy_status;
ech:=0;//standard error check, changed conditionally if needed;
overall:=false; //overwrite all, default false;
if Form_peach.Visible=true then Application.ProcessMessages;
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;
      Form_peach.ProgressBar2.Position:=0;
      cl:='';
      src:='';
      dest:='';
      destf:='';
      P:=tprocessutf8.Create(nil);
      src:=clipcontent[i,0];
      if checkfiledirname(src)<>0 then
         begin
         //exit_busy_status;
         MessageDlg(txt_2_7_validatefn+' '+src, mtWarning, [mbOK], 0);
         filecopying:=false;
         exit;
         end;
      {$IFDEF MSWINDOWS}
      {if winver='9x' then //legacy code for 9x
         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 udirectoryexists((dest)) then
               if overall=true then
               else
                     case MessageDlg('"'+uextractfilename(dest)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                     2: goto 1;
                     6: cl:=wincomspec+' /c xcopy '+delimiter+src+delimiter+' '+delimiter+dest+delimiter+' /C /E /H /K /I /R /Y';
                     7: cl:=wincomspec+' /c xcopy '+delimiter+src+delimiter+' '+delimiter+dest+delimiter+' /C /E /H /K /I /R /-Y'; //there is not an explicit options to skip existing files, will ask confirmation in console
                     10: begin overall:=true; cl:=wincomspec+' /c xcopy '+delimiter+src+delimiter+' '+delimiter+dest+delimiter+' /C /E /H /K /I /R /Y'; end;
                     end;
            if cl='' then cl:=wincomspec+' /c xcopy '+delimiter+src+delimiter+' '+delimiter+dest+delimiter+' /C /E /H /K /I /R /Y';
            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
               else
                  begin
                  cl:=wincomspec+' /c xcopy '+delimiter+src+delimiter+' '+delimiter+destf+delimiter+' /C /H /K /R /Y';
                  end
            else
               begin
               if ufileexists((destf)) then
                  if overall=true then clearfile(destf)
                  else
                     case MessageDlg('"'+uextractfilename(destf)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                     2: goto 1;
                     6: clearfile(destf);
                     7: goto 1;
                     10: begin clearfile(destf); overall:=true; end;
                     end;
               cl:=wincomspec+' /c xcopy '+delimiter+src+delimiter+' '+delimiter+dest+delimiter+' /C /H /K /R /Y';
               end;
            end;}
      if winver='nt5' then
         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 udirectoryexists((dest)) then
               if overall=true then
               else
                     case MessageDlg('"'+uextractfilename(dest)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                     2: goto 1;
                     6: cl:='xcopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /C /E /H /K /I /R /Y'+zparam;
                     7: cl:='xcopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /C /E /H /K /I /R /-Y'+zparam; //there is not an explicit options to skip existing files, will ask confirmation in console
                     10: begin overall:=true; cl:='xcopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /C /E /H /K /I /R /Y'+zparam; end;
                     end;
            if cl='' then cl:='xcopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /C /E /H /K /I /R /Y'+zparam;
            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
               else
                  begin
                  cl:='xcopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(destf)+delimiter+' /C /H /K /R /Y'+zparam;
                  end
            else
               begin
               if ufileexists((destf)) then
                  if overall=true then //clearfile(destf) not needed, the command will overwrite
                  else
                     case MessageDlg('"'+uextractfilename(destf)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                     2: goto 1;
                     6: begin end;
                     7: goto 1;
                     10: begin overall:=true; end;
                     end;
               cl:='xcopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /C /H /K /R /Y'+zparam;
               end;
            end;
      if winver='nt6+' then
         begin
         ech:=1;
         if clipcontent[i,2]=txt_list_isfolder then //dir
            begin
            dest:=destdir+clipcontent[i,1]; //getting new directory name does not work with shortnames utf-8 workaround
            if src=dest then
               if getnewdestname(dest)<>0 then
                  begin
                  filecopying:=false;
                  //exit_busy_status;
                  exit;
                  end;
            if udirectoryexists((dest)) then
               if overall=true then
               else
                  case MessageDlg('"'+uextractfilename(dest)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                     2: goto 1;
                     6: cl:='robocopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /E'+zparam;
                     7: cl:='robocopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /E /XO /XN'+zparam; //exclude existing files (either older and newer) to skip overwriting
                     10: begin overall:=true; cl:='robocopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /E'+zparam; end;
                     end;
            if cl='' then cl:='robocopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' /E'+zparam;
            if clipcontent[i,3]=txt_cut then cl:=cl+' /MOV';
            end
         else //file
            begin
            if uextractfilepath(src)=destdir then //src=dest
               begin
               ech:=0;
               dest:=destdir;
               if dest<>'' then if dest[length(dest)]=directoryseparator then setlength(dest,length(dest)-1);
               destf:=dest+directoryseparator+clipcontent[i,1];
               if getnewdestname(destf)<>0 then
                  begin
                  filecopying:=false;
                  //exit_busy_status;
                  exit;
                  end
               else
                  begin  //getting new name does not work with shortnames utf-8 workaround
                  cl:=wincomspec+' /c copy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(destf)+delimiter+' /Y'+zparam;
                  //cl:='xcopy '+delimiter+src+delimiter+' '+delimiter+destf+delimiter+' /C /H /K /R /Y'+zparam; //robocopy doesn't like to copy to a different filename
                  end;
               end
            else
               begin
               if length(uextractfilepath(src))>3 then
                  begin
                  src:=uextractfilepath(src);
                  if src<>'' then if src[length(src)]=directoryseparator then setlength(src,length(src)-1);
                  dest:=destdir;
                  if dest<>'' then if dest[length(dest)]=directoryseparator then setlength(dest,length(dest)-1);
                  destf:=dest+directoryseparator+clipcontent[i,1];
                  if ufileexists((destf)) then
                     if overall=true then //clearfile(destf) not needed, the command will overwrite
                     else
                        case MessageDlg('"'+uextractfilename(destf)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                           2: goto 1;
                           6: begin end;
                           7: goto 1;
                           10: begin overall:=true; end;
                           end;
                  cl:='robocopy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(dest)+delimiter+' '+delimiter+usetfsnameonly(clipcontent[i,0])+delimiter+zparam+' /COPY:DT';
                  if clipcontent[i,3]=txt_cut then cl:=cl+' /MOVE';
                  end
               else //Robocopy does not copy files from unit's root level (no problem with directories)
                  begin
                  ech:=0;
                  dest:=destdir;
                  if dest<>'' then if dest[length(dest)]=directoryseparator then setlength(dest,length(dest)-1);
                  destf:=dest+directoryseparator+clipcontent[i,1];
                  if ufileexists((destf)) then
                     if overall=true then //clearfile(destf) not needed, the command will overwrite
                     else
                        case MessageDlg('"'+uextractfilename(destf)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) of
                           2: goto 1;
                           6: begin end;
                           7: goto 1;
                           10: begin overall:=true; end;
                           end;
                  cl:=wincomspec+' /c copy '+delimiter+usetfsname(src)+delimiter+' '+delimiter+usetfsname(destf)+delimiter+' /Y'+zparam;
                  //cl:='xcopy '+delimiter+src+delimiter+' '+delimiter+destf+delimiter+' /C /H /K /R /Y'+zparam;
                  end;
               end;
            usetcurrentdir((src)); //robocopy will fail otherwise in case of src or dest <3 characters
            end;
         end;
      {$ELSE}//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 udirectoryexists((dest)) then
            if overall=true then
            else
                  case MessageDlg('"'+uextractfilename(dest)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) 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 ufileexists((destf)) then
            if overall=true then clearfile(destf)
            else
                  case MessageDlg('"'+uextractfilename(destf)+'" '+txt_overwrite, mtInformation, [mbYesToAll, mbYes, mbNo, mbCancel],0) 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;
      {$ENDIF}
      if cl='' then goto 1;
      cl:=utf8toenv(cl);
      P.CommandLine:=cl;
      if validatecl(cl)<>0 then
         begin
         MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0);
         //exit_busy_status;
         filecopying:=false;
         exit;
         end;
      P.Execute;
      //enter_busy_status;
      while P.Running do
         begin
         if Form_peach.Visible=true then Application.ProcessMessages;
         Sleep(100);
         end;
      //exit_busy_status;
      usetcurrentdir((executable_path));
      ecode:=P.ExitStatus;
      if ech=0 then
         if ecode<>0 then
               if MessageDlg(cl+char($0D)+char($0A)+txt_copy_error+' '+inttostr(ecode)+'. '+txt_abort, mtError, [mbYes, mbNo],0)=6 then
                  begin
                  break;
                  end
               else goto 1
         else cp_copy_filedir:=0;
      if ech=1 then
         if (ecode>3) then
               if MessageDlg(cl+char($0D)+char($0A)+txt_copy_error+' '+inttostr(ecode)+'. '+txt_abort, mtError, [mbYes, mbNo],0)=6 then
                  begin
                  break;
                  end
               else goto 1
         else cp_copy_filedir:=0;
      {$IFDEF MSWINDOWS}
      //remove src on move operations: only executed if no errors are encountered
      if winver='nt5' then
         if clipcontent[i,3]=txt_cut then
            if clipcontent[i,2]=txt_list_isfolder then cp_copy_filedir:=cleardir(src,false)
            else clearfile(src);
      if winver='nt6+' then
         if clipcontent[i,3]=txt_cut then
            if clipcontent[i,2]=txt_list_isfolder then
               if udirectoryexists((src)) then cp_copy_filedir:=cleardir(src,false)
               else
            else
               if ufileexists(src) then clearfile(src);
      {$ENDIF}
      1:
      try P.Free; except end;
   end;
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:utf8string);
var
   i,j:integer;
   s:string;//dragged files are passed as strings, not utf8strings
begin
if filecopying=true then
   begin
   MessageDlg(txt_copy_wait, mtInformation, [mbOK], 0);
   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[length(s)]=directoryseparator then setlength(s,length(s)-1);
      clipcontent1[j,1]:=uextractfilename(s);
      if directoryexists(s) then clipcontent1[j,2]:=txt_list_isfolder
      else clipcontent1[j,2]:=uextractfileext(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
   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.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 clickmoveto;
begin
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;

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:utf8string);
var
   olddest,cl,jobcode,outname:utf8string;
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
   if Form_peach.StringGridList.Cells[1,1]='' then exit;
{$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;

if dest='' then
   if (fun='FILEBROWSER') then Form_peach.EditOpenOut.Text:=Form_peach.EditOpenIn.Text
   else Form_peach.EditOpenOut.Text:=uextractfilepath(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;

end;

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

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

procedure TForm_peach.pmqe3favClick(Sender: TObject);
begin
if (uextractfilepath(pnb3.Caption)<>'') then quickextract(uextractfilepath(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 TForm_peach.pmqenewfolderClick(Sender: TObject);
begin
pmqenewfolder.checked:=not(pmqenewfolder.checked);
if pmqenewfolder.checked=true then tonewfolder:=1
else tonewfolder:=0;
updateconf_modified;
settonewfolder(tonewfolder);
end;

procedure TForm_peach.pmqenopathClick(Sender: TObject);
begin
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
deleteselected_frombrowser;
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}
if (winver='nt5') or (winver='nt6+') then
   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.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 numstr(i,nsel:integer):utf8string;
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:utf8string);
var
   s,s0,sext,sextorig,sextchanged,strsel,s1,sadd,sold,snew,sti,snchar,snpos:utf8string;
   i,k,nsel,rc,nchar,npos:integer;
begin
if fun<>'FILEBROWSER' then exit;
{$IFDEF MSWINDOWS}if Form_peach.EditOpenIn.Text=txt_mypc then exit;{$ENDIF}
if Form_peach.StringGridList.Cells[1,1]='' then exit;
//if checklistsel<>0 then exit;
if checklisttotsel(nsel,strsel)<>0 then exit;
s:=Form_peach.StringGridList.Cells[1,Form_peach.StringGridList.Row];
if mode='rename' then //replace entire file name string
begin
sextorig:='';
if not udirectoryexists(Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]) then
   sextorig:=uextractfileext(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
   MessageDlg('"'+s+'" '+txt_checkname_failed+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
   exit;
   end;
if nsel>1 then
   if MessageDlg(txt_rename+char($0D)+char($0A)+'   '+s+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel,mtWarning,[mbYes,mbNo], 0)<>6 then exit;
k:=0;
s1:=Form_peach.EditOpenIn.Text;
s0:=s;
sextchanged:='';
if not udirectoryexists(Form_peach.StringGridList.Cells[8,Form_peach.StringGridList.Row]) then
   begin
   if sextorig<>uextractfileext(s) then sextchanged:=uextractfileext(s);
   cutextension(s0);
   end;
enter_busy_status;
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' 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; MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); navrefresh; exit; end;
      k:=k+1;
      sext:='';
      if not udirectoryexists(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:=uextractfileext(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
         urenamefilebyname(Form_peach.StringGridList.Cells[8,i],uextractfilepath(Form_peach.StringGridList.Cells[8,i])+s);
         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='timestamp') then //special modes
begin
if mode='add' then
   begin
   if not pInputQuery(txt_5_5_string, txt_name_provide, '', sadd, false) then exit;
   if checkfilename(sadd)<>0 then
      begin
      MessageDlg('"'+sadd+'" '+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
      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
      MessageDlg(txt_5_5_position+char($0D)+char($0A)+txt_5_5_positionw, mtWarning, [mbOK], 0);
      exit;
   end;
   end;
if mode='delete' then
   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
      MessageDlg(txt_5_5_position+char($0D)+char($0A)+txt_5_5_positionwd, mtWarning, [mbOK], 0);
      exit;
   end;
   end;
if (mode='replace') or (mode='replacecase') then
   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
      MessageDlg('"'+sold+'" '+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
      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
      MessageDlg('"'+snew+'" '+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
      exit;
      end;
   if length(sold)>256 then sold:=copy(sold,1,256);
   if length(snew)>256 then snew:=copy(snew,1,256);
   end;
if (mode='extension') then
   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
      MessageDlg('"'+snew+'" '+char($0D)+char($0A)+txt_name_provide, mtWarning, [mbOK], 0);
      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);
   end;
if nsel>1 then
   if MessageDlg(txt_rename+char($0D)+char($0A)+sti+char($0D)+char($0A)+char($0D)+char($0A)+inttostr(nsel)+' '+txt_displayed_obj+':'+char($0D)+char($0A)+strsel,mtWarning,[mbYes,mbNo], 0)<>6 then exit;
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' then
      begin
      if checkfiledirname(Form_peach.StringGridList.Cells[8,i])<>0 then begin exit_busy_status; MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); navrefresh; exit; end;
      Form_peach.Caption:=txt_rename+' '+sti+' ('+inttostr(k+1)+'/'+inttostr(nsel)+') '+Form_peach.StringGridList.Cells[1,i]+'...';
      if mode='uppercase' then
         s:=upcase(uextractfilename(Form_peach.StringGridList.Cells[8,i]));
      if mode='lowercase' then
         s:=lowercase(uextractfilename(Form_peach.StringGridList.Cells[8,i]));
      if mode='timestamp' then
         begin
         s:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
         apply_timestamptoname(s,0,1);
         end;
      if mode='add' then
         begin
         s:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
         sext:='';
         if not udirectoryexists(Form_peach.StringGridList.Cells[8,i]) then
            begin //it is a file
            sext:=uextractfileext(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:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
         sext:='';
         if not udirectoryexists(Form_peach.StringGridList.Cells[8,i]) then
            begin //it is a file
            sext:=uextractfileext(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:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
         sext:='';
         if not udirectoryexists(Form_peach.StringGridList.Cells[8,i]) then
            begin //it is a file
            sext:=uextractfileext(s);
            cutextension(s);
            end;
         if mode='replace' then
            s:=uStringReplace_new(s,sold,snew, [rfIgnoreCase, rfReplaceAll])
         else
            s:=uStringReplace_new(s,sold,snew, [rfReplaceAll]);
         if s='' then s:=sold;
         s:=s+sext;
         end;
      if mode='extension' then
         begin
         s:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
         if not udirectoryexists(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:=uextractfilename(Form_peach.StringGridList.Cells[8,i]);
         end;
      //check if name is unique
      if Form_peach.StringGridList.Cells[8,i]<>(uextractfilepath(Form_peach.StringGridList.Cells[8,i])+s) then
         begin
         {$IFDEF MSWINDOWS}if (mode<>'uppercase') and (mode<>'lowercase') then{$ENDIF}
         if (ufileexists(uextractfilepath(Form_peach.StringGridList.Cells[8,i])+s)) or (udirectoryexists(uextractfilepath(Form_peach.StringGridList.Cells[8,i])+s)) then
            begin
            s:=uextractfilepath(Form_peach.StringGridList.Cells[8,i])+s;
            get_new_archive_name(s);
            s:=uextractfilename(s);
            end;
         k:=k+1;
         urenamefilebyname(Form_peach.StringGridList.Cells[8,i],uextractfilepath(Form_peach.StringGridList.Cells[8,i])+s);
         end;
      Application.ProcessMessages;
      end;
   end;
exit_busy_status;
end;
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:=9;
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.RadioGroup1Click(Sender: TObject);
begin
on_RadioGroup1Click;
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;
//schedulestart1.Visible:=true;
//scheduleend1.Visible:=true;
//dateedit3.Visible:=true;
//dateedit4.Visible:=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
   //scheduleend1.Visible:=false;
   //dateedit4.Visible:=false;
   end;
   else //on start, on login
   begin
   lsa6.Visible:=false;
   schedulehh1.Visible:=false;
   schedulemm1.Visible:=false;
   //schedulestart1.Visible:=false;
   //scheduleend1.Visible:=false;
   //dateedit3.Visible:=false;
   //dateedit4.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;
//schedulestart.Visible:=true;
//scheduleend.Visible:=true;
//dateedit1.Visible:=true;
//dateedit2.Visible:=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
   //scheduleend.Visible:=false;
   //dateedit2.Visible:=false;
   end;
   else //on start, on login
   begin
   lsa3.Visible:=false;
   schedulehh.Visible:=false;
   schedulemm.Visible:=false;
   //schedulestart.Visible:=false;
   //scheduleend.Visible:=false;
   //dateedit1.Visible:=false;
   //dateedit2.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:utf8string;
begin
if fromtree=true then
   begin
   s:=ShellTreeView1.GetSelectedNodePath;
   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;
setmswindowsopacity;
end;

procedure TForm_peach.SpinEditPrebrowseChange(Sender: TObject);
begin
on_SpinEditPrebrowseChange;
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.StringGrid1DblClick(Sender: TObject);
begin
if currow1=0 then
else open_associated;
end;

procedure drawcellicon(sg:tstringgrid; arow:integer);
var
   fullname,fulltype:utf8string;
   l,t:integer;
begin
l:=sg.CellRect(0,arow).Left+2;
t:=sg.CellRect(0,arow).Top+3;
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);
   {if StringGrid1.Cells[11,arow] = '1' then
      begin
      StringGrid1.Canvas.Brush.Color := clHighlight;
      StringGrid1.Canvas.FillRect(aRect);
      StringGrid1.Canvas.Font.Color := clHighlightText;//no longer needed in 0.9.30
      if aCol=0 then drawcellicon(StringGrid1,arow);
      end
   else
      begin
      StringGrid1.Canvas.Brush.Color := rowcol;
      StringGrid1.Canvas.FillRect(aRect);
      StringGrid1.Canvas.Font.Color := clWindowText;
      if aCol=0 then drawcellicon(StringGrid1,arow);
      end;}

{$IFDEF MSWINDOWS}
//{$ELSE}//patch the GTK/GTK2 issue of text remaining visible when column width is set to 0
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;
   {if Form_peach.StringGrid1.RowCount-1<length(clipcontent) then
      begin
      Form_peach.StringGrid1.RowCount:=1024;//length(clipcontent)+1;}
   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);
   {if StringGrid2.Cells[11,arow] = '1' then
      begin
      StringGrid2.Canvas.Brush.Color := clHighlight;
      StringGrid2.Canvas.FillRect(aRect);
      StringGrid2.Canvas.Font.Color := clHighlightText;//no longer needed in 0.9.30
      if aCol=0 then drawcellicon(StringGrid2,arow);
      end
   else
      begin
      StringGrid2.Canvas.Brush.Color := rowcol;
      StringGrid2.Canvas.FillRect(aRect);
      StringGrid2.Canvas.Font.Color := clWindowText;
      if aCol=0 then drawcellicon(StringGrid2,arow);
      end;}

{$IFDEF MSWINDOWS}
//{$ELSE}//patch the GTK/GTK2 issue of text remaining visible when column width is set to 0
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:utf8string;
   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+2;
t:=sg.CellRect(0,arow).Top+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
   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,Bweb);
   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;
{$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[length(s)]=directoryseparator then fulltype:=txt_list_isfolder
else fulltype:=uextractfileext(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);
var
   rowcol:TColor;
begin
if arow=0 then exit;
{if (arow and 1)=0 then rowcol:=StringGridBookmarks.Color
else rowcol:=StringGridBookmarks.AlternateColor;//col2
if StringGridBookmarks.Cells[11,arow] = '1' then
   begin
   StringGridBookmarks.Canvas.Brush.Color := clHighlight;
   StringGridBookmarks.Canvas.FillRect(aRect);
   StringGridBookmarks.Canvas.Font.Color := clHighlightText;
   end
else
   begin
   StringGridBookmarks.Canvas.Brush.Color := rowcol;
   StringGridBookmarks.Canvas.FillRect(aRect);
   StringGridBookmarks.Canvas.Font.Color := clWindowText;
   end;}
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 MessageDlg(txt_3_7_sort+' > '+Form_peach.StringGridBookmarks.Cells[Column,0], mtConfirmation,[mbYes, mbNo],0)<>6 then exit; end
   else begin if MessageDlg(txt_3_7_sort+' < '+Form_peach.StringGridBookmarks.Cells[Column,0], mtConfirmation,[mbYes, mbNo],0)<>6 then exit; end
else begin if MessageDlg(txt_3_7_sort+' < '+Form_peach.StringGridBookmarks.Cells[Column,0], mtConfirmation,[mbYes, mbNo],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[0,i]:=inttostr(i);
   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.StringGridSessionHistoryDblClick(Sender: TObject);
begin
{if browsinghistory=true then exit;
browsehistory;}
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);
begin
cp_open('http://www.peazip.org/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+'*';
      list_un7z_do;
      end;
   if fun='FILEBROWSER' then
      begin
      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:utf8string;
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); exit; end;
      case fun of
         'UNLPAQ' :
         begin
         if StringGridList.Rowcount<3 then
            if compose_unlpaq_cl(cl,jobcode,outname,true)=0 then
               if execute_cl(cl,'extandrun')=0 then execute_obj(3,outname)
               else
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0)
            else
         else
            MessageDlg(txt_error_partial, mtWarning, [mbOK], 0); //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
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
               end
            else
         else
            MessageDlg(txt_error_partial, mtWarning, [mbOK], 0);
         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
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
               end
            else
         else
            MessageDlg(txt_error_partial, mtWarning, [mbOK], 0);
         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)=0 then
               if execute_cl(cl,'extandrun')=0 then execute_obj(3,outname)
               else
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
            end
         else
            MessageDlg(txt_error_partial, mtWarning, [mbOK], 0); //never happens since QUAD/BALZ/BCM 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
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
               end;
            end
         else
            MessageDlg(txt_error_partial, mtWarning, [mbOK], 0);
         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];
            udodirseparators(s);
            mri:=MessageDlg(txt_dis+' '+s+' '+txt_type_exe, mtWarning,[mbYes, mbNo, mbCancel],0);
            if mri=6 then
               begin
               w:=utf8decode(s);
               if validatecl(s)<>0 then begin MessageDlg(txt_2_7_validatecl+' '+s, mtWarning, [mbOK], 0); 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(uextractfileext(StringGridList.Cells[8,StringGridList.Row]))='.fat')
                  or (lowercase(uextractfileext(StringGridList.Cells[8,StringGridList.Row]))='.ntfs') then
                     begin
                     MessageDlg(txt_2_8_unitrecommend, mtInformation, [mbOK], 0);
                     exit;
                     end;
            if compose_un7z_cl(cl,jobcode,outname,true,'preview','single')=0 then
               if execute_cl(cl,'preview')=0 then begin uFileSetAttr(outname+tempstring, faReadOnly); execute_obj(3,outname); end
               else
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
         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 uFileSetAttr(outname+directoryseparator+tempstring, faReadOnly); execute_obj(3,outname); end
               else
                  MessageDlg(txt_extraction_error, mtWarning, [mbOK], 0);
         exit;
         end;
      end;
   end;
end;
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;
begin
if StringGridList.Cells[1,1]='' then exit;
if checklistanysel<>0 then exit;
if Key=13 then
   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;
         for i:=1 to Form_peach.StringGridList.RowCount-1 do
            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;
         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;
               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.Cells[1,1]='' then exit;
      checkselected_list('check');
      end;
   if key='=' then //compare
   if checklistsel=0 then
      begin
      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=[ssShift] then
      if fun='FILEBROWSER' then eraseselected_list(1);
   if shift=[ssCtrl] 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);
begin
try
   shint:='';
   prevshint:='';
   h.hide;
except
end;
if set_grid=false then exit;
case button of
   mbMiddle: rename_files('rename');
   end;
{$IFDEF MSWINDOWS}
rightdropbutton:=false;
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;
{$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:utf8string;
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 s:=s+char($0D)+char($0A)+ListView1.Column[3].Caption+' - '+ListView1.Items[i].SubItems[2];
        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.ListView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
update_selstatus;
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
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(udirectoryexists(confpath+'Scheduled scripts'+DirectorySeparator)) then umkdir(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:utf8string):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:utf8string);
var
   i,j:integer;
begin
if filecopying=true then
   begin
   MessageDlg(txt_copy_wait, mtInformation, [mbOK], 0);
   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:utf8string;
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:utf8string;
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:utf8string;
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);
//Form_peach.EditOpenOut.Text:=olddest;
end;

procedure TForm_peach.pma2s_extractall1Click(Sender: TObject);
var
   cl,jobcode,outname:utf8string;
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
//fun is 'FILEBROWSER'
//list_toextractor('multi','full'); //extraction through form
//Form_peach.EditOpenOut.Text:=destdir;
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:utf8string;
   P:tprocessutf8;
begin
themedir:='themes'+directoryseparator+Form_peach.edit1.text+directoryseparator;
theme_path:=themedir+'theme.txt';
graphicsfolder:=themedir;
try
try
   if not(udirectoryexists(confpath+'themes')) then uforcedirectories(confpath+'themes');
   uforcedirectories(confpath+themedir);
except
   MessageDlg(confpath+themedir+' '+txt_theme_exists, mtError, [mbOK], 0);
   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}
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0);
   exit;
   end;
P.Execute;
P.Free;
uassigntext(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;
cl:=utf8toenv(cl);
P.CommandLine:=cl;
if validatecl(cl)<>0 then
   begin
   MessageDlg(txt_2_7_validatecl+' '+cl, mtWarning, [mbOK], 0);
   exit;
   end;
P.Execute;
P.Free;
MessageDlg(txt_done+' '+local_desktop+Form_peach.Edit1.text+'.theme.7z', mtInformation, [mbOK], 0);
except
   MessageDlg(txt_theme_create_error, mtError, [mbOK], 0);
   exit;
end;
end;

procedure TForm_peach.themesave_labelClick(Sender: TObject);
begin
if edit1.text='' then
   begin
   MessageDlg(txt_no_theme_name, mtWarning, [mbOK], 0);
   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
   //Form_peach.ListView1.LargeImages:=Form_peach.ImageList16px; //0.9.30, Linux: with larger icons the listview component has critical performance problems when drawing itself
   {$ENDIF}
   {Form_peach.ImageList1Small.Width:=smalliconsize;
   Form_peach.ImageList1Small.Height:=smalliconsize;
   Form_peach.ImageList1Large.Width:=largeiconsize;
   Form_peach.ImageList1Large.Height:=largeiconsize;}//0.9.30: does not work reliably, so were created separated imagelists with size set at design time
   loadsmallicons(smalliconsize);
   loadlargeicons(largeiconsize);
   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.ListView1.Rowselect:=rowselect;
   if rowselect=true then Form_peach.mrowselect.checked:=true else Form_peach.mrowselect.checked:=false;
   togglemenubar;
   setnav(navbar);
   setaddressbar(addressbar);
   settoolbar;
   showtoolbar(-1);
   setbrowsersize(browsersize);
   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);
   setusebreadcrumb(usebreadcrumb);
   set_listview_cnames;
   setdecostyle;
   hideintro;
end;

procedure doprogress2;
begin
if Form_peach.ProgressBar2.Visible=false then
   if pcount<10 then
      pcount:=pcount+1
   else
      begin
      Form_peach.ProgressBar2.Position:=0;
      Form_peach.ProgressBar2.Visible:=true;
      refreshstatus:=2;
      Form_peach.ImageListSearch.Picture.Bitmap:=Bdelete;
      end
else
   begin
   Form_peach.Progressbar2.Position:=Form_peach.Progressbar2.Position+1;
   if Form_peach.Progressbar2.Position>=50 then Form_peach.Progressbar2.Position:=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;
      set_items_height;//needs to be recalled when the form is fully drawn, set custom height to other GUI items which may be to small for some font sizes, accordingly to grid height
      finishlistview;
      populatepcmenu;
      imgshelltree;
      end
else exit;
{$ELSE}
if form_peach.Visible=true then
   if openstarted=true then exit
   else
      begin
      openstarted:=true;
      set_items_height;
      finishlistview;
      openstart;
      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 from 1 to 6 sec (increases for flat mode and for many items)
var
   recmode:boolean;
   nfiles,ndirs,nunits,rc,sc,tsize,nparsed: qword;
   i,torefresh:integer;
   navrefreshed:boolean;
begin
{$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 control_listingdir=true then begin timer2.enabled:=false; exit; end;
      control_listingdir:=true;
      //labelstatus.Caption:=status0+' '+status1+' ['+status2+']';
      if StringGridSessionHistory.Cells[1,StringGridSessionHistory.Row]=txt_list_browsing then recmode:=false
      else recmode:=true;
      //if recmode=true then Timer2.Interval:=2000
      ///else
      Timer2.Interval:=1000;
      rc:=StringGridList.rowcount;
      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 udirectoryexists(EditOpenIn.Text) then
            begin
            nfiles:=0;
            ndirs:=0;
            tsize:=0;
            rcountsize(EditOpenIn.Text,'*',faAnyFile,recmode,nfiles,ndirs,tsize);
            nparsed:=nfiles+ndirs;
            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);
            if nparsed>5000 then
               begin
               Timer2.Interval:=Timer2.Interval*(1+nparsed div 5000);
               //if nfiles>50000 then Timer2.Interval:=Timer2.Interval*3
               //else Timer2.Interval:=Timer2.Interval*2;
               end;
            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 //slower refresh rate if only size is changing
                  begin
                  torefresh:=random(4);
                  if torefresh=0 then navrefresh;
                  end;
            end;
         end
      else
         begin
         {$IFDEF MSWINDOWS}
         Timer2.Interval:=1000;
         countunits(nunits);
         if nunits+1<>rc then
            begin
            navrefresh;
            populatepcmenu;
            end;
         {$ENDIF}
         end;
      control_listingdir:=false;
      end;
   //else labelstatus.Caption:=status0+' '+status1+' ['+status2+']';
end;

procedure addmultiupdate;
var
   t:text;
   s1:utf8string;
   i:integer;
   nfiles,ndirs,tsize: qword;
   okfile:boolean;
   flist: TFoundList;
   fsizes: TFoundListSizes;
   ftimes: TFoundListAges;
   fattr: TFoundListAttrib;
   fattr_dec: TFoundList;
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
      uassigntext(t,flist[i]);
      reset(t);
      readln(t,s1);
      closefile(t);
      udeletefile(flist[i]);
      if testname(s1, Form_peach.StringGrid1)=0 then
         if ufilegetattr(s1) > 0 then
            if ufilegetattr(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
   for i:=0 to nfiles-1 do
      begin
      uassigntext(t,flist[i]);
      reset(t);
      readln(t,s1);
      closefile(t);
      udeletefile(flist[i]);
      test_extfile(s1,okfile);
      if okfile=true then
         begin
         if checkfiledirname(s1)<>0 then begin MessageDlg(txt_2_7_validatefn+' '+s1, mtWarning, [mbOK], 0); exit; end;
         deselectingrid(Form_peach.StringGrid2);
         addfilestr(Form_peach.StringGrid2,s1);
         end;
      end;
   if Form_peach.StringGrid2.Rowcount>1 then
      Form_peach.EditOpenOut.Text:=uextractfilepath(Form_peach.StringGrid2.Cells[8,Form_peach.StringGrid2.Row])
   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.TimerHintStopTimer(Sender: TObject);
begin
if checkboxshowhints.Checked=false then exit;
try
   h.hide;
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:utf8string;
   i,appsnodes:integer;
begin
if TargetNode=nil then
   begin
   Form_peach.treeview1.selected:=nil;
   exit;
   end;
if (targetnode.parent<>nil) then
   begin
   {s1:=TargetNode.Text;
   if TargetNode.GetParentNodeOfAbsoluteLevel(0).Text=txt_mypc then //possible implementation: display a treeview of folders and navigate folder by node name
       begin
       //opendevice(TargetNode.Text);
       getfullnodepath(targetnode,s,s1);
       if s=Form_peach.EditOpenIn1.Text then exit;
       if fromtree=true then
          begin
          fun:='FILEBROWSER';
          fun_status:=fun;
          Form_peach.EditUn7zaFilter.Text:='*';
          listdir(s,false,false);
          addtohistory;
          exit;
          end;
       end;}
   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
          //1: cp_open('http://www.peazip.org/web-search.html',desk_env);
          0: run_custom;
          else
             begin
             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
      {if TargetNode.Text=txt_2_9_organize then
         do_organizebookmarks
      else
         if TargetNode.Text=txt_add_tobookmarks then
            addtobookmarks('*browser')
         else}
            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]);
         //open_archive_fromname(Form_peach.StringGridRecent.Cells[1,TargetNode.Index+1-hnum]);
      exit;
      end;
   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_4_1_duplicatesfind);
treeview2.Items.Add(nil,txt_copyto);
treeview2.Items.Add(nil,txt_moveto);
treeview2.Items.Add(nil,txt_join);
treeview2.Items.Add(nil,txt_split);
treeview2.Items.Add(nil,txt_4_3_pwman);
treeview2.Items.Add(nil,txt_2_7_setpw);
treeview2.Items.Add(nil,txt_4_8_rl);
treeview2.Items.Add(nil,txt_4_8_rr);
treeview2.Items.Add(nil,txt_2_5_help);
treeview2.Items.Add(nil,txt_peazip_new);
treeview2.Items.Add(nil,txt_cphere);
{$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
//populatetree2;  done in populatetree
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:utf8string);
begin
if capt=txt_add then begin do_add; exit; end;
if capt=txt_2_5_help then
   begin
   showpanel('defaults');
   clicklabel_options(form_peach.LabelTitleOptions7, form_peach.BevelTitleOptions7);
   exit;
   end;
if capt=txt_2_8_convert then begin archive_convert; exit; end;
if capt=txt_caption_extract then begin do_extract; exit; end;
if capt=txt_ext_allto+'...' then begin do_extallto; exit; end;
if capt=txt_caption_test then begin do_test; exit; end;
if capt=txt_4_1_duplicatesfind then begin deduplicate('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
MessageDlg(txt_5_3_cmlmessage, mtInformation, [mbOk], 0);
cp_open(executable_path+'res'+directoryseparator+'lang-wincontext'+directoryseparator,desk_env);
end;

procedure TForm_peach.TimerdragTimer(Sender: TObject);
var
   lpPoint:TPoint;
   dragdest:utf8string;
begin
{$IFDEF MSWINDOWS}
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[length(dragdest)]=directoryseparator then setlength(dragdest,length(dragdest)-1);
         FormDrop.Labeldragtitle.Caption:=basedragtitle+' '+txt_to+' '+uextractfilename(dragdest);
         end
      else FormDrop.Labeldragtitle.Caption:=basedragtitle
   else FormDrop.Labeldragtitle.Caption:=basedragtitle
else FormDrop.Labeldragtitle.Caption:=basedragtitle;
FormDrop.Height:=FormDrop.imagedragfile.top+56;
{$ENDIF}
end;

{$IFDEF MSWINDOWS}

procedure preparedragform;
var
   sfiles:qword;
   nfiles,nfolders:integer;
   name_file,name_folder,dragsrc,txt1_dirs:utf8string;
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[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 uextractfilename(dragsrc)<>'' then FormDrop.Labeldragtitle.Caption:=txt_2_4_copyfrom+' '+uextractfilename(dragsrc)//+char($0D)+char($0A)+txt_2_4_draghint
      else FormDrop.Labeldragtitle.Caption:=txt_2_4_copyfrom+' '+copy(Form_peach.EditOpenIn.Caption,1,3);//+char($0D)+char($0A)+txt_2_4_draghint;
      FormDrop.Imagedragop.picture.bitmap:=Btool_copy;
      FormDrop.Imagedragop.transparent:=true;
      end
   else
      begin
      FormDrop.Labeldragtitle.Caption:=uextractfilename(dragsrc)+' > '+getextcaption;//txt_2_4_extractfrom+' '++char($0D)+char($0A)+txt_2_4_draghint;
      if tonewfolder=0 then FormDrop.Imagedragop.picture.bitmap:=Bextractallto_big
      else FormDrop.Imagedragop.picture.bitmap:=Bextractallton_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;
   //{$IFDEF MSWINDOWS}
   cl,jobcode,outname,dragdest,olddest:utf8string;
   lpPoint:TPoint;
   //{$ENDIF}
begin
Form_peach.Timerdrag.enabled:=false;
FormDrop.Visible:=false;
totrow:=Form_peach.StringGridList.Rowcount;
if totrow<2 then begin FDragObject.Destroy; exit; end;
//{$IFDEF MSWINDOWS}
{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;
   case fun of
      'RFJ' :
      if totrow<3 then
         if compose_unpea_cl(cl,jobcode,outname)=0 then launch_cl(cl,jobcode,outname)
         else
      else
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0); //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
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0); //never happens since PEA visualize content as a single object
      'UNLPAQ' :
      if totrow<3 then
         if compose_unlpaq_cl(cl,jobcode,outname,true)=0 then launch_cl(cl,jobcode,outname)
         else
      else
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0); //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
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0);
      '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
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0);
      'UNQUAD' :
      if totrow<3 then
         if compose_unquad_cl(cl,jobcode,outname,true)=0 then launch_cl(cl,jobcode,outname)
         else
      else
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0); //never happens since QUAD/BALZ/BCM 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
         MessageDlg(txt_error_partial, mtWarning, [mbOK], 0);
      'FILEBROWSER':
      if (GetKeyShiftState=[ssctrl]) or (rightdropbutton=true) then
         begin
         destdir:=Form_peach.EditOpenOut.Text;
         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;
            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;
            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;
   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 MessageDlg(txt_2_7_validatefn+' '+Form_peach.StringGridList.Cells[8,i], mtWarning, [mbOK], 0); 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;
//{$ENDIF}
end;

{$ENDIF}

initialization
  {$I peach.lrs}

  {$IFDEF MSWINDOWS}
  OleInitialize(nil);
  {$ENDIF}

finalization
  {$IFDEF MSWINDOWS}
  OleUninitialize();
  {$ENDIF}

end.
