#!/usr/bin/env bash
#
#####################################
#####################################
#
# EasyBashGUI allows you to use SAME script
# with gtkdialog, kdialog, zenity, Xdialog, (c)dialog or whiptail ...
#
#########################
#
# Copyright (C) 2012 Vittorio Cagnetta
#
# Author: Vittorio Cagnetta <vaisarger@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program, 
# called, in this distribution, "EasyBashGUI-license"; if not, write to the 
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
#########################
#
#	Dedicated to Angela, Nicole and Carlo.
#
#			Vittorio Cagnetta
#	http://sites.google.com/site/easybashgui
#
#####################################
#####################################
#
LIB_NAME="easybashgui"
LIB_VERSION="4.0.3"
LIB_URL="http://sites.google.com/site/easybashgui"
LIB_AUTHOR="Vittorio Cagnetta"
#
#####################################
#####################################
# Initial settings...
#
##
# mascotte...
[ ${#OSTYPE} -gt 0 ] && os=${OSTYPE} || os="$(uname -s )"
[ $(echo -n "${os}" | grep -i "bsd" | wc -c ) -gt 0 ] && \
mascotte="Beastie" || mascotte="Tux"
#
##
#
# Window width and height...
width=500
: width
height=378
: height
#
##
#
# gsed...
for word in sed gsed
	do
	unset -v "${word}"
	unset -f "${word}"
done 
[ "${mascotte}" = "Beastie" ] && : #later we'll check for gsed binary...
[ "${mascotte}" = "Tux" ] && shopt -s expand_aliases && alias gsed=sed #gsed is no more a function...
typing_gsed="$(type "gsed" 2> /dev/null )"
if [ ${#typing_gsed} -eq 0 ]
	then
	[ "${mascotte}" = "Beastie" ] && echo -e "\n\n\n\nYou need to install \"gsed\" ( GNU Sed ) port/package to use ${LIB_NAME}...\nSorry :(\n\n\n\n" 1>&2
	[ "${mascotte}" = "Tux" ] && echo -e "\n\n\n\nErr.: gsed aliasing failed!...\n:(\n\n\n\n" 1>&2
	#
	exit 1
fi
#
##
#
# where storing data file...
default_tmp="${HOME}/tmp"
if [ -d "${default_tmp}" ]
	then
	dir_tmp="${default_tmp}"
else
	dir_tmp="/tmp"
fi
[ ! -d "${dir_tmp}" -o ! -w "${dir_tmp}" ] && mkdir "${default_tmp}" && dir_tmp="${default_tmp}"
: dir_tmp
#
if [ -f "${dir_tmp}/${file_tmp}" ]
	then
	: 1> "${dir_tmp}/${file_tmp}"
	: 1> "${dir_tmp}/${file_ignore}"
else
	cd "${dir_tmp}"
	export file_tmp="$(mktemp "XXXXXXXXXXXXXXXXXXXX" )"
	export file_ignore="$(mktemp "XXXXXXXXXXXXXXXXXXXX" )"
	cd - 1>/dev/null
fi
: file_tmp
#
##
#
# Set it if you want _force_ easybashgui mode :
#supermode="" # <= 5 options: "auto" "gtkdialog" "kdialog", "zenity", "Xdialog", "dialog"
: supermode
#
##
#
string_to_clean=':1: error: unexpected .*, expected .* - e.g. .*'
: string_to_clean
#
##
#
#####################################
#
# ... gtkdialog, kdialog, zenity, Xdialog, or dialog ???
#
################
#
gtkdialog="NO"
esistenza_gtkdialog="$(type "gtkdialog" 2> /dev/null )"
if [ ${#esistenza_gtkdialog} -gt 0 ]
	then
	#
	# versione minima => 0.7.20 ...
	required_gtkdialog_first_field=0
	required_gtkdialog_second_field=7
	required_gtkdialog_third_field=20
	#
	vers_gtkdialog="$(gtkdialog --version | cut -d ' ' -f 3 )"
	if [ $(echo -n "${vers_gtkdialog}" | tr -dc '[[:digit:]]' | wc -c ) -gt 0 ]
		then
		vers_gtkdialog_primo_campo=$(echo "${vers_gtkdialog}" | cut -d '.' -f 1 )
		vers_gtkdialog_secondo_campo=$(echo "${vers_gtkdialog}" | cut -d '.' -f 2 )
		vers_gtkdialog_terzo_campo=$(echo "${vers_gtkdialog}" | cut -d '.' -f 3 )
		#
		if [ ${vers_gtkdialog_primo_campo} -gt ${required_gtkdialog_first_field} ]
			then
			#
			gtkdialog="SI"
			#
		elif [ ${vers_gtkdialog_primo_campo} -eq ${required_gtkdialog_first_field} ]
			then
			#
			if [ ${vers_gtkdialog_secondo_campo} -gt ${required_gtkdialog_second_field} ]
				then
				#
				gtkdialog="SI"
				#
			elif [ ${vers_gtkdialog_secondo_campo} -eq ${required_gtkdialog_second_field} ]
				then
				#
				if [ ${vers_gtkdialog_terzo_campo} -ge ${required_gtkdialog_third_field} ]
					then
					#
					gtkdialog="SI"
					#
				fi
				#
			fi
			#
		fi # if [ ${vers_gtkdialog_primo_campo} -gt ${required_gtkdialog_first_field} ]
		#
	fi #if [ $(echo -n "${vers_kdialog}" | tr -dc '[[:digit:]]' | wc -c) -gt 0 ]
	#
fi #if [ ${#esistenza_kdialog} -gt 0 ]
#
kdialog="NO"
esistenza_kdialog="$(type "kdialog" 2> /dev/null )"
if [ ${#esistenza_kdialog} -gt 0 ]
	then
	# versione minima => 1.0 ...
	required_kdialog_first_field=1
	#
	vers_kdialog="$(kdialog --version 2> /dev/null | gsed -n s\#'^.*kdialog[[:punct:]]*[[:blank:]]*\(.*\)$'#'\1'#Ip )"
	if [ $(echo -n "${vers_kdialog}" | tr -dc '[[:digit:]]' | wc -c ) -gt 0 ]
		then
		vers_kdialog_primo_campo=$(echo "${vers_kdialog}" | cut -d '.' -f 1 )
		#vers_kdialog_secondo_campo=$(echo "${vers_kdialog}" | cut -d '.' -f 2 )
		# 
		if [ ${vers_kdialog_primo_campo} -ge ${required_kdialog_first_field} ]
			then
			#
			kdialog="SI"
			#
		fi #if [ ${vers_kdialog_primo_campo} -ge 1 ]
		#
	fi #if [ $(echo -n "${vers_kdialog}" | tr -dc '[[:digit:]]' | wc -c) -gt 0 ]
	#
fi #if [ ${#esistenza_kdialog} -gt 0 ]
#
zenity="NO"
esistenza_zenity="$(type "zenity" 2> /dev/null )"
if [ ${#esistenza_zenity} -gt 0 ]
	then
	#
	# versione minima => 2.26 ...
	required_zenity_first_field=2
	required_zenity_second_field=26
	#
	vers_zenity="$(zenity --version 2>/dev/null )"
	if [ $(echo -n "${vers_zenity}" | tr -dc '[[:digit:]]' | wc -c) -gt 0 ]
		then
		vers_zenity_primo_campo=$(echo "${vers_zenity}" | cut -d '.' -f 1 )
		vers_zenity_secondo_campo=$(echo "${vers_zenity}" | cut -d '.' -f 2 )
		#
		if [ ${vers_zenity_primo_campo} -gt ${required_zenity_first_field} ]
			then
			#
			zenity="SI"
			#
		elif [ ${vers_zenity_primo_campo} -eq ${required_zenity_first_field} ]
			then
			#
			if [ ${vers_zenity_secondo_campo} -ge ${required_zenity_second_field} ]
				then
				#
				zenity="SI"
				#
			fi
			#
		fi
		#
	fi #if [ $(echo -n "${vers_zenity}" | tr -dc '[[:digit:]]' | wc -c) -gt 0 ]
	#
fi #if [ ${#esistenza_zenity} -gt 0 ]
#
Xdialog="NO"
esistenza_Xdialog="$(type "Xdialog" 2> /dev/null)"
if [ ${#esistenza_Xdialog} -gt 0 ]
	then
	Xdialog="SI"
fi
#
################
#
if [ "${kdialog}" = "NO" -a "${zenity}" = "NO" -a "${Xdialog}" = "NO" ]
	then
	mode="dialog"
	#
elif [ "${kdialog}" = "NO" -a "${zenity}" = "NO" -a "${Xdialog}" = "SI" ]
	then
	mode="Xdialog"
	#
elif [ "${kdialog}" = "NO" -a "${zenity}" = "SI" -a "${Xdialog}" = "NO" ]
	then
	mode="zenity"
	#
elif [ "${kdialog}" = "NO" -a "${zenity}" = "SI" -a "${Xdialog}" = "SI" ]
	then
	# Esistono sia zenity sia Xdialog...
	#
	## priorita' a zenity ? ...solo se c'e' Gnome... : $(ps aux | grep "gnome-panel" | grep -v grep )
	#if [ $(ps aux | grep "gnome-panel" | grep -v grep | wc -c ) -gt 0 ]
	#	then
	#	# Sta girando Gnome... 
	#	mode="zenity"
	#	#
	#else
	#	# Gnome NON sta' girando...
	#	mode="Xdialog"
	#	#
	#fi #if STA GIRANDO GNOME...
	#
	mode="zenity"
	#
elif [ "${kdialog}" = "SI" -a "${zenity}" = "NO" -a "${Xdialog}" = "NO" ]
	then
	mode="kdialog"
	#
elif [ "${kdialog}" = "SI" -a "${zenity}" = "NO" -a "${Xdialog}" = "SI" ]
	then
	# Esistono sia kdialog sia Xdialog...
	# priorita' a kdialog ? ...solo se c'e' KDE... : 
	kde="$(ps ax | grep "kde" | grep "bin" | grep -v grep )"
	kwin="$(ps aux | grep "\<kwin\>" | grep -v grep )"
	if [ ${#kde} -gt 0 -a ${#kwin} -gt 0 ]
		then
		# Sta girando KDE... 
		mode="kdialog"
		#
	else
		# KDE NON sta' girando...
		mode="Xdialog"
		#
	fi #if STA GIRANDO KDE...
	#
elif [ "${kdialog}" = "SI" -a "${zenity}" = "SI" ]
	then
	# Esistono sia kdialog sia zenity...
	# priorita' a kdialog ? ...solo se c'e' KDE... : 
	kde="$(ps ax | grep "kde" | grep "bin" | grep -v grep )"
	kwin="$(ps aux | grep "\<kwin\>" | grep -v grep )"
	if [ ${#kde} -gt 0 -a ${#kwin} -gt 0 ]
		then
		# Sta girando KDE... 
		mode="kdialog"
		#
	else
		# KDE NON sta' girando...
		mode="zenity"
		#
	fi #if STA GIRANDO KDE...
	#
fi #if [ "${kdialog}" = "NO" -a "${zenity}" = "NO" -a "${Xdialog}" = "NO" ]
#
################
#
if [ "${mode}" = "kdialog" ]
	then
	kdialog_presente_e_funzionante="$(kdialog 2>&1 )"
	if [ $(echo -n "${kdialog_presente_e_funzionante}" | grep ".*cannot connect to X server" | wc -c ) -eq 0 ]
		then
		mode="kdialog"
	elif [ $(echo -n "${kdialog_presente_e_funzionante}" | grep ".*cannot connect to X server" | wc -c ) -gt 0 ]
		then
		mode="dialog"
	fi
	#
fi
#
if [ "${mode}" = "zenity" ]
	then
	zenity_presente_e_funzionante="$(zenity 2>&1 )"
	if [ $(echo -n "${zenity_presente_e_funzionante}" | grep ".*cannot open display:" | wc -c ) -eq 0 ]
		then
		mode="zenity"
	elif [ $(echo -n "${zenity_presente_e_funzionante}" | grep ".*cannot open display:" | wc -c ) -gt 0 ]
		then
		mode="dialog"
	fi
	#
fi
#
if [ "${mode}" = "Xdialog" ]
	then
	Xdialog_presente_e_funzionante="$(Xdialog --version 2>&1 )"
	if [ $(echo -n "${Xdialog_presente_e_funzionante}" | grep "Do you run under X11 with GTK.*installed ?" | wc -c) -eq 0 ]
		then
		mode="Xdialog"
	elif [ $(echo -n "${Xdialog_presente_e_funzionante}" | grep "Do you run under X11 with GTK.*installed ?" | wc -c) -gt 0 ]
		then
		mode="dialog"
	fi
	#
fi
#
######### Final: => let's substitute "gtkdialog" to... #########
if [ "${gtkdialog}" = "SI" ]
	then
	# ...whatever dialog but "dialog" and "kdialog", moreover...
	if [ "${mode}" != "dialog" -a "${mode}" != "kdialog" ]
		then
		# ...only if DISPLAY var is set...
		if [ ${#DISPLAY} -gt 0 ]
			then
			# ;)
			mode="gtkdialog"
			#
		else
			# :/
			mode="dialog"
			#
		fi
		#
	fi
	#
fi
#
###############
#
#####################################
#
# This is only for test, it's preferable that mode is set only in automatic way...
if [ ${#supermode} -eq 0 ]
	then
	:
else
	case "${supermode}" in
		"auto" )
			:;;
		#
		"gtkdialog"|"kdialog"|"zenity"|"Xdialog"|"dialog" )
			mode="${supermode}" ;;
		#
		*)
			echo -e "\nERR: \"supermode\" is not correct." 1>&2 && sleep 2 && exit 1 ;;
		#
	esac
fi
#
#####################################
#
###############
#
# Variables...
: width
: height
if [ "${mode}" = "gtkdialog" ]
	then
	#
	dialogo="gtkdialog"
	#
elif [ "${mode}" = "kdialog" ]
	then
	x_root=$(xwininfo -root | gsed -n s\#'^.*-geometry[[:blank:]]\([[:digit:]]\+\)[[:alpha:]]\([[:digit:]]\+\).*$'#'\1'#p )
	y_root=$(xwininfo -root | gsed -n s\#'^.*-geometry[[:blank:]]\([[:digit:]]\+\)[[:alpha:]]\([[:digit:]]\+\).*$'#'\2'#p )
	if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
		then
		x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
		y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
	fi
	#
	dimensione_finestra="--geometry=${width}x${height}${x}${y}"
	dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
	dimensione_finestra_2=""
	no_tags=""
	no_buttons=""
	menubox="--menu"
	icona_Ok=""
	icona_Attenzione=""
	progress="--progressbar"
	#
	dialogo="kdialog ${dimensione_finestra}"
	#
elif [ "${mode}" = "zenity" ]
	then
	dimensione_finestra="--width=${width} --height=${height}"
	dimensione_finestra_1="--width=${width} --height=${height}"
	dimensione_finestra_2=""
	no_tags=""
	no_buttons=""
	menubox="--list"
	icona_Ok=""
	icona_Attenzione=""
	progress="--progress"
	#
	dialogo="zenity"
	#
elif [ "${mode}" = "Xdialog" ]
	then
	dimensione_finestra="${width}x${height}"
	dimensione_finestra_1="${width}x${height}"
	dimensione_finestra_2=""
	no_tags="--no-tags"
	no_buttons="--no-buttons"
	menubox="--menubox"
	icona_Ok="--icon /usr/share/easybashgui/Ok.xpm"
	icona_Attenzione="--icon /usr/share/easybashgui/Attenzione.xpm"
	progress="--progress"
	#
	dialogo="Xdialog"
	#
elif [ "${mode}" = "dialog" ]
	then
	ERR_MESSAGE="YES"
	#
	dimensione_finestra="38 80"
	dimensione_finestra_1=38
	dimensione_finestra_2=80
	no_tags=""
	no_buttons=""
	menubox="--menu"
	icona_Ok=""
	icona_Attenzione=""
	if [ $(dialog --help 2>&1 | grep -- "--separator" | wc -c) -gt 0 ]
		then
		separator="--separator"
		dialogo="dialog"
		#
		ERR_MESSAGE="NO"
		#
	elif [ $(dialog --help 2>&1 | grep -- "--separate-widget" | wc -c) -gt 0 ]
		then
		separator="--separate-widget"
		dialogo="dialog"
		#
		ERR_MESSAGE="NO"
		#
	else
		#
		whiptail="NO"
		esistenza_whiptail="$(type "whiptail" 2> /dev/null )"
		if [ ${#esistenza_whiptail} -gt 0 ]
			then
			required_whiptail_first_field=0
			required_whiptail_second_field=52
			required_whiptail_third_field=11
			#
			vers_whiptail="$(whiptail --version | cut -d ' ' -f 3 )"
			if [ $(echo -n "${vers_whiptail}" | tr -dc '[[:digit:]]' | wc -c ) -gt 0 ]
				then
				vers_whiptail_primo_campo=$(echo "${vers_whiptail}" | cut -d '.' -f 1 )
				vers_whiptail_secondo_campo=$(echo "${vers_whiptail}" | cut -d '.' -f 2 )
				vers_whiptail_terzo_campo=$(echo "${vers_whiptail}" | cut -d '.' -f 3 )
				# versione minima => 0.52.11 ...
				if [ ${vers_whiptail_primo_campo} -ge ${required_whiptail_first_field} -a ${vers_whiptail_secondo_campo} -ge ${required_whiptail_second_field} -a ${vers_whiptail_terzo_campo} -ge ${required_whiptail_third_field} ]
					then
					#
					whiptail="SI"
					#
					separator="--separate-output"
					dialogo="whiptail --fb"
					#
					ERR_MESSAGE="NO"
					#
				fi
				#
			fi # if [ $(echo -n "${vers_whiptail}" | tr -dc '[[:digit:]]' | wc -c ) -gt 0 ]
			#
		fi # if [ ${#esistenza_whiptail} -gt 0 ]
		#
	fi
	#
	if [ "${ERR_MESSAGE}" = "YES" ]
		then
		echo -e "\nMaybe your \"dialog\" is NOT an alias to \"cdialog\", but is the original one obsolete... \nPlease, try to install \"cdialog\" and alias \"dialog\" to it..."
		exit 1
	fi
	progress="--gauge"
	#
fi
#
##
#
###############################################
###############################################
######### ...  FUNCTIONS  ... #################
###############################################
###############################################
#
##
#
clean_temp()
	{
	local FUNCT_NAME="clean_temp"
	local IFS=$' \t\n'
	#
	if [ -f "${dir_tmp}/${file_tmp}" ] 2> /dev/null
		then
		rm -f "${dir_tmp}/${file_tmp}" 2> /dev/null
	fi
	#
	if [ -f "${dir_tmp}/${file_ignore}" ] 2> /dev/null
		then
		rm -f "${dir_tmp}/${file_ignore}" 2> /dev/null
	fi
	#
	}
#
##
#
# This is only used in Xdialog mode, for its *annoying* error messages sent in STDOUT...
clean()
	{
	local FUNCT_NAME="clean"
	local IFS=$' \t\n'
	#
	while read Xdialog_stdout
		do
		if [ $(echo -n "${Xdialog_stdout}" | grep "${string_to_clean}" | wc -c ) -gt 0 ]
			then
			echo "yes" 1> "${dir_tmp}/${file_ignore}"
			echo "You have gtk 1.x config problems... :(" 1>&2
		fi
		echo "${Xdialog_stdout}" | grep -v "${string_to_clean}"
	done
	}
#
##
#
arrotonda()
	{
	local FUNCT_NAME="arrotonda"
	local IFS=$' \t\n'
	#
	float="${1}"
	#
	float__integer_part=$(echo "${float}" | cut -d '.' -f 1 ) ; [ ${#float__integer_part} -eq 0 ] && float__integer_part=0
	float__decimal_part=$(echo "${float}" | cut -d '.' -f 2 )
	# =>
	[ ${float__decimal_part} -le 50 ] && \
	arrotondato=${float__integer_part} || \
	arrotondato=$(( ${float__integer_part} + 1 ))
	#
	echo "${arrotondato}"
	#
	}
#
##
#
if_arg_is_an_empty_variable_then_exit()
	{
	local FUNCT_NAME="if_arg_is_an_empty_variable_then_exit"
	local IFS=$' \t\n'
	#
	var_da_controllare="${1}"
	if [ $(echo -n "${!var_da_controllare}" | wc -c ) -eq 0 ]
		then
		#
		clean_temp
		exit
	fi
	}
#
##
#
exit_if_user_closes_window()
	{
	uscita=${?}
	local FUNCT_NAME="exit_if_user_closes_window"
	local IFS=$' \t\n'
	#
	if [ -f "${dir_tmp}/${file_ignore}" ]
		then
		if [ "$(0< "${dir_tmp}/${file_ignore}" )" = "yes" ]
			then
			return 0
		fi
	fi
	#
	if [ ${uscita} -ne 0 ]
		then
		#clean_temp
		if [ ${uscita} -eq 1 ]
			then
        		#
			#echo "Hai cliccato su \"Cancel\"..."
			#
			exit 1
			#
		elif [ ${uscita} -eq 255 ]
			then
	        	#
			#echo "Hai chiuso la finestra..."
			#
			exit 255
			#
		else
			if [ "${dialogo}" = "zenity" -a ${uscita} -eq 5 ]
				then
				# Non far niente: sembra un codice di uscita di zenity legato ai temi...
				:
				#
			else
				#
				#
				alert_message ":( ...Something went wrong..."
				echo -e "\n:( ...Something went wrong..." 1>&2
				#
				exit 1
				#
			fi
			#
		fi
		#
	fi
	}
#
##
#
# question()
if [ "${mode}" = "gtkdialog" ]
	then
	question()
		{
		local FUNCT_NAME="question"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		export QUESTION_DIALOG="
		<window title=\"$(basename "${0}"): please confirm\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-question\">
			<vbox>
				<frame>
					<pixmap xalign=\"0\">
						<input file stock=\"gtk-dialog-question\"></input>
					</pixmap>
					
					<text xalign=\"2\">
						<label>\"$(echo -e "\n\n${testo_gtkdialog}\n")\"</label>
					</text>
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=QUESTION_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	question()
		{
		local FUNCT_NAME="question"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_kdialog="\n${testo}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n..................................................................................................."
		( ${dialogo} --title "$(basename "${0}" ): please confirm" --yesno "$(echo -e "${testo_kdialog}" )" 2> /dev/null )
		exit_code="${?}"
		#
		#exit_if_user_closes_window #(l'ho commentato altrimenti lo cattura lui, il "Cancel" ... )
		#
		OUT_STDERR="${exit_code}"
		echo "${OUT_STDERR}" 1>&2
		#
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	question()
		{
		local FUNCT_NAME="question"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		( ${dialogo} --ok-label "Ok" --cancel-label "Cancel" --title "$(basename "${0}" ): please confirm" --question \
			--text "$(echo -e "${testo_zenity}" )" ${dimensione_finestra_1} ${dimensione_finestra_2} 2> /dev/null )
		exit_code="${?}"
		#
		#exit_if_user_closes_window #(l'ho commentato altrimenti lo cattura lui, il "Cancel" ... )
		#
		OUT_STDERR="${exit_code}"
		echo "${OUT_STDERR}" 1>&2
		#
		return "${exit_code}"
		#
		}
else
	question()
		{
		local FUNCT_NAME="question"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ "${mode}" = "Xdialog" ]
				then
				local dimensione_finestra="${width}x${height}"
				local dimensione_finestra_1="${width}x${height}"
			fi
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			( ${dialogo} --title "$(basename "${0}" ): please confirm" ${icona_Attenzione} --yesno \
			"$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" 2> /dev/null )
			exit_code="${?}"
		else
			( ${dialogo} --stdout --ok-label "Ok" --cancel-label "Cancel" --title "$(basename "${0}" ): please confirm" ${icona_Attenzione} --yesno \
			"$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" 2> /dev/null )
			exit_code="${?}"
		fi
		#
		#exit_if_user_closes_window #(l'ho commentato altrimenti lo cattura lui, il "Cancel" ... )
		#
		OUT_STDERR="${exit_code}"
		echo "${OUT_STDERR}" 1>&2
		#
		return "${exit_code}"
		#
		}
fi
# question()
#
##
#
# message()
if [ "${mode}" = "gtkdialog" ]
	then
	message()
		{
		local FUNCT_NAME="message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		export MESSAGE_DIALOG="
		<window title=\"$(basename "${0}"): message\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-info\">
			<vbox>
				<frame>
					<text xalign=\"2\">
						<label>\"$(echo -e "\n\n${testo_gtkdialog}\n")\"</label>
					</text>
				</frame>
				<hbox>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=MESSAGE_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	message()
		{
		local FUNCT_NAME="message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		[ "${reset_geometry}" = "NO" ] && testo_kdialog="\n${testo}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n..................................................................................................." || testo_kdialog="${testo}"
		( ${dialogo} --title "$(basename "${0}" ): message" --msgbox "$(echo -e "${testo_kdialog}" )" )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	message()
		{
		local FUNCT_NAME="message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		( ${dialogo} --title "$(basename "${0}" ): message" --info --text "$(echo -e "${testo_zenity}" )" ${dimensione_finestra_1} ${dimensione_finestra_2} )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	message()
		{
		local FUNCT_NAME="message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		( ${dialogo} --title "$(basename "${0}" ): message" --msgbox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" 1> >( clean ) )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	message()
		{
		local FUNCT_NAME="message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		( ${dialogo} --title "$(basename "${0}" ): message" --msgbox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" )
		exit_if_user_closes_window
		#
		}
fi
# message()
#
##
#
# alert_message()
if [ "${mode}" = "gtkdialog" ]
	then
	alert_message()
		{
		local FUNCT_NAME="alert_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		export ALERTMESSAGE_DIALOG="
		<window title=\"$(basename "${0}"): alert message\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-warning\">
			<vbox>
				<frame>
					<pixmap xalign=\"0\">
						<input file stock=\"gtk-dialog-warning\"></input>
					</pixmap>
					
					<text xalign=\"2\">
						<label>\"$(echo -e "\n\n${testo_gtkdialog}\n")\"</label>
					</text>
				</frame>
				<hbox>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=ALERTMESSAGE_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	alert_message()
		{
		local FUNCT_NAME="alert_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if  [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		[ "${reset_geometry}" = "NO" ] && testo_kdialog="\n${testo}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n..................................................................................................." || testo_kdialog="${testo}"
		( ${dialogo} --title "$(basename "${0}" ): alert message" --error "$(echo -e "${testo_kdialog}" )" )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	alert_message()
		{
		local FUNCT_NAME="alert_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		( ${dialogo} --title "$(basename "${0}" ): alert message" --warning --text "$(echo -e "${testo_zenity}" )" ${dimensione_finestra_1} ${dimensione_finestra_2} )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	alert_message()
		{
		local FUNCT_NAME="alert_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		( ${dialogo} --title "$(basename "${0}" ): alert message" ${icona_Attenzione} --msgbox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" 1> >( clean ) )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	alert_message()
		{
		local FUNCT_NAME="alert_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		( ${dialogo} --title "$(basename "${0}" ): alert message" ${icona_Attenzione} --msgbox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" )
		exit_if_user_closes_window
		#
		}
fi
# alert_message()
#
##
#
# ok_message()
if [ "${mode}" = "gtkdialog" ]
	then
	ok_message()
		{
		local FUNCT_NAME="ok_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		export OKMESSAGE_DIALOG="
		<window title=\"$(basename "${0}"): ok message\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-info\">
			<vbox>
				<frame>
					<pixmap xalign=\"0\">
						<input file stock=\"gtk-dialog-info\"></input>
					</pixmap>
					
					<text xalign=\"2\">
						<label>\"$(echo -e "\n\n${testo_gtkdialog}\n")\"</label>
					</text>
				</frame>
				<hbox>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=OKMESSAGE_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	ok_message()
		{
		local FUNCT_NAME="ok_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		[ "${reset_geometry}" = "NO" ] && testo_kdialog="\n${testo}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n..................................................................................................." || testo_kdialog="${testo}"
		( ${dialogo} --title "$(basename "${0}" ): ok message" --msgbox "$(echo -e "${testo_kdialog}" )" )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	ok_message()
		{
		local FUNCT_NAME="ok_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		( ${dialogo} --title "$(basename "${0}" ): ok message" --info --text "$(echo -e "${testo_zenity}" )" ${dimensione_finestra_1} ${dimensione_finestra_2} )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	ok_message()
		{
		local FUNCT_NAME="ok_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		( ${dialogo} --title "$(basename "${0}" ): ok message" ${icona_Ok} --msgbox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" 1> >( clean ) )
		exit_if_user_closes_window
		#
		}
	#
elif [ "${mode}" = "dialog" ]
	then
	ok_message()
		{
		local FUNCT_NAME="ok_message"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		( ${dialogo} --title "$(basename "${0}" ): ok message" ${icona_Ok} --msgbox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" )
		exit_if_user_closes_window
		#
		}
fi
# ok_message()
#
##
#
# text()
if [ "${mode}" = "gtkdialog" ]
	then
	text()
		{
		local FUNCT_NAME="text"
		local IFS=$' \t\n'
		export dummy_file="${dir_tmp}/${file_ignore}"
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		#read -d "" textStdIn ; export textStdIn ; echo "${textStdIn}" 1> "${dummy_file}"
		cat - 1> "${dummy_file}"
		#
		export TEXT_DIALOG="
		<window title=\"$(basename "${0}"): text\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-info\">
			<vbox>
				<frame>
					<edit>
						<variable>TEXT</variable>
						<input file>\"${dummy_file}\"</input>
					</edit>
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		# 
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=TEXT_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		if [ "${exit_code}" = "0" ]
			then
			echo "${TEXT}" 1> "${dir_tmp}/${file_tmp}" && echo "${TEXT}" 1>&2
			#
		fi
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	text()
		{
		local FUNCT_NAME="text"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		file="${dir_tmp}/${file_tmp}"
		( ${dialogo} --title "$(basename "${0}" ): text" --textinputbox " " "$(cat - )" \
			1> "${file}" 2> /dev/null )
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${file}" )"
		echo "${OUT_STDERR}" 1>&2
		}
elif [ "${mode}" = "zenity" ]
	then
	text()
		{
		local FUNCT_NAME="text"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		file="${dir_tmp}/${file_tmp}"
		( ${dialogo} --title "$(basename "${0}" ): text" --text-info --editable --filename <(cat - ) ${dimensione_finestra_1} ${dimensione_finestra_2} \
			1> "${file}" 2> /dev/null )
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${file}" )"
		echo "${OUT_STDERR}" 1>&2
		}
elif [ "${mode}" = "Xdialog" ]
	then
	text()
		{
		local FUNCT_NAME="text"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		file="${dir_tmp}/${file_tmp}"
		#
		( ${dialogo} --stdout --title "$(basename "${0}" ): text" ${icona_Ok} --editbox "-" "${dimensione_finestra_1}" "${dimensione_finestra_2}" \
		1> "${file}" 2> /dev/null )
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${file}" )"
		echo "${OUT_STDERR}" 1>&2
		}
elif [ "${mode}" = "dialog" ]
	then
	text()
		{
		local FUNCT_NAME="text"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		file="${dir_tmp}/${file_tmp}"
		dimensione_finestra_1=0
		dimensione_finestra_2=0
		cat - 1> "${dir_tmp}/${file_tmp}"
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			( ${dialogo} --title "$(basename "${0}" ): text" ${icona_Ok} --textbox "${file}" --scrolltext "${dimensione_finestra_1}" "${dimensione_finestra_2}" 2> /dev/null )
		else
			( ${dialogo} --title "$(basename "${0}" ): text" ${icona_Ok} --textbox "${file}" "${dimensione_finestra_1}" "${dimensione_finestra_2}" 2> /dev/null )
		fi
		# 1> "${file}"
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${file}" )"
		echo "${OUT_STDERR}" 1>&2
		}
fi
# text()
#
##
#
# wait_seconds()
if [ "${mode}" = "gtkdialog" ]
	then
	wait_seconds()
		{
		local FUNCT_NAME="wait_seconds"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		secondi="${1}"
		export WAITSECONDS_DIALOG="
		<window title=\"$(basename "${0}"): please wait\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-warning\">
			<vbox>
				<frame>
					<pixmap xalign=\"0\">
						<input file stock=\"gtk-dialog-warning\"></input>
					</pixmap>
					
					<text>
						<label>Please wait...</label>
					</text>
					<progressbar visible=\"false\">
						<input>echo 0; sleep ${secondi} ; echo 100</input>
						<action type=\"exit\">Ready</action>
					</progressbar>
				</frame>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=WAITSECONDS_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		#[ "${EXIT}" = "OK" ] && exit_code="0"
		#[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		#return "${exit_code}"
		return "0"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	wait_seconds()
		{
		local FUNCT_NAME="wait_seconds"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		num_secondi=${1}
		#
		( kdialog --title "$(basename "${0}" ): please wait" --passivepopup "Please wait..." \
			${num_secondi} )
		#exit_if_user_closes_window
		sleep $(( ${num_secondi} - 1 ))
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	wait_seconds()
		{
		local FUNCT_NAME="wait_seconds"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		num_secondi=${1}
		#
		yes | ( ${dialogo} --title "$(basename "${0}" ): please wait" --progress --pulsate --auto-kill --text "Please wait..." ${dimensione_finestra} \
			--timeout ${num_secondi} )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	wait_seconds()
		{
		local FUNCT_NAME="wait_seconds"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		num_secondi=${1}
		#
		num_milli_secondi=$(( ${num_secondi} * 1000 ))
		#
		( ${dialogo} ${no_buttons} --title "$(basename "${0}" ): please wait" ${icona_Attenzione} --infobox "Please wait..." ${dimensione_finestra} \
			${num_milli_secondi} 1> >( clean ) )
		exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	wait_seconds()
		{
		local FUNCT_NAME="wait_seconds"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		num_secondi=${1}
		#
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			clear
			echo -e "\n\n################################################\n################################################\n\n\tPlease wait...\n\n################################################\n################################################\n"
		fi
		( ${dialogo} ${no_buttons} --title "$(basename "${0}" ): please wait" ${icona_Attenzione} --infobox "Please wait..." "${dimensione_finestra_1}" "${dimensione_finestra_2}" )
		exit_if_user_closes_window
		sleep ${num_secondi}
		#
		}
fi
# wait_seconds()
#
##
#
# wait_for()
if [ "${mode}" = "gtkdialog" ]
	then
	wait_for()
		{
		local FUNCT_NAME="wait_for"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		#
		export WAITFOR_DIALOG="
		<window title=\"$(basename "${0}"): please wait\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-warning\">
			<vbox>
				<frame>
					<pixmap xalign=\"0\">
						<input file stock=\"gtk-dialog-warning\"></input>
					</pixmap>
					
					<text xalign=\"2\">
						<label>\"$(echo -e "${testo_gtkdialog}")\"</label>
					</text>
				</frame>
			</vbox>
		</window>
		"
		#
		yes | \
			${dialogo} --program=WAITFOR_DIALOG 2> /dev/null &
		export wait_for__PID="${!}"
		#
		OUT_STDERR="${wait_for__PID}"
		echo "${OUT_STDERR}" 1>&2
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		#
		##
		#
		#[ "${EXIT}" = "OK" ] && exit_code="0"
		#[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		#return "${exit_code}"
		return "0"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	wait_for()
		{
		local FUNCT_NAME="wait_for"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		num_secondi=3
		#testo_kdialog="\n${testo}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n..................................................................................................."
		testo_kdialog="${testo}"
		# ${dialogo} NON si puo' usare qui...
		yes | \
			{ 
			while read dummy_var
				do
				kdialog --title "$(basename "${0}" ): please wait" --passivepopup "$(echo -e "${testo_kdialog}" )" "${num_secondi}"
				sleep $(( ${num_secondi} - 1 ))
			done
			sleep 1
			} &>/dev/null &
		#
		export wait_for__PID="${!}"
		#
		OUT_STDERR="${wait_for__PID}"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${dialogo}" = "zenity" ]
	then
	wait_for()
		{
		local FUNCT_NAME="wait_for"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		yes | \
			${dialogo} --title "$(basename "${0}" ): please wait" --progress --pulsate --auto-kill --text "$(echo -e "${testo_zenity}" )" ${dimensione_finestra} &>/dev/null &
		#
		export wait_for__PID="${!}"
		#
		OUT_STDERR="${wait_for__PID}"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	wait_for()
		{
		local FUNCT_NAME="wait_for"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		yes | \
			${dialogo} ${no_buttons} --title "$(basename "${0}" ): please wait" ${icona_Attenzione} --infobox "$(echo -e "${testo}" )" ${dimensione_finestra} 0 &>/dev/null &
		#
		export wait_for__PID="${!}"
		#
		OUT_STDERR="${wait_for__PID}"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	wait_for()
		{
		local FUNCT_NAME="wait_for"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${@}"
		#
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			clear
			echo -e "\n\n################################################\n################################################\n\n\t$(echo -e "${testo}" )\n\n################################################\n################################################\n"
		fi
		num_secondi=1972
		${dialogo} ${no_buttons} --title "$(basename "${0}" ): please wait" ${icona_Attenzione} --infobox "$(echo -e "${testo}" )" "${dimensione_finestra_1}" "${dimensione_finestra_2}" ; exit_if_user_closes_window
		#
		sleep "${num_secondi}" &
		#
		export wait_for__PID="${!}"
		#
		OUT_STDERR="${wait_for__PID}"
		echo "${OUT_STDERR}" 1>&2
		#
		}
fi
# wait_for()
#
##
#
terminate_wait_for()
	{
	local FUNCT_NAME="terminate_wait_for"
	local IFS=$' \t\n'
	#
	[ ${#} -gt 0 ] && wait_for__PID="${1}"
	[ ${#wait_for__PID} -gt 0 ] && kill "${wait_for__PID}"
	}
#
##
#
# fselect()
if [ "${mode}" = "gtkdialog" ]
	then
	fselect()
		{
		local FUNCT_NAME="fselect"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		init_dir="${@}" ; [ ${#init_dir} -eq 0 ] && init_dir="${HOME}"
		export FSELECT_DIALOG="
		<window title=\"$(basename "${0}"): file select\" window_position=\"1\" icon-name=\"gtk-dialog-question\">
			<vbox>
				<frame>
					<chooser>
						<default>\"${init_dir}\"</default>
						<height>\"${height}\"</height><width>\"${width}\"</width>
						<variable>FILESELECTED</variable>
					</chooser>
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=FSELECT_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0" && echo "${FILESELECTED}" 1> "${dir_tmp}/${file_tmp}"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	fselect()
		{
		local FUNCT_NAME="fselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		fselect="--getopenfilename"
		:
		( eval ${dialogo} --title \"$(basename "${0}" ): file select\" ${fselect} \"${dir}\" 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	fselect()
		{
		local FUNCT_NAME="fselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		fselect="--file-selection"
		dim_finestra="${dimensione_finestra}"
		( eval ${dialogo} --title \"$(basename "${0}" ): file select\" ${fselect} --filename \"${dir}\" ${dim_finestra} 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	fselect()
		{
		local FUNCT_NAME="fselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		fselect="--fselect"
		dim_finestra="${dimensione_finestra}"
		( eval ${dialogo} --stdout --title \"$(basename "${0}" ): file select\" ${fselect} \"${dir}\" ${dim_finestra} 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	fselect()
		{
		local FUNCT_NAME="fselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		dim=13
		dim_finestra="\"${dim}\" \"${dimensione_finestra_2}\""
		#
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			#
			local IFS=$'\n'
				args=( $(for element in $(find "${dir}" -maxdepth 1 -type f | grep -v '~' )
						do
						echo "${element}"
					done) )
			local IFS=$' \t\n'
			: args[@]
			#
			#
			local IFS=$'\n'
				dimensione_menu=$(if [ ${#args[@]} -le 17 ]; then echo ${#args[@]}; else echo 17; fi )
				parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
						do
						echo -ne "\"${args[${index}]}\" - "
					done )"
			local IFS=$' \t\n'
			#
			##
			#
			fselect="--menu"
			( eval ${dialogo} --title \"$(basename "${0}" ): file select\" ${fselect} \"file select\" ${dim_finestra} ${dimensione_menu} ${parametri} 2> "${dir_tmp}/${file_tmp}" )
			exit_if_user_closes_window
			#
		else
			#
			fselect="--fselect"
			( eval ${dialogo} --stdout --title \"$(basename "${0}" ): file select\" ${fselect} \"${dir}\" ${dim_finestra} 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
			exit_if_user_closes_window
			#
		fi
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
fi
# fselect()
#
##
#
# dselect()
if [ "${mode}" = "gtkdialog" ]
	then
	dselect()
		{
		local FUNCT_NAME="dselect"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		init_dir="${@}" ; [ ${#init_dir} -eq 0 ] && init_dir="${HOME}"
		export DSELECT_DIALOG="
		<window title=\"$(basename "${0}"): dir. select\" window_position=\"1\" icon-name=\"gtk-dialog-question\">
			<vbox>
				<frame>
					<chooser>
						<default>\"${init_dir}\"</default>
						<height>\"${height}\"</height><width>\"${width}\"</width>
						<variable>DIRSELECTED</variable>
					</chooser>
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=DSELECT_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0" && echo "${DIRSELECTED}" 1> "${dir_tmp}/${file_tmp}"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	dselect()
		{
		local FUNCT_NAME="dselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		dselect="--getexistingdirectory"
		:
		( eval ${dialogo} --title \"$(basename "${0}" ): dir. select\" ${dselect} \"${dir}\" 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
		#exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${dialogo}" = "zenity" ]
	then
	dselect()
		{
		local FUNCT_NAME="dselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		dselect="--file-selection --directory"
		dim_finestra="${dimensione_finestra}"
		( eval ${dialogo} --title \"$(basename "${0}" ): dir. select\" ${dselect} --filename \"${dir}\" ${dim_finestra} 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
		#exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	dselect()
		{
		local FUNCT_NAME="dselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		dselect="--dselect"
		dim_finestra="${dimensione_finestra}"
		( eval ${dialogo} --stdout --title \"$(basename "${0}" ): dir. select\" ${dselect} \"${dir}\" ${dim_finestra} 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	dselect()
		{
		local FUNCT_NAME="dselect"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		if [ ${#} -gt 0 ]
			then
			dir="${1}"
		else
			dir="${HOME}/"
		fi
		#
		dim=13
		dim_finestra="\"${dim}\" \"${dimensione_finestra_2}\""
		#
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			#
			local IFS=$'\n'
				args=( $(for element in $(find "${dir}" -maxdepth 1 -type d | grep -v '~' )
						do
						echo "${element}"
					done) )
			local IFS=$' \t\n'
			: args[@]
			#
			#
			local IFS=$'\n'
				dimensione_menu=$(if [ ${#args[@]} -le 17 ]; then echo ${#args[@]}; else echo 17; fi )
				parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
						do
						echo -ne "\"${args[${index}]}\" - "
					done )"
			local IFS=$' \t\n'
			#
			##
			#
			dselect="--menu"
			( eval ${dialogo} --title \"$(basename "${0}" ): dir. select\" ${dselect} \"dir. select\" ${dim_finestra} ${dimensione_menu} ${parametri} 2> "${dir_tmp}/${file_tmp}" )
			#
		else
			#
			dselect="--fselect"
			( eval ${dialogo} --stdout --title \"$(basename "${0}" ): dir. select\" ${dselect} \"${dir}\" ${dim_finestra} 2> /dev/null ) 1> "${dir_tmp}/${file_tmp}"
			exit_if_user_closes_window
			#
		fi
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
fi
# deselect()
#
##
#
# menu()
if [ "${mode}" = "gtkdialog" ]
	then
	menu()
		{
		local FUNCT_NAME="menu"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}" | tr '"' "'"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		#
		local IFS=$'\n'
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					echo -e "<item>\"${args[${index}]}\"</item>"
				done )"
		local IFS=$' \t\n'
		#
		export MENU_DIALOG="
		<window title=\"$(basename "${0}"): Select option...\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-question\">
			<vbox>
				<frame>
					<list>
						<variable>CHOICE</variable>
						${parametri}
					</list>
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=MENU_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0" && \
			echo "${CHOICE}" 1> "${dir_tmp}/${file_tmp}" && echo "${CHOICE}" 1>&2
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	menu()
		{
		local FUNCT_NAME="menu"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		#
		local IFS=$'\n'
			stdout=""
			text=""
			column=""
			dimensione_menu=""
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					echo -ne "\"${args[${index}]}\"\t\"${args[${index}]}\"\t"
				done )"
		local IFS=$' \t\n'
		#
		#
		local IFS=$'\t\n'
			scelta="$(eval $(local IFS=$'\t' ; echo -e "${dialogo}\t${stdout}\t${no_tags}\t--title\t\"$(basename "${0}" ): menu\"\t${menubox}\t${text}\t\"Select option...\"\t${dimensione_finestra}\t${dimensione_menu}\t${column}\t${parametri}\t2>\t/dev/null" ; local IFS=$'\t\n') )"
			if [ "${dialogo}" = "dialog" ]
				then
				if [ $(echo -n "${scelta}" | wc -c) -gt 0 ]
					then
					indice_capisci_a_me=$(( ${scelta} - 1 ))
					scelta=${args[${indice_capisci_a_me}]}
				fi
			fi
			#
			####
			#######
			echo "${scelta}" | grep -v "${string_to_clean}" 1> "${dir_tmp}/${file_tmp}"
			#######
			####
			#
		local IFS=$' \t\n'
		#
		if [ $(echo -n "${scelta}" | grep -v "${string_to_clean}" | wc -c) -eq 0 ]
			then
			#Vuol dire che _non ha scelto nulla_ ( cioe' HA cliccato su "Cancel" ) ...
			return 1
		else
			#Vuol dire che almeno QUALCOSA _l'ha scelta_ ( cioe' NON ha cliccato su "Cancel" ) ...
			if [ "$(echo "${scelta}" | grep -v "${string_to_clean}" )" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					return 1
				fi
			fi
		fi
		#
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	menu()
		{
		local FUNCT_NAME="menu"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		#
		local IFS=$'\n'
			stdout=""
			text="--text"
			column="--column\t\" \""
			dimensione_menu=""
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					arg_pre="${args[${index}]}"
					first_char="${arg_pre:0:1}"
					#
					if [ "${first_char}" = "-" ]
						then
						arg="${arg_pre:1}"
					else
						arg="${arg_pre}"
					fi
					#
					echo -ne "\"${arg}\"\t"
				done )"
		local IFS=$' \t\n'
		#
		#
		local IFS=$'\t\n'
			scelta="$(eval $(local IFS=$'\t' ; echo -e "${dialogo}\t${stdout}\t${no_tags}\t--title\t\"$(basename "${0}" ): menu\"\t${menubox}\t${text}\t\"Select option...\"\t${dimensione_finestra}\t${dimensione_menu}\t${column}\t${parametri}\t2>\t/dev/null" ; local IFS=$'\t\n') )"
			if [ "${dialogo}" = "dialog" ]
				then
				if [ $(echo -n "${scelta}" | wc -c) -gt 0 ]
					then
					indice_capisci_a_me=$(( ${scelta} - 1 ))
					scelta=${args[${indice_capisci_a_me}]}
				fi
			fi
			#
			####
			#######
			echo "${scelta}" | grep -v "${string_to_clean}" 1> "${dir_tmp}/${file_tmp}"
			#######
			####
			#
		local IFS=$' \t\n'
		#
		if [ $(echo -n "${scelta}" | grep -v "${string_to_clean}" | wc -c) -eq 0 ]
			then
			#Vuol dire che _non ha scelto nulla_ ( cioe' HA cliccato su "Cancel" ) ...
			return 1
		else
			#Vuol dire che almeno QUALCOSA _l'ha scelta_ ( cioe' NON ha cliccato su "Cancel" ) ...
			if [ "$(echo "${scelta}" | grep -v "${string_to_clean}" )" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					return 1
				fi
			fi
		fi
		#
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	menu()
		{
		local FUNCT_NAME="menu"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		#
		local IFS=$'\n'
			stdout="--stdout"
			text=""
			column=""
			dimensione_menu=0
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					echo -ne "\"${args[${index}]}\"\t\"${args[${index}]}\"\t"
				done )"
		local IFS=$' \t\n'
		#
		#
		local IFS=$'\t\n'
			scelta="$(eval $(local IFS=$'\t' ; echo -e "${dialogo}\t${stdout}\t${no_tags}\t--title\t\"$(basename "${0}" ): menu\"\t${menubox}\t${text}\t\"Select option...\"\t${dimensione_finestra}\t${dimensione_menu}\t${column}\t${parametri}\t2>\t/dev/null" ; local IFS=$'\t\n') )"
			if [ "${dialogo}" = "dialog" ]
				then
				if [ $(echo -n "${scelta}" | wc -c) -gt 0 ]
					then
					indice_capisci_a_me=$(( ${scelta} - 1 ))
					scelta=${args[${indice_capisci_a_me}]}
				fi
			fi
			#
			####
			#######
			echo "${scelta}" | grep -v "${string_to_clean}" 1> "${dir_tmp}/${file_tmp}"
			#######
			####
			#
		local IFS=$' \t\n'
		#
		if [ $(echo -n "${scelta}" | grep -v "${string_to_clean}" | wc -c) -eq 0 ]
			then
			#Vuol dire che _non ha scelto nulla_ ( cioe' HA cliccato su "Cancel" ) ...
			return 1
		else
			#Vuol dire che almeno QUALCOSA _l'ha scelta_ ( cioe' NON ha cliccato su "Cancel" ) ...
			if [ "$(echo "${scelta}" | grep -v "${string_to_clean}" )" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					return 1
				fi
			fi
		fi
		#
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	menu()
		{
		local FUNCT_NAME="menu"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		#
		local IFS=$'\n'
			stdout="--stdout"
			text=""
			column=""
			dimensione_menu=$(if [ ${#args[@]} -le 17 ]; then echo ${#args[@]}; else echo 17; fi )
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					echo -ne "$(( ${index} + 1 ))\t\"${args[${index}]}\"\t"
				done )"
		local IFS=$' \t\n'
		#
		#
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			dim=13
			dim_finestra="\"${dim}\" \"${dimensione_finestra_2}\""
			#
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					echo -en "\"${args[${index}]}\" - "
				done )"
			#echo "eval ${dialogo} --title \"$(basename "${0}" ): menu\" --menu \"Select option...\" ${dim_finestra} ${dimensione_menu} ${parametri}"
			( eval ${dialogo} --title \"$(basename "${0}" ): menu\" --menu \"Select option...\" ${dim_finestra} ${dimensione_menu} ${parametri} 2> "${dir_tmp}/${file_tmp}" )
			exit_if_user_closes_window
			#
			scelta="$(0< "${dir_tmp}/${file_tmp}" )"
			#
		else
			local IFS=$'\t\n'
				scelta="$(eval $(local IFS=$'\t' ; echo -e "${dialogo}\t${stdout}\t${no_tags}\t--title\t\"$(basename "${0}" ): menu\"\t${menubox}\t${text}\t\"Select option...\"\t${dimensione_finestra}\t${dimensione_menu}\t${column}\t${parametri}\t2>\t/dev/null" ; local IFS=$'\t\n') )"
				if [ "${dialogo}" = "dialog" ]
					then
					if [ $(echo -n "${scelta}" | wc -c) -gt 0 ]
						then
						indice_capisci_a_me=$(( ${scelta} - 1 ))
						scelta=${args[${indice_capisci_a_me}]}
					fi
				fi
				#
				####
				#######
				echo "${scelta}" | grep -v "${string_to_clean}" 1> "${dir_tmp}/${file_tmp}"
				#######
				####
				#
			local IFS=$' \t\n'
		fi
		#
		if [ $(echo -n "${scelta}" | grep -v "${string_to_clean}" | wc -c) -eq 0 ]
			then
			#Vuol dire che _non ha scelto nulla_ ( cioe' HA cliccato su "Cancel" ) ...
			return 1
		else
			#Vuol dire che almeno QUALCOSA _l'ha scelta_ ( cioe' NON ha cliccato su "Cancel" ) ...
			if [ "$(echo "${scelta}" | grep -v "${string_to_clean}" )" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					return 1
				fi
			fi
		fi
		#
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
fi
# menu()
#
##
#
# list()
if [ "${mode}" = "gtkdialog" ]
	then
	list()
		{
		local FUNCT_NAME="list"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		: 1> "${dir_tmp}/${file_tmp}"
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}" | tr '"' "'"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		checkboxes="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					#
					arg_prog="${args[${index}]}"
					first_char="${arg_prog:0:1}"
					#
					if [ "${first_char}" = "+" ]
						then
						arg="${arg_prog:1}"
						#
						echo -e "<checkbox active=\"true\">"
						echo -e "<label>\"${arg}\"</label>"
						echo -e "<variable>CHECKBOX${index}</variable>"
						#
					else
						#
						if [ "${first_char}" = "-" ]
							then
							arg="${arg_prog:1}"
						else
							arg="${arg_prog}"
						fi
						#
						echo -e "<checkbox active=\"false\">"
						echo -e "<label>\"${arg}\"</label>"
						echo -e "<variable>CHECKBOX${index}</variable>"
						#
					fi #if [ "${first_char}" = "+" ]
					#
					echo "</checkbox>"
					#
				done )"
		: checkboxes
		#
		export LIST_DIALOG="
		<window title=\"$(basename "${0}"): list\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-question\">
			<vbox>
				<frame>
					${checkboxes}
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=LIST_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#
		if [ ${exit_code} -eq 0 ]
			then
			#
			: ${args[@]}
			#
			for (( index=0 ; index < ${#args[@]} ; index++ ))
				do
				checkbox="CHECKBOX${index}"
				true_or_false="${!checkbox}"
				#
				if [ "${true_or_false}" = "true" ]
					then
					arg_prog="${args[${index}]}"
					first_char="${arg_prog:0:1}"
					#
					if [ "${first_char}" = "+" ]
						then
						arg="${arg_prog:1}"
						#
					else
						#
						if [ "${first_char}" = "-" ]
							then
							arg="${arg_prog:1}"
						else
							arg="${arg_prog}"
						fi
						#
					fi #if [ "${first_char}" = "+" ]
					echo "${arg}" 1>> "${dir_tmp}/${file_tmp}"
					echo "${arg}" 1>&2
				fi
				#
			done
		fi
		#
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	list()
		{
		local FUNCT_NAME="list"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					#
					arg_prog="${args[${index}]}"
					first_char="${arg_prog:0:1}"
					#
					if [ "${first_char}" = "+" ]
						then
						arg="${arg_prog:1}"
						#
						echo -ne "\"${arg}\" \"${arg}\" \"on\" "
						#
					else
						#
						if [ "${first_char}" = "-" ]
							then
							arg="${arg_prog:1}"
						else
							arg="${arg_prog}"
						fi
						#
						echo -ne "\"${arg}\" \"${arg}\" \"off\" "
						#
					fi #if [ "${first_char}" = "+" ]
					#
				done )"
		: parametri
		#
		#
		#dimensione_menu
		#
		scelte="$(eval ${dialogo} --title \"$(basename "${0}" ): list\" --separate-output --checklist \"Select multiple options...\" ${parametri} 2> /dev/null )"
		exit_code="${?}"
		echo -e "${scelte}" 1> "${dir_tmp}/${file_tmp}"
		#
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		[ ${#exit_code} -gt 0 ] && return "${exit_code}"
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	list()
		{
		local FUNCT_NAME="list"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					#
					arg_prog="${args[${index}]}"
					first_char="${arg_prog:0:1}"
					#
					if [ "${first_char}" = "+" ]
						then
						arg="${arg_prog:1}"
						#
						echo -ne "\"TRUE\" \"${arg}\" "
						#
					else
						#
						if [ "${first_char}" = "-" ]
							then
							arg="${arg_prog:1}"
						else
							arg="${arg_prog}"
						fi
						#
						echo -ne "\"FALSE\" \"${arg}\" "
						#
					fi #if [ "${first_char}" = "+" ]
					#
				done )"
		: parametri
		#
		#
		#dimensione_menu
		#
		scelte="$(eval ${dialogo} --title \"$(basename "${0}" ): list\" --separator \"\\n\" --list --checklist --column \" \" --column \" \" --text \"Select multiple options...\" ${dimensione_finestra_1} ${dimensione_finestra_2} ${parametri} 2> /dev/null )"
		exit_code="${?}"
		echo -e "${scelte}" 1> "${dir_tmp}/${file_tmp}"
		#
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		[ ${#exit_code} -gt 0 ] && return "${exit_code}"
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	list()
		{
		local FUNCT_NAME="list"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					#
					arg_prog="${args[${index}]}"
					first_char="${arg_prog:0:1}"
					#
					if [ "${first_char}" = "+" ]
						then
						arg="${arg_prog:1}"
						#
						echo -ne "\"${arg}\" \"${arg}\" \"on\" "
						#
					else
						#
						if [ "${first_char}" = "-" ]
							then
							arg="${arg_prog:1}"
						else
							arg="${arg_prog}"
						fi
						#
						echo -ne "\"${arg}\" \"${arg}\" \"off\" "
						#
					fi #if [ "${first_char}" = "+" ]
					#
				done )"
		: parametri
		#
		#
		dimensione_menu=0
		#
		scelte="$(eval ${dialogo} --title \"$(basename "${0}" ): list\" --stdout --separator \"\\n\" ${no_tags} ${icona_Ok} --checklist \"Select multiple options...\" ${dimensione_finestra_1} ${dimensione_finestra_2} ${dimensione_menu} ${parametri} 2> /dev/null )"
		exit_code="${?}"
		echo -e "${scelte}" 1> "${dir_tmp}/${file_tmp}"
		#
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		[ ${#exit_code} -gt 0 ] && return "${exit_code}"
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	list()
		{
		local FUNCT_NAME="list"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		#
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
		local IFS=$' \t\n'
		: args[@]
		#
		parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					#
					arg_prog="${args[${index}]}"
					first_char="${arg_prog:0:1}"
					#
					if [ "${first_char}" = "+" ]
						then
						arg="${arg_prog:1}"
						#
						echo -ne "\"${arg}\" \"(click on 'space' to disable)\" \"on\" "
						#
					else
						#
						if [ "${first_char}" = "-" ]
							then
							arg="${arg_prog:1}"
						else
							arg="${arg_prog}"
						fi
						#
						echo -ne "\"${arg}\" \"(click on 'space' to enable)\" \"off\" "
						#
					fi #if [ "${first_char}" = "+" ]
					#
				done )"
		: parametri
		#
		#
		dimensione_menu=$(if [ ${#args[@]} -le 17 ]; then echo ${#args[@]}; else echo 17; fi )
		#
		if [ "${dialogo}" = "whiptail --fb" ]
			then
			dim=13
			dim_finestra="\"${dim}\" \"${dimensione_finestra_2}\""
			#
			( eval ${dialogo} ${separator} --title \"$(basename "${0}" ): list\" --checklist \"Select options...\" ${dim_finestra} ${dimensione_menu} ${parametri} 2> "${dir_tmp}/${file_tmp}" )
			exit_if_user_closes_window
			#
			scelta="$(0< "${dir_tmp}/${file_tmp}" )"
			#
		else
			#
			scelte="$(eval ${dialogo} --title \"$(basename "${0}" ): list\" --stdout  --separate-output ${icona_Ok} --checklist \"Select options...\" \"${dimensione_finestra_1}\" \"${dimensione_finestra_2}\" ${dimensione_menu} ${parametri} 2> /dev/null )"
			exit_code="${?}"
			#
			echo -e "${scelte}" 1> "${dir_tmp}/${file_tmp}"
			#
		fi
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		[ ${#exit_code} -gt 0 ] && return "${exit_code}"
		#
		}
fi
# list()
#
##
#
# input()
if [ "${mode}" = "gtkdialog" ]
	then
	input()
		{
		local FUNCT_NAME="input"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		## testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		quanti_campi=${1}
		: 1> "${dir_tmp}/${file_tmp}"
		#
		shift #...perche' il primo parametro e': "quanti_campi" ...
		threshold=${#}
		local IFS=$'\n'
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
					do
					echo "${1}" | tr '"' "'"
					shift
				done) )
		local IFS=$' \t\n'
		#
		if [ ${quanti_campi} -eq 1 ]
			then
			#
			default_value="${args[0]}"
			inputboxes="$(echo -e "<hbox>"
					echo -e "<entry>"
					echo -e "<default>\"${default_value}\"</default>"
					echo -e "<variable>INPUT1</variable>"
					echo -e "</entry>"
					echo -e "</hbox>" )"
			#
		else
			#
			inputboxes="$(for (( index=0 ; index < ${quanti_campi} ; index++ ))
					do
					#
					array_label_index=$(( ${index} * 2 ))
					label_value="${args[${array_label_index}]}"
					#
					array_default_index=$(( ${array_label_index} + 1 ))
					default_value="${args[${array_default_index}]}"
					#
					echo -e "<hbox>"
					echo -e "<text>"
					echo -e "<label>\"${label_value}\"</label>"
					echo -e "</text>"
					echo -e "<entry>"
					echo -e "<default>\"${default_value}\"</default>"
					echo -e "<variable>INPUT$(( ${index} + 1 ))</variable>"
					echo -e "</entry>"
					echo -e "</hbox>"
					#
				done )"
			#
		fi
		: inputboxes
		#
		export INPUT_DIALOG="
		<window title=\"$(basename "${0}"): data input\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-info\">
			<vbox>
				<frame>
					${inputboxes}
				</frame>
				<hbox>
					<button cancel></button>
					<button ok></button>
				</hbox>
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=INPUT_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#
		if [ ${exit_code} -eq 0 ]
			then
			#
			for (( index=0 ; index < ${quanti_campi} ; index++ ))
				do
				#
				input_name="INPUT$(( ${index} + 1 ))"
				echo "${!input_name}" 1>> "${dir_tmp}/${file_tmp}"
				echo "${!input_name}" 1>&2
				#
			done
		fi
		#
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	input()
		{
		local FUNCT_NAME="input"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		quanti_campi=${1}
		: 1> "${dir_tmp}/${file_tmp}"
		#
		shift #...perche' il primo parametro e': "quanti_campi" ...
		threshold=${#}
		local IFS=$'\n'
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
					do
					echo "${1}"
					shift
				done) )
		local IFS=$' \t\n'
		#
		if [ ${quanti_campi} -eq 1 ]
			then
			#
			# Questo "if" qui sotto e' per standardizzare col comportamento di Xdialog...
			if [ ${#args[@]} -eq 1 ]
				then
				#Cioe' c'e' un UNICO ARGOMENTO, quindi va bene ...
				:
			elif [ ${#args[@]} -gt 1 ]
				then
				#Quando il campo e' unico, Xdialog NON METTE IL TITOLO sul campo (quindi ci devi mettere SOLO un argomento aggiuntivo, NON due o comunque piu' di uno )...
				alert_message "Warning, problems in \"${0}\" source :\nwhen you use \"input 1 [args]\", args must be UNIQUE...\nE.g.: input \"1\" \"ciccio\" (NOT: input \"1\" \"ciccio\" \"franco\" )"
				exit
			fi
			#
			#
			#
			testo=" " #Perche' il campo e' UNO, e Xdialog con un solo arg NON ha il testo... sai, per standardizzare il comportamento di kdialog con quello di Xdialog...
			parametro="${args[0]}"
			#
			#############
			scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--title\t\"$(basename "${0}" ): data input\"\t--inputbox\t\"${testo}\"\t\"${parametro}\"\t2>\t/dev/null" ) )"
			echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
			#############
			#
			if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					exit
				fi
			fi
			#
			exit_if_user_closes_window
			#
		else
			for (( volta=1 ; volta <= $(( ${quanti_campi} * 2 )) ; volta++,volta++ ))
				do
				#
				testo="${args[$(( ${volta} - 1 ))]}"
				parametro="${args[${volta}]}"
				#
				#############
				scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--title\t\"$(basename "${0}" ): data input\"\t--inputbox\t\"${testo}\"\t\"${parametro}\"\t2>\t/dev/null" ) )"
				echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
				#############
				#
				if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
					then
					:
				else
					question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?"
					if [ "${conferma}" -eq 0 ] #"Confermato"
						then
						:
					elif [ "${conferma}" -eq 1 ] #"Non confermato"
						then
						exit
					fi
				fi
				#
				exit_if_user_closes_window
				#
			done
		fi #if [ ${quanti_campi} -eq 1 ]
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
	#
elif [ "${mode}" = "zenity" ]
	then
	input()
		{
		local FUNCT_NAME="input"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		quanti_campi=${1}
		: 1> "${dir_tmp}/${file_tmp}"
		#
		shift #...perche' il primo parametro e': "quanti_campi" ...
		threshold=${#}
		local IFS=$'\n'
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
					do
					echo "${1}"
					shift
				done) )
		local IFS=$' \t\n'
		#
		if [ ${quanti_campi} -eq 1 ]
			then
			#
			# Questo "if" qui sotto e' per standardizzare col comportamento di Xdialog...
			if [ ${#args[@]} -eq 1 ]
				then
				#Cioe' c'e' al massimo ${quanti_campi} e L'UNICO ARGOMENTO, quindi va bene ...
				:
			elif [ ${#args[@]} -gt 1 ] #Quando il campo e' unico, Xdialog NON METTE IL TITOLO sul campo (quindi ci devi mettere SOLO un argomento aggiuntivo, NON due o comunque piu' di uno )...
				then
				alert_message "Warning, problems in \"${0}\" source :\nwhen you use \"input 1 [args]\", args must be UNIQUE...\nE.g.: input \"1\" \"ciccio\" (NOT: input \"1\" \"ciccio\" \"franco\" )"
				exit
			fi
			#
			#
			#
			testo=" " #Perche' il campo e' UNO, e Xdialog con un solo arg NON ha il testo... sai, per standardizzare con Xdialog...
			parametro="${args[0]}"
			#
			#############
			scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--title\t\"$(basename "${0}" ): data input\"\t--entry\t--text\t\"${testo}\"\t${dimensione_finestra}\t--entry-text\t\"${parametro}\"\t2>\t/dev/null" ) )"
			echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
			#############
			#
			if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					exit
				fi
			fi
			#
			exit_if_user_closes_window
			#
		else
			for (( volta=1 ; volta <= $(( ${quanti_campi} * 2 )) ; volta++,volta++ ))
				do
				#
				testo="${args[$(( ${volta} - 1 ))]}"
				parametro="${args[${volta}]}"
				#
				#############
				scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--title\t\"$(basename "${0}" ): data input\"\t--entry\t--text\t\"${testo}\"\t${dimensione_finestra}\t--entry-text\t\"${parametro}\"\t2>\t/dev/null" ) )"
				echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
				#############
				#
				if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
					then
					:
				else
					question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?"
					if [ "${conferma}" -eq 0 ] #"Confermato"
						then
						:
					elif [ "${conferma}" -eq 1 ] #"Non confermato"
						then
						exit
					fi
				fi
				#
				exit_if_user_closes_window
				#
			done
		fi #if [ ${quanti_campi} -eq 1 ]
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
	#
elif [ "${mode}" = "Xdialog" ]
	then
	input()
		{
		local FUNCT_NAME="input"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		quanti_campi=${1}
		: 1> "${dir_tmp}/${file_tmp}"
		#
		if [ ${quanti_campi} -eq 1 ]
			then
			inputbox="--inputbox"
			if [ ${#} -le 2 ]
				then
				#Cioe' c'e' al massimo ${quanti_campi} e L'UNICO ARGOMENTO, quindi va bene ...
				:
			elif [ ${#} -gt 2 ] #Quando il campo e' unico, Xdialog NON METTE IL TITOLO sul campo (quindi ci devi mettere SOLO un argomento aggiuntivo, NON due)...
				then
				alert_message "Warning, problems in \"${0}\" source :\nwhen you use \"input 1 [args]\", args must be UNIQUE...\nE.g.: input \"1\" \"ciccio\" (NOT: input \"1\" \"ciccio\" \"franco\" )"
				exit
			fi
			#
		elif [ ${quanti_campi} -gt 1 ]
			then
			inputbox="--${quanti_campi}inputsbox"
			#
		fi #if [ ${quanti_campi} -eq 1 ]
		#
		shift
		local IFS=$'\n'
			threshold=${#}
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
						do
						echo "${1}"
						shift
					done) )
			parametri="$(for (( index=0 ; index < ${#args[@]} ; index++ ))
					do
					echo -ne "${args[${index}]}\t"
				done)"
		local IFS=$'\t\n'
			#
			#############
			scelta=$( ${dialogo} --stdout --separator "\\n" --title "$(basename "${0}" ): data input" ${inputbox} "Please, write data ..." ${dimensione_finestra} ${parametri} 2> /dev/null | grep -v "${string_to_clean}" )
			echo "${scelta}" 1> "${dir_tmp}/${file_tmp}"
			#############
			#
		local IFS=$' \t\n'
		if [ "${scelta}" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
			then
			:
		else
			question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?"
			if [ "${conferma}" -eq 0 ] #"Confermato"
				then
				:
			elif [ "${conferma}" -eq 1 ] #"Non confermato"
				then
				exit
			fi
		fi #if [ "${scelta}" = "$(0< "${dir_tmp}/${file_tmp}" )" ]
		#
		exit_if_user_closes_window
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	input()
		{
		local FUNCT_NAME="input"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		quanti_campi=${1}
		: 1> "${dir_tmp}/${file_tmp}"
		#
		shift #...perche' il primo parametro e': "quanti_campi" ...
		threshold=${#}
		local IFS=$'\n'
			args=( $(for (( num=1 ; num <= ${threshold} ; num++ ))
					do
					echo "${1}"
					shift
				done) )
		local IFS=$' \t\n'
		#
		if [ ${quanti_campi} -eq 1 ]
			then
			#
			# Questo "if" qui sotto e' per standardizzare col comportamento di Xdialog...
			if [ ${#args[@]} -eq 1 ]
				then
				#Cioe' c'e' al massimo ${quanti_campi} e L'UNICO ARGOMENTO, quindi va bene ...
				:
			elif [ ${#args[@]} -gt 1 ] #Quando il campo e' unico, Xdialog NON METTE IL TITOLO sul campo (quindi ci devi mettere SOLO 1 argomento aggiuntivo, NON due o comunque piu' di uno )...
				then
				alert_message "Warning, problems in \"${0}\" source :\nwhen you use \"input 1 [args]\", args must be UNIQUE...\nE.g.: input \"1\" \"ciccio\" (NOT: input \"1\" \"ciccio\" \"franco\" )"
				exit
			fi
			#
			#
			#
			testo="" #Perche' il campo e' UNO, e Xdialog con un solo arg NON ha il testo... sai, per standardizzare con Xdialog...
			parametro="${args[0]}"
			#
			#############
			if [ "${dialogo}" = "whiptail --fb" ]
				then
				#
				${dialogo} ${separator} --title "$(basename "${0}" ): data input" --inputbox "${testo}" ${dimensione_finestra} "${parametro}" 2>> "${dir_tmp}/${file_tmp}"; echo "" 1>> "${dir_tmp}/${file_tmp}"
				#
				scelta="$(0< "${dir_tmp}/${file_tmp}" )"
				#
			else
				scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--stdout\t${separator}\t\"\\n\"\t--title\t\"$(basename "${0}" ): data input\"\t--inputbox\t\"${testo}\"\t${dimensione_finestra}\t\"${parametro}\"\t2>\t/dev/null" ) )"
				#
				echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
				#
			fi
			#
			#############
			#
			if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
				then
				:
			else
				question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\n Continue ?"
				if [ "${conferma}" -eq 0 ] #"Confermato"
					then
					:
				elif [ "${conferma}" -eq 1 ] #"Non confermato"
					then
					exit
				fi
			fi
			#
			exit_if_user_closes_window
			#
		else
			for (( volta=1 ; volta <= $(( ${quanti_campi} * 2 )) ; volta++,volta++ ))
				do
				#
				testo="${args[$(( ${volta} - 1 ))]}"
				parametro="${args[${volta}]}"				
				#
				#############
				if [ "${dialogo}" = "whiptail --fb" ]
					then
					#
					${dialogo} ${separator} --title "$(basename "${0}" ): data input" --inputbox "${testo}" ${dimensione_finestra} "${parametro}" 2>> "${dir_tmp}/${file_tmp}" ; echo "" 1>> "${dir_tmp}/${file_tmp}"
					#
					scelta="$(0< "${dir_tmp}/${file_tmp}" )"
					#
				else
					#
					scelta="$(eval $(local IFS=$'\t' && echo -e "${dialogo}\t--stdout\t${separator}\t\"\\n\"\t--title\t\"$(basename "${0}" ): data input\"\t--inputbox\t\"${testo}\"\t${dimensione_finestra}\t\"${parametro}\"\t2>\t/dev/null" ) )"
					#
					echo "${scelta}" 1>> "${dir_tmp}/${file_tmp}"
					#
				fi
				#
				#############
				#
				if [ $(grep "${scelta}" 0< "${dir_tmp}/${file_tmp}" | wc -c ) -gt 0 ]
					then
					:
				else
					question "Warning: could not write \"\${scelta}\" variable in: \"${dir_tmp}/${file_tmp}\" ...\nShould I continue the same ?"
					if [ "${conferma}" -eq 0 ] #"Confermato"
						then
						:
					elif [ "${conferma}" -eq 1 ] #"Non confermato"
						then
						exit
					fi
				fi
				#
				exit_if_user_closes_window
				#
			done
			#
		fi #if [ ${quanti_campi} -eq 1 ]
		#
		OUT_STDERR="$(0< "${dir_tmp}/${file_tmp}" )"
		echo "${OUT_STDERR}" 1>&2
		#
		}
fi
# input()
#
##
#
# progress()
if [ "${mode}" = "gtkdialog" ]
	then
	progress()
		{
		local FUNCT_NAME="progress"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		steps=100
		[ ${#} -eq 0 ] && testo="Progress" || testo="${1}"
		#
		if [ ${#} -ge 2 ]
			then
			if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ]
				then
				# Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
				alert_message "$(basename "${0}" ): \n second argument \n\n must be an integer..."
				return
				#
			else
				quanti_sono_gli_elementi=$(echo -n "${2}" | tr -dc '[[:digit:]]' )
				steps=${quanti_sono_gli_elementi}
				#
				if [ ${quanti_sono_gli_elementi} -eq 0 ]
					then
					alert_message "$(basename "${0}" ): \n this progress \n\n \"${testo}\" \n\n has 0 elements..."
					return
				fi
				#
				percentuale_di_1_elemento_sul_totale_degli_elementi=$(echo "scale=10; 100 / ${quanti_sono_gli_elementi}" | bc -l)
				if [ $(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 1 | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
					then
					secondo_numero=$(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 2)
					percentuale_di_1_elemento_sul_totale_degli_elementi="0.${secondo_numero}"
				fi
				#
			fi #if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ] # Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
			#
		fi #if [ ${#} -ge 2 ]
		#
		#
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		export PROGRESS_DIALOG="
		<window title=\"$(basename "${0}" ): progress\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-info\">
			<vbox>
				<frame>
					<pixmap xalign=\"0\">
						<input file stock=\"gtk-dialog-info\"></input>
					</pixmap>
					
					<text xalign=\"2\">
						<label>\"$(echo -e "\n\n${testo_gtkdialog}\n\n")\"</label>
					</text>
					
					<progressbar>
						<input>while read riga; do echo \$riga ; done</input>
						<action type=\"exit\">Ready</action>
					</progressbar>

				</frame>
				
			</vbox>
		</window>
		"
		#
		#
		local IFS=""
		for DICHIARAZIONI in $(
					{
					unset index
					while read standard_input
						do
						if [ "${standard_input}" = "PROGRESS" ]
							then
							index=$(( ${index} + 1 ))
							percentuale=$(echo "scale=10; ${index} * ${percentuale_di_1_elemento_sul_totale_degli_elementi}" | bc -l )
							[ "X${percentuale%%.*}" = "X" ] && secondo_numero=${percentuale_di_1_elemento_sul_totale_degli_elementi##*.} && percentuale="0.${secondo_numero}"
							#
							echo "${percentuale}"
							#
						else
							#
							echo "${standard_input}"
							#
						fi
					done
					echo 100
					#sleep 1 
					} | ${dialogo} --program=PROGRESS_DIALOG 2> /dev/null 
					)
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	progress()
		{
		local FUNCT_NAME="progress"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		steps=100
		[ ${#} -eq 0 ] && testo="Progress" || testo="${1}"
		#
		if [ ${#} -ge 2 ]
			then
			if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ]
				then
				# Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
				alert_message "$(basename "${0}" ): \n second argument \n\n must be an integer..."
				return
				#
			else
				quanti_sono_gli_elementi=$(echo -n "${2}" | tr -dc '[[:digit:]]' )
				steps=${quanti_sono_gli_elementi}
				#
				if [ ${quanti_sono_gli_elementi} -eq 0 ]
					then
					alert_message "$(basename "${0}" ): \n this progress \n\n \"${testo}\" \n\n has 0 elements..."
					return
				fi
				#
				percentuale_di_1_elemento_sul_totale_degli_elementi=$(echo "scale=10; 100 / ${quanti_sono_gli_elementi}" | bc -l)
				if [ $(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 1 | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
					then
					secondo_numero=$(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 2)
					percentuale_di_1_elemento_sul_totale_degli_elementi="0.${secondo_numero}"
				fi
				#
			fi #if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ] # Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
			#
		fi #if [ ${#} -ge 2 ]
		#
		qdbus_or_dcop="$(if [ $(echo -n "$(type qdbus 2>/dev/null)" | wc -c ) -gt 0 ]
					then
					echo "qdbus" 
				else
					echo "dcop"
				fi )"
		#
		# Creazione della finestra...
		progress_var="$(${dialogo} --title "$(basename "${0}" )" ${progress} "$(echo -e "${testo}" )" ${steps} )" ; ${qdbus_or_dcop} ${progress_var} showCancelButton "true"
		#
		# Loop dei valori...
		conteggio=0
		until [ "$(${qdbus_or_dcop} ${progress_var} wasCancelled )" = "true" ]
			do
			# Leggi lo StdIn...		
			read standard_input
			if [ "${standard_input}" = "PROGRESS" ]
				then
				#
				conteggio=$(( ${conteggio} + 1 ))
				#
			else
				#
				conteggio="${standard_input%%.*}"
				#
			fi
			#
			# Setta la barra...
			if [ "${qdbus_or_dcop}" = "qdbus" ]
				then
				${qdbus_or_dcop} ${progress_var} Set "" "value" ${conteggio} 1> /dev/null
				#
			elif [ "${qdbus_or_dcop}" = "dcop" ]
				then
				${qdbus_or_dcop} ${progress_var} setProgress ${conteggio}
				#
			fi
			#
			# Alla fine esci dal loop...
			risultato=$(echo "scale=10; ${conteggio} == ${steps}" | bc -l )
			[ ${risultato} -eq 1 ] && break
			#
		done
		sleep 1 ; ${qdbus_or_dcop} ${progress_var} close
		#exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "zenity" ]
	then
	progress()
		{
		local FUNCT_NAME="progress"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		steps=100
		[ ${#} -eq 0 ] && testo="Progress" || testo="${1}"
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		#
		if [ ${#} -ge 2 ]
			then
			if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ]
				then
				# Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
				alert_message "$(basename "${0}" ): \n second argument \n\n must be an integer..."
				return
				#
			else
				quanti_sono_gli_elementi=$(echo -n "${2}" | tr -dc '[[:digit:]]' )
				steps=${quanti_sono_gli_elementi}
				#
				if [ ${quanti_sono_gli_elementi} -eq 0 ]
					then
					alert_message "$(basename "${0}" ): \n this progress \n\n \"${testo_zenity}\" \n\n has 0 elements..."
					return
				fi
				#
				percentuale_di_1_elemento_sul_totale_degli_elementi=$(echo "scale=10; 100 / ${quanti_sono_gli_elementi}" | bc -l)
				if [ $(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 1 | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
					then
					secondo_numero=$(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 2)
					percentuale_di_1_elemento_sul_totale_degli_elementi="0.${secondo_numero}"
				fi
				#
			fi #if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ] # Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
			#
		fi #if [ ${#} -ge 2 ]
		#
		#
		{
		while read standard_input
			do
			if [ "${standard_input}" = "PROGRESS" ]
				then
				index=$(( ${index} + 1 ))
				percentuale=$(echo "scale=10; ${index} * ${percentuale_di_1_elemento_sul_totale_degli_elementi}" | bc -l )
				[ "X${percentuale%%.*}" = "X" ] && secondo_numero=${percentuale_di_1_elemento_sul_totale_degli_elementi##*.} && percentuale="0.${secondo_numero}"
				#
				echo "${percentuale}"
				#
			else
				#
				echo "${standard_input}"
				#
			fi
		done
		sleep 1 
		} | \
		\
		${dialogo} --title "$(basename "${0}" ): progress" ${progress} --text "${testo_zenity}" ${dimensione_finestra_1} ${dimensione_finestra_2} \
			--auto-close --auto-kill
		#exit_if_user_closes_window
		#
		}
elif [ "${mode}" = "Xdialog" ]
	then
	progress()
		{
		local FUNCT_NAME="progress"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		steps=100
		[ ${#} -eq 0 ] && testo="Progress" || testo="${1}"
		#
		if [ ${#} -ge 2 ]
			then
			if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ]
				then
				# Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
				alert_message "$(basename "${0}" ): \n second argument \n\n must be an integer..."
				return
				#
			else
				quanti_sono_gli_elementi=$(echo -n "${2}" | tr -dc '[[:digit:]]' )
				steps=${quanti_sono_gli_elementi}
				#
				if [ ${quanti_sono_gli_elementi} -eq 0 ]
					then
					alert_message "$(basename "${0}" ): \n this progress \n\n \"${testo}\" \n\n has 0 elements..."
					return
				fi
				#
				percentuale_di_1_elemento_sul_totale_degli_elementi=$(echo "scale=10; 100 / ${quanti_sono_gli_elementi}" | bc -l)
				if [ $(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 1 | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
					then
					secondo_numero=$(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 2)
					percentuale_di_1_elemento_sul_totale_degli_elementi="0.${secondo_numero}"
				fi
				#
			fi #if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ] # Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
			#
		fi #if [ ${#} -ge 2 ]
		#
		#
		{
		if [ -z "${testo_new}" ]
			then
			testo_new="$(echo "${testo}" | sed s\#'\\n'#'^'#g )"
			local IFS=$'^'
				array__testo_new=( ${testo_new} )
			local IFS=$' \t\n'
		fi
		#
		if [ ${#array__testo_new[@]} -eq 1 ]
			then
			while read standard_input
				do
				count=$(( ${count} + 1 ))
				if [ "${standard_input}" = "PROGRESS" ]
					then
					index=${count}
					percentuale=$(echo "scale=10; ${index} * ${percentuale_di_1_elemento_sul_totale_degli_elementi}" | bc -l )
					[ "X${percentuale%%.*}" = "X" ] && secondo_numero=${percentuale_di_1_elemento_sul_totale_degli_elementi##*.} && percentuale="0.${secondo_numero}"
					#
					echo "${percentuale}"
					#
				else
					#
					echo "${standard_input}"
					#
				fi
				echo "XXX"
				echo "[Inter-process message #]: ${count} ..."
				echo "\\n"
				echo "\\n"
				echo "${array__testo_new[0]}"
				echo "XXX"
			done
		else
			while read standard_input
				do
				count=$(( ${count} + 1 ))
				if [ "${standard_input}" = "PROGRESS" ]
					then
					index=${count}
					percentuale=$(echo "scale=10; ${index} * ${percentuale_di_1_elemento_sul_totale_degli_elementi}" | bc -l )
					[ "X${percentuale%%.*}" = "X" ] && secondo_numero=${percentuale_di_1_elemento_sul_totale_degli_elementi##*.} && percentuale="0.${secondo_numero}"
					#
					echo "${percentuale}"
					#
				else
					#
					echo "${standard_input}"
					#
				fi
				echo "XXX"
				echo "[Inter-process message #]: ${count} ..."
				echo "\\n"
				for (( index=0 ; index < ${#array__testo_new[@]} ; index++ ))
					do
					echo "\\n"
					echo "${array__testo_new[${index}]}"
				done
				echo "XXX"
			done
		fi 
		sleep 1 
		} | \
		\
		${dialogo} --title "$(basename "${0}" ): progress" --gauge "[Inter-process message #]: <starting> ...\n\n${testo}"  "${dimensione_finestra_1}" "${dimensione_finestra_2}"
		exit_if_user_closes_window ; unset testo_new
		#
		}
elif [ "${mode}" = "dialog" ]
	then
	progress()
		{
		local FUNCT_NAME="progress"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		steps=100
		[ ${#} -eq 0 ] && testo="Progress" || testo="${1}"
		#
		if [ ${#} -ge 2 ]
			then
			if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ]
				then
				# Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
				alert_message "$(basename "${0}" ): \n second argument \n\n must be an integer..."
				return
				#
			else
				quanti_sono_gli_elementi=$(echo -n "${2}" | tr -dc '[[:digit:]]' )
				steps=${quanti_sono_gli_elementi}
				#
				if [ ${quanti_sono_gli_elementi} -eq 0 ]
					then
					alert_message "$(basename "${0}" ): \n this progress \n\n \"${testo}\" \n\n has 0 elements..."
					return
				fi
				#
				percentuale_di_1_elemento_sul_totale_degli_elementi=$(echo "scale=10; 100 / ${quanti_sono_gli_elementi}" | bc -l)
				if [ $(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 1 | tr -dc '[[:digit:]]' | wc -c) -eq 0 ]
					then
					secondo_numero=$(echo -n "${percentuale_di_1_elemento_sul_totale_degli_elementi}" | cut -d '.' -f 2)
					percentuale_di_1_elemento_sul_totale_degli_elementi="0.${secondo_numero}"
				fi
				#
			fi #if [ $(echo -n "${2}" | tr -dc '[[:digit:]]' | wc -c ) -eq 0 ] # Il secondo argomento c'e', ma NON e' formato da cifre numeriche...
			#
		fi #if [ ${#} -ge 2 ]
		#
		#
		dim=10
		{
		while read standard_input
			do
			if [ "${standard_input}" = "PROGRESS" ]
				then
				index=$(( ${index} + 1 ))
				percentuale=$(echo "scale=10; ${index} * ${percentuale_di_1_elemento_sul_totale_degli_elementi}" | bc -l )
				[ "X${percentuale%%.*}" = "X" ] && secondo_numero=${percentuale_di_1_elemento_sul_totale_degli_elementi##*.} && percentuale="0.${secondo_numero}"
				#
				echo "${percentuale%%.*}"
				#
			else
				#
				echo "${standard_input%%.*}"
				#
			fi
		done
		sleep 1 
		} | \
		\
		${dialogo} --title "$(basename "${0}" ): progress" ${progress} "${testo}" "${dim}" "${dimensione_finestra_2}" "0"
		exit_if_user_closes_window
		#
		}
fi
# progress()
#
##
#
# adjust()
if [ "${mode}" = "gtkdialog" ]
	then
	adjust()
		{
		local FUNCT_NAME="adjust"
		local IFS=$' \t\n'
		#
		#clean_temp
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		testo="${1-"Please adjust parameter..."}"
		testo_gtkdialog="$(echo "${testo}" | tr '"' "'" )"
		#
		start_value=${2-"0"}
		init_value=${3-"50"}
		end_value=${4-"100"}
		#
		start_value_percent=0
		end_value_percent=100
		#
		num_tot_elementi=$(( ${end_value} - ${start_value} ))
		diff_values_percent=$(( ${end_value_percent} - ${start_value_percent} ))
		step=$(echo "scale=2; ${num_tot_elementi} / ${diff_values_percent}" | bc -l )
		# =>
		init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
		init_value_percent=$(arrotonda "${init_value_percent_float}" )
		#
		#
		export dummy_file="${dir_tmp}/${file_tmp}"
		echo "${init_value_percent}" 1> "${dummy_file}"
		#
		functions_step=$(echo "${step}" | cut -d '.' -f 1 )
		[ ${#functions_step} -eq 0 ] && functions_step=1
		#
		export functions_file="${dir_tmp}/${file_ignore}"
		cat <<-EOB1 1> "${functions_file}"
# "adjust" functions:
export dummy_file="${dir_tmp}/${file_tmp}"
export step=${functions_step}
EOB1
		cat <<-'EOB2' 1>> "${functions_file}"
aumenta()
	{
	vecchio_valore=$(cat "${dummy_file}" )
	nuovo_valore=$(expr ${vecchio_valore} + ${step} )
	if [ ${nuovo_valore} -le 100 ]
		then
		echo "${nuovo_valore}" 1> "${dummy_file}"
	fi
	}
diminuisci()
	{
	vecchio_valore="$(cat "${dummy_file}" )"
	nuovo_valore=$(expr ${vecchio_valore} - ${step} )
	if [ ${nuovo_valore} -ge 0 ]
		then
		echo "${nuovo_valore}" 1> "${dummy_file}"
	fi
	}
EOB2
		: testo
		: dummy_file
		export ADJUST_DIALOG="
		<window title=\"$(basename "${0}"): adjust\" default_height=\"${height}\" default_width=\"${width}\" window_position=\"1\" icon-name=\"gtk-dialog-info\">
			<vbox>
				<frame>
					<frame>
						<hbox homogeneous=\"true\">
							<text>
								<label>\"$(echo -e "${testo_gtkdialog}" )\"</label>
							</text>
						</hbox>
					</frame>
					
					
					<frame>
						<hbox homogeneous=\"true\">
							<text>
								<input file>\"${dummy_file}\"</input>
								<variable>LIVELLO</variable>
							</text>
							
						</hbox>
						<hbox homogeneous=\"true\">
							<text>
								<label>\"(%)\"</label>
							</text>
						</hbox>
					</frame>
				
					
					
					<frame>
						<button>
							<input file icon=\"gtk-go-up\"></input>
							<action>. ${functions_file} ; aumenta</action>
							<action type=\"refresh\">LIVELLO</action>
						</button>

						<progressbar bar-style=\"0\" orientation=\"0\">
							<input>while [ -e \"${dummy_file}\" ] ; do cat \"${dummy_file}\" ; sleep 0.1; done</input>
							<action type=\"refresh\">LIVELLO</action>
						</progressbar>

						<button>
							<input file icon=\"gtk-go-down\"></input>
							<action>. \"${functions_file}\" ; diminuisci</action>
							<action type=\"refresh\">LIVELLO</action>
						</button>
					</frame>
					
				</frame>
				
				<hbox>
					<button ok></button>
				</hbox>
				
			</vbox>
		</window>
		"
		#
		local IFS=""
		for DICHIARAZIONI in $(${dialogo} --program=ADJUST_DIALOG 2> /dev/null )
			do
			eval ${DICHIARAZIONI}
		done
		local IFS=$' \t\n'
		#
		##
		#
		#exit_if_user_closes_window #(gtkdialog sets "EXIT" var.,it doesn't handle exit codes  ... )
		[ "${EXIT}" = "abort" ] && exit 255
		#
		##
		#
		[ "${EXIT}" = "OK" ] && exit_code="0"
		[ "${EXIT}" = "Cancel" ] && exit_code="1"
		#
		if [ ${exit_code} -eq 0 ]
			then
			#
			value_percent=$(tr -dc '[[:digit:]]' 0< "${dir_tmp}/${file_tmp}" )
			: value_percent
			#
			final_value_temp=$(echo "scale=2; ${value_percent} * ${step}" | bc -l )
			final_value_float=$(echo "scale=2; ${start_value} + ${final_value_temp}" | bc -l )
			: final_value_float
			#
			final_value=$(arrotonda "${final_value_float}" )
			: final_value
			#
			echo "${final_value}" 1> "${dir_tmp}/${file_tmp}" 
			echo "${final_value}" 1>&2
		else
			: 1> "${dir_tmp}/${file_tmp}"
		fi
		#echo "${exit_code}" 1>&2
		return "${exit_code}"
		#
		}
elif [ "${mode}" = "kdialog" ]
	then
	adjust()
		{
		local FUNCT_NAME="adjust"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			if [ ${#x_root} -gt 0 -a ${#y_root} -gt 0 ]
				then
				local x="+$(( $(( ${x_root} / 2 )) - $(( ${width} / 2 )) ))"
				local y="+$(( $(( ${y_root} / 2 )) - $(( ${height} / 2 )) ))"
			fi
			local dimensione_finestra="--geometry=${width}x${height}${x}${y}"
			local dimensione_finestra_1="--geometry=${width}x${height}${x}${y}"
			local dialogo="kdialog ${dimensione_finestra}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		##
		#
		testo="${1-"Please adjust parameter..."}"
		#
		start_value=${2-"0"}
		init_value=${3-"50"}
		end_value=${4-"100"}
		#
		start_value_percent=0
		end_value_percent=100
		#
		num_tot_elementi=$(( ${end_value} - ${start_value} ))
		diff_values_percent=$(( ${end_value_percent} - ${start_value_percent} ))
		step=$(echo "scale=2; ${num_tot_elementi} / ${diff_values_percent}" | bc -l )
		# =>
		init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
		init_value_percent=$(arrotonda "${init_value_percent_float}" )
		#
		#
		pre_values="$(for ((int1=${start_value_percent} ; int1 < ${init_value_percent} ; int1++ )); do echo -n "${int1}% " ; done )"
		post_values="$(for ((int2=${init_value_percent} ; int2 <= ${end_value_percent} ; int2++ )); do echo -n "${int2}% " ; done )"
		( ${dialogo} --title "$(basename "${0}" ): adjust" --default "${init_value_percent}%" --combobox "${testo}" ${pre_values} ${post_values} \
			2> /dev/null 1> "${dir_tmp}/${file_tmp}" )
		#exit_if_user_closes_window
		exit_code="${?}"
		#
		#
		value_percent=$(tr -dc '[[:digit:]]' 0< "${dir_tmp}/${file_tmp}" )
		: value_percent
		#
		final_value_temp=$(echo "scale=2; ${value_percent} * ${step}" | bc -l )
		final_value_float=$(echo "scale=2; ${start_value} + ${final_value_temp}" | bc -l )
		: final_value_float
		#
		final_value=$(arrotonda "${final_value_float}" )
		: final_value
		#
		echo "${final_value}" 1> "${dir_tmp}/${file_tmp}" 
		#
		#####################################################
		# Exit code check... 
		# ( Note:  for this function it's better _do not_ use:
		#          "exit_if_user_closes_window" )
		uscita="${exit_code}"
		if [ ${uscita} -ne 0 ]
			then
			#clean_temp
			if [ ${uscita} -eq 1 ]
				then
				#
				#echo "Hai cliccato su \"Cancel\"..."
				#
				exit 1
				#
			elif [ ${uscita} -eq 255 ]
				then
				#
				#echo "Hai chiuso la finestra..."
				#
				exit 255
				#
			else
				if [ "${dialogo}" = "zenity" -a ${uscita} -eq 5 ]
					then
					# Non far niente: sembra un codice di uscita di zenity legato ai temi...
					:
					#
				else
					#
					#
					alert_message ":( ...Something went wrong..."
					echo -e "\n:( ...Something went wrong..." 1>&2
					#
					exit 1
					#
				fi
				#
			fi
			#
		fi
		# End exit code check... 
		#####################################################
		#
		OUT_STDERR="${final_value}"
		echo "${OUT_STDERR}" 1>&2
		}
elif [ "${mode}" = "zenity" ]
	then
	adjust()
		{
		local FUNCT_NAME="adjust"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="--width=${width} --height=${height}"
			local dimensione_finestra_1="--width=${width} --height=${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		##
		#
		testo="${1-"Please adjust parameter..."}"
		testo_zenity="$(echo "${testo}" | tr -d '<>' )"
		#
		start_value=${2-"0"}
		init_value=${3-"50"}
		end_value=${4-"100"}
		#
		start_value_percent=0
		end_value_percent=100
		#
		num_tot_elementi=$(( ${end_value} - ${start_value} ))
		diff_values_percent=$(( ${end_value_percent} - ${start_value_percent} ))
		step=$(echo "scale=2; ${num_tot_elementi} / ${diff_values_percent}" | bc -l )
		# =>
		init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
		init_value_percent=$(arrotonda "${init_value_percent_float}" )
		#
		#
		( ${dialogo} --title "$(basename "${0}" ): adjust" --scale --text "${testo_zenity}" --value ${init_value_percent} --min-value ${start_value_percent} --max-value ${end_value_percent} ${dimensione_finestra_1} ${dimensione_finestra_2} \
		2> /dev/null 1> "${dir_tmp}/${file_tmp}" )
		#exit_if_user_closes_window
		exit_code="${?}"
		#
		#
		value_percent=$(tr -dc '[[:digit:]]' 0< "${dir_tmp}/${file_tmp}" )
		: value_percent
		#
		final_value_temp=$(echo "scale=2; ${value_percent} * ${step}" | bc -l )
		final_value_float=$(echo "scale=2; ${start_value} + ${final_value_temp}" | bc -l )
		: final_value_float
		#
		final_value=$(arrotonda "${final_value_float}" )
		: final_value
		#
		echo "${final_value}" 1> "${dir_tmp}/${file_tmp}" 
		#
		#####################################################
		# Exit code check... 
		# ( Note:  for this function is better _do not_ use:
		#          "exit_if_user_closes_window" )
		uscita="${exit_code}"
		if [ ${uscita} -ne 0 ]
			then
			#clean_temp
			if [ ${uscita} -eq 1 ]
				then
				#
				#echo "Hai cliccato su \"Cancel\"..."
				#
				exit 1
				#
			elif [ ${uscita} -eq 255 ]
				then
				#
				#echo "Hai chiuso la finestra..."
				#
				exit 255
				#
			else
				if [ "${dialogo}" = "zenity" -a ${uscita} -eq 5 ]
					then
					# Non far niente: sembra un codice di uscita di zenity legato ai temi...
					:
					#
				else
					#
					#
					alert_message ":( ...Something went wrong..."
					echo -e "\n:( ...Something went wrong..." 1>&2
					#
					exit 1
					#
				fi
				#
			fi
			#
		fi
		# End exit code check... 
		#####################################################
		#
		OUT_STDERR="${final_value}"
		echo "${OUT_STDERR}" 1>&2
		}
elif [ "${mode}" = "Xdialog" ]
	then
	adjust()
		{
		local FUNCT_NAME="adjust"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		reset_geometry="NO"
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		if [ "${reset_geometry}" = "YES" ]
			then
			local dimensione_finestra="${width}x${height}"
			local dimensione_finestra_1="${width}x${height}"
		fi
		# End check for user custom geometry...
		#########################################
		#
		##
		#
		testo="${1-"Please adjust parameter..."}"
		#
		start_value=${2-"0"}
		init_value=${3-"50"}
		end_value=${4-"100"}
		#
		start_value_percent=0
		end_value_percent=100
		#
		num_tot_elementi=$(( ${end_value} - ${start_value} ))
		diff_values_percent=$(( ${end_value_percent} - ${start_value_percent} ))
		step=$(echo "scale=2; ${num_tot_elementi} / ${diff_values_percent}" | bc -l )
		# =>
		init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
		init_value_percent=$(arrotonda "${init_value_percent_float}" )
		#
		#
		( ${dialogo} --title "$(basename "${0}" ): adjust" --stdout --separator "\\n" ${no_tags} ${icona_Ok} --rangebox "${testo}" ${dimensione_finestra_1} ${dimensione_finestra_2} ${start_value_percent} ${end_value_percent} ${init_value_percent} \
			2> /dev/null 1> "${dir_tmp}/${file_tmp}" )
		#exit_if_user_closes_window
		exit_code="${?}"
		#
		#
		value_percent=$(tr -dc '[[:digit:]]' 0< "${dir_tmp}/${file_tmp}" )
		: value_percent
		#
		final_value_temp=$(echo "scale=2; ${value_percent} * ${step}" | bc -l )
		final_value_float=$(echo "scale=2; ${start_value} + ${final_value_temp}" | bc -l )
		: final_value_float
		#
		final_value=$(arrotonda "${final_value_float}" )
		: final_value
		#
		echo "${final_value}" 1> "${dir_tmp}/${file_tmp}" 
		#
		#####################################################
		# Exit code check... 
		# ( Note:  for this function is better _do not_ use:
		#          "exit_if_user_closes_window" )
		uscita="${exit_code}"
		if [ ${uscita} -ne 0 ]
			then
			#clean_temp
			if [ ${uscita} -eq 1 ]
				then
				#
				#echo "Hai cliccato su \"Cancel\"..."
				#
				exit 1
				#
			elif [ ${uscita} -eq 255 ]
				then
				#
				#echo "Hai chiuso la finestra..."
				#
				exit 255
				#
			else
				if [ "${dialogo}" = "zenity" -a ${uscita} -eq 5 ]
					then
					# Non far niente: sembra un codice di uscita di zenity legato ai temi...
					:
					#
				else
					#
					#
					alert_message ":( ...Something went wrong..."
					echo -e "\n:( ...Something went wrong..." 1>&2
					#
					exit 1
					#
				fi
				#
			fi
			#
		fi
		# End exit code check... 
		#####################################################
		#
		OUT_STDERR="${final_value}"
		echo "${OUT_STDERR}" 1>&2
		}
elif [ "${mode}" = "dialog" ]
	then
	adjust()
		{
		local FUNCT_NAME="adjust"
		local IFS=$' \t\n'
		#
		##clean_temp #( #clean_temp not useful because this function will write in temp file... )
		#
		#########################################
		# Begin check for user custom geometry...
		while [ "${1}" = "--width" -o "${1}" = "-w" -o "${1}" = "--height" -o "${1}" = "-h" ]
			do
			w_or_h="$(if [ "${1}" = "--width" -o "${1}" = "-w" ]
					then
					echo "width"
				elif [ "${1}" = "--height" -o "${1}" = "-h" ]
					then
					echo "height"
				fi )"
			parameter=$(echo -n "${2}" | tr -dc '[[:digit:]]' ) ; [ ${#parameter} -eq 0 ] && break
			reset_geometry="YES" && eval "local ${w_or_h}=${parameter}" && shift 2
		done
		# End check for user custom geometry...
		#########################################
		#
		##
		#
		testo="${1-"Please adjust parameter..."}"
		#
		start_value=${2-"0"}
		init_value=${3-"50"}
		end_value=${4-"100"}
		#
		start_value_percent=0
		end_value_percent=100
		#
		num_tot_elementi=$(( ${end_value} - ${start_value} ))
		diff_values_percent=$(( ${end_value_percent} - ${start_value_percent} ))
		step=$(echo "scale=2; ${num_tot_elementi} / ${diff_values_percent}" | bc -l )
		# =>
		init_value_percent_float=$(echo "scale=2; $(( ${init_value} - ${start_value} )) / ${step}" | bc -l )
		init_value_percent=$(arrotonda "${init_value_percent_float}" )
		#
		#
		dim=10
		#
		{
		up_with_X='OA' && up_without_X='\[A'
		right_with_X='OC' && right_without_X='\[C'
		#
		down_with_X='OB' && down_without_X='\[B'
		left_with_X='OD' && left_without_X='\[D'
		#
		exit_success=0
		value_percent=${init_value_percent} && echo ${value_percent}
		#echo "INIZIO" 1> /home/cagnettav/Desktop/prova-adj.txt
		while :
			do
			read -n 3 -s key
			#
			#echo "---${key}---" 1>> /home/cagnettav/Desktop/prova-adj.txt
			#
			case ${exit_success} in 
				"$(echo -n "${key}" | grep -E "(${up_with_X}|${up_without_X}|${right_with_X}|${right_without_X})" &> /dev/null; echo ${?} )" ) 
					value_percent=$(( ${value_percent} + 1 )) ;;
				"$(echo -n "${key}" | grep -E "(${down_with_X}|${down_without_X}|${left_with_X}|${left_without_X})" &> /dev/null; echo ${?} )" )
					value_percent=$(( ${value_percent} - 1 )) ;;
				* )
					if [[ ${key} =~ .*A.* ]]
						then
						value_percent=$(( ${value_percent} + 1 ))
					elif [[ ${key} =~ .*C.* ]]
						then
						value_percent=$(( ${value_percent} + 1 ))
					elif [[ ${key} =~ .*B.* ]]
						then
						value_percent=$(( ${value_percent} - 1 ))
					elif [[ ${key} =~ .*D.* ]]
						then
						value_percent=$(( ${value_percent} - 1 ))
						#
					elif [[ ${key} =~ .*O.* ]]
						then
						continue 1
					elif [[ ${key} =~ .*\[.* ]]
						then
						continue 1
					else
						break 1
						#
					fi ;;
			esac
			#
			echo "${value_percent}"
		done
		#
		echo "${value_percent}" 1> "${dir_tmp}/${file_tmp}" 
		#sleep 1 
		} | \
		\
		${dialogo} --title "$(basename "${0}" ): adjust (use arrow keys)" ${progress} "${testo}" "${dim}" "${dimensione_finestra_2}" $(if [ "${dialogo}" = "whiptail --fb" ] ; then echo "${init_value_percent}"; fi )
		#exit_if_user_closes_window
		exit_code="${?}"
		#
		reset
		#
		#
		value_percent=$(tr -dc '[[:digit:]]' 0< "${dir_tmp}/${file_tmp}" )
		: value_percent
		#
		final_value_temp=$(echo "scale=2; ${value_percent} * ${step}" | bc -l )
		final_value_float=$(echo "scale=2; ${start_value} + ${final_value_temp}" | bc -l )
		: final_value_float
		#
		final_value=$(arrotonda "${final_value_float}" )
		: final_value
		#
		echo "${final_value}" 1> "${dir_tmp}/${file_tmp}" 
		#
		#####################################################
		# Exit code check... 
		# ( Note:  for this function is better _do not_ use:
		#          "exit_if_user_closes_window" )
		uscita="${exit_code}"
		if [ ${uscita} -ne 0 ]
			then
			#clean_temp
			if [ ${uscita} -eq 1 ]
				then
				#
				#echo "Hai cliccato su \"Cancel\"..."
				#
				exit 1
				#
			elif [ ${uscita} -eq 255 ]
				then
				#
				#echo "Hai chiuso la finestra..."
				#
				exit 255
				#
			else
				if [ "${dialogo}" = "zenity" -a ${uscita} -eq 5 ]
					then
					# Non far niente: sembra un codice di uscita di zenity legato ai temi...
					:
					#
				else
					#
					#
					alert_message ":( ...Something went wrong..."
					echo -e "\n:( ...Something went wrong..." 1>&2
					#
					exit 1
					#
				fi
				#
			fi
			#
		fi
		# End exit code check... 
		#####################################################
		#
		OUT_STDERR="${final_value}"
		echo "${OUT_STDERR}" 1>&2
		}
fi
# adjust()
#
##
#
