Skip to content

Commit

Permalink
Hide editing controls in multi-selection mode
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vslavik committed Sep 16, 2023
1 parent e2206b4 commit 2830ba5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/editing_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
}

Expand Down
3 changes: 3 additions & 0 deletions src/editing_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2830ba5

Please sign in to comment.