← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2357: file list search bar; allow splitters to live inside grids

 

------------------------------------------------------------
revno: 2357
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-12-21 15:40:47 +0100
message:
  file list search bar; allow splitters to live inside grids
renamed:
  win32/WidgetPaned.h => dwt/include/dwt/widgets/Splitter.h
modified:
  changelog.txt
  dwt/include/dwt/forward.h
  dwt/src/widgets/ToolBar.cpp
  help/window_file_list.html
  win32/DirectoryListingFrame.cpp
  win32/DirectoryListingFrame.h
  win32/HubFrame.cpp
  win32/HubFrame.h
  win32/MainWindow.cpp
  win32/MainWindow.h
  win32/QueueFrame.cpp
  win32/QueueFrame.h
  win32/SearchFrame.cpp
  win32/SearchFrame.h
  win32/stdafx.h
  dwt/include/dwt/widgets/Splitter.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2010-12-18 16:47:53 +0000
+++ changelog.txt	2010-12-21 14:40:47 +0000
@@ -33,8 +33,10 @@
 * Add a menu to change the group of a fav hub more easily (poy)
 * [ADC] Support hidden users as per the ADC ext spec (poy)
 * [ADC] Group search extensions thanks to "SEGA" (poy)
-* Keep search history in file list windows; add "Previous" button for backwards searching (emtee)
+* Keep search history in file list windows (emtee)
+* Add a "Previous" button in file lists for backwards searching (emtee)
 * More efficient file list searches that start from the current selection (poy)
