mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Added undo-redo to locking of sources.
This commit is contained in:
@@ -428,11 +428,11 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
}
|
||||
// pick on the lock icon; unlock source
|
||||
else if ( pick.first == current->lock_ ) {
|
||||
current->setLocked(false);
|
||||
lock(current, false);
|
||||
}
|
||||
// pick on the open lock icon; lock source and cancel pick
|
||||
else if ( pick.first == current->unlock_ ) {
|
||||
current->setLocked(true);
|
||||
lock(current, true);
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
// pick a locked source without CTRL key; cancel pick
|
||||
@@ -452,7 +452,7 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
Source *s = Mixer::manager().findSource((*itp).first);
|
||||
// lock icon of a source (not current) is picked : unlock
|
||||
if ( s!=nullptr && (*itp).first == s->lock_) {
|
||||
s->setLocked(false);
|
||||
lock(s, false);
|
||||
pick = { s->locker_, (*itp).second };
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -443,10 +443,14 @@ void ImGuiVisitor::visit (Source& s)
|
||||
bool l = s.locked();
|
||||
if (ImGuiToolkit::IconToggle(15,6,17,6, &l, tooltip ) ) {
|
||||
s.setLocked(l);
|
||||
if (l)
|
||||
if (l) {
|
||||
Mixer::selection().clear();
|
||||
else
|
||||
Action::manager().store(s.name() + std::string(" lock."), s.id());
|
||||
}
|
||||
else {
|
||||
Mixer::selection().set(&s);
|
||||
Action::manager().store(s.name() + std::string(" unlock."), s.id());
|
||||
}
|
||||
}
|
||||
|
||||
// toggle enable/disable image processing
|
||||
|
||||
@@ -222,12 +222,12 @@ std::pair<Node *, glm::vec2> LayerView::pick(glm::vec2 P)
|
||||
if (s != nullptr) {
|
||||
// pick on the lock icon; unlock source
|
||||
if ( pick.first == s->lock_) {
|
||||
s->setLocked(false);
|
||||
lock(s, false);
|
||||
pick = { s->locker_, pick.second };
|
||||
}
|
||||
// pick on the open lock icon; lock source and cancel pick
|
||||
else if ( pick.first == s->unlock_ ) {
|
||||
s->setLocked(true);
|
||||
lock(s, true);
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
// pick a locked source; cancel pick
|
||||
|
||||
@@ -337,12 +337,12 @@ std::pair<Node *, glm::vec2> MixingView::pick(glm::vec2 P)
|
||||
if (s != nullptr) {
|
||||
// pick on the lock icon; unlock source
|
||||
if ( pick.first == s->lock_) {
|
||||
s->setLocked(false);
|
||||
lock(s, false);
|
||||
pick = { s->locker_, pick.second };
|
||||
}
|
||||
// pick on the open lock icon; lock source and cancel pick
|
||||
else if ( pick.first == s->unlock_ ) {
|
||||
s->setLocked(true);
|
||||
lock(s, true);
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
// pick a locked source ; cancel pick
|
||||
|
||||
@@ -830,11 +830,15 @@ void TextureView::draw()
|
||||
if (s != nullptr) {
|
||||
|
||||
if (s->textureMirrored()) {
|
||||
if (ImGui::Selectable( ICON_FA_TH " Repeat " ))
|
||||
if (ImGui::Selectable( ICON_FA_TH " Repeat " )){
|
||||
s->setTextureMirrored(false);
|
||||
Action::manager().store(s->name() + std::string(": Texture Repeat."), s->id());
|
||||
}
|
||||
} else {
|
||||
if (ImGui::Selectable( ICON_FA_TH " Mirror " ))
|
||||
if (ImGui::Selectable( ICON_FA_TH " Mirror " )){
|
||||
s->setTextureMirrored(true);
|
||||
Action::manager().store(s->name() + std::string(": Texture Mirror."), s->id());
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
10
View.cpp
10
View.cpp
@@ -263,3 +263,13 @@ void View::updateSelectionOverlay()
|
||||
overlay_selection_->scale_ = glm::vec3(0.f, 0.f, 1.f);
|
||||
}
|
||||
|
||||
|
||||
void View::lock(Source *s, bool on)
|
||||
{
|
||||
s->setLocked(on);
|
||||
if (on)
|
||||
Action::manager().store(s->name() + std::string(" lock."), s->id());
|
||||
else
|
||||
Action::manager().store(s->name() + std::string(" unlock."), s->id());
|
||||
}
|
||||
|
||||
|
||||
3
View.h
3
View.h
@@ -80,7 +80,7 @@ public:
|
||||
return Cursor ();
|
||||
}
|
||||
|
||||
// test mouse over provided a point in screen coordinates
|
||||
//TODO: test mouse over provided a point in screen coordinates
|
||||
virtual Cursor over (glm::vec2) {
|
||||
return Cursor ();
|
||||
}
|
||||
@@ -120,6 +120,7 @@ protected:
|
||||
} ContextMenu;
|
||||
ContextMenu show_context_menu_;
|
||||
inline void openContextMenu (ContextMenu m) { show_context_menu_ = m; }
|
||||
void lock(Source *s, bool on);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user