--- G:\World of Warcraft\Interface\AddOns\Violation.old\Violation.lua	2007-07-01 13:35:45.750000000 +0100
+++ G:\World of Warcraft\Interface\AddOns\Violation\Violation.lua	2007-07-02 17:22:44.921875000 +0100
@@ -50,6 +50,9 @@
 local latestRevisionSeen
 local updateWarned
 
+local curSplit = 1
+local maxSplits = 10
+
 local runningModules = {}
 local runningModuleOrdering = {}
 local violationUsers = nil
@@ -332,6 +335,31 @@
 				Violation:UpdateTooltip()
 			end
 		},
+		splitspacer = {
+			type = "header",
+			name = " ",
+			order = 109.1,
+		},
+		split = {
+			type = "execute",
+			name = "Split",
+			desc = "Splits the current data",
+			func = "Split",
+			order = 109.2,
+		},
+		showSplit = {
+			type = "range",
+			name = "Show Split #",
+			desc = "Show Split #",
+			get = function()
+				return curSplit
+			end,
+			set = "ShowSplit",
+			min = 1,
+			max = maxSplits,
+			step = 1,
+			order = 109.3,
+		},
 		windowspacer = {
 			type = "header",
 			name = " ",
@@ -567,9 +595,10 @@
 -----------------------------------------------------------------------
 -- Module prototype
 -----------------------------------------------------------------------
-
+local emptyData = {}
 Violation.modulePrototype.version = -1
 Violation.modulePrototype.canBroadcast = true
+Violation.modulePrototype.emptyData = emptyData
 
 local incompatible = {}
 local registered = {}
@@ -658,11 +687,14 @@
 end
 
 function Violation.modulePrototype:Reset()
-	if type(self.data) == "table" then
-		self.data = del(self.data)
+	if not self.data then self.data = new() end
+	for i in ipairs(self.data) do
+		if type(self.data[i]) == "table" then
+			del(self.data[i])
+		end
+		self.data[i] = nil
 	end
-	self.data = new()
-	self.data[playerName] = 0
+	self.data[1] = false
 	if type( self.broadcast ) == "table" then
 		self.broadcast = del(self.broadcast)
 	end
@@ -700,9 +732,9 @@
 
 function Violation.modulePrototype:GetData(name)
 	if name then
-		return self.data[name]
+		return self.data[curSplit] and self.data[curSplit][name]
 	else
-		return self.data
+		return self.data[curSplit] or emptyData
 	end
 end
 
@@ -736,6 +768,22 @@
 	self:OnData(name, input, true)
 end
 
+function Violation.modulePrototype:Split()
+	table.insert(self.data, 1, false)
+	local splits = #self.data
+	if splits > maxSplits then
+		for i=splits, maxSplits+1, -1 do
+			if type(self.data[i]) == "table" then
+				del(self.data[i])
+			end
+			table.remove(self.data, i)
+		end
+	end
+	if type(self.OnSplit) == "function" then
+		self:OnSplit()
+	end
+end
+
 function Violation.modulePrototype:new(...) return new(...) end
 function Violation.modulePrototype:del(t) return del(t) end
 
@@ -785,10 +833,14 @@
 
 function Violation.modulePrototype:OnData(name, input, remote)
 	if name and input and input > 0 then
+		if not self.data[1] then
+			self.data[1] = new()
+			self.data[1][playerName] = 0
+		end
 		if not remote then
 			self.broadcast[name] = (self.broadcast[name] or 0) + input
 		end
-		self.data[name] = (self.data[name] or 0) + input
+		self.data[1][name] = (self.data[1][name] or 0) + input
 		self.dirty = true
 	end
 end
@@ -953,6 +1005,7 @@
 	self:SetIcon(grey)
 
 	playerName = UnitName("player")
+	emptyData[playerName] = 0	
 	
 	-- exports
 	self.options = options	
@@ -1114,6 +1167,26 @@
 	self:UpdateWindows()
 end
 
+function Violation:GetCurrentSplit()
+	return curSplit
+end
+
+function Violation:Split()
+	for index, modName in self:IterateRunningModules() do
+		local module = runningModules[modName]
+		module:Split()
+	end
+	self:UpdateDisplay()
+	self:UpdateWindows()
+end
+
+function Violation:ShowSplit(i)
+	if curSplit == i then return end
+	curSplit = (type(i) == "number") and i or 1
+	self:UpdateDisplay()
+	self:UpdateWindows()
+end
+
 local function checkCategory(cat)
 	if not cat or not violationCategories[cat] then
 		cat = "other"
@@ -3055,6 +3128,10 @@
 	if module then 
 		o.cachedShortDisplayName = module:GetShortDisplayName();
 		o.cachedDisplayName = module:GetDisplayName();
+		if curSplit > 1 then
+			o.cachedShortDisplayName = format("%s [%d]", o.cachedShortDisplayName, curSplit)
+			o.cachedDisplayName = format("%s [%d]", o.cachedDisplayName, curSplit)
+		end
 	end
 	
 	local f = self.frame
