 --*****************************************************************************
--* File: lua/modules/ui/uiutil.lua
--* Author: Chris Blackwell
--* Summary: Various utility functions to make UI scripts easier and more consistent
--*
--* Copyright © 2005 Gas Powered Games, Inc.  All rights reserved.
--*****************************************************************************

local LazyVar = import('/lua/lazyvar.lua')
local LayoutHelpers = import('/lua/maui/layouthelpers.lua')
local Group = import('/lua/maui/group.lua').Group
local Text = import('/lua/maui/text.lua').Text
local MultiLineText = import('/lua/maui/multilinetext.lua').MultiLineText
local Button = import('/lua/maui/button.lua').Button
local Edit = import('/lua/maui/edit.lua').Edit
local Checkbox = import('/lua/maui/Checkbox.lua').Checkbox
local Scrollbar = import('/lua/maui/scrollbar.lua').Scrollbar
local Bitmap = import('/lua/maui/bitmap.lua').Bitmap
local Cursor = import('/lua/maui/cursor.lua').Cursor
local Prefs = import('/lua/user/prefs.lua')
local Border = import('/lua/maui/border.lua').Border
local ItemList = import('/lua/maui/itemlist.lua').ItemList
local Layouts = import('/lua/skins/layouts.lua')

do
   local MyUnitIdTable = {
      #'uaa0309',--t3 trans
      #'ura0309',--t3 trans
      'ura0409',-- garg
      'xab5205',--t3 air stagin
      #'xaa0307',---removed
      #'xal0310',-- wraith
      'xas0308',-- t3 frigate
      'xaa0401',-- artemis
      #'xab2306',-- t3 PD
      'xeb5205',-- t3 air stagin
      'xel0307',-- juggie
      'xel0308',--rapier
      'xel0109',-- avenger
      'xel0109b',-- avenger
      'xel0109c',-- avenger
      'xel0401',-- goliath
      'xes0306',-- t3 frigate
      'xes0402',-- bismarck
      'xea0003',-- hellfire sat
      #'xrb2306',-- t3 pd
      'xrb5205',-- t3 air stagin
      'xrl0110',-- hydra
      'xrl0205',-- scorpion
      #'xrl0307',-- hailfire
      'xrl0308',-- Basilisk
      'xrl0308b',-- Basilisk
      'xrl0308c',-- Basilisk
      'xrb4401',-- cloak field gen
      #'xrs0304',-- reaper
      #'xrs0305',-- leviathan
      'xrs0306',-- t3 frigate
      'xrs0402',-- Seadragon
      'xrl0006',-- loyalist egg
      'xrl0007',-- scorpion egg
      'xrl0008',-- deciever egg
      'xrl0009',-- firebeetle egg
      'xrl0010',-- wagner egg
      #'xrl0011',-- hailfire egg
      #'xsa0001',-- Attack drone
      #'xsa0002',-- repair drone
      #'xsa0309',-- t3 trans
      #'xsa0310',-- t3 gunship
      'xsb2402',-- rift gate
      'xsb0405',-- lambda field gen
      'xsb5205',-- t3 air stagin
      'xsa0003',-- rift gate unit
      'xsl0002',-- rift gate unit
      'xsl0003',-- rift gate unit
      'xsl0004',-- rift gate unit
      'xsl0005',-- rift gate unit
      'xsl0006',-- rift gate unit
      'xsl0007',-- rift gate unit
      'xsl0310',-- rift gate unit
      'xss0306',-- t3 frigate
      'xss0401',-- Dreadnought
      'xsb0004',-- dreadnaught naval fac
      'drlk001',-- t3 Mobile AA
	  'drlk005',-- t3 Mobile AA egg
	  'delk002',-- t3 Mobile AA
	  'dalk003',-- t3 Mobile AA
	  'dslk004',-- t3 Mobile AA
	  'xsb5104',-- t1 air stagin
	  'xeb5102',-- t1 air stagin
	  'xrb5102',-- t1 air stagin
	  'xab5102',-- t1 air stagin
	  #'xab2210',-- t2 naval mine
	  #'xeb2210',-- t2 naval mine
	  #'xrb2210',-- t2 naval mine
	  #'xsb2210',-- t2 naval mine
   }
   --unit icon must be in /icons/units/. Put the full path to the /icons/ folder in here - note no / on the end!
   local MyIconPath = "/mods/BlackOps"
   local oldUIFile = UIFile
   function UIFile(filespec)
      for i, v in MyUnitIdTable do
         if string.find(filespec, v .. '_icon') then
            local curfile =  MyIconPath .. filespec
            if DiskGetFileInfo(curfile) then
               return curfile
            else
               WARN('Blueprint icon for unit '.. control.Data.id ..' could not be found, check your file path and icon names!')
            end
         end
      end
      return oldUIFile(filespec)
   end
end 