svn merge -r 128442:129343 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-18 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3

master
Richard Nelson 2009-08-04 01:12:59 +00:00
parent db5cda2667
commit eb853f55c0
232 changed files with 4685 additions and 4513 deletions

View File

@ -52,6 +52,11 @@
// *TODO: switch to using TUT
// *TODO: teach Parabuild about this program, run automatically after full builds
// I believe these must be globals, not stack variables. JC
LLControlGroup gSavedSettings("Global"); // saved at end of session
LLControlGroup gSavedPerAccountSettings("PerAccount"); // saved at end of session
LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warnings
// We can't create LLImageGL objects because we have no window or rendering
// context. Provide enough of an LLUIImage to test the LLUI library without
// an underlying image.
@ -73,6 +78,7 @@ public:
}
};
class LLTexture ;
// We need to supply dummy images
class TestImageProvider : public LLImageProviderInterface
@ -95,10 +101,16 @@ public:
LLPointer<LLUIImage> makeImage()
{
LLPointer<LLTexture> image_gl;
LLPointer<LLUIImage> image = new LLUIImage( std::string(), image_gl);
LLPointer<LLUIImage> image = new TestUIImage(); //LLUIImage( std::string(), image_gl);
mImageList.push_back(image);
return image;
}
public:
// Unclear if we need this, hold on to one copy of each image we make
std::vector<LLPointer<LLUIImage> > mImageList;
};
TestImageProvider gTestImageProvider;
static std::string get_xui_dir()
{
@ -117,27 +129,22 @@ void init_llui()
gDirUtilp->initAppDirs("SecondLife", newview_path);
gDirUtilp->setSkinFolder("default");
// colors are no longer stored in a LLControlGroup file
LLUIColorTable::instance().loadFromSettings();
std::string config_filename = gDirUtilp->getExpandedFilename(
LL_PATH_APP_SETTINGS, "settings.xml");
LLControlGroup config_group("config");
config_group.loadFromFile(config_filename);
gSavedSettings.loadFromFile(config_filename);
std::string color_filename = gDirUtilp->getExpandedFilename(
LL_PATH_DEFAULT_SKIN, "colors.xml");
LLControlGroup color_group("color");
color_group.loadFromFile(color_filename);
LLControlGroup floater_group("floater");
LLControlGroup ignores_group("ignores");
// See LLAppViewer::init()
LLUI::settings_map_t settings;
settings["config"] = &config_group;
settings["color"] = &color_group;
settings["floater"] = &floater_group;
settings["ignores"] = &ignores_group;
settings["config"] = &gSavedSettings;
settings["ignores"] = &gWarningSettings;
settings["floater"] = &gSavedSettings;
settings["account"] = &gSavedPerAccountSettings;
// Don't use real images as we don't have a GL context
TestImageProvider image_provider;
LLUI::initClass(settings, &image_provider);
LLUI::initClass(settings, &gTestImageProvider);
const bool no_register_widgets = false;
LLWidgetReg::initClass( no_register_widgets );
@ -148,7 +155,7 @@ void init_llui()
// (tooltips for buttons)
std::set<std::string> default_args;
LLTrans::parseStrings("strings.xml", default_args);
LLTrans::parseLanguageStrings("language_settings.xml");
LLFontManager::initClass();
// Creating widgets apparently requires fonts to be initialized,
@ -183,10 +190,10 @@ void export_test_floaters()
llinfos << "Converting " << filename << llendl;
// Build a floater and output new attributes
LLXMLNodePtr output_node = new LLXMLNode();
LLFloater* floater = new LLFloater();
LLFloater* floater = new LLFloater(LLSD());
LLUICtrlFactory::getInstance()->buildFloater(floater,
filename,
FALSE, // don't open floater
// FALSE, // don't open floater
output_node);
std::string out_filename = xui_dir + filename;
std::string::size_type extension_pos = out_filename.rfind(".xml");

View File

@ -50,6 +50,7 @@ const S32 GESTURE_VERSION = 2;
LLMultiGesture::LLMultiGesture()
: mKey(),
mMask(),
mName(),
mTrigger(),
mReplaceText(),
mSteps(),

View File

@ -65,11 +65,13 @@ protected:
const LLMultiGesture& operator=(const LLMultiGesture& rhs);
public:
// name is stored at asset level
// desc is stored at asset level
KEY mKey;
MASK mMask;
// This name can be empty if the inventory item is not around and
// the gesture manager has not yet set the name
std::string mName;
// String, like "/foo" or "hello" that makes it play
std::string mTrigger;

View File

@ -516,9 +516,9 @@ BOOL LLPoseBlender::addMotion(LLMotion* motion)
void LLPoseBlender::blendAndApply()
{
for (blender_list_t::iterator iter = mActiveBlenders.begin();
iter != mActiveBlenders.end(); ++iter)
iter != mActiveBlenders.end(); )
{
LLJointStateBlender* jsbp = *iter;
LLJointStateBlender* jsbp = *iter++;
jsbp->blendJointStates();
}

View File

@ -143,7 +143,14 @@ public:
{
return *getInstance();
}
// Has this singleton been created uet?
// Use this to avoid accessing singletons before the can safely be constructed
static bool instanceExists()
{
return getData().mInitState == INITIALIZED;
}
// Has this singleton already been deleted?
// Use this to avoid accessing singletons from a static object's destructor
static bool destroyed()

View File

@ -237,7 +237,7 @@ F32 LLFontFreetype::getXAdvance(llwchar wch) const
if (mFTFace == NULL)
return 0.0;
llassert(!mIsFallback);
//llassert(!mIsFallback);
U32 glyph_index;
// Return existing info only if it is current
@ -308,7 +308,7 @@ F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const
if (mFTFace == NULL)
return 0.0;
llassert(!mIsFallback);
//llassert(!mIsFallback);
LLFontGlyphInfo* left_glyph_info = get_if_there(mCharGlyphInfoMap, char_left, (LLFontGlyphInfo*)NULL);
U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0;
// Kern this puppy.

View File

@ -100,7 +100,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
mSelectionCallback(p.selection_callback()),
mListPosition(p.list_position)
mListPosition(p.list_position),
mLastSelectedIndex(-1)
{
// Text label button
@ -625,15 +626,15 @@ void LLComboBox::showList()
mList->setVisible(TRUE);
setUseBoundingRect(TRUE);
mList->sortItems();
mLastSelectedIndex = mList->getFirstSelectedIndex();
}
void LLComboBox::hideList()
{
//*HACK: store the original value explicitly somewhere, not just in label
std::string orig_selection = mAllowTextEntry ? mTextEntry->getText() : mButton->getLabelSelected();
// assert selection in list
mList->selectItemByLabel(orig_selection, FALSE);
mList->selectNthItem(mLastSelectedIndex);
mButton->setToggleState(FALSE);
mList->setVisible(FALSE);
@ -691,6 +692,7 @@ void LLComboBox::onItemSelected(const LLSD& data)
const std::string name = mList->getSelectedItemLabel();
S32 cur_id = getCurrentIndex();
mLastSelectedIndex = cur_id;
if (cur_id != -1)
{
setLabel(name);

View File

@ -232,5 +232,6 @@ private:
commit_callback_t mPrearrangeCallback;
commit_callback_t mTextEntryCallback;
commit_callback_t mSelectionCallback;
S32 mLastSelectedIndex;
};
#endif

View File

@ -75,6 +75,19 @@ std::string LLFloater::sButtonActiveImageNames[BUTTON_COUNT] =
"Icon_Undock_Foreground"
};
// Empty string means programmatic glow effect, achieved by
// not setting explicit image.
std::string LLFloater::sButtonHoveredImageNames[BUTTON_COUNT] =
{
"", //BUTTON_CLOSE
"restore_pressed.tga", //BUTTON_RESTORE
"minimize_pressed.tga", //BUTTON_MINIMIZE
"tearoff_pressed.tga", //BUTTON_TEAR_OFF
"close_in_blue.tga", //BUTTON_EDIT
"", //BUTTON_DOCK
"", //BUTTON_UNDOCK
};
std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] =
{
"Icon_Close_Press", //BUTTON_CLOSE
@ -97,20 +110,19 @@ std::string LLFloater::sButtonNames[BUTTON_COUNT] =
"llfloater_undock_btn"
};
std::string LLFloater::sButtonToolTips[BUTTON_COUNT] = {};
std::string LLFloater::sButtonToolTips[BUTTON_COUNT];
std::string LLFloater::sButtonToolTipsIndex[BUTTON_COUNT]=
{
#ifdef LL_DARWIN
"BUTTON_CLOSE_DARWIN",//LLTrans::getString("BUTTON_CLOSE_DARWIN"), //"Close (Cmd-W)", //BUTTON_CLOSE
"BUTTON_CLOSE_DARWIN", //"Close (Cmd-W)", //BUTTON_CLOSE
#else
"BUTTON_CLOSE_WIN", //LLTrans::getString("BUTTON_CLOSE_WIN"), //"Close (Ctrl-W)", //BUTTON_CLOSE
"BUTTON_CLOSE_WIN", //"Close (Ctrl-W)", //BUTTON_CLOSE
#endif
"BUTTON_RESTORE",//LLTrans::getString("BUTTON_RESTORE"), //"Restore", //BUTTON_RESTORE
"BUTTON_MINIMIZE",//LLTrans::getString("BUTTON_MINIMIZE"), //"Minimize", //BUTTON_MINIMIZE
"BUTTON_TEAR_OFF",//LLTrans::getString("BUTTON_TEAR_OFF"), //"Tear Off", //BUTTON_TEAR_OFF
"BUTTON_EDIT", //LLTrans::getString("BUTTON_EDIT"), // "Edit", //BUTTON_EDIT
"BUTTON_RESTORE", //"Restore", //BUTTON_RESTORE
"BUTTON_MINIMIZE", //"Minimize", //BUTTON_MINIMIZE
"BUTTON_TEAR_OFF", //"Tear Off", //BUTTON_TEAR_OFF
"BUTTON_EDIT", //"Edit", //BUTTON_EDIT
"BUTTON_DOCK",
"BUTTON_UNDOCK"
};
@ -128,7 +140,7 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] =
LLMultiFloater* LLFloater::sHostp = NULL;
BOOL LLFloater::sEditModeEnabled = FALSE;
BOOL LLFloater::sQuitting = FALSE; // Temporary hack until onClose() behavior becomes data driven
BOOL LLFloater::sQuitting = FALSE; // Flag to prevent storing visibility controls while quitting
LLFloater::handle_map_t LLFloater::sFloaterMap;
LLFloaterView* gFloaterView = NULL;
@ -219,6 +231,15 @@ const LLFloater::Params& LLFloater::getDefaultParams()
return LLUICtrlFactory::getDefaultParams<LLFloater>();
}
//static
void LLFloater::initClass()
{
// translate tooltips for floater buttons
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
sButtonToolTips[i] = LLTrans::getString( sButtonToolTipsIndex[i] );
}
}
LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
: LLPanel(),
@ -251,22 +272,11 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
static LLUIColor default_background_color = LLUIColorTable::instance().getColor("FloaterDefaultBackgroundColor");
static LLUIColor focus_background_color = LLUIColorTable::instance().getColor("FloaterFocusBackgroundColor");
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
sButtonToolTips[i] =LLTrans::getString( sButtonToolTipsIndex[i]);
}
mHandle.bind(this);
mNotificationContext = new LLFloaterNotificationContext(getHandle());
mBgColorAlpha = default_background_color;
mBgColorOpaque = focus_background_color;
for (S32 i = 0; i < 4; i++)
{
mResizeBar[i] = NULL;
mResizeHandle[i] = NULL;
}
// Clicks stop here.
setMouseOpaque(TRUE);
@ -431,6 +441,9 @@ void LLFloater::addResizeCtrls()
// Resize handles (corners)
LLResizeHandle::Params handle_p;
// handles must not be mouse-opaque, otherwise they block hover events
// to other buttons like the close box. JC
handle_p.mouse_opaque(false);
handle_p.rect(LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0));
handle_p.min_width(mMinWidth);
handle_p.min_height(mMinHeight);
@ -505,7 +518,6 @@ void LLFloater::storeRectControl()
void LLFloater::storeVisibilityControl()
{
// sQuitting is a temp hack until we standardize onClose() behavior so that it won't call this when quitting
if( !sQuitting && mVisibilityControl.size() > 1 )
{
LLUI::sSettingGroups["floater"]->setBOOL( mVisibilityControl, getVisible() );
@ -514,7 +526,7 @@ void LLFloater::storeVisibilityControl()
void LLFloater::setVisible( BOOL visible )
{
LLPanel::setVisible(visible);
LLPanel::setVisible(visible); // calls handleVisibilityChange()
if( visible && mFirstLook )
{
mFirstLook = FALSE;
@ -549,14 +561,14 @@ void LLFloater::setVisible( BOOL visible )
}
// virtual
void LLFloater::onVisibilityChange ( BOOL new_visibility )
void LLFloater::handleVisibilityChange ( BOOL new_visibility )
{
if (new_visibility)
{
if (getHost())
getHost()->setFloaterFlashing(this, FALSE);
}
LLPanel::onVisibilityChange ( new_visibility );
LLPanel::handleVisibilityChange ( new_visibility );
}
void LLFloater::openFloater(const LLSD& key)
@ -593,7 +605,7 @@ void LLFloater::openFloater(const LLSD& key)
setVisibleAndFrontmost(mAutoFocus);
}
mOpenSignal(this, getValue());
mOpenSignal(this, key);
onOpen(key);
}
@ -601,7 +613,7 @@ void LLFloater::closeFloater(bool app_quitting)
{
if (app_quitting)
{
LLFloater::sQuitting = true; // Temp hack until we standardize onClose()
LLFloater::sQuitting = true;
}
// Always unminimize before trying to close.
@ -661,9 +673,27 @@ void LLFloater::closeFloater(bool app_quitting)
}
}
// Let floater do cleanup.
mCloseSignal(this, getValue(), app_quitting);
onClose(app_quitting);
// Close callback
mCloseSignal(this, LLSD(app_quitting));
// Hide or Destroy
if (mSingleInstance)
{
// Hide the instance
if (getHost())
{
getHost()->setVisible(FALSE);
}
else
{
setVisible(FALSE);
}
}
else
{
setVisible(FALSE); // hide before destroying (so handleVisibilityChange() gets called)
destroy();
}
}
}
@ -1771,9 +1801,20 @@ void LLFloater::buildButtons()
p.rect(btn_rect);
p.label("");
p.image_unselected.name(sButtonActiveImageNames[i]);
// Selected, no matter if hovered or not, is "pressed"
p.image_selected.name(sButtonPressedImageNames[i]);
p.image_hover_selected.name(sButtonPressedImageNames[i]);
p.image_hover_unselected.name(sButtonPressedImageNames[i]);
// Empty string means programmatic glow effect, achieved by
// not setting explicit image.
if (sButtonHoveredImageNames[i].empty())
{
// These icons are really small, need glow amount increased
p.hover_glow_amount( 0.22f );
}
else
{
p.image_hover_unselected.name(sButtonHoveredImageNames[i]);
}
p.click_callback.function(boost::bind(sButtonCallbacks[i], this));
p.tab_stop(false);
p.follows.flags(FOLLOWS_TOP|FOLLOWS_RIGHT);
@ -1788,72 +1829,6 @@ void LLFloater::buildButtons()
updateButtons();
}
void LLFloater::initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig)
{
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
sig.connect(boost::bind(cb.function(), _1, cb.parameter));
else
sig.connect(cb.function());
}
else
{
std::string function_name = cb.function_name;
open_callback_t* func = (OpenCallbackRegistry::getValue(function_name));
if (func)
{
if (cb.parameter.isProvided())
sig.connect(boost::bind((*func), _1, cb.parameter));
else
sig.connect(*func);
}
else if (!function_name.empty())
{
llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
}
}
}
void LLFloater::initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig)
{
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
sig.connect(boost::bind(cb.function(), _1, cb.parameter, _3));
else
sig.connect(cb.function());
}
else
{
std::string function_name = cb.function_name;
close_callback_t* func = (CloseCallbackRegistry::getValue(function_name));
if (func)
{
if (cb.parameter.isProvided())
sig.connect(boost::bind((*func), _1, cb.parameter,_3));
else
sig.connect(*func);
}
else if (!function_name.empty())
{
llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
}
}
}
namespace LLInitParam
{
template<>
bool ParamCompare<LLFloater::close_callback_t>::equals(
const LLFloater::close_callback_t &a,
const LLFloater::close_callback_t &b)
{
return false;
}
}
/////////////////////////////////////////////////////
// LLFloaterView
@ -2612,13 +2587,13 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
// open callback
if (p.open_callback.isProvided())
initOpenCallback(p.open_callback, mOpenSignal);
initCommitCallback(p.open_callback, mOpenSignal);
// close callback
if (p.close_callback.isProvided())
initCloseCallback(p.close_callback, mCloseSignal);
initCommitCallback(p.close_callback, mCloseSignal);
}
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floater, LLXMLNodePtr output_node)
void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
{
Params params(LLUICtrlFactory::getDefaultParams<LLFloater>());
LLXUIParser::instance().readXUI(node, params);
@ -2661,38 +2636,6 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floa
applyRectControl(); // If we have a saved rect control, apply it
gFloaterView->adjustToFitScreen(this, FALSE); // Floaters loaded from XML should all fit on screen
if (open_floater)
{
this->openFloater(getKey());
}
moveResizeHandlesToFront();
}
// visibility methods
bool VisibilityPolicy<LLFloater>::visible(LLFloater* instance, const LLSD& key)
{
if (instance)
{
return !instance->isMinimized() && instance->isInVisibleChain();
}
return FALSE;
}
void VisibilityPolicy<LLFloater>::show(LLFloater* instance, const LLSD& key)
{
if (instance)
{
instance->openFloater(key);
if (instance->getHost())
{
instance->getHost()->openFloater(key);
}
}
}
void VisibilityPolicy<LLFloater>::hide(LLFloater* instance, const LLSD& key)
{
if (instance) instance->closeFloater();
}

View File

@ -97,7 +97,7 @@ public:
enum EFloaterButtons
{
BUTTON_CLOSE,
BUTTON_CLOSE = 0,
BUTTON_RESTORE,
BUTTON_MINIMIZE,
BUTTON_TEAR_OFF,
@ -107,22 +107,6 @@ public:
BUTTON_COUNT
};
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> open_callback_t;
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> open_signal_t;
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_callback_t;
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_signal_t;
struct OpenCallbackParam : public LLInitParam::Block<OpenCallbackParam, CallbackParam >
{
Optional<open_callback_t> function;
};
struct CloseCallbackParam : public LLInitParam::Block<CloseCallbackParam, CallbackParam >
{
Optional<close_callback_t> function;
};
struct Params
: public LLInitParam::Block<Params, LLPanel::Params>
{
@ -140,8 +124,8 @@ public:
save_visibility,
can_dock;
Optional<OpenCallbackParam> open_callback;
Optional<CloseCallbackParam> close_callback;
Optional<CommitCallbackParam> open_callback,
close_callback;
Params();
};
@ -149,7 +133,10 @@ public:
// use this to avoid creating your own default LLFloater::Param instance
static const Params& getDefaultParams();
LLFloater(const LLSD& key = LLSD(), const Params& params = getDefaultParams());
// Load translations for tooltips for standard buttons
static void initClass();
LLFloater(const LLSD& key, const Params& params = getDefaultParams());
virtual ~LLFloater();
@ -157,7 +144,7 @@ public:
static void setupParamsForExport(Params& p, LLView* parent);
void initFromParams(const LLFloater::Params& p);
void initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floater = TRUE, LLXMLNodePtr output_node = NULL);
void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
/*virtual*/ BOOL canSnapTo(const LLView* other_view);
@ -171,7 +158,6 @@ public:
void openFloater(const LLSD& key = LLSD());
// If allowed, close the floater cleanly, releasing focus.
// app_quitting is passed to onClose() below.
void closeFloater(bool app_quitting = false);
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
@ -221,20 +207,16 @@ public:
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
virtual void draw();
// *TODO: Eliminate this in favor of mOpenSignal
virtual void onOpen(const LLSD& key) {}
// Call destroy() to free memory, or setVisible(FALSE) to keep it
// If app_quitting, you might not want to save your visibility.
// Defaults to destroy().
virtual void onClose(bool app_quitting) { destroy(); }
// This cannot be "const" until all derived floater canClose()
// methods are const as well. JC
virtual BOOL canClose() { return TRUE; }
virtual void setVisible(BOOL visible);
virtual void onVisibilityChange ( BOOL curVisibilityIn );
/*virtual*/ void setVisible(BOOL visible); // do not override
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override
void setFrontmost(BOOL take_focus = TRUE);
@ -250,7 +232,9 @@ public:
LLHandle<LLFloater> getHandle() const { return mHandle; }
const LLSD& getKey() { return mKey; }
BOOL matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); }
const std::string& getInstanceName() { return mInstanceName; }
bool isDockable() const { return mCanDock; }
void setCanDock(bool b);
@ -299,10 +283,7 @@ protected:
void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened
LLDragHandle* getDragHandle() const { return mDragHandle; }
void destroy() { die(); } // Don't call this directly. You probably want to call close(). JC
void initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig);
void initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig);
void destroy() { die(); } // Don't call this directly. You probably want to call closeFloater()
private:
void setForeground(BOOL b); // called only by floaterview
@ -314,15 +295,11 @@ private:
void addResizeCtrls();
void addDragHandle();
public:
class OpenCallbackRegistry : public CallbackRegistry<open_callback_t, OpenCallbackRegistry> {};
class CloseCallbackRegistry : public CallbackRegistry<close_callback_t, CloseCallbackRegistry> {};
protected:
std::string mRectControl;
std::string mVisibilityControl;
open_signal_t mOpenSignal;
close_signal_t mCloseSignal;
commit_signal_t mOpenSignal; // Called when floater is opened, passes mKey
commit_signal_t mCloseSignal; // Called when floater is closed, passes app_qitting as LLSD()
LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg
LLDragHandle* mDragHandle;
@ -376,6 +353,8 @@ private:
static BOOL sEditModeEnabled;
static BOOL sQuitting;
static std::string sButtonActiveImageNames[BUTTON_COUNT];
// Images to use when cursor hovered over an enabled button
static std::string sButtonHoveredImageNames[BUTTON_COUNT];
static std::string sButtonPressedImageNames[BUTTON_COUNT];
static std::string sButtonNames[BUTTON_COUNT];
static std::string sButtonToolTips[BUTTON_COUNT];
@ -465,37 +444,12 @@ private:
S32 mSnapOffsetRight;
};
//*******************************************************
//* TO BE DEPRECATED
//*******************************************************
// visibility policy specialized for floaters
template<>
class VisibilityPolicy<LLFloater>
{
public:
// visibility methods
static bool visible(LLFloater* instance, const LLSD& key);
static void show(LLFloater* instance, const LLSD& key);
static void hide(LLFloater* instance, const LLSD& key);
};
//
// Globals
//
extern LLFloaterView* gFloaterView;
namespace LLInitParam
{
template<>
bool ParamCompare<LLFloater::close_callback_t>::equals(
const LLFloater::close_callback_t &a,
const LLFloater::close_callback_t &b);
}
#endif // LL_FLOATER_H

View File

@ -121,8 +121,7 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
res = build_func(key);
const bool DONT_OPEN_FLOATER = false;
LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, DONT_OPEN_FLOATER);
LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, NULL);
// Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe
res->mKey = key;

View File

@ -89,7 +89,6 @@ const U32 RIGHT_PAD_PIXELS = 2;
const U32 RIGHT_WIDTH_PIXELS = 15;
const U32 RIGHT_PLAIN_PIXELS = RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS;
const U32 ACCEL_PAD_PIXELS = 10;
const U32 PLAIN_PAD_PIXELS = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS + RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS;
const U32 BRIEF_PAD_PIXELS = 2;
@ -302,7 +301,7 @@ U32 LLMenuItemGL::getNominalHeight( void ) const
// Get the parent menu for this item
LLMenuGL* LLMenuItemGL::getMenu()
LLMenuGL* LLMenuItemGL::getMenu() const
{
return (LLMenuGL*) getParent();
}
@ -326,7 +325,7 @@ U32 LLMenuItemGL::getNominalWidth( void ) const
if( KEY_NONE != mAcceleratorKey )
{
width += ACCEL_PAD_PIXELS;
width += getMenu()->getShortcutPad();
std::string temp;
appendAcceleratorString( temp );
width += mFont->getWidth( temp );
@ -515,12 +514,13 @@ BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit&
return TRUE;
}
void LLMenuItemGL::onVisibilityChange(BOOL new_visibility)
void LLMenuItemGL::handleVisibilityChange(BOOL new_visibility)
{
if (getMenu())
{
getMenu()->needsArrange();
}
LLView::handleVisibilityChange(new_visibility);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1067,13 +1067,13 @@ void LLMenuItemBranchGL::updateBranchParent(LLView* parentp)
}
}
void LLMenuItemBranchGL::onVisibilityChange( BOOL new_visibility )
void LLMenuItemBranchGL::handleVisibilityChange( BOOL new_visibility )
{
if (new_visibility == FALSE && getBranch() && !getBranch()->getTornOff())
{
getBranch()->setVisible(FALSE);
}
LLMenuItemGL::onVisibilityChange(new_visibility);
LLMenuItemGL::handleVisibilityChange(new_visibility);
}
BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask )
@ -1587,7 +1587,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p)
mJumpKey(p.jump_key),
mCreateJumpKeys(p.create_jump_keys),
mParentFloaterHandle(p.parent_floater),
mNeedsArrange(FALSE)
mNeedsArrange(FALSE),
mShortcutPad(p.shortcut_pad)
{
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep("_");
@ -3213,6 +3214,8 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask )
///============================================================================
/// Class LLMenuHolderGL
///============================================================================
LLCoordGL LLMenuHolderGL::sContextMenuSpawnPos(S32_MAX, S32_MAX);
LLMenuHolderGL::LLMenuHolderGL()
: LLPanel()
{
@ -3273,6 +3276,19 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask )
// down, move off the menu, then mouse-up. We want this to close the menu.
BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask )
{
const S32 SLOP = 2;
S32 spawn_dx = (x - sContextMenuSpawnPos.mX);
S32 spawn_dy = (y - sContextMenuSpawnPos.mY);
if (-SLOP <= spawn_dx && spawn_dx <= SLOP
&& -SLOP <= spawn_dy && spawn_dy <= SLOP)
{
// we're still inside the slop region from spawning this menu
// so interpret the mouse-up as a single-click to show and leave on
// screen
sContextMenuSpawnPos.set(S32_MAX, S32_MAX);
return TRUE;
}
BOOL handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL;
if (!handled)
{
@ -3344,7 +3360,7 @@ void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item)
/// Class LLTearOffMenu
///============================================================================
LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
LLFloater()
LLFloater(LLSD())
{
static LLUICachedControl<S32> floater_header_size ("UIFloaterHeaderSize", 0);
@ -3377,6 +3393,16 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :
mMenu->highlightNextItem(NULL);
}
LLTearOffMenu::~LLTearOffMenu()
{
}
// virtual
BOOL LLTearOffMenu::postBuild()
{
mCloseSignal.connect(boost::bind(&LLTearOffMenu::closeTearOff, this));
return TRUE;
}
void LLTearOffMenu::draw()
{
@ -3476,7 +3502,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup)
return tearoffp;
}
void LLTearOffMenu::onClose(bool app_quitting)
void LLTearOffMenu::closeTearOff()
{
removeChild(mMenu);
mOldParent->addChild(mMenu);
@ -3486,7 +3512,6 @@ void LLTearOffMenu::onClose(bool app_quitting)
mMenu->setVisible(FALSE);
mMenu->setTornOff(FALSE);
mMenu->setDropShadowed(TRUE);
destroy();
}
@ -3600,9 +3625,7 @@ static MenuRegistry::Register<LLContextMenu> context_menu_register2("context_men
LLContextMenu::LLContextMenu(const Params& p)
: LLMenuGL(p),
mHoveredAnyItem(FALSE),
mHoverItem(NULL),
mSpawnMouseX(S32_MAX), // definitely not inside the window frame
mSpawnMouseY(S32_MAX)
mHoverItem(NULL)
{
//setBackgroundVisible(TRUE);
}
@ -3616,6 +3639,11 @@ void LLContextMenu::setVisible(BOOL visible)
// Takes cursor position in screen space?
void LLContextMenu::show(S32 x, S32 y)
{
// Save click point for detecting cursor moves before mouse-up.
// Must be in local coords to compare with mouseUp events.
// If the mouse doesn't move, the menu will stay open ala the Mac.
LLMenuHolderGL::sContextMenuSpawnPos.set(x,y);
arrangeAndClear();
S32 width = getRect().getWidth();
@ -3652,15 +3680,11 @@ void LLContextMenu::show(S32 x, S32 y)
S32 local_x, local_y;
parent_view->screenPointToLocal(x, y, &local_x, &local_y);
// HACK: casting away const. Should use setRect or some helper function instead.
const_cast<LLRect&>(getRect()).setCenterAndSize(local_x + width/2, local_y - height/2, width, height);
LLRect rect;
rect.setLeftTopAndSize(local_x, local_y, width, height);
setRect(rect);
arrange();
// Save click point for detecting cursor moves before mouse-up.
// Must be in local coords to compare with mouseUp events.
// If the mouse doesn't move, the menu will stay open ala the Mac.
screenPointToLocal(x, y, &mSpawnMouseX, &mSpawnMouseY);
LLView::setVisible(TRUE);
}
@ -3758,20 +3782,6 @@ BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask)
BOOL LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask )
{
const S32 SLOP = 2;
S32 spawn_dx = (x - mSpawnMouseX);
S32 spawn_dy = (y - mSpawnMouseY);
if (-SLOP <= spawn_dx && spawn_dx <= SLOP
&& -SLOP <= spawn_dy && spawn_dy <= SLOP)
{
// we're still inside the slop region from spawning this menu
// so interpret the mouse-up as a single-click to show and leave on
// screen
mSpawnMouseX = S32_MAX;
mSpawnMouseY = S32_MAX;
return TRUE;
}
S32 local_x = x - getRect().mLeft;
S32 local_y = y - getRect().mBottom;

View File

@ -106,7 +106,7 @@ protected:
friend class LLUICtrlFactory;
public:
virtual void setValue(const LLSD& value) { setLabel(value.asString()); }
/*virtual*/ void onVisibilityChange(BOOL new_visibility);
/*virtual*/ void handleVisibilityChange(BOOL new_visibility);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleAcceleratorKey(KEY key, MASK mask);
@ -137,7 +137,7 @@ public:
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
// Get the parent menu for this item
virtual class LLMenuGL* getMenu();
virtual class LLMenuGL* getMenu() const;
// returns the normal width of this control in pixels - this is
// used for calculating the widest item, as well as for horizontal
@ -383,6 +383,7 @@ public:
keep_fixed_size,
scrollable;
Optional<LLUIColor> bg_color;
Optional<S32> shortcut_pad;
Params()
: jump_key("jump_key", KEY_NONE),
@ -392,7 +393,8 @@ public:
bg_visible("bg_visible", true),
create_jump_keys("create_jump_keys", false),
bg_color("bg_color", LLUIColorTable::instance().getColor( "MenuDefaultBgColor" )),
scrollable("scrollable", false)
scrollable("scrollable", false),
shortcut_pad("shortcut_pad")
{
addSynonym(bg_visible, "opaque");
addSynonym(bg_color, "color");
@ -513,6 +515,8 @@ public:
static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; }
static BOOL getKeyboardMode() { return sKeyboardMode; }
S32 getShortcutPad() { return mShortcutPad; }
void scrollItemsUp();
void scrollItemsDown();
BOOL isScrollable() const { return mScrollable; }
@ -566,6 +570,7 @@ private:
LLHandle<LLFloater> mParentFloaterHandle;
KEY mJumpKey;
BOOL mCreateJumpKeys;
S32 mShortcutPad;
}; // end class LLMenuGL
@ -621,7 +626,7 @@ public:
virtual void updateBranchParent( LLView* parentp );
// LLView Functionality
virtual void onVisibilityChange( BOOL curVisibilityIn );
virtual void handleVisibilityChange( BOOL curVisibilityIn );
virtual void draw();
@ -680,11 +685,6 @@ public:
protected:
BOOL mHoveredAnyItem;
LLMenuItemGL* mHoverItem;
// Cursor position when the menu was spawned, in menu-local coords
// Used to allow single right-click within a slop region to spawn the menu
S32 mSpawnMouseX;
S32 mSpawnMouseY;
};
@ -764,6 +764,8 @@ public:
virtual void draw();
virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
// Close context menus on right mouse up not handled by menus.
/*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask );
virtual const LLRect getMenuRect() const { return getLocalRect(); }
@ -771,6 +773,10 @@ public:
static void setActivatedItem(LLMenuItemGL* item);
// Need to detect if mouse-up after context menu spawn has moved.
// If not, need to keep the menu up.
static LLCoordGL sContextMenuSpawnPos;
private:
static LLHandle<LLView> sItemLastSelectedHandle;
static LLFrameTimer sItemActivationTimer;
@ -788,8 +794,10 @@ class LLTearOffMenu : public LLFloater
{
public:
static LLTearOffMenu* create(LLMenuGL* menup);
virtual ~LLTearOffMenu() {}
virtual void onClose(bool app_quitting);
virtual ~LLTearOffMenu();
virtual BOOL postBuild();
virtual void draw(void);
virtual void onFocusReceived();
virtual void onFocusLost();
@ -799,7 +807,9 @@ public:
private:
LLTearOffMenu(LLMenuGL* menup);
void closeTearOff();
LLView* mOldParent;
LLMenuGL* mMenu;
F32 mTargetHeight;

View File

@ -44,12 +44,11 @@
// static
std::list<LLModalDialog*> LLModalDialog::sModalStack;
LLModalDialog::LLModalDialog( const std::string& title, S32 width, S32 height, BOOL modal )
: LLFloater(),
LLModalDialog::LLModalDialog( const LLSD& key, S32 width, S32 height, BOOL modal )
: LLFloater(key),
mModal( modal )
{
setRect(LLRect( 0, height, width, 0 ));
setTitle(title);
if (modal)
{
setCanMinimize(FALSE);
@ -59,6 +58,7 @@ LLModalDialog::LLModalDialog( const std::string& title, S32 width, S32 height, B
setBackgroundVisible(TRUE);
setBackgroundOpaque(TRUE);
centerOnScreen(); // default position
mCloseSignal.connect(boost::bind(&LLModalDialog::stopModal, this));
}
LLModalDialog::~LLModalDialog()
@ -68,6 +68,18 @@ LLModalDialog::~LLModalDialog()
{
gFocusMgr.unlockFocus();
}
std::list<LLModalDialog*>::iterator iter = std::find(sModalStack.begin(), sModalStack.end(), this);
if (iter != sModalStack.end())
{
llerrs << "Attempt to delete dialog while still in sModalStack!" << llendl;
}
}
// virtual
BOOL LLModalDialog::postBuild()
{
return LLFloater::postBuild();
}
// virtual
@ -235,12 +247,6 @@ BOOL LLModalDialog::handleKeyHere(KEY key, MASK mask )
}
}
void LLModalDialog::onClose(bool app_quitting)
{
stopModal();
LLFloater::onClose(app_quitting);
}
// virtual
void LLModalDialog::draw()
{

View File

@ -45,9 +45,11 @@ class LLModalDialog;
class LLModalDialog : public LLFloater
{
public:
LLModalDialog( const std::string& title, S32 width, S32 height, BOOL modal = true );
LLModalDialog( const LLSD& key, S32 width, S32 height, BOOL modal = true );
/*virtual*/ ~LLModalDialog();
/*virtual*/ BOOL postBuild();
/*virtual*/ void openFloater(const LLSD& key = LLSD());
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
@ -63,8 +65,6 @@ public:
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ void draw();

View File

@ -42,8 +42,8 @@
// LLMultiFloater
//
LLMultiFloater::LLMultiFloater(const LLFloater::Params& params)
: LLFloater(),
LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params)
: LLFloater(key),
mTabContainer(NULL),
mTabPos(LLTabContainer::TOP),
mAutoResize(TRUE),
@ -74,20 +74,12 @@ void LLMultiFloater::buildTabContainer()
void LLMultiFloater::onOpen(const LLSD& key)
{
if (mTabContainer->getTabCount() <= 0)
{
// for now, don't allow multifloaters
// without any child floaters
closeFloater();
}
}
void LLMultiFloater::onClose(bool app_quitting)
{
if(closeAllFloaters() == TRUE)
{
LLFloater::onClose(app_quitting);
}//else not all tabs could be closed...
// if (mTabContainer->getTabCount() <= 0)
// {
// // for now, don't allow multifloaters
// // without any child floaters
// closeFloater();
// }
}
void LLMultiFloater::draw()
@ -124,7 +116,8 @@ BOOL LLMultiFloater::closeAllFloaters()
//Tab did not actually close, possibly due to a pending Save Confirmation dialog..
//so try and close the next one in the list...
tabToClose++;
}else
}
else
{
//Tab closed ok.
lastTabCount = mTabContainer->getTabCount();
@ -246,6 +239,9 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater,
{
floaterp->setVisible(FALSE);
}
// Tabs sometimes overlap resize handle
moveResizeHandlesToFront();
}
/**
@ -448,6 +444,8 @@ void LLMultiFloater::setCanResize(BOOL can_resize)
BOOL LLMultiFloater::postBuild()
{
mCloseSignal.connect(boost::bind(&LLMultiFloater::closeAllFloaters, this));
// remember any original xml minimum size
getResizeLimits(&mOrigMinWidth, &mOrigMinHeight);

View File

@ -44,14 +44,13 @@
class LLMultiFloater : public LLFloater
{
public:
LLMultiFloater(const LLFloater::Params& params = LLFloater::getDefaultParams());
LLMultiFloater(const LLSD& key, const Params& params = getDefaultParams());
virtual ~LLMultiFloater() {};
void buildTabContainer();
virtual BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void draw();
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);

View File

@ -100,8 +100,9 @@
// and we need this to manage the notification callbacks
#include "llevents.h"
#include "llfunctorregistry.h"
#include "llui.h"
#include "llmemory.h"
#include "llpointer.h"
#include "llinitparam.h"
#include "llxmlnode.h"
class LLNotification;
typedef boost::shared_ptr<LLNotification> LLNotificationPtr;
@ -158,7 +159,8 @@ public:
LLNotificationForm();
LLNotificationForm(const LLSD& sd);
LLNotificationForm(const std::string& name, const LLXMLNodePtr xml_node);
LLNotificationForm(const std::string& name,
const LLPointer<LLXMLNode> xml_node);
LLSD asLLSD() const;
@ -824,7 +826,7 @@ public:
// load notification descriptions from file;
// OK to call more than once because it will reload
bool loadTemplates();
LLXMLNodePtr checkForXMLTemplate(LLXMLNodePtr item);
LLPointer<class LLXMLNode> checkForXMLTemplate(LLPointer<class LLXMLNode> item);
// Add a simple notification (from XUI)
void addFromCallback(const LLSD& name);
@ -907,7 +909,7 @@ private:
std::string mFileName;
typedef std::map<std::string, LLXMLNodePtr> XMLTemplateMap;
typedef std::map<std::string, LLPointer<class LLXMLNode> > XMLTemplateMap;
XMLTemplateMap mXmlTemplates;
LLNotificationMap mUniqueNotifications;

View File

@ -74,7 +74,8 @@ LLPanel::Params::Params()
min_height("min_height", 100),
strings("string"),
filename("filename"),
class_name("class")
class_name("class"),
visible_callback("visible_callback")
{
name = "panel";
addSynonym(background_visible, "bg_visible");
@ -307,6 +308,12 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
return handled;
}
void LLPanel::handleVisibilityChange ( BOOL new_visibility )
{
LLUICtrl::handleVisibilityChange ( new_visibility );
mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
BOOL LLPanel::checkRequirements()
{
if (!mRequirementsError.empty())
@ -426,7 +433,11 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
// control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible
LLUICtrl::initFromParams(p);
// visible callback
if (p.visible_callback.isProvided())
initCommitCallback(p.visible_callback, mVisibleSignal);
for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin();
it != p.strings().end();
++it)

View File

@ -88,7 +88,9 @@ public:
Optional<std::string> class_name;
Multiple<LocalizedString> strings;
Optional<CommitCallbackParam> visible_callback;
Params();
};
@ -111,6 +113,7 @@ public:
/*virtual*/ BOOL isPanel() const;
/*virtual*/ void draw();
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask );
/*virtual*/ void handleVisibilityChange ( BOOL new_visibility );
// Override to set not found list:
/*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const;
@ -254,6 +257,8 @@ protected:
CommitCallbackRegistry::ScopedRegistrar mCommitCallbackRegistrar;
EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar;
commit_signal_t mVisibleSignal; // Called when visibilit changes, passes new visibility as LLSD()
private:
// Unified error reporting for the child* functions
typedef std::set<std::string> expected_members_list_t;
@ -273,7 +278,7 @@ private:
ui_string_map_t mUIStrings;
std::string mRequirementsError;
}; // end class LLPanel
#endif

View File

@ -56,8 +56,10 @@ LLScrollbar::Params::Params()
doc_pos ("doc_pos", 0),
page_size ("page_size", 0),
step_size ("step_size", 1),
thumb_image("thumb_image"),
track_image("track_image"),
thumb_image_vertical("thumb_image_vertical"),
thumb_image_horizontal("thumb_image_horizontal"),
track_image_vertical("track_image_vertical"),
track_image_horizontal("track_image_horizontal"),
track_color("track_color"),
thumb_color("thumb_color"),
thickness("thickness"),
@ -86,8 +88,10 @@ LLScrollbar::LLScrollbar(const Params & p)
mThumbColor ( p.thumb_color() ),
mOnScrollEndCallback( NULL ),
mOnScrollEndData( NULL ),
mThumbImage(p.thumb_image),
mTrackImage(p.track_image),
mThumbImageV(p.thumb_image_vertical),
mThumbImageH(p.thumb_image_horizontal),
mTrackImageV(p.track_image_vertical),
mTrackImageH(p.track_image_horizontal),
mThickness(p.thickness.isProvided() ? p.thickness : LLUI::sSettingGroups["config"]->getS32("UIScrollbarSize"))
{
updateThumbRect();
@ -493,7 +497,8 @@ void LLScrollbar::draw()
}
// Draw background and thumb.
if (mTrackImage.isNull() || mThumbImage.isNull())
if ( ( mOrientation == VERTICAL&&(mThumbImageV.isNull() || mThumbImageV.isNull()) )
|| (mOrientation == HORIZONTAL&&(mTrackImageH.isNull() || mThumbImageH.isNull()) ))
{
gl_rect_2d(mOrientation == HORIZONTAL ? mThickness : 0,
mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(),
@ -505,30 +510,54 @@ void LLScrollbar::draw()
}
else
{
// Background
mTrackImage->drawSolid(mOrientation == HORIZONTAL ? mThickness : 0,
mOrientation == VERTICAL ? mThickness : 0,
mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * mThickness : getRect().getWidth(),
mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(),
mTrackColor.get());
// Thumb
LLRect outline_rect = mThumbRect;
outline_rect.stretch(2);
if (gFocusMgr.getKeyboardFocus() == this)
S32 rect_fix = 0;
// Background
if(mOrientation == HORIZONTAL)
{
mTrackImage->draw(outline_rect, gFocusMgr.getFocusColor());
mTrackImageH->drawSolid(mThickness //S32 x
, 0 //S32 y
, getRect().getWidth() - 2 * mThickness //S32 width
, getRect().getHeight()- rect_fix //S32 height
, mTrackColor.get()); //const LLColor4& color
if (gFocusMgr.getKeyboardFocus() == this)
{
mTrackImageH->draw(outline_rect, gFocusMgr.getFocusColor());
}
mThumbImageH->draw(mThumbRect, mThumbColor.get());
if (mCurGlowStrength > 0.01f)
{
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
mThumbImageH->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
mThumbImage->draw(mThumbRect, mThumbColor.get());
if (mCurGlowStrength > 0.01f)
else if(mOrientation == VERTICAL)
{
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
mThumbImage->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
mTrackImageV->drawSolid( 0+rect_fix //S32 x
, mThickness //S32 y
, getRect().getWidth() //S32 width
, getRect().getHeight() - 2 * mThickness //S32 height
, mTrackColor.get()); //const LLColor4& color
if (gFocusMgr.getKeyboardFocus() == this)
{
mTrackImageV->draw(outline_rect, gFocusMgr.getFocusColor());
}
mThumbImageV->draw(mThumbRect, mThumbColor.get());
if (mCurGlowStrength > 0.01f)
{
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
mThumbImageV->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
}
BOOL was_scrolled_to_bottom = (getDocPos() == getDocPosMax());

View File

@ -61,8 +61,10 @@ public:
Optional<S32> step_size;
Optional<S32> thickness;
Optional<LLUIImage*> thumb_image,
track_image;
Optional<LLUIImage*> thumb_image_vertical,
thumb_image_horizontal,
track_image_horizontal,
track_image_vertical;
Optional<LLUIColor> track_color,
thumb_color;
@ -155,8 +157,10 @@ private:
LLUIColor mTrackColor;
LLUIColor mThumbColor;
LLUIImagePtr mThumbImage;
LLUIImagePtr mTrackImage;
LLUIImagePtr mThumbImageV;
LLUIImagePtr mThumbImageH;
LLUIImagePtr mTrackImageV;
LLUIImagePtr mTrackImageH;
S32 mThickness;

View File

@ -163,7 +163,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
mSorted(FALSE),
mDirty(FALSE),
mOriginalSelection(-1),
mDrewSelected(FALSE),
mLastSelected(NULL),
mHeadingHeight(p.heading_height),
mAllowMultipleSelection(p.multi_select),
@ -1353,8 +1352,6 @@ void LLScrollListCtrl::drawItems()
S32 cur_y = y;
mDrewSelected = FALSE;
S32 line = 0;
S32 max_columns = 0;
@ -1375,11 +1372,6 @@ void LLScrollListCtrl::drawItems()
//llinfos << item_rect.getWidth() << llendl;
if (item->getSelected())
{
mDrewSelected = TRUE;
}
max_columns = llmax(max_columns, item->getNumColumns());
LLColor4 fg_color;
@ -1444,10 +1436,7 @@ void LLScrollListCtrl::draw()
LLLocalClipRect clip(getLocalRect());
// if user specifies sort, make sure it is maintained
if (needsSorting() && !isSorted())
{
sortItems();
}
sortItems();
if (mNeedsScroll)
{
@ -2208,6 +2197,8 @@ BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending)
sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING;
sort_column_t new_sort_column(column_idx, ascending);
setSorted(FALSE);
if (mSortColumns.empty())
{
@ -2248,21 +2239,22 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending)
// First column is column 0
void LLScrollListCtrl::sortByColumnIndex(U32 column, BOOL ascending)
{
if (setSort(column, ascending))
{
sortItems();
}
setSort(column, ascending);
sortItems();
}
void LLScrollListCtrl::sortItems()
{
// do stable sort to preserve any previous sorts
std::stable_sort(
mItemList.begin(),
mItemList.end(),
SortScrollListItem(mSortColumns));
if (hasSortOrder() && !isSorted())
{
// do stable sort to preserve any previous sorts
std::stable_sort(
mItemList.begin(),
mItemList.end(),
SortScrollListItem(mSortColumns));
setSorted(TRUE);
setSorted(TRUE);
}
}
// for one-shot sorts, does not save sort column/order
@ -2318,10 +2310,7 @@ void LLScrollListCtrl::scrollToShowSelected()
return;
}
if (needsSorting() && !isSorted())
{
sortItems();
}
sortItems();
S32 index = getFirstSelectedIndex();
if (index < 0)
@ -2562,7 +2551,7 @@ std::string LLScrollListCtrl::getSortColumnName()
else return "";
}
BOOL LLScrollListCtrl::needsSorting()
BOOL LLScrollListCtrl::hasSortOrder()
{
return !mSortColumns.empty();
}

View File

@ -329,7 +329,7 @@ public:
std::string getSortColumnName();
BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; }
BOOL needsSorting();
BOOL hasSortOrder();
S32 selectMultiple( std::vector<LLUUID> ids );
void sortItems();
@ -374,9 +374,6 @@ private:
void commitIfChanged();
BOOL setSort(S32 column, BOOL ascending);
S32 mCurIndex; // For get[First/Next]Data
S32 mCurSelectedIndex; // For get[First/Next]Selected
S32 mLineHeight; // the max height of a single line
S32 mScrollLines; // how many lines we've scrolled down
S32 mPageLines; // max number of lines is it possible to see on the screen given mRect and mLineHeight
@ -445,11 +442,6 @@ private:
typedef std::pair<S32, BOOL> sort_column_t;
std::vector<sort_column_t> mSortColumns;
// HACK: Did we draw one selected item this frame?
BOOL mDrewSelected;
LLTextBox* mCommentTextBox;
}; // end class LLScrollListCtrl
#endif // LL_SCROLLLISTCTRL_H

View File

@ -39,20 +39,20 @@
LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p)
: LLUICtrl(p)
{
const S32 fudge = 2;
S32 btn_height = getRect().getHeight() - (fudge * 2);
S32 btn_top = p.search_button.top_pad + p.search_button.rect.height;
S32 btn_right = p.search_button.rect.width + p.search_button.left_pad;
LLRect search_btn_rect(p.search_button.left_pad, btn_top, btn_right, p.search_button.top_pad);
LLLineEditor::Params line_editor_params(p);
line_editor_params.name("filter edit box");
line_editor_params.rect(getLocalRect());
line_editor_params.follows.flags(FOLLOWS_ALL);
line_editor_params.text_pad_left(btn_height + fudge);
line_editor_params.text_pad_left(p.text_pad_left + search_btn_rect.getWidth());
line_editor_params.commit_callback.function(boost::bind(&LLUICtrl::onCommit, this));
mSearchEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_params);
addChild(mSearchEditor);
LLRect search_btn_rect(fudge, fudge + btn_height, fudge + btn_height, fudge);
LLButton::Params button_params(p.search_button);
button_params.name(std::string("clear filter"));
button_params.rect(search_btn_rect) ;

View File

@ -286,6 +286,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p)
mReflowNeeded(FALSE),
mScrollNeeded(FALSE),
mLastSelectionY(-1),
mParseHTML(FALSE),
mParseHighlights(FALSE),
mTabsToNextField(p.ignore_tab),
mGLFont(p.font)
{
@ -335,7 +337,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p)
setHideScrollbarForShortDocs(p.hide_scrollbar);
mParseHTML=FALSE;
mHTML.clear();
}
@ -388,6 +389,15 @@ void LLTextEditor::setThumbColor( const LLColor4& color )
mScrollbar->setThumbColor(color);
}
struct LLTextEditor::pred
{
bool operator()(const std::pair<S32, S32>& b, const LLTextEditor::line_info& a)
{
return a.mSegment > 0;
}
};
void LLTextEditor::updateLineStartList(S32 startpos)
{
updateSegments();
@ -398,11 +408,12 @@ void LLTextEditor::updateLineStartList(S32 startpos)
S32 seg_idx = 0;
S32 seg_offset = 0;
if (!mLineStartList.empty())
{
getSegmentAndOffset(startpos, &seg_idx, &seg_offset);
line_info t(seg_idx, seg_offset);
line_list_t::iterator iter = std::upper_bound(mLineStartList.begin(), mLineStartList.end(), t, line_info_compare());
line_list_t::iterator iter = std::upper_bound(mLineStartList.begin(), mLineStartList.end(), std::make_pair(seg_idx, seg_offset), pred());
if (iter != mLineStartList.begin()) --iter;
seg_idx = iter->mSegment;
seg_offset = iter->mOffset;

View File

@ -515,6 +515,7 @@ private:
S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be
LLRect mTextRect; // The rect in which text is drawn. Excludes borders.
// List of offsets and segment index of the start of each line. Always has at least one node (0).
struct pred;
struct line_info
{
line_info(S32 segment, S32 offset) : mSegment(segment), mOffset(offset) {}

View File

@ -1860,10 +1860,11 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
for (settings_map_t::iterator itor = sSettingGroups.begin();
itor != sSettingGroups.end(); ++itor)
{
if(itor->second!= NULL)
LLControlGroup* control_group = itor->second;
if(control_group != NULL)
{
if (sSettingGroups[(itor->first)]->controlExists(controlname))
return *sSettingGroups[(itor->first)];
if (control_group->controlExists(controlname))
return *control_group;
}
}

View File

@ -222,193 +222,6 @@ private:
static std::vector<std::string> sXUIPaths;
};
// FactoryPolicy is a static class that controls the creation and lookup of UI elements,
// such as floaters.
// The key parameter is used to provide a unique identifier and/or associated construction
// parameters for a given UI instance
//
// Specialize this traits for different types, or provide a class with an identical interface
// in the place of the traits parameter
//
// For example:
//
// template <>
// class FactoryPolicy<MyClass> /* FactoryPolicy specialized for MyClass */
// {
// public:
// static MyClass* findInstance(const LLSD& key = LLSD())
// {
// /* return instance of MyClass associated with key */
// }
//
// static MyClass* createInstance(const LLSD& key = LLSD())
// {
// /* create new instance of MyClass using key for construction parameters */
// }
// }
//
// class MyClass : public LLUIFactory<MyClass>
// {
// /* uses FactoryPolicy<MyClass> by default */
// }
template <class T>
class FactoryPolicy
{
public:
// basic factory methods
static T* findInstance(const LLSD& key); // unimplemented, provide specialiation
static T* createInstance(const LLSD& key); // unimplemented, provide specialiation
};
// VisibilityPolicy controls the visibility of UI elements, such as floaters.
// The key parameter is used to store the unique identifier of a given UI instance
//
// Specialize this traits for different types, or duplicate this interface for specific instances
// (see above)
template <class T>
class VisibilityPolicy
{
public:
// visibility methods
static bool visible(T* instance, const LLSD& key); // unimplemented, provide specialiation
static void show(T* instance, const LLSD& key); // unimplemented, provide specialiation
static void hide(T* instance, const LLSD& key); // unimplemented, provide specialiation
};
// Manages generation of UI elements by LLSD, such that (generally) there is
// a unique instance per distinct LLSD parameter
// Class T is the instance type being managed, and the FACTORY_POLICY and VISIBILITY_POLICY
// classes provide static methods for creating, accessing, showing and hiding the associated
// element T
template <class T, class FACTORY_POLICY = FactoryPolicy<T>, class VISIBILITY_POLICY = VisibilityPolicy<T> >
class LLUIFactory
{
public:
// give names to the template parameters so derived classes can refer to them
// except this doesn't work in gcc
typedef FACTORY_POLICY factory_policy_t;
typedef VISIBILITY_POLICY visibility_policy_t;
LLUIFactory()
{
}
virtual ~LLUIFactory()
{
}
// default show and hide methods
static T* showInstance(const LLSD& key = LLSD())
{
T* instance = getInstance(key);
if (instance != NULL)
{
VISIBILITY_POLICY::show(instance, key);
}
return instance;
}
static void hideInstance(const LLSD& key = LLSD())
{
T* instance = getInstance(key);
if (instance != NULL)
{
VISIBILITY_POLICY::hide(instance, key);
}
}
static void toggleInstance(const LLSD& key = LLSD())
{
if (instanceVisible(key))
{
hideInstance(key);
}
else
{
showInstance(key);
}
}
static bool instanceVisible(const LLSD& key = LLSD())
{
T* instance = FACTORY_POLICY::findInstance(key);
return instance != NULL && VISIBILITY_POLICY::visible(instance, key);
}
static T* getInstance(const LLSD& key = LLSD())
{
T* instance = FACTORY_POLICY::findInstance(key);
if (instance == NULL)
{
instance = FACTORY_POLICY::createInstance(key);
}
return instance;
}
};
// Creates a UI singleton by ignoring the identifying parameter
// and always generating the same instance via the LLUIFactory interface.
// Note that since UI elements can be destroyed by their hierarchy, this singleton
// pattern uses a static pointer to an instance that will be re-created as needed.
//
// Usage Pattern:
//
// class LLFloaterFoo : public LLFloater, public LLUISingleton<LLFloaterFoo>
// {
// friend class LLUISingleton<LLFloaterFoo>;
// private:
// LLFloaterFoo(const LLSD& key);
// };
//
// Note that LLUISingleton takes an option VisibilityPolicy parameter that defines
// how showInstance(), hideInstance(), etc. work.
//
// https://wiki.lindenlab.com/mediawiki/index.php?title=LLUISingleton&oldid=79352
template <class T, class VISIBILITY_POLICY = VisibilityPolicy<T> >
class LLUISingleton: public LLUIFactory<T, LLUISingleton<T, VISIBILITY_POLICY>, VISIBILITY_POLICY>
{
protected:
// T must derive from LLUISingleton<T>
LLUISingleton() { sInstance = static_cast<T*>(this); }
~LLUISingleton() { sInstance = NULL; }
public:
static T* findInstance(const LLSD& key = LLSD())
{
return sInstance;
}
static T* createInstance(const LLSD& key = LLSD())
{
if (sInstance == NULL)
{
sInstance = new T(key);
}
return sInstance;
}
static void destroyInstance()
{
delete sInstance;
sInstance = NULL;
}
static bool instanceExists() { return NULL != sInstance; }
private:
LLUISingleton(const LLUISingleton&){}
LLUISingleton& operator=(const LLUISingleton&){}
private:
static T* sInstance;
};
template <class T, class U> T* LLUISingleton<T,U>::sInstance = NULL;
class LLScreenClipRect
{

View File

@ -125,7 +125,9 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
mViewModel(viewmodel),
mControlVariable(NULL),
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL)
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
mMakeInvisibleControlVariable(NULL)
{
mUICtrlHandle.bind(this);
}

View File

@ -196,7 +196,7 @@ static LLFastTimer::DeclareTimer BUILD_FLOATERS("Build Floaters");
//-----------------------------------------------------------------------------
// buildFloater()
//-----------------------------------------------------------------------------
void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, BOOL open_floater, LLXMLNodePtr output_node)
void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node)
{
LLFastTimer timer(BUILD_FLOATERS);
LLXMLNodePtr root;
@ -236,7 +236,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
floaterp->getCommitCallbackRegistrar().pushScope();
floaterp->getEnableCallbackRegistrar().pushScope();
floaterp->initFloaterXML(root, floaterp->getParent(), open_floater, output_node);
floaterp->initFloaterXML(root, floaterp->getParent(), output_node);
if (LLUI::sShowXUINames)
{
@ -254,13 +254,6 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen
mFileNames.pop_back();
}
LLFloater* LLUICtrlFactory::buildFloaterFromXML(const std::string& filename, BOOL open_floater)
{
LLFloater* floater = new LLFloater();
buildFloater(floater, filename, open_floater);
return floater;
}
//-----------------------------------------------------------------------------
// saveToXML()
//-----------------------------------------------------------------------------

View File

@ -267,8 +267,7 @@ public:
return ParamDefaults<typename T::Params, 0>::instance().get();
}
void buildFloater(LLFloater* floaterp, const std::string &filename, BOOL open_floater = TRUE, LLXMLNodePtr output_node = NULL);
LLFloater* buildFloaterFromXML(const std::string& filename, BOOL open_floater = TRUE);
void buildFloater(LLFloater* floaterp, const std::string &filename, LLXMLNodePtr output_node);
BOOL buildPanel(LLPanel* panelp, const std::string &filename, LLXMLNodePtr output_node = NULL);
// Does what you want for LLFloaters and LLPanels

View File

@ -603,14 +603,14 @@ void LLView::setVisible(BOOL visible)
if (!getParent() || getParent()->isInVisibleChain())
{
// tell all children of this view that the visibility may have changed
onVisibilityChange( visible );
handleVisibilityChange( visible );
}
updateBoundingRect();
}
}
// virtual
void LLView::onVisibilityChange ( BOOL new_visibility )
void LLView::handleVisibilityChange ( BOOL new_visibility )
{
for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
@ -618,7 +618,7 @@ void LLView::onVisibilityChange ( BOOL new_visibility )
// only views that are themselves visible will have their overall visibility affected by their ancestors
if (viewp->getVisible())
{
viewp->onVisibilityChange ( new_visibility );
viewp->handleVisibilityChange ( new_visibility );
}
}
}

View File

@ -93,7 +93,7 @@ virtual void setEnabled(BOOL enabled) { mEnabled = enabled; }
LLCheckBoxCtrl, LLComboBox, LLLineEditor, LLMenuGL, LLRadioGroup, etc
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; }
LLUICtrl, LLButton, LLCheckBoxCtrl, LLLineEditor, LLMenuGL, LLSliderCtrl
virtual void onVisibilityChange ( BOOL curVisibilityIn );
virtual void handleVisibilityChange ( BOOL curVisibilityIn );
LLMenuGL
virtual LLRect getSnapRect() const { return mRect; } *TODO: Make non virtual
LLFloater
@ -349,7 +349,7 @@ public:
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
virtual void onVisibilityChange ( BOOL curVisibilityIn );
virtual void handleVisibilityChange ( BOOL new_visibility );
void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); }
void popVisible() { setVisible(mLastVisible); }

View File

@ -89,6 +89,7 @@ set(viewer_SOURCE_FILES
llcapabilitylistener.cpp
llcaphttpsender.cpp
llchannelmanager.cpp
llchatbar.cpp
llchatitemscontainerctrl.cpp
llchatmsgbox.cpp
llchiclet.cpp
@ -151,13 +152,11 @@ set(viewer_SOURCE_FILES
llfloatercamera.cpp
llfloaterchat.cpp
llfloaterchatterbox.cpp
llfloaterclassified.cpp
llfloatercolorpicker.cpp
llfloatercustomize.cpp
llfloaterdaycycle.cpp
llfloaterdirectory.cpp
llfloaterenvsettings.cpp
llfloaterevent.cpp
llfloaterfirsttimetip.cpp
llfloaterfriends.cpp
llfloaterfonttest.cpp
@ -186,7 +185,6 @@ set(viewer_SOURCE_FILES
llfloatermute.cpp
llfloaternamedesc.cpp
llfloaternotificationsconsole.cpp
llfloaterobjectiminfo.cpp
llfloateropenobject.cpp
llfloaterparcel.cpp
llfloaterperms.cpp
@ -283,6 +281,7 @@ set(viewer_SOURCE_FILES
lloverlaybar.cpp
llpanelavatar.cpp
llpanelavatarrow.cpp
llpanelavatartag.cpp
llpanelclassified.cpp
llsidetraypanelcontainer.cpp
llpanelcontents.cpp
@ -531,6 +530,7 @@ set(viewer_HEADER_FILES
llcapabilityprovider.h
llcaphttpsender.h
llchannelmanager.h
llchatbar.h
llchatitemscontainerctrl.h
llchatmsgbox.h
llchiclet.h
@ -594,13 +594,11 @@ set(viewer_HEADER_FILES
llfloatercamera.h
llfloaterchat.h
llfloaterchatterbox.h
llfloaterclassified.h
llfloatercolorpicker.h
llfloatercustomize.h
llfloaterdaycycle.h
llfloaterdirectory.h
llfloaterenvsettings.h
llfloaterevent.h
llfloaterfirsttimetip.h
llfloaterfonttest.h
llfloaterfriends.h
@ -629,7 +627,6 @@ set(viewer_HEADER_FILES
llfloatermute.h
llfloaternamedesc.h
llfloaternotificationsconsole.h
llfloaterobjectiminfo.h
llfloateropenobject.h
llfloaterparcel.h
llfloaterpostcard.h
@ -725,6 +722,7 @@ set(viewer_HEADER_FILES
lloverlaybar.h
llpanelavatar.h
llpanelavatarrow.h
llpanelavatartag.h
llpanelclassified.h
llsidetraypanelcontainer.h
llpanelcontents.h

View File

@ -584,17 +584,6 @@
<key>Value</key>
<integer>40</integer>
</map>
<key>BeaconAlwaysOn</key>
<map>
<key>Comment</key>
<string>Beacons / highlighting always on</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>BottomPanelNew</key>
<map>
<key>Comment</key>
@ -4593,7 +4582,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
<integer>0</integer>
</map>
<key>NearMeRange</key>
<map>
@ -7203,7 +7192,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<integer>1</integer>
</map>
<key>ShowTangentBasis</key>
<map>
@ -8289,7 +8278,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
<real>16</real>
<real>15</real>
</map>
<key>UISliderctrlHeight</key>
<map>

View File

@ -678,13 +678,15 @@ bool LLAppViewer::init()
// Setup paths and LLTrans after LLUI::initClass has been called
LLUI::setupPaths();
LLTrans::parseStrings("strings.xml", default_trans_args);
LLTrans::parseLanguageStrings("language_settings.xml");
LLWeb::initClass(); // do this after LLUI
LLTextEditor::setURLCallbacks(&LLWeb::loadURL,
&LLURLDispatcher::dispatchFromTextEditor,
&LLURLDispatcher::dispatchFromTextEditor);
// Load translations for tooltips
LLFloater::initClass();
/////////////////////////////////////////////////
@ -1739,7 +1741,7 @@ bool LLAppViewer::initConfiguration()
LLUI::setupPaths(); // setup paths for LLTrans based on settings files only
LLTrans::parseStrings("strings.xml", default_trans_args);
LLTrans::parseLanguageStrings("language_settings.xml");
// - set procedural settings
// Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet
gSavedSettings.setString("ClientSettingsFile",
@ -1794,6 +1796,7 @@ bool LLAppViewer::initConfiguration()
LLControlGroupCLP clp;
std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,
"cmd_line.xml");
clp.configure(cmd_line_config, &gSavedSettings);
if(!initParseCommandLine(clp))
@ -3435,7 +3438,7 @@ void LLAppViewer::idle()
{
// Handle pending gesture processing
gGestureManager.update();
LLGestureManager::instance().update();
gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
}

View File

@ -465,10 +465,10 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
{
// If this gesture is active, then we need to update the in-memory
// active map with the new pointer.
if (gGestureManager.isGestureActive(item_id))
if (LLGestureManager::instance().isGestureActive(item_id))
{
LLUUID asset_id = new_item->getAssetUUID();
gGestureManager.replaceGesture(item_id, asset_id);
LLGestureManager::instance().replaceGesture(item_id, asset_id);
gInventory.notifyObservers();
}

View File

@ -40,13 +40,14 @@
#include "llnearbychatbar.h"
#include "llsplitbutton.h"
#include "llfloatercamera.h"
#include "llimpanel.h"
LLBottomTray::LLBottomTray(const LLSD&)
: mChicletPanel(NULL)
, mIMWell(NULL)
, mSysWell(NULL)
, mTalkBtn(NULL)
, mNearbyChatBar(NULL)
: mChicletPanel(NULL),
mIMWell(NULL),
mSysWell(NULL),
mTalkBtn(NULL),
mNearbyChatBar(NULL)
{
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
@ -72,6 +73,13 @@ LLBottomTray::LLBottomTray(const LLSD&)
setFocusRoot(TRUE);
}
BOOL LLBottomTray::postBuild()
{
mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar");
return TRUE;
}
LLBottomTray::~LLBottomTray()
{
if (!LLSingleton<LLIMMgr>::destroyed())
@ -87,24 +95,18 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl)
{
// Until you can type into an IM Window and have a conversation,
// still show the old communicate window
LLFloaterReg::showInstance("communicate", chiclet->getSessionId());
// DISABLED IN VIEWER-2 BRANCH UNTIL FEATURE IS DONE -- James
//// Show after comm window so it is frontmost (and hence will not
//// auto-hide)
//LLIMFloater::show(chiclet->getSessionId());
//LLFloaterReg::showInstance("communicate", chiclet->getSessionId());
// Show after comm window so it is frontmost (and hence will not
// auto-hide)
LLIMFloater::show(chiclet->getSessionId());
chiclet->setCounter(0);
}
}
void* LLBottomTray::createNearbyChatBar(void* userdata)
{
LLBottomTray *bt = LLBottomTray::getInstance();
if (!bt)
return NULL;
bt->mNearbyChatBar = new LLNearbyChatBar();
return bt->mNearbyChatBar;
return new LLNearbyChatBar();
}
//virtual

View File

@ -43,21 +43,22 @@ class LLTalkButton;
class LLNearbyChatBar;
class LLBottomTray
: public LLUISingleton<LLBottomTray>
: public LLSingleton<LLBottomTray>
, public LLPanel
, public LLIMSessionObserver
{
friend class LLUISingleton<LLBottomTray>;
friend class LLSingleton<LLBottomTray>;
public:
~LLBottomTray();
BOOL postBuild();
LLChicletPanel* getChicletPanel() {return mChicletPanel;}
LLNotificationChiclet* getIMWell() {return mIMWell;}
LLNotificationChiclet* getSysWell() {return mSysWell;}
LLNearbyChatBar* getNearbyChatBar() {return mNearbyChatBar;}
void onCommitGesture(LLUICtrl* ctrl);
void refreshGestures();
// LLIMSessionObserver observe triggers
virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id);

694
indra/newview/llchatbar.cpp Normal file
View File

@ -0,0 +1,694 @@
/**
* @file llchatbar.cpp
* @brief LLChatBar class implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llchatbar.h"
#include "imageids.h"
#include "llfontgl.h"
#include "llrect.h"
#include "llerror.h"
#include "llparcel.h"
#include "llstring.h"
#include "message.h"
#include "llfocusmgr.h"
#include "llagent.h"
#include "llbutton.h"
#include "llcombobox.h"
#include "llcommandhandler.h" // secondlife:///app/chat/ support
#include "llviewercontrol.h"
#include "llfloaterchat.h"
#include "llgesturemgr.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llstatusbar.h"
#include "lltextbox.h"
#include "lluiconstants.h"
#include "llviewergesture.h" // for triggering gestures
#include "llviewermenu.h" // for deleting object with DEL key
#include "llviewerstats.h"
#include "llviewerwindow.h"
#include "llframetimer.h"
#include "llresmgr.h"
#include "llworld.h"
#include "llinventorymodel.h"
#include "llmultigesture.h"
#include "llui.h"
#include "llviewermenu.h"
#include "lluictrlfactory.h"
#include "llbottomtray.h"
//
// Globals
//
const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds
LLChatBar *gChatBar = NULL;
class LLChatBarGestureObserver : public LLGestureManagerObserver
{
public:
LLChatBarGestureObserver(LLChatBar* chat_barp) : mChatBar(chat_barp){}
virtual ~LLChatBarGestureObserver() {}
virtual void changed() { mChatBar->refreshGestures(); }
private:
LLChatBar* mChatBar;
};
extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
//
// Functions
//
LLChatBar::LLChatBar()
: LLPanel(),
mInputEditor(NULL),
mGestureLabelTimer(),
mLastSpecialChatChannel(0),
mIsBuilt(FALSE),
mGestureCombo(NULL),
mObserver(NULL)
{
setIsChrome(TRUE);
#if !LL_RELEASE_FOR_DOWNLOAD
childDisplayNotFound();
#endif
}
LLChatBar::~LLChatBar()
{
LLGestureManager::instance().removeObserver(mObserver);
delete mObserver;
mObserver = NULL;
// LLView destructor cleans up children
}
BOOL LLChatBar::postBuild()
{
getChild<LLUICtrl>("Say")->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1));
// attempt to bind to an existing combo box named gesture
setGestureCombo(getChild<LLComboBox>( "Gesture", TRUE, FALSE));
mInputEditor = getChild<LLLineEditor>("Chat Editor");
mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke, this);
mInputEditor->setFocusLostCallback(&onInputEditorFocusLost, this);
mInputEditor->setFocusReceivedCallback( &onInputEditorGainFocus, this );
mInputEditor->setCommitOnFocusLost( FALSE );
mInputEditor->setRevertOnEsc( FALSE );
mInputEditor->setIgnoreTab(TRUE);
mInputEditor->setPassDelete(TRUE);
mInputEditor->setReplaceNewlinesWithSpaces(FALSE);
mInputEditor->setMaxTextLength(1023);
mInputEditor->setEnableLineHistory(TRUE);
mIsBuilt = TRUE;
return TRUE;
}
//-----------------------------------------------------------------------
// Overrides
//-----------------------------------------------------------------------
// virtual
BOOL LLChatBar::handleKeyHere( KEY key, MASK mask )
{
BOOL handled = FALSE;
// ALT-RETURN is reserved for windowed/fullscreen toggle
if( KEY_RETURN == key )
{
if (mask == MASK_CONTROL)
{
// shout
sendChat(CHAT_TYPE_SHOUT);
handled = TRUE;
}
else if (mask == MASK_NONE)
{
// say
sendChat( CHAT_TYPE_NORMAL );
handled = TRUE;
}
}
// only do this in main chatbar
else if ( KEY_ESCAPE == key && gChatBar == this)
{
stopChat();
handled = TRUE;
}
return handled;
}
void LLChatBar::refresh()
{
// HACK: Leave the name of the gesture in place for a few seconds.
const F32 SHOW_GESTURE_NAME_TIME = 2.f;
if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME)
{
LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL;
if (gestures) gestures->selectFirstItem();
mGestureLabelTimer.stop();
}
if ((gAgent.getTypingTime() > AGENT_TYPING_TIMEOUT) && (gAgent.getRenderState() & AGENT_STATE_TYPING))
{
gAgent.stopTyping();
}
childSetEnabled("Say", mInputEditor->getText().size() > 0);
}
void LLChatBar::refreshGestures()
{
if (mGestureCombo)
{
//store current selection so we can maintain it
std::string cur_gesture = mGestureCombo->getValue().asString();
mGestureCombo->selectFirstItem();
std::string label = mGestureCombo->getValue().asString();;
// clear
mGestureCombo->clearRows();
// collect list of unique gestures
std::map <std::string, BOOL> unique;
LLGestureManager::item_map_t::iterator it;
for (it = LLGestureManager::instance().mActive.begin(); it != LLGestureManager::instance().mActive.end(); ++it)
{
LLMultiGesture* gesture = (*it).second;
if (gesture)
{
if (!gesture->mTrigger.empty())
{
unique[gesture->mTrigger] = TRUE;
}
}
}
// add unique gestures
std::map <std::string, BOOL>::iterator it2;
for (it2 = unique.begin(); it2 != unique.end(); ++it2)
{
mGestureCombo->addSimpleElement((*it2).first);
}
mGestureCombo->sortByName();
// Insert label after sorting, at top, with separator below it
mGestureCombo->addSeparator(ADD_TOP);
mGestureCombo->addSimpleElement(getString("gesture_label"), ADD_TOP);
if (!cur_gesture.empty())
{
mGestureCombo->selectByValue(LLSD(cur_gesture));
}
else
{
mGestureCombo->selectFirstItem();
}
}
}
// Move the cursor to the correct input field.
void LLChatBar::setKeyboardFocus(BOOL focus)
{
if (focus)
{
if (mInputEditor)
{
mInputEditor->setFocus(TRUE);
mInputEditor->selectAll();
}
}
else if (gFocusMgr.childHasKeyboardFocus(this))
{
if (mInputEditor)
{
mInputEditor->deselect();
}
setFocus(FALSE);
}
}
// Ignore arrow keys in chat bar
void LLChatBar::setIgnoreArrowKeys(BOOL b)
{
if (mInputEditor)
{
mInputEditor->setIgnoreArrowKeys(b);
}
}
BOOL LLChatBar::inputEditorHasFocus()
{
return mInputEditor && mInputEditor->hasFocus();
}
std::string LLChatBar::getCurrentChat()
{
return mInputEditor ? mInputEditor->getText() : LLStringUtil::null;
}
void LLChatBar::setGestureCombo(LLComboBox* combo)
{
mGestureCombo = combo;
if (mGestureCombo)
{
mGestureCombo->setCommitCallback(boost::bind(&LLChatBar::onCommitGesture, this, _1));
// now register observer since we have a place to put the results
mObserver = new LLChatBarGestureObserver(this);
LLGestureManager::instance().addObserver(mObserver);
// refresh list from current active gestures
refreshGestures();
}
}
//-----------------------------------------------------------------------
// Internal functions
//-----------------------------------------------------------------------
// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
// Otherwise returns input and channel 0.
LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel)
{
if (mesg[0] == '/'
&& mesg[1] == '/')
{
// This is a "repeat channel send"
*channel = mLastSpecialChatChannel;
return mesg.substr(2, mesg.length() - 2);
}
else if (mesg[0] == '/'
&& mesg[1]
&& LLStringOps::isDigit(mesg[1]))
{
// This a special "/20" speak on a channel
S32 pos = 0;
// Copy the channel number into a string
LLWString channel_string;
llwchar c;
do
{
c = mesg[pos+1];
channel_string.push_back(c);
pos++;
}
while(c && pos < 64 && LLStringOps::isDigit(c));
// Move the pointer forward to the first non-whitespace char
// Check isspace before looping, so we can handle "/33foo"
// as well as "/33 foo"
while(c && iswspace(c))
{
c = mesg[pos+1];
pos++;
}
mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10);
*channel = mLastSpecialChatChannel;
return mesg.substr(pos, mesg.length() - pos);
}
else
{
// This is normal chat.
*channel = 0;
return mesg;
}
}
void LLChatBar::sendChat( EChatType type )
{
if (mInputEditor)
{
LLWString text = mInputEditor->getConvertedText();
if (!text.empty())
{
// store sent line in history, duplicates will get filtered
if (mInputEditor) mInputEditor->updateHistory();
// Check if this is destined for another channel
S32 channel = 0;
stripChannelNumber(text, &channel);
std::string utf8text = wstring_to_utf8str(text);
// Try to trigger a gesture, if not chat to a script.
std::string utf8_revised_text;
if (0 == channel)
{
// discard returned "found" boolean
LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
}
else
{
utf8_revised_text = utf8text;
}
utf8_revised_text = utf8str_trim(utf8_revised_text);
if (!utf8_revised_text.empty())
{
// Chat with animation
sendChatFromViewer(utf8_revised_text, type, TRUE);
}
}
}
childSetValue("Chat Editor", LLStringUtil::null);
gAgent.stopTyping();
// If the user wants to stop chatting on hitting return, lose focus
// and go out of chat mode.
if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn"))
{
stopChat();
}
}
//-----------------------------------------------------------------------
// Static functions
//-----------------------------------------------------------------------
// static
void LLChatBar::startChat(const char* line)
{
//TODO* remove DUMMY chat
//if(gBottomTray && gBottomTray->getChatBox())
//{
// gBottomTray->setVisible(TRUE);
// gBottomTray->getChatBox()->setFocus(TRUE);
//}
// *TODO Vadim: Why was this code commented out?
// gChatBar->setVisible(TRUE);
// gChatBar->setKeyboardFocus(TRUE);
// gSavedSettings.setBOOL("ChatVisible", TRUE);
//
// if (line && gChatBar->mInputEditor)
// {
// std::string line_string(line);
// gChatBar->mInputEditor->setText(line_string);
// }
// // always move cursor to end so users don't obliterate chat when accidentally hitting WASD
// gChatBar->mInputEditor->setCursorToEnd();
}
// Exit "chat mode" and do the appropriate focus changes
// static
void LLChatBar::stopChat()
{
//TODO* remove DUMMY chat
//if(gBottomTray && gBottomTray->getChatBox())
///{
// gBottomTray->getChatBox()->setFocus(FALSE);
//}
// *TODO Vadim: Why was this code commented out?
// // In simple UI mode, we never release focus from the chat bar
// gChatBar->setKeyboardFocus(FALSE);
//
// // If we typed a movement key and pressed return during the
// // same frame, the keyboard handlers will see the key as having
// // gone down this frame and try to move the avatar.
// gKeyboard->resetKeys();
// gKeyboard->resetMaskKeys();
//
// // stop typing animation
// gAgent.stopTyping();
//
// // hide chat bar so it doesn't grab focus back
// gChatBar->setVisible(FALSE);
// gSavedSettings.setBOOL("ChatVisible", FALSE);
}
// static
void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
{
LLChatBar* self = (LLChatBar *)userdata;
LLWString raw_text;
if (self->mInputEditor) raw_text = self->mInputEditor->getWText();
// Can't trim the end, because that will cause autocompletion
// to eat trailing spaces that might be part of a gesture.
LLWStringUtil::trimHead(raw_text);
S32 length = raw_text.length();
if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences
{
gAgent.startTyping();
}
else
{
gAgent.stopTyping();
}
/* Doesn't work -- can't tell the difference between a backspace
that killed the selection vs. backspace at the end of line.
if (length > 1
&& text[0] == '/'
&& key == KEY_BACKSPACE)
{
// the selection will already be deleted, but we need to trim
// off the character before
std::string new_text = raw_text.substr(0, length-1);
self->mInputEditor->setText( new_text );
self->mInputEditor->setCursorToEnd();
length = length - 1;
}
*/
KEY key = gKeyboard->currentKey();
// Ignore "special" keys, like backspace, arrows, etc.
if (length > 1
&& raw_text[0] == '/'
&& key < KEY_SPECIAL)
{
// we're starting a gesture, attempt to autocomplete
std::string utf8_trigger = wstring_to_utf8str(raw_text);
std::string utf8_out_str(utf8_trigger);
if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str))
{
if (self->mInputEditor)
{
std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
S32 outlength = self->mInputEditor->getLength(); // in characters
// Select to end of line, starting from the character
// after the last one the user typed.
self->mInputEditor->setSelection(length, outlength);
}
}
//llinfos << "GESTUREDEBUG " << trigger
// << " len " << length
// << " outlen " << out_str.getLength()
// << llendl;
}
}
// static
void LLChatBar::onInputEditorFocusLost( LLFocusableElement* caller, void* userdata)
{
// stop typing animation
gAgent.stopTyping();
}
// static
void LLChatBar::onInputEditorGainFocus( LLFocusableElement* caller, void* userdata )
{
LLFloaterChat::setHistoryCursorAndScrollToEnd();
}
void LLChatBar::onClickSay( LLUICtrl* ctrl )
{
std::string cmd = ctrl->getValue().asString();
e_chat_type chat_type = CHAT_TYPE_NORMAL;
if (cmd == "shout")
{
chat_type = CHAT_TYPE_SHOUT;
}
else if (cmd == "whisper")
{
chat_type = CHAT_TYPE_WHISPER;
}
sendChat(chat_type);
}
void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate)
{
sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate);
}
void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate)
{
// Look for "/20 foo" channel chats.
S32 channel = 0;
LLWString out_text = stripChannelNumber(wtext, &channel);
std::string utf8_out_text = wstring_to_utf8str(out_text);
std::string utf8_text = wstring_to_utf8str(wtext);
utf8_text = utf8str_trim(utf8_text);
if (!utf8_text.empty())
{
utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1);
}
// Don't animate for chats people can't hear (chat to scripts)
if (animate && (channel == 0))
{
if (type == CHAT_TYPE_WHISPER)
{
lldebugs << "You whisper " << utf8_text << llendl;
gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START);
}
else if (type == CHAT_TYPE_NORMAL)
{
lldebugs << "You say " << utf8_text << llendl;
gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START);
}
else if (type == CHAT_TYPE_SHOUT)
{
lldebugs << "You shout " << utf8_text << llendl;
gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START);
}
else
{
llinfos << "send_chat_from_viewer() - invalid volume" << llendl;
return;
}
}
else
{
if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP)
{
lldebugs << "Channel chat: " << utf8_text << llendl;
}
}
send_chat_from_viewer(utf8_out_text, type, channel);
}
/*
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ChatFromViewer);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ChatData);
msg->addStringFast(_PREHASH_Message, utf8_out_text);
msg->addU8Fast(_PREHASH_Type, type);
msg->addS32("Channel", channel);
gAgent.sendReliableMessage();
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT);
}
*/
void LLChatBar::onCommitGesture(LLUICtrl* ctrl)
{
LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL;
if (gestures)
{
S32 index = gestures->getFirstSelectedIndex();
if (index == 0)
{
return;
}
const std::string& trigger = gestures->getSelectedValue().asString();
// pretend the user chatted the trigger string, to invoke
// substitution and logging.
std::string text(trigger);
std::string revised_text;
LLGestureManager::instance().triggerAndReviseString(text, &revised_text);
revised_text = utf8str_trim(revised_text);
if (!revised_text.empty())
{
// Don't play nodding animation
sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE);
}
}
mGestureLabelTimer.start();
if (mGestureCombo != NULL)
{
// free focus back to chat bar
mGestureCombo->setFocus(FALSE);
}
}
class LLChatHandler : public LLCommandHandler
{
public:
// not allowed from outside the app
LLChatHandler() : LLCommandHandler("chat", true) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
LLWebBrowserCtrl* web)
{
if (tokens.size() < 2) return false;
S32 channel = tokens[0].asInteger();
std::string mesg = tokens[1].asString();
send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel);
return true;
}
};
// Creating the object registers with the dispatcher.
//LLChatHandler gChatHandler;

