| 746 | } |
| 747 | |
| 748 | void CEditor::DoSoundSource(int LayerIndex, CSoundSource *pSource, int Index) |
| 749 | { |
| 750 | static ESoundSourceOp s_Operation = ESoundSourceOp::NONE; |
| 751 | |
| 752 | float CenterX = fx2f(pSource->m_Position.x); |
| 753 | float CenterY = fx2f(pSource->m_Position.y); |
| 754 | |
| 755 | const bool IgnoreGrid = Input()->AltIsPressed(); |
| 756 | |
| 757 | if(s_Operation == ESoundSourceOp::NONE) |
| 758 | { |
| 759 | if(!Ui()->MouseButton(0)) |
| 760 | Map()->m_SoundSourceOperationTracker.End(); |
| 761 | } |
| 762 | |
| 763 | if(Ui()->CheckActiveItem(pSource)) |
| 764 | { |
| 765 | if(s_Operation != ESoundSourceOp::NONE) |
| 766 | { |
| 767 | Map()->m_SoundSourceOperationTracker.Begin(pSource, s_Operation, LayerIndex); |
| 768 | } |
| 769 | |
| 770 | if(m_MouseDeltaWorld != vec2(0.0f, 0.0f)) |
| 771 | { |
| 772 | if(s_Operation == ESoundSourceOp::MOVE) |
| 773 | { |
| 774 | vec2 Pos = Ui()->MouseWorldPos(); |
| 775 | if(MapView()->MapGrid()->IsEnabled() && !IgnoreGrid) |
| 776 | { |
| 777 | MapView()->MapGrid()->SnapToGrid(Pos); |
| 778 | } |
| 779 | pSource->m_Position.x = f2fx(Pos.x); |
| 780 | pSource->m_Position.y = f2fx(Pos.y); |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | if(s_Operation == ESoundSourceOp::CONTEXT_MENU) |
| 785 | { |
| 786 | if(!Ui()->MouseButton(1)) |
| 787 | { |
| 788 | if(Map()->m_vSelectedLayers.size() == 1) |
| 789 | { |
| 790 | static SPopupMenuId s_PopupSourceId; |
| 791 | Ui()->DoPopupMenu(&s_PopupSourceId, Ui()->MouseX(), Ui()->MouseY(), 120, 200, this, PopupSource); |
| 792 | Ui()->DisableMouseLock(); |
| 793 | } |
| 794 | s_Operation = ESoundSourceOp::NONE; |
| 795 | Ui()->SetActiveItem(nullptr); |
| 796 | } |
| 797 | } |
| 798 | else |
| 799 | { |
| 800 | if(!Ui()->MouseButton(0)) |
| 801 | { |
| 802 | Ui()->DisableMouseLock(); |
| 803 | s_Operation = ESoundSourceOp::NONE; |
| 804 | Ui()->SetActiveItem(nullptr); |
| 805 | } |
nothing calls this directly
no test coverage detected