mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-11 11:47:41 -05:00
Fix macro action paste happening in the wrong section
Instead of checking the cursor position at the time of the paste, it needed to be checked at the time of the context menu creation to ensure the segment gets pasted into the correct section
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "macro-segment-copy-paste.hpp"
|
||||
#include "advanced-scene-switcher.hpp"
|
||||
#include "macro.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QShortcut>
|
||||
|
||||
@@ -76,22 +75,10 @@ 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;
|
||||
@@ -111,6 +98,21 @@ bool MacroActionIsInClipboard()
|
||||
copyInfo.type == MacroSegmentCopyInfo::Type::ELSE;
|
||||
}
|
||||
|
||||
void SetCopySegmentTargetActionType(bool setToElseAction)
|
||||
{
|
||||
if (copyInfo.type == MacroSegmentCopyInfo::Type::ACTION &&
|
||||
setToElseAction) {
|
||||
copyInfo.type = MacroSegmentCopyInfo::Type::ELSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (copyInfo.type == MacroSegmentCopyInfo::Type::ELSE &&
|
||||
!setToElseAction) {
|
||||
copyInfo.type = MacroSegmentCopyInfo::Type::ACTION;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SetupSegmentCopyPasteShortcutHandlers(AdvSceneSwitcher *window)
|
||||
{
|
||||
auto copyShortcut = new QShortcut(QKeySequence("Ctrl+C"), window);
|
||||
|
||||
Reference in New Issue
Block a user