Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
2.5 KiB

4 years ago
  1. #include "stdafx.h"
  2. #include "TxDBase.h"
  3. #include "Tokens.h"
  4. #include "FileList.h"
  5. #include "indicate.h"
  6. #include "MemEx.h"
  7. #include "TextSet.h"
  8. // BugBug!? Is the fFromFile form used now? If not, we should delete the interface.
  9. CFileList::CFileList() : CTextMatrix WithType("FileList")
  10. {
  11. m_ptkl = NULL;
  12. m_pisRelevancy = NULL;
  13. m_psel = NULL;
  14. }
  15. CFileList* CFileList::NewFileList(CTokenList *ptkl)
  16. {
  17. CFileList *pfl= NULL;
  18. __try
  19. {
  20. pfl= New CFileList;
  21. pfl->InitialFileList(ptkl);
  22. }
  23. __finally
  24. {
  25. if (_abnormal_termination() && pfl)
  26. {
  27. delete pfl; pfl= NULL;
  28. }
  29. }
  30. return pfl;
  31. }
  32. VOID CFileList::InitialFileList(CTokenList *ptkl)
  33. {
  34. ChangeRef(m_ptkl, ptkl);
  35. ChangeRef(m_pisRelevancy, CIndicatorSet::NewIndicatorSet(ptkl->RowCount()));
  36. NullFilterShowsAll(TRUE);
  37. if (m_psel) { delete m_psel; m_psel= NULL; }
  38. m_psel= New CTMSingleSelect(this);
  39. SetSelector(m_psel);
  40. if (m_ptkl->RowCount()) m_psel->SetSelectedRow(0, FALSE);
  41. }
  42. VOID CFileList::UpdateList(CTokenList *ptkl)
  43. {
  44. InitialFileList(ptkl);
  45. NotifyInterface(CTextMatrix::ShapeChange);
  46. NotifyViewers (CTextMatrix::ShapeChange);
  47. }
  48. CFileList::~CFileList()
  49. {
  50. if (m_ptkl ) DetachRef(m_ptkl );
  51. if (m_pisRelevancy) DetachRef(m_pisRelevancy);
  52. delete m_psel;
  53. }
  54. // File List class:
  55. long CFileList::TrackTextHighlight(long iFile, BOOL fAtStart)
  56. {
  57. if (!m_pisCombinedFilter)
  58. {
  59. m_psel->SetSelectedRow(iFile, TRUE,
  60. fAtStart? CHighlight::HIGHLIGHT_TEXT
  61. : CHighlight::DOT_BOX_TEXT
  62. );
  63. return iFile;
  64. }
  65. if (!m_pisCombinedFilter->IsBitSet(iFile))
  66. {
  67. m_psel->SetSelectedRow(0, FALSE, CHighlight::HIGHLIGHT_TEXT, FALSE);
  68. return -1;
  69. }
  70. long cMarksPreceding= m_pisCombinedFilter->PredecessorMarkCount(iFile);
  71. m_psel->SetSelectedRow(cMarksPreceding, FALSE,
  72. fAtStart? CHighlight::HIGHLIGHT_TEXT
  73. : CHighlight::DOT_BOX_TEXT
  74. );
  75. return cMarksPreceding;
  76. }
  77. ULONG CFileList::GetSlotRef(long iFile)
  78. {
  79. return m_ptkl->GetSlotIndex(iFile);
  80. }
  81. UINT CFileList::GetFileNameI(long iFile, PWCHAR pbDest, WORD cbDestMax) //rmk
  82. {
  83. return m_ptkl->GetWTokenI(iFile, pbDest, cbDestMax);
  84. }
  85. BOOL CFileList::IsRowChecked(long row)
  86. {
  87. ASSERT(m_ptkl);
  88. ASSERT(m_pisRelevancy);
  89. return IsRelevant(MapToActualRow(row));
  90. }