mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-20 00:05:41 -05:00
Paste copied macro action depending on cursor position
If cursor is above else action section paste it there. If cursor is above regular action section paste it there. In case of neither paste in original position.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "macro-segment-copy-paste.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QShortcut>
|
||||
|
||||
@@ -74,10 +76,22 @@ void AdvSceneSwitcher::PasteMacroSegment()
|
||||
break;
|
||||
}
|
||||
case MacroSegmentCopyInfo::Type::ACTION:
|
||||
if (IsCursorInWidgetArea(ui->macroElseActions)) {
|
||||
AddMacroElseAction(macro.get(),
|
||||
macro->ElseActions().size(),
|
||||
copyInfo.segment->GetId(),
|
||||
data.Get());
|
||||
break;
|
||||
}
|
||||
AddMacroAction(macro.get(), macro->Actions().size(),
|
||||
copyInfo.segment->GetId(), data.Get());
|
||||
break;
|
||||
case MacroSegmentCopyInfo::Type::ELSE:
|
||||
if (IsCursorInWidgetArea(ui->macroActions)) {
|
||||
AddMacroAction(macro.get(), macro->Actions().size(),
|
||||
copyInfo.segment->GetId(), data.Get());
|
||||
break;
|
||||
}
|
||||
AddMacroElseAction(macro.get(), macro->ElseActions().size(),
|
||||
copyInfo.segment->GetId(), data.Get());
|
||||
break;
|
||||
@@ -91,6 +105,12 @@ bool MacroSegmentIsInClipboard()
|
||||
return copyInfo.type != MacroSegmentCopyInfo::Type::NONE;
|
||||
}
|
||||
|
||||
bool MacroActionIsInClipboard()
|
||||
{
|
||||
return copyInfo.type == MacroSegmentCopyInfo::Type::ACTION ||
|
||||
copyInfo.type == MacroSegmentCopyInfo::Type::ELSE;
|
||||
}
|
||||
|
||||
void SetupSegmentCopyPasteShortcutHandlers(AdvSceneSwitcher *window)
|
||||
{
|
||||
auto copyShortcut = new QShortcut(QKeySequence("Ctrl+C"), window);
|
||||
|
||||
Reference in New Issue
Block a user