| 39 | // ----------------------------------------------------------------------------------------------- |
| 40 | |
| 41 | ImportImageDialog::ImportImageDialog(wxWindow *parent, wxString filename, int num_chemicals, int i_target_chemical, |
| 42 | float in_low, float in_high, float out_low, float out_high) |
| 43 | : wxDialog(parent,wxID_ANY,_("Import an image"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) |
| 44 | , in_low(in_low) |
| 45 | , in_high(in_high) |
| 46 | , out_low(out_low) |
| 47 | , out_high(out_high) |
| 48 | { |
| 49 | // create the controls |
| 50 | wxBoxSizer* vbox = new wxBoxSizer(wxVERTICAL); |
| 51 | SetSizer(vbox); |
| 52 | |
| 53 | wxStaticText* source_label = new wxStaticText(this, wxID_STATIC, _("Image source:")); |
| 54 | |
| 55 | wxBoxSizer* hbox1 = new wxBoxSizer(wxHORIZONTAL); |
| 56 | { |
| 57 | this->filename_edit = new wxTextCtrl(this, wxID_ANY, filename, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); |
| 58 | this->filename_edit->SetMinSize(wxSize(400, -1)); |
| 59 | hbox1->Add(this->filename_edit, 1, wxEXPAND | wxRIGHT, 10); |
| 60 | wxButton *change_filename_button = new wxButton(this, wxID_ANY, _("...")); |
| 61 | change_filename_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ImportImageDialog::OnChangeFilename, this); |
| 62 | hbox1->Add(change_filename_button, 0, wxLEFT | wxRIGHT, 0); |
| 63 | } |
| 64 | |
| 65 | wxStaticText* convert_label = new wxStaticText(this, wxID_STATIC, _("(will be converted to grayscale if not already)")); |
| 66 | |
| 67 | wxBoxSizer* hbox2 = new wxBoxSizer(wxHORIZONTAL); |
| 68 | { |
| 69 | wxStaticText* chemical_label = new wxStaticText(this, wxID_STATIC, _("Apply to chemical:")); |
| 70 | hbox2->Add(chemical_label, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, STDHGAP); |
| 71 | this->chemical_combo = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY); |
| 72 | for (int i = 0; i < num_chemicals; ++i) |
| 73 | this->chemical_combo->AppendString(GetChemicalName(i)); |
| 74 | this->chemical_combo->SetSelection(i_target_chemical); |
| 75 | hbox2->Add(chemical_combo, 1, wxLEFT | wxRIGHT, STDHGAP); |
| 76 | } |
| 77 | |
| 78 | wxBoxSizer* hbox3 = new wxBoxSizer(wxHORIZONTAL); |
| 79 | { |
| 80 | wxStaticText* map_label1 = new wxStaticText(this, wxID_STATIC, _("Map color range:")); |
| 81 | hbox3->Add(map_label1, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, STDHGAP); |
| 82 | this->in_low_edit = new wxTextCtrl(this, wxID_ANY, wxString::Format("%.1f", in_low), wxDefaultPosition, wxSize(50,-1), wxTE_RIGHT); |
| 83 | hbox3->Add(this->in_low_edit, 1, wxGROW | wxLEFT | wxRIGHT, STDHGAP); |
| 84 | wxStaticText* map_label2 = new wxStaticText(this, wxID_STATIC, _("-")); |
| 85 | hbox3->Add(map_label2, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, STDHGAP); |
| 86 | this->in_high_edit = new wxTextCtrl(this, wxID_ANY, wxString::Format("%.1f", in_high), wxDefaultPosition, wxSize(50, -1)); |
| 87 | hbox3->Add(this->in_high_edit, 1, wxGROW | wxLEFT | wxRIGHT, STDHGAP); |
| 88 | wxStaticText* map_label3 = new wxStaticText(this, wxID_STATIC, _("onto")); |
| 89 | hbox3->Add(map_label3, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, STDHGAP); |
| 90 | this->out_low_edit = new wxTextCtrl(this, wxID_ANY, wxString::Format("%.1f", out_low), wxDefaultPosition, wxSize(50, -1), wxTE_RIGHT); |
| 91 | hbox3->Add(this->out_low_edit, 1, wxGROW | wxLEFT | wxRIGHT, STDHGAP); |
| 92 | wxStaticText* map_label4 = new wxStaticText(this, wxID_STATIC, _("-")); |
| 93 | hbox3->Add(map_label4, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, STDHGAP); |
| 94 | this->out_high_edit = new wxTextCtrl(this, wxID_ANY, wxString::Format("%.1f", out_high), wxDefaultPosition, wxSize(50, -1)); |
| 95 | hbox3->Add(this->out_high_edit, 1, wxGROW | wxLEFT | wxRIGHT, STDHGAP); |
| 96 | } |
| 97 | |
| 98 | wxBoxSizer* buttbox = new wxBoxSizer(wxHORIZONTAL); |
nothing calls this directly
no test coverage detected