118
indra/newview/llchatbar.h Normal file
View File

@ -0,0 +1,118 @@
/**
* @file llchatbar.h
* @brief LLChatBar class definition
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LLCHATBAR_H
#define LL_LLCHATBAR_H
#include "llpanel.h"
#include "llframetimer.h"
#include "llchat.h"
class LLLineEditor;
class LLMessageSystem;
class LLUICtrl;
class LLUUID;
class LLFrameTimer;
class LLChatBarGestureObserver;
class LLComboBox;
class LLChatBar
: public LLPanel
{
public:
// constructor for inline chat-bars (e.g. hosted in chat history window)
LLChatBar();
~LLChatBar();
virtual BOOL postBuild();
virtual BOOL handleKeyHere(KEY key, MASK mask);
void refresh();
void refreshGestures();
// Move cursor into chat input field.
void setKeyboardFocus(BOOL b);
// Ignore arrow keys for chat bar
void setIgnoreArrowKeys(BOOL b);
BOOL inputEditorHasFocus();
std::string getCurrentChat();
// since chat bar logic is reused for chat history
// gesture combo box might not be a direct child
void setGestureCombo(LLComboBox* combo);
// Send a chat (after stripping /20foo channel chats).
// "Animate" means the nodding animation for regular text.
void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate);
void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate);
// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20.
// Otherwise returns input and channel 0.
LLWString stripChannelNumber(const LLWString &mesg, S32* channel);
// callbacks
void onClickSay(LLUICtrl* ctrl);
static void onTabClick( void* userdata );
static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
static void onInputEditorFocusLost(LLFocusableElement* caller,void* userdata);
static void onInputEditorGainFocus(LLFocusableElement* caller,void* userdata);
void onCommitGesture(LLUICtrl* ctrl);
static void startChat(const char* line);
static void stopChat();
protected:
void sendChat(EChatType type);
void updateChat();
protected:
LLLineEditor* mInputEditor;
LLFrameTimer mGestureLabelTimer;
// Which non-zero channel did we last chat on?
S32 mLastSpecialChatChannel;
BOOL mIsBuilt;
LLComboBox* mGestureCombo;
LLChatBarGestureObserver* mObserver;
};
extern LLChatBar *gChatBar;
#endif

View File

@ -40,6 +40,7 @@
#include "llimpanel.h" // LLFloaterIMPanel
#include "llimview.h"
#include "llfloatergroupinfo.h"
#include "llfloaterreg.h"
#include "llmenugl.h"
#include "lloutputmonitorctrl.h"
#include "lltextbox.h"
@ -203,7 +204,6 @@ LLIMChiclet::LLIMChiclet(const Params& p)
, mSpeakerCtrl(NULL)
, mShowSpeaker(p.show_speaker)
, mPopupMenu(NULL)
, mDockTongueVisible(false)
{
LLChicletAvatarIconCtrl::Params avatar_params = p.avatar_icon;
mAvatarCtrl = LLUICtrlFactory::create<LLChicletAvatarIconCtrl>(avatar_params);
@ -228,10 +228,6 @@ LLIMChiclet::~LLIMChiclet()
}
void LLIMChiclet::setDockTongueVisible(bool visible)
{
mDockTongueVisible = visible;
}
void LLIMChiclet::setCounter(S32 counter)
{
@ -326,14 +322,20 @@ void LLIMChiclet::setShowSpeaker(bool show)
void LLIMChiclet::draw()
{
LLUICtrl::draw();
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE);
if (mDockTongueVisible)
//if we have a docked floater, we want to position it relative to us
LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", getSessionId());
if (im_floater && im_floater->isDocked())
{
LLUIImagePtr flyout_tongue = LLUI::getUIImage("windows/Flyout_Pointer.png");
// was previously AVATAR_WIDTH-16 and CHICLET_HEIGHT-6
flyout_tongue->draw( getRect().getWidth()-31, getRect().getHeight()-5);
S32 x, y;
getParent()->localPointToScreen(getRect().getCenterX(), 0, &x, &y);
im_floater->translate(x - im_floater->getRect().getCenterX(), 10 - im_floater->getRect().mBottom);
//set this so the docked floater knows it's been positioned and can now draw
im_floater->setPositioned(true);
}
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE);
}
BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
@ -890,7 +892,8 @@ LLTalkButton::Params::Params()
show_button.image_unselected(LLUI::getUIImage("ComboButton_Off"));
monitor.name("monitor");
monitor.rect(LLRect(0, 10, 16, 0));
// *TODO: Make this data driven.
monitor.rect(LLRect(0, 18, 18, 0));
}
LLTalkButton::LLTalkButton(const Params& p)
@ -953,6 +956,8 @@ void LLTalkButton::draw()
// Always provide speaking feedback. User can trigger speaking
// with keyboard or middle-mouse shortcut.
mOutputMonitor->setPower(gVoiceClient->getCurrentPower(gAgent.getID()));
mOutputMonitor->setIsTalking( gVoiceClient->getUserPTTState() );
mSpeakBtn->setToggleState( gVoiceClient->getUserPTTState() );
LLUICtrl::draw();
}

View File

@ -41,6 +41,7 @@
class LLVoiceControlPanel;
class LLMenuGL;
class LLIMFloater;
/*
* Class for displaying amount of messages/notifications(unread).
@ -267,8 +268,6 @@ public:
*/
virtual void setShowSpeaker(bool show);
void setDockTongueVisible(bool visible);
/*
* Returns voice chat status control visibility.
*/
@ -335,7 +334,6 @@ protected:
LLMenuGL* mPopupMenu;
bool mShowSpeaker;
bool mDockTongueVisible;
};
/*

View File

@ -50,7 +50,7 @@
std::map<std::string, LLDebugVarMessageBox*> LLDebugVarMessageBox::sInstances;
LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) :
LLFloater(),
LLFloater(LLSD()),
mVarType(var_type), mVarData(var), mAnimate(FALSE)
{
setRect(LLRect(10,160,400,10));
@ -250,11 +250,6 @@ void LLDebugVarMessageBox::onAnimateClicked(const LLSD& data)
mAnimateButton->setToggleState(mAnimate);
}
void LLDebugVarMessageBox::onClose(bool app_quitting)
{
setVisible(FALSE);
}
void LLDebugVarMessageBox::draw()
{
std::string text;

View File

@ -76,7 +76,6 @@ public:
static void show(const std::string& title, LLVector3 *var, LLVector3 max_value = LLVector3(100.f, 100.f, 100.f), LLVector3 increment = LLVector3(0.1f, 0.1f, 0.1f));
//static void show(const std::string& title, LLVector4 *var, LLVector4 max_value = LLVector4(100.f, 100.f, 100.f, 100.f), LLVector4 increment = LLVector4(0.1f, 0.1f, 0.1f, 0.1f));
virtual void onClose(bool app_quitting);
virtual void draw();
protected:

View File

@ -80,7 +80,7 @@ static timer_tree_iterator_t end_timer_tree()
}
LLFastTimerView::LLFastTimerView(const LLRect& rect)
: LLFloater(),
: LLFloater(LLSD()),
mHoverTimer(NULL)
{
setRect(rect);

View File

@ -374,7 +374,7 @@ void LLFavoritesBarCtrl::showDropDownMenu()
{
if (mPopupMenuHandle.isDead())
{
LLMenuGL::Params menu_p;
LLToggleableMenu::Params menu_p;
menu_p.name("favorites menu");
menu_p.can_tear_off(false);
menu_p.visible(false);

View File

@ -37,6 +37,7 @@
#include "llbvhloader.h"
#include "lldatapacker.h"
#include "lldir.h"
#include "lleconomy.h"
#include "llvfile.h"
#include "llapr.h"
#include "llstring.h"
@ -69,8 +70,6 @@
#include "lluictrlfactory.h"
#include "lltrans.h"
S32 LLFloaterAnimPreview::sUploadAmount = 10;
const S32 PREVIEW_BORDER_WIDTH = 2;
const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
@ -197,7 +196,6 @@ BOOL LLFloaterAnimPreview::postBuild()
childSetCommitCallback("name_form", onCommitName, this);
childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount));
childSetAction("ok_btn", onBtnOK, this);
setDefaultBtn();
@ -733,7 +731,7 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data)
motionp->setName(previewp->childGetValue("name_form").asString());
}
LLFloaterNameDesc::doCommit(ctrl, data);
previewp->doCommit();
}
//-----------------------------------------------------------------------------
@ -984,7 +982,7 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata)
std::string name = floaterp->childGetValue("name_form").asString();
std::string desc = floaterp->childGetValue("description_form").asString();
LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = sUploadAmount;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
void *userdata = NULL;
upload_new_resource(floaterp->mTransactionID, // tid
LLAssetType::AT_ANIMATION,

View File

@ -88,7 +88,6 @@ public:
static void onBtnPlay(void*);
static void onBtnStop(void*);
static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
static void onSliderMove(LLUICtrl*, void*);
static void onCommitBaseAnim(LLUICtrl*, void*);
static void onCommitLoop(LLUICtrl*, void*);
@ -129,8 +128,6 @@ protected:
LLAnimPauseRequest mPauseRequest;
std::map<std::string, LLUUID> mIDList;
static S32 sUploadAmount;
};
#endif // LL_LLFLOATERANIMPREVIEW_H

View File

@ -51,7 +51,6 @@ class LLFloaterAuction : public LLFloater
friend class LLFloaterReg;
public:
// LLFloater interface
/*virtual*/ void onClose(bool app_quitting) { setVisible(FALSE); }
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void draw();

View File

@ -36,6 +36,7 @@
// Viewer includes
#include "llagent.h"
#include "llfocusmgr.h"
#include "llfloaterreg.h"
#include "llfloaterinventory.h"
#include "llfoldervieweventlistener.h"
#include "llinventorymodel.h"
@ -53,49 +54,33 @@
#include "lluictrlfactory.h"
#include "message.h"
// static
LLFloaterAvatarPicker* LLFloaterAvatarPicker::sInstance = NULL;
LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback,
void* userdata,
BOOL allow_multiple,
BOOL closeOnSelect)
{
// TODO: This class should not be a singleton as it's used in multiple places
// and therefore can't be used simultaneously. -MG
if (!sInstance)
{
sInstance = new LLFloaterAvatarPicker();
sInstance->mCallback = callback;
sInstance->mCallbackUserdata = userdata;
sInstance->mCloseOnSelect = FALSE;
sInstance->openFloater();
sInstance->center();
sInstance->setAllowMultiple(allow_multiple);
}
else
{
sInstance->openFloater();
sInstance->mCallback = callback;
sInstance->mCallbackUserdata = userdata;
sInstance->setAllowMultiple(allow_multiple);
}
// *TODO: Use a key to allow this not to be an effective singleton
LLFloaterAvatarPicker* floater = LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
sInstance->mNearMeListComplete = FALSE;
sInstance->mCloseOnSelect = closeOnSelect;
return sInstance;
floater->mCallback = callback;
floater->mCallbackUserdata = userdata;
floater->setAllowMultiple(allow_multiple);
floater->mNearMeListComplete = FALSE;
floater->mCloseOnSelect = closeOnSelect;
return floater;
}
// Default constructor
LLFloaterAvatarPicker::LLFloaterAvatarPicker()
: LLFloater(),
LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key)
: LLFloater(key),
mResultsReturned(FALSE),
mCallback(NULL),
mCallbackUserdata(NULL)
mCallbackUserdata(NULL),
mNearMeListComplete(FALSE),
mCloseOnSelect(FALSE)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml");
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml");
}
BOOL LLFloaterAvatarPicker::postBuild()
@ -143,7 +128,9 @@ BOOL LLFloaterAvatarPicker::postBuild()
boost::bind(&LLFloaterAvatarPicker::onTabChanged, this));
setAllowMultiple(FALSE);
center();
return TRUE;
}
@ -156,8 +143,6 @@ void LLFloaterAvatarPicker::onTabChanged()
LLFloaterAvatarPicker::~LLFloaterAvatarPicker()
{
gFocusMgr.releaseFocusIfNeeded( this );
sInstance = NULL;
}
void LLFloaterAvatarPicker::onBtnFind(void* userdata)
@ -408,23 +393,21 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
// Not for us
if (agent_id != gAgent.getID()) return;
// Dialog already closed
LLFloaterAvatarPicker *self = sInstance;
if (!self) return;
LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker");
// these are not results from our last request
if (query_id != self->mQueryID)
if (query_id != floater->mQueryID)
{
return;
}
LLScrollListCtrl* search_results = self->getChild<LLScrollListCtrl>("SearchResults");
LLScrollListCtrl* search_results = floater->getChild<LLScrollListCtrl>("SearchResults");
// clear "Searching" label on first results
search_results->deleteAllItems();
self->mResultsReturned = TRUE;
floater->mResultsReturned = TRUE;
BOOL found_one = FALSE;
S32 num_new_rows = msg->getNumberOfBlocks("Data");
@ -438,10 +421,10 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
if (avatar_id.isNull())
{
LLStringUtil::format_map_t map;
map["[TEXT]"] = self->childGetText("Edit");
avatar_name = self->getString("not_found", map);
map["[TEXT]"] = floater->childGetText("Edit");
avatar_name = floater->getString("not_found", map);
search_results->setEnabled(FALSE);
self->childDisable("Select");
floater->childDisable("Select");
}
else
{
@ -457,9 +440,9 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void*
if (found_one)
{
self->childEnable("Select");
floater->childEnable("Select");
search_results->selectFirstItem();
self->onList(search_results, self);
floater->onList(search_results, floater);
search_results->setFocus(TRUE);
}
}

