Skip to content

Commit

Permalink
Fixed playlist creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Apr 28, 2024
1 parent 018c2c6 commit 8e3741f
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 30 deletions.
2 changes: 2 additions & 0 deletions mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ v1.1.4
and around 300Mb of disk space for it.
- Fixed Preview thumbnails above the Timeline crashing the viewer on all
platforms.
- Fixed Playlist creation showing an empty view for the first clip loaded.
(regression of v1.1.2).


v1.1.3
Expand Down
18 changes: 16 additions & 2 deletions mrv2/lib/mrvEdit/mrvEditCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,9 @@ namespace mrv
destItem->path = file::Path(otioFile);

if (refreshCache)
{
refresh_file_cache_cb(nullptr, ui);
}
else if (create)
{
panel::refreshThumbnails();
Expand Down Expand Up @@ -1954,7 +1956,7 @@ namespace mrv
auto player = ui->uiView->getTimelinePlayer();
if (!player)
return;

auto destTimeline = player->getTimeline();

auto time = getTime(player);
Expand All @@ -1968,6 +1970,7 @@ namespace mrv

auto sourceItem = sourceItems[index];

auto destItemIndex = model->observeAIndex()->get();
auto destItem = model->observeA()->get();
if (!destItem)
{
Expand Down Expand Up @@ -2029,6 +2032,8 @@ namespace mrv
player->getAllAnnotations(), sourceItem->inOutRange,
sourceItem->annotations);

bool emptyTracks = hasEmptyTracks(destTimeline->tracks());

addClipToTimeline(index, destTimeline, ui);

//
Expand All @@ -2046,13 +2051,22 @@ namespace mrv
destItem->inOutRange = timeRange;
destItem->speed = videoRate;

if (emptyTracks)
{
model->setA(index);
model->setA(destItemIndex);
}

ui->uiView->valid(0); // needed
ui->uiView->redraw(); // needed

player = ui->uiView->getTimelinePlayer();
if (!player)
{
LOG_ERROR("No destination player");
return;

}

auto time = timelineDuration.rescaled_to(videoRate) +
sourceItem->currentTime.rescaled_to(videoRate);
updateTimeline(destTimeline, time, ui);
Expand Down
22 changes: 22 additions & 0 deletions mrv2/lib/mrvFl/mrvPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,29 @@ namespace mrv
opengl.get("color_buffers_accuracy", tmp, 0);
uiPrefs->uiPrefsColorAccuracy->value(tmp);


opengl.get("blit_viewports", tmp, 1);

#ifdef __linux__
#ifdef FLTK_USE_X11
if (fl_x11_display())
{
// Check if running under XWayland (we assume if FLTK_BACKEND is
// set, we are).
if (tmp)
{
const char* backend = fl_getenv("FLTK_BACKEND");
if (backend && strcmp(backend, "x11") == 0)
{
LOG_WARNING(_("Running under XWayland. Cannot use "
"Viewport blitting"));
tmp = 0;
}
}
}
#endif
#endif

uiPrefs->uiPrefsBlitViewports->value(tmp);

opengl.get("blit_timeline", tmp, 1);
Expand Down
33 changes: 13 additions & 20 deletions mrv2/lib/mrvGL/mrvTimelineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ namespace mrv
if (!p.thumbnailWindow)
return;

p.thumbnailWindow->hide();
// Make sure we are still hiding it after the timeout
if (Fl::belowmouse() != this)
{
p.thumbnailWindow->hide();
}
}

TimelineWidget::~TimelineWidget()
Expand Down Expand Up @@ -335,7 +339,7 @@ namespace mrv
}
}

int TimelineWidget::_requestThumbnail(bool fetch)
int TimelineWidget::_requestThumbnail(bool fetch, bool show)
{
TLRENDER_P();
if (!p.player)
Expand Down Expand Up @@ -382,15 +386,11 @@ namespace mrv
p.thumbnailWindow->end();
p.thumbnailWindow->show();
}
if (fetch)
{
p.thumbnailWindow->resize(X, Y, W, H);

p.thumbnailWindow->resize(X, Y, W, H);

if (show)
p.thumbnailWindow->show();
}
else
{
p.thumbnailWindow->resize(X, Y, W, H);
}

