mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 06:39:42 +00:00
Merge branch 'master' into inventoryGUI
This commit is contained in:
commit
f300a5621c
10 changed files with 97 additions and 59 deletions
|
@ -60,6 +60,10 @@ StatsWindow::StatsWindow (WindowManager& parWindowManager)
|
|||
getWidget(skillAreaWidget, "Skills");
|
||||
getWidget(skillClientWidget, "SkillClient");
|
||||
getWidget(skillScrollerWidget, "SkillScroller");
|
||||
getWidget(mLeftPane, "LeftPane");
|
||||
getWidget(mRightPane, "RightPane");
|
||||
|
||||
skillClientWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||
|
||||
skillScrollerWidget->eventScrollChangePosition += MyGUI::newDelegate(this, &StatsWindow::onScrollChangePosition);
|
||||
updateScroller();
|
||||
|
@ -91,8 +95,22 @@ void StatsWindow::onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos)
|
|||
}
|
||||
}
|
||||
|
||||
void StatsWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (skillScrollerWidget->getScrollPosition() - _rel*0.3 < 0)
|
||||
skillScrollerWidget->setScrollPosition(0);
|
||||
else if (skillScrollerWidget->getScrollPosition() - _rel*0.3 > skillScrollerWidget->getScrollRange()-1)
|
||||
skillScrollerWidget->setScrollPosition(skillScrollerWidget->getScrollRange()-1);
|
||||
else
|
||||
skillScrollerWidget->setScrollPosition(skillScrollerWidget->getScrollPosition() - _rel*0.3);
|
||||
|
||||
onScrollChangePosition(skillScrollerWidget, skillScrollerWidget->getScrollPosition());
|
||||
}
|
||||
|
||||
void StatsWindow::onWindowResize(MyGUI::Window* window)
|
||||
{
|
||||
mLeftPane->setCoord( MyGUI::IntCoord(0, 0, 0.44*window->getSize().width, window->getSize().height) );
|
||||
mRightPane->setCoord( MyGUI::IntCoord(0.44*window->getSize().width, 0, 0.56*window->getSize().width, window->getSize().height) );
|
||||
updateScroller();
|
||||
}
|
||||
|
||||
|
@ -233,6 +251,7 @@ void StatsWindow::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
|||
MyGUI::ImageBox* separator = skillClientWidget->createWidget<MyGUI::ImageBox>("MW_HLine",
|
||||
MyGUI::IntCoord(10, coord1.top, coord1.width + coord2.width - 4, 18),
|
||||
MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
|
||||
separator->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||
skillWidgets.push_back(separator);
|
||||
|
||||
coord1.top += separator->getHeight();
|
||||
|
@ -245,6 +264,7 @@ void StatsWindow::addGroup(const std::string &label, MyGUI::IntCoord &coord1, My
|
|||
MyGUI::IntCoord(0, coord1.top, coord1.width + coord2.width, coord1.height),
|
||||
MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
|
||||
groupWidget->setCaption(label);
|
||||
groupWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||
skillWidgets.push_back(groupWidget);
|
||||
|
||||
coord1.top += lineHeight;
|
||||
|
@ -259,12 +279,14 @@ MyGUI::TextBox* StatsWindow::addValueItem(const std::string& text, const std::st
|
|||
skillNameWidget->setCaption(text);
|
||||
skillNameWidget->setUserString("ToolTipType", "Text");
|
||||
skillNameWidget->setUserString("ToolTipText", tooltip);
|
||||
skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||
|
||||
skillValueWidget = skillClientWidget->createWidget<MyGUI::TextBox>("SandTextRight", coord2, MyGUI::Align::Right | MyGUI::Align::Top);
|
||||
skillValueWidget->setUserString("ToolTipType", "Text");
|
||||
skillValueWidget->setUserString("ToolTipText", tooltip);
|
||||
skillValueWidget->setCaption(value);
|
||||
skillValueWidget->_setWidgetState(state);
|
||||
skillValueWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||
|
||||
skillWidgets.push_back(skillNameWidget);
|
||||
skillWidgets.push_back(skillValueWidget);
|
||||
|
@ -281,6 +303,7 @@ void StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI
|
|||
|
||||
skillNameWidget = skillClientWidget->createWidget<MyGUI::TextBox>("SandText", coord1 + MyGUI::IntSize(coord2.width, 0), MyGUI::Align::Default);
|
||||
skillNameWidget->setCaption(text);
|
||||
skillNameWidget->eventMouseWheel += MyGUI::newDelegate(this, &StatsWindow::onMouseWheel);
|
||||
|
||||
skillWidgets.push_back(skillNameWidget);
|
||||
|
||||
|
@ -366,7 +389,7 @@ void StatsWindow::updateSkillArea()
|
|||
if (!skillWidgets.empty())
|
||||
addSeparator(coord1, coord2);
|
||||
|
||||
addGroup(mWindowManager.getGameSettingString("sSign", "Sign"), coord1, coord2);
|
||||
addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2);
|
||||
const ESM::BirthSign *sign = store.birthSigns.find(birthSignId);
|
||||
addItem(sign->name, coord1, coord2);
|
||||
}
|
||||
|
@ -390,6 +413,8 @@ void StatsWindow::updateScroller()
|
|||
{
|
||||
skillScrollerWidget->setScrollRange(std::max(clientHeight - skillClientWidget->getHeight(), 0));
|
||||
skillScrollerWidget->setScrollPage(std::max(skillClientWidget->getHeight() - lineHeight, 0));
|
||||
if (clientHeight != 0)
|
||||
skillScrollerWidget->setTrackSize( (skillAreaWidget->getHeight() / float(clientHeight)) * skillScrollerWidget->getLineSize() );
|
||||
}
|
||||
|
||||
void StatsWindow::onPinToggled()
|
||||
|
|
|
@ -54,9 +54,13 @@ namespace MWGui
|
|||
|
||||
void onScrollChangePosition(MyGUI::ScrollBar* scroller, size_t pos);
|
||||
void onWindowResize(MyGUI::Window* window);
|
||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||
|
||||
static const int lineHeight;
|
||||
|
||||
MyGUI::Widget* mLeftPane;
|
||||
MyGUI::Widget* mRightPane;
|
||||
|
||||
MyGUI::WidgetPtr skillAreaWidget, skillClientWidget;
|
||||
MyGUI::ScrollBar* skillScrollerWidget;
|
||||
int lastPos, clientHeight;
|
||||
|
|
|
@ -45,7 +45,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end()
|
|||
return ContainerStoreIterator (this);
|
||||
}
|
||||
|
||||
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2) const
|
||||
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
|
||||
{
|
||||
/// \todo add current weapon/armor health, remaining lockpick/repair uses, current enchantment charge here as soon as they are implemented
|
||||
if ( ptr1.mCellRef->refID == ptr2.mCellRef->refID
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace MWWorld
|
|||
void addImpl (const Ptr& ptr);
|
||||
///< Add the item to this container (no stacking)
|
||||
|
||||
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2) const;
|
||||
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2);
|
||||
///< @return true if the two specified objects can stack with each other
|
||||
/// @note ptr1 is the item that is already in this container
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ void MWWorld::InventoryStore::autoEquip (const MWMechanics::NpcStats& stats)
|
|||
}
|
||||
}
|
||||
|
||||
bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2) const
|
||||
bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
|
||||
{
|
||||
bool canStack = MWWorld::ContainerStore::stacks(ptr1, ptr2);
|
||||
if (!canStack)
|
||||
|
@ -211,7 +211,7 @@ bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2) const
|
|||
for (TSlots::const_iterator iter (mSlots.begin());
|
||||
iter!=mSlots.end(); ++iter)
|
||||
{
|
||||
if (ptr1 == **iter)
|
||||
if (*iter != end() && ptr1 == **iter)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace MWWorld
|
|||
|
||||
protected:
|
||||
|
||||
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2) const;
|
||||
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2);
|
||||
///< @return true if the two specified objects can stack with each other
|
||||
/// @note ptr1 is the item that is already in this container
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<Widget type="ImageBox" skin="ImageBox" position_real="0 0 1 1" align="Top|Right" name="BookImage">
|
||||
<Property key="ImageTexture" value="textures\tx_menubook.dds"/>
|
||||
|
||||
<Widget type="Button" skin="ButtonImage" position="251 220 96 24" name="NextPageBTN">
|
||||
<Widget type="Button" skin="ButtonImage" position="251 220 57 24" name="NextPageBTN">
|
||||
<Property key="ImageResource" value="MenuBook_Next"/>
|
||||
</Widget>
|
||||
<Widget type="Button" skin="ButtonImage" position="165 220 96 24" name="PrevPageBTN">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<Widget type="ImageBox" skin="ImageBox" position_real="0 0 1 1" align="Top|Right" name="JImage">
|
||||
<Property key="ImageTexture" value="textures\tx_menubook.dds"/>
|
||||
|
||||
<Widget type="Button" skin="ButtonImage" position="370 220 96 24" name="NextPageBTN">
|
||||
<Widget type="Button" skin="ButtonImage" position="370 220 57 24" name="NextPageBTN">
|
||||
<Property key="ImageResource" value="MenuBook_Next"/>
|
||||
</Widget>
|
||||
<Widget type="Button" skin="ButtonImage" position="80 220 96 24" name="PrevPageBTN">
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</Resource>
|
||||
|
||||
<Resource type="ResourceImageSet" name="MenuBook_Next">
|
||||
<Group name="States" texture="mwgui1" size="96 24">
|
||||
<Group name="States" texture="mwgui1" size="57 24">
|
||||
<Index name="disabled">
|
||||
<Frame point="256 32"/>
|
||||
</Index>
|
||||
|
|
|
@ -3,59 +3,68 @@
|
|||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 500 342" name="_Main">
|
||||
|
||||
<!-- Player health stats -->
|
||||
<Widget type="Widget" skin="MW_Box" position="8 8 212 62">
|
||||
<Widget type="TextBox" skin="NormalText" position="4 4 70 18" name="Health_str"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 22 70 18" name="Magicka_str"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 40 70 18" name="Fatigue_str"/>
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Red" position="78 4 130 18" name="HBar"/>
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="78 22 130 18" name="MBar"/>
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Green" position="78 40 130 18" name="FBar"/>
|
||||
<Widget type="TextBox" skin="ProgressText" position="78 4 130 18" align="Center" name="HBarT"/>
|
||||
<Widget type="TextBox" skin="ProgressText" position="78 22 130 18" align="Center" name="MBarT"/>
|
||||
<Widget type="TextBox" skin="ProgressText" position="78 40 130 18" align="Center" name="FBarT"/>
|
||||
<Widget type="Widget" skin="" name="LeftPane" position="0 0 220 342">
|
||||
|
||||
<!-- Player health stats -->
|
||||
<Widget type="Widget" skin="MW_Box" position="8 8 212 62" align="Left Top HStretch">
|
||||
<Widget type="TextBox" skin="NormalText" position="4 4 70 18" name="Health_str" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 22 70 18" name="Magicka_str" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 40 70 18" name="Fatigue_str" align="Left Top HStretch"/>
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Red" position="78 4 130 18" name="HBar" align="Right Top"/>
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="78 22 130 18" name="MBar" align="Right Top"/>
|
||||
<Widget type="ProgressBar" skin="MW_Progress_Green" position="78 40 130 18" name="FBar" align="Right Top"/>
|
||||
<Widget type="TextBox" skin="ProgressText" position="78 4 130 18" name="HBarT" align="Right Top"/>
|
||||
<Widget type="TextBox" skin="ProgressText" position="78 22 130 18" name="MBarT" align="Right Top"/>
|
||||
<Widget type="TextBox" skin="ProgressText" position="78 40 130 18" name="FBarT" align="Right Top"/>
|
||||
</Widget>
|
||||
|
||||
<!-- Player level, race and class -->
|
||||
<Widget type="Widget" skin="MW_Box" position="8 78 212 62" align="Left Top HStretch">
|
||||
<Widget type="TextBox" skin="NormalText" position="4 4 100 18" name="Level_str" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 22 100 18" name="Race_str" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 40 100 18" name="Class_str" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="104 4 104 18" name="LevelText" align="Right Top"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="104 22 104 18" name="RaceText" align="Right Top"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="104 40 104 18" name="ClassText" align="Right Top"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="Widget" skin="MW_Box" position="8 148 212 152" align="Left Top Stretch">
|
||||
<Widget type="TextBox" skin="SandText" position="4 4 160 18" name="Attrib1" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 4 44 18" name="AttribVal1" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 22 160 18" name="Attrib2" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 22 44 18" name="AttribVal2" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 40 160 18" name="Attrib3" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 40 44 18" name="AttribVal3" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 58 160 18" name="Attrib4" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 58 44 18" name="AttribVal4" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 76 160 18" name="Attrib5" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 76 44 18" name="AttribVal5" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 94 160 18" name="Attrib6" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 94 44 18" name="AttribVal6" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 112 160 18" name="Attrib7" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 112 44 18" name="AttribVal7" align="Right Top"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 130 160 18" name="Attrib8" align="Left Top HStretch"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 130 44 18" name="AttribVal8" align="Right Top"/>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
|
||||
<!-- Player level, race and class -->
|
||||
<Widget type="Widget" skin="MW_Box" position="8 78 212 62">
|
||||
<Widget type="TextBox" skin="NormalText" position="4 4 100 18" name="Level_str"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 22 100 18" name="Race_str"/>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 40 100 18" name="Class_str"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="104 4 104 18" name="LevelText"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="104 22 104 18" name="RaceText"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="104 40 104 18" name="ClassText"/>
|
||||
<Widget type="Widget" skin="" name="RightPane" position="220 0 280 342">
|
||||
|
||||
<!-- Player skills, factions, birthsign and reputation -->
|
||||
<Widget type="Widget" skin="MW_Box" position="8 8 248 292" align="ALIGN_LEFT ALIGN_STRETCH" name="Skills">
|
||||
<Widget type="Widget" skin="" position="4 4 222 284" align="ALIGN_LEFT ALIGN_TOP ALIGN_STRETCH" name="SkillClient" />
|
||||
<Widget type="ScrollBar" skin="MW_VScroll" position="230 4 14 284" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="SkillScroller" />
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
|
||||
<Widget type="Widget" skin="MW_Box" position="8 148 212 152" align="ALIGN_LEFT ALIGN_TOP ALIGN_VSTRETCH">
|
||||
<Widget type="TextBox" skin="SandText" position="4 4 160 18" name="Attrib1"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 4 44 18" name="AttribVal1"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 22 160 18" name="Attrib2"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 22 44 18" name="AttribVal2"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 40 160 18" name="Attrib3"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 40 44 18" name="AttribVal3"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 58 160 18" name="Attrib4"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 58 44 18" name="AttribVal4"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 76 160 18" name="Attrib5"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 76 44 18" name="AttribVal5"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 94 160 18" name="Attrib6"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 94 44 18" name="AttribVal6"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 112 160 18" name="Attrib7"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 112 44 18" name="AttribVal7"/>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="4 130 160 18" name="Attrib8"/>
|
||||
<Widget type="TextBox" skin="SandTextRight" position="164 130 44 18" name="AttribVal8"/>
|
||||
</Widget>
|
||||
|
||||
<!-- Player skills, factions, birthsign and reputation -->
|
||||
<Widget type="Widget" skin="MW_Box" position="228 8 248 292" align="ALIGN_LEFT ALIGN_STRETCH" name="Skills">
|
||||
<Widget type="Widget" skin="" position="4 4 222 284" align="ALIGN_STRETCH" name="SkillClient" />
|
||||
<Widget type="ScrollBar" skin="MW_VScroll" position="230 4 14 284" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="SkillScroller" />
|
||||
</Widget>
|
||||
</Widget>
|
||||
</MyGUI>
|
||||
|
|
Loading…
Reference in a new issue