00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034
00035 #include "llfloatermap.h"
00036
00037
00038 #include "llfontgl.h"
00039 #include "llinventory.h"
00040 #include "message.h"
00041
00042
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
00061 #include "llui.h"
00062 #include "llviewermenu.h"
00063 #include "llviewerparceloverlay.h"
00064 #include "llviewerregion.h"
00065 #include "llviewerstats.h"
00066 #include "viewer.h"
00067
00068 #include "llglheaders.h"
00069
00070
00071
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;
00086 const S32 MAP_SCALE_MAX = 180;
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
00108
00109 LLFloaterMap *gFloaterMap = NULL;
00110
00111
00112
00113
00114
00115
00116
00117
00118 LLFloaterMap::LLFloaterMap(const std::string& name)
00119 :
00120 LLFloater(name,
00121 "FloaterMapRect",
00122 MAP_TITLE,
00123 TRUE,
00124 FLOATERMAP_MIN_WIDTH,
00125 FLOATERMAP_MIN_HEIGHT_LARGE,
00126 FALSE,
00127 FALSE,
00128 TRUE)
00129 {
00130 const S32 LEFT = LLPANEL_BORDER_WIDTH;
00131 const S32 TOP = mRect.getHeight();
00132
00133 S32 y = 0;
00134
00135
00136 LLRect map_rect(
00137 LEFT,
00138 TOP - LLPANEL_BORDER_WIDTH,
00139 mRect.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
00147 removeChild(mDragHandle);
00148 addChildAtEnd(mDragHandle);
00149
00150 setIsChrome(TRUE);
00151 }
00152
00153
00154 LLFloaterMap::~LLFloaterMap()
00155 {
00156 }
00157
00158
00159
00160 void LLFloaterMap::setVisible(BOOL visible)
00161 {
00162 LLFloater::setVisible(visible);
00163
00164 gSavedSettings.setBOOL("ShowMiniMap", visible);
00165 }
00166
00167
00168
00169 void LLFloaterMap::onClose(bool app_quitting)
00170 {
00171 LLFloater::setVisible(FALSE);
00172
00173 if (!app_quitting)
00174 {
00175 gSavedSettings.setBOOL("ShowMiniMap", FALSE);
00176 }
00177 }
00178
00179 BOOL LLFloaterMap::canClose()
00180 {
00181 return !gQuit;
00182 }
00183
00184
00185
00186 void LLFloaterMap::draw()
00187 {
00188 if( getVisible() )
00189 {
00190
00191 if( gAgent.cameraMouselook())
00192 {
00193 setMouseOpaque(FALSE);
00194 mDragHandle->setMouseOpaque(FALSE);
00195
00196 drawChild(mMap);
00197 }
00198 else
00199 {
00200 setMouseOpaque(TRUE);
00201 mDragHandle->setMouseOpaque(TRUE);
00202
00203 LLFloater::draw();
00204 }
00205 }
00206 }
00207
00208
00209 void LLFloaterMap::toggle(void*)
00210 {
00211 if( gFloaterMap )
00212 {
00213 if (gFloaterMap->getVisible())
00214 {
00215 gFloaterMap->close();
00216 }
00217 else
00218 {
00219 gFloaterMap->open();
00220 }
00221 }
00222 }