View File

@ -48,6 +48,10 @@ public:
void* userdata,
BOOL allow_multiple = FALSE,
BOOL closeOnSelect = FALSE);
LLFloaterAvatarPicker(const LLSD& key);
virtual ~LLFloaterAvatarPicker();
virtual BOOL postBuild();
static void processAvatarPickerReply(class LLMessageSystem* msg, void**);
@ -84,13 +88,6 @@ private:
void (*mCallback)(const std::vector<std::string>& name, const std::vector<LLUUID>& id, void* userdata);
void* mCallbackUserdata;
static LLFloaterAvatarPicker* sInstance;
private:
// do not call these directly
LLFloaterAvatarPicker();
virtual ~LLFloaterAvatarPicker();
};
#endif

View File

@ -42,29 +42,15 @@
using namespace LLVOAvatarDefines;
LLFloaterAvatarTextures* LLFloaterAvatarTextures::sInstance = NULL;
LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id)
: LLFloater(),
mID(id)
LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLSD& id)
: LLFloater(id),
mID(id.asUUID())
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_textures.xml");
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_textures.xml");
}
LLFloaterAvatarTextures::~LLFloaterAvatarTextures()
{
sInstance = NULL;
}
LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id)
{
if (!sInstance)
{
sInstance = new LLFloaterAvatarTextures(id);
gFloaterView->addChild(sInstance);
gFloaterView->adjustToFitScreen(sInstance, FALSE);
}
sInstance->openFloater();
return sInstance;
}
BOOL LLFloaterAvatarTextures::postBuild()

View File

@ -43,7 +43,7 @@ class LLTextureCtrl;
class LLFloaterAvatarTextures : public LLFloater
{
public:
LLFloaterAvatarTextures(const LLUUID& id);
LLFloaterAvatarTextures(const LLSD& id);
virtual ~LLFloaterAvatarTextures();
/*virtual*/ BOOL postBuild();
@ -51,8 +51,6 @@ public:
void refresh();
static LLFloaterAvatarTextures* show(const LLUUID& id);
private:
static void onClickDump(void*);
@ -60,7 +58,6 @@ private:
LLUUID mID;
std::string mTitle;
LLTextureCtrl* mTextures[LLVOAvatarDefines::TEX_NUM_INDICES];
static LLFloaterAvatarTextures* sInstance;
};
#endif

View File

@ -64,21 +64,6 @@ BOOL LLFloaterBeacons::postBuild()
return TRUE;
}
// Needed to make the floater visibility toggle the beacons.
// Too bad we can't just add control_name="BeaconAlwaysOn" to the XML.
void LLFloaterBeacons::onOpen(const LLSD& key)
{
gSavedSettings.setBOOL( "BeaconAlwaysOn", TRUE);
}
void LLFloaterBeacons::onClose(bool app_quitting)
{
destroy();
if(!app_quitting)
{
gSavedSettings.setBOOL( "BeaconAlwaysOn", FALSE);
}
}
// Callback attached to each check box control to both affect their main purpose
// and to implement the couple screwy interdependency rules that some have.

View File

@ -46,8 +46,6 @@ public:
// Needed to make the floater visibility toggle the beacons.
// Too bad we can't just add control_name="BeaconAlwaysOn" to the XML.
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
void onClickUICheck(LLUICtrl *ctrl);
private:

View File

@ -165,7 +165,7 @@ void LLFloaterBulkPermission::onApplyBtn()
void LLFloaterBulkPermission::onCloseBtn()
{
onClose(false);
closeFloater();
}
//static

View File

@ -43,6 +43,7 @@
#include "llagent.h" // for agent id
#include "llalertdialog.h"
#include "llinventorymodel.h" // for gInventory
#include "llfloaterreg.h"
#include "llfloaterinventory.h" // for get_item_icon
#include "llselectmgr.h"
#include "llscrolllistctrl.h"
@ -51,13 +52,10 @@
#include "llviewerwindow.h"
#include "lltrans.h"
LLFloaterBuy* LLFloaterBuy::sInstance = NULL;
LLFloaterBuy::LLFloaterBuy()
: LLFloater()
LLFloaterBuy::LLFloaterBuy(const LLSD& key)
: LLFloater(key)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml");
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml");
}
BOOL LLFloaterBuy::postBuild()
@ -65,16 +63,23 @@ BOOL LLFloaterBuy::postBuild()
childDisable("object_list");
childDisable("item_list");
childSetAction("cancel_btn", onClickCancel, this);
childSetAction("buy_btn", onClickBuy, this);
getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickCancel, this));
getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickBuy, this));
setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
// Always center the dialog. User can change the size,
// but purchases are important and should be center screen.
// This also avoids problems where the user resizes the application window
// mid-session and the saved rect is off-center.
center();
return TRUE;
}
LLFloaterBuy::~LLFloaterBuy()
{
sInstance = NULL;
mObjectSelection = NULL;
}
void LLFloaterBuy::reset()
@ -96,47 +101,34 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
LLNotifications::instance().add("BuyOneObjectOnly");
return;
}
// Create a new instance only if one doesn't exist
if (sInstance)
{
// Clean up the lists...
sInstance->reset();
}
else
{
sInstance = new LLFloaterBuy();
}
sInstance->openFloater();
sInstance->setFocus(TRUE);
sInstance->mSaleInfo = sale_info;
sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
// Always center the dialog. User can change the size,
// but purchases are important and should be center screen.
// This also avoids problems where the user resizes the application window
// mid-session and the saved rect is off-center.
sInstance->center();
LLFloaterBuy* floater = LLFloaterReg::showTypedInstance<LLFloaterBuy>("buy_object");
if (!floater)
return;
// Clean up the lists...
floater->reset();
floater->mSaleInfo = sale_info;
floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
LLSelectNode* node = selection->getFirstRootNode();
if (!node)
return;
// Set title based on sale type
LLUIString title;
switch (sale_info.getSaleType())
{
case LLSaleInfo::FS_ORIGINAL:
title = sInstance->getString("title_buy_text");
title = floater->getString("title_buy_text");
break;
case LLSaleInfo::FS_COPY:
default:
title = sInstance->getString("title_buy_copy_text");
title = floater->getString("title_buy_copy_text");
break;
}
title.setArg("[NAME]", node->mName);
sInstance->setTitle(title);
floater->setTitle(title);
LLUUID owner_id;
std::string owner_name;
@ -147,7 +139,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
return;
}
LLCtrlListInterface *object_list = sInstance->childGetListInterface("object_list");
LLCtrlListInterface *object_list = floater->childGetListInterface("object_list");
if (!object_list)
{
return;
@ -172,15 +164,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
std::string text = node->mName;
if (!(next_owner_mask & PERM_COPY))
{
text.append(sInstance->getString("no_copy_text"));
text.append(floater->getString("no_copy_text"));
}
if (!(next_owner_mask & PERM_MODIFY))
{
text.append(sInstance->getString("no_modify_text"));
text.append(floater->getString("no_modify_text"));
}
if (!(next_owner_mask & PERM_TRANSFER))
{
text.append(sInstance->getString("no_transfer_text"));
text.append(floater->getString("no_transfer_text"));
}
row["columns"][1]["column"] = "text";
@ -190,15 +182,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
// Add after columns added so appropriate heights are correct.
object_list->addElement(row);
sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
sInstance->childSetTextArg("buy_text", "[NAME]", owner_name);
floater->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
floater->childSetTextArg("buy_text", "[NAME]", owner_name);
// Must do this after the floater is created, because
// sometimes the inventory is already there and
// the callback is called immediately.
LLViewerObject* obj = selection->getFirstRootObject();
sInstance->registerVOInventoryListener(obj,NULL);
sInstance->requestVOInventory();
floater->registerVOInventoryListener(obj,NULL);
floater->requestVOInventory();
}
void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
@ -296,15 +288,8 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
removeVOInventoryListener();
}
// static
void LLFloaterBuy::onClickBuy(void*)
void LLFloaterBuy::onClickBuy()
{
if (!sInstance)
{
llinfos << "LLFloaterBuy::onClickBuy no sInstance!" << llendl;
return;
}
// Put the items where we put new folders.
LLUUID category_id;
category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT);
@ -312,24 +297,13 @@ void LLFloaterBuy::onClickBuy(void*)
// *NOTE: doesn't work for multiple object buy, which UI does not
// currently support sale info is used for verification only, if
// it doesn't match region info then sale is canceled.
LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo );
LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo );
sInstance->closeFloater();
closeFloater();
}
// static
void LLFloaterBuy::onClickCancel(void*)
void LLFloaterBuy::onClickCancel()
{
if (sInstance)
{
sInstance->closeFloater();
}
}
void LLFloaterBuy::onClose(bool app_quitting)
{
// drop reference to current selection so selection goes away
mObjectSelection = NULL;
destroy();
closeFloater();
}

View File

@ -52,13 +52,14 @@ class LLFloaterBuy
: public LLFloater, public LLVOInventoryListener
{
public:
LLFloaterBuy(const LLSD& key);
~LLFloaterBuy();
/*virtual*/ BOOL postBuild();
static void show(const LLSaleInfo& sale_info);
protected:
LLFloaterBuy();
~LLFloaterBuy();
/*virtual*/ BOOL postBuild();
/*virtual*/ void onClose(bool app_quitting);
void reset();
void requestObjectInventories();
@ -67,12 +68,10 @@ protected:
S32 serial_num,
void* data);
static void onClickBuy(void*);
static void onClickCancel(void*);
void onClickBuy();
void onClickCancel();
private:
static LLFloaterBuy* sInstance;
LLSafeHandle<LLObjectSelection> mObjectSelection;
LLSaleInfo mSaleInfo;
};

View File

@ -46,6 +46,7 @@
#include "llalertdialog.h"
#include "llcheckboxctrl.h"
#include "llinventorymodel.h" // for gInventory
#include "llfloaterreg.h"
#include "llfloaterinventory.h" // for get_item_icon
#include "llselectmgr.h"
#include "llscrolllistctrl.h"
@ -54,31 +55,35 @@
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
LLFloaterBuyContents* LLFloaterBuyContents::sInstance = NULL;
LLFloaterBuyContents::LLFloaterBuyContents()
: LLFloater()
LLFloaterBuyContents::LLFloaterBuyContents(const LLSD& key)
: LLFloater(key)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml");
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml");
}
BOOL LLFloaterBuyContents::postBuild()
{
childSetAction("cancel_btn", onClickCancel, this);
childSetAction("buy_btn", onClickBuy, this);
getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickCancel, this));
getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickBuy, this));
childDisable("item_list");
childDisable("buy_btn");
childDisable("wear_check");
setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130)
// Always center the dialog. User can change the size,
// but purchases are important and should be center screen.
// This also avoids problems where the user resizes the application window
// mid-session and the saved rect is off-center.
center();
return TRUE;
}
LLFloaterBuyContents::~LLFloaterBuyContents()
{
sInstance = NULL;
}
@ -92,27 +97,16 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
LLNotifications::instance().add("BuyContentsOneOnly");
return;
}
LLFloaterBuyContents* floater = LLFloaterReg::showTypedInstance<LLFloaterBuyContents>("buy_object_contents");
if (!floater)
return;
LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("item_list");
if (list)
list->deleteAllItems();
// Create a new instance only if needed
if (sInstance)
{
LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("item_list");
if (list) list->deleteAllItems();
}
else
{
sInstance = new LLFloaterBuyContents();
}
sInstance->openFloater();
sInstance->setFocus(TRUE);
sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
// Always center the dialog. User can change the size,
// but purchases are important and should be center screen.
// This also avoids problems where the user resizes the application window
// mid-session and the saved rect is off-center.
sInstance->center();
floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
LLUUID owner_id;
std::string owner_name;
@ -123,7 +117,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
return;
}
sInstance->mSaleInfo = sale_info;
floater->mSaleInfo = sale_info;
// Update the display
LLSelectNode* node = selection->getFirstRootNode();
@ -133,16 +127,16 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
gCacheName->getGroupName(owner_id, owner_name);
}
sInstance->childSetTextArg("contains_text", "[NAME]", node->mName);
sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
sInstance->childSetTextArg("buy_text", "[NAME]", owner_name);
floater->childSetTextArg("contains_text", "[NAME]", node->mName);
floater->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
floater->childSetTextArg("buy_text", "[NAME]", owner_name);
// Must do this after the floater is created, because
// sometimes the inventory is already there and
// the callback is called immediately.
LLViewerObject* obj = selection->getFirstRootObject();
sInstance->registerVOInventoryListener(obj,NULL);
sInstance->requestVOInventory();
floater->registerVOInventoryListener(obj,NULL);
floater->requestVOInventory();
}
@ -272,20 +266,19 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
}
// static
void LLFloaterBuyContents::onClickBuy(void*)
void LLFloaterBuyContents::onClickBuy()
{
// Make sure this wasn't selected through other mechanisms
// (ie, being the default button and pressing enter.
if(!sInstance->childIsEnabled("buy_btn"))
if(!childIsEnabled("buy_btn"))
{
// We shouldn't be enabled. Just close.
sInstance->closeFloater();
closeFloater();
return;
}
// We may want to wear this item
if (sInstance->childGetValue("wear_check"))
if (childGetValue("wear_check"))
{
LLFloaterInventory::sWearNewClothing = TRUE;
}
@ -297,14 +290,12 @@ void LLFloaterBuyContents::onClickBuy(void*)
// *NOTE: doesn't work for multiple object buy, which UI does not
// currently support sale info is used for verification only, if
// it doesn't match region info then sale is canceled.
LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo);
LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo);
sInstance->closeFloater();
closeFloater();
}
// static
void LLFloaterBuyContents::onClickCancel(void*)
void LLFloaterBuyContents::onClickCancel()
{
sInstance->closeFloater();
closeFloater();
}

View File

@ -52,22 +52,21 @@ class LLFloaterBuyContents
public:
static void show(const LLSaleInfo& sale_info);
protected:
LLFloaterBuyContents();
LLFloaterBuyContents(const LLSD& key);
~LLFloaterBuyContents();
/*virtual*/ BOOL postBuild();
protected:
void requestObjectInventories();
/*virtual*/ void inventoryChanged(LLViewerObject* obj,
InventoryObjectList* inv,
S32 serial_num,
void* data);
static void onClickBuy(void*);
static void onClickCancel(void*);
void onClickBuy();
void onClickCancel();
protected:
static LLFloaterBuyContents* sInstance;
LLSafeHandle<LLObjectSelection> mObjectSelection;
LLSaleInfo mSaleInfo;
};

View File

@ -37,6 +37,7 @@
// viewer includes
#include "llcurrencyuimanager.h"
#include "llfloater.h"
#include "llfloaterreg.h"
#include "llstatusbar.h"
#include "lltextbox.h"
#include "llviewchildren.h"
@ -53,12 +54,7 @@ class LLFloaterBuyCurrencyUI
: public LLFloater
{
public:
static LLFloaterBuyCurrencyUI* soleInstance(bool createIfNeeded);
private:
static LLFloaterBuyCurrencyUI* sInstance;
LLFloaterBuyCurrencyUI();
LLFloaterBuyCurrencyUI(const LLSD& key);
virtual ~LLFloaterBuyCurrencyUI();
@ -81,30 +77,17 @@ public:
virtual void draw();
virtual BOOL canClose();
static void onClickBuy(void* data);
static void onClickCancel(void* data);
static void onClickErrorWeb(void* data);
void onClickBuy();
void onClickCancel();
void onClickErrorWeb();
};
// static
LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::sInstance = NULL;
// static
LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded)
LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key)
{
if (!sInstance && createIfNeeded)
{
sInstance = new LLFloaterBuyCurrencyUI();
LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_currency.xml");
sInstance->center();
}
return sInstance;
LLFloaterBuyCurrencyUI* floater = new LLFloaterBuyCurrencyUI(key);
return floater;
}
#if LL_WINDOWS
// passing 'this' during construction generates a warning. The callee
// only uses the pointer to hold a reference to 'this' which is
@ -112,8 +95,8 @@ LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded
// warning so that we can compile without generating a warning.
#pragma warning(disable : 4355)
#endif
LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI()
: LLFloater(),
LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI(const LLSD& key)
: LLFloater(key),
mChildren(*this),
mManager(*this)
{
@ -121,10 +104,6 @@ LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI()
LLFloaterBuyCurrencyUI::~LLFloaterBuyCurrencyUI()
{
if (sInstance == this)
{
sInstance = NULL;
}
}
@ -156,11 +135,14 @@ BOOL LLFloaterBuyCurrencyUI::postBuild()
{
mManager.prepare();
childSetAction("buy_btn", onClickBuy, this);
childSetAction("cancel_btn", onClickCancel, this);
childSetAction("error_web", onClickErrorWeb, this);
getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this));
getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this));
getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickErrorWeb, this));
center();
updateUI();
return TRUE;
}
@ -312,57 +294,41 @@ void LLFloaterBuyCurrencyUI::updateUI()
}
}
// static
void LLFloaterBuyCurrencyUI::onClickBuy(void* data)
void LLFloaterBuyCurrencyUI::onClickBuy()
{
LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false);
if (self)
{
self->mManager.buy(self->getString("buy_currency"));
self->updateUI();
// JC: updateUI() doesn't get called again until progress is made
// with transaction processing, so the "Purchase" button would be
// left enabled for some time. Pre-emptively disable.
self->childSetEnabled("buy_btn", false);
}
mManager.buy(getString("buy_currency"));
updateUI();
// JC: updateUI() doesn't get called again until progress is made
// with transaction processing, so the "Purchase" button would be
// left enabled for some time. Pre-emptively disable.
childSetEnabled("buy_btn", false);
}
// static
void LLFloaterBuyCurrencyUI::onClickCancel(void* data)
void LLFloaterBuyCurrencyUI::onClickCancel()
{
LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false);
if (self)
{
self->closeFloater();
}
closeFloater();
}
// static
void LLFloaterBuyCurrencyUI::onClickErrorWeb(void* data)
void LLFloaterBuyCurrencyUI::onClickErrorWeb()
{
LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false);
if (self)
{
LLWeb::loadURLExternal(self->mManager.errorURI());
self->closeFloater();
}
LLWeb::loadURLExternal(mManager.errorURI());
closeFloater();
}
// static
void LLFloaterBuyCurrency::buyCurrency()
{
LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true);
LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency");
ui->noTarget();
ui->updateUI();
ui->openFloater();
}
// static
void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price)
{
LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true);
LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency");
ui->target(name, price);
ui->updateUI();
ui->openFloater();
}

View File

@ -35,6 +35,8 @@
#include "stdtypes.h"
class LLFloater;
class LLFloaterBuyCurrency
{
public:
@ -46,6 +48,8 @@ public:
"Uploading costs"
a space and the price will be appended
*/
static LLFloater* buildFloater(const LLSD& key);
};

View File

@ -43,6 +43,7 @@
#include "llconfirmationmanager.h"
#include "llcurrencyuimanager.h"
#include "llfloater.h"
#include "llfloaterreg.h"
#include "llfloatertools.h"
#include "llframetimer.h"
#include "lliconctrl.h"
@ -75,10 +76,22 @@ const F64 CURRENCY_ESTIMATE_FREQUENCY = 0.5;
class LLFloaterBuyLandUI
: public LLFloater
{
private:
LLFloaterBuyLandUI();
public:
LLFloaterBuyLandUI(const LLSD& key);
virtual ~LLFloaterBuyLandUI();
private:
class SelectionObserver : public LLParcelObserver
{
public:
SelectionObserver(LLFloaterBuyLandUI* floater) : mFloater(floater) {}
virtual void changed();
private:
LLFloaterBuyLandUI* mFloater;
};
private:
SelectionObserver mParcelSelectionObserver;
LLViewerRegion* mRegion;
LLParcelSelectionHandle mParcel;
bool mIsClaim;
@ -144,11 +157,7 @@ private:
LLViewerParcelMgr::ParcelBuyInfo* mParcelBuyInfo;
static LLFloaterBuyLandUI* sInstance;
public:
static LLFloaterBuyLandUI* soleInstance(bool createIfNeeded);
void setForGroup(bool is_for_group);
void setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
@ -156,10 +165,10 @@ public:
void updateParcelInfo();
void updateCovenantInfo();
static void onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data);
void updateCovenantText(const std::string& string, const LLUUID &asset_id);
void updateEstateName(const std::string& name);
void updateLastModified(const std::string& text);
void updateEstateOwnerName(const std::string& name);
void updateFloaterCovenantText(const std::string& string, const LLUUID &asset_id);
void updateFloaterEstateName(const std::string& name);
void updateFloaterLastModified(const std::string& text);
void updateFloaterEstateOwnerName(const std::string& name);
void updateWebSiteInfo();
void finishWebSiteInfo();
@ -171,7 +180,7 @@ public:
void refreshUI();
void startTransaction(TransactionType type, LLXMLRPCValue params);
void startTransaction(TransactionType type, const LLXMLRPCValue& params);
bool checkTransaction();
void tellUserError(const std::string& message, const std::string& uri);
@ -181,26 +190,21 @@ public:
void startBuyPreConfirm();
void startBuyPostConfirm(const std::string& password);
static void onClickBuy(void* data);
static void onClickCancel(void* data);
static void onClickErrorWeb(void* data);
void onClickBuy();
void onClickCancel();
void onClickErrorWeb();
virtual void draw();
virtual BOOL canClose();
/*virtual*/ void setMinimized(BOOL b);
void onVisibilityChange ( const LLSD& new_visibility );
private:
class SelectionObserver : public LLParcelObserver
{
public:
virtual void changed();
};
};
static void cacheNameUpdateRefreshesBuyLand(const LLUUID&,
const std::string&, const std::string&, BOOL)
{
LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false);
LLFloaterBuyLandUI* ui = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
if (ui)
{
ui->updateNames();
@ -217,101 +221,64 @@ void LLFloaterBuyLand::buyLand(
return;
}
LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(true);
ui->setForGroup(is_for_group);
ui->setParcel(region, parcel);
ui->openFloater();
LLFloaterBuyLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyLandUI>("buy_land");
if (ui)
{
ui->setForGroup(is_for_group);
ui->setParcel(region, parcel);
}
}
// static
void LLFloaterBuyLand::updateCovenantText(const std::string& string, const LLUUID &asset_id)
{
LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE);
LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
if (floater)
{
floater->updateCovenantText(string, asset_id);
floater->updateFloaterCovenantText(string, asset_id);
}
}
// static
void LLFloaterBuyLand::updateEstateName(const std::string& name)
{
LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE);
LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
if (floater)
{
floater->updateEstateName(name);
floater->updateFloaterEstateName(name);
}
}
// static
void LLFloaterBuyLand::updateLastModified(const std::string& text)
{
LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE);
LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
if (floater)
{
floater->updateLastModified(text);
floater->updateFloaterLastModified(text);
}
}
// static
void LLFloaterBuyLand::updateEstateOwnerName(const std::string& name)
{
LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE);
LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
if (floater)
{
floater->updateEstateOwnerName(name);
floater->updateFloaterEstateOwnerName(name);
}
}
// static
BOOL LLFloaterBuyLand::isOpen()
LLFloater* LLFloaterBuyLand::buildFloater(const LLSD& key)
{
LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE);
if (floater)
{
return floater->getVisible();
}
return FALSE;
}
// static
LLFloaterBuyLandUI* LLFloaterBuyLandUI::sInstance = NULL;
// static
LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded)
{
#if !LL_RELEASE_FOR_DOWNLOAD
if (createIfNeeded)
{
delete sInstance;
sInstance = NULL;
}
#endif
if (!sInstance && createIfNeeded)
{
sInstance = new LLFloaterBuyLandUI();
LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_land.xml");
sInstance->center();
static bool observingCacheName = false;
if (!observingCacheName)
{
gCacheName->addObserver(&cacheNameUpdateRefreshesBuyLand);
observingCacheName = true;
}
static SelectionObserver* parcelSelectionObserver = NULL;
if (!parcelSelectionObserver)
{
parcelSelectionObserver = new SelectionObserver;
LLViewerParcelMgr::getInstance()->addObserver(parcelSelectionObserver);
}
}
return sInstance;
LLFloaterBuyLandUI* floater = new LLFloaterBuyLandUI(key);
return floater;
}
//----------------------------------------------------------------------------
// LLFloaterBuyLandUI
//----------------------------------------------------------------------------
#if LL_WINDOWS
// passing 'this' during construction generates a warning. The callee
@ -320,42 +287,45 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded)
// warning so that we can compile without generating a warning.
#pragma warning(disable : 4355)
#endif
LLFloaterBuyLandUI::LLFloaterBuyLandUI()
: LLFloater(),
LLFloaterBuyLandUI::LLFloaterBuyLandUI(const LLSD& key)
: LLFloater(LLSD()),
mParcelSelectionObserver(this),
mParcel(0),
mBought(false),
mParcelValid(false), mSiteValid(false),
mChildren(*this), mCurrency(*this), mTransaction(0),
mParcelBuyInfo(0)
{
static bool observingCacheName = false;
if (!observingCacheName)
{
gCacheName->addObserver(&cacheNameUpdateRefreshesBuyLand);
observingCacheName = true;
}
LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver);
// LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_land.xml");
}
LLFloaterBuyLandUI::~LLFloaterBuyLandUI()
{
delete mTransaction;
LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver);
LLViewerParcelMgr::getInstance()->deleteParcelBuy(mParcelBuyInfo);
if (sInstance == this)
{
sInstance = NULL;
}
delete mTransaction;
}
void LLFloaterBuyLandUI::SelectionObserver::changed()
{
LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false);
if (ui)
if (LLViewerParcelMgr::getInstance()->selectionEmpty())
{
if (LLViewerParcelMgr::getInstance()->selectionEmpty())
{
ui->closeFloater();
}
else {
ui->setParcel(
LLViewerParcelMgr::getInstance()->getSelectionRegion(),
LLViewerParcelMgr::getInstance()->getParcelSelection());
}
mFloater->closeFloater();
}
else
{
mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(),
LLViewerParcelMgr::getInstance()->getParcelSelection());
}
}
@ -593,7 +563,7 @@ void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data)
}
}
void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLUUID& asset_id)
void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, const LLUUID& asset_id)
{
LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
if (editor)
@ -625,19 +595,19 @@ void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLU
}
}
void LLFloaterBuyLandUI::updateEstateName(const std::string& name)
void LLFloaterBuyLandUI::updateFloaterEstateName(const std::string& name)
{
LLTextBox* box = getChild<LLTextBox>("estate_name_text");
if (box) box->setText(name);
}
void LLFloaterBuyLandUI::updateLastModified(const std::string& text)
void LLFloaterBuyLandUI::updateFloaterLastModified(const std::string& text)
{
LLTextBox* editor = getChild<LLTextBox>("covenant_timestamp_text");
if (editor) editor->setText(text);
}
void LLFloaterBuyLandUI::updateEstateOwnerName(const std::string& name)
void LLFloaterBuyLandUI::updateFloaterEstateOwnerName(const std::string& name)
{
LLTextBox* box = getChild<LLTextBox>("estate_owner_text");
if (box) box->setText(name);
@ -834,8 +804,7 @@ void LLFloaterBuyLandUI::updateNames()
}
void LLFloaterBuyLandUI::startTransaction(TransactionType type,
LLXMLRPCValue params)
void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCValue& params)
{
delete mTransaction;
mTransaction = NULL;
@ -916,11 +885,15 @@ void LLFloaterBuyLandUI::tellUserError(
// virtual
BOOL LLFloaterBuyLandUI::postBuild()
{
mVisibleSignal.connect(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2));
mCurrency.prepare();
childSetAction("buy_btn", onClickBuy, this);
childSetAction("cancel_btn", onClickCancel, this);
childSetAction("error_web", onClickErrorWeb, this);
getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickBuy, this));
getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickCancel, this));
getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickErrorWeb, this));
center();
return TRUE;
}
@ -986,12 +959,9 @@ BOOL LLFloaterBuyLandUI::canClose()
return can_close;
}
// virtual
void LLFloaterBuyLandUI::setMinimized(BOOL minimize)
void LLFloaterBuyLandUI::onVisibilityChange ( const LLSD& new_visibility )
{
bool restored = (isMinimized() && !minimize);
LLFloater::setMinimized(minimize);
if (restored)
if (new_visibility.asBoolean())
{
refreshUI();
}
@ -1346,26 +1316,20 @@ void LLFloaterBuyLandUI::startBuyPostConfirm(const std::string& password)
}
// static
void LLFloaterBuyLandUI::onClickBuy(void* data)
void LLFloaterBuyLandUI::onClickBuy()
{
LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data;
self->startBuyPreConfirm();
startBuyPreConfirm();
}
// static
void LLFloaterBuyLandUI::onClickCancel(void* data)
void LLFloaterBuyLandUI::onClickCancel()
{
LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data;
self->closeFloater();
closeFloater();
}
// static
void LLFloaterBuyLandUI::onClickErrorWeb(void* data)
void LLFloaterBuyLandUI::onClickErrorWeb()
{
LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data;
LLWeb::loadURLExternal(self->mCannotBuyURI);
self->closeFloater();
LLWeb::loadURLExternal(mCannotBuyURI);
closeFloater();
}

