Skip to content

Commit 9110ec7

Browse files
committed
Temp: Copy preset to clipboard
1 parent 4610e9c commit 9110ec7

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/gui/preset_editor/EditorMenu.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ void EditorMenu::DrawFileMenu()
5959
{
6060
}
6161

62+
if (ImGui::MenuItem(ICON_FA_COPY " Copy Preset to Clipboard"))
63+
{
64+
_presetEditorGUI.CopyToClipboard();
65+
}
66+
6267
ImGui::Separator();
6368

6469
if (ImGui::MenuItem(ICON_FA_CIRCLE_XMARK " Exit Preset Editor"))

src/gui/preset_editor/PresetEditorGUI.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "notifications/DisplayToastNotification.h"
1111
#include "notifications/UpdateWindowTitleNotification.h"
1212

13+
#include <SDL_clipboard.h>
1314
#include <imgui.h>
1415

1516
#include <Poco/NotificationCenter.h>
@@ -123,6 +124,12 @@ void PresetEditorGUI::UpdatePresetPreview()
123124
}
124125
}
125126

127+
void PresetEditorGUI::CopyToClipboard()
128+
{
129+
_editorPreset.ToParsedFile(_presetFile);
130+
SDL_SetClipboardText(_presetFile.AsString().c_str());
131+
}
132+
126133
void PresetEditorGUI::HandleGlobalEditorKeys()
127134
{
128135
ImGuiIO& io = ImGui::GetIO();

src/gui/preset_editor/PresetEditorGUI.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class PresetEditorGUI
4646
*/
4747
void UpdatePresetPreview();
4848

49+
/**
50+
* @brief Reloads the rendered preview with the current changes.
51+
*/
52+
void CopyToClipboard();
53+
4954
private:
5055
void HandleGlobalEditorKeys();
5156
void TakeProjectMControl();

0 commit comments

Comments
 (0)