+* Move the file list searching functionality to a togglable search bar (poy)
 * Update OpenSSL to version 1.0.0c (poy)
 * [L#378829] Make sure our OpenSSL binaries aren't "optimized for MS-DOS" (poy)
 * [L#674545] Add magnet keyword search (thanks flow84)

=== modified file 'dwt/include/dwt/forward.h'
--- dwt/include/dwt/forward.h	2010-11-12 17:22:02 +0000
+++ dwt/include/dwt/forward.h	2010-12-21 14:40:47 +0000
@@ -96,6 +96,12 @@
 class Spinner;
 typedef Spinner* SpinnerPtr;
 
+template<bool horizontal> class Splitter;
+typedef Splitter<false> VSplitter;
+typedef VSplitter* VSplitterPtr;
+typedef Splitter<true> HSplitter;
+typedef HSplitter* HSplitterPtr;
+
 class StatusBar;
 typedef StatusBar* StatusBarPtr;
 

=== renamed file 'win32/WidgetPaned.h' => 'dwt/include/dwt/widgets/Splitter.h'
--- win32/WidgetPaned.h	2010-07-10 14:36:48 +0000
+++ dwt/include/dwt/widgets/Splitter.h	2010-12-21 14:40:47 +0000
@@ -1,36 +1,55 @@
 /*
- * Copyright (C) 2001-2010 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef DCPLUSPLUS_WIN32_WIDGETPANED_H_
-#define DCPLUSPLUS_WIN32_WIDGETPANED_H_
-
-template< bool horizontal >
-class WidgetPaned :
+  DC++ Widget Toolkit
+
+  Copyright (c) 2007-2010, Jacek Sieka
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without modification,
+  are permitted provided that the following conditions are met:
+
+      * Redistributions of source code must retain the above copyright notice,
+        this list of conditions and the following disclaimer.
+      * Redistributions in binary form must reproduce the above copyright notice,
+        this list of conditions and the following disclaimer in the documentation
+        and/or other materials provided with the distribution.
+      * Neither the name of the DWT nor the names of its contributors
+        may be used to endorse or promote products derived from this software
+        without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef DWT_SPLITTER_H
+#define DWT_SPLITTER_H
+
+#include "Container.h"
+
+namespace dwt {
+
+template<bool horizontal>
+class Splitter :
 	public Container
 {
 	typedef Container BaseType;
-	friend class dwt::WidgetCreator< WidgetPaned >;
+
+	friend class WidgetCreator<Splitter>;
+
 public:
 	/// Class type
-	typedef WidgetPaned< horizontal > ThisType;
+	typedef Splitter<horizontal> ThisType;
 
 	/// Object type
-	typedef ThisType * ObjectType;
+	typedef ThisType* ObjectType;
 
 	struct Seed : public BaseType::Seed {
 		typedef ThisType WidgetType;
@@ -46,50 +65,49 @@
 
 	void setRelativePos(double pos_) {
 		pos = pos_;
-		resizeChildren();
-	}
-
-	dwt::Widget* getFirst() {
-		return children.first;
-	}
-	void setFirst(dwt::Widget* child) {
-		children.first = child;
-		resizeChildren();
-	}
-
-	dwt::Widget* getSecond() {
-		return children.second;
-	}
-	void setSecond(dwt::Widget* child) {
-		children.second = child;
-		resizeChildren();
-	}
-
-	void create( const Seed & cs = Seed() );
-
-	void setRect(dwt::Rectangle r) {
+		layout();
+	}
+
+	Widget* getFirst() {
+		return first;
+	}
+	void setFirst(Widget* first_) {
+		dwtassert(first_->getParent() == getParent(), _T("A splitter and its siblings must have the same parent"));
+		first = first_;
+	}
+
+	Widget* getSecond() {
+		return second;
+	}
+	void setSecond(Widget* second_) {
+		dwtassert(second_->getParent() == getParent(), _T("A splitter and its siblings must have the same parent"));
+		second = second_;
+	}
+
+	void create(const Seed& cs = Seed());
+
+	void layout(const Rectangle& r) {
 		rect = r;
-		resizeChildren();
+		layout();
 	}
 
 protected:
-	// Constructor Taking pointer to parent
-	explicit WidgetPaned( dwt::Widget * parent );
+	explicit Splitter(Widget* parent);
 
-	virtual ~WidgetPaned()
-	{}
+	virtual ~Splitter() { }
 
 private:
-	std::pair<dwt::Widget*, dwt::Widget*> children;
+	Widget* first;
+	Widget* second;
 
 	double pos;
 
 	bool moving;
 
-	dwt::Rectangle rect;
+	Rectangle rect;
 
-	dwt::Rectangle getSplitterRect();
-	void resizeChildren();
+	Rectangle getSplitterRect();
+	void layout();
 
 	bool handleLButtonDown() {
 		::SetCapture(handle());
@@ -97,14 +115,14 @@
 		return true;
 	}
 
-	bool handleMouseMove(const dwt::MouseEvent& mouseEvent) {
-		if(mouseEvent.ButtonPressed == dwt::MouseEvent::LEFT && moving) {
-			dwt::ClientCoordinate cc(mouseEvent.pos, getParent());
+	bool handleMouseMove(const MouseEvent& mouseEvent) {
+		if(moving && mouseEvent.ButtonPressed == MouseEvent::LEFT) {
+			ClientCoordinate cc(mouseEvent.pos, getParent());
 			double distance = horizontal ? cc.y() : cc.x();
 			double size = horizontal ? rect.size.y : rect.size.x;
 			double offset = horizontal ? rect.pos.y : rect.pos.x;
 			pos = (distance - offset) / size;
-			resizeChildren();
+			layout();
 		}
 		return true;
 	}
@@ -116,42 +134,35 @@
 	}
 };
 
-typedef WidgetPaned<false> WidgetVPaned;
-typedef WidgetVPaned::ObjectType WidgetVPanedPtr;
-
-typedef WidgetPaned<true>WidgetHPaned;
-typedef WidgetHPaned::ObjectType WidgetHPanedPtr;
-
-template< bool horizontal >
-WidgetPaned< horizontal >::Seed::Seed(double pos_) :
+template<bool horizontal>
+Splitter<horizontal>::Seed::Seed(double pos_) :
 BaseType::Seed(),
 pos(pos_)
 {
 }
 
 template<bool horizontal>
-WidgetPaned<horizontal>::WidgetPaned(dwt::Widget* parent) :
-BaseType(parent, dwt::NormalDispatcher::newClass<ThisType>(0, 0, ::LoadCursor(0, horizontal ? IDC_SIZENS : IDC_SIZEWE))),
+Splitter<horizontal>::Splitter(Widget* parent) :
+BaseType(parent, NormalDispatcher::newClass<ThisType>(0, 0, ::LoadCursor(0, horizontal ? IDC_SIZENS : IDC_SIZEWE))),
+first(0),
+second(0),
 pos(0.5),
 moving(false)
 {
-	children.first = children.second = 0;
 }
 
-template< bool horizontal >
-void WidgetPaned< horizontal >::create( const Seed & cs )
-{
+template<bool horizontal>
+void Splitter<horizontal>::create(const Seed& cs) {
 	pos = cs.pos;
 	BaseType::create(cs);
 
-	onLeftMouseDown(std::bind(&ThisType::handleLButtonDown, this));
-	onMouseMove(std::bind(&ThisType::handleMouseMove, this, _1));
-	onLeftMouseUp(std::bind(&ThisType::handleLButtonUp, this));
+	onLeftMouseDown([this](const MouseEvent&) { return handleLButtonDown(); });
+	onMouseMove([this](const MouseEvent& mouseEvent) { return handleMouseMove(mouseEvent); });
+	onLeftMouseUp([this](const MouseEvent&) { return handleLButtonUp(); });
 }
 
-template< bool horizontal >
-dwt::Rectangle WidgetPaned< horizontal >::getSplitterRect()
-{
+template<bool horizontal>
+Rectangle Splitter<horizontal>::getSplitterRect() {
 	// Sanity check
 	if(pos < 0.) {
 		pos = 0.0;
@@ -159,8 +170,8 @@
 		pos = 1.0;
 	}
 
-	dwt::Rectangle rc;
-	if(!children.first || !children.second) {
+	Rectangle rc;
+	if(!first || !second) {
 		return rc;
 	}
 
@@ -177,24 +188,23 @@
 	return rc;
 }
 
-template< bool horizontal >
-void WidgetPaned< horizontal >::resizeChildren( )
-{
-	if(!children.first) {
-		if(children.second) {
-			children.second->layout(rect);
+template<bool horizontal>
+void Splitter<horizontal>::layout() {
+	if(!first) {
+		if(second) {
+			second->layout(rect);
 		}
-		layout(getSplitterRect());
+		BaseType::layout(getSplitterRect());
 		return;
 	}
-	if(!children.second) {
-		children.first->layout(rect);
-		layout(getSplitterRect());
+	if(!second) {
+		first->layout(rect);
+		BaseType::layout(getSplitterRect());
 		return;
 	}
 
-	dwt::Rectangle left = rect, right = rect;
-	dwt::Rectangle rcSplit = getSplitterRect();
+	Rectangle left = rect, right = rect;
+	Rectangle rcSplit = getSplitterRect();
 
 	if(horizontal) {
 		left.size.y = rcSplit.y() - left.y();
@@ -206,10 +216,12 @@
 		right.size.x = rect.width() - rcSplit.width() - left.width();
 	}
 
-	children.first->layout(left);
-	children.second->layout(right);
-
-	layout(rcSplit);
+	first->layout(left);
+	second->layout(right);
+
+	BaseType::layout(rcSplit);
+}
+
 }
 
 #endif

=== modified file 'dwt/src/widgets/ToolBar.cpp'
--- dwt/src/widgets/ToolBar.cpp	2010-09-02 18:16:12 +0000
+++ dwt/src/widgets/ToolBar.cpp	2010-12-21 14:40:47 +0000
@@ -87,7 +87,7 @@
 	if(hotIcon) {
 		if(!itsHotImageList)
 			setHotImageList(new ImageList(hotIcon->getSize()));
-		itsHotImageList->add(*icon);
+		itsHotImageList->add(*hotIcon);
 	}
 
 	addButton(id, icon ? itsNormalImageList->size() - 1 : I_IMAGENONE, text, helpId, f, dropDownF);

=== modified file 'help/window_file_list.html'
--- help/window_file_list.html	2010-12-11 18:16:14 +0000
+++ help/window_file_list.html	2010-12-21 14:40:47 +0000
@@ -33,19 +33,34 @@
 </dl>
 
 <h2>Context menu commands</h2>
-<!--#include virtual="commands_file_download.inc" --> 
-<!--#include virtual="commands_file_general.inc" --> 
-<!--#include virtual="commands_file_management.inc" --> 
+<!--#include virtual="commands_file_download.inc" -->
+<!--#include virtual="commands_file_general.inc" -->
+<!--#include virtual="commands_file_management.inc" -->
 <dl style="margin-left: 40px;">
   <dt>View as text</dt>
   <dd>
-  	 <p>Using in downloaded filelists, this command downloads the selected file to the temporary folder of the operating system and opens
-  	its contents in a text viewer window. The file will be deleted right after its contents shown.</p>
-  	<p>If you browse your <u>own</u> filelist this will open the selected file (stored locally) in a text viewer window.</p>  	
-    <!--#include virtual="commands_viewastext.inc" --> 
+    <!--#include virtual="commands_viewastext.inc" -->
   </dd>
 </dl>
 
+<h2>Search row (bottom)</h2>
+A search row may be shown right above the status bar to allow looking for files in the current file
+list. Its visibility is controlled by the "Find &#9650;" button.
+<dl style="margin-left: 40px;">
+  <dt>Text-box (left)</dt>
+  <dd cshelp="IDH_FILE_LIST_SEARCH_BOX">Enter your search terms here. The most recent searches can
+  be accessed by unfolding the list contained within this box.</dd>
+  <dt>Find from the beginning</dt>
+  <dd cshelp="IDH_FILE_LIST_FIND_START">Find items that match the search strings specified in the
+  text-box. The search starts from the root of the file list.</dd>
+  <dt>Previous</dt>
+  <dd cshelp="IDH_FILE_LIST_FIND_PREV">Find items that match the search strings specified in the
+  text-box. The search starts from the current selection and goes backwards.</dd>
+  <dt>Next</dt>
+  <dd cshelp="IDH_FILE_LIST_FIND_NEXT">Find items that match the search strings specified in the
+  text-box. The search starts from the current selection and goes forward.</dd>
+</dl>
+
 <h2>Status bar (bottom)</h2>
 <h3>Indicators:</h3>
 <dl style="margin-left: 40px;">
@@ -67,11 +82,8 @@
   <dt>Match queue</dt>
   <dd cshelp="IDH_FILE_LIST_MATCH_QUEUE">Search the list for items you are currently downloading; found items will be automatically added as sources for your current downloads.</dd>
   <dt>Find</dt>
-  <dd cshelp="IDH_FILE_LIST_FIND">Find items based on search strings you can specify.</dd>
-  <dt>Previous</dt>
-  <dd cshelp="IDH_FILE_LIST_PREV">Go backwards for previous items found based on search strings you have specified by pressing the "Find" button.</dd>
-  <dt>Next</dt>
-  <dd cshelp="IDH_FILE_LIST_NEXT">Continue searching for more items based on search strings you have specified by pressing the "Find" button.</dd>
+  <dd cshelp="IDH_FILE_LIST_FIND">Toggle the visibility of the search box, which allows searching
+  within the file list.</dd>
 </dl>
 </body>
 </html>

=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2010-12-20 17:40:42 +0000
+++ win32/DirectoryListingFrame.cpp	2010-12-21 14:40:47 +0000
@@ -21,7 +21,6 @@
 #include "DirectoryListingFrame.h"
 
 #include "MainWindow.h"
-#include "ParamDlg.h"
 #include "TextFrame.h"
 #include "HoldRedraw.h"
 
@@ -169,14 +168,14 @@
 
 DirectoryListingFrame::DirectoryListingFrame(dwt::TabView* mdiParent, const HintedUser& aUser, int64_t aSpeed) :
 	BaseType(mdiParent, _T(""), IDH_FILE_LIST, IDI_DIRECTORY),
+	grid(0),
 	dirs(0),
 	files(0),
-	paned(0),
-	findPrev(0),
-	find(0),
-	findNext(0),
+	searchGrid(0),
+	searchBox(0),
 	listDiff(0),
 	matchQueue(0),
+	find(0),
 	speed(aSpeed),
 	dl(new DirectoryListing(aUser)),
 	user(aUser),
@@ -186,10 +185,17 @@
 	updating(false),
 	searching(false)
 {
-	paned = addChild(WidgetVPaned::Seed(0.3));
+	grid = addChild(Grid::Seed(2, 1));
+	grid->column(0).mode = GridInfo::FILL;
+	grid->row(0).mode = GridInfo::FILL;
+	grid->row(0).align = GridInfo::STRETCH;
+	grid->row(1).size = 0;
+	grid->row(1).mode = GridInfo::STATIC;
+
+	VSplitterPtr paned = grid->addChild(VSplitter::Seed(0.3));
 
 	{
-		dirs = addChild(WidgetDirs::Seed());
+		dirs = grid->addChild(WidgetDirs::Seed());
 		dirs->setHelpId(IDH_FILE_LIST_DIRS);
 		addWidget(dirs);
 		paned->setFirst(dirs);
@@ -200,7 +206,7 @@
 	}
 
 	{
-		files = addChild(WidgetFiles::Seed());
+		files = grid->addChild(WidgetFiles::Seed());
 		files->setHelpId(IDH_FILE_LIST_FILES);
 		addWidget(files);
 		paned->setSecond(files);
@@ -221,6 +227,35 @@
 	{
 		Button::Seed cs = WinUtil::Seeds::button;
 
+		searchGrid = grid->addChild(Grid::Seed(1, 4));
+		grid->setWidget(searchGrid, 1, 0);
+		searchGrid->column(0).mode = GridInfo::FILL;
+
+		searchBox = searchGrid->addChild(WinUtil::Seeds::comboBoxEdit);
+		searchBox->setHelpId(IDH_FILE_LIST_SEARCH_BOX);
+		addWidget(searchBox);
+
+		cs.caption = T_("Find from the beginning");
+		ButtonPtr button = searchGrid->addChild(cs);
+		button->setHelpId(IDH_FILE_LIST_FIND_START);
+		button->setImage(WinUtil::buttonIcon(IDI_SEARCH));
+		button->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_START));
+		addWidget(button);
+
+		cs.caption = T_("Previous");
+		button = searchGrid->addChild(cs);
+		button->setHelpId(IDH_FILE_LIST_FIND_PREV);
+		button->setImage(WinUtil::buttonIcon(IDI_LEFT));
+		button->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_PREV));
+		addWidget(button);
+
+		cs.caption = T_("Next");
+		button = searchGrid->addChild(cs);
+		button->setHelpId(IDH_FILE_LIST_FIND_NEXT);
+		button->setImage(WinUtil::buttonIcon(IDI_RIGHT));
+		button->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_NEXT));
+		addWidget(button);
+
 		cs.caption = T_("Subtract list");
 		listDiff = addChild(cs);
 		listDiff->setHelpId(IDH_FILE_LIST_SUBSTRACT);
@@ -231,32 +266,20 @@
 		matchQueue->setHelpId(IDH_FILE_LIST_MATCH_QUEUE);
 		matchQueue->onClicked(std::bind(&DirectoryListingFrame::handleMatchQueue, this));
 
-		cs.caption = T_("Find");
+		cs.caption = T_("Find") + _T(" \u25B2") /* up arrow */;
 		find = addChild(cs);
 		find->setHelpId(IDH_FILE_LIST_FIND);
 		find->setImage(WinUtil::buttonIcon(IDI_SEARCH));
-		find->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_START));
-
-		cs.caption = T_("Previous");
-		findPrev = addChild(cs);
-		findPrev->setHelpId(IDH_FILE_LIST_PREV);
-		findPrev->setImage(WinUtil::buttonIcon(IDI_LEFT));
-		findPrev->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_PREV));
-
-		cs.caption = T_("Next");
-		findNext = addChild(cs);
-		findNext->setHelpId(IDH_FILE_LIST_NEXT);
-		findNext->setImage(WinUtil::buttonIcon(IDI_RIGHT));
-		findNext->onClicked(std::bind(&DirectoryListingFrame::handleFind, this, FIND_NEXT));
+		find->onClicked(std::bind(&DirectoryListingFrame::handleFindToggle, this));
 	}
 