View File

@ -33,6 +33,7 @@
#ifndef LL_LLFLOATERBUYLAND_H
#define LL_LLFLOATERBUYLAND_H
class LLFloater;
class LLViewerRegion;
class LLViewerTextEditor;
class LLParcelSelection;
@ -47,7 +48,8 @@ public:
static void updateEstateName(const std::string& name);
static void updateLastModified(const std::string& text);
static void updateEstateOwnerName(const std::string& name);
static BOOL isOpen();
static LLFloater* buildFloater(const LLSD& key);
};
#endif

View File

@ -54,6 +54,7 @@
//#include "lllineeditor.h"
#include "llmutelist.h"
//#include "llresizehandle.h"
#include "llchatbar.h"
#include "llrecentpeople.h"
#include "llstatusbar.h"
#include "llviewertexteditor.h"
@ -98,6 +99,7 @@ LLFloaterChat::LLFloaterChat(const LLSD& seed)
: LLFloater(seed),
mPanel(NULL)
{
mFactoryMap["chat_panel"] = LLCallbackMap(createChatPanel, NULL);
mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL);
//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml");
@ -108,23 +110,27 @@ LLFloaterChat::~LLFloaterChat()
// Children all cleaned up by default view destructor.
}
void LLFloaterChat::setVisible(BOOL visible)
{
LLFloater::setVisible( visible );
}
void LLFloaterChat::draw()
{
// enable say and shout only when text available
childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
LLChatBar* chat_barp = findChild<LLChatBar>("chat_panel", TRUE);
if (chat_barp)
{
chat_barp->refresh();
}
mPanel->refreshSpeakers();
LLFloater::draw();
}
BOOL LLFloaterChat::postBuild()
{
// Hide the chat overlay when our history is visible.
mVisibleSignal.connect(boost::bind(&LLFloaterChat::updateConsoleVisibility, this));
mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel");
childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes
@ -134,34 +140,6 @@ BOOL LLFloaterChat::postBuild()
return TRUE;
}
// public virtual
void LLFloaterChat::onClose(bool app_quitting)
{
if (getHost())
{
getHost()->setVisible(FALSE);
}
else
{
setVisible(FALSE);
}
}
void LLFloaterChat::onVisibilityChange(BOOL new_visibility)
{
// Hide the chat overlay when our history is visible.
updateConsoleVisibility();
LLFloater::onVisibilityChange(new_visibility);
}
void LLFloaterChat::setMinimized(BOOL minimized)
{
LLFloater::setMinimized(minimized);
updateConsoleVisibility();
}
void LLFloaterChat::updateConsoleVisibility()
{
// determine whether we should show console due to not being visible
@ -526,6 +504,13 @@ void* LLFloaterChat::createSpeakersPanel(void* data)
return new LLPanelActiveSpeakers(LLLocalSpeakerMgr::getInstance(), TRUE);
}
//static
void* LLFloaterChat::createChatPanel(void* data)
{
LLChatBar* chatp = new LLChatBar();
return chatp;
}
// static
void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata)
{

View File

@ -65,12 +65,9 @@ public:
LLFloaterChat(const LLSD& seed);
~LLFloaterChat();
virtual void setVisible( BOOL b );
virtual void draw();
virtual BOOL postBuild();
virtual void onClose(bool app_quitting);
virtual void onVisibilityChange(BOOL cur_visibility);
virtual void setMinimized(BOOL);
void updateConsoleVisibility();
static void setHistoryCursorAndScrollToEnd();
@ -90,6 +87,7 @@ public:
static void chatFromLogFile(LLLogChat::ELogLineType type,std::string line, void* userdata);
static void loadHistory();
static void* createSpeakersPanel(void* data);
static void* createChatPanel(void* data);
static LLFloaterChat* getInstance(); // *TODO:Skinning Deprecate

View File

@ -50,7 +50,7 @@
//
LLFloaterMyFriends::LLFloaterMyFriends(const LLSD& seed)
: LLFloater()
: LLFloater(seed)
{
mFactoryMap["friends_panel"] = LLCallbackMap(LLFloaterMyFriends::createFriendsPanel, NULL);
mFactoryMap["groups_panel"] = LLCallbackMap(LLFloaterMyFriends::createGroupsPanel, NULL);
@ -78,11 +78,6 @@ void LLFloaterMyFriends::onOpen(const LLSD& key)
}
}
void LLFloaterMyFriends::onClose(bool app_quitting)
{
setVisible(FALSE);
}
//static
void* LLFloaterMyFriends::createFriendsPanel(void* data)
{
@ -105,8 +100,8 @@ LLFloaterMyFriends* LLFloaterMyFriends::getInstance()
// LLFloaterChatterBox
//
LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed)
: LLMultiFloater(),
mActiveVoiceFloater(NULL)
: LLMultiFloater(seed),
mActiveVoiceFloater(NULL)
{
mAutoResize = FALSE;
@ -119,6 +114,8 @@ LLFloaterChatterBox::~LLFloaterChatterBox()
BOOL LLFloaterChatterBox::postBuild()
{
mVisibleSignal.connect(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2));
if (gSavedSettings.getBOOL("ContactsTornOff"))
{
LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance();
@ -245,14 +242,8 @@ void LLFloaterChatterBox::onOpen(const LLSD& key)
}
}
void LLFloaterChatterBox::onClose(bool app_quitting)
void LLFloaterChatterBox::onVisibilityChange ( const LLSD& new_visibility )
{
setVisible(FALSE);
}
void LLFloaterChatterBox::setMinimized(BOOL minimized)
{
LLFloater::setMinimized(minimized);
// HACK: potentially need to toggle console
LLFloaterChat* instance = LLFloaterChat::getInstance();
if(instance)
@ -332,7 +323,7 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp,
else
{
LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
openFloater(floaterp->getKey());
// openFloater(floaterp->getKey());
}
// make sure active voice icon shows up for new tab

View File

@ -52,8 +52,6 @@ public:
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
/*virtual*/ void draw();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void setMinimized(BOOL minimized);
/*virtual*/ void removeFloater(LLFloater* floaterp);
/*virtual*/ void addFloater(LLFloater* floaterp,
@ -64,6 +62,8 @@ public:
static LLFloater* getCurrentVoiceFloater();
protected:
void onVisibilityChange ( const LLSD& new_visibility );
LLFloater* mActiveVoiceFloater;
};
@ -76,7 +76,6 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
static LLFloaterMyFriends* getInstance(); // *TODO:Skinning Deprecate

View File

@ -79,7 +79,7 @@ const F32 CONTEXT_FADE_TIME = 0.08f;
//////////////////////////////////////////////////////////////////////////////
LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
: LLFloater(),
: LLFloater(LLSD()),
mComponents ( 3 ),
mMouseDownInLumRegion ( FALSE ),
mMouseDownInHueRegion ( FALSE ),
@ -113,6 +113,9 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show
mCanApplyImmediately ( show_apply_immediate ),
mContextConeOpacity ( 0.f )
{
// build the majority of the gui using the factory builder
LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml", NULL );
// create user interface for this picker
createUI ();
@ -133,10 +136,6 @@ LLFloaterColorPicker::~LLFloaterColorPicker()
//
void LLFloaterColorPicker::createUI ()
{
// build the majority of the gui using the factory builder
LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" );
setVisible ( FALSE );
// create RGB type area (not really RGB but it's got R,G & B in it.,..
LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents );

View File

@ -59,14 +59,13 @@
#include "llfloaterwindlight.h"
LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL;
std::map<std::string, LLWLSkyKey> LLFloaterDayCycle::sSliderToKey;
const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f;
LLFloaterDayCycle::LLFloaterDayCycle()
: LLFloater()
LLFloaterDayCycle::LLFloaterDayCycle(const LLSD& key)
: LLFloater(key)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml");
//LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml");
}
BOOL LLFloaterDayCycle::postBuild()
@ -95,6 +94,10 @@ BOOL LLFloaterDayCycle::postBuild()
// load it up
initCallbacks();
syncMenu();
syncSliderTrack();
return TRUE;
}
@ -102,17 +105,14 @@ LLFloaterDayCycle::~LLFloaterDayCycle()
{
}
void LLFloaterDayCycle::onClickHelp(void* data)
void LLFloaterDayCycle::onClickHelp(std::string xml_alert)
{
LLFloaterDayCycle* self = LLFloaterDayCycle::instance();
std::string xml_alert = *(std::string *) data;
LLNotifications::instance().add(self->contextualNotification(xml_alert));
LLNotifications::instance().add(contextualNotification(xml_alert));
}
void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert)
{
childSetAction(name, onClickHelp, new std::string(xml_alert));
getChild<LLButton>(name)->setClickedCallback(boost::bind(&LLFloaterDayCycle::onClickHelp, this, xml_alert));
}
void LLFloaterDayCycle::initCallbacks(void)
@ -120,24 +120,24 @@ void LLFloaterDayCycle::initCallbacks(void)
initHelpBtn("WLDayCycleHelp", "HelpDayCycle");
// WL Day Cycle
childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL);
childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL);
childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL);
childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL);
childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL);
getChild<LLUICtrl>("WLTimeSlider")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeSliderMoved, this, _1));
getChild<LLUICtrl>("WLDayCycleKeys")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeMoved, this, _1));
getChild<LLUICtrl>("WLCurKeyHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1));
getChild<LLUICtrl>("WLCurKeyMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1));
getChild<LLUICtrl>("WLKeyPresets")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyPresetChanged, this, _1));
childSetCommitCallback("WLLengthOfDayHour", onTimeRateChanged, NULL);
childSetCommitCallback("WLLengthOfDayMin", onTimeRateChanged, NULL);
childSetCommitCallback("WLLengthOfDaySec", onTimeRateChanged, NULL);
childSetAction("WLUseLindenTime", onUseLindenTime, NULL);
childSetAction("WLAnimSky", onRunAnimSky, NULL);
childSetAction("WLStopAnimSky", onStopAnimSky, NULL);
getChild<LLUICtrl>("WLLengthOfDayHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1));
getChild<LLUICtrl>("WLLengthOfDayMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1));
getChild<LLUICtrl>("WLLengthOfDaySec")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1));
getChild<LLUICtrl>("WLUseLindenTime")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onUseLindenTime, this, _1));
getChild<LLUICtrl>("WLAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onRunAnimSky, this, _1));
getChild<LLUICtrl>("WLStopAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onStopAnimSky, this, _1));
childSetAction("WLLoadDayCycle", onLoadDayCycle, NULL);
childSetAction("WLSaveDayCycle", onSaveDayCycle, NULL);
getChild<LLUICtrl>("WLLoadDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onLoadDayCycle, this, _1));
getChild<LLUICtrl>("WLSaveDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onSaveDayCycle, this, _1));
childSetAction("WLAddKey", onAddKey, NULL);
childSetAction("WLDeleteKey", onDeleteKey, NULL);
getChild<LLUICtrl>("WLAddKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onAddKey, this, _1));
getChild<LLUICtrl>("WLDeleteKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onDeleteKey, this, _1));
}
void LLFloaterDayCycle::syncMenu()
@ -145,12 +145,12 @@ void LLFloaterDayCycle::syncMenu()
// std::map<std::string, LLVector4> & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues;
// set time
LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider");
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay);
LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDaySec");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayMin");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayHour");
LLSpinCtrl* secSpin = getChild<LLSpinCtrl>("WLLengthOfDaySec");
LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLLengthOfDayMin");
LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLLengthOfDayHour");
F32 curRate;
F32 hours, min, sec;
@ -170,18 +170,18 @@ void LLFloaterDayCycle::syncMenu()
// turn off Use Estate Time button if it's already being used
if( LLWLParamManager::instance()->mAnimator.mUseLindenTime == true)
{
LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime");
childDisable("WLUseLindenTime");
}
else
{
LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime");
childEnable("WLUseLindenTime");
}
}
void LLFloaterDayCycle::syncSliderTrack()
{
// clear the slider
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
kSldr->clear();
sSliderToKey.clear();
@ -204,12 +204,12 @@ void LLFloaterDayCycle::syncTrack()
}
LLMultiSliderCtrl* sldr;
sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
sldr = getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
llassert_always(sSliderToKey.size() == sldr->getValue().size());
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
tSldr = getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
// create a new animation track
@ -231,50 +231,7 @@ void LLFloaterDayCycle::syncTrack()
LLWLParamManager::instance()->mCurParams);
}
// static
LLFloaterDayCycle* LLFloaterDayCycle::instance()
{
if (!sDayCycle)
{
sDayCycle = new LLFloaterDayCycle();
sDayCycle->openFloater();
sDayCycle->setFocus(TRUE);
}
return sDayCycle;
}
bool LLFloaterDayCycle::isOpen()
{
if (sDayCycle != NULL)
{
return true;
}
return false;
}
void LLFloaterDayCycle::show()
{
LLFloaterDayCycle* dayCycle = instance();
dayCycle->syncMenu();
syncSliderTrack();
// comment in if you want the menu to rebuild each time
//LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml");
//dayCycle->initCallbacks();
dayCycle->openFloater();
}
// virtual
void LLFloaterDayCycle::onClose(bool app_quitting)
{
if (sDayCycle)
{
sDayCycle->setVisible(FALSE);
}
}
void LLFloaterDayCycle::onRunAnimSky(void* userData)
void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl)
{
// if no keys, do nothing
if(sSliderToKey.size() == 0)
@ -283,11 +240,11 @@ void LLFloaterDayCycle::onRunAnimSky(void* userData)
}
LLMultiSliderCtrl* sldr;
sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
llassert_always(sSliderToKey.size() == sldr->getValue().size());
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider");
tSldr = getChild<LLMultiSliderCtrl>("WLTimeSlider");
// turn off linden time
LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
@ -299,7 +256,7 @@ void LLFloaterDayCycle::onRunAnimSky(void* userData)
llassert_always(LLWLParamManager::instance()->mAnimator.mTimeTrack.size() == sldr->getValue().size());
}
void LLFloaterDayCycle::onStopAnimSky(void* userData)
void LLFloaterDayCycle::onStopAnimSky(LLUICtrl* ctrl)
{
// if no keys, do nothing
if(sSliderToKey.size() == 0) {
@ -311,17 +268,16 @@ void LLFloaterDayCycle::onStopAnimSky(void* userData)
LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
}
void LLFloaterDayCycle::onUseLindenTime(void* userData)
void LLFloaterDayCycle::onUseLindenTime(LLUICtrl* ctrl)
{
LLFloaterWindLight* wl = LLFloaterWindLight::instance();
LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo");
LLComboBox* box = getChild<LLComboBox>("WLPresetsCombo");
box->selectByValue("");
LLWLParamManager::instance()->mAnimator.mIsRunning = true;
LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;
}
void LLFloaterDayCycle::onLoadDayCycle(void* userData)
void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl)
{
LLWLParamManager::instance()->mDay.loadDayCycle("Default.xml");
@ -331,7 +287,7 @@ void LLFloaterDayCycle::onLoadDayCycle(void* userData)
// set the param manager's track to the new one
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
tSldr = getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
LLWLParamManager::instance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
@ -341,15 +297,15 @@ void LLFloaterDayCycle::onLoadDayCycle(void* userData)
LLWLParamManager::instance()->mCurParams);
}
void LLFloaterDayCycle::onSaveDayCycle(void* userData)
void LLFloaterDayCycle::onSaveDayCycle(LLUICtrl* ctrl)
{
LLWLParamManager::instance()->mDay.saveDayCycle("Default.xml");
}
void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl)
{
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
/// get the slider value
@ -365,12 +321,12 @@ void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData)
LLWLParamManager::instance()->mCurParams);
}
void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl)
{
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets");
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin");
LLComboBox* comboBox = getChild<LLComboBox>("WLKeyPresets");
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLCurKeyHour");
LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLCurKeyMin");
if(sldr->getValue().size() == 0) {
return;
@ -408,18 +364,18 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData)
}
void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData)
void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl)
{
// if no keys, skipped
if(sSliderToKey.size() == 0) {
return;
}
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>(
LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>(
"WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>(
LLSpinCtrl* minSpin = getChild<LLSpinCtrl>(
"WLCurKeyMin");
F32 hour = hourSpin->get();
@ -437,12 +393,12 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData)
syncTrack();
}
void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData)
void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl)
{
// get the time
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
LLComboBox* comboBox = getChild<LLComboBox>(
"WLKeyPresets");
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
// do nothing if no sliders
@ -464,16 +420,16 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData)
syncTrack();
}
void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData)
void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl)
{
// get the time
LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>(
LLSpinCtrl* secSpin = getChild<LLSpinCtrl>(
"WLLengthOfDaySec");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>(
LLSpinCtrl* minSpin = getChild<LLSpinCtrl>(
"WLLengthOfDayMin");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>(
LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>(
"WLLengthOfDayHour");
F32 hour;
@ -492,13 +448,13 @@ void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData)
syncTrack();
}
void LLFloaterDayCycle::onAddKey(void* userData)
void LLFloaterDayCycle::onAddKey(LLUICtrl* ctrl)
{
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
LLComboBox* comboBox = getChild<LLComboBox>(
"WLKeyPresets");
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
LLMultiSliderCtrl* tSldr = getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
llassert_always(sSliderToKey.size() == kSldr->getValue().size());
@ -514,7 +470,7 @@ void LLFloaterDayCycle::onAddKey(void* userData)
void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName)
{
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
// make a slider
@ -539,7 +495,7 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName)
void LLFloaterDayCycle::deletePreset(std::string& presetName)
{
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
/// delete any reference
std::map<std::string, LLWLSkyKey>::iterator curr_preset, next_preset;
@ -555,15 +511,15 @@ void LLFloaterDayCycle::deletePreset(std::string& presetName)
}
}
void LLFloaterDayCycle::onDeleteKey(void* userData)
void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl)
{
if(sSliderToKey.size() == 0) {
return;
}
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
LLComboBox* comboBox = getChild<LLComboBox>(
"WLKeyPresets");
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
// delete from map
const std::string& sldrName = sldr->getCurSlider();
@ -580,8 +536,8 @@ void LLFloaterDayCycle::onDeleteKey(void* userData)
comboBox->selectByValue(sSliderToKey[name].presetName);
F32 time = sSliderToKey[name].time;
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin");
LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLCurKeyHour");
LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLCurKeyMin");
// now set the spinners
F32 hour = (F32)((S32)time);

View File

@ -56,87 +56,69 @@ class LLFloaterDayCycle : public LLFloater
{
public:
LLFloaterDayCycle();
LLFloaterDayCycle(const LLSD& key);
virtual ~LLFloaterDayCycle();
/*virtual*/ BOOL postBuild();
/// help button stuff
static void onClickHelp(void* data);
void onClickHelp(std::string xml_alert);
void initHelpBtn(const std::string& name, const std::string& xml_alert);
/// initialize all
void initCallbacks(void);
/// one and one instance only
static LLFloaterDayCycle* instance();
/// on time slider moved
static void onTimeSliderMoved(LLUICtrl* ctrl, void* userData);
void onTimeSliderMoved(LLUICtrl* ctrl);
/// what happens when you move the key frame
static void onKeyTimeMoved(LLUICtrl* ctrl, void* userData);
void onKeyTimeMoved(LLUICtrl* ctrl);
/// what happens when you change the key frame's time
static void onKeyTimeChanged(LLUICtrl* ctrl, void* userData);
void onKeyTimeChanged(LLUICtrl* ctrl);
/// if you change the combo box, change the frame
static void onKeyPresetChanged(LLUICtrl* ctrl, void* userData);
void onKeyPresetChanged(LLUICtrl* ctrl);
/// run this when user says to run the sky animation
static void onRunAnimSky(void* userData);
void onRunAnimSky(LLUICtrl* ctrl);
/// run this when user says to stop the sky animation
static void onStopAnimSky(void* userData);
void onStopAnimSky(LLUICtrl* ctrl);
/// if you change the combo box, change the frame
static void onTimeRateChanged(LLUICtrl* ctrl, void* userData);
void onTimeRateChanged(LLUICtrl* ctrl);
/// add a new key on slider
static void onAddKey(void* userData);
void onAddKey(LLUICtrl* ctrl);
/// delete any and all reference to a preset
void deletePreset(std::string& presetName);
/// delete a key frame
static void onDeleteKey(void* userData);
void onDeleteKey(LLUICtrl* ctrl);
/// button to load day
static void onLoadDayCycle(void* userData);
void onLoadDayCycle(LLUICtrl* ctrl);
/// button to save day
static void onSaveDayCycle(void* userData);
void onSaveDayCycle(LLUICtrl* ctrl);
/// toggle for Linden time
static void onUseLindenTime(void* userData);
//// menu management
/// show off our menu
static void show();
/// return if the menu exists or not
static bool isOpen();
/// stuff to do on exit
virtual void onClose(bool app_quitting);
void onUseLindenTime(LLUICtrl* ctrl);
/// sync up sliders with day cycle structure
static void syncMenu();
void syncMenu();
// makes sure key slider has what's in day cycle
static void syncSliderTrack();
void syncSliderTrack();
/// makes sure day cycle data structure has what's in menu
static void syncTrack();
void syncTrack();
/// add a slider to the track
static void addSliderKey(F32 time, const std::string& presetName);
void addSliderKey(F32 time, const std::string& presetName);
private:
// one instance on the inside
static LLFloaterDayCycle* sDayCycle;
// map of sliders to parameters
static std::map<std::string, LLWLSkyKey> sSliderToKey;

View File

@ -34,6 +34,7 @@
#include "llfloaterenvsettings.h"
#include "llfloaterreg.h"
#include "llfloaterwindlight.h"
#include "llfloaterwater.h"
#include "lluictrlfactory.h"
@ -52,12 +53,10 @@
#include <sstream>
LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL;
LLFloaterEnvSettings::LLFloaterEnvSettings()
: LLFloater()
LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD& key)
: LLFloater(key)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml");
//LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml");
}
// virtual
LLFloaterEnvSettings::~LLFloaterEnvSettings()
@ -68,31 +67,29 @@ BOOL LLFloaterEnvSettings::postBuild()
{
// load it up
initCallbacks();
syncMenu();
return TRUE;
}
void LLFloaterEnvSettings::onClickHelp(void* data)
void LLFloaterEnvSettings::onClickHelp()
{
LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data;
LLNotifications::instance().add(self->contextualNotification("EnvSettingsHelpButton"));
LLNotifications::instance().add(contextualNotification("EnvSettingsHelpButton"));
}
void LLFloaterEnvSettings::initCallbacks(void)
{
// our three sliders
childSetCommitCallback("EnvTimeSlider", onChangeDayTime, NULL);
childSetCommitCallback("EnvCloudSlider", onChangeCloudCoverage, NULL);
childSetCommitCallback("EnvWaterFogSlider", onChangeWaterFogDensity,
&LLWaterParamManager::instance()->mFogDensity);
getChild<LLUICtrl>("EnvTimeSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeDayTime, this, _1));
getChild<LLUICtrl>("EnvCloudSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeCloudCoverage, this, _1));
getChild<LLUICtrl>("EnvWaterFogSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterFogDensity, this, _1, &LLWaterParamManager::instance()->mFogDensity));
// color picker
childSetCommitCallback("EnvWaterColor", onChangeWaterColor,
&LLWaterParamManager::instance()->mFogColor);
getChild<LLUICtrl>("EnvWaterColor")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterColor, this, _1, &LLWaterParamManager::instance()->mFogColor));
// WL Top
childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, NULL);
childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, NULL);
childSetAction("EnvUseEstateTimeButton", onUseEstateTime, NULL);
childSetAction("EnvSettingsHelpButton", onClickHelp, this);
getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedSky, this));
getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedWater, this));
getChild<LLUICtrl>("EnvUseEstateTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseEstateTime, this));
getChild<LLUICtrl>("EnvSettingsHelpButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onClickHelp, this));
}
@ -101,14 +98,14 @@ void LLFloaterEnvSettings::initCallbacks(void)
void LLFloaterEnvSettings::syncMenu()
{
LLSliderCtrl* sldr;
sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider");
sldr = getChild<LLSliderCtrl>("EnvTimeSlider");
// sync the clock
F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime();
std::string timeStr = timeToString(val);
LLTextBox* textBox;
textBox = sEnvSettings->getChild<LLTextBox>("EnvTimeText");
textBox = getChild<LLTextBox>("EnvTimeText");
textBox->setValue(timeStr);
@ -127,7 +124,7 @@ void LLFloaterEnvSettings::syncMenu()
LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
// sync water params
LLColor4 col = param_mgr->getFogColor();
LLColorSwatchCtrl* colCtrl = sEnvSettings->getChild<LLColorSwatchCtrl>("EnvWaterColor");
LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor");
col.mV[3] = 1.0f;
colCtrl->set(col);
@ -171,53 +168,9 @@ void LLFloaterEnvSettings::syncMenu()
}
}
// static instance of it
LLFloaterEnvSettings* LLFloaterEnvSettings::instance()
void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl)
{
if (!sEnvSettings)
{
sEnvSettings = new LLFloaterEnvSettings();
sEnvSettings->openFloater();
sEnvSettings->setFocus(TRUE);
}
return sEnvSettings;
}
void LLFloaterEnvSettings::show()
{
LLFloaterEnvSettings* envSettings = instance();
envSettings->syncMenu();
// comment in if you want the menu to rebuild each time
//LLUICtrlFactory::getInstance()->buildFloater(envSettings, "floater_env_settings.xml");
//envSettings->initCallbacks();
envSettings->openFloater();
}
bool LLFloaterEnvSettings::isOpen()
{
if (sEnvSettings != NULL)
{
return true;
}
return false;
}
// virtual
void LLFloaterEnvSettings::onClose(bool app_quitting)
{
if (sEnvSettings)
{
sEnvSettings->setVisible(FALSE);
}
}
void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData)
{
LLSliderCtrl* sldr;
sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider");
LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
// deactivate animator
LLWLParamManager::instance()->mAnimator.mIsRunning = false;
@ -234,10 +187,9 @@ void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData)
LLWLParamManager::instance()->mCurParams);
}
void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData)
void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl)
{
LLSliderCtrl* sldr;
sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvCloudSlider");
LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
// deactivate animator
//LLWLParamManager::instance()->mAnimator.mIsRunning = false;
@ -247,17 +199,10 @@ void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData)
LLWLParamManager::instance()->mCurParams.set("cloud_shadow", val);
}
void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData)
void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl)
{
LLSliderCtrl* sldr;
sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvWaterFogSlider");
if(NULL == userData)
{
return;
}
WaterExpFloatControl * expFloatControl = static_cast<WaterExpFloatControl *>(userData);
sldr = getChild<LLSliderCtrl>("EnvWaterFogSlider");
F32 val = sldr->getValueF32();
expFloatControl->mExp = val;
@ -267,10 +212,9 @@ void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userDat
LLWaterParamManager::instance()->propagateParameters();
}
void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData)
void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
*colorControl = swatch->get();
colorControl->update(LLWaterParamManager::instance()->mCurParams);
@ -278,23 +222,22 @@ void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData)
}
void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData)
void LLFloaterEnvSettings::onOpenAdvancedSky()
{
LLFloaterWindLight::show();
LLFloaterReg::showInstance("env_windlight");
}
void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData)
void LLFloaterEnvSettings::onOpenAdvancedWater()
{
LLFloaterWater::show();
LLFloaterReg::showInstance("env_water");
}
void LLFloaterEnvSettings::onUseEstateTime(void* userData)
void LLFloaterEnvSettings::onUseEstateTime()
{
if(LLFloaterWindLight::isOpen())
LLFloaterWindLight* wl = LLFloaterReg::findTypedInstance<LLFloaterWindLight>("env_windlight");
if(wl)
{
// select the blank value in
LLFloaterWindLight* wl = LLFloaterWindLight::instance();
LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo");
box->selectByValue("");
}

View File

@ -39,59 +39,46 @@
#include "llfloater.h"
struct WaterColorControl;
struct WaterExpFloatControl;
/// Menuing system for all of windlight's functionality
class LLFloaterEnvSettings : public LLFloater
{
public:
LLFloaterEnvSettings();
LLFloaterEnvSettings(const LLSD& key);
/*virtual*/ ~LLFloaterEnvSettings();
/*virtual*/ BOOL postBuild();
/// initialize all the callbacks for the menu
void initCallbacks(void);
/// one and one instance only
static LLFloaterEnvSettings* instance();
/// callback for the menus help button
static void onClickHelp(void* data);
void onClickHelp();
/// handle if time of day is changed
static void onChangeDayTime(LLUICtrl* ctrl, void* userData);
void onChangeDayTime(LLUICtrl* ctrl);
/// handle if cloud coverage is changed
static void onChangeCloudCoverage(LLUICtrl* ctrl, void* userData);
void onChangeCloudCoverage(LLUICtrl* ctrl);
/// handle change in water fog density
static void onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData);
/// handle change in under water fog density
static void onChangeUnderWaterFogMod(LLUICtrl* ctrl, void* userData);
void onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl);
/// handle change in water fog color
static void onChangeWaterColor(LLUICtrl* ctrl, void* userData);
void onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl);
/// open the advanced sky settings menu
static void onOpenAdvancedSky(void* userData);
void onOpenAdvancedSky();
/// open the advanced water settings menu
static void onOpenAdvancedWater(void* userData);
void onOpenAdvancedWater();
/// sync time with the server
static void onUseEstateTime(void* userData);
void onUseEstateTime();
//// menu management
/// show off our menu
static void show();
/// return if the menu exists or not
static bool isOpen();
/// stuff to do on exit
virtual void onClose(bool app_quitting);
/// sync up sliders with parameters
void syncMenu();
@ -99,8 +86,6 @@ public:
std::string timeToString(F32 curTime);
private:
// one instance on the inside
static LLFloaterEnvSettings* sEnvSettings;
};

