/[gentoo-x86]/net-p2p/rtorrent/files/rtorrent-0.9.0-canvas-fix.patch
Gentoo

Contents of /net-p2p/rtorrent/files/rtorrent-0.9.0-canvas-fix.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Apr 8 18:21:45 2012 UTC (2 years, 7 months ago) by sochotnicky
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Version bump (#411041), drop upstreamed patches and support for color. Too
much work to keep working and delays updates.

(Portage version: 2.1.10.49/cvs/Linux x86_64)

1 Index: rtorrent/src/display/window_download_list.h
2 ===================================================================
3 --- rtorrent/src/display/window_download_list.h (revision 1163)
4 +++ rtorrent/src/display/window_download_list.h (working copy)
5 @@ -59,6 +59,10 @@
6 virtual void redraw();
7
8 void set_view(core::View* l);
9 + void set_done_fg_color(int64_t color);
10 + void set_done_bg_color(int64_t color);
11 + void set_active_fg_color(int64_t color);
12 + void set_active_bg_color(int64_t color);
13
14 private:
15 core::View* m_view;
16 Index: rtorrent/src/display/canvas.cc
17 ===================================================================
18 --- rtorrent/src/display/canvas.cc (revision 1163)
19 +++ rtorrent/src/display/canvas.cc (working copy)
20 @@ -92,6 +92,10 @@
21 m_isInitialized = true;
22
23 initscr();
24 + start_color();
25 + use_default_colors();
26 + init_pair(2, -1, -1);
27 + init_pair(1, -1, -1);
28 raw();
29 noecho();
30 nodelay(stdscr, TRUE);
31 Index: rtorrent/src/display/window_download_list.cc
32 ===================================================================
33 --- rtorrent/src/display/window_download_list.cc (revision 1163)
34 +++ rtorrent/src/display/window_download_list.cc (working copy)
35 @@ -37,6 +37,7 @@
36 #include "config.h"
37
38 #include <rak/algorithm.h>
39 +#include <torrent/rate.h>
40
41 #include "core/download.h"
42 #include "core/view.h"
43 @@ -96,12 +97,30 @@
44 char* position;
45 char* last = buffer + m_canvas->width() - 2 + 1;
46
47 + if( pos >= m_canvas->height() ) break;
48 position = print_download_title(buffer, last, *range.first);
49 - m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
50 + m_canvas->print(0, pos, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
51 + if( (*range.first)->is_done() ) {
52 + if( (*range.first)->info()->up_rate()->rate() != 0 ) {
53 + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_BOLD, 2);
54 + } else {
55 + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 2);
56 + }
57 + } else if( (*range.first)->info()->is_active() ) {
58 + if( (*range.first)->info()->down_rate()->rate() != 0 ) {
59 + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_BOLD, 1);
60 + } else {
61 + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 1);
62 + }
63 + }
64 + pos++;
65 +
66 + if( pos >= m_canvas->height() ) break;
67
68 position = print_download_info(buffer, last, *range.first);
69 m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
70
71 + if( pos >= m_canvas->height() ) break;
72 position = print_download_status(buffer, last, *range.first);
73 m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
74
75 @@ -109,4 +128,41 @@
76 }
77 }
78
79 +void
80 +WindowDownloadList::set_done_fg_color(int64_t color) {
81 + short fg, bg;
82 + pair_content(2, &fg, &bg);
83 + if( color < 0 ) color = -1;
84 + color = color % 8;
85 + init_pair(2, (short)color, bg);
86 }
87 +
88 +void
89 +WindowDownloadList::set_done_bg_color(int64_t color) {
90 + short fg, bg;
91 + pair_content(2, &fg, &bg);
92 + if( color < 0 ) color = -1;
93 + color = color % 8;
94 + init_pair(2, fg, (short)color);
95 +}
96 +
97 +void
98 +WindowDownloadList::set_active_fg_color(int64_t color) {
99 + short fg, bg;
100 + pair_content(1, &fg, &bg);
101 + if( color < 0 ) color = -1;
102 + color = color % 8;
103 + init_pair(1, (short)color, bg);
104 +}
105 +
106 +void
107 +WindowDownloadList::set_active_bg_color(int64_t color) {
108 + short fg, bg;
109 + pair_content(1, &fg, &bg);
110 + if( color < 0 ) color = -1;
111 + color = color % 8;
112 + init_pair(1, fg, (short)color);
113 +}
114 +
115 +}
116 +
117 Index: rtorrent/src/ui/download_list.cc
118 ===================================================================
119 --- rtorrent/src/ui/download_list.cc (revision 1163)
120 +++ rtorrent/src/ui/download_list.cc (working copy)
121 @@ -137,6 +137,11 @@
122 current_view()->next_focus();
123 }
124
125 +display::WindowDownloadList*
126 +DownloadList::current_window_list() {
127 + return dynamic_cast<ElementDownloadList*>(m_uiArray[DISPLAY_DOWNLOAD_LIST])->window();
128 +}
129 +
130 void
131 DownloadList::activate_display(Display displayType) {
132 if (!is_active())
133 Index: rtorrent/src/ui/download_list.h
134 ===================================================================
135 --- rtorrent/src/ui/download_list.h (revision 1163)
136 +++ rtorrent/src/ui/download_list.h (working copy)
137 @@ -101,6 +101,7 @@
138 void activate_display(Display d);
139
140 core::View* current_view();
141 + display::WindowDownloadList* current_window_list();
142 void set_current_view(const std::string& name);
143
144 void slot_open_uri(SlotOpenUri s) { m_slotOpenUri = s; }
145 Index: rtorrent/src/ui/element_download_list.h
146 ===================================================================
147 --- rtorrent/src/ui/element_download_list.h (revision 1163)
148 +++ rtorrent/src/ui/element_download_list.h (working copy)
149 @@ -60,6 +60,7 @@
150 void disable();
151
152 core::View* view() { return m_view; }
153 + WDownloadList* window() { return m_window; }
154 void set_view(core::View* l);
155
156 void receive_command(const char* cmd);
157 Index: rtorrent/src/ui/root.cc
158 ===================================================================
159 --- rtorrent/src/ui/root.cc (revision 1163)
160 +++ rtorrent/src/ui/root.cc (working copy)
161 @@ -44,6 +44,7 @@
162
163 #include "core/manager.h"
164 #include "display/frame.h"
165 +#include "display/window_download_list.h"
166 #include "display/window_http_queue.h"
167 #include "display/window_title.h"
168 #include "display/window_input.h"
169 @@ -65,7 +66,11 @@
170 m_windowTitle(NULL),
171 m_windowHttpQueue(NULL),
172 m_windowInput(NULL),
173 - m_windowStatusbar(NULL) {
174 + m_windowStatusbar(NULL),
175 + done_fg_color(-1),
176 + done_bg_color(-1),
177 + active_fg_color(-1),
178 + active_bg_color(-1) {
179 }
180
181 void
182 @@ -97,6 +102,10 @@
183 setup_keys();
184
185 m_downloadList->activate(rootFrame->frame(1));
186 + m_downloadList->current_window_list()->set_done_fg_color(done_fg_color);
187 + m_downloadList->current_window_list()->set_done_bg_color(done_bg_color);
188 + m_downloadList->current_window_list()->set_active_fg_color(active_fg_color);
189 + m_downloadList->current_window_list()->set_active_bg_color(active_bg_color);
190 }
191
192 void
193 @@ -219,7 +228,47 @@
194 torrent::set_max_unchoked(maxUnchoked);
195 }
196
197 +int
198 +Root::get_done_fg_color() {
199 + return done_fg_color;
200 +}
201 +
202 void
203 +Root::set_done_fg_color(int64_t color) {
204 + done_fg_color = color;
205 +}
206 +
207 +int
208 +Root::get_done_bg_color() {
209 + return done_bg_color;
210 +}
211 +
212 +void
213 +Root::set_done_bg_color(int64_t color) {
214 + done_bg_color = color;
215 +}
216 +
217 +int
218 +Root::get_active_fg_color() {
219 + return active_fg_color;
220 +}
221 +
222 +void
223 +Root::set_active_fg_color(int64_t color) {
224 + active_fg_color = color;
225 +}
226 +
227 +int
228 +Root::get_active_bg_color() {
229 + return active_bg_color;
230 +}
231 +
232 +void
233 +Root::set_active_bg_color(int64_t color) {
234 + active_bg_color = color;
235 +}
236 +
237 +void
238 Root::adjust_down_throttle(int throttle) {
239 set_down_throttle(std::max<int>(torrent::down_throttle_global()->max_rate() / 1024 + throttle, 0));
240 }
241 Index: rtorrent/src/ui/root.h
242 ===================================================================
243 --- rtorrent/src/ui/root.h (revision 1163)
244 +++ rtorrent/src/ui/root.h (working copy)
245 @@ -82,7 +82,16 @@
246 // Rename to raw or something, make base function.
247 void set_down_throttle_i64(int64_t throttle) { set_down_throttle(throttle >> 10); }
248 void set_up_throttle_i64(int64_t throttle) { set_up_throttle(throttle >> 10); }
249 + int get_done_fg_color();
250 + void set_done_fg_color(int64_t color);
251 + int get_done_bg_color();
252 + void set_done_bg_color(int64_t color);
253 + int get_active_fg_color();
254 + void set_active_fg_color(int64_t color);
255 + int get_active_bg_color();
256 + void set_active_bg_color(int64_t color);
257
258 +
259 void adjust_down_throttle(int throttle);
260 void adjust_up_throttle(int throttle);
261
262 @@ -93,6 +102,11 @@
263
264 input::TextInput* current_input();
265
266 + int64_t done_fg_color;
267 + int64_t done_bg_color;
268 + int64_t active_fg_color;
269 + int64_t active_bg_color;
270 +
271 private:
272 void setup_keys();
273
274 @@ -105,6 +119,7 @@
275 WStatusbar* m_windowStatusbar;
276
277 input::Bindings m_bindings;
278 +
279 };
280
281 }

  ViewVC Help
Powered by ViewVC 1.1.20