mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 23:26:43 +00:00 
			
		
		
		
	use the new scrollbar; range dependent step size; fix
This commit is contained in:
		
							parent
							
								
									b43f41c2bd
								
							
						
					
					
						commit
						26bd2a5301
					
				
					 11 changed files with 67 additions and 32 deletions
				
			
		|  | @ -899,6 +899,7 @@ namespace MWGui | |||
|             : mEnableRepeat(true) | ||||
|             , mRepeatTriggerTime(0.5) | ||||
|             , mRepeatStepTime(0.1) | ||||
|             , mStepSize(0) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|  | @ -908,12 +909,18 @@ namespace MWGui | |||
| 
 | ||||
|         void MWScrollBar::initialiseOverride() | ||||
|         { | ||||
|             Base::initialiseOverride(); | ||||
|             ScrollBar::initialiseOverride(); | ||||
| 
 | ||||
|             mWidgetStart->eventMouseButtonPressed += MyGUI::newDelegate(this, &MWScrollBar::onDecreaseButtonPressed); | ||||
|             mWidgetStart->eventMouseButtonReleased += MyGUI::newDelegate(this, &MWScrollBar::onDecreaseButtonReleased); | ||||
|             mWidgetEnd->eventMouseButtonPressed += MyGUI::newDelegate(this, &MWScrollBar::onIncreaseButtonPressed); | ||||
|             mWidgetEnd->eventMouseButtonReleased += MyGUI::newDelegate(this, &MWScrollBar::onIncreaseButtonReleased); | ||||
|             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::setEnableRepeat(bool enable) | ||||
|  | @ -938,17 +945,42 @@ namespace MWGui | |||
|             mRepeatStepTime = step; | ||||
|         } | ||||
| 
 | ||||
|         void MWScrollBar::setStepSize(int step) | ||||
|         { | ||||
|             mStepSize = step; | ||||
|         } | ||||
| 
 | ||||
|         int MWScrollBar::getStepSize() | ||||
|         { | ||||
|             return mStepSize; | ||||
|         } | ||||
| 
 | ||||
|         void MWScrollBar::repeatClick(MyGUI::Widget* _widget, MyGUI::ControllerItem* _controller) | ||||
|         { | ||||
|             int stepSize = mStepSize; | ||||
|             if(stepSize == 0) | ||||
|                 stepSize = mScrollRange/20; | ||||
| 
 | ||||
|             if(mIsIncreasing && mScrollPosition < mScrollRange-1) | ||||
|             { | ||||
|                 mScrollPosition += 1; | ||||
|                 if(mScrollPosition + stepSize > mScrollRange-1) | ||||
|                     mScrollPosition = mScrollRange-1; | ||||
|                 else | ||||
|                     mScrollPosition += stepSize; | ||||
| 
 | ||||
|                 eventScrollChangePosition(this, mScrollPosition); | ||||
|                 updateTrack(); | ||||
|             } | ||||
|             else if(!mIsIncreasing && mScrollPosition > 0) | ||||
|             { | ||||
|                 mScrollPosition -= 1; | ||||
|                 int newPos = mScrollPosition - stepSize; | ||||
|                 if(newPos < 0) | ||||
|                     mScrollPosition = 0; | ||||
|                 else | ||||
|                     mScrollPosition -= stepSize; | ||||
| 
 | ||||
|                 eventScrollChangePosition(this, mScrollPosition); | ||||
|                 updateTrack(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -422,6 +422,8 @@ namespace MWGui | |||
|             bool getEnableRepeat(); | ||||
|             void getRepeat(float &trigger, float &step); | ||||
|             void setRepeat(float trigger, float step); | ||||
|             void setStepSize(int step); | ||||
|             int getStepSize(); | ||||
| 
 | ||||
|         protected: | ||||
|             virtual void initialiseOverride(); | ||||
|  | @ -431,6 +433,7 @@ namespace MWGui | |||
|             float mRepeatTriggerTime; | ||||
|             float mRepeatStepTime; | ||||
|             bool mIsIncreasing; | ||||
|             int mStepSize; | ||||
| 
 | ||||
|         private: | ||||
|             void onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id); | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| 
 | ||||
|         <!-- Sliders --> | ||||
|         <!-- Rotation of head --> | ||||
|         <Widget type="ScrollBar" skin="MW_HScroll" position="8 270 241 14" name="HeadRotate"/> | ||||
|         <Widget type="MWScrollBar" skin="MW_HScroll" position="8 270 241 14" name="HeadRotate"/> | ||||
| 
 | ||||
|         <!-- Gender choice --> | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
|             <Property key="TextAlign" value="Center"/> | ||||
|         </Widget> | ||||
| 
 | ||||
|         <Widget type="ScrollBar" skin="MW_HScroll" position="28 60 544 18" name="CountSlider" align="Left Top HStretch"> | ||||
|         <Widget type="MWScrollBar" skin="MW_HScroll" position="28 60 544 18" name="CountSlider" align="Left Top HStretch"> | ||||
|             <Property key="MoveToClick" value="true"/> | ||||
|         </Widget> | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
|             </Widget> | ||||
|         </Widget> | ||||
| 
 | ||||
|         <Widget type="ScrollBar" skin="MW_VScroll" position="404 13 14 371" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"> | ||||
|         <Widget type="MWScrollBar" skin="MW_VScroll" position="404 13 14 371" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"> | ||||
|             <Property key="Visible" value="false"/> | ||||
|         </Widget> | ||||
| 
 | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ | |||
| 
 | ||||
|         <Child type="TextBox" skin="MW_TextBoxEditClient" offset = "2 2 490 18" align = "Stretch" name = "Client"/> | ||||
| 
 | ||||
|         <Child type="ScrollBar" skin="MW_VScroll" offset = "494 3 14 14" align = "Right VStretch" name = "VScroll"/> | ||||
|         <Child type="MWScrollBar" skin="MW_VScroll" offset = "494 3 14 14" align = "Right VStretch" name = "VScroll"/> | ||||
| 
 | ||||
|     </Skin> | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ | |||
|                 <Property key="TextAlign" value="Center"/> | ||||
|                 <Property key="Caption" value="0"/> | ||||
|             </Widget> | ||||
|             <Widget type="ScrollBar" skin="MW_HScroll" position="122 20 210 13" name="MagnitudeMinSlider"> | ||||
|             <Widget type="MWScrollBar" skin="MW_HScroll" position="122 20 210 13" name="MagnitudeMinSlider"> | ||||
|                 <Property key="Range" value="100"/> | ||||
|             </Widget> | ||||
| 
 | ||||
|  | @ -39,7 +39,7 @@ | |||
|                 <Property key="TextAlign" value="Center"/> | ||||
|                 <Property key="Caption" value="0"/> | ||||
|             </Widget> | ||||
|             <Widget type="ScrollBar" skin="MW_HScroll" position="122 52 210 13" name="MagnitudeMaxSlider"> | ||||
|             <Widget type="MWScrollBar" skin="MW_HScroll" position="122 52 210 13" name="MagnitudeMaxSlider"> | ||||
|                 <Property key="Range" value="100"/> | ||||
|             </Widget> | ||||
|         </Widget> | ||||
|  | @ -56,7 +56,7 @@ | |||
|                 <Property key="TextAlign" value="Center"/> | ||||
|                 <Property key="Caption" value="0"/> | ||||
|             </Widget> | ||||
|             <Widget type="ScrollBar" skin="MW_HScroll" position="122 20 210 13" name="DurationSlider"> | ||||
|             <Widget type="MWScrollBar" skin="MW_HScroll" position="122 20 210 13" name="DurationSlider"> | ||||
|                 <Property key="Range" value="1440"/> | ||||
|             </Widget> | ||||
|         </Widget> | ||||
|  | @ -72,7 +72,7 @@ | |||
|                 <Property key="TextAlign" value="Center"/> | ||||
|                 <Property key="Caption" value="0"/> | ||||
|             </Widget> | ||||
|             <Widget type="ScrollBar" skin="MW_HScroll" position="122 20 210 13" name="AreaSlider"> | ||||
|             <Widget type="MWScrollBar" skin="MW_HScroll" position="122 20 210 13" name="AreaSlider"> | ||||
|                 <Property key="Range" value="51"/> | ||||
|             </Widget> | ||||
|         </Widget> | ||||
|  |  | |||
|  | @ -120,7 +120,7 @@ | |||
| 
 | ||||
|         <Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="ALIGN_STRETCH"/> | ||||
| 
 | ||||
|         <Child type="ScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"/> | ||||
|         <Child type="MWScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"/> | ||||
| 
 | ||||
|         <Child type="Widget" skin="" offset="3 3 493 509" align="ALIGN_STRETCH" name="Client"/> | ||||
| 
 | ||||
|  | @ -150,7 +150,7 @@ | |||
| 
 | ||||
|         <Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="ALIGN_STRETCH"/> | ||||
| 
 | ||||
|         <Child type="ScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"/> | ||||
|         <Child type="MWScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="VScroll"/> | ||||
| 
 | ||||
|         <Child type="Widget" skin="Default" offset="3 3 493 509" align="ALIGN_STRETCH" name="Client"/> | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|         <Child type="Widget" skin="" offset="0 0 516 516" align="Stretch" name="Client"/> | ||||
| 
 | ||||
|         <!-- invisible scroll bars, needed for setting the view offset --> | ||||
|         <Child type="ScrollBar" skin="" offset="0 0 0 0" align="ALIGN_DEFAULT" name="VScroll"/> | ||||
|         <Child type="ScrollBar" skin="" offset="0 0 0 0" align="ALIGN_DEFAULT" name="HScroll"/> | ||||
|         <Child type="MWScrollBar" skin="" offset="0 0 0 0" align="ALIGN_DEFAULT" name="VScroll"/> | ||||
|         <Child type="MWScrollBar" skin="" offset="0 0 0 0" align="ALIGN_DEFAULT" name="HScroll"/> | ||||
|     </Skin> | ||||
| </MyGUI> | ||||
|  |  | |||
|  | @ -4,12 +4,12 @@ | |||
| 
 | ||||
|     <Skin name="MW_ScrollView" size="516 516"> | ||||
|         <Child type="Widget" skin="" offset="0 0 516 516" align="Stretch" name="Client"/> | ||||
|         <Child type="ScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_TOP ALIGN_VSTRETCH" name="VScroll"/> | ||||
|         <Child type="MWScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="ALIGN_RIGHT ALIGN_TOP ALIGN_VSTRETCH" name="VScroll"/> | ||||
|     </Skin> | ||||
| 
 | ||||
|     <Skin name="MW_ScrollViewH" size="516 516"> | ||||
|         <Child type="Widget" skin="" offset="0 0 516 516" align="Stretch" name="Client"/> | ||||
|         <Child type="ScrollBar" skin="MW_HScroll" offset="3 498 509 14" align="ALIGN_LEFT ALIGN_BOTTOM ALIGN_HSTRETCH" name="HScroll"/> | ||||
|         <Child type="MWScrollBar" skin="MW_HScroll" offset="3 498 509 14" align="ALIGN_LEFT ALIGN_BOTTOM ALIGN_HSTRETCH" name="HScroll"/> | ||||
|     </Skin> | ||||
| 
 | ||||
| </MyGUI> | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
|                 <Widget type="TextBox" skin="NormalText" position="4 4 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sTransparency_Menu}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MenuTransparencySlider"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MenuTransparencySlider"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="TextBox" skin="SandText" position="4 52 352 18" align="Left Top"> | ||||
|  | @ -30,7 +30,7 @@ | |||
|                 <Widget type="TextBox" skin="NormalText" position="4 78 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sMenu_Help_Delay}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 102 352 18" align="Left Top" name="ToolTipDelaySlider"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 102 352 18" align="Left Top" name="ToolTipDelaySlider"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="TextBox" skin="SandText" position="4 126 352 18" align="Left Top"> | ||||
|  | @ -64,35 +64,35 @@ | |||
|                 <Widget type="TextBox" skin="NormalText" position="4 4 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sMaster}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MasterVolume"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 28 352 18" align="Left Top" name="MasterVolume"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
| 
 | ||||
|                 <Widget type="TextBox" skin="NormalText" position="4 54 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sVoice}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 78 352 18" align="Left Top" name="VoiceVolume"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 78 352 18" align="Left Top" name="VoiceVolume"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
| 
 | ||||
|                 <Widget type="TextBox" skin="NormalText" position="4 104 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sEffects}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 128 352 18" align="Left Top" name="EffectsVolume"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 128 352 18" align="Left Top" name="EffectsVolume"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
| 
 | ||||
|                 <Widget type="TextBox" skin="NormalText" position="4 154 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sFootsteps}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 178 352 18" align="Left Top" name="FootstepsVolume"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 178 352 18" align="Left Top" name="FootstepsVolume"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
| 
 | ||||
|                 <Widget type="TextBox" skin="NormalText" position="4 204 352 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="#{sMusic}"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 228 352 18" align="Left Top" name="MusicVolume"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 228 352 18" align="Left Top" name="MusicVolume"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
|             </Widget> | ||||
|  | @ -117,7 +117,7 @@ | |||
|                 <Widget type="TextBox" skin="NormalText" position="4 228 336 18" align="Left Top"> | ||||
|                     <Property key="Caption" value="Camera sensitivity"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="ScrollBar" skin="MW_HScroll" position="4 252 336 18" align="Left Top" name="CameraSensitivitySlider"> | ||||
|                 <Widget type="MWScrollBar" skin="MW_HScroll" position="4 252 336 18" align="Left Top" name="CameraSensitivitySlider"> | ||||
|                     <Property key="Range" value="100"/> | ||||
|                 </Widget> | ||||
|                 <Widget type="TextBox" skin="SandText" position="4 276 336 18" align="Left Top"> | ||||
|  | @ -182,7 +182,7 @@ | |||
|                         <Widget type="TextBox" skin="NormalText" position="4 198 329 18" align="Left Top" name="FovText"> | ||||
|                             <Property key="Caption" value="Field of View"/> | ||||
|                         </Widget> | ||||
|                         <Widget type="ScrollBar" skin="MW_HScroll" position="4 222 329 18" align="Left Top" name="FOVSlider"> | ||||
|                         <Widget type="MWScrollBar" skin="MW_HScroll" position="4 222 329 18" align="Left Top" name="FOVSlider"> | ||||
|                             <Property key="Range" value="100"/> | ||||
|                         </Widget> | ||||
|                         <Widget type="TextBox" skin="SandText" position="4 246 329 18" align="Left Top"> | ||||
|  | @ -207,7 +207,7 @@ | |||
|                             <Widget type="TextBox" skin="SandText" position="0 0 300 24" align="Left Top" name="AnisotropyLabel"> | ||||
|                                 <Property key="Caption" value="Anisotropy"/> | ||||
|                             </Widget> | ||||
|                             <Widget type="ScrollBar" skin="MW_HScroll" position="0 28 150 18" align="Left Top" name="AnisotropySlider"> | ||||
|                             <Widget type="MWScrollBar" skin="MW_HScroll" position="0 28 150 18" align="Left Top" name="AnisotropySlider"> | ||||
|                                 <Property key="Range" value="100"/> | ||||
|                             </Widget> | ||||
|                         </Widget> | ||||
|  | @ -215,7 +215,7 @@ | |||
|                         <Widget type="TextBox" skin="NormalText" position="4 130 322 18" align="Left Top"> | ||||
|                             <Property key="Caption" value="#{sRender_Distance}"/> | ||||
|                         </Widget> | ||||
|                         <Widget type="ScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top" name="ViewDistanceSlider"> | ||||
|                         <Widget type="MWScrollBar" skin="MW_HScroll" position="4 154 322 18" align="Left Top" name="ViewDistanceSlider"> | ||||
|                             <Property key="Range" value="100"/> | ||||
|                         </Widget> | ||||
|                         <Widget type="TextBox" skin="SandText" position="4 178 332 18" align="Left Top"> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue