Changeset 26 for trunk/Classes/mouse_events.cpp
- Timestamp:
- 2010-05-28 07:39:52 (2 years ago)
- File:
-
- 1 edited
-
trunk/Classes/mouse_events.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Classes/mouse_events.cpp
r17 r26 29 29 #include "wml_separators.hpp" 30 30 31 extern bool gIsDragging; 32 extern bool gRedraw; 31 33 32 34 namespace events{ … … 336 338 } 337 339 338 bool mouse_handler::right_click_show_menu(int /*x*/, int /*y*/, const bool browse)340 bool mouse_handler::right_click_show_menu(int x, int y, const bool browse) 339 341 { 340 342 // The first right-click cancel the selection if any, 341 343 // the second open the context menu 342 344 if (selected_hex_.valid() && find_unit(selected_hex_) != units_.end()) { 343 select_hex(map_location(), browse); 345 //select_hex(map_location(), browse); 346 347 // KP: if we double tap on the selected unit, then always display the context menu 348 map_location new_hex = gui().hex_clicked_on(x,y); 349 if (selected_hex_ == new_hex) 350 { 351 select_hex(map_location(), browse); 352 return true; 353 } 354 355 // KP: now, we just send another tap if a unit is already selected, the user probably tapped too fast... 356 left_mouse_up(x, y, browse); 357 // note: we just need one, because the first one was already sent... 344 358 return false; 345 359 } else { 360 const SDL_Rect map_area = gui().map_area(); 361 if (x > map_area.w || y < map_area.y) 362 return false; // tap on a panel, not the map 346 363 return true; 347 364 } … … 352 369 if (mouse_handler_base::left_click(x, y, browse)) 353 370 return false; 371 372 // check for a click on the selected unit's description image 373 const SDL_Rect uia = gui().unit_image_area(); 374 if (x > uia.x && y > uia.y && x < uia.x+uia.w && y < uia.y+uia.h) 375 { 376 const unit_map::const_iterator i = find_unit(gui().displayedUnitHex_); 377 if (i != units_.end()) 378 dialogs::show_unit_description(gui(), i->second); 379 return true; 380 } 354 381 355 382 return false; … … 516 543 { 517 544 didDrag_ = false; 545 gIsDragging = false; 546 gRedraw = true; 518 547 return; 519 548 } … … 814 843 gui().draw(true,true); 815 844 816 //attack_prediction_displayer ap_displayer(gui(), bc_vector, map_, teams_, units_, status_, attacker_loc, defender_loc);845 //attack_prediction_displayer ap_displayer(gui(), bc_vector, map_, teams_, units_, status_, attacker_loc, defender_loc); 817 846 std::vector<gui::dialog_button_info> buttons; 818 //buttons.push_back(gui::dialog_button_info(&ap_displayer, _("Damage Calculations")));847 //buttons.push_back(gui::dialog_button_info(&ap_displayer, _("Damage Calculations"))); 819 848 820 849 int res = 0;
Note: See TracChangeset
for help on using the changeset viewer.