Center selected thumb in Filmstrip #5174
When opening an image, selecting the next/previous image or syncing the Filmstrip, the newly selected thumbnail is centered, unless it lies within the visible area more than 1 thumbnails-width away from either edge, in which case centering does not occur.
This commit is contained in:
@@ -1057,14 +1057,14 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc)
|
|||||||
} else {
|
} else {
|
||||||
Gtk::Allocation alloc;
|
Gtk::Allocation alloc;
|
||||||
iareapanel->imageArea->on_resized (alloc);
|
iareapanel->imageArea->on_resized (alloc);
|
||||||
}
|
|
||||||
|
|
||||||
history->resetSnapShotNumber();
|
|
||||||
navigator->setInvalid(ipc->getFullWidth(),ipc->getFullHeight());
|
|
||||||
|
|
||||||
// When passing a photo as an argument to the RawTherapee executable, the user wants
|
// When passing a photo as an argument to the RawTherapee executable, the user wants
|
||||||
// this auto-loaded photo's thumbnail to be selected and visible in the Filmstrip.
|
// this auto-loaded photo's thumbnail to be selected and visible in the Filmstrip.
|
||||||
EditorPanel::syncFileBrowser();
|
EditorPanel::syncFileBrowser();
|
||||||
|
}
|
||||||
|
|
||||||
|
history->resetSnapShotNumber();
|
||||||
|
navigator->setInvalid(ipc->getFullWidth(),ipc->getFullHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorPanel::close ()
|
void EditorPanel::close ()
|
||||||
|
@@ -1727,62 +1727,62 @@ void FileBrowser::buttonPressed (LWButton* button, int actionCode, void* actionD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::openNextImage ()
|
void FileBrowser::openNextImage()
|
||||||
{
|
{
|
||||||
MYWRITERLOCK(l, entryRW);
|
MYWRITERLOCK(l, entryRW);
|
||||||
|
|
||||||
if (!fd.empty() && selected.size() > 0 && !options.tabbedUI) {
|
if (!fd.empty() && selected.size() > 0 && !options.tabbedUI) {
|
||||||
|
|
||||||
for (size_t i = 0; i < fd.size() - 1; i++) {
|
for (size_t i = 0; i < fd.size() - 1; i++) {
|
||||||
if (selected[0]->thumbnail->getFileName() == fd[i]->filename) { // located 1-st image in current selection
|
if (selected[0]->thumbnail->getFileName() == fd[i]->filename) { // located 1-st image in current selection
|
||||||
if (i < fd.size() && tbl) {
|
if (i < fd.size() && tbl) {
|
||||||
// find the first not-filtered-out (next) image
|
// find the first not-filtered-out (next) image
|
||||||
for (size_t k = i + 1; k < fd.size(); k++) {
|
for (size_t k = i + 1; k < fd.size(); k++) {
|
||||||
if (!fd[k]->filtered/*checkFilter (fd[k])*/) {
|
if (!fd[k]->filtered/*checkFilter (fd[k])*/) {
|
||||||
|
|
||||||
// clear current selection
|
// clear current selection
|
||||||
for (size_t j = 0; j < selected.size(); j++) {
|
for (size_t j = 0; j < selected.size(); j++) {
|
||||||
selected[j]->selected = false;
|
selected[j]->selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
selected.clear ();
|
selected.clear();
|
||||||
|
|
||||||
// set new selection
|
// set new selection
|
||||||
fd[k]->selected = true;
|
fd[k]->selected = true;
|
||||||
selected.push_back (fd[k]);
|
selected.push_back(fd[k]);
|
||||||
//queue_draw ();
|
//queue_draw();
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
|
|
||||||
// this will require a read access
|
// this will require a read access
|
||||||
notifySelectionListener ();
|
notifySelectionListener();
|
||||||
|
|
||||||
MYWRITERLOCK_ACQUIRE(l);
|
MYWRITERLOCK_ACQUIRE(l);
|
||||||
|
|
||||||
// scroll to the selected position
|
// scroll to the selected position, centered horizontally in the container
|
||||||
double h1, v1;
|
double x1, y1;
|
||||||
getScrollPosition(h1, v1);
|
getScrollPosition(x1, y1);
|
||||||
|
|
||||||
double h2 = selected[0]->getStartX();
|
double x2 = selected[0]->getStartX();
|
||||||
double v2 = selected[0]->getStartY();
|
double y2 = selected[0]->getStartY();
|
||||||
|
|
||||||
Thumbnail* thumb = (static_cast<FileBrowserEntry*>(fd[k]))->thumbnail;
|
Thumbnail* thumb = (static_cast<FileBrowserEntry*>(fd[k]))->thumbnail;
|
||||||
int minWidth = get_width() - fd[k]->getMinimalWidth();
|
int tw = fd[k]->getMinimalWidth(); // thumb width
|
||||||
|
|
||||||
|
int ww = get_width(); // window width
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
|
|
||||||
// scroll only when selected[0] is outside of the displayed bounds
|
// scroll only when selected[0] is outside of the displayed bounds
|
||||||
if (h2 + minWidth - h1 > get_width()) {
|
// or less than a thumbnail's width from either edge.
|
||||||
setScrollPosition(h2 - minWidth, v2);
|
if ((x2 > x1 + ww - 2 * tw) || (x2 - tw < x1)) {
|
||||||
}
|
setScrollPosition(x2 - (ww - tw) / 2, y2);
|
||||||
|
|
||||||
if (h1 > h2) {
|
|
||||||
setScrollPosition(h2, v2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the selected image
|
// open the selected image
|
||||||
std::vector<Thumbnail*> entries;
|
std::vector<Thumbnail*> entries;
|
||||||
entries.push_back (thumb);
|
entries.push_back(thumb);
|
||||||
tbl->openRequested (entries);
|
tbl->openRequested(entries);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1792,62 +1792,62 @@ void FileBrowser::openNextImage ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::openPrevImage ()
|
void FileBrowser::openPrevImage()
|
||||||
{
|
{
|
||||||
MYWRITERLOCK(l, entryRW);
|
MYWRITERLOCK(l, entryRW);
|
||||||
|
|
||||||
if (!fd.empty() && selected.size() > 0 && !options.tabbedUI) {
|
if (!fd.empty() && selected.size() > 0 && !options.tabbedUI) {
|
||||||
|
|
||||||
for (size_t i = 1; i < fd.size(); i++) {
|
for (size_t i = 1; i < fd.size(); i++) {
|
||||||
if (selected[0]->thumbnail->getFileName() == fd[i]->filename) { // located 1-st image in current selection
|
if (selected[0]->thumbnail->getFileName() == fd[i]->filename) { // located 1-st image in current selection
|
||||||
if (i > 0 && tbl) {
|
if (i > 0 && tbl) {
|
||||||
// find the first not-filtered-out (previous) image
|
// find the first not-filtered-out (previous) image
|
||||||
for (ssize_t k = (ssize_t)i - 1; k >= 0; k--) {
|
for (ssize_t k = (ssize_t)i - 1; k >= 0; k--) {
|
||||||
if (!fd[k]->filtered/*checkFilter (fd[k])*/) {
|
if (!fd[k]->filtered/*checkFilter (fd[k])*/) {
|
||||||
|
|
||||||
// clear current selection
|
// clear current selection
|
||||||
for (size_t j = 0; j < selected.size(); j++) {
|
for (size_t j = 0; j < selected.size(); j++) {
|
||||||
selected[j]->selected = false;
|
selected[j]->selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
selected.clear ();
|
selected.clear();
|
||||||
|
|
||||||
// set new selection
|
// set new selection
|
||||||
fd[k]->selected = true;
|
fd[k]->selected = true;
|
||||||
selected.push_back (fd[k]);
|
selected.push_back(fd[k]);
|
||||||
//queue_draw ();
|
//queue_draw();
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
|
|
||||||
// this will require a read access
|
// this will require a read access
|
||||||
notifySelectionListener ();
|
notifySelectionListener();
|
||||||
|
|
||||||
MYWRITERLOCK_ACQUIRE(l);
|
MYWRITERLOCK_ACQUIRE(l);
|
||||||
|
|
||||||
// scroll to the selected position
|
// scroll to the selected position, centered horizontally in the container
|
||||||
double h1, v1;
|
double x1, y1;
|
||||||
getScrollPosition(h1, v1);
|
getScrollPosition(x1, y1);
|
||||||
|
|
||||||
double h2 = selected[0]->getStartX();
|
double x2 = selected[0]->getStartX();
|
||||||
double v2 = selected[0]->getStartY();
|
double y2 = selected[0]->getStartY();
|
||||||
|
|
||||||
Thumbnail* thumb = (static_cast<FileBrowserEntry*>(fd[k]))->thumbnail;
|
Thumbnail* thumb = (static_cast<FileBrowserEntry*>(fd[k]))->thumbnail;
|
||||||
int minWidth = get_width() - fd[k]->getMinimalWidth();
|
int tw = fd[k]->getMinimalWidth(); // thumb width
|
||||||
|
|
||||||
|
int ww = get_width(); // window width
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
|
|
||||||
// scroll only when selected[0] is outside of the displayed bounds
|
// scroll only when selected[0] is outside of the displayed bounds
|
||||||
if (h2 + minWidth - h1 > get_width()) {
|
// or less than a thumbnail's width from either edge.
|
||||||
setScrollPosition(h2 - minWidth, v2);
|
if ((x2 > x1 + ww - 2 * tw) || (x2 - tw < x1)) {
|
||||||
}
|
setScrollPosition(x2 - (ww - tw) / 2, y2);
|
||||||
|
|
||||||
if (h1 > h2) {
|
|
||||||
setScrollPosition(h2, v2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the selected image
|
// open the selected image
|
||||||
std::vector<Thumbnail*> entries;
|
std::vector<Thumbnail*> entries;
|
||||||
entries.push_back (thumb);
|
entries.push_back(thumb);
|
||||||
tbl->openRequested (entries);
|
tbl->openRequested(entries);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1857,11 +1857,8 @@ void FileBrowser::openPrevImage ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBrowser::selectImage(Glib::ustring fname)
|
||||||
void FileBrowser::selectImage (Glib::ustring fname)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
// need to clear the filter in filecatalog
|
|
||||||
MYWRITERLOCK(l, entryRW);
|
MYWRITERLOCK(l, entryRW);
|
||||||
|
|
||||||
if (!fd.empty() && !options.tabbedUI) {
|
if (!fd.empty() && !options.tabbedUI) {
|
||||||
@@ -1874,27 +1871,31 @@ void FileBrowser::selectImage (Glib::ustring fname)
|
|||||||
selected[j]->selected = false;
|
selected[j]->selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
selected.clear ();
|
selected.clear();
|
||||||
|
|
||||||
// set new selection
|
// set new selection
|
||||||
fd[i]->selected = true;
|
fd[i]->selected = true;
|
||||||
selected.push_back (fd[i]);
|
selected.push_back(fd[i]);
|
||||||
queue_draw ();
|
queue_draw();
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
|
|
||||||
// this will require a read access
|
// this will require a read access
|
||||||
notifySelectionListener ();
|
notifySelectionListener();
|
||||||
|
|
||||||
MYWRITERLOCK_ACQUIRE(l);
|
MYWRITERLOCK_ACQUIRE(l);
|
||||||
|
|
||||||
// scroll to the selected position
|
// scroll to the selected position, centered horizontally in the container
|
||||||
double h = selected[0]->getStartX();
|
double x = selected[0]->getStartX();
|
||||||
double v = selected[0]->getStartY();
|
double y = selected[0]->getStartY();
|
||||||
|
|
||||||
|
int tw = fd[i]->getMinimalWidth(); // thumb width
|
||||||
|
|
||||||
|
int ww = get_width(); // window width
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
|
|
||||||
setScrollPosition(h, v);
|
setScrollPosition(x - (ww - tw) / 2, y);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -181,12 +181,13 @@ public:
|
|||||||
return tbl ? tbl->isInTabMode() : false;
|
return tbl ? tbl->isInTabMode() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void openNextImage ();
|
void openNextImage();
|
||||||
void openPrevImage ();
|
void openPrevImage();
|
||||||
|
void selectImage(Glib::ustring fname);
|
||||||
|
|
||||||
void copyProfile ();
|
void copyProfile ();
|
||||||
void pasteProfile ();
|
void pasteProfile ();
|
||||||
void partPasteProfile ();
|
void partPasteProfile ();
|
||||||
void selectImage (Glib::ustring fname);
|
|
||||||
void openNextPreviousEditorImage (Glib::ustring fname, eRTNav eNextPrevious);
|
void openNextPreviousEditorImage (Glib::ustring fname, eRTNav eNextPrevious);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Reference in New Issue
Block a user