+	searchGrid->setEnabled(false);
+
 	initStatus();
 
 	status->setSize(STATUS_FILE_LIST_DIFF, listDiff->getPreferredSize().x);
 	status->setSize(STATUS_MATCH_QUEUE, matchQueue->getPreferredSize().x);
 	status->setSize(STATUS_FIND, find->getPreferredSize().x);
-	status->setSize(STATUS_PREV, findPrev->getPreferredSize().x);
-	status->setSize(STATUS_NEXT, findNext->getPreferredSize().x);
 
 	treeRoot = dirs->insert(NULL, new ItemInfo(true, dl->getRoot()));
 
@@ -306,10 +329,8 @@
 	status->mapWidget(STATUS_FILE_LIST_DIFF, listDiff);
 	status->mapWidget(STATUS_MATCH_QUEUE, matchQueue);
 	status->mapWidget(STATUS_FIND, find);
-	status->mapWidget(STATUS_PREV, findPrev);
-	status->mapWidget(STATUS_NEXT, findNext);
 
-	paned->setRect(r);
+	grid->layout(r);
 }
 
 bool DirectoryListingFrame::preClosing() {
@@ -352,6 +373,21 @@
 	}
 }
 
+void DirectoryListingFrame::handleFindToggle() {
+	if(searchGrid->getEnabled()) {
+		searchBox->clear();
+		searchGrid->setEnabled(false);
+		grid->row(1).mode = GridInfo::STATIC;
+	} else {
+		for(auto i = lastSearches.crbegin(), iend = lastSearches.crend(); i != iend; ++i)
+			searchBox->addValue(*i);
+		searchGrid->setEnabled(true);
+		grid->row(1).mode = GridInfo::AUTO;
+		searchBox->setFocus();
+	}
+	layout();
+}
+
 void DirectoryListingFrame::refreshTree(const tstring& root) {
 	HoldRedraw hold(dirs);
 	HTREEITEM ht = findItem(treeRoot, root);
@@ -887,24 +923,21 @@
 }
 
 void DirectoryListingFrame::findFile(FindMode mode) {
-	if(mode == FIND_START || findStr.empty()) {
-		// Prompt for substring to find
-		ParamDlg dlg(this, T_("Search for file"), T_("Enter search string"), lastSearches, 0, true);
-		if(dlg.run() != IDOK)
-			return;
-
-		const tstring& value = dlg.getValue();
-		if(value.empty())
-			return;
-		findStr = Text::fromT(value);
-
-		if(std::find(lastSearches.begin(), lastSearches.end(), value) == lastSearches.end()) {
+	const tstring findStr = searchBox->getText();
+	if(findStr.empty())
+		return;
+
+	{
+		auto prev = std::find(lastSearches.begin(), lastSearches.end(), findStr);
+		if(prev == lastSearches.end()) {
 			size_t i = max(SETTING(SEARCH_HISTORY) - 1, 0);
 			while(lastSearches.size() > i) {
-				lastSearches.erase(lastSearches.end() - 1);
+				lastSearches.erase(lastSearches.begin());
 			}
-			lastSearches.insert(lastSearches.begin(), value);
-		}
+		} else
+			lastSearches.erase(prev);
+		lastSearches.push_back(findStr);
+		searchBox->insertValue(0, findStr);
 	}
 
 	HoldRedraw hold(files);
@@ -928,7 +961,8 @@
 	}
 
 	vector<HTREEITEM> collapse;
-	auto search = findFile(StringSearch(findStr), mode == FIND_PREV, (mode == FIND_START) ? treeRoot : oldDir, files->getSelected(), collapse);
+	auto search = findFile(StringSearch(Text::fromT(findStr)), mode == FIND_PREV,
+		(mode == FIND_START) ? treeRoot : oldDir, files->getSelected(), collapse);
 	for(auto i = collapse.cbegin(), iend = collapse.cend(); i != iend; ++i)
 		dirs->collapse(*i);
 
@@ -945,7 +979,7 @@
 
 	} else {
 		selectDir(oldDir);
-		dwt::MessageBox(this).show(T_("No matches found for:") + _T("\n") + Text::toT(findStr), T_("Search for file"));
+		dwt::MessageBox(this).show(T_("No matches found for:") + _T("\n") + findStr, T_("Search for file"));
 	}
 }
 

