1// Aseprite
2// Copyright (C) 2020-2021 Igara Studio S.A.
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifndef APP_UI_DYNAMICS_POPUP_H_INCLUDED
8#define APP_UI_DYNAMICS_POPUP_H_INCLUDED
9#pragma once
10
11#include "app/tools/dynamics.h"
12#include "app/tools/velocity.h"
13#include "app/ui/button_set.h"
14#include "base/time.h"
15#include "doc/brush.h"
16#include "gfx/region.h"
17#include "ui/popup_window.h"
18
19namespace app {
20 namespace gen {
21 class Dynamics;
22 }
23
24 class DitheringSelector;
25
26 class DynamicsPopup : public ui::PopupWindow {
27 public:
28 class Delegate {
29 public:
30 virtual ~Delegate() { }
31 virtual doc::BrushRef getActiveBrush() = 0;
32 virtual void setMaxSize(int size) = 0;
33 virtual void setMaxAngle(int angle) = 0;
34 };
35 DynamicsPopup(Delegate* delegate);
36
37 tools::DynamicsOptions getDynamics() const;
38 void setOptionsGridVisibility(bool state);
39
40 private:
41 class ThresholdSlider;
42
43 void setCheck(int i, bool state);
44 bool isCheck(int i) const;
45 void onValuesChange(ButtonSet::Item* item);
46 void updateFromToText();
47 void updateWidgetsWithBrush();
48 bool onProcessMessage(ui::Message* msg) override;
49
50 Delegate* m_delegate;
51 gen::Dynamics* m_dynamics;
52 DitheringSelector* m_ditheringSel;
53 gfx::Region m_hotRegion;
54 ThresholdSlider* m_pressureThreshold;
55 ThresholdSlider* m_velocityThreshold;
56 tools::VelocitySensor m_velocity;
57 tools::ColorFromTo m_fromTo;
58 };
59
60} // namespace app
61
62#endif
63