diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Main/Forms/Forms.cpp | 15 | ||||
-rw-r--r-- | src/Main/Forms/Forms.h | 2 | ||||
-rw-r--r-- | src/Main/Forms/TrueCrypt.fbp | 103 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.cpp | 39 | ||||
-rw-r--r-- | src/Main/Forms/VolumePasswordPanel.h | 1 | ||||
-rw-r--r-- | src/Main/Forms/VolumePimWizardPage.cpp | 46 | ||||
-rw-r--r-- | src/Main/Forms/VolumePimWizardPage.h | 2 |
7 files changed, 188 insertions, 20 deletions
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 @@ <property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
- <property name="style"></property>
+ <property name="style">wxTE_PASSWORD</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@@ -27412,7 +27412,7 @@ <property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
- <property name="style"></property>
+ <property name="style">wxTE_PASSWORD</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@@ -27538,6 +27538,105 @@ </object>
</object>
</object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer166</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxCheckBox" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="checked">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">&Display PIM</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">DisplayPimCheckBox</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnCheckBox">OnDisplayPimCheckBoxClick</event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
</object>
</object>
<object class="sizeritem" expanded="0">
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 <VolumePassword> 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 <VolumePassword> 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); }; |