diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index f6c20cec..3c0db6a7 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -3209,7 +3209,7 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
VolumePimStaticText->Wrap( -1 );
GridBagSizer->Add( VolumePimStaticText, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxRIGHT, 5 );
- VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
VolumePimTextCtrl->SetMaxLength( 10 );
GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 );
@@ -3350,7 +3350,7 @@ VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID i
VolumePimStaticText->Wrap( -1 );
PimSizer->Add( VolumePimStaticText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
- VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
VolumePimTextCtrl->SetMaxLength( 10 );
PimSizer->Add( VolumePimTextCtrl, 0, wxALL, 5 );
@@ -3361,6 +3361,15 @@ VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID i
PimPanelSizer->Add( PimSizer, 1, wxEXPAND, 5 );
+ wxBoxSizer* bSizer166;
+ bSizer166 = new wxBoxSizer( wxHORIZONTAL );
+
+ DisplayPimCheckBox = new wxCheckBox( this, wxID_ANY, _("&Display PIM"), wxDefaultPosition, wxDefaultSize, 0 );
+ bSizer166->Add( DisplayPimCheckBox, 1, wxALL|wxEXPAND, 5 );
+
+
+ PimPanelSizer->Add( bSizer166, 1, wxEXPAND, 5 );
+
bSizer102->Add( PimPanelSizer, 0, wxEXPAND, 5 );
@@ -3378,12 +3387,14 @@ VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID i
// Connect Events
VolumePimTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePimWizardPageBase::OnPimChanged ), NULL, this );
+ DisplayPimCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePimWizardPageBase::OnDisplayPimCheckBoxClick ), NULL, this );
}
VolumePimWizardPageBase::~VolumePimWizardPageBase()
{
// Disconnect Events
VolumePimTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePimWizardPageBase::OnPimChanged ), NULL, this );
+ DisplayPimCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePimWizardPageBase::OnDisplayPimCheckBoxClick ), NULL, this );
}
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index e950ac2e..629519ae 100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -1026,10 +1026,12 @@ namespace VeraCrypt
wxStaticText* VolumePimStaticText;
wxTextCtrl* VolumePimTextCtrl;
wxStaticText* VolumePimHelpStaticText;
+ wxCheckBox* DisplayPimCheckBox;
wxStaticText* InfoStaticText;
// Virtual event handlers, overide them in your derived class
virtual void OnPimChanged( wxCommandEvent& event ) { event.Skip(); }
+ virtual void OnDisplayPimCheckBoxClick( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 25dfe831..5f5735ab 100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -25972,7 +25972,7 @@
Resizable
1
-
+ wxTE_PASSWORD
0
@@ -27412,7 +27412,7 @@
Resizable
1
-
+ wxTE_PASSWORD
0
@@ -27538,6 +27538,105 @@
+
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 8d4639bf..03134535 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -66,10 +66,7 @@ namespace VeraCrypt
VolumePimTextCtrl->Show (false);
VolumePimHelpStaticText->Show (false);
- 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));
- VolumePimTextCtrl->SetValidator (validator);
+ SetPimValidator ();
ConfirmPasswordStaticText->Show (enableConfirmation);
ConfirmPasswordTextCtrl->Show (enableConfirmation);
@@ -186,17 +183,27 @@ namespace VeraCrypt
UseKeyfilesCheckBox->SetValue (true);
}
+ void VolumePasswordPanel::SetPimValidator ()
+ {
+ 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));
+ VolumePimTextCtrl->SetValidator (validator);
+ }
+
void VolumePasswordPanel::DisplayPassword (bool display, wxTextCtrl **textCtrl, int row)
{
FreezeScope freeze (this);
+ bool isPim = (*textCtrl == VolumePimTextCtrl);
+ int colspan = isPim? 1 : 2;
wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD);
- newTextCtrl->SetMaxLength (VolumePassword::MaxSize);
+ newTextCtrl->SetMaxLength (isPim? 10 : 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);
+ GridBagSizer->Add (newTextCtrl, wxGBPosition (row, 1), wxGBSpan (1, colspan), wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5);
(*textCtrl)->Show (false);
WipeTextCtrl (*textCtrl);
@@ -204,8 +211,11 @@ namespace VeraCrypt
Layout();
newTextCtrl->SetMinSize ((*textCtrl)->GetMinSize());
- newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (VolumePasswordPanel::OnTextChanged), nullptr, this);
+ newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, isPim? wxCommandEventHandler (VolumePasswordPanel::OnPimChanged): wxCommandEventHandler (VolumePasswordPanel::OnTextChanged), nullptr, this);
+ delete *textCtrl;
*textCtrl = newTextCtrl;
+ if (isPim)
+ SetPimValidator ();
}
shared_ptr VolumePasswordPanel::GetPassword () const
@@ -369,6 +379,9 @@ namespace VeraCrypt
if (ConfirmPasswordTextCtrl->IsShown())
DisplayPassword (event.IsChecked(), &ConfirmPasswordTextCtrl, 2);
+
+ if (VolumePimTextCtrl->IsShown())
+ DisplayPassword (event.IsChecked(), &VolumePimTextCtrl, 3);
OnUpdate();
}
@@ -449,9 +462,15 @@ namespace VeraCrypt
VolumePimStaticText->Show (true);
VolumePimTextCtrl->Show (true);
VolumePimHelpStaticText->Show (true);
-
- Layout();
- Fit();
+
+ if (DisplayPasswordCheckBox->IsChecked ())
+ DisplayPassword (true, &VolumePimTextCtrl, 3);
+ else
+ {
+ Layout();
+ Fit();
+ }
+
GetParent()->Layout();
GetParent()->Fit();
}
diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h
index 520c36f6..de2475e9 100644
--- a/src/Main/Forms/VolumePasswordPanel.h
+++ b/src/Main/Forms/VolumePasswordPanel.h
@@ -45,6 +45,7 @@ namespace VeraCrypt
Event UpdateEvent;
protected:
+ void SetPimValidator ();
void DisplayPassword (bool display, wxTextCtrl **textCtrl, int row);
shared_ptr GetPassword (wxTextCtrl *textCtrl) const;
void OnAddKeyfileDirMenuItemSelected (wxCommandEvent& event);
diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp
index 36dc4c7f..8f98cb54 100644
--- a/src/Main/Forms/VolumePimWizardPage.cpp
+++ b/src/Main/Forms/VolumePimWizardPage.cpp
@@ -23,10 +23,7 @@ namespace VeraCrypt
VolumePimWizardPage::VolumePimWizardPage (wxPanel* parent)
: VolumePimWizardPageBase (parent)
{
- 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));
- VolumePimTextCtrl->SetValidator (validator);
+ SetPimValidator ();
}
VolumePimWizardPage::~VolumePimWizardPage ()
@@ -85,6 +82,43 @@ namespace VeraCrypt
{
VolumePimHelpStaticText->SetForegroundColour(*wxBLACK);
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
- }
+ }
+ Fit();
+ Layout();
}
-}
+
+ void VolumePimWizardPage::SetPimValidator ()
+ {
+ 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));
+ VolumePimTextCtrl->SetValidator (validator);
+ }
+
+ void VolumePimWizardPage::OnDisplayPimCheckBoxClick( wxCommandEvent& event )
+ {
+ FreezeScope freeze (this);
+
+ bool display = event.IsChecked ();
+
+ wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD);
+ newTextCtrl->SetMaxLength (10);
+ newTextCtrl->SetValue (VolumePimTextCtrl->GetValue());
+ newTextCtrl->SetMinSize (VolumePimTextCtrl->GetSize());
+
+ PimSizer->Replace (VolumePimTextCtrl, newTextCtrl);
+ VolumePimTextCtrl->Show (false);
+ VolumePimTextCtrl->SetValue (wxString (L'X', VolumePimTextCtrl->GetLineLength(0)));
+ GetVolumePim ();
+
+ Fit();
+ Layout();
+ newTextCtrl->SetMinSize (VolumePimTextCtrl->GetMinSize());
+
+ newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (VolumePimWizardPage::OnPimChanged), nullptr, this);
+ delete VolumePimTextCtrl;
+ VolumePimTextCtrl = newTextCtrl;
+ SetPimValidator ();
+ OnPimChanged (GetVolumePim ());
+ }
+}
\ No newline at end of file
diff --git a/src/Main/Forms/VolumePimWizardPage.h b/src/Main/Forms/VolumePimWizardPage.h
index ae097004..af757359 100644
--- a/src/Main/Forms/VolumePimWizardPage.h
+++ b/src/Main/Forms/VolumePimWizardPage.h
@@ -32,8 +32,10 @@ namespace VeraCrypt
bool IsValid ();
void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); }
void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); }
+ void OnDisplayPimCheckBoxClick( wxCommandEvent& event );
protected:
+ void SetPimValidator ();
void OnPimChanged (wxCommandEvent& event);
void OnPimChanged (int pim);
};