MAINT-8344 Day Cycle Editor (part 3)

master
andreykproductengine 2018-05-18 21:09:42 +03:00
parent 7a0a580edd
commit e4973e0f92
8 changed files with 366 additions and 797 deletions

View File

@ -196,7 +196,11 @@ void LLMultiSlider::setValue(const LLSD& value)
F32 LLMultiSlider::getSliderValue(const std::string& name) const
{
return (F32)mValue[name].asReal();
if (mValue.has(name))
{
return (F32)mValue[name].asReal();
}
return 0;
}
void LLMultiSlider::setCurSlider(const std::string& name)
@ -206,6 +210,11 @@ void LLMultiSlider::setCurSlider(const std::string& name)
}
}
void LLMultiSlider::resetCurSlider()
{
mCurSlider = LLStringUtil::null;
}
const std::string& LLMultiSlider::addSlider()
{
return addSlider(mInitialValue);
@ -421,20 +430,23 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask)
}
}
// Find the offset of the actual mouse location from the center of the thumb.
if (mThumbRects[mCurSlider].pointInRect(x,y))
if (!mCurSlider.empty())
{
mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x;
}
else
{
mMouseOffset = 0;
}
// Find the offset of the actual mouse location from the center of the thumb.
if (mThumbRects[mCurSlider].pointInRect(x,y))
{
mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x;
}
else
{
mMouseOffset = 0;
}
// Start dragging the thumb
// No handler needed for focus lost since this class has no state that depends on it.
gFocusMgr.setMouseCapture( this );
mDragStartThumbRect = mThumbRects[mCurSlider];
// Start dragging the thumb
// No handler needed for focus lost since this class has no state that depends on it.
gFocusMgr.setMouseCapture( this );
mDragStartThumbRect = mThumbRects[mCurSlider];
}
}
make_ui_sound("UISndClick");
@ -551,7 +563,7 @@ void LLMultiSlider::draw()
thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f);
// draw the highlight
if (hasFocus())
if (hasFocus() && !mCurSlider.empty())
{
thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
}
@ -583,7 +595,7 @@ void LLMultiSlider::draw()
else
{
// draw highlight
if (hasFocus())
if (hasFocus() && !mCurSlider.empty())
{
thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
}

View File

@ -76,6 +76,7 @@ public:
const std::string& getCurSlider() const { return mCurSlider; }
F32 getCurSliderValue() const { return getSliderValue(mCurSlider); }
void setCurSlider(const std::string& name);
void resetCurSlider();
void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); }
/*virtual*/ void setValue(const LLSD& value);

View File

@ -213,6 +213,11 @@ void LLMultiSliderCtrl::setCurSlider(const std::string& name)
mCurValue = mMultiSlider->getCurSliderValue();
}
void LLMultiSliderCtrl::resetCurSlider()
{
mMultiSlider->resetCurSlider();
}
BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text )
{
BOOL res = FALSE;

View File

@ -84,6 +84,7 @@ public:
const std::string& getCurSlider() const { return mMultiSlider->getCurSlider(); }
F32 getCurSliderValue() const { return mCurValue; }
void setCurSlider(const std::string& name);
void resetCurSlider();
void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); }
virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); }

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,7 @@ class LLLineEditor;
class LLMultiSliderCtrl;
class LLTextBox;
class LLTimeCtrl;
//class LLFlyoutComboBtnCtrl;
typedef std::shared_ptr<LLSettingsBase> LLSettingsBasePtr_t;
@ -52,15 +53,14 @@ public:
typedef boost::signals2::connection connection_t;
LLFloaterEditExtDayCycle(const LLSD &key);
~LLFloaterEditExtDayCycle();
void openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength = S64Seconds(0), S64Seconds dayoffset = S64Seconds(0));
BOOL postBuild();
void onOpen(const LLSD& key);
void onOpen(const LLSD& key);
void onClose(bool app_quitting);
/*TEMP*/
void onUpload();
void onVisibilityChange(BOOL new_visibility);
// /*virtual*/ void draw();
@ -79,8 +79,10 @@ private:
//
// /// refresh the sky presets combobox
// void onButtonApply(LLUICtrl *ctrl, const LLSD &data);
void onBtnSave();
void onBtnCancel();
void onBtnUpload();
void onAddTrack();
void onRemoveTrack();
void onCommitName(class LLLineEditor* caller, void* user_data);
@ -89,49 +91,16 @@ private:
void onFrameSliderCallback(); /// a frame moved or frame selection changed
void selectTrack(U32 track_index);
void clearTabs();
void updateTabs();
void updateSkyTabs();
void updateWaterTabs();
void updateWaterTabs(const LLSettingsWaterPtr_t &p_water);
void updateSkyTabs(const LLSettingsSkyPtr_t &p_sky);
void updateButtons();
void updateSlider(); //track to slider
void updateTimeAndLabel();
void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t setting);
void removeCurrentSliderFrame();
//void updateTrack(); // slider->track, todo: better name
// /// refresh the day cycle combobox
// void refreshDayCyclesList();
//
// /// add a slider to the track
//
// void initCallbacks();
// // LLWLParamKey getSelectedDayCycle();
// bool isNewDay() const;
// void dumpTrack();
// void enableEditing(bool enable);
// void reset();
// void saveRegionDayCycle();
//
// void setApplyProgress(bool started);
// bool getApplyProgress() const;
//
// void onKeyTimeChanged(); /// a key frame's time changed
// void onAddKey(); /// new key added on slider
// void onDeleteKey(); /// a key frame deleted
//
// void onRegionSettingsChange();
// void onRegionChange();
// void onRegionSettingsApplied(bool success);
// void onRegionInfoUpdate();
//
// void onDayCycleNameEdited();
// void onDayCycleSelected();
//
// bool onSaveAnswer(const LLSD& notification, const LLSD& response);
// void onSaveConfirmed();
//
// void onDayCycleListChange();
// void onSkyPresetListChange();
//
// static std::string getRegionName();
LLSettingsDay::ptr_t mSavedDay;
LLSettingsDay::ptr_t mEditDay;
@ -140,11 +109,11 @@ private:
U32 mCurrentTrack;
std::string mLastFrameSlider;
LLButton* mSaveButton;
LLButton* mCancelButton;
LLButton* mSaveButton;
LLButton* mCancelButton;
LLButton* mUploadButton;
edit_commit_signal_t mCommitSignal;
LLButton* mAddFrameButton;
LLButton* mDeleteFrameButton;
LLMultiSliderCtrl* mTimeSlider;
LLMultiSliderCtrl* mFramesSlider;
@ -152,10 +121,14 @@ private:
LLView* mWaterTabLayoutContainer;
LLTextBox* mCurrentTimeLabel;
// LLFlyoutComboBtnCtrl * mFlyoutControl; // not a View!
edit_commit_signal_t mCommitSignal;
// map of sliders to parameters
typedef std::pair<F32, LLSettingsBase::ptr_t> framedata_t;
typedef std::map<std::string, framedata_t> keymap_t;
keymap_t mSliderKeyMap;
keymap_t mSliderKeyMap; //slider keys[old_frames], shadows mFramesSlider
};
#endif // LL_LLFloaterEditExtDayCycle_H

