mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
(continue) Migrating clipboard manipulation to Session XML management
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
|
||||
#include <tinyxml2.h>
|
||||
#include "tinyxml2Toolkit.h"
|
||||
|
||||
#include "defines.h"
|
||||
#include "Log.h"
|
||||
#include "Scene.h"
|
||||
@@ -21,6 +24,8 @@
|
||||
#include "PatternSource.h"
|
||||
#include "DeviceSource.h"
|
||||
#include "NetworkSource.h"
|
||||
#include "SessionCreator.h"
|
||||
#include "SessionVisitor.h"
|
||||
#include "Settings.h"
|
||||
#include "Mixer.h"
|
||||
#include "ActionManager.h"
|
||||
@@ -237,11 +242,7 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
{
|
||||
ImGui::PushID(std::to_string(n.id()).c_str());
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(6, 2)) {
|
||||
ImageProcessingShader defaultvalues;
|
||||
n = defaultvalues;
|
||||
Action::manager().store("Reset Filters");
|
||||
}
|
||||
ImGuiToolkit::Icon(6, 2);
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::Text("Filters");
|
||||
|
||||
@@ -463,13 +464,45 @@ void ImGuiVisitor::visit (Source& s)
|
||||
}
|
||||
s.setImageProcessingEnabled(on);
|
||||
|
||||
ImGui::SetCursorPosY(pos.y + preview_height); // ...come back
|
||||
|
||||
// image processing pannel
|
||||
if (s.imageProcessingEnabled())
|
||||
s.processingShader()->accept(*this);
|
||||
if (s.imageProcessingEnabled()) {
|
||||
|
||||
// geometry direct control
|
||||
// menu icon for image processing
|
||||
ImGui::SetCursorPos( ImVec2( preview_width - ImGui::GetTextLineHeight(), pos.y + 4.5f * ImGui::GetFrameHeightWithSpacing())); // ...come back
|
||||
if (ImGuiToolkit::IconButton(5, 8))
|
||||
ImGui::OpenPopup( "MenuImageProcessing" );
|
||||
if (ImGui::BeginPopup( "MenuImageProcessing" ))
|
||||
{
|
||||
if (ImGui::MenuItem("Reset" )){
|
||||
ImageProcessingShader defaultvalues;
|
||||
s.processingShader()->copy(defaultvalues);
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": " << "Reset Filter";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::MenuItem("Copy" )){
|
||||
std::string clipboard = SessionVisitor::getClipboard(s.processingShader());
|
||||
if (!clipboard.empty())
|
||||
ImGui::SetClipboardText(clipboard.c_str());
|
||||
}
|
||||
const char *clipboard = ImGui::GetClipboardText();
|
||||
const bool can_paste = (clipboard != nullptr && SessionLoader::isClipboard(clipboard));
|
||||
if (ImGui::MenuItem("Paste", NULL, false, can_paste)) {
|
||||
SessionLoader::applyImageProcessing(s, clipboard);
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": " << "Change Filter";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
// full panel for image processing
|
||||
ImGui::SetCursorPos( ImVec2( pos.x, pos.y + preview_height)); // ...come back
|
||||
s.processingShader()->accept(*this);
|
||||
}
|
||||
|
||||
// geometry direct control for DEBUG
|
||||
// s.groupNode(View::GEOMETRY)->accept(*this);
|
||||
// s.groupNode((View::Mode) Settings::application.current_view)->accept(*this);
|
||||
|
||||
|
||||
@@ -258,12 +258,12 @@ void UserInterface::handleKeyboard()
|
||||
Action::manager().undo();
|
||||
}
|
||||
else if (ImGui::IsKeyPressed( GLFW_KEY_C )) {
|
||||
std::string clipboard = Mixer::selection().xml();
|
||||
std::string clipboard = Mixer::selection().clipboard();
|
||||
if (!clipboard.empty())
|
||||
ImGui::SetClipboardText(clipboard.c_str());
|
||||
}
|
||||
else if (ImGui::IsKeyPressed( GLFW_KEY_X )) {
|
||||
std::string clipboard = Mixer::selection().xml();
|
||||
std::string clipboard = Mixer::selection().clipboard();
|
||||
if (!clipboard.empty()) {
|
||||
ImGui::SetClipboardText(clipboard.c_str());
|
||||
Mixer::manager().deleteSelection();
|
||||
@@ -787,10 +787,10 @@ void UserInterface::showMenuEdit()
|
||||
{
|
||||
bool has_selection = !Mixer::selection().empty();
|
||||
const char *clipboard = ImGui::GetClipboardText();
|
||||
bool has_clipboard = (clipboard != nullptr && strlen(clipboard) > 0 && Mixer::manager().isClipboard(clipboard));
|
||||
bool has_clipboard = (clipboard != nullptr && strlen(clipboard) > 0 && SessionLoader::isClipboard(clipboard));
|
||||
|
||||
if (ImGui::MenuItem( ICON_FA_CUT " Cut", CTRL_MOD "X", false, has_selection)) {
|
||||
std::string copied_text = Mixer::selection().xml();
|
||||
std::string copied_text = Mixer::selection().clipboard();
|
||||
if (!copied_text.empty()) {
|
||||
ImGui::SetClipboardText(copied_text.c_str());
|
||||
Mixer::manager().deleteSelection();
|
||||
@@ -798,7 +798,7 @@ void UserInterface::showMenuEdit()
|
||||
navigator.hidePannel();
|
||||
}
|
||||
if (ImGui::MenuItem( ICON_FA_COPY " Copy", CTRL_MOD "C", false, has_selection)) {
|
||||
std::string copied_text = Mixer::selection().xml();
|
||||
std::string copied_text = Mixer::selection().clipboard();
|
||||
if (!copied_text.empty())
|
||||
ImGui::SetClipboardText(copied_text.c_str());
|
||||
navigator.hidePannel();
|
||||
|
||||
Reference in New Issue
Block a user