diff options
author | Kostyantyn Ovechko <fastinetserver@gmail.com> | 2010-08-12 00:28:05 +0300 |
---|---|---|
committer | Kostyantyn Ovechko <fastinetserver@gmail.com> | 2010-08-12 00:28:05 +0300 |
commit | da4951f05f0ddcac9600b5c747d4264a638961f5 (patch) | |
tree | 032e3c1fd2c04a7ba4624e7199d165f8aa6548f9 | |
parent | Add [colors] section to tuiclient.conf file (diff) | |
download | idfetch-da4951f05f0ddcac9600b5c747d4264a638961f5.tar.gz idfetch-da4951f05f0ddcac9600b5c747d4264a638961f5.tar.bz2 idfetch-da4951f05f0ddcac9600b5c747d4264a638961f5.zip |
Fix tuiclient scrollwindow when there're no lines.
-rw-r--r-- | tuiclient/mainwindow.cpp | 4 | ||||
-rw-r--r-- | tuiclient/scrollwindow.cpp | 8 | ||||
-rw-r--r-- | tuiclient/tuiclient.cpp | 6 | ||||
-rw-r--r-- | tuiclient/twindow.cpp | 9 |
4 files changed, 17 insertions, 10 deletions
diff --git a/tuiclient/mainwindow.cpp b/tuiclient/mainwindow.cpp index 2493d81..57042e2 100644 --- a/tuiclient/mainwindow.cpp +++ b/tuiclient/mainwindow.cpp @@ -167,6 +167,8 @@ void Tmainwindow::init(){ distfiles_win.visible=true; error_log_win.init(" ERROR LOG ",12,50,5,5); disconnected(); - show(); + wclear(window); // sleep(1); + show(); + sleep(1); } diff --git a/tuiclient/scrollwindow.cpp b/tuiclient/scrollwindow.cpp index 3714f04..b0f7343 100644 --- a/tuiclient/scrollwindow.cpp +++ b/tuiclient/scrollwindow.cpp @@ -38,8 +38,12 @@ void Tscroll_window::compose(){ make_frame(); color_downloads(window); // screenlines[26]="Max_num:"+toString(max_received_screenline_num); - top_position=scroll_lines.size()-height+2; // +2 for border lines -// if (top_position<0) {top_position=0;}; +// top_position=; // +2 for border lines + if (scroll_lines.size()+2<height){ + top_position=0; + }else{ + top_position=scroll_lines.size()-height+2; + }; uint line_num=top_position; for (uint y=0; (y<bottom_screenline_num && line_num<scroll_lines.size()); y++, line_num++){ msg_line(y+1,scroll_lines[line_num]); diff --git a/tuiclient/tuiclient.cpp b/tuiclient/tuiclient.cpp index 838f702..db99e73 100644 --- a/tuiclient/tuiclient.cpp +++ b/tuiclient/tuiclient.cpp @@ -158,11 +158,11 @@ void * watch_keyboard_thread_function(void *){ void * refresh_screen_thread_function(void *){ while (! exit_flag){ mainwindow.refresh(); - mainwindow.refresh(); +// mainwindow.refresh(); // sleep(1); struct timeval delay; - delay.tv_sec=0; - delay.tv_usec=300000; + delay.tv_sec=1; + delay.tv_usec=500000; select(FD_SETSIZE, (fd_set *)0, (fd_set *)0,(fd_set *)0, (struct timeval *) &delay);//&timeout } exit_curses_and_show_msg(); diff --git a/tuiclient/twindow.cpp b/tuiclient/twindow.cpp index 7b2d244..556aa83 100644 --- a/tuiclient/twindow.cpp +++ b/tuiclient/twindow.cpp @@ -69,8 +69,8 @@ void Twindow::up(int inc){ }else{ top_position=tmp_top_position; } - sms="UP"+toString(top_position); - +// sms="UP"+toString(top_position); +// refresh(); } void Twindow::down(uint inc){ uint tmp_top_position=top_position+inc; @@ -84,7 +84,8 @@ void Twindow::down(uint inc){ top_position=tmp_top_position; } } - sms="DOWN "+toString(top_position)+"------>"+toString(bottom_screenline_num); +// sms="DOWN "+toString(top_position)+"------>"+toString(bottom_screenline_num); +// refresh(); } void Twindow::center(uint max_y, uint max_x){ @@ -103,7 +104,7 @@ void Twindow::resize(uint new_height, uint new_width, uint new_y, uint new_x){ } void Twindow::make_frame(){ - wclear(window); +// wclear(window); box(window, ACS_VLINE, ACS_HLINE); mvwaddstr(window,0,(width-caption.length())/2,caption.c_str()); // msg_short(0,width-20,"[Lines:"+toString(top_position+1)+"-"+toString(top_position+bottom_screenline_num)+"/"+toString(max_received_screenline_num)+"]"); |