From: <geo...@us...> - 2008-05-18 02:54:12
|
Revision: 2555 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=2555&view=rev Author: geoffthemedio Date: 2008-05-17 19:54:18 -0700 (Sat, 17 May 2008) Log Message: ----------- Hid system resource summary if system has no resource-producing planets for the client's empire Modified Paths: -------------- trunk/FreeOrion/UI/InfoPanels.cpp trunk/FreeOrion/UI/InfoPanels.h trunk/FreeOrion/UI/SidePanel.cpp Modified: trunk/FreeOrion/UI/InfoPanels.cpp =================================================================== --- trunk/FreeOrion/UI/InfoPanels.cpp 2008-05-18 00:45:27 UTC (rev 2554) +++ trunk/FreeOrion/UI/InfoPanels.cpp 2008-05-18 02:54:18 UTC (rev 2555) @@ -1499,6 +1499,11 @@ SetText("MultiIconValueIndicator"); } +bool MultiIconValueIndicator::Empty() +{ + return m_obj_vec.empty(); +} + void MultiIconValueIndicator::Render() { GG::Pt ul = UpperLeft(); Modified: trunk/FreeOrion/UI/InfoPanels.h =================================================================== --- trunk/FreeOrion/UI/InfoPanels.h 2008-05-18 00:45:27 UTC (rev 2554) +++ trunk/FreeOrion/UI/InfoPanels.h 2008-05-18 02:54:18 UTC (rev 2555) @@ -311,22 +311,24 @@ MultiIconValueIndicator(int w, const std::vector<const UniverseObject*>& obj_vec, const std::vector<MeterType>& meter_types); MultiIconValueIndicator(int w); ///< initializes with no icons shown - virtual void Render(); - virtual void MouseWheel(const GG::Pt& pt, int move, GG::Flags<GG::ModKey> mod_keys); + bool Empty(); - void Update(); + virtual void Render(); + virtual void MouseWheel(const GG::Pt& pt, int move, GG::Flags<GG::ModKey> mod_keys); - void SetToolTip(MeterType meter_type, const boost::shared_ptr<GG::BrowseInfoWnd>& browse_wnd); + void Update(); + void SetToolTip(MeterType meter_type, const boost::shared_ptr<GG::BrowseInfoWnd>& browse_wnd); + private: - std::vector<StatisticIcon*> m_icons; + std::vector<StatisticIcon*> m_icons; - std::vector<MeterType> m_meter_types; - std::vector<const UniverseObject*> m_obj_vec; + std::vector<MeterType> m_meter_types; + std::vector<const UniverseObject*> m_obj_vec; - static const int EDGE_PAD = 6; - static const int ICON_SPACING = 12; - static const int ICON_WIDTH = 24; + static const int EDGE_PAD = 6; + static const int ICON_SPACING = 12; + static const int ICON_WIDTH = 24; }; /** Graphically represets the current max and projected changes to values of multiple Meters, using a Modified: trunk/FreeOrion/UI/SidePanel.cpp =================================================================== --- trunk/FreeOrion/UI/SidePanel.cpp 2008-05-18 00:45:27 UTC (rev 2554) +++ trunk/FreeOrion/UI/SidePanel.cpp 2008-05-18 02:54:18 UTC (rev 2555) @@ -456,7 +456,7 @@ /** \name Mutators */ //@{ PlanetPanel* GetPlanetPanel(int n) {return m_planet_panels[n];} - + void RefreshAllPlanetPanels(); ///< updates data displayed in info panels and redoes layout //@} @@ -1286,7 +1286,7 @@ m_system_name->Clear(); DeleteChild(m_star_graphic); m_star_graphic = 0; - + // disconnect any existing system signals while (!m_system_connections.empty()) { m_system_connections.begin()->disconnect(); @@ -1383,7 +1383,12 @@ m_system_connections.insert(GG::Connect(plt_vec[i]->ResourceCenterChangedSignal, SidePanel::ResourceCenterChangedSignal)); } - m_system_resource_summary->Update(); + if(m_system_resource_summary->Empty()) { + DetachChild(m_system_resource_summary); + } else { + AttachChild(m_system_resource_summary); + m_system_resource_summary->Update(); + } } } |