llfloatermap.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 // self include
00035 #include "llfloatermap.h"
00036 
00037 // Library includes
00038 #include "llfontgl.h"
00039 #include "llinventory.h"
00040 #include "message.h"
00041 
00042 // Viewer includes
00043 #include "llagent.h"
00044 #include "llcolorscheme.h"
00045 #include "llviewercontrol.h"
00046 #include "lldraghandle.h"
00047 #include "lleconomy.h"
00048 #include "llfloaterworldmap.h"
00049 #include "llfocusmgr.h"
00050 #include "llnetmap.h"
00051 #include "llregionhandle.h"
00052 #include "llresizebar.h"
00053 #include "llresizehandle.h"
00054 #include "llresmgr.h"
00055 #include "llsky.h"
00056 #include "llsliderctrl.h"
00057 #include "llspinctrl.h"
00058 #include "llstatgraph.h"
00059 #include "llstatusbar.h"
00060 //#include "lltextbox.h"
00061 #include "llui.h"
00062 #include "llviewermenu.h"
00063 #include "llviewerparceloverlay.h"
00064 #include "llviewerregion.h"
00065 #include "llviewerstats.h"
00066 #include "llurlsimstring.h"
00067 
00068 #include "llglheaders.h"
00069 
00070 //
00071 // Constants
00072 //
00073 const S32 LEGEND_SIZE = 16;
00074 
00075 const S32 HPAD = 4;
00076 
00077 const S32 MAP_COMBOBOX_WIDTH = 128;
00078 const S32 MAP_COMBOBOX_HEIGHT = 20;
00079 const S32 GO_BTN_WIDTH = 20;
00080 const S32 SLIDER_WIDTH = LEGEND_SIZE + MAP_COMBOBOX_WIDTH + HPAD + GO_BTN_WIDTH - HPAD;
00081 const S32 SLIDER_HEIGHT = 16;
00082 
00083 const S32 SIM_STAT_WIDTH = 8;
00084 
00085 const S32 MAP_SCALE_MIN = 35;   // in pixels per sim
00086 const S32 MAP_SCALE_MAX = 180;  // in pixels per sim
00087 const S32 MAP_SCALE_INCREMENT = 5;
00088 
00089 const char MAP_TITLE[] = "";
00090 
00091 const S32 NETMAP_MIN_WIDTH = 128;
00092 const S32 NETMAP_MIN_HEIGHT = 128;
00093 
00094 const S32 FLOATERMAP_MIN_WIDTH = 
00095         SLIDER_WIDTH + 
00096         2 * (HPAD + LLPANEL_BORDER_WIDTH);
00097 
00098 const S32 MORE_BTN_VPAD = 2;
00099 
00100 const S32 SPIN_VPAD = 4;
00101   
00102 const S32 TRACKING_LABEL_HEIGHT = 16;
00103 
00104 const S32 FLOATERMAP_MIN_HEIGHT_LARGE = 60;
00105 
00106 //
00107 // Globals
00108 //
00109 LLFloaterMap *gFloaterMap = NULL;
00110 
00111 
00112 
00113 
00114 //
00115 // Member functions
00116 //
00117 
00118 LLFloaterMap::LLFloaterMap(const std::string& name)
00119         :
00120         LLFloater(name, 
00121                                 "FloaterMiniMapRect", 
00122                                 MAP_TITLE, 
00123                                 TRUE, 
00124                                 FLOATERMAP_MIN_WIDTH, 
00125                                 FLOATERMAP_MIN_HEIGHT_LARGE, 
00126                                 FALSE, 
00127                                 FALSE, 
00128                                 TRUE)   // close button
00129 {
00130         const S32 LEFT = LLPANEL_BORDER_WIDTH;
00131         const S32 TOP = getRect().getHeight();
00132 
00133         S32 y = 0;
00134 
00135         // Map itself
00136         LLRect map_rect(
00137                 LEFT, 
00138                 TOP - LLPANEL_BORDER_WIDTH,
00139                 getRect().getWidth() - LLPANEL_BORDER_WIDTH,
00140                 y );
00141         LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" );
00142         mMap = new LLNetMap("Net Map", map_rect, bg_color);
00143         mMap->setFollowsAll();
00144         addChildAtEnd(mMap);
00145 
00146         // Get the drag handle all the way in back
00147         sendChildToBack(getDragHandle());
00148 
00149         setIsChrome(TRUE);
00150 }
00151 
00152 
00153 LLFloaterMap::~LLFloaterMap()
00154 {
00155 }
00156 
00157 
00158 // virtual 
00159 void LLFloaterMap::setVisible(BOOL visible)
00160 {
00161         LLFloater::setVisible(visible);
00162 
00163         gSavedSettings.setBOOL("ShowMiniMap", visible);
00164 }
00165 
00166 
00167 // virtual
00168 void LLFloaterMap::onClose(bool app_quitting)
00169 {
00170         LLFloater::setVisible(FALSE);
00171 
00172         if (!app_quitting)
00173         {
00174                 gSavedSettings.setBOOL("ShowMiniMap", FALSE);
00175         }
00176 }
00177 
00178 BOOL LLFloaterMap::canClose()
00179 {
00180         return !LLApp::isExiting();
00181 }
00182 
00183 
00184 // virtual
00185 void LLFloaterMap::draw()
00186 {
00187         // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong.
00188         if( gAgent.cameraMouselook())
00189         {
00190                 setMouseOpaque(FALSE);
00191                 getDragHandle()->setMouseOpaque(FALSE);
00192 
00193                 drawChild(mMap);
00194         }
00195         else
00196         {
00197                 setMouseOpaque(TRUE);
00198                 getDragHandle()->setMouseOpaque(TRUE);
00199 
00200                 LLFloater::draw();
00201         }
00202 }
00203 
00204 // static
00205 void LLFloaterMap::toggle(void*)
00206 {
00207         if( gFloaterMap )
00208         {
00209                 if (gFloaterMap->getVisible())
00210                 {
00211                         gFloaterMap->close();
00212                 }
00213                 else
00214                 {
00215                         gFloaterMap->open();            /* Flawfinder: ignore */
00216                 }
00217         }
00218 }

Generated on Fri May 16 08:33:29 2008 for SecondLife by  doxygen 1.5.5