mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 23:40:02 +01:00
Reordering of Sources in list.
This commit is contained in:
@@ -1108,7 +1108,7 @@ void ImGuiToolkit::SetAccentColor(accent_color color)
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.13f);
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.10f, 0.10f, 0.10f, 0.60f);
|
||||
|
||||
colors[ImGuiCol_DragDropTarget] = colors[ImGuiCol_HeaderActive];
|
||||
}
|
||||
else if (color == ImGuiToolkit::ACCENT_GREY) {
|
||||
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
@@ -1159,6 +1159,7 @@ void ImGuiToolkit::SetAccentColor(accent_color color)
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.13f);
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.10f, 0.10f, 0.10f, 0.60f);
|
||||
colors[ImGuiCol_DragDropTarget] = colors[ImGuiCol_HeaderActive];
|
||||
}
|
||||
else {
|
||||
// default BLUE
|
||||
@@ -1188,7 +1189,7 @@ void ImGuiToolkit::SetAccentColor(accent_color color)
|
||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.24f, 0.24f, 0.24f, 0.67f);
|
||||
colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
|
||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.51f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.71f);
|
||||
colors[ImGuiCol_Separator] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
|
||||
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.67f);
|
||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.59f, 0.73f, 0.90f, 0.95f);
|
||||
@@ -1210,7 +1211,9 @@ void ImGuiToolkit::SetAccentColor(accent_color color)
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.13f);
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.10f, 0.10f, 0.10f, 0.60f);
|
||||
colors[ImGuiCol_DragDropTarget] = colors[ImGuiCol_HeaderActive];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
17
Session.cpp
17
Session.cpp
@@ -275,6 +275,23 @@ int Session::index(SourceList::iterator it) const
|
||||
return index;
|
||||
}
|
||||
|
||||
void Session::move(int current_index, int target_index)
|
||||
{
|
||||
if ( current_index < 0 || current_index > sources_.size()
|
||||
|| target_index < 0 || target_index > sources_.size()
|
||||
|| target_index == current_index )
|
||||
return;
|
||||
|
||||
SourceList::iterator from = at(current_index);
|
||||
SourceList::iterator to = at(target_index);
|
||||
if ( target_index > current_index )
|
||||
to++;
|
||||
|
||||
Source *s = (*from);
|
||||
sources_.erase(from);
|
||||
sources_.insert(to, s);
|
||||
}
|
||||
|
||||
void Session::lock()
|
||||
{
|
||||
access_.lock();
|
||||
|
||||
@@ -43,7 +43,8 @@ public:
|
||||
std::list<uint64_t> getIdList() const;
|
||||
|
||||
SourceList::iterator at (int index);
|
||||
int index (SourceList::iterator it) const;
|
||||
int index (SourceList::iterator it) const;
|
||||
void move (int current_index, int target_index);
|
||||
|
||||
// update all sources and mark sources which failed
|
||||
void update (float dt);
|
||||
|
||||
@@ -1945,8 +1945,9 @@ void Navigator::Render()
|
||||
SourceList::iterator iter;
|
||||
for (iter = Mixer::manager().session()->begin(); iter != Mixer::manager().session()->end(); iter++, index++)
|
||||
{
|
||||
Source *s = (*iter);
|
||||
// draw an indicator for current source
|
||||
if ( (*iter)->mode() >= Source::SELECTED ){
|
||||
if ( s->mode() >= Source::SELECTED ){
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
ImVec2 p1 = ImGui::GetCursorScreenPos() + ImVec2(icon_width, 0.5f * icon_width);
|
||||
ImVec2 p2 = ImVec2(p1.x + 2.f, p1.y + 2.f);
|
||||
@@ -1958,13 +1959,32 @@ void Navigator::Render()
|
||||
draw_list->AddRect(p1, p2, color, 0.0f, 0, 3.f);
|
||||
}
|
||||
// draw select box
|
||||
ImGui::PushID(std::to_string((*iter)->group(View::RENDERING)->id()).c_str());
|
||||
if (ImGui::Selectable( (*iter)->initials(), &selected_button[index], 0, iconsize))
|
||||
ImGui::PushID(std::to_string(s->group(View::RENDERING)->id()).c_str());
|
||||
if (ImGui::Selectable(s->initials(), &selected_button[index], 0, iconsize))
|
||||
{
|
||||
applyButtonSelection(index);
|
||||
if (selected_button[index])
|
||||
Mixer::manager().setCurrentIndex(index);
|
||||
}
|
||||
|
||||
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_None))
|
||||
{
|
||||
ImGui::SetDragDropPayload("DND_SOURCE", &index, sizeof(int));
|
||||
ImGui::Text("%s", s->initials());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
if (ImGui::BeginDragDropTarget())
|
||||
{
|
||||
if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("DND_SOURCE"))
|
||||
{
|
||||
if ( payload->DataSize == sizeof(int) ) {
|
||||
int payload_index = *(const int*)payload->Data;
|
||||
Mixer::manager().session()->move(payload_index, index);
|
||||
}
|
||||
}
|
||||
ImGui::EndDragDropTarget();
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
@@ -2501,10 +2521,10 @@ void Navigator::RenderMainPannel()
|
||||
ImGui::PopFont();
|
||||
|
||||
// Icon to switch fullscreen
|
||||
ImGui::SetCursorPos(ImVec2(pannel_width_ - 35.f, 15.f));
|
||||
ImGui::SetCursorPos(ImVec2(pannel_width_ - 40.f, 13.f));
|
||||
const char *tooltip[2] = {"Enter Fullscreen (" CTRL_MOD "Shift+F)", "Exit Fullscreen (" CTRL_MOD "Shift+F)"};
|
||||
bool fs = Rendering::manager().mainWindow().isFullscreen();
|
||||
if ( ImGuiToolkit::IconToggle(3,15,2,15, &fs, tooltip ) ) {
|
||||
if ( ImGuiToolkit::IconToggle(4,15,3,15, &fs, tooltip ) ) {
|
||||
Rendering::manager().mainWindow().toggleFullscreen();
|
||||
}
|
||||
// Session menu
|
||||
@@ -2629,7 +2649,7 @@ void Navigator::RenderMainPannel()
|
||||
// display the sessions list and detect if one was selected (double clic)
|
||||
bool session_selected = false;
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::ListBoxHeader("##Sessions", 5);
|
||||
ImGui::ListBoxHeader("##Sessions", CLAMP(sessions_list.size(), 4, 8));
|
||||
static std::string file_info = "";
|
||||
static std::list<std::string>::iterator file_selected = sessions_list.end();
|
||||
for(auto it = sessions_list.begin(); it != sessions_list.end(); it++) {
|
||||
|
||||
Reference in New Issue
Block a user