Finalisation de l'ajout de multi-marques

This commit is contained in:
Nicolas H 2021-07-14 09:28:29 +00:00
parent 79d4f6f7a9
commit 8d31ee3056
2 changed files with 21 additions and 12 deletions

View File

@ -1431,12 +1431,22 @@ inline void FListView::mapKeyFunctions()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::vector<int> FListView::getmultimark() std::vector<int> FListView::getmultimark()
{ {
return multi; std::vector<int> list;
for(FListViewIterator item: multi)
list.push_back(item.getPosition());
return list;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::setmultimark(std::vector<int> mark) void FListView::setmultimark(std::vector<int> list)
{ {
multi=mark; multi.clear();
for(int mark: list)
{
FListViewIterator newiterator=itemlist.begin();
newiterator+=mark;
multi.push_back(newiterator);
}
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::setindex(int index) void FListView::setindex(int index)
@ -1655,8 +1665,8 @@ void FListView::drawList()
const bool is_current_line( iter == current_iter ); const bool is_current_line( iter == current_iter );
const bool is_current_mark( iter == mark_iter ); const bool is_current_mark( iter == mark_iter );
bool is_current_selected=false; bool is_current_selected=false;
for(int item: multi) for(FListViewIterator item: multi)
if (item==current_iter.getPosition()) if (item==iter)
{ {
is_current_selected=true; is_current_selected=true;
break; break;
@ -1815,8 +1825,9 @@ inline void FListView::setLineAttributes ( bool is_current
{ {
const auto& wc = getColorTheme(); const auto& wc = getColorTheme();
setColor (wc->list_fg, wc->list_bg); setColor (wc->list_fg, wc->list_bg);
if ( is_mark )
if ( is_current ) setColor ( FColor::White, FColor::Red );
else if ( is_current )
{ {
if ( is_focus && FTerm::getMaxColor() < 16 ) if ( is_focus && FTerm::getMaxColor() < 16 )
setBold(); setBold();
@ -1836,6 +1847,8 @@ inline void FListView::setLineAttributes ( bool is_current
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
setReverse(false); setReverse(false);
} }
else if ( is_selected )
setColor ( FColor::White , FColor::Green );
else else
{ {
if ( FTerm::isMonochron() ) if ( FTerm::isMonochron() )
@ -1843,10 +1856,6 @@ inline void FListView::setLineAttributes ( bool is_current
else if ( is_focus && FTerm::getMaxColor() < 16 ) else if ( is_focus && FTerm::getMaxColor() < 16 )
unsetBold(); unsetBold();
} }
if ( is_selected )
setColor ( FColor::White , FColor::Green );
if ( is_mark )
setColor ( FColor::White, FColor::Red );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -530,7 +530,7 @@ class FListView : public FWidget
bool tree_view{false}; bool tree_view{false};
bool hide_sort_indicator{false}; bool hide_sort_indicator{false};
bool has_checkable_items{false}; bool has_checkable_items{false};
std::vector<int> multi; std::vector<FListViewIterator> multi;
// Function Pointer // Function Pointer
bool (*user_defined_ascending) (const FObject*, const FObject*){nullptr}; bool (*user_defined_ascending) (const FObject*, const FObject*){nullptr};
bool (*user_defined_descending) (const FObject*, const FObject*){nullptr}; bool (*user_defined_descending) (const FObject*, const FObject*){nullptr};