Bläddra i källkod

Removed old code

Ivan Savenko 2 år sedan
förälder
incheckning
e2a85e25fa
3 ändrade filer med 0 tillägg och 115 borttagningar
  1. 0 82
      client/widgets/Buttons.cpp
  2. 0 32
      client/widgets/Buttons.h
  3. 0 1
      client/windows/GUIClasses.h

+ 0 - 82
client/widgets/Buttons.cpp

@@ -473,88 +473,6 @@ int CToggleGroup::getSelected() const
 	return selectedID;
 }
 
-CVolumeSlider::CVolumeSlider(const Point & position, const std::string & defName, const int value, ETooltipMode mode)
-	: CIntObject(LCLICK | RCLICK | WHEEL),
-	value(value),
-	mode(mode)
-{
-	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
-	animImage = std::make_shared<CAnimImage>(std::make_shared<CAnimation>(defName), 0, 0, position.x, position.y),
-	pos.x += position.x;
-	pos.y += position.y;
-	pos.w = (animImage->pos.w + 1) * (int)animImage->size();
-	pos.h = animImage->pos.h;
-	type |= REDRAW_PARENT;
-	setVolume(value);
-}
-
-void CVolumeSlider::setVolume(int value_)
-{
-	value = value_;
-	moveTo((int)(value * static_cast<double>(animImage->size()) / 100.0));
-}
-
-void CVolumeSlider::moveTo(int id)
-{
-	vstd::abetween<int>(id, 0, animImage->size() - 1);
-	animImage->setFrame(id);
-	animImage->moveTo(Point(pos.x + (animImage->pos.w + 1) * id, pos.y));
-	if (isActive())
-		redraw();
-}
-
-void CVolumeSlider::addCallback(std::function<void(int)> callback)
-{
-	onChange += callback;
-}
-
-void CVolumeSlider::clickLeft(tribool down, bool previousState)
-{
-	if (down)
-	{
-		double px = GH.getCursorPosition().x - pos.x;
-		double rx = px / static_cast<double>(pos.w);
-		// setVolume is out of 100
-		setVolume((int)(rx * 100));
-		// Volume config is out of 100, set to increments of 5ish roughly based on the half point of the indicator
-		// 0.0 -> 0, 0.05 -> 5, 0.09 -> 5,...,
-		// 0.1 -> 10, ..., 0.19 -> 15, 0.2 -> 20, ...,
-		// 0.28 -> 25, 0.29 -> 30, 0.3 -> 30, ...,
-		// 0.85 -> 85, 0.86 -> 90, ..., 0.87 -> 90,...,
-		// 0.95 -> 95, 0.96 -> 100, 0.99 -> 100
-		int volume = 5 * int(rx * (2 * animImage->size() + 1));
-		onChange(volume);
-	}
-}
-
-void CVolumeSlider::clickRight(tribool down, bool previousState)
-{
-	if (down)
-	{
-		double px = GH.getCursorPosition().x - pos.x;
-		int index = static_cast<int>(px / static_cast<double>(pos.w) * animImage->size());
-
-		size_t helpIndex = index + (mode == MUSIC ? 326 : 336);
-		std::string helpBox = CGI->generaltexth->translate("core.help", helpIndex, "help" );
-
-		if(!helpBox.empty())
-			CRClickPopup::createAndPush(helpBox);
-
-		GH.statusbar()->write(helpBox);
-	}
-}
-
-void CVolumeSlider::wheelScrolled(bool down, bool in)
-{
-	if (in)
-	{
-		int volume = value + 3 * (down ? 1 : -1);
-		vstd::abetween(volume, 0, 100);
-		setVolume(volume);
-		onChange(volume);
-	}
-}
-
 void CSlider::sliderClicked()
 {
 	addUsedEvents(MOVE);

+ 0 - 32
client/widgets/Buttons.h

@@ -182,38 +182,6 @@ public:
 	int getSelected() const;
 };
 
-/// A typical slider for volume with an animated indicator
-class CVolumeSlider : public CIntObject
-{
-public:
-	enum ETooltipMode
-	{
-		MUSIC,
-		SOUND
-	};
-
-private:
-	int value;
-	CFunctionList<void(int)> onChange;
-	std::shared_ptr<CAnimImage> animImage;
-	ETooltipMode mode;
-	void setVolume(const int v);
-public:
-	/// @param position coordinates of slider
-	/// @param defName name of def animation for slider
-	/// @param value initial value for volume
-	/// @param mode that determines tooltip texts
-	CVolumeSlider(const Point & position, const std::string & defName, const int value, ETooltipMode mode);
-
-	void moveTo(int id);
-	void addCallback(std::function<void(int)> callback);
-
-
-	void clickLeft(tribool down, bool previousState) override;
-	void clickRight(tribool down, bool previousState) override;
-	void wheelScrolled(bool down, bool in) override;
-};
-
 /// A typical slider which can be orientated horizontally/vertically.
 class CSlider : public CIntObject
 {

+ 0 - 1
client/windows/GUIClasses.h

@@ -35,7 +35,6 @@ class CTextInput;
 class CListBox;
 class CLabelGroup;
 class CToggleButton;
-class CVolumeSlider;
 class CGStatusBar;
 class CTextBox;
 class CResDataBar;