diff -ruN ../rtorrent-0.7.9-original/src/command_ui.cc src/command_ui.cc--- ../rtorrent-0.7.9-original/src/command_ui.cc 2008-07-31 01:11:37.000000000 +0300+++ src/command_ui.cc 2008-07-31 01:20:51.000000000 +0300@@ -36,6 +36,8 @@ #include "config.h"+#include <ctime>+ #include <rak/functional.h> #include <rak/functional_fun.h> #include <sigc++/adaptors/bind.h>diff -ruN ../rtorrent-0.7.9-original/src/display/frame.h src/display/frame.h--- ../rtorrent-0.7.9-original/src/display/frame.h 2008-07-31 01:11:36.000000000 +0300+++ src/display/frame.h 2008-07-31 01:20:50.000000000 +0300@@ -69,7 +69,7 @@ typedef std::pair<Frame*, bounds_type> dynamic_type;- static const size_type max_size = 5;+ static const size_type max_size = 6; Frame();diff -ruN ../rtorrent-0.7.9-original/src/display/text_element_value.cc src/display/text_element_value.cc--- ../rtorrent-0.7.9-original/src/display/text_element_value.cc 2008-07-31 01:11:37.000000000 +0300+++ src/display/text_element_value.cc 2008-07-31 01:20:50.000000000 +0300@@ -36,6 +36,8 @@ #include "config.h"+#include <ctime>+ #include "globals.h" #include "text_element_value.h"diff -ruN ../rtorrent-0.7.9-original/src/display/window_file_list.cc src/display/window_file_list.cc--- ../rtorrent-0.7.9-original/src/display/window_file_list.cc 2008-07-31 01:11:36.000000000 +0300+++ src/display/window_file_list.cc 2008-07-31 01:20:50.000000000 +0300@@ -36,6 +36,8 @@ #include "config.h"+#include <cstdlib>+ #include <torrent/path.h> #include <torrent/data/file.h> #include <torrent/data/file_list.h>diff -ruN ../rtorrent-0.7.9-original/src/display/window_help.cc src/display/window_help.cc--- ../rtorrent-0.7.9-original/src/display/window_help.cc 1970-01-01 02:00:00.000000000 +0200+++ src/display/window_help.cc 2008-07-31 01:20:50.000000000 +0300@@ -0,0 +1,84 @@+// rTorrent - BitTorrent client+// Copyright (C) 2005-2007, Jari Sundell+//+// 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+//+// In addition, as a special exception, the copyright holders give+// permission to link the code of portions of this program with the+// OpenSSL library under certain conditions as described in each+// individual source file, and distribute linked combinations+// including the two.+//+// You must obey the GNU General Public License in all respects for+// all of the code used other than OpenSSL. If you modify file(s)+// with this exception, you may extend this exception to your version+// of the file(s), but you are not obligated to do so. If you do not+// wish to do so, delete this exception statement from your version.+// If you delete this exception statement from all source files in the+// program, then also delete it here.+//+// Contact: Jari Sundell <jaris@ifi.uio.no>+//+// Skomakerveien 33+// 3185 Skoppum, NORWAY++#include "config.h"++#include <torrent/rate.h>+#include <torrent/tracker_list.h>++#include "canvas.h"+#include "globals.h"+#include "utils.h"+#include "window_help.h"+#include "input/manager.h"+#include "input/bindings.h"++#include "core/download.h"++namespace display {++void+WindowHelp::redraw() {+ m_canvas->erase();++ m_canvas->print(0, 0, "Help -----------------------");++ int pos = 1;++ for (input::Manager::reverse_iterator itr = m_input->rbegin(); itr != m_input->rend(); ++itr) {+ for (input::Bindings::iterator bitr = (*itr)->begin(); bitr != (*itr)->end(); ++bitr) {+ if ((*itr)->has_help((*bitr).first)) {+ m_canvas->print(0, pos++, " %c | %s", (*bitr).first, (*itr)->get_help((*bitr).first).c_str());+ }+ }+ }+}++void+WindowHelp::toggle() {+ if (!m_input)+ return;+ if (shown) {+ set_active(false);+ shown = false;+ } else {+ set_active(true);+ mark_dirty();+ shown = true;+ }+}++}diff -ruN ../rtorrent-0.7.9-original/src/display/window_help.h src/display/window_help.h--- ../rtorrent-0.7.9-original/src/display/window_help.h 1970-01-01 02:00:00.000000000 +0200+++ src/display/window_help.h 2008-07-31 01:20:50.000000000 +0300@@ -0,0 +1,70 @@+// rTorrent - BitTorrent client+// Copyright (C) 2005-2007, Jari Sundell+//+// 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+//+// In addition, as a special exception, the copyright holders give+// permission to link the code of portions of this program with the+// OpenSSL library under certain conditions as described in each+// individual source file, and distribute linked combinations+// including the two.+//+// You must obey the GNU General Public License in all respects for+// all of the code used other than OpenSSL. If you modify file(s)+// with this exception, you may extend this exception to your version+// of the file(s), but you are not obligated to do so. If you do not+// wish to do so, delete this exception statement from your version.+// If you delete this exception statement from all source files in the+// program, then also delete it here.+//+// Contact: Jari Sundell <jaris@ifi.uio.no>+//+// Skomakerveien 33+// 3185 Skoppum, NORWAY++#ifndef RTORRENT_WINDOW_HELP_H+#define RTORRENT_WINDOW_HELP_H++#include <inttypes.h>++#include "window.h"++namespace input {+ class Manager;+ class Bindings;+}++namespace display {++class WindowHelp : public Window {+public:+ WindowHelp() :+ Window(new Canvas, 0, 0, 3, extent_full, extent_full) {}+// Window(new Canvas, 0, 0, 3, extent_full, extent_static) {}++ virtual void redraw();++ void toggle();++ void set_manager(input::Manager* manager) { m_input = manager; }++private:+ bool shown;+ input::Manager* m_input;+};++}++#endifdiff -ruN ../rtorrent-0.7.9-original/src/input/bindings.h src/input/bindings.h--- ../rtorrent-0.7.9-original/src/input/bindings.h 2008-07-31 01:11:37.000000000 +0300+++ src/input/bindings.h 2008-07-31 01:20:50.000000000 +0300@@ -38,6 +38,7 @@ #define RTORRENT_INPUT_BINDINGS_H #include <map>+#include <string> #include <ncurses.h> #include <sigc++/functors/slot.h>@@ -48,6 +49,7 @@ typedef sigc::slot0<void> Slot; typedef std::map<int, Slot > Base;+ using Base::iterator; using Base::const_iterator; using Base::reverse_iterator;@@ -72,8 +74,13 @@ void ignore(int key) { (*this)[key] = Slot(); }+ void set_help(int key, std::string help) { m_help[key] = help; }+ std::string& get_help(int key) { return m_help[key]; }+ bool has_help(int key) { return m_help.find(key) != m_help.end(); }+ private: bool m_enabled;+ std::map<int, std::string> m_help; }; }diff -ruN ../rtorrent-0.7.9-original/src/rpc/command_map.cc src/rpc/command_map.cc--- ../rtorrent-0.7.9-original/src/rpc/command_map.cc 2008-07-31 01:11:36.000000000 +0300+++ src/rpc/command_map.cc 2008-07-31 01:20:50.000000000 +0300@@ -36,6 +36,8 @@ #include "config.h"+#include <cstdlib>+ #include <torrent/exceptions.h> #include <torrent/object.h> #include <torrent/data/file_list_iterator.h>diff -ruN ../rtorrent-0.7.9-original/src/rpc/exec_file.cc src/rpc/exec_file.cc--- ../rtorrent-0.7.9-original/src/rpc/exec_file.cc 2008-07-31 01:11:36.000000000 +0300+++ src/rpc/exec_file.cc 2008-07-31 01:20:50.000000000 +0300@@ -36,6 +36,9 @@ #include "config.h"+#include <cstdlib>+#include <cstring>+ #include <string> #include <unistd.h> #include <rak/path.h>diff -ruN ../rtorrent-0.7.9-original/src/rpc/parse.cc src/rpc/parse.cc--- ../rtorrent-0.7.9-original/src/rpc/parse.cc 2008-07-31 01:11:36.000000000 +0300+++ src/rpc/parse.cc 2008-07-31 01:20:50.000000000 +0300@@ -36,6 +36,8 @@ #include "config.h"+#include <cstring>+ #include <locale> #include <rak/path.h> #include <torrent/exceptions.h>diff -ruN ../rtorrent-0.7.9-original/src/ui/root.cc src/ui/root.cc--- ../rtorrent-0.7.9-original/src/ui/root.cc 2008-07-31 01:11:36.000000000 +0300+++ src/ui/root.cc 2008-07-31 01:20:49.000000000 +0300@@ -47,6 +47,7 @@ #include "display/window_title.h" #include "display/window_input.h" #include "display/window_statusbar.h"+#include "display/window_help.h" #include "input/manager.h" #include "input/text_input.h" #include "rpc/parse_commands.h"@@ -64,7 +65,8 @@ m_windowTitle(NULL), m_windowHttpQueue(NULL), m_windowInput(NULL),- m_windowStatusbar(NULL) {+ m_windowStatusbar(NULL),+ m_windowHelp(NULL) { } void@@ -78,20 +80,23 @@ m_windowHttpQueue = new WHttpQueue(control->core()->http_queue()); m_windowInput = new WInput(); m_windowStatusbar = new WStatusbar();+ m_windowHelp = new WHelp(); m_downloadList = new DownloadList(); display::Frame* rootFrame = m_control->display()->root_frame();- rootFrame->initialize_row(5);+ rootFrame->initialize_row(6); rootFrame->frame(0)->initialize_window(m_windowTitle); rootFrame->frame(2)->initialize_window(m_windowHttpQueue);- rootFrame->frame(3)->initialize_window(m_windowInput);- rootFrame->frame(4)->initialize_window(m_windowStatusbar);+ rootFrame->frame(3)->initialize_window(m_windowHelp);+ rootFrame->frame(4)->initialize_window(m_windowInput);+ rootFrame->frame(5)->initialize_window(m_windowStatusbar); m_windowTitle->set_active(true); m_windowStatusbar->set_active(true); m_windowStatusbar->set_bottom(true);+ m_windowHelp->set_manager(m_control->input()); setup_keys();@@ -114,6 +119,7 @@ delete m_windowHttpQueue; delete m_windowInput; delete m_windowStatusbar;+ delete m_windowHelp; m_control->input()->erase(&m_bindings); m_control = NULL;@@ -137,17 +143,32 @@ m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1); m_bindings['Y'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1);+ m_bindings.set_help('a', "Upload throttle increase by 1");+ m_bindings.set_help('y', "Upload throttle decrease by 1");+ m_bindings.set_help('A', "Download throttle increase by 1");+ m_bindings.set_help('Y', "Download throttle decrease by 1");+ } else if (strcasecmp(keyLayout.c_str(), "dvorak") == 0) { m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 1); m_bindings[';'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -1); m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1); m_bindings[':'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1);+ m_bindings.set_help('a', "Upload throttle increase by 1");+ m_bindings.set_help(';', "Upload throttle decrease by 1");+ m_bindings.set_help('A', "Download throttle increase by 1");+ m_bindings.set_help(':', "Download throttle decrease by 1");+ } else { m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 1); m_bindings['z'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -1); m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1); m_bindings['Z'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1);++ m_bindings.set_help('a', "Upload throttle increase by 1");+ m_bindings.set_help('z', "Upload throttle decrease by 1");+ m_bindings.set_help('A', "Download throttle increase by 1");+ m_bindings.set_help('Z', "Download throttle decrease by 1"); } if (strcasecmp(keyLayout.c_str(), "dvorak") != 0) {@@ -175,6 +196,18 @@ m_bindings['\x0C'] = sigc::mem_fun(m_control->display(), &display::Manager::force_redraw); // ^L m_bindings['\x11'] = sigc::mem_fun(m_control, &Control::receive_normal_shutdown); // ^Q+ m_bindings['h'] = sigc::mem_fun(*this, &Root::toggle_help);+ m_bindings.set_help('h', "Toggle help window");++}++void+Root::toggle_help() {+ m_windowHelp->toggle();+// m_windowHelp->set_active(true);+// m_control->display()->root_frame()->frame(1)->initialize_window(m_windowHelp);+// m_windowHelp->mark_dirty();+ m_control->display()->force_redraw(); } voiddiff -ruN ../rtorrent-0.7.9-original/src/ui/root.h src/ui/root.h--- ../rtorrent-0.7.9-original/src/ui/root.h 2008-07-31 01:11:36.000000000 +0300+++ src/ui/root.h 2008-07-31 01:20:49.000000000 +0300@@ -48,6 +48,7 @@ class WindowHttpQueue; class WindowInput; class WindowStatusbar;+ class WindowHelp; } namespace input {@@ -64,6 +65,7 @@ typedef display::WindowHttpQueue WHttpQueue; typedef display::WindowInput WInput; typedef display::WindowStatusbar WStatusbar;+ typedef display::WindowHelp WHelp; Root();@@ -73,6 +75,7 @@ WTitle* window_title() { return m_windowTitle; } WStatusbar* window_statusbar() { return m_windowStatusbar; } WInput* window_input() { return m_windowInput; }+ WHelp* window_help() { return m_windowHelp; } void set_down_throttle(unsigned int throttle); void set_up_throttle(unsigned int throttle);@@ -88,6 +91,8 @@ void disable_input(); input::TextInput* current_input();++ void toggle_help(); private: void setup_keys();@@ -99,6 +104,7 @@ WHttpQueue* m_windowHttpQueue; WInput* m_windowInput; WStatusbar* m_windowStatusbar;+ WHelp* m_windowHelp; input::Bindings m_bindings; };