Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

dlgConf.cpp

Go to the documentation of this file.
00001 /* 00002 * wxChecksums 00003 * Copyright (C) 2003-2004 Julien Couot 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 /** 00021 * \file dlgConf.cpp 00022 * Configuration dialog. 00023 */ 00024 00025 00026 //--------------------------------------------------------------------------- 00027 // For compilers that support precompilation, includes "wx.h". 00028 #include <wx/wxprec.h> 00029 00030 #ifdef __BORLANDC__ 00031 #pragma hdrstop 00032 #endif 00033 00034 #ifndef WX_PRECOMP 00035 // Include your minimal set of headers here, or wx.h 00036 #include <wx/wx.h> 00037 #endif 00038 00039 #include <wx/colordlg.h> 00040 #include <wx/filename.h> 00041 #include <wx/image.h> 00042 #include <wx/notebook.h> 00043 #include <wx/splitter.h> 00044 #include <wx/treectrl.h> 00045 #include <wx/txtstrm.h> 00046 #include <wx/settings.h> 00047 00048 #include "dlgConf.hpp" 00049 #include "cmdlnopt.hpp" 00050 #include "comdefs.hpp" 00051 #include "appprefs.hpp" 00052 #include "language.hpp" 00053 #include "utils.hpp" 00054 00055 #include "compat.hpp" 00056 //--------------------------------------------------------------------------- 00057 00058 00059 /// The C++ standard namespace. 00060 using namespace std; 00061 00062 00063 // On some plate-forms scrolled window don't refresh correctly. 00064 // Currently it work well only of wxMSW 00065 #if defined(__WXMSW__) 00066 #define USE_SCROLLEDWINDOW 1 00067 #else 00068 #undef USE_SCROLLEDWINDOW 00069 #endif // defined(__WXMSW__) 00070 00071 00072 //########################################################################### 00073 // dlgConfigure::TreePagesItemData methods 00074 //########################################################################### 00075 00076 /** 00077 * Data for the tree of configuration pages. 00078 */ 00079 class dlgConfigure::TreePagesItemData : public wxTreeItemData 00080 { 00081 protected: 00082 TreePagesId pageId; ///< Identifier of the page. 00083 00084 public: 00085 /// Default constructor. 00086 TreePagesItemData() { } 00087 00088 /// Constructor with a identifier. 00089 TreePagesItemData(const TreePagesId id) { SetPageId(id); } 00090 00091 // Default copy constructor and assignment operator are OK. 00092 00093 /// Gets the identifier of the page. 00094 TreePagesId GetPageId() const { return pageId; } 00095 00096 /// Sets the identifier of the page 00097 void SetPageId(const TreePagesId id) { pageId = id; } 00098 }; 00099 //--------------------------------------------------------------------------- 00100 00101 00102 00103 //########################################################################### 00104 // Facility functions 00105 //########################################################################### 00106 00107 /** 00108 * Creates a bitmap of uniform colour for a bitmap button. 00109 * 00110 * The size is (3*size_of_char, 1*size_of_char). 00111 * 00112 * @param colour Colour of the bitmap to create. 00113 * @param window Window from which <CODE>dc</CODE> is taken. 00114 * @return A bitmap of uniform colour for a bitmap button. 00115 */ 00116 static wxBitmap createBitmapForButton(const wxColour& colour, wxWindow* window) 00117 { 00118 wxSize size; 00119 if (window == NULL) 00120 // Use abitrary size 00121 size.Set(48, 16); 00122 else 00123 { 00124 wxClientDC dc(window); 00125 size.Set(dc.GetCharWidth() * 3, dc.GetCharHeight()); 00126 } 00127 00128 wxImage img(size.GetWidth(), size.GetHeight()); 00129 unsigned char* data = img.GetData(); 00130 00131 unsigned char* p = data; 00132 int s = size.GetWidth() * size.GetHeight(); 00133 for (int i = 0; i < s; i++) 00134 { 00135 *p = colour.Red(); 00136 *(p + 1) = colour.Green(); 00137 *(p + 2) = colour.Blue(); 00138 p += 3; 00139 } 00140 00141 return wxBitmap(img); 00142 } 00143 //--------------------------------------------------------------------------- 00144 00145 00146 //########################################################################### 00147 // dlgConfigure methods 00148 //########################################################################### 00149 00150 IMPLEMENT_DYNAMIC_CLASS(dlgConfigure, wxDialog) 00151 00152 00153 /** 00154 * Creates a new dialog. 00155 */ 00156 dlgConfigure::dlgConfigure() : wxDialog() 00157 { 00158 createControls(); 00159 } 00160 //--------------------------------------------------------------------------- 00161 00162 00163 /** 00164 * Creates a new dialog. 00165 * 00166 * @param parent Parent of the dialog. 00167 */ 00168 dlgConfigure::dlgConfigure(wxWindow* parent) : 00169 wxDialog(parent, -1, _("Settings"), wxDefaultPosition, wxDefaultSize, 00170 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) 00171 { 00172 createControls(); 00173 00174 wxSize s = AppPrefs::get()->readSize(prGUI_CONF_WINDOW_SIZE); 00175 if (s.GetWidth() < 0 || s.GetHeight() < 0) 00176 { 00177 wxClientDC dc(this); 00178 this->SetSize(dc.GetCharWidth() * 80, dc.GetCharHeight() * 30); 00179 } 00180 else 00181 this->SetSize(s); 00182 00183 this->Centre(); 00184 } 00185 //--------------------------------------------------------------------------- 00186 00187 00188 /** 00189 * Creates and initializes the controls of the dialog. 00190 */ 00191 void dlgConfigure::createControls() 00192 { 00193 wxString msg; 00194 wxPathFormat pf; 00195 wxEOL eol; 00196 00197 00198 //------------------------------------------------------------------------- 00199 // The splitter 00200 sptConfigure = new wxSplitterWindow(this, -1, wxDefaultPosition, wxDefaultSize, wxSP_3D); 00201 sptConfigure->SetMinimumPaneSize(5); 00202 00203 00204 //------------------------------------------------------------------------- 00205 // The tree to select configuration pages. 00206 long trePagesStyle = wxNO_BORDER | wxTR_HIDE_ROOT | wxTR_HAS_BUTTONS | wxTR_SINGLE; 00207 #if defined(__WXMSW__) 00208 trePagesStyle |= wxTR_LINES_AT_ROOT; 00209 #else 00210 trePagesStyle |= wxTR_TWIST_BUTTONS | wxTR_NO_LINES; 00211 #endif // defined(__WXMSW__) 00212 trePages = new wxTreeCtrl(sptConfigure, TRE_PAGES, wxDefaultPosition, wxDefaultSize, trePagesStyle); 00213 wxTreeItemId trePagesRoot = trePages->AddRoot(wxEmptyString); 00214 wxTreeItemId trePagesInterface = trePages->AppendItem(trePagesRoot, _("Interface")/*, -1, -1, new TreePagesItemData(TpInterface)*/); 00215 wxTreeItemId trePagesGUIDisplay = trePages->AppendItem(trePagesInterface, _("Display"), -1, -1, new TreePagesItemData(TpDisplay)); 00216 wxTreeItemId trePagesGUIBehavior = trePages->AppendItem(trePagesInterface, _("Behavior"), -1, -1, new TreePagesItemData(TpBehavior)); 00217 wxTreeItemId trePagesGUILanguage = trePages->AppendItem(trePagesInterface, _("Language"), -1, -1, new TreePagesItemData(TpLanguage)); 00218 wxTreeItemId trePagesGUICmdLine = trePages->AppendItem(trePagesInterface, _("Command line"), -1, -1, new TreePagesItemData(TpCmdLine)); 00219 trePages->Expand(trePagesInterface); 00220 00221 wxTreeItemId trePagesChecksumsFiles = trePages->AppendItem(trePagesRoot, _("Checksums' files")/*, -1, -1, new TreePagesItemData(TpChecksumsFiles)*/); 00222 wxTreeItemId trePagesCksumsSFV = trePages->AppendItem(trePagesChecksumsFiles, _("SFV files"), -1, -1, new TreePagesItemData(TpSFVFiles)); 00223 wxTreeItemId trePagesCksumsMD5 = trePages->AppendItem(trePagesChecksumsFiles, _("MD5 files"), -1, -1, new TreePagesItemData(TpMD5Files)); 00224 trePages->Expand(trePagesChecksumsFiles); 00225 00226 wxTreeItemId trePagesTools = trePages->AppendItem(trePagesRoot, _("Tools") /*, -1, -1, new TreePagesItemData(TpTools)*/); 00227 wxTreeItemId trePagesToolsMultiCheck = trePages->AppendItem(trePagesTools, _("Multiple check"), -1, -1, new TreePagesItemData(TpMultiCheck)); 00228 wxTreeItemId trePagesToolsBatchCreation = trePages->AppendItem(trePagesTools, _("Batch creation"), -1, -1, new TreePagesItemData(TpBatchCreation)); 00229 trePages->Expand(trePagesTools); 00230 00231 00232 //------------------------------------------------------------------------- 00233 // Interface page 00234 wxScrolledWindow* tabInterface = new wxScrolledWindow(sptConfigure); 00235 #if defined(USE_SCROLLEDWINDOW) 00236 tabInterface->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00237 #endif 00238 tabInterface->Hide(); 00239 00240 wxPanel* pnlInterface = makePageTitlePanel(tabInterface, trePages->GetItemText(trePagesInterface), 1); 00241 00242 // Sizers 00243 // The panel sizer 00244 wxBoxSizer* tabInterfaceSizer2 = new wxBoxSizer(wxVERTICAL); 00245 tabInterface->SetSizer(tabInterfaceSizer2); 00246 wxBoxSizer* tabInterfaceSizer = new wxBoxSizer(wxVERTICAL); 00247 tabInterfaceSizer2->Add(tabInterfaceSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00248 00249 // Title of the page 00250 tabInterfaceSizer->Add(pnlInterface, 0, wxGROW); 00251 00252 00253 //------------------------------------------------------------------------- 00254 // Display page 00255 wxScrolledWindow* tabDisplay = new wxScrolledWindow(sptConfigure); 00256 #if defined(USE_SCROLLEDWINDOW) 00257 tabDisplay->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00258 #endif 00259 // This tab is the one displayed by default, don't hide it. 00260 // tabDisplay->Hide(); 00261 00262 wxPanel* pnlDisplay = makePageTitlePanel(tabDisplay, trePages->GetItemText(trePagesGUIDisplay)); 00263 00264 wxStaticBox* fraWindow = new wxStaticBox(tabDisplay, -1, _("Window:")); 00265 chkWindowSavePosition = new wxCheckBox(tabDisplay, -1, _("Save and restore the &position of the window")); 00266 chkWindowSavePosition->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SAVE_WINDOW_POSITION)); 00267 chkWindowSaveSize = new wxCheckBox(tabDisplay, -1, _("Save and restore the &size of the window")); 00268 chkWindowSaveSize->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SAVE_WINDOW_SIZE)); 00269 00270 wxStaticBox* fraSumsHeaders = new wxStaticBox(tabDisplay, -1, _("Headers of the checksums' list:")); 00271 lstSumsHeaders = new wxListBox(tabDisplay, LST_SUMS_HEADERS, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); 00272 wxButton* btnSumsHeadersUp = new wxButton(tabDisplay, BTN_SUMS_HEADERS_UP, _("&Up")); 00273 wxButton* btnSumsHeadersDown = new wxButton(tabDisplay, BTN_SUMS_HEADERS_DOWN, _("&Down")); 00274 00275 wxStaticBox* fraDisplaySums = new wxStaticBox(tabDisplay, -1, _("Checksums' list:")); 00276 chkSumsSaveColumnToSort = new wxCheckBox(tabDisplay, -1, _("Save the &column to sort (and the order)")); 00277 chkSumsSaveColumnToSort->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SUMS_SAVECOLUMNTOSORT)); 00278 chkSumsSaveColumnsWidths = new wxCheckBox(tabDisplay, -1, _("Save the &widths of the columns")); 00279 chkSumsSaveColumnsWidths->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SUMS_SAVECOLUMNSWIDTHS)); 00280 chkSumsDirInAbsolutePath = new wxCheckBox(tabDisplay, -1, _("Display the directories in &absolute path")); 00281 chkSumsDirInAbsolutePath->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SUMS_DIRSINABSOLUTEPATH)); 00282 wxStaticText* lblSumsValuesCase = new wxStaticText(tabDisplay, -1, _("Show checksums values in:")); 00283 rbtSumsValuesCaseUpper = new wxRadioButton(tabDisplay, -1, _("upp&ercase"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00284 rbtSumsValuesCaseLower = new wxRadioButton(tabDisplay, -1, _("&lowercase")); 00285 if (AppPrefs::get()->readBool(prGUI_MAIN_SUMS_UPPERCASE)) { 00286 rbtSumsValuesCaseLower->SetValue(false); rbtSumsValuesCaseUpper->SetValue(true); 00287 } else { 00288 rbtSumsValuesCaseUpper->SetValue(false); rbtSumsValuesCaseLower->SetValue(true); } 00289 chkSumsHRules = new wxCheckBox(tabDisplay, -1, _("Draws light &horizontal rules between rows")); 00290 chkSumsHRules->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SUMS_HRULES)); 00291 chkSumsVRules = new wxCheckBox(tabDisplay, -1, _("Draws light &vertical rules between columns")); 00292 chkSumsVRules->SetValue(AppPrefs::get()->readBool(prGUI_MAIN_SUMS_VRULES)); 00293 00294 // Sizers 00295 // The panel sizer 00296 wxBoxSizer* tabDisplaySizer2 = new wxBoxSizer(wxVERTICAL); 00297 tabDisplay->SetSizer(tabDisplaySizer2); 00298 wxBoxSizer* tabDisplaySizer = new wxBoxSizer(wxVERTICAL); 00299 tabDisplaySizer2->Add(tabDisplaySizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00300 00301 // Title of the page 00302 tabDisplaySizer->Add(pnlDisplay, 0, wxGROW); 00303 00304 // The 'Window' frame sizer 00305 wxStaticBoxSizer* fraWindowSizer2 = new wxStaticBoxSizer(fraWindow, wxVERTICAL); 00306 tabDisplaySizer->Add(fraWindowSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00307 wxBoxSizer* fraWindowSizer = new wxBoxSizer(wxVERTICAL); 00308 fraWindowSizer2->Add(fraWindowSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00309 fraWindowSizer->Add(chkWindowSavePosition); 00310 fraWindowSizer->Add(chkWindowSaveSize, 0, wxTOP, CONTROL_SPACE / 2); 00311 00312 // The 'Headers of the checksums' list' frame sizer 00313 wxStaticBoxSizer* fraSumsHeadersSizer2 = new wxStaticBoxSizer(fraSumsHeaders, wxVERTICAL); 00314 tabDisplaySizer->Add(fraSumsHeadersSizer2, 1, wxGROW | wxTOP, CONTROL_SPACE); 00315 wxBoxSizer* fraSumsHeadersSizer = new wxBoxSizer(wxVERTICAL); 00316 fraSumsHeadersSizer2->Add(fraSumsHeadersSizer, 1, wxALL | wxGROW, CONTROL_SPACE / 2); 00317 00318 // The list and buttons sizer 00319 wxBoxSizer* SumsHeadersSizer = new wxBoxSizer(wxHORIZONTAL); 00320 fraSumsHeadersSizer->Add(SumsHeadersSizer, 1, wxGROW); 00321 SumsHeadersSizer->Add(lstSumsHeaders, 1, wxGROW); 00322 wxBoxSizer* SumsHeadersButtonsSizer = new wxBoxSizer(wxVERTICAL); 00323 SumsHeadersSizer->Add(SumsHeadersButtonsSizer, 0, wxLEFT, CONTROL_SPACE); 00324 SumsHeadersButtonsSizer->Add(btnSumsHeadersUp); 00325 SumsHeadersButtonsSizer->Add(btnSumsHeadersDown, 0, wxTOP, CONTROL_SPACE); 00326 00327 // The 'Checksums' list' frame sizer 00328 wxStaticBoxSizer* fraDisplaySumsSizer2 = new wxStaticBoxSizer(fraDisplaySums, wxVERTICAL); 00329 tabDisplaySizer->Add(fraDisplaySumsSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00330 wxBoxSizer* fraDisplaySumsSizer = new wxBoxSizer(wxVERTICAL); 00331 fraDisplaySumsSizer2->Add(fraDisplaySumsSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00332 00333 // Display directories in absolute path 00334 fraDisplaySumsSizer->Add(chkSumsSaveColumnToSort, 0); 00335 fraDisplaySumsSizer->Add(chkSumsSaveColumnsWidths, 0, wxTOP, CONTROL_SPACE / 2); 00336 fraDisplaySumsSizer->Add(chkSumsDirInAbsolutePath, 0, wxTOP, CONTROL_SPACE / 2); 00337 00338 // Case of the checksums values 00339 wxBoxSizer* SumsCaseSizer = new wxBoxSizer(wxHORIZONTAL); 00340 fraDisplaySumsSizer->Add(SumsCaseSizer, 0, wxTOP, CONTROL_SPACE / 2); 00341 SumsCaseSizer->Add(lblSumsValuesCase, 0, wxALIGN_CENTER_VERTICAL); 00342 SumsCaseSizer->Add(rbtSumsValuesCaseUpper, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00343 SumsCaseSizer->Add(rbtSumsValuesCaseLower, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00344 00345 // Sums list rules bitween rows and columns. 00346 fraDisplaySumsSizer->Add(chkSumsHRules, 0, wxTOP, CONTROL_SPACE / 2); 00347 fraDisplaySumsSizer->Add(chkSumsVRules, 0, wxTOP, CONTROL_SPACE / 2); 00348 00349 00350 //------------------------------------------------------------------------- 00351 // Behavior page 00352 wxScrolledWindow* tabBehavior = new wxScrolledWindow(sptConfigure); 00353 #if defined(USE_SCROLLEDWINDOW) 00354 tabBehavior->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00355 #endif 00356 tabBehavior->Hide(); 00357 00358 wxPanel* pnlBehavior = makePageTitlePanel(tabBehavior, trePages->GetItemText(trePagesGUIBehavior)); 00359 00360 chkAutoCheckOnOpen = new wxCheckBox(tabBehavior, -1, _("&Checks automatically the checksums file when opening it")); 00361 chkAutoCheckOnOpen->SetValue(AppPrefs::get()->readBool(prGUI_AUTO_CHECK_ON_OPEN)); 00362 chkDlgSumUpCheck = new wxCheckBox(tabBehavior, -1, _("&Opens a dialog box to sum up the check")); 00363 chkDlgSumUpCheck->SetValue(AppPrefs::get()->readBool(prGUI_DLG_SUMUP_CHECK)); 00364 chkWarnOnInvalidWhenSaving = new wxCheckBox(tabBehavior, -1, _("&Displays a warning if the state of all the files is not 'OK' when saving a checksums file")); 00365 chkWarnOnInvalidWhenSaving->SetValue(AppPrefs::get()->readBool(prGUI_WARN_ON_INVALID_WHEN_SAVING)); 00366 00367 // Behavior page sizer 00368 // The panel sizer 00369 wxBoxSizer* tabBehaviorSizer2 = new wxBoxSizer(wxVERTICAL); 00370 tabBehavior->SetSizer(tabBehaviorSizer2); 00371 wxBoxSizer* tabBehaviorSizer = new wxBoxSizer(wxVERTICAL); 00372 tabBehaviorSizer2->Add(tabBehaviorSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00373 00374 // Title of the page 00375 tabBehaviorSizer->Add(pnlBehavior, 0, wxGROW); 00376 00377 tabBehaviorSizer->Add(chkAutoCheckOnOpen, 0, wxTOP, CONTROL_SPACE); 00378 tabBehaviorSizer->Add(chkDlgSumUpCheck, 0, wxTOP, CONTROL_SPACE / 2); 00379 tabBehaviorSizer->Add(chkWarnOnInvalidWhenSaving, 0, wxTOP, CONTROL_SPACE / 2); 00380 00381 00382 //------------------------------------------------------------------------- 00383 // Language page 00384 wxScrolledWindow* tabLanguage = new wxScrolledWindow(sptConfigure); 00385 #if defined(USE_SCROLLEDWINDOW) 00386 tabLanguage->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00387 #endif 00388 tabLanguage->Hide(); 00389 00390 wxPanel* pnlLanguage = makePageTitlePanel(tabLanguage, trePages->GetItemText(trePagesGUILanguage)); 00391 00392 wxStaticText* lblLanguage = new wxStaticText(tabLanguage, -1, wxString::Format(_("Select the &language that %s should use:"), wxT(APP_NAME))); 00393 lstLanguages = new wxListBox(tabLanguage, -1, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); 00394 lstLanguages->Append(_("Language of the system (if available)"), reinterpret_cast<void*>(Languages::LANGUAGE_UNKNOW)); 00395 int i; 00396 Languages languages; 00397 for (i = 0; i < languages.getLanguagesCount(); i++) 00398 { 00399 if (languages.getLanguageName(i) == languages.getLanguageTranslatedName(i)) 00400 msg = languages.getLanguageName(i); 00401 else 00402 msg = languages.getLanguageName(i) + wxT(" / ") + languages.getLanguageTranslatedName(i); 00403 lstLanguages->Append(msg, reinterpret_cast<void*>(i)); 00404 } 00405 wxStaticText* lblLanguageRestart = new wxStaticText(tabLanguage, -1, _("Note: Changes you made for the language won't take effect before the next restart.")); 00406 i = languages.getLanguageIndexByShortName(AppPrefs::get()->readString(prLANGUAGE_NAME)); 00407 if (i == Languages::LANGUAGE_UNKNOW) 00408 lstLanguages->SetSelection(0, true); 00409 else 00410 lstLanguages->SetSelection(i + 1, true); 00411 00412 // Language tab sizer 00413 // The panel sizer 00414 wxBoxSizer* tabLanguageSizer2 = new wxBoxSizer(wxVERTICAL); 00415 tabLanguage->SetSizer(tabLanguageSizer2); 00416 wxBoxSizer* tabLanguageSizer = new wxBoxSizer(wxVERTICAL); 00417 tabLanguageSizer2->Add(tabLanguageSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00418 00419 // Title of the page 00420 tabLanguageSizer->Add(pnlLanguage, 0, wxGROW); 00421 00422 tabLanguageSizer->Add(lblLanguage, 0, wxTOP, CONTROL_SPACE); 00423 tabLanguageSizer->Add(lstLanguages, 1, wxGROW); 00424 tabLanguageSizer->Add(lblLanguageRestart, 0, wxTOP, CONTROL_SPACE); 00425 00426 00427 //------------------------------------------------------------------------- 00428 // Command line page 00429 wxScrolledWindow* tabCmdLine = new wxScrolledWindow(sptConfigure); 00430 #if defined(USE_SCROLLEDWINDOW) 00431 tabCmdLine->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00432 #endif 00433 tabCmdLine->Hide(); 00434 00435 wxPanel* pnlCmdLine = makePageTitlePanel(tabCmdLine, trePages->GetItemText(trePagesGUICmdLine)); 00436 00437 wxStaticBox* fraCLnVerify = new wxStaticBox(tabCmdLine, -1, _("When verifying a checksums' file:")); 00438 chkCLnVerifyDontShowGUI = new wxCheckBox(tabCmdLine, -1, _("&Don't show the GUI if all the checksums are correct")); 00439 chkCLnVerifyDontShowGUI->SetValue(AppPrefs::get()->readBool(prGUI_CLN_VERIFY_DONT_SHOW_GUI)); 00440 00441 wxStaticBox* fraCLnAppend = new wxStaticBox(tabCmdLine, -1, _("When adding files to a checksums' file:")); 00442 rbxCLnAppendNeverShowGUI = new wxRadioButton(tabCmdLine, -1, _("&Never show the GUI"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00443 rbxCLnAppendShowGUIOnError = new wxRadioButton(tabCmdLine, -1, _("Show the GUI on &errors")); 00444 rbxCLnAppendShowGUIOnWarning = new wxRadioButton(tabCmdLine, -1, _("Show the GUI on errors or &warnings")); 00445 rbxCLnAppendAlwaysGUI = new wxRadioButton(tabCmdLine, -1, _("&Always show the GUI")); 00446 switch (static_cast<DisplayGUI>(AppPrefs::get()->readLong(prGUI_CLN_APPEND_SHOW_GUI))) 00447 { 00448 case clgNever : rbxCLnAppendNeverShowGUI->SetValue(true); break; 00449 case clgOnError : rbxCLnAppendShowGUIOnError->SetValue(true); break; 00450 case clgAlways : rbxCLnAppendAlwaysGUI->SetValue(true); break; 00451 case clgOnWarning : 00452 default : rbxCLnAppendShowGUIOnWarning->SetValue(true); break; 00453 } 00454 00455 wxStaticBox* fraCLnCreate = new wxStaticBox(tabCmdLine, -1, _("When creating a checksums' file:")); 00456 rbxCLnCreateNeverShowGUI = new wxRadioButton(tabCmdLine, -1, _("Ne&ver show the GUI"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00457 rbxCLnCreateShowGUIOnError = new wxRadioButton(tabCmdLine, -1, _("Show the GUI on e&rrors")); 00458 rbxCLnCreateShowGUIOnWarning = new wxRadioButton(tabCmdLine, -1, _("Show the GUI on errors or warnin&gs")); 00459 rbxCLnCreateAlwaysGUI = new wxRadioButton(tabCmdLine, -1, _("Alwa&ys show the GUI")); 00460 switch (static_cast<DisplayGUI>(AppPrefs::get()->readLong(prGUI_CLN_CREATE_SHOW_GUI))) 00461 { 00462 case clgNever : rbxCLnCreateNeverShowGUI->SetValue(true); break; 00463 case clgOnError : rbxCLnCreateShowGUIOnError->SetValue(true); break; 00464 case clgAlways : rbxCLnCreateAlwaysGUI->SetValue(true); break; 00465 case clgOnWarning : 00466 default : rbxCLnCreateShowGUIOnWarning->SetValue(true); break; 00467 } 00468 00469 wxStaticText* lblCLnWarning = new wxStaticText(tabCmdLine, -1, _("Note: Error and warning messages are always displayed.")); 00470 00471 // Command line tab sizer 00472 // The panel sizer 00473 wxBoxSizer* tabCmdLineSizer2 = new wxBoxSizer(wxVERTICAL); 00474 tabCmdLine->SetSizer(tabCmdLineSizer2); 00475 wxBoxSizer* tabCmdLineSizer = new wxBoxSizer(wxVERTICAL); 00476 tabCmdLineSizer2->Add(tabCmdLineSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00477 00478 // Title of the page 00479 tabCmdLineSizer->Add(pnlCmdLine, 0, wxGROW); 00480 00481 // The 'When verifying a checksums' file:' frame sizer 00482 wxStaticBoxSizer* fraCLnVerifySizer2 = new wxStaticBoxSizer(fraCLnVerify, wxVERTICAL); 00483 tabCmdLineSizer->Add(fraCLnVerifySizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00484 wxBoxSizer* fraCLnVerifySizer = new wxBoxSizer(wxVERTICAL); 00485 fraCLnVerifySizer2->Add(fraCLnVerifySizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00486 00487 fraCLnVerifySizer->Add(chkCLnVerifyDontShowGUI, 0); 00488 00489 // The 'When appending files to a checksums' file:' frame sizer 00490 wxStaticBoxSizer* fraCLnAppendSizer2 = new wxStaticBoxSizer(fraCLnAppend, wxVERTICAL); 00491 tabCmdLineSizer->Add(fraCLnAppendSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00492 wxBoxSizer* fraCLnAppendSizer = new wxBoxSizer(wxVERTICAL); 00493 fraCLnAppendSizer2->Add(fraCLnAppendSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00494 00495 fraCLnAppendSizer->Add(rbxCLnAppendNeverShowGUI, 0, wxALIGN_CENTER_VERTICAL); 00496 fraCLnAppendSizer->Add(rbxCLnAppendShowGUIOnError, 0, wxTOP, CONTROL_SPACE / 2); 00497 fraCLnAppendSizer->Add(rbxCLnAppendShowGUIOnWarning, 0, wxTOP, CONTROL_SPACE / 2); 00498 fraCLnAppendSizer->Add(rbxCLnAppendAlwaysGUI, 0, wxTOP, CONTROL_SPACE / 2); 00499 00500 // The 'When creating a checksums' file:' frame sizer 00501 wxStaticBoxSizer* fraCLnCreateSizer2 = new wxStaticBoxSizer(fraCLnCreate, wxVERTICAL); 00502 tabCmdLineSizer->Add(fraCLnCreateSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00503 wxBoxSizer* fraCLnCreateSizer = new wxBoxSizer(wxVERTICAL); 00504 fraCLnCreateSizer2->Add(fraCLnCreateSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00505 00506 fraCLnCreateSizer->Add(rbxCLnCreateNeverShowGUI, 0, wxALIGN_CENTER_VERTICAL); 00507 fraCLnCreateSizer->Add(rbxCLnCreateShowGUIOnError, 0, wxTOP, CONTROL_SPACE / 2); 00508 fraCLnCreateSizer->Add(rbxCLnCreateShowGUIOnWarning, 0, wxTOP, CONTROL_SPACE / 2); 00509 fraCLnCreateSizer->Add(rbxCLnCreateAlwaysGUI, 0, wxTOP, CONTROL_SPACE / 2); 00510 00511 tabCmdLineSizer->Add(lblCLnWarning, 0, wxTOP, CONTROL_SPACE); 00512 00513 00514 //------------------------------------------------------------------------- 00515 // Checksums' files page 00516 wxScrolledWindow* tabChecksumsFiles = new wxScrolledWindow(sptConfigure); 00517 #if defined(USE_SCROLLEDWINDOW) 00518 tabChecksumsFiles->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00519 #endif 00520 tabChecksumsFiles->Hide(); 00521 00522 wxPanel* pnlChecksumsFiles = makePageTitlePanel(tabChecksumsFiles, trePages->GetItemText(trePagesChecksumsFiles), 1); 00523 00524 // Sizers 00525 // The panel sizer 00526 wxBoxSizer* tabChecksumsFilesSizer2 = new wxBoxSizer(wxVERTICAL); 00527 tabChecksumsFiles->SetSizer(tabChecksumsFilesSizer2); 00528 wxBoxSizer* tabChecksumsFilesSizer = new wxBoxSizer(wxVERTICAL); 00529 tabChecksumsFilesSizer2->Add(tabChecksumsFilesSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00530 00531 // Title of the page 00532 tabChecksumsFilesSizer->Add(pnlChecksumsFiles, 0, wxGROW); 00533 00534 00535 //------------------------------------------------------------------------- 00536 // SFV files page 00537 wxScrolledWindow* tabSFV = new wxScrolledWindow(sptConfigure); 00538 #if defined(USE_SCROLLEDWINDOW) 00539 tabSFV->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00540 #endif 00541 tabSFV->Hide(); 00542 00543 wxPanel* pnlSFV = makePageTitlePanel(tabSFV, trePages->GetItemText(trePagesCksumsSFV)); 00544 00545 // Paths separators on reading 00546 wxStaticBox* fraSFVPathSepRead = new wxStaticBox(tabSFV, -1, _("Path separator on reading SFV files:")); 00547 rbxSFVPathSepReadAuto = new wxRadioButton(tabSFV, -1, _("&Automatic recognition"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00548 rbxSFVPathSepReadUnix = new wxRadioButton(tabSFV, -1, _("&Unix: '/'")); 00549 rbxSFVPathSepReadWindows = new wxRadioButton(tabSFV, -1, _("&Windows: '\\'")); 00550 rbxSFVPathSepReadMAC = new wxRadioButton(tabSFV, -1, _("&Macintosh: ':'")); 00551 pf = static_cast<wxPathFormat>(AppPrefs::get()->readLong(prSFV_READ_PATH_SEPARATOR)); 00552 switch (pf) 00553 { 00554 case wxPATH_UNIX : rbxSFVPathSepReadUnix->SetValue(true); break; 00555 case wxPATH_WIN : rbxSFVPathSepReadWindows->SetValue(true); break; 00556 case wxPATH_MAC : rbxSFVPathSepReadMAC->SetValue(true); break; 00557 default : rbxSFVPathSepReadAuto->SetValue(true); /* wxPATH_NATIVE */ 00558 } 00559 00560 // Parameters for saving 00561 wxStaticBox* fraSFVSaving = new wxStaticBox(tabSFV, -1, _("Saving SFV files:")); 00562 chkSFVSaveGenerator = new wxCheckBox(tabSFV, -1, _("Save the &name of the generator and the date of creation in the comments")); 00563 chkSFVSaveGenerator->SetValue(AppPrefs::get()->readBool(prSFV_WRITE_GEN_AND_DATE)); 00564 wxStaticText* lblSFVIdentifyAs = new wxStaticText(tabSFV, -1, _("Identi&fy as:")); 00565 cboSFVIdentifyAs = new wxChoice(tabSFV, CBO_SFV_IDENTIFY_AS, wxDefaultPosition, wxSize(chkSFVSaveGenerator->GetSize().GetWidth() / 2, -1)); 00566 chkSFVSaveFilesInfo = new wxCheckBox(tabSFV, -1, _("Save the size and the modification &date of the files in the comments")); 00567 chkSFVSaveFilesInfo->SetValue(AppPrefs::get()->readBool(prSFV_WRITE_FILE_SIZE_AND_DATE)); 00568 00569 wxStaticText* lblSFVPathSepWrite = new wxStaticText(tabSFV, -1, _("Use the following path sepator:")); 00570 rbxSFVPathSepWriteSystem = new wxRadioButton(tabSFV, -1, wxString::Format(_("S&ystem default: '%c'"), wxFileName::GetPathSeparator()), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00571 rbxSFVPathSepWriteUnix = new wxRadioButton(tabSFV, -1, _("Un&ix: '/'")); 00572 rbxSFVPathSepWriteWindows = new wxRadioButton(tabSFV, -1, _("Wind&ows: '\\'")); 00573 rbxSFVPathSepWriteMAC = new wxRadioButton(tabSFV, -1, _("Macin&tosh: ':'")); 00574 pf = static_cast<wxPathFormat>(AppPrefs::get()->readLong(prSFV_WRITE_PATH_SEPARATOR)); 00575 switch (pf) 00576 { 00577 case wxPATH_UNIX : rbxSFVPathSepWriteUnix->SetValue(true); break; 00578 case wxPATH_WIN : rbxSFVPathSepWriteWindows->SetValue(true); break; 00579 case wxPATH_MAC : rbxSFVPathSepWriteMAC->SetValue(true); break; 00580 default : rbxSFVPathSepWriteSystem->SetValue(true); /* wxPATH_NATIVE */ 00581 } 00582 00583 wxStaticText* lblSFVEOLWrite = new wxStaticText(tabSFV, -1, _("Use the following end of line:")); 00584 rbxSFVEOLWriteSystem = new wxRadioButton(tabSFV, -1, _("Syst&em native"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00585 rbxSFVEOLWriteUnix = new wxRadioButton(tabSFV, -1, _("Uni&x")); 00586 rbxSFVEOLWriteWindows = new wxRadioButton(tabSFV, -1, _("Window&s")); 00587 rbxSFVEOLWriteMAC = new wxRadioButton(tabSFV, -1, _("Macintos&h")); 00588 eol = static_cast<wxEOL>(AppPrefs::get()->readLong(prSFV_WRITE_EOL)); 00589 switch (eol) 00590 { 00591 case wxEOL_UNIX : rbxSFVEOLWriteUnix->SetValue(true); break; 00592 case wxEOL_DOS : rbxSFVEOLWriteWindows->SetValue(true); break; 00593 case wxEOL_MAC : rbxSFVEOLWriteMAC->SetValue(true); break; 00594 default : rbxSFVEOLWriteSystem->SetValue(true); 00595 } 00596 00597 // SFV tab sizer 00598 // The panel sizer 00599 wxBoxSizer* tabSFVSizer2 = new wxBoxSizer(wxVERTICAL); 00600 tabSFV->SetSizer(tabSFVSizer2); 00601 wxBoxSizer* tabSFVSizer = new wxBoxSizer(wxVERTICAL); 00602 tabSFVSizer2->Add(tabSFVSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00603 00604 // Title of the page 00605 tabSFVSizer->Add(pnlSFV, 0, wxGROW); 00606 00607 // The 'Path separator on reading SFV files:' frame sizer 00608 wxStaticBoxSizer* fraSFVPathSepReadSizer2 = new wxStaticBoxSizer(fraSFVPathSepRead, wxVERTICAL); 00609 tabSFVSizer->Add(fraSFVPathSepReadSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00610 wxBoxSizer* fraSFVPathSepReadSizer = new wxBoxSizer(wxHORIZONTAL); 00611 fraSFVPathSepReadSizer2->Add(fraSFVPathSepReadSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00612 00613 fraSFVPathSepReadSizer->Add(rbxSFVPathSepReadAuto, 0, wxALIGN_CENTER_VERTICAL); 00614 fraSFVPathSepReadSizer->Add(rbxSFVPathSepReadUnix, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00615 fraSFVPathSepReadSizer->Add(rbxSFVPathSepReadWindows, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00616 fraSFVPathSepReadSizer->Add(rbxSFVPathSepReadMAC, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00617 00618 // The 'Saving:' frame sizer 00619 wxStaticBoxSizer* fraSFVSavingSizer2 = new wxStaticBoxSizer(fraSFVSaving, wxVERTICAL); 00620 tabSFVSizer->Add(fraSFVSavingSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00621 wxBoxSizer* fraSFVSavingSizer = new wxBoxSizer(wxVERTICAL); 00622 fraSFVSavingSizer2->Add(fraSFVSavingSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00623 00624 fraSFVSavingSizer->Add(chkSFVSaveGenerator); 00625 wxBoxSizer* SFVIdentAsSizer = new wxBoxSizer(wxHORIZONTAL); 00626 SFVIdentAsSizer->Add(lblSFVIdentifyAs, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, CONTROL_SPACE * 2); 00627 SFVIdentAsSizer->Add(cboSFVIdentifyAs, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, CONTROL_SPACE / 2); 00628 fraSFVSavingSizer->Add(SFVIdentAsSizer, 1, wxTOP | wxGROW | wxALIGN_CENTER_VERTICAL, CONTROL_SPACE / 2); 00629 fraSFVSavingSizer->Add(chkSFVSaveFilesInfo, 0, wxTOP, CONTROL_SPACE / 2); 00630 00631 fraSFVSavingSizer->Add(lblSFVPathSepWrite, 0, wxTOP, CONTROL_SPACE); 00632 wxBoxSizer* SFVPathWriteSizer = new wxBoxSizer(wxHORIZONTAL); 00633 fraSFVSavingSizer->Add(SFVPathWriteSizer, 0); 00634 SFVPathWriteSizer->Add(rbxSFVPathSepWriteSystem, 0, wxALIGN_CENTER_VERTICAL); 00635 SFVPathWriteSizer->Add(rbxSFVPathSepWriteUnix, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00636 SFVPathWriteSizer->Add(rbxSFVPathSepWriteWindows, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00637 SFVPathWriteSizer->Add(rbxSFVPathSepWriteMAC, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00638 00639 fraSFVSavingSizer->Add(lblSFVEOLWrite, 0, wxTOP, CONTROL_SPACE); 00640 wxBoxSizer* SFVEOLWriteSizer = new wxBoxSizer(wxHORIZONTAL); 00641 fraSFVSavingSizer->Add(SFVEOLWriteSizer, 0); 00642 SFVEOLWriteSizer->Add(rbxSFVEOLWriteSystem, 0, wxALIGN_CENTER_VERTICAL); 00643 SFVEOLWriteSizer->Add(rbxSFVEOLWriteUnix, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00644 SFVEOLWriteSizer->Add(rbxSFVEOLWriteWindows, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00645 SFVEOLWriteSizer->Add(rbxSFVEOLWriteMAC, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00646 00647 00648 //------------------------------------------------------------------------- 00649 // MD5 files page 00650 wxScrolledWindow* tabMD5 = new wxScrolledWindow(sptConfigure); 00651 #if defined(USE_SCROLLEDWINDOW) 00652 tabMD5->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00653 #endif 00654 tabMD5->Hide(); 00655 00656 wxPanel* pnlMD5 = makePageTitlePanel(tabMD5, trePages->GetItemText(trePagesCksumsMD5)); 00657 00658 // Paths separators on reading 00659 wxStaticBox* fraMD5PathSepRead = new wxStaticBox(tabMD5, -1, _("Path separator on reading MD5 files:")); 00660 rbxMD5PathSepReadAuto = new wxRadioButton(tabMD5, -1, _("&Automatic recognition"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00661 rbxMD5PathSepReadUnix = new wxRadioButton(tabMD5, -1, _("&Unix: '/'")); 00662 rbxMD5PathSepReadWindows = new wxRadioButton(tabMD5, -1, _("&Windows: '\\'")); 00663 rbxMD5PathSepReadMAC = new wxRadioButton(tabMD5, -1, _("&Macintosh: ':'")); 00664 pf = static_cast<wxPathFormat>(AppPrefs::get()->readLong(prMD5_READ_PATH_SEPARATOR)); 00665 switch (pf) 00666 { 00667 case wxPATH_UNIX : rbxMD5PathSepReadUnix->SetValue(true); break; 00668 case wxPATH_WIN : rbxMD5PathSepReadWindows->SetValue(true); break; 00669 case wxPATH_MAC : rbxMD5PathSepReadMAC->SetValue(true); break; 00670 default : rbxMD5PathSepReadAuto->SetValue(true); /* wxPATH_NATIVE */ 00671 } 00672 00673 // Parameters for saving 00674 wxStaticBox* fraMD5Saving = new wxStaticBox(tabMD5, -1, _("Saving MD5 files:")); 00675 chkMD5SaveGenerator = new wxCheckBox(tabMD5, -1, _("Save the &name of the generator and the date of creation in the comments")); 00676 chkMD5SaveGenerator->SetValue(AppPrefs::get()->readBool(prMD5_WRITE_GEN_AND_DATE)); 00677 chkMD5SaveFilesInfo = new wxCheckBox(tabMD5, -1, _("Save the size and the modification &date of the files in the comments")); 00678 chkMD5SaveFilesInfo->SetValue(AppPrefs::get()->readBool(prMD5_WRITE_FILE_SIZE_AND_DATE)); 00679 00680 wxStaticText* lblMD5PathSepWrite = new wxStaticText(tabMD5, -1, _("Use the following path sepator:")); 00681 rbxMD5PathSepWriteSystem = new wxRadioButton(tabMD5, -1, wxString::Format(_("S&ystem default: '%c'"), wxFileName::GetPathSeparator()), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00682 rbxMD5PathSepWriteUnix = new wxRadioButton(tabMD5, -1, _("Un&ix: '/'")); 00683 rbxMD5PathSepWriteWindows = new wxRadioButton(tabMD5, -1, _("Wind&ows: '\\'")); 00684 rbxMD5PathSepWriteMAC = new wxRadioButton(tabMD5, -1, _("Macin&tosh: ':'")); 00685 pf = static_cast<wxPathFormat>(AppPrefs::get()->readLong(prMD5_WRITE_PATH_SEPARATOR)); 00686 switch (pf) 00687 { 00688 case wxPATH_UNIX : rbxMD5PathSepWriteUnix->SetValue(true); break; 00689 case wxPATH_WIN : rbxMD5PathSepWriteWindows->SetValue(true); break; 00690 case wxPATH_MAC : rbxMD5PathSepWriteMAC->SetValue(true); break; 00691 default : rbxMD5PathSepWriteSystem->SetValue(true); /* wxPATH_NATIVE */ 00692 } 00693 00694 wxStaticText* lblMD5EOLWrite = new wxStaticText(tabMD5, -1, _("Use the following end of line:")); 00695 rbxMD5EOLWriteSystem = new wxRadioButton(tabMD5, -1, _("Syst&em native"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00696 rbxMD5EOLWriteUnix = new wxRadioButton(tabMD5, -1, _("Uni&x")); 00697 rbxMD5EOLWriteWindows = new wxRadioButton(tabMD5, -1, _("Window&s")); 00698 rbxMD5EOLWriteMAC = new wxRadioButton(tabMD5, -1, _("Macintos&h")); 00699 eol = static_cast<wxEOL>(AppPrefs::get()->readLong(prMD5_WRITE_EOL)); 00700 switch (eol) 00701 { 00702 case wxEOL_UNIX : rbxMD5EOLWriteUnix->SetValue(true); break; 00703 case wxEOL_DOS : rbxMD5EOLWriteWindows->SetValue(true); break; 00704 case wxEOL_MAC : rbxMD5EOLWriteMAC->SetValue(true); break; 00705 default : rbxMD5EOLWriteSystem->SetValue(true); 00706 } 00707 00708 // MD5 tab sizer 00709 // The panel sizer 00710 wxBoxSizer* tabMD5Sizer2 = new wxBoxSizer(wxVERTICAL); 00711 tabMD5->SetSizer(tabMD5Sizer2); 00712 wxBoxSizer* tabMD5Sizer = new wxBoxSizer(wxVERTICAL); 00713 tabMD5Sizer2->Add(tabMD5Sizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00714 00715 // Title of the page 00716 tabMD5Sizer->Add(pnlMD5, 0, wxGROW); 00717 00718 // The 'Path separator on reading MD5 files:' frame sizer 00719 wxStaticBoxSizer* fraMD5PathSepReadSizer2 = new wxStaticBoxSizer(fraMD5PathSepRead, wxVERTICAL); 00720 tabMD5Sizer->Add(fraMD5PathSepReadSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00721 wxBoxSizer* fraMD5PathSepReadSizer = new wxBoxSizer(wxHORIZONTAL); 00722 fraMD5PathSepReadSizer2->Add(fraMD5PathSepReadSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00723 00724 fraMD5PathSepReadSizer->Add(rbxMD5PathSepReadAuto, 0, wxALIGN_CENTER_VERTICAL); 00725 fraMD5PathSepReadSizer->Add(rbxMD5PathSepReadUnix, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00726 fraMD5PathSepReadSizer->Add(rbxMD5PathSepReadWindows, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00727 fraMD5PathSepReadSizer->Add(rbxMD5PathSepReadMAC, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00728 00729 // The 'Saving:' frame sizer 00730 wxStaticBoxSizer* fraMD5SavingSizer2 = new wxStaticBoxSizer(fraMD5Saving, wxVERTICAL); 00731 tabMD5Sizer->Add(fraMD5SavingSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00732 wxBoxSizer* fraMD5SavingSizer = new wxBoxSizer(wxVERTICAL); 00733 fraMD5SavingSizer2->Add(fraMD5SavingSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00734 00735 fraMD5SavingSizer->Add(chkMD5SaveGenerator); 00736 fraMD5SavingSizer->Add(chkMD5SaveFilesInfo, 0, wxTOP, CONTROL_SPACE / 2); 00737 00738 fraMD5SavingSizer->Add(lblMD5PathSepWrite, 0, wxTOP, CONTROL_SPACE); 00739 wxBoxSizer* MD5PathWriteSizer = new wxBoxSizer(wxHORIZONTAL); 00740 fraMD5SavingSizer->Add(MD5PathWriteSizer, 0); 00741 MD5PathWriteSizer->Add(rbxMD5PathSepWriteSystem, 0, wxALIGN_CENTER_VERTICAL); 00742 MD5PathWriteSizer->Add(rbxMD5PathSepWriteUnix, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00743 MD5PathWriteSizer->Add(rbxMD5PathSepWriteWindows, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00744 MD5PathWriteSizer->Add(rbxMD5PathSepWriteMAC, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00745 00746 fraMD5SavingSizer->Add(lblMD5EOLWrite, 0, wxTOP, CONTROL_SPACE); 00747 wxBoxSizer* MD5EOLWriteSizer = new wxBoxSizer(wxHORIZONTAL); 00748 fraMD5SavingSizer->Add(MD5EOLWriteSizer, 0); 00749 MD5EOLWriteSizer->Add(rbxMD5EOLWriteSystem, 0, wxALIGN_CENTER_VERTICAL); 00750 MD5EOLWriteSizer->Add(rbxMD5EOLWriteUnix, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00751 MD5EOLWriteSizer->Add(rbxMD5EOLWriteWindows, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00752 MD5EOLWriteSizer->Add(rbxMD5EOLWriteMAC, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, CONTROL_SPACE); 00753 00754 00755 //------------------------------------------------------------------------- 00756 // Tools page 00757 wxScrolledWindow* tabTools = new wxScrolledWindow(sptConfigure); 00758 #if defined(USE_SCROLLEDWINDOW) 00759 tabTools->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00760 #endif 00761 tabTools->Hide(); 00762 00763 wxPanel* pnlTools = makePageTitlePanel(tabTools, trePages->GetItemText(trePagesTools), 1); 00764 00765 // Sizers 00766 // The panel sizer 00767 wxBoxSizer* tabToolsSizer2 = new wxBoxSizer(wxVERTICAL); 00768 tabTools->SetSizer(tabToolsSizer2); 00769 wxBoxSizer* tabToolsSizer = new wxBoxSizer(wxVERTICAL); 00770 tabToolsSizer2->Add(tabToolsSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00771 00772 // Title of the page 00773 tabToolsSizer->Add(pnlTools, 0, wxGROW); 00774 00775 00776 //------------------------------------------------------------------------- 00777 // Multiple check page 00778 wxScrolledWindow* tabMultiCheck = new wxScrolledWindow(sptConfigure); 00779 #if defined(USE_SCROLLEDWINDOW) 00780 tabMultiCheck->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00781 #endif 00782 tabMultiCheck->Hide(); 00783 00784 wxPanel* pnlMultiCheck = makePageTitlePanel(tabMultiCheck, trePages->GetItemText(trePagesToolsMultiCheck)); 00785 00786 // Results frame. 00787 wxStaticBox* fraMCDisplayResults = new wxStaticBox(tabMultiCheck, -1, _("Displaying of the results:")); 00788 chkMCGlobalSummary = new wxCheckBox(tabMultiCheck, -1, _("Display a &global summary")); 00789 chkMCGlobalSummary->SetValue(AppPrefs::get()->readBool(prMC_GLOBAL_SUMMARY)); 00790 chkMCChecksumsFileSummary = new wxCheckBox(tabMultiCheck, -1, _("Display a summary for each &checksums' file")); 00791 chkMCChecksumsFileSummary->SetValue(AppPrefs::get()->readBool(prMC_CHECKSUMS_FILE_SUMMARY)); 00792 chkMCNoCorrectFileState = NULL; 00793 chkMCFileState = new wxCheckBox(tabMultiCheck, CHK_MC_FILE_STATE, _("Display the state of each checked &file")); 00794 chkMCFileState->SetValue(AppPrefs::get()->readBool(prMC_FILE_STATE)); 00795 chkMCNoCorrectFileState = new wxCheckBox(tabMultiCheck, -1, _("Don't display the state of the c&orrect files")); 00796 chkMCNoCorrectFileState->SetValue(AppPrefs::get()->readBool(prMC_NO_CORRECT_FILE_STATE)); 00797 chkMCNoCorrectFileState->Enable(chkMCFileState->GetValue()); 00798 00799 // Colors of the text. 00800 wxStaticBox* fraMCTextColours = new wxStaticBox(tabMultiCheck, -1, _("Text colours:")); 00801 00802 MCNormalColour = ::longTowxColour(AppPrefs::get()->readLong(prMC_NORMAL_COLOUR)); 00803 MCSuccessColour = ::longTowxColour(AppPrefs::get()->readLong(prMC_SUCCESS_COLOUR)); 00804 MCWarningColour = ::longTowxColour(AppPrefs::get()->readLong(prMC_WARNING_COLOUR)); 00805 MCErrorColour = ::longTowxColour(AppPrefs::get()->readLong(prMC_ERROR_COLOUR)); 00806 00807 wxStaticText* lblMCNormalColour = new wxStaticText(tabMultiCheck, -1, _("&Normal:")); 00808 btnMCNormalColour = new wxBitmapButton(tabMultiCheck, BTN_MC_NORMAL_COLOUR, ::createBitmapForButton(MCNormalColour, lblMCNormalColour)); 00809 wxStaticText* lblMCSuccessColour = new wxStaticText(tabMultiCheck, -1, _("&Success:")); 00810 btnMCSuccessColour = new wxBitmapButton(tabMultiCheck, BTN_MC_SUCCESS_COLOUR, ::createBitmapForButton(MCSuccessColour, lblMCSuccessColour)); 00811 wxStaticText* lblMCWarningColour = new wxStaticText(tabMultiCheck, -1, _("&Warning:")); 00812 btnMCWarningColour = new wxBitmapButton(tabMultiCheck, BTN_MC_WARNING_COLOUR, ::createBitmapForButton(MCWarningColour, lblMCWarningColour)); 00813 wxStaticText* lblMCErrorColour = new wxStaticText(tabMultiCheck, -1, _("&Error:")); 00814 btnMCErrorColour = new wxBitmapButton(tabMultiCheck, BTN_MC_ERROR_COLOUR, ::createBitmapForButton(MCErrorColour, lblMCErrorColour)); 00815 00816 // Multiple check page sizer 00817 // The panel sizer 00818 wxBoxSizer* tabMultiCheckSizer2 = new wxBoxSizer(wxVERTICAL); 00819 tabMultiCheck->SetSizer(tabMultiCheckSizer2); 00820 wxBoxSizer* tabMultiCheckSizer = new wxBoxSizer(wxVERTICAL); 00821 tabMultiCheckSizer2->Add(tabMultiCheckSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00822 00823 // Title of the page 00824 tabMultiCheckSizer->Add(pnlMultiCheck, 0, wxGROW); 00825 00826 // The 'Displaying of the results:' frame sizer 00827 wxStaticBoxSizer* fraMCDisplayResultsSizer2 = new wxStaticBoxSizer(fraMCDisplayResults, wxVERTICAL); 00828 tabMultiCheckSizer->Add(fraMCDisplayResultsSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00829 wxBoxSizer* fraMCDisplayResultsSizer = new wxBoxSizer(wxVERTICAL); 00830 fraMCDisplayResultsSizer2->Add(fraMCDisplayResultsSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00831 00832 fraMCDisplayResultsSizer->Add(chkMCGlobalSummary); 00833 fraMCDisplayResultsSizer->Add(chkMCChecksumsFileSummary, 0, wxTOP, CONTROL_SPACE / 2); 00834 fraMCDisplayResultsSizer->Add(chkMCFileState, 0, wxTOP, CONTROL_SPACE / 2); 00835 wxBoxSizer* chkMCNoCorrectFileStateSizer = new wxBoxSizer(wxVERTICAL); 00836 fraMCDisplayResultsSizer->Add(chkMCNoCorrectFileStateSizer, 0, wxTOP, CONTROL_SPACE / 2); 00837 chkMCNoCorrectFileStateSizer->Add(chkMCNoCorrectFileState, 0, wxLEFT, (3 * CONTROL_SPACE) / 2); 00838 00839 // The 'Colours of the text:' frame sizer 00840 wxStaticBoxSizer* fraMCTextColoursSizer2 = new wxStaticBoxSizer(fraMCTextColours, wxVERTICAL); 00841 tabMultiCheckSizer->Add(fraMCTextColoursSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00842 wxFlexGridSizer* fraMCTextColoursSizer = new wxFlexGridSizer(2, CONTROL_SPACE / 2, CONTROL_SPACE); 00843 fraMCTextColoursSizer2->Add(fraMCTextColoursSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00844 00845 fraMCTextColoursSizer->Add(lblMCNormalColour, 0, wxALIGN_CENTER_VERTICAL); 00846 fraMCTextColoursSizer->Add(btnMCNormalColour, 0, wxALIGN_CENTER_VERTICAL); 00847 fraMCTextColoursSizer->Add(lblMCSuccessColour, 0, wxALIGN_CENTER_VERTICAL); 00848 fraMCTextColoursSizer->Add(btnMCSuccessColour, 0, wxALIGN_CENTER_VERTICAL); 00849 fraMCTextColoursSizer->Add(lblMCWarningColour, 0, wxALIGN_CENTER_VERTICAL); 00850 fraMCTextColoursSizer->Add(btnMCWarningColour, 0, wxALIGN_CENTER_VERTICAL); 00851 fraMCTextColoursSizer->Add(lblMCErrorColour, 0, wxALIGN_CENTER_VERTICAL); 00852 fraMCTextColoursSizer->Add(btnMCErrorColour, 0, wxALIGN_CENTER_VERTICAL); 00853 00854 00855 //------------------------------------------------------------------------- 00856 // Batch creation page 00857 wxScrolledWindow* tabBatchCreation = new wxScrolledWindow(sptConfigure); 00858 #if defined(USE_SCROLLEDWINDOW) 00859 tabBatchCreation->SetScrollRate(CONTROL_SPACE, CONTROL_SPACE); 00860 #endif 00861 tabBatchCreation->Hide(); 00862 00863 wxPanel* pnlBatchCreation = makePageTitlePanel(tabBatchCreation, trePages->GetItemText(trePagesToolsBatchCreation)); 00864 00865 // "When a checksums' file alrealdy exists" frame. 00866 wxStaticBox* fraBCCkFileExists = new wxStaticBox(tabBatchCreation, -1, _("When a checksums' file alrealdy exists:")); 00867 rbxBCSkipExistingCkFile = new wxRadioButton(tabBatchCreation, -1, _("S&kip the creation"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00868 rbxBCOverwriteExistingCkFile = new wxRadioButton(tabBatchCreation, -1, _("&Overwrite it")); 00869 if (AppPrefs::get()->readBool(prBC_OVERWRITE_WHEN_CKFILE_EXISTS)) 00870 rbxBCOverwriteExistingCkFile->SetValue(true); 00871 else 00872 rbxBCSkipExistingCkFile->SetValue(true); 00873 00874 // "Create the name of the checksums' file by:" frame 00875 wxStaticBox* fraBCChecksumsFileName = new wxStaticBox(tabBatchCreation, -1, _("Create the name of the checksums' file by:")); 00876 rbxBCReplaceFileExtension = new wxRadioButton(tabBatchCreation, -1, _("&Replacing the extension of the source file with the extension of the type of the checksums' file"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); 00877 rbxBCAddFileExtension = new wxRadioButton(tabBatchCreation, -1, _("&Adding the extension of the type of the checksums' file to the name of the source file")); 00878 if (AppPrefs::get()->readBool(prBC_REPLACE_FILE_EXTENSION)) 00879 rbxBCReplaceFileExtension->SetValue(true); 00880 else 00881 rbxBCAddFileExtension->SetValue(true); 00882 00883 // The "Verbosity level of the report:" frame 00884 wxStaticBox* fraBCVerbosityLevel = new wxStaticBox(tabBatchCreation, -1, _("Level of &verbosity of the report:")); 00885 const wxString strVerbosityLevels[] = { _("Errors only"), _("Errors and warnings"), _("Normal"), _("Talkative") }; 00886 cboBCVerbosityLevel = new wxChoice(tabBatchCreation, -1, wxDefaultPosition, wxDefaultSize, 00887 4, strVerbosityLevels); 00888 i = static_cast<int>(AppPrefs::get()->readLong(prBC_VERBOSITY_LEVEL)); 00889 if (i < 0 || i > 3) i = 2; // normal 00890 cboBCVerbosityLevel->SetSelection(i); 00891 00892 // Colors of the text. 00893 wxStaticBox* fraBCTextColours = new wxStaticBox(tabBatchCreation, -1, _("Text colours:")); 00894 00895 BCNormalColour = ::longTowxColour(AppPrefs::get()->readLong(prBC_NORMAL_COLOUR)); 00896 BCSuccessColour = ::longTowxColour(AppPrefs::get()->readLong(prBC_SUCCESS_COLOUR)); 00897 BCWarningColour = ::longTowxColour(AppPrefs::get()->readLong(prBC_WARNING_COLOUR)); 00898 BCErrorColour = ::longTowxColour(AppPrefs::get()->readLong(prBC_ERROR_COLOUR)); 00899 00900 wxStaticText* lblBCNormalColour = new wxStaticText(tabBatchCreation, -1, _("&Normal:")); 00901 btnBCNormalColour = new wxBitmapButton(tabBatchCreation, BTN_BC_NORMAL_COLOUR, ::createBitmapForButton(BCNormalColour, lblBCNormalColour)); 00902 wxStaticText* lblBCSuccessColour = new wxStaticText(tabBatchCreation, -1, _("&Success:")); 00903 btnBCSuccessColour = new wxBitmapButton(tabBatchCreation, BTN_BC_SUCCESS_COLOUR, ::createBitmapForButton(BCSuccessColour, lblBCSuccessColour)); 00904 wxStaticText* lblBCWarningColour = new wxStaticText(tabBatchCreation, -1, _("&Warning:")); 00905 btnBCWarningColour = new wxBitmapButton(tabBatchCreation, BTN_BC_WARNING_COLOUR, ::createBitmapForButton(BCWarningColour, lblBCWarningColour)); 00906 wxStaticText* lblBCErrorColour = new wxStaticText(tabBatchCreation, -1, _("&Error:")); 00907 btnBCErrorColour = new wxBitmapButton(tabBatchCreation, BTN_BC_ERROR_COLOUR, ::createBitmapForButton(BCErrorColour, lblBCErrorColour)); 00908 00909 // Batch creation page sizer 00910 // The panel sizer 00911 wxBoxSizer* tabBatchCreationSizer2 = new wxBoxSizer(wxVERTICAL); 00912 tabBatchCreation->SetSizer(tabBatchCreationSizer2); 00913 wxBoxSizer* tabBatchCreationSizer = new wxBoxSizer(wxVERTICAL); 00914 tabBatchCreationSizer2->Add(tabBatchCreationSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00915 00916 // Title of the page 00917 tabBatchCreationSizer->Add(pnlBatchCreation, 0, wxGROW); 00918 00919 // The "When a checksums' file alrealdy exists" frame sizer 00920 wxStaticBoxSizer* fraBCCkFileExistsSizer2 = new wxStaticBoxSizer(fraBCCkFileExists, wxVERTICAL); 00921 tabBatchCreationSizer->Add(fraBCCkFileExistsSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00922 wxBoxSizer* fraBCCkFileExistsSizer = new wxBoxSizer(wxVERTICAL); 00923 fraBCCkFileExistsSizer2->Add(fraBCCkFileExistsSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00924 00925 fraBCCkFileExistsSizer->Add(rbxBCSkipExistingCkFile); 00926 fraBCCkFileExistsSizer->Add(rbxBCOverwriteExistingCkFile, 0, wxTOP, CONTROL_SPACE / 2); 00927 00928 // The "Create the name of the checksums' file by:" frame sizer 00929 wxStaticBoxSizer* fraBCChecksumsFileNameSizer2 = new wxStaticBoxSizer(fraBCChecksumsFileName, wxVERTICAL); 00930 tabBatchCreationSizer->Add(fraBCChecksumsFileNameSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00931 wxBoxSizer* fraBCChecksumsFileNameSizer = new wxBoxSizer(wxVERTICAL); 00932 fraBCChecksumsFileNameSizer2->Add(fraBCChecksumsFileNameSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00933 00934 fraBCChecksumsFileNameSizer->Add(rbxBCReplaceFileExtension); 00935 fraBCChecksumsFileNameSizer->Add(rbxBCAddFileExtension, 0, wxTOP, CONTROL_SPACE / 2); 00936 00937 // The "Verbosity level of the report:" frame sizer 00938 wxStaticBoxSizer* fraBCVerbosityLevelSizer2 = new wxStaticBoxSizer(fraBCVerbosityLevel, wxVERTICAL); 00939 tabBatchCreationSizer->Add(fraBCVerbosityLevelSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00940 wxBoxSizer* fraBCVerbosityLevelSizer = new wxBoxSizer(wxVERTICAL); 00941 fraBCVerbosityLevelSizer2->Add(fraBCVerbosityLevelSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00942 00943 fraBCVerbosityLevelSizer->Add(cboBCVerbosityLevel); 00944 00945 // The 'Colours of the text:' frame sizer 00946 wxStaticBoxSizer* fraBCTextColoursSizer2 = new wxStaticBoxSizer(fraBCTextColours, wxVERTICAL); 00947 tabBatchCreationSizer->Add(fraBCTextColoursSizer2, 0, wxGROW | wxTOP, CONTROL_SPACE); 00948 wxFlexGridSizer* fraBCTextColoursSizer = new wxFlexGridSizer(2, CONTROL_SPACE / 2, CONTROL_SPACE); 00949 fraBCTextColoursSizer2->Add(fraBCTextColoursSizer, 0, wxALL | wxGROW, CONTROL_SPACE / 2); 00950 00951 fraBCTextColoursSizer->Add(lblBCNormalColour, 0, wxALIGN_CENTER_VERTICAL); 00952 fraBCTextColoursSizer->Add(btnBCNormalColour, 0, wxALIGN_CENTER_VERTICAL); 00953 fraBCTextColoursSizer->Add(lblBCSuccessColour, 0, wxALIGN_CENTER_VERTICAL); 00954 fraBCTextColoursSizer->Add(btnBCSuccessColour, 0, wxALIGN_CENTER_VERTICAL); 00955 fraBCTextColoursSizer->Add(lblBCWarningColour, 0, wxALIGN_CENTER_VERTICAL); 00956 fraBCTextColoursSizer->Add(btnBCWarningColour, 0, wxALIGN_CENTER_VERTICAL); 00957 fraBCTextColoursSizer->Add(lblBCErrorColour, 0, wxALIGN_CENTER_VERTICAL); 00958 fraBCTextColoursSizer->Add(btnBCErrorColour, 0, wxALIGN_CENTER_VERTICAL); 00959 00960 00961 //------------------------------------------------------------------------- 00962 // The validation buttons 00963 wxButton* btnOK = new wxButton(this, wxID_OK, _("OK")); 00964 btnOK->SetDefault(); 00965 wxButton* btnCancel = new wxButton(this, wxID_CANCEL, _("Cancel"));; 00966 00967 // Validation buttons sizer 00968 wxGridSizer* buttonsSizer = new wxGridSizer(2, 0, 2 * CONTROL_SPACE); 00969 buttonsSizer->Add(btnOK); 00970 buttonsSizer->Add(btnCancel); 00971 00972 00973 //------------------------------------------------------------------------- 00974 // Dialog sizer 00975 wxBoxSizer* dlgConfigureSizer2 = new wxBoxSizer(wxVERTICAL); 00976 this->SetSizer(dlgConfigureSizer2); 00977 wxBoxSizer* dlgConfigureSizer = new wxBoxSizer(wxVERTICAL); 00978 dlgConfigureSizer2->Add(dlgConfigureSizer, 1, wxALL | wxGROW, CONTROL_SPACE); 00979 00980 dlgConfigureSizer->Add(sptConfigure, 1, wxALL | wxGROW); 00981 dlgConfigureSizer->Add(buttonsSizer, 0, wxTOP | wxALIGN_RIGHT, CONTROL_SPACE); 00982 00983 // Set on the auto-layout feature 00984 this->SetAutoLayout(true); 00985 this->Layout(); 00986 00987 // Sets the background color 00988 //this->SetBackgroundColour(a_control->GetBackgroundColour()); 00989 00990 //------------------------------------------------------------------------- 00991 // Dialog initialization 00992 // Initializes the spitter. 00993 sptConfigure->SplitVertically(trePages, tabInterface, AppPrefs::get()->readLong(prGUI_CONF_SASH_POSITION, 100L)); 00994 00995 // Initializes the array that make the correspondance between the Page 00996 // identifiers in the tree and the controls that contains the pages. 00997 // See dlgConfigure::TreePagesId for the order of insertion. 00998 pagesArray.Add(tabInterface); 00999 pagesArray.Add(tabDisplay); 01000 pagesArray.Add(tabBehavior); 01001 pagesArray.Add(tabLanguage); 01002 pagesArray.Add(tabCmdLine); 01003 pagesArray.Add(tabChecksumsFiles); 01004 pagesArray.Add(tabSFV); 01005 pagesArray.Add(tabMD5); 01006 pagesArray.Add(tabTools); 01007 pagesArray.Add(tabMultiCheck); 01008 pagesArray.Add(tabBatchCreation); 01009 01010 // Selected item 01011 trePages->SelectItem(trePagesGUIDisplay); 01012 01013 // Initializes the selector of client identificator for writing SFV files. 01014 // The two first items never change. The first is the name of the current 01015 // version of wxChecksums, the second is an entry to add a personalized one. 01016 cboSFVIdentifyAs->Append(::getAppName(true)); 01017 cboSFVIdentifyAs->Append(_("Personalized...")); 01018 wxString s; 01019 for (i = 1; i <= getSFVGeneratorIdentifierHistoryMaxSize(); i++) 01020 { 01021 s = wxConfig::Get()->Read(getSFVGeneratorIdentifierConfigKey(i), wxString()); 01022 if (!s.IsEmpty()) 01023 cboSFVIdentifyAs->Append(s); 01024 } 01025 if (AppPrefs::get()->readString(prSFV_IDENTIFY_AS).IsEmpty()) 01026 // Use default identifier 01027 cboSFVIdentifyAs->SetSelection(0); 01028 else 01029 if ((i = cboSFVIdentifyAs->FindString(AppPrefs::get()->readString(prSFV_IDENTIFY_AS))) == -1) 01030 cboSFVIdentifyAs->SetSelection(0); 01031 else 01032 cboSFVIdentifyAs->SetSelection(i); 01033 } 01034 //--------------------------------------------------------------------------- 01035 01036 01037 /** 01038 * The class descructor. 01039 */ 01040 dlgConfigure::~dlgConfigure() 01041 { 01042 } 01043 //--------------------------------------------------------------------------- 01044 01045 01046 /** 01047 * Event handler for a selection change. 01048 * 01049 * @param event The event's parameters 01050 */ 01051 void dlgConfigure::trePagesSelChanged(wxTreeEvent& event) 01052 { 01053 #if defined(__VISUALC__) // Visual C++ doesn't seem to like this dynamic_cast 01054 TreePagesItemData* data = (TreePagesItemData*)trePages->GetItemData(event.GetItem()); 01055 #else 01056 TreePagesItemData* data = dynamic_cast<TreePagesItemData*>(trePages->GetItemData(event.GetItem())); 01057 #endif 01058 if (data != NULL) 01059 { 01060 int page = data->GetPageId(); 01061 wxScrolledWindow* oldPanel = wxDynamicCast(sptConfigure->GetWindow2(), wxScrolledWindow); 01062 wxScrolledWindow* newPanel = wxDynamicCast(pagesArray[page], wxScrolledWindow); 01063 if (oldPanel != newPanel) 01064 { 01065 oldPanel->Hide(); 01066 sptConfigure->ReplaceWindow(oldPanel, newPanel); 01067 newPanel->Show(); 01068 } 01069 } 01070 else 01071 trePages->SelectItem(event.GetOldItem()); 01072 } 01073 //--------------------------------------------------------------------------- 01074 01075 01076 /** 01077 * Processes button Up. 01078 * 01079 * @param event The event's parameters. 01080 */ 01081 void dlgConfigure::btnSumsHeadersUpClick(wxCommandEvent& event) 01082 { 01083 int sel = lstSumsHeaders->GetSelection(); 01084 if (sel > 0) 01085 { 01086 wxString swapText = lstSumsHeaders->GetString(sel); 01087 void* swapData = lstSumsHeaders->GetClientData(sel); 01088 lstSumsHeaders->SetString(sel, lstSumsHeaders->GetString(sel - 1)); 01089 lstSumsHeaders->SetClientData(sel, lstSumsHeaders->GetClientData(sel - 1)); 01090 lstSumsHeaders->SetString(sel - 1, swapText); 01091 lstSumsHeaders->SetClientData(sel - 1, swapData); 01092 lstSumsHeaders->SetSelection(sel - 1); 01093 } 01094 } 01095 //--------------------------------------------------------------------------- 01096 01097 01098 /** 01099 * Processes button Down. 01100 * 01101 * @param event The event's parameters. 01102 */ 01103 void dlgConfigure::btnSumsHeadersDownClick(wxCommandEvent& event) 01104 { 01105 int sel = lstSumsHeaders->GetSelection(); 01106 if (sel >= 0 && sel < lstSumsHeaders->GetCount() - 1) 01107 { 01108 wxString swapText = lstSumsHeaders->GetString(sel); 01109 void* swapData = lstSumsHeaders->GetClientData(sel); 01110 lstSumsHeaders->SetString(sel, lstSumsHeaders->GetString(sel + 1)); 01111 lstSumsHeaders->SetClientData(sel, lstSumsHeaders->GetClientData(sel + 1)); 01112 lstSumsHeaders->SetString(sel + 1, swapText); 01113 lstSumsHeaders->SetClientData(sel + 1, swapData); 01114 lstSumsHeaders->SetSelection(sel + 1); 01115 } 01116 } 01117 //--------------------------------------------------------------------------- 01118 01119 01120 /** 01121 * Processes a selection in the choices of SFV generators. 01122 * 01123 * @param event The event's parameters. 01124 */ 01125 void dlgConfigure::cboSFVIdentifyAsSelect(wxCommandEvent& event) 01126 { 01127 if (event.GetInt() == 1) 01128 // Enter a custom identifier 01129 { 01130 wxString id = ::wxGetTextFromUser(_("Name of the generator:"), _("Identify as"), ::getAppName(true), this, -1, -1, false); 01131 if (!id.IsEmpty()) 01132 { 01133 int sel = addSFVGeneratorIdentifier(id); 01134 cboSFVIdentifyAs->SetSelection(sel); 01135 } 01136 else // Select the default identifier 01137 cboSFVIdentifyAs->SetSelection(0); 01138 } 01139 } 01140 //--------------------------------------------------------------------------- 01141 01142 01143 /** 01144 * Processes check on the <CODE>chkMCFileState</CODE> check box. 01145 * 01146 * @param event The event's parameters. 01147 */ 01148 void dlgConfigure::chkMCFileStateCheck(wxCommandEvent& event) 01149 { 01150 if (chkMCNoCorrectFileState != NULL) 01151 chkMCNoCorrectFileState->Enable(event.IsChecked()); 01152 } 01153 //--------------------------------------------------------------------------- 01154 01155 01156 /** 01157 * Processes button for changing colours of the results text of the multiple 01158 * check dialog. 01159 * 01160 * @param event The event's parameters. 01161 */ 01162 void dlgConfigure::btnMCColoursClick(wxCommandEvent& event) 01163 { 01164 wxColour colour, res; 01165 01166 switch (event.GetId()) 01167 { 01168 case BTN_MC_NORMAL_COLOUR : colour = MCNormalColour; break; 01169 case BTN_MC_SUCCESS_COLOUR : colour = MCSuccessColour; break; 01170 case BTN_MC_WARNING_COLOUR : colour = MCWarningColour; break; 01171 case BTN_MC_ERROR_COLOUR : colour = MCErrorColour; break; 01172 case BTN_BC_NORMAL_COLOUR : colour = BCNormalColour; break; 01173 case BTN_BC_SUCCESS_COLOUR : colour = BCSuccessColour; break; 01174 case BTN_BC_WARNING_COLOUR : colour = BCWarningColour; break; 01175 case BTN_BC_ERROR_COLOUR : colour = BCErrorColour; break; 01176 default: 01177 return; // problem go away. 01178 } 01179 01180 res = ::wxGetColourFromUser(this, colour); 01181 if (res.Ok()) 01182 { 01183 wxBitmapButton* button; 01184 switch (event.GetId()) 01185 { 01186 case BTN_MC_NORMAL_COLOUR : 01187 MCNormalColour = res; 01188 button = btnMCNormalColour; 01189 break; 01190 case BTN_MC_SUCCESS_COLOUR : 01191 MCSuccessColour = res; 01192 button = btnMCSuccessColour; 01193 break; 01194 case BTN_MC_WARNING_COLOUR : 01195 MCWarningColour = res; 01196 button = btnMCWarningColour; 01197 break; 01198 case BTN_MC_ERROR_COLOUR : 01199 MCErrorColour = res; 01200 button = btnMCErrorColour; 01201 break; 01202 case BTN_BC_NORMAL_COLOUR : 01203 BCNormalColour = res; 01204 button = btnBCNormalColour; 01205 break; 01206 case BTN_BC_SUCCESS_COLOUR : 01207 BCSuccessColour = res; 01208 button = btnBCSuccessColour; 01209 break; 01210 case BTN_BC_WARNING_COLOUR : 01211 BCWarningColour = res; 01212 button = btnBCWarningColour; 01213 break; 01214 case BTN_BC_ERROR_COLOUR : 01215 BCErrorColour = res; 01216 button = btnBCErrorColour; 01217 break; 01218 } 01219 01220 button->SetBitmapLabel(::createBitmapForButton(res, button)); 01221 } 01222 } 01223 //--------------------------------------------------------------------------- 01224 01225 01226 /** 01227 * Makes a panel that contains the title of a configuration page. 01228 * 01229 * @param parent Parent of the panel. 01230 * @param title Title of the page. 01231 * @param level Level of the page (1 or 2). 01232 * @return A panel that contains the title of a configuration page. 01233 */ 01234 wxPanel* dlgConfigure::makePageTitlePanel(wxWindow* parent, const wxString& title, int const level) 01235 { 01236 const int fontSize = (level >= 1 && level <= 2) ? 175 - (25 * level) : 125; 01237 01238 wxPanel* pnlTitle = new wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER); 01239 pnlTitle->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); 01240 01241 wxStaticText* lblTitle = new wxStaticText(pnlTitle, -1, title); 01242 lblTitle->SetBackgroundColour(pnlTitle->GetBackgroundColour()); 01243 lblTitle->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); 01244 wxFont f = lblTitle->GetFont(); 01245 lblTitle->SetFont(wxFont((f.GetPointSize() * fontSize) / 100, f.GetFamily(), f.GetStyle(), wxFONTWEIGHT_BOLD, f.GetUnderlined(), f.GetFaceName(), f.GetDefaultEncoding())); 01246 01247 wxBoxSizer* titleSizer = new wxBoxSizer(wxVERTICAL); 01248 titleSizer->Add(lblTitle, 1, wxGROW | wxALL, CONTROL_SPACE / 2); 01249 pnlTitle->SetSizer(titleSizer); 01250 pnlTitle->Fit(); 01251 01252 return pnlTitle; 01253 } 01254 //--------------------------------------------------------------------------- 01255 01256 01257 /** 01258 * Adds an item in the choices of the generators identifiers on saving SFV files. 01259 * 01260 * @param identifier Identifier to add to the list of choices. 01261 * @return The index where the identifier has been added. 01262 */ 01263 int dlgConfigure::addSFVGeneratorIdentifier(const wxString& identifier) 01264 { 01265 wxArrayString entries; 01266 int index; // index where the identifier has been added. 01267 01268 // The two first items never change. The first is the name of the current 01269 // version of wxChecksums, the second is an entry to add a personalized one. 01270 entries.Add(cboSFVIdentifyAs->GetString(0)); 01271 entries.Add(cboSFVIdentifyAs->GetString(1)); 01272 01273 // Add the new identifier at the "top" of the choices. 01274 int i = entries.Index(identifier); 01275 if (i == wxNOT_FOUND) 01276 // The identifier is not a "reserved" identifier, adding it. 01277 { 01278 entries.Add(identifier); 01279 index = 2; 01280 } 01281 else // using the default identifier of the application. 01282 index = 0; 01283 01284 // Adding the rest of choice control 01285 wxString toAdd; // string to add 01286 for (i = 2; i < cboSFVIdentifyAs->GetCount(); i++) 01287 { 01288 toAdd = cboSFVIdentifyAs->GetString(i); 01289 if (entries.Index(toAdd) == wxNOT_FOUND) 01290 entries.Add(toAdd); 01291 } 01292 01293 // Recreates the choice control entries 01294 cboSFVIdentifyAs->Clear(); 01295 int to = (entries.GetCount() <= getSFVGeneratorIdentifierHistoryMaxSize() + 2) ? entries.GetCount() : getSFVGeneratorIdentifierHistoryMaxSize() + 2; // + 2 => two first items are always there 01296 for (i = 0; i < to; i++) 01297 cboSFVIdentifyAs->Append(entries[i]); 01298 01299 return index; 01300 } 01301 //--------------------------------------------------------------------------- 01302 01303 01304 /** 01305 * Gets the configuration key of the <I>n</I>th generator identifier on saving SFV files. 01306 * 01307 * @param n The nth history configuration key to get. 01308 * @return The configuration key of the <I>n</I>th generator identifier on saving SFV files. 01309 */ 01310 wxString dlgConfigure::getSFVGeneratorIdentifierConfigKey(const int n) const 01311 { 01312 if (n >= 1 && n <= getSFVGeneratorIdentifierHistoryMaxSize()) 01313 { 01314 wxString rootConfigKey = AppPrefs::get()->getConfigKey(prSFV_WRITE_GEN_AND_DATE).BeforeLast(wxT('/')); 01315 return rootConfigKey + wxString::Format(wxT("/IdentifyAs/History/Identify%02d"), n); 01316 } 01317 else 01318 return wxEmptyString; 01319 } 01320 //--------------------------------------------------------------------------- 01321 01322 01323 /** 01324 * Gets the maximum size of the history of the generators identifiers on 01325 * saving SFV files. 01326 * 01327 * @return the maximum size of the history of the generators identifiers on 01328 * saving SFV files. 01329 */ 01330 int dlgConfigure::getSFVGeneratorIdentifierHistoryMaxSize() const 01331 { 01332 return 16; 01333 } 01334 //--------------------------------------------------------------------------- 01335 01336 01337 01338 BEGIN_EVENT_TABLE(dlgConfigure, wxDialog) 01339 EVT_BUTTON(BTN_SUMS_HEADERS_UP, dlgConfigure::btnSumsHeadersUpClick) 01340 EVT_BUTTON(BTN_SUMS_HEADERS_DOWN, dlgConfigure::btnSumsHeadersDownClick) 01341 EVT_CHOICE(CBO_SFV_IDENTIFY_AS, dlgConfigure::cboSFVIdentifyAsSelect) 01342 EVT_CHECKBOX(CHK_MC_FILE_STATE, dlgConfigure::chkMCFileStateCheck) 01343 EVT_BUTTON(BTN_MC_NORMAL_COLOUR, dlgConfigure::btnMCColoursClick) 01344 EVT_BUTTON(BTN_MC_SUCCESS_COLOUR, dlgConfigure::btnMCColoursClick) 01345 EVT_BUTTON(BTN_MC_WARNING_COLOUR, dlgConfigure::btnMCColoursClick) 01346 EVT_BUTTON(BTN_MC_ERROR_COLOUR, dlgConfigure::btnMCColoursClick) 01347 EVT_BUTTON(BTN_BC_NORMAL_COLOUR, dlgConfigure::btnMCColoursClick) 01348 EVT_BUTTON(BTN_BC_SUCCESS_COLOUR, dlgConfigure::btnMCColoursClick) 01349 EVT_BUTTON(BTN_BC_WARNING_COLOUR, dlgConfigure::btnMCColoursClick) 01350 EVT_BUTTON(BTN_BC_ERROR_COLOUR, dlgConfigure::btnMCColoursClick) 01351 EVT_TREE_SEL_CHANGED(TRE_PAGES, dlgConfigure::trePagesSelChanged) 01352 END_EVENT_TABLE() 01353 //---------------------------------------------------------------------------

Generated on Sun May 30 13:37:44 2004 for wxChecksums by doxygen 1.3.7