require( "scripts/style.lua" );

SliderFont = {
  standardFont,
  16,
  BlackColor
};

-- Speed buttons Creation
ButtonX = 2;
ButtonY = kCenter;
ButtonXSpace = 100;

function AddInternalButtons( N )

	t = { SetStyle(TimeButtonStyle), BeginGroup() };

	local i;
	for i = 0,N-1 do
		local j=i+1;
		table.insert(t,
			InternalButton
      {
				name="button"..i,
				value = i,
				sound = "sounds/gui/selection/selection_vitesse_"..j..".ogg",
				--label="time"..i,
				y=ButtonY,
				x=ButtonX+(ButtonXSpace*i),
			}
		);
	end

	return Group(t);
end

MakeDialog
{
	-- Name the modal dialog
	name="speedmenu",
	Bitmap
	{
		image="backgrounds/speedmenu",
		x = kCenter,
		y = kCenter,
		
		SpeedWindow
		{
			x=0,y=0,w=kMax,h=kMax,
			
			Text
			{
				font = BookAntiquaTitle36Font,
				name = "speed",
				x=kCenter,y=35,w=kMax,h=kMax,
				flags = kHAlignCenter + kVAlignTop,
				label = "speed"
			};
			SetStyle( OptionsValidationButtonStyle );
			Button
			{
				x= 222,
				y= 250,
				--font = BookAntiquaStandardButtonFont,
				name="save",
				label="save",
				close = true,
				type=kPush,
				command=
          function()
            SaveTimeModifications();
          end
			},
      SetStyle( OptionsCancelButtonStyle );
      Button
      {
        x= 388,
        y= 250,
        --font = BookAntiquaStandardButtonFont,
        name="cancel",
        label="cancel",
        close = true,
        type=kPush,
        --command=
          --function()
          --  DoModal( "scripts/speed.lua" );
          --end
      },
      
      Bitmap
      {
        image = "slider/speedslider",
        x = kCenter,
        y = kCenter,
        
        ButtonSlider
        {
          name = "timeslider",
          x = 0,
          y = 0,
          w = kMax,
          h = kMax,
          
          slide_image = "buttons/buttonrunedown",
          
          SetStyle( TimeButtonStyle );
          AddInternalButtons( 5 );
        },
      },
		},
	},
}