=== modified file 'win32/DirectoryListingFrame.h'
--- win32/DirectoryListingFrame.h	2010-12-20 17:19:41 +0000
+++ win32/DirectoryListingFrame.h	2010-12-21 14:40:47 +0000
@@ -58,8 +58,6 @@
 		STATUS_FILE_LIST_DIFF,
 		STATUS_MATCH_QUEUE,
 		STATUS_FIND,
-		STATUS_PREV,
-		STATUS_NEXT,
 		STATUS_LAST
 	};
 
@@ -154,20 +152,22 @@
 		tstring columns[COLUMN_LAST];
 	};
 
+	GridPtr grid;
+
 	typedef TypedTree<ItemInfo> WidgetDirs;
 	typedef WidgetDirs* WidgetDirsPtr;
 	WidgetDirsPtr dirs;
+
 	typedef TypedTable<ItemInfo> WidgetFiles;
 	typedef WidgetFiles* WidgetFilesPtr;
-
 	WidgetFilesPtr files;
-	WidgetVPanedPtr paned;
-
-	ButtonPtr findPrev;
-	ButtonPtr find;
-	ButtonPtr findNext;
+
+	GridPtr searchGrid;
+	ComboBoxPtr searchBox;
+
 	ButtonPtr listDiff;
 	ButtonPtr matchQueue;
