From a374eca86ad88d2ece05dac662c75aebaf035770 Mon Sep 17 00:00:00 2001 From: Arucard1983 Date: Tue, 2 Jul 2019 14:51:16 +0100 Subject: [PATCH] Code cleanup to correct sentence on dialogs. As a little bonus, a big simplification on File>New event that don't reset the child window. --- src/ERYAPIXE.cpp | 24 +-- src/ERYAPIXEMainFrame.cpp | 233 ++++++-------------------- src/ERYAPIXEdialogDatabaseManager.cpp | 4 +- src/ERYAPIXEdialogRemark.cpp | 67 ++++++++ src/ERYAPIXEdialogRemark.h | 31 ++++ src/ERYAPIXEdialogSetup.cpp | 2 +- 6 files changed, 165 insertions(+), 196 deletions(-) create mode 100644 src/ERYAPIXEdialogRemark.cpp create mode 100644 src/ERYAPIXEdialogRemark.h diff --git a/src/ERYAPIXE.cpp b/src/ERYAPIXE.cpp index 795bb14..d893880 100644 --- a/src/ERYAPIXE.cpp +++ b/src/ERYAPIXE.cpp @@ -75,7 +75,7 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co menuDatabase = new wxMenu(); wxMenuItem* menuDatabaseDetector; - menuDatabaseDetector = new wxMenuItem( menuDatabase, wxID_ANY, wxString( wxT("Detector Eficiency") ) , wxEmptyString, wxITEM_NORMAL ); + menuDatabaseDetector = new wxMenuItem( menuDatabase, wxID_ANY, wxString( wxT("Detector Efficiency") ) , wxEmptyString, wxITEM_NORMAL ); menuDatabase->Append( menuDatabaseDetector ); wxMenuItem* menuDatabaseElements; @@ -148,7 +148,7 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co labelStoichiometricGuess->SetFont(TableFont); sizerButtons->Add( labelStoichiometricGuess, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - labelYieldSimulation = new wxStaticText(scrollButtons, wxID_ANY, wxT("Yield\nInitial Guess"), wxDefaultPosition, wxDefaultSize, 0 ); + labelYieldSimulation = new wxStaticText(scrollButtons, wxID_ANY, wxT("Theoretical\nYield"), wxDefaultPosition, wxDefaultSize, 0 ); labelYieldSimulation->Wrap( -1 ); labelYieldSimulation->SetFont(TableFont); sizerButtons->Add( labelYieldSimulation, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -163,12 +163,12 @@ MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, co labelYieldFitted->SetFont(TableFont); sizerButtons->Add( labelYieldFitted, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - labelStoichiometricFitted = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fitted\nComposition"), wxDefaultPosition, wxDefaultSize, 0 ); + labelStoichiometricFitted = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fitted Atomic\nComposition"), wxDefaultPosition, wxDefaultSize, 0 ); labelStoichiometricFitted->Wrap( -1 ); labelStoichiometricFitted->SetFont(TableFont); sizerButtons->Add( labelStoichiometricFitted, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - labelStoichiometricMass = new wxStaticText( scrollButtons, wxID_ANY, wxT("Composition\nFitted Mass"), wxDefaultPosition, wxDefaultSize, 0 ); + labelStoichiometricMass = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fitted Mass\nComposition"), wxDefaultPosition, wxDefaultSize, 0 ); labelStoichiometricMass->Wrap( -1 ); labelStoichiometricMass->SetFont(TableFont); sizerButtons->Add( labelStoichiometricMass, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); @@ -987,7 +987,7 @@ dialogZieglerParameters::dialogZieglerParameters( wxWindow* parent, wxWindowID i lineZieglerTables = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); sizerZieglerParameters->Add( lineZieglerTables, 0, wxEXPAND | wxALL, 5 ); - labelZieglerFunction = new wxStaticText( this, wxID_ANY, wxT("To override the built-in Ziegler Functions and SRIM tables, while reading the tables values, you can insert on the box blow, a custom ERYA macro function (See \"Help\" for more details)."), wxDefaultPosition, wxDefaultSize, 0 ); + labelZieglerFunction = new wxStaticText( this, wxID_ANY, wxT("To override the built-in Ziegler Functions and SRIM tables, while reading the tables values, you can insert on the box blow, a custom ERYA macro function (Read the manual for more details)."), wxDefaultPosition, wxDefaultSize, 0 ); labelZieglerFunction->Wrap( -1 ); sizerZieglerParameters->Add( labelZieglerFunction, 1, wxALL|wxEXPAND, 5 ); @@ -1038,7 +1038,7 @@ dialogZieglerParameters::dialogZieglerParameters( wxWindow* parent, wxWindowID i tableZieglerSRIM->EnableDragColSize( true ); tableZieglerSRIM->SetColLabelSize( 30 ); tableZieglerSRIM->SetColLabelValue( 0, wxT("Energy (keV)") ); - tableZieglerSRIM->SetColLabelValue( 1, wxT("Stopping Power (ev*10^15 atm/cm^2)") ); + tableZieglerSRIM->SetColLabelValue( 1, wxT("Stopping Power (eV*10^15 at/cm^2)") ); tableZieglerSRIM->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); // Rows @@ -1331,7 +1331,7 @@ wizardFirstRun::wizardFirstRun( wxWindow* parent, wxWindowID id, const wxString& wxBoxSizer* sizerFirstRun2; sizerFirstRun2 = new wxBoxSizer( wxVERTICAL ); - labelFirstRun2 = new wxStaticText( wizardFirstRun2, wxID_ANY, wxT("Select the Detector Efficiency Profile file, from the widget below.\n\nNote: It will only support native ERYA Bulk files.\nIf you had another file formats, \nplease use the Database Management tools to convert them first.\n\nIf necessary, read the User Guide before proceding."), wxDefaultPosition, wxDefaultSize, 0 ); + labelFirstRun2 = new wxStaticText( wizardFirstRun2, wxID_ANY, wxT("Select the Detector Efficiency Profile file, from the widget below.\n\nNote: It will only support native ERYA Bulk files.\nIf you had another file formats, \nplease use the Database Management tools to convert them first.\n\nIf necessary, read the User Guide before proceeding."), wxDefaultPosition, wxDefaultSize, 0 ); labelFirstRun2->Wrap( -1 ); sizerFirstRun2->Add( labelFirstRun2, 1, wxALL|wxEXPAND, 5 ); @@ -1348,7 +1348,7 @@ wizardFirstRun::wizardFirstRun( wxWindow* parent, wxWindowID id, const wxString& wxBoxSizer* sizerFirstRun3; sizerFirstRun3 = new wxBoxSizer( wxVERTICAL ); - labelFirstRun3 = new wxStaticText( wizardFirstRun3, wxID_ANY, wxT("Select the Elements Database compatible with ERYA Bulk, from the widget below.\n\nNote: If you have Databases from LabView ERYA,\nplease use the \"Import LabView ERYA\" wizard first to convert them.\n\nIf necessary, read the User Guide for further details."), wxDefaultPosition, wxDefaultSize, 0 ); + labelFirstRun3 = new wxStaticText( wizardFirstRun3, wxID_ANY, wxT("Select the Elements Database compatible with ERYA Bulk, from the widget below.\n\nNote: It will only support native ERYA Bulk files.\nIf you had another file formats, \nplease use the Database Management tools to convert them first.\n\nIf necessary, read the User Guide before proceeding."), wxDefaultPosition, wxDefaultSize, 0 ); labelFirstRun3->Wrap( -1 ); sizerFirstRun3->Add( labelFirstRun3, 1, wxALL|wxEXPAND, 5 ); @@ -1365,7 +1365,7 @@ wizardFirstRun::wizardFirstRun( wxWindow* parent, wxWindowID id, const wxString& wxBoxSizer* sizerFirstRun4; sizerFirstRun4 = new wxBoxSizer( wxVERTICAL ); - labelFirstRun4 = new wxStaticText( wizardFirstRun4, wxID_ANY, wxT("Select a compatible ERYA Ziegler Parameters file,\nfrom the widget below.\n\nNote: Use the Database Management tools to convert the LabView ERYA file formats if necessary, before continue.\n\nPlease read the User Guide, before continue."), wxDefaultPosition, wxDefaultSize, 0 ); + labelFirstRun4 = new wxStaticText( wizardFirstRun4, wxID_ANY, wxT("Select a compatible ERYA Ziegler Parameters file,\nfrom the widget below.\n\nNote: It will only support native ERYA Bulk files.\nIf you had another file formats, \nplease use the Database Management tools to convert them first.\n\nIf necessary, read the User Guide before proceeding."), wxDefaultPosition, wxDefaultSize, 0 ); labelFirstRun4->Wrap( -1 ); sizerFirstRun4->Add( labelFirstRun4, 1, wxALL|wxEXPAND, 5 ); @@ -1382,7 +1382,7 @@ wizardFirstRun::wizardFirstRun( wxWindow* parent, wxWindowID id, const wxString& wxBoxSizer* sizerFirstRun5; sizerFirstRun5 = new wxBoxSizer( wxVERTICAL ); - labelFirstRun5 = new wxStaticText( wizardFirstRun5, wxID_ANY, wxT("Select where the ERYA Bulk Configuration file should be placed.\n\nThe default Databases will also be placed at the same Configuration directory.\n\nThe recomended setting is to choose the default folder defined by the operating system itself.\n\nRead the manual for more information."), wxDefaultPosition, wxDefaultSize, 0 ); + labelFirstRun5 = new wxStaticText( wizardFirstRun5, wxID_ANY, wxT("Select where the ERYA Bulk Configuration file should be placed.\n\nThe default Databases will also be placed at the same Configuration directory.\n\nThe recommended setting is to choose the default folder defined by the operating system itself.\n\nRead the manual for more information."), wxDefaultPosition, wxDefaultSize, 0 ); labelFirstRun5->Wrap( -1 ); sizerFirstRun5->Add( labelFirstRun5, 1, wxALL|wxEXPAND, 5 ); @@ -1402,7 +1402,7 @@ wizardFirstRun::wizardFirstRun( wxWindow* parent, wxWindowID id, const wxString& wxBoxSizer* sizerFirstRun6; sizerFirstRun6 = new wxBoxSizer( wxVERTICAL ); - labelFirstRun6 = new wxStaticText( wizardFirstRun6, wxID_ANY, wxT("ERYA Bulk Setup Complete!\n\nThe default configuration file was stored, and the default Databases will be loaded automatically at next start-ups.\n\nYou can reset the configurations using the \"Reset Settings\" option menu, and it will repeat the same process again."), wxDefaultPosition, wxDefaultSize, 0 ); + labelFirstRun6 = new wxStaticText( wizardFirstRun6, wxID_ANY, wxT("ERYA Bulk Setup Complete!\n\nThe configuration file are created, and the default Databases will be loaded automatically at next start-ups.\n\nYou can reset the configurations using the \"Reset Settings\" option menu, that will repeat the same process again."), wxDefaultPosition, wxDefaultSize, 0 ); labelFirstRun6->Wrap( -1 ); sizerFirstRun6->Add( labelFirstRun6, 1, wxALL|wxEXPAND, 5 ); @@ -1475,7 +1475,7 @@ dialogAdvancedFit::dialogAdvancedFit( wxWindow* parent, wxWindowID id, const wxS spinYieldConvergence = new wxSpinCtrl( this, wxID_ANY, wxT("3"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 6, 3 ); sizerAdvancedOptions->Add( spinYieldConvergence, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); - labelStoichiometryConvergence = new wxStaticText( this, wxID_ANY, wxT("Stoichiometry Convergence Criteria, in Number of Significant Digits"), wxDefaultPosition, wxDefaultSize, 0 ); + labelStoichiometryConvergence = new wxStaticText( this, wxID_ANY, wxT("Composition Convergence Criteria, in Number of Significant Digits"), wxDefaultPosition, wxDefaultSize, 0 ); labelStoichiometryConvergence->Wrap( -1 ); sizerAdvancedOptions->Add( labelStoichiometryConvergence, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); diff --git a/src/ERYAPIXEMainFrame.cpp b/src/ERYAPIXEMainFrame.cpp index 1531ad6..0c56f78 100644 --- a/src/ERYAPIXEMainFrame.cpp +++ b/src/ERYAPIXEMainFrame.cpp @@ -45,41 +45,37 @@ void ERYAPIXEMainFrame::OnFileNew( wxCommandEvent& event ) wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Do you want to clear all current contents?"), wxT("New file?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); if (dial->ShowModal() == wxID_YES) { - for(int k=0; kSetValue(1); + this->GenerateTable(1); + this->GenerateLog(); + if(OpenDatabase.RebuildElementGammaMenu(choiceElement.Item(0), choiceGP.Item(0), 0)) { - choiceElement.Item(k)->SetSelection(0); - choiceGP.Item(k)->SetSelection(0); + choiceElement.Item(0)->SetSelection(0); + choiceGP.Item(0)->SetSelection(0); } - checkFit.Item(k)->SetValue(false); - textZ.Item(k)->Clear(); - textCP.Item(k)->Clear(); - textCP.Item(k)->SetValue(wxT("1")); - textSG.Item(k)->Clear(); - textYS.Item(k)->Clear(); - textYE.Item(k)->Clear(); - textYF.Item(k)->Clear(); - textSF.Item(k)->Clear(); - textSM.Item(k)->Clear(); - textSE.Item(k)->Clear(); - textMinimumEnergy->Clear(); - textMaximumEnergy->Clear(); - textStepSize->Clear(); - textCharge->Clear(); - textThickness->Clear(); - textMinimumEnergy->SetValue(wxT("0")); - textStepSize->SetValue(wxT("1")); - textDetectorAngle->SetValue(wxT("1")); - textCharge->SetValue(wxT("1")); - textThickness->SetValue(wxT("0")); - } + choiceElement.Item(0)->SetSelection(0); + choiceGP.Item(0)->SetSelection(0); + checkFit.Item(0)->SetValue(false); + textZ.Item(0)->Clear(); + textCP.Item(0)->Clear(); + textSG.Item(0)->Clear(); + textYS.Item(0)->Clear(); + textYE.Item(0)->Clear(); + textYF.Item(0)->Clear(); + textSF.Item(0)->Clear(); + textSM.Item(0)->Clear(); + textSE.Item(0)->Clear(); renderYield->DelAllLayers(false,true); renderStoichiometry->DelAllLayers(false,true); renderError->DelAllLayers(false,true); renderDetectorFitting->DelAllLayers(false,true); SucefulFit = false; barMainStatus->SetStatusText(wxT("ERYA is Ready...") ,0); + // A little hack to clean the table + int i = choiceElement.Item(0)->GetSelection(); + int j = choiceGP.Item(0)->GetSelection(); + wxString temp = wxT("Yield ") + choiceElement.Item(0)->GetString(i) + wxT(" (") + choiceGP.Item(0)->GetString(j) + wxT(" keV)"); + tableLogProfiling->SetColLabelValue(1,temp); } } @@ -93,137 +89,13 @@ wxFileDialog *OpenDialog = new wxFileDialog(this, wxT("Select a ERYA Yield file wxArrayString ListElement,ListGammaPeak,ListFit,ListZ,ListCP,ListSG,ListYS,ListYE,ListYF,ListSF,ListSM,ListSE,ProfilingDataTable; if(file.ERYAPIXEFileLoad(textMinimumEnergy, textMaximumEnergy, textStepSize, textDetectorAngle, textCharge, textThickness, ListElement, ListGammaPeak, ListFit, ListZ, ListCP, ListSG, ListYS, ListYE, ListYF, ListSF, ListSM, ListSE, ProfilingDataTable, OpenDatabase, IterationSum, FitIterations, LogTau, LogStoichiometry, LogYield)) { - // Clear the current screen - choiceElement.Clear(); - choiceGP.Clear(); - checkFit.Clear(); - textZ.Clear(); - textCP.Clear(); - textSG.Clear(); - textYS.Clear(); - textYE.Clear(); - textYF.Clear(); - textSF.Clear(); - textSM.Clear(); - textSE.Clear(); - sizerButtons->Clear(true); // It need to be true to erase all child attachments! - int NumberElements = ListElement.GetCount(); - - // Rebuild the labels - - wxFont TableFont(70, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString, wxFONTENCODING_DEFAULT); - - labelElements = new wxStaticText( scrollButtons, wxID_ANY, wxT("Element"), wxDefaultPosition, wxDefaultSize, 0 ); - labelElements->Wrap( -1 ); - labelElements->SetFont(TableFont); - sizerButtons->Add( labelElements, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelGammaPeak = new wxStaticText( scrollButtons, wxID_ANY, wxT("Gamma Peak (keV)"), wxDefaultPosition, wxDefaultSize, 0 ); - labelGammaPeak->Wrap( -1 ); - labelGammaPeak->SetFont(TableFont); - sizerButtons->Add( labelGammaPeak, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelFit = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fit"), wxDefaultPosition, wxDefaultSize, 0 ); - labelFit->Wrap( -1 ); - labelFit->SetFont(TableFont); - sizerButtons->Add( labelFit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelZ = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fixed Ratio\nGroup Number"), wxDefaultPosition, wxDefaultSize, 0 ); - labelZ->Wrap( -1 ); - labelZ->SetFont(TableFont); - sizerButtons->Add( labelZ, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelElementCalibrationParameter = new wxStaticText( scrollButtons, wxID_ANY, wxT("Cross-Section\nCalibration Parameter"), wxDefaultPosition, wxDefaultSize, 0 ); - labelElementCalibrationParameter->Wrap( -1 ); - labelElementCalibrationParameter->SetFont(TableFont); - sizerButtons->Add( labelElementCalibrationParameter, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelStoichiometricGuess = new wxStaticText( scrollButtons, wxID_ANY, wxT("Stoichiometric\nInitial Guess"), wxDefaultPosition, wxDefaultSize, 0 ); - labelStoichiometricGuess->Wrap( -1 ); - labelStoichiometricGuess->SetFont(TableFont); - sizerButtons->Add( labelStoichiometricGuess, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelYieldSimulation = new wxStaticText(scrollButtons, wxID_ANY, wxT("Yield\nInitial Guess"), wxDefaultPosition, wxDefaultSize, 0 ); - labelYieldSimulation->Wrap( -1 ); - labelYieldSimulation->SetFont(TableFont); - sizerButtons->Add( labelYieldSimulation, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelYieldExperimental = new wxStaticText( scrollButtons, wxID_ANY, wxT("Experimental\nYield"), wxDefaultPosition, wxDefaultSize, 0 ); - labelYieldExperimental->Wrap( -1 ); - labelYieldExperimental->SetFont(TableFont); - sizerButtons->Add( labelYieldExperimental, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelYieldFitted = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fitted\nYield"), wxDefaultPosition, wxDefaultSize, 0 ); - labelYieldFitted->Wrap( -1 ); - labelYieldFitted->SetFont(TableFont); - sizerButtons->Add( labelYieldFitted, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelStoichiometricFitted = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fitted\nStoichiometry"), wxDefaultPosition, wxDefaultSize, 0 ); - labelStoichiometricFitted->Wrap( -1 ); - labelStoichiometricFitted->SetFont(TableFont); - sizerButtons->Add( labelStoichiometricFitted, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelStoichiometricMass = new wxStaticText( scrollButtons, wxID_ANY, wxT("Stoichiometric\nFitted Mass"), wxDefaultPosition, wxDefaultSize, 0 ); - labelStoichiometricMass->Wrap( -1 ); - labelStoichiometricMass->SetFont(TableFont); - sizerButtons->Add( labelStoichiometricMass, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - labelStoichiometricError = new wxStaticText( scrollButtons, wxID_ANY, wxT("Fitting\nError"), wxDefaultPosition, wxDefaultSize, 0 ); - labelStoichiometricError->Wrap( -1 ); - labelStoichiometricError->SetFont(TableFont); - sizerButtons->Add( labelStoichiometricError, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - // Complete additional global variables - choiceElementChoices = OpenDatabase.GetAllListElements(); - choiceGPChoices = OpenDatabase.GetAllListGammaPeaks(choiceElementChoices.Item(0)); - spinNumberElements->SetValue(NumberElements); - - // Build the new tab - for (int k=0; kSetSelection( 0 ); - sizerButtons->Add( choiceElement.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - choiceGP.Add(new wxChoice( scrollButtons, wxID_ANY, wxDefaultPosition, wxSize(120,-1), choiceGPChoices, 0 )); - choiceGP.Last()->SetSelection( 0 ); - sizerButtons->Add( choiceGP.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + // Clear screen and allocate room for the loaded file - checkFit.Add(new wxCheckBox( scrollButtons, wxID_ANY, wxT("Fit ?"), wxDefaultPosition, wxDefaultSize, 0 )); - sizerButtons->Add( checkFit.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textZ.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListZ.Item(k), wxDefaultPosition, wxSize(120,-1), 0 )); - sizerButtons->Add( textZ.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + int NumberElements = ListElement.GetCount(); + spinNumberElements->SetValue(NumberElements); + this->GenerateTable(NumberElements); - textCP.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListCP.Item(k), wxDefaultPosition, wxSize(120,-1), 0 )); - sizerButtons->Add( textCP.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textSG.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListSG.Item(k), wxDefaultPosition, wxSize(120,-1), 0 )); - sizerButtons->Add( textSG.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textYS.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListYS.Item(k), wxDefaultPosition, wxSize(120,-1), wxTE_READONLY )); - sizerButtons->Add( textYS.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textYE.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListYE.Item(k), wxDefaultPosition, wxSize(120,-1), 0 )); - sizerButtons->Add( textYE.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textYF.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListYF.Item(k), wxDefaultPosition, wxSize(120,-1), wxTE_READONLY )); - sizerButtons->Add( textYF.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textSF.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListSF.Item(k), wxDefaultPosition, wxSize(120,-1), wxTE_READONLY )); - sizerButtons->Add( textSF.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textSM.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListSM.Item(k), wxDefaultPosition, wxSize(120,-1), wxTE_READONLY )); - sizerButtons->Add( textSM.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - textSE.Add(new wxTextCtrl( scrollButtons, wxID_ANY, ListSE.Item(k), wxDefaultPosition, wxSize(120,-1), wxTE_READONLY )); - sizerButtons->Add( textSE.Last(), 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - choiceElement.Item(k)->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( ERYAPIXEMainFrame::OnElement ), NULL, this ); - choiceGP.Item(k)->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( ERYAPIXEMainFrame::OnGammaPeak ), NULL, this ); - - } // Set the correct values for the pull-downs menus, and also for the check-box for (int k=0; kFindString(ListGammaPeak.Item(k)); choiceGP.Item(k)->SetSelection(GammaPosition); } + if(ListFit.Item(k) == wxT("0")) checkFit.Item(k)->SetValue(false); else checkFit.Item(k)->SetValue(true); - } - - // Redraw the new elements on screen - scrollButtons->SetSizer( sizerButtons ); - scrollButtons->Layout(); - sizerButtons->Fit( scrollButtons ); - tabElements->SetSizer( sizerElements ); - tabElements->Layout(); - sizerElements->Fit( tabElements ); - // Win32 API require external sizer refitting to correctly redraw the Elements tab, unlike the GTK which is irrelevant. - this->SetSizer( sizerMainFrame ); - this->Layout(); + textZ.Item(k)->SetValue(ListZ.Item(k)); + textCP.Item(k)->SetValue(ListCP.Item(k)); + textSG.Item(k)->SetValue(ListSG.Item(k)); + textYS.Item(k)->SetValue(ListYS.Item(k)); + textYE.Item(k)->SetValue(ListYE.Item(k)); + textYF.Item(k)->SetValue(ListYF.Item(k)); + textSF.Item(k)->SetValue(ListSF.Item(k)); + textSM.Item(k)->SetValue(ListSM.Item(k)); + textSE.Item(k)->SetValue(ListSE.Item(k)); + } //Fill the Profiling table this->GenerateLog(); @@ -265,7 +136,7 @@ wxFileDialog *OpenDialog = new wxFileDialog(this, wxT("Select a ERYA Yield file tableLogProfiling->SetCellValue(i,j,ProfilingDataTable.Item(k)); } - + // Delete previous renders barMainStatus->SetStatusText(wxT("File loaded successfully..."),0); renderDetectorFitting->DelAllLayers(false,true); renderError->DelAllLayers(false,true); @@ -273,7 +144,7 @@ wxFileDialog *OpenDialog = new wxFileDialog(this, wxT("Select a ERYA Yield file renderYield->DelAllLayers(false,true); // Make an optional recalculation - wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Do you want to reavaluate the sample defined by this file?\nYou can press \"Run\" later if necessary..."), wxT("Reavaluate the loaded file?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Do you want to reevaluate the sample defined by this file?\nYou can press \"Run\" later if necessary..."), wxT("Reevaluate the loaded file?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); if(dial->ShowModal() == wxID_YES) { // Store the elements as arrays @@ -344,7 +215,7 @@ wxFileDialog *OpenDialog = new wxFileDialog(this, wxT("Select a ERYA Yield file if(SucefulFit) { barMainStatus->SetStatusText(wxT("Fitting Requires ") + wxString::Format( "%i" , MainReactionYield.GetNumberIteractions()) + wxT(" steps..."),0); - wxMessageDialog *dialcopy = new wxMessageDialog(NULL, wxT("Fitting was sucefull within ") + wxString::Format( "%i" , MainReactionYield.GetNumberIteractions()) + wxT(" steps...\n") + wxT("Do you want to update the original stoichiometry guess to the fitted stoichiometry ?") , wxT("Copy the Fitting Stoichiometry to Guess Stoichiometry?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); + wxMessageDialog *dialcopy = new wxMessageDialog(NULL, wxT("Fitting was successful within ") + wxString::Format( "%i" , MainReactionYield.GetNumberIteractions()) + wxT(" steps...\n") + wxT("Do you want to update the original stoichiometry guess to the fitted stoichiometry ?") , wxT("Copy the Fitting Stoichiometry to Guess Stoichiometry?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); if(dialcopy->ShowModal() == wxID_YES) { for(int z=0; zStartUpProgram()) { barMainStatus->SetStatusText(wxT("ERYA-Bulk is ready...") ,0); - wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("A new ERYA-Bulk Configuration was done!\nThe new settings are now in use!"), wxT("Reset Complete!"), wxOK); + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("The new ERYA-Bulk configuration file are in use.\nThe new default databases are also reloaded automatically."), wxT("Reset Complete!"), wxOK); dial->ShowModal(); } else @@ -664,7 +535,7 @@ void ERYAPIXEMainFrame::OnDatabaseSetup( wxCommandEvent& event ) void ERYAPIXEMainFrame::OnHelpAbout( wxCommandEvent& event ) { - wxMessageBox(wxT("Current Build Version 4.30\nBuilt with wxWidgets 3.0.4, with wxMathPlot 0.13\nand Custom Simple Xlsx File Library\n(c) 2018 LIBPHYS"), wxT("Welcome to ERYA")); + wxMessageBox(wxT("Current Build Version 4.30\nBuilt with wxWidgets 3.0.4, with wxMathPlot 0.13\nand Custom Simple Xlsx File Library\n(c) 2019 LIBPHYS"), wxT("Welcome to ERYA")); } void ERYAPIXEMainFrame::OnElement( wxCommandEvent& event ) @@ -791,7 +662,7 @@ if( IsDatabaseEmpty(OpenDatabase) || IsDetectorEmpty(CurrentDetectorParameters) if(SucefulFit) { barMainStatus->SetStatusText(wxT("Fitting Requires ") + wxString::Format( "%i" , MainReactionYield.GetNumberIteractions()) + wxT(" steps..."),0); - wxMessageDialog *dialcopy = new wxMessageDialog(NULL, wxT("Fitting was sucefull within ") + wxString::Format( "%i" , MainReactionYield.GetNumberIteractions()) + wxT(" steps...\n") + wxT("Do you want to update the original stoichiometry guess to the fitted stoichiometry ?") , wxT("Copy the Fitting Stoichiometry to Guess Stoichiometry?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); + wxMessageDialog *dialcopy = new wxMessageDialog(NULL, wxT("Fitting was successful within ") + wxString::Format( "%i" , MainReactionYield.GetNumberIteractions()) + wxT(" steps...\n") + wxT("Do you want to update the original stoichiometry guess to the fitted stoichiometry ?") , wxT("Copy the Fitting Stoichiometry to Guess Stoichiometry?"), wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION); if(dialcopy->ShowModal() == wxID_YES) { for(int z=0; zShowModal(); barMainStatus->SetStatusText(wxT("Warning! Invalid input entry, please check the values.") ,0); } @@ -951,7 +822,7 @@ void ERYAPIXEMainFrame::OnMainCheck( wxCommandEvent& event ) } else { - wxMessageDialog *dial = new wxMessageDialog(NULL, test.GetErrorString() , wxT("Error at Stoichiometry Guess Entry #") + wxString::Format("%i",k+1), wxOK | wxICON_ERROR); + wxMessageDialog *dial = new wxMessageDialog(NULL, test.GetErrorString() , wxT("Error at Composition Guess Entry #") + wxString::Format("%i",k+1), wxOK | wxICON_ERROR); dial->ShowModal(); barMainStatus->SetStatusText(wxT("Warning! Invalid input entry, please check the values.") ,0); } @@ -988,7 +859,7 @@ void ERYAPIXEMainFrame::OnMainStop( wxCommandEvent& event ) CurrentYieldTable.Add(TableNode(wxT("Yield Guess"))); CurrentYieldTable.Add(TableNode(wxT("Yield Experimental"))); CurrentYieldTable.Add(TableNode(wxT("Yield Fitted"))); - CurrentYieldTable.Add(TableNode(wxT("Composition Fitted"))); + CurrentYieldTable.Add(TableNode(wxT("Composition Atomic"))); CurrentYieldTable.Add(TableNode(wxT("Composition Mass"))); CurrentYieldTable.Add(TableNode(wxT("Composition Error"))); for(int z=0; zDelAllLayers(false,true); this->GenerateTable(); this->GenerateLog(); - return true; //Init sucefull + return true; //Init successful } bool ERYAPIXEMainFrame::StartUpDatabases() diff --git a/src/ERYAPIXEdialogDatabaseManager.cpp b/src/ERYAPIXEdialogDatabaseManager.cpp index 7b44bee..7507023 100644 --- a/src/ERYAPIXEdialogDatabaseManager.cpp +++ b/src/ERYAPIXEdialogDatabaseManager.cpp @@ -168,7 +168,7 @@ void ERYAPIXEdialogDatabaseManager::OnDatabaseLoad( wxCommandEvent& event ) ERYAPIXEMainFrame *Parent = (ERYAPIXEMainFrame *) GetParent(); wxString DefaultDatabaseDirectory; Parent->GetConfig(DefaultDatabaseDirectory); -wxFileDialog *OpenDialog = new wxFileDialog(this, wxT("Select a ERYA Database to open"), DefaultDatabaseDirectory, wxEmptyString, wxT("ERYA database (*.epd)|*.epd|Legacy ERYA database (*.txt)|*.txt"), wxFD_OPEN, wxDefaultPosition); +wxFileDialog *OpenDialog = new wxFileDialog(this, wxT("Select a ERYA Database to open"), DefaultDatabaseDirectory, wxEmptyString, wxT("ERYA database (*.epd)|*.epd|Legacy ASCII database (*.txt)|*.txt"), wxFD_OPEN, wxDefaultPosition); if (OpenDialog->ShowModal() == wxID_OK) { MainDatabaseFile = OpenDialog->GetPath(); @@ -205,7 +205,7 @@ void ERYAPIXEdialogDatabaseManager::OnDatabaseSave( wxCommandEvent& event ) ERYAPIXEMainFrame *Parent = (ERYAPIXEMainFrame *) GetParent(); wxString DefaultDatabaseDirectory; Parent->GetConfig(DefaultDatabaseDirectory); -wxFileDialog *SaveDialog = new wxFileDialog(this, wxT("Save ERYA Database As..."), DefaultDatabaseDirectory, wxEmptyString,wxT("ERYA database (*.epd)|*.epd|LabView ERYA Source database (*.txt)|*.txt"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition); +wxFileDialog *SaveDialog = new wxFileDialog(this, wxT("Save ERYA Database As..."), DefaultDatabaseDirectory, wxEmptyString,wxT("ERYA database (*.epd)|*.epd|Legacy ASCII Database (*.txt)|*.txt"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition); if (SaveDialog->ShowModal() == wxID_OK) { MainDatabaseFile = SaveDialog->GetPath(); diff --git a/src/ERYAPIXEdialogRemark.cpp b/src/ERYAPIXEdialogRemark.cpp new file mode 100644 index 0000000..595a511 --- /dev/null +++ b/src/ERYAPIXEdialogRemark.cpp @@ -0,0 +1,67 @@ +#include "ERYAPIXEdialogRemark.h" +#include "ERYAPIXEdialogAddDatabase.h" +#include "ERYAPIXEdialogDatabaseManager.h" +#include "ERYAPIXEdialogDetectorSetup.h" +#include "ERYAPIXEdialogZieglerParameters.h" + +ERYAPIXEdialogRemark::ERYAPIXEdialogRemark( wxWindow* parent ) +: +dialogRemark( parent ) +{ + +} + +ERYAPIXEdialogRemark::ERYAPIXEdialogRemark( wxWindow* parent, wxString info, int n ) +: +dialogRemark( parent ) +{ + textRemark->SetValue(info); + FlagValue = n; +} + +void ERYAPIXEdialogRemark::OnRemarkSave( wxCommandEvent& event ) +{ + // Call the parent frame +if(FlagValue==0) +{ + ERYAPIXEdialogAddDatabase *Parent = (ERYAPIXEdialogAddDatabase *) GetParent(); + wxString data = textRemark->GetValue(); + Parent->SetRemark(data); + Close(); +} +else if(FlagValue==1) +{ + ERYAPIXEdialogDatabaseManager *Parent = (ERYAPIXEdialogDatabaseManager *) GetParent(); + wxString data = textRemark->GetValue(); + Parent->SetRemark(data); + Close(); +} +else if(FlagValue==2) +{ + ERYAPIXEdialogDetectorSetup *Parent = (ERYAPIXEdialogDetectorSetup *) GetParent(); + wxString data = textRemark->GetValue(); + Parent->SetRemark(data); + Close(); +} +else if(FlagValue==3) +{ + ERYAPIXEdialogZieglerParameters *Parent = (ERYAPIXEdialogZieglerParameters *) GetParent(); + wxString data = textRemark->GetValue(); + Parent->SetRemark(data); + Close(); +} +else +{ + Close(); +} +} + +void ERYAPIXEdialogRemark::OnRemarkClear( wxCommandEvent& event ) +{ + textRemark->Clear(); +} + +void ERYAPIXEdialogRemark::OnRemarkQuit( wxCommandEvent& event ) +{ + Close(); +} diff --git a/src/ERYAPIXEdialogRemark.h b/src/ERYAPIXEdialogRemark.h new file mode 100644 index 0000000..8d38b84 --- /dev/null +++ b/src/ERYAPIXEdialogRemark.h @@ -0,0 +1,31 @@ +#ifndef __ERYAPIXEdialogRemark__ +#define __ERYAPIXEdialogRemark__ + +/** +@file +Subclass of dialogRemark, which is generated by wxFormBuilder. +*/ + +#include "ERYAPIXE.h" + +//// end generated include + +/** Implementing dialogRemark */ +class ERYAPIXEdialogRemark : public dialogRemark +{ + protected: + // Handlers for dialogRemark events. + void OnRemarkSave( wxCommandEvent& event ); + void OnRemarkClear( wxCommandEvent& event ); + void OnRemarkQuit( wxCommandEvent& event ); + public: + /** Constructor */ + ERYAPIXEdialogRemark( wxWindow* parent, wxString info, int n ); + ERYAPIXEdialogRemark( wxWindow* parent ); + private: + int FlagValue; + //// end generated class members + +}; + +#endif // __ERYAPIXEdialogRemark__ diff --git a/src/ERYAPIXEdialogSetup.cpp b/src/ERYAPIXEdialogSetup.cpp index 462d230..aec3211 100644 --- a/src/ERYAPIXEdialogSetup.cpp +++ b/src/ERYAPIXEdialogSetup.cpp @@ -178,7 +178,7 @@ void ERYAPIXEdialogSetup::OnDefaultSave( wxCommandEvent& event ) // Clears the database names on main widget, but not change the config file! void ERYAPIXEdialogSetup::OnDefaultReset( wxCommandEvent& event ) { - wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Do you want to reset the current editions?\nThe actual config files content will not be changed."), wxT("Clear Edited Selection"), wxYES_NO | wxNO_DEFAULT | wxICON_WARNING); + wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Do you want to reset the current editions?\nThe actual configuration files content will not be changed."), wxT("Clear Edited Selection"), wxYES_NO | wxNO_DEFAULT | wxICON_WARNING); if (dial->ShowModal() == wxID_YES) { wxString SetupPath = ::wxStandardPaths::Get().GetUserLocalDataDir();