diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index b9b6c18e4..6e3e081a9 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -530,99 +530,5 @@ namespace MWGui assignWidget(mBarWidget, "Bar"); assignWidget(mBarTextWidget, "BarText"); } - - MWScrollBar::MWScrollBar() - : mEnableRepeat(true) - , mRepeatTriggerTime(0.5f) - , mRepeatStepTime(0.1f) - , mIsIncreasing(true) - { - ScrollBar::setRepeatEnabled(false); - } - - MWScrollBar::~MWScrollBar() - { - } - - void MWScrollBar::initialiseOverride() - { - ScrollBar::initialiseOverride(); - - if(mWidgetStart) - { - mWidgetStart->eventMouseButtonPressed += MyGUI::newDelegate(this, &MWScrollBar::onDecreaseButtonPressed); - mWidgetStart->eventMouseButtonReleased += MyGUI::newDelegate(this, &MWScrollBar::onDecreaseButtonReleased); - } - if(mWidgetEnd) - { - mWidgetEnd->eventMouseButtonPressed += MyGUI::newDelegate(this, &MWScrollBar::onIncreaseButtonPressed); - mWidgetEnd->eventMouseButtonReleased += MyGUI::newDelegate(this, &MWScrollBar::onIncreaseButtonReleased); - } - } - - void MWScrollBar::setRepeat(float trigger, float step) - { - mRepeatTriggerTime = trigger; - mRepeatStepTime = step; - } - - void MWScrollBar::repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller) - { - int stepSize = mScrollPage; - - if(mIsIncreasing && mScrollPosition < mScrollRange-1) - { - if(mScrollPosition + stepSize > mScrollRange-1) - mScrollPosition = mScrollRange-1; - else - mScrollPosition += stepSize; - - eventScrollChangePosition(this, mScrollPosition); - updateTrack(); - } - else if(!mIsIncreasing && mScrollPosition > 0) - { - int newPos = mScrollPosition - stepSize; - if(newPos < 0) - mScrollPosition = 0; - else - mScrollPosition -= stepSize; - - eventScrollChangePosition(this, mScrollPosition); - updateTrack(); - } - } - - void MWScrollBar::onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) - { - mIsIncreasing = false; - MyGUI::ControllerItem* item = MyGUI::ControllerManager::getInstance().createItem(MWGui::Controllers::ControllerRepeatEvent::getClassTypeName()); - MWGui::Controllers::ControllerRepeatEvent* controller = item->castType(); - controller->eventRepeatClick += newDelegate(this, &MWScrollBar::repeatClick); - controller->setEnabled(mEnableRepeat); - controller->setRepeat(mRepeatTriggerTime, mRepeatStepTime); - MyGUI::ControllerManager::getInstance().addItem(this, controller); - } - - void MWScrollBar::onDecreaseButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) - { - MyGUI::ControllerManager::getInstance().removeItem(this); - } - - void MWScrollBar::onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) - { - mIsIncreasing = true; - MyGUI::ControllerItem* item = MyGUI::ControllerManager::getInstance().createItem(MWGui::Controllers::ControllerRepeatEvent::getClassTypeName()); - MWGui::Controllers::ControllerRepeatEvent* controller = item->castType(); - controller->eventRepeatClick += newDelegate(this, &MWScrollBar::repeatClick); - controller->setEnabled(mEnableRepeat); - controller->setRepeat(mRepeatTriggerTime, mRepeatStepTime); - MyGUI::ControllerManager::getInstance().addItem(this, controller); - } - - void MWScrollBar::onIncreaseButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id) - { - MyGUI::ControllerManager::getInstance().removeItem(this); - } } } diff --git a/apps/openmw/mwgui/widgets.hpp b/apps/openmw/mwgui/widgets.hpp index a39bfad3f..6eab431d6 100644 --- a/apps/openmw/mwgui/widgets.hpp +++ b/apps/openmw/mwgui/widgets.hpp @@ -303,33 +303,6 @@ namespace MWGui MyGUI::TextBox* mBarTextWidget; }; typedef MWDynamicStat* MWDynamicStatPtr; - - // Should be removed when upgrading to MyGUI 3.2.2 (current git), it has ScrollBar autorepeat support - class MWScrollBar : public MyGUI::ScrollBar - { - MYGUI_RTTI_DERIVED(MWScrollBar) - - public: - MWScrollBar(); - virtual ~MWScrollBar(); - - void setRepeat(float trigger, float step); - - protected: - virtual void initialiseOverride(); - void repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller); - - bool mEnableRepeat; - float mRepeatTriggerTime; - float mRepeatStepTime; - bool mIsIncreasing; - - private: - void onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id); - void onDecreaseButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id); - void onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id); - void onIncreaseButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id); - }; } } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f8ebc4748..0f49038da 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -217,7 +217,6 @@ namespace MWGui MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); - MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Layer"); diff --git a/files/mygui/openmw_chargen_race.layout b/files/mygui/openmw_chargen_race.layout index ea7ec6179..3b0a0191f 100644 --- a/files/mygui/openmw_chargen_race.layout +++ b/files/mygui/openmw_chargen_race.layout @@ -14,7 +14,7 @@ - + diff --git a/files/mygui/openmw_count_window.layout b/files/mygui/openmw_count_window.layout index 2e083dcea..d507ad31a 100644 --- a/files/mygui/openmw_count_window.layout +++ b/files/mygui/openmw_count_window.layout @@ -11,7 +11,7 @@ - + diff --git a/files/mygui/openmw_debug_window.skin.xml b/files/mygui/openmw_debug_window.skin.xml index 587101b7f..1421b52a1 100644 --- a/files/mygui/openmw_debug_window.skin.xml +++ b/files/mygui/openmw_debug_window.skin.xml @@ -12,6 +12,6 @@ - + diff --git a/files/mygui/openmw_dialogue_window.layout b/files/mygui/openmw_dialogue_window.layout index 1ed399572..d1f96121e 100644 --- a/files/mygui/openmw_dialogue_window.layout +++ b/files/mygui/openmw_dialogue_window.layout @@ -11,7 +11,7 @@ - + diff --git a/files/mygui/openmw_edit.skin.xml b/files/mygui/openmw_edit.skin.xml index a53becdaa..07c3557e0 100644 --- a/files/mygui/openmw_edit.skin.xml +++ b/files/mygui/openmw_edit.skin.xml @@ -37,7 +37,7 @@ - + @@ -54,7 +54,7 @@ - + diff --git a/files/mygui/openmw_edit_effect.layout b/files/mygui/openmw_edit_effect.layout index c2429d24b..3b26286c4 100644 --- a/files/mygui/openmw_edit_effect.layout +++ b/files/mygui/openmw_edit_effect.layout @@ -37,7 +37,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -87,7 +87,7 @@ - + diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index 9af0e7966..8795d9bbd 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -130,7 +130,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -154,7 +154,7 @@ - + diff --git a/files/mygui/openmw_map_window.skin.xml b/files/mygui/openmw_map_window.skin.xml index f6c099630..cb964758d 100644 --- a/files/mygui/openmw_map_window.skin.xml +++ b/files/mygui/openmw_map_window.skin.xml @@ -6,7 +6,7 @@ - - + + diff --git a/files/mygui/openmw_scroll.skin.xml b/files/mygui/openmw_scroll.skin.xml index cff0ad7eb..f946a61ac 100644 --- a/files/mygui/openmw_scroll.skin.xml +++ b/files/mygui/openmw_scroll.skin.xml @@ -5,13 +5,13 @@ - + - + diff --git a/files/mygui/openmw_settings_window.layout b/files/mygui/openmw_settings_window.layout index 1b9901d8c..ce1fb15ed 100644 --- a/files/mygui/openmw_settings_window.layout +++ b/files/mygui/openmw_settings_window.layout @@ -10,7 +10,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -77,7 +77,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -155,7 +155,7 @@ - + @@ -166,7 +166,7 @@ - + @@ -177,7 +177,7 @@ - + @@ -188,7 +188,7 @@ - + @@ -234,7 +234,7 @@ - + @@ -308,7 +308,7 @@ - + @@ -331,7 +331,7 @@ - + @@ -363,7 +363,7 @@ - + @@ -376,7 +376,7 @@ - + @@ -388,7 +388,7 @@ - + diff --git a/files/mygui/openmw_wait_dialog.layout b/files/mygui/openmw_wait_dialog.layout index b02db3764..460002b87 100644 --- a/files/mygui/openmw_wait_dialog.layout +++ b/files/mygui/openmw_wait_dialog.layout @@ -16,7 +16,7 @@ - +