file::Path path;
auto model = p.ui->app->filesModel();
Expand Down Expand Up @@ -1358,8 +1358,7 @@ namespace mrv
if (p.thumbnailWindow && p.player &&
p.ui->uiPrefs->uiPrefsTimelineThumbnails->value())
{
p.thumbnailWindow->show();
_requestThumbnail();
_requestThumbnail(true, true);
}
return enterEvent();
case FL_LEAVE:
Expand All @@ -1377,22 +1376,20 @@ namespace mrv
return leaveEvent();
case FL_PUSH:
if (p.ui->uiPrefs->uiPrefsTimelineThumbnails->value())
_requestThumbnail(true);
_requestThumbnail(true, false);
return mousePressEvent();
case FL_DRAG:
return mouseDragEvent(Fl::event_x(), Fl::event_y());
case FL_RELEASE:
panel::redrawThumbnails();
return mouseReleaseEvent();
case FL_MOVE:
_requestThumbnail();
_requestThumbnail(true, false);
return mouseMoveEvent();
case FL_MOUSEWHEEL:
return wheelEvent();
case FL_KEYDOWN:
{
// @todo: ask darby for a return code from key press
// int ret = p.ui->uiView->handle(event);
return keyPressEvent();
}
case FL_KEYUP:
Expand All @@ -1416,10 +1413,6 @@ namespace mrv
}
}
int out = Fl_Gl_Window::handle(event);
// if (event->type() == QEvent::StyleChange)
// {
// _styleUpdate();
// }
return out;
}

Expand Down
2 changes: 1 addition & 1 deletion mrv2/lib/mrvGL/mrvTimelineWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace mrv

void _styleUpdate();

int _requestThumbnail(bool fetch = true);
int _requestThumbnail(bool fetch = true, bool show = false);
void _deleteThumbnails();
void _thumbnailsUpdate();

Expand Down
15 changes: 12 additions & 3 deletions mrv2/lib/mrvWidgets/mrvFileButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace mrv

struct FileButton::Private
{
bool isXWayland = false;
size_t index = 0;
FileDragger* drag = nullptr;
math::Vector2i push;
Expand Down Expand Up @@ -149,7 +150,7 @@ namespace mrv
case FL_DRAG:
{
math::Vector2i cursorPos(Fl::event_x_root(), Fl::event_y_root());
if (std::abs(cursorPos.y - p.push.y) < 2)
if (!p.isXWayland && std::abs(cursorPos.y - p.push.y) < 2)
{
return 1;
}
Expand All @@ -175,15 +176,23 @@ namespace mrv
int X = Fl::event_x_root();
int Y = Fl::event_y_root();
auto window = p.drag->window();
#ifdef __linux__
#ifdef FLTK_USE_WAYLAND
std::cerr << X << " " << Y << std::endl;
if (fl_wl_display())
{
window->resize(X, Y, window->w(), window->h());
}
else
{
window->position(X, Y);
}
#else
window->position(X, Y);
#endif
return 1;
#else
window->position(X, Y);
#endif
return 1;
}
}
break;
Expand Down
27 changes: 24 additions & 3 deletions mrv2/lib/mrvWidgets/mrvFileDragger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
#include "mrvWidgets/mrvMainWindow.h"
#include "mrvWidgets/mrvFileDragger.h"

#include "mrViewer.h"

#include <FL/platform.H>


namespace mrv
{
struct FileDragger::Private
{
MainWindow* parent;
MainWindow* window;
Fl_Box* box;
};
Expand All @@ -23,10 +29,25 @@ namespace mrv

int X = Fl::event_x_root();
int Y = Fl::event_y_root();
int W = 128;
int H = 80;
#ifdef FLTK_USE_WAYLAND
if (fl_wl_display())
{
p.parent = App::ui->uiMain;

Fl_Group::current(p.parent);

X -= p.parent->x();
Y -= p.parent->y();
}
#endif
else
{
Fl_Group::current(0);
}

const int W = 128;
const int H = 80;

Fl_Group::current(0);
p.window = new MainWindow(X, Y, W, H);
p.window->border(0);
p.window->begin();
Expand Down
2 changes: 1 addition & 1 deletion mrv2/lib/mrvWidgets/mrvFileDragger.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace mrv
MainWindow* window() const;

void image(Fl_Image*);

private:
TLRENDER_PRIVATE();
};
Expand Down

0 comments on commit 8e3741f

Please sign in to comment.