/* Archive::findModifiedEntries * Returns a list of modified entries, and set archive to unmodified * status if the list is empty *******************************************************************/ vector<ArchiveEntry*> Archive::findModifiedEntries(ArchiveTreeNode* dir) { // Init search variables if (dir == NULL) dir = dir_root; vector<ArchiveEntry*> ret; // Search entries for (unsigned a = 0; a < dir->numEntries(); a++) { ArchiveEntry* entry = dir->getEntry(a); // Add new and modified entries if (entry->getState() != 0) ret.push_back(entry); } // Search subdirectories for (unsigned a = 0; a < dir->nChildren(); a++) { vector<ArchiveEntry*> vec = findModifiedEntries((ArchiveTreeNode*)dir->getChild(a)); ret.insert(ret.end(), vec.begin(), vec.end()); } // If there aren't actually any, set archive to be unmodified if (ret.size() == 0) setModified(false); // Return matches return ret; }
// ---------------------------------------------------------------------------- // ArchiveEntryList::updateItemAttr // // Called when widget requests the attributes // (text colour / background colour / font) for [item] // ---------------------------------------------------------------------------- void ArchiveEntryList::updateItemAttr(long item, long column, long index) const { // Get associated entry ArchiveEntry* entry = getEntry(item); // Init attributes wxColour col_bg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX); item_attr->SetTextColour(WXCOL(ColourConfiguration::getColour("error"))); item_attr->SetBackgroundColour(col_bg); // If entry doesn't exist, return error colour if (!entry) return; // Set font if (elist_name_monospace && !list_font_monospace) item_attr->SetFont((column == 0) ? *font_monospace : *font_normal); else item_attr->SetFont(list_font_monospace ? *font_monospace : *font_normal); // Set background colour defined in entry type (if any) rgba_t col = entry->getType()->getColour(); if ((col.r != 255 || col.g != 255 || col.b != 255) && elist_type_bgcol) { rgba_t bcol; bcol.r = (col.r * elist_type_bgcol_intensity) + (col_bg.Red() * (1.0 - elist_type_bgcol_intensity)); bcol.g = (col.g * elist_type_bgcol_intensity) + (col_bg.Green() * (1.0 - elist_type_bgcol_intensity)); bcol.b = (col.b * elist_type_bgcol_intensity) + (col_bg.Blue() * (1.0 - elist_type_bgcol_intensity)); item_attr->SetBackgroundColour(WXCOL(bcol)); } // Alternating row colour if (elist_alt_row_colour && item % 2 > 0) { wxColour dark = item_attr->GetBackgroundColour().ChangeLightness(95); item_attr->SetBackgroundColour(dark); } // Set colour depending on entry state switch (entry->getState()) { case 1: item_attr->SetTextColour(WXCOL(ColourConfiguration::getColour("modified"))); break; case 2: item_attr->SetTextColour(WXCOL(ColourConfiguration::getColour("new"))); break; default: item_attr->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT)); break; }; // Locked state overrides others if (entry->isLocked()) item_attr->SetTextColour(WXCOL(ColourConfiguration::getColour("locked"))); }