[mouse] more small fixes for mouse support (dragging)

This commit is contained in:
Timothy Stack 2014-03-03 21:02:59 -08:00
parent 74e7b3b92c
commit c780ddb9af
3 changed files with 18 additions and 3 deletions

View File

@ -2973,7 +2973,6 @@ public:
if (lv.lv_origin.contains(x_offset)) { if (lv.lv_origin.contains(x_offset)) {
this->ad_press_value = lpc; this->ad_press_value = lpc;
retval = true;
break; break;
} }
} }
@ -2981,6 +2980,9 @@ public:
} }
break; break;
case BUTTON_STATE_DRAGGED: case BUTTON_STATE_DRAGGED:
if (mouse_line != this->ad_press_line) {
this->ad_press_value = -1;
}
if (this->ad_press_value != -1) { if (this->ad_press_value != -1) {
retval = true; retval = true;
} }

View File

@ -587,7 +587,8 @@ void logfile_sub_source::text_update_marks(vis_bookmarks &bm)
} }
for (; vl < (int)this->lss_index.size(); ++vl) { for (; vl < (int)this->lss_index.size(); ++vl) {
content_line_t cl = this->lss_index[vl]; const content_line_t orig_cl = this->lss_index[vl];
content_line_t cl = orig_cl;
logfile * lf; logfile * lf;
lf = this->find(cl); lf = this->find(cl);
@ -596,7 +597,9 @@ void logfile_sub_source::text_update_marks(vis_bookmarks &bm)
this->lss_user_marks.begin(); this->lss_user_marks.begin();
iter != this->lss_user_marks.end(); iter != this->lss_user_marks.end();
++iter) { ++iter) {
if (binary_search(iter->second.begin(), iter->second.end(), cl)) { if (binary_search(iter->second.begin(),
iter->second.end(),
orig_cl)) {
bm[iter->first].insert_once(vl); bm[iter->first].insert_once(vl);
if (iter->first == &textview_curses::BM_USER) { if (iter->first == &textview_curses::BM_USER) {

View File

@ -238,6 +238,9 @@ void textview_curses::listview_value_for_row(const listview_curses &lv,
bool textview_curses::handle_mouse(mouse_event &me) bool textview_curses::handle_mouse(mouse_event &me)
{ {
unsigned long width;
vis_line_t height;
if (this->tc_selection_start == -1 && if (this->tc_selection_start == -1 &&
listview_curses::handle_mouse(me)) { listview_curses::handle_mouse(me)) {
return true; return true;
@ -258,6 +261,8 @@ bool textview_curses::handle_mouse(mouse_event &me)
mouse_line = this->get_bottom(); mouse_line = this->get_bottom();
} }
this->get_dimensions(height, width);
switch (me.me_state) { switch (me.me_state) {
case BUTTON_STATE_PRESSED: case BUTTON_STATE_PRESSED:
this->tc_selection_start = mouse_line; this->tc_selection_start = mouse_line;
@ -270,6 +275,11 @@ bool textview_curses::handle_mouse(mouse_event &me)
me.me_y = 0; me.me_y = 0;
mouse_line = this->get_top(); mouse_line = this->get_top();
} }
if (me.me_y >= height && this->get_top() < this->get_top_for_last_row()) {
this->shift_top(vis_line_t(1));
me.me_y = height;
mouse_line = this->get_bottom();
}
if (this->tc_selection_last == mouse_line) if (this->tc_selection_last == mouse_line)
break; break;