View File

@ -1,131 +0,0 @@
/**
* @file llfloaterevent.cpp
* @brief Event information as shown in a floating window from
* secondlife:// command handler.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Copyright (c) 2007-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterevent.h"
// viewer project includes
#include "llcommandhandler.h"
#include "llpanelevent.h"
// linden library includes
#include "lluuid.h"
#include "lluictrlfactory.h"
////////////////////////////////////////////////////////////////////////////
// LLFloaterEventInfo
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
LLMap< U32, LLFloaterEventInfo* > gEventInfoInstances;
class LLEventHandler : public LLCommandHandler
{
public:
// requires trusted browser to trigger
LLEventHandler() : LLCommandHandler("event", true) { }
bool handle(const LLSD& tokens, const LLSD& query_map,
LLWebBrowserCtrl* web)
{
if (tokens.size() < 2)
{
return false;
}
U32 event_id = tokens[0].asInteger();
if (tokens[1].asString() == "about")
{
LLFloaterEventInfo::show(event_id);
return true;
}
return false;
}
};
LLEventHandler gEventHandler;
LLFloaterEventInfo::LLFloaterEventInfo(const U32 event_id)
: LLFloater(),
mEventID( event_id )
{
mFactoryMap["event_details_panel"] = LLCallbackMap(LLFloaterEventInfo::createEventDetail, this);
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_event.xml");
gEventInfoInstances.addData(event_id, this);
}
LLFloaterEventInfo::~LLFloaterEventInfo()
{
// child views automatically deleted
gEventInfoInstances.removeData(mEventID);
}
void LLFloaterEventInfo::displayEventInfo(const U32 event_id)
{
mPanelEventp->setEventID(event_id);
this->setFrontmost(true);
}
// static
void* LLFloaterEventInfo::createEventDetail(void* userdata)
{
LLFloaterEventInfo *self = (LLFloaterEventInfo*)userdata;
self->mPanelEventp = new LLPanelEvent();
LLUICtrlFactory::getInstance()->buildPanel(self->mPanelEventp, "panel_event.xml");
return self->mPanelEventp;
}
// static
LLFloaterEventInfo* LLFloaterEventInfo::show(const U32 event_id)
{
LLFloaterEventInfo *floater;
if (gEventInfoInstances.checkData(event_id))
{
// ...bring that window to front
floater = gEventInfoInstances.getData(event_id);
floater->openFloater();
floater->setFrontmost(true);
}
else
{
floater = new LLFloaterEventInfo( event_id );
floater->center();
floater->openFloater();
floater->displayEventInfo(event_id);
floater->setFrontmost(true);
}
return floater;
}

View File

@ -1,60 +0,0 @@
/**
* @file llfloaterevent.h
* @brief Event information as shown in a floating window from
* secondlife:// command handler.
* Just a wrapper for LLPanelEvent.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Copyright (c) 2007-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LLFLOATEREVENT_H
#define LL_LLFLOATEREVENT_H
#include "llfloater.h"
class LLPanelEvent;
class LLFloaterEventInfo : public LLFloater
{
public:
LLFloaterEventInfo( const U32 event_id );
/*virtual*/ ~LLFloaterEventInfo();
void displayEventInfo(const U32 event_id);
static LLFloaterEventInfo* show(const U32 event_id);
static void* createEventDetail(void* userdata);
private:
U32 mEventID; // for which event is this window?
LLPanelEvent* mPanelEventp;
};
#endif // LL_LLFLOATEREVENT_H

View File

@ -61,10 +61,6 @@
#include "llvoavatar.h"
#include "llviewercontrol.h"
// static
LLFloaterGesture* LLFloaterGesture::sInstance = NULL;
LLFloaterGestureObserver* LLFloaterGesture::sObserver = NULL;
BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b )
{
return LLStringUtil::precedesDict( a->getName(), b->getName() );
@ -73,29 +69,31 @@ BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b )
class LLFloaterGestureObserver : public LLGestureManagerObserver
{
public:
LLFloaterGestureObserver() {}
LLFloaterGestureObserver(LLFloaterGesture* floater) : mFloater(floater) {}
virtual ~LLFloaterGestureObserver() {}
virtual void changed() { LLFloaterGesture::refreshAll(); }
virtual void changed() { mFloater->refreshAll(); }
private:
LLFloaterGesture* mFloater;
};
//---------------------------------------------------------------------------
// LLFloaterGesture
//---------------------------------------------------------------------------
LLFloaterGesture::LLFloaterGesture()
: LLFloater()
LLFloaterGesture::LLFloaterGesture(const LLSD& key)
: LLFloater(key)
{
sObserver = new LLFloaterGestureObserver;
gGestureManager.addObserver(sObserver);
mObserver = new LLFloaterGestureObserver(this);
LLGestureManager::instance().addObserver(mObserver);
//LLUICtrlFactory::getInstance()->buildFloater(this, "floater_gesture.xml");
}
// virtual
LLFloaterGesture::~LLFloaterGesture()
{
gGestureManager.removeObserver(sObserver);
delete sObserver;
sObserver = NULL;
sInstance = NULL;
LLGestureManager::instance().removeObserver(mObserver);
delete mObserver;
mObserver = NULL;
}
// virtual
@ -107,45 +105,27 @@ BOOL LLFloaterGesture::postBuild()
setTitle(label);
childSetCommitCallback("gesture_list", onCommitList, this);
getChild<LLScrollListCtrl>("gesture_list")->setDoubleClickCallback(onClickPlay, this);
getChild<LLUICtrl>("gesture_list")->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this));
getChild<LLScrollListCtrl>("gesture_list")->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
childSetAction("inventory_btn", onClickInventory, this);
getChild<LLUICtrl>("inventory_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickInventory, this));
childSetAction("edit_btn", onClickEdit, this);
getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this));
childSetAction("play_btn", onClickPlay, this);
childSetAction("stop_btn", onClickPlay, this);
getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this));
childSetAction("new_gesture_btn", onClickNew, this);
getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
childSetVisible("play_btn", true);
childSetVisible("stop_btn", false);
setDefaultBtn("play_btn");
buildGestureList();
childSetFocus("gesture_list");
return TRUE;
}
// static
void LLFloaterGesture::show()
{
if (sInstance)
{
sInstance->openFloater();
return;
}
sInstance = new LLFloaterGesture();
// Builds and adds to gFloaterView
LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_gesture.xml");
sInstance->buildGestureList();
sInstance->childSetFocus("gesture_list");
LLCtrlListInterface *list = sInstance->childGetListInterface("gesture_list");
LLCtrlListInterface *list = childGetListInterface("gesture_list");
if (list)
{
const BOOL ascending = TRUE;
@ -153,51 +133,34 @@ void LLFloaterGesture::show()
list->selectFirstItem();
}
sInstance->mSelectedID = LLUUID::null;
// Update button labels
onCommitList(NULL, sInstance);
sInstance->openFloater();
onCommitList();
return TRUE;
}
// static
void LLFloaterGesture::toggleVisibility()
void LLFloaterGesture::refreshAll()
{
if(sInstance && sInstance->getVisible())
buildGestureList();
LLCtrlListInterface *list = childGetListInterface("gesture_list");
if (!list) return;
if (mSelectedID.isNull())
{
sInstance->closeFloater();
list->selectFirstItem();
}
else
{
show();
}
}
// static
void LLFloaterGesture::refreshAll()
{
if (sInstance)
{
sInstance->buildGestureList();
LLCtrlListInterface *list = sInstance->childGetListInterface("gesture_list");
if (!list) return;
if (sInstance->mSelectedID.isNull())
if (! list->setCurrentByID(mSelectedID))
{
list->selectFirstItem();
}
else
{
if (! list->setCurrentByID(sInstance->mSelectedID))
{
list->selectFirstItem();
}
}
// Update button labels
onCommitList(NULL, sInstance);
}
// Update button labels
onCommitList();
}
void LLFloaterGesture::buildGestureList()
@ -214,7 +177,7 @@ void LLFloaterGesture::buildGestureList()
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
LLGestureManager::item_map_t::iterator it;
for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it)
for (it = LLGestureManager::instance().mActive.begin(); it != LLGestureManager::instance().mActive.end(); ++it)
{
const LLUUID& item_id = (*it).first;
LLMultiGesture* gesture = (*it).second;
@ -313,12 +276,9 @@ void LLFloaterGesture::buildGestureList()
scroll->setScrollPos(current_scroll_pos);
}
// static
void LLFloaterGesture::onClickInventory(void* data)
void LLFloaterGesture::onClickInventory()
{
LLFloaterGesture* self = (LLFloaterGesture*)data;
LLCtrlListInterface *list = self->childGetListInterface("gesture_list");
LLCtrlListInterface *list = childGetListInterface("gesture_list");
if (!list) return;
const LLUUID& item_id = list->getCurrentID();
@ -327,22 +287,19 @@ void LLFloaterGesture::onClickInventory(void* data)
inv->getPanel()->setSelection(item_id, TRUE);
}
// static
void LLFloaterGesture::onClickPlay(void* data)
void LLFloaterGesture::onClickPlay()
{
LLFloaterGesture* self = (LLFloaterGesture*)data;
LLCtrlListInterface *list = self->childGetListInterface("gesture_list");
LLCtrlListInterface *list = childGetListInterface("gesture_list");
if (!list) return;
const LLUUID& item_id = list->getCurrentID();
if (gGestureManager.isGesturePlaying(item_id))
if (LLGestureManager::instance().isGesturePlaying(item_id))
{
gGestureManager.stopGesture(item_id);
LLGestureManager::instance().stopGesture(item_id);
}
else
{
gGestureManager.playGesture(item_id);
LLGestureManager::instance().playGesture(item_id);
}
}
@ -355,8 +312,7 @@ public:
}
};
// static
void LLFloaterGesture::onClickNew(void* data)
void LLFloaterGesture::onClickNew()
{
LLPointer<LLInventoryCallback> cb = new GestureShowCallback();
create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
@ -365,12 +321,9 @@ void LLFloaterGesture::onClickNew(void* data)
}
// static
void LLFloaterGesture::onClickEdit(void* data)
void LLFloaterGesture::onClickEdit()
{
LLFloaterGesture* self = (LLFloaterGesture*)data;
LLCtrlListInterface *list = self->childGetListInterface("gesture_list");
LLCtrlListInterface *list = childGetListInterface("gesture_list");
if (!list) return;
const LLUUID& item_id = list->getCurrentID();
@ -380,26 +333,23 @@ void LLFloaterGesture::onClickEdit(void* data)
LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null);
if (!previewp->getHost())
{
previewp->setRect(gFloaterView->findNeighboringPosition(self, previewp));
previewp->setRect(gFloaterView->findNeighboringPosition(this, previewp));
}
}
// static
void LLFloaterGesture::onCommitList(LLUICtrl* ctrl, void* data)
void LLFloaterGesture::onCommitList()
{
LLFloaterGesture* self = (LLFloaterGesture*)data;
const LLUUID& item_id = childGetValue("gesture_list").asUUID();
const LLUUID& item_id = self->childGetValue("gesture_list").asUUID();
self->mSelectedID = item_id;
if (gGestureManager.isGesturePlaying(item_id))
mSelectedID = item_id;
if (LLGestureManager::instance().isGesturePlaying(item_id))
{
self->childSetVisible("play_btn", false);
self->childSetVisible("stop_btn", true);
childSetVisible("play_btn", false);
childSetVisible("stop_btn", true);
}
else
{
self->childSetVisible("play_btn", true);
self->childSetVisible("stop_btn", false);
childSetVisible("play_btn", true);
childSetVisible("stop_btn", false);
}
}

View File

@ -56,32 +56,28 @@ class LLFloaterGesture
: public LLFloater
{
public:
LLFloaterGesture();
LLFloaterGesture(const LLSD& key);
virtual ~LLFloaterGesture();
virtual BOOL postBuild();
static void show();
static void toggleVisibility();
static void refreshAll();
void refreshAll();
protected:
// Reads from the gesture manager's list of active gestures
// and puts them in this list.
void buildGestureList();
static void onClickInventory(void* data);
static void onClickEdit(void* data);
static void onClickPlay(void* data);
static void onClickNew(void* data);
static void onCommitList(LLUICtrl* ctrl, void* data);
void onClickInventory();
void onClickEdit();
void onClickPlay();
void onClickNew();
void onCommitList();
protected:
LLUUID mSelectedID;
static LLFloaterGesture* sInstance;
static LLFloaterGestureObserver* sObserver;
static LLFloaterGestureInventoryObserver* sInventoryObserver;
LLFloaterGestureObserver* mObserver;
};

View File

@ -185,15 +185,6 @@ void LLFloaterGodTools::updatePopup(LLCoordGL center, MASK mask)
{
}
// virtual
void LLFloaterGodTools::onClose(bool app_quitting)
{
LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools");
if(!god_tools) return;
god_tools->setVisible(FALSE);
}
// virtual
void LLFloaterGodTools::draw()
{

View File

@ -81,7 +81,6 @@ public:
void showPanel(const std::string& panel_name);
virtual void onOpen(const LLSD& key);
virtual void onClose(bool app_quitting);
virtual void draw();

View File

@ -79,7 +79,7 @@ void LLFloaterGroupInvite::impl::closeFloater(void* data)
// Implementation
//-----------------------------------------------------------------------------
LLFloaterGroupInvite::LLFloaterGroupInvite(const LLUUID& group_id)
: LLFloater()
: LLFloater(group_id)
{
static LLUICachedControl<S32> floater_header_size ("UIFloaterHeaderSize", 0);
LLRect contents;

View File

@ -53,9 +53,6 @@
using namespace LLOldEvents;
// static
std::map<const LLUUID, LLFloaterGroupPicker*> LLFloaterGroupPicker::sInstances;
// helper functions
void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 powers_mask = GP_ALL_POWERS);
@ -63,36 +60,16 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow
/// Class LLFloaterGroupPicker
///----------------------------------------------------------------------------
// static
LLFloaterGroupPicker* LLFloaterGroupPicker::findInstance(const LLSD& seed)
{
instance_map_t::iterator found_it = sInstances.find(seed.asUUID());
if (found_it != sInstances.end())
{
return found_it->second;
}
return NULL;
}
// static
LLFloaterGroupPicker* LLFloaterGroupPicker::createInstance(const LLSD &seed)
{
LLFloaterGroupPicker* pickerp = new LLFloaterGroupPicker(seed);
return pickerp;
}
LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed)
: LLFloater(),
mPowersMask(GP_ALL_POWERS)
: LLFloater(seed),
mPowersMask(GP_ALL_POWERS),
mID(seed.asUUID())
{
mID = seed.asUUID();
sInstances.insert(std::make_pair(mID, this));
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml");
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml");
}
LLFloaterGroupPicker::~LLFloaterGroupPicker()
{
sInstances.erase(mID);
}
void LLFloaterGroupPicker::setPowersMask(U64 powers_mask)

View File