+	ButtonPtr find;
 
 	int64_t speed;		/**< Speed at which this file list was downloaded */
 
@@ -183,7 +183,6 @@
 
 	HTREEITEM treeRoot;
 
-	string findStr;
 	string size;
 
 	bool updating;
@@ -219,6 +218,7 @@
 	void handleFind(FindMode mode);
 	void handleListDiff();
 	void handleMatchQueue();
+	void handleFindToggle();
 
 	void handleDownload();
 	void handleViewAsText();

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2010-12-20 17:40:42 +0000
+++ win32/HubFrame.cpp	2010-12-21 14:40:47 +0000
@@ -128,7 +128,7 @@
 hubMenu(false),
 inTabComplete(false)
 {
-	paned = addChild(WidgetVPaned::Seed(0.7));
+	paned = addChild(VSplitter::Seed(0.7));
 
 	chat->setHelpId(IDH_HUB_CHAT);
 	addWidget(chat);
@@ -271,7 +271,7 @@
 	} else if(!checked && paned->getSecond()) {
 		paned->setSecond(0);
 	}
-	paned->setRect(r);
+	paned->layout(r);
 }
 
 void HubFrame::updateStatus() {

=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h	2010-11-30 18:21:53 +0000
+++ win32/HubFrame.h	2010-12-21 14:40:47 +0000
@@ -153,7 +153,7 @@
 		}
 	};
 