View File

@ -360,8 +360,8 @@ void LLPanelEnvironmentInfo::onBtnEdit()
if (dayeditor)
{
dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1));
dayeditor->openFloater();
dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); //Not needed?
dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal()));
}
}

View File

@ -15,7 +15,7 @@
<string name="hint_edit">To edit your day cycle, adjust the controls below and click "Save".</string>
<!-- Todo: These 5 strings might be subjected to a change to get dynamic labels, consider using layout_stack to get dynamic width adjustment-->
<string name="time_label"> ([TIME] hr)</string>
<string name="time_label"> ([HH]:[MM])</string>
<layout_stack name="test_stack"
width="705"
@ -58,23 +58,19 @@
bevel_style="in"
auto_resize="false"
user_resize="true"
bg_alpha_color="red"
height="150"
min_height="0"
visible="true"
background_visible="true">
visible="true">
<panel name="timeline_layers"
border="false"
follows="left|top"
auto_resize="false"
user_resize="true"
bg_alpha_color="yellow"
height="150"
width="110"
top_pad="0"
min_height="0"
visible="true"
background_visible="true">
visible="true">
<button
follows="left|top"
height="23"
@ -161,43 +157,43 @@
name="p0"
top_pad="5"
value="0%[DSC]"
width="70" />
width="80" />
<text
follows="left|top|right"
height="15"
layout="topleft"
left_pad="49"
left_pad="39"
name="p1"
top_delta="0"
value="25%[DSC]"
width="70" />
width="80" />
<text
follows="left|top|right"
height="15"
layout="topleft"
left_pad="49"
left_pad="39"
name="p2"
top_delta="0"
value="50%[DSC]"
width="70" />
width="80" />
<text
follows="left|top|right"
height="15"
layout="topleft"
left_pad="49"
left_pad="39"
name="p3"
top_delta="0"
value="75%[DSC]"
width="70" />
width="80" />
<text
follows="left|top|right"
height="15"
layout="topleft"
left_pad="49"
left_pad="39"
name="p4"
top_delta="0"
value="100%[DSC]"
width="70" />
width="80" />
<multi_slider
can_edit_text="true"
decimal_digits="0"
@ -490,7 +486,22 @@
layout="topleft"
left_pad="10"
name="upload_btn"
width="100" />
width="100" />
<!--<button
follows="top|left"
height="23"
name="btn_flyout"
label=""
layout="topleft"
left_pad="-20"
top="0"
image_selected="SegmentedBtn_Right_Selected_Press"
image_unselected="SegmentedBtn_Right_Off"
image_pressed="SegmentedBtn_Right_Press"
image_pressed_selected="SegmentedBtn_Right_Selected_Press"
image_overlay="Arrow_Small_Up"
width="20"/>-->
</layout_panel>
</layout_stack>