From 7ffce028d04a6b13ef762e2b89c34b688e8ca59d Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 31 May 2014 18:44:53 +0200 Subject: Add TrueCrypt 7.1a MacOSX/Linux specific source files. --- src/Main/Forms/AboutDialog.cpp | 66 + src/Main/Forms/AboutDialog.h | 25 + src/Main/Forms/BenchmarkDialog.cpp | 157 + src/Main/Forms/BenchmarkDialog.h | 43 + src/Main/Forms/ChangePasswordDialog.cpp | 195 + src/Main/Forms/ChangePasswordDialog.h | 48 + src/Main/Forms/DeviceSelectionDialog.cpp | 120 + src/Main/Forms/DeviceSelectionDialog.h | 46 + src/Main/Forms/EncryptionOptionsWizardPage.cpp | 137 + src/Main/Forms/EncryptionOptionsWizardPage.h | 41 + src/Main/Forms/EncryptionTestDialog.cpp | 227 + src/Main/Forms/EncryptionTestDialog.h | 40 + src/Main/Forms/FavoriteVolumesDialog.cpp | 118 + src/Main/Forms/FavoriteVolumesDialog.h | 45 + src/Main/Forms/Forms.cpp | 3062 ++++ src/Main/Forms/Forms.h | 1023 ++ src/Main/Forms/InfoWizardPage.cpp | 33 + src/Main/Forms/InfoWizardPage.h | 32 + src/Main/Forms/KeyfileGeneratorDialog.cpp | 118 + src/Main/Forms/KeyfileGeneratorDialog.h | 34 + src/Main/Forms/KeyfilesDialog.cpp | 44 + src/Main/Forms/KeyfilesDialog.h | 33 + src/Main/Forms/KeyfilesPanel.cpp | 160 + src/Main/Forms/KeyfilesPanel.h | 37 + src/Main/Forms/LegalNoticesDialog.cpp | 28 + src/Main/Forms/LegalNoticesDialog.h | 23 + src/Main/Forms/MainFrame.cpp | 1585 ++ src/Main/Forms/MainFrame.h | 173 + src/Main/Forms/MountOptionsDialog.cpp | 174 + src/Main/Forms/MountOptionsDialog.h | 42 + src/Main/Forms/NewSecurityTokenKeyfileDialog.cpp | 45 + src/Main/Forms/NewSecurityTokenKeyfileDialog.h | 30 + src/Main/Forms/PreferencesDialog.cpp | 488 + src/Main/Forms/PreferencesDialog.h | 60 + src/Main/Forms/ProgressWizardPage.cpp | 80 + src/Main/Forms/ProgressWizardPage.h | 42 + src/Main/Forms/RandomPoolEnrichmentDialog.cpp | 93 + src/Main/Forms/RandomPoolEnrichmentDialog.h | 33 + src/Main/Forms/SecurityTokenKeyfilesDialog.cpp | 197 + src/Main/Forms/SecurityTokenKeyfilesDialog.h | 47 + src/Main/Forms/SelectDirectoryWizardPage.cpp | 32 + src/Main/Forms/SelectDirectoryWizardPage.h | 33 + src/Main/Forms/SingleChoiceWizardPage.h | 116 + src/Main/Forms/TrueCrypt.fbp | 17436 +++++++++++++++++++ .../Forms/VolumeCreationProgressWizardPage.cpp | 183 + src/Main/Forms/VolumeCreationProgressWizardPage.h | 53 + src/Main/Forms/VolumeCreationWizard.cpp | 984 ++ src/Main/Forms/VolumeCreationWizard.h | 85 + src/Main/Forms/VolumeFormatOptionsWizardPage.cpp | 81 + src/Main/Forms/VolumeFormatOptionsWizardPage.h | 36 + src/Main/Forms/VolumeLocationWizardPage.cpp | 98 + src/Main/Forms/VolumeLocationWizardPage.h | 40 + src/Main/Forms/VolumePasswordPanel.cpp | 310 + src/Main/Forms/VolumePasswordPanel.h | 54 + src/Main/Forms/VolumePasswordWizardPage.cpp | 39 + src/Main/Forms/VolumePasswordWizardPage.h | 37 + src/Main/Forms/VolumePropertiesDialog.cpp | 97 + src/Main/Forms/VolumePropertiesDialog.h | 26 + src/Main/Forms/VolumeSizeWizardPage.cpp | 137 + src/Main/Forms/VolumeSizeWizardPage.h | 51 + src/Main/Forms/WizardFrame.cpp | 189 + src/Main/Forms/WizardFrame.h | 58 + src/Main/Forms/WizardPage.h | 41 + 63 files changed, 29240 insertions(+) create mode 100644 src/Main/Forms/AboutDialog.cpp create mode 100644 src/Main/Forms/AboutDialog.h create mode 100644 src/Main/Forms/BenchmarkDialog.cpp create mode 100644 src/Main/Forms/BenchmarkDialog.h create mode 100644 src/Main/Forms/ChangePasswordDialog.cpp create mode 100644 src/Main/Forms/ChangePasswordDialog.h create mode 100644 src/Main/Forms/DeviceSelectionDialog.cpp create mode 100644 src/Main/Forms/DeviceSelectionDialog.h create mode 100644 src/Main/Forms/EncryptionOptionsWizardPage.cpp create mode 100644 src/Main/Forms/EncryptionOptionsWizardPage.h create mode 100644 src/Main/Forms/EncryptionTestDialog.cpp create mode 100644 src/Main/Forms/EncryptionTestDialog.h create mode 100644 src/Main/Forms/FavoriteVolumesDialog.cpp create mode 100644 src/Main/Forms/FavoriteVolumesDialog.h create mode 100644 src/Main/Forms/Forms.cpp create mode 100644 src/Main/Forms/Forms.h create mode 100644 src/Main/Forms/InfoWizardPage.cpp create mode 100644 src/Main/Forms/InfoWizardPage.h create mode 100644 src/Main/Forms/KeyfileGeneratorDialog.cpp create mode 100644 src/Main/Forms/KeyfileGeneratorDialog.h create mode 100644 src/Main/Forms/KeyfilesDialog.cpp create mode 100644 src/Main/Forms/KeyfilesDialog.h create mode 100644 src/Main/Forms/KeyfilesPanel.cpp create mode 100644 src/Main/Forms/KeyfilesPanel.h create mode 100644 src/Main/Forms/LegalNoticesDialog.cpp create mode 100644 src/Main/Forms/LegalNoticesDialog.h create mode 100644 src/Main/Forms/MainFrame.cpp create mode 100644 src/Main/Forms/MainFrame.h create mode 100644 src/Main/Forms/MountOptionsDialog.cpp create mode 100644 src/Main/Forms/MountOptionsDialog.h create mode 100644 src/Main/Forms/NewSecurityTokenKeyfileDialog.cpp create mode 100644 src/Main/Forms/NewSecurityTokenKeyfileDialog.h create mode 100644 src/Main/Forms/PreferencesDialog.cpp create mode 100644 src/Main/Forms/PreferencesDialog.h create mode 100644 src/Main/Forms/ProgressWizardPage.cpp create mode 100644 src/Main/Forms/ProgressWizardPage.h create mode 100644 src/Main/Forms/RandomPoolEnrichmentDialog.cpp create mode 100644 src/Main/Forms/RandomPoolEnrichmentDialog.h create mode 100644 src/Main/Forms/SecurityTokenKeyfilesDialog.cpp create mode 100644 src/Main/Forms/SecurityTokenKeyfilesDialog.h create mode 100644 src/Main/Forms/SelectDirectoryWizardPage.cpp create mode 100644 src/Main/Forms/SelectDirectoryWizardPage.h create mode 100644 src/Main/Forms/SingleChoiceWizardPage.h create mode 100644 src/Main/Forms/TrueCrypt.fbp create mode 100644 src/Main/Forms/VolumeCreationProgressWizardPage.cpp create mode 100644 src/Main/Forms/VolumeCreationProgressWizardPage.h create mode 100644 src/Main/Forms/VolumeCreationWizard.cpp create mode 100644 src/Main/Forms/VolumeCreationWizard.h create mode 100644 src/Main/Forms/VolumeFormatOptionsWizardPage.cpp create mode 100644 src/Main/Forms/VolumeFormatOptionsWizardPage.h create mode 100644 src/Main/Forms/VolumeLocationWizardPage.cpp create mode 100644 src/Main/Forms/VolumeLocationWizardPage.h create mode 100644 src/Main/Forms/VolumePasswordPanel.cpp create mode 100644 src/Main/Forms/VolumePasswordPanel.h create mode 100644 src/Main/Forms/VolumePasswordWizardPage.cpp create mode 100644 src/Main/Forms/VolumePasswordWizardPage.h create mode 100644 src/Main/Forms/VolumePropertiesDialog.cpp create mode 100644 src/Main/Forms/VolumePropertiesDialog.h create mode 100644 src/Main/Forms/VolumeSizeWizardPage.cpp create mode 100644 src/Main/Forms/VolumeSizeWizardPage.h create mode 100644 src/Main/Forms/WizardFrame.cpp create mode 100644 src/Main/Forms/WizardFrame.h create mode 100644 src/Main/Forms/WizardPage.h (limited to 'src/Main/Forms') diff --git a/src/Main/Forms/AboutDialog.cpp b/src/Main/Forms/AboutDialog.cpp new file mode 100644 index 00000000..736a669a --- /dev/null +++ b/src/Main/Forms/AboutDialog.cpp @@ -0,0 +1,66 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Volume/Version.h" +#include "Main/Application.h" +#include "Main/GraphicUserInterface.h" +#include "Main/Resources.h" +#include "AboutDialog.h" + +namespace TrueCrypt +{ + AboutDialog::AboutDialog (wxWindow* parent) : AboutDialogBase (parent) + { + LogoBitmap->SetBitmap (Resources::GetTextualLogoBitmap()); + + wxFont versionStaticTextFont = VersionStaticText->GetFont(); + versionStaticTextFont.SetWeight (wxFONTWEIGHT_BOLD); + VersionStaticText->SetFont (versionStaticTextFont); + + VersionStaticText->SetLabel (Application::GetName() + L" " + StringConverter::ToWide (Version::String())); + CopyrightStaticText->SetLabel (StringConverter::ToWide (TC_STR_RELEASED_BY)); + WebsiteHyperlink->SetLabel (L"www.truecrypt.org"); + + CreditsTextCtrl->SetMinSize (wxSize ( + Gui->GetCharWidth (CreditsTextCtrl) * 70, + Gui->GetCharHeight (CreditsTextCtrl) * 6 +#ifdef TC_WINDOWS + - 5 +#else + - 11 +#endif + )); + + Layout(); + Fit(); + Center(); + + CreditsTextCtrl->ChangeValue ( + L"Portions of this software are based in part on the works of the following people: " + L"Paul Le Roux, " + L"Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall, Niels Ferguson, " + L"Lars Knudsen, Ross Anderson, Eli Biham, " + L"Joan Daemen, Vincent Rijmen, " + L"Phillip Rogaway, " + L"Hans Dobbertin, Antoon Bosselaers, Bart Preneel, " + L"Paulo Barreto, Brian Gladman, Wei Dai, Peter Gutmann, and many others.\n\n" + + L"Portions of this software:\n" + L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\n" + L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\n" + L"Copyright \xA9 1998-2008 Brian Gladman. All Rights Reserved.\n" + + L"\nThis software as a whole:\n" + L"Copyright \xA9 2012 TrueCrypt Developers Association. All rights reserved.\n\n" + + L"This software uses wxWidgets library, which is copyright \xA9 1998-2011 Julian Smart, Robert Roebling et al.\n\n" + + L"A TrueCrypt Foundation Release"); + } +} diff --git a/src/Main/Forms/AboutDialog.h b/src/Main/Forms/AboutDialog.h new file mode 100644 index 00000000..94cca8bb --- /dev/null +++ b/src/Main/Forms/AboutDialog.h @@ -0,0 +1,25 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_AboutDialog +#define TC_HEADER_Main_Forms_AboutDialog + +#include "Forms.h" + +namespace TrueCrypt +{ + class AboutDialog : public AboutDialogBase + { + public: + AboutDialog (wxWindow* parent); + + void OnWebsiteHyperlinkClick (wxHyperlinkEvent& event) { Gui->OpenHomepageLink (this, L"main"); } + }; +} + +#endif // TC_HEADER_Main_Forms_AboutDialog diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp new file mode 100644 index 00000000..a2c1418d --- /dev/null +++ b/src/Main/Forms/BenchmarkDialog.cpp @@ -0,0 +1,157 @@ +/* + Copyright (c) 2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Volume/EncryptionModeXTS.h" +#include "Main/GraphicUserInterface.h" +#include "BenchmarkDialog.h" + +namespace TrueCrypt +{ + BenchmarkDialog::BenchmarkDialog (wxWindow *parent) + : BenchmarkDialogBase (parent) + { + BenchmarkNoteStaticText->SetLabel (LangString["IDT_BOX_BENCHMARK_INFO"]); + BenchmarkNoteStaticText->Wrap (RightSizer->GetSize().GetWidth()); + + list bufferSizes; + bufferSizes.push_back (1 * BYTES_PER_MB); + bufferSizes.push_back (5 * BYTES_PER_MB); + bufferSizes.push_back (10 * BYTES_PER_MB); + bufferSizes.push_back (50 * BYTES_PER_MB); + bufferSizes.push_back (100 * BYTES_PER_MB); + bufferSizes.push_back (200 * BYTES_PER_MB); + bufferSizes.push_back (500 * BYTES_PER_MB); + bufferSizes.push_back (1 * BYTES_PER_GB); + + foreach (size_t size, bufferSizes) + { + BufferSizeChoice->Append (Gui->SizeToString (size), (void *) size); + } + + BufferSizeChoice->Select (1); + + list colPermilles; + BenchmarkListCtrl->InsertColumn (ColumnAlgorithm, LangString["ALGORITHM"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (322); + + BenchmarkListCtrl->InsertColumn (ColumnEncryption, LangString["ENCRYPTION"], wxLIST_FORMAT_RIGHT, 1); + colPermilles.push_back (226); + + BenchmarkListCtrl->InsertColumn (ColumnDecryption, LangString["DECRYPTION"], wxLIST_FORMAT_RIGHT, 1); + colPermilles.push_back (226); + + BenchmarkListCtrl->InsertColumn (ColumnMean, LangString["MEAN"], wxLIST_FORMAT_RIGHT, 1); + colPermilles.push_back (226); + + Gui->SetListCtrlWidth (BenchmarkListCtrl, 62, false); + Gui->SetListCtrlHeight (BenchmarkListCtrl, 14); + Gui->SetListCtrlColumnWidths (BenchmarkListCtrl, colPermilles); + + Layout(); + Fit(); + Center(); + } + + void BenchmarkDialog::OnBenchmarkButtonClick (wxCommandEvent& event) + { + try + { + list results; + + wxBusyCursor busy; + Buffer buffer ((size_t) Gui->GetSelectedData (BufferSizeChoice)); + + EncryptionAlgorithmList encryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms(); + foreach (shared_ptr ea, encryptionAlgorithms) + { + if (!ea->IsDeprecated()) + { + BenchmarkResult result; + result.AlgorithmName = ea->GetName(); + + Buffer key (ea->GetKeySize()); + ea->SetKey (key); + + shared_ptr xts (new EncryptionModeXTS); + xts->SetKey (key); + ea->SetMode (xts); + + wxLongLong startTime = wxGetLocalTimeMillis(); + + // CPU "warm up" (an attempt to prevent skewed results on systems where CPU frequency gradually changes depending on CPU load). + do + { + ea->EncryptSectors (buffer, 0, buffer.Size() / ENCRYPTION_DATA_UNIT_SIZE, ENCRYPTION_DATA_UNIT_SIZE); + } + while (wxGetLocalTimeMillis().GetValue() - startTime.GetValue() < 20); + + uint64 size = 0; + uint64 time; + startTime = wxGetLocalTimeMillis(); + + do + { + ea->EncryptSectors (buffer, 0, buffer.Size() / ENCRYPTION_DATA_UNIT_SIZE, ENCRYPTION_DATA_UNIT_SIZE); + size += buffer.Size(); + time = (uint64) (wxGetLocalTimeMillis().GetValue() - startTime.GetValue()); + } + while (time < 100); + + result.EncryptionSpeed = size * 1000 / time; + + startTime = wxGetLocalTimeMillis(); + size = 0; + + do + { + ea->DecryptSectors (buffer, 0, buffer.Size() / ENCRYPTION_DATA_UNIT_SIZE, ENCRYPTION_DATA_UNIT_SIZE); + size += buffer.Size(); + time = (uint64) (wxGetLocalTimeMillis().GetValue() - startTime.GetValue()); + } + while (time < 100); + + result.DecryptionSpeed = size * 1000 / time; + result.MeanSpeed = (result.EncryptionSpeed + result.DecryptionSpeed) / 2; + + bool inserted = false; + for (list ::iterator i = results.begin(); i != results.end(); ++i) + { + if (i->MeanSpeed < result.MeanSpeed) + { + results.insert (i, result); + inserted = true; + break; + } + } + + if (!inserted) + results.push_back (result); + } + } + + BenchmarkListCtrl->DeleteAllItems(); + + foreach (const BenchmarkResult &result, results) + { + vector fields (BenchmarkListCtrl->GetColumnCount()); + + fields[ColumnAlgorithm] = result.AlgorithmName; + fields[ColumnEncryption] = Gui->SpeedToString (result.EncryptionSpeed); + fields[ColumnDecryption] = Gui->SpeedToString (result.DecryptionSpeed); + fields[ColumnMean] = Gui->SpeedToString (result.MeanSpeed); + + Gui->AppendToListCtrl (BenchmarkListCtrl, fields); + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + } +} diff --git a/src/Main/Forms/BenchmarkDialog.h b/src/Main/Forms/BenchmarkDialog.h new file mode 100644 index 00000000..3cd61511 --- /dev/null +++ b/src/Main/Forms/BenchmarkDialog.h @@ -0,0 +1,43 @@ +/* + Copyright (c) 2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_BenchmarkDialog +#define TC_HEADER_Main_Forms_BenchmarkDialog + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class BenchmarkDialog : public BenchmarkDialogBase + { + public: + BenchmarkDialog (wxWindow *parent); + + protected: + enum + { + ColumnAlgorithm = 0, + ColumnEncryption, + ColumnDecryption, + ColumnMean + }; + + struct BenchmarkResult + { + wstring AlgorithmName; + uint64 EncryptionSpeed; + uint64 DecryptionSpeed; + uint64 MeanSpeed; + }; + + void OnBenchmarkButtonClick (wxCommandEvent& event); + }; +} + +#endif // TC_HEADER_Main_Forms_BenchmarkDialog diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp new file mode 100644 index 00000000..05d0143c --- /dev/null +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -0,0 +1,195 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/Main.h" +#include "Main/GraphicUserInterface.h" +#include "ChangePasswordDialog.h" + +namespace TrueCrypt +{ + ChangePasswordDialog::ChangePasswordDialog (wxWindow* parent, shared_ptr volumePath, Mode::Enum mode, shared_ptr password, shared_ptr keyfiles, shared_ptr newPassword, shared_ptr newKeyfiles) + : ChangePasswordDialogBase (parent), DialogMode (mode), Path (volumePath) + { + bool enableNewPassword = false; + bool enableNewKeyfiles = false; + bool enablePkcs5Prf = false; + + switch (mode) + { + case Mode::ChangePasswordAndKeyfiles: + enableNewPassword = true; + enableNewKeyfiles = true; + enablePkcs5Prf = true; + SetTitle (_("Change Volume Password and Keyfiles")); + break; + + case Mode::ChangeKeyfiles: + enableNewKeyfiles = true; + SetTitle (_("Add/Remove Keyfiles to/from Volume")); + break; + + case Mode::RemoveAllKeyfiles: + SetTitle (_("Remove All Keyfiles from Volume")); + break; + + case Mode::ChangePkcs5Prf: + enablePkcs5Prf = true; + SetTitle (_("Change Header Key Derivation Algorithm")); + break; + + default: + throw ParameterIncorrect (SRC_POS); + } + + CurrentPasswordPanel = new VolumePasswordPanel (this, password, keyfiles); + CurrentPasswordPanel->UpdateEvent.Connect (EventConnector (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); + CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND); + + NewPasswordPanel = new VolumePasswordPanel (this, newPassword, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); + NewPasswordPanel->UpdateEvent.Connect (EventConnector (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); + NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND); + + if (mode == Mode::RemoveAllKeyfiles) + NewSizer->Show (false); + + Layout(); + Fit(); + Center(); + + OnPasswordPanelUpdate(); + CurrentPasswordPanel->SetFocusToPasswordTextCtrl(); + } + + ChangePasswordDialog::~ChangePasswordDialog () + { + CurrentPasswordPanel->UpdateEvent.Disconnect (this); + NewPasswordPanel->UpdateEvent.Disconnect (this); + } + + void ChangePasswordDialog::OnOKButtonClick (wxCommandEvent& event) + { + // Avoid a GTK bug + if (!OKButton->IsEnabled()) + return; + + try + { + shared_ptr newPassword; + if (DialogMode == Mode::ChangePasswordAndKeyfiles) + { + newPassword = NewPasswordPanel->GetPassword(); + newPassword->CheckPortability(); + + if (newPassword->Size() > 0 && newPassword->Size() < VolumePassword::WarningSizeThreshold + && !Gui->AskYesNo (LangString ["PASSWORD_LENGTH_WARNING"], false, true)) + { + NewPasswordPanel->SetFocusToPasswordTextCtrl(); + return; + } + } + else + newPassword = CurrentPasswordPanel->GetPassword(); + + shared_ptr newKeyfiles; + if (DialogMode == Mode::ChangePasswordAndKeyfiles || DialogMode == Mode::ChangeKeyfiles) + newKeyfiles = NewPasswordPanel->GetKeyfiles(); + else if (DialogMode != Mode::RemoveAllKeyfiles) + newKeyfiles = CurrentPasswordPanel->GetKeyfiles(); + + Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf() ? NewPasswordPanel->GetPkcs5Kdf()->GetHash() : shared_ptr ()); + + { +#ifdef TC_UNIX + // Temporarily take ownership of a device if the user is not an administrator + UserId origDeviceOwner ((uid_t) -1); + + if (!Core->HasAdminPrivileges() && Path->IsDevice()) + { + origDeviceOwner = FilesystemPath (wstring (*Path)).GetOwner(); + Core->SetFileOwner (*Path, UserId (getuid())); + } + + finally_do_arg2 (FilesystemPath, *Path, UserId, origDeviceOwner, + { + if (finally_arg2.SystemId != (uid_t) -1) + Core->SetFileOwner (finally_arg, finally_arg2); + }); +#endif + wxBusyCursor busy; + Core->ChangePassword (Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps, + CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetKeyfiles(), + newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf()); + } + + switch (DialogMode) + { + case Mode::ChangePasswordAndKeyfiles: + Gui->ShowInfo ("PASSWORD_CHANGED"); + break; + + case Mode::ChangeKeyfiles: + case Mode::RemoveAllKeyfiles: + Gui->ShowInfo ("KEYFILE_CHANGED"); + break; + + case Mode::ChangePkcs5Prf: + Gui->ShowInfo ("PKCS5_PRF_CHANGED"); + break; + + default: + throw ParameterIncorrect (SRC_POS); + } + + EndModal (wxID_OK); + } + catch (UnportablePassword &e) + { + Gui->ShowError (e); + NewPasswordPanel->SetFocusToPasswordTextCtrl(); + } + catch (PasswordException &e) + { + Gui->ShowWarning (e); + CurrentPasswordPanel->SetFocusToPasswordTextCtrl(); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void ChangePasswordDialog::OnPasswordPanelUpdate () + { + bool ok = true; + + bool passwordEmpty = CurrentPasswordPanel->GetPassword()->IsEmpty(); + bool keyfilesEmpty = !CurrentPasswordPanel->GetKeyfiles() || CurrentPasswordPanel->GetKeyfiles()->empty(); + + if (passwordEmpty && keyfilesEmpty) + ok = false; + + if (DialogMode == Mode::RemoveAllKeyfiles && (passwordEmpty || keyfilesEmpty)) + ok = false; + + if (DialogMode == Mode::ChangePasswordAndKeyfiles || DialogMode == Mode::ChangeKeyfiles) + { + bool newKeyfilesEmpty = !NewPasswordPanel->GetKeyfiles() || NewPasswordPanel->GetKeyfiles()->empty(); + + if (DialogMode == Mode::ChangeKeyfiles + && ((passwordEmpty && newKeyfilesEmpty) || (keyfilesEmpty && newKeyfilesEmpty))) + ok = false; + + if (DialogMode == Mode::ChangePasswordAndKeyfiles + && ((NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) || !NewPasswordPanel->PasswordsMatch())) + ok = false; + } + + OKButton->Enable (ok); + } +} diff --git a/src/Main/Forms/ChangePasswordDialog.h b/src/Main/Forms/ChangePasswordDialog.h new file mode 100644 index 00000000..cc147602 --- /dev/null +++ b/src/Main/Forms/ChangePasswordDialog.h @@ -0,0 +1,48 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_ChangePasswordDialog +#define TC_HEADER_Main_Forms_ChangePasswordDialog + +#include "Forms.h" +#include "Main/Main.h" +#include "VolumePasswordPanel.h" + +namespace TrueCrypt +{ + class ChangePasswordDialog : public ChangePasswordDialogBase + { + public: + struct Mode + { + enum Enum + { + ChangePasswordAndKeyfiles, + ChangeKeyfiles, + RemoveAllKeyfiles, + ChangePkcs5Prf + }; + }; + + ChangePasswordDialog (wxWindow* parent, shared_ptr volumePath, Mode::Enum mode = Mode::ChangePasswordAndKeyfiles, shared_ptr password = shared_ptr (), shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), shared_ptr newKeyfiles = shared_ptr ()); + virtual ~ChangePasswordDialog (); + + protected: + void OnOKButtonClick (wxCommandEvent& event); + void OnPasswordPanelUpdate (); + void OnPasswordPanelUpdate (EventArgs &args) { OnPasswordPanelUpdate(); } + + Mode::Enum DialogMode; + + VolumePasswordPanel *CurrentPasswordPanel; + VolumePasswordPanel *NewPasswordPanel; + shared_ptr Path; + }; +} + +#endif // TC_HEADER_Main_Forms_ChangePasswordDialog diff --git a/src/Main/Forms/DeviceSelectionDialog.cpp b/src/Main/Forms/DeviceSelectionDialog.cpp new file mode 100644 index 00000000..86db68a1 --- /dev/null +++ b/src/Main/Forms/DeviceSelectionDialog.cpp @@ -0,0 +1,120 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "Main/Resources.h" +#include "DeviceSelectionDialog.h" + +namespace TrueCrypt +{ + DeviceSelectionDialog::DeviceSelectionDialog (wxWindow* parent) + : DeviceSelectionDialogBase (parent) + { + wxBusyCursor busy; + + list colPermilles; + + DeviceListCtrl->InsertColumn (ColumnDevice, LangString["DEVICE"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (447); +#ifdef TC_WINDOWS + DeviceListCtrl->InsertColumn (ColumnDrive, LangString["DRIVE"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (91); +#endif + DeviceListCtrl->InsertColumn (ColumnSize, LangString["SIZE"], wxLIST_FORMAT_RIGHT, 1); + colPermilles.push_back (153); +#ifdef TC_WINDOWS + DeviceListCtrl->InsertColumn (ColumnName, LangString["LABEL"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (307); +#else + DeviceListCtrl->InsertColumn (ColumnMountPoint, LangString["MOUNT_POINT"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (396); +#endif + + wxImageList *imageList = new wxImageList (16, 12, true); + imageList->Add (Resources::GetDriveIconBitmap(), Resources::GetDriveIconMaskBitmap()); + DeviceListCtrl->AssignImageList (imageList, wxIMAGE_LIST_SMALL); + + DeviceList = Core->GetHostDevices(); + + foreach_ref (HostDevice &device, DeviceList) + { + if (device.Size == 0) + continue; + + vector fields (DeviceListCtrl->GetColumnCount()); + + if (DeviceListCtrl->GetItemCount() > 0) + Gui->AppendToListCtrl (DeviceListCtrl, fields); + +#ifdef TC_WINDOWS + fields[ColumnDevice] = StringFormatter (L"{0} {1}:", _("Harddisk"), device.SystemNumber); + fields[ColumnDrive] = device.MountPoint; + fields[ColumnName] = device.Name; +#else + fields[ColumnDevice] = wstring (device.Path) + L":"; + fields[ColumnMountPoint] = device.MountPoint; +#endif + fields[ColumnSize] = Gui->SizeToString (device.Size); + Gui->AppendToListCtrl (DeviceListCtrl, fields, 0, &device); + + foreach_ref (HostDevice &partition, device.Partitions) + { + fields[ColumnDevice] = +#ifndef TC_WINDOWS + wstring (L" ") + +#endif + wstring (partition.Path); + +#ifdef TC_WINDOWS + fields[ColumnDrive] = partition.MountPoint; + fields[ColumnName] = partition.Name; +#else + fields[ColumnMountPoint] = partition.MountPoint; +#endif + fields[ColumnSize] = Gui->SizeToString (partition.Size); + Gui->AppendToListCtrl (DeviceListCtrl, fields, -1, &partition); + } + } + + Gui->SetListCtrlWidth (DeviceListCtrl, 73); + Gui->SetListCtrlHeight (DeviceListCtrl, 16); + Gui->SetListCtrlColumnWidths (DeviceListCtrl, colPermilles); + + Fit(); + Layout(); + Center(); + + StdButtonsOK->Disable(); + StdButtonsOK->SetDefault(); + } + + void DeviceSelectionDialog::OnListItemActivated (wxListEvent& event) + { + if (StdButtonsOK->IsEnabled()) + EndModal (wxID_OK); + } + + void DeviceSelectionDialog::OnListItemDeselected (wxListEvent& event) + { + if (DeviceListCtrl->GetSelectedItemCount() == 0) + StdButtonsOK->Disable(); + } + + void DeviceSelectionDialog::OnListItemSelected (wxListEvent& event) + { + HostDevice *device = (HostDevice *) (event.GetItem().GetData()); + if (device) + { + SelectedDevice = *device; + StdButtonsOK->Enable(); + } + else + StdButtonsOK->Disable(); + } +} diff --git a/src/Main/Forms/DeviceSelectionDialog.h b/src/Main/Forms/DeviceSelectionDialog.h new file mode 100644 index 00000000..df0b6184 --- /dev/null +++ b/src/Main/Forms/DeviceSelectionDialog.h @@ -0,0 +1,46 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_DeviceSelectionDialog +#define TC_HEADER_Main_Forms_DeviceSelectionDialog + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class DeviceSelectionDialog : public DeviceSelectionDialogBase + { + public: + DeviceSelectionDialog (wxWindow* parent); + + HostDeviceList DeviceList; + HostDevice SelectedDevice; + + protected: + enum + { + ColumnDevice = 0, +#ifdef TC_WINDOWS + ColumnDrive, +#endif + ColumnSize, +#ifdef TC_WINDOWS + ColumnName +#else + ColumnMountPoint +#endif + }; + + void OnListItemActivated (wxListEvent& event); + void OnListItemDeselected (wxListEvent& event); + void OnListItemSelected (wxListEvent& event); + }; +} + +#endif // TC_HEADER_Main_Forms_DeviceSelectionDialog diff --git a/src/Main/Forms/EncryptionOptionsWizardPage.cpp b/src/Main/Forms/EncryptionOptionsWizardPage.cpp new file mode 100644 index 00000000..d321add2 --- /dev/null +++ b/src/Main/Forms/EncryptionOptionsWizardPage.cpp @@ -0,0 +1,137 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Volume/EncryptionTest.h" +#include "Volume/Hash.h" +#include "Main/GraphicUserInterface.h" +#include "BenchmarkDialog.h" +#include "EncryptionOptionsWizardPage.h" +#include "EncryptionTestDialog.h" + +namespace TrueCrypt +{ + EncryptionOptionsWizardPage::EncryptionOptionsWizardPage (wxPanel* parent) + : EncryptionOptionsWizardPageBase (parent) + { + + EncryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms(); + foreach (shared_ptr ea, EncryptionAlgorithms) + { + if (!ea->IsDeprecated()) + EncryptionAlgorithmChoice->Append (ea->GetName(), ea.get()); + } + + EncryptionAlgorithmChoice->Select (0); + + Hashes = Hash::GetAvailableAlgorithms(); + foreach (shared_ptr hash, Hashes) + { + if (!hash->IsDeprecated()) + HashChoice->Append (hash->GetName(), hash.get()); + } + + HashChoice->Select (0); + OnEncryptionAlgorithmSelected(); + + } + + shared_ptr EncryptionOptionsWizardPage::GetEncryptionAlgorithm () const + { + return Gui->GetSelectedData (EncryptionAlgorithmChoice)->GetNew(); + } + + shared_ptr EncryptionOptionsWizardPage::GetHash () const + { + return Gui->GetSelectedData (HashChoice)->GetNew(); + } + + void EncryptionOptionsWizardPage::OnBenchmarkButtonClick (wxCommandEvent& event) + { + BenchmarkDialog dialog (this); + dialog.ShowModal(); + } + + void EncryptionOptionsWizardPage::OnEncryptionAlgorithmSelected () + { + FreezeScope freeze (this); + + shared_ptr ea = GetEncryptionAlgorithm(); + CipherList ciphers = ea->GetCiphers(); + + if (ciphers.size() == 1) + { + EncryptionAlgorithmHyperlink->SetLabel (StringFormatter (LangString["MORE_INFO_ABOUT"], ea->GetName())); + + if (typeid (*ea) == typeid (AES)) + EncryptionAlgorithmStaticText->SetLabel (LangString["AES_HELP"]); + else if (typeid (*ea) == typeid (Serpent)) + EncryptionAlgorithmStaticText->SetLabel (LangString["SERPENT_HELP"]); + else if (typeid (*ea) == typeid (Twofish)) + EncryptionAlgorithmStaticText->SetLabel (LangString["TWOFISH_HELP"]); + else + EncryptionAlgorithmStaticText->SetLabel (L""); + } + else + { + if (ciphers.size() == 2) + { + EncryptionAlgorithmStaticText->SetLabel (StringFormatter (LangString["TWO_LAYER_CASCADE_HELP"], + ciphers[0]->GetName(), (int) ciphers[0]->GetKeySize() * 8, + ciphers[1]->GetName(), (int) ciphers[1]->GetKeySize() * 8)); + } + else if (ciphers.size() == 3) + { + EncryptionAlgorithmStaticText->SetLabel (StringFormatter (LangString["THREE_LAYER_CASCADE_HELP"], + ciphers[0]->GetName(), (int) ciphers[0]->GetKeySize() * 8, + ciphers[1]->GetName(), (int) ciphers[1]->GetKeySize() * 8, + ciphers[2]->GetName(), (int) ciphers[2]->GetKeySize() * 8)); + } + else + EncryptionAlgorithmStaticText->SetLabel (L""); + + EncryptionAlgorithmHyperlink->SetLabel (_("More information")); + } + + Layout(); + } + + void EncryptionOptionsWizardPage::OnEncryptionAlgorithmHyperlinkClick (wxHyperlinkEvent& event) + { + if (GetEncryptionAlgorithm()->GetCiphers().size() == 1) + Gui->OpenHomepageLink (this, wxString (GetEncryptionAlgorithm()->GetName()).Lower()); + else + Gui->OpenHomepageLink (this, L"cascades"); + } + + void EncryptionOptionsWizardPage::OnHashHyperlinkClick (wxHyperlinkEvent& event) + { + Gui->OpenHomepageLink (this, L"hashalgorithms"); + } + + void EncryptionOptionsWizardPage::OnTestButtonClick (wxCommandEvent& event) + { + EncryptionTestDialog dialog (this); + dialog.ShowModal(); + } + + void EncryptionOptionsWizardPage::SetEncryptionAlgorithm (shared_ptr algorithm) + { + if (algorithm) + { + EncryptionAlgorithmChoice->SetStringSelection (algorithm->GetName()); + OnEncryptionAlgorithmSelected (); + } + } + + void EncryptionOptionsWizardPage::SetHash (shared_ptr hash) + { + if (hash) + HashChoice->SetStringSelection (hash->GetName()); + } +} diff --git a/src/Main/Forms/EncryptionOptionsWizardPage.h b/src/Main/Forms/EncryptionOptionsWizardPage.h new file mode 100644 index 00000000..1c8b0d95 --- /dev/null +++ b/src/Main/Forms/EncryptionOptionsWizardPage.h @@ -0,0 +1,41 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_EncryptionOptionsWizardPage +#define TC_HEADER_Main_Forms_EncryptionOptionsWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + class EncryptionOptionsWizardPage : public EncryptionOptionsWizardPageBase + { + public: + EncryptionOptionsWizardPage (wxPanel* parent); + + shared_ptr GetEncryptionAlgorithm () const; + shared_ptr GetHash () const; + bool IsValid () { return true; } + void SetPageText (const wxString &text) { } + void SetEncryptionAlgorithm (shared_ptr algorithm); + void SetHash (shared_ptr hash); + + protected: + void OnBenchmarkButtonClick (wxCommandEvent& event); + void OnEncryptionAlgorithmHyperlinkClick (wxHyperlinkEvent& event); + void OnEncryptionAlgorithmSelected (); + void OnEncryptionAlgorithmSelected (wxCommandEvent& event) { OnEncryptionAlgorithmSelected(); } + void OnHashHyperlinkClick (wxHyperlinkEvent& event); + void OnTestButtonClick (wxCommandEvent& event); + + EncryptionAlgorithmList EncryptionAlgorithms; + HashList Hashes; + }; +} + +#endif // TC_HEADER_Main_Forms_EncryptionOptionsWizardPage diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp new file mode 100644 index 00000000..3e6fa6cc --- /dev/null +++ b/src/Main/Forms/EncryptionTestDialog.cpp @@ -0,0 +1,227 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Volume/EncryptionModeXTS.h" +#include "Volume/EncryptionTest.h" +#include "Main/GraphicUserInterface.h" +#include "EncryptionTestDialog.h" + +namespace TrueCrypt +{ + EncryptionTestDialog::EncryptionTestDialog (wxWindow* parent) + : EncryptionTestDialogBase (parent) + { + EncryptionAlgorithms = EncryptionAlgorithm::GetAvailableAlgorithms(); + foreach (shared_ptr ea, EncryptionAlgorithms) + { + if (!ea->IsDeprecated()) + EncryptionAlgorithmChoice->Append (ea->GetName(), ea.get()); + } + + EncryptionAlgorithmChoice->Select (0); + Reset(); + + Fit(); + Layout(); + Center(); + } + + void EncryptionTestDialog::EncryptOrDecrypt (bool encrypt) + { + try + { + bool xts = XtsModeCheckBox->IsChecked(); + + shared_ptr ea = GetSelectedEncryptionAlgorithm(); + + Buffer key; + GetTextCtrlData (KeyTextCtrl, key); + + if (key.Size() != ea->GetKeySize()) + throw_err (LangString["TEST_KEY_SIZE"]); + + ea->SetKey (key); + + Buffer data; + GetTextCtrlData (encrypt ? PlainTextTextCtrl : CipherTextTextCtrl, data); + + if (data.Size() != ea->GetMaxBlockSize()) + throw_err (LangString[encrypt ? "TEST_PLAINTEXT_SIZE" : "TEST_CIPHERTEXT_SIZE"]); + + if (xts) + { + Buffer secondaryKey; + GetTextCtrlData (SecondaryKeyTextCtrl, secondaryKey); + + if (secondaryKey.Size() != ea->GetKeySize()) + throw_err (LangString["TEST_INCORRECT_SECONDARY_KEY_SIZE"]); + + uint64 dataUnitNumber; + size_t blockNumber; + + try + { + dataUnitNumber = StringConverter::ToUInt64 (wstring (DataUnitNumberTextCtrl->GetValue())); + } + catch (...) + { + DataUnitNumberTextCtrl->SetFocus(); + throw StringConversionFailed (SRC_POS); + } + + try + { + blockNumber = StringConverter::ToUInt32 (wstring (BlockNumberTextCtrl->GetValue())); + if (blockNumber > 31) + { + blockNumber = 31; + BlockNumberTextCtrl->SetValue (L"31"); + } + } + catch (...) + { + BlockNumberTextCtrl->SetFocus(); + throw StringConversionFailed (SRC_POS); + } + + shared_ptr xts (new EncryptionModeXTS); + xts->SetKey (secondaryKey); + ea->SetMode (xts); + + Buffer sector (ENCRYPTION_DATA_UNIT_SIZE); + BufferPtr block = sector.GetRange (blockNumber * ea->GetMaxBlockSize(), ea->GetMaxBlockSize()); + + block.CopyFrom (data); + + if (encrypt) + ea->EncryptSectors (sector, dataUnitNumber, 1, sector.Size()); + else + ea->DecryptSectors (sector, dataUnitNumber, 1, sector.Size()); + + data.CopyFrom (block); + } + else + { + if (encrypt) + ea->GetCiphers().front()->EncryptBlock (data); + else + ea->GetCiphers().front()->DecryptBlock (data); + } + + SetTextCtrlData (encrypt ? CipherTextTextCtrl : PlainTextTextCtrl, data); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + shared_ptr EncryptionTestDialog::GetSelectedEncryptionAlgorithm () const + { + return Gui->GetSelectedData (EncryptionAlgorithmChoice)->GetNew(); + } + + void EncryptionTestDialog::GetTextCtrlData (wxTextCtrl *textCtrl, Buffer &buffer) const + { + vector data; + string dataStr = StringConverter::ToSingle (wstring (textCtrl->GetValue())); + + for (size_t i = 0; i < dataStr.size() / 2; ++i) + { + unsigned int dataByte; + if (sscanf (dataStr.substr (i * 2, 2).c_str(), "%x", &dataByte) != 1) + { + textCtrl->SetFocus(); + throw StringConversionFailed (SRC_POS); + } + + data.push_back ((byte) dataByte); + } + + if (data.empty()) + return; + + buffer.CopyFrom (ConstBufferPtr (&data.front(), data.size())); + } + + void EncryptionTestDialog::OnAutoTestAllButtonClick (wxCommandEvent& event) + { + try + { + { + wxBusyCursor busy; + EncryptionTest::TestAll(); + } + + Gui->ShowInfo ("TESTS_PASSED"); + } + catch (Exception &e) + { + Gui->ShowError (e); + Gui->ShowError ("TESTS_FAILED"); + } + } + + void EncryptionTestDialog::OnEncryptionAlgorithmSelected () + { + shared_ptr ea = GetSelectedEncryptionAlgorithm(); + + KeySizeStaticText->SetLabel (StringFormatter (L"{0} {1}", (uint32) ea->GetKeySize() * 8, LangString["BITS"])); + + Buffer key (ea->GetKeySize()); + key.Zero(); + SetTextCtrlData (KeyTextCtrl, key); + SetTextCtrlData (SecondaryKeyTextCtrl, key); + + Buffer block (ea->GetMaxBlockSize()); + block.Zero(); + SetTextCtrlData (PlainTextTextCtrl, block); + SetTextCtrlData (CipherTextTextCtrl, block); + + if (ea->GetCiphers().size() > 1) + { + XtsModeCheckBox->Disable(); + XtsModeCheckBox->SetValue (true); + SecondaryKeyTextCtrl->Enable (true); + DataUnitNumberTextCtrl->Enable (true); + BlockNumberTextCtrl->Enable (true); + } + else + XtsModeCheckBox->Enable(); + } + + void EncryptionTestDialog::OnXtsModeCheckBoxClick (wxCommandEvent& event) + { + bool enabled = event.IsChecked(); + SecondaryKeyTextCtrl->Enable (enabled); + DataUnitNumberTextCtrl->Enable (enabled); + BlockNumberTextCtrl->Enable (enabled); + } + + void EncryptionTestDialog::SetTextCtrlData (wxTextCtrl *textCtrl, const BufferPtr &data) + { + wstring str; + for (size_t i = 0; i < data.Size(); i++) + { + char strBuf[3]; + sprintf (strBuf, "%02x", (int) data[i]); + str += StringConverter::ToWide (strBuf); + } + + textCtrl->SetValue (str); + } + + void EncryptionTestDialog::Reset () + { + OnEncryptionAlgorithmSelected(); + + DataUnitNumberTextCtrl->SetValue (L"0"); + BlockNumberTextCtrl->SetValue (L"0"); + } +} diff --git a/src/Main/Forms/EncryptionTestDialog.h b/src/Main/Forms/EncryptionTestDialog.h new file mode 100644 index 00000000..3466ac98 --- /dev/null +++ b/src/Main/Forms/EncryptionTestDialog.h @@ -0,0 +1,40 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_EncryptionTestDialog +#define TC_HEADER_Main_Forms_EncryptionTestDialog + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class EncryptionTestDialog : public EncryptionTestDialogBase + { + public: + EncryptionTestDialog (wxWindow* parent); + + protected: + void EncryptOrDecrypt (bool encrypt); + shared_ptr GetSelectedEncryptionAlgorithm () const; + void GetTextCtrlData (wxTextCtrl *textCtrl, Buffer &buffer) const; + void OnAutoTestAllButtonClick (wxCommandEvent& event); + void OnDecryptButtonClick (wxCommandEvent& event) { EncryptOrDecrypt (false); } + void OnEncryptButtonClick (wxCommandEvent& event) { EncryptOrDecrypt (true); } + void OnEncryptionAlgorithmSelected (); + void OnEncryptionAlgorithmSelected (wxCommandEvent& event) { OnEncryptionAlgorithmSelected(); } + void OnResetButtonClick (wxCommandEvent& event) { Reset(); } + void OnXtsModeCheckBoxClick (wxCommandEvent& event); + void SetTextCtrlData (wxTextCtrl *textCtrl, const BufferPtr &data); + void Reset (); + + EncryptionAlgorithmList EncryptionAlgorithms; + }; +} + +#endif // TC_HEADER_Main_Forms_EncryptionTestDialog diff --git a/src/Main/Forms/FavoriteVolumesDialog.cpp b/src/Main/Forms/FavoriteVolumesDialog.cpp new file mode 100644 index 00000000..7592b3c9 --- /dev/null +++ b/src/Main/Forms/FavoriteVolumesDialog.cpp @@ -0,0 +1,118 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "FavoriteVolumesDialog.h" + +namespace TrueCrypt +{ + FavoriteVolumesDialog::FavoriteVolumesDialog (wxWindow* parent, const FavoriteVolumeList &favorites, size_t newItemCount) + : FavoriteVolumesDialogBase (parent), Favorites (favorites) + { + list colPermilles; + FavoritesListCtrl->InsertColumn (ColumnVolumePath, LangString["VOLUME"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (500); + FavoritesListCtrl->InsertColumn (ColumnMountPoint, LangString["MOUNT_POINT"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (500); + + FavoritesListCtrl->SetMinSize (wxSize (400, -1)); + Gui->SetListCtrlHeight (FavoritesListCtrl, 15); + Gui->SetListCtrlColumnWidths (FavoritesListCtrl, colPermilles); + + Layout(); + Fit(); + Center(); + +#ifdef TC_MACOSX + // wxMac cannot insert items to wxListCtrl due to a bug + MoveUpButton->Show (false); + MoveDownButton->Show (false); +#endif + + vector fields (FavoritesListCtrl->GetColumnCount()); + size_t itemCount = 0; + foreach (shared_ptr favorite, Favorites) + { + fields[ColumnVolumePath] = favorite->Path; + fields[ColumnMountPoint] = favorite->MountPoint; + Gui->AppendToListCtrl (FavoritesListCtrl, fields, -1, favorite.get()); + + if (++itemCount > Favorites.size() - newItemCount) + { + FavoritesListCtrl->SetItemState (itemCount - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + FavoritesListCtrl->EnsureVisible (itemCount - 1); + } + } + + UpdateButtons(); + FavoritesListCtrl->SetFocus(); + } + + void FavoriteVolumesDialog::OnMoveDownButtonClick (wxCommandEvent& event) + { + FreezeScope freeze (this); + foreach_reverse (long itemIndex, Gui->GetListCtrlSelectedItems (FavoritesListCtrl)) + { + if (itemIndex >= FavoritesListCtrl->GetItemCount() - 1) + break; + Gui->MoveListCtrlItem (FavoritesListCtrl, itemIndex, itemIndex + 1); + } + UpdateButtons(); + } + + void FavoriteVolumesDialog::OnMoveUpButtonClick (wxCommandEvent& event) + { + FreezeScope freeze (this); + foreach (long itemIndex, Gui->GetListCtrlSelectedItems (FavoritesListCtrl)) + { + if (itemIndex == 0) + break; + + Gui->MoveListCtrlItem (FavoritesListCtrl, itemIndex, itemIndex - 1); + } + UpdateButtons(); + } + + void FavoriteVolumesDialog::OnOKButtonClick (wxCommandEvent& event) + { + FavoriteVolumeList newFavorites; + + for (long i = 0; i < FavoritesListCtrl->GetItemCount(); i++) + { + newFavorites.push_back (make_shared ( + *reinterpret_cast (FavoritesListCtrl->GetItemData (i)))); + } + + Favorites = newFavorites; + EndModal (wxID_OK); + } + + void FavoriteVolumesDialog::OnRemoveAllButtonClick (wxCommandEvent& event) + { + FavoritesListCtrl->DeleteAllItems(); + UpdateButtons(); + } + + void FavoriteVolumesDialog::OnRemoveButtonClick (wxCommandEvent& event) + { + long offset = 0; + foreach (long item, Gui->GetListCtrlSelectedItems (FavoritesListCtrl)) + FavoritesListCtrl->DeleteItem (item - offset++); + } + + void FavoriteVolumesDialog::UpdateButtons () + { + bool selected = FavoritesListCtrl->GetSelectedItemCount() > 0; + + MoveDownButton->Enable (selected); + MoveUpButton->Enable (selected); + RemoveAllButton->Enable (FavoritesListCtrl->GetItemCount() > 0); + RemoveButton->Enable (selected); + } +} diff --git a/src/Main/Forms/FavoriteVolumesDialog.h b/src/Main/Forms/FavoriteVolumesDialog.h new file mode 100644 index 00000000..7ab940a6 --- /dev/null +++ b/src/Main/Forms/FavoriteVolumesDialog.h @@ -0,0 +1,45 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_FavoriteVolumesDialog +#define TC_HEADER_Main_Forms_FavoriteVolumesDialog + +#include "Forms.h" +#include "Main/Main.h" +#include "Main/FavoriteVolume.h" + +namespace TrueCrypt +{ + class FavoriteVolumesDialog : public FavoriteVolumesDialogBase + { + public: + FavoriteVolumesDialog (wxWindow* parent, const FavoriteVolumeList &favorites, size_t newItemCount = 0); + + FavoriteVolumeList GetFavorites () const { return Favorites; } + + protected: + void OnListItemDeselected (wxListEvent& event) { UpdateButtons (); } + void OnListItemSelected (wxListEvent& event) { UpdateButtons (); } + void OnMoveUpButtonClick (wxCommandEvent& event); + void OnMoveDownButtonClick (wxCommandEvent& event); + void OnOKButtonClick (wxCommandEvent& event); + void OnRemoveAllButtonClick (wxCommandEvent& event); + void OnRemoveButtonClick (wxCommandEvent& event); + void UpdateButtons (); + + enum + { + ColumnVolumePath = 0, + ColumnMountPoint + }; + + FavoriteVolumeList Favorites; + }; +} + +#endif // TC_HEADER_Main_Forms_FavoriteVolumesDialog diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp new file mode 100644 index 00000000..5825381c --- /dev/null +++ b/src/Main/Forms/Forms.cpp @@ -0,0 +1,3062 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "System.h" + +#include "Forms.h" + +/////////////////////////////////////////////////////////////////////////// +using namespace TrueCrypt; + +MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxSize( -1,496 ), wxDefaultSize ); + + MainMenuBar = new wxMenuBar( 0 ); + VolumesMenu = new wxMenu(); + wxMenuItem* CreateNewVolumeMenuItem; + CreateNewVolumeMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Create New Volume...") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( CreateNewVolumeMenuItem ); + + VolumesMenu->AppendSeparator(); + + MountVolumeMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Mount Volume") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( MountVolumeMenuItem ); + + wxMenuItem* AutoMountDevicesMenuItem; + AutoMountDevicesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Auto-Mount All Device-Hosted Volumes") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( AutoMountDevicesMenuItem ); + + VolumesMenu->AppendSeparator(); + + DismountVolumeMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Dismount Volume") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( DismountVolumeMenuItem ); + + DismountAllMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Dismount All Mounted Volumes") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( DismountAllMenuItem ); + + VolumesMenu->AppendSeparator(); + + wxMenuItem* ChangePasswordMenuItem; + ChangePasswordMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Change Volume Password...") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( ChangePasswordMenuItem ); + + wxMenuItem* ChangePkcs5PrfMenuItem; + ChangePkcs5PrfMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Change Header Key Derivation Algorithm...") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( ChangePkcs5PrfMenuItem ); + + wxMenuItem* ChangeKeyfilesMenuItem; + ChangeKeyfilesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Add/Remove Keyfiles to/from Volume...") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( ChangeKeyfilesMenuItem ); + + wxMenuItem* RemoveKeyfilesMenuItem; + RemoveKeyfilesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Remove All Keyfiles from Volume...") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( RemoveKeyfilesMenuItem ); + + VolumesMenu->AppendSeparator(); + + VolumePropertiesMenuItem = new wxMenuItem( VolumesMenu, wxID_ANY, wxString( _("Volume Properties...") ) , wxEmptyString, wxITEM_NORMAL ); + VolumesMenu->Append( VolumePropertiesMenuItem ); + + MainMenuBar->Append( VolumesMenu, _("&Volumes") ); + + FavoritesMenu = new wxMenu(); + AddToFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("Add Selected Volume to Favorites...") ) , wxEmptyString, wxITEM_NORMAL ); + FavoritesMenu->Append( AddToFavoritesMenuItem ); + + AddAllMountedToFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("Add All Mounted Volumes to Favorites...") ) , wxEmptyString, wxITEM_NORMAL ); + FavoritesMenu->Append( AddAllMountedToFavoritesMenuItem ); + + wxMenuItem* OrganizeFavoritesMenuItem; + OrganizeFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("Organize Favorite Volumes...") ) , wxEmptyString, wxITEM_NORMAL ); + FavoritesMenu->Append( OrganizeFavoritesMenuItem ); + + FavoritesMenu->AppendSeparator(); + + wxMenuItem* MountAllFavoritesMenuItem; + MountAllFavoritesMenuItem = new wxMenuItem( FavoritesMenu, wxID_ANY, wxString( _("Mount Favorite Volumes") ) , wxEmptyString, wxITEM_NORMAL ); + FavoritesMenu->Append( MountAllFavoritesMenuItem ); + + FavoritesMenu->AppendSeparator(); + + MainMenuBar->Append( FavoritesMenu, _("&Favorites") ); + + ToolsMenu = new wxMenu(); + wxMenuItem* BenchmarkMenuItem; + BenchmarkMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Benchmark...") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( BenchmarkMenuItem ); + + wxMenuItem* EncryptionTestMenuItem; + EncryptionTestMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Test Vectors...") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( EncryptionTestMenuItem ); + + ToolsMenu->AppendSeparator(); + + wxMenuItem* VolumeCreationWizardMenuItem; + VolumeCreationWizardMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Volume Creation Wizard") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( VolumeCreationWizardMenuItem ); + + ToolsMenu->AppendSeparator(); + + BackupVolumeHeadersMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Backup Volume Header...") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( BackupVolumeHeadersMenuItem ); + + RestoreVolumeHeaderMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Restore Volume Header...") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( RestoreVolumeHeaderMenuItem ); + + ToolsMenu->AppendSeparator(); + + wxMenuItem* CreateKeyfileMenuItem; + CreateKeyfileMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Keyfile Generator") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( CreateKeyfileMenuItem ); + + wxMenuItem* ManageSecurityTokenKeyfilesMenuItem; + ManageSecurityTokenKeyfilesMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Manage Security Token Keyfiles...") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( ManageSecurityTokenKeyfilesMenuItem ); + + wxMenuItem* CloseAllSecurityTokenSessionsMenuItem; + CloseAllSecurityTokenSessionsMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Close All Security Token Sessions") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( CloseAllSecurityTokenSessionsMenuItem ); + + ToolsMenu->AppendSeparator(); + + WipeCachedPasswordsMenuItem = new wxMenuItem( ToolsMenu, wxID_ANY, wxString( _("Wipe Cached Passwords") ) , wxEmptyString, wxITEM_NORMAL ); + ToolsMenu->Append( WipeCachedPasswordsMenuItem ); + + MainMenuBar->Append( ToolsMenu, _("T&ools") ); + + SettingsMenu = new wxMenu(); + HotkeysMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("Hotkeys...") ) , wxEmptyString, wxITEM_NORMAL ); + SettingsMenu->Append( HotkeysMenuItem ); + + wxMenuItem* DefaultKeyfilesMenuItem; + DefaultKeyfilesMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("Default Keyfiles...") ) , wxEmptyString, wxITEM_NORMAL ); + SettingsMenu->Append( DefaultKeyfilesMenuItem ); + + wxMenuItem* SecurityTokenPreferencesMenuItem; + SecurityTokenPreferencesMenuItem = new wxMenuItem( SettingsMenu, wxID_ANY, wxString( _("Security Tokens...") ) , wxEmptyString, wxITEM_NORMAL ); + SettingsMenu->Append( SecurityTokenPreferencesMenuItem ); + + SettingsMenu->AppendSeparator(); + + PreferencesMenuItem = new wxMenuItem( SettingsMenu, wxID_PREFERENCES, wxString( _("&Preferences...") ) , wxEmptyString, wxITEM_NORMAL ); + SettingsMenu->Append( PreferencesMenuItem ); + + MainMenuBar->Append( SettingsMenu, _("Settin&gs") ); + + HelpMenu = new wxMenu(); + wxMenuItem* UserGuideMenuItem; + UserGuideMenuItem = new wxMenuItem( HelpMenu, wxID_HELP, wxString( _("User's Guide") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( UserGuideMenuItem ); + + wxMenuItem* OnlineHelpMenuItem; + OnlineHelpMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Online Help") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( OnlineHelpMenuItem ); + + wxMenuItem* BeginnersTutorialMenuItem; + BeginnersTutorialMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Beginner's Tutorial") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( BeginnersTutorialMenuItem ); + + wxMenuItem* FaqMenuItem; + FaqMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Frequently Asked Questions") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( FaqMenuItem ); + + HelpMenu->AppendSeparator(); + + wxMenuItem* WebsiteMenuItem; + WebsiteMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("TrueCrypt Website") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( WebsiteMenuItem ); + + wxMenuItem* DownloadsMenuItem; + DownloadsMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Downloads") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( DownloadsMenuItem ); + + wxMenuItem* NewsMenuItem; + NewsMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("News") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( NewsMenuItem ); + + wxMenuItem* VersionHistoryMenuItem; + VersionHistoryMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Version History") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( VersionHistoryMenuItem ); + + HelpMenu->AppendSeparator(); + + wxMenuItem* ContactMenuItem; + ContactMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Contact") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( ContactMenuItem ); + + wxMenuItem* LegalNoticesMenuItem; + LegalNoticesMenuItem = new wxMenuItem( HelpMenu, wxID_ANY, wxString( _("Legal Notices") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( LegalNoticesMenuItem ); + + wxMenuItem* AboutMenuItem; + AboutMenuItem = new wxMenuItem( HelpMenu, wxID_ABOUT, wxString( _("About") ) , wxEmptyString, wxITEM_NORMAL ); + HelpMenu->Append( AboutMenuItem ); + + MainMenuBar->Append( HelpMenu, _("&Help") ); + + this->SetMenuBar( MainMenuBar ); + + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + MainPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer2; + bSizer2 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer48; + bSizer48 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + SlotListCtrl = new wxListCtrl( MainPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxSUNKEN_BORDER ); + sbSizer1->Add( SlotListCtrl, 1, wxALL|wxEXPAND, 5 ); + + bSizer48->Add( sbSizer1, 1, wxEXPAND, 5 ); + + LowStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + HigherButtonSizer = new wxBoxSizer( wxVERTICAL ); + + LowStaticBoxSizer->Add( HigherButtonSizer, 0, wxEXPAND|wxTOP, 2 ); + + wxGridSizer* gSizer1; + gSizer1 = new wxGridSizer( 1, 3, 0, 0 ); + + wxBoxSizer* bSizer17; + bSizer17 = new wxBoxSizer( wxVERTICAL ); + + bSizer17->SetMinSize( wxSize( 138,34 ) ); + CreateVolumeButton = new wxButton( MainPanel, wxID_ANY, _("&Create Volume"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer17->Add( CreateVolumeButton, 1, wxALL|wxEXPAND, 5 ); + + gSizer1->Add( bSizer17, 0, 0, 5 ); + + wxBoxSizer* bSizer18; + bSizer18 = new wxBoxSizer( wxVERTICAL ); + + bSizer18->SetMinSize( wxSize( 138,34 ) ); + VolumePropertiesButton = new wxButton( MainPanel, wxID_ANY, _("&Volume Properties..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer18->Add( VolumePropertiesButton, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + gSizer1->Add( bSizer18, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer19; + bSizer19 = new wxBoxSizer( wxVERTICAL ); + + bSizer19->SetMinSize( wxSize( 138,34 ) ); + WipeCacheButton = new wxButton( MainPanel, wxID_ANY, _("&Wipe Cache"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer19->Add( WipeCacheButton, 1, wxALL|wxALIGN_RIGHT|wxEXPAND, 5 ); + + gSizer1->Add( bSizer19, 0, wxALIGN_RIGHT, 5 ); + + LowStaticBoxSizer->Add( gSizer1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + + LowStaticBoxSizer->Add( 0, 0, 0, 0, 5 ); + + VolumeStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, _("Volume") ), wxVERTICAL ); + + VolumeGridBagSizer = new wxGridBagSizer( 0, 0 ); + VolumeGridBagSizer->AddGrowableCol( 1 ); + VolumeGridBagSizer->AddGrowableRow( 0 ); + VolumeGridBagSizer->SetFlexibleDirection( wxBOTH ); + VolumeGridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + LogoBitmap = new wxStaticBitmap( MainPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER ); + LogoBitmap->SetMinSize( wxSize( 42,52 ) ); + + VolumeGridBagSizer->Add( LogoBitmap, wxGBPosition( 0, 0 ), wxGBSpan( 2, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + VolumePathComboBox = new wxComboBox( MainPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN ); + VolumeGridBagSizer->Add( VolumePathComboBox, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer191; + bSizer191 = new wxBoxSizer( wxVERTICAL ); + + bSizer191->SetMinSize( wxSize( 138,34 ) ); + SelectFileButton = new wxButton( MainPanel, wxID_ANY, _("Select &File..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer191->Add( SelectFileButton, 1, wxALL|wxEXPAND, 5 ); + + VolumeGridBagSizer->Add( bSizer191, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + + NoHistoryCheckBox = new wxCheckBox( MainPanel, wxID_ANY, _("&Never save history"), wxDefaultPosition, wxDefaultSize, 0 ); + + VolumeGridBagSizer->Add( NoHistoryCheckBox, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer20; + bSizer20 = new wxBoxSizer( wxVERTICAL ); + + bSizer20->SetMinSize( wxSize( 138,34 ) ); + VolumeToolsButton = new wxButton( MainPanel, wxID_ANY, _("Volume &Tools..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer20->Add( VolumeToolsButton, 1, wxALL|wxEXPAND, 5 ); + + VolumeGridBagSizer->Add( bSizer20, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT, 5 ); + + wxBoxSizer* bSizer21; + bSizer21 = new wxBoxSizer( wxVERTICAL ); + + bSizer21->SetMinSize( wxSize( 138,34 ) ); + SelectDeviceButton = new wxButton( MainPanel, wxID_ANY, _("Select D&evice..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer21->Add( SelectDeviceButton, 1, wxEXPAND|wxALL, 5 ); + + VolumeGridBagSizer->Add( bSizer21, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + + VolumeStaticBoxSizer->Add( VolumeGridBagSizer, 1, wxEXPAND|wxALL, 4 ); + + LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND, 5 ); + + + LowStaticBoxSizer->Add( 0, 0, 0, 0, 5 ); + + wxGridSizer* gSizer2; + gSizer2 = new wxGridSizer( 1, 4, 0, 0 ); + + wxStaticBoxSizer* sbSizer4; + sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + sbSizer4->SetMinSize( wxSize( 139,-1 ) ); + VolumeButton = new wxButton( MainPanel, wxID_ANY, _("&Mount"), wxDefaultPosition, wxDefaultSize, 0 ); + VolumeButton->SetDefault(); + VolumeButton->SetMinSize( wxSize( -1,32 ) ); + + sbSizer4->Add( VolumeButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 ); + + gSizer2->Add( sbSizer4, 1, wxEXPAND, 0 ); + + wxStaticBoxSizer* sbSizer41; + sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + MountAllDevicesButton = new wxButton( MainPanel, wxID_ANY, _("&Auto-Mount Devices"), wxDefaultPosition, wxDefaultSize, 0 ); + MountAllDevicesButton->SetMinSize( wxSize( -1,32 ) ); + + sbSizer41->Add( MountAllDevicesButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 ); + + gSizer2->Add( sbSizer41, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer42; + sbSizer42 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + DismountAllButton = new wxButton( MainPanel, wxID_ANY, _("Di&smount All"), wxDefaultPosition, wxDefaultSize, 0 ); + DismountAllButton->SetMinSize( wxSize( -1,32 ) ); + + sbSizer42->Add( DismountAllButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 ); + + gSizer2->Add( sbSizer42, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer43; + sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + ExitButton = new wxButton( MainPanel, wxID_ANY, _("E&xit"), wxDefaultPosition, wxDefaultSize, 0 ); + ExitButton->SetMinSize( wxSize( -1,32 ) ); + + sbSizer43->Add( ExitButton, 1, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP, 2 ); + + gSizer2->Add( sbSizer43, 1, wxALIGN_RIGHT|wxEXPAND, 5 ); + + LowStaticBoxSizer->Add( gSizer2, 0, wxEXPAND, 5 ); + + bSizer48->Add( LowStaticBoxSizer, 0, wxEXPAND, 5 ); + + bSizer2->Add( bSizer48, 1, wxEXPAND, 5 ); + + MainPanel->SetSizer( bSizer2 ); + MainPanel->Layout(); + bSizer2->Fit( MainPanel ); + bSizer1->Add( MainPanel, 1, wxEXPAND, 0 ); + + this->SetSizer( bSizer1 ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) ); + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) ); + this->Connect( CreateNewVolumeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) ); + this->Connect( MountVolumeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountVolumeMenuItemSelected ) ); + this->Connect( AutoMountDevicesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ) ); + this->Connect( DismountVolumeMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountVolumeMenuItemSelected ) ); + this->Connect( DismountAllMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ) ); + this->Connect( ChangePasswordMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePasswordMenuItemSelected ) ); + this->Connect( ChangePkcs5PrfMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePkcs5PrfMenuItemSelected ) ); + this->Connect( ChangeKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangeKeyfilesMenuItemSelected ) ); + this->Connect( RemoveKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRemoveKeyfilesMenuItemSelected ) ); + this->Connect( VolumePropertiesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ) ); + this->Connect( AddToFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddToFavoritesMenuItemSelected ) ); + this->Connect( AddAllMountedToFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddAllMountedToFavoritesMenuItemSelected ) ); + this->Connect( OrganizeFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOrganizeFavoritesMenuItemSelected ) ); + this->Connect( MountAllFavoritesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllFavoritesMenuItemSelected ) ); + this->Connect( BenchmarkMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBenchmarkMenuItemSelected ) ); + this->Connect( EncryptionTestMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnEncryptionTestMenuItemSelected ) ); + this->Connect( VolumeCreationWizardMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) ); + this->Connect( BackupVolumeHeadersMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBackupVolumeHeadersMenuItemSelected ) ); + this->Connect( RestoreVolumeHeaderMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRestoreVolumeHeaderMenuItemSelected ) ); + this->Connect( CreateKeyfileMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateKeyfileMenuItemSelected ) ); + this->Connect( ManageSecurityTokenKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnManageSecurityTokenKeyfilesMenuItemSelected ) ); + this->Connect( CloseAllSecurityTokenSessionsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCloseAllSecurityTokenSessionsMenuItemSelected ) ); + this->Connect( WipeCachedPasswordsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ) ); + this->Connect( HotkeysMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnHotkeysMenuItemSelected ) ); + this->Connect( DefaultKeyfilesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultKeyfilesMenuItemSelected ) ); + this->Connect( SecurityTokenPreferencesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnSecurityTokenPreferencesMenuItemSelected ) ); + this->Connect( PreferencesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ) ); + this->Connect( UserGuideMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ) ); + this->Connect( OnlineHelpMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOnlineHelpMenuItemSelected ) ); + this->Connect( BeginnersTutorialMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBeginnersTutorialMenuItemSelected ) ); + this->Connect( FaqMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnFaqMenuItemSelected ) ); + this->Connect( WebsiteMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWebsiteMenuItemSelected ) ); + this->Connect( DownloadsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDownloadsMenuItemSelected ) ); + this->Connect( NewsMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnNewsMenuItemSelected ) ); + this->Connect( VersionHistoryMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVersionHistoryMenuItemSelected ) ); + this->Connect( ContactMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnContactMenuItemSelected ) ); + this->Connect( LegalNoticesMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLegalNoticesMenuItemSelected ) ); + this->Connect( AboutMenuItem->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ) ); + SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( MainFrameBase::OnListItemActivated ), NULL, this ); + SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( MainFrameBase::OnListItemDeselected ), NULL, this ); + SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( MainFrameBase::OnListItemRightClick ), NULL, this ); + SlotListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFrameBase::OnListItemSelected ), NULL, this ); + CreateVolumeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), NULL, this ); + VolumePropertiesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ), NULL, this ); + WipeCacheButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ), NULL, this ); + LogoBitmap->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrameBase::OnLogoBitmapClick ), NULL, this ); + SelectFileButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectFileButtonClick ), NULL, this ); + NoHistoryCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::OnNoHistoryCheckBoxClick ), NULL, this ); + VolumeToolsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeToolsButtonClick ), NULL, this ); + SelectDeviceButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectDeviceButtonClick ), NULL, this ); + VolumeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeButtonClick ), NULL, this ); + MountAllDevicesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), NULL, this ); + DismountAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), NULL, this ); + ExitButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnExitButtonClick ), NULL, this ); +} + +MainFrameBase::~MainFrameBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( MainFrameBase::OnActivate ) ); + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnClose ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountVolumeMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountVolumeMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePasswordMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangePkcs5PrfMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnChangeKeyfilesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRemoveKeyfilesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddToFavoritesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAddAllMountedToFavoritesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOrganizeFavoritesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnMountAllFavoritesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBenchmarkMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnEncryptionTestMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBackupVolumeHeadersMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnRestoreVolumeHeaderMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCreateKeyfileMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnManageSecurityTokenKeyfilesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnCloseAllSecurityTokenSessionsMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnHotkeysMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDefaultKeyfilesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnSecurityTokenPreferencesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnUserGuideMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOnlineHelpMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnBeginnersTutorialMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnFaqMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnWebsiteMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnDownloadsMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnNewsMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnVersionHistoryMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnContactMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLegalNoticesMenuItemSelected ) ); + this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutMenuItemSelected ) ); + SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( MainFrameBase::OnListItemActivated ), NULL, this ); + SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( MainFrameBase::OnListItemDeselected ), NULL, this ); + SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler( MainFrameBase::OnListItemRightClick ), NULL, this ); + SlotListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFrameBase::OnListItemSelected ), NULL, this ); + CreateVolumeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnCreateVolumeButtonClick ), NULL, this ); + VolumePropertiesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumePropertiesButtonClick ), NULL, this ); + WipeCacheButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnWipeCacheButtonClick ), NULL, this ); + LogoBitmap->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrameBase::OnLogoBitmapClick ), NULL, this ); + SelectFileButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectFileButtonClick ), NULL, this ); + NoHistoryCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MainFrameBase::OnNoHistoryCheckBoxClick ), NULL, this ); + VolumeToolsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeToolsButtonClick ), NULL, this ); + SelectDeviceButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnSelectDeviceButtonClick ), NULL, this ); + VolumeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnVolumeButtonClick ), NULL, this ); + MountAllDevicesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMountAllDevicesButtonClick ), NULL, this ); + DismountAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnDismountAllButtonClick ), NULL, this ); + ExitButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnExitButtonClick ), NULL, this ); +} + +WizardFrameBase::WizardFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer92; + bSizer92 = new wxBoxSizer( wxVERTICAL ); + + MainPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer63; + bSizer63 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer64; + bSizer64 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer27; + sbSizer27 = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, wxEmptyString ), wxHORIZONTAL ); + + WizardBitmap = new wxStaticBitmap( MainPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer27->Add( WizardBitmap, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer66; + bSizer66 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer126; + bSizer126 = new wxBoxSizer( wxHORIZONTAL ); + + PageTitleStaticText = new wxStaticText( MainPanel, wxID_ANY, _("Page Title"), wxDefaultPosition, wxDefaultSize, 0 ); + PageTitleStaticText->Wrap( -1 ); + PageTitleStaticText->SetFont( wxFont( 16, 70, 90, 90, false, wxT("Times New Roman") ) ); + + bSizer126->Add( PageTitleStaticText, 0, wxALL, 5 ); + + bSizer66->Add( bSizer126, 0, wxLEFT, 5 ); + + PageSizer = new wxBoxSizer( wxVERTICAL ); + + bSizer66->Add( PageSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + sbSizer27->Add( bSizer66, 1, wxEXPAND|wxLEFT, 5 ); + + bSizer64->Add( sbSizer27, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer70; + bSizer70 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer70->Add( 0, 0, 1, wxEXPAND, 5 ); + + HelpButton = new wxButton( MainPanel, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer70->Add( HelpButton, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer70->Add( 0, 0, 0, wxLEFT|wxALIGN_RIGHT, 5 ); + + PreviousButton = new wxButton( MainPanel, wxID_ANY, _("< &Prev"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer70->Add( PreviousButton, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + NextButton = new wxButton( MainPanel, wxID_ANY, _("&Next >"), wxDefaultPosition, wxDefaultSize, 0|wxWANTS_CHARS ); + NextButton->SetDefault(); + bSizer70->Add( NextButton, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer70->Add( 0, 0, 0, wxLEFT|wxALIGN_RIGHT, 5 ); + + CancelButton = new wxButton( MainPanel, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer70->Add( CancelButton, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer64->Add( bSizer70, 0, wxEXPAND|wxALIGN_RIGHT|wxALL, 5 ); + + bSizer63->Add( bSizer64, 1, wxEXPAND, 5 ); + + MainPanel->SetSizer( bSizer63 ); + MainPanel->Layout(); + bSizer63->Fit( MainPanel ); + bSizer92->Add( MainPanel, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer92 ); + this->Layout(); + bSizer92->Fit( this ); + + // Connect Events + this->Connect( wxEVT_ACTIVATE, wxActivateEventHandler( WizardFrameBase::OnActivate ) ); + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WizardFrameBase::OnClose ) ); + MainPanel->Connect( wxEVT_MOTION, wxMouseEventHandler( WizardFrameBase::OnMouseMotion ), NULL, this ); + HelpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnHelpButtonClick ), NULL, this ); + PreviousButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnPreviousButtonClick ), NULL, this ); + NextButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnNextButtonClick ), NULL, this ); + CancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnCancelButtonClick ), NULL, this ); +} + +WizardFrameBase::~WizardFrameBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_ACTIVATE, wxActivateEventHandler( WizardFrameBase::OnActivate ) ); + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( WizardFrameBase::OnClose ) ); + MainPanel->Disconnect( wxEVT_MOTION, wxMouseEventHandler( WizardFrameBase::OnMouseMotion ), NULL, this ); + HelpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnHelpButtonClick ), NULL, this ); + PreviousButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnPreviousButtonClick ), NULL, this ); + NextButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnNextButtonClick ), NULL, this ); + CancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WizardFrameBase::OnCancelButtonClick ), NULL, this ); +} + +AboutDialogBase::AboutDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer116; + bSizer116 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer117; + bSizer117 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer120; + bSizer120 = new wxBoxSizer( wxVERTICAL ); + + bSizer120->SetMinSize( wxSize( -1,78 ) ); + m_panel14 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel14->SetBackgroundColour( wxColour( 10, 108, 206 ) ); + + wxBoxSizer* bSizer121; + bSizer121 = new wxBoxSizer( wxVERTICAL ); + + + bSizer121->Add( 0, 0, 1, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer122; + bSizer122 = new wxBoxSizer( wxVERTICAL ); + + LogoBitmap = new wxStaticBitmap( m_panel14, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer122->Add( LogoBitmap, 0, wxALL, 10 ); + + bSizer121->Add( bSizer122, 0, wxEXPAND|wxLEFT, 8 ); + + m_panel14->SetSizer( bSizer121 ); + m_panel14->Layout(); + bSizer121->Fit( m_panel14 ); + bSizer120->Add( m_panel14, 1, wxEXPAND, 5 ); + + bSizer117->Add( bSizer120, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer118; + bSizer118 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer123; + bSizer123 = new wxBoxSizer( wxVERTICAL ); + + VersionStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + VersionStaticText->Wrap( -1 ); + bSizer123->Add( VersionStaticText, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + + bSizer123->Add( 0, 0, 0, wxTOP, 3 ); + + CopyrightStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + CopyrightStaticText->Wrap( -1 ); + bSizer123->Add( CopyrightStaticText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizer123->Add( 0, 0, 0, wxTOP, 3 ); + + WebsiteHyperlink = new wxHyperlinkCtrl( this, wxID_ANY, wxEmptyString, wxT("."), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + + WebsiteHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + WebsiteHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + WebsiteHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + bSizer123->Add( WebsiteHyperlink, 0, wxALL, 5 ); + + bSizer118->Add( bSizer123, 1, wxEXPAND|wxLEFT, 5 ); + + bSizer117->Add( bSizer118, 1, wxALL|wxEXPAND, 15 ); + + m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer117->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM, 5 ); + + CreditsTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxSUNKEN_BORDER ); + bSizer117->Add( CreditsTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); + + + bSizer117->Add( 0, 0, 0, wxTOP, 5 ); + + m_staticline4 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer117->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 ); + + m_staticline5 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer117->Add( m_staticline5, 0, wxEXPAND|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer119; + bSizer119 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer119->Add( 0, 0, 1, wxEXPAND|wxALL, 5 ); + + wxButton* OKButton; + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer119->Add( OKButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer119->Add( 0, 0, 0, wxLEFT, 5 ); + + bSizer117->Add( bSizer119, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 6 ); + + bSizer116->Add( bSizer117, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer116 ); + this->Layout(); + bSizer116->Fit( this ); + + // Connect Events + WebsiteHyperlink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( AboutDialogBase::OnWebsiteHyperlinkClick ), NULL, this ); +} + +AboutDialogBase::~AboutDialogBase() +{ + // Disconnect Events + WebsiteHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( AboutDialogBase::OnWebsiteHyperlinkClick ), NULL, this ); +} + +BenchmarkDialogBase::BenchmarkDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer153; + bSizer153 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer154; + bSizer154 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer155; + bSizer155 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText54; + m_staticText54 = new wxStaticText( this, wxID_ANY, _("Buffer Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText54->Wrap( -1 ); + bSizer155->Add( m_staticText54, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxArrayString BufferSizeChoiceChoices; + BufferSizeChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, BufferSizeChoiceChoices, 0 ); + BufferSizeChoice->SetSelection( 0 ); + bSizer155->Add( BufferSizeChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer154->Add( bSizer155, 0, wxEXPAND, 5 ); + + wxStaticLine* m_staticline6; + m_staticline6 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer154->Add( m_staticline6, 0, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bSizer156; + bSizer156 = new wxBoxSizer( wxHORIZONTAL ); + + BenchmarkListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxSUNKEN_BORDER ); + bSizer156->Add( BenchmarkListCtrl, 1, wxALL|wxEXPAND, 5 ); + + RightSizer = new wxBoxSizer( wxVERTICAL ); + + BenchmarkButton = new wxButton( this, wxID_OK, _("Benchmark"), wxDefaultPosition, wxDefaultSize, 0 ); + BenchmarkButton->SetDefault(); + RightSizer->Add( BenchmarkButton, 0, wxALL|wxEXPAND, 5 ); + + wxButton* CancelButton; + CancelButton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + RightSizer->Add( CancelButton, 0, wxALL|wxEXPAND, 5 ); + + + RightSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + BenchmarkNoteStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + BenchmarkNoteStaticText->Wrap( -1 ); + RightSizer->Add( BenchmarkNoteStaticText, 1, wxALL|wxEXPAND, 5 ); + + bSizer156->Add( RightSizer, 0, wxEXPAND, 5 ); + + bSizer154->Add( bSizer156, 1, wxEXPAND, 5 ); + + bSizer153->Add( bSizer154, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer153 ); + this->Layout(); + bSizer153->Fit( this ); + + // Connect Events + BenchmarkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BenchmarkDialogBase::OnBenchmarkButtonClick ), NULL, this ); +} + +BenchmarkDialogBase::~BenchmarkDialogBase() +{ + // Disconnect Events + BenchmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BenchmarkDialogBase::OnBenchmarkButtonClick ), NULL, this ); +} + +ChangePasswordDialogBase::ChangePasswordDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer30; + bSizer30 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer31; + bSizer31 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer32; + bSizer32 = new wxBoxSizer( wxVERTICAL ); + + CurrentSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current") ), wxVERTICAL ); + + CurrentPasswordPanelSizer = new wxBoxSizer( wxVERTICAL ); + + CurrentSizer->Add( CurrentPasswordPanelSizer, 0, wxALIGN_RIGHT, 5 ); + + bSizer32->Add( CurrentSizer, 0, wxEXPAND, 5 ); + + NewSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("New") ), wxVERTICAL ); + + NewPasswordPanelSizer = new wxBoxSizer( wxVERTICAL ); + + NewSizer->Add( NewPasswordPanelSizer, 0, wxALIGN_RIGHT, 5 ); + + bSizer32->Add( NewSizer, 0, wxTOP|wxEXPAND, 5 ); + + bSizer31->Add( bSizer32, 1, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer33; + bSizer33 = new wxBoxSizer( wxVERTICAL ); + + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer33->Add( OKButton, 0, wxALL|wxEXPAND, 5 ); + + CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer33->Add( CancelButton, 0, wxALL|wxEXPAND, 5 ); + + bSizer31->Add( bSizer33, 0, 0, 5 ); + + bSizer30->Add( bSizer31, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer30 ); + this->Layout(); + bSizer30->Fit( this ); + + // Connect Events + OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ChangePasswordDialogBase::OnOKButtonClick ), NULL, this ); +} + +ChangePasswordDialogBase::~ChangePasswordDialogBase() +{ + // Disconnect Events + OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ChangePasswordDialogBase::OnOKButtonClick ), NULL, this ); +} + +DeviceSelectionDialogBase::DeviceSelectionDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxVERTICAL ); + + DeviceListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxSUNKEN_BORDER ); + bSizer4->Add( DeviceListCtrl, 1, wxALL|wxEXPAND, 5 ); + + StdButtons = new wxStdDialogButtonSizer(); + StdButtonsOK = new wxButton( this, wxID_OK ); + StdButtons->AddButton( StdButtonsOK ); + StdButtonsCancel = new wxButton( this, wxID_CANCEL ); + StdButtons->AddButton( StdButtonsCancel ); + StdButtons->Realize(); + bSizer4->Add( StdButtons, 0, wxEXPAND|wxALL, 5 ); + + bSizer3->Add( bSizer4, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer3 ); + this->Layout(); + bSizer3->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + DeviceListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemActivated ), NULL, this ); + DeviceListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemDeselected ), NULL, this ); + DeviceListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemSelected ), NULL, this ); +} + +DeviceSelectionDialogBase::~DeviceSelectionDialogBase() +{ + // Disconnect Events + DeviceListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemActivated ), NULL, this ); + DeviceListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemDeselected ), NULL, this ); + DeviceListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DeviceSelectionDialogBase::OnListItemSelected ), NULL, this ); +} + +EncryptionTestDialogBase::EncryptionTestDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer132; + bSizer132 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer133; + bSizer133 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer134; + bSizer134 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText41; + m_staticText41 = new wxStaticText( this, wxID_ANY, _("Encryption algorithm:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText41->Wrap( -1 ); + bSizer134->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxArrayString EncryptionAlgorithmChoiceChoices; + EncryptionAlgorithmChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, EncryptionAlgorithmChoiceChoices, 0 ); + EncryptionAlgorithmChoice->SetSelection( 0 ); + bSizer134->Add( EncryptionAlgorithmChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + XtsModeCheckBox = new wxCheckBox( this, wxID_ANY, _("XTS mode"), wxDefaultPosition, wxDefaultSize, 0 ); + XtsModeCheckBox->SetValue(true); + + bSizer134->Add( XtsModeCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer133->Add( bSizer134, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxStaticBoxSizer* sbSizer38; + sbSizer38 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Key (hexadecimal)") ), wxVERTICAL ); + + KeyTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + KeyTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier") ) ); + + sbSizer38->Add( KeyTextCtrl, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer135; + bSizer135 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText43; + m_staticText43 = new wxStaticText( this, wxID_ANY, _("Key size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText43->Wrap( -1 ); + bSizer135->Add( m_staticText43, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + KeySizeStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + KeySizeStaticText->Wrap( -1 ); + bSizer135->Add( KeySizeStaticText, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + + sbSizer38->Add( bSizer135, 0, wxEXPAND, 5 ); + + bSizer133->Add( sbSizer38, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer39; + sbSizer39 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("XTS mode") ), wxVERTICAL ); + + wxStaticText* m_staticText45; + m_staticText45 = new wxStaticText( this, wxID_ANY, _("Secondary key (hexadecimal)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText45->Wrap( -1 ); + sbSizer39->Add( m_staticText45, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + SecondaryKeyTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + SecondaryKeyTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier") ) ); + + sbSizer39->Add( SecondaryKeyTextCtrl, 0, wxEXPAND|wxALL, 5 ); + + wxStaticText* m_staticText46; + m_staticText46 = new wxStaticText( this, wxID_ANY, _("Data unit number (64-bit, data unit size is 512 bytes)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText46->Wrap( -1 ); + sbSizer39->Add( m_staticText46, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + DataUnitNumberTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer39->Add( DataUnitNumberTextCtrl, 0, wxALL, 5 ); + + wxStaticText* m_staticText47; + m_staticText47 = new wxStaticText( this, wxID_ANY, _("Block number:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText47->Wrap( -1 ); + sbSizer39->Add( m_staticText47, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + BlockNumberTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer39->Add( BlockNumberTextCtrl, 0, wxALL, 5 ); + + bSizer133->Add( sbSizer39, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer40; + sbSizer40 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Plaintext (hexadecimal)") ), wxVERTICAL ); + + PlainTextTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + PlainTextTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier") ) ); + + sbSizer40->Add( PlainTextTextCtrl, 0, wxALL|wxEXPAND, 5 ); + + bSizer133->Add( sbSizer40, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer41; + sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Ciphertext (hexadecimal)") ), wxVERTICAL ); + + CipherTextTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + CipherTextTextCtrl->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier") ) ); + + sbSizer41->Add( CipherTextTextCtrl, 0, wxALL|wxEXPAND, 5 ); + + bSizer133->Add( sbSizer41, 0, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer136; + bSizer136 = new wxBoxSizer( wxHORIZONTAL ); + + EncryptButton = new wxButton( this, wxID_ANY, _("&Encrypt"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer136->Add( EncryptButton, 0, wxALL, 5 ); + + DecryptButton = new wxButton( this, wxID_ANY, _("&Decrypt"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer136->Add( DecryptButton, 0, wxALL, 5 ); + + AutoTestAllButton = new wxButton( this, wxID_ANY, _("&Auto-Test All"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer136->Add( AutoTestAllButton, 0, wxALL, 5 ); + + ResetButton = new wxButton( this, wxID_ANY, _("&Reset"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer136->Add( ResetButton, 0, wxALL, 5 ); + + CloseButton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer136->Add( CloseButton, 0, wxALL, 5 ); + + bSizer133->Add( bSizer136, 0, wxEXPAND, 5 ); + + bSizer132->Add( bSizer133, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer132 ); + this->Layout(); + bSizer132->Fit( this ); + + // Connect Events + EncryptionAlgorithmChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( EncryptionTestDialogBase::OnEncryptionAlgorithmSelected ), NULL, this ); + XtsModeCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnXtsModeCheckBoxClick ), NULL, this ); + EncryptButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnEncryptButtonClick ), NULL, this ); + DecryptButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnDecryptButtonClick ), NULL, this ); + AutoTestAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnAutoTestAllButtonClick ), NULL, this ); + ResetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnResetButtonClick ), NULL, this ); +} + +EncryptionTestDialogBase::~EncryptionTestDialogBase() +{ + // Disconnect Events + EncryptionAlgorithmChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( EncryptionTestDialogBase::OnEncryptionAlgorithmSelected ), NULL, this ); + XtsModeCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnXtsModeCheckBoxClick ), NULL, this ); + EncryptButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnEncryptButtonClick ), NULL, this ); + DecryptButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnDecryptButtonClick ), NULL, this ); + AutoTestAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnAutoTestAllButtonClick ), NULL, this ); + ResetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionTestDialogBase::OnResetButtonClick ), NULL, this ); +} + +FavoriteVolumesDialogBase::FavoriteVolumesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer57; + bSizer57 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer60; + bSizer60 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer58; + bSizer58 = new wxBoxSizer( wxVERTICAL ); + + FavoritesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); + bSizer58->Add( FavoritesListCtrl, 1, wxALL|wxEXPAND, 5 ); + + wxGridSizer* gSizer5; + gSizer5 = new wxGridSizer( 1, 4, 0, 0 ); + + MoveUpButton = new wxButton( this, wxID_ANY, _("Move &Up"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer5->Add( MoveUpButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + MoveDownButton = new wxButton( this, wxID_ANY, _("Move &Down"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer5->Add( MoveDownButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + RemoveButton = new wxButton( this, wxID_ANY, _("&Remove"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer5->Add( RemoveButton, 0, wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + RemoveAllButton = new wxButton( this, wxID_ANY, _("Remove &All"), wxDefaultPosition, wxDefaultSize, 0 ); + gSizer5->Add( RemoveAllButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + bSizer58->Add( gSizer5, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxFlexGridSizer* fgSizer4; + fgSizer4 = new wxFlexGridSizer( 1, 5, 0, 0 ); + fgSizer4->AddGrowableCol( 2 ); + fgSizer4->SetFlexibleDirection( wxBOTH ); + fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer58->Add( fgSizer4, 0, wxEXPAND, 5 ); + + bSizer60->Add( bSizer58, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer59; + bSizer59 = new wxBoxSizer( wxVERTICAL ); + + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer59->Add( OKButton, 0, wxALL, 5 ); + + CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer59->Add( CancelButton, 0, wxALL, 5 ); + + bSizer60->Add( bSizer59, 0, wxEXPAND, 5 ); + + bSizer57->Add( bSizer60, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer57 ); + this->Layout(); + bSizer57->Fit( this ); + + // Connect Events + FavoritesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( FavoriteVolumesDialogBase::OnListItemDeselected ), NULL, this ); + FavoritesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( FavoriteVolumesDialogBase::OnListItemSelected ), NULL, this ); + MoveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnMoveUpButtonClick ), NULL, this ); + MoveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnMoveDownButtonClick ), NULL, this ); + RemoveButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnRemoveButtonClick ), NULL, this ); + RemoveAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnRemoveAllButtonClick ), NULL, this ); + OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnOKButtonClick ), NULL, this ); +} + +FavoriteVolumesDialogBase::~FavoriteVolumesDialogBase() +{ + // Disconnect Events + FavoritesListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( FavoriteVolumesDialogBase::OnListItemDeselected ), NULL, this ); + FavoritesListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( FavoriteVolumesDialogBase::OnListItemSelected ), NULL, this ); + MoveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnMoveUpButtonClick ), NULL, this ); + MoveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnMoveDownButtonClick ), NULL, this ); + RemoveButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnRemoveButtonClick ), NULL, this ); + RemoveAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnRemoveAllButtonClick ), NULL, this ); + OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( FavoriteVolumesDialogBase::OnOKButtonClick ), NULL, this ); +} + +KeyfilesDialogBase::KeyfilesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer26; + bSizer26 = new wxBoxSizer( wxVERTICAL ); + + UpperSizer = new wxBoxSizer( wxHORIZONTAL ); + + PanelSizer = new wxBoxSizer( wxVERTICAL ); + + UpperSizer->Add( PanelSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer22; + bSizer22 = new wxBoxSizer( wxVERTICAL ); + + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer22->Add( OKButton, 0, wxALL|wxEXPAND, 5 ); + + CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer22->Add( CancelButton, 0, wxALL|wxEXPAND, 5 ); + + WarningStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + WarningStaticText->Wrap( -1 ); + bSizer22->Add( WarningStaticText, 1, wxALL|wxEXPAND, 5 ); + + UpperSizer->Add( bSizer22, 0, wxEXPAND, 5 ); + + bSizer26->Add( UpperSizer, 1, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer23; + bSizer23 = new wxBoxSizer( wxVERTICAL ); + + KeyfilesNoteSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticLine* m_staticline1; + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + KeyfilesNoteSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + KeyfilesNoteStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + KeyfilesNoteStaticText->Wrap( -1 ); + KeyfilesNoteSizer->Add( KeyfilesNoteStaticText, 0, wxALL|wxEXPAND, 5 ); + + wxStaticLine* m_staticline2; + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + KeyfilesNoteSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); + + bSizer23->Add( KeyfilesNoteSizer, 1, wxEXPAND, 5 ); + + wxFlexGridSizer* fgSizer2; + fgSizer2 = new wxFlexGridSizer( 1, 2, 0, 0 ); + fgSizer2->AddGrowableCol( 0 ); + fgSizer2->SetFlexibleDirection( wxBOTH ); + fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + KeyfilesHyperlink = new wxHyperlinkCtrl( this, wxID_ANY, _("More information on keyfiles"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + + KeyfilesHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + KeyfilesHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + KeyfilesHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + fgSizer2->Add( KeyfilesHyperlink, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + CreateKeyfileButtton = new wxButton( this, wxID_ANY, _("&Generate Random Keyfile..."), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer2->Add( CreateKeyfileButtton, 0, wxALL, 5 ); + + bSizer23->Add( fgSizer2, 0, wxEXPAND, 5 ); + + bSizer26->Add( bSizer23, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + this->SetSizer( bSizer26 ); + this->Layout(); + bSizer26->Fit( this ); + + // Connect Events + KeyfilesHyperlink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( KeyfilesDialogBase::OnKeyfilesHyperlinkClick ), NULL, this ); + CreateKeyfileButtton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesDialogBase::OnCreateKeyfileButttonClick ), NULL, this ); +} + +KeyfilesDialogBase::~KeyfilesDialogBase() +{ + // Disconnect Events + KeyfilesHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( KeyfilesDialogBase::OnKeyfilesHyperlinkClick ), NULL, this ); + CreateKeyfileButtton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesDialogBase::OnCreateKeyfileButttonClick ), NULL, this ); +} + +KeyfileGeneratorDialogBase::KeyfileGeneratorDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + MainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer144; + bSizer144 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer145; + bSizer145 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer145->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticText* m_staticText49; + m_staticText49 = new wxStaticText( this, wxID_ANY, _("Mixing PRF:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText49->Wrap( -1 ); + bSizer145->Add( m_staticText49, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString HashChoiceChoices; + HashChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 ); + HashChoice->SetSelection( 0 ); + bSizer145->Add( HashChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer145->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer144->Add( bSizer145, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer43; + sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + wxBoxSizer* bSizer147; + bSizer147 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText52; + m_staticText52 = new wxStaticText( this, wxID_ANY, _("Random Pool:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText52->Wrap( -1 ); + bSizer147->Add( m_staticText52, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + RandomPoolStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + RandomPoolStaticText->Wrap( -1 ); + RandomPoolStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier New") ) ); + + bSizer147->Add( RandomPoolStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + ShowRandomPoolCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); + ShowRandomPoolCheckBox->SetValue(true); + + bSizer147->Add( ShowRandomPoolCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer43->Add( bSizer147, 0, wxEXPAND|wxTOP, 5 ); + + + sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 ); + + MouseStaticText = new wxStaticText( this, wxID_ANY, _("IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the keyfile."), wxDefaultPosition, wxDefaultSize, 0 ); + MouseStaticText->Wrap( -1 ); + sbSizer43->Add( MouseStaticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer144->Add( sbSizer43, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer146; + bSizer146 = new wxBoxSizer( wxHORIZONTAL ); + + GenerateButton = new wxButton( this, wxID_ANY, _("Generate and Save Keyfile..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer146->Add( GenerateButton, 0, wxALL, 5 ); + + + bSizer146->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxButton* m_button61; + m_button61 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer146->Add( m_button61, 0, wxALL, 5 ); + + bSizer144->Add( bSizer146, 0, wxEXPAND, 5 ); + + MainSizer->Add( bSizer144, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( MainSizer ); + this->Layout(); + MainSizer->Fit( this ); + + // Connect Events + this->Connect( wxEVT_MOTION, wxMouseEventHandler( KeyfileGeneratorDialogBase::OnMouseMotion ) ); + HashChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnHashSelected ), NULL, this ); + ShowRandomPoolCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnShowRandomPoolCheckBoxClicked ), NULL, this ); + GenerateButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnGenerateButtonClick ), NULL, this ); +} + +KeyfileGeneratorDialogBase::~KeyfileGeneratorDialogBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_MOTION, wxMouseEventHandler( KeyfileGeneratorDialogBase::OnMouseMotion ) ); + HashChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnHashSelected ), NULL, this ); + ShowRandomPoolCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnShowRandomPoolCheckBoxClicked ), NULL, this ); + GenerateButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfileGeneratorDialogBase::OnGenerateButtonClick ), NULL, this ); +} + +LegalNoticesDialogBase::LegalNoticesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer114; + bSizer114 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer115; + bSizer115 = new wxBoxSizer( wxVERTICAL ); + + LegalNoticesTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + bSizer115->Add( LegalNoticesTextCtrl, 1, wxALL|wxEXPAND, 5 ); + + wxButton* OKButton; + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer115->Add( OKButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer114->Add( bSizer115, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer114 ); + this->Layout(); + bSizer114->Fit( this ); +} + +LegalNoticesDialogBase::~LegalNoticesDialogBase() +{ +} + +MountOptionsDialogBase::MountOptionsDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer5; + bSizer5 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer19; + bSizer19 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer14; + bSizer14 = new wxBoxSizer( wxHORIZONTAL ); + + PasswordSizer = new wxBoxSizer( wxVERTICAL ); + + bSizer14->Add( PasswordSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer9; + bSizer9 = new wxBoxSizer( wxVERTICAL ); + + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer9->Add( OKButton, 0, wxALL|wxEXPAND, 5 ); + + CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( CancelButton, 0, wxALL|wxEXPAND, 5 ); + + + bSizer9->Add( 0, 0, 1, wxTOP|wxEXPAND, 5 ); + + OptionsButton = new wxButton( this, wxID_ANY, _("Op&tions"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( OptionsButton, 0, wxALL|wxEXPAND, 5 ); + + bSizer14->Add( bSizer9, 0, wxEXPAND, 5 ); + + bSizer19->Add( bSizer14, 0, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer6; + bSizer6 = new wxBoxSizer( wxVERTICAL ); + + OptionsPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + OptionsSizer = new wxStaticBoxSizer( new wxStaticBox( OptionsPanel, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + + OptionsSizer->Add( 0, 0, 0, wxTOP, 5 ); + + ReadOnlyCheckBox = new wxCheckBox( OptionsPanel, wxID_ANY, _("Mount volume as &read-only"), wxDefaultPosition, wxDefaultSize, 0 ); + + OptionsSizer->Add( ReadOnlyCheckBox, 0, wxALL, 5 ); + + RemovableCheckBox = new wxCheckBox( OptionsPanel, wxID_ANY, _("Mount volume as removable &medium"), wxDefaultPosition, wxDefaultSize, 0 ); + + OptionsSizer->Add( RemovableCheckBox, 0, wxALL, 5 ); + + PartitionInSystemEncryptionScopeCheckBox = new wxCheckBox( OptionsPanel, wxID_ANY, _("Mount partition &using system encryption (preboot authentication)"), wxDefaultPosition, wxDefaultSize, 0 ); + + OptionsSizer->Add( PartitionInSystemEncryptionScopeCheckBox, 0, wxALL, 5 ); + + ProtectionSizer = new wxStaticBoxSizer( new wxStaticBox( OptionsPanel, wxID_ANY, _("Hidden Volume Protection") ), wxVERTICAL ); + + ProtectionCheckBox = new wxCheckBox( OptionsPanel, wxID_ANY, _("&Protect hidden volume when mounting outer volume"), wxDefaultPosition, wxDefaultSize, 0 ); + + ProtectionSizer->Add( ProtectionCheckBox, 0, wxALL, 5 ); + + ProtectionPasswordSizer = new wxBoxSizer( wxVERTICAL ); + + ProtectionSizer->Add( ProtectionPasswordSizer, 1, wxEXPAND|wxLEFT, 5 ); + + ProtectionHyperlinkCtrl = new wxHyperlinkCtrl( OptionsPanel, wxID_ANY, _("What is hidden volume protection?"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + + ProtectionHyperlinkCtrl->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + ProtectionHyperlinkCtrl->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + ProtectionHyperlinkCtrl->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + ProtectionSizer->Add( ProtectionHyperlinkCtrl, 0, wxALL, 5 ); + + OptionsSizer->Add( ProtectionSizer, 1, wxEXPAND|wxALL, 5 ); + + FilesystemSizer = new wxBoxSizer( wxVERTICAL ); + + m_panel8 = new wxPanel( OptionsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxStaticBoxSizer* sbSizer28; + sbSizer28 = new wxStaticBoxSizer( new wxStaticBox( m_panel8, wxID_ANY, _("Filesystem") ), wxVERTICAL ); + + wxBoxSizer* bSizer54; + bSizer54 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer55; + bSizer55 = new wxBoxSizer( wxVERTICAL ); + + NoFilesystemCheckBox = new wxCheckBox( m_panel8, wxID_ANY, _("Do ¬ mount"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer55->Add( NoFilesystemCheckBox, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + bSizer54->Add( bSizer55, 1, wxEXPAND, 5 ); + + FilesystemOptionsSizer = new wxGridBagSizer( 0, 0 ); + FilesystemOptionsSizer->AddGrowableCol( 1 ); + FilesystemOptionsSizer->SetFlexibleDirection( wxBOTH ); + FilesystemOptionsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + FilesystemOptionsSizer->SetEmptyCellSize( wxSize( 0,0 ) ); + + FilesystemSpacer = new wxBoxSizer( wxVERTICAL ); + + FilesystemOptionsSizer->Add( FilesystemSpacer, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP, 5 ); + + MountPointTextCtrlStaticText = new wxStaticText( m_panel8, wxID_ANY, _("Mount at directory:"), wxDefaultPosition, wxDefaultSize, 0 ); + MountPointTextCtrlStaticText->Wrap( -1 ); + FilesystemOptionsSizer->Add( MountPointTextCtrlStaticText, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + MountPointTextCtrl = new wxTextCtrl( m_panel8, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + FilesystemOptionsSizer->Add( MountPointTextCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + MountPointButton = new wxButton( m_panel8, wxID_ANY, _("Se&lect..."), wxDefaultPosition, wxDefaultSize, 0 ); + FilesystemOptionsSizer->Add( MountPointButton, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + + FilesystemOptionsStaticText = new wxStaticText( m_panel8, wxID_ANY, _("Mount options:"), wxDefaultPosition, wxDefaultSize, 0 ); + FilesystemOptionsStaticText->Wrap( -1 ); + FilesystemOptionsSizer->Add( FilesystemOptionsStaticText, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxLEFT, 5 ); + + FilesystemOptionsTextCtrl = new wxTextCtrl( m_panel8, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + FilesystemOptionsSizer->Add( FilesystemOptionsTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + + bSizer54->Add( FilesystemOptionsSizer, 0, wxEXPAND, 5 ); + + sbSizer28->Add( bSizer54, 0, wxEXPAND|wxBOTTOM, 5 ); + + m_panel8->SetSizer( sbSizer28 ); + m_panel8->Layout(); + sbSizer28->Fit( m_panel8 ); + FilesystemSizer->Add( m_panel8, 0, wxEXPAND | wxALL, 5 ); + + OptionsSizer->Add( FilesystemSizer, 0, wxEXPAND, 5 ); + + OptionsPanel->SetSizer( OptionsSizer ); + OptionsPanel->Layout(); + OptionsSizer->Fit( OptionsPanel ); + bSizer6->Add( OptionsPanel, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + bSizer19->Add( bSizer6, 0, wxEXPAND, 5 ); + + bSizer5->Add( bSizer19, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer5 ); + this->Layout(); + bSizer5->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( MountOptionsDialogBase::OnInitDialog ) ); + OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnOKButtonClick ), NULL, this ); + OptionsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnOptionsButtonClick ), NULL, this ); + ReadOnlyCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnReadOnlyCheckBoxClick ), NULL, this ); + ProtectionCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnProtectionCheckBoxClick ), NULL, this ); + ProtectionHyperlinkCtrl->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( MountOptionsDialogBase::OnProtectionHyperlinkClick ), NULL, this ); + NoFilesystemCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnNoFilesystemCheckBoxClick ), NULL, this ); + MountPointButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnMountPointButtonClick ), NULL, this ); +} + +MountOptionsDialogBase::~MountOptionsDialogBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( MountOptionsDialogBase::OnInitDialog ) ); + OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnOKButtonClick ), NULL, this ); + OptionsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnOptionsButtonClick ), NULL, this ); + ReadOnlyCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnReadOnlyCheckBoxClick ), NULL, this ); + ProtectionCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnProtectionCheckBoxClick ), NULL, this ); + ProtectionHyperlinkCtrl->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( MountOptionsDialogBase::OnProtectionHyperlinkClick ), NULL, this ); + NoFilesystemCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnNoFilesystemCheckBoxClick ), NULL, this ); + MountPointButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MountOptionsDialogBase::OnMountPointButtonClick ), NULL, this ); +} + +NewSecurityTokenKeyfileDialogBase::NewSecurityTokenKeyfileDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer143; + bSizer143 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer144; + bSizer144 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer42; + sbSizer42 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer7; + fgSizer7 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer7->SetFlexibleDirection( wxBOTH ); + fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxStaticText* m_staticText47; + m_staticText47 = new wxStaticText( this, wxID_ANY, _("Security token:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + m_staticText47->Wrap( -1 ); + fgSizer7->Add( m_staticText47, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxArrayString SecurityTokenChoiceChoices; + SecurityTokenChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, SecurityTokenChoiceChoices, 0 ); + SecurityTokenChoice->SetSelection( 0 ); + fgSizer7->Add( SecurityTokenChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxStaticText* m_staticText48; + m_staticText48 = new wxStaticText( this, wxID_ANY, _("Keyfile name:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT ); + m_staticText48->Wrap( -1 ); + fgSizer7->Add( m_staticText48, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + KeyfileNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer7->Add( KeyfileNameTextCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); + + sbSizer42->Add( fgSizer7, 1, wxEXPAND|wxTOP, 5 ); + + bSizer144->Add( sbSizer42, 1, wxEXPAND|wxALL, 5 ); + + StdButtons = new wxStdDialogButtonSizer(); + StdButtonsOK = new wxButton( this, wxID_OK ); + StdButtons->AddButton( StdButtonsOK ); + StdButtonsCancel = new wxButton( this, wxID_CANCEL ); + StdButtons->AddButton( StdButtonsCancel ); + StdButtons->Realize(); + bSizer144->Add( StdButtons, 0, wxALIGN_RIGHT|wxALL, 5 ); + + bSizer143->Add( bSizer144, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer143 ); + this->Layout(); + bSizer143->Fit( this ); + + // Connect Events + KeyfileNameTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( NewSecurityTokenKeyfileDialogBase::OnKeyfileNameChanged ), NULL, this ); +} + +NewSecurityTokenKeyfileDialogBase::~NewSecurityTokenKeyfileDialogBase() +{ + // Disconnect Events + KeyfileNameTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( NewSecurityTokenKeyfileDialogBase::OnKeyfileNameChanged ), NULL, this ); +} + +PreferencesDialogBase::PreferencesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer32; + bSizer32 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer41; + bSizer41 = new wxBoxSizer( wxVERTICAL ); + + PreferencesNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + SecurityPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer44; + bSizer44 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer33; + bSizer33 = new wxBoxSizer( wxVERTICAL ); + + AutoDismountSizer = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("Auto-Dismount") ), wxVERTICAL ); + + wxStaticBoxSizer* sbSizer13; + sbSizer13 = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("Dismount All Volumes When") ), wxVERTICAL ); + + DismountOnLogOffCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("User logs off"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer13->Add( DismountOnLogOffCheckBox, 0, wxALL, 5 ); + + DismountOnScreenSaverCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("Screen saver is launched"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer13->Add( DismountOnScreenSaverCheckBox, 0, wxALL, 5 ); + + DismountOnPowerSavingCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("System is entering power saving mode"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer13->Add( DismountOnPowerSavingCheckBox, 0, wxALL, 5 ); + + AutoDismountSizer->Add( sbSizer13, 0, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer34; + bSizer34 = new wxBoxSizer( wxHORIZONTAL ); + + DismountOnInactivityCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("Auto-dismount volume after no data has been read/written to it for"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer34->Add( DismountOnInactivityCheckBox, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + DismountOnInactivitySpinCtrl = new wxSpinCtrl( SecurityPage, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( 60,-1 ), wxSP_ARROW_KEYS, 1, 9999, 1 ); + bSizer34->Add( DismountOnInactivitySpinCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + wxStaticText* m_staticText5; + m_staticText5 = new wxStaticText( SecurityPage, wxID_ANY, _("minutes"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5->Wrap( -1 ); + bSizer34->Add( m_staticText5, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + AutoDismountSizer->Add( bSizer34, 0, wxEXPAND, 5 ); + + ForceAutoDismountCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("Force auto-dismount even if volume contains open files or directories"), wxDefaultPosition, wxDefaultSize, 0 ); + + AutoDismountSizer->Add( ForceAutoDismountCheckBox, 0, wxALL, 5 ); + + bSizer33->Add( AutoDismountSizer, 0, wxEXPAND|wxALL, 5 ); + + FilesystemSecuritySizer = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("Filesystem") ), wxVERTICAL ); + + PreserveTimestampsCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("Preserve modification timestamp of file containers"), wxDefaultPosition, wxDefaultSize, 0 ); + + FilesystemSecuritySizer->Add( PreserveTimestampsCheckBox, 0, wxALL, 5 ); + + bSizer33->Add( FilesystemSecuritySizer, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer14; + sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( SecurityPage, wxID_ANY, _("Password Cache") ), wxVERTICAL ); + + WipeCacheOnCloseCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("Wipe after TrueCrypt window has been closed"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer14->Add( WipeCacheOnCloseCheckBox, 0, wxALL, 5 ); + + WipeCacheOnAutoDismountCheckBox = new wxCheckBox( SecurityPage, wxID_ANY, _("Wipe after volume has been auto-dismounted"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer14->Add( WipeCacheOnAutoDismountCheckBox, 0, wxALL, 5 ); + + bSizer33->Add( sbSizer14, 0, wxEXPAND|wxALL, 5 ); + + bSizer44->Add( bSizer33, 1, wxEXPAND|wxALL, 5 ); + + SecurityPage->SetSizer( bSizer44 ); + SecurityPage->Layout(); + bSizer44->Fit( SecurityPage ); + PreferencesNotebook->AddPage( SecurityPage, _("Security"), true ); + DefaultMountOptionsPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer46; + bSizer46 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer35; + bSizer35 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer15; + sbSizer15 = new wxStaticBoxSizer( new wxStaticBox( DefaultMountOptionsPage, wxID_ANY, _("Default Mount Options") ), wxVERTICAL ); + + MountReadOnlyCheckBox = new wxCheckBox( DefaultMountOptionsPage, wxID_ANY, _("Mount volumes as read-only"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer15->Add( MountReadOnlyCheckBox, 0, wxALL, 5 ); + + MountRemovableCheckBox = new wxCheckBox( DefaultMountOptionsPage, wxID_ANY, _("Mount volumes as removable media"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer15->Add( MountRemovableCheckBox, 0, wxALL, 5 ); + + CachePasswordsCheckBox = new wxCheckBox( DefaultMountOptionsPage, wxID_ANY, _("Cache passwords in memory"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer15->Add( CachePasswordsCheckBox, 0, wxALL, 5 ); + + bSizer35->Add( sbSizer15, 0, wxEXPAND|wxALL, 5 ); + + FilesystemSizer = new wxStaticBoxSizer( new wxStaticBox( DefaultMountOptionsPage, wxID_ANY, _("Filesystem") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer3; + fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 ); + fgSizer3->AddGrowableCol( 1 ); + fgSizer3->SetFlexibleDirection( wxBOTH ); + fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxStaticText* m_staticText6; + m_staticText6 = new wxStaticText( DefaultMountOptionsPage, wxID_ANY, _("Mount options:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText6->Wrap( -1 ); + fgSizer3->Add( m_staticText6, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + FilesystemOptionsTextCtrl = new wxTextCtrl( DefaultMountOptionsPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer3->Add( FilesystemOptionsTextCtrl, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + FilesystemSizer->Add( fgSizer3, 1, wxEXPAND, 5 ); + + bSizer35->Add( FilesystemSizer, 0, wxEXPAND|wxALL, 5 ); + + bSizer46->Add( bSizer35, 1, wxEXPAND|wxALL, 5 ); + + DefaultMountOptionsPage->SetSizer( bSizer46 ); + DefaultMountOptionsPage->Layout(); + bSizer46->Fit( DefaultMountOptionsPage ); + PreferencesNotebook->AddPage( DefaultMountOptionsPage, _("Mount Options"), false ); + BackgroundTaskPanel = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer61; + bSizer61 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer62; + bSizer62 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer18; + sbSizer18 = new wxStaticBoxSizer( new wxStaticBox( BackgroundTaskPanel, wxID_ANY, _("TrueCrypt Background Task") ), wxVERTICAL ); + + BackgroundTaskEnabledCheckBox = new wxCheckBox( BackgroundTaskPanel, wxID_ANY, _("Enabled"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer18->Add( BackgroundTaskEnabledCheckBox, 0, wxALL, 5 ); + + CloseBackgroundTaskOnNoVolumesCheckBox = new wxCheckBox( BackgroundTaskPanel, wxID_ANY, _("Exit when there are no mounted volumes"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer18->Add( CloseBackgroundTaskOnNoVolumesCheckBox, 0, wxALL, 5 ); + + wxStaticBoxSizer* sbSizer26; + sbSizer26 = new wxStaticBoxSizer( new wxStaticBox( BackgroundTaskPanel, wxID_ANY, _("Task Icon Menu Items") ), wxVERTICAL ); + + BackgroundTaskMenuMountItemsEnabledCheckBox = new wxCheckBox( BackgroundTaskPanel, wxID_ANY, _("Mount Favorite Volumes"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer26->Add( BackgroundTaskMenuMountItemsEnabledCheckBox, 0, wxALL, 5 ); + + BackgroundTaskMenuOpenItemsEnabledCheckBox = new wxCheckBox( BackgroundTaskPanel, wxID_ANY, _("Open Mounted Volumes"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer26->Add( BackgroundTaskMenuOpenItemsEnabledCheckBox, 0, wxALL, 5 ); + + BackgroundTaskMenuDismountItemsEnabledCheckBox = new wxCheckBox( BackgroundTaskPanel, wxID_ANY, _("Dismount Mounted Volumes"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer26->Add( BackgroundTaskMenuDismountItemsEnabledCheckBox, 0, wxALL, 5 ); + + sbSizer18->Add( sbSizer26, 1, wxEXPAND|wxALL, 5 ); + + bSizer62->Add( sbSizer18, 0, wxEXPAND|wxALL, 5 ); + + bSizer61->Add( bSizer62, 1, wxEXPAND|wxALL, 5 ); + + BackgroundTaskPanel->SetSizer( bSizer61 ); + BackgroundTaskPanel->Layout(); + bSizer61->Fit( BackgroundTaskPanel ); + PreferencesNotebook->AddPage( BackgroundTaskPanel, _("Background Task"), false ); + SystemIntegrationPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer49; + bSizer49 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer37; + bSizer37 = new wxBoxSizer( wxVERTICAL ); + + LogOnSizer = new wxStaticBoxSizer( new wxStaticBox( SystemIntegrationPage, wxID_ANY, _("Actions to Perform when User Logs On") ), wxVERTICAL ); + + StartOnLogonCheckBox = new wxCheckBox( SystemIntegrationPage, wxID_ANY, _("Start TrueCrypt Background Task"), wxDefaultPosition, wxDefaultSize, 0 ); + + LogOnSizer->Add( StartOnLogonCheckBox, 0, wxALL, 5 ); + + MountFavoritesOnLogonCheckBox = new wxCheckBox( SystemIntegrationPage, wxID_ANY, _("Mount favorite volumes"), wxDefaultPosition, wxDefaultSize, 0 ); + + LogOnSizer->Add( MountFavoritesOnLogonCheckBox, 0, wxALL, 5 ); + + MountDevicesOnLogonCheckBox = new wxCheckBox( SystemIntegrationPage, wxID_ANY, _("Mount all device-hosted TrueCrypt volumes"), wxDefaultPosition, wxDefaultSize, 0 ); + + LogOnSizer->Add( MountDevicesOnLogonCheckBox, 0, wxALL, 5 ); + + bSizer37->Add( LogOnSizer, 0, wxALL|wxEXPAND, 5 ); + + ExplorerSizer = new wxStaticBoxSizer( new wxStaticBox( SystemIntegrationPage, wxID_ANY, _("Filesystem Explorer") ), wxVERTICAL ); + + OpenExplorerWindowAfterMountCheckBox = new wxCheckBox( SystemIntegrationPage, wxID_ANY, _("Open Explorer window for successfully mounted volume"), wxDefaultPosition, wxDefaultSize, 0 ); + + ExplorerSizer->Add( OpenExplorerWindowAfterMountCheckBox, 0, wxALL, 5 ); + + CloseExplorerWindowsOnDismountCheckBox = new wxCheckBox( SystemIntegrationPage, wxID_ANY, _("Close all Explorer windows of volume being dismounted"), wxDefaultPosition, wxDefaultSize, 0 ); + + ExplorerSizer->Add( CloseExplorerWindowsOnDismountCheckBox, 0, wxALL, 5 ); + + bSizer37->Add( ExplorerSizer, 0, wxEXPAND|wxALL, 5 ); + + KernelServicesSizer = new wxStaticBoxSizer( new wxStaticBox( SystemIntegrationPage, wxID_ANY, _("Kernel Services") ), wxVERTICAL ); + + NoKernelCryptoCheckBox = new wxCheckBox( SystemIntegrationPage, wxID_ANY, _("Do not use kernel cryptographic services"), wxDefaultPosition, wxDefaultSize, 0 ); + + KernelServicesSizer->Add( NoKernelCryptoCheckBox, 0, wxALL, 5 ); + + bSizer37->Add( KernelServicesSizer, 0, wxEXPAND|wxALL, 5 ); + + bSizer49->Add( bSizer37, 1, wxEXPAND|wxALL, 5 ); + + SystemIntegrationPage->SetSizer( bSizer49 ); + SystemIntegrationPage->Layout(); + bSizer49->Fit( SystemIntegrationPage ); + PreferencesNotebook->AddPage( SystemIntegrationPage, _("System Integration"), false ); + PerformanceOptionsPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer151; + bSizer151 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer152; + bSizer152 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer44; + sbSizer44 = new wxStaticBoxSizer( new wxStaticBox( PerformanceOptionsPage, wxID_ANY, _("Hardware Acceleration") ), wxVERTICAL ); + + wxBoxSizer* bSizer158; + bSizer158 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText57; + m_staticText57 = new wxStaticText( PerformanceOptionsPage, wxID_ANY, _("Processor (CPU) in this computer supports hardware acceleration for AES:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText57->Wrap( -1 ); + bSizer158->Add( m_staticText57, 0, wxALL, 5 ); + + AesHwCpuSupportedStaticText = new wxStaticText( PerformanceOptionsPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0|wxSUNKEN_BORDER ); + AesHwCpuSupportedStaticText->Wrap( -1 ); + bSizer158->Add( AesHwCpuSupportedStaticText, 0, wxALL, 5 ); + + sbSizer44->Add( bSizer158, 1, wxEXPAND, 5 ); + + + sbSizer44->Add( 0, 0, 0, wxBOTTOM, 5 ); + + NoHardwareCryptoCheckBox = new wxCheckBox( PerformanceOptionsPage, wxID_ANY, _("Do not accelerate AES encryption/decryption by using the AES instructions of the processor"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer44->Add( NoHardwareCryptoCheckBox, 0, wxALL, 5 ); + + bSizer152->Add( sbSizer44, 0, wxEXPAND|wxALL, 5 ); + + bSizer151->Add( bSizer152, 1, wxALL|wxEXPAND, 5 ); + + PerformanceOptionsPage->SetSizer( bSizer151 ); + PerformanceOptionsPage->Layout(); + bSizer151->Fit( PerformanceOptionsPage ); + PreferencesNotebook->AddPage( PerformanceOptionsPage, _("Performance"), false ); + DefaultKeyfilesPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer40; + bSizer40 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer43; + bSizer43 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* bSizer42; + bSizer42 = new wxStaticBoxSizer( new wxStaticBox( DefaultKeyfilesPage, wxID_ANY, _("Default Keyfiles") ), wxVERTICAL ); + + DefaultKeyfilesSizer = new wxBoxSizer( wxVERTICAL ); + + bSizer42->Add( DefaultKeyfilesSizer, 1, wxEXPAND, 5 ); + + bSizer43->Add( bSizer42, 1, wxEXPAND|wxALL, 5 ); + + UseKeyfilesCheckBox = new wxCheckBox( DefaultKeyfilesPage, wxID_ANY, _("Use keyfiles by default"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer43->Add( UseKeyfilesCheckBox, 0, wxALL, 5 ); + + bSizer40->Add( bSizer43, 1, wxEXPAND|wxALL, 5 ); + + DefaultKeyfilesPage->SetSizer( bSizer40 ); + DefaultKeyfilesPage->Layout(); + bSizer40->Fit( DefaultKeyfilesPage ); + PreferencesNotebook->AddPage( DefaultKeyfilesPage, _("Keyfiles"), false ); + SecurityTokensPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer127; + bSizer127 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer128; + bSizer128 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer36; + sbSizer36 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("PKCS #11 Library Path") ), wxVERTICAL ); + + wxBoxSizer* bSizer129; + bSizer129 = new wxBoxSizer( wxHORIZONTAL ); + + Pkcs11ModulePathTextCtrl = new wxTextCtrl( SecurityTokensPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer129->Add( Pkcs11ModulePathTextCtrl, 1, wxALL, 5 ); + + SelectPkcs11ModuleButton = new wxButton( SecurityTokensPage, wxID_ANY, _("Select &Library..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer129->Add( SelectPkcs11ModuleButton, 0, wxALL, 5 ); + + sbSizer36->Add( bSizer129, 1, wxEXPAND, 5 ); + + bSizer128->Add( sbSizer36, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer37; + sbSizer37 = new wxStaticBoxSizer( new wxStaticBox( SecurityTokensPage, wxID_ANY, _("Security Options") ), wxVERTICAL ); + + CloseSecurityTokenSessionsAfterMountCheckBox = new wxCheckBox( SecurityTokensPage, wxID_ANY, _("&Close token session (log out) after a volume is successfully mounted"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer37->Add( CloseSecurityTokenSessionsAfterMountCheckBox, 0, wxALL, 5 ); + + bSizer128->Add( sbSizer37, 0, wxEXPAND|wxALL, 5 ); + + bSizer127->Add( bSizer128, 1, wxEXPAND|wxALL, 5 ); + + SecurityTokensPage->SetSizer( bSizer127 ); + SecurityTokensPage->Layout(); + bSizer127->Fit( SecurityTokensPage ); + PreferencesNotebook->AddPage( SecurityTokensPage, _("Security Tokens"), false ); + HotkeysPage = new wxPanel( PreferencesNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer51; + bSizer51 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer38; + bSizer38 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer21; + sbSizer21 = new wxStaticBoxSizer( new wxStaticBox( HotkeysPage, wxID_ANY, _("System-Wide Hotkeys") ), wxVERTICAL ); + + HotkeyListCtrl = new wxListCtrl( HotkeysPage, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxSUNKEN_BORDER ); + sbSizer21->Add( HotkeyListCtrl, 1, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer23; + sbSizer23 = new wxStaticBoxSizer( new wxStaticBox( HotkeysPage, wxID_ANY, _("Shortcut") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer4; + fgSizer4 = new wxFlexGridSizer( 2, 3, 0, 0 ); + fgSizer4->SetFlexibleDirection( wxBOTH ); + fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxStaticText* m_staticText10; + m_staticText10 = new wxStaticText( HotkeysPage, wxID_ANY, _("Key to assign:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText10->Wrap( -1 ); + fgSizer4->Add( m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + HotkeyTextCtrl = new wxTextCtrl( HotkeysPage, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer4->Add( HotkeyTextCtrl, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + AssignHotkeyButton = new wxButton( HotkeysPage, wxID_ANY, _("Assign"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer4->Add( AssignHotkeyButton, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + fgSizer4->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxGridSizer* gSizer4; + gSizer4 = new wxGridSizer( 1, 4, 0, 0 ); + + HotkeyControlCheckBox = new wxCheckBox( HotkeysPage, wxID_ANY, _("Control"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer4->Add( HotkeyControlCheckBox, 0, wxALL, 5 ); + + HotkeyShiftCheckBox = new wxCheckBox( HotkeysPage, wxID_ANY, _("Shift"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer4->Add( HotkeyShiftCheckBox, 0, wxALL, 5 ); + + HotkeyAltCheckBox = new wxCheckBox( HotkeysPage, wxID_ANY, _("Alt"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer4->Add( HotkeyAltCheckBox, 0, wxALL, 5 ); + + HotkeyWinCheckBox = new wxCheckBox( HotkeysPage, wxID_ANY, _("Win"), wxDefaultPosition, wxDefaultSize, 0 ); + + gSizer4->Add( HotkeyWinCheckBox, 0, wxALL, 5 ); + + fgSizer4->Add( gSizer4, 1, wxEXPAND, 5 ); + + RemoveHotkeyButton = new wxButton( HotkeysPage, wxID_ANY, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer4->Add( RemoveHotkeyButton, 1, wxALL, 5 ); + + sbSizer23->Add( fgSizer4, 1, wxALIGN_RIGHT, 5 ); + + sbSizer21->Add( sbSizer23, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer24; + sbSizer24 = new wxStaticBoxSizer( new wxStaticBox( HotkeysPage, wxID_ANY, _("Options") ), wxVERTICAL ); + + BeepAfterHotkeyMountDismountCheckBox = new wxCheckBox( HotkeysPage, wxID_ANY, _("Play system notification sound after mount/dismount"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer24->Add( BeepAfterHotkeyMountDismountCheckBox, 0, wxALL, 5 ); + + DisplayMessageAfterHotkeyDismountCheckBox = new wxCheckBox( HotkeysPage, wxID_ANY, _("Display confirmation message box after dismount"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer24->Add( DisplayMessageAfterHotkeyDismountCheckBox, 0, wxALL, 5 ); + + sbSizer21->Add( sbSizer24, 0, wxEXPAND|wxALL, 5 ); + + bSizer38->Add( sbSizer21, 1, wxEXPAND|wxALL, 5 ); + + bSizer51->Add( bSizer38, 1, wxEXPAND|wxALL, 5 ); + + HotkeysPage->SetSizer( bSizer51 ); + HotkeysPage->Layout(); + bSizer51->Fit( HotkeysPage ); + PreferencesNotebook->AddPage( HotkeysPage, _("Hotkeys"), false ); + + bSizer41->Add( PreferencesNotebook, 1, wxEXPAND | wxALL, 5 ); + + StdButtons = new wxStdDialogButtonSizer(); + StdButtonsOK = new wxButton( this, wxID_OK ); + StdButtons->AddButton( StdButtonsOK ); + StdButtonsCancel = new wxButton( this, wxID_CANCEL ); + StdButtons->AddButton( StdButtonsCancel ); + StdButtons->Realize(); + bSizer41->Add( StdButtons, 0, wxEXPAND|wxALL, 5 ); + + bSizer32->Add( bSizer41, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer32 ); + this->Layout(); + bSizer32->Fit( this ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PreferencesDialogBase::OnClose ) ); + DismountOnScreenSaverCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnScreenSaverCheckBoxClick ), NULL, this ); + DismountOnPowerSavingCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnPowerSavingCheckBoxClick ), NULL, this ); + ForceAutoDismountCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnForceAutoDismountCheckBoxClick ), NULL, this ); + PreserveTimestampsCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnPreserveTimestampsCheckBoxClick ), NULL, this ); + BackgroundTaskEnabledCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnBackgroundTaskEnabledCheckBoxClick ), NULL, this ); + NoKernelCryptoCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoKernelCryptoCheckBoxClick ), NULL, this ); + NoHardwareCryptoCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoHardwareCryptoCheckBoxClick ), NULL, this ); + SelectPkcs11ModuleButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSelectPkcs11ModuleButtonClick ), NULL, this ); + HotkeyListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemDeselected ), NULL, this ); + HotkeyListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemSelected ), NULL, this ); + AssignHotkeyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnAssignHotkeyButtonClick ), NULL, this ); + RemoveHotkeyButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnRemoveHotkeyButtonClick ), NULL, this ); + StdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnCancelButtonClick ), NULL, this ); + StdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnOKButtonClick ), NULL, this ); +} + +PreferencesDialogBase::~PreferencesDialogBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PreferencesDialogBase::OnClose ) ); + DismountOnScreenSaverCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnScreenSaverCheckBoxClick ), NULL, this ); + DismountOnPowerSavingCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnDismountOnPowerSavingCheckBoxClick ), NULL, this ); + ForceAutoDismountCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnForceAutoDismountCheckBoxClick ), NULL, this ); + PreserveTimestampsCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnPreserveTimestampsCheckBoxClick ), NULL, this ); + BackgroundTaskEnabledCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnBackgroundTaskEnabledCheckBoxClick ), NULL, this ); + NoKernelCryptoCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoKernelCryptoCheckBoxClick ), NULL, this ); + NoHardwareCryptoCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnNoHardwareCryptoCheckBoxClick ), NULL, this ); + SelectPkcs11ModuleButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnSelectPkcs11ModuleButtonClick ), NULL, this ); + HotkeyListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemDeselected ), NULL, this ); + HotkeyListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( PreferencesDialogBase::OnHotkeyListItemSelected ), NULL, this ); + AssignHotkeyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnAssignHotkeyButtonClick ), NULL, this ); + RemoveHotkeyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnRemoveHotkeyButtonClick ), NULL, this ); + StdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnCancelButtonClick ), NULL, this ); + StdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PreferencesDialogBase::OnOKButtonClick ), NULL, this ); +} + +RandomPoolEnrichmentDialogBase::RandomPoolEnrichmentDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + MainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer144; + bSizer144 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer145; + bSizer145 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer145->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticText* m_staticText49; + m_staticText49 = new wxStaticText( this, wxID_ANY, _("Mixing PRF:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText49->Wrap( -1 ); + bSizer145->Add( m_staticText49, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxArrayString HashChoiceChoices; + HashChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 ); + HashChoice->SetSelection( 0 ); + bSizer145->Add( HashChoice, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bSizer145->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer144->Add( bSizer145, 0, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer43; + sbSizer43 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + wxBoxSizer* bSizer147; + bSizer147 = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticText* m_staticText52; + m_staticText52 = new wxStaticText( this, wxID_ANY, _("Random Pool:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText52->Wrap( -1 ); + bSizer147->Add( m_staticText52, 0, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + RandomPoolStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + RandomPoolStaticText->Wrap( -1 ); + RandomPoolStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier New") ) ); + + bSizer147->Add( RandomPoolStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + ShowRandomPoolCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); + ShowRandomPoolCheckBox->SetValue(true); + + bSizer147->Add( ShowRandomPoolCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + sbSizer43->Add( bSizer147, 0, wxEXPAND|wxTOP, 5 ); + + + sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 ); + + MouseStaticText = new wxStaticText( this, wxID_ANY, _("IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases security. When done, click 'Continue'."), wxDefaultPosition, wxDefaultSize, 0 ); + MouseStaticText->Wrap( -1 ); + sbSizer43->Add( MouseStaticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer144->Add( sbSizer43, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizer146; + bSizer146 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer146->Add( 0, 0, 1, wxEXPAND, 5 ); + + ContinueButton = new wxButton( this, wxID_OK, _("&Continue"), wxDefaultPosition, wxDefaultSize, 0 ); + ContinueButton->SetDefault(); + bSizer146->Add( ContinueButton, 0, wxALL, 5 ); + + + bSizer146->Add( 0, 0, 1, wxEXPAND, 5 ); + + bSizer144->Add( bSizer146, 0, wxEXPAND, 5 ); + + MainSizer->Add( bSizer144, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( MainSizer ); + this->Layout(); + MainSizer->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_MOTION, wxMouseEventHandler( RandomPoolEnrichmentDialogBase::OnMouseMotion ) ); + HashChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnHashSelected ), NULL, this ); + ShowRandomPoolCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnShowRandomPoolCheckBoxClicked ), NULL, this ); +} + +RandomPoolEnrichmentDialogBase::~RandomPoolEnrichmentDialogBase() +{ + // Disconnect Events + this->Disconnect( wxEVT_MOTION, wxMouseEventHandler( RandomPoolEnrichmentDialogBase::OnMouseMotion ) ); + HashChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnHashSelected ), NULL, this ); + ShowRandomPoolCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( RandomPoolEnrichmentDialogBase::OnShowRandomPoolCheckBoxClicked ), NULL, this ); +} + +SecurityTokenKeyfilesDialogBase::SecurityTokenKeyfilesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); + this->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY ); + + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer138; + bSizer138 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer142; + bSizer142 = new wxBoxSizer( wxVERTICAL ); + + SecurityTokenKeyfileListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); + bSizer142->Add( SecurityTokenKeyfileListCtrl, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer141; + bSizer141 = new wxBoxSizer( wxHORIZONTAL ); + + ExportButton = new wxButton( this, wxID_ANY, _("&Export..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer141->Add( ExportButton, 0, wxALL, 5 ); + + DeleteButton = new wxButton( this, wxID_ANY, _("&Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer141->Add( DeleteButton, 0, wxALL, 5 ); + + + bSizer141->Add( 0, 0, 1, wxEXPAND|wxLEFT, 5 ); + + ImportButton = new wxButton( this, wxID_ANY, _("&Import Keyfile to Token..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer141->Add( ImportButton, 0, wxALL, 5 ); + + bSizer142->Add( bSizer141, 0, wxEXPAND, 5 ); + + bSizer138->Add( bSizer142, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer139; + bSizer139 = new wxBoxSizer( wxVERTICAL ); + + OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); + OKButton->SetDefault(); + bSizer139->Add( OKButton, 0, wxALL, 5 ); + + CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer139->Add( CancelButton, 0, wxALL, 5 ); + + bSizer138->Add( bSizer139, 0, wxEXPAND, 5 ); + + bSizer3->Add( bSizer138, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer3 ); + this->Layout(); + bSizer3->Fit( this ); + + // Connect Events + SecurityTokenKeyfileListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemActivated ), NULL, this ); + SecurityTokenKeyfileListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemDeselected ), NULL, this ); + SecurityTokenKeyfileListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemSelected ), NULL, this ); + ExportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnExportButtonClick ), NULL, this ); + DeleteButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnDeleteButtonClick ), NULL, this ); + ImportButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnImportButtonClick ), NULL, this ); + OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnOKButtonClick ), NULL, this ); +} + +SecurityTokenKeyfilesDialogBase::~SecurityTokenKeyfilesDialogBase() +{ + // Disconnect Events + SecurityTokenKeyfileListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemActivated ), NULL, this ); + SecurityTokenKeyfileListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemDeselected ), NULL, this ); + SecurityTokenKeyfileListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( SecurityTokenKeyfilesDialogBase::OnListItemSelected ), NULL, this ); + ExportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnExportButtonClick ), NULL, this ); + DeleteButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnDeleteButtonClick ), NULL, this ); + ImportButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnImportButtonClick ), NULL, this ); + OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SecurityTokenKeyfilesDialogBase::OnOKButtonClick ), NULL, this ); +} + +VolumePropertiesDialogBase::VolumePropertiesDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* bSizer49; + bSizer49 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer50; + bSizer50 = new wxBoxSizer( wxVERTICAL ); + + PropertiesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES|wxSUNKEN_BORDER ); + bSizer50->Add( PropertiesListCtrl, 1, wxALL|wxEXPAND, 5 ); + + StdButtons = new wxStdDialogButtonSizer(); + StdButtonsOK = new wxButton( this, wxID_OK ); + StdButtons->AddButton( StdButtonsOK ); + StdButtons->Realize(); + bSizer50->Add( StdButtons, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + bSizer49->Add( bSizer50, 1, wxEXPAND|wxALL, 5 ); + + this->SetSizer( bSizer49 ); + this->Layout(); + bSizer49->Fit( this ); +} + +VolumePropertiesDialogBase::~VolumePropertiesDialogBase() +{ +} + +EncryptionOptionsWizardPageBase::EncryptionOptionsWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer93; + bSizer93 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer94; + bSizer94 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer95; + bSizer95 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer29; + sbSizer29 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Encryption Algorithm") ), wxVERTICAL ); + + wxBoxSizer* bSizer96; + bSizer96 = new wxBoxSizer( wxHORIZONTAL ); + + wxArrayString EncryptionAlgorithmChoiceChoices; + EncryptionAlgorithmChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, EncryptionAlgorithmChoiceChoices, 0 ); + EncryptionAlgorithmChoice->SetSelection( 0 ); + bSizer96->Add( EncryptionAlgorithmChoice, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + TestButton = new wxButton( this, wxID_ANY, _("&Test"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer96->Add( TestButton, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + sbSizer29->Add( bSizer96, 0, wxEXPAND, 5 ); + + EncryptionAlgorithmStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + EncryptionAlgorithmStaticText->Wrap( -1 ); + sbSizer29->Add( EncryptionAlgorithmStaticText, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer97; + bSizer97 = new wxBoxSizer( wxHORIZONTAL ); + + EncryptionAlgorithmHyperlink = new wxHyperlinkCtrl( this, wxID_ANY, _("More information"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + + EncryptionAlgorithmHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + EncryptionAlgorithmHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + EncryptionAlgorithmHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + bSizer97->Add( EncryptionAlgorithmHyperlink, 0, wxALL, 5 ); + + + bSizer97->Add( 0, 0, 1, wxEXPAND, 5 ); + + BenchmarkButton = new wxButton( this, wxID_ANY, _("&Benchmark"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer97->Add( BenchmarkButton, 0, wxALL, 5 ); + + sbSizer29->Add( bSizer97, 0, wxEXPAND, 5 ); + + bSizer95->Add( sbSizer29, 1, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer30; + sbSizer30 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Hash Algorithm") ), wxHORIZONTAL ); + + wxArrayString HashChoiceChoices; + HashChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HashChoiceChoices, 0 ); + HashChoice->SetSelection( 0 ); + sbSizer30->Add( HashChoice, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + HashHyperlink = new wxHyperlinkCtrl( this, wxID_ANY, _("Information on hash algorithms"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); + + HashHyperlink->SetHoverColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + HashHyperlink->SetNormalColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + HashHyperlink->SetVisitedColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) ); + sbSizer30->Add( HashHyperlink, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer95->Add( sbSizer30, 0, wxEXPAND|wxALL, 5 ); + + bSizer94->Add( bSizer95, 1, wxEXPAND, 5 ); + + bSizer93->Add( bSizer94, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer93 ); + this->Layout(); + bSizer93->Fit( this ); + + // Connect Events + EncryptionAlgorithmChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnEncryptionAlgorithmSelected ), NULL, this ); + TestButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnTestButtonClick ), NULL, this ); + EncryptionAlgorithmHyperlink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( EncryptionOptionsWizardPageBase::OnEncryptionAlgorithmHyperlinkClick ), NULL, this ); + BenchmarkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnBenchmarkButtonClick ), NULL, this ); + HashHyperlink->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( EncryptionOptionsWizardPageBase::OnHashHyperlinkClick ), NULL, this ); +} + +EncryptionOptionsWizardPageBase::~EncryptionOptionsWizardPageBase() +{ + // Disconnect Events + EncryptionAlgorithmChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnEncryptionAlgorithmSelected ), NULL, this ); + TestButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnTestButtonClick ), NULL, this ); + EncryptionAlgorithmHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( EncryptionOptionsWizardPageBase::OnEncryptionAlgorithmHyperlinkClick ), NULL, this ); + BenchmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( EncryptionOptionsWizardPageBase::OnBenchmarkButtonClick ), NULL, this ); + HashHyperlink->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( EncryptionOptionsWizardPageBase::OnHashHyperlinkClick ), NULL, this ); +} + +InfoWizardPageBase::InfoWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer71; + bSizer71 = new wxBoxSizer( wxVERTICAL ); + + InfoPageSizer = new wxBoxSizer( wxVERTICAL ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + InfoPageSizer->Add( InfoStaticText, 1, wxALL|wxEXPAND, 5 ); + + bSizer71->Add( InfoPageSizer, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer71 ); + this->Layout(); + bSizer71->Fit( this ); +} + +InfoWizardPageBase::~InfoWizardPageBase() +{ +} + +KeyfilesPanelBase::KeyfilesPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer19; + bSizer19 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer20; + bSizer20 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer21; + bSizer21 = new wxBoxSizer( wxVERTICAL ); + + KeyfilesListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxSUNKEN_BORDER ); + bSizer21->Add( KeyfilesListCtrl, 1, wxEXPAND|wxALL, 5 ); + + wxBoxSizer* bSizer137; + bSizer137 = new wxBoxSizer( wxHORIZONTAL ); + + AddFilesButton = new wxButton( this, wxID_ANY, _("Add &Files..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer137->Add( AddFilesButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + AddDirectoryButton = new wxButton( this, wxID_ANY, _("Add &Path..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer137->Add( AddDirectoryButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + AddSecurityTokenSignatureButton = new wxButton( this, wxID_ANY, _("Add &Token Files..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer137->Add( AddSecurityTokenSignatureButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + RemoveButton = new wxButton( this, wxID_ANY, _("&Remove"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer137->Add( RemoveButton, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + RemoveAllButton = new wxButton( this, wxID_ANY, _("Remove &All"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer137->Add( RemoveAllButton, 0, wxEXPAND|wxALL, 5 ); + + bSizer21->Add( bSizer137, 0, wxEXPAND, 5 ); + + bSizer20->Add( bSizer21, 1, wxEXPAND, 5 ); + + bSizer19->Add( bSizer20, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer19 ); + this->Layout(); + + // Connect Events + KeyfilesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemDeselected ), NULL, this ); + KeyfilesListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemSelected ), NULL, this ); + KeyfilesListCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( KeyfilesPanelBase::OnListSizeChanged ), NULL, this ); + AddFilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddFilesButtonClick ), NULL, this ); + AddDirectoryButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddDirectoryButtonClick ), NULL, this ); + AddSecurityTokenSignatureButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddSecurityTokenSignatureButtonClick ), NULL, this ); + RemoveButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveButtonClick ), NULL, this ); + RemoveAllButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveAllButtonClick ), NULL, this ); +} + +KeyfilesPanelBase::~KeyfilesPanelBase() +{ + // Disconnect Events + KeyfilesListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemDeselected ), NULL, this ); + KeyfilesListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( KeyfilesPanelBase::OnListItemSelected ), NULL, this ); + KeyfilesListCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( KeyfilesPanelBase::OnListSizeChanged ), NULL, this ); + AddFilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddFilesButtonClick ), NULL, this ); + AddDirectoryButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddDirectoryButtonClick ), NULL, this ); + AddSecurityTokenSignatureButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnAddSecurityTokenSignatureButtonClick ), NULL, this ); + RemoveButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveButtonClick ), NULL, this ); + RemoveAllButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( KeyfilesPanelBase::OnRemoveAllButtonClick ), NULL, this ); +} + +ProgressWizardPageBase::ProgressWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer81; + bSizer81 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer82; + bSizer82 = new wxBoxSizer( wxVERTICAL ); + + ProgressSizer = new wxBoxSizer( wxHORIZONTAL ); + + ProgressGauge = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxSize( -1,-1 ), wxGA_HORIZONTAL|wxGA_SMOOTH ); + ProgressGauge->SetValue( 0 ); + ProgressSizer->Add( ProgressGauge, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + AbortButton = new wxButton( this, wxID_ANY, _("&Abort"), wxDefaultPosition, wxDefaultSize, 0 ); + AbortButton->Enable( false ); + + ProgressSizer->Add( AbortButton, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer82->Add( ProgressSizer, 0, wxEXPAND, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer82->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 ); + + bSizer81->Add( bSizer82, 0, wxEXPAND, 5 ); + + this->SetSizer( bSizer81 ); + this->Layout(); + bSizer81->Fit( this ); + + // Connect Events + AbortButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProgressWizardPageBase::OnAbortButtonClick ), NULL, this ); +} + +ProgressWizardPageBase::~ProgressWizardPageBase() +{ + // Disconnect Events + AbortButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProgressWizardPageBase::OnAbortButtonClick ), NULL, this ); +} + +SelectDirectoryWizardPageBase::SelectDirectoryWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer68; + bSizer68 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer69; + bSizer69 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer70; + bSizer70 = new wxBoxSizer( wxHORIZONTAL ); + + DirectoryTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer70->Add( DirectoryTextCtrl, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + BrowseButton = new wxButton( this, wxID_ANY, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer70->Add( BrowseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer69->Add( bSizer70, 0, wxEXPAND, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( 300 ); + bSizer69->Add( InfoStaticText, 1, wxALL|wxEXPAND, 5 ); + + bSizer68->Add( bSizer69, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer68 ); + this->Layout(); + + // Connect Events + DirectoryTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnDirectoryTextChanged ), NULL, this ); + BrowseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnBrowseButtonClick ), NULL, this ); +} + +SelectDirectoryWizardPageBase::~SelectDirectoryWizardPageBase() +{ + // Disconnect Events + DirectoryTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnDirectoryTextChanged ), NULL, this ); + BrowseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( SelectDirectoryWizardPageBase::OnBrowseButtonClick ), NULL, this ); +} + +SingleChoiceWizardPageBase::SingleChoiceWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer71; + bSizer71 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer77; + bSizer77 = new wxBoxSizer( wxVERTICAL ); + + + bSizer77->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 ); + + OuterChoicesSizer = new wxBoxSizer( wxVERTICAL ); + + ChoicesSizer = new wxBoxSizer( wxVERTICAL ); + + OuterChoicesSizer->Add( ChoicesSizer, 0, wxEXPAND, 5 ); + + bSizer77->Add( OuterChoicesSizer, 0, wxEXPAND, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer77->Add( InfoStaticText, 1, wxALL|wxEXPAND, 5 ); + + bSizer71->Add( bSizer77, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer71 ); + this->Layout(); + bSizer71->Fit( this ); +} + +SingleChoiceWizardPageBase::~SingleChoiceWizardPageBase() +{ +} + +VolumeCreationProgressWizardPageBase::VolumeCreationProgressWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer104; + bSizer104 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer105; + bSizer105 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer31; + sbSizer31 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + KeySamplesUpperSizer = new wxBoxSizer( wxVERTICAL ); + + KeySamplesUpperInnerSizer = new wxBoxSizer( wxVERTICAL ); + + KeySamplesUpperSizer->Add( KeySamplesUpperInnerSizer, 1, wxEXPAND|wxTOP, 3 ); + + sbSizer31->Add( KeySamplesUpperSizer, 1, wxEXPAND, 30 ); + + wxFlexGridSizer* fgSizer5; + fgSizer5 = new wxFlexGridSizer( 3, 2, 0, 0 ); + fgSizer5->SetFlexibleDirection( wxBOTH ); + fgSizer5->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + wxStaticText* m_staticText25; + m_staticText25 = new wxStaticText( this, wxID_ANY, _("Random Pool:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText25->Wrap( -1 ); + fgSizer5->Add( m_staticText25, 0, wxALL|wxALIGN_RIGHT|wxALIGN_BOTTOM, 5 ); + + wxBoxSizer* bSizer126; + bSizer126 = new wxBoxSizer( wxHORIZONTAL ); + + RandomPoolSampleStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + RandomPoolSampleStaticText->Wrap( -1 ); + RandomPoolSampleStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier New") ) ); + + bSizer126->Add( RandomPoolSampleStaticText, 0, wxEXPAND|wxTOP|wxRIGHT|wxALIGN_BOTTOM, 7 ); + + DisplayKeysCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); + DisplayKeysCheckBox->SetValue(true); + + bSizer126->Add( DisplayKeysCheckBox, 0, wxEXPAND|wxRIGHT, 5 ); + + fgSizer5->Add( bSizer126, 1, wxEXPAND|wxALIGN_BOTTOM, 5 ); + + wxStaticText* m_staticText28; + m_staticText28 = new wxStaticText( this, wxID_ANY, _("Header Key:"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + m_staticText28->Wrap( -1 ); + fgSizer5->Add( m_staticText28, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_BOTTOM, 5 ); + + HeaderKeySampleStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + HeaderKeySampleStaticText->Wrap( -1 ); + HeaderKeySampleStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier New") ) ); + + fgSizer5->Add( HeaderKeySampleStaticText, 0, wxALIGN_BOTTOM|wxEXPAND|wxTOP|wxRIGHT, 2 ); + + wxStaticText* m_staticText29; + m_staticText29 = new wxStaticText( this, wxID_ANY, _("Master Key:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText29->Wrap( -1 ); + fgSizer5->Add( m_staticText29, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_BOTTOM, 5 ); + + MasterKeySampleStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + MasterKeySampleStaticText->Wrap( -1 ); + MasterKeySampleStaticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Courier New") ) ); + + fgSizer5->Add( MasterKeySampleStaticText, 0, wxEXPAND|wxALIGN_BOTTOM|wxTOP|wxRIGHT, 2 ); + + sbSizer31->Add( fgSizer5, 0, wxEXPAND, 5 ); + + bSizer105->Add( sbSizer31, 0, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizer32; + sbSizer32 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + wxBoxSizer* bSizer106; + bSizer106 = new wxBoxSizer( wxHORIZONTAL ); + + ProgressGauge = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH ); + bSizer106->Add( ProgressGauge, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + AbortButton = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer106->Add( AbortButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + sbSizer32->Add( bSizer106, 0, wxEXPAND, 5 ); + + wxGridSizer* gSizer6; + gSizer6 = new wxGridSizer( 1, 3, 0, 0 ); + + wxBoxSizer* bSizer108; + bSizer108 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText31 = new wxStaticText( this, wxID_ANY, _("Done"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText31->Wrap( -1 ); + bSizer108->Add( m_staticText31, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_panel12 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSUNKEN_BORDER ); + wxBoxSizer* bSizer115; + bSizer115 = new wxBoxSizer( wxHORIZONTAL ); + + SizeDoneStaticText = new wxStaticText( m_panel12, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + SizeDoneStaticText->Wrap( -1 ); + bSizer115->Add( SizeDoneStaticText, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 3 ); + + m_panel12->SetSizer( bSizer115 ); + m_panel12->Layout(); + bSizer115->Fit( m_panel12 ); + bSizer108->Add( m_panel12, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + gSizer6->Add( bSizer108, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer1081; + bSizer1081 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText311 = new wxStaticText( this, wxID_ANY, _("Speed"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText311->Wrap( -1 ); + bSizer1081->Add( m_staticText311, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_panel121 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER ); + wxBoxSizer* bSizer1151; + bSizer1151 = new wxBoxSizer( wxHORIZONTAL ); + + SpeedStaticText = new wxStaticText( m_panel121, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + SpeedStaticText->Wrap( -1 ); + bSizer1151->Add( SpeedStaticText, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); + + m_panel121->SetSizer( bSizer1151 ); + m_panel121->Layout(); + bSizer1151->Fit( m_panel121 ); + bSizer1081->Add( m_panel121, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + gSizer6->Add( bSizer1081, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + wxBoxSizer* bSizer1082; + bSizer1082 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText312 = new wxStaticText( this, wxID_ANY, _("Left"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText312->Wrap( -1 ); + bSizer1082->Add( m_staticText312, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_panel122 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); + wxBoxSizer* bSizer1152; + bSizer1152 = new wxBoxSizer( wxHORIZONTAL ); + + TimeLeftStaticText = new wxStaticText( m_panel122, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT|wxST_NO_AUTORESIZE ); + TimeLeftStaticText->Wrap( -1 ); + bSizer1152->Add( TimeLeftStaticText, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 3 ); + + m_panel122->SetSizer( bSizer1152 ); + m_panel122->Layout(); + bSizer1152->Fit( m_panel122 ); + bSizer1082->Add( m_panel122, 1, wxALL|wxEXPAND, 5 ); + + gSizer6->Add( bSizer1082, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + sbSizer32->Add( gSizer6, 0, wxEXPAND|wxTOP, 2 ); + + bSizer105->Add( sbSizer32, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizer105->Add( 0, 0, 0, wxTOP|wxBOTTOM, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer105->Add( InfoStaticText, 0, wxALL, 5 ); + + bSizer104->Add( bSizer105, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer104 ); + this->Layout(); + bSizer104->Fit( this ); + + // Connect Events + DisplayKeysCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnDisplayKeysCheckBoxClick ), NULL, this ); + AbortButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnAbortButtonClick ), NULL, this ); +} + +VolumeCreationProgressWizardPageBase::~VolumeCreationProgressWizardPageBase() +{ + // Disconnect Events + DisplayKeysCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnDisplayKeysCheckBoxClick ), NULL, this ); + AbortButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeCreationProgressWizardPageBase::OnAbortButtonClick ), NULL, this ); +} + +VolumeLocationWizardPageBase::VolumeLocationWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer86; + bSizer86 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer87; + bSizer87 = new wxBoxSizer( wxVERTICAL ); + + + bSizer87->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 ); + + wxBoxSizer* bSizer88; + bSizer88 = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer89; + bSizer89 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer126; + bSizer126 = new wxBoxSizer( wxHORIZONTAL ); + + VolumePathComboBox = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN ); + bSizer126->Add( VolumePathComboBox, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + wxBoxSizer* bSizer90; + bSizer90 = new wxBoxSizer( wxVERTICAL ); + + SelectFileButton = new wxButton( this, wxID_ANY, _("Select &File..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer90->Add( SelectFileButton, 0, wxALL|wxEXPAND, 5 ); + + SelectDeviceButton = new wxButton( this, wxID_ANY, _("Select D&evice..."), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer90->Add( SelectDeviceButton, 0, wxALL|wxEXPAND, 5 ); + + bSizer126->Add( bSizer90, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + bSizer89->Add( bSizer126, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer91; + bSizer91 = new wxBoxSizer( wxHORIZONTAL ); + + + bSizer91->Add( 0, 0, 0, wxLEFT, 5 ); + + NoHistoryCheckBox = new wxCheckBox( this, wxID_ANY, _("&Never save history"), wxDefaultPosition, wxDefaultSize, 0 ); + + bSizer91->Add( NoHistoryCheckBox, 0, wxALL|wxEXPAND, 5 ); + + bSizer89->Add( bSizer91, 0, wxEXPAND, 5 ); + + bSizer88->Add( bSizer89, 1, wxEXPAND, 5 ); + + bSizer87->Add( bSizer88, 0, wxEXPAND, 5 ); + + + bSizer87->Add( 0, 0, 0, wxEXPAND|wxBOTTOM, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer87->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 ); + + bSizer86->Add( bSizer87, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer86 ); + this->Layout(); + bSizer86->Fit( this ); + + // Connect Events + VolumePathComboBox->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnVolumePathTextChanged ), NULL, this ); + SelectFileButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectFileButtonClick ), NULL, this ); + SelectDeviceButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectDeviceButtonClick ), NULL, this ); + NoHistoryCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnNoHistoryCheckBoxClick ), NULL, this ); +} + +VolumeLocationWizardPageBase::~VolumeLocationWizardPageBase() +{ + // Disconnect Events + VolumePathComboBox->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnVolumePathTextChanged ), NULL, this ); + SelectFileButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectFileButtonClick ), NULL, this ); + SelectDeviceButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnSelectDeviceButtonClick ), NULL, this ); + NoHistoryCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeLocationWizardPageBase::OnNoHistoryCheckBoxClick ), NULL, this ); +} + +VolumeFormatOptionsWizardPageBase::VolumeFormatOptionsWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer124; + bSizer124 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer125; + bSizer125 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer33; + sbSizer33 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Filesystem Options") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer6; + fgSizer6 = new wxFlexGridSizer( 2, 2, 0, 0 ); + fgSizer6->SetFlexibleDirection( wxBOTH ); + fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText43 = new wxStaticText( this, wxID_ANY, _("Filesystem type:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText43->Wrap( -1 ); + fgSizer6->Add( m_staticText43, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + wxArrayString FilesystemTypeChoiceChoices; + FilesystemTypeChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, FilesystemTypeChoiceChoices, 0 ); + FilesystemTypeChoice->SetSelection( 0 ); + fgSizer6->Add( FilesystemTypeChoice, 0, wxALL, 5 ); + + sbSizer33->Add( fgSizer6, 1, wxEXPAND, 5 ); + + bSizer125->Add( sbSizer33, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* sbSizer34; + sbSizer34 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Volume Format Options") ), wxVERTICAL ); + + QuickFormatCheckBox = new wxCheckBox( this, wxID_ANY, _("Quick format"), wxDefaultPosition, wxDefaultSize, 0 ); + + sbSizer34->Add( QuickFormatCheckBox, 0, wxALL, 5 ); + + bSizer125->Add( sbSizer34, 0, wxEXPAND|wxALL, 5 ); + + + bSizer125->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer125->Add( InfoStaticText, 0, wxALL, 5 ); + + bSizer124->Add( bSizer125, 0, wxEXPAND, 5 ); + + this->SetSizer( bSizer124 ); + this->Layout(); + bSizer124->Fit( this ); + + // Connect Events + FilesystemTypeChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnFilesystemTypeSelected ), NULL, this ); + QuickFormatCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnQuickFormatCheckBoxClick ), NULL, this ); +} + +VolumeFormatOptionsWizardPageBase::~VolumeFormatOptionsWizardPageBase() +{ + // Disconnect Events + FilesystemTypeChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnFilesystemTypeSelected ), NULL, this ); + QuickFormatCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumeFormatOptionsWizardPageBase::OnQuickFormatCheckBoxClick ), NULL, this ); +} + +VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer7; + bSizer7 = new wxBoxSizer( wxVERTICAL ); + + GridBagSizer = new wxGridBagSizer( 0, 0 ); + GridBagSizer->AddGrowableCol( 1 ); + GridBagSizer->SetFlexibleDirection( wxBOTH ); + GridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + GridBagSizer->SetEmptyCellSize( wxSize( 0,0 ) ); + + PasswordStaticText = new wxStaticText( this, wxID_ANY, _("Password:"), wxDefaultPosition, wxDefaultSize, 0 ); + PasswordStaticText->Wrap( -1 ); + GridBagSizer->Add( PasswordStaticText, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 5 ); + + PasswordTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); + PasswordTextCtrl->SetMaxLength( 1 ); + PasswordTextCtrl->SetMinSize( wxSize( 232,-1 ) ); + + GridBagSizer->Add( PasswordTextCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + ConfirmPasswordStaticText = new wxStaticText( this, wxID_ANY, _("Confirm password:"), wxDefaultPosition, wxDefaultSize, 0 ); + ConfirmPasswordStaticText->Wrap( -1 ); + GridBagSizer->Add( ConfirmPasswordStaticText, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + ConfirmPasswordTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); + ConfirmPasswordTextCtrl->SetMaxLength( 1 ); + ConfirmPasswordTextCtrl->SetMinSize( wxSize( 232,-1 ) ); + + GridBagSizer->Add( ConfirmPasswordTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + CacheCheckBox = new wxCheckBox( this, wxID_ANY, _("Cach&e passwords and keyfiles in memory "), wxDefaultPosition, wxDefaultSize, 0 ); + + GridBagSizer->Add( CacheCheckBox, wxGBPosition( 3, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + DisplayPasswordCheckBox = new wxCheckBox( this, wxID_ANY, _("&Display password"), wxDefaultPosition, wxDefaultSize, 0 ); + + GridBagSizer->Add( DisplayPasswordCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + UseKeyfilesCheckBox = new wxCheckBox( this, wxID_ANY, _("U&se keyfiles"), wxDefaultPosition, wxDefaultSize, 0 ); + + GridBagSizer->Add( UseKeyfilesCheckBox, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxRIGHT|wxLEFT, 5 ); + + KeyfilesButton = new wxButton( this, wxID_ANY, _("&Keyfiles..."), wxDefaultPosition, wxDefaultSize, 0 ); + GridBagSizer->Add( KeyfilesButton, wxGBPosition( 5, 2 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT, 5 ); + + Pkcs5PrfSizer = new wxBoxSizer( wxVERTICAL ); + + GridBagSizer->Add( Pkcs5PrfSizer, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + Pkcs5PrfStaticText = new wxStaticText( this, wxID_ANY, _("PKCS-5 PRF:"), wxDefaultPosition, wxDefaultSize, 0 ); + Pkcs5PrfStaticText->Wrap( -1 ); + GridBagSizer->Add( Pkcs5PrfStaticText, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + wxString Pkcs5PrfChoiceChoices[] = { _("Unchanged") }; + int Pkcs5PrfChoiceNChoices = sizeof( Pkcs5PrfChoiceChoices ) / sizeof( wxString ); + Pkcs5PrfChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Pkcs5PrfChoiceNChoices, Pkcs5PrfChoiceChoices, 0 ); + Pkcs5PrfChoice->SetSelection( 0 ); + GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + + PasswordPlaceholderSizer = new wxBoxSizer( wxVERTICAL ); + + GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 ); + + bSizer7->Add( GridBagSizer, 1, wxALL|wxEXPAND, 5 ); + + this->SetSizer( bSizer7 ); + this->Layout(); + bSizer7->Fit( this ); + + // Connect Events + PasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this ); + ConfirmPasswordTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this ); + DisplayPasswordCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnDisplayPasswordCheckBoxClick ), NULL, this ); + UseKeyfilesCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUseKeyfilesCheckBoxClick ), NULL, this ); + KeyfilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this ); + KeyfilesButton->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this ); + KeyfilesButton->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this ); +} + +VolumePasswordPanelBase::~VolumePasswordPanelBase() +{ + // Disconnect Events + PasswordTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this ); + ConfirmPasswordTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePasswordPanelBase::OnTextChanged ), NULL, this ); + DisplayPasswordCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnDisplayPasswordCheckBoxClick ), NULL, this ); + UseKeyfilesCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnUseKeyfilesCheckBoxClick ), NULL, this ); + KeyfilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this ); + KeyfilesButton->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this ); + KeyfilesButton->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this ); +} + +VolumePasswordWizardPageBase::VolumePasswordWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer101; + bSizer101 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer102; + bSizer102 = new wxBoxSizer( wxVERTICAL ); + + PasswordPanelSizer = new wxBoxSizer( wxVERTICAL ); + + bSizer102->Add( PasswordPanelSizer, 0, wxEXPAND, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer102->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 ); + + bSizer101->Add( bSizer102, 1, wxEXPAND, 5 ); + + this->SetSizer( bSizer101 ); + this->Layout(); + bSizer101->Fit( this ); +} + +VolumePasswordWizardPageBase::~VolumePasswordWizardPageBase() +{ +} + +VolumeSizeWizardPageBase::VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style ) +{ + wxBoxSizer* bSizer98; + bSizer98 = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizer99; + bSizer99 = new wxBoxSizer( wxVERTICAL ); + + + bSizer99->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer100; + bSizer100 = new wxBoxSizer( wxHORIZONTAL ); + + VolumeSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer100->Add( VolumeSizeTextCtrl, 0, wxALL, 5 ); + + wxArrayString VolumeSizePrefixChoiceChoices; + VolumeSizePrefixChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, VolumeSizePrefixChoiceChoices, 0 ); + VolumeSizePrefixChoice->SetSelection( 0 ); + bSizer100->Add( VolumeSizePrefixChoice, 0, wxALL, 5 ); + + bSizer99->Add( bSizer100, 0, wxEXPAND, 5 ); + + + bSizer99->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + FreeSpaceStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + FreeSpaceStaticText->Wrap( -1 ); + bSizer99->Add( FreeSpaceStaticText, 0, wxALL|wxEXPAND, 5 ); + + + bSizer99->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + InfoStaticText->Wrap( -1 ); + bSizer99->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 ); + + bSizer98->Add( bSizer99, 0, wxEXPAND, 5 ); + + this->SetSizer( bSizer98 ); + this->Layout(); + bSizer98->Fit( this ); + + // Connect Events + VolumeSizeTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizeTextChanged ), NULL, this ); + VolumeSizePrefixChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizePrefixSelected ), NULL, this ); +} + +VolumeSizeWizardPageBase::~VolumeSizeWizardPageBase() +{ + // Disconnect Events + VolumeSizeTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizeTextChanged ), NULL, this ); + VolumeSizePrefixChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( VolumeSizeWizardPageBase::OnVolumeSizePrefixSelected ), NULL, this ); +} diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h new file mode 100644 index 00000000..cbc6f6e1 --- /dev/null +++ b/src/Main/Forms/Forms.h @@ -0,0 +1,1023 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __Forms__ +#define __Forms__ + +#include + +class WizardPage; + +#include "WizardPage.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +namespace TrueCrypt +{ + /////////////////////////////////////////////////////////////////////////////// + /// Class MainFrameBase + /////////////////////////////////////////////////////////////////////////////// + class MainFrameBase : public wxFrame + { + private: + + protected: + wxMenuBar* MainMenuBar; + wxMenu* VolumesMenu; + wxMenuItem* MountVolumeMenuItem; + wxMenuItem* DismountVolumeMenuItem; + wxMenuItem* DismountAllMenuItem; + wxMenuItem* VolumePropertiesMenuItem; + wxMenu* FavoritesMenu; + wxMenuItem* AddToFavoritesMenuItem; + wxMenuItem* AddAllMountedToFavoritesMenuItem; + wxMenu* ToolsMenu; + wxMenuItem* BackupVolumeHeadersMenuItem; + wxMenuItem* RestoreVolumeHeaderMenuItem; + wxMenuItem* WipeCachedPasswordsMenuItem; + wxMenu* SettingsMenu; + wxMenuItem* HotkeysMenuItem; + wxMenuItem* PreferencesMenuItem; + wxMenu* HelpMenu; + wxPanel* MainPanel; + wxListCtrl* SlotListCtrl; + wxStaticBoxSizer* LowStaticBoxSizer; + wxBoxSizer* HigherButtonSizer; + wxButton* CreateVolumeButton; + wxButton* VolumePropertiesButton; + wxButton* WipeCacheButton; + + wxStaticBoxSizer* VolumeStaticBoxSizer; + wxGridBagSizer* VolumeGridBagSizer; + wxStaticBitmap* LogoBitmap; + wxComboBox* VolumePathComboBox; + wxButton* SelectFileButton; + wxCheckBox* NoHistoryCheckBox; + wxButton* VolumeToolsButton; + wxButton* SelectDeviceButton; + + wxButton* VolumeButton; + wxButton* MountAllDevicesButton; + wxButton* DismountAllButton; + wxButton* ExitButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnActivate( wxActivateEvent& event ){ event.Skip(); } + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnCreateVolumeButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnMountVolumeMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnMountAllDevicesButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDismountVolumeMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDismountAllButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnChangePasswordMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnChangePkcs5PrfMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnChangeKeyfilesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRemoveKeyfilesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnVolumePropertiesButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAddToFavoritesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAddAllMountedToFavoritesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOrganizeFavoritesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnMountAllFavoritesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnBenchmarkMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnEncryptionTestMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnBackupVolumeHeadersMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRestoreVolumeHeaderMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCreateKeyfileMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnManageSecurityTokenKeyfilesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCloseAllSecurityTokenSessionsMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnWipeCacheButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnHotkeysMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDefaultKeyfilesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSecurityTokenPreferencesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnPreferencesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnUserGuideMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOnlineHelpMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnBeginnersTutorialMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnFaqMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnWebsiteMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDownloadsMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnNewsMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnVersionHistoryMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnContactMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnLegalNoticesMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAboutMenuItemSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemRightClick( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } + virtual void OnLogoBitmapClick( wxMouseEvent& event ){ event.Skip(); } + virtual void OnSelectFileButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnNoHistoryCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnVolumeToolsButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSelectDeviceButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnVolumeButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnExitButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + MainFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("TrueCrypt"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,496 ), long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxTAB_TRAVERSAL ); + ~MainFrameBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class WizardFrameBase + /////////////////////////////////////////////////////////////////////////////// + class WizardFrameBase : public wxFrame + { + private: + + protected: + wxPanel* MainPanel; + wxStaticBitmap* WizardBitmap; + wxStaticText* PageTitleStaticText; + wxBoxSizer* PageSizer; + + wxButton* HelpButton; + + wxButton* PreviousButton; + wxButton* NextButton; + + wxButton* CancelButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnActivate( wxActivateEvent& event ){ event.Skip(); } + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnMouseMotion( wxMouseEvent& event ){ event.Skip(); } + virtual void OnHelpButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnPreviousButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnNextButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + WizardFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxTAB_TRAVERSAL ); + ~WizardFrameBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class AboutDialogBase + /////////////////////////////////////////////////////////////////////////////// + class AboutDialogBase : public wxDialog + { + private: + + protected: + wxPanel* m_panel14; + + wxStaticBitmap* LogoBitmap; + wxStaticText* VersionStaticText; + + wxStaticText* CopyrightStaticText; + + wxHyperlinkCtrl* WebsiteHyperlink; + wxStaticLine* m_staticline3; + wxTextCtrl* CreditsTextCtrl; + + wxStaticLine* m_staticline4; + wxStaticLine* m_staticline5; + + + + // Virtual event handlers, overide them in your derived class + virtual void OnWebsiteHyperlinkClick( wxHyperlinkEvent& event ){ event.Skip(); } + + + public: + AboutDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~AboutDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class BenchmarkDialogBase + /////////////////////////////////////////////////////////////////////////////// + class BenchmarkDialogBase : public wxDialog + { + private: + + protected: + wxChoice* BufferSizeChoice; + wxListCtrl* BenchmarkListCtrl; + wxBoxSizer* RightSizer; + wxButton* BenchmarkButton; + + wxStaticText* BenchmarkNoteStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnBenchmarkButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + BenchmarkDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("TrueCrypt - Encryption Algorithm Benchmark"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~BenchmarkDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class ChangePasswordDialogBase + /////////////////////////////////////////////////////////////////////////////// + class ChangePasswordDialogBase : public wxDialog + { + private: + + protected: + wxStaticBoxSizer* CurrentSizer; + wxBoxSizer* CurrentPasswordPanelSizer; + wxStaticBoxSizer* NewSizer; + wxBoxSizer* NewPasswordPanelSizer; + wxButton* OKButton; + wxButton* CancelButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + ChangePasswordDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~ChangePasswordDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class DeviceSelectionDialogBase + /////////////////////////////////////////////////////////////////////////////// + class DeviceSelectionDialogBase : public wxDialog + { + private: + + protected: + wxListCtrl* DeviceListCtrl; + wxStdDialogButtonSizer* StdButtons; + wxButton* StdButtonsOK; + wxButton* StdButtonsCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } + + + public: + DeviceSelectionDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select a Partition or Device"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~DeviceSelectionDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class EncryptionTestDialogBase + /////////////////////////////////////////////////////////////////////////////// + class EncryptionTestDialogBase : public wxDialog + { + private: + + protected: + wxChoice* EncryptionAlgorithmChoice; + wxCheckBox* XtsModeCheckBox; + wxTextCtrl* KeyTextCtrl; + wxStaticText* KeySizeStaticText; + wxTextCtrl* SecondaryKeyTextCtrl; + wxTextCtrl* DataUnitNumberTextCtrl; + wxTextCtrl* BlockNumberTextCtrl; + wxTextCtrl* PlainTextTextCtrl; + wxTextCtrl* CipherTextTextCtrl; + wxButton* EncryptButton; + wxButton* DecryptButton; + wxButton* AutoTestAllButton; + wxButton* ResetButton; + wxButton* CloseButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnEncryptionAlgorithmSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnXtsModeCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnEncryptButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDecryptButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAutoTestAllButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnResetButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + EncryptionTestDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("TrueCrypt - Test Vectors"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~EncryptionTestDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class FavoriteVolumesDialogBase + /////////////////////////////////////////////////////////////////////////////// + class FavoriteVolumesDialogBase : public wxDialog + { + private: + + protected: + wxListCtrl* FavoritesListCtrl; + wxButton* MoveUpButton; + wxButton* MoveDownButton; + wxButton* RemoveButton; + wxButton* RemoveAllButton; + + wxButton* OKButton; + wxButton* CancelButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } + virtual void OnMoveUpButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnMoveDownButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRemoveButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRemoveAllButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + FavoriteVolumesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Favorite Volumes"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~FavoriteVolumesDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class KeyfilesDialogBase + /////////////////////////////////////////////////////////////////////////////// + class KeyfilesDialogBase : public wxDialog + { + private: + + protected: + wxBoxSizer* UpperSizer; + wxBoxSizer* PanelSizer; + wxButton* OKButton; + wxButton* CancelButton; + wxStaticText* WarningStaticText; + wxBoxSizer* KeyfilesNoteSizer; + wxStaticText* KeyfilesNoteStaticText; + wxHyperlinkCtrl* KeyfilesHyperlink; + wxButton* CreateKeyfileButtton; + + // Virtual event handlers, overide them in your derived class + virtual void OnKeyfilesHyperlinkClick( wxHyperlinkEvent& event ){ event.Skip(); } + virtual void OnCreateKeyfileButttonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + KeyfilesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Keyfiles"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~KeyfilesDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class KeyfileGeneratorDialogBase + /////////////////////////////////////////////////////////////////////////////// + class KeyfileGeneratorDialogBase : public wxDialog + { + private: + + protected: + wxBoxSizer* MainSizer; + + wxChoice* HashChoice; + + wxStaticText* RandomPoolStaticText; + wxCheckBox* ShowRandomPoolCheckBox; + + wxStaticText* MouseStaticText; + + wxButton* GenerateButton; + + + // Virtual event handlers, overide them in your derived class + virtual void OnMouseMotion( wxMouseEvent& event ){ event.Skip(); } + virtual void OnHashSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnShowRandomPoolCheckBoxClicked( wxCommandEvent& event ){ event.Skip(); } + virtual void OnGenerateButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + KeyfileGeneratorDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~KeyfileGeneratorDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class LegalNoticesDialogBase + /////////////////////////////////////////////////////////////////////////////// + class LegalNoticesDialogBase : public wxDialog + { + private: + + protected: + wxTextCtrl* LegalNoticesTextCtrl; + + public: + LegalNoticesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("TrueCrypt - Legal Notices"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~LegalNoticesDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class MountOptionsDialogBase + /////////////////////////////////////////////////////////////////////////////// + class MountOptionsDialogBase : public wxDialog + { + private: + + protected: + wxBoxSizer* PasswordSizer; + wxButton* OKButton; + wxButton* CancelButton; + + wxButton* OptionsButton; + wxPanel* OptionsPanel; + wxStaticBoxSizer* OptionsSizer; + + wxCheckBox* ReadOnlyCheckBox; + wxCheckBox* RemovableCheckBox; + wxCheckBox* PartitionInSystemEncryptionScopeCheckBox; + wxStaticBoxSizer* ProtectionSizer; + wxCheckBox* ProtectionCheckBox; + wxBoxSizer* ProtectionPasswordSizer; + wxHyperlinkCtrl* ProtectionHyperlinkCtrl; + wxBoxSizer* FilesystemSizer; + wxPanel* m_panel8; + wxCheckBox* NoFilesystemCheckBox; + wxGridBagSizer* FilesystemOptionsSizer; + wxBoxSizer* FilesystemSpacer; + wxStaticText* MountPointTextCtrlStaticText; + wxTextCtrl* MountPointTextCtrl; + wxButton* MountPointButton; + wxStaticText* FilesystemOptionsStaticText; + wxTextCtrl* FilesystemOptionsTextCtrl; + + // Virtual event handlers, overide them in your derived class + virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOptionsButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnReadOnlyCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnProtectionCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnProtectionHyperlinkClick( wxHyperlinkEvent& event ){ event.Skip(); } + virtual void OnNoFilesystemCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnMountPointButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + MountOptionsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Enter TrueCrypt Volume Password"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~MountOptionsDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class NewSecurityTokenKeyfileDialogBase + /////////////////////////////////////////////////////////////////////////////// + class NewSecurityTokenKeyfileDialogBase : public wxDialog + { + private: + + protected: + wxChoice* SecurityTokenChoice; + wxTextCtrl* KeyfileNameTextCtrl; + wxStdDialogButtonSizer* StdButtons; + wxButton* StdButtonsOK; + wxButton* StdButtonsCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnKeyfileNameChanged( wxCommandEvent& event ){ event.Skip(); } + + + public: + NewSecurityTokenKeyfileDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("New Security Token Keyfile Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~NewSecurityTokenKeyfileDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class PreferencesDialogBase + /////////////////////////////////////////////////////////////////////////////// + class PreferencesDialogBase : public wxDialog + { + private: + + protected: + wxNotebook* PreferencesNotebook; + wxPanel* SecurityPage; + wxStaticBoxSizer* AutoDismountSizer; + wxCheckBox* DismountOnLogOffCheckBox; + wxCheckBox* DismountOnScreenSaverCheckBox; + wxCheckBox* DismountOnPowerSavingCheckBox; + wxCheckBox* DismountOnInactivityCheckBox; + wxSpinCtrl* DismountOnInactivitySpinCtrl; + wxCheckBox* ForceAutoDismountCheckBox; + wxStaticBoxSizer* FilesystemSecuritySizer; + wxCheckBox* PreserveTimestampsCheckBox; + wxCheckBox* WipeCacheOnCloseCheckBox; + wxCheckBox* WipeCacheOnAutoDismountCheckBox; + wxPanel* DefaultMountOptionsPage; + wxCheckBox* MountReadOnlyCheckBox; + wxCheckBox* MountRemovableCheckBox; + wxCheckBox* CachePasswordsCheckBox; + wxStaticBoxSizer* FilesystemSizer; + wxTextCtrl* FilesystemOptionsTextCtrl; + wxPanel* BackgroundTaskPanel; + wxCheckBox* BackgroundTaskEnabledCheckBox; + wxCheckBox* CloseBackgroundTaskOnNoVolumesCheckBox; + wxCheckBox* BackgroundTaskMenuMountItemsEnabledCheckBox; + wxCheckBox* BackgroundTaskMenuOpenItemsEnabledCheckBox; + wxCheckBox* BackgroundTaskMenuDismountItemsEnabledCheckBox; + wxPanel* SystemIntegrationPage; + wxStaticBoxSizer* LogOnSizer; + wxCheckBox* StartOnLogonCheckBox; + wxCheckBox* MountFavoritesOnLogonCheckBox; + wxCheckBox* MountDevicesOnLogonCheckBox; + wxStaticBoxSizer* ExplorerSizer; + wxCheckBox* OpenExplorerWindowAfterMountCheckBox; + wxCheckBox* CloseExplorerWindowsOnDismountCheckBox; + wxStaticBoxSizer* KernelServicesSizer; + wxCheckBox* NoKernelCryptoCheckBox; + wxPanel* PerformanceOptionsPage; + wxStaticText* AesHwCpuSupportedStaticText; + + wxCheckBox* NoHardwareCryptoCheckBox; + wxBoxSizer* DefaultKeyfilesSizer; + wxCheckBox* UseKeyfilesCheckBox; + wxTextCtrl* Pkcs11ModulePathTextCtrl; + wxButton* SelectPkcs11ModuleButton; + wxCheckBox* CloseSecurityTokenSessionsAfterMountCheckBox; + wxListCtrl* HotkeyListCtrl; + wxTextCtrl* HotkeyTextCtrl; + wxButton* AssignHotkeyButton; + + wxCheckBox* HotkeyControlCheckBox; + wxCheckBox* HotkeyShiftCheckBox; + wxCheckBox* HotkeyAltCheckBox; + wxCheckBox* HotkeyWinCheckBox; + wxButton* RemoveHotkeyButton; + wxCheckBox* BeepAfterHotkeyMountDismountCheckBox; + wxCheckBox* DisplayMessageAfterHotkeyDismountCheckBox; + wxStdDialogButtonSizer* StdButtons; + wxButton* StdButtonsOK; + wxButton* StdButtonsCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } + virtual void OnDismountOnScreenSaverCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDismountOnPowerSavingCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnForceAutoDismountCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnPreserveTimestampsCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnBackgroundTaskEnabledCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnNoKernelCryptoCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnNoHardwareCryptoCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSelectPkcs11ModuleButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnHotkeyListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnHotkeyListItemSelected( wxListEvent& event ){ event.Skip(); } + virtual void OnAssignHotkeyButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRemoveHotkeyButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + wxPanel* DefaultKeyfilesPage; + wxPanel* SecurityTokensPage; + wxPanel* HotkeysPage; + PreferencesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Preferences"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~PreferencesDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class RandomPoolEnrichmentDialogBase + /////////////////////////////////////////////////////////////////////////////// + class RandomPoolEnrichmentDialogBase : public wxDialog + { + private: + + protected: + wxBoxSizer* MainSizer; + + wxChoice* HashChoice; + + wxStaticText* RandomPoolStaticText; + wxCheckBox* ShowRandomPoolCheckBox; + + wxStaticText* MouseStaticText; + + + wxButton* ContinueButton; + + + // Virtual event handlers, overide them in your derived class + virtual void OnMouseMotion( wxMouseEvent& event ){ event.Skip(); } + virtual void OnHashSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnShowRandomPoolCheckBoxClicked( wxCommandEvent& event ){ event.Skip(); } + + + public: + RandomPoolEnrichmentDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("TrueCrypt - Random Pool Enrichment"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~RandomPoolEnrichmentDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class SecurityTokenKeyfilesDialogBase + /////////////////////////////////////////////////////////////////////////////// + class SecurityTokenKeyfilesDialogBase : public wxDialog + { + private: + + protected: + wxListCtrl* SecurityTokenKeyfileListCtrl; + wxButton* ExportButton; + wxButton* DeleteButton; + + wxButton* ImportButton; + wxButton* OKButton; + wxButton* CancelButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnListItemActivated( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } + virtual void OnExportButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDeleteButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnImportButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + SecurityTokenKeyfilesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Security Token Keyfiles"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE ); + ~SecurityTokenKeyfilesDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumePropertiesDialogBase + /////////////////////////////////////////////////////////////////////////////// + class VolumePropertiesDialogBase : public wxDialog + { + private: + + protected: + wxListCtrl* PropertiesListCtrl; + wxStdDialogButtonSizer* StdButtons; + wxButton* StdButtonsOK; + + public: + VolumePropertiesDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Volume Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + ~VolumePropertiesDialogBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class EncryptionOptionsWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class EncryptionOptionsWizardPageBase : public WizardPage + { + private: + + protected: + wxChoice* EncryptionAlgorithmChoice; + wxButton* TestButton; + wxStaticText* EncryptionAlgorithmStaticText; + wxHyperlinkCtrl* EncryptionAlgorithmHyperlink; + + wxButton* BenchmarkButton; + wxChoice* HashChoice; + wxHyperlinkCtrl* HashHyperlink; + + // Virtual event handlers, overide them in your derived class + virtual void OnEncryptionAlgorithmSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnTestButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnEncryptionAlgorithmHyperlinkClick( wxHyperlinkEvent& event ){ event.Skip(); } + virtual void OnBenchmarkButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnHashHyperlinkClick( wxHyperlinkEvent& event ){ event.Skip(); } + + + public: + EncryptionOptionsWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~EncryptionOptionsWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class InfoWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class InfoWizardPageBase : public WizardPage + { + private: + + protected: + wxBoxSizer* InfoPageSizer; + wxStaticText* InfoStaticText; + + public: + InfoWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~InfoWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class KeyfilesPanelBase + /////////////////////////////////////////////////////////////////////////////// + class KeyfilesPanelBase : public wxPanel + { + private: + + protected: + wxListCtrl* KeyfilesListCtrl; + wxButton* AddFilesButton; + wxButton* AddDirectoryButton; + wxButton* AddSecurityTokenSignatureButton; + wxButton* RemoveButton; + wxButton* RemoveAllButton; + + // Virtual event handlers, overide them in your derived class + virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } + virtual void OnListSizeChanged( wxSizeEvent& event ){ event.Skip(); } + virtual void OnAddFilesButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAddDirectoryButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAddSecurityTokenSignatureButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRemoveButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnRemoveAllButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + KeyfilesPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL ); + ~KeyfilesPanelBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class ProgressWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class ProgressWizardPageBase : public WizardPage + { + private: + + protected: + wxBoxSizer* ProgressSizer; + wxGauge* ProgressGauge; + wxButton* AbortButton; + wxStaticText* InfoStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnAbortButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + ProgressWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~ProgressWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class SelectDirectoryWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class SelectDirectoryWizardPageBase : public WizardPage + { + private: + + protected: + wxTextCtrl* DirectoryTextCtrl; + wxButton* BrowseButton; + wxStaticText* InfoStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnDirectoryTextChanged( wxCommandEvent& event ){ event.Skip(); } + virtual void OnBrowseButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + SelectDirectoryWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 200,65 ), long style = wxTAB_TRAVERSAL ); + ~SelectDirectoryWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class SingleChoiceWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class SingleChoiceWizardPageBase : public WizardPage + { + private: + + protected: + + wxBoxSizer* OuterChoicesSizer; + wxBoxSizer* ChoicesSizer; + wxStaticText* InfoStaticText; + + public: + SingleChoiceWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~SingleChoiceWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumeCreationProgressWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class VolumeCreationProgressWizardPageBase : public WizardPage + { + private: + + protected: + wxBoxSizer* KeySamplesUpperSizer; + wxBoxSizer* KeySamplesUpperInnerSizer; + wxStaticText* RandomPoolSampleStaticText; + wxCheckBox* DisplayKeysCheckBox; + wxStaticText* HeaderKeySampleStaticText; + wxStaticText* MasterKeySampleStaticText; + wxGauge* ProgressGauge; + wxButton* AbortButton; + wxStaticText* m_staticText31; + wxPanel* m_panel12; + wxStaticText* SizeDoneStaticText; + wxStaticText* m_staticText311; + wxPanel* m_panel121; + wxStaticText* SpeedStaticText; + wxStaticText* m_staticText312; + wxPanel* m_panel122; + wxStaticText* TimeLeftStaticText; + + wxStaticText* InfoStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnDisplayKeysCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnAbortButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + VolumeCreationProgressWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~VolumeCreationProgressWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumeLocationWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class VolumeLocationWizardPageBase : public WizardPage + { + private: + + protected: + + wxComboBox* VolumePathComboBox; + wxButton* SelectFileButton; + wxButton* SelectDeviceButton; + + wxCheckBox* NoHistoryCheckBox; + + wxStaticText* InfoStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnVolumePathTextChanged( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSelectFileButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnSelectDeviceButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnNoHistoryCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + VolumeLocationWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~VolumeLocationWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumeFormatOptionsWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class VolumeFormatOptionsWizardPageBase : public WizardPage + { + private: + + protected: + wxStaticText* m_staticText43; + wxChoice* FilesystemTypeChoice; + wxCheckBox* QuickFormatCheckBox; + + wxStaticText* InfoStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnFilesystemTypeSelected( wxCommandEvent& event ){ event.Skip(); } + virtual void OnQuickFormatCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + VolumeFormatOptionsWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~VolumeFormatOptionsWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumePasswordPanelBase + /////////////////////////////////////////////////////////////////////////////// + class VolumePasswordPanelBase : public wxPanel + { + private: + + protected: + wxGridBagSizer* GridBagSizer; + wxStaticText* PasswordStaticText; + wxTextCtrl* PasswordTextCtrl; + wxStaticText* ConfirmPasswordStaticText; + wxTextCtrl* ConfirmPasswordTextCtrl; + wxCheckBox* CacheCheckBox; + wxCheckBox* DisplayPasswordCheckBox; + wxCheckBox* UseKeyfilesCheckBox; + wxButton* KeyfilesButton; + wxBoxSizer* Pkcs5PrfSizer; + wxStaticText* Pkcs5PrfStaticText; + wxChoice* Pkcs5PrfChoice; + wxBoxSizer* PasswordPlaceholderSizer; + + // Virtual event handlers, overide them in your derived class + virtual void OnTextChanged( wxCommandEvent& event ){ event.Skip(); } + virtual void OnDisplayPasswordCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnUseKeyfilesCheckBoxClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnKeyfilesButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnKeyfilesButtonRightDown( wxMouseEvent& event ){ event.Skip(); } + virtual void OnKeyfilesButtonRightClick( wxMouseEvent& event ){ event.Skip(); } + + + public: + VolumePasswordPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~VolumePasswordPanelBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumePasswordWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class VolumePasswordWizardPageBase : public WizardPage + { + private: + + protected: + wxBoxSizer* PasswordPanelSizer; + wxStaticText* InfoStaticText; + + public: + VolumePasswordWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~VolumePasswordWizardPageBase(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class VolumeSizeWizardPageBase + /////////////////////////////////////////////////////////////////////////////// + class VolumeSizeWizardPageBase : public WizardPage + { + private: + + protected: + + wxTextCtrl* VolumeSizeTextCtrl; + wxChoice* VolumeSizePrefixChoice; + + wxStaticText* FreeSpaceStaticText; + + wxStaticText* InfoStaticText; + + // Virtual event handlers, overide them in your derived class + virtual void OnVolumeSizeTextChanged( wxCommandEvent& event ){ event.Skip(); } + virtual void OnVolumeSizePrefixSelected( wxCommandEvent& event ){ event.Skip(); } + + + public: + VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + ~VolumeSizeWizardPageBase(); + + }; + +} // namespace TrueCrypt + +#endif //__Forms__ diff --git a/src/Main/Forms/InfoWizardPage.cpp b/src/Main/Forms/InfoWizardPage.cpp new file mode 100644 index 00000000..286ba476 --- /dev/null +++ b/src/Main/Forms/InfoWizardPage.cpp @@ -0,0 +1,33 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "InfoWizardPage.h" + +namespace TrueCrypt +{ + InfoWizardPage::InfoWizardPage (wxPanel *parent, const wxString &actionButtonText, shared_ptr actionFunctor) + : InfoWizardPageBase (parent) + { + if (!actionButtonText.empty()) + { + wxButton *actionButton = new wxButton (this, wxID_ANY, actionButtonText); + ActionFunctor = actionFunctor; + actionButton->Connect (wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (InfoWizardPage::OnActionButtonClick), nullptr, this); + + InfoPageSizer->Add (actionButton, 0, wxALL, 5); + } + + InfoStaticText->SetFocus(); + } + + void InfoWizardPage::SetMaxStaticTextWidth (int width) + { + InfoStaticText->Wrap (width); + } +} diff --git a/src/Main/Forms/InfoWizardPage.h b/src/Main/Forms/InfoWizardPage.h new file mode 100644 index 00000000..a3938b03 --- /dev/null +++ b/src/Main/Forms/InfoWizardPage.h @@ -0,0 +1,32 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_InfoWizardPage +#define TC_HEADER_Main_Forms_InfoWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + class InfoWizardPage : public InfoWizardPageBase + { + public: + InfoWizardPage (wxPanel *parent, const wxString &actionButtonText = wxEmptyString, shared_ptr actionFunctor = shared_ptr ()); + + bool IsValid () { return true; } + void SetMaxStaticTextWidth (int width); + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + + protected: + virtual void OnActionButtonClick (wxCommandEvent& event) { (*ActionFunctor)(); } + + shared_ptr ActionFunctor; + }; +} + +#endif // TC_HEADER_Main_Forms_InfoWizardPage diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp new file mode 100644 index 00000000..c217d40a --- /dev/null +++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp @@ -0,0 +1,118 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "Volume/Hash.h" +#include "KeyfileGeneratorDialog.h" + +namespace TrueCrypt +{ + KeyfileGeneratorDialog::KeyfileGeneratorDialog (wxWindow* parent) : KeyfileGeneratorDialogBase (parent) + { + RandomNumberGenerator::Start(); + + Hashes = Hash::GetAvailableAlgorithms(); + foreach (shared_ptr hash, Hashes) + { + if (!hash->IsDeprecated()) + HashChoice->Append (hash->GetName(), hash.get()); + } + + HashChoice->Select (0); + RandomNumberGenerator::SetHash (Gui->GetSelectedData (HashChoice)->GetNew()); + + ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24)); + MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70); + + MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24)); + + Layout(); + Fit(); + Center(); + + foreach (wxWindow *c, this->GetChildren()) + c->Connect (wxEVT_MOTION, wxMouseEventHandler (KeyfileGeneratorDialog::OnMouseMotion), nullptr, this); + } + + KeyfileGeneratorDialog::~KeyfileGeneratorDialog () + { + } + + void KeyfileGeneratorDialog::OnGenerateButtonClick (wxCommandEvent& event) + { + try + { + FilePathList files = Gui->SelectFiles (Gui->GetActiveWindow(), wxEmptyString, true); + + if (files.empty()) + return; + + SecureBuffer keyfileBuffer (VolumePassword::MaxSize); + RandomNumberGenerator::GetData (keyfileBuffer); + + { + File keyfile; + keyfile.Open (*files.front(), File::CreateWrite); + keyfile.Write (keyfileBuffer); + } + + Gui->ShowInfo ("KEYFILE_CREATED"); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void KeyfileGeneratorDialog::OnHashSelected (wxCommandEvent& event) + { + RandomNumberGenerator::SetHash (Gui->GetSelectedData (HashChoice)->GetNew()); + } + + void KeyfileGeneratorDialog::OnMouseMotion (wxMouseEvent& event) + { + event.Skip(); + + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&event), sizeof (event))); + + long coord = event.GetX(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&coord), sizeof (coord))); + coord = event.GetY(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&coord), sizeof (coord))); + + if (ShowRandomPoolCheckBox->IsChecked()) + ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24)); + } + + void KeyfileGeneratorDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event) + { + if (!event.IsChecked()) + RandomPoolStaticText->SetLabel (L""); + } + + void KeyfileGeneratorDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots) + { + wxString str; + + for (size_t i = 0; i < buffer.Size(); ++i) + { + str += wxString::Format (L"%02X", buffer[i]); + } + + if (appendDots) + str += L".."; + + textCtrl->SetLabel (str.c_str()); + + for (size_t i = 0; i < str.size(); ++i) + { + str[i] = L'X'; + } + } +} diff --git a/src/Main/Forms/KeyfileGeneratorDialog.h b/src/Main/Forms/KeyfileGeneratorDialog.h new file mode 100644 index 00000000..bc4748f2 --- /dev/null +++ b/src/Main/Forms/KeyfileGeneratorDialog.h @@ -0,0 +1,34 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_KeyfileGeneratorDialog +#define TC_HEADER_Main_Forms_KeyfileGeneratorDialog + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class KeyfileGeneratorDialog : public KeyfileGeneratorDialogBase + { + public: + KeyfileGeneratorDialog (wxWindow* parent); + ~KeyfileGeneratorDialog (); + + protected: + void OnGenerateButtonClick (wxCommandEvent& event); + void OnHashSelected (wxCommandEvent& event); + void OnMouseMotion (wxMouseEvent& event); + void OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event); + void ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots = true); + + HashList Hashes; + }; +} + +#endif // TC_HEADER_Main_Forms_KeyfileGeneratorDialog diff --git a/src/Main/Forms/KeyfilesDialog.cpp b/src/Main/Forms/KeyfilesDialog.cpp new file mode 100644 index 00000000..267f8554 --- /dev/null +++ b/src/Main/Forms/KeyfilesDialog.cpp @@ -0,0 +1,44 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "KeyfilesDialog.h" + +namespace TrueCrypt +{ + KeyfilesDialog::KeyfilesDialog (wxWindow* parent, shared_ptr keyfiles) + : KeyfilesDialogBase (parent), Keyfiles (keyfiles) + { + mKeyfilesPanel = new KeyfilesPanel (this, keyfiles); + PanelSizer->Add (mKeyfilesPanel, 1, wxALL | wxEXPAND); + + WarningStaticText->SetLabel (LangString["IDT_KEYFILE_WARNING"]); + WarningStaticText->Wrap (Gui->GetCharWidth (this) * 15); + + Layout(); + Fit(); + + KeyfilesNoteStaticText->SetLabel (LangString["KEYFILES_NOTE"]); + KeyfilesNoteStaticText->Wrap (UpperSizer->GetSize().GetWidth() - Gui->GetCharWidth (this) * 2); + + Layout(); + Fit(); + Center(); + } + + void KeyfilesDialog::OnCreateKeyfileButttonClick (wxCommandEvent& event) + { + Gui->CreateKeyfile(); + } + + void KeyfilesDialog::OnKeyfilesHyperlinkClick (wxHyperlinkEvent& event) + { + Gui->OpenHomepageLink (this, L"keyfiles"); + } +} diff --git a/src/Main/Forms/KeyfilesDialog.h b/src/Main/Forms/KeyfilesDialog.h new file mode 100644 index 00000000..722cc8ba --- /dev/null +++ b/src/Main/Forms/KeyfilesDialog.h @@ -0,0 +1,33 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_KeyfilesDialog +#define TC_HEADER_Main_Forms_KeyfilesDialog + +#include "Forms.h" +#include "Main/Main.h" +#include "KeyfilesPanel.h" + +namespace TrueCrypt +{ + class KeyfilesDialog : public KeyfilesDialogBase + { + public: + KeyfilesDialog (wxWindow* parent, shared_ptr keyfiles); + shared_ptr GetKeyfiles () const { return mKeyfilesPanel->GetKeyfiles(); } + + protected: + void OnCreateKeyfileButttonClick (wxCommandEvent& event); + void OnKeyfilesHyperlinkClick (wxHyperlinkEvent& event); + + shared_ptr Keyfiles; + KeyfilesPanel *mKeyfilesPanel; + }; +} + +#endif // TC_HEADER_Main_Forms_KeyfilesDialog diff --git a/src/Main/Forms/KeyfilesPanel.cpp b/src/Main/Forms/KeyfilesPanel.cpp new file mode 100644 index 00000000..506e008a --- /dev/null +++ b/src/Main/Forms/KeyfilesPanel.cpp @@ -0,0 +1,160 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "KeyfilesPanel.h" +#include "SecurityTokenKeyfilesDialog.h" + +namespace TrueCrypt +{ + KeyfilesPanel::KeyfilesPanel (wxWindow* parent, shared_ptr keyfiles) + : KeyfilesPanelBase (parent) + { + KeyfilesListCtrl->InsertColumn (0, LangString["KEYFILE"], wxLIST_FORMAT_LEFT, 1); + Gui->SetListCtrlHeight (KeyfilesListCtrl, 10); + + Layout(); + Fit(); + + if (keyfiles) + { + foreach_ref (const Keyfile &k, *keyfiles) + { + vector fields; + fields.push_back (FilesystemPath (k)); + Gui->AppendToListCtrl (KeyfilesListCtrl, fields); + } + } + + class FileDropTarget : public wxFileDropTarget + { + public: + FileDropTarget (KeyfilesPanel *panel) : Panel (panel) { } + + wxDragResult OnDragOver (wxCoord x, wxCoord y, wxDragResult def) + { + return wxDragLink; + } + + bool OnDropFiles (wxCoord x, wxCoord y, const wxArrayString &filenames) + { + foreach (const wxString &f, filenames) + Panel->AddKeyfile (make_shared (wstring (f))); + return true; + } + + protected: + KeyfilesPanel *Panel; + }; + + SetDropTarget (new FileDropTarget (this)); + KeyfilesListCtrl->SetDropTarget (new FileDropTarget (this)); +#ifdef TC_MACOSX + foreach (wxWindow *c, GetChildren()) + c->SetDropTarget (new FileDropTarget (this)); +#endif + + UpdateButtons(); + } + + void KeyfilesPanel::AddKeyfile (shared_ptr keyfile) + { + vector fields; + fields.push_back (FilesystemPath (*keyfile)); + Gui->AppendToListCtrl (KeyfilesListCtrl, fields); + UpdateButtons(); + } + + shared_ptr KeyfilesPanel::GetKeyfiles () const + { + make_shared_auto (KeyfileList, keyfiles); + + for (long i = 0; i < KeyfilesListCtrl->GetItemCount(); i++) + keyfiles->push_back (make_shared (wstring (KeyfilesListCtrl->GetItemText (i)))); + + return keyfiles; + } + + void KeyfilesPanel::OnAddDirectoryButtonClick (wxCommandEvent& event) + { + DirectoryPath dir = Gui->SelectDirectory (this, LangString["SELECT_KEYFILE_PATH"]); + if (!dir.IsEmpty()) + { + vector fields; + fields.push_back (dir); + Gui->AppendToListCtrl (KeyfilesListCtrl, fields); + UpdateButtons(); + } + } + + void KeyfilesPanel::OnAddFilesButtonClick (wxCommandEvent& event) + { + FilePathList files = Gui->SelectFiles (this, LangString["SELECT_KEYFILES"], false, true); + + foreach_ref (const FilePath &f, files) + { + vector fields; + fields.push_back (f); + Gui->AppendToListCtrl (KeyfilesListCtrl, fields); + } + UpdateButtons(); + } + + void KeyfilesPanel::OnAddSecurityTokenSignatureButtonClick (wxCommandEvent& event) + { + try + { + SecurityTokenKeyfilesDialog dialog (this); + if (dialog.ShowModal() == wxID_OK) + { + foreach (const SecurityTokenKeyfilePath &path, dialog.GetSelectedSecurityTokenKeyfilePaths()) + { + vector fields; + fields.push_back (path); + Gui->AppendToListCtrl (KeyfilesListCtrl, fields); + } + + UpdateButtons(); + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void KeyfilesPanel::OnListSizeChanged (wxSizeEvent& event) + { + list colPermilles; + colPermilles.push_back (1000); + Gui->SetListCtrlColumnWidths (KeyfilesListCtrl, colPermilles); + event.Skip(); + } + + void KeyfilesPanel::OnRemoveAllButtonClick (wxCommandEvent& event) + { + KeyfilesListCtrl->DeleteAllItems(); + UpdateButtons(); + } + + void KeyfilesPanel::OnRemoveButtonClick (wxCommandEvent& event) + { + long offset = 0; + foreach (long item, Gui->GetListCtrlSelectedItems (KeyfilesListCtrl)) + KeyfilesListCtrl->DeleteItem (item - offset++); + + UpdateButtons(); + } + + void KeyfilesPanel::UpdateButtons () + { + RemoveAllButton->Enable (KeyfilesListCtrl->GetItemCount() > 0); + RemoveButton->Enable (KeyfilesListCtrl->GetSelectedItemCount() > 0); + } +} diff --git a/src/Main/Forms/KeyfilesPanel.h b/src/Main/Forms/KeyfilesPanel.h new file mode 100644 index 00000000..c7617453 --- /dev/null +++ b/src/Main/Forms/KeyfilesPanel.h @@ -0,0 +1,37 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_KeyfilesPanel +#define TC_HEADER_Main_Forms_KeyfilesPanel + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class KeyfilesPanel : public KeyfilesPanelBase + { + public: + KeyfilesPanel (wxWindow* parent, shared_ptr keyfiles); + void AddKeyfile (shared_ptr keyfile); + shared_ptr GetKeyfiles () const; + + protected: + void OnAddFilesButtonClick (wxCommandEvent& event); + void OnAddDirectoryButtonClick (wxCommandEvent& event); + void OnAddSecurityTokenSignatureButtonClick (wxCommandEvent& event); + void OnListItemDeselected (wxListEvent& event) { UpdateButtons(); } + void OnListItemSelected (wxListEvent& event) { UpdateButtons(); } + void OnListSizeChanged (wxSizeEvent& event); + void OnRemoveButtonClick (wxCommandEvent& event); + void OnRemoveAllButtonClick (wxCommandEvent& event); + void UpdateButtons (); + }; +} + +#endif // TC_HEADER_Main_Forms_KeyfilesPanel diff --git a/src/Main/Forms/LegalNoticesDialog.cpp b/src/Main/Forms/LegalNoticesDialog.cpp new file mode 100644 index 00000000..8029965d --- /dev/null +++ b/src/Main/Forms/LegalNoticesDialog.cpp @@ -0,0 +1,28 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "LegalNoticesDialog.h" +#include "Main/GraphicUserInterface.h" +#include "Main/Resources.h" + +namespace TrueCrypt +{ + LegalNoticesDialog::LegalNoticesDialog (wxWindow* parent) : LegalNoticesDialogBase (parent) + { + LegalNoticesTextCtrl->SetMinSize (wxSize ( + Gui->GetCharWidth (LegalNoticesTextCtrl) * 88, + Gui->GetCharHeight (LegalNoticesTextCtrl) * 28)); + + Layout(); + Fit(); + Center(); + + LegalNoticesTextCtrl->ChangeValue (StringConverter::ToWide (Resources::GetLegalNotices())); + } +} diff --git a/src/Main/Forms/LegalNoticesDialog.h b/src/Main/Forms/LegalNoticesDialog.h new file mode 100644 index 00000000..609ed83a --- /dev/null +++ b/src/Main/Forms/LegalNoticesDialog.h @@ -0,0 +1,23 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_LegalNoticesDialog +#define TC_HEADER_Main_Forms_LegalNoticesDialog + +#include "Forms.h" + +namespace TrueCrypt +{ + class LegalNoticesDialog : public LegalNoticesDialogBase + { + public: + LegalNoticesDialog (wxWindow* parent); + }; +} + +#endif // TC_HEADER_Main_Forms_LegalNoticesDialog diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp new file mode 100644 index 00000000..cf313a8e --- /dev/null +++ b/src/Main/Forms/MainFrame.cpp @@ -0,0 +1,1585 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" + +#ifdef TC_UNIX +#include +#include +#include +#include +#endif + +#include "Common/SecurityToken.h" +#include "Main/Main.h" +#include "Main/Resources.h" +#include "Main/Application.h" +#include "Main/GraphicUserInterface.h" +#include "Main/VolumeHistory.h" +#include "Main/Xml.h" +#include "MainFrame.h" +#include "AboutDialog.h" +#include "BenchmarkDialog.h" +#include "ChangePasswordDialog.h" +#include "EncryptionTestDialog.h" +#include "FavoriteVolumesDialog.h" +#include "LegalNoticesDialog.h" +#include "PreferencesDialog.h" +#include "SecurityTokenKeyfilesDialog.h" +#include "VolumeCreationWizard.h" +#include "VolumePropertiesDialog.h" + +namespace TrueCrypt +{ + MainFrame::MainFrame (wxWindow* parent) : MainFrameBase (parent), + ListItemRightClickEventPending (false), + SelectedItemIndex (-1), + SelectedSlotNumber (0), + ShowRequestFifo (-1) + { + wxBusyCursor busy; + + SetName (Application::GetName()); + SetTitle (Application::GetName()); + SetIcon (Resources::GetTrueCryptIcon()); + +#if defined(TC_UNIX) && !defined(TC_MACOSX) + try + { + string fifoPath = GetShowRequestFifoPath(); + + remove (fifoPath.c_str()); + throw_sys_if (mkfifo (fifoPath.c_str(), S_IRUSR | S_IWUSR) == -1); + + ShowRequestFifo = open (fifoPath.c_str(), O_RDONLY | O_NONBLOCK); + throw_sys_if (ShowRequestFifo == -1); + } + catch (...) + { +#ifdef DEBUG + throw; +#endif + } +#endif + + InitControls(); + InitPreferences(); + InitTaskBarIcon(); + InitEvents(); + InitMessageFilter(); + + if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized()) + { + try + { + Gui->InitSecurityTokenLibrary(); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + } + + MainFrame::~MainFrame () + { +#if defined(TC_UNIX) && !defined(TC_MACOSX) + if (ShowRequestFifo != -1) + { + try + { + close (ShowRequestFifo); + remove (string (GetShowRequestFifoPath()).c_str()); + } + catch (...) { } + } +#endif + + Core->VolumeMountedEvent.Disconnect (this); + Core->VolumeDismountedEvent.Disconnect (this); + Gui->OpenVolumeSystemRequestEvent.Disconnect (this); + Gui->PreferencesUpdatedEvent.Disconnect (this); + + VolumeHistory::DisconnectComboBox (VolumePathComboBox); + +#ifdef TC_WINDOWS + Hotkey::UnregisterList (this, GetPreferences().Hotkeys); +#endif + } + + void MainFrame::AddToFavorites (const VolumeInfoList &volumes) + { + try + { + FavoriteVolumeList newFavorites; + + // Delete duplicates + foreach (shared_ptr favorite, FavoriteVolume::LoadList()) + { + bool mounted = false; + foreach_ref (const VolumeInfo &volume, volumes) + { + if (volume.Path == favorite->Path) + { + mounted = true; + break; + } + } + if (!mounted) + newFavorites.push_back (favorite); + } + + size_t newItemCount = 0; + foreach_ref (const VolumeInfo &volume, volumes) + { + newFavorites.push_back (shared_ptr (new FavoriteVolume (volume.Path, volume.MountPoint, volume.SlotNumber, volume.Protection == VolumeProtection::ReadOnly, volume.SystemEncryption))); + ++newItemCount; + } + + OrganizeFavorites (newFavorites, newItemCount); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + bool MainFrame::CanExit () const + { + return Gui->IsTheOnlyTopLevelWindow (this); + } + + void MainFrame::ChangePassword (ChangePasswordDialog::Mode::Enum mode) + { + if (!CheckVolumePathNotEmpty ()) + return; + + shared_ptr volumePath = GetSelectedVolumePath(); + +#ifdef TC_WINDOWS + if (Core->IsVolumeMounted (*volumePath)) + { + Gui->ShowInfo (LangString [mode == ChangePasswordDialog::Mode::ChangePkcs5Prf ? "MOUNTED_NO_PKCS5_PRF_CHANGE" : "MOUNTED_NOPWCHANGE"]); + return; + } +#endif + + ChangePasswordDialog dialog (this, volumePath, mode); + dialog.ShowModal(); + } + + void MainFrame::CheckFilesystem (bool repair) + { + shared_ptr selectedVolume = GetSelectedVolume(); + if (selectedVolume) + { + try + { +#ifdef TC_WINDOWS + string mountPoint = selectedVolume->MountPoint; + + wstring args = StringFormatter (repair ? L"/C echo {0} & chkdsk {1} /F /X & pause" : L"/C echo {0} & chkdsk {1} & pause", + StringFormatter (LangString[repair ? "REPAIRING_FS" : "CHECKING_FS"], mountPoint), mountPoint); + + ShellExecute (static_cast (GetHandle()), + L"runas", + L"cmd.exe", args.c_str(), nullptr, SW_SHOW); +#else +# ifdef TC_MACOSX + Gui->ShowInfo (_("Disk Utility will be launched after you press 'OK'.\n\nPlease select your volume in the Disk Utility window and press 'Verify Disk' or 'Repair Disk' button on the 'First Aid' page.")); +# endif + Core->CheckFilesystem (selectedVolume, repair); + UpdateVolumeList(); +#endif + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + } + + bool MainFrame::CheckVolumePathNotEmpty () const + { + if (VolumePathComboBox->GetValue().empty()) + { + Gui->ShowInfo ("NO_VOLUME_SELECTED"); + return false; + } + return true; + } + + void MainFrame::DismountVolume (shared_ptr volume) + { + try + { + if (!volume) + volume = GetSelectedVolume(); + + if (volume) + Gui->DismountVolume (volume); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + shared_ptr MainFrame::GetSelectedVolume () const + { + return Core->GetMountedVolume (SelectedSlotNumber); + } + + void MainFrame::InitControls () + { + LogoBitmap->SetBitmap (Resources::GetLogoBitmap()); + + list colPermilles; + +#ifndef TC_WINDOWS + SettingsMenu->Remove (HotkeysMenuItem); +#endif + +#ifdef TC_MACOSX + SettingsMenu->Remove (PreferencesMenuItem); + SettingsMenu->AppendSeparator(); + SettingsMenu->Append (PreferencesMenuItem); + + LowStaticBoxSizer->Detach (HigherButtonSizer); + VolumeStaticBoxSizer->Detach (VolumeGridBagSizer); + VolumeStaticBoxSizer->Add (VolumeGridBagSizer, 1, wxEXPAND, 0); + + ExitButton->SetLabel (_("Close")); + MountAllDevicesButton->SetLabel (_("Mount All Devices")); +#endif + +#ifdef TC_WINDOWS + SlotListCtrl->InsertColumn (ColumnSlot, LangString["DRIVE"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (75); +#else + SlotListCtrl->InsertColumn (ColumnSlot, _("Slot"), wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (82); +#endif + + SlotListCtrl->InsertColumn (ColumnPath, LangString["VOLUME"], wxLIST_FORMAT_LEFT, 1); +#ifdef TC_WINDOWS + colPermilles.push_back (487); +#else + colPermilles.push_back (429); +#endif + + SlotListCtrl->InsertColumn (ColumnSize, LangString["SIZE"], wxLIST_FORMAT_RIGHT, 1); +#ifdef TC_WINDOWS + colPermilles.push_back (126); +#else + colPermilles.push_back (130); +#endif + +#ifdef TC_WINDOWS + SlotListCtrl->InsertColumn (ColumnEA, LangString["ENCRYPTION_ALGORITHM_LV"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (233); +#else + SlotListCtrl->InsertColumn (ColumnMountPoint, LangString["MOUNT_POINT"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (259); +#endif + + SlotListCtrl->InsertColumn (ColumnType, LangString["TYPE"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (100); + + wxImageList *imageList = new wxImageList (16, 12, true); + imageList->Add (Resources::GetDriveIconBitmap(), Resources::GetDriveIconMaskBitmap()); + SlotListCtrl->AssignImageList (imageList, wxIMAGE_LIST_SMALL); + + SetMinSize (wxSize (-1, -1)); + + size_t slotListRowCount = 12; + +#ifndef TC_WINDOWS + int screenHeight = wxSystemSettings::GetMetric (wxSYS_SCREEN_Y); + + if (screenHeight < 480) + slotListRowCount = 1; + else if (screenHeight <= 600) + slotListRowCount = slotListRowCount * screenHeight / 1000; +#endif + + Gui->SetListCtrlHeight (SlotListCtrl, slotListRowCount); + +#ifdef __WXGTK__ + wxSize size (-1, (int) ((double) Gui->GetCharHeight (this) * 1.53)); + CreateVolumeButton->SetMinSize (size); + VolumePropertiesButton->SetMinSize (size); + WipeCacheButton->SetMinSize (size); + VolumePathComboBox->SetMinSize (size); + SelectFileButton->SetMinSize (size); + SelectDeviceButton->SetMinSize (size); + VolumeToolsButton->SetMinSize (size); + size = wxSize (-1, 38); + VolumeButton->SetMinSize (size); +#endif + Fit(); + Layout(); + Center(); + + VolumePathComboBox->SetMinSize (VolumePathComboBox->GetSize()); + VolumePathComboBox->SetMaxSize (VolumePathComboBox->GetSize()); + + SetMinSize (GetSize()); + SetMaxSize (GetSize()); + + Gui->SetListCtrlColumnWidths (SlotListCtrl, colPermilles); + + UpdateVolumeList(); + UpdateWipeCacheButton(); + } + + void MainFrame::InitEvents () + { + Core->VolumeMountedEvent.Connect (EventConnector (this, &MainFrame::OnVolumeMounted)); + Core->VolumeDismountedEvent.Connect (EventConnector (this, &MainFrame::OnVolumeDismounted)); + Gui->OpenVolumeSystemRequestEvent.Connect (EventConnector (this, &MainFrame::OnOpenVolumeSystemRequestEvent)); + Gui->PreferencesUpdatedEvent.Connect (EventConnector (this, &MainFrame::OnPreferencesUpdated)); + + // Drag & drop + class FileDropTarget : public wxFileDropTarget + { + public: + FileDropTarget (MainFrame *frame) : Frame (frame) { } + + wxDragResult OnDragOver (wxCoord x, wxCoord y, wxDragResult def) + { + wxPoint p; + wxWindow *w = wxFindWindowAtPointer (p); + if (w == Frame || wxGetTopLevelParent (w) == Frame) + return wxDragLink; + return wxDragNone; + } + + bool OnDropFiles (wxCoord x, wxCoord y, const wxArrayString &filenames) + { + if (!filenames.empty()) + Frame->SetVolumePath (wstring (filenames.front())); + return true; + } + + MainFrame *Frame; + }; + + SetDropTarget (new FileDropTarget (this)); +#ifdef TC_MACOSX + foreach (wxWindow *c, MainPanel->GetChildren()) + c->SetDropTarget (new FileDropTarget (this)); +#endif + + // Volume history + VolumeHistory::ConnectComboBox (VolumePathComboBox); + +#ifdef TC_WINDOWS + // Hotkeys + Hotkey::RegisterList (this, GetPreferences().Hotkeys); + Connect (wxEVT_HOTKEY, wxKeyEventHandler (MainFrame::OnHotkey)); +#endif + + // Timer + class Timer : public wxTimer + { + public: + Timer (MainFrame *frame) : Frame (frame) { } + + void Notify() + { + Frame->OnTimer(); + } + + MainFrame *Frame; + }; + + mTimer.reset (dynamic_cast (new Timer (this))); + mTimer->Start (2000); + } + +#ifdef TC_WINDOWS +#include + static WNDPROC MainFrameWndProc; + static LRESULT CALLBACK MainFrameWndProcFilter (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) + { + if (message == WM_DEVICECHANGE && !Core->IsDeviceChangeInProgress()) + { + MainFrame *frame = dynamic_cast (Gui->GetMainFrame()); + PDEV_BROADCAST_HDR hdr = (PDEV_BROADCAST_HDR) lParam; + + if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME) + { + PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam; + for (wchar_t driveNo = 0; driveNo < 26; ++driveNo) + { + if (vol->dbcv_unitmask & (1 << driveNo)) + frame->OnDeviceChange (wstring (StringFormatter (L"{0}:\\", wchar_t (L'A' + driveNo)))); + } + } + else + { + frame->OnDeviceChange (); + } + } + + return CallWindowProc (MainFrameWndProc, hwnd, message, wParam, lParam); + } +#endif + + void MainFrame::InitMessageFilter () + { +#ifdef TC_WINDOWS + HWND mainFrameHwnd = static_cast (GetHandle()); + MainFrameWndProc = (WNDPROC) GetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC); + SetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC, (LONG_PTR) MainFrameWndProcFilter); +#endif + } + + void MainFrame::InitPreferences () + { + try + { + LoadPreferences(); + + VolumeSlotNumber lastSelectedSlotNumber = GetPreferences().LastSelectedSlotNumber; + if (Core->IsSlotNumberValid (lastSelectedSlotNumber)) + { + long slotIndex = SlotNumberToItemIndex (lastSelectedSlotNumber); + if (slotIndex >= 0) + { + SlotListCtrl->SetItemState (slotIndex, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + SlotListCtrl->EnsureVisible (slotIndex); + } + } + + LoadFavoriteVolumes(); + VolumeHistory::Load(); + + if (VolumePathComboBox->GetValue().empty() && !VolumeHistory::Get().empty()) + SetVolumePath (VolumeHistory::Get().front()); + } + catch (exception &e) + { + Gui->ShowError (e); + Gui->ShowError (_("Error while loading configuration files located in ") + wstring (Application::GetConfigFilePath (L""))); + } + } + + void MainFrame::InitTaskBarIcon () + { + class TaskBarIcon : public wxTaskBarIcon + { + public: + TaskBarIcon (MainFrame *frame) : Busy (false), Frame (frame) + { + Connect (wxEVT_TASKBAR_LEFT_DOWN, wxTaskBarIconEventHandler (TaskBarIcon::OnLeftButtonDown)); + } + + wxMenu *CreatePopupMenu () + { + auto_ptr popup (new wxMenu); + + Gui->AppendToMenu (*popup, LangString[Gui->IsInBackgroundMode() ? "SHOW_TC" : "HIDE_TC"], this, wxCommandEventHandler (TaskBarIcon::OnShowHideMenuItemSelected)); + + popup->AppendSeparator(); + Gui->AppendToMenu (*popup, _("Mount All Favorite Volumes"), this, wxCommandEventHandler (TaskBarIcon::OnMountAllFavoritesMenuItemSelected))->Enable (!Busy); + Gui->AppendToMenu (*popup, _("Dismount All Mounted Volumes"), this, wxCommandEventHandler (TaskBarIcon::OnDismountAllMenuItemSelected))->Enable (!Busy); + + // Favorite volumes + if (Gui->GetPreferences().BackgroundTaskMenuMountItemsEnabled && !Frame->FavoriteVolumesMenuMap.empty()) + { + popup->AppendSeparator(); + typedef pair FavMapPair; + foreach (FavMapPair fp, Frame->FavoriteVolumesMenuMap) + { + Gui->AppendToMenu (*popup, LangString["MOUNT"] + L" " + wstring (fp.second.Path) + (fp.second.MountPoint.IsEmpty() ? L"" : L" " + wstring (fp.second.MountPoint)), + this, wxCommandEventHandler (TaskBarIcon::OnFavoriteVolumeMenuItemSelected), fp.first)->Enable (!Busy); + } + } + + // Mounted volumes + VolumeInfoList mountedVolumes = Core->GetMountedVolumes(); + if (!mountedVolumes.empty()) + { + if (Gui->GetPreferences().BackgroundTaskMenuOpenItemsEnabled) + { + popup->AppendSeparator(); + OpenMap.clear(); + foreach (shared_ptr volume, mountedVolumes) + { + if (!volume->MountPoint.IsEmpty()) + { + wxString label = LangString["OPEN"] + L" " + wstring (volume->MountPoint) + L" (" + wstring (volume->Path) + L")"; + wxMenuItem *item = Gui->AppendToMenu (*popup, label, this, wxCommandEventHandler (TaskBarIcon::OnOpenMenuItemSelected)); + OpenMap[item->GetId()] = volume; + } + } + } + + if (Gui->GetPreferences().BackgroundTaskMenuDismountItemsEnabled) + { + popup->AppendSeparator(); + DismountMap.clear(); + foreach (shared_ptr volume, mountedVolumes) + { + wxString label = LangString["DISMOUNT"] + L" "; + + if (!volume->MountPoint.IsEmpty()) + label += wstring (volume->MountPoint) + L" (" + wstring (volume->Path) + L")"; + else + label += wstring (volume->Path); + + wxMenuItem *item = Gui->AppendToMenu (*popup, label, this, wxCommandEventHandler (TaskBarIcon::OnDismountMenuItemSelected)); + item->Enable (!Busy); + DismountMap[item->GetId()] = volume; + } + } + } + + popup->AppendSeparator(); + Gui->AppendToMenu (*popup, _("Preferences..."), this, wxCommandEventHandler (TaskBarIcon::OnPreferencesMenuItemSelected))->Enable (!Busy); +#ifndef TC_MACOSX + popup->AppendSeparator(); + Gui->AppendToMenu (*popup, _("Exit"), this, wxCommandEventHandler (TaskBarIcon::OnExitMenuItemSelected))->Enable (!Busy && Frame->CanExit()); +#endif + return popup.release(); + } + + void OnDismountAllMenuItemSelected (wxCommandEvent& event) { Busy = true; Frame->OnDismountAllButtonClick (event); Busy = false; } + void OnDismountMenuItemSelected (wxCommandEvent& event) { Busy = true; Frame->DismountVolume (DismountMap[event.GetId()]); Busy = false; } + void OnFavoriteVolumeMenuItemSelected (wxCommandEvent& event) { Busy = true; Frame->OnFavoriteVolumeMenuItemSelected (event); Busy = false; } + void OnMountAllFavoritesMenuItemSelected (wxCommandEvent& event) { Busy = true; Frame->MountAllFavorites (); Busy = false; } + + void OnExitMenuItemSelected (wxCommandEvent& event) + { + Busy = true; + if (Core->GetMountedVolumes().empty() || Gui->AskYesNo (LangString ["CONFIRM_EXIT"], false, true)) + Frame->Close (true); + Busy = false; + } + + void OnLeftButtonDown (wxTaskBarIconEvent& event) { Gui->SetBackgroundMode (false); } + void OnOpenMenuItemSelected (wxCommandEvent& event) { Gui->OpenExplorerWindow (OpenMap[event.GetId()]->MountPoint); } + void OnPreferencesMenuItemSelected (wxCommandEvent& event) { Busy = true; Frame->OnPreferencesMenuItemSelected (event); Busy = false; } + void OnShowHideMenuItemSelected (wxCommandEvent& event) { Gui->SetBackgroundMode (!Gui->IsInBackgroundMode()); } + + bool Busy; + map < int, shared_ptr > DismountMap; + MainFrame *Frame; + map < int, shared_ptr > OpenMap; + }; + + mTaskBarIcon.reset (new TaskBarIcon (this)); + ShowTaskBarIcon (GetPreferences().BackgroundTaskEnabled); + } + + void MainFrame::LoadFavoriteVolumes () + { + typedef pair FavMapPair; + foreach (FavMapPair p, FavoriteVolumesMenuMap) + { + FavoritesMenu->Delete (p.first); + } + FavoriteVolumesMenuMap.clear(); + + foreach_ref (const FavoriteVolume &favorite, FavoriteVolume::LoadList()) + { + wstring label = wstring (favorite.Path); + if (!favorite.MountPoint.IsEmpty()) + label += wstring (L" ") + wstring (favorite.MountPoint); + + wxMenuItem *item = Gui->AppendToMenu (*FavoritesMenu, label, this, wxCommandEventHandler (MainFrame::OnFavoriteVolumeMenuItemSelected)); + FavoriteVolumesMenuMap[item->GetId()] = favorite; + } + } + + void MainFrame::LoadPreferences () + { + UserPreferences prefs; + prefs.Load(); + Gui->SetPreferences (prefs); + NoHistoryCheckBox->SetValue (!prefs.SaveHistory); + } + + void MainFrame::MountAllDevices () + { + try + { + MountOptions mountOptions (GetPreferences().DefaultMountOptions); + + if (SlotListCtrl->GetSelectedItemCount() == 1) + mountOptions.SlotNumber = SelectedSlotNumber; + + Gui->MountAllDeviceHostedVolumes (mountOptions); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::MountAllFavorites () + { + try + { + MountOptions mountOptions (GetPreferences().DefaultMountOptions); + Gui->MountAllFavoriteVolumes (mountOptions); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::MountVolume () + { + if (!IsFreeSlotSelected()) + { + Gui->ShowWarning (_("Please select a free drive slot from the list.")); + return; + } + + if (!CheckVolumePathNotEmpty()) + return; + + MountOptions mountOptions (GetPreferences().DefaultMountOptions); + mountOptions.SlotNumber = SelectedSlotNumber; + mountOptions.Path = GetSelectedVolumePath(); + + try + { + if (Gui->MountVolume (mountOptions) && GetPreferences().SaveHistory) + VolumeHistory::Add (*mountOptions.Path); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnAboutMenuItemSelected (wxCommandEvent& event) + { + AboutDialog dialog (this); + dialog.ShowModal(); + } + + void MainFrame::OnActivate (wxActivateEvent& event) + { + Gui->SetActiveFrame (this); + +#ifdef TC_MACOSX + if (event.GetActive() && Gui->IsInBackgroundMode()) + Gui->SetBackgroundMode (false); +#endif + event.Skip(); + } + + void MainFrame::OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event) + { + AddToFavorites (MountedVolumes); + } + + void MainFrame::OnAddToFavoritesMenuItemSelected (wxCommandEvent& event) + { + shared_ptr selectedVolume = GetSelectedVolume(); + if (selectedVolume) + { + VolumeInfoList volumes; + volumes.push_back (selectedVolume); + AddToFavorites (volumes); + } + } + + void MainFrame::OnBackupVolumeHeadersMenuItemSelected (wxCommandEvent& event) + { + if (!CheckVolumePathNotEmpty ()) + return; + + try + { + Gui->BackupVolumeHeaders (GetSelectedVolumePath()); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnBenchmarkMenuItemSelected (wxCommandEvent& event) + { + BenchmarkDialog dialog (this); + dialog.ShowModal(); + } + + void MainFrame::OnClearSlotSelectionMenuItemSelected (wxCommandEvent& event) + { + Gui->ClearListCtrlSelection (SlotListCtrl); + UpdateControls(); + } + + void MainFrame::OnClose (wxCloseEvent& event) + { + if (GetPreferences().WipeCacheOnClose) + Core->WipePasswordCache(); + +#ifdef TC_MACOSX + if (!event.CanVeto() && GetPreferences().DismountOnLogOff) + { + try + { + Gui->DismountVolumes (Core->GetMountedVolumes(), GetPreferences().ForceAutoDismount, false); + } + catch (...) { } + } +#endif + + if (!Gui->IsTheOnlyTopLevelWindow (this)) + { + // Bring first frame to foreground + wxFrame *frame = nullptr; + foreach (wxWindow *window, wxTopLevelWindows) + { + if (window != this + && dynamic_cast (window) + && StringConverter::GetTypeName (typeid (*window)).find ("wxTaskBarIcon") == string::npos) + { + frame = dynamic_cast (window); + if (window->IsShown()) + break; + } + } + + if (frame) + { + frame->Show(); + if (frame->IsIconized()) + frame->Iconize(false); + frame->Raise(); + } + } + else if (event.CanVeto() && GetPreferences().BackgroundTaskEnabled + && (!GetPreferences().CloseBackgroundTaskOnNoVolumes || !MountedVolumes.empty())) + { + // Enter background mode + if (!Gui->IsInBackgroundMode()) + Gui->SetBackgroundMode (true); + } + else + { +#ifdef __WXGTK__ + Show(); +#endif + SavePreferences(); + + Destroy(); + } + + // Cancel close - veto is not used to prevent aborting log off procedure on Windows + return; + } + + void MainFrame::OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event) + { + try + { + { + wxBusyCursor busy; + SecurityToken::CloseAllSessions(); + } + Gui->ShowInfo ("ALL_TOKEN_SESSIONS_CLOSED"); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnCreateVolumeButtonClick (wxCommandEvent& event) + { + try + { + (new VolumeCreationWizard (nullptr))->Show(); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event) + { + PreferencesDialog dialog (this); + dialog.SelectPage (dialog.DefaultKeyfilesPage); + dialog.ShowModal(); + } + + void MainFrame::OnDeviceChange (const DirectoryPath &mountPoint) + { + // Check if any host device has been removed and force dismount of volumes accordingly + VolumeInfoList removedVolumes; + foreach (shared_ptr volume, Core->GetMountedVolumes()) + { + // File-hosted volumes + if (!volume->Path.IsDevice() && !mountPoint.IsEmpty()) + { + if (wxString (volume->Path).Upper().StartsWith (wstring (mountPoint).c_str())) + { + removedVolumes.push_back (volume); + continue; + } + } + + // Device-hosted volumes + if (volume->Path.IsDevice() && !Core->IsDevicePresent (volume->Path)) + removedVolumes.push_back (volume); + } + + if (!removedVolumes.empty()) + Gui->AutoDismountVolumes (removedVolumes, true); + } + + void MainFrame::OnDismountAllButtonClick (wxCommandEvent& event) + { + Gui->DismountAllVolumes(); + } + + void MainFrame::OnEncryptionTestMenuItemSelected (wxCommandEvent& event) + { + EncryptionTestDialog dialog (this); + dialog.ShowModal(); + } + + void MainFrame::OnExitButtonClick (wxCommandEvent& event) + { + Close(); + } + + void MainFrame::OnFavoriteVolumeMenuItemSelected (wxCommandEvent& event) + { + FavoriteVolume favorite = FavoriteVolumesMenuMap[event.GetId()]; + if (!favorite.Path.IsEmpty()) + { + SetVolumePath (favorite.Path); + + MountOptions mountOptions (GetPreferences().DefaultMountOptions); + favorite.ToMountOptions (mountOptions); + + shared_ptr volume = Gui->MountVolume (mountOptions); + if (volume) + SlotListCtrl->EnsureVisible (SlotNumberToItemIndex (volume->SlotNumber)); + } + } + + void MainFrame::OnHiddenVolumeProtectionTriggered (shared_ptr protectedVolume) + { + Gui->ShowWarningTopMost (StringFormatter (LangString["DAMAGE_TO_HIDDEN_VOLUME_PREVENTED"], wstring (protectedVolume->Path))); + } + + void MainFrame::OnHotkey (wxKeyEvent& event) + { +#ifdef TC_WINDOWS + switch (event.GetId()) + { + case Hotkey::Id::CloseAllSecurityTokenSessions: + try + { + SecurityToken::CloseAllSessions(); + Gui->ShowInfo ("ALL_TOKEN_SESSIONS_CLOSED"); + } + catch (exception &e) { Gui->ShowError (e); } + break; + + case Hotkey::Id::DismountAll: + case Hotkey::Id::DismountAllWipeCache: + { + if (event.GetId() == Hotkey::Id::DismountAllWipeCache) + WipeCache(); + + size_t mountedCount = Core->GetMountedVolumes().size(); + Gui->DismountAllVolumes(); + size_t newMountedCount = Core->GetMountedVolumes().size(); + + if (newMountedCount < mountedCount) + { + if (newMountedCount == 0 && GetPreferences().DisplayMessageAfterHotkeyDismount) + Gui->ShowInfo ("MOUNTED_VOLUMES_DISMOUNTED"); + else if (GetPreferences().BeepAfterHotkeyMountDismount) + MessageBeep((UINT) -1); + } + } + break; + + case Hotkey::Id::ForceDismountAllWipeCache: + case Hotkey::Id::ForceDismountAllWipeCacheExit: + { + bool mounted = !Core->GetMountedVolumes().empty(); + + WipeCache(); + Gui->DismountAllVolumes (true, true); + + if (mounted && GetPreferences().DisplayMessageAfterHotkeyDismount) + Gui->ShowInfo ("VOLUMES_DISMOUNTED_CACHE_WIPED"); + else if (mounted && GetPreferences().BeepAfterHotkeyMountDismount) + MessageBeep((UINT) -1); + + if (event.GetId() == Hotkey::Id::ForceDismountAllWipeCacheExit) + Close (true); + } + break; + + case Hotkey::Id::MountAllDevices: + case Hotkey::Id::MountAllFavorites: + { + size_t mountedCount = Core->GetMountedVolumes().size(); + + if (event.GetId() == Hotkey::Id::MountAllDevices) + MountAllDevices(); + else + MountAllFavorites(); + + if (Core->GetMountedVolumes().size() > mountedCount && GetPreferences().BeepAfterHotkeyMountDismount) + MessageBeep((UINT) -1); + } + break; + + case Hotkey::Id::ShowHideApplication: + Gui->SetBackgroundMode (!Gui->IsInBackgroundMode()); + break; + + case Hotkey::Id::WipeCache: + WipeCache(); + Gui->ShowInfo ("PASSWORD_CACHE_WIPED"); + break; + + default: + assert (false); + break; + } +#endif // TC_WINDOWS + } + + void MainFrame::OnHotkeysMenuItemSelected (wxCommandEvent& event) + { + PreferencesDialog dialog (this); + dialog.SelectPage (dialog.HotkeysPage); + dialog.ShowModal(); + } + + void MainFrame::OnLegalNoticesMenuItemSelected (wxCommandEvent& event) + { + LegalNoticesDialog dialog (this); + dialog.ShowModal(); + } + + void MainFrame::OnListChanged () + { + OnListItemSelectionChanged(); + UpdateControls(); + } + + void MainFrame::OnListItemActivated (wxListEvent& event) + { + if (IsMountedSlotSelected()) + OpenSelectedVolume(); + else + MountVolume(); + } + + void MainFrame::OnListItemDeleted (long itemIndex) + { + if (SelectedItemIndex > itemIndex) + --SelectedItemIndex; + } + + void MainFrame::OnListItemDeselected (wxListEvent& event) + { + OnListItemSelectionChanged(); + } + + void MainFrame::OnListItemInserted (long itemIndex) + { + if (SelectedItemIndex >= itemIndex) + ++SelectedItemIndex; + } + + void MainFrame::OnListItemRightClick (wxListEvent& event) + { +#ifdef TC_MACOSX + if (SelectedItemIndex != event.GetIndex()) + { + SelectedItemIndex = event.GetIndex(); + OnListItemSelectionChanged(); + } + + if (!ListItemRightClickEventPending) + { + ListItemRightClickEventPending = true; + SlotListCtrl->AddPendingEvent (event); + return; + } + + ListItemRightClickEventPending = false; +#endif + + wxMenu popup; + if (IsMountedSlotSelected()) + { + Gui->AppendToMenu (popup, LangString["DISMOUNT"], this, wxCommandEventHandler (MainFrame::OnDismountVolumeMenuItemSelected)); + Gui->AppendToMenu (popup, LangString["OPEN"], this, wxCommandEventHandler (MainFrame::OnOpenVolumeMenuItemSelected)); + Gui->AppendToMenu (popup, _("Deselect"), this, wxCommandEventHandler (MainFrame::OnClearSlotSelectionMenuItemSelected)); + + popup.AppendSeparator(); + Gui->AppendToMenu (popup, _("Add to Favorites..."), this, wxCommandEventHandler (MainFrame::OnAddToFavoritesMenuItemSelected)); + + popup.AppendSeparator(); + Gui->AppendToMenu (popup, LangString["IDPM_CHECK_FILESYS"], this, wxCommandEventHandler (MainFrame::OnCheckFilesystemMenuItemSelected)); + Gui->AppendToMenu (popup, LangString["IDPM_REPAIR_FILESYS"], this, wxCommandEventHandler (MainFrame::OnRepairFilesystemMenuItemSelected)); + + popup.AppendSeparator(); + Gui->AppendToMenu (popup, LangString["IDPM_PROPERTIES"], this, wxCommandEventHandler (MainFrame::OnVolumePropertiesButtonClick)); + + PopupMenu (&popup); + } + else if (IsFreeSlotSelected()) + { + Gui->AppendToMenu (popup, _("Mount Volume"), this, wxCommandEventHandler (MainFrame::OnMountVolumeMenuItemSelected)); + + popup.AppendSeparator(); + + Gui->AppendToMenu (popup, LangString["SELECT_FILE_AND_MOUNT"], this, wxCommandEventHandler (MainFrame::OnSelectFileAndMountMenuItemSelected)); + Gui->AppendToMenu (popup, LangString["SELECT_DEVICE_AND_MOUNT"], this, wxCommandEventHandler (MainFrame::OnSelectDeviceAndMountMenuItemSelected)); + + popup.AppendSeparator(); + + Gui->AppendToMenu (popup, _("Deselect"), this, wxCommandEventHandler (MainFrame::OnClearSlotSelectionMenuItemSelected)); + + PopupMenu (&popup); + } + } + + void MainFrame::OnListItemSelected (wxListEvent& event) + { + SelectedItemIndex = event.GetIndex(); + OnListItemSelectionChanged(); + } + + void MainFrame::OnListItemSelectionChanged () + { + if (SlotListCtrl->GetSelectedItemCount() < 1) + SelectedItemIndex = -1; + + if (SelectedItemIndex >= 0) + SelectedSlotNumber = (VolumeSlotNumber) SlotListCtrl->GetItemData (SelectedItemIndex); + else + SelectedSlotNumber = 0; + + UpdateControls(); + } + + void MainFrame::OnManageSecurityTokenKeyfilesMenuItemSelected (wxCommandEvent& event) + { + try + { + SecurityTokenKeyfilesDialog dialog (this, false); + dialog.ShowModal(); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnMountAllDevicesButtonClick (wxCommandEvent& event) + { + MountAllDevices(); + } + + void MainFrame::OnMountAllFavoritesMenuItemSelected (wxCommandEvent& event) + { + MountAllFavorites(); + } + + void MainFrame::OnNoHistoryCheckBoxClick (wxCommandEvent& event) + { + UserPreferences prefs = GetPreferences(); + prefs.SaveHistory = !event.IsChecked(); + Gui->SetPreferences (prefs); + + if (event.IsChecked()) + { + try + { + VolumeHistory::Clear(); + } + catch (exception &e) { Gui->ShowError (e); } + } + } + + void MainFrame::OnOrganizeFavoritesMenuItemSelected (wxCommandEvent& event) + { + try + { + OrganizeFavorites (FavoriteVolume::LoadList()); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnPreferencesMenuItemSelected (wxCommandEvent& event) + { + PreferencesDialog dialog (this); + dialog.ShowModal(); + } + + void MainFrame::OnPreferencesUpdated (EventArgs &args) + { + const UserPreferences &prefs = GetPreferences(); + + NoHistoryCheckBox->SetValue (!prefs.SaveHistory); + + ShowTaskBarIcon (prefs.BackgroundTaskEnabled); + if (Gui->IsInBackgroundMode() && !prefs.BackgroundTaskEnabled) + Close (true); + + SavePreferences(); + } + + void MainFrame::OnRestoreVolumeHeaderMenuItemSelected (wxCommandEvent& event) + { + if (!CheckVolumePathNotEmpty ()) + return; + + try + { + Gui->RestoreVolumeHeaders (GetSelectedVolumePath()); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnSecurityTokenPreferencesMenuItemSelected (wxCommandEvent& event) + { + PreferencesDialog dialog (this); + dialog.SelectPage (dialog.SecurityTokensPage); + dialog.ShowModal(); + } + + + void MainFrame::OnSelectDeviceAndMountMenuItemSelected (wxCommandEvent& event) + { + DevicePath path = Gui->SelectDevice (this); + + if (!path.IsEmpty()) + { + SetVolumePath (path); + OnMountVolumeMenuItemSelected (event); + } + } + + void MainFrame::OnSelectDeviceButtonClick (wxCommandEvent& event) + { + DevicePath path = Gui->SelectDevice (this); + + if (!path.IsEmpty()) + SetVolumePath (path); + } + + void MainFrame::OnSelectFileAndMountMenuItemSelected (wxCommandEvent& event) + { + FilePath path = Gui->SelectVolumeFile (this); + + if (!path.IsEmpty()) + { + SetVolumePath (path); + OnMountVolumeMenuItemSelected (event); + } + } + + void MainFrame::OnSelectFileButtonClick (wxCommandEvent& event) + { + FilePath path = Gui->SelectVolumeFile (this); + if (!path.IsEmpty()) + SetVolumePath (path); + } + + void MainFrame::OnTimer () + { + try + { + UpdateVolumeList(); + UpdateWipeCacheButton(); + + if (GetPreferences().BackgroundTaskEnabled) + { + // Inactivity auto-dismount + if (GetPreferences().DismountOnInactivity) + { + VolumeInfoList inactiveVolumes; + wxLongLong currentTime = wxGetLocalTimeMillis().GetValue(); + + map newActivityTimeMap; + + foreach (shared_ptr volume, MountedVolumes) + { + if (VolumeActivityMap.find (volume->Path) != VolumeActivityMap.end() + && VolumeActivityMap[volume->Path].SerialInstanceNumber == volume->SerialInstanceNumber) + { + VolumeActivityMapEntry ae = VolumeActivityMap[volume->Path]; + + if (volume->TotalDataRead != ae.TotalDataRead || volume->TotalDataWritten != ae.TotalDataWritten) + { + ae.LastActivityTime = currentTime; + ae.TotalDataRead = volume->TotalDataRead; + ae.TotalDataWritten = volume->TotalDataWritten; + } + else if ((currentTime - ae.LastActivityTime) > GetPreferences().MaxVolumeIdleTime * 1000LL * 60) + { + inactiveVolumes.push_back (volume); + } + + newActivityTimeMap[volume->Path] = ae; + } + else + { + newActivityTimeMap[volume->Path] = VolumeActivityMapEntry (*volume, currentTime); + } + } + + VolumeActivityMap = newActivityTimeMap; + + if (!inactiveVolumes.empty()) + Gui->AutoDismountVolumes (inactiveVolumes); + } + + // Screen saver auto-dismount + if (GetPreferences().DismountOnScreenSaver) + { +#ifdef TC_WINDOWS + bool running; + if (SystemParametersInfo (SPI_GETSCREENSAVERRUNNING, 0, &running, 0) != 0) + { + static bool previousState = false; + if (running && !previousState) + { + previousState = true; + Gui->OnAutoDismountAllEvent(); + } + else + { + previousState = running; + } + } +#endif + } + } + + if (Gui->IsInBackgroundMode()) + { + if (!GetPreferences().BackgroundTaskEnabled) + { + Close (true); + } + else if (MountedVolumes.empty() && (GetPreferences().CloseBackgroundTaskOnNoVolumes || Core->IsInPortableMode())) + { + Close (true); + } + } + +#if defined(TC_UNIX) && !defined(TC_MACOSX) + try + { + byte buf[128]; + if (read (ShowRequestFifo, buf, sizeof (buf)) > 0 && Gui->IsInBackgroundMode()) + Gui->SetBackgroundMode (false); + } + catch (...) + { +#ifdef DEBUG + throw; +#endif + } +#endif + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void MainFrame::OnVolumeButtonClick (wxCommandEvent& event) + { + if (IsMountedSlotSelected()) + DismountVolume(); + else + MountVolume(); + } + + void MainFrame::OnVolumePropertiesButtonClick (wxCommandEvent& event) + { + shared_ptr selectedVolume = GetSelectedVolume(); + if (selectedVolume) + { + VolumePropertiesDialog dialog (this, *selectedVolume); + dialog.ShowModal(); + } + } + + void MainFrame::OnVolumeToolsButtonClick (wxCommandEvent& event) + { + if (!CheckVolumePathNotEmpty()) + return; + + wxMenu popup; + + Gui->AppendToMenu (popup, _("Change Volume Password..."), this, wxCommandEventHandler (MainFrame::OnChangePasswordMenuItemSelected)); + + popup.AppendSeparator (); + + Gui->AppendToMenu (popup, _("Add/Remove Keyfiles to/from Volume..."), this, wxCommandEventHandler (MainFrame::OnChangeKeyfilesMenuItemSelected)); + Gui->AppendToMenu (popup, _("Remove All Keyfiles from Volume..."), this, wxCommandEventHandler (MainFrame::OnRemoveKeyfilesMenuItemSelected)); + + popup.AppendSeparator (); + + Gui->AppendToMenu (popup, _("Change Header Key Derivation Algorithm..."), this, wxCommandEventHandler (MainFrame::OnChangePkcs5PrfMenuItemSelected)); + + popup.AppendSeparator (); + + Gui->AppendToMenu (popup, _("Backup Volume Header..."), this, wxCommandEventHandler (MainFrame::OnBackupVolumeHeadersMenuItemSelected)); + Gui->AppendToMenu (popup, _("Restore Volume Header..."), this, wxCommandEventHandler (MainFrame::OnRestoreVolumeHeaderMenuItemSelected)); + + PopupMenu (&popup, VolumeToolsButton->GetPosition().x + 2, VolumeToolsButton->GetPosition().y + 2); + } + + void MainFrame::OnWipeCacheButtonClick (wxCommandEvent& event) + { + WipeCache(); + Gui->ShowInfo ("PASSWORD_CACHE_WIPED"); + } + + void MainFrame::OpenSelectedVolume () const + { + shared_ptr selectedVolume = GetSelectedVolume(); + if (selectedVolume) + { + try + { + wxBusyCursor busy; + Gui->OpenExplorerWindow (selectedVolume->MountPoint); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + } + + void MainFrame::OrganizeFavorites (const FavoriteVolumeList &favorites, size_t newItemCount) + { + FavoriteVolumesDialog dialog (this, favorites, newItemCount); + + if (dialog.ShowModal() == wxID_OK) + { + FavoriteVolume::SaveList (dialog.GetFavorites()); + LoadFavoriteVolumes(); + } + } + + void MainFrame::SavePreferences () const + { + try + { + UserPreferences prefs = GetPreferences(); + prefs.LastSelectedSlotNumber = SelectedSlotNumber; + prefs.Save(); + + VolumeHistory::Save(); + } + catch (exception &e) + { + if (!Core->IsInPortableMode()) + Gui->ShowError (e); + } + } + + void MainFrame::ShowTaskBarIcon (bool show) + { + if (!show && mTaskBarIcon->IsIconInstalled()) + { + mTaskBarIcon->RemoveIcon(); + } + else if (show && !mTaskBarIcon->IsIconInstalled()) + { +#ifndef TC_MACOSX + mTaskBarIcon->SetIcon (Resources::GetTrueCryptIcon(), L"TrueCrypt"); +#endif + } + } + + long MainFrame::SlotNumberToItemIndex (uint32 slotNumber) const + { + for (long itemIndex = 0; itemIndex < SlotListCtrl->GetItemCount(); itemIndex++) + { + wxListItem item; + item.SetId (itemIndex); + if (slotNumber == (uint32) SlotListCtrl->GetItemData (item)) + return itemIndex; + } + return -1; + } + + void MainFrame::UpdateControls () + { + bool mounted = IsMountedSlotSelected(); + + VolumeButton->SetLabel (mounted ? LangString["DISMOUNT"] : wxString (_("Mount"))); + VolumePropertiesButton->Enable (mounted); + + DismountVolumeMenuItem->Enable (mounted); + MountVolumeMenuItem->Enable (!mounted); + VolumePropertiesMenuItem->Enable (mounted); + AddToFavoritesMenuItem->Enable (mounted); + AddAllMountedToFavoritesMenuItem->Enable (!MountedVolumes.empty()); + UpdateWipeCacheButton(); + } + + void MainFrame::UpdateVolumeList () + { + static Mutex mutex; + ScopeLock lock (mutex); + + bool listChanged = false; + + MountedVolumes = Core->GetMountedVolumes(); + + map < VolumeSlotNumber, shared_ptr > mountedVolumesMap; + foreach (shared_ptr volume, MountedVolumes) + { + mountedVolumesMap[volume->SlotNumber] = volume; + } + + VolumeInfoList protectionTriggeredVolumes; + + // Update list + long prevItemIndex = -1; + for (VolumeSlotNumber slotNumber = Core->GetFirstSlotNumber(); slotNumber <= Core->GetLastSlotNumber(); ++slotNumber) + { + long itemIndex = SlotNumberToItemIndex (slotNumber); + vector fields (SlotListCtrl->GetColumnCount()); + + if (mountedVolumesMap.find (slotNumber) != mountedVolumesMap.end()) + { + shared_ptr volume = mountedVolumesMap[slotNumber]; + +#ifdef TC_WINDOWS + fields[ColumnSlot] = volume->MountPoint; + fields[ColumnEA] = volume->EncryptionAlgorithmName; +#else + fields[ColumnSlot] = StringConverter::FromNumber (slotNumber); + fields[ColumnMountPoint] = volume->MountPoint; +#endif + fields[ColumnPath] = volume->Path; + fields[ColumnSize] = Gui->SizeToString (volume->Size); + fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->Protection); + + if (volume->HiddenVolumeProtectionTriggered) + { + fields[ColumnType] += L"(!)"; + } + + bool slotUpdated = false; + if (itemIndex == -1) + { + Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex, fields, 0, (void *) volume->SlotNumber); + OnListItemInserted (prevItemIndex); + + listChanged |= true; + slotUpdated = true; + } + else + { + if (Gui->UpdateListCtrlItem (SlotListCtrl, itemIndex, fields)) + { + listChanged = true; + slotUpdated = true; + } + prevItemIndex = itemIndex; + } + + if (slotUpdated && volume->HiddenVolumeProtectionTriggered) + protectionTriggeredVolumes.push_back (volume); + } + else + { +#ifdef TC_WINDOWS + fields[ColumnSlot] = Core->SlotNumberToMountPoint (slotNumber); +#else + fields[ColumnSlot] = StringConverter::FromNumber (slotNumber); +#endif + +#ifdef TC_WINDOWS + if (Core->IsMountPointAvailable (fields[ColumnSlot])) +#else + if (true) +#endif + { + if (itemIndex == -1) + { + Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex, fields, 0, (void *) slotNumber); + OnListItemInserted (prevItemIndex); + listChanged |= true; + } + else + { + listChanged |= Gui->UpdateListCtrlItem (SlotListCtrl, itemIndex, fields); + prevItemIndex = itemIndex; + } + } + else if (itemIndex != -1) + { + SlotListCtrl->DeleteItem (itemIndex); + OnListItemDeleted (itemIndex); + listChanged = true; + } + } + } + + if (listChanged) + OnListChanged(); + + foreach (shared_ptr volume, protectionTriggeredVolumes) + OnHiddenVolumeProtectionTriggered (volume); + } + + void MainFrame::UpdateWipeCacheButton () + { + bool enabled = WipeCacheButton->IsEnabled(); + bool empty = Core->IsPasswordCacheEmpty(); + + if (empty && enabled) + { + WipeCacheButton->Disable(); + WipeCachedPasswordsMenuItem->Enable (false); + } + else if (!empty && !enabled) + { + WipeCacheButton->Enable(); + WipeCachedPasswordsMenuItem->Enable(); + } + } + + void MainFrame::WipeCache () + { + Core->WipePasswordCache(); + UpdateWipeCacheButton(); + } +} diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h new file mode 100644 index 00000000..5b775abc --- /dev/null +++ b/src/Main/Forms/MainFrame.h @@ -0,0 +1,173 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_MainFrame +#define TC_HEADER_Main_Forms_MainFrame + +#include "Forms.h" +#include "ChangePasswordDialog.h" + +namespace TrueCrypt +{ + struct FavoriteVolume; + + class MainFrame : public MainFrameBase + { + public: + MainFrame (wxWindow* parent); + virtual ~MainFrame (); + + void OnDeviceChange (const DirectoryPath &mountPoint = DirectoryPath()); +#ifdef TC_UNIX + static FilePath GetShowRequestFifoPath () { return Application::GetConfigFilePath (L".show-request-queue", true); } +#endif + + protected: + enum + { + ColumnSlot = 0, + ColumnPath, + ColumnSize, +#ifdef TC_WINDOWS + ColumnEA, +#else + ColumnMountPoint, +#endif + ColumnType + }; + + void AddToFavorites (const VolumeInfoList &volumes); + bool CanExit () const; + void ChangePassword (ChangePasswordDialog::Mode::Enum mode = ChangePasswordDialog::Mode::ChangePasswordAndKeyfiles); + void CheckFilesystem (bool repair = false); + bool CheckVolumePathNotEmpty () const; + void DismountVolume (shared_ptr volume = shared_ptr ()); + const UserPreferences &GetPreferences () const { return Gui->GetPreferences(); } + shared_ptr GetSelectedVolume () const; + shared_ptr GetSelectedVolumePath () const { return make_shared (wstring (VolumePathComboBox->GetValue())); } + void InitControls (); + void InitEvents (); + void InitMessageFilter (); + void InitPreferences (); + void InitTaskBarIcon (); + bool IsFreeSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); } + bool IsMountedSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && !Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); } + void LoadFavoriteVolumes (); + void LoadPreferences (); + void MountAllDevices (); + void MountAllFavorites (); + void MountVolume (); + void OnAboutMenuItemSelected (wxCommandEvent& event); + void OnActivate (wxActivateEvent& event); + void OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event); + void OnAddToFavoritesMenuItemSelected (wxCommandEvent& event); + void OnBackupVolumeHeadersMenuItemSelected (wxCommandEvent& event); + void OnBeginnersTutorialMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"tutorial"); } + void OnBenchmarkMenuItemSelected (wxCommandEvent& event); + void OnChangeKeyfilesMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangeKeyfiles); } + void OnChangePasswordMenuItemSelected (wxCommandEvent& event) { ChangePassword (); } + void OnChangePkcs5PrfMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::ChangePkcs5Prf); } + void OnCheckFilesystemMenuItemSelected( wxCommandEvent& event ) { CheckFilesystem (); } + void OnClearSlotSelectionMenuItemSelected (wxCommandEvent& event); + void OnClose (wxCloseEvent& event); + void OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event); + void OnContactMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"contact"); } + void OnCreateKeyfileMenuItemSelected (wxCommandEvent& event) { Gui->CreateKeyfile(); } + void OnCreateVolumeButtonClick (wxCommandEvent& event); + void OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event); + void OnDismountAllButtonClick (wxCommandEvent& event); + void OnDismountVolumeMenuItemSelected (wxCommandEvent& event) { DismountVolume(); } + void OnDownloadsMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"downloads"); } + void OnEncryptionTestMenuItemSelected (wxCommandEvent& event); + void OnExitButtonClick (wxCommandEvent& event); + void OnFavoriteVolumeMenuItemSelected (wxCommandEvent& event); + void OnFaqMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"faq"); } + void OnHiddenVolumeProtectionTriggered (shared_ptr protectedVolume); + void OnHotkey (wxKeyEvent& event); + void OnHotkeysMenuItemSelected (wxCommandEvent& event); + void OnLegalNoticesMenuItemSelected (wxCommandEvent& event); + void OnListChanged (); + void OnListItemActivated (wxListEvent& event); + void OnListItemDeleted (long itemIndex); + void OnListItemDeselected (wxListEvent& event); + void OnListItemInserted (long itemIndex); + void OnListItemRightClick (wxListEvent& event); + void OnListItemSelected (wxListEvent& event); + void OnListItemSelectionChanged (); + void OnLogoBitmapClick (wxMouseEvent &event) { wxCommandEvent ev; OnAboutMenuItemSelected (ev); } + void OnManageSecurityTokenKeyfilesMenuItemSelected (wxCommandEvent& event); + void OnMountAllDevicesButtonClick (wxCommandEvent& event); + void OnMountAllFavoritesMenuItemSelected (wxCommandEvent& event); + void OnMountVolumeMenuItemSelected (wxCommandEvent& event) { MountVolume(); } + void OnNewsMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"news"); } + void OnNoHistoryCheckBoxClick (wxCommandEvent& event); + void OnOnlineHelpMenuItemSelected (wxCommandEvent& event) { Gui->OpenOnlineHelp (this); } + void OnOpenVolumeMenuItemSelected (wxCommandEvent& event) { OpenSelectedVolume(); } + void OnOpenVolumeSystemRequestEvent (EventArgs &args) { SetVolumePath (wstring (dynamic_cast (args).mVolumePath)); } + void OnOrganizeFavoritesMenuItemSelected (wxCommandEvent& event); + void OnPreferencesMenuItemSelected (wxCommandEvent& event); + void OnPreferencesUpdated (EventArgs &args); + void OnRemoveKeyfilesMenuItemSelected (wxCommandEvent& event) { ChangePassword (ChangePasswordDialog::Mode::RemoveAllKeyfiles); } + void OnRepairFilesystemMenuItemSelected( wxCommandEvent& event ) { CheckFilesystem (true); } + void OnRestoreVolumeHeaderMenuItemSelected (wxCommandEvent& event); + void OnSecurityTokenPreferencesMenuItemSelected (wxCommandEvent& event); + void OnSelectDeviceAndMountMenuItemSelected (wxCommandEvent& event); + void OnSelectDeviceButtonClick (wxCommandEvent& event); + void OnSelectFileAndMountMenuItemSelected (wxCommandEvent& event); + void OnSelectFileButtonClick (wxCommandEvent& event); + void OnTimer (); + void OnVersionHistoryMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"history"); } + void OnVolumePropertiesButtonClick (wxCommandEvent& event); + void OnVolumeToolsButtonClick (wxCommandEvent& event); + void OnVolumeButtonClick (wxCommandEvent& event); + void OnVolumeDismounted (EventArgs &args) { UpdateVolumeList(); } + void OnVolumeMounted (EventArgs &args) { UpdateVolumeList(); } + void OnUserGuideMenuItemSelected (wxCommandEvent& event) { Gui->OpenUserGuide (this); } + void OnWebsiteMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"website"); } + void OnWipeCacheButtonClick (wxCommandEvent& event); + void OrganizeFavorites (const FavoriteVolumeList &favorites, size_t newItemCount = 0); + void OpenSelectedVolume () const; + void SavePreferences () const; + long SlotNumberToItemIndex (uint32 slotNumber) const; + void SetVolumePath (const VolumePath &path) { VolumePathComboBox->SetValue (wstring (path)); } + void ShowTaskBarIcon (bool show = true); + void UpdateControls (); + void UpdateVolumeList (); + void UpdateWipeCacheButton (); + void WipeCache (); + + struct VolumeActivityMapEntry + { + VolumeActivityMapEntry () { } + + VolumeActivityMapEntry (const VolumeInfo &volume, wxLongLong lastActivityTime) + : LastActivityTime (lastActivityTime), + SerialInstanceNumber (volume.SerialInstanceNumber), + TotalDataRead (volume.TotalDataRead), + TotalDataWritten (volume.TotalDataWritten) + { } + + wxLongLong LastActivityTime; + uint64 SerialInstanceNumber; + uint64 TotalDataRead; + uint64 TotalDataWritten; + }; + + map FavoriteVolumesMenuMap; + bool ListItemRightClickEventPending; + VolumeInfoList MountedVolumes; + auto_ptr mTaskBarIcon; + auto_ptr mTimer; + long SelectedItemIndex; + VolumeSlotNumber SelectedSlotNumber; + int ShowRequestFifo; + map VolumeActivityMap; + }; +} + +#endif // TC_HEADER_Main_Forms_MainFrame diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp new file mode 100644 index 00000000..f4fea7a6 --- /dev/null +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -0,0 +1,174 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/Main.h" +#include "Main/GraphicUserInterface.h" +#include "MountOptionsDialog.h" + +namespace TrueCrypt +{ + MountOptionsDialog::MountOptionsDialog (wxWindow *parent, MountOptions &options, const wxString &title, bool disableMountOptions) + : MountOptionsDialogBase (parent, wxID_ANY, wxString() +#ifdef __WXGTK__ // GTK apparently needs wxRESIZE_BORDER to support dynamic resizing + , wxDefaultPosition, wxSize (-1,-1), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER +#endif + ), Options (options) + { + if (!title.empty()) + this->SetTitle (title); + else if (options.Path && !options.Path->IsEmpty()) + this->SetTitle (StringFormatter (LangString["ENTER_PASSWORD_FOR"], wstring (*options.Path))); + else + this->SetTitle (LangString["ENTER_TC_VOL_PASSWORD"]); + + if (disableMountOptions) + OptionsButton->Show (false); + + PasswordPanel = new VolumePasswordPanel (this, options.Password, options.Keyfiles, !disableMountOptions); + PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword)); + + PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); + +#ifdef __WXGTK__ + FilesystemOptionsSizer->Remove (FilesystemSpacer); + OptionsPanel->Show (false); + Fit(); + Layout(); + SetMinSize (GetSize()); +#endif + + NoFilesystemCheckBox->SetValidator (wxGenericValidator (&Options.NoFilesystem)); + RemovableCheckBox->SetValidator (wxGenericValidator (&Options.Removable)); + PartitionInSystemEncryptionScopeCheckBox->SetValidator (wxGenericValidator (&Options.PartitionInSystemEncryptionScope)); + + TransferDataToWindow(); + + if (Options.MountPoint && !Options.MountPoint->IsEmpty()) + MountPointTextCtrl->SetValue (wstring (*Options.MountPoint)); + + FilesystemOptionsTextCtrl->SetValue (Options.FilesystemOptions); + + ReadOnlyCheckBox->SetValue (Options.Protection == VolumeProtection::ReadOnly); + ProtectionCheckBox->SetValue (Options.Protection == VolumeProtection::HiddenVolumeReadOnly); + + OptionsButtonLabel = OptionsButton->GetLabel(); + OptionsButton->SetLabel (OptionsButtonLabel + L" >"); + OptionsPanel->Show (false); + + ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, options.ProtectionPassword, options.ProtectionKeyfiles, false, true, true, false, false, _("P&assword to hidden volume:")); + ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND); + + UpdateDialog(); + Center(); + } + + void MountOptionsDialog::OnInitDialog (wxInitDialogEvent& event) + { + PasswordPanel->SetFocusToPasswordTextCtrl(); + } + + void MountOptionsDialog::OnMountPointButtonClick (wxCommandEvent& event) + { + DirectoryPath dir = Gui->SelectDirectory (this, wxEmptyString, false); + if (!dir.IsEmpty()) + MountPointTextCtrl->SetValue (wstring (dir)); + } + + void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event) + { + TransferDataFromWindow(); + + Options.Password = PasswordPanel->GetPassword(); + Options.Keyfiles = PasswordPanel->GetKeyfiles(); + + if (ReadOnlyCheckBox->IsChecked()) + { + Options.Protection = VolumeProtection::ReadOnly; + } + else if (ProtectionCheckBox->IsChecked()) + { + Options.Protection = VolumeProtection::HiddenVolumeReadOnly; + Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(); + Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles(); + } + else + { + Options.Protection = VolumeProtection::None; + } + + wstring mountPoint (MountPointTextCtrl->GetValue()); + if (!mountPoint.empty()) + Options.MountPoint = make_shared (mountPoint); + + Options.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue(); + + try + { + if (Options.Password) + Options.Password->CheckPortability(); + } + catch (UnportablePassword &) + { + Gui->ShowWarning (LangString ["UNSUPPORTED_CHARS_IN_PWD_RECOM"]); + } + + EndModal (wxID_OK); + } + + void MountOptionsDialog::OnOptionsButtonClick (wxCommandEvent& event) + { + FreezeScope freeze (this); + OptionsPanel->Show (!OptionsPanel->IsShown()); + UpdateDialog(); + OptionsButton->SetLabel (OptionsButtonLabel + (OptionsPanel->IsShown() ? L" <" : L" >")); + } + + void MountOptionsDialog::OnProtectionCheckBoxClick (wxCommandEvent& event) + { + FreezeScope freeze (this); + ProtectionPasswordPanel->Show (event.IsChecked()); + Fit(); + Layout(); + ProtectionPasswordPanel->SetFocusToPasswordTextCtrl(); + } + + void MountOptionsDialog::OnProtectionHyperlinkClick (wxHyperlinkEvent& event) + { + Gui->OpenHomepageLink (this, L"hiddenvolprotection"); + } + + void MountOptionsDialog::UpdateDialog () + { + FreezeScope freeze (this); + +#ifdef TC_WINDOWS + FilesystemSizer->Show (false); +#else + FilesystemOptionsSizer->Show (!NoFilesystemCheckBox->IsChecked()); + +# ifdef TC_MACOSX + FilesystemOptionsStaticText->Show (false); + FilesystemOptionsTextCtrl->Show (false); +# endif + + if (!Options.Path || Options.Path->IsEmpty()) + { + MountPointTextCtrlStaticText->Show (false); + MountPointTextCtrl->Show (false); + MountPointButton->Show (false); + } + RemovableCheckBox->Show (false); +#endif + ProtectionSizer->Show (!ReadOnlyCheckBox->IsChecked()); + ProtectionPasswordPanel->Show (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked()); + + Fit(); + Layout(); + } +} diff --git a/src/Main/Forms/MountOptionsDialog.h b/src/Main/Forms/MountOptionsDialog.h new file mode 100644 index 00000000..c5ef8097 --- /dev/null +++ b/src/Main/Forms/MountOptionsDialog.h @@ -0,0 +1,42 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_MountOptionsDialog +#define TC_HEADER_Main_Forms_MountOptionsDialog + +#include "Forms.h" +#include "Main/Main.h" +#include "VolumePasswordPanel.h" + +namespace TrueCrypt +{ + class MountOptionsDialog : public MountOptionsDialogBase + { + public: + MountOptionsDialog (wxWindow* parent, MountOptions &options, const wxString &title = wxEmptyString, bool disableMountOptions = false); + void OnShow (); + + protected: + void OnInitDialog (wxInitDialogEvent& event); + void OnMountPointButtonClick (wxCommandEvent& event); + void OnNoFilesystemCheckBoxClick (wxCommandEvent& event) { UpdateDialog(); } + void OnOKButtonClick (wxCommandEvent& event); + void OnOptionsButtonClick (wxCommandEvent& event); + void OnProtectionCheckBoxClick (wxCommandEvent& event); + void OnProtectionHyperlinkClick (wxHyperlinkEvent& event); + void OnReadOnlyCheckBoxClick (wxCommandEvent& event) { UpdateDialog(); } + void UpdateDialog (); + + MountOptions &Options; + wxString OptionsButtonLabel; + VolumePasswordPanel *PasswordPanel; + VolumePasswordPanel *ProtectionPasswordPanel; + }; +} + +#endif // TC_HEADER_Main_Forms_MountOptionsDialog diff --git a/src/Main/Forms/NewSecurityTokenKeyfileDialog.cpp b/src/Main/Forms/NewSecurityTokenKeyfileDialog.cpp new file mode 100644 index 00000000..ed728254 --- /dev/null +++ b/src/Main/Forms/NewSecurityTokenKeyfileDialog.cpp @@ -0,0 +1,45 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "NewSecurityTokenKeyfileDialog.h" + +namespace TrueCrypt +{ + NewSecurityTokenKeyfileDialog::NewSecurityTokenKeyfileDialog (wxWindow* parent, const wstring &keyfileName) : NewSecurityTokenKeyfileDialogBase (parent) + { + list tokens = SecurityToken::GetAvailableTokens(); + + if (tokens.empty()) + throw_err (LangString ["NO_TOKENS_FOUND"]); + + foreach (const SecurityTokenInfo &token, tokens) + { + wstringstream tokenLabel; + tokenLabel << L"[" << token.SlotId << L"] " << token.Label; + + SecurityTokenChoice->Append (tokenLabel.str(), (void *) token.SlotId); + } + + SecurityTokenChoice->Select (0); + KeyfileNameTextCtrl->SetValue (keyfileName); + + KeyfileNameTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (KeyfileNameTextCtrl) * 32, -1)); + + Fit(); + Layout(); + Center(); + } + + void NewSecurityTokenKeyfileDialog::OnKeyfileNameChanged (wxCommandEvent& event) + { + StdButtonsOK->Enable (!KeyfileNameTextCtrl->GetValue().empty()); + event.Skip(); + } +} diff --git a/src/Main/Forms/NewSecurityTokenKeyfileDialog.h b/src/Main/Forms/NewSecurityTokenKeyfileDialog.h new file mode 100644 index 00000000..11891dbb --- /dev/null +++ b/src/Main/Forms/NewSecurityTokenKeyfileDialog.h @@ -0,0 +1,30 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_NewSecurityTokenKeyfileDialog +#define TC_HEADER_Main_Forms_NewSecurityTokenKeyfileDialog + +#include "Forms.h" +#include "Common/SecurityToken.h" + +namespace TrueCrypt +{ + class NewSecurityTokenKeyfileDialog : public NewSecurityTokenKeyfileDialogBase + { + public: + NewSecurityTokenKeyfileDialog (wxWindow* parent, const wstring &keyfileName); + + wstring GetKeyfileName () const { return wstring (KeyfileNameTextCtrl->GetValue()); } + CK_SLOT_ID GetSelectedSlotId () const { return reinterpret_cast (SecurityTokenChoice->GetClientData (SecurityTokenChoice->GetSelection())); } + + protected: + void OnKeyfileNameChanged (wxCommandEvent& event); + }; +} + +#endif // TC_HEADER_Main_Forms_NewSecurityTokenKeyfileDialog diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp new file mode 100644 index 00000000..b10a5cdd --- /dev/null +++ b/src/Main/Forms/PreferencesDialog.cpp @@ -0,0 +1,488 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include +#ifdef TC_WINDOWS +#include +#endif +#include "Common/SecurityToken.h" +#include "Main/Main.h" +#include "Main/Application.h" +#include "Main/GraphicUserInterface.h" +#include "Volume/Cipher.h" +#include "PreferencesDialog.h" + +namespace TrueCrypt +{ + PreferencesDialog::PreferencesDialog (wxWindow* parent) + : PreferencesDialogBase (parent), + LastVirtualKeyPressed (0), + Preferences (Gui->GetPreferences()), + RestoreValidatorBell (false) + { +#define TC_CHECK_BOX_VALIDATOR(NAME) (TC_JOIN(NAME,CheckBox))->SetValidator (wxGenericValidator (&Preferences.NAME)); + +#ifdef TC_MACOSX + PreferencesNotebook->SetMinSize (wxSize (Gui->GetCharWidth (PreferencesNotebook) * 108, -1)); +#endif + // Security + TC_CHECK_BOX_VALIDATOR (DismountOnLogOff); + TC_CHECK_BOX_VALIDATOR (DismountOnPowerSaving); + TC_CHECK_BOX_VALIDATOR (DismountOnScreenSaver); + TC_CHECK_BOX_VALIDATOR (DismountOnInactivity); + DismountOnInactivitySpinCtrl->SetValidator (wxGenericValidator (&Preferences.MaxVolumeIdleTime)); + TC_CHECK_BOX_VALIDATOR (ForceAutoDismount); + PreserveTimestampsCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.PreserveTimestamps)); + TC_CHECK_BOX_VALIDATOR (WipeCacheOnAutoDismount); + TC_CHECK_BOX_VALIDATOR (WipeCacheOnClose); + + // Mount options + CachePasswordsCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.CachePassword)); + MountReadOnlyCheckBox->SetValue (Preferences.DefaultMountOptions.Protection == VolumeProtection::ReadOnly); + MountRemovableCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.Removable)); + + FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions); + + // Keyfiles + TC_CHECK_BOX_VALIDATOR (UseKeyfiles); + + DefaultKeyfilesPanel = new KeyfilesPanel (DefaultKeyfilesPage, make_shared (Preferences.DefaultKeyfiles)); + DefaultKeyfilesSizer->Add (DefaultKeyfilesPanel, 1, wxALL | wxEXPAND); + DefaultKeyfilesSizer->Layout(); + + TC_CHECK_BOX_VALIDATOR (BackgroundTaskEnabled); + TC_CHECK_BOX_VALIDATOR (CloseBackgroundTaskOnNoVolumes); + CloseBackgroundTaskOnNoVolumesCheckBox->Show (!Core->IsInPortableMode()); + TC_CHECK_BOX_VALIDATOR (BackgroundTaskMenuDismountItemsEnabled); + TC_CHECK_BOX_VALIDATOR (BackgroundTaskMenuMountItemsEnabled); + TC_CHECK_BOX_VALIDATOR (BackgroundTaskMenuOpenItemsEnabled); + + // Encryption + AesHwCpuSupportedStaticText->SetLabel ( +#ifdef TC_AES_HW_CPU + (is_aes_hw_cpu_supported() ? LangString["UISTR_YES"] : LangString["UISTR_NO"])); +#else + LangString["NOT_APPLICABLE_OR_NOT_AVAILABLE"]); +#endif + NoHardwareCryptoCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.NoHardwareCrypto)); + + // Security tokens + Pkcs11ModulePathTextCtrl->SetValue (wstring (Preferences.SecurityTokenModule)); + TC_CHECK_BOX_VALIDATOR (CloseSecurityTokenSessionsAfterMount); + + // System integration + TC_CHECK_BOX_VALIDATOR (StartOnLogon); + TC_CHECK_BOX_VALIDATOR (MountDevicesOnLogon); + TC_CHECK_BOX_VALIDATOR (MountFavoritesOnLogon); + + TC_CHECK_BOX_VALIDATOR (CloseExplorerWindowsOnDismount); + TC_CHECK_BOX_VALIDATOR (OpenExplorerWindowAfterMount); + + NoKernelCryptoCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.NoKernelCrypto)); + +#ifdef TC_WINDOWS + // Hotkeys + TC_CHECK_BOX_VALIDATOR (BeepAfterHotkeyMountDismount); + TC_CHECK_BOX_VALIDATOR (DisplayMessageAfterHotkeyDismount); +#endif + + TransferDataToWindow(); // Code below relies on TransferDataToWindow() called at this point + +#if defined (TC_WINDOWS) || defined (TC_MACOSX) + FilesystemSizer->Show (false); +#else + // Auto-dismount is not supported on Linux as dismount may require the user to enter admin password + AutoDismountSizer->Show (false); + WipeCacheOnAutoDismountCheckBox->Show (false); +#endif + +#ifndef TC_WINDOWS + LogOnSizer->Show (false); + MountRemovableCheckBox->Show (false); + CloseExplorerWindowsOnDismountCheckBox->Show (false); +#endif + +#ifndef wxHAS_POWER_EVENTS + DismountOnPowerSavingCheckBox->Show (false); +#endif + +#ifdef TC_MACOSX + DismountOnScreenSaverCheckBox->Show (false); + DismountOnLogOffCheckBox->SetLabel (_("TrueCrypt quits")); + OpenExplorerWindowAfterMountCheckBox->SetLabel (_("Open Finder window for successfully mounted volume")); + + MountRemovableCheckBox->Show (false); + FilesystemSizer->Show (false); + LogOnSizer->Show (false); + CloseExplorerWindowsOnDismountCheckBox->Show (false); +#endif + +#ifndef TC_LINUX + KernelServicesSizer->Show (false); +#endif + +#ifdef TC_WINDOWS + // Hotkeys + list colPermilles; + HotkeyListCtrl->InsertColumn (ColumnHotkeyDescription, LangString["ACTION"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (642); + HotkeyListCtrl->InsertColumn (ColumnHotkey, LangString["SHORTCUT"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (358); + + vector fields (HotkeyListCtrl->GetColumnCount()); + + UnregisteredHotkeys = Preferences.Hotkeys; + Hotkey::UnregisterList (Gui->GetMainFrame(), UnregisteredHotkeys); + + foreach (shared_ptr hotkey, Preferences.Hotkeys) + { + fields[ColumnHotkeyDescription] = hotkey->Description; + fields[ColumnHotkey] = hotkey->GetShortcutString(); + Gui->AppendToListCtrl (HotkeyListCtrl, fields, -1, hotkey.get()); + } + + Gui->SetListCtrlHeight (HotkeyListCtrl, 5); + + Layout(); + Fit(); + Gui->SetListCtrlColumnWidths (HotkeyListCtrl, colPermilles); + + RestoreValidatorBell = !wxTextValidator::IsSilent(); + wxTextValidator::SetBellOnError (true); + HotkeyTextCtrl->SetValidator (wxTextValidator (wxFILTER_INCLUDE_CHAR_LIST)); + + UpdateHotkeyButtons(); +#endif + + // Page setup + for (size_t page = 0; page < PreferencesNotebook->GetPageCount(); page++) + { + wxNotebookPage *np = PreferencesNotebook->GetPage (page); + if (np == HotkeysPage) + { +#ifndef TC_WINDOWS + PreferencesNotebook->RemovePage (page--); + continue; +#endif + } + + np->Layout(); + } + + Layout(); + Fit(); + Center(); + + StdButtonsOK->SetDefault(); + +#ifdef TC_WINDOWS + // Hotkey timer + class Timer : public wxTimer + { + public: + Timer (PreferencesDialog *dialog) : Dialog (dialog) { } + + void Notify() + { + Dialog->OnTimer(); + } + + PreferencesDialog *Dialog; + }; + + mTimer.reset (dynamic_cast (new Timer (this))); + mTimer->Start (25); +#endif + } + + PreferencesDialog::~PreferencesDialog () + { + if (RestoreValidatorBell) + wxTextValidator::SetBellOnError (false); + } + + void PreferencesDialog::SelectPage (wxPanel *page) + { + for (size_t pageIndex = 0; pageIndex < PreferencesNotebook->GetPageCount(); pageIndex++) + { + if (PreferencesNotebook->GetPage (pageIndex) == page) + PreferencesNotebook->ChangeSelection (pageIndex); + } + } + + void PreferencesDialog::OnAssignHotkeyButtonClick (wxCommandEvent& event) + { +#ifdef TC_WINDOWS + foreach (long item, Gui->GetListCtrlSelectedItems (HotkeyListCtrl)) + { + Hotkey *hotkey = reinterpret_cast (HotkeyListCtrl->GetItemData (item)); + + int mods = 0; + mods |= HotkeyShiftCheckBox->IsChecked() ? wxMOD_SHIFT : 0; + mods |= HotkeyControlCheckBox->IsChecked() ? wxMOD_CONTROL : 0; + mods |= HotkeyAltCheckBox->IsChecked() ? wxMOD_ALT : 0; + mods |= HotkeyWinCheckBox->IsChecked() ? wxMOD_WIN : 0; + + // F1 is help and F12 is reserved for use by the debugger at all times + if (mods == 0 && (LastVirtualKeyPressed == VK_F1 || LastVirtualKeyPressed == VK_F12)) + { + Gui->ShowError ("CANNOT_USE_RESERVED_KEY"); + return; + } + + // Test if the hotkey can be registered + if (!this->RegisterHotKey (hotkey->Id, mods, LastVirtualKeyPressed)) + { + Gui->ShowError (SystemException (SRC_POS)); + return; + } + UnregisterHotKey (hotkey->Id); + + foreach_ref (const Hotkey &h, Preferences.Hotkeys) + { + if (h.Id != hotkey->Id && h.VirtualKeyCode == LastVirtualKeyPressed && h.VirtualKeyModifiers == mods) + { + Gui->ShowError ("SHORTCUT_ALREADY_IN_USE"); + return; + } + } + + hotkey->VirtualKeyCode = LastVirtualKeyPressed; + hotkey->VirtualKeyModifiers = mods; + + vector fields (HotkeyListCtrl->GetColumnCount()); + fields[ColumnHotkeyDescription] = hotkey->Description; + fields[ColumnHotkey] = hotkey->GetShortcutString(); + Gui->UpdateListCtrlItem (HotkeyListCtrl, item, fields); + + UpdateHotkeyButtons(); + } +#endif // TC_WINDOWS + } + + void PreferencesDialog::OnBackgroundTaskEnabledCheckBoxClick (wxCommandEvent& event) + { + if (!event.IsChecked()) + BackgroundTaskEnabledCheckBox->SetValue (!Gui->AskYesNo (LangString["CONFIRM_BACKGROUND_TASK_DISABLED"], false, true)); + } + + void PreferencesDialog::OnNoHardwareCryptoCheckBoxClick (wxCommandEvent& event) + { + if (event.IsChecked()) + { + if (Gui->AskYesNo (LangString["CONFIRM_SETTING_DEGRADES_PERFORMANCE"], true, true)) + { +#ifdef TC_LINUX + Gui->ShowWarning (_("Please note that this setting takes effect only if use of the kernel cryptographic services is disabled.")); +#endif + } + else + NoHardwareCryptoCheckBox->SetValue (false); + } + + Gui->ShowWarning (_("Please note that any currently mounted volumes need to be remounted before they can use this setting.")); + } + + void PreferencesDialog::OnNoKernelCryptoCheckBoxClick (wxCommandEvent& event) + { + if (event.IsChecked()) + NoKernelCryptoCheckBox->SetValue (Gui->AskYesNo (_("Disabling the use of kernel cryptographic services can degrade performance.\n\nAre you sure?"), false, true)); + } + + void PreferencesDialog::OnClose (wxCloseEvent& event) + { +#ifdef TC_WINDOWS + Hotkey::RegisterList (Gui->GetMainFrame(), UnregisteredHotkeys); +#endif + event.Skip(); + } + + void PreferencesDialog::OnDismountOnPowerSavingCheckBoxClick (wxCommandEvent& event) + { + if (event.IsChecked() && !ForceAutoDismountCheckBox->IsChecked()) + Gui->ShowWarning ("WARN_PREF_AUTO_DISMOUNT"); + } + + void PreferencesDialog::OnDismountOnScreenSaverCheckBoxClick (wxCommandEvent& event) + { + if (event.IsChecked() && !ForceAutoDismountCheckBox->IsChecked()) + Gui->ShowWarning ("WARN_PREF_AUTO_DISMOUNT"); + } + + void PreferencesDialog::OnForceAutoDismountCheckBoxClick (wxCommandEvent& event) + { + if (!event.IsChecked()) + ForceAutoDismountCheckBox->SetValue (!Gui->AskYesNo (LangString["CONFIRM_NO_FORCED_AUTODISMOUNT"], false, true)); + } + + void PreferencesDialog::OnHotkeyListItemDeselected (wxListEvent& event) + { + UpdateHotkeyButtons(); + } + + void PreferencesDialog::OnHotkeyListItemSelected (wxListEvent& event) + { + UpdateHotkeyButtons(); + HotkeyTextCtrl->ChangeValue (LangString ["PRESS_A_KEY_TO_ASSIGN"]); + AssignHotkeyButton->Enable (false); + } + + void PreferencesDialog::OnOKButtonClick (wxCommandEvent& event) + { +#ifdef TC_WINDOWS + HotkeyTextCtrl->SetValidator (wxTextValidator (wxFILTER_NONE)); +#endif + if (!Validate()) + return; + + TransferDataFromWindow(); + + Preferences.DefaultMountOptions.Protection = MountReadOnlyCheckBox->IsChecked() ? VolumeProtection::ReadOnly : VolumeProtection::None; + Preferences.DefaultMountOptions.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue(); + Preferences.DefaultKeyfiles = *DefaultKeyfilesPanel->GetKeyfiles(); + + bool securityTokenModuleChanged = (Preferences.SecurityTokenModule != wstring (Pkcs11ModulePathTextCtrl->GetValue())); + Preferences.SecurityTokenModule = wstring (Pkcs11ModulePathTextCtrl->GetValue()); + + Gui->SetPreferences (Preferences); + + try + { + if (securityTokenModuleChanged) + { + if (Preferences.SecurityTokenModule.IsEmpty()) + { + if (SecurityToken::IsInitialized()) + SecurityToken::CloseLibrary (); + } + else + { + Gui->InitSecurityTokenLibrary(); + } + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + +#ifdef TC_WINDOWS + // Hotkeys + Hotkey::RegisterList (Gui->GetMainFrame(), Preferences.Hotkeys); +#endif + + EndModal (wxID_OK); + } + + void PreferencesDialog::OnPreserveTimestampsCheckBoxClick (wxCommandEvent& event) + { +#ifdef TC_LINUX + if (!event.IsChecked()) + Gui->ShowInfo (_("Please note that disabling this option may have no effect on volumes mounted using kernel cryptographic services.")); +#endif + } + + void PreferencesDialog::OnRemoveHotkeyButtonClick (wxCommandEvent& event) + { +#ifdef TC_WINDOWS + foreach (long item, Gui->GetListCtrlSelectedItems (HotkeyListCtrl)) + { + Hotkey *hotkey = reinterpret_cast (HotkeyListCtrl->GetItemData (item)); + hotkey->VirtualKeyCode = 0; + hotkey->VirtualKeyModifiers = 0; + + vector fields (HotkeyListCtrl->GetColumnCount()); + fields[ColumnHotkeyDescription] = hotkey->Description; + fields[ColumnHotkey] = hotkey->GetShortcutString(); + Gui->UpdateListCtrlItem (HotkeyListCtrl, item, fields); + + UpdateHotkeyButtons(); + } +#endif + } + + void PreferencesDialog::OnSelectPkcs11ModuleButtonClick (wxCommandEvent& event) + { + list < pair > extensions; + wxString libExtension; + libExtension = wxDynamicLibrary::CanonicalizeName (L"x"); + +#ifdef TC_MACOSX + extensions.push_back (make_pair (L"dylib", LangString["DLL_FILES"])); +#endif + if (!libExtension.empty()) + { + extensions.push_back (make_pair (libExtension.Mid (libExtension.find (L'.') + 1), LangString["DLL_FILES"])); + extensions.push_back (make_pair (L"*", L"")); + } + + string libDir; + +#ifdef TC_WINDOWS + + char sysDir[TC_MAX_PATH]; + GetSystemDirectoryA (sysDir, sizeof (sysDir)); + libDir = sysDir; + +#elif defined (TC_MACOSX) + libDir = "/usr/local/lib"; +#elif defined (TC_UNIX) + libDir = "/usr/lib"; +#endif + + Gui->ShowInfo ("SELECT_PKCS11_MODULE_HELP"); + + FilePathList files = Gui->SelectFiles (this, LangString["SELECT_PKCS11_MODULE"], false, false, extensions, libDir); + if (!files.empty()) + Pkcs11ModulePathTextCtrl->SetValue (wstring (*files.front())); + } + + void PreferencesDialog::OnTimer () + { +#ifdef TC_WINDOWS + for (UINT vKey = 0; vKey <= 0xFF; vKey++) + { + if (GetAsyncKeyState (vKey) < 0) + { + bool shift = wxGetKeyState (WXK_SHIFT); + bool control = wxGetKeyState (WXK_CONTROL); + bool alt = wxGetKeyState (WXK_ALT); + bool win = wxGetKeyState (WXK_WINDOWS_LEFT) || wxGetKeyState (WXK_WINDOWS_RIGHT); + + if (!Hotkey::GetVirtualKeyCodeString (vKey).empty()) // If the key is allowed and its name has been resolved + { + LastVirtualKeyPressed = vKey; + + HotkeyShiftCheckBox->SetValue (shift); + HotkeyControlCheckBox->SetValue (control); + HotkeyAltCheckBox->SetValue (alt); + HotkeyWinCheckBox->SetValue (win); + + HotkeyTextCtrl->ChangeValue (Hotkey::GetVirtualKeyCodeString (LastVirtualKeyPressed)); + UpdateHotkeyButtons(); + return; + } + } + } +#endif + } + + void PreferencesDialog::UpdateHotkeyButtons() + { + AssignHotkeyButton->Enable (!HotkeyTextCtrl->IsEmpty() && HotkeyListCtrl->GetSelectedItemCount() > 0); + + bool remove = false; + foreach (long item, Gui->GetListCtrlSelectedItems (HotkeyListCtrl)) + { + if (reinterpret_cast (HotkeyListCtrl->GetItemData (item))->VirtualKeyCode != 0) + remove = true; + } + RemoveHotkeyButton->Enable (remove); + } +} diff --git a/src/Main/Forms/PreferencesDialog.h b/src/Main/Forms/PreferencesDialog.h new file mode 100644 index 00000000..412d7c44 --- /dev/null +++ b/src/Main/Forms/PreferencesDialog.h @@ -0,0 +1,60 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_PreferencesDialog +#define TC_HEADER_Main_Forms_PreferencesDialog + +#include "Forms.h" +#include "Main/Main.h" +#include "KeyfilesPanel.h" + +namespace TrueCrypt +{ + class PreferencesDialog : public PreferencesDialogBase + { + public: + PreferencesDialog (wxWindow* parent); + ~PreferencesDialog (); + + void SelectPage (wxPanel *page); + + protected: + void OnAssignHotkeyButtonClick (wxCommandEvent& event); + void OnBackgroundTaskEnabledCheckBoxClick (wxCommandEvent& event); + void OnCancelButtonClick (wxCommandEvent& event) { Close(); } + void OnClose (wxCloseEvent& event); + void OnDismountOnPowerSavingCheckBoxClick (wxCommandEvent& event); + void OnDismountOnScreenSaverCheckBoxClick (wxCommandEvent& event); + void OnForceAutoDismountCheckBoxClick (wxCommandEvent& event); + void OnHotkeyListItemDeselected (wxListEvent& event); + void OnHotkeyListItemSelected (wxListEvent& event); + void OnNoHardwareCryptoCheckBoxClick (wxCommandEvent& event); + void OnNoKernelCryptoCheckBoxClick (wxCommandEvent& event); + void OnOKButtonClick (wxCommandEvent& event); + void OnPreserveTimestampsCheckBoxClick (wxCommandEvent& event); + void OnRemoveHotkeyButtonClick (wxCommandEvent& event); + void OnSelectPkcs11ModuleButtonClick (wxCommandEvent& event); + void OnTimer (); + void UpdateHotkeyButtons(); + + enum + { + ColumnHotkeyDescription = 0, + ColumnHotkey + }; + + KeyfilesPanel *DefaultKeyfilesPanel; + int LastVirtualKeyPressed; + auto_ptr mTimer; + UserPreferences Preferences; + bool RestoreValidatorBell; + HotkeyList UnregisteredHotkeys; + }; +} + +#endif // TC_HEADER_Main_Forms_PreferencesDialog diff --git a/src/Main/Forms/ProgressWizardPage.cpp b/src/Main/Forms/ProgressWizardPage.cpp new file mode 100644 index 00000000..113d9872 --- /dev/null +++ b/src/Main/Forms/ProgressWizardPage.cpp @@ -0,0 +1,80 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "ProgressWizardPage.h" + +namespace TrueCrypt +{ + ProgressWizardPage::ProgressWizardPage (wxPanel* parent, bool enableAbort) + : ProgressWizardPageBase (parent), + PreviousGaugeValue (0), + ProgressBarRange (1), + RealProgressBarRange (1) + { +#ifdef TC_MACOSX + ProgressGauge->SetMinSize (wxSize (-1, 12)); // OS X apparently supports only up to 12px thick progress bars +#else + ProgressGauge->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 2)); +#endif + + ProgressValue.Set (0); + ProgressGauge->SetValue (0); + + AbortButton->Show (enableAbort); + + class Timer : public wxTimer + { + public: + Timer (ProgressWizardPage *page) : Page (page) { } + + void Notify() + { + Page->OnTimer(); + } + + ProgressWizardPage *Page; + }; + + mTimer.reset (dynamic_cast (new Timer (this))); + mTimer->Start (30); + } + + void ProgressWizardPage::OnAbortButtonClick (wxCommandEvent& event) + { + AbortEvent.Raise(); + } + + void ProgressWizardPage::OnTimer () + { + uint64 value = ProgressValue.Get(); + int gaugeValue = static_cast (value * RealProgressBarRange / ProgressBarRange); + + if (value == ProgressBarRange) + gaugeValue = RealProgressBarRange; // Prevent round-off error + + if (gaugeValue != PreviousGaugeValue) + { + ProgressGauge->SetValue (gaugeValue); + PreviousGaugeValue = gaugeValue; + } + } + + void ProgressWizardPage::SetMaxStaticTextWidth (int width) + { + InfoStaticText->Wrap (width); + } + + void ProgressWizardPage::SetProgressRange (uint64 progressBarRange) + { + ProgressBarRange = progressBarRange; + RealProgressBarRange = ProgressGauge->GetSize().GetWidth(); + ProgressGauge->SetRange (RealProgressBarRange); + } +} diff --git a/src/Main/Forms/ProgressWizardPage.h b/src/Main/Forms/ProgressWizardPage.h new file mode 100644 index 00000000..541edd66 --- /dev/null +++ b/src/Main/Forms/ProgressWizardPage.h @@ -0,0 +1,42 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_ProgressWizardPage +#define TC_HEADER_Main_Forms_ProgressWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + class ProgressWizardPage : public ProgressWizardPageBase + { + public: + ProgressWizardPage (wxPanel* parent, bool enableAbort = false); + ~ProgressWizardPage () { } + + void EnableAbort (bool enable = true) { AbortButton->Enable (enable); } + bool IsValid () { return true; } + void SetMaxStaticTextWidth (int width); + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + void SetProgressRange (uint64 progressBarRange); + + Event AbortEvent; + SharedVal ProgressValue; + + protected: + void OnAbortButtonClick (wxCommandEvent& event); + void OnTimer (); + + auto_ptr mTimer; + int PreviousGaugeValue; + uint64 ProgressBarRange; + int RealProgressBarRange; + }; +} + +#endif // TC_HEADER_Main_Forms_ProgressWizardPage diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp new file mode 100644 index 00000000..44e45db8 --- /dev/null +++ b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp @@ -0,0 +1,93 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "Volume/Hash.h" +#include "RandomPoolEnrichmentDialog.h" + +namespace TrueCrypt +{ + RandomPoolEnrichmentDialog::RandomPoolEnrichmentDialog (wxWindow* parent) : RandomPoolEnrichmentDialogBase (parent) + { + RandomNumberGenerator::Start(); + + Hashes = Hash::GetAvailableAlgorithms(); + foreach (shared_ptr hash, Hashes) + { + if (!hash->IsDeprecated()) + { + HashChoice->Append (hash->GetName(), hash.get()); + + if (typeid (*hash) == typeid (*RandomNumberGenerator::GetHash())) + HashChoice->Select (HashChoice->GetCount() - 1); + } + } + + ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24)); + MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70); + + MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24)); + + Layout(); + Fit(); + Center(); + + foreach (wxWindow *c, this->GetChildren()) + c->Connect (wxEVT_MOTION, wxMouseEventHandler (RandomPoolEnrichmentDialog::OnMouseMotion), nullptr, this); + } + + RandomPoolEnrichmentDialog::~RandomPoolEnrichmentDialog () + { + } + + void RandomPoolEnrichmentDialog::OnHashSelected (wxCommandEvent& event) + { + RandomNumberGenerator::SetHash (Gui->GetSelectedData (HashChoice)->GetNew()); + } + + void RandomPoolEnrichmentDialog::OnMouseMotion (wxMouseEvent& event) + { + event.Skip(); + + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&event), sizeof (event))); + + long coord = event.GetX(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&coord), sizeof (coord))); + coord = event.GetY(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&coord), sizeof (coord))); + + if (ShowRandomPoolCheckBox->IsChecked()) + ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24)); + } + + void RandomPoolEnrichmentDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event) + { + if (!event.IsChecked()) + RandomPoolStaticText->SetLabel (L""); + } + + void RandomPoolEnrichmentDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer) + { + wxString str; + + for (size_t i = 0; i < buffer.Size(); ++i) + { + str += wxString::Format (L"%02X", buffer[i]); + } + + str += L".."; + + textCtrl->SetLabel (str.c_str()); + + for (size_t i = 0; i < str.size(); ++i) + { + str[i] = L'X'; + } + } +} diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.h b/src/Main/Forms/RandomPoolEnrichmentDialog.h new file mode 100644 index 00000000..8a951bcb --- /dev/null +++ b/src/Main/Forms/RandomPoolEnrichmentDialog.h @@ -0,0 +1,33 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_RandomPoolEnrichmentDialog +#define TC_HEADER_Main_Forms_RandomPoolEnrichmentDialog + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class RandomPoolEnrichmentDialog : public RandomPoolEnrichmentDialogBase + { + public: + RandomPoolEnrichmentDialog (wxWindow* parent); + ~RandomPoolEnrichmentDialog (); + + protected: + void OnHashSelected (wxCommandEvent& event); + void OnMouseMotion (wxMouseEvent& event); + void OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event); + void ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer); + + HashList Hashes; + }; +} + +#endif // TC_HEADER_Main_Forms_RandomPoolEnrichmentDialog diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp new file mode 100644 index 00000000..5978b0b1 --- /dev/null +++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp @@ -0,0 +1,197 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "Common/SecurityToken.h" +#include "NewSecurityTokenKeyfileDialog.h" +#include "SecurityTokenKeyfilesDialog.h" + +namespace TrueCrypt +{ + SecurityTokenKeyfilesDialog::SecurityTokenKeyfilesDialog (wxWindow* parent, bool selectionMode) + : SecurityTokenKeyfilesDialogBase (parent) + { + if (selectionMode) + SetTitle (LangString["SELECT_TOKEN_KEYFILES"]); + + list colPermilles; + + SecurityTokenKeyfileListCtrl->InsertColumn (ColumnSecurityTokenSlotId, LangString["TOKEN_SLOT_ID"], wxLIST_FORMAT_CENTER, 1); + colPermilles.push_back (102); + SecurityTokenKeyfileListCtrl->InsertColumn (ColumnSecurityTokenLabel, LangString["TOKEN_NAME"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (368); + SecurityTokenKeyfileListCtrl->InsertColumn (ColumnSecurityTokenKeyfileLabel, LangString["TOKEN_DATA_OBJECT_LABEL"], wxLIST_FORMAT_LEFT, 1); + colPermilles.push_back (529); + + FillSecurityTokenKeyfileListCtrl(); + + Gui->SetListCtrlWidth (SecurityTokenKeyfileListCtrl, 65); + Gui->SetListCtrlHeight (SecurityTokenKeyfileListCtrl, 16); + Gui->SetListCtrlColumnWidths (SecurityTokenKeyfileListCtrl, colPermilles); + + Fit(); + Layout(); + Center(); + + DeleteButton->Disable(); + ExportButton->Disable(); + OKButton->Disable(); + OKButton->SetDefault(); + } + + void SecurityTokenKeyfilesDialog::FillSecurityTokenKeyfileListCtrl () + { + wxBusyCursor busy; + + SecurityTokenKeyfileListCtrl->DeleteAllItems(); + SecurityTokenKeyfileList = SecurityToken::GetAvailableKeyfiles(); + + size_t i = 0; + foreach (const SecurityTokenKeyfile &key, SecurityTokenKeyfileList) + { + vector fields (SecurityTokenKeyfileListCtrl->GetColumnCount()); + + fields[ColumnSecurityTokenSlotId] = StringConverter::ToWide ((uint64) key.SlotId); + fields[ColumnSecurityTokenLabel] = key.Token.Label; + fields[ColumnSecurityTokenKeyfileLabel] = key.Id; + + Gui->AppendToListCtrl (SecurityTokenKeyfileListCtrl, fields, 0, &SecurityTokenKeyfileList[i++]); + } + } + + void SecurityTokenKeyfilesDialog::OnDeleteButtonClick (wxCommandEvent& event) + { + try + { + if (!Gui->AskYesNo (LangString["CONFIRM_SEL_FILES_DELETE"])) + return; + + wxBusyCursor busy; + + foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl)) + { + SecurityToken::DeleteKeyfile (*reinterpret_cast (SecurityTokenKeyfileListCtrl->GetItemData (item))); + } + + FillSecurityTokenKeyfileListCtrl(); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void SecurityTokenKeyfilesDialog::OnExportButtonClick (wxCommandEvent& event) + { + try + { + foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl)) + { + SecurityTokenKeyfile *keyfile = reinterpret_cast (SecurityTokenKeyfileListCtrl->GetItemData (item)); + + FilePathList files = Gui->SelectFiles (this, wxEmptyString, true); + + if (!files.empty()) + { + wxBusyCursor busy; + + vector keyfileData; + SecurityToken::GetKeyfileData (*keyfile, keyfileData); + + BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size()); + finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); }); + + File keyfile; + keyfile.Open (*files.front(), File::CreateWrite); + keyfile.Write (keyfileDataBuf); + } + else + break; + + Gui->ShowInfo ("KEYFILE_EXPORTED"); + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void SecurityTokenKeyfilesDialog::OnImportButtonClick (wxCommandEvent& event) + { + try + { + FilePathList keyfilePaths = Gui->SelectFiles (this, LangString["SELECT_KEYFILES"], false); + + if (keyfilePaths.empty()) + return; + + FilePath keyfilePath = *keyfilePaths.front(); + + File keyfile; + keyfile.Open (keyfilePath, File::OpenRead, File::ShareReadWrite, File::PreserveTimestamps); + + if (keyfile.Length() > 0) + { + vector keyfileData (keyfile.Length()); + BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size()); + + keyfile.ReadCompleteBuffer (keyfileDataBuf); + finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); }); + + NewSecurityTokenKeyfileDialog newKeyfileDialog (this, keyfilePath.ToBaseName()); + + if (newKeyfileDialog.ShowModal() == wxID_OK) + { + wxBusyCursor busy; + SecurityToken::CreateKeyfile (newKeyfileDialog.GetSelectedSlotId(), keyfileData, StringConverter::ToSingle (newKeyfileDialog.GetKeyfileName())); + + FillSecurityTokenKeyfileListCtrl(); + } + } + else + throw InsufficientData (SRC_POS, keyfilePath); + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void SecurityTokenKeyfilesDialog::OnListItemDeselected (wxListEvent& event) + { + if (SecurityTokenKeyfileListCtrl->GetSelectedItemCount() == 0) + { + DeleteButton->Disable(); + ExportButton->Disable(); + OKButton->Disable(); + } + } + + void SecurityTokenKeyfilesDialog::OnListItemSelected (wxListEvent& event) + { + if (event.GetItem().GetData() != (wxUIntPtr) nullptr) + { + DeleteButton->Enable(); + ExportButton->Enable(); + OKButton->Enable(); + } + } + + void SecurityTokenKeyfilesDialog::OnOKButtonClick () + { + foreach (long item, Gui->GetListCtrlSelectedItems (SecurityTokenKeyfileListCtrl)) + { + SecurityTokenKeyfile *key = reinterpret_cast (SecurityTokenKeyfileListCtrl->GetItemData (item)); + SelectedSecurityTokenKeyfilePaths.push_back (*key); + } + + EndModal (wxID_OK); + } +} diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.h b/src/Main/Forms/SecurityTokenKeyfilesDialog.h new file mode 100644 index 00000000..2fd78349 --- /dev/null +++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.h @@ -0,0 +1,47 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_SecurityTokenKeyfilesDialog +#define TC_HEADER_Main_Forms_SecurityTokenKeyfilesDialog + +#include "Forms.h" +#include "Common/SecurityToken.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class SecurityTokenKeyfilesDialog : public SecurityTokenKeyfilesDialogBase + { + public: + SecurityTokenKeyfilesDialog (wxWindow* parent, bool selectionMode = true); + list GetSelectedSecurityTokenKeyfilePaths() const { return SelectedSecurityTokenKeyfilePaths; } + + protected: + enum + { + ColumnSecurityTokenSlotId = 0, + ColumnSecurityTokenLabel, + ColumnSecurityTokenKeyfileLabel, + }; + + void FillSecurityTokenKeyfileListCtrl (); + void OnDeleteButtonClick (wxCommandEvent& event); + void OnExportButtonClick (wxCommandEvent& event); + void OnImportButtonClick (wxCommandEvent& event); + void OnListItemActivated (wxListEvent& event) { OnOKButtonClick(); } + void OnListItemDeselected (wxListEvent& event); + void OnListItemSelected (wxListEvent& event); + void OnOKButtonClick (); + void OnOKButtonClick (wxCommandEvent& event) { OnOKButtonClick(); } + + vector SecurityTokenKeyfileList; + list SelectedSecurityTokenKeyfilePaths; + }; +} + +#endif // TC_HEADER_Main_Forms_SecurityTokenKeyfilesDialog diff --git a/src/Main/Forms/SelectDirectoryWizardPage.cpp b/src/Main/Forms/SelectDirectoryWizardPage.cpp new file mode 100644 index 00000000..a6a3ab02 --- /dev/null +++ b/src/Main/Forms/SelectDirectoryWizardPage.cpp @@ -0,0 +1,32 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "SelectDirectoryWizardPage.h" + +namespace TrueCrypt +{ + bool SelectDirectoryWizardPage::IsValid () + { + if (!DirectoryTextCtrl->IsEmpty()) + { + return FilesystemPath (DirectoryTextCtrl->GetValue()).IsDirectory(); + } + + return false; + } + + void SelectDirectoryWizardPage::OnBrowseButtonClick (wxCommandEvent& event) + { + DirectoryPath dir = Gui->SelectDirectory (this); + + if (!dir.IsEmpty()) + DirectoryTextCtrl->SetValue (wstring (dir)); + } +} diff --git a/src/Main/Forms/SelectDirectoryWizardPage.h b/src/Main/Forms/SelectDirectoryWizardPage.h new file mode 100644 index 00000000..52335fc5 --- /dev/null +++ b/src/Main/Forms/SelectDirectoryWizardPage.h @@ -0,0 +1,33 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_SelectDirectoryWizardPage +#define TC_HEADER_Main_Forms_SelectDirectoryWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + class SelectDirectoryWizardPage : public SelectDirectoryWizardPageBase + { + public: + SelectDirectoryWizardPage (wxPanel* parent) : SelectDirectoryWizardPageBase (parent) { } + + DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue()); } + bool IsValid (); + void SetDirectory (const DirectoryPath &path) { DirectoryTextCtrl->SetValue (wstring (path)); } + void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + + protected: + void OnBrowseButtonClick (wxCommandEvent& event); + void OnDirectoryTextChanged (wxCommandEvent& event) { PageUpdatedEvent.Raise(); } + }; +} + +#endif // TC_HEADER_Main_Forms_SelectDirectoryWizardPage diff --git a/src/Main/Forms/SingleChoiceWizardPage.h b/src/Main/Forms/SingleChoiceWizardPage.h new file mode 100644 index 00000000..43536eca --- /dev/null +++ b/src/Main/Forms/SingleChoiceWizardPage.h @@ -0,0 +1,116 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_SingleChoiceWizardPage +#define TC_HEADER_Main_Forms_SingleChoiceWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + template + class SingleChoiceWizardPage : public SingleChoiceWizardPageBase + { + public: + SingleChoiceWizardPage (wxPanel* parent, const wxString &groupBoxText = wxEmptyString, bool choiceTextBold = false) + : SingleChoiceWizardPageBase (parent), + ChoiceTextBold (choiceTextBold) + { + if (!groupBoxText.empty()) + { + OuterChoicesSizer->Remove (ChoicesSizer); + ChoicesSizer = new wxStaticBoxSizer (wxVERTICAL, this, groupBoxText); + OuterChoicesSizer->Add (ChoicesSizer, 0, wxEXPAND, 5); + } + } + + void AddChoice (ChoiceType choice, const wxString &choiceText, const wxString &infoText = wxEmptyString, const wchar_t *infoLinkId = nullptr, const wxString &infoLinkText = wxEmptyString) + { + assert (RadioButtonMap.find (choice) == RadioButtonMap.end()); + + wxRadioButton *radioButton = new wxRadioButton (this, wxID_ANY, choiceText); + if (RadioButtonMap.empty()) + radioButton->SetValue (true); + + RadioButtonMap[choice] = radioButton; + + if (ChoiceTextBold) + { + wxFont buttonFont = radioButton->GetFont(); + buttonFont.SetWeight (wxFONTWEIGHT_BOLD); + radioButton->SetFont (buttonFont); + } + + ChoicesSizer->Add (radioButton, 0, wxALL, 5); + + wxBoxSizer *infoSizer = new wxBoxSizer (wxVERTICAL); + + wxStaticText *infoStaticText = new wxStaticText (this, wxID_ANY, infoText, wxDefaultPosition, wxDefaultSize, 0); + ChoiceInfoTexts.push_back (infoStaticText); + + infoSizer->Add (infoStaticText, 0, wxALL, 5); + ChoicesSizer->Add (infoSizer, 0, wxEXPAND | wxLEFT, Gui->GetCharWidth (this) * 3); + + if (infoLinkId) + { + wxHyperlinkCtrl *hyperlink = Gui->CreateHyperlink (this, infoLinkId, infoLinkText); + infoSizer->Add (hyperlink, 0, wxALL, 5); + hyperlink->Connect (wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler (SingleChoiceWizardPage::OnChoiceHyperlinkClick), nullptr, this); + } + + ChoicesSizer->Add (1, Gui->GetCharHeight (this) * 1, 0, wxEXPAND, 5); + } + + ChoiceType GetSelection () const + { + typedef pair MapPair; + foreach (MapPair p, RadioButtonMap) + { + if (p.second->GetValue()) + return p.first; + } + + throw NoItemSelected (SRC_POS); + } + + bool IsValid () + { + return true; + } + + void SetMaxStaticTextWidth (int width) + { + InfoStaticText->Wrap (width); + + foreach (wxStaticText *infoText, ChoiceInfoTexts) + infoText->Wrap (width - Gui->GetCharWidth (this) * 3); + } + + void SetPageText (const wxString &text) + { + InfoStaticText->SetLabel (text); + } + + void SetSelection (ChoiceType choice) + { + RadioButtonMap[choice]->SetValue (true); + } + + protected: + void OnChoiceHyperlinkClick (wxHyperlinkEvent &event) + { + Gui->OpenHomepageLink (this, event.GetURL()); + } + + bool ChoiceTextBold; + list ChoiceInfoTexts; + map RadioButtonMap; + }; +} + +#endif // TC_HEADER_Main_Forms_SingleChoiceWizardPage diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp new file mode 100644 index 00000000..9d8fb6f9 --- /dev/null +++ b/src/Main/Forms/TrueCrypt.fbp @@ -0,0 +1,17436 @@ + + + + + + C++ + 1 + UTF-8 + connect + Forms + 1000 + none + 1 + TrueCrypt + "TrueCrypt" + . + #include "System.h" + 1 + 1 + 0 + + + wxBOTH + + 1 + + + + 0 + wxID_ANY + + -1,496 + MainFrameBase + + -1,496 + wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU + + TrueCrypt + + + + wxTAB_TRAVERSAL + 1 + OnActivate + + + OnClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + MainMenuBar + + + MainMenuBar + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &Volumes + VolumesMenu + protected + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Create New Volume... + CreateNewVolumeMenuItem + none + + + OnCreateVolumeButtonClick + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Mount Volume + MountVolumeMenuItem + protected + + + OnMountVolumeMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Auto-Mount All Device-Hosted Volumes + AutoMountDevicesMenuItem + none + + + OnMountAllDevicesButtonClick + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Dismount Volume + DismountVolumeMenuItem + protected + + + OnDismountVolumeMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Dismount All Mounted Volumes + DismountAllMenuItem + protected + + + OnDismountAllButtonClick + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Change Volume Password... + ChangePasswordMenuItem + none + + + OnChangePasswordMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Change Header Key Derivation Algorithm... + ChangePkcs5PrfMenuItem + none + + + OnChangePkcs5PrfMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Add/Remove Keyfiles to/from Volume... + ChangeKeyfilesMenuItem + none + + + OnChangeKeyfilesMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Remove All Keyfiles from Volume... + RemoveKeyfilesMenuItem + none + + + OnRemoveKeyfilesMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Volume Properties... + VolumePropertiesMenuItem + protected + + + OnVolumePropertiesButtonClick + + + + + &Favorites + FavoritesMenu + protected + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Add Selected Volume to Favorites... + AddToFavoritesMenuItem + protected + + + OnAddToFavoritesMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Add All Mounted Volumes to Favorites... + AddAllMountedToFavoritesMenuItem + protected + + + OnAddAllMountedToFavoritesMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Organize Favorite Volumes... + OrganizeFavoritesMenuItem + none + + + OnOrganizeFavoritesMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Mount Favorite Volumes + MountAllFavoritesMenuItem + none + + + OnMountAllFavoritesMenuItemSelected + + + + none + + + + T&ools + ToolsMenu + protected + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Benchmark... + BenchmarkMenuItem + none + + + OnBenchmarkMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Test Vectors... + EncryptionTestMenuItem + none + + + OnEncryptionTestMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Volume Creation Wizard + VolumeCreationWizardMenuItem + none + + + OnCreateVolumeButtonClick + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Backup Volume Header... + BackupVolumeHeadersMenuItem + protected + + + OnBackupVolumeHeadersMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Restore Volume Header... + RestoreVolumeHeaderMenuItem + protected + + + OnRestoreVolumeHeaderMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Keyfile Generator + CreateKeyfileMenuItem + none + + + OnCreateKeyfileMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Manage Security Token Keyfiles... + ManageSecurityTokenKeyfilesMenuItem + none + + + OnManageSecurityTokenKeyfilesMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Close All Security Token Sessions + CloseAllSecurityTokenSessionsMenuItem + none + + + OnCloseAllSecurityTokenSessionsMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Wipe Cached Passwords + WipeCachedPasswordsMenuItem + protected + + + OnWipeCacheButtonClick + + + + + Settin&gs + SettingsMenu + protected + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Hotkeys... + HotkeysMenuItem + protected + + + OnHotkeysMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Default Keyfiles... + DefaultKeyfilesMenuItem + none + + + OnDefaultKeyfilesMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Security Tokens... + SecurityTokenPreferencesMenuItem + none + + + OnSecurityTokenPreferencesMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_PREFERENCES + wxITEM_NORMAL + &Preferences... + PreferencesMenuItem + protected + + + OnPreferencesMenuItemSelected + + + + + &Help + HelpMenu + protected + + + 0 + 1 + + wxID_HELP + wxITEM_NORMAL + User's Guide + UserGuideMenuItem + none + + + OnUserGuideMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Online Help + OnlineHelpMenuItem + none + + + OnOnlineHelpMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Beginner's Tutorial + BeginnersTutorialMenuItem + none + + + OnBeginnersTutorialMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Frequently Asked Questions + FaqMenuItem + none + + + OnFaqMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + TrueCrypt Website + WebsiteMenuItem + none + + + OnWebsiteMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Downloads + DownloadsMenuItem + none + + + OnDownloadsMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + News + NewsMenuItem + none + + + OnNewsMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Version History + VersionHistoryMenuItem + none + + + OnVersionHistoryMenuItemSelected + + + + none + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Contact + ContactMenuItem + none + + + OnContactMenuItemSelected + + + + + 0 + 1 + + wxID_ANY + wxITEM_NORMAL + Legal Notices + LegalNoticesMenuItem + none + + + OnLegalNoticesMenuItemSelected + + + + + 0 + 1 + + wxID_ABOUT + wxITEM_NORMAL + About + AboutMenuItem + none + + + OnAboutMenuItemSelected + + + + + + + bSizer1 + wxVERTICAL + none + + 0 + wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + MainPanel + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer2 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer48 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + wxID_ANY + + + sbSizer1 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + SlotListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + OnListItemActivated + OnListItemDeselected + + + OnListItemRightClick + OnListItemSelected + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + wxID_ANY + + + LowStaticBoxSizer + wxVERTICAL + protected + + + 2 + wxEXPAND|wxTOP + 0 + + + HigherButtonSizer + wxVERTICAL + protected + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 3 + 0 + + gSizer1 + none + 1 + 0 + + 5 + + 0 + + 138,34 + bSizer17 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + &Create Volume + + -1,-1 + CreateVolumeButton + protected + + + + + + + + + OnCreateVolumeButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 138,34 + bSizer18 + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + &Volume Properties... + + -1,-1 + VolumePropertiesButton + protected + + + + + + + + + OnVolumePropertiesButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT + 0 + + 138,34 + bSizer19 + wxVERTICAL + none + + 5 + wxALL|wxALIGN_RIGHT|wxEXPAND + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + &Wipe Cache + + -1,-1 + WipeCacheButton + protected + + + + + + + + + OnWipeCacheButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + wxID_ANY + Volume + + VolumeStaticBoxSizer + wxVERTICAL + protected + + + 4 + wxEXPAND|wxALL + 1 + + + wxBOTH + 1 + 0 + 0 + + VolumeGridBagSizer + wxFLEX_GROWMODE_SPECIFIED + protected + 0 + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + 2 + + + + + 1 + + + 0 + wxID_ANY + + 42,52 + LogoBitmap + protected + + + + + + + wxSUNKEN_BORDER + + + + + + + + + OnLogoBitmapClick + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxEXPAND|wxALL + 0 + 1 + + + + + 1 + + + 0 + wxID_ANY + + + VolumePathComboBox + protected + + + wxCB_DROPDOWN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 3 + wxEXPAND + 0 + 1 + + 138,34 + bSizer191 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Select &File... + + -1,-1 + SelectFileButton + protected + + + + + + + + + OnSelectFileButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxBOTTOM|wxRIGHT|wxLEFT + 1 + 1 + + + 0 + + 1 + + + 0 + wxID_ANY + &Never save history + + + NoHistoryCheckBox + protected + + + + + + + + + + OnNoHistoryCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_RIGHT + 1 + 1 + + 138,34 + bSizer20 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Volume &Tools... + + -1,-1 + VolumeToolsButton + protected + + + + + + + + + OnVolumeToolsButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 3 + wxEXPAND + 1 + 1 + + 138,34 + bSizer21 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Select D&evice... + + -1,-1 + SelectDeviceButton + protected + + + + + + + + + OnSelectDeviceButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 0 + + 4 + 0 + + gSizer2 + none + 1 + 0 + + 0 + wxEXPAND + 1 + + wxID_ANY + + 139,-1 + sbSizer4 + wxVERTICAL + none + + + 2 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP + 1 + + + + 1 + 1 + + + 0 + wxID_ANY + &Mount + + -1,32 + VolumeButton + protected + + + + + + + + + OnVolumeButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 1 + + wxID_ANY + + -1,-1 + sbSizer41 + wxVERTICAL + none + + + 2 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + &Auto-Mount Devices + + -1,32 + MountAllDevicesButton + protected + + + + + + + + + OnMountAllDevicesButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 1 + + wxID_ANY + + -1,-1 + sbSizer42 + wxVERTICAL + none + + + 2 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Di&smount All + + -1,32 + DismountAllButton + protected + + + + + + + + + OnDismountAllButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxEXPAND + 1 + + wxID_ANY + + -1,-1 + sbSizer43 + wxVERTICAL + none + + + 2 + wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + E&xit + + -1,32 + ExitButton + protected + + + + + + + + + OnExitButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + WizardFrameBase + + -1,-1 + wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU + + + + + + wxTAB_TRAVERSAL + 1 + OnActivate + + + OnClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer92 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + MainPanel + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + OnMouseMotion + + + + + + + + + + + + bSizer63 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer64 + wxVERTICAL + none + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 1 + + wxID_ANY + + + sbSizer27 + wxHORIZONTAL + none + + + 5 + wxALL|wxEXPAND + 0 + + + + + 1 + + + 0 + wxID_ANY + + + WizardBitmap + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxLEFT + 1 + + + bSizer66 + wxVERTICAL + none + + 5 + wxLEFT + 0 + + + bSizer126 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 1 + + Times New Roman,90,90,16,70,0 + 0 + wxID_ANY + Page Title + + + PageTitleStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 1 + + + PageSizer + wxVERTICAL + protected + + + + + + + + 5 + wxEXPAND|wxALIGN_RIGHT|wxALL + 0 + + + bSizer70 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 0 + 1 + + + 0 + wxID_HELP + &Help + + + HelpButton + protected + + + + + + + + + OnHelpButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxALIGN_RIGHT + 0 + + 0 + protected + 0 + + + + 5 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + < &Prev + + + PreviousButton + protected + + + + + + + + + OnPreviousButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + &Next > + + + NextButton + protected + + + + + + + + wxWANTS_CHARS + OnNextButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxALIGN_RIGHT + 0 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + CancelButton + protected + + + + + + + + + OnCancelButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + AboutDialogBase + + + wxDEFAULT_DIALOG_STYLE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer116 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer117 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + -1,78 + bSizer120 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 10,108,206 + + 1 + + + 0 + wxID_ANY + + + m_panel14 + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer121 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + 0 + protected + 0 + + + + 8 + wxEXPAND|wxLEFT + 0 + + + bSizer122 + wxVERTICAL + none + + 10 + wxALL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + LogoBitmap + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 15 + wxALL|wxEXPAND + 1 + + + bSizer118 + wxVERTICAL + none + + 5 + wxEXPAND|wxLEFT + 1 + + + bSizer123 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + + + + VersionStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxTOP + 0 + + 0 + protected + 0 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + + + + CopyrightStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + wxTOP + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxSYS_COLOUR_WINDOWTEXT + wxID_ANY + + + + WebsiteHyperlink + wxSYS_COLOUR_WINDOWTEXT + protected + + + wxHL_DEFAULT_STYLE + + + . + wxSYS_COLOUR_WINDOWTEXT + + + + + + + OnWebsiteHyperlinkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline3 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + CreditsTextCtrl + protected + + + wxTE_MULTILINE|wxTE_READONLY + + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP + 0 + + 0 + protected + 0 + + + + 3 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline4 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline5 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + bSizer119 + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT + 0 + + 0 + protected + 0 + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + BenchmarkDialogBase + + + wxDEFAULT_DIALOG_STYLE + + TrueCrypt - Encryption Algorithm Benchmark + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer153 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer154 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer155 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Buffer Size: + + + m_staticText54 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + BufferSizeChoice + protected + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline6 + none + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer156 + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + BenchmarkListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + RightSizer + wxVERTICAL + protected + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_OK + Benchmark + + + BenchmarkButton + protected + + + + + + + + + OnBenchmarkButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Close + + + CancelButton + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + -1,-1 + + BenchmarkNoteStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + ChangePasswordDialogBase + + + wxDEFAULT_DIALOG_STYLE + + + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer30 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer31 + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer32 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + wxID_ANY + Current + + CurrentSizer + wxVERTICAL + protected + + + 5 + wxALIGN_RIGHT + 0 + + + CurrentPasswordPanelSizer + wxVERTICAL + protected + + + + + + 5 + wxTOP|wxEXPAND + 0 + + wxID_ANY + New + + NewSizer + wxVERTICAL + protected + + + 5 + wxALIGN_RIGHT + 0 + + + NewPasswordPanelSizer + wxVERTICAL + protected + + + + + + + + 5 + + 0 + + + bSizer33 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + protected + + + + + + + + + OnOKButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + CancelButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + wxBOTH + + 1 + + + + 0 + wxID_ANY + + -1,-1 + DeviceSelectionDialogBase + + -1,-1 + wxDEFAULT_DIALOG_STYLE + + Select a Partition or Device + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer3 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer4 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + DeviceListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + OnListItemActivated + OnListItemDeselected + + + + OnListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + StdButtons + protected + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + EncryptionTestDialogBase + + + wxDEFAULT_DIALOG_STYLE + + TrueCrypt - Test Vectors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer132 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer133 + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + + bSizer134 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Encryption algorithm: + + + m_staticText41 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + EncryptionAlgorithmChoice + protected + + 0 + + + + + + + + OnEncryptionAlgorithmSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + 1 + + 1 + + + 0 + wxID_ANY + XTS mode + + + XtsModeCheckBox + protected + + + + + + + + + + OnXtsModeCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Key (hexadecimal) + + sbSizer38 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + Courier,90,90,-1,70,0 + 0 + wxID_ANY + + 0 + + KeyTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer135 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Key size: + + + m_staticText43 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + + + + KeySizeStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + XTS mode + + sbSizer39 + wxVERTICAL + none + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Secondary key (hexadecimal) + + + m_staticText45 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + + + 1 + + Courier,90,90,-1,70,0 + 0 + wxID_ANY + + 0 + + SecondaryKeyTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Data unit number (64-bit, data unit size is 512 bytes) + + + m_staticText46 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + DataUnitNumberTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Block number: + + + m_staticText47 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + BlockNumberTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Plaintext (hexadecimal) + + sbSizer40 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + Courier,90,90,-1,70,0 + 0 + wxID_ANY + + 0 + + PlainTextTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Ciphertext (hexadecimal) + + sbSizer41 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + Courier,90,90,-1,70,0 + 0 + wxID_ANY + + 0 + + CipherTextTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer136 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Encrypt + + + EncryptButton + protected + + + + + + + + + OnEncryptButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Decrypt + + + DecryptButton + protected + + + + + + + + + OnDecryptButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Auto-Test All + + + AutoTestAllButton + protected + + + + + + + + + OnAutoTestAllButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Reset + + + ResetButton + protected + + + + + + + + + OnResetButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Close + + + CloseButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + FavoriteVolumesDialogBase + + + wxDEFAULT_DIALOG_STYLE + + Favorite Volumes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer57 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer60 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer58 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + FavoritesListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + OnListItemDeselected + + + + OnListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 4 + 0 + + gSizer5 + none + 1 + 0 + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Move &Up + + + MoveUpButton + protected + + + + + + + + + OnMoveUpButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Move &Down + + + MoveDownButton + protected + + + + + + + + + OnMoveDownButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Remove + + + RemoveButton + protected + + + + + + + + + OnRemoveButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Remove &All + + + RemoveAllButton + protected + + + + + + + + + OnRemoveAllButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 5 + wxBOTH + 2 + + 0 + + fgSizer4 + wxFLEX_GROWMODE_SPECIFIED + none + 1 + 0 + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer59 + wxVERTICAL + none + + 5 + wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + protected + + + + + + + + + OnOKButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + CancelButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + KeyfilesDialogBase + + + wxDEFAULT_DIALOG_STYLE + + Select Keyfiles + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer26 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 1 + + + UpperSizer + wxHORIZONTAL + protected + + 5 + wxEXPAND + 1 + + + PanelSizer + wxVERTICAL + protected + + + + 5 + wxEXPAND + 0 + + + bSizer22 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + CancelButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + WarningStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + + bSizer23 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + KeyfilesNoteSizer + wxVERTICAL + protected + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline1 + none + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + -1,-1 + + KeyfilesNoteStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline2 + none + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 2 + wxBOTH + 0 + + 0 + + fgSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 1 + 0 + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxSYS_COLOUR_WINDOWTEXT + wxID_ANY + More information on keyfiles + + + KeyfilesHyperlink + wxSYS_COLOUR_WINDOWTEXT + protected + + + wxHL_DEFAULT_STYLE + + + + wxSYS_COLOUR_WINDOWTEXT + + + + + + + OnKeyfilesHyperlinkClick + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Generate Random Keyfile... + + + CreateKeyfileButtton + protected + + + + + + + + + OnCreateKeyfileButttonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + KeyfileGeneratorDialogBase + + + wxDEFAULT_DIALOG_STYLE + + + + + + + + + + + + + + + + + + + + + + + + + + + OnMouseMotion + + + + + + + + + + + + MainSizer + wxVERTICAL + protected + + 5 + wxEXPAND|wxALL + 1 + + + bSizer144 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer145 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Mixing PRF: + + + m_staticText49 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + HashChoice + protected + + 0 + + + + + + + + OnHashSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + wxID_ANY + + + sbSizer43 + wxVERTICAL + none + + + 5 + wxEXPAND|wxTOP + 0 + + + bSizer147 + wxHORIZONTAL + none + + 5 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Random Pool: + + + m_staticText52 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + Courier New,90,90,-1,70,0 + 0 + wxID_ANY + + + + RandomPoolStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + 1 + + 1 + + + 0 + wxID_ANY + Show + + + ShowRandomPoolCheckBox + protected + + + + + + + + + + OnShowRandomPoolCheckBoxClicked + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + + + 1 + + + 0 + wxID_ANY + IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the keyfile. + + + MouseStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND + 0 + + + bSizer146 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Generate and Save Keyfile... + + + GenerateButton + protected + + + + + + + + + OnGenerateButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Close + + + m_button61 + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + LegalNoticesDialogBase + + + wxDEFAULT_DIALOG_STYLE + + TrueCrypt - Legal Notices + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer114 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer115 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + 0 + + LegalNoticesTextCtrl + protected + + + wxTE_MULTILINE|wxTE_READONLY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + none + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + wxBOTH + + 1 + + + + 0 + wxID_ANY + + + MountOptionsDialogBase + + -1,-1 + wxDEFAULT_DIALOG_STYLE + + Enter TrueCrypt Volume Password + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + + + + + + + OnInitDialog + + + + + + + + + + + + + + + + + + + + + + + bSizer5 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer19 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + + bSizer14 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + PasswordSizer + wxVERTICAL + protected + + + + 5 + wxEXPAND + 0 + + + bSizer9 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + protected + + + + + + + + + OnOKButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + CancelButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Op&tions + + + OptionsButton + protected + + + + + + + + + OnOptionsButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer6 + wxVERTICAL + none + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + + + 1 + + + 0 + wxID_ANY + + + OptionsPanel + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + wxID_ANY + + + OptionsSizer + wxVERTICAL + protected + + + 5 + wxTOP + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount volume as &read-only + + + ReadOnlyCheckBox + protected + + + + + + + + + + OnReadOnlyCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount volume as removable &medium + + + RemovableCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount partition &using system encryption (preboot authentication) + + + PartitionInSystemEncryptionScopeCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Hidden Volume Protection + + ProtectionSizer + wxVERTICAL + protected + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + &Protect hidden volume when mounting outer volume + + + ProtectionCheckBox + protected + + + + + + + + + + OnProtectionCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxLEFT + 1 + + + ProtectionPasswordSizer + wxVERTICAL + protected + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxSYS_COLOUR_WINDOWTEXT + wxID_ANY + What is hidden volume protection? + + + ProtectionHyperlinkCtrl + wxSYS_COLOUR_WINDOWTEXT + protected + + + wxHL_DEFAULT_STYLE + + + + wxSYS_COLOUR_WINDOWTEXT + + + + + + + OnProtectionHyperlinkClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + FilesystemSizer + wxVERTICAL + protected + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_panel8 + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + wxID_ANY + Filesystem + + sbSizer28 + wxVERTICAL + none + + + 5 + wxEXPAND|wxBOTTOM + 0 + + + bSizer54 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer55 + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Do &not mount + + + NoFilesystemCheckBox + protected + + + + + + + + + + OnNoFilesystemCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 0,0 + wxBOTH + 1 + + 0 + + FilesystemOptionsSizer + wxFLEX_GROWMODE_SPECIFIED + protected + 0 + + 5 + 1 + 0 + wxEXPAND|wxTOP + 0 + 1 + + + FilesystemSpacer + wxVERTICAL + protected + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + 1 + 1 + + + + 1 + + + 0 + wxID_ANY + Mount at directory: + + + MountPointTextCtrlStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + 1 + + + + 1 + + + 0 + wxID_ANY + + 0 + + MountPointTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 1 + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Se&lect... + + + MountPointButton + protected + + + + + + + + + OnMountPointButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxLEFT + 2 + 1 + + + + 1 + + + 0 + wxID_ANY + Mount options: + + + FilesystemOptionsStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 2 + 1 + + + + 1 + + + 0 + wxID_ANY + + 0 + + FilesystemOptionsTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + NewSecurityTokenKeyfileDialogBase + + + wxDEFAULT_DIALOG_STYLE + + New Security Token Keyfile Properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer143 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer144 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + + + sbSizer42 + wxVERTICAL + none + + + 5 + wxEXPAND|wxTOP + 1 + + 2 + wxBOTH + + + 0 + + fgSizer7 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Security token: + + + m_staticText47 + none + + + wxALIGN_RIGHT + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + + + + 1 + + + 0 + wxID_ANY + + + SecurityTokenChoice + protected + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Keyfile name: + + + m_staticText48 + none + + + wxALIGN_RIGHT + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + KeyfileNameTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnKeyfileNameChanged + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + StdButtons + protected + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + PreferencesDialogBase + + + wxDEFAULT_DIALOG_STYLE + + Preferences + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + OnClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer32 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer41 + wxVERTICAL + none + + 5 + wxEXPAND | wxALL + 1 + + + + + 1 + + + 0 + wxID_ANY + + + PreferencesNotebook + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Security + 1 + + + + 1 + + + 0 + wxID_ANY + + + SecurityPage + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer44 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer33 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Auto-Dismount + + AutoDismountSizer + wxVERTICAL + protected + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Dismount All Volumes When + + sbSizer13 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + User logs off + + + DismountOnLogOffCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Screen saver is launched + + + DismountOnScreenSaverCheckBox + protected + + + + + + + + + + OnDismountOnScreenSaverCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + System is entering power saving mode + + + DismountOnPowerSavingCheckBox + protected + + + + + + + + + + OnDismountOnPowerSavingCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer34 + wxHORIZONTAL + none + + 5 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Auto-dismount volume after no data has been read/written to it for + + + DismountOnInactivityCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + 1 + 9999 + + 1 + + DismountOnInactivitySpinCtrl + protected + + 60,-1 + wxSP_ARROW_KEYS + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 1 + + + + 1 + + + 0 + wxID_ANY + minutes + + + m_staticText5 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Force auto-dismount even if volume contains open files or directories + + + ForceAutoDismountCheckBox + protected + + + + + + + + + + OnForceAutoDismountCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Filesystem + + FilesystemSecuritySizer + wxVERTICAL + protected + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Preserve modification timestamp of file containers + + + PreserveTimestampsCheckBox + protected + + + + + + + + + + OnPreserveTimestampsCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Password Cache + + sbSizer14 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Wipe after TrueCrypt window has been closed + + + WipeCacheOnCloseCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Wipe after volume has been auto-dismounted + + + WipeCacheOnAutoDismountCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mount Options + 0 + + + + 1 + + + 0 + wxID_ANY + + + DefaultMountOptionsPage + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer46 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer35 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Default Mount Options + + sbSizer15 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount volumes as read-only + + + MountReadOnlyCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount volumes as removable media + + + MountRemovableCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Cache passwords in memory + + + CachePasswordsCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Filesystem + + FilesystemSizer + wxVERTICAL + protected + + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + 1 + + 0 + + fgSizer3 + wxFLEX_GROWMODE_SPECIFIED + none + 1 + 0 + + 5 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Mount options: + + + m_staticText6 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + FilesystemOptionsTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background Task + 0 + + + + 1 + + + 0 + wxID_ANY + + + BackgroundTaskPanel + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer61 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer62 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + TrueCrypt Background Task + + sbSizer18 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Enabled + + + BackgroundTaskEnabledCheckBox + protected + + + + + + + + + + OnBackgroundTaskEnabledCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Exit when there are no mounted volumes + + + CloseBackgroundTaskOnNoVolumesCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Task Icon Menu Items + + sbSizer26 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount Favorite Volumes + + + BackgroundTaskMenuMountItemsEnabledCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Open Mounted Volumes + + + BackgroundTaskMenuOpenItemsEnabledCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Dismount Mounted Volumes + + + BackgroundTaskMenuDismountItemsEnabledCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + System Integration + 0 + + + + 1 + + + 0 + wxID_ANY + + + SystemIntegrationPage + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer49 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer37 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Actions to Perform when User Logs On + + LogOnSizer + wxVERTICAL + protected + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Start TrueCrypt Background Task + + + StartOnLogonCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount favorite volumes + + + MountFavoritesOnLogonCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Mount all device-hosted TrueCrypt volumes + + + MountDevicesOnLogonCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Filesystem Explorer + + ExplorerSizer + wxVERTICAL + protected + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Open Explorer window for successfully mounted volume + + + OpenExplorerWindowAfterMountCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Close all Explorer windows of volume being dismounted + + + CloseExplorerWindowsOnDismountCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Kernel Services + + KernelServicesSizer + wxVERTICAL + protected + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Do not use kernel cryptographic services + + + NoKernelCryptoCheckBox + protected + + + + + + + + + + OnNoKernelCryptoCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Performance + 0 + + + + 1 + + + 0 + wxID_ANY + + + PerformanceOptionsPage + protected + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer151 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + bSizer152 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Hardware Acceleration + + sbSizer44 + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + + bSizer158 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + Processor (CPU) in this computer supports hardware acceleration for AES: + + + m_staticText57 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + + AesHwCpuSupportedStaticText + protected + + + + + + + + wxSUNKEN_BORDER + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Do not accelerate AES encryption/decryption by using the AES instructions of the processor + + + NoHardwareCryptoCheckBox + protected + + + + + + + + + + OnNoHardwareCryptoCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Keyfiles + 0 + + + + 1 + + + 0 + wxID_ANY + + + DefaultKeyfilesPage + public + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer40 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer43 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Default Keyfiles + + bSizer42 + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + + DefaultKeyfilesSizer + wxVERTICAL + protected + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Use keyfiles by default + + + UseKeyfilesCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Security Tokens + 0 + + + + 1 + + + 0 + wxID_ANY + + + SecurityTokensPage + public + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer127 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer128 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + PKCS #11 Library Path + + sbSizer36 + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + + bSizer129 + wxHORIZONTAL + none + + 5 + wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + + 0 + + Pkcs11ModulePathTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Select &Library... + + + SelectPkcs11ModuleButton + protected + + + + + + + + + OnSelectPkcs11ModuleButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Security Options + + sbSizer37 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + &Close token session (log out) after a volume is successfully mounted + + + CloseSecurityTokenSessionsAfterMountCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hotkeys + 0 + + + + 1 + + + 0 + wxID_ANY + + + HotkeysPage + public + + + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer51 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer38 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + System-Wide Hotkeys + + sbSizer21 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + HotkeyListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + OnHotkeyListItemDeselected + + + + OnHotkeyListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Shortcut + + sbSizer23 + wxVERTICAL + none + + + 5 + wxALIGN_RIGHT + 1 + + 3 + wxBOTH + + + 0 + + fgSizer4 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Key to assign: + + + m_staticText10 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + HotkeyTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Assign + + + AssignHotkeyButton + protected + + + + + + + + + OnAssignHotkeyButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 4 + 0 + + gSizer4 + none + 1 + 0 + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Control + + + HotkeyControlCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Shift + + + HotkeyShiftCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Alt + + + HotkeyAltCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Win + + + HotkeyWinCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + Remove + + + RemoveHotkeyButton + protected + + + + + + + + + OnRemoveHotkeyButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Options + + sbSizer24 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Play system notification sound after mount/dismount + + + BeepAfterHotkeyMountDismountCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Display confirmation message box after dismount + + + DisplayMessageAfterHotkeyDismountCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + StdButtons + protected + + OnCancelButtonClick + + + + OnOKButtonClick + + + + + + + + + + + wxBOTH + + 1 + + + + 0 + wxID_ANY + + + RandomPoolEnrichmentDialogBase + + + wxDEFAULT_DIALOG_STYLE + + TrueCrypt - Random Pool Enrichment + + + + + + + + + + + + + + + + + + + + + + + + + OnMouseMotion + + + + + + + + + + + + MainSizer + wxVERTICAL + protected + + 5 + wxEXPAND|wxALL + 1 + + + bSizer144 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer145 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Mixing PRF: + + + m_staticText49 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + HashChoice + protected + + 0 + + + + + + + + OnHashSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + wxID_ANY + + + sbSizer43 + wxVERTICAL + none + + + 5 + wxEXPAND|wxTOP + 0 + + + bSizer147 + wxHORIZONTAL + none + + 5 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Random Pool: + + + m_staticText52 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + Courier New,90,90,-1,70,0 + 0 + wxID_ANY + + + + RandomPoolStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + 1 + + 1 + + + 0 + wxID_ANY + Show + + + ShowRandomPoolCheckBox + protected + + + + + + + + + + OnShowRandomPoolCheckBoxClicked + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + + + 1 + + + 0 + wxID_ANY + IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases security. When done, click 'Continue'. + + + MouseStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + 5 + wxEXPAND + 0 + + + bSizer146 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_OK + &Continue + + + ContinueButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + -1,-1 + SecurityTokenKeyfilesDialogBase + + -1,-1 + wxDEFAULT_DIALOG_STYLE + + Security Token Keyfiles + + wxWS_EX_VALIDATE_RECURSIVELY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer3 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer138 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer142 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + SecurityTokenKeyfileListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + OnListItemActivated + OnListItemDeselected + + + + OnListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer141 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Export... + + + ExportButton + protected + + + + + + + + + OnExportButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Delete + + + DeleteButton + protected + + + + + + + + + OnDeleteButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxLEFT + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Import Keyfile to Token... + + + ImportButton + protected + + + + + + + + + OnImportButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer139 + wxVERTICAL + none + + 5 + wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_OK + OK + + + OKButton + protected + + + + + + + + + OnOKButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + CancelButton + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + 0 + wxID_ANY + + + VolumePropertiesDialogBase + + + wxDEFAULT_DIALOG_STYLE + + Volume Properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer49 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + bSizer50 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + PropertiesListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_VRULES + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + + StdButtons + protected + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + EncryptionOptionsWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer93 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer94 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer95 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Encryption Algorithm + + sbSizer29 + wxVERTICAL + none + + + 5 + wxEXPAND + 0 + + + bSizer96 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + + 1 + + + 0 + wxID_ANY + + + EncryptionAlgorithmChoice + protected + + 0 + + + + + + + + OnEncryptionAlgorithmSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Test + + + TestButton + protected + + + + + + + + + OnTestButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + EncryptionAlgorithmStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer97 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxSYS_COLOUR_WINDOWTEXT + wxID_ANY + More information + + + EncryptionAlgorithmHyperlink + wxSYS_COLOUR_WINDOWTEXT + protected + + + wxHL_DEFAULT_STYLE + + + + wxSYS_COLOUR_WINDOWTEXT + + + + + + + OnEncryptionAlgorithmHyperlinkClick + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Benchmark + + + BenchmarkButton + protected + + + + + + + + + OnBenchmarkButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Hash Algorithm + + sbSizer30 + wxHORIZONTAL + none + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + + 1 + + + 0 + wxID_ANY + + + HashChoice + protected + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxSYS_COLOUR_WINDOWTEXT + wxID_ANY + Information on hash algorithms + + + HashHyperlink + wxSYS_COLOUR_WINDOWTEXT + protected + + + wxHL_DEFAULT_STYLE + + + + wxSYS_COLOUR_WINDOWTEXT + + + + + + + OnHashHyperlinkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + InfoWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer71 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + InfoPageSizer + wxVERTICAL + protected + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + KeyfilesPanelBase + + 500,300 + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer19 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer20 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer21 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + + + KeyfilesListCtrl + protected + + + wxLC_NO_SORT_HEADER|wxLC_REPORT + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + OnListItemDeselected + + + + OnListItemSelected + + + + + + + + + + + + + OnListSizeChanged + + + + + 5 + wxEXPAND + 0 + + + bSizer137 + wxHORIZONTAL + none + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Add &Files... + + + AddFilesButton + protected + + + + + + + + + OnAddFilesButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Add &Path... + + + AddDirectoryButton + protected + + + + + + + + + OnAddDirectoryButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Add &Token Files... + + + AddSecurityTokenSignatureButton + protected + + + + + + + + + OnAddSecurityTokenSignatureButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Remove + + + RemoveButton + protected + + + + + + + + + OnRemoveButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Remove &All + + + RemoveAllButton + protected + + + + + + + + + OnRemoveAllButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + ProgressWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer81 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer82 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + ProgressSizer + wxHORIZONTAL + protected + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + 1 + + + 0 + wxID_ANY + + -1,-1 + ProgressGauge + protected + + 100 + -1,-1 + wxGA_HORIZONTAL|wxGA_SMOOTH + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 0 + 0 + + + 0 + wxID_ANY + &Abort + + + AbortButton + protected + + + + + + + + + OnAbortButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + SelectDirectoryWizardPageBase + + 200,65 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer68 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer69 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer70 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + 1 + + + 0 + wxID_ANY + + 0 + + DirectoryTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnDirectoryTextChanged + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + &Browse... + + + BrowseButton + protected + + + + + + + + + OnBrowseButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + 300 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + SingleChoiceWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer71 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer77 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 0 + + + OuterChoicesSizer + wxVERTICAL + protected + + 5 + wxEXPAND + 0 + + + ChoicesSizer + wxVERTICAL + protected + + + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + VolumeCreationProgressWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer104 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer105 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + + + sbSizer31 + wxVERTICAL + none + + + 30 + wxEXPAND + 1 + + + KeySamplesUpperSizer + wxVERTICAL + protected + + 3 + wxEXPAND|wxTOP + 1 + + + KeySamplesUpperInnerSizer + wxVERTICAL + protected + + + + + + 5 + wxEXPAND + 0 + + 2 + wxBOTH + + + 0 + + fgSizer5 + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_BOTTOM + 0 + + + + 1 + + + 0 + wxID_ANY + Random Pool: + + + m_staticText25 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_BOTTOM + 1 + + + bSizer126 + wxHORIZONTAL + none + + 7 + wxEXPAND|wxTOP|wxRIGHT|wxALIGN_BOTTOM + 0 + + + + 1 + + Courier New,90,90,-1,70,0 + 0 + wxID_ANY + + + + RandomPoolSampleStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT + 0 + + + 1 + + 1 + + + 0 + wxID_ANY + Show + + + DisplayKeysCheckBox + protected + + + + + + + + + + OnDisplayKeysCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_BOTTOM + 0 + + + + 1 + + + 0 + wxID_ANY + Header Key: + + + m_staticText28 + none + + -1,-1 + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + wxALIGN_BOTTOM|wxEXPAND|wxTOP|wxRIGHT + 0 + + + + 1 + + Courier New,90,90,-1,70,0 + 0 + wxID_ANY + + + + HeaderKeySampleStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_BOTTOM + 0 + + + + 1 + + + 0 + wxID_ANY + Master Key: + + + m_staticText29 + none + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + wxEXPAND|wxALIGN_BOTTOM|wxTOP|wxRIGHT + 0 + + + + 1 + + Courier New,90,90,-1,70,0 + 0 + wxID_ANY + + + + MasterKeySampleStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + wxID_ANY + + + sbSizer32 + wxVERTICAL + none + + + 5 + wxEXPAND + 0 + + + bSizer106 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + 1 + + + 0 + wxID_ANY + + -1,-1 + ProgressGauge + protected + + 100 + + wxGA_HORIZONTAL|wxGA_SMOOTH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Abort + + + AbortButton + protected + + + + + + + + + OnAbortButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + wxEXPAND|wxTOP + 0 + + 3 + 0 + + gSizer6 + none + 1 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + + + bSizer108 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Done + + + m_staticText31 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + + -1,-1 + m_panel12 + protected + + -1,-1 + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer115 + wxHORIZONTAL + none + + 3 + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL + 1 + + + + 1 + + + 0 + wxID_ANY + + + + SizeDoneStaticText + protected + + + wxALIGN_RIGHT|wxST_NO_AUTORESIZE + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL + 1 + + + bSizer1081 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Speed + + + m_staticText311 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL + 1 + + + + 1 + + + 0 + wxID_ANY + + + m_panel121 + protected + + + + + + + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer1151 + wxHORIZONTAL + none + + 3 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + SpeedStaticText + protected + + + wxALIGN_RIGHT|wxST_NO_AUTORESIZE + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 1 + + + bSizer1082 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Left + + + m_staticText312 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + m_panel122 + protected + + + + + + + wxSUNKEN_BORDER|wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer1152 + wxHORIZONTAL + none + + 3 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + + TimeLeftStaticText + protected + + + wxALIGN_RIGHT|wxST_NO_AUTORESIZE + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + VolumeLocationWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer86 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer87 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 0 + + + bSizer88 + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bSizer89 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer126 + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 1 + + + + + 1 + + + 0 + wxID_ANY + + -1,-1 + VolumePathComboBox + protected + + + wxCB_DROPDOWN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnVolumePathTextChanged + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bSizer90 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Select &File... + + -1,-1 + SelectFileButton + protected + + + + + + + + + OnSelectFileButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Select D&evice... + + -1,-1 + SelectDeviceButton + protected + + + + + + + + + OnSelectDeviceButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer91 + wxHORIZONTAL + none + + 5 + wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + &Never save history + + + NoHistoryCheckBox + protected + + + + + + + + + + OnNoHistoryCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + VolumeFormatOptionsWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer124 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer125 + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Filesystem Options + + sbSizer33 + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + + + 0 + + fgSizer6 + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Filesystem type: + + + m_staticText43 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + FilesystemTypeChoice + protected + + 0 + + + + + + + + OnFilesystemTypeSelected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Volume Format Options + + sbSizer34 + wxVERTICAL + none + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Quick format + + + QuickFormatCheckBox + protected + + + + + + + + + + OnQuickFormatCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 1 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + VolumePasswordPanelBase + + -1,-1 + + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer7 + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 0,0 + wxBOTH + 1 + + 0 + + GridBagSizer + wxFLEX_GROWMODE_SPECIFIED + protected + 0 + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT + 1 + 1 + + + + 1 + + + 0 + wxID_ANY + Password: + + + PasswordStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + 1 + + + + 1 + + + 0 + wxID_ANY + + 1 + 232,-1 + PasswordTextCtrl + protected + + + wxTE_PASSWORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnTextChanged + + + + + + + + 5 + 1 + 0 + wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 2 + 1 + + + + 1 + + + 0 + wxID_ANY + Confirm password: + + + ConfirmPasswordStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND + 2 + 1 + + + + 1 + + + 0 + wxID_ANY + + 1 + 232,-1 + ConfirmPasswordTextCtrl + protected + + + wxTE_PASSWORD + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnTextChanged + + + + + + + + 5 + 2 + 1 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 3 + 1 + + + 0 + + 1 + + + 0 + wxID_ANY + Cach&e passwords and keyfiles in memory + + + CacheCheckBox + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL + 4 + 1 + + + 0 + + 1 + + + 0 + wxID_ANY + &Display password + + + DisplayPasswordCheckBox + protected + + + + + + + + + + OnDisplayPasswordCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxTOP|wxRIGHT|wxLEFT + 5 + 1 + + + 0 + + 1 + + + 0 + wxID_ANY + U&se keyfiles + + + UseKeyfilesCheckBox + protected + + + + + + + + + + OnUseKeyfilesCheckBoxClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_RIGHT|wxALIGN_BOTTOM|wxLEFT + 5 + 1 + + + + 0 + 1 + + + 0 + wxID_ANY + &Keyfiles... + + + KeyfilesButton + protected + + + + + + + + + OnKeyfilesButtonClick + + + + + + + + + + + + + + + + + + + OnKeyfilesButtonRightDown + OnKeyfilesButtonRightClick + + + + + + + 5 + 1 + 1 + wxEXPAND|wxTOP|wxBOTTOM + 6 + 1 + + + Pkcs5PrfSizer + wxVERTICAL + protected + + + + 5 + 1 + 0 + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxRIGHT + 7 + 1 + + + + 1 + + + 0 + wxID_ANY + PKCS-5 PRF: + + + Pkcs5PrfStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxALIGN_CENTER_VERTICAL|wxLEFT + 7 + 1 + + + "Unchanged" + + 1 + + + 0 + wxID_ANY + -1,-1 + -1,-1 + Pkcs5PrfChoice + protected + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 2 + 1 + wxTOP|wxEXPAND + 8 + 1 + + + PasswordPlaceholderSizer + wxVERTICAL + protected + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + VolumePasswordWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer101 + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizer102 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + PasswordPanelSizer + wxVERTICAL + protected + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + 0 + wxID_ANY + + + VolumeSizeWizardPageBase + + -1,-1 + WizardPage; WizardPage.h + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer98 + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizer99 + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 0 + + + bSizer100 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + VolumeSizeTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnVolumeSizeTextChanged + + + + + + + + 5 + wxALL + 0 + + + + + 1 + + + 0 + wxID_ANY + + + VolumeSizePrefixChoice + protected + + 0 + + + + + + + + OnVolumeSizePrefixSelected + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + + + FreeSpaceStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + + + InfoStaticText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Main/Forms/VolumeCreationProgressWizardPage.cpp b/src/Main/Forms/VolumeCreationProgressWizardPage.cpp new file mode 100644 index 00000000..12b11591 --- /dev/null +++ b/src/Main/Forms/VolumeCreationProgressWizardPage.cpp @@ -0,0 +1,183 @@ +/* + Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "VolumeCreationProgressWizardPage.h" + +namespace TrueCrypt +{ + VolumeCreationProgressWizardPage::VolumeCreationProgressWizardPage (wxPanel* parent, bool displayKeyInfo) + : VolumeCreationProgressWizardPageBase (parent), + PreviousGaugeValue (0), + ProgressBarRange (1), + RealProgressBarRange (1), + VolumeCreatorRunning (false) + { + DisplayKeysCheckBox->SetValue (displayKeyInfo); +#ifdef TC_WINDOWS + DisplayKeysCheckBox->SetLabel (L""); +#endif + +#ifdef TC_MACOSX + ProgressGauge->SetMinSize (wxSize (-1, 12)); // OS X apparently supports only up to 12px thick progress bars + KeySamplesUpperSizer->Remove (KeySamplesUpperInnerSizer); +#else + ProgressGauge->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 2)); +#endif + + if (DisplayKeysCheckBox->IsChecked()) + ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true); + else + ShowAsterisks (RandomPoolSampleStaticText); + + class Timer : public wxTimer + { + public: + Timer (VolumeCreationProgressWizardPage *page) : Page (page) { } + + void Notify() + { + Page->OnRandomPoolTimer(); + } + + VolumeCreationProgressWizardPage *Page; + }; + + RandomPoolTimer.reset (dynamic_cast (new Timer (this))); + RandomPoolTimer->Start (30); + + AbortButton->Disable(); + ProgressGauge->SetValue (0); + + } + + void VolumeCreationProgressWizardPage::OnAbortButtonClick (wxCommandEvent& event) + { + AbortEvent.Raise(); + } + + void VolumeCreationProgressWizardPage::OnDisplayKeysCheckBoxClick (wxCommandEvent& event) + { + if (!event.IsChecked()) + { + ShowAsterisks (RandomPoolSampleStaticText); + ShowAsterisks (HeaderKeySampleStaticText); + ShowAsterisks (MasterKeySampleStaticText); + } + else + { + RandomPoolSampleStaticText->SetLabel (L""); + HeaderKeySampleStaticText->SetLabel (L""); + MasterKeySampleStaticText->SetLabel (L""); + } + } + + void VolumeCreationProgressWizardPage::OnRandomPoolTimer () + { + if (!VolumeCreatorRunning && DisplayKeysCheckBox->IsChecked()) + ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true); + } + + void VolumeCreationProgressWizardPage::SetKeyInfo (const VolumeCreator::KeyInfo &keyInfo) + { + if (DisplayKeysCheckBox->IsChecked()) + { + ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true); + ShowBytes (HeaderKeySampleStaticText, keyInfo.HeaderKey); + ShowBytes (MasterKeySampleStaticText, keyInfo.MasterKey); + } + } + + void VolumeCreationProgressWizardPage::ShowAsterisks (wxStaticText *textCtrl) + { + wxString str; + for (size_t i = 0; i < MaxDisplayedKeyBytes + 1; ++i) + { + str += L"**"; + } + + textCtrl->SetLabel (str.c_str()); + } + + void VolumeCreationProgressWizardPage::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots) + { + wxString str; + + for (size_t i = 0; i < MaxDisplayedKeyBytes && i < buffer.Size(); ++i) + { + str += wxString::Format (L"%02X", buffer[i]); + } + + if (appendDots) + str += L".."; + + textCtrl->SetLabel (str.c_str()); + + for (size_t i = 0; i < str.size(); ++i) + { + str[i] = L'X'; + } + } + + void VolumeCreationProgressWizardPage::SetProgressValue (uint64 value) + { + int gaugeValue = static_cast (value * RealProgressBarRange / ProgressBarRange); + + if (value == ProgressBarRange) + gaugeValue = RealProgressBarRange; // Prevent round-off error + + if (gaugeValue != PreviousGaugeValue) + { + ProgressGauge->SetValue (gaugeValue); + PreviousGaugeValue = gaugeValue; + } + + if (value != 0) + { + SizeDoneStaticText->SetLabel (wxString::Format (L"%7.3f%%", 100.0 - double (ProgressBarRange - value) / (double (ProgressBarRange) / 100.0))); + + wxLongLong timeDiff = wxGetLocalTimeMillis() - StartTime; + if (timeDiff.GetValue() > 0) + { + uint64 speed = value * 1000 / timeDiff.GetValue(); + + if (ProgressBarRange != value) + SpeedStaticText->SetLabel (Gui->SpeedToString (speed)); + + TimeLeftStaticText->SetLabel (speed > 0 ? Gui->TimeSpanToString ((ProgressBarRange - value) / speed) : L""); + } + } + else + { + SizeDoneStaticText->SetLabel (L""); + SpeedStaticText->SetLabel (L""); + TimeLeftStaticText->SetLabel (L""); + } + } + + void VolumeCreationProgressWizardPage::SetMaxStaticTextWidth (int width) + { + InfoStaticText->Wrap (width); + } + + void VolumeCreationProgressWizardPage::SetProgressState (bool volumeCreatorRunning) + { + if (volumeCreatorRunning) + StartTime = wxGetLocalTimeMillis(); + + VolumeCreatorRunning = volumeCreatorRunning; + } + + void VolumeCreationProgressWizardPage::SetProgressRange (uint64 progressBarRange) + { + ProgressBarRange = progressBarRange; + RealProgressBarRange = ProgressGauge->GetSize().GetWidth(); + ProgressGauge->SetRange (RealProgressBarRange); + } +} diff --git a/src/Main/Forms/VolumeCreationProgressWizardPage.h b/src/Main/Forms/VolumeCreationProgressWizardPage.h new file mode 100644 index 00000000..a33b3623 --- /dev/null +++ b/src/Main/Forms/VolumeCreationProgressWizardPage.h @@ -0,0 +1,53 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumeCreationProgressWizardPage +#define TC_HEADER_Main_Forms_VolumeCreationProgressWizardPage + +#include "Forms.h" +#include "Core/VolumeCreator.h" + +namespace TrueCrypt +{ + class VolumeCreationProgressWizardPage : public VolumeCreationProgressWizardPageBase + { + public: + VolumeCreationProgressWizardPage (wxPanel* parent, bool displayKeyInfo); + ~VolumeCreationProgressWizardPage () { } + + void EnableAbort (bool enable = true) { AbortButton->Enable (enable); } + bool IsKeyInfoDisplayed () const { return DisplayKeysCheckBox->GetValue(); } + bool IsValid () { return true; } + void OnRandomPoolTimer (); + void SetKeyInfo (const VolumeCreator::KeyInfo &keyInfo); + void SetMaxStaticTextWidth (int width); + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + void SetProgressRange (uint64 progressBarRange); + void SetProgressValue (uint64 value); + void SetProgressState (bool volumeCreatorRunning); + + Event AbortEvent; + + protected: + void OnAbortButtonClick (wxCommandEvent& event); + void OnDisplayKeysCheckBoxClick (wxCommandEvent& event); + void ShowAsterisks (wxStaticText *textCtrl); + void ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots = true); + + static const size_t MaxDisplayedKeyBytes = 13; + + int PreviousGaugeValue; + uint64 ProgressBarRange; + auto_ptr RandomPoolTimer; + int RealProgressBarRange; + wxLongLong StartTime; + bool VolumeCreatorRunning; + }; +} + +#endif // TC_HEADER_Main_Forms_VolumeCreationProgressWizardPage diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp new file mode 100644 index 00000000..1219fc20 --- /dev/null +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -0,0 +1,984 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Platform/SystemInfo.h" +#ifdef TC_UNIX +#include +#include "Platform/Unix/Process.h" +#endif +#include "Core/RandomNumberGenerator.h" +#include "Core/VolumeCreator.h" +#include "Main/Application.h" +#include "Main/GraphicUserInterface.h" +#include "Main/Resources.h" +#include "VolumeCreationWizard.h" +#include "EncryptionOptionsWizardPage.h" +#include "InfoWizardPage.h" +#include "ProgressWizardPage.h" +#include "SingleChoiceWizardPage.h" +#include "VolumeCreationProgressWizardPage.h" +#include "VolumeFormatOptionsWizardPage.h" +#include "VolumeLocationWizardPage.h" +#include "VolumePasswordWizardPage.h" +#include "VolumeSizeWizardPage.h" + +namespace TrueCrypt +{ + VolumeCreationWizard::VolumeCreationWizard (wxWindow* parent) + : WizardFrame (parent), + CrossPlatformSupport (true), + DisplayKeyInfo (true), + LargeFilesSupport (false), + QuickFormatEnabled (false), + SelectedFilesystemClusterSize (0), + SelectedFilesystemType (VolumeCreationOptions::FilesystemType::FAT), + SelectedVolumeHostType (VolumeHostType::File), + SelectedVolumeType (VolumeType::Normal), + SectorSize (0), + VolumeSize (0) + { + RandomNumberGenerator::Start(); + + SetTitle (LangString["INTRO_TITLE"]); + SetImage (Resources::GetVolumeCreationWizardBitmap (Gui->GetCharHeight (this) * 21)); + SetMaxStaticTextWidth (55); + + SetStep (Step::VolumeHostType); + + class Timer : public wxTimer + { + public: + Timer (VolumeCreationWizard *wizard) : Wizard (wizard) { } + + void Notify() + { + Wizard->OnRandomPoolUpdateTimer(); + } + + VolumeCreationWizard *Wizard; + }; + + RandomPoolUpdateTimer.reset (dynamic_cast (new Timer (this))); + RandomPoolUpdateTimer->Start (200); + } + + VolumeCreationWizard::~VolumeCreationWizard () + { + } + + WizardPage *VolumeCreationWizard::GetPage (WizardStep step) + { + switch (step) + { + case Step::VolumeHostType: + { + ClearHistory(); + + OuterVolume = false; + LargeFilesSupport = false; + QuickFormatEnabled = false; + + SingleChoiceWizardPage *page = new SingleChoiceWizardPage (GetPageParent(), wxEmptyString, true); + page->SetMinSize (wxSize (Gui->GetCharWidth (this) * 58, Gui->GetCharHeight (this) * 18 + 5)); + + page->SetPageTitle (LangString["INTRO_TITLE"]); + + page->AddChoice (VolumeHostType::File, LangString["IDC_FILE_CONTAINER"], LangString["IDT_FILE_CONTAINER"], L"introcontainer", LangString["IDC_MORE_INFO_ON_CONTAINERS"]); + page->AddChoice (VolumeHostType::Device, _("Create a volume within a partition/&drive"), _("Formats and encrypts a non-system partition, entire external or secondary drive, entire USB stick, etc.")); + + page->SetSelection (SelectedVolumeHostType); + return page; + } + + case Step::VolumeType: + { + SingleChoiceWizardPage *page = new SingleChoiceWizardPage (GetPageParent(), wxEmptyString, true); + page->SetPageTitle (LangString["VOLUME_TYPE_TITLE"]); + + page->AddChoice (VolumeType::Normal, LangString["IDC_STD_VOL"], LangString["NORMAL_VOLUME_TYPE_HELP"]); + page->AddChoice (VolumeType::Hidden, LangString["IDC_HIDDEN_VOL"], LangString["HIDDEN_VOLUME_TYPE_HELP"], L"hiddenvolume", LangString["IDC_HIDDEN_VOL_HELP"]); + + page->SetSelection (SelectedVolumeType); + return page; + } + + case Step::VolumeLocation: + { + VolumeLocationWizardPage *page = new VolumeLocationWizardPage (GetPageParent(), SelectedVolumeHostType); + page->SetPageTitle (LangString["VOLUME_LOCATION"]); + + if (SelectedVolumeType == VolumeType::Hidden) + page->SetPageText (LangString[SelectedVolumeHostType == VolumeHostType::File ? "FILE_HELP_HIDDEN_HOST_VOL" : "DEVICE_HELP_HIDDEN_HOST_VOL"]); + else + page->SetPageText (LangString[SelectedVolumeHostType == VolumeHostType::File ? "FILE_HELP" : "DEVICE_HELP_NO_INPLACE"]); + + page->SetVolumePath (SelectedVolumePath); + return page; + } + + case Step::EncryptionOptions: + { + EncryptionOptionsWizardPage *page = new EncryptionOptionsWizardPage (GetPageParent()); + + if (OuterVolume) + page->SetPageTitle (LangString["CIPHER_HIDVOL_HOST_TITLE"]); + else if (SelectedVolumeType == VolumeType::Hidden) + page->SetPageTitle (LangString["CIPHER_HIDVOL_TITLE"]); + else + page->SetPageTitle (LangString["CIPHER_TITLE"]); + + page->SetEncryptionAlgorithm (SelectedEncryptionAlgorithm); + page->SetHash (SelectedHash); + return page; + } + + case Step::VolumeSize: + { + wxString freeSpaceText; + wxString pageTitle; + wxString pageText; + + if (OuterVolume) + { + pageTitle = LangString["SIZE_HIDVOL_HOST_TITLE"]; + pageText = LangString["SIZE_HELP_HIDDEN_HOST_VOL"]; + } + else if (SelectedVolumeType == VolumeType::Hidden) + { + pageTitle = LangString["SIZE_HIDVOL_TITLE"]; + pageText = LangString["SIZE_HELP_HIDDEN_VOL"] + L"\n\n" + _("Please note that if your operating system does not allocate files from the beginning of the free space, the maximum possible hidden volume size may be much smaller than the size of the free space on the outer volume. This not a bug in TrueCrypt but a limitation of the operating system."); + freeSpaceText = StringFormatter (_("Maximum possible hidden volume size for this volume is {0}."), Gui->SizeToString (MaxHiddenVolumeSize)); + } + else + { + pageTitle = LangString["SIZE_TITLE"]; + pageText = LangString["VOLUME_SIZE_HELP"]; + } + + VolumeSizeWizardPage *page = new VolumeSizeWizardPage (GetPageParent(), SelectedVolumePath, SectorSize, freeSpaceText); + + page->SetPageTitle (pageTitle); + page->SetPageText (pageText); + + if (!OuterVolume && SelectedVolumeType == VolumeType::Hidden) + page->SetMaxVolumeSize (MaxHiddenVolumeSize); + else + page->SetVolumeSize (VolumeSize); + + if (OuterVolume) + page->SetMinVolumeSize (TC_MIN_HIDDEN_VOLUME_HOST_SIZE); + else if (SelectedVolumeType == VolumeType::Hidden) + page->SetMinVolumeSize (TC_MIN_HIDDEN_VOLUME_SIZE); + else + page->SetMinVolumeSize (TC_MIN_VOLUME_SIZE); + + return page; + } + + case Step::VolumePassword: + { + VolumePasswordWizardPage *page = new VolumePasswordWizardPage (GetPageParent(), Password, Keyfiles); + + if (OuterVolume) + page->SetPageTitle (LangString["PASSWORD_HIDVOL_HOST_TITLE"]); + else if (SelectedVolumeType == VolumeType::Hidden) + page->SetPageTitle (LangString["PASSWORD_HIDVOL_TITLE"]); + else + page->SetPageTitle (LangString["PASSWORD_TITLE"]); + + page->SetPageText (LangString[OuterVolume ? "PASSWORD_HIDDENVOL_HOST_HELP" : "PASSWORD_HELP"]); + return page; + } + + case Step::LargeFilesSupport: + { + SingleChoiceWizardPage *page = new SingleChoiceWizardPage (GetPageParent(), wxEmptyString, true); + page->SetPageTitle (LangString["FILESYS_PAGE_TITLE"]); + + page->AddChoice (false, _("I will not store files larger than 4 GB on the volume"), + _("Choose this option if you do not need to store files larger than 4 GB (4,294,967,296 bytes) on the volume.")); + + page->AddChoice (true, _("I will store files larger than 4 GB on the volume"), + _("Choose this option if you need to store files larger than 4 GB (4,294,967,296 bytes) on the volume.")); + + page->SetSelection (LargeFilesSupport); + return page; + } + + case Step::FormatOptions: + { + VolumeFormatOptionsWizardPage *page = new VolumeFormatOptionsWizardPage (GetPageParent(), VolumeSize, SectorSize, + SelectedVolumePath.IsDevice() && (OuterVolume || SelectedVolumeType != VolumeType::Hidden), OuterVolume, LargeFilesSupport); + + page->SetPageTitle (_("Format Options")); + page->SetFilesystemType (SelectedFilesystemType); + + if (!OuterVolume && SelectedVolumeType == VolumeType::Hidden) + QuickFormatEnabled = true; + page->SetQuickFormat (QuickFormatEnabled); + + return page; + } + + case Step::CrossPlatformSupport: + { + SingleChoiceWizardPage *page = new SingleChoiceWizardPage (GetPageParent(), wxEmptyString, true); + page->SetPageTitle (_("Cross-Platform Support")); + + page->AddChoice (true, _("I will mount the volume on other platforms"), + _("Choose this option if you need to use the volume on other platforms.")); + + page->AddChoice (false, StringFormatter (_("I will mount the volume only on {0}"), SystemInfo::GetPlatformName()), + _("Choose this option if you do not need to use the volume on other platforms.")); + + page->SetSelection (CrossPlatformSupport); + return page; + } + + case Step::CreationProgress: + { + VolumeCreationProgressWizardPage *page = new VolumeCreationProgressWizardPage (GetPageParent(), DisplayKeyInfo); + + if (OuterVolume) + page->SetPageTitle (LangString["FORMAT_HIDVOL_HOST_TITLE"]); + else if (SelectedVolumeType == VolumeType::Hidden) + page->SetPageTitle (LangString["FORMAT_HIDVOL_TITLE"]); + else + page->SetPageTitle (LangString["FORMAT_TITLE"]); + + page->SetPageText (LangString["FORMAT_HELP"]); + page->AbortEvent.Connect (EventConnector (this, &VolumeCreationWizard::OnAbortButtonClick)); + page->SetNextButtonText (LangString["FORMAT"]); + return page; + } + + case Step::VolumeCreatedInfo: + { + InfoWizardPage *page = new InfoWizardPage (GetPageParent()); + page->SetPageTitle (LangString["FORMAT_FINISHED_TITLE"]); + page->SetPageText (LangString["FORMAT_FINISHED_HELP"]); + + SetCancelButtonText (_("Exit")); + return page; + } + + case Step::OuterVolumeContents: + { + ClearHistory(); + + MountOptions mountOptions; + mountOptions.Keyfiles = Keyfiles; + mountOptions.Password = Password; + mountOptions.Path = make_shared (SelectedVolumePath); + + try + { + wxBusyCursor busy; + Gui->SetActiveFrame (this); + MountedOuterVolume = Core->MountVolume (mountOptions); + } + catch (exception &e) + { + Gui->SetActiveFrame (this); + Gui->ShowError (e); + + Close(); + return new InfoWizardPage (GetPageParent()); + } + + struct OpenOuterVolumeFunctor : public Functor + { + OpenOuterVolumeFunctor (const DirectoryPath &outerVolumeMountPoint) : OuterVolumeMountPoint (outerVolumeMountPoint) { } + + virtual void operator() () + { + Gui->OpenExplorerWindow (OuterVolumeMountPoint); + } + + DirectoryPath OuterVolumeMountPoint; + }; + + InfoWizardPage *page = new InfoWizardPage (GetPageParent(), _("Open Outer Volume"), + shared_ptr (new OpenOuterVolumeFunctor (MountedOuterVolume->MountPoint))); + + page->SetPageTitle (LangString["HIDVOL_HOST_FILLING_TITLE"]); + + page->SetPageText (StringFormatter ( + _("Outer volume has been successfully created and mounted as '{0}'. To this volume you should now copy some sensitive-looking files that you actually do NOT want to hide. The files will be there for anyone forcing you to disclose your password. You will reveal only the password for this outer volume, not for the hidden one. The files that you really care about will be stored in the hidden volume, which will be created later on. When you finish copying, click Next. Do not dismount the volume.\n\nNote: After you click Next, the outer volume will be analyzed to determine the size of uninterrupted area of free space whose end is aligned with the end of the volume. This area will accommodate the hidden volume, so it will limit its maximum possible size. The procedure ensures no data on the outer volume are overwritten by the hidden volume."), + wstring (MountedOuterVolume->MountPoint))); + + return page; + } + + case Step::HiddenVolume: + { + ClearHistory(); + OuterVolume = false; + LargeFilesSupport = false; + + InfoWizardPage *page = new InfoWizardPage (GetPageParent()); + page->SetPageTitle (LangString["HIDVOL_PRE_CIPHER_TITLE"]); + page->SetPageText (LangString["HIDVOL_PRE_CIPHER_HELP"]); + + return page; + } + + default: + throw ParameterIncorrect (SRC_POS); + } + } + + void VolumeCreationWizard::OnAbortButtonClick (EventArgs &args) + { + AbortRequested = true; + } + + void VolumeCreationWizard::OnMouseMotion (wxMouseEvent& event) + { + event.Skip(); + if (!IsWorkInProgress() && RandomNumberGenerator::IsRunning()) + { + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&event), sizeof (event))); + + long coord = event.GetX(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&coord), sizeof (coord))); + coord = event.GetY(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&coord), sizeof (coord))); + } + } + + void VolumeCreationWizard::OnProgressTimer () + { + if (!IsWorkInProgress()) + return; + + if (AbortRequested && !AbortConfirmationPending) + { + AbortConfirmationPending = true; + if (Gui->AskYesNo (LangString ["FORMAT_ABORT"], true)) + { + if (IsWorkInProgress() && Creator.get() != nullptr) + { + CreationAborted = true; + Creator->Abort(); + } + } + AbortRequested = false; + AbortConfirmationPending = false; + } + + VolumeCreator::ProgressInfo progress = Creator->GetProgressInfo(); + + VolumeCreationProgressWizardPage *page = dynamic_cast (GetCurrentPage()); + page->SetProgressValue (progress.SizeDone); + + if (!progress.CreationInProgress && !AbortConfirmationPending) + { + SetWorkInProgress (false); + OnVolumeCreatorFinished (); + } + } + + void VolumeCreationWizard::OnRandomPoolUpdateTimer () + { + if (!IsWorkInProgress()) + { + wxLongLong time = wxGetLocalTimeMillis(); + RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast (&time), sizeof (time))); + } + } + + void VolumeCreationWizard::OnVolumeCreatorFinished () + { + VolumeCreationProgressWizardPage *page = dynamic_cast (GetCurrentPage()); + + ProgressTimer.reset(); + page->SetProgressState (false); + + Gui->EndInteractiveBusyState (this); + SetWorkInProgress (false); + UpdateControls(); + + try + { + if (!CreationAborted) + { + Creator->CheckResult(); + +#ifdef TC_UNIX + // Format non-FAT filesystem + const char *fsFormatter = nullptr; + + switch (SelectedFilesystemType) + { + case VolumeCreationOptions::FilesystemType::Ext2: fsFormatter = "mkfs.ext2"; break; + case VolumeCreationOptions::FilesystemType::Ext3: fsFormatter = "mkfs.ext3"; break; + case VolumeCreationOptions::FilesystemType::Ext4: fsFormatter = "mkfs.ext4"; break; + case VolumeCreationOptions::FilesystemType::MacOsExt: fsFormatter = "newfs_hfs"; break; + case VolumeCreationOptions::FilesystemType::UFS: fsFormatter = "newfs" ; break; + default: break; + } + + if (fsFormatter) + { + wxBusyCursor busy; + + MountOptions mountOptions (Gui->GetPreferences().DefaultMountOptions); + mountOptions.Path = make_shared (SelectedVolumePath); + mountOptions.NoFilesystem = true; + mountOptions.Protection = VolumeProtection::None; + mountOptions.Password = Password; + mountOptions.Keyfiles = Keyfiles; + + shared_ptr volume = Core->MountVolume (mountOptions); + finally_do_arg (shared_ptr , volume, { Core->DismountVolume (finally_arg, true); }); + + Thread::Sleep (2000); // Try to prevent race conditions caused by OS + + // Temporarily take ownership of the device if the user is not an administrator + UserId origDeviceOwner ((uid_t) -1); + + DevicePath virtualDevice = volume->VirtualDevice; +#ifdef TC_MACOSX + string virtualDeviceStr = virtualDevice; + if (virtualDeviceStr.find ("/dev/rdisk") != 0) + virtualDevice = "/dev/r" + virtualDeviceStr.substr (5); +#endif + try + { + File file; + file.Open (virtualDevice, File::OpenReadWrite); + } + catch (...) + { + if (!Core->HasAdminPrivileges()) + { + origDeviceOwner = virtualDevice.GetOwner(); + Core->SetFileOwner (virtualDevice, UserId (getuid())); + } + } + + finally_do_arg2 (FilesystemPath, virtualDevice, UserId, origDeviceOwner, + { + if (finally_arg2.SystemId != (uid_t) -1) + Core->SetFileOwner (finally_arg, finally_arg2); + }); + + // Create filesystem + list args; + + if (SelectedFilesystemType == VolumeCreationOptions::FilesystemType::MacOsExt && VolumeSize >= 10 * BYTES_PER_MB) + args.push_back ("-J"); + + args.push_back (string (virtualDevice)); + + Process::Execute (fsFormatter, args); + } +#endif // TC_UNIX + + if (OuterVolume) + { + SetStep (Step::OuterVolumeContents); + } + else + { + Gui->ShowInfo (SelectedVolumeType == VolumeType::Hidden ? "HIDVOL_FORMAT_FINISHED_HELP" : "FORMAT_FINISHED_INFO"); + SetStep (Step::VolumeCreatedInfo); + } + + return; + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + + page->SetProgressValue (0); + if (SelectedVolumeType == VolumeType::Normal && !SelectedVolumePath.IsDevice()) + { + try + { + FilePath (wstring (SelectedVolumePath)).Delete(); + } + catch (...) { } + } + } + + WizardFrame::WizardStep VolumeCreationWizard::ProcessPageChangeRequest (bool forward) + { + switch (GetCurrentStep()) + { + case Step::VolumeHostType: + { + SingleChoiceWizardPage *page = dynamic_cast *> (GetCurrentPage()); + + try + { + SelectedVolumeHostType = page->GetSelection(); + } + catch (NoItemSelected &) + { + return GetCurrentStep(); + } + + return Step::VolumeType; + } + + case Step::VolumeType: + { + SingleChoiceWizardPage *page = dynamic_cast *> (GetCurrentPage()); + + try + { + SelectedVolumeType = page->GetSelection(); + } + catch (NoItemSelected &) + { + return GetCurrentStep(); + } + + if (SelectedVolumeType == VolumeType::Hidden) + OuterVolume = true; + + return Step::VolumeLocation; + } + + case Step::VolumeLocation: + { + VolumeLocationWizardPage *page = dynamic_cast (GetCurrentPage()); + SelectedVolumePath = page->GetVolumePath(); + VolumeSize = 0; + + if (forward) + { + if (Core->IsVolumeMounted (SelectedVolumePath)) + { + Gui->ShowInfo ("DISMOUNT_FIRST"); + return GetCurrentStep(); + } + + if (SelectedVolumePath.IsDevice()) + { + if (!DeviceWarningConfirmed && !Gui->AskYesNo (LangString["FORMAT_DEVICE_FOR_ADVANCED_ONLY"])) + return GetCurrentStep(); + + DeviceWarningConfirmed = true; + + foreach_ref (const HostDevice &drive, Core->GetHostDevices()) + { + if (drive.Path == SelectedVolumePath && !drive.Partitions.empty()) + { + foreach_ref (const HostDevice &partition, drive.Partitions) + { + if (partition.MountPoint == "/") + { + Gui->ShowError (_("Error: You are trying to encrypt a system drive.\n\nTrueCrypt can encrypt a system drive only under Windows.")); + return GetCurrentStep(); + } + } + + Gui->ShowError ("DEVICE_PARTITIONS_ERR"); + return GetCurrentStep(); + } + } + + try + { + SectorSize = Core->GetDeviceSectorSize (SelectedVolumePath); + VolumeSize = Core->GetDeviceSize (SelectedVolumePath); + } + catch (UserAbort&) + { + return Step::VolumeLocation; + } + catch (exception &e) + { + Gui->ShowError (e); + Gui->ShowError ("CANNOT_CALC_SPACE"); + return GetCurrentStep(); + } + + DirectoryPath mountPoint; + try + { + mountPoint = Core->GetDeviceMountPoint (SelectedVolumePath); + + if (!mountPoint.IsEmpty()) + { + if (mountPoint == "/") + { + Gui->ShowError (_("Error: You are trying to encrypt a system partition.\n\nTrueCrypt can encrypt system partitions only under Windows.")); + return GetCurrentStep(); + } + + if (!Gui->AskYesNo (StringFormatter (_("WARNING: Formatting of the device will destroy all data on filesystem '{0}'.\n\nDo you want to continue?"), wstring (mountPoint)), false, true)) + return GetCurrentStep(); + + try + { + Core->DismountFilesystem (mountPoint, true); + } + catch (exception &e) + { + Gui->ShowError (e); + Gui->ShowError (StringFormatter (_("The filesystem of the selected device is currently mounted. Please dismount '{0}' before proceeding."), wstring (mountPoint))); + return GetCurrentStep(); + } + } + } + catch (...) { } + } + else + SectorSize = TC_SECTOR_SIZE_FILE_HOSTED_VOLUME; + } + + return Step::EncryptionOptions; + } + + case Step::EncryptionOptions: + { + EncryptionOptionsWizardPage *page = dynamic_cast (GetCurrentPage()); + SelectedEncryptionAlgorithm = page->GetEncryptionAlgorithm (); + SelectedHash = page->GetHash (); + + if (forward) + RandomNumberGenerator::SetHash (SelectedHash); + + if (SelectedVolumePath.IsDevice() && (OuterVolume || SelectedVolumeType != VolumeType::Hidden)) + return Step::VolumePassword; + else + return Step::VolumeSize; + } + + case Step::VolumeSize: + { + VolumeSizeWizardPage *page = dynamic_cast (GetCurrentPage()); + + try + { + VolumeSize = page->GetVolumeSize(); + } + catch (Exception &e) + { + if (forward) + { + Gui->ShowError (e); + return GetCurrentStep(); + } + } + + if (forward + && !OuterVolume && SelectedVolumeType == VolumeType::Hidden + && (double) VolumeSize / MaxHiddenVolumeSize > 0.85) + { + if (!Gui->AskYesNo (LangString["FREE_SPACE_FOR_WRITING_TO_OUTER_VOLUME"])) + return GetCurrentStep(); + } + + if (forward + && SelectedVolumeHostType == VolumeHostType::File + && VolumeSize > 4 * BYTES_PER_GB + && (OuterVolume || SelectedVolumeType != VolumeType::Hidden) + && !Core->FilesystemSupportsLargeFiles (SelectedVolumePath)) + { + Gui->ShowWarning (LangString["VOLUME_TOO_LARGE_FOR_FAT32"]); + } + + return Step::VolumePassword; + } + + case Step::VolumePassword: + { + VolumePasswordWizardPage *page = dynamic_cast (GetCurrentPage()); + Password = page->GetPassword(); + Keyfiles = page->GetKeyfiles(); + + if (forward && Password && !Password->IsEmpty()) + { + try + { + Password->CheckPortability(); + } + catch (UnportablePassword &e) + { + Gui->ShowError (e); + return GetCurrentStep(); + } + + if (Password->Size() < VolumePassword::WarningSizeThreshold + && !Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true)) + { + return GetCurrentStep(); + } + } + + if (forward && OuterVolume) + { + // Use FAT to prevent problems with free space + QuickFormatEnabled = false; + SelectedFilesystemType = VolumeCreationOptions::FilesystemType::FAT; + return Step::CreationProgress; + } + + if (VolumeSize > 4 * BYTES_PER_GB) + { + if (VolumeSize <= TC_MAX_FAT_SECTOR_COUNT * SectorSize) + return Step::LargeFilesSupport; + else + SelectedFilesystemType = VolumeCreationOptions::FilesystemType::GetPlatformNative(); + } + + return Step::FormatOptions; + } + + case Step::LargeFilesSupport: + { + SingleChoiceWizardPage *page = dynamic_cast *> (GetCurrentPage()); + + try + { + LargeFilesSupport = page->GetSelection(); + } + catch (NoItemSelected &) + { + return GetCurrentStep(); + } + + if (LargeFilesSupport) + SelectedFilesystemType = VolumeCreationOptions::FilesystemType::GetPlatformNative(); + else + SelectedFilesystemType = VolumeCreationOptions::FilesystemType::FAT; + + return Step::FormatOptions; + } + + case Step::FormatOptions: + { + VolumeFormatOptionsWizardPage *page = dynamic_cast (GetCurrentPage()); + SelectedFilesystemType = page->GetFilesystemType(); + QuickFormatEnabled = page->IsQuickFormatEnabled(); + + if (SelectedFilesystemType != VolumeCreationOptions::FilesystemType::None + && SelectedFilesystemType != VolumeCreationOptions::FilesystemType::FAT) + return Step::CrossPlatformSupport; + + return Step::CreationProgress; + } + + case Step::CrossPlatformSupport: + { + SingleChoiceWizardPage *page = dynamic_cast *> (GetCurrentPage()); + + try + { + CrossPlatformSupport = page->GetSelection(); + } + catch (NoItemSelected &) + { + return GetCurrentStep(); + } + + if (forward && CrossPlatformSupport) + Gui->ShowWarning (StringFormatter (_("Please note that the volume will not be formatted with a FAT filesystem and, therefore, you may be required to install additional filesystem drivers on platforms other than {0}, which will enable you to mount the volume."), SystemInfo::GetPlatformName())); + + return Step::CreationProgress; + } + + case Step::CreationProgress: + { + VolumeCreationProgressWizardPage *page = dynamic_cast (GetCurrentPage()); + + DisplayKeyInfo = page->IsKeyInfoDisplayed(); + + if (forward) + { + if (SelectedVolumeType != VolumeType::Hidden || OuterVolume) + { + if (OuterVolume && VolumeSize > TC_MAX_FAT_SECTOR_COUNT * SectorSize) + { + uint64 limit = TC_MAX_FAT_SECTOR_COUNT * SectorSize / BYTES_PER_TB; + wstring err = StringFormatter (_("Error: The hidden volume to be created is larger than {0} TB ({1} GB).\n\nPossible solutions:\n- Create a container/partition smaller than {0} TB.\n"), limit, limit * 1024); + + if (SectorSize < 4096) + { + err += _("- Use a drive with 4096-byte sectors to be able to create partition/device-hosted hidden volumes up to 16 TB in size"); +#if defined (TC_LINUX) + err += _(".\n"); +#else + err += _(" (not supported by components available on this platform).\n"); +#endif + } + + Gui->ShowError (err); + return GetCurrentStep(); + } + + if (SelectedVolumePath.IsDevice()) + { + wxString confirmMsg = LangString["OVERWRITEPROMPT_DEVICE"]; + confirmMsg.Replace (L"%hs", L"%s"); + + if (!Gui->AskYesNo (wxString::Format (confirmMsg, wxString (_("DEVICE")).c_str(), wstring (SelectedVolumePath).c_str(), L""), false, true)) + return GetCurrentStep(); + } + else if (FilesystemPath (wstring (SelectedVolumePath)).IsFile()) + { + wxString confirmMsg = LangString["OVERWRITEPROMPT"]; + confirmMsg.Replace (L"%hs", L"%s"); + + if (!Gui->AskYesNo (wxString::Format (confirmMsg, wstring (SelectedVolumePath).c_str(), false, true))) + return GetCurrentStep(); + } + } + + AbortRequested = false; + AbortConfirmationPending = false; + CreationAborted = false; + SetWorkInProgress (true); + UpdateControls(); + + Gui->BeginInteractiveBusyState (this); + + try + { + make_shared_auto (VolumeCreationOptions, options); + + options->Filesystem = SelectedFilesystemType; + options->FilesystemClusterSize = SelectedFilesystemClusterSize; + options->SectorSize = SectorSize; + options->EA = SelectedEncryptionAlgorithm; + options->Password = Password; + options->Keyfiles = Keyfiles; + options->Path = SelectedVolumePath; + options->Quick = QuickFormatEnabled; + options->Size = VolumeSize; + options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType; + options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash); + + Creator.reset (new VolumeCreator); + Creator->CreateVolume (options); + + page->SetKeyInfo (Creator->GetKeyInfo()); + + class Timer : public wxTimer + { + public: + Timer (VolumeCreationWizard *wizard) : Wizard (wizard) { } + + void Notify() + { + Wizard->OnProgressTimer(); + } + + VolumeCreationWizard *Wizard; + }; + + page->SetProgressRange (options->Size); + page->SetProgressState (true); + ProgressTimer.reset (dynamic_cast (new Timer (this))); + ProgressTimer->Start (50); + } + catch (Exception &e) + { + CreationAborted = true; + OnVolumeCreatorFinished(); + Gui->ShowError (e); + } + } + + return GetCurrentStep(); + } + + case Step::VolumeCreatedInfo: + Creator.reset(); + SetCancelButtonText (L""); + + return Step::VolumeHostType; + + case Step::OuterVolumeContents: + try + { + // Determine maximum size of the hidden volume. Scan cluster table offline as a live filesystem test would + // require using FUSE and loop device which cannot be used for devices with sectors larger than 512. + + wxBusyCursor busy; + MaxHiddenVolumeSize = 0; + + Gui->SetActiveFrame (this); + + if (MountedOuterVolume) + { + Core->DismountVolume (MountedOuterVolume); + MountedOuterVolume.reset(); + } + +#ifdef TC_UNIX + // Temporarily take ownership of a device if the user is not an administrator + UserId origDeviceOwner ((uid_t) -1); + + if (!Core->HasAdminPrivileges() && SelectedVolumePath.IsDevice()) + { + origDeviceOwner = FilesystemPath (wstring (SelectedVolumePath)).GetOwner(); + Core->SetFileOwner (SelectedVolumePath, UserId (getuid())); + } + + finally_do_arg2 (FilesystemPath, SelectedVolumePath, UserId, origDeviceOwner, + { + if (finally_arg2.SystemId != (uid_t) -1) + Core->SetFileOwner (finally_arg, finally_arg2); + }); +#endif + + shared_ptr outerVolume = Core->OpenVolume (make_shared (SelectedVolumePath), true, Password, Keyfiles, VolumeProtection::ReadOnly); + MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume); + + // Add a reserve (in case the user mounts the outer volume and creates new files + // on it by accident or OS writes some new data behind his or her back, such as + // System Restore etc.) + + uint64 reservedSize = outerVolume->GetSize() / 200; + if (reservedSize > 10 * BYTES_PER_MB) + reservedSize = 10 * BYTES_PER_MB; + + if (MaxHiddenVolumeSize < reservedSize) + MaxHiddenVolumeSize = 0; + else + MaxHiddenVolumeSize -= reservedSize; + + MaxHiddenVolumeSize -= MaxHiddenVolumeSize % outerVolume->GetSectorSize(); // Must be a multiple of the sector size + } + catch (exception &e) + { + Gui->SetActiveFrame (this); + Gui->ShowError (e); + return GetCurrentStep(); + } + + return Step::HiddenVolume; + + case Step::HiddenVolume: + return Step::EncryptionOptions; + + default: + throw ParameterIncorrect (SRC_POS); + } + } + + void VolumeCreationWizard::UpdateControls () + { + VolumeCreationProgressWizardPage *page = dynamic_cast (GetCurrentPage()); + if (page) + { + page->EnableAbort (IsWorkInProgress()); + } + } + + bool VolumeCreationWizard::DeviceWarningConfirmed; +} diff --git a/src/Main/Forms/VolumeCreationWizard.h b/src/Main/Forms/VolumeCreationWizard.h new file mode 100644 index 00000000..fb2a8ddd --- /dev/null +++ b/src/Main/Forms/VolumeCreationWizard.h @@ -0,0 +1,85 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumeCreationWizard +#define TC_HEADER_Main_Forms_VolumeCreationWizard + +#include "WizardFrame.h" +#include "Core/VolumeCreator.h" + +namespace TrueCrypt +{ + class VolumeCreationWizard : public WizardFrame + { + public: + VolumeCreationWizard (wxWindow* parent); + ~VolumeCreationWizard (); + + protected: + struct Step + { + enum Enum + { + VolumeHostType, + VolumeType, + VolumeLocation, + EncryptionOptions, + VolumeSize, + VolumePassword, + LargeFilesSupport, + FormatOptions, + CrossPlatformSupport, + CreationProgress, + VolumeCreatedInfo, + OuterVolumeContents, + HiddenVolume + }; + }; + + void CreateVolume (); + WizardPage *GetPage (WizardStep step); + void OnAbortButtonClick (EventArgs &args); + void OnMouseMotion (wxMouseEvent& event); + void OnProgressTimer (); + void OnRandomPoolUpdateTimer (); + void OnThreadExiting (wxCommandEvent& event); + void OnVolumeCreatorFinished (); + WizardStep ProcessPageChangeRequest (bool forward); + + volatile bool AbortConfirmationPending; + volatile bool AbortRequested; + volatile bool CreationAborted; + auto_ptr Creator; + bool CrossPlatformSupport; + static bool DeviceWarningConfirmed; + bool DisplayKeyInfo; + auto_ptr ProgressTimer; + auto_ptr RandomPoolUpdateTimer; + shared_ptr Keyfiles; + bool LargeFilesSupport; + uint64 MaxHiddenVolumeSize; + shared_ptr MountedOuterVolume; + bool OuterVolume; + bool QuickFormatEnabled; + shared_ptr SelectedEncryptionAlgorithm; + uint32 SelectedFilesystemClusterSize; + VolumeCreationOptions::FilesystemType::Enum SelectedFilesystemType; + VolumePath SelectedVolumePath; + VolumeHostType::Enum SelectedVolumeHostType; + VolumeType::Enum SelectedVolumeType; + shared_ptr Password; + uint32 SectorSize; + shared_ptr SelectedHash; + uint64 VolumeSize; + + private: + void UpdateControls (); + }; +} + +#endif // TC_HEADER_Main_Forms_VolumeCreationWizard diff --git a/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp new file mode 100644 index 00000000..656c7626 --- /dev/null +++ b/src/Main/Forms/VolumeFormatOptionsWizardPage.cpp @@ -0,0 +1,81 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "VolumeFormatOptionsWizardPage.h" + +namespace TrueCrypt +{ + VolumeFormatOptionsWizardPage::VolumeFormatOptionsWizardPage (wxPanel* parent, uint64 volumeSize, uint32 sectorSize, bool enableQuickFormatButton, bool disableNoneFilesystem, bool disable32bitFilesystems) + : VolumeFormatOptionsWizardPageBase (parent) + { + InfoStaticText->SetLabel (_( + "In order to enable your operating system to mount your new volume, it has to be formatted with a filesystem. Please select a filesystem type.\n\nIf your volume is going to be hosted on a device or partition, you can use 'Quick format' to skip encryption of free space of the volume.")); + + if (!disableNoneFilesystem) + FilesystemTypeChoice->Append (LangString["NONE"], (void *) VolumeCreationOptions::FilesystemType::None); + + if (!disable32bitFilesystems && volumeSize <= TC_MAX_FAT_SECTOR_COUNT * sectorSize) + FilesystemTypeChoice->Append (L"FAT", (void *) VolumeCreationOptions::FilesystemType::FAT); + +#ifdef TC_WINDOWS + FilesystemTypeChoice->Append (L"NTFS", (void *) VolumeCreationOptions::FilesystemType::NTFS); +#elif defined (TC_LINUX) + FilesystemTypeChoice->Append (L"Linux Ext2", (void *) VolumeCreationOptions::FilesystemType::Ext2); + FilesystemTypeChoice->Append (L"Linux Ext3", (void *) VolumeCreationOptions::FilesystemType::Ext3); + FilesystemTypeChoice->Append (L"Linux Ext4", (void *) VolumeCreationOptions::FilesystemType::Ext4); +#elif defined (TC_MACOSX) + FilesystemTypeChoice->Append (L"Mac OS Extended", (void *) VolumeCreationOptions::FilesystemType::MacOsExt); +#elif defined (TC_FREEBSD) || defined (TC_SOLARIS) + FilesystemTypeChoice->Append (L"UFS", (void *) VolumeCreationOptions::FilesystemType::UFS); +#endif + + if (!disable32bitFilesystems && volumeSize <= TC_MAX_FAT_SECTOR_COUNT * sectorSize) + SetFilesystemType (VolumeCreationOptions::FilesystemType::FAT); + else + SetFilesystemType (VolumeCreationOptions::FilesystemType::GetPlatformNative()); + + QuickFormatCheckBox->Enable (enableQuickFormatButton); + } + + VolumeCreationOptions::FilesystemType::Enum VolumeFormatOptionsWizardPage::GetFilesystemType () const + { + return (VolumeCreationOptions::FilesystemType::Enum) reinterpret_cast (Gui->GetSelectedData (FilesystemTypeChoice)); + } + + void VolumeFormatOptionsWizardPage::OnFilesystemTypeSelected (wxCommandEvent& event) + { + } + + void VolumeFormatOptionsWizardPage::OnQuickFormatCheckBoxClick (wxCommandEvent& event) + { + if (event.IsChecked()) + { + QuickFormatCheckBox->SetValue (Gui->AskYesNo (LangString["WARN_QUICK_FORMAT"], false, true)); + } + } + + void VolumeFormatOptionsWizardPage::SetFilesystemType (VolumeCreationOptions::FilesystemType::Enum type) + { + switch (type) + { + case VolumeCreationOptions::FilesystemType::None: FilesystemTypeChoice->SetStringSelection (LangString["NONE"]); break; + case VolumeCreationOptions::FilesystemType::FAT: FilesystemTypeChoice->SetStringSelection (L"FAT"); break; + case VolumeCreationOptions::FilesystemType::NTFS: FilesystemTypeChoice->SetStringSelection (L"NTFS"); break; + case VolumeCreationOptions::FilesystemType::Ext2: FilesystemTypeChoice->SetStringSelection (L"Linux Ext2"); break; + case VolumeCreationOptions::FilesystemType::Ext3: FilesystemTypeChoice->SetStringSelection (L"Linux Ext3"); break; + case VolumeCreationOptions::FilesystemType::Ext4: FilesystemTypeChoice->SetStringSelection (L"Linux Ext4"); break; + case VolumeCreationOptions::FilesystemType::MacOsExt: FilesystemTypeChoice->SetStringSelection (L"Mac OS Extended"); break; + case VolumeCreationOptions::FilesystemType::UFS: FilesystemTypeChoice->SetStringSelection (L"UFS"); break; + + default: + throw ParameterIncorrect (SRC_POS); + } + } +} diff --git a/src/Main/Forms/VolumeFormatOptionsWizardPage.h b/src/Main/Forms/VolumeFormatOptionsWizardPage.h new file mode 100644 index 00000000..ae724c66 --- /dev/null +++ b/src/Main/Forms/VolumeFormatOptionsWizardPage.h @@ -0,0 +1,36 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumeFormatOptionsWizardPage +#define TC_HEADER_Main_Forms_VolumeFormatOptionsWizardPage + +#include "Forms.h" +#include "Core/VolumeCreator.h" + +namespace TrueCrypt +{ + class VolumeFormatOptionsWizardPage : public VolumeFormatOptionsWizardPageBase + { + public: + VolumeFormatOptionsWizardPage (wxPanel* parent, uint64 volumeSize, uint32 sectorSize, bool enableQuickFormatButton = true, bool disableNoneFilesystem = false, bool disable32bitFilesystems = false); + + VolumeCreationOptions::FilesystemType::Enum GetFilesystemType () const; + bool IsValid () { return true; } + bool IsQuickFormatEnabled () const { return QuickFormatCheckBox->IsChecked(); } + void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } + void SetFilesystemType (VolumeCreationOptions::FilesystemType::Enum type); + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + void SetQuickFormat (bool enabled) { QuickFormatCheckBox->SetValue (enabled); } + + protected: + void OnFilesystemTypeSelected (wxCommandEvent& event); + void OnQuickFormatCheckBoxClick (wxCommandEvent& event); + }; +} + +#endif // TC_HEADER_Main_Forms_VolumeFormatOptionsWizardPage diff --git a/src/Main/Forms/VolumeLocationWizardPage.cpp b/src/Main/Forms/VolumeLocationWizardPage.cpp new file mode 100644 index 00000000..c3992827 --- /dev/null +++ b/src/Main/Forms/VolumeLocationWizardPage.cpp @@ -0,0 +1,98 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "Main/VolumeHistory.h" +#include "VolumeLocationWizardPage.h" + +namespace TrueCrypt +{ + VolumeLocationWizardPage::VolumeLocationWizardPage (wxPanel* parent, VolumeHostType::Enum hostType, bool selectExisting) + : VolumeLocationWizardPageBase (parent), + SelectExisting (selectExisting) + { + switch (hostType) + { + case VolumeHostType::Device: + SelectFileButton->Show (false); + break; + + case VolumeHostType::File: + SelectDeviceButton->Show (false); + break; + + default: + break; + } + + Gui->PreferencesUpdatedEvent.Connect (EventConnector (this, &VolumeLocationWizardPage::OnPreferencesUpdated)); + VolumeHistory::ConnectComboBox (VolumePathComboBox); + + NoHistoryCheckBox->SetValue (!Gui->GetPreferences().SaveHistory); + } + + VolumeLocationWizardPage::~VolumeLocationWizardPage () + { + Gui->PreferencesUpdatedEvent.Disconnect (this); + VolumeHistory::DisconnectComboBox (VolumePathComboBox); + } + + void VolumeLocationWizardPage::OnNoHistoryCheckBoxClick (wxCommandEvent& event) + { + UserPreferences prefs = Gui->GetPreferences(); + prefs.SaveHistory = !event.IsChecked(); + Gui->SetPreferences (prefs); + + if (event.IsChecked()) + { + try + { + VolumeHistory::Clear(); + } + catch (exception &e) { Gui->ShowError (e); } + } + } + + void VolumeLocationWizardPage::OnPageChanging (bool forward) + { + if (forward) + { + VolumePath path = GetVolumePath(); + if (!path.IsEmpty()) + VolumeHistory::Add (path); + } + } + + void VolumeLocationWizardPage::OnPreferencesUpdated (EventArgs &args) + { + NoHistoryCheckBox->SetValue (!Gui->GetPreferences().SaveHistory); + } + + void VolumeLocationWizardPage::OnSelectFileButtonClick (wxCommandEvent& event) + { + FilePath path = Gui->SelectVolumeFile (this, !SelectExisting); + + if (!path.IsEmpty()) + SetVolumePath (path); + } + + void VolumeLocationWizardPage::OnSelectDeviceButtonClick (wxCommandEvent& event) + { + DevicePath path = Gui->SelectDevice (this); + + if (!path.IsEmpty()) + SetVolumePath (path); + } + + void VolumeLocationWizardPage::SetVolumePath (const VolumePath &path) + { + VolumePathComboBox->SetValue (wstring (path)); + PageUpdatedEvent.Raise(); + } +} diff --git a/src/Main/Forms/VolumeLocationWizardPage.h b/src/Main/Forms/VolumeLocationWizardPage.h new file mode 100644 index 00000000..8634f239 --- /dev/null +++ b/src/Main/Forms/VolumeLocationWizardPage.h @@ -0,0 +1,40 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumeLocationWizardPage +#define TC_HEADER_Main_Forms_VolumeLocationWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + class VolumeLocationWizardPage : public VolumeLocationWizardPageBase + { + public: + VolumeLocationWizardPage (wxPanel* parent, VolumeHostType::Enum hostType = VolumeHostType::Unknown, bool selectExisting = false); + ~VolumeLocationWizardPage (); + + VolumePath GetVolumePath () const { return VolumePath (wstring (VolumePathComboBox->GetValue())); } + bool IsValid () { return !VolumePathComboBox->GetValue().IsEmpty(); } + void OnPageChanging (bool forward); + void SetVolumePath (const VolumePath &path); + void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + + protected: + void OnVolumePathTextChanged (wxCommandEvent& event) { PageUpdatedEvent.Raise(); } + void OnNoHistoryCheckBoxClick (wxCommandEvent& event); + void OnSelectDeviceButtonClick (wxCommandEvent& event); + void OnSelectFileButtonClick (wxCommandEvent& event); + void OnPreferencesUpdated (EventArgs &args); + + bool SelectExisting; + }; +} + +#endif // TC_HEADER_Main_Forms_VolumeLocationWizardPage diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp new file mode 100644 index 00000000..25767f96 --- /dev/null +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -0,0 +1,310 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "KeyfilesDialog.h" +#include "VolumePasswordPanel.h" +#include "SecurityTokenKeyfilesDialog.h" + +namespace TrueCrypt +{ + VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, shared_ptr password, shared_ptr keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, const wxString &passwordLabel) + : VolumePasswordPanelBase (parent), Keyfiles (new KeyfileList) + { + if (keyfiles) + { + *Keyfiles = *keyfiles; + UseKeyfilesCheckBox->SetValue (!Keyfiles->empty()); + } + else + { + *Keyfiles = Gui->GetPreferences().DefaultKeyfiles; + UseKeyfilesCheckBox->SetValue (Gui->GetPreferences().UseKeyfiles && !Keyfiles->empty()); + } + + PasswordTextCtrl->SetMaxLength (VolumePassword::MaxSize); + ConfirmPasswordTextCtrl->SetMaxLength (VolumePassword::MaxSize); + + if (!passwordLabel.empty()) + { + PasswordStaticText->SetLabel (passwordLabel); + GridBagSizer->Detach (PasswordStaticText); + GridBagSizer->Add (PasswordStaticText, wxGBPosition (0, 1), wxGBSpan (1, 1), wxALIGN_CENTER_VERTICAL | wxBOTTOM, Gui->GetDefaultBorderSize()); + } + + CacheCheckBox->Show (enableCache); + + if (!enablePassword && enableKeyfiles) + { + Layout(); + Fit(); + PasswordPlaceholderSizer->SetMinSize (wxSize (PasswordTextCtrl->GetSize().GetWidth(), -1)); + } + else if (!enablePkcs5Prf) + { + GridBagSizer->Remove (PasswordPlaceholderSizer); + } + + PasswordStaticText->Show (enablePassword); + PasswordTextCtrl->Show (enablePassword); + DisplayPasswordCheckBox->Show (enablePassword); + + ConfirmPasswordStaticText->Show (enableConfirmation); + ConfirmPasswordTextCtrl->Show (enableConfirmation); + + UseKeyfilesCheckBox->Show (enableKeyfiles); + KeyfilesButton->Show (enableKeyfiles); + + Pkcs5PrfStaticText->Show (enablePkcs5Prf); + Pkcs5PrfChoice->Show (enablePkcs5Prf); + + if (enablePkcs5Prf) + { + foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms()) + { + if (!kdf.IsDeprecated()) + Pkcs5PrfChoice->Append (kdf.GetName()); + } + Pkcs5PrfChoice->Select (0); + } + + if (!enablePkcs5Prf || (!enablePassword && !enableKeyfiles)) + { + GridBagSizer->Remove (Pkcs5PrfSizer); + } + + // Keyfiles drag & drop + class FileDropTarget : public wxFileDropTarget + { + public: + FileDropTarget (VolumePasswordPanel *panel) : Panel (panel) { } + + wxDragResult OnDragOver (wxCoord x, wxCoord y, wxDragResult def) + { + return wxDragLink; + } + + bool OnDropFiles (wxCoord x, wxCoord y, const wxArrayString &filenames) + { + foreach (const wxString &f, filenames) + Panel->AddKeyfile (make_shared (wstring (f))); + + return true; + } + + protected: + VolumePasswordPanel *Panel; + }; + + if (enableKeyfiles) + { + SetDropTarget (new FileDropTarget (this)); +#ifdef TC_MACOSX + foreach (wxWindow *c, GetChildren()) + c->SetDropTarget (new FileDropTarget (this)); +#endif + } + + Layout(); + Fit(); + } + + VolumePasswordPanel::~VolumePasswordPanel () + { + WipeTextCtrl (PasswordTextCtrl); + WipeTextCtrl (ConfirmPasswordTextCtrl); + } + + void VolumePasswordPanel::AddKeyfile (shared_ptr keyfile) + { + if (!Keyfiles) + Keyfiles.reset (new KeyfileList); + + Keyfiles->push_back (keyfile); + UseKeyfilesCheckBox->SetValue (true); + } + + void VolumePasswordPanel::DisplayPassword (bool display, wxTextCtrl **textCtrl, int row) + { + FreezeScope freeze (this); + + wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD); + newTextCtrl->SetMaxLength (VolumePassword::MaxSize); + newTextCtrl->SetValue ((*textCtrl)->GetValue()); + newTextCtrl->SetMinSize ((*textCtrl)->GetSize()); + + GridBagSizer->Detach ((*textCtrl)); + GridBagSizer->Add (newTextCtrl, wxGBPosition (row, 1), wxGBSpan (1, 2), wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5); + (*textCtrl)->Show (false); + WipeTextCtrl (*textCtrl); + + Fit(); + Layout(); + newTextCtrl->SetMinSize ((*textCtrl)->GetMinSize()); + + newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (VolumePasswordPanel::OnTextChanged), nullptr, this); + *textCtrl = newTextCtrl; + } + + shared_ptr VolumePasswordPanel::GetPassword () const + { + return GetPassword (PasswordTextCtrl); + } + + shared_ptr VolumePasswordPanel::GetPassword (wxTextCtrl *textCtrl) const + { + shared_ptr password; + wchar_t passwordBuf[VolumePassword::MaxSize + 1]; + finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); }); + +#ifdef TC_WINDOWS + int len = GetWindowText (static_cast (textCtrl->GetHandle()), passwordBuf, VolumePassword::MaxSize + 1); + password.reset (new VolumePassword (passwordBuf, len)); +#else + wxString passwordStr (textCtrl->GetValue()); // A copy of the password is created here by wxWidgets, which cannot be erased + for (size_t i = 0; i < passwordStr.size() && i < VolumePassword::MaxSize; ++i) + { + passwordBuf[i] = (wchar_t) passwordStr[i]; + passwordStr[i] = L'X'; + } + password.reset (new VolumePassword (passwordBuf, passwordStr.size() <= VolumePassword::MaxSize ? passwordStr.size() : VolumePassword::MaxSize)); +#endif + return password; + } + + shared_ptr VolumePasswordPanel::GetPkcs5Kdf () const + { + try + { + return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection())); + } + catch (ParameterIncorrect&) + { + return shared_ptr (); + } + } + + void VolumePasswordPanel::OnAddKeyfileDirMenuItemSelected (wxCommandEvent& event) + { + try + { + DirectoryPath dir = Gui->SelectDirectory (this, LangString["SELECT_KEYFILE_PATH"]); + + if (!dir.IsEmpty()) + { + Keyfiles->push_back (make_shared (dir)); + + UseKeyfilesCheckBox->SetValue (!Keyfiles->empty()); + OnUpdate(); + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void VolumePasswordPanel::OnAddKeyfilesMenuItemSelected (wxCommandEvent& event) + { + try + { + FilePathList files = Gui->SelectFiles (this, LangString["SELECT_KEYFILES"], false, true); + + if (!files.empty()) + { + foreach_ref (const FilePath &f, files) + Keyfiles->push_back (make_shared (f)); + + UseKeyfilesCheckBox->SetValue (!Keyfiles->empty()); + OnUpdate(); + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void VolumePasswordPanel::OnAddSecurityTokenSignatureMenuItemSelected (wxCommandEvent& event) + { + try + { + SecurityTokenKeyfilesDialog dialog (this); + if (dialog.ShowModal() == wxID_OK) + { + foreach (const SecurityTokenKeyfilePath &path, dialog.GetSelectedSecurityTokenKeyfilePaths()) + { + Keyfiles->push_back (make_shared (wstring (path))); + } + + if (!dialog.GetSelectedSecurityTokenKeyfilePaths().empty()) + { + UseKeyfilesCheckBox->SetValue (!Keyfiles->empty()); + OnUpdate(); + } + } + } + catch (exception &e) + { + Gui->ShowError (e); + } + } + + void VolumePasswordPanel::OnDisplayPasswordCheckBoxClick (wxCommandEvent& event) + { + DisplayPassword (event.IsChecked(), &PasswordTextCtrl, 1); + + if (ConfirmPasswordTextCtrl->IsShown()) + DisplayPassword (event.IsChecked(), &ConfirmPasswordTextCtrl, 2); + + OnUpdate(); + } + + void VolumePasswordPanel::OnKeyfilesButtonClick (wxCommandEvent& event) + { + KeyfilesDialog dialog (GetParent(), Keyfiles); + + if (dialog.ShowModal() == wxID_OK) + { + Keyfiles = dialog.GetKeyfiles(); + + UseKeyfilesCheckBox->SetValue (!Keyfiles->empty()); + OnUpdate(); + } + } + + void VolumePasswordPanel::OnKeyfilesButtonRightClick (wxMouseEvent& event) + { + wxMenu popup; + Gui->AppendToMenu (popup, LangString["IDC_KEYADD"], this, wxCommandEventHandler (VolumePasswordPanel::OnAddKeyfilesMenuItemSelected)); + Gui->AppendToMenu (popup, LangString["IDC_ADD_KEYFILE_PATH"], this, wxCommandEventHandler (VolumePasswordPanel::OnAddKeyfileDirMenuItemSelected)); + Gui->AppendToMenu (popup, LangString["IDC_TOKEN_FILES_ADD"], this, wxCommandEventHandler (VolumePasswordPanel::OnAddSecurityTokenSignatureMenuItemSelected)); + + PopupMenu (&popup, KeyfilesButton->GetPosition().x + 2, KeyfilesButton->GetPosition().y + 2); + } + + void VolumePasswordPanel::OnKeyfilesButtonRightDown (wxMouseEvent& event) + { +#ifndef TC_MACOSX + event.Skip(); +#endif + } + + bool VolumePasswordPanel::PasswordsMatch () const + { + assert (ConfirmPasswordStaticText->IsShown()); + return *GetPassword (PasswordTextCtrl) == *GetPassword (ConfirmPasswordTextCtrl); + } + + void VolumePasswordPanel::WipeTextCtrl (wxTextCtrl *textCtrl) + { + textCtrl->SetValue (wxString (L'X', textCtrl->GetLineLength(0))); + GetPassword (textCtrl); + } +} diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h new file mode 100644 index 00000000..8488cbd1 --- /dev/null +++ b/src/Main/Forms/VolumePasswordPanel.h @@ -0,0 +1,54 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_PasswordPanel +#define TC_HEADER_Main_Forms_PasswordPanel + +#include "Forms.h" +#include "Platform/Functor.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class VolumePasswordPanel : public VolumePasswordPanelBase + { + public: + VolumePasswordPanel (wxWindow* parent, shared_ptr password, shared_ptr keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, const wxString &passwordLabel = wxString()); + virtual ~VolumePasswordPanel (); + + void AddKeyfile (shared_ptr keyfile); + shared_ptr GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr (); } + shared_ptr GetPassword () const; + shared_ptr GetPkcs5Kdf () const; + void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } + void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } + bool PasswordsMatch () const; + + Event UpdateEvent; + + protected: + void DisplayPassword (bool display, wxTextCtrl **textCtrl, int row); + shared_ptr GetPassword (wxTextCtrl *textCtrl) const; + void OnAddKeyfileDirMenuItemSelected (wxCommandEvent& event); + void OnAddKeyfilesMenuItemSelected (wxCommandEvent& event); + void OnAddSecurityTokenSignatureMenuItemSelected (wxCommandEvent& event); + void OnDisplayPasswordCheckBoxClick (wxCommandEvent& event); + void OnKeyfilesButtonClick (wxCommandEvent& event); + void OnKeyfilesButtonRightClick (wxMouseEvent& event); + void OnKeyfilesButtonRightDown (wxMouseEvent& event); + void OnTextChanged (wxCommandEvent& event) { OnUpdate(); } + void OnUpdate () { UpdateEvent.Raise(); } + void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); } + void WipeTextCtrl (wxTextCtrl *textCtrl); + + shared_ptr Keyfiles; + shared_ptr UpdateCallback; + }; +} + +#endif // TC_HEADER_Main_Forms_PasswordPanel diff --git a/src/Main/Forms/VolumePasswordWizardPage.cpp b/src/Main/Forms/VolumePasswordWizardPage.cpp new file mode 100644 index 00000000..fd4eaf2c --- /dev/null +++ b/src/Main/Forms/VolumePasswordWizardPage.cpp @@ -0,0 +1,39 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "VolumePasswordWizardPage.h" + +namespace TrueCrypt +{ + VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr password, shared_ptr keyfiles, bool enableConfirmation) + : VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation) + { + PasswordPanel = new VolumePasswordPanel (this, password, keyfiles, false, true, true, enableConfirmation); + PasswordPanel->UpdateEvent.Connect (EventConnector (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate)); + + PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); + } + + VolumePasswordWizardPage::~VolumePasswordWizardPage () + { + PasswordPanel->UpdateEvent.Disconnect (this); + } + + bool VolumePasswordWizardPage::IsValid () + { + if (ConfirmationMode && !PasswordPanel->PasswordsMatch()) + return false; + + shared_ptr keyfiles (GetKeyfiles()); + shared_ptr password (GetPassword()); + + return (password && !GetPassword()->IsEmpty()) || (keyfiles && !keyfiles->empty()); + } +} diff --git a/src/Main/Forms/VolumePasswordWizardPage.h b/src/Main/Forms/VolumePasswordWizardPage.h new file mode 100644 index 00000000..d26cc010 --- /dev/null +++ b/src/Main/Forms/VolumePasswordWizardPage.h @@ -0,0 +1,37 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumePasswordWizardPage +#define TC_HEADER_Main_Forms_VolumePasswordWizardPage + +#include "Forms.h" +#include "VolumePasswordPanel.h" + +namespace TrueCrypt +{ + class VolumePasswordWizardPage : public VolumePasswordWizardPageBase + { + public: + VolumePasswordWizardPage (wxPanel* parent, shared_ptr password, shared_ptr keyfiles, bool enableConfirmation = true); + ~VolumePasswordWizardPage (); + + shared_ptr GetKeyfiles () const { return PasswordPanel->GetKeyfiles(); } + shared_ptr GetPassword () const { return PasswordPanel->GetPassword(); } + bool IsValid (); + void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + + protected: + void OnPasswordPanelUpdate (EventArgs &args) { PageUpdatedEvent.Raise(); } + + bool ConfirmationMode; + VolumePasswordPanel *PasswordPanel; + }; +} + +#endif // TC_HEADER_Main_Forms_VolumePasswordWizardPage diff --git a/src/Main/Forms/VolumePropertiesDialog.cpp b/src/Main/Forms/VolumePropertiesDialog.cpp new file mode 100644 index 00000000..65685ba0 --- /dev/null +++ b/src/Main/Forms/VolumePropertiesDialog.cpp @@ -0,0 +1,97 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/Main.h" +#include "Main/GraphicUserInterface.h" +#include "VolumePropertiesDialog.h" + +namespace TrueCrypt +{ + VolumePropertiesDialog::VolumePropertiesDialog (wxWindow* parent, const VolumeInfo &volumeInfo) + : VolumePropertiesDialogBase (parent) + { + list colPermilles; + + PropertiesListCtrl->InsertColumn (0, LangString["PROPERTY"], wxLIST_FORMAT_LEFT, 208); + colPermilles.push_back (500); + PropertiesListCtrl->InsertColumn (1, LangString["VALUE"], wxLIST_FORMAT_LEFT, 192); + colPermilles.push_back (500); + + Gui->SetListCtrlWidth (PropertiesListCtrl, 70, false); + Gui->SetListCtrlHeight (PropertiesListCtrl, 17); + Gui->SetListCtrlColumnWidths (PropertiesListCtrl, colPermilles, false); + + AppendToList ("LOCATION", wstring (volumeInfo.Path)); +#ifndef TC_WINDOWS + AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice)); +#endif + AppendToList ("SIZE", Gui->SizeToString (volumeInfo.Size)); + AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.Protection)); + AppendToList ("READ_ONLY", LangString [volumeInfo.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"]); + + wxString protection; + if (volumeInfo.Type == VolumeType::Hidden) + protection = LangString["NOT_APPLICABLE_OR_NOT_AVAILABLE"]; + else if (volumeInfo.HiddenVolumeProtectionTriggered) + protection = LangString["HID_VOL_DAMAGE_PREVENTED"]; + else + protection = LangString [volumeInfo.Protection == VolumeProtection::HiddenVolumeReadOnly ? "UISTR_YES" : "UISTR_NO"]; + + AppendToList ("HIDDEN_VOL_PROTECTION", protection); + AppendToList ("ENCRYPTION_ALGORITHM", volumeInfo.EncryptionAlgorithmName); + AppendToList ("KEY_SIZE", StringFormatter (L"{0} {1}", volumeInfo.EncryptionAlgorithmKeySize * 8, LangString ["BITS"])); + + if (volumeInfo.EncryptionModeName == L"XTS") + AppendToList ("SECONDARY_KEY_SIZE_XTS", StringFormatter (L"{0} {1}", volumeInfo.EncryptionAlgorithmKeySize * 8, LangString ["BITS"])); + + wstringstream blockSize; + blockSize << volumeInfo.EncryptionAlgorithmBlockSize * 8; + if (volumeInfo.EncryptionAlgorithmBlockSize != volumeInfo.EncryptionAlgorithmMinBlockSize) + blockSize << L"/" << volumeInfo.EncryptionAlgorithmMinBlockSize * 8; + + AppendToList ("BLOCK_SIZE", blockSize.str() + L" " + LangString ["BITS"]); + AppendToList ("MODE_OF_OPERATION", volumeInfo.EncryptionModeName); + AppendToList ("PKCS5_PRF", volumeInfo.Pkcs5PrfName); + +#if 0 + AppendToList ("PKCS5_ITERATIONS", StringConverter::FromNumber (volumeInfo.Pkcs5IterationCount)); + AppendToList ("VOLUME_CREATE_DATE", Gui->VolumeTimeToString (volumeInfo.VolumeCreationTime)); + AppendToList ("VOLUME_HEADER_DATE", Gui->VolumeTimeToString (volumeInfo.HeaderCreationTime)); +#endif + + AppendToList ("VOLUME_FORMAT_VERSION", StringConverter::ToWide (volumeInfo.MinRequiredProgramVersion < 0x600 ? 1 : 2)); + AppendToList ("BACKUP_HEADER", LangString[volumeInfo.MinRequiredProgramVersion >= 0x600 ? "UISTR_YES" : "UISTR_NO"]); + +#ifdef TC_LINUX + if (string (volumeInfo.VirtualDevice).find ("/dev/mapper/truecrypt") != 0) + { +#endif + AppendToList ("TOTAL_DATA_READ", Gui->SizeToString (volumeInfo.TotalDataRead)); + AppendToList ("TOTAL_DATA_WRITTEN", Gui->SizeToString (volumeInfo.TotalDataWritten)); +#ifdef TC_LINUX + } +#endif + + Layout(); + Fit(); + Center(); + + StdButtonsOK->SetDefault(); + } + + void VolumePropertiesDialog::AppendToList (const string &name, const wxString &value) + { + vector fields (PropertiesListCtrl->GetColumnCount()); + + fields[0] = LangString[name]; + fields[1] = value; + + Gui->AppendToListCtrl (PropertiesListCtrl, fields); + } +} diff --git a/src/Main/Forms/VolumePropertiesDialog.h b/src/Main/Forms/VolumePropertiesDialog.h new file mode 100644 index 00000000..d651b6b5 --- /dev/null +++ b/src/Main/Forms/VolumePropertiesDialog.h @@ -0,0 +1,26 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumePropertiesDialog +#define TC_HEADER_Main_Forms_VolumePropertiesDialog + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class VolumePropertiesDialog : public VolumePropertiesDialogBase + { + public: + VolumePropertiesDialog (wxWindow* parent, const VolumeInfo &volumeInfo); + + void AppendToList (const string &name, const wxString &value); + }; +} + +#endif // TC_HEADER_Main_Forms_VolumePropertiesDialog diff --git a/src/Main/Forms/VolumeSizeWizardPage.cpp b/src/Main/Forms/VolumeSizeWizardPage.cpp new file mode 100644 index 00000000..42abfbe6 --- /dev/null +++ b/src/Main/Forms/VolumeSizeWizardPage.cpp @@ -0,0 +1,137 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "VolumeSizeWizardPage.h" + +namespace TrueCrypt +{ + VolumeSizeWizardPage::VolumeSizeWizardPage (wxPanel* parent, const VolumePath &volumePath, uint32 sectorSize, const wxString &freeSpaceText) + : VolumeSizeWizardPageBase (parent), + MaxVolumeSize (0), + MaxVolumeSizeValid (false), + MinVolumeSize (1), + SectorSize (sectorSize) + { + VolumeSizePrefixChoice->Append (LangString["KB"], reinterpret_cast (1024)); + VolumeSizePrefixChoice->Append (LangString["MB"], reinterpret_cast (1024 * 1024)); + VolumeSizePrefixChoice->Append (LangString["GB"], reinterpret_cast (1024 * 1024 * 1024)); + VolumeSizePrefixChoice->Select (Prefix::MB); + + wxLongLong diskSpace = 0; + if (!wxGetDiskSpace (wxFileName (wstring (volumePath)).GetPath(), nullptr, &diskSpace)) + { + VolumeSizeTextCtrl->Disable(); + VolumeSizeTextCtrl->SetValue (L""); + } + + FreeSpaceStaticText->SetFont (Gui->GetDefaultBoldFont (this)); + + if (!freeSpaceText.empty()) + { + FreeSpaceStaticText->SetLabel (freeSpaceText); + } + else + { +#ifdef TC_WINDOWS + wxString drive = wxFileName (wstring (volumePath)).GetVolume(); + if (!drive.empty()) + { + FreeSpaceStaticText->SetLabel (StringFormatter (_("Free space on drive {0}: is {1}."), + drive, Gui->SizeToString (diskSpace.GetValue()))); + } + else +#endif + { + FreeSpaceStaticText->SetLabel (StringFormatter (_("Free space available: {0}"), + Gui->SizeToString (diskSpace.GetValue()))); + } + } + + VolumeSizeTextCtrl->SetMinSize (wxSize (Gui->GetCharWidth (VolumeSizeTextCtrl) * 20, -1)); + + wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc. + const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" }; + validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr)); + VolumeSizeTextCtrl->SetValidator (validator); + } + + uint64 VolumeSizeWizardPage::GetVolumeSize () const + { + uint64 prefixMult = 1; + int selection = VolumeSizePrefixChoice->GetSelection(); + if (selection == wxNOT_FOUND) + return 0; + + prefixMult = reinterpret_cast (VolumeSizePrefixChoice->GetClientData (selection)); + + uint64 val = StringConverter::ToUInt64 (wstring (VolumeSizeTextCtrl->GetValue())); + if (val <= 0x7fffFFFFffffFFFFull / prefixMult) + { + val *= prefixMult; + + uint32 sectorSizeRem = val % SectorSize; + + if (sectorSizeRem != 0) + val += SectorSize - sectorSizeRem; + + return val; + } + else + return 0; + } + + bool VolumeSizeWizardPage::IsValid () + { + if (!VolumeSizeTextCtrl->IsEmpty() && Validate()) + { + try + { + if (GetVolumeSize() >= MinVolumeSize && (!MaxVolumeSizeValid || GetVolumeSize() <= MaxVolumeSize)) + return true; + } + catch (...) { } + } + return false; + } + + void VolumeSizeWizardPage::SetMaxStaticTextWidth (int width) + { + FreeSpaceStaticText->Wrap (width); + InfoStaticText->Wrap (width); + } + + void VolumeSizeWizardPage::SetVolumeSize (uint64 size) + { + if (size == 0) + { + VolumeSizePrefixChoice->Select (Prefix::MB); + VolumeSizeTextCtrl->SetValue (L""); + return; + } + + if (size % (1024 * 1024 * 1024) == 0) + { + size /= 1024 * 1024 * 1024; + VolumeSizePrefixChoice->Select (Prefix::GB); + } + else if (size % (1024 * 1024) == 0) + { + size /= 1024 * 1024; + VolumeSizePrefixChoice->Select (Prefix::MB); + } + else + { + size /= 1024; + VolumeSizePrefixChoice->Select (Prefix::KB); + } + + VolumeSizeTextCtrl->SetValue (StringConverter::FromNumber (size)); + } +} diff --git a/src/Main/Forms/VolumeSizeWizardPage.h b/src/Main/Forms/VolumeSizeWizardPage.h new file mode 100644 index 00000000..d6f19428 --- /dev/null +++ b/src/Main/Forms/VolumeSizeWizardPage.h @@ -0,0 +1,51 @@ +/* + Copyright (c) 2008-2010 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_VolumeSizeWizardPage +#define TC_HEADER_Main_Forms_VolumeSizeWizardPage + +#include "Forms.h" + +namespace TrueCrypt +{ + class VolumeSizeWizardPage : public VolumeSizeWizardPageBase + { + public: + VolumeSizeWizardPage (wxPanel* parent, const VolumePath &volumePath, uint32 sectorSize, const wxString &freeSpaceText = wxEmptyString); + + uint64 GetVolumeSize () const; + bool IsValid (); + void SetMaxStaticTextWidth (int width); + void SetMaxVolumeSize (uint64 size) { MaxVolumeSize = size; MaxVolumeSizeValid = true; } + void SetMinVolumeSize (uint64 size) { MinVolumeSize = size; } + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + void SetVolumeSize (uint64 size); + + protected: + struct Prefix + { + enum + { + KB = 0, + MB, + GB + }; + }; + + void OnBrowseButtonClick (wxCommandEvent& event); + void OnVolumeSizePrefixSelected (wxCommandEvent& event) { PageUpdatedEvent.Raise(); } + void OnVolumeSizeTextChanged (wxCommandEvent& event) { PageUpdatedEvent.Raise(); } + + uint64 MaxVolumeSize; + bool MaxVolumeSizeValid; + uint64 MinVolumeSize; + uint32 SectorSize; + }; +} + +#endif // TC_HEADER_Main_Forms_VolumeSizeWizardPage diff --git a/src/Main/Forms/WizardFrame.cpp b/src/Main/Forms/WizardFrame.cpp new file mode 100644 index 00000000..9941be81 --- /dev/null +++ b/src/Main/Forms/WizardFrame.cpp @@ -0,0 +1,189 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "Main/Resources.h" +#include "WizardFrame.h" + +namespace TrueCrypt +{ + WizardFrame::WizardFrame (wxWindow* parent) + : WizardFrameBase (parent), + CurrentPage (nullptr), + CurrentStep (-1), + MaxStaticTextWidth (-1), + WorkInProgress (false) + { + SetIcon (Resources::GetTrueCryptIcon()); + + PageTitleStaticText->SetFont (wxFont ( +#ifdef TC_WINDOWS + 16 +#elif defined(TC_MACOSX) + 18 +#elif defined(__WXGTK__) + 14 +#endif + * Gui->GetCharHeight (this) / 13, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Times New Roman")); + + UpdateControls(); + this->SetDefaultItem (NextButton); + NextButton->SetFocus(); + + foreach (wxWindow *c, MainPanel->GetChildren()) + c->Connect (wxEVT_MOTION, wxMouseEventHandler (WizardFrame::OnMouseMotion), nullptr, this); + } + + WizardFrame::~WizardFrame () + { + if (CurrentPage) + CurrentPage->Destroy(); + } + + void WizardFrame::ClearHistory () + { + StepHistory.clear(); + UpdateControls(); + } + + void WizardFrame::OnActivate (wxActivateEvent& event) + { + Gui->SetActiveFrame (this); + event.Skip(); + } + + void WizardFrame::OnClose (wxCloseEvent& event) + { + if (WorkInProgress) + return; + + Gui->SetActiveFrame (nullptr); + event.Skip(); + } + + void WizardFrame::OnHelpButtonClick (wxCommandEvent& event) + { + Gui->OpenUserGuide (this); + } + + void WizardFrame::OnNextButtonClick (wxCommandEvent& event) + { + if (CurrentPage->IsValid()) + { + WizardStep nextStep = ProcessPageChangeRequest (true); + if (nextStep != CurrentStep) + SetStep (nextStep); + } + } + + void WizardFrame::OnPreviousButtonClick (wxCommandEvent& event) + { + ProcessPageChangeRequest (false); + + if (!StepHistory.empty()) + { + WizardStep prevStep = *StepHistory.rbegin(); + StepHistory.pop_back(); + SetStep (prevStep, false); + } + } + + void WizardFrame::SetCancelButtonText (const wxString &text) + { + CancelButton->SetLabel (text.empty() ? wxString (_("Cancel")) : text); + } + + void WizardFrame::SetImage (const wxBitmap &bitmap) + { + WizardBitmap->SetBitmap (bitmap); + } + + void WizardFrame::SetMaxStaticTextWidth (size_t charCount) + { + MaxStaticTextWidth = Gui->GetCharWidth (this) * charCount; + } + + void WizardFrame::SetStep (WizardStep newStep) + { + SetStep (newStep, true); + } + + void WizardFrame::SetStep (WizardStep newStep, bool forward) + { + bool init = false; + FreezeScope freeze (this); + +#ifdef TC_WINDOWS + HelpButton->Disable(); // Prevent Help button from getting default focus + NextButton->Enable(); +#endif + if (CurrentPage) + { + if (forward) + StepHistory.push_back (CurrentStep); + + CurrentPage->OnPageChanging (forward); + CurrentPage->Destroy(); + CurrentPage = nullptr; + } + else + init = true; + + CurrentStep = newStep; + CurrentPage = GetPage (newStep); + + CurrentPage->PageUpdatedEvent.Connect (EventConnector (this, &WizardFrame::OnPageUpdated)); + + CurrentPage->Connect (wxEVT_MOTION, wxMouseEventHandler (WizardFrame::OnMouseMotion), nullptr, this); + foreach (wxWindow *c, CurrentPage->GetChildren()) + c->Connect (wxEVT_MOTION, wxMouseEventHandler (WizardFrame::OnMouseMotion), nullptr, this); + + if (MaxStaticTextWidth > 0) + CurrentPage->SetMaxStaticTextWidth (MaxStaticTextWidth); + + PageTitleStaticText->SetLabel (CurrentPage->GetPageTitle()); + PageSizer->Add (CurrentPage, 1, wxALL | wxEXPAND); + + if (init) + { + Fit(); + Layout(); + Center(); + } + else + MainPanel->Layout(); + + CurrentPage->SetFocus(); + + wxString nextButtonText = CurrentPage->GetNextButtonText(); + if (nextButtonText.empty()) + NextButton->SetLabel (_("&Next >")); + else + NextButton->SetLabel (nextButtonText); + +#ifdef TC_WINDOWS + HelpButton->Enable(); +#endif + UpdateControls(); + } + + void WizardFrame::SetWorkInProgress (bool state) + { + WorkInProgress = state; + UpdateControls(); + } + + void WizardFrame::UpdateControls () + { + CancelButton->Enable (!WorkInProgress); + HelpButton->Enable (!WorkInProgress); + NextButton->Enable (!WorkInProgress && CurrentPage != nullptr && CurrentPage->IsValid()); + PreviousButton->Enable (!WorkInProgress && !StepHistory.empty()); + } +} diff --git a/src/Main/Forms/WizardFrame.h b/src/Main/Forms/WizardFrame.h new file mode 100644 index 00000000..d9f9ceb0 --- /dev/null +++ b/src/Main/Forms/WizardFrame.h @@ -0,0 +1,58 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_WizardFrame +#define TC_HEADER_Main_Forms_WizardFrame + +#include "Forms.h" +#include "Main/Main.h" + +namespace TrueCrypt +{ + class WizardFrame : public WizardFrameBase + { + public: + WizardFrame (wxWindow* parent); + virtual ~WizardFrame (); + + protected: + typedef int WizardStep; + + void ClearHistory (); + virtual WizardPage *GetPage (WizardStep step) = 0; + WizardPage *GetCurrentPage () const { return CurrentPage; } + WizardStep GetCurrentStep () const { return CurrentStep; } + wxPanel *GetPageParent () const { return MainPanel; } + bool IsWorkInProgress() const { return WorkInProgress; } + virtual void OnCancelButtonClick (wxCommandEvent& event) { Close(); } + virtual void OnClose (wxCloseEvent& event); + virtual void OnHelpButtonClick (wxCommandEvent& event); + virtual WizardStep ProcessPageChangeRequest (bool forward) = 0; + void SetCancelButtonText (const wxString &text); + void SetImage (const wxBitmap &bitmap); + void SetMaxStaticTextWidth (size_t charCount); + void SetStep (WizardStep newStep); + void SetWorkInProgress (bool state); + + private: + void OnActivate (wxActivateEvent& event); + void OnNextButtonClick (wxCommandEvent& event); + void OnPageUpdated (EventArgs &args) { UpdateControls(); } + void OnPreviousButtonClick (wxCommandEvent& event); + void SetStep (WizardStep newStep, bool forward); + void UpdateControls (); + + WizardPage *CurrentPage; + WizardStep CurrentStep; + int MaxStaticTextWidth; + list StepHistory; + bool WorkInProgress; + }; +} + +#endif // TC_HEADER_Main_Forms_WizardFrame diff --git a/src/Main/Forms/WizardPage.h b/src/Main/Forms/WizardPage.h new file mode 100644 index 00000000..e00b8605 --- /dev/null +++ b/src/Main/Forms/WizardPage.h @@ -0,0 +1,41 @@ +/* + Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved. + + Governed by the TrueCrypt License 3.0 the full text of which is contained in + the file License.txt included in TrueCrypt binary and source code distribution + packages. +*/ + +#ifndef TC_HEADER_Main_Forms_WizardPage +#define TC_HEADER_Main_Forms_WizardPage + +#include "Main/Main.h" + +namespace TrueCrypt +{ + class WizardPage : public wxPanel + { + public: + WizardPage (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) + : wxPanel (parent, id, pos, size, style) + { } + virtual ~WizardPage () { } + + wxString GetPageTitle () const { return PageTitle; } + virtual bool IsValid () = 0; + virtual void OnPageChanging (bool forward) { } + wxString GetNextButtonText () const { return NextButtonText; } + void SetNextButtonText (const wxString &text) { NextButtonText = text; } + virtual void SetMaxStaticTextWidth (int width) { } + void SetPageTitle (const wxString &title) { PageTitle = title; } + virtual void SetPageText (const wxString &text) = 0; + + Event PageUpdatedEvent; + + protected: + wxString PageTitle; + wxString NextButtonText; + }; +} + +#endif // TC_HEADER_Main_Forms_WizardPage -- cgit v1.2.3