mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
Improve Undo History
Store a short label in XML for improved display of action history in list. Ensured all action labels include the source name (IMGUI visitor) and checked all action manager store action.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <regex>
|
||||
|
||||
#include "Log.h"
|
||||
#include "View.h"
|
||||
@@ -84,6 +85,28 @@ void captureMixerSession(Session *se, std::string node, std::string label, tinyx
|
||||
// view indicates the view when this action occurred
|
||||
sessionNode->SetAttribute("view", (int) Mixer::manager().view()->mode());
|
||||
|
||||
// generate short label, if possible
|
||||
std::smatch match;
|
||||
const std::regex pattern("([^:]*):(.*)");
|
||||
// extract left and right part around colon in the label
|
||||
if (std::regex_search(label, match, pattern) && match.size() > 1 && match[1].str().size() > 1) {
|
||||
// take left part of ':'
|
||||
std::string left = match[1].str();
|
||||
// keep only the initials, i.e. front and back characters, to upper case
|
||||
std::string short_label;
|
||||
short_label.append( 1, static_cast<char>(std::toupper(static_cast<unsigned char>(left.front()))));
|
||||
short_label.append( 1, static_cast<char>(std::toupper(static_cast<unsigned char>(left.back()))));
|
||||
|
||||
// separator
|
||||
short_label.append(":");
|
||||
|
||||
// take the right part of ':'
|
||||
if (match.size() > 2)
|
||||
short_label.append(match[2].str());
|
||||
|
||||
sessionNode->SetAttribute("shortlabel", short_label.c_str() );
|
||||
}
|
||||
|
||||
// get the thumbnail (requires one opengl update to render)
|
||||
FrameBufferImage *thumbnail = se->renderThumbnail();
|
||||
if (thumbnail) {
|
||||
@@ -193,6 +216,22 @@ std::string Action::label(uint s) const
|
||||
return l;
|
||||
}
|
||||
|
||||
std::string Action::shortlabel(uint s) const
|
||||
{
|
||||
std::string l = "";
|
||||
|
||||
if (s > 0 && s <= history_max_step_) {
|
||||
const XMLElement *sessionNode = history_doc_.FirstChildElement( HISTORY_NODE(s).c_str());
|
||||
if (sessionNode) {
|
||||
if (sessionNode->Attribute("shortlabel"))
|
||||
l = sessionNode->Attribute("shortlabel");
|
||||
else
|
||||
l = sessionNode->Attribute("label");
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
FrameBufferImage *Action::thumbnail(uint s) const
|
||||
{
|
||||
FrameBufferImage *img = nullptr;
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
inline uint current () const { return history_step_; }
|
||||
inline uint max () const { return history_max_step_; }
|
||||
std::string label (uint s) const;
|
||||
std::string shortlabel (uint s) const;
|
||||
FrameBufferImage *thumbnail (uint s) const;
|
||||
|
||||
// Snapshots
|
||||
|
||||
@@ -403,7 +403,7 @@ void GeometryView::draw()
|
||||
s->group(mode_)->rotation_.z = 0;
|
||||
s->group(mode_)->translation_ = glm::vec3(0.f);
|
||||
s->touch();
|
||||
Action::manager().store(s->name() + std::string(": Geometry Fit output"));
|
||||
Action::manager().store(s->name() + std::string(": Fit to output"));
|
||||
}
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
@@ -427,7 +427,7 @@ void GeometryView::draw()
|
||||
(*sit)->group(mode_)->translation_ = glm::vec3(0.f);
|
||||
(*sit)->touch();
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Fit all."));
|
||||
Action::manager().store(std::string("Fit selected " ICON_FA_OBJECT_UNGROUP));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_VECTOR_SQUARE " Reset all" )){
|
||||
// apply to every sources in selection
|
||||
@@ -438,7 +438,7 @@ void GeometryView::draw()
|
||||
(*sit)->group(mode_)->translation_ = glm::vec3(0.f);
|
||||
(*sit)->touch();
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Reset all."));
|
||||
Action::manager().store(std::string("Reset selected " ICON_FA_OBJECT_UNGROUP));
|
||||
}
|
||||
// if (ImGui::Selectable( ICON_FA_TH " Mosaic" )){ // TODO
|
||||
|
||||
@@ -450,7 +450,7 @@ void GeometryView::draw()
|
||||
initiate();
|
||||
applySelectionTransform(T);
|
||||
terminate();
|
||||
Action::manager().store(std::string("Selection: Center."));
|
||||
Action::manager().store(std::string("Center selected " ICON_FA_OBJECT_UNGROUP));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_COMPASS " Align" )){
|
||||
// apply to every sources in selection
|
||||
@@ -458,7 +458,7 @@ void GeometryView::draw()
|
||||
(*sit)->group(mode_)->rotation_.z = overlay_selection_->rotation_.z;
|
||||
(*sit)->touch();
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Align."));
|
||||
Action::manager().store(std::string("Align selected " ICON_FA_OBJECT_UNGROUP));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_OBJECT_GROUP " Best Fit" )){
|
||||
glm::mat4 T = glm::translate(glm::identity<glm::mat4>(), -overlay_selection_->translation_);
|
||||
@@ -477,7 +477,7 @@ void GeometryView::draw()
|
||||
initiate();
|
||||
applySelectionTransform(M);
|
||||
terminate();
|
||||
Action::manager().store(std::string("Selection: Best Fit."));
|
||||
Action::manager().store(std::string("Best Fit selected " ICON_FA_OBJECT_UNGROUP));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_EXCHANGE_ALT " Mirror" )){
|
||||
glm::mat4 T = glm::translate(glm::identity<glm::mat4>(), -overlay_selection_->translation_);
|
||||
@@ -486,7 +486,7 @@ void GeometryView::draw()
|
||||
initiate();
|
||||
applySelectionTransform(M);
|
||||
terminate();
|
||||
Action::manager().store(std::string("Selection: Mirror."));
|
||||
Action::manager().store(std::string("Mirror selected " ICON_FA_OBJECT_UNGROUP));
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(2);
|
||||
@@ -912,6 +912,8 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// apply to source Node and to handles
|
||||
sourceNode->data_[0].x = CLAMP( node_pos.x, 0.f, 0.96f );
|
||||
sourceNode->data_[0].y = CLAMP( node_pos.y, 0.f, 0.96f );
|
||||
info << "Corner low-left " << std::fixed << std::setprecision(3) << sourceNode->data_[0].x;
|
||||
info << " x " << sourceNode->data_[0].y;
|
||||
}
|
||||
else if (pick.first == s->handles_[mode_][Handles::NODE_UPPER_LEFT]) {
|
||||
// hide other grips
|
||||
@@ -939,6 +941,8 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// apply to source Node and to handles
|
||||
sourceNode->data_[1].x = CLAMP( node_pos.x, 0.f, 0.96f );
|
||||
sourceNode->data_[1].y = CLAMP( node_pos.y, -0.96f, 0.f );
|
||||
info << "Corner up-left " << std::fixed << std::setprecision(3) << sourceNode->data_[1].x;
|
||||
info << " x " << sourceNode->data_[1].y;
|
||||
}
|
||||
else if ( pick.first == s->handles_[mode_][Handles::NODE_LOWER_RIGHT] ) {
|
||||
// hide other grips
|
||||
@@ -966,6 +970,8 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// apply to source Node and to handles
|
||||
sourceNode->data_[2].x = CLAMP( node_pos.x, -0.96f, 0.f );
|
||||
sourceNode->data_[2].y = CLAMP( node_pos.y, 0.f, 0.96f );
|
||||
info << "Corner low-right " << std::fixed << std::setprecision(3) << sourceNode->data_[2].x;
|
||||
info << " x " << sourceNode->data_[2].y;
|
||||
}
|
||||
else if (pick.first == s->handles_[mode_][Handles::NODE_UPPER_RIGHT]) {
|
||||
// hide other grips
|
||||
@@ -994,6 +1000,8 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// apply to source Node and to handles
|
||||
sourceNode->data_[3].x = CLAMP( node_pos.x, -0.96f, 0.f );
|
||||
sourceNode->data_[3].y = CLAMP( node_pos.y, -0.96f, 0.f );
|
||||
info << "Corner up-right " << std::fixed << std::setprecision(3) << sourceNode->data_[3].x;
|
||||
info << " x " << sourceNode->data_[3].y;
|
||||
}
|
||||
// horizontal CROP
|
||||
else if (pick.first == s->handles_[mode_][Handles::CROP_H]) {
|
||||
@@ -1201,6 +1209,7 @@ View::Cursor GeometryView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::p
|
||||
// apply to source Node and to handles
|
||||
// sourceNode->data_[0].z = - CLAMP( node_pos.x, -1.f, 0.f );
|
||||
sourceNode->data_[0].w = - CLAMP( node_pos.x, -1.f, 0.f );
|
||||
info << "Corner round " << std::fixed << std::setprecision(3) << sourceNode->data_[0].w;
|
||||
}
|
||||
// picking on the resizing handles in the corners RESIZE CORNER
|
||||
else if ( pick.first == s->handles_[mode_][Handles::RESIZE] ) {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
@@ -109,7 +108,6 @@ void ImGuiVisitor::visit(Group &n)
|
||||
n.translation_.y = translation[1];
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
std::ostringstream oss;
|
||||
oss << "Position " << std::setprecision(3) << n.translation_.x << ", " << n.translation_.y;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
@@ -127,7 +125,6 @@ void ImGuiVisitor::visit(Group &n)
|
||||
n.scale_.y = CLAMP_SCALE(scale[1]);
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
std::ostringstream oss;
|
||||
oss << "Scale " << std::setprecision(3) << n.scale_.x << " x " << n.scale_.y;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
@@ -140,7 +137,6 @@ void ImGuiVisitor::visit(Group &n)
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderAngle("Angle", &(n.rotation_.z), -180.f, 180.f) ;
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
std::ostringstream oss;
|
||||
oss << "Angle " << std::setprecision(3) << n.rotation_.z * 180.f / M_PI;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
@@ -205,7 +201,6 @@ void ImGuiVisitor::visit(Shader &n)
|
||||
"\0Hard light\0Soft subtract\0Lighten only\0") ) {
|
||||
n.blending = Shader::BlendMode(mode);
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "Blending ";
|
||||
switch(n.blending) {
|
||||
case Shader::BLEND_OPACITY:
|
||||
@@ -245,7 +240,6 @@ void ImGuiVisitor::visit(Shader &n)
|
||||
void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream oss;
|
||||
ImGui::PushID(std::to_string(n.id()).c_str());
|
||||
|
||||
///
|
||||
@@ -380,7 +374,6 @@ void ImGuiVisitor::visit(ImageProcessingShader &n)
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
std::ostringstream oss;
|
||||
oss << "Posterize ";
|
||||
if (n.nbColors == 0) oss << "Full range"; else oss << n.nbColors;
|
||||
Action::manager().store(oss.str());
|
||||
@@ -443,6 +436,9 @@ void ImGuiVisitor::visit (Source& s)
|
||||
|
||||
ImGui::PushID(std::to_string(s.id()).c_str());
|
||||
|
||||
oss = std::ostringstream();
|
||||
oss << s.name() << ": ";
|
||||
|
||||
// blending selection
|
||||
s.blendingShader()->accept(*this);
|
||||
|
||||
@@ -521,12 +517,13 @@ void ImGuiVisitor::visit (Source& s)
|
||||
s.setLocked(l);
|
||||
if (l) {
|
||||
Mixer::selection().clear();
|
||||
Action::manager().store(s.name() + std::string(": lock."));
|
||||
oss << "Locked";
|
||||
}
|
||||
else {
|
||||
Mixer::selection().set(&s);
|
||||
Action::manager().store(s.name() + std::string(": unlock."));
|
||||
oss << "Unlocked";
|
||||
}
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
// Filter
|
||||
@@ -549,8 +546,7 @@ void ImGuiVisitor::visit (Source& s)
|
||||
if (ImGui::BeginPopup( "MenuImageProcessing" ))
|
||||
{
|
||||
if (ImGui::MenuItem("Enable", NULL, &on)) {
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": " << ( on ? "Enable Color correction" : "Disable Color correction");
|
||||
oss << ( on ? "Enable Color correction" : "Disable Color correction");
|
||||
Action::manager().store(oss.str());
|
||||
s.setImageProcessingEnabled(on);
|
||||
}
|
||||
@@ -565,8 +561,7 @@ void ImGuiVisitor::visit (Source& s)
|
||||
ImageProcessingShader defaultvalues;
|
||||
s.processingShader()->copy(defaultvalues);
|
||||
s.processingshader_link_.disconnect();
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": " << "Reset Filter";
|
||||
oss << "Reset Filter";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::MenuItem("Copy", NULL, false, on )){
|
||||
@@ -578,8 +573,7 @@ void ImGuiVisitor::visit (Source& s)
|
||||
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";
|
||||
oss << "Change Filter";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
// // NON-stable style follow mechanism
|
||||
@@ -816,19 +810,18 @@ void ImGuiVisitor::visit (SessionFileSource& s)
|
||||
}
|
||||
|
||||
// fading
|
||||
std::ostringstream oss;
|
||||
int f = 100 - int(s.session()->fading() * 100.f);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::SliderInt("##Fading", &f, 0, 100, f > 99 ? ICON_FA_ADJUST " None" : ICON_FA_ADJUST " %d %%") )
|
||||
s.session()->setFadingTarget( float(100 - f) * 0.01f );
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
oss << s.name() << ": Fading " << f << " %";
|
||||
oss << "Fading " << f << " %";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Fading")) {
|
||||
s.session()->setFadingTarget(0.f);
|
||||
oss << s.name() << ": Fading 0 %";
|
||||
oss << "Fading 0 %";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
@@ -984,7 +977,6 @@ void ImGuiVisitor::visit (PassthroughFilter&)
|
||||
void ImGuiVisitor::visit (DelayFilter& f)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream oss;
|
||||
|
||||
// if (ImGuiToolkit::IconButton(ICON_FILTER_DELAY)) {
|
||||
// f.setDelay(0.f);
|
||||
@@ -1008,14 +1000,13 @@ void ImGuiVisitor::visit (DelayFilter& f)
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Delay ")) {
|
||||
f.setDelay(0.5f);
|
||||
Action::manager().store("Delay 0.5 s");
|
||||
oss << "Delay 0.5 s";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiVisitor::visit (ResampleFilter& f)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
int m = (int) f.factor();
|
||||
if (ImGui::Combo("##Factor", &m, ResampleFilter::factor_label, IM_ARRAYSIZE(ResampleFilter::factor_label) )) {
|
||||
@@ -1049,18 +1040,18 @@ void list_parameters_(ImageFilter &f, std::ostringstream &oss)
|
||||
if (ImGui::IsItemHovered() && io.MouseWheel != 0.f ){
|
||||
v = CLAMP( v + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter(param->first, v);
|
||||
oss << " : " << param->first << " " << std::setprecision(3) << v;
|
||||
oss << " " << param->first << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << " : " << param->first << " " << std::setprecision(3) <<param->second;
|
||||
oss << " " << param->first << " " << std::setprecision(3) <<param->second;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton( param->first.c_str() )) {
|
||||
v = 0.5f;
|
||||
f.setProgramParameter(param->first, v);
|
||||
oss << " : " << param->first << " " << std::setprecision(3) << v;
|
||||
oss << " " << param->first << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::PopID();
|
||||
@@ -1069,7 +1060,6 @@ void list_parameters_(ImageFilter &f, std::ostringstream &oss)
|
||||
|
||||
void ImGuiVisitor::visit (BlurFilter& f)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Blur ";
|
||||
|
||||
// Method selection
|
||||
@@ -1093,7 +1083,6 @@ void ImGuiVisitor::visit (BlurFilter& f)
|
||||
|
||||
void ImGuiVisitor::visit (SharpenFilter& f)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Sharpen ";
|
||||
|
||||
// Method selection
|
||||
@@ -1117,7 +1106,6 @@ void ImGuiVisitor::visit (SharpenFilter& f)
|
||||
|
||||
void ImGuiVisitor::visit (SmoothFilter& f)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Smooth ";
|
||||
|
||||
// Method selection
|
||||
@@ -1141,7 +1129,6 @@ void ImGuiVisitor::visit (SmoothFilter& f)
|
||||
|
||||
void ImGuiVisitor::visit (EdgeFilter& f)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << "Edge ";
|
||||
|
||||
// Method selection
|
||||
@@ -1166,7 +1153,6 @@ void ImGuiVisitor::visit (EdgeFilter& f)
|
||||
void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::ostringstream oss;
|
||||
oss << "Alpha ";
|
||||
|
||||
// Alpha operation selection
|
||||
@@ -1198,12 +1184,12 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
v = CLAMP( v + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter("Tolerance", v);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
oss << " " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
oss << " " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -1211,7 +1197,7 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
v = 0.f;
|
||||
f.setProgramParameter("Tolerance", v);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
oss << " " << "Tolerance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
float t = filter_parameters["Threshold"];
|
||||
@@ -1223,12 +1209,12 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
t = CLAMP( t + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter("Threshold", t);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
oss << " " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
oss << " " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -1236,7 +1222,7 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
t = 0.f;
|
||||
f.setProgramParameter("Threshold", t);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
oss << " " << "Threshold" << " " << std::setprecision(3) << t;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
@@ -1308,12 +1294,12 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
v = CLAMP( v + 0.01f * io.MouseWheel, 0.f, 1.f);
|
||||
f.setProgramParameter("Luminance", v);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Luminance" << " " << std::setprecision(3) << v;
|
||||
oss << " " << "Luminance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Luminance" << " " << std::setprecision(3) << v;
|
||||
oss << " " << "Luminance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -1321,7 +1307,7 @@ void ImGuiVisitor::visit (AlphaFilter& f)
|
||||
v = 0.f;
|
||||
f.setProgramParameter("Luminance", v);
|
||||
oss << AlphaFilter::operation_label[ f.operation() ];
|
||||
oss << " : " << "Luminance" << " " << std::setprecision(3) << v;
|
||||
oss << " " << "Luminance" << " " << std::setprecision(3) << v;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
@@ -1340,7 +1326,6 @@ void ImGuiVisitor::visit (ImageFilter& f)
|
||||
}
|
||||
|
||||
// List of parameters
|
||||
std::ostringstream oss;
|
||||
oss << "Custom ";
|
||||
list_parameters_(f, oss);
|
||||
|
||||
@@ -1372,20 +1357,18 @@ void ImGuiVisitor::visit (CloneSource& s)
|
||||
ImGui::Text("Origin");
|
||||
|
||||
// filter selection
|
||||
std::ostringstream oss;
|
||||
oss << s.name();
|
||||
int type = (int) s.filter()->type();
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGuiToolkit::ComboIcon("##SelectFilter", &type, FrameBufferFilter::Types)) {
|
||||
s.setFilter( FrameBufferFilter::Type(type) );
|
||||
oss << ": Filter " << std::get<2>(FrameBufferFilter::Types[type]);
|
||||
oss << "Filter " << std::get<2>(FrameBufferFilter::Types[type]);
|
||||
Action::manager().store(oss.str());
|
||||
info.reset();
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Filter")) {
|
||||
s.setFilter( FrameBufferFilter::FILTER_PASSTHROUGH );
|
||||
oss << ": Filter None";
|
||||
oss << "Filter None";
|
||||
Action::manager().store(oss.str());
|
||||
info.reset();
|
||||
}
|
||||
@@ -1436,8 +1419,7 @@ void ImGuiVisitor::visit (PatternSource& s)
|
||||
ImGui::Selectable( label.c_str(), p == s.pattern()->type() )) {
|
||||
s.setPattern(p, s.pattern()->resolution());
|
||||
info.reset();
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": Pattern " << Pattern::get(p).label;
|
||||
oss << "Pattern " << Pattern::get(p).label;
|
||||
Action::manager().store(oss.str());
|
||||
// ensure all sources are updated after the texture change of this one
|
||||
Mixer::manager().session()->execute([](Source *so) { so->touch(Source::SourceUpdate_Mask); });
|
||||
@@ -1493,8 +1475,7 @@ void ImGuiVisitor::visit (DeviceSource& s)
|
||||
else {
|
||||
s.setDevice(namedev);
|
||||
info.reset();
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << " Device " << namedev;
|
||||
oss << "Device " << namedev;
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
// ensure all sources are updated after the texture change of this one
|
||||
@@ -1562,8 +1543,7 @@ void ImGuiVisitor::visit (ScreenCaptureSource& s)
|
||||
else {
|
||||
s.setWindow(namedev);
|
||||
info.reset();
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << " Window " << namedev;
|
||||
oss << "Window '" << namedev << "'";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
// ensure all sources are updated after the texture change of this one
|
||||
@@ -1663,16 +1643,14 @@ void ImGuiVisitor::visit (MultiFileSource& s)
|
||||
ImGui::DragIntRange2("##Range", &_begin, &_end, 1, s.sequence().min, s.sequence().max);
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
s.setRange( _begin, _end );
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": Range " << _begin << "-" << _end;
|
||||
oss << "Range " << _begin << "-" << _end;
|
||||
Action::manager().store(oss.str());
|
||||
_begin = _end = -1;
|
||||
}
|
||||
ImGui::SameLine(0, 0);
|
||||
if (ImGuiToolkit::TextButton("Range")) {
|
||||
s.setRange( s.sequence().min, s.sequence().max );
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": Range " << s.sequence().min << "-" << s.sequence().max;
|
||||
oss << "Range " << s.sequence().min << "-" << s.sequence().max;
|
||||
Action::manager().store(oss.str());
|
||||
_begin = _end = -1;
|
||||
}
|
||||
@@ -1685,16 +1663,14 @@ void ImGuiVisitor::visit (MultiFileSource& s)
|
||||
ImGui::SliderInt("##Framerate", &_fps, 1, 30, "%d fps");
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()){
|
||||
s.setFramerate(_fps);
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": Framerate " << _fps << " fps";
|
||||
oss << "Framerate " << _fps << " fps";
|
||||
Action::manager().store(oss.str());
|
||||
_fps = -1;
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Framerate")) {
|
||||
s.setFramerate(25);
|
||||
std::ostringstream oss;
|
||||
oss << s.name() << ": Framerate 25 fps";
|
||||
oss << "Framerate 25 fps";
|
||||
Action::manager().store(oss.str());
|
||||
_fps = -1;
|
||||
}
|
||||
@@ -1768,7 +1744,8 @@ void ImGuiVisitor::visit (GenericStreamSource& s)
|
||||
if (changed) {
|
||||
info.reset();
|
||||
s.setDescription(_description);
|
||||
Action::manager().store( s.name() + ": Change pipeline");
|
||||
oss << "Change pipeline";
|
||||
Action::manager().store( oss.str() );
|
||||
// ensure all sources are updated after the texture change of this one
|
||||
Mixer::manager().session()->execute([](Source *so) { so->touch(Source::SourceUpdate_Mask); });
|
||||
}
|
||||
@@ -1868,7 +1845,8 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
if (ImGuiToolkit::InputTextMultiline("Text", &_contents, fieldsize, &numlines)) {
|
||||
info.reset();
|
||||
tc->setText(_contents);
|
||||
Action::manager().store(s.name() + " Change text");
|
||||
oss << "Text changed";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
botom = ImGui::GetCursorPos();
|
||||
|
||||
@@ -1878,11 +1856,16 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
ImGui::SetClipboardText(_contents.c_str());
|
||||
ImGui::SetCursorPos(
|
||||
ImVec2(top.x + 0.95 * ImGui::GetFrameHeight(), botom.y - ImGui::GetFrameHeight()));
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PASTE, "Paste")) {
|
||||
_contents = std::string(ImGui::GetClipboardText());
|
||||
info.reset();
|
||||
tc->setText(_contents);
|
||||
Action::manager().store(s.name() + " Change text");
|
||||
_contents = std::string(ImGui::GetClipboardText());
|
||||
if (_contents.empty())
|
||||
ImGui::TextDisabled(ICON_FA_PASTE);
|
||||
else {
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_PASTE, "Paste")) {
|
||||
info.reset();
|
||||
tc->setText(_contents);
|
||||
oss << "Text changed";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
ImGui::SetCursorPos(ImVec2(top.x, botom.y - 2.f * ImGui::GetFrameHeight()));
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_CODE, "Pango syntax"))
|
||||
@@ -1897,21 +1880,25 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel) ) {
|
||||
tc->setColor( ImGuiToolkit::ColorConvertFloat4ToARGB(color) );
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit())
|
||||
Action::manager().store( s.name() + " Change font color" );
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << "Change font color";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
std::string font = tc->fontDescriptor();
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGuiToolkit::InputText("##Font", &font, ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
tc->setFontDescriptor(font);
|
||||
Action::manager().store( s.name() + " Change font");
|
||||
oss << "Change font";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Font")) {
|
||||
tc->setFontDescriptor("arial 24");
|
||||
tc->setColor(0xffffffff);
|
||||
Action::manager().store(s.name() + " Reset font");
|
||||
oss << "Reset font";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
botom = ImGui::GetCursorPos();
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
@@ -1924,20 +1911,24 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel) ) {
|
||||
tc->setOutlineColor( ImGuiToolkit::ColorConvertFloat4ToARGB(color) );
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit())
|
||||
Action::manager().store( s.name() + " Change outline color" );
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << "Change outline color";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
int outline = tc->outline();
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::Combo("##Outline", &outline, "None\0Border\0Border & shadow\0")) {
|
||||
tc->setOutline(outline);
|
||||
Action::manager().store(s.name() + " Change outline");
|
||||
oss << "Change outline";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Outline")) {
|
||||
tc->setOutline(2);
|
||||
tc->setOutlineColor(0xFF000000);
|
||||
Action::manager().store(s.name() + " Reset outline");
|
||||
oss << "Reset outline";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
// HORIZONTAL alignment
|
||||
@@ -1955,6 +1946,10 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
if (ImGui::SliderFloat("##Posx", &align_x, 0.f, 1.f, "%.2f")) {
|
||||
tc->setHorizontalPadding(align_x);
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << "Change h-align coordinates";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip( "Coordinates" );
|
||||
} else {
|
||||
@@ -1963,6 +1958,10 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
if (ImGui::SliderInt("##Padx", &pad_x, 0, 1000)) {
|
||||
tc->setHorizontalPadding((float) pad_x);
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << "Change h-align padding";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip( "Padding" );
|
||||
}
|
||||
@@ -1985,12 +1984,15 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
on = var == 3;
|
||||
if (ImGuiToolkit::ButtonIconToggle(6, 10, &on, "Absolute"))
|
||||
tc->setHorizontalAlignment(3);
|
||||
if (var != tc->horizontalAlignment())
|
||||
Action::manager().store(s.name() + " Change h-align");
|
||||
if (var != tc->horizontalAlignment()){
|
||||
oss << "Change h-align";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Horizontal")) {
|
||||
tc->setHorizontalAlignment(1);
|
||||
Action::manager().store(s.name() + " Reset h-align");
|
||||
oss << "Reset h-align";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
// VERTICAL alignment
|
||||
@@ -2007,6 +2009,10 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
if (ImGui::SliderFloat("##Posy", &align_y, 0.f, 1.f, "%.2f")) {
|
||||
tc->setVerticalPadding(align_y);
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << "Change v-align coordinates";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip( "Coordinates" );
|
||||
} else {
|
||||
@@ -2015,6 +2021,10 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
if (ImGui::SliderInt("##Pady", &pad_y, 0, 1000)) {
|
||||
tc->setVerticalPadding((float) pad_y);
|
||||
}
|
||||
if (ImGui::IsItemDeactivatedAfterEdit()) {
|
||||
oss << "Change v-align padding";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGuiToolkit::ToolTip( "Padding" );
|
||||
}
|
||||
@@ -2038,12 +2048,15 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
on = var == 3;
|
||||
if (ImGuiToolkit::ButtonIconToggle(3, 10, &on, "Absolute"))
|
||||
tc->setVerticalAlignment(3);
|
||||
if (var != tc->verticalAlignment())
|
||||
Action::manager().store(s.name() + " Change v-align");
|
||||
if (var != tc->verticalAlignment()){
|
||||
oss << "Change v-align";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
if (ImGuiToolkit::TextButton("Vertical")) {
|
||||
tc->setVerticalAlignment(2);
|
||||
Action::manager().store(s.name() + " Reset v-align");
|
||||
oss << "Reset v-align";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
|
||||
botom = ImGui::GetCursorPos();
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#ifndef IMGUIVISITOR_H
|
||||
#define IMGUIVISITOR_H
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "Visitor.h"
|
||||
#include "InfoVisitor.h"
|
||||
|
||||
class ImGuiVisitor: public Visitor
|
||||
{
|
||||
InfoVisitor info;
|
||||
std::ostringstream oss;
|
||||
|
||||
public:
|
||||
ImGuiVisitor();
|
||||
|
||||
@@ -40,7 +40,7 @@ std::vector< ShadingProgram > maskPrograms = {
|
||||
};
|
||||
|
||||
const char* MaskShader::mask_icons[4] = { ICON_FA_WINDOW_CLOSE, ICON_FA_EDIT, ICON_FA_SHAPES, ICON_FA_CLONE };
|
||||
const char* MaskShader::mask_names[4] = { "No mask", "Paint mask", "Shape mask", "Source mask" };
|
||||
const char* MaskShader::mask_names[4] = { "Mask None", "Mask Paint", "Mask Shape", "Mask Source" };
|
||||
const char* MaskShader::mask_shapes[5] = { "Ellipse", "Oblong", "Rectangle", "Horizontal", "Vertical" };
|
||||
|
||||
ImageShader::ImageShader(): Shader(), secondary_texture(0), stipple(0.f)
|
||||
|
||||
@@ -146,7 +146,7 @@ void LayerView::draw()
|
||||
depth += depth_inc;
|
||||
(*it)->call( new SetDepth(depth, 80.f) );
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Layer Distribute"));
|
||||
Action::manager().store(std::string("Distribute selected " ICON_FA_LAYER_GROUP));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_CARET_RIGHT ICON_FA_CARET_LEFT " Compress" )){
|
||||
SourceList dsl = depth_sorted(Mixer::selection().getCopy());
|
||||
@@ -156,7 +156,7 @@ void LayerView::draw()
|
||||
depth += LAYER_STEP;
|
||||
(*it)->call( new SetDepth(depth, 80.f) );
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Layer Compress"));
|
||||
Action::manager().store(std::string("Compress selected " ICON_FA_LAYER_GROUP));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_EXCHANGE_ALT " Reverse order" )){
|
||||
SourceList dsl = depth_sorted(Mixer::selection().getCopy());
|
||||
@@ -165,7 +165,7 @@ void LayerView::draw()
|
||||
for (; it != dsl.end(); ++it, ++rit) {
|
||||
(*it)->call( new SetDepth((*rit)->depth(), 80.f) );
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Layer Reverse order"));
|
||||
Action::manager().store(std::string("Reverse order selected " ICON_FA_LAYER_GROUP));
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
@@ -549,7 +549,7 @@ void Mixer::insertSource(Source *s, View::Mode m)
|
||||
attachSource(s);
|
||||
|
||||
// new state in history manager
|
||||
Action::manager().store(s->name() + std::string(": source inserted"));
|
||||
Action::manager().store(s->name() + std::string(": Source inserted"));
|
||||
|
||||
// Log & notification
|
||||
Log::Info("Adding source '%s'...", s->name().c_str());
|
||||
@@ -742,7 +742,7 @@ void Mixer::deleteSelection()
|
||||
if (N > 1)
|
||||
info << N << " sources deleted";
|
||||
else
|
||||
info << selection().front()->name() << ": deleted";
|
||||
info << selection().front()->name() << ": Deleted";
|
||||
|
||||
// get clones first : this way we store the history of deletion in the right order
|
||||
SourceList selection_clones_;
|
||||
@@ -834,7 +834,7 @@ void Mixer::groupSelection()
|
||||
|
||||
// store in action manager
|
||||
std::ostringstream info;
|
||||
info << sessiongroup->name() << " inserted: " << sessiongroup->session()->size() << " sources groupped.";
|
||||
info << sessiongroup->name() << ": inserted (" << sessiongroup->session()->size() << " sources group)";
|
||||
Action::manager().store(info.str());
|
||||
|
||||
Log::Notify("Added %s source '%s' (group of %d sources)", sessiongroup->info().c_str(), sessiongroup->name().c_str(), sessiongroup->session()->size());
|
||||
@@ -1383,7 +1383,7 @@ void Mixer::merge(Session *session)
|
||||
|
||||
// import every sources
|
||||
std::ostringstream info;
|
||||
info << session->size() << " sources imported from:" << session->filename();
|
||||
info << session->size() << " sources imported from " << session->filename();
|
||||
for ( Source *s = session->popSource(); s != nullptr; s = session->popSource()) {
|
||||
// avoid name duplicates
|
||||
renameSource(s);
|
||||
@@ -1422,7 +1422,7 @@ void Mixer::merge(SessionSource *source)
|
||||
|
||||
// prepare Action manager info
|
||||
std::ostringstream info;
|
||||
info << source->name().c_str() << " expanded:" << session->size() << " sources imported";
|
||||
info << source->name().c_str() << ": expanded to " << session->size() << " sources";
|
||||
|
||||
// import sources of the session (if not empty)
|
||||
if ( !session->empty() ) {
|
||||
|
||||
@@ -200,7 +200,7 @@ void MixingView::draw()
|
||||
if (ImGui::Selectable( ICON_FA_UNLINK " Unlink" )){
|
||||
// dismantle MixingGroup(s)
|
||||
Mixer::manager().session()->unlink(selected);
|
||||
Action::manager().store(std::string("Sources unlinked."));
|
||||
Action::manager().store(std::string( "Unlink selected " ICON_FA_BULLSEYE));
|
||||
}
|
||||
}
|
||||
else if (ImGui::Selectable( ICON_FA_LINK " Link" )){
|
||||
@@ -209,7 +209,7 @@ void MixingView::draw()
|
||||
if (do_link){
|
||||
// assemble a MixingGroup
|
||||
Mixer::manager().session()->link(selected, scene.fg() );
|
||||
Action::manager().store(std::string("Sources linked."));
|
||||
Action::manager().store(std::string( "Link selected " ICON_FA_BULLSEYE));
|
||||
// clear selection and select one of the sources of the group
|
||||
Source *cur = Mixer::selection().front();
|
||||
Mixer::manager().unsetCurrentSource();
|
||||
@@ -232,7 +232,7 @@ void MixingView::draw()
|
||||
(*it)->group(View::MIXING)->translation_ -= glm::vec3(center, 0.f);
|
||||
(*it)->touch();
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Mixing Center"));
|
||||
Action::manager().store(std::string("Center selected " ICON_FA_BULLSEYE));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_HAYKAL " Dispatch" )){
|
||||
glm::vec2 center = glm::vec2(0.f, 0.f);
|
||||
@@ -246,7 +246,7 @@ void MixingView::draw()
|
||||
(*it)->touch();
|
||||
angle -= glm::two_pi<float>() / float(Mixer::selection().size());
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Mixing Dispatch"));
|
||||
Action::manager().store(std::string("Dispatch selected " ICON_FA_BULLSEYE));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_FAN " Distribute" )){
|
||||
SourceList list;
|
||||
@@ -275,7 +275,7 @@ void MixingView::draw()
|
||||
(*it)->touch();
|
||||
angle -= glm::two_pi<float>() / float(list.size());
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Mixing Distribute in circle"));
|
||||
Action::manager().store(std::string("Distribute selected " ICON_FA_BULLSEYE));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_ALIGN_CENTER " Align & Distribute" )){
|
||||
SourceList list;
|
||||
@@ -296,21 +296,21 @@ void MixingView::draw()
|
||||
if (sign<0) i+=0.32f;
|
||||
(*it)->touch();
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Mixing Align & Distribute"));
|
||||
Action::manager().store(std::string("Align & distribute " ICON_FA_BULLSEYE));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_CLOUD_SUN " Expand & hide" )){
|
||||
SourceList::iterator it = Mixer::selection().begin();
|
||||
for (; it != Mixer::selection().end(); ++it) {
|
||||
(*it)->call( new SetAlpha(0.f) );
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Mixing Expand & hide"));
|
||||
Action::manager().store(std::string( ICON_FA_BULLSEYE " Expand & hide selected"));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_SUN " Compress & show" )){
|
||||
SourceList::iterator it = Mixer::selection().begin();
|
||||
for (; it != Mixer::selection().end(); ++it) {
|
||||
(*it)->call( new SetAlpha(0.999f) );
|
||||
}
|
||||
Action::manager().store(std::string("Selection: Mixing Compress & show"));
|
||||
Action::manager().store(std::string("Compress & show selected " ICON_FA_BULLSEYE));
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::EndPopup();
|
||||
|
||||
@@ -3074,14 +3074,18 @@ void SourceControlWindow::DrawButtonBar(ImVec2 bottom, float width)
|
||||
if (ImGui::Button(ICON_FA_PAUSE) && enabled) {
|
||||
for (auto source = selection_.begin(); source != selection_.end(); ++source)
|
||||
(*source)->play(false);
|
||||
Action::manager().store("Sources Pause");
|
||||
Action::manager().store(std::string("Pause ") +
|
||||
std::to_string(selection_.size()) +
|
||||
" sources");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ImGui::Button(ICON_FA_PLAY) && enabled){
|
||||
for (auto source = selection_.begin(); source != selection_.end(); ++source)
|
||||
(*source)->play(true);
|
||||
Action::manager().store("Sources Play");
|
||||
Action::manager().store(std::string("Play ") +
|
||||
std::to_string(selection_.size()) +
|
||||
" sources");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3090,13 +3094,17 @@ void SourceControlWindow::DrawButtonBar(ImVec2 bottom, float width)
|
||||
if (ImGui::Button(ICON_FA_PLAY) && enabled) {
|
||||
for (auto source = selection_.begin(); source != selection_.end(); ++source)
|
||||
(*source)->play(true);
|
||||
Action::manager().store("Sources Play");
|
||||
Action::manager().store(std::string("Play " ) +
|
||||
std::to_string(selection_.size()) +
|
||||
" sources");
|
||||
}
|
||||
ImGui::SameLine(0, h_space_);
|
||||
if (ImGui::Button(ICON_FA_PAUSE) && enabled) {
|
||||
for (auto source = selection_.begin(); source != selection_.end(); ++source)
|
||||
(*source)->play(false);
|
||||
Action::manager().store("Sources Pause");
|
||||
Action::manager().store(std::string("Pause ") +
|
||||
std::to_string(selection_.size()) +
|
||||
" sources");
|
||||
}
|
||||
}
|
||||
ImGui::SameLine(0, h_space_);
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
|
||||
#include "TextureView.h"
|
||||
|
||||
#define MASK_PAINT_ACTION_LABEL "Mask Paint"
|
||||
|
||||
TextureView::TextureView() : View(TEXTURE), edit_source_(nullptr), need_edit_update_(true)
|
||||
{
|
||||
scene.root()->scale_ = glm::vec3(APPEARANCE_DEFAULT_SCALE, APPEARANCE_DEFAULT_SCALE, 1.0f);
|
||||
@@ -734,6 +732,10 @@ void TextureView::draw()
|
||||
edit_source_->maskSource()->connect( *iter );
|
||||
edit_source_->touch(Source::SourceUpdate_Mask);
|
||||
need_edit_update_ = true;
|
||||
// store action history
|
||||
std::ostringstream oss;
|
||||
oss << edit_source_->name() << ": " << MaskShader::mask_names[maskmode];
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
@@ -863,19 +865,19 @@ void TextureView::draw()
|
||||
{
|
||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_DEFAULT);
|
||||
std::ostringstream oss;
|
||||
oss << edit_source_->name();
|
||||
oss << edit_source_->name() << ": " << MaskShader::mask_names[MaskShader::PAINT];
|
||||
int e = 0;
|
||||
if (ImGui::Selectable( ICON_FA_BACKSPACE " Clear")) {
|
||||
e = 1;
|
||||
oss << ": Clear " << MASK_PAINT_ACTION_LABEL;
|
||||
oss << " cleared";
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_THEATER_MASKS " Invert")) {
|
||||
e = 2;
|
||||
oss << ": Invert " << MASK_PAINT_ACTION_LABEL;
|
||||
oss << " inverted";
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_WAVE_SQUARE " Edge")) {
|
||||
e = 3;
|
||||
oss << ": Edge " << MASK_PAINT_ACTION_LABEL;
|
||||
oss << " edged";
|
||||
}
|
||||
if (e>0) {
|
||||
edit_source_->maskShader()->effect = e;
|
||||
@@ -904,7 +906,8 @@ void TextureView::draw()
|
||||
edit_source_->storeMask();
|
||||
// store history
|
||||
std::ostringstream oss;
|
||||
oss << edit_source_->name() << ": Mask fill with " << maskdialog.path();
|
||||
oss << edit_source_->name() << ": " << MaskShader::mask_names[MaskShader::PAINT];
|
||||
oss << " filled with image";
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
}
|
||||
@@ -943,6 +946,9 @@ void TextureView::draw()
|
||||
|
||||
if (mask_cursor_shape_ > 0) {
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << edit_source_->name() << ": " << MaskShader::mask_names[MaskShader::SHAPE];
|
||||
|
||||
ImGui::SameLine(0, 50);
|
||||
ImGui::SetNextItemWidth( ImGui::GetTextLineHeight() * 6.5f);
|
||||
if ( ImGui::Combo("##MaskShape", &shape, MaskShader::mask_shapes, IM_ARRAYSIZE(MaskShader::mask_shapes) ) ) {
|
||||
@@ -950,8 +956,7 @@ void TextureView::draw()
|
||||
edit_source_->touch(Source::SourceUpdate_Mask);
|
||||
need_edit_update_ = true;
|
||||
// store action history
|
||||
std::ostringstream oss;
|
||||
oss << edit_source_->name() << ": Mask Shape " << MaskShader::mask_shapes[shape];
|
||||
oss << " " << MaskShader::mask_shapes[shape];
|
||||
Action::manager().store(oss.str());
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
@@ -978,8 +983,7 @@ void TextureView::draw()
|
||||
}
|
||||
else if (smoothchanged && ImGui::IsMouseReleased(ImGuiMouseButton_Left)){
|
||||
// store action history
|
||||
std::ostringstream oss;
|
||||
oss << edit_source_->name() << ": Mask Shape Blur " << blur_percent << "%";
|
||||
oss << " Blur " << blur_percent << "%";
|
||||
Action::manager().store(oss.str());
|
||||
smoothchanged = false;
|
||||
}
|
||||
@@ -1032,12 +1036,12 @@ void TextureView::draw()
|
||||
if (s->textureMirrored()) {
|
||||
if (ImGui::Selectable( ICON_FA_TH_LARGE " Repeat " )){
|
||||
s->setTextureMirrored(false);
|
||||
Action::manager().store(s->name() + std::string(": Texture Repeat"));
|
||||
Action::manager().store(s->name() + std::string(": Texture Repeat "));
|
||||
}
|
||||
} else {
|
||||
if (ImGui::Selectable( ICON_FA_TH_LARGE " Mirror " )){
|
||||
s->setTextureMirrored(true);
|
||||
Action::manager().store(s->name() + std::string(": Texture Mirror"));
|
||||
Action::manager().store(s->name() + std::string(": Texture Mirror "));
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
@@ -1047,24 +1051,24 @@ void TextureView::draw()
|
||||
s->group(mode_)->rotation_.z = 0;
|
||||
s->group(mode_)->translation_ = glm::vec3(0.f);
|
||||
s->touch();
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset"));
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset "));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_CROSSHAIRS " Reset position" )){
|
||||
s->group(mode_)->translation_ = glm::vec3(0.f);
|
||||
s->touch();
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset position"));
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset position "));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_CIRCLE_NOTCH " Reset rotation" )){
|
||||
s->group(mode_)->rotation_.z = 0;
|
||||
s->touch();
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset rotation"));
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset rotation "));
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_EXPAND_ALT " Reset aspect ratio" )){
|
||||
s->group(mode_)->scale_.x = s->group(mode_)->scale_.y;
|
||||
s->group(mode_)->scale_.x *= (s->group(mode_)->crop_[1] - s->group(mode_)->crop_[0]) /
|
||||
(s->group(mode_)->crop_[2] - s->group(mode_)->crop_[3]);
|
||||
s->touch();
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset aspect ratio"));
|
||||
Action::manager().store(s->name() + std::string(": Texture Reset aspect ratio "));
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
@@ -1104,7 +1108,7 @@ View::Cursor TextureView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pa
|
||||
edit_source_->mixingsurface_->scale_.y);
|
||||
edit_source_->touch(Source::SourceUpdate_Mask);
|
||||
// action label
|
||||
info << MASK_PAINT_ACTION_LABEL;
|
||||
info << MaskShader::mask_names[MaskShader::PAINT] << " changed";
|
||||
// cursor indication - no info, just cursor
|
||||
ret.type = Cursor_Hand;
|
||||
// store action in history
|
||||
@@ -1140,7 +1144,8 @@ View::Cursor TextureView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pa
|
||||
edit_source_->touch(Source::SourceUpdate_Mask);
|
||||
need_edit_update_ = true;
|
||||
// action label
|
||||
info << "Texture Mask " << std::fixed << std::setprecision(3) << edit_source_->maskShader()->size.x;
|
||||
info << MaskShader::mask_names[MaskShader::SHAPE] << " "
|
||||
<< std::fixed << std::setprecision(3) << edit_source_->maskShader()->size.x;
|
||||
info << " x " << edit_source_->maskShader()->size.y;
|
||||
// cursor indication - no info, just cursor
|
||||
ret.type = Cursor_Hand;
|
||||
@@ -1227,7 +1232,7 @@ View::Cursor TextureView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pa
|
||||
T = glm::scale(T, s->stored_status_->scale_);
|
||||
corner = T * glm::vec4( corner, 0.f, 0.f );
|
||||
ret.type = corner.x * corner.y > 0.f ? Cursor_ResizeNESW : Cursor_ResizeNWSE;
|
||||
info << "Texture scale " << std::fixed << std::setprecision(3) << sourceNode->scale_.x;
|
||||
info << "Texture Scale " << std::fixed << std::setprecision(3) << sourceNode->scale_.x;
|
||||
info << " x " << sourceNode->scale_.y;
|
||||
}
|
||||
// picking on the BORDER RESIZING handles left or right
|
||||
@@ -1427,7 +1432,7 @@ View::Cursor TextureView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pa
|
||||
// compute rotation angle on Z axis
|
||||
float angle = glm::orientedAngle( glm::normalize(glm::vec2(source_from)), glm::normalize(glm::vec2(source_to)));
|
||||
handle_polar.y = s->stored_status_->rotation_.z + angle;
|
||||
info << "Angle " << std::fixed << std::setprecision(1) << glm::degrees(sourceNode->rotation_.z) << UNICODE_DEGREE;
|
||||
info << "Texture Angle " << std::fixed << std::setprecision(1) << glm::degrees(sourceNode->rotation_.z) << UNICODE_DEGREE;
|
||||
|
||||
// compute scaling of diagonal to reach new coordinates
|
||||
handle_polar.x *= glm::length( glm::vec2(source_to) ) / glm::length( glm::vec2(source_from) );
|
||||
@@ -1531,7 +1536,7 @@ void TextureView::initiate()
|
||||
void TextureView::terminate(bool force)
|
||||
{
|
||||
// special case for texture paint: store image on mouse release (end of action PAINT)
|
||||
if ( edit_source_ != nullptr && current_action_.find(MASK_PAINT_ACTION_LABEL) != std::string::npos ) {
|
||||
if ( edit_source_ != nullptr && current_action_.find(MaskShader::mask_names[MaskShader::PAINT]) != std::string::npos ) {
|
||||
edit_source_->storeMask();
|
||||
edit_source_->maskShader()->cursor = glm::vec4(100.0, 100.0, 0.f, 0.f);
|
||||
}
|
||||
|
||||
@@ -1873,7 +1873,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
if (ImGuiToolkit::IconButton( 18, 9, "Angle")) {
|
||||
n->rotation_.z = 0.f;
|
||||
s->touch();
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
info << "Angle " << std::fixed << std::setprecision(2) << n->rotation_.z * 180.f / M_PI << UNICODE_DEGREE;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
float v_deg = n->rotation_.z * 360.0f / (2.f*M_PI);
|
||||
@@ -1887,11 +1887,11 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
|
||||
v_deg = CLAMP(v_deg + 0.01f * io.MouseWheel, -180.f, 180.f);
|
||||
n->rotation_.z = v_deg * (2.f*M_PI) / 360.0f;
|
||||
s->touch();
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
info << "Angle " << std::fixed << std::setprecision(2) << n->rotation_.z * 180.f / M_PI << UNICODE_DEGREE;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
if ( ImGui::IsItemDeactivatedAfterEdit() ) {
|
||||
info << "Angle " << std::setprecision(3) << n->rotation_.z * 180.f / M_PI;
|
||||
info << "Angle " << std::fixed << std::setprecision(2) << n->rotation_.z * 180.f / M_PI << UNICODE_DEGREE;
|
||||
Action::manager().store(info.str());
|
||||
}
|
||||
|
||||
@@ -3596,7 +3596,7 @@ void Navigator::RenderSourcePannel(Source *s, const ImVec2 &iconsize)
|
||||
// delete button
|
||||
if ( ImGui::Button( ACTION_DELETE, ImVec2(ImGui::GetContentRegionAvail().x, 0)) ) {
|
||||
Mixer::manager().deleteSource(s);
|
||||
Action::manager().store(sname + std::string(": deleted"));
|
||||
Action::manager().store(sname + std::string(": Deleted"));
|
||||
}
|
||||
if ( Mixer::manager().session()->failedSources().size() > 1 ) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(IMGUI_COLOR_FAILED, 1.));
|
||||
@@ -4922,7 +4922,7 @@ void Navigator::RenderMainPannelSession()
|
||||
|
||||
for (uint i = Action::manager().max(); i > 0; --i) {
|
||||
|
||||
if (ImGui::Selectable( Action::manager().label(i).c_str(), i == Action::manager().current(), ImGuiSelectableFlags_AllowDoubleClick, size )) {
|
||||
if (ImGui::Selectable( Action::manager().shortlabel(i).c_str(), i == Action::manager().current(), ImGuiSelectableFlags_AllowDoubleClick, size )) {
|
||||
// go to on double clic
|
||||
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
|
||||
Action::manager().stepTo(i);
|
||||
@@ -4943,7 +4943,7 @@ void Navigator::RenderMainPannelSession()
|
||||
_displayed_over = _over;
|
||||
text = Action::manager().label(_over);
|
||||
if (text.find_first_of(':') < text.size())
|
||||
text = text.insert( text.find_first_of(':') + 1, 1, '\n');
|
||||
text = text.insert( text.find_first_of(':') + 2, 1, '\n');
|
||||
FrameBufferImage *im = Action::manager().thumbnail(_over);
|
||||
if (im) {
|
||||
// set image content to thumbnail display
|
||||
|
||||
@@ -293,7 +293,7 @@ void View::lock(Source *s, bool on)
|
||||
{
|
||||
s->setLocked(on);
|
||||
if (on)
|
||||
Action::manager().store(s->name() + std::string(": lock."));
|
||||
Action::manager().store(s->name() + std::string(": Locked"));
|
||||
else
|
||||
Action::manager().store(s->name() + std::string(": unlock."));
|
||||
Action::manager().store(s->name() + std::string(": Unlocked"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user