diff --git a/StroopTest/Controllers/ExpositionController.cs b/StroopTest/Controllers/ExpositionController.cs index 2a8f2d0..2a65244 100644 --- a/StroopTest/Controllers/ExpositionController.cs +++ b/StroopTest/Controllers/ExpositionController.cs @@ -150,11 +150,12 @@ public static void BeginMatchingTest(string programName, string participantName, } } - public static PictureBox InitializeImageBox(int stimuliSize, Image image, bool expandImage) + public static PictureBox InitializeImageBox(double stimuliSize, Image image, bool expandImage, Form form) { PictureBox newPictureBox = new PictureBox(); + int size = CentimeterToPixel(stimuliSize, form); newPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; - newPictureBox.Size = new Size(stimuliSize, stimuliSize); + newPictureBox.Size = new Size(size, size); newPictureBox.Image = image; newPictureBox.Enabled = true; @@ -229,6 +230,16 @@ public static void formSecondScreen(Form form) } + public static int CentimeterToPixel(double Centimeter, Form form) + { + double pixel = -1; + using (Graphics g = form.CreateGraphics()) + { + pixel = Centimeter * g.DpiY / 2.54d; + } + return (int)pixel; + } + } } diff --git a/StroopTest/Models/Tests/Reaction/ReactionProgram.cs b/StroopTest/Models/Tests/Reaction/ReactionProgram.cs index a96e9a2..f1df946 100644 --- a/StroopTest/Models/Tests/Reaction/ReactionProgram.cs +++ b/StroopTest/Models/Tests/Reaction/ReactionProgram.cs @@ -9,7 +9,7 @@ namespace TestPlatform.Models { class ReactionProgram : Program { - private Int32 stimuluSize; // [3] + private double stimuluSize; // [3] private Boolean isBeeping; // [9] private Boolean beepingRandom; // [19] private Int32 beepDuration; // [10] @@ -43,7 +43,7 @@ public override string ToString() /// /// This constructor is used to create a reaction program with shapes /// - public ReactionProgram(string programName, int expositionTime, int numExpositions, int stimuluSize, int intervalTime, + public ReactionProgram(string programName, int expositionTime, int numExpositions, double stimuluSize, int intervalTime, bool isBeeping, int beepDuration, string stimulusColor, string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom, string stimuluShape, bool beepRandom, int numberPositions, @@ -102,7 +102,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition { // ReactionProgram properties this.expositionType = "words"; - this.stimuluSize = stimuluSize; + this.fontSize = stimuluSize; this.isBeeping = isBeeping; this.beepDuration = beepDuration; this.FontSize = fontSize; @@ -125,10 +125,11 @@ public ReactionProgram(string programName, int expositionTime, int numExposition this.setColorListFile(colorList); } - //default configurations for shapes version of ReactionProgram + //default configurations for words version of ReactionProgram this.setAudioListFile("false"); this.setImageListFile("false"); this.ExpandImage = false; + this.stimuluSize = 10; // Program properties this.programName = programName; @@ -146,7 +147,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition /// /// This constructor is used to create a reaction program with image type /// - public ReactionProgram(string programName, int expositionTime, int numExpositions, int stimuluSize, int intervalTime, + public ReactionProgram(string programName, int expositionTime, int numExpositions, double stimuluSize, int intervalTime, bool isBeeping, int beepDuration, string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom, string imageList, bool beepRandom, int numberPositions, @@ -188,7 +189,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition /// /// This constructor is used to create a reaction program with image and words /// - public ReactionProgram(string programName, int expositionTime, int numExpositions, int stimuluSize, int intervalTime, + public ReactionProgram(string programName, int expositionTime, int numExpositions, double stimuluSize, int intervalTime, bool isBeeping, int beepDuration, string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom, string imageList, string wordList, string colorList, bool beepRandom, int numberPositions, @@ -295,7 +296,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition /// public ReactionProgram(string programName, int expositionTime, int numExpositions, int intervalTime, string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom, int numberPositions, - string responseType, int stimulusSize, bool isExpositionRandom,string audioListFile, string imageListFile, bool expandImage, bool sstInterval) + string responseType, double stimulusSize, bool isExpositionRandom,string audioListFile, string imageListFile, bool expandImage, bool sstInterval) { // ReactionProgram properties @@ -331,7 +332,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition this.intervalTimeRandom = intervalTimeRandom; } - public int StimuluSize + public double StimuluSize { get { @@ -587,7 +588,7 @@ public void readProgramFile(string filepath) { NumExpositions = int.Parse(config[1]); ExpositionTime = int.Parse(config[2]); - StimuluSize = int.Parse(config[3]); + StimuluSize = double.Parse(config[3]); IntervalTime = int.Parse(config[4]); setWordListFile(config[5]); setColorListFile(config[6]); diff --git a/StroopTest/Views/MatchingPages/MatchingExposition.cs b/StroopTest/Views/MatchingPages/MatchingExposition.cs index 0c30137..cb5dc56 100644 --- a/StroopTest/Views/MatchingPages/MatchingExposition.cs +++ b/StroopTest/Views/MatchingPages/MatchingExposition.cs @@ -605,7 +605,7 @@ private void drawModel() else { modelControl = ExpositionController.InitializeImageBox(executingTest.ProgramInUse.StimuluSize, - Image.FromFile(matchingGroups.ElementAt(groupCounter).getModelName()), false); + Image.FromFile(matchingGroups.ElementAt(groupCounter).getModelName()), false, this); size = modelControl.Size; } @@ -650,7 +650,7 @@ private void drawStimulu() } else { - newStimulu = ExpositionController.InitializeImageBox(executingTest.ProgramInUse.StimuluSize, Image.FromFile(element), false); + newStimulu = ExpositionController.InitializeImageBox(executingTest.ProgramInUse.StimuluSize, Image.FromFile(element), false, this); newStimulu.Tag = element; size = modelControl.Size; } diff --git a/StroopTest/Views/ReactionPages/FormReactExposition.cs b/StroopTest/Views/ReactionPages/FormReactExposition.cs index 962a6f3..cd06803 100644 --- a/StroopTest/Views/ReactionPages/FormReactExposition.cs +++ b/StroopTest/Views/ReactionPages/FormReactExposition.cs @@ -477,7 +477,7 @@ private void drawWord() private void drawImage() { imgPictureBox = ExpositionController.InitializeImageBox(executingTest.ProgramInUse.StimuluSize, Image.FromFile(imagesList[imageCounter]), - executingTest.ProgramInUse.ExpandImage); + executingTest.ProgramInUse.ExpandImage, this); Point screenPosition = ScreenPosition(imgPictureBox.Size); imgPictureBox.Location = screenPosition; @@ -886,8 +886,9 @@ private Point randomScreenEightPositions(Size size) // draw on screen filled square stimulus private void drawFullSquareShape() { - float widthSquare = executingTest.ProgramInUse.StimuluSize; - float heightSquare = executingTest.ProgramInUse.StimuluSize; + int size = ExpositionController.CentimeterToPixel(executingTest.ProgramInUse.StimuluSize, this); + float widthSquare = size; + float heightSquare = size; SolidBrush myBrush = new SolidBrush(ColorTranslator.FromHtml(colorsList[colorCounter])); Graphics formGraphicsSquare = CreateGraphics(); @@ -906,8 +907,9 @@ private void drawFullSquareShape() private void drawSquareShape() { - float widthSquare = executingTest.ProgramInUse.StimuluSize; - float heightSquare = executingTest.ProgramInUse.StimuluSize; + int size = ExpositionController.CentimeterToPixel(executingTest.ProgramInUse.StimuluSize, this); + float widthSquare = size; + float heightSquare = size; Pen myPen = new Pen(ColorTranslator.FromHtml(colorsList[colorCounter])); Graphics formGraphicsSquare = CreateGraphics(); @@ -926,8 +928,9 @@ private void drawSquareShape() private void drawFullCircleShape() { - float widthEllipse = executingTest.ProgramInUse.StimuluSize; - float heightEllipse = executingTest.ProgramInUse.StimuluSize; + int size = ExpositionController.CentimeterToPixel(executingTest.ProgramInUse.StimuluSize, this); + float widthEllipse = size; + float heightEllipse = size; SolidBrush myBrush = new SolidBrush(ColorTranslator.FromHtml(colorsList[colorCounter])); Graphics formGraphicsEllipse = CreateGraphics(); @@ -946,8 +949,9 @@ private void drawFullCircleShape() private void drawCircleShape() { - float widthEllipse = executingTest.ProgramInUse.StimuluSize; - float heightEllipse = executingTest.ProgramInUse.StimuluSize; + int size = ExpositionController.CentimeterToPixel(executingTest.ProgramInUse.StimuluSize, this); + float widthEllipse = size; + float heightEllipse = size; Pen myPen = new Pen(ColorTranslator.FromHtml(colorsList[colorCounter])); Graphics formGraphicsEllipse = CreateGraphics(); @@ -1006,7 +1010,8 @@ private void drawFullTriangleShape() private Point[] createTrianglePoints() { int[] clientMiddle = { (ClientSize.Width / 2), (ClientSize.Height / 2) }; - int heightTriangle = executingTest.ProgramInUse.StimuluSize; + int size = ExpositionController.CentimeterToPixel(executingTest.ProgramInUse.StimuluSize, this); + int heightTriangle = size; Point screenPosition = this.ScreenPosition(new Size(heightTriangle, heightTriangle)); screenPosition.X -= heightTriangle / 3; screenPosition.Y += heightTriangle / 2; diff --git a/StroopTest/Views/ReactionPages/FormTRConfig.Designer.cs b/StroopTest/Views/ReactionPages/FormTRConfig.Designer.cs index 9032844..f34036a 100644 --- a/StroopTest/Views/ReactionPages/FormTRConfig.Designer.cs +++ b/StroopTest/Views/ReactionPages/FormTRConfig.Designer.cs @@ -100,7 +100,7 @@ private void InitializeComponent() this.beepingCheckbox = new System.Windows.Forms.CheckBox(); this.numExpoLabel = new System.Windows.Forms.Label(); this.numExpo = new System.Windows.Forms.NumericUpDown(); - this.wordSizeLabel = new System.Windows.Forms.Label(); + this.stimulusSizeLabel = new System.Windows.Forms.Label(); this.stimuluSize = new System.Windows.Forms.NumericUpDown(); this.instructionsLabel = new System.Windows.Forms.Label(); this.prgNameTextBox = new System.Windows.Forms.TextBox(); @@ -525,7 +525,7 @@ private void InitializeComponent() this.expositionGroupBox.Controls.Add(this.beepingCheckbox); this.expositionGroupBox.Controls.Add(this.numExpoLabel); this.expositionGroupBox.Controls.Add(this.numExpo); - this.expositionGroupBox.Controls.Add(this.wordSizeLabel); + this.expositionGroupBox.Controls.Add(this.stimulusSizeLabel); this.expositionGroupBox.Controls.Add(this.stimuluSize); resources.ApplyResources(this.expositionGroupBox, "expositionGroupBox"); this.expositionGroupBox.Name = "expositionGroupBox"; @@ -749,33 +749,29 @@ private void InitializeComponent() this.numExpo.Validating += new System.ComponentModel.CancelEventHandler(this.numExpo_Validating); this.numExpo.Validated += new System.EventHandler(this.numExpo_Validated); // - // wordSizeLabel + // stimulusSizeLabel // - resources.ApplyResources(this.wordSizeLabel, "wordSizeLabel"); - this.wordSizeLabel.Name = "wordSizeLabel"; + resources.ApplyResources(this.stimulusSizeLabel, "stimulusSizeLabel"); + this.stimulusSizeLabel.Name = "stimulusSizeLabel"; // // stimuluSize // + this.stimuluSize.DecimalPlaces = 2; this.stimuluSize.Increment = new decimal(new int[] { 2, 0, 0, - 0}); + 65536}); resources.ApplyResources(this.stimuluSize, "stimuluSize"); this.stimuluSize.Maximum = new decimal(new int[] { - 500, - 0, - 0, - 0}); - this.stimuluSize.Minimum = new decimal(new int[] { - 10, + 50, 0, 0, 0}); this.stimuluSize.Name = "stimuluSize"; this.toolTip.SetToolTip(this.stimuluSize, resources.GetString("stimuluSize.ToolTip")); this.stimuluSize.Value = new decimal(new int[] { - 50, + 1, 0, 0, 0}); @@ -893,7 +889,7 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox expositionGroupBox; private System.Windows.Forms.Label numExpoLabel; private System.Windows.Forms.NumericUpDown numExpo; - private System.Windows.Forms.Label wordSizeLabel; + private System.Windows.Forms.Label stimulusSizeLabel; private System.Windows.Forms.NumericUpDown stimuluSize; private System.Windows.Forms.Label instructionsLabel; private System.Windows.Forms.TextBox prgNameTextBox; diff --git a/StroopTest/Views/ReactionPages/FormTRConfig.cs b/StroopTest/Views/ReactionPages/FormTRConfig.cs index d5eadba..f7c9723 100644 --- a/StroopTest/Views/ReactionPages/FormTRConfig.cs +++ b/StroopTest/Views/ReactionPages/FormTRConfig.cs @@ -56,7 +56,7 @@ private void editProgram() intervalTime.Value = editProgram.IntervalTime; beepingCheckbox.Checked = editProgram.IsBeeping; beepDuration.Value = editProgram.BeepDuration; - stimuluSize.Value = editProgram.StimuluSize; + stimuluSize.Value = (decimal) editProgram.StimuluSize; fontSizeUpDown.Value = editProgram.FontSize; positionsBox.SelectedIndex = editProgram.NumberPositions - 1; expandImageCheck.Checked = editProgram.ExpandImage; @@ -383,7 +383,7 @@ private ReactionProgram configureNewProgram() // Program type "shapes" case 0: newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), - Convert.ToInt32(numExpo.Value), Convert.ToInt32(stimuluSize.Value), + Convert.ToInt32(numExpo.Value), Convert.ToDouble(stimuluSize.Value), Convert.ToInt32(intervalTime.Value), beepingCheckbox.Checked, Convert.ToInt32(beepDuration.Value), stimulusColorCheck(), @@ -394,7 +394,7 @@ private ReactionProgram configureNewProgram() // Program type "words" case 1: newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), - Convert.ToInt32(numExpo.Value), Convert.ToInt32(stimuluSize.Value), + Convert.ToInt32(numExpo.Value), Convert.ToInt32(fontSizeUpDown.Value), Convert.ToInt32(intervalTime.Value), beepingCheckbox.Checked, Convert.ToInt32(beepDuration.Value), stimulusColorCheck(), @@ -406,7 +406,7 @@ private ReactionProgram configureNewProgram() // Program type "images" case 2: - newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), Convert.ToInt32(numExpo.Value), Convert.ToInt32(stimuluSize.Value), + newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), Convert.ToInt32(numExpo.Value), Convert.ToDouble(stimuluSize.Value), Convert.ToInt32(intervalTime.Value), beepingCheckbox.Checked, Convert.ToInt32(beepDuration.Value), fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked, openImgListButton.Text, randomBeepCheck.Checked, Convert.ToInt32(positionsBox.Text), responseType(), isRandomExposition.Checked, @@ -415,7 +415,7 @@ private ReactionProgram configureNewProgram() // Program type "imageAndWord" case 3: - newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), Convert.ToInt32(numExpo.Value), Convert.ToInt32(stimuluSize.Value), + newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), Convert.ToInt32(numExpo.Value), Convert.ToDouble(stimuluSize.Value), Convert.ToInt32(intervalTime.Value), beepingCheckbox.Checked, Convert.ToInt32(beepDuration.Value), fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked, openImgListButton.Text, openWordListButton.Text, openColorListButton.Text, randomBeepCheck.Checked, @@ -437,7 +437,7 @@ private ReactionProgram configureNewProgram() case 5: newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), Convert.ToInt32(numExpo.Value), Convert.ToInt32(intervalTime.Value), fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked, Convert.ToInt32(positionsBox.Text), - responseType(), Convert.ToInt32(stimuluSize.Value), isRandomExposition.Checked, openAudioListButton.Text, + responseType(), Convert.ToDouble(stimuluSize.Value), isRandomExposition.Checked, openAudioListButton.Text, openImgListButton.Text, expandImageCheck.Checked, sstCheckBox.Checked); break; diff --git a/StroopTest/Views/ReactionPages/FormTRConfig.en-US.resx b/StroopTest/Views/ReactionPages/FormTRConfig.en-US.resx index a98cb9f..722f5cf 100644 --- a/StroopTest/Views/ReactionPages/FormTRConfig.en-US.resx +++ b/StroopTest/Views/ReactionPages/FormTRConfig.en-US.resx @@ -214,8 +214,8 @@ Color: Number of Attempts: - - Stimulus size: + + Stimulus size (cm): Instructions: @@ -230,7 +230,7 @@ Color: save - Font Size: + Font Size (pt): Fix Point diff --git a/StroopTest/Views/ReactionPages/FormTRConfig.es-ES.resx b/StroopTest/Views/ReactionPages/FormTRConfig.es-ES.resx index 98ed6c6..833feb4 100644 --- a/StroopTest/Views/ReactionPages/FormTRConfig.es-ES.resx +++ b/StroopTest/Views/ReactionPages/FormTRConfig.es-ES.resx @@ -213,8 +213,8 @@ Número de intentos: - - Tamaño del Estímulo: + + Tamaño del Estímulo (cm): Instrucciones: @@ -226,6 +226,6 @@ cancelar - Tamaño de Letra: + Tamaño de Letra (pt): \ No newline at end of file diff --git a/StroopTest/Views/ReactionPages/FormTRConfig.pt-BR.resx b/StroopTest/Views/ReactionPages/FormTRConfig.pt-BR.resx index a1dcfbb..4271645 100644 --- a/StroopTest/Views/ReactionPages/FormTRConfig.pt-BR.resx +++ b/StroopTest/Views/ReactionPages/FormTRConfig.pt-BR.resx @@ -214,8 +214,8 @@ Ponto: Número de Tentativas: - - Tamanho do Estímulo: + + Tamanho do Estímulo (cm): Instruções: @@ -230,7 +230,7 @@ Ponto: salvar - Tamanho da Fonte: + Tamanho da Fonte (pt): Ponto de Fixação diff --git a/StroopTest/Views/ReactionPages/FormTRConfig.resx b/StroopTest/Views/ReactionPages/FormTRConfig.resx index 2d5da26..7908460 100644 --- a/StroopTest/Views/ReactionPages/FormTRConfig.resx +++ b/StroopTest/Views/ReactionPages/FormTRConfig.resx @@ -1460,7 +1460,7 @@ Ponto: 2 - 144, 81 + 197, 81 3, 2, 3, 2 @@ -2096,38 +2096,38 @@ Ponto: 23 - + True - + NoControl - + 11, 55 - + 149, 17 - + 159 - + Tamanho do Estímulo: - - wordSizeLabel + + stimulusSizeLabel - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + expositionGroupBox - + 24 - 165, 52 + 199, 52 3, 2, 3, 2 @@ -2139,7 +2139,7 @@ Ponto: 3 - O valor está em pixels e deve estar entre 10 e 500. + O valor está em centímetros e deve estar entre 0,1 e 50 stimuluSize