@ -56,10 +56,10 @@ class LLScrollListCtrl;
class LLButton;
class LLFloaterGroupPicker;
class LLFloaterGroupPicker : public LLFloater, public LLUIFactory<LLFloaterGroupPicker, LLFloaterGroupPicker, VisibilityPolicy<LLFloater> >
class LLFloaterGroupPicker : public LLFloater
{
friend class LLUIFactory<LLFloaterGroupPicker>;
public:
LLFloaterGroupPicker(const LLSD& seed);
~LLFloaterGroupPicker();
// Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots
@ -73,7 +73,6 @@ public:
static LLFloaterGroupPicker* createInstance(const LLSD& seed);
protected:
LLFloaterGroupPicker(const LLSD& seed);
void ok();
static void onBtnOK(void* userdata);
static void onBtnCancel(void* userdata);

View File

@ -49,12 +49,10 @@
#include "llwindow.h"
#include "llslider.h"
LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL;
LLFloaterHardwareSettings::LLFloaterHardwareSettings()
: LLFloater()
LLFloaterHardwareSettings::LLFloaterHardwareSettings(const LLSD& key)
: LLFloater(key)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml");
//LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml");
}
LLFloaterHardwareSettings::~LLFloaterHardwareSettings()
@ -109,48 +107,6 @@ void LLFloaterHardwareSettings::refreshEnabledState()
}
// static instance of it
LLFloaterHardwareSettings* LLFloaterHardwareSettings::instance()
{
if (!sHardwareSettings)
{
sHardwareSettings = new LLFloaterHardwareSettings();
sHardwareSettings->closeFloater();
}
return sHardwareSettings;
}
void LLFloaterHardwareSettings::show()
{
LLFloaterHardwareSettings* hardSettings = instance();
hardSettings->refresh();
hardSettings->center();
// comment in if you want the menu to rebuild each time
//LLUICtrlFactory::getInstance()->buildFloater(hardSettings, "floater_hardware_settings.xml");
//hardSettings->initCallbacks();
hardSettings->openFloater();
}
bool LLFloaterHardwareSettings::isOpen()
{
if (sHardwareSettings != NULL)
{
return true;
}
return false;
}
// virtual
void LLFloaterHardwareSettings::onClose(bool app_quitting)
{
if (sHardwareSettings)
{
sHardwareSettings->setVisible(FALSE);
}
}
//============================================================================
BOOL LLFloaterHardwareSettings::postBuild()
@ -158,6 +114,7 @@ BOOL LLFloaterHardwareSettings::postBuild()
childSetAction("OK", onBtnOK, this);
refresh();
center();
// load it up
initCallbacks();

View File

@ -42,7 +42,7 @@ class LLFloaterHardwareSettings : public LLFloater
public:
LLFloaterHardwareSettings();
LLFloaterHardwareSettings(const LLSD& key);
/*virtual*/ ~LLFloaterHardwareSettings();
/*virtual*/ BOOL postBuild();
@ -50,9 +50,6 @@ public:
/// initialize all the callbacks for the menu
void initCallbacks(void);
/// one and one instance only
static LLFloaterHardwareSettings* instance();
/// callback for the menus help button
static void onClickHelp(void* data);
@ -67,9 +64,6 @@ public:
/// return if the menu exists or not
static bool isOpen();
/// stuff to do on exit
virtual void onClose(bool app_quitting);
/// sync up menu with parameters
void refresh();
@ -92,8 +86,6 @@ protected:
BOOL mProbeHardwareOnStartup;
private:
// one instance on the inside
static LLFloaterHardwareSettings* sHardwareSettings;
};
#endif

View File

@ -101,12 +101,3 @@ BOOL LLFloaterHUD::postBuild()
LLFloaterHUD::~LLFloaterHUD()
{
}
// Save our visibility state on close in case the user accidentally
// quit the application while the tutorial was visible.
// virtual
void LLFloaterHUD::onClose(bool app_quitting)
{
bool stay_visible = app_quitting;
gSavedSettings.setBOOL("ShowTutorial", stay_visible);
destroy();
}

View File

@ -42,8 +42,6 @@ class LLFloaterHUD : public LLFloater
friend class LLFloaterReg;
public:
// Save our visibility state during close
/*virtual*/ void onClose(bool app_quitting);
BOOL postBuild();
private:

View File

@ -59,9 +59,6 @@
#include "llviewertexturelist.h"
#include "llstring.h"
//static
S32 LLFloaterImagePreview::sUploadAmount = 10;
const S32 PREVIEW_BORDER_WIDTH = 2;
const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH;
const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
@ -93,9 +90,7 @@ BOOL LLFloaterImagePreview::postBuild()
{
return FALSE;
}
childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount));
LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo");
if (iface)
{
@ -130,7 +125,9 @@ BOOL LLFloaterImagePreview::postBuild()
childDisable("clothing_type_combo");
childDisable("ok_btn");
}
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}

View File

@ -121,7 +121,6 @@ public:
BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
static void onMouseCaptureLostImagePreview(LLMouseHandler*);
static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
void clearAllPreviewTextures();
@ -139,7 +138,6 @@ protected:
LLRectf mPreviewImageRect;
LLPointer<LLViewerTexture> mImagep ;
static S32 sUploadAmount;
};
#endif // LL_LLFLOATERIMAGEPREVIEW_H

View File

@ -95,11 +95,11 @@ LLUUID LLFloaterInventory::sWearNewClothingTransactionID;
///----------------------------------------------------------------------------
LLFloaterInventoryFinder::LLFloaterInventoryFinder(LLFloaterInventory* inventory_view)
: LLFloater(),
: LLFloater(LLSD()),
mFloaterInventory(inventory_view),
mFilter(inventory_view->mActivePanel->getFilter())
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml");
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml", NULL);
updateElementsFromFilter();
}
@ -297,21 +297,6 @@ void LLFloaterInventoryFinder::draw()
LLFloater::draw();
}
void LLFloaterInventoryFinder::onClose(bool app_quitting)
{
gSavedSettings.setBOOL("Inventory.ShowFilters", FALSE);
// If you want to reset the filter on close, do it here. This functionality was
// hotly debated - Paulm
#if 0
if (mFloaterInventory)
{
LLFloaterInventory::onResetFilter((void *)mFloaterInventory);
}
#endif
destroy();
}
BOOL LLFloaterInventoryFinder::getCheckShowEmpty()
{
return childGetValue("check_show_empty");
@ -450,7 +435,7 @@ LLFloaterInventory::LLFloaterInventory(const LLSD& key)
mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLAssetType::AT_TRASH));
mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLAssetType::AT_LOST_AND_FOUND));
mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLFloaterInventory::doCreate, this, _2));
mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::newWindow, this));
// mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::newWindow, this));
mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLFloaterInventory::toggleFindOptions, this));
mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLFloaterInventory::resetFilters, this));
mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLFloaterInventory::setSortBy, this, _2));
@ -462,7 +447,6 @@ LLFloaterInventory::LLFloaterInventory(const LLSD& key)
BOOL sort_folders_by_name = ( sort_order & LLInventoryFilter::SO_FOLDERS_BY_NAME );
BOOL sort_system_folders_to_top = ( sort_order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP );
gSavedSettings.declareBOOL("Inventory.ShowFilters", FALSE, "Declared in code", FALSE);
gSavedSettings.declareBOOL("Inventory.SortByName", sort_by_name, "Declared in code", FALSE);
gSavedSettings.declareBOOL("Inventory.SortByDate", !sort_by_name, "Declared in code", FALSE);
gSavedSettings.declareBOOL("Inventory.FoldersAlwaysByName", sort_folders_by_name, "Declared in code", FALSE);
@ -597,10 +581,6 @@ void LLFloaterInventory::draw()
title << mFilterText;
setTitle(title.str());
}
if (mActivePanel && mFilterEditor)
{
mFilterEditor->setText(mActivePanel->getFilterSubString());
}
LLFloater::draw();
}
@ -678,36 +658,11 @@ void LLFloaterInventory::startSearch()
}
}
// virtual, from LLView
void LLFloaterInventory::setVisible( BOOL visible )
{
LLFloater::setVisible(visible);
}
void LLFloaterInventory::onOpen(const LLSD& key)
{
LLFirstUse::useInventory();
}
// Destroy all but the last floater, which is made invisible.
void LLFloaterInventory::onClose(bool app_quitting)
{
if (getKey().asInteger() != 0)
{
destroy();
}
else
{
// clear filters, but save user's folder state first
if (!mActivePanel->getRootFolder()->isFilterModified())
{
mSavedFolderState->setApply(FALSE);
mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
}
setVisible(FALSE);
}
}
BOOL LLFloaterInventory::handleKeyHere(KEY key, MASK mask)
{
LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL;
@ -754,14 +709,6 @@ void LLFloaterInventory::changed(U32 mask)
}
//static
LLFloaterInventory* LLFloaterInventory::newInstance()
{
LLMemType mt(LLMemType::MTYPE_INVENTORY_VIEW_SHOW);
static S32 inst_count = 1;
return LLFloaterReg::getTypedInstance<LLFloaterInventory>("inventory", LLSD(inst_count++));
}
//----------------------------------------------------------------------------
// menu callbacks
@ -780,17 +727,6 @@ void LLFloaterInventory::doCreate(const LLSD& userdata)
menu_create_inventory_item(getPanel()->getRootFolder(), NULL, userdata);
}
void LLFloaterInventory::newWindow()
{
LLFloaterInventory* iv = newInstance();
iv->getActivePanel()->setFilterTypes(getActivePanel()->getFilterTypes());
iv->getActivePanel()->setFilterSubString(getActivePanel()->getFilterSubString());
iv->openFloater();
// force onscreen
gFloaterView->adjustToFitScreen(iv, FALSE);
}
void LLFloaterInventory::resetFilters()
{
LLFloaterInventoryFinder *finder = getFinder();
@ -920,14 +856,10 @@ void LLFloaterInventory::toggleFindOptions()
// start background fetch of folders
gInventory.startBackgroundFetch();
gSavedSettings.setBOOL("Inventory.ShowFilters", TRUE);
}
else
{
floater->closeFloater();
gSavedSettings.setBOOL("Inventory.ShowFilters", FALSE);
}
}
@ -978,8 +910,7 @@ void LLFloaterInventory::onFilterEdit(const std::string& search_string )
gInventory.startBackgroundFetch();
std::string filter_text = search_string;
std::string uppercase_search_string = filter_text;
std::string uppercase_search_string = search_string;
LLStringUtil::toUpper(uppercase_search_string);
if (mActivePanel->getFilterSubString().empty() && uppercase_search_string.empty())
{

View File

@ -188,7 +188,6 @@ class LLFloaterInventoryFinder : public LLFloater
public:
LLFloaterInventoryFinder( LLFloaterInventory* inventory_view);
virtual void draw();
virtual void onClose(bool app_quitting);
/*virtual*/ BOOL postBuild();
void changeFilter(LLInventoryFilter* filter);
void updateElementsFromFilter();
@ -226,9 +225,6 @@ public:
void setFilterTextFromFilter() { mFilterText = mActivePanel->getFilter()->getFilterText(); }
void startSearch();
// Spawn a new inventory view
static LLFloaterInventory* newInstance();
// This method makes sure that an inventory view exists, is
// visible, and has focus. The view chosen is returned.
static LLFloaterInventory* showAgentInventory();
@ -248,8 +244,6 @@ public:
// LLView & LLFloater functionality
virtual void onOpen(const LLSD& key);
virtual void onClose(bool app_quitting);
virtual void setVisible(BOOL visible);
virtual void draw();
virtual BOOL handleKeyHere(KEY key, MASK mask);
@ -278,7 +272,6 @@ public:
void doToSelected(const LLSD& userdata);
void closeAllFolders();
void doCreate(const LLSD& userdata);
void newWindow();
void resetFilters();
void setSortBy(const LLSD& userdata);

View File

@ -204,21 +204,16 @@ void LLFloaterLand::onOpen(const LLSD& key)
refresh();
}
// virtual
void LLFloaterLand::onClose(bool app_quitting)
void LLFloaterLand::onVisibilityChange(const LLSD& visible)
{
LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
delete sObserver;
sObserver = NULL;
if (!visible.asBoolean())
{
// Might have been showing owned objects
LLSelectMgr::getInstance()->unhighlightAll();
// Might have been showing owned objects
LLSelectMgr::getInstance()->unhighlightAll();
// Save which panel we had open
sLastTab = mTabLand->getCurrentPanelIndex();
destroy();
// Save which panel we had open
sLastTab = mTabLand->getCurrentPanelIndex();
}
}
@ -239,7 +234,9 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed)
}
BOOL LLFloaterLand::postBuild()
{
{
mVisibleSignal.connect(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2));
LLTabContainer* tab = getChild<LLTabContainer>("landtab");
mTabLand = (LLTabContainer*) tab;
@ -256,6 +253,9 @@ BOOL LLFloaterLand::postBuild()
// virtual
LLFloaterLand::~LLFloaterLand()
{
LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
delete sObserver;
sObserver = NULL;
}
// public
@ -781,18 +781,18 @@ void LLPanelLandGeneral::draw()
void LLPanelLandGeneral::onClickSetGroup()
{
LLFloaterGroupPicker* fg;
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID()));
fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 ));
if (parent_floater)
LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID()));
if (fg)
{
LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
parent_floater->addDependentFloater(fg);
fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 ));
if (parent_floater)
{
LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg);
fg->setOrigin(new_rect.mLeft, new_rect.mBottom);
parent_floater->addDependentFloater(fg);
}
}
}

View File

@ -81,8 +81,6 @@ public:
static LLPanelLandObjects* getCurrentPanelLandObjects();
static LLPanelLandCovenant* getCurrentPanelLandCovenant();
// Destroys itself on close.
virtual void onClose(bool app_quitting);
virtual void onOpen(const LLSD& key);
virtual BOOL postBuild();
@ -91,6 +89,8 @@ private:
// to allocate or destroy.
LLFloaterLand(const LLSD& seed);
virtual ~LLFloaterLand();
void onVisibilityChange(const LLSD& visible);
protected:

View File

@ -56,46 +56,16 @@
#include "llviewermessage.h"
#include "lluictrlfactory.h"
// statics
LLFloaterLandHoldings* LLFloaterLandHoldings::sInstance = NULL;
// static
void LLFloaterLandHoldings::show(void*)
{
LLFloaterLandHoldings* floater = new LLFloaterLandHoldings();
LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_land_holdings.xml");
floater->center();
// query_id null is known to be us
const LLUUID& query_id = LLUUID::null;
// look only for parcels we own
U32 query_flags = DFQ_AGENT_OWNED;
send_places_query(query_id,
LLUUID::null,
"",
query_flags,
LLParcel::C_ANY,
"");
// TODO: request updated L$ balance?
floater->openFloater();
}
// protected
LLFloaterLandHoldings::LLFloaterLandHoldings()
: LLFloater(),
LLFloaterLandHoldings::LLFloaterLandHoldings(const LLSD& key)
: LLFloater(key),
mActualArea(0),
mBillableArea(0),
mFirstPacketReceived(FALSE),
mSortColumn(""),
mSortAscending(TRUE)
{
// Instance management.
sInstance = this;
// LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_land_holdings.xml");
}
BOOL LLFloaterLandHoldings::postBuild()
@ -128,7 +98,9 @@ BOOL LLFloaterLandHoldings::postBuild()
list->addElement(element, ADD_SORTED);
}
center();
return TRUE;
}
@ -136,9 +108,23 @@ BOOL LLFloaterLandHoldings::postBuild()
// protected
LLFloaterLandHoldings::~LLFloaterLandHoldings()
{
sInstance = NULL;
}
void LLFloaterLandHoldings::onOpen(const LLSD& key)
{
// query_id null is known to be us
const LLUUID& query_id = LLUUID::null;
// look only for parcels we own
U32 query_flags = DFQ_AGENT_OWNED;
send_places_query(query_id,
LLUUID::null,
"",
query_flags,
LLParcel::C_ANY,
"");
}
void LLFloaterLandHoldings::draw()
{
@ -168,7 +154,7 @@ void LLFloaterLandHoldings::refresh()
// static
void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**)
{
LLFloaterLandHoldings* self = sInstance;
LLFloaterLandHoldings* self = LLFloaterReg::findTypedInstance<LLFloaterLandHoldings>("land_holdings");
// Is this packet from an old, closed window?
if (!self)
@ -224,50 +210,53 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**)
land_type = LLTrans::getString("land_type_unknown");
}
self->mActualArea += actual_area;
self->mBillableArea += billable_area;
S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
std::string location;
location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y);
std::string area;
if(billable_area == actual_area)
if(owner_id.notNull())
{
area = llformat("%d", billable_area);
}
else
{
area = llformat("%d / %d", billable_area, actual_area);
}
std::string hidden;
hidden = llformat("%f %f", global_x, global_y);
self->mActualArea += actual_area;
self->mBillableArea += billable_area;
LLSD element;
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = name;
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][1]["column"] = "location";
element["columns"][1]["value"] = location;
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][2]["column"] = "area";
element["columns"][2]["value"] = area;
element["columns"][2]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "type";
element["columns"][3]["value"] = land_type;
element["columns"][3]["font"] = "SANSSERIF";
// hidden is always last column
element["columns"][4]["column"] = "hidden";
element["columns"][4]["value"] = hidden;
S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
list->addElement(element);
std::string location;
location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y);
std::string area;
if(billable_area == actual_area)
{
area = llformat("%d", billable_area);
}
else
{
area = llformat("%d / %d", billable_area, actual_area);
}
std::string hidden;
hidden = llformat("%f %f", global_x, global_y);
LLSD element;
element["columns"][0]["column"] = "name";
element["columns"][0]["value"] = name;
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][1]["column"] = "location";
element["columns"][1]["value"] = location;
element["columns"][1]["font"] = "SANSSERIF";
element["columns"][2]["column"] = "area";
element["columns"][2]["value"] = area;
element["columns"][2]["font"] = "SANSSERIF";
element["columns"][3]["column"] = "type";
element["columns"][3]["value"] = land_type;
element["columns"][3]["font"] = "SANSSERIF";
// hidden is always last column
element["columns"][4]["column"] = "hidden";
element["columns"][4]["value"] = hidden;
list->addElement(element);
}
}
self->refreshAggregates();

View File

@ -44,10 +44,11 @@ class LLFloaterLandHoldings
: public LLFloater
{
public:
BOOL postBuild();
static void show(void*);
LLFloaterLandHoldings(const LLSD& key);
virtual ~LLFloaterLandHoldings();
virtual BOOL postBuild();
virtual void onOpen(const LLSD& key);
virtual void draw();
void refresh();
@ -63,14 +64,9 @@ public:
static void onGrantList(void* data);
protected:
LLFloaterLandHoldings();
virtual ~LLFloaterLandHoldings();
void refreshAggregates();
protected:
static LLFloaterLandHoldings* sInstance;
// Sum up as packets arrive the total holdings
S32 mActualArea;
S32 mBillableArea;

View File

@ -69,15 +69,12 @@ const S32 PREF_BUTTON_HEIGHT = 16;
//-----------------------------------------------------------------------------
// LLFloaterNameDesc()
//-----------------------------------------------------------------------------
LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename )
: LLFloater()
LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename )
: LLFloater(filename),
mIsAudio(FALSE)
{
setTitle("Name/Description Floater");
mFilenameAndPath = filename;
mFilename = gDirUtilp->getBaseFileName(filename, false);
// SL-5521 Maintain capitalization of filename when making the inventory item. JC
//LLStringUtil::toLower(mFilename);
mIsAudio = FALSE;
mFilenameAndPath = filename.asString();
mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false);
}
//-----------------------------------------------------------------------------
@ -93,11 +90,6 @@ BOOL LLFloaterNameDesc::postBuild()
LLStringUtil::stripNonprintable(asset_name);
LLStringUtil::trim(asset_name);
std::string exten = gDirUtilp->getExtension(asset_name);
if (exten == "wav")
{
mIsAudio = TRUE;
}
asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion
setTitle(mFilename);
@ -112,7 +104,7 @@ BOOL LLFloaterNameDesc::postBuild()
r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
childSetCommitCallback("name_form", doCommit, this);
getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
childSetValue("name_form", LLSD(asset_name));
LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form");
@ -126,7 +118,7 @@ BOOL LLFloaterNameDesc::postBuild()
y -= PREVIEW_LINE_HEIGHT;
r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT );
childSetCommitCallback("description_form", doCommit, this);
getChild<LLUICtrl>("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form");
if (DescEditor)
{
@ -137,12 +129,12 @@ BOOL LLFloaterNameDesc::postBuild()
y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f);
// Cancel button
childSetAction("cancel_btn", onBtnCancel, this);
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
// OK button
childSetAction("ok_btn", onBtnOK, this);
childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() ));
setDefaultBtn("ok_btn");
return TRUE;
}
@ -162,45 +154,59 @@ void LLFloaterNameDesc::onCommit()
{
}
// static
//-----------------------------------------------------------------------------
// onCommit()
//-----------------------------------------------------------------------------
void LLFloaterNameDesc::doCommit( class LLUICtrl *, void* userdata )
void LLFloaterNameDesc::doCommit()
{
LLFloaterNameDesc* self = (LLFloaterNameDesc*) userdata;
self->onCommit();
onCommit();
}
// static
//-----------------------------------------------------------------------------
// onBtnOK()
//-----------------------------------------------------------------------------
void LLFloaterNameDesc::onBtnOK( void* userdata )
void LLFloaterNameDesc::onBtnOK( )
{
LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata;
fp->childDisable("ok_btn"); // don't allow inadvertent extra uploads
childDisable("ok_btn"); // don't allow inadvertent extra uploads
LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
void *nruserdata = NULL;
std::string display_name = LLStringUtil::null;
upload_new_resource(fp->mFilenameAndPath, // file
fp->childGetValue("name_form").asString(),
fp->childGetValue("description_form").asString(),
upload_new_resource(mFilenameAndPath, // file
childGetValue("name_form").asString(),
childGetValue("description_form").asString(),
0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(),
display_name, callback, expected_upload_cost, nruserdata);
fp->closeFloater(false);
closeFloater(false);
}
// static
//-----------------------------------------------------------------------------
// onBtnCancel()
//-----------------------------------------------------------------------------
void LLFloaterNameDesc::onBtnCancel( void* userdata )
void LLFloaterNameDesc::onBtnCancel()
{
LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata;
fp->closeFloater(false);
closeFloater(false);
}
//-----------------------------------------------------------------------------
// LLFloaterSoundPreview()
//-----------------------------------------------------------------------------
LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename )
: LLFloaterNameDesc(filename)
{
mIsAudio = TRUE;
}
BOOL LLFloaterSoundPreview::postBuild()
{
if (!LLFloaterNameDesc::postBuild())
{
return FALSE;
}
getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}

View File

@ -44,11 +44,14 @@ class LLRadioGroup;
class LLFloaterNameDesc : public LLFloater
{
public:
LLFloaterNameDesc(const std::string& filename);
LLFloaterNameDesc(const LLSD& filename);
virtual ~LLFloaterNameDesc();
virtual BOOL postBuild();
static void doCommit(class LLUICtrl *, void* userdata);
void onBtnOK();
void onBtnCancel();
void doCommit();
protected:
virtual void onCommit();
@ -57,9 +60,13 @@ protected:
std::string mFilenameAndPath;
std::string mFilename;
static void onBtnOK(void*);
static void onBtnCancel(void*);
};
class LLFloaterSoundPreview : public LLFloaterNameDesc
{
public:
LLFloaterSoundPreview(const LLSD& filename );
virtual BOOL postBuild();
};
#endif // LL_LLFLOATERNAMEDESC_H

View File

@ -168,13 +168,6 @@ LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key)
//LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml");
}
void LLFloaterNotificationConsole::onClose(bool app_quitting)
{
setVisible(FALSE);
//destroy();
}
BOOL LLFloaterNotificationConsole::postBuild()
{
// these are in the order of processing
@ -251,10 +244,10 @@ void LLFloaterNotificationConsole::onClickAdd()
//=============== LLFloaterNotification ================
LLFloaterNotification::LLFloaterNotification(LLNotification* note)
: LLFloater(),
: LLFloater(LLSD()),
mNote(note)
{
LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml");
LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml", NULL);
}
BOOL LLFloaterNotification::postBuild()

View File

@ -46,7 +46,6 @@ public:
// LLPanel
BOOL postBuild();
void onClose(bool app_quitting);
void addChannel(const std::string& type, bool open = false);
void updateResizeLimits(LLLayoutStack &stack);
@ -71,7 +70,6 @@ public:
// LLPanel
BOOL postBuild();
void respond();
void onClose(bool app_quitting) { setVisible(FALSE); }
private:
static void onCommitResponse(LLUICtrl* ctrl, void* data) { ((LLFloaterNotification*)data)->respond(); }

Some files were not shown because too many files have changed in this diff Show More