@@ -20,17 +20,8 @@ class MyFrame : public wxFrame {
2020 wxBoxSizer* panelSizer = new wxBoxSizer (wxVERTICAL);
2121
2222 // Поля для путей
23- wxBoxSizer* compilerSizer = new wxBoxSizer (wxHORIZONTAL);
24- compilerLabel = new wxStaticText (panel, wxID_ANY, wxT (" Компилятор:" ));
25- compilerText = new wxTextCtrl (panel, wxID_ANY, wxT (" " ), wxDefaultPosition, wxSize (400 , -1 ), wxTE_READONLY);
26- compilerButton = new wxButton (panel, wxID_ANY, wxT (" Выбрать..." ), wxDefaultPosition, wxSize (100 , -1 ));
27- compilerSizer->Add (compilerLabel, 0 , wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
28- compilerSizer->Add (compilerText, 1 , wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 ); // Пропорция 1 для растяжки
29- compilerSizer->Add (compilerButton, 0 , wxALIGN_CENTER_VERTICAL);
30- panelSizer->Add (compilerSizer, 0 , wxEXPAND | wxALL, 5 ); // Добавлен wxEXPAND
31-
3223 wxBoxSizer* wxWidgetsSizer = new wxBoxSizer (wxHORIZONTAL);
33- wxWidgetsLabel = new wxStaticText (panel, wxID_ANY, wxT (" wxWidgets:" ));
24+ wxWidgetsLabel = new wxStaticText (panel, wxID_ANY, wxT (" Путь к wxWidgets:" ));
3425 wxWidgetsText = new wxTextCtrl (panel, wxID_ANY, wxT (" " ), wxDefaultPosition, wxSize (400 , -1 ), wxTE_READONLY);
3526 wxWidgetsButton = new wxButton (panel, wxID_ANY, wxT (" Выбрать..." ), wxDefaultPosition, wxSize (100 , -1 ));
3627 wxWidgetsSizer->Add (wxWidgetsLabel, 0 , wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
@@ -60,17 +51,13 @@ class MyFrame : public wxFrame {
6051 LoadConfig ();
6152
6253 // Привязка событий
63- compilerButton->Bind (wxEVT_BUTTON, &MyFrame::OnSelectCompilerFolder, this );
6454 wxWidgetsButton->Bind (wxEVT_BUTTON, &MyFrame::OnSelectWxWidgetsFolder, this );
6555 devFileButton->Bind (wxEVT_BUTTON, &MyFrame::OnSelectDevFile, this );
6656 updateButton->Bind (wxEVT_BUTTON, &MyFrame::OnUpdateDevFile, this );
6757 }
6858
6959private:
7060 wxString CONFIG_FILE; // Член класса
71- wxStaticText* compilerLabel;
72- wxTextCtrl* compilerText;
73- wxButton* compilerButton;
7461 wxStaticText* wxWidgetsLabel;
7562 wxTextCtrl* wxWidgetsText;
7663 wxButton* wxWidgetsButton;
@@ -81,11 +68,8 @@ class MyFrame : public wxFrame {
8168
8269 void LoadConfig () {
8370 wxFileConfig config (wxEmptyString, wxEmptyString, CONFIG_FILE);
84- wxString compilerFolder, wxWidgetsFolder, devFile;
71+ wxString wxWidgetsFolder, devFile;
8572
86- if (config.Read (wxT (" Paths/CompilerFolder" ), &compilerFolder) && wxFileName::DirExists (compilerFolder)) {
87- compilerText->SetValue (compilerFolder);
88- }
8973 if (config.Read (wxT (" Paths/WxWidgetsFolder" ), &wxWidgetsFolder) && wxFileName::DirExists (wxWidgetsFolder)) {
9074 wxWidgetsText->SetValue (wxWidgetsFolder);
9175 }
@@ -96,20 +80,11 @@ class MyFrame : public wxFrame {
9680
9781 void SaveConfig () {
9882 wxFileConfig config (wxEmptyString, wxEmptyString, CONFIG_FILE);
99- config.Write (wxT (" Paths/CompilerFolder" ), compilerText->GetValue ());
10083 config.Write (wxT (" Paths/WxWidgetsFolder" ), wxWidgetsText->GetValue ());
10184 config.Write (wxT (" Paths/DevFile" ), devFileText->GetValue ());
10285 config.Flush ();
10386 }
10487
105- void OnSelectCompilerFolder (wxCommandEvent& event) {
106- wxDirDialog dlg (this , wxT (" Выберите папку с компилятором" ), compilerText->GetValue (),
107- wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
108- if (dlg.ShowModal () == wxID_OK) {
109- compilerText->SetValue (dlg.GetPath ());
110- }
111- }
112-
11388 void OnSelectWxWidgetsFolder (wxCommandEvent& event) {
11489 wxDirDialog dlg (this , wxT (" Выберите папку с wxWidgets" ), wxWidgetsText->GetValue (),
11590 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
@@ -131,10 +106,6 @@ class MyFrame : public wxFrame {
131106
132107 void OnUpdateDevFile (wxCommandEvent& event) {
133108 // Проверка заполненности полей
134- if (compilerText->GetValue ().IsEmpty ()) {
135- wxMessageBox (wxT (" Пожалуйста, выберите папку компилятора." ), wxT (" Ошибка" ), wxOK | wxICON_ERROR);
136- return ;
137- }
138109 if (wxWidgetsText->GetValue ().IsEmpty ()) {
139110 wxMessageBox (wxT (" Пожалуйста, выберите папку wxWidgets." ), wxT (" Ошибка" ), wxOK | wxICON_ERROR);
140111 return ;
@@ -145,10 +116,6 @@ class MyFrame : public wxFrame {
145116 }
146117
147118 // Проверка существования путей
148- if (!wxFileName::DirExists (compilerText->GetValue ())) {
149- wxMessageBox (wxT (" Папка компилятора не существует." ), wxT (" Ошибка" ), wxOK | wxICON_ERROR);
150- return ;
151- }
152119 if (!wxFileName::DirExists (wxWidgetsText->GetValue ())) {
153120 wxMessageBox (wxT (" Папка wxWidgets не существует." ), wxT (" Ошибка" ), wxOK | wxICON_ERROR);
154121 return ;
0 commit comments