G4C AVDBMAN
WINDOW #center #center 660 620 ""
WinAttr style -maxbox/minbox/allgray/remsize/noedit
WinAttr ICON g4c/15
xOnLoad
ifexists GUI '~avanti'
loadIcon '$$this.path/avsystem/avanti2.icl' avicons
loadfont 'courier new/9' lv2font
loadfont 'arial/10/bold' hd2font
loadfont 'arial/8/bold' he2font
loadfont 'arial/16/bold' bigfont
loadfont 'verdana/8' norm
guiopen #this
endif
xOnOpen
setEvent #this idCOdecs* hide
setEvent #this idFormats* hide
setEvent #this idtxt* hide
setEvent #this scanMsg show
pumpmessages
set buffers 10000
ms = '#separator'
changedFormats = 0
changedCodecs = 0
newFormats = 0
newCodecs = 0
remFormats = 0
remCodecs = 0
codecstats = 0
formatstats = 0
lvIDglobal = 'idCodecs2'
addFormats = 0
addCodecs = 0
modFormats = 0
modCodecs = 0
avanti_path = ''
av_restart = 0
use lv #this idCodecs; lv clear
gosub #this setLVdefault
use lv #this idFormats; lv clear
gosub #this setLVdefault
use lv #this idCodecs2; lv clear
gosub #this setLVdefault
use lv #this idFormats2; lv clear
gosub #this setLVdefault
AppName = 'AVANTI  DBMAN'
int_ver = '0.1.3'
app_ver = $int_ver
iniPath = '$$this.path/$appName\.ini'
winTitle = ' $appName  version $int_ver  -  Advanced Codecs/Formats Database Manager'
setWinTitle #this $winTitle
avanti_path = $$this.path
ifexists PROCESS 'Avanti-GUI.exe' ; avanti_path = $$gc.gcdir ; endif
gosub #this getCodecs
gosub #this getFormats
swap = 0
label back
use lv #this 'idFormats2'
lv select none
lv go first
while $$lv.valid = 1
gosub #this searchNew
lv go next
endwhile
pumpmessages
use lv #this 'idCodecs2'
lv select none
lv go first
while $$lv.valid = 1
gosub #this searchNew
lv go next
endwhile
pumpmessages
use lv #this idCodecs
lvSwitch #this idCodecs2
use lv #this idFormats
lvSwitch #this idFormats2
pumpmessages
if $swap = 0
swap = 1
goto back
endif
swap = 0
update #this idRemFormats '| Removed: $remFormats' TRIGGER
update #this idRemCodecs '| Removed: $remCodecs' TRIGGER
gosub #this updateChanges idCodecs2
gosub #this updateChanges idFormats2
use lv #this idCodecs
lv go last
lv delete
use lv #this idFormats
lv go last
lv delete
gosub #this countDBtotal
use lv #this idFormats2
lv go #0
lv column #2
lv select
gosub #this searchNew
use lv #this idCodecs2
lv go #0
lv column #2
lv select
gosub #this searchNew
use gui avdbman
gui page codecs
pumpmessages
setEvent #this scanMsg hide
setEvent #this idCodecs* show
setEvent #this idFormats* show
setEvent #this idtxt* show
setEvent #this idCodecs2 select
xBeforeClose
ifexists GUI '~avanti'
freefont lv2font
freefont hd2font
freefont he2font
freefont bigfont
freefont norm
endif
xOnClose
ifexists GUI '~avanti'
orifexists GUIWINDOW '~avanti'
GuiQuit #this
quit
endif
use gui avanti
xRoutine getCodecs
use lv #this idBuffer
lv load '$avanti_path/avsystem/codecs.dat'
lvRep 'AVANTI' 'AVDBMAN' SENSETIVE
lv save '$avanti_path/avsystem/codecs.tmp'
loadini '$avanti_path/avsystem/codecs.tmp' #EVENT avdbman/idCodecs
loadini '$avanti_path/avsystem/codecs.tmp' codecstats
use lv #this idCodecs
lv add''
lv select none
lv go first
lv select
lv move first
codecsTotal = $$lv.total
gui page formats
use lv #this idBuffer
lv clear
lv load '$avanti_path/ffmpeg/formats.txt'
lvSearch 'Codecs:' FIRST
lv go next
temp = $$lv.text
gosub #this getStrFormat 'Suppor' $temp
while '$temp[0][9]' != 'Supported'
and $$lv.valid = 1
bufstr = $$lv.text
use lv #this idCodecs2
lv add '---'
if $bufstr[$lof][1] != 'D'
and $bufstr[$lof][2] != ' E'
and $bufstr[$lof][2] != 'DE'
%desc = $bufstr
goto skip
endif
%cotype = '$bufstr[$lof][$lp1]'
temp = $%cotype
appVar temp '      '
%cotype = $temp[0][6]
%codec = '$bufstr[$p1][100]'
if $lp2 > ''; %codec = '$bufstr[$p1][$lp2]'; endif
extract %codec CLEAN
%user = '------------'
%prio = 'Y'
%desc = '---'
if $p2 > ''; %desc = '$bufstr[$p2][100]'; endif
label skip
extract %desc CLEAN
use lv #this idBuffer
lv go next
temp = $$lv.text
endwhile
use lv #this idCodecs2
lv del current
lv add
lv select none
lv go first
lv select
gui page codecs
avcom32.deleteFile '$avanti_path/avsystem/codecs.tmp'
xRoutine getFormats
use lv #this idBuffer
lv load '$avanti_path/avsystem/formats.dat'
lvRep 'AVANTI' 'AVDBMAN' SENSETIVE
lv save '$avanti_path/avsystem/formats.tmp'
loadini '$avanti_path/avsystem/formats.tmp' #EVENT avdbman/idFormats
loadini '$avanti_path/avsystem/formats.tmp' formatstats
use lv #this idFormats
lv add''
lv select none
lv go first
lv select
lv move first
FormatsTotal = $$lv.total
gui page codecs
use lv #this idBuffer
lv clear
lv load '$avanti_path/ffmpeg/formats.txt'
lvSearch 'File formats:' FIRST
lv go next
temp = $$lv.text
gosub #this getStrFormat 'Codecs' $temp
while '$temp[0][6]' != 'Codecs'
and $$lv.valid = 1
bufstr = $$lv.text
use lv #this idFormats2
lv add '---'
if $bufstr[$lof][1] != 'D'
and $bufstr[$lof][2] != ' E'
and $bufstr[$lof][2] != 'DE'
%desc = $bufstr
goto skip
endif
%cotype = '$bufstr[$lof][$lp1]'
temp = $%cotype
appVar temp '      '
%cotype = $temp[0][3]
%codec = '$bufstr[$p1][$lp2]'
extract %codec CLEAN
%user = '----'
%prio = '3'
%desc = '$bufstr[$p2][100]'
label skip
extract %desc CLEAN
use lv #this idBuffer
lv go next
temp = $$lv.text
endwhile
use lv #this idFormats2
lv del current
lv add
lv select none
lv go first
lv select
gui page formats
avcom32.deleteFile '$avanti_path/avsystem/formats.tmp'
xRoutine getStrFormat listEnd line
local temp/pos1/pos2/n
lof = ''; p1 = ''; p2 = ''; lp1 = ''; lp2 = '';
searchVar line 'D' FIRST SENSETIVE
lof = $$search.pos
if $$search.pos = ''
searchVar line 'E' FIRST SENSETIVE
lof = $$search.pos
--lof
endif
while '$$lv.text[0][6]' != $listEnd
and $$lv.valid = 1
temp = $$lv.text
searchVar temp 'ac3' FIRST
temp = '$($$search.pos-1)'
if $$search.pos > ''
and '$line[$temp][1]' = ' '
p1 = $$search.pos
lp1 = '$($p1-$lof)'
endif
temp = $$lv.text
searchVar temp 'raw ac3' NEXT
temp = '$($$search.pos-1)'
if $$search.pos > ''
and '$line[$temp][1]' = ' '
p2 = $$search.pos
lp2 = '$($p2-$p1)'
endif
lv go next
endwhile
lvSearch '$line' FIRST
xRoutine SearchNew
local lvSource/lvDestin/temp/temp2/lin
if $$lv.id = idFormats
or $$lv.id = idCodecs
return
endif
if $$lv.id = idCodecs2; lvSource = idCodecs2; lvDestin = idCodecs; endif
if $$lv.id = idFormats2; lvSource = idFormats2; lvDestin = idFormats; endif
use lv #this $lvSource
temp = $%codec
extract temp CLEAN
use lv #this $lvDestin
lv go first
lv select none
while $$lv.valid = 1
extract %codec CLEAN
extract %user CLEAN
if $%codec = $temp
lv select
lv column #2
temp = $$lv.line
if $prev < $temp; lv move '$($$lv.line+3)'; endif
if $prev > $temp; lv move '$($$lv.line-3)'; endif
prev = $temp
temp2 = $%cotype
use lv #this $lvSource
if $swap = 0
if $lvDestin = idCodecs; and $%user > ''; %user = '------------'; endif
if $lvDestin = idFormats; and $%user > ''; %user = '----'; endif
if $%cotype != $temp2; and $lvDestin = idCodecs; %user = 'CHANGED'; endif
if $%cotype[0][2] != $temp2[0][2]; and $lvDestin = idFormats; %user = 'CHNG'; endif
endif
return
endif
lv go next
endwhile
use lv #this $lvSource
if $swap = 0
if $%user > ''; %user = 'NEW'; endif
else
if $lvDestin = idCodecs
temp = $%desc
searchVar temp 'Avanti' FIRST
if $$search.pos = ''
%desc = 'REMOVED $%desc'
++remCodecs
endif
else
%user = 'REM'
++remFormats
endif
endif
xRoutine updateChanges lvidCall
local new/changed/lvid
new = 0; changed = 0
lvid = $$lv.id
use lv #this $lvidCall
lv go first
while $$lv.valid = 1
if $%user = 'NEW'; ++new; endif
if $%user = 'CHANGED'
or $%user = 'CHNG'
++changed
endif
lv go next
endwhile
if $lvidCall = idFormats2
update #this idNewFormats '| New: $new' TRIGGER
update #this idChangedFormats '| Changed: $changed' TRIGGER
else
update #this idNewCodecs '| New: $new' TRIGGER
update #this idChangedCodecs '| Changed: $changed' TRIGGER
endif
use lv #this $lvid
XLISTVIEW 10 10 10 10 '' '' dummy
attr ID idBuffer
attr SHOW hide
xRoutine countDBtotal
local lvid
lvid = $$lv.id
use lv #this idFormats
FormatsTotal = $$lv.total
use lv #this idCodecs
CodecsTotal = $$lv.total
use lv #this idFormats2
FormatsTotal2 = $$lv.total
use lv #this idCodecs2
CodecsTotal2 = $$lv.total
use lv #this $lvid
gosub #this updateTotals
xRoutine updateTotals
update #this idtotalFormats '| Total: $formatsTotal' TRIGGER
update #this idtotalFormats2 '| Total: $formatsTotal2' TRIGGER
update #this idtotalCodecs '| Total: $codecsTotal' TRIGGER
update #this idtotalCodecs2 '| Total: $codecsTotal2' TRIGGER
xRoutine setLVdefault
lv color LC0 0/0/0
lv color LC1 255/255/225
lv color LC2 255/255/225
lv color LC4 255/255/225
lv color LC5 255/255/225
lv color LC6 0/0/0
lv color LC7 200/200/200
lv color LC8 0/0/0
lv color LC9 200/200/200
lv color LC10 255/255/255
lv color LC11 0/0/150
xOnkey F1
HTMLHelp  TOPIC  '$$this.path/avanti-help.chm' 'avanti-10-test.htm#avdbman'
xRebar toolbar
xToolbar avicons/0/L s/0/s/s/5/6/s/8/8/8/8/8/8/8/8/8/8/8/8/7
attr id toolbar
attr style flat
Attr TOOL '0/ROUTINE/generalMenu/HELP/ Main options menu '
Attr TOOL '5/ROUTINE/key_F8/HELP/ Codec database manager '
Attr TOOL '6/ROUTINE/restoreMain/HELP/ Back to main window '
Attr TOOL '15/HELP/ Future expansion '
Attr TOOL '7/ROUTINE/helpMenu/HELP/ Help menu '
xAttr codecs
attr style vcenter/oneline
attr FONT hd2font
attr PAGE codecs
attr COLOR 255/255/255/100/100/100
xAttr formats
attr style vcenter/oneline
attr FONT hd2font
attr PAGE formats
attr COLOR 255/255/255/100/100/100
XTEXTBOX 10 54 470 20 " Present FFmpeg Codecs database:"
attr LIKE codecs
XTEXTBOX 10 344 410 20 " Extracted Codecs list from currently used FFmpeg version:"
attr LIKE codecs
XTEXTBOX 10 54 470 20 " Present FFmpeg Formats database:"
attr LIKE formats
XTEXTBOX 10 344 410 20 " Extracted Formats list from currently used FFmpeg version:"
attr LIKE formats
XTEXTBOX 480 54 75 20 "| Total: 0"
attr ID idTotalFormats
attr LIKE formats
XTEXTBOX 420 344 75 20 "| Total: 0"
attr ID idTotalFormats2
attr LIKE formats
XTEXTBOX 480 54 75 20 "| Total: 0"
attr ID idTotalCodecs
attr LIKE codecs
XTEXTBOX 420 344 75 20 "| Total: 0"
attr ID idTotalCodecs2
attr LIKE codecs
XTEXTBOX 560 344 90 20 "| Changed: 0"
attr ID idChangedFormats
attr LIKE formats
XTEXTBOX 495 344 65 20 "| New: 0"
attr ID idNewFormats
attr LIKE formats
XTEXTBOX 560 344 90 20 "| Changed: 0"
attr ID idChangedCodecs
attr LIKE codecs
XTEXTBOX 495 344 65 20 "| New: 0"
attr ID idNewCodecs
attr LIKE codecs
XTEXTBOX 555 54 95 20 "| Removed: 0"
attr ID idRemCodecs
attr LIKE codecs
XTEXTBOX 555 54 95 20 "| Removed: 0"
attr ID idRemFormats
attr LIKE formats
xVariable text1
The "Codec label" column shows NEW and CHANGED items. Use the buttons on top to manage them.
###
xVariable text2
The "N.A." column shows NEW and CHNG (changed) items. Use the buttons on top to manage them.
###
xVariable text3
The "Description" column shows items which are not found on the extracted FFmpeg lists.
###
XTEXTBOX 10 324 640 15 $text1
attr ID idtxt1
attr PAGE codecs
attr FONT norm
XTEXTBOX 10 324 640 15 $text2
attr ID idtxt2
attr PAGE formats
attr FONT norm
XTEXTBOX 10 34 640 15 $text3
attr ID idtxt3
attr PAGE codecs
attr FONT norm
XTEXTBOX 10 34 640 15 $text3
attr ID idtxt4
attr PAGE formats
attr FONT norm
XTEXTBOX 5 34 650 580 "SCANNING DATABASE FOR CHANGES"
attr FONT bigfont
attr ID scanMsg
attr style center/vcenter/oneline
attr COLOR 225/0/0
xAttr butta
attr style button/center/vcenter/oneline
attr FONT he2font
attr COLOR 255/255/255/50/100/150
XTEXTBOX 10 4 100 25 "ADD ALL NEW"
attr LIKE butta
local lvid/lvid2
lvid = $$lv.id
if '$lvid[0][8]' = 'idCodecs'; lvid = 'idCodecs'; lvid2 = 'idCodecs2'; endif
if '$lvid[0][9]' = 'idFormats'; lvid = 'idFormats'; lvid2 = 'idFormats2'; endif
if '$lvid' = 'idCodecs'
and $addCodecs = 1
msgbox 'New codecs are already added.     ' STOP/OK
setEvent #this $lvid select
stop
endif
if '$lvid' = 'idFormats'
and $addFormats = 1
msgbox 'New formats are already added.     ' STOP/OK
setEvent #this $lvid select
stop
endif
gosub #this confirm 'ADD ALL NEW' $lvid2
use lv #this $lvid
pos = $$lv.line
use lv #this $lvid2
pos2 = $$lv.line
use lv #this $lvid2
lv go first
while $$lv.valid = 1
if $%user = NEW
lvClip COPY 1 ADD #this $lvid
endif
use lv #this $lvid2
lv go next
endwhile
use lv #this $lvid2
lv select none
lv go first
setEvent #this $lvid hide
while $$lv.valid = 1
gosub #this searchNew
lv go next
endwhile
gosub #this updateChanges $lvid2
setEvent #this $lvid show
use lv #this $lvid
lv select none
lv go '#$pos'
lv column #2
lv select
use lv #this $lvid2
lv select none
lv go '#$pos2'
lv column #2
lv select
if $lvid = 'idCodecs'; addCodecs = 1; endif
if $lvid = 'idFormats'; addFormats = 1; endif
pumpmessages
gosub #this countDBtotal
setEvent #this $lvid2 select
XTEXTBOX 110 4 145 25 "UPDATE ALL CHANGED"
attr LIKE butta
local lvid/temp/temp2/pos/pos2
lvid = $$lv.id
if '$lvid[0][8]' = 'idCodecs'
and $modCodecs = 1
msgbox 'Modifications already done.     ' STOP/OK
setEvent #this 'idCodecs2' select
stop
endif
if '$lvid[0][9]' = 'idFormats'
and $modFormats = 1
msgbox 'Modifications already done.     ' STOP/OK
setEvent #this 'idFormats2' select
stop
endif
if '$lvid[0][8]' = 'idCodecs'; lvid = 'idCodecs'; lvid2 = 'idCodecs2'; endif
if '$lvid[0][9]' = 'idFormats'; lvid = 'idFormats'; lvid2 = 'idFormats2'; endif
gosub #this confirm 'UPDATE ALL CHANGED' $lvid2
use lv #this $lvid
pos = $$lv.line
use lv #this $lvid2
pos2 = $$lv.line
use lv #this $lvid2
lv go first
while $$lv.valid = 1
if $%user = 'CHNG'
temp = $%cotype[0][2]
temp2 = $%codec
use lv #this $lvid
lv go first
while $$lv.valid = 1
if $%codec = $temp2
%cotype[0][2] = $temp
endif
lv go next
endwhile
use lv #this $lvid2
endif
if $%user = 'CHANGED'
temp = $%cotype
temp2 = $%codec
use lv #this $lvid
lv go first
while $$lv.valid = 1
if $%codec = $temp2
%cotype = $temp
endif
lv go next
endwhile
use lv #this $lvid2
endif
use lv #this $lvid2
lv go next
endwhile
use lv #this $lvid2
lv select none
lv go first
setEvent #this $lvid hide
while $$lv.valid = 1
gosub #this searchNew
lv go next
endwhile
gosub #this updateChanges $lvid2
setEvent #this $lvid show
use lv #this $lvid
lv select none
lv go '#$pos'
lv column #2
lv select
use lv #this $lvid2
lv select none
lv go '#$pos2'
lv column #2
lv select
if $lvid = 'idCodecs'; modCodecs = 1; endif
if $lvid = 'idFormats'; modFormats = 1; endif
setEvent #this $lvid2 select
XTEXTBOX 255 4 150 25 "ADD/CHANGE SELECTED"
attr LIKE butta
local lvid/pos/temp
lvid = $$lv.id
pos = $$lv.line
if $lvid = 'idCodecs'; stop; endif
if $lvid = 'idFormats'; stop; endif
gosub #this confirm 'ADD/CHANGE SELECTED'	$lvid
if $lvid = 'idCodecs2'
and $%user = 'CHANGED'
%user = '------------'
temp = $%cotype
use lv #this 'idCodecs'
%cotype = $temp
gosub #this updateChanges $lvid
use lv #this $lvid
lv go $pos
setEvent #this $lvid select
stop
endif
if $lvid = 'idFormats2'
and $%user = 'CHNG'
user = '----'
temp = $%cotype[0][2]
use lv #this 'idFormats'
%cotype[0][2] = $temp
gosub #this updateChanges $lvid
use lv #this $lvid
lv go $pos
setEvent #this $lvid select
stop
endif
temp = $%codec
use lv #this $lvid[0][-1]
lv go first
while $$lv.valid = 1
if $%codec = $temp
and $%user = 'NEW'
msgbox 'This item is already added to the database.     ' STOP/OK
setEvent #this $lvid select
stop
endif
lv go next
endwhile
use lv #this $lvid
if $lvid = 'idCodecs2'
and $%user = 'NEW'
use lv #this 'idCodecs2'
lvClip COPY 1 ADD #this 'idCodecs'
lv column #2
use lv #this 'idCodecs'
lv go last
lv column #2
lv move last
use lv #this 'idCodecs2'
%user = '------------'
endif
if $lvid = 'idFormats2'
and $%user = 'NEW'
use lv #this 'idFormats2'
lvClip COPY 1 ADD #this 'idFormats'
lv column #2
use lv #this 'idFormats'
lv go last
lv column #2
lv move last
use lv #this 'idFormats2'
%user = '----'
endif
gosub #this countDBtotal
gosub #this updateChanges $lvid
prev = '$($$lv.total-1)'
use lv #this $lvid
lv go $pos
setEvent #this $lvid select
XTEXTBOX 405 4 130 25 "REMOVE SELECTED"
attr LIKE butta
local lvid/pos/temp
lvid = $$lv.id
if $lvid = 'idCodecs2'; stop; endif
if $lvid = 'idFormats2'; stop; endif
if '$%desc[0][7]' != 'REMOVED'
and $%user != 'REM'
msgbox 'This item is not removed from the $lvid[2] list below.   \nIf you want to delete items use <Ctrl><Del>.' WARN/OK
setEvent #this $lvid select
stop
endif
gosub #this confirm 'REMOVE SELECTED' $lvid
use lv #this $lvid
pos = $$lv.line
lv delete selected
lv go $pos
lv select
lv column #2
temp = 'rem$lvid[2]'
--$temp
update #this idRemFormats '| Removed: $remFormats' TRIGGER
update #this idRemCodecs '| Removed: $remCodecs' TRIGGER
gosub #this countDBtotal
setEvent #this $lvid select
XTEXTBOX 535 4 115 25 "SORT DATABASE"
attr LIKE butta
gosub #this confirm 'SORT DATABASE' $$lv.id
gosub #this sortDB
xRoutine sortDB
local lvid/flag
flag = 0
lvid = $$lv.id
if $lvid[0][8] = 'idCodecs'; lvid = 'idCodecs'; flag = 1; endif
if $lvid[0][9] = 'idFormats'; lvid = 'idFormats'; endif
use lv #this $lvid
lv go first
while $$lv.valid = 1
if $%name = ''; lv delete; endif
lv go next
endwhile
lv go first
if $flag = 1
lv sort #3
lv column #3
else
lv sort #2
lv column #2
endif
gosub #this countDBtotal
setEvent #this $lvid select
xRoutine confirm mode lvid
msgbox 'Please confirm  \"$mode\"  operation.     ' QUESTION/YESNO
setEvent #this $lvid select;
if $$choice = NO; stop; endif
xOnRMB
local ttemp/temp/maxlin/cnt
if $$click.id = id_help
gosub #this helpMenu
stop
endif
xRoutine helpMenu
local temp
quickmenu '$($$gui.left+500)' -1 '$ms/Commands FFmpeg/Formats - Codecs/$ms/Avisynth Help/$ms/Avanti Help/$ms/Cancel'
if $$choice = 1
run '$avanti_path/ffmpeg/commands1.txt' OPEN
elseif $$choice = 2
run '$avanti_path/ffmpeg/formats.txt' OPEN
elseif $$choice = 4
if $avanti.avs_doc_path = ''
msgbox 'You can set this button to the Avisynth help index.    \n\nDo yo want to browse for it ?' YESNO/INFO
if $$choice = YES
reqfile OPEN 'Browse for Avisynth Index.htm' 'c:' temp 'htm Index files/index.htm/All files/*.*'
if $temp = ''; stop; endif
avanti.avs_doc_path = $temp
endif
else
run '$avanti.avs_doc_path' OPEN
endif
elseif $$choice = 6
run '$avanti_path/avanti-help.chm' OPEN
endif
xRoutine generalMenu
quickmenu '$ms/Update Avanti database/$ms/Undo last database update/$ms/Exit Database Manager/$ms'
if $$choice = 1
gosub #this updateDatabase
elseif $$choice = 3
msgbox 'This will undo the last Database update.    \n\nDo you want to continue?' QUESTION/YESNO
if $$choice = NO; return; endif
av_restart = 1
guiclose avanti
pumpmessages
copy '$avanti_path/avsystem/backup/formats.bup' '$avanti_path/avsystem/formats.dat' SILENT/NOERROR/YESTOALL
copy '$avanti_path/avsystem/backup/codecs.bup' '$avanti_path/avsystem/codecs.dat' SILENT/NOERROR/YESTOALL
guiopen avanti
guiWindow #this front
guiWindow #this active
setEvent #this $lvIDglobal select
av_restart = 0
elseif $$choice = 5
guiclose #this
endif
xOnReturn INISET
tpl_load = 0
gosub #this loadSettings $iniPath
guiWindow #this refresh
xRoutine updateDatabase
msgbox 'This will update the current Avanti database.    \n\nDo you want to continue ?' QUESTION/YESNO
if $$choice = NO; return; endif
use lv #this idCodecs
lvRep 'REMOVED ' '' SENSITIVE
gosub #this sortDB
use lv #this idFormats
lvRep 'REM' '----' SENSITIVE
gosub #this sortDB
gosub #this countDBtotal
av_restart = 1
guiclose avanti
pumpmessages
saveini '$avanti_path/avsystem/codecs.tmp' CODECSTATS CodecsTotal
saveini '$avanti_path/avsystem/codecs.tmp' #EVENT avdbman/idCodecs
saveini '$avanti_path/avsystem/formats.tmp' FORMATSTATS FormatsTotal
saveini '$avanti_path/avsystem/formats.tmp' #EVENT avdbman/idFormats
copy '$avanti_path/avsystem/codecs.dat' '$avanti_path/avsystem/backup/codecs.bup' SILENT/NOERROR/YESTOALL
copy '$avanti_path/avsystem/formats.dat' '$avanti_path/avsystem/backup/formats.bup' SILENT/NOERROR/YESTOALL
pumpmessages
use lv #this idBuffer
lv load '$avanti_path/avsystem/codecs.tmp'
lvRep 'AVDBMAN' 'AVANTI' SENSETIVE
use lv #this idBuffer
lv save '$avanti_path/avsystem/codecs.dat'
use lv #this idBuffer
lv load '$avanti_path/avsystem/formats.tmp'
lvRep 'AVDBMAN' 'AVANTI' SENSETIVE
use lv #this idBuffer
lv save '$avanti_path/avsystem/formats.dat'
avcom32.deleteFile '$avanti_path/avsystem/codecs.tmp'
avcom32.deleteFile '$avanti_path/avsystem/formats.tmp'
guiopen avanti
guiWindow #this front
guiWindow #this active
setEvent #this $lvIDglobal select
av_restart = 0
xOnKey ^INSERT
if $$lv.valid = 0; stop; endif
if $$lv.id = idCodecs2; stop; endif
if $$lv.id = idFormats2; stop; endif
LVClip COPY SELECTED INSERT #this '$$lv.id'
setEvent #this $$lv.id select
pumpmessages
if $$lv.id = idCodecs
use lv #this $$lv.id
if $$lv.id = idCodecs; ++codecsTotal; endif
%name = '---';
%cotype = 'DE*SDT'; %codec = 'Codec name'
%user = 'unregistered'; %prio= 'Y'; %desc = 'user comment'
endif
if $$lv.id = idFormats
use lv #this $$lv.id
if $$lv.id = idFormats; ++formatsTotal; endif
if $$lv.id = idFormats2; ++formatsTotal2; endif
%name = '---'; %cotype = 'DE*'; 	%codec = '---';
%user = '----'; %prio = '1'; %desc = 'user comment';
endif
lv go next
lv column #2
sendKey '~'
sendKey '~'
setEvent #this $$lv.id refresh
gosub #this updateTotals
xOnKey ^DELETE
local lvid
if $$lv.valid = 0; stop; endif
if $$lv.id = idCodecs2; stop; endif
if $$lv.id = idFormats2; stop; endif
extract %desc CLEAN temp
if $temp[0][13] = 'Avanti system'; stop; endif
if $temp[0][7] = 'REMOVED'; stop; endif
extract %user CLEAN temp
if $temp[0][3] = 'REM'; stop; endif
lvid = $$lv.id
lv delete current
use lv #this $lvid
setEvent #this $lvid select
if $$lv.line < '$($$lv.total-1)'
lv go next
endif
lv select
if $$lv.id = idCodecs; --codecsTotal; endif
if $$lv.id = idFormats; --formatsTotal; endif
gosub #this updateTotals
XLISTVIEW 10 79 640 240 '' '' fformat
attr PAGE formats
attr ID idFormats
attr style edit/grid/owner
attr LVHEIGHT 1
attr font lv2font
attr frame sunken
attr lvcolumn '#Name/width/40/TITLE/Ext/TYPE/string'
attr lvcolumn 'cotype/width/60/TITLE/DE*SDT/TYPE/string'
attr lvcolumn 'codec/width/140/TITLE/File formats/TYPE/string'
attr lvcolumn 'user/width/43/TITLE/N.A./TYPE/string'
attr lvcolumn 'prio/width/25/TITLE/P/TYPE/string/JUSTIFY/center'
attr lvcolumn 'desc/width/325/TITLE/Description/TYPE/string'
XLISTVIEW 10 369 640 240 "" "" fformat2
attr PAGE formats
attr ID idFormats2
attr style edit/grid/owner
attr LVHEIGHT 1
attr font lv2font
attr frame sunken
attr lvcolumn '#Name/width/40/TITLE/Ext/TYPE/string'
attr lvcolumn 'cotype/width/60/TITLE/DE*SDT/TYPE/string'
attr lvcolumn 'codec/width/140/TITLE/File formats/TYPE/string'
attr lvcolumn 'user/width/43/TITLE/N.A./TYPE/string'
attr lvcolumn 'prio/width/25/TITLE/P/TYPE/string/JUSTIFY/center'
attr lvcolumn 'desc/width/325/TITLE/Description/TYPE/string'
xOnListview edit idFormats
use lv #this idFormats
gosub #this makeLine2
xOnListview edit idFormats2
use lv #this idFormats2
gosub #this makeLine2
xRoutine makeLine2
local temp
if $$lv.valid = 0; return; endif
if $$lv.column = 0; temp = '---'; endif
if $$lv.column = 1; temp = 'DE*'; endif
if $$lv.column = 2; temp = '---'; endif
if $$lv.column = 3; temp = '----'; endif
if $$lv.column = 4; temp = '1'; endif
if $$lv.column = 5; temp = 'user comment'; endif
if $$lv.text = ''; %$$lv.colname = $temp; return; endif
temp = $%cotype
appVar temp '      '
%cotype = $temp[0][3]
XLISTVIEW 10 79 640 240 '' '' fcodec
attr PAGE codecs
attr ID idCodecs
attr style edit/grid/owner
attr LVHEIGHT 1
attr font lv2font
attr frame sunken
attr lvcolumn '#Name/width/40/TITLE/Ext/TYPE/string'
attr lvcolumn 'cotype/width/60/TITLE/DE*SDT/TYPE/string'
attr lvcolumn 'codec/width/140/TITLE/FFmpeg codecs/TYPE/string'
attr lvcolumn 'user/width/120/TITLE/Codec label/TYPE/string'
attr lvcolumn 'prio/width/25/TITLE/M/TYPE/string/JUSTIFY/center'
attr lvcolumn 'desc/width/325/TITLE/Description/TYPE/string'
XLISTVIEW 10 369 640 240 "" "" "fcodec"
attr PAGE codecs
attr ID idCodecs2
attr style edit/grid/owner
attr LVHEIGHT 1
attr font lv2font
attr frame sunken
attr lvcolumn '#Name/width/40/TITLE/Ext/TYPE/string'
attr lvcolumn 'cotype/width/60/TITLE/DE*SDT/TYPE/string'
attr lvcolumn 'codec/width/140/TITLE/FFmpeg codecs/TYPE/string'
attr lvcolumn 'user/width/120/TITLE/Codec label/TYPE/string'
attr lvcolumn 'prio/width/25/TITLE/M/TYPE/string/JUSTIFY/center'
attr lvcolumn 'desc/width/325/TITLE/Description/TYPE/string'
xOnLVclick idCodecs
lvIDglobal = $$lv.id
lv select current
xOnLVclick idFormats
lvIDglobal = $$lv.id
lv select current
xOnLVclick idCodecs2
lvIDglobal = $$lv.id
lv select current
gosub #this searchNew
xOnLVclick idFormats2
lvIDglobal = $$lv.id
lv select current
gosub #this searchNew
xOnListview edit idCodecs
use lv #this idCodecs
gosub #this makeLine
xOnListview edit idCodecs2
use lv #this idCodecs2
gosub #this makeLine
xRoutine makeLine
local temp/clabel
if $$lv.valid = 0; return; endif
if $$lv.id = idCodecs; clabel = 'unregistered'; endif
if $$lv.id = idCodecs2; clabel = '------------'; endif
if $$lv.column = 0; temp = '---'; endif
if $$lv.column = 1; temp = 'DE*SDT'; endif
if $$lv.column = 2; temp = 'Codec name'; endif
if $$lv.column = 3; temp = '$clabel'; endif
if $$lv.column = 4; temp = 'Y'; endif
if $$lv.column = 5; temp = '---'; endif
if $$lv.text = ''; %$$lv.colname = $temp; return; endif
temp = $%cotype
appVar temp '      '
%cotype = $temp[0][6]
extract %name CLEAN
extract %user CLEAN
extract %codec CLEAN
extract %prio CLEAN
extract %desc CLEAN
xOnKey ^UP
if $$lv.valid = 0; stop; endif
gosub #this moveLine UP
xOnKey ^DOWN
if $$lv.valid = 0; stop; endif
if $$lv.line = '$($$lv.total-1)'; stop; endif
if $$lv.line = 1; gosub #this moveLine TOP ;stop; endif
gosub #this moveLine DOWN
xRoutine moveLine direc
local c1/c2/c3/c4/c5/c6/b1/b2/b3/b4/b5/b6
if $direc = TOP; lv go first; endif
b1 = $%name ; b2 = $%cotype ; b3 = $%codec ; b4 = $%user ; b5 = $%prio ; b6 = $%desc
if $direc = UP; lv go next; endif
if $direc = DOWN; lv go prev; endif
if $direc = TOP; lv go next; endif
c1 = $%name ; c2 = $%cotype ; c3 = $%codec ; c4 = $%user ; c5 = $%prio ; c6 = $%desc
%name = $b1 ; %cotype = $b2 ; %codec = $b3 ; %user = $b4 ; %prio = $b5 ; %desc = $b6
if $direc = UP; lv go prev; endif
if $direc = DOWN; lv go next; endif
if $direc = TOP; lv go prev; endif
%name = $c1 ; %cotype = $c2 ; %codec = $c3 ; %user = $c4 ; %prio = $c5 ; %desc = $c6
if $direc = TOP; lv select none; lv go #1; lv select #2; endif
xOnKey LEFT
lvField = $$lv.text
xOnKey RIGHT
lvField = $$lv.text
xOnKey UP
lvField = $$lv.text
use lv #this $lvIDglobal
gosub #this searchNew
xOnKey DOWN
lvField = $$lv.text
use lv #this $lvIDglobal
gosub #this searchNew
xOnLMB
if $$lv.valid = 1; lvField = $$lv.text; endif
xRoutine key_F8
if $extman = 1
gui page codecs
use lv #this idCodecs2
lv select current
setEvent #this idCodecs2 select
lvidGlobal = idCodecs2
extman = 0
else
gui page formats
use lv #this idFormats2
lv select current
setEvent #this idFormats2 select
lvidGlobal = idFormats2
extman = 1
endif
xRoutine key_F7
local temp
temp = $fman_path
extract temp UNQUOTE
update #this id_fmanstat ' $temp'
gui PAGE fman
extman = 1
xRoutine restoreMain
gui page codecs
use lv #this idCodecs2
lvidGlobal = idCodecs2
setEvent #this idCodecs2 select
pumpmessages
extman = 0
