# AVSLib :: 'base' package :: 'version' module
# Copyright (c) 2005 George Zarkadas (gzarkadas@users.sourceforge.net)

# 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; either 
# version 2 of the License, or (at your option) any later version.
# 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; 
# if not, write to the "Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA  02111-1307  USA"

DefineModule("avslib", "base", "version")

# Avisynth version numbers
global AVISYNTH_NUM_MAJOR = Int(VersionNumber())
global AVISYNTH_NUM_MINOR = Int(Value(MidStr(String(VersionNumber()), \
	FindStr(String(VersionNumber()), ".") + 1, 1)))
global AVISYNTH_NUM_PATCH = Int(Value(MidStr(String(VersionNumber()), \
	FindStr(String(VersionNumber()), ".") + 2, 1)))

# AVSLib version numbers
global AVSLIB_NUM_MAJOR = 1		# Major AVSLib version number
global AVSLIB_NUM_MINOR = 1		# Minor AVSLib version number
global AVSLIB_NUM_PATCH = 0		# Patch AVSLib version number

Function AVSLibVersionString() { 
	return "AVSLib - Version " + String(AVSLIB_NUM_MAJOR) + "." \
		+ String(AVSLIB_NUM_MINOR) + "." + String(AVSLIB_NUM_PATCH)
}

Function AVSLibVersionNumber() { 
	return AVSLIB_NUM_MAJOR + Float(10 * AVSLIB_NUM_MINOR + AVSLIB_NUM_PATCH) / 100
}

# Returns a clip with AVSLib's version and copyright information
Function AVSLibVersion() {
	c = BlankClip(width=440, height=44, color=$000000)

	s_ver = AVSLibVersionString()
	s_hpg = "Homepage:  http://avslib.sourceforge.net"
	s_cop = "Copyright (c) 2005, George Zarkadas (gzarkadas@users.sourceforge.net)"
	
	c_ver = c.SubTitle(s_ver, y=40, size=44, align=5)
	c_hpg = c.Crop(0,0,c.Width,28).SubTitle(s_hpg, y=22, size=24, align=5)
	c_cop = c.Crop(0,0,c.Width,18).SubTitle(s_cop, y=12, size=14, align=5)
	return StackVertical(c_ver, c_hpg, c_cop)
}
