Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.11 KB | None | 0 0
  1. === modified file 'win32/DirectoryListingFrame.cpp'
  2. --- win32/DirectoryListingFrame.cpp 2010-07-10 14:36:48 +0000
  3. +++ win32/DirectoryListingFrame.cpp 2010-11-20 17:09:14 +0000
  4. @@ -49,6 +49,8 @@
  5.  
  6.  DirectoryListingFrame::UserMap DirectoryListingFrame::lists;
  7.  
  8. +TStringList DirectoryListingFrame::lastSearches;
  9. +
  10.  int DirectoryListingFrame::ItemInfo::getImage() const {
  11.     if(type == DIRECTORY || type == USER) {
  12.         return dir->getComplete() ? WinUtil::getDirIconIndex() : WinUtil::getDirMaskedIndex();
  13. @@ -891,12 +893,20 @@
  14.  {
  15.     if(!findNext) {
  16.         // Prompt for substring to find
  17. -       ParamDlg dlg(this, T_("Search for file"), T_("Enter search string"));
  18. +       ParamDlg dlg(this, T_("Search for file"), T_("Enter search string"), lastSearches, 0, true /*comboBoxEdit*/);
  19.  
  20.         if(dlg.run() != IDOK)
  21.             return;
  22.  
  23. -       findStr = Text::fromT(dlg.getValue());
  24. +       tstring value = dlg.getValue();
  25. +       if(!value.empty() && std::find(lastSearches.begin(), lastSearches.end(), value) == lastSearches.end()) {
  26. +           size_t i = max(SETTING(SEARCH_HISTORY)-1, 0);
  27. +           while(lastSearches.size() > i) {
  28. +               lastSearches.erase(lastSearches.end());
  29. +           }
  30. +           lastSearches.insert(lastSearches.begin(), value);
  31. +       }
  32. +       findStr = Text::fromT(value);
  33.         skipHits = 0;
  34.     } else {
  35.         skipHits++;
  36.  
  37. === modified file 'win32/DirectoryListingFrame.h'
  38. --- win32/DirectoryListingFrame.h   2010-07-10 14:36:48 +0000
  39. +++ win32/DirectoryListingFrame.h   2010-11-20 15:48:33 +0000
  40. @@ -182,6 +182,8 @@
  41.     bool updating;
  42.     bool searching;
  43.  
  44. +   static TStringList lastSearches;
  45. +  
  46.     StringMap ucLineParams;
  47.  
  48.     typedef unordered_map<UserPtr, DirectoryListingFrame*, User::Hash> UserMap;
  49.  
  50. === modified file 'win32/ParamDlg.cpp'
  51. --- win32/ParamDlg.cpp  2010-07-10 14:36:48 +0000
  52. +++ win32/ParamDlg.cpp  2010-11-20 16:07:38 +0000
  53. @@ -39,12 +39,12 @@
  54.     addTextBox(name, value, password);
  55.  }
  56.  
  57. -ParamDlg::ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel) :
  58. +ParamDlg::ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel, bool edit) :
  59.  GridDialog(parent, width),
  60.  left(0)
  61.  {
  62.     onInitDialog(std::bind(&ParamDlg::initDialog, this, title));
  63. -   addComboBox(name, choices, sel);
  64. +   addComboBox(name, choices, sel, edit);
  65.  }
  66.  
  67.  void ParamDlg::addTextBox(const tstring& name, const tstring& value, bool password) {
  68. @@ -55,8 +55,8 @@
  69.     initFs.push_back(std::bind(&ParamDlg::initIntTextBox, this, name, value, min, max));
  70.  }
  71.  
  72. -void ParamDlg::addComboBox(const tstring& name, const TStringList& choices, size_t sel) {
  73. -   initFs.push_back(std::bind(&ParamDlg::initComboBox, this, name, choices, sel));
  74. +void ParamDlg::addComboBox(const tstring& name, const TStringList& choices, size_t sel, bool edit) {
  75. +   initFs.push_back(std::bind(&ParamDlg::initComboBox, this, name, choices, sel, edit));
  76.  }
  77.  
  78.  void ParamDlg::initTextBox(const tstring& name, const tstring& value, bool password) {
  79. @@ -80,8 +80,8 @@
  80.     valueFs.push_back(std::bind((tstring (TextBox::*)() const)(&TextBox::getText), box));
  81.  }
  82.  
  83. -void ParamDlg::initComboBox(const tstring& name, const TStringList& choices, size_t sel) {
  84. -   ComboBoxPtr box = left->addChild(GroupBox::Seed(name))->addChild(WinUtil::Seeds::Dialog::comboBox);
  85. +void ParamDlg::initComboBox(const tstring& name, const TStringList& choices, size_t sel, bool edit) {
  86. +   ComboBoxPtr box = left->addChild(GroupBox::Seed(name))->addChild(edit ? WinUtil::Seeds::Dialog::comboBoxEdit : WinUtil::Seeds::Dialog::comboBox);
  87.     for(TStringList::const_iterator i = choices.begin(), iend = choices.end(); i != iend; ++i)
  88.         box->addValue(*i);
  89.     box->setSelected(sel);
  90.  
  91. === modified file 'win32/ParamDlg.h'
  92. --- win32/ParamDlg.h    2010-07-10 14:36:48 +0000
  93. +++ win32/ParamDlg.h    2010-11-20 16:07:13 +0000
  94. @@ -32,11 +32,11 @@
  95.     /// shorthand constructor that adds a text box
  96.     ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const tstring& value = Util::emptyStringT, bool password = false);
  97.     /// shorthand constructor that adds a combo box
  98. -   ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel = 0);
  99. +   ParamDlg(dwt::Widget* parent, const tstring& title, const tstring& name, const TStringList& choices, size_t sel = 0, bool edit = false);
  100.  
  101.     void addTextBox(const tstring& name, const tstring& value = Util::emptyStringT, bool password = false);
  102.     void addIntTextBox(const tstring& name, const tstring& value, const int min = UD_MINVAL, const int max = UD_MAXVAL);
  103. -   void addComboBox(const tstring& name, const TStringList& choices, size_t sel = 0);
  104. +   void addComboBox(const tstring& name, const TStringList& choices, size_t sel = 0, bool edit = false);
  105.  
  106.     const TStringList& getValues() const { return values; }
  107.     const tstring& getValue() const { return values[0]; }
  108. @@ -52,7 +52,7 @@
  109.  
  110.     void initTextBox(const tstring& name, const tstring& value, bool password);
  111.     void initIntTextBox(const tstring& name, const tstring& value, const int min, const int max);
  112. -   void initComboBox(const tstring& name, const TStringList& choices, size_t sel);
  113. +   void initComboBox(const tstring& name, const TStringList& choices, size_t sel, bool edit);
  114.  
  115.     bool initDialog(const tstring& title);
  116.     void okClicked();
  117.  
  118. === modified file 'win32/WinUtil.cpp'
  119. --- win32/WinUtil.cpp   2010-10-29 16:31:08 +0000
  120. +++ win32/WinUtil.cpp   2010-11-20 17:11:38 +0000
  121. @@ -88,6 +88,7 @@
  122.  const Tree::Seed WinUtil::Seeds::treeView;
  123.  
  124.  const ComboBox::Seed WinUtil::Seeds::Dialog::comboBox;
  125. +const ComboBox::Seed WinUtil::Seeds::Dialog::comboBoxEdit;
  126.  const TextBox::Seed WinUtil::Seeds::Dialog::textBox;
  127.  const TextBox::Seed WinUtil::Seeds::Dialog::intTextBox;
  128.  const RichTextBox::Seed WinUtil::Seeds::Dialog::richTextBox;
  129.  
  130. === modified file 'win32/WinUtil.h'
  131. --- win32/WinUtil.h 2010-10-24 18:06:17 +0000
  132. +++ win32/WinUtil.h 2010-11-20 16:18:14 +0000
  133. @@ -85,6 +85,7 @@
  134.  
  135.         struct Dialog {
  136.             static const ComboBox::Seed comboBox;
  137. +           static const ComboBox::Seed comboBoxEdit;
  138.             static const TextBox::Seed textBox;
  139.             static const TextBox::Seed intTextBox;
  140.             static const RichTextBox::Seed richTextBox;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement