11namespace tracktion {
inline namespace engine
14bool UIBehaviour::paste (
const Clipboard& clipboard)
16 if (
auto content = clipboard.getContent())
18 if (
auto sm = getCurrentlyFocusedSelectionManager())
20 if (sm->pasteSelected())
23 if (sm->insertPoint !=
nullptr && sm->getEdit() !=
nullptr)
24 return content->pasteIntoEdit (*sm->getEdit(), *sm->insertPoint, sm);
40 #if JUCE_MODAL_LOOPS_PERMITTED
51 #if JUCE_MODAL_LOOPS_PERMITTED
64 bmc->addToDesktop (0);
85 if (commandDesc.
contains (
"right")) delta = TimeDuration::fromSeconds (0.00001);
86 else if (commandDesc.
contains (
"left")) delta = TimeDuration::fromSeconds (-0.00001);
87 else if (commandDesc.
contains (
"up")) trackDelta = -1;
88 else if (commandDesc.
contains (
"down")) trackDelta = 1;
92 int minTrack = 0xffff;
96 for (
int i = clips.
size(); --i >= 0;)
109 if (allTracks.size() - maxTrack < 2)
117 if (automationLocked)
119 for (
auto&& clip : clips)
121 TrackAutomationSection ts (*clip);
123 if (
auto t = allTracks [allTracks.indexOf (clip->getTrack()) + trackDelta])
130 for (
int i = clips.
size(); --i >= 0;)
131 if (
auto targetTrack = allTracks[allTracks.indexOf (clips.
getUnchecked (i)->getTrack()) + trackDelta])
132 if (
auto ct =
dynamic_cast<ClipTrack*
> (targetTrack))
139 else if (delta != TimeDuration())
143 if (automationLocked)
144 for (
auto&& clip : clips)
145 sections.add (TrackAutomationSection (*clip));
151 auto origClip1Start = first->getPosition().getStart();
152 auto clipStart = origClip1Start;
154 if (delta > TimeDuration())
155 first->setStart (snapType.roundTimeUp (origClip1Start + delta, ed.tempoSequence),
false,
true);
157 first->setStart (snapType.roundTimeDown (origClip1Start + delta, ed.tempoSequence),
false,
true);
159 if (clips.
size() > 1)
161 delta = first->getPosition().getStart() - origClip1Start;
163 for (
int i = clips.
size(); --i > 0;)
164 clips[i]->setStart (clips.
getUnchecked (i)->getPosition().getStart() + delta,
false,
true);
168 moveAutomation (sections, first->getPosition().getStart() - clipStart,
false);
177void UIBehaviour::nudgeSelected (TimecodeSnapType snapType,
const juce::String& commandDesc,
bool automationLocked)
179 if (
auto sm = getCurrentlyFocusedSelectionManager())
181 auto clips = sm->getItemsOfType<Clip>();
183 for (
auto cc : sm->getItemsOfType<CollectionClip>())
184 clips.addArray (cc->getClips());
188 if (clips.
size() > 0)
190 nudgeSelectedClips (snapType, commandDesc, *sm, clips, automationLocked);
194 if (
auto s = sm->getFirstItemOfType<SelectedMidiEvents>())
196 int leftRight = 0, upDown = 0;
198 if (commandDesc.
contains (
"right")) leftRight = 1;
199 else if (commandDesc.
contains (
"left")) leftRight = -1;
200 else if (commandDesc.
contains (
"up")) upDown = 1;
201 else if (commandDesc.
contains (
"down")) upDown = -1;
203 s->nudge (snapType, leftRight, upDown);
209void UIBehaviour::nudgeSelected (
const juce::String& commandDesc)
211 if (
auto edit = getCurrentlyFocusedEdit())
212 nudgeSelected (edit->getTransport().getSnapType(), commandDesc,
false);
228 p.windowState->recreateWindowIfShowing();
static int JUCE_CALLTYPE showYesNoCancelBox(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text, const String &button2Text, const String &button3Text, Component *associatedComponent, ModalComponentManager::Callback *callback)
static bool JUCE_CALLTYPE showOkCancelBox(MessageBoxIconType iconType, const String &title, const String &message, const String &button1Text, const String &button2Text, Component *associatedComponent, ModalComponentManager::Callback *callback)
static void JUCE_CALLTYPE showMessageBoxAsync(MessageBoxIconType iconType, const String &title, const String &message, const String &buttonText=String(), Component *associatedComponent=nullptr, ModalComponentManager::Callback *callback=nullptr)
ElementType getUnchecked(int index) const
int size() const noexcept
ElementType getFirst() const noexcept
void add(const ElementType &newElement)
static Desktop &JUCE_CALLTYPE getInstance()
bool contains(StringRef text) const noexcept
The Tracktion Edit class!
TransportControl & getTransport() const noexcept
Returns the TransportControl which is used to stop/stop/position playback and recording.
Manages a list of items that are currently selected.
void keepSelectedObjectsOnScreen()
Scrolls whatever is necessary to keep the selected stuff visible.
TimePosition getPosition() const
Returns the current transport position.
TimeRange getLoopRange() const noexcept
Returns the loop range.
virtual bool showOkCancelAlertBox(const juce::String &title, const juce::String &message, const juce::String &ok={}, const juce::String &cancel={})
Should display a dismissable alert window.
virtual void recreatePluginWindowContentAsync(Plugin &)
Should trigger an asynchronous refresh of any editor components showing for this plugin.
virtual void showInfoMessage(const juce::String &message)
Should display a temporary information message, usually in the same place.
virtual SelectableList getAssociatedClipsToEdit(const SelectableList &items)
If your UI has the concept of edit groups, you should return an expanded list of selected items that ...
virtual TimeRange getEditingRange(Edit &)
Should return the range which used be used for edit operations such as coping or deleting.
virtual void showWarningAlert(const juce::String &title, const juce::String &message)
Should display a dismissable alert window.
virtual int showYesNoCancelAlertBox(const juce::String &title, const juce::String &message, const juce::String &yes={}, const juce::String &no={}, const juce::String &cancel={})
Should display a dismissable alert window.
virtual void showWarningMessage(const juce::String &message)
Should display a temporary warning message.
virtual TimePosition getEditingPosition(Edit &)
Should return the position which used be used for edit operations such as splitting.
juce::Array< Track * > getAllTracks(const Edit &edit)
Returns all the tracks in an Edit.
void moveAutomation(const juce::Array< TrackAutomationSection > &origSections, TimeDuration offset, bool copy)
Moves a set of automation optionally applying an offset and copying the automation (rather than movin...
Represents a duration in real-life time.
Represents a position in real-life time.