-	WidgetVPanedPtr paned;
+	VSplitterPtr paned;
 
 	GridPtr userGrid;
 

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2010-12-08 23:01:06 +0000
+++ win32/MainWindow.cpp	2010-12-21 14:40:47 +0000
@@ -213,7 +213,7 @@
 
 	setHelpId(IDH_MAIN);
 
-	paned = addChild(WidgetHPaned::Seed(SETTING(TRANSFERS_PANED_POS)));
+	paned = addChild(HSplitter::Seed(SETTING(TRANSFERS_PANED_POS)));
 }
 
 void MainWindow::initMenu() {
@@ -870,7 +870,7 @@
 		layoutSlotsSpin();
 	}
 
-	paned->setRect(r);
+	paned->layout(r);
 }
 
 void MainWindow::layoutSlotsSpin() {
@@ -1285,6 +1285,7 @@
 		transfers->prepareClose();
 		::DestroyWindow(transfers->handle());
 		transfers = 0;
+		paned->setSecond(transfers);
 
 		SettingsManager::getInstance()->set(SettingsManager::SHOW_TRANSFERVIEW, false);
 		viewMenu->checkItem(viewIndexes["Transfers"], false);
@@ -1294,7 +1295,7 @@
 		initTransfers();
 	}
 
-	paned->setSecond(transfers);
+	layout();
 }
 
 void MainWindow::switchStatus() {

=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h	2010-12-03 11:29:33 +0000
+++ win32/MainWindow.h	2010-12-21 14:40:47 +0000
@@ -107,7 +107,7 @@
 		TIMER_SAVE
 	};
 
-	WidgetHPanedPtr paned;
+	HSplitterPtr paned;
 	MenuPtr mainMenu;
 	MenuPtr viewMenu;
 	TransferView* transfers;

=== modified file 'win32/QueueFrame.cpp'
--- win32/QueueFrame.cpp	2010-12-20 17:40:42 +0000
+++ win32/QueueFrame.cpp	2010-12-21 14:40:47 +0000
@@ -59,7 +59,7 @@
 queueItems(0),
 fileLists(0)
 {
-	paned = addChild(WidgetVPaned::Seed(SETTING(QUEUE_PANED_POS)));
+	paned = addChild(VSplitter::Seed(SETTING(QUEUE_PANED_POS)));
 
 	{
 		dirs = addChild(WidgetDirs::Seed());
@@ -119,7 +119,7 @@
 	status->layout(r);
 	status->mapWidget(STATUS_SHOW_TREE, showTree);
 
-	paned->setRect(r);
+	paned->layout(r);
 }
 
 bool QueueFrame::handleKeyDownDirs(int c) {

=== modified file 'win32/QueueFrame.h'
--- win32/QueueFrame.h	2010-07-10 15:49:05 +0000
+++ win32/QueueFrame.h	2010-12-21 14:40:47 +0000
@@ -185,7 +185,7 @@
 		QueueItemInfo& operator=(const QueueItemInfo&);
 	};
 
-	WidgetVPanedPtr paned;
+	VSplitterPtr paned;
 
 	typedef TypedTree<DirItemInfo> WidgetDirs;
 	typedef WidgetDirs* WidgetDirsPtr;

=== modified file 'win32/SearchFrame.cpp'
--- win32/SearchFrame.cpp	2010-12-20 17:40:42 +0000
+++ win32/SearchFrame.cpp	2010-12-21 14:40:47 +0000
@@ -113,7 +113,7 @@
 initialType(initialType_),
 droppedResults(0)
 {
-	paned = addChild(WidgetVPaned::Seed(SETTING(SEARCH_PANED_POS)));
+	paned = addChild(VSplitter::Seed(SETTING(SEARCH_PANED_POS)));
 
 	{
 		options = addChild(Grid::Seed(5, 1));
@@ -136,9 +136,8 @@
 		cur->setWidget(searchBox, 0, 0, 1, 2);
 		addWidget(searchBox);
 
-		for(TStringIter i = lastSearches.begin(); i != lastSearches.end(); ++i) {
-			searchBox->insertValue(0, *i);
-		}
+		for(auto i = lastSearches.crbegin(), iend = lastSearches.crend(); i != iend; ++i)
+			searchBox->addValue(*i);
 		searchBox->getTextBox()->onKeyDown(std::bind(&SearchFrame::handleSearchKeyDown, this, _1));
 		searchBox->getTextBox()->onChar(std::bind(&SearchFrame::handleSearchChar, this, _1));
 
@@ -328,7 +327,7 @@
 	status->layout(r);
 	status->mapWidget(STATUS_SHOW_UI, showUI);
 
-	paned->setRect(r);
+	paned->layout(r);
 }
 
 bool SearchFrame::preClosing() {

=== modified file 'win32/SearchFrame.h'
--- win32/SearchFrame.h	2010-11-08 16:27:16 +0000
+++ win32/SearchFrame.h	2010-12-21 14:40:47 +0000
@@ -155,7 +155,7 @@
 	typedef FrameSet::iterator FrameIter;
 	static FrameSet frames;
 
-	WidgetVPanedPtr paned;
+	VSplitterPtr paned;
 
 	GridPtr options;
 

=== modified file 'win32/stdafx.h'
--- win32/stdafx.h	2010-11-30 18:21:53 +0000
+++ win32/stdafx.h	2010-12-21 14:40:47 +0000
@@ -45,6 +45,7 @@
 #include <dwt/widgets/RadioButton.h>
 #include <dwt/widgets/RichTextBox.h>
 #include <dwt/widgets/SaveDialog.h>
+#include <dwt/widgets/Splitter.h>
 #include <dwt/widgets/Table.h>
 #include <dwt/widgets/TabView.h>
 #include <dwt/widgets/TextBox.h>
@@ -83,6 +84,10 @@
 using dwt::SliderPtr;
 using dwt::Spinner;
 using dwt::SpinnerPtr;
+using dwt::HSplitter;
+using dwt::HSplitterPtr;
+using dwt::VSplitter;
+using dwt::VSplitterPtr;
 using dwt::TabView;
 using dwt::TabViewPtr;
 using dwt::TextBox;
@@ -117,4 +122,3 @@
 #include "RichTextBox.h"
 #include "ShellMenu.h"
 #include "Table.h"
-#include "WidgetPaned.h"