<commit_before>#define LINQ
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
using OpenTK.Graphics.ES11;

namespace GLPaintGameView
{
	public class Application
	{
		static void Main (string[] args)
		{
			UIApplication.Main (args);
		}
	}
	
	// The name AppDelegate is referenced in the MainWindow.xib file.
	public partial class AppDelegate : UIApplicationDelegate
	{
		const int PaletteHeight = 30;
		const int PaletteSize = 5;
		const int AccelerometerFrequency = 25;
		const float FilteringFactor = 0.1f;
		const float EraseAccelerationThreshold = 2.0f;

		static readonly TimeSpan MinEraseInterval = TimeSpan.FromSeconds (0.5);

		const float LeftMarginPadding = 10.0f;
		const float TopMarginPadding = 10.0f;
		const float RightMarginPadding = 10.0f;

		double[] myAccelerometer = new double [3];
		SoundEffect erasingSound = new SoundEffect (NSBundle.MainBundle.PathForResource ("Erase", "caf"));
		SoundEffect selectSound  = new SoundEffect (NSBundle.MainBundle.PathForResource ("Select", "caf"));
		DateTime lastTime;

		PaintingView drawingView;
		
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

			window.BackgroundColor = UIColor.Black;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new RectangleF (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			UISegmentedControl segmentedControl = new UISegmentedControl (new[]{
					UIImage.FromFile ("Images/Red.png"),
					UIImage.FromFile ("Images/Yellow.png"),
					UIImage.FromFile ("Images/Green.png"),
					UIImage.FromFile ("Images/Blue.png"),
					UIImage.FromFile ("Images/Purple.png"),
			});

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			RectangleF frame = new RectangleF (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			//segmentedControl.ControlStyle = UISegmentedControlStyle.Bar;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);<commit_msg>[GLPaint-GameView] Color picker issues in iOS7 fix, bug #14599<commit_after>#define LINQ
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using System.Drawing;
using OpenTK.Graphics.ES11;

namespace GLPaintGameView
{
	public class Application
	{
		static void Main (string[] args)
		{
			UIApplication.Main (args);
		}
	}
	
	// The name AppDelegate is referenced in the MainWindow.xib file.
	public partial class AppDelegate : UIApplicationDelegate
	{
		const int PaletteHeight = 30;
		const int PaletteSize = 5;
		const int AccelerometerFrequency = 25;
		const float FilteringFactor = 0.1f;
		const float EraseAccelerationThreshold = 2.0f;

		static readonly TimeSpan MinEraseInterval = TimeSpan.FromSeconds (0.5);

		const float LeftMarginPadding = 10.0f;
		const float TopMarginPadding = 10.0f;
		const float RightMarginPadding = 10.0f;

		double[] myAccelerometer = new double [3];
		SoundEffect erasingSound = new SoundEffect (NSBundle.MainBundle.PathForResource ("Erase", "caf"));
		SoundEffect selectSound  = new SoundEffect (NSBundle.MainBundle.PathForResource ("Select", "caf"));
		DateTime lastTime;

		PaintingView drawingView;
		
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

			window.BackgroundColor = UIColor.Black;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new RectangleF (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			var images = new[] {
				UIImage.FromFile ("Images/Red.png"),
				UIImage.FromFile ("Images/Yellow.png"),
				UIImage.FromFile ("Images/Green.png"),
				UIImage.FromFile ("Images/Blue.png"),
				UIImage.FromFile ("Images/Purple.png")
			};
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				// we want the original colors, which is not the default iOS7 behaviour, so we need to
				// replace them with ones having the right UIImageRenderingMode
				for (int i = 0; i < images.Length; i++)
					images [i] = images [i].ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
			}
			var segmentedControl = new UISegmentedControl (images);

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			var frame = new RectangleF (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
{'fraction_non_alphanumeric': 0.08585546633724521, 'fraction_numerical': 0.009882643607164917, 'mean_word_length': 4.068075117370892, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4298234', 'n_tokens_mistral': 2145, 'n_tokens_neox': 1854, 'n_words': 630}