Author: mir3x
Date: Sat Nov  7 17:30:03 2015
New Revision: 30463

URL: http://svn.gna.org/viewcvs/freeciv?rev=30463&view=rev
Log:
Fixed overview often not refreshed and viewport 
being badly positioned after changing view (eg. disconnecting 
and reconnecting, or observing someone else )

See bug #24027


Modified:
    trunk/client/gui-qt/fc_client.cpp
    trunk/client/gui-qt/mapctrl.cpp
    trunk/client/gui-qt/mapview.cpp
    trunk/client/gui-qt/mapview.h

Modified: trunk/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=30463&r1=30462&r2=30463&view=diff
==============================================================================
--- trunk/client/gui-qt/fc_client.cpp   (original)
+++ trunk/client/gui-qt/fc_client.cpp   Sat Nov  7 17:30:03 2015
@@ -302,6 +302,8 @@
     center_on_something();
     voteinfo_gui_update();
     update_info_label();
+    minimapview_wdg->reset();
+    overview_size_changed();
     break;
   case PAGE_SCENARIO:
     update_scenarios_page();

Modified: trunk/client/gui-qt/mapctrl.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapctrl.cpp?rev=30463&r1=30462&r2=30463&view=diff
==============================================================================
--- trunk/client/gui-qt/mapctrl.cpp     (original)
+++ trunk/client/gui-qt/mapctrl.cpp     Sat Nov  7 17:30:03 2015
@@ -191,7 +191,6 @@
       }
     } else {
       recenter_button_pressed(event->x(), event->y());
-      ::gui()->minimapview_wdg->update_image();
     }
   }
 

Modified: trunk/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=30463&r1=30462&r2=30463&view=diff
==============================================================================
--- trunk/client/gui-qt/mapview.cpp     (original)
+++ trunk/client/gui-qt/mapview.cpp     Sat Nov  7 17:30:03 2015
@@ -590,6 +590,13 @@
 
 }
 
+/**************************************************************************
+  Sets minimap scale to default
+**************************************************************************/
+void minimap_view::reset()
+{
+  scale_factor = 1;
+}
 
 /**************************************************************************
   Updates minimap's pixmap
@@ -1382,6 +1389,7 @@
     }
   }
   num_dirty_rects = 0;
+  gui()->minimapview_wdg->update_image();
 }
 
 /****************************************************************************
@@ -1485,8 +1493,8 @@
 ****************************************************************************/
 void get_overview_area_dimensions(int *width, int *height)
 {
-  *width = ::gui()->minimapview_wdg->width();
-  *height = ::gui()->minimapview_wdg->height();
+  *width = 0;
+  *height = 0;
 }
 
 /****************************************************************************
@@ -1501,6 +1509,7 @@
 {
   int map_width, map_height, over_width, over_height, ow, oh, oldx, oldy;
   float ratio;
+
   map_width = gui()->mapview_wdg->width();
   map_height = gui()->mapview_wdg->height();
   over_width = 2 * gui_options.overview.width;
@@ -1533,6 +1542,8 @@
   if (over_height < 48) {
     over_height = 48;
   }
+  /* Magic trick here */
+  gui()->minimapview_wdg->resize(0, 0);
   gui()->minimapview_wdg->resize(over_width, over_height);
   gui()->minimapview_wdg->move(oldx - over_width, oldy - over_height);
 }

Modified: trunk/client/gui-qt/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=30463&r1=30462&r2=30463&view=diff
==============================================================================
--- trunk/client/gui-qt/mapview.h       (original)
+++ trunk/client/gui-qt/mapview.h       Sat Nov  7 17:30:03 2015
@@ -213,6 +213,7 @@
   void paint(QPainter * painter, QPaintEvent * event);
   virtual void update_menu();
   void update_image();
+  void reset();
 
 protected:
   void paintEvent(QPaintEvent * event);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to