From 2830ba55c97c242f382753799de3d1ea35bc7d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 16 Sep 2023 17:41:54 +0200 Subject: [PATCH] Hide editing controls in multi-selection mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t show (albeit disabled) editing controls if the user selects multiple items. Instead, hide things like character counter, tags or the fuzzy toggle, and clear texts. This is still not ideal UI, but is better than before. --- src/editing_area.cpp | 27 ++++++++++++++++++++++++--- src/editing_area.h | 3 +++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/editing_area.cpp b/src/editing_area.cpp index 0ef4f7aae9..c28c9f5b98 100644 --- a/src/editing_area.cpp +++ b/src/editing_area.cpp @@ -739,8 +739,9 @@ void EditingArea::UpdateEditingUIForCatalog(CatalogPtr catalog) else m_labelSource->SetLabel(_("Source text")); + m_fuzzyToggleNeeded = m_fuzzy && catalog->HasCapability(Catalog::Cap::FuzzyTranslations); if (m_fuzzy) - m_fuzzy->Show(catalog->HasCapability(Catalog::Cap::FuzzyTranslations)); + m_fuzzy->Show(m_fuzzyToggleNeeded); RecreatePluralTextCtrls(catalog); } @@ -876,14 +877,34 @@ void EditingArea::ShowPart(wxWindow *part, bool show) void EditingArea::SetSingleSelectionMode() { - if (!IsThisEnabled()) - Enable(); // in case of previous multiple selection + if (m_isSingleSelection) + return; + m_isSingleSelection = true; + + if (m_fuzzy) + m_fuzzy->Show(m_fuzzyToggleNeeded); + m_charCounter->Show(); + + Enable(); } void EditingArea::SetMultipleSelectionMode() { + if (!m_isSingleSelection) + return; + m_isSingleSelection = false; + // TODO: Show better UI + + if (m_fuzzy) + m_fuzzy->Hide(); + m_charCounter->Hide(); + ShowPluralFormUI(false); + ShowPart(m_tagIdOrContext, false); + ShowPart(m_tagFormat, false); + m_textOrig->Clear(); + m_textTrans->Clear(); Disable(); } diff --git a/src/editing_area.h b/src/editing_area.h index f2a9cb264d..a4df53106f 100644 --- a/src/editing_area.h +++ b/src/editing_area.h @@ -137,6 +137,9 @@ class EditingArea : public wxPanel PoeditListCtrl *m_associatedList; + bool m_isSingleSelection = true; + bool m_fuzzyToggleNeeded = true; + bool m_dontAutoclearFuzzyStatus; SourceTextCtrl *m_textOrig, *m_textOrigPlural;