VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Chew <79120643+kthchew@users.noreply.github.com>2022-08-21 11:58:08 -0400
committerGitHub <noreply@github.com>2022-08-21 17:58:08 +0200
commita23d4392fb9b570edd1c0eac9c267a50a6e2dfd7 (patch)
treebb0b008a9017571b53e6a7842f708e861356f8fb
parent53b4019d1f2c69cd1b4ee528c31a78a3a5a0e817 (diff)
downloadVeraCrypt-a23d4392fb9b570edd1c0eac9c267a50a6e2dfd7.tar.gz
VeraCrypt-a23d4392fb9b570edd1c0eac9c267a50a6e2dfd7.zip
Fix incorrect text color in dark mode (#920)
-rw-r--r--src/Main/Forms/VolumePasswordPanel.cpp4
-rw-r--r--src/Main/Forms/VolumePimWizardPage.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index bb1f0c78..3525abf5 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -440,73 +440,73 @@ namespace VeraCrypt
void VolumePasswordPanel::OnKeyfilesButtonRightDown (wxMouseEvent& event)
{
#ifndef TC_MACOSX
event.Skip();
#endif
}
bool VolumePasswordPanel::PasswordsMatch () const
{
assert (ConfirmPasswordStaticText->IsShown());
try
{
return *GetPassword (PasswordTextCtrl) == *GetPassword (ConfirmPasswordTextCtrl);
}
catch (PasswordException&)
{
return false;
}
}
void VolumePasswordPanel::WipeTextCtrl (wxTextCtrl *textCtrl)
{
textCtrl->SetValue (wxString (L'X', textCtrl->GetLineLength(0)));
GetPassword (textCtrl);
}
bool VolumePasswordPanel::UpdatePimHelpText (bool pimChanged)
{
bool guiUpdated = false;
if (pimChanged && VolumePimHelpStaticText->GetForegroundColour() != *wxRED)
{
VolumePimHelpStaticText->SetForegroundColour(*wxRED);
VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
guiUpdated = true;
}
- if (!pimChanged && VolumePimHelpStaticText->GetForegroundColour() != *wxBLACK)
+ if (!pimChanged && VolumePimHelpStaticText->GetForegroundColour() != wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT))
{
- VolumePimHelpStaticText->SetForegroundColour(*wxBLACK);
+ VolumePimHelpStaticText->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
guiUpdated = true;
}
if (guiUpdated)
{
Layout();
Fit();
GetParent()->Layout();
GetParent()->Fit();
}
return guiUpdated;
}
void VolumePasswordPanel::OnUsePimCheckBoxClick( wxCommandEvent& event )
{
if (EnablePimEntry)
{
wxWindow* layoutParent = TopOwnerParent? TopOwnerParent : GetParent();
PimCheckBox->Show (false);
VolumePimStaticText->Show (true);
VolumePimTextCtrl->Show (true);
VolumePimHelpStaticText->Show (true);
if (DisplayPasswordCheckBox->IsChecked ())
DisplayPassword (true, &VolumePimTextCtrl, 3);
else
{
Layout();
Fit();
}
layoutParent->Layout();
layoutParent->Fit();
}
diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp
index 8ce23043..7ef8a3a0 100644
--- a/src/Main/Forms/VolumePimWizardPage.cpp
+++ b/src/Main/Forms/VolumePimWizardPage.cpp
@@ -50,71 +50,71 @@ namespace VeraCrypt
}
void VolumePimWizardPage::SetVolumePim (int pim)
{
if (pim > 0)
{
VolumePimTextCtrl->SetValue (StringConverter::FromNumber (pim));
}
else
{
VolumePimTextCtrl->SetValue (wxT(""));
}
OnPimValueChanged (pim);
}
bool VolumePimWizardPage::IsValid ()
{
return true;
}
void VolumePimWizardPage::OnPimChanged (wxCommandEvent& event)
{
OnPimValueChanged (GetVolumePim ());
}
void VolumePimWizardPage::OnPimValueChanged (int pim)
{
if (pim > 0)
{
VolumePimHelpStaticText->SetForegroundColour(*wxRED);
VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
}
else
{
- VolumePimHelpStaticText->SetForegroundColour(*wxBLACK);
+ VolumePimHelpStaticText->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
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 (MAX_PIM_DIGITS);
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);