Merged master into gtk3, manually copied rtgui/threadutils.h over from master
This commit is contained in:
@@ -214,7 +214,7 @@ FileBrowser::FileBrowser ()
|
||||
/***********************
|
||||
* external programs
|
||||
* *********************/
|
||||
#if defined(WIN32) && defined(PROTECT_VECTORS)
|
||||
#if defined(WIN32)
|
||||
Gtk::manage(miOpenDefaultViewer = new Gtk::MenuItem (M("FILEBROWSER_OPENDEFAULTVIEWER")));
|
||||
#else
|
||||
miOpenDefaultViewer = NULL;
|
||||
@@ -467,9 +467,7 @@ void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry)
|
||||
{
|
||||
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
trash->set_sensitive (false);
|
||||
untrash->set_sensitive (false);
|
||||
@@ -606,9 +604,7 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
||||
|
||||
// find place in abc order
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
std::vector<ThumbBrowserEntryBase*>::iterator i = fd.begin();
|
||||
|
||||
@@ -628,9 +624,7 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
||||
|
||||
FileBrowserEntry* FileBrowser::delEntry (const Glib::ustring& fname)
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
for (std::vector<ThumbBrowserEntryBase*>::iterator i = fd.begin(); i != fd.end(); i++)
|
||||
if ((*i)->filename == fname) {
|
||||
@@ -639,9 +633,7 @@ FileBrowserEntry* FileBrowser::delEntry (const Glib::ustring& fname)
|
||||
fd.erase (i);
|
||||
std::vector<ThumbBrowserEntryBase*>::iterator j = std::find (selected.begin(), selected.end(), entry);
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
if (j != selected.end()) {
|
||||
if (checkFilter (*j)) {
|
||||
@@ -678,21 +670,15 @@ void FileBrowser::close ()
|
||||
fbih->pending = 0;
|
||||
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
selected.clear ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l); // notifySelectionListener will need read access!
|
||||
#endif
|
||||
|
||||
notifySelectionListener ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_ACQUIRE(l);
|
||||
#endif
|
||||
|
||||
// The listener merges parameters with old values, so delete afterwards
|
||||
for (size_t i = 0; i < fd.size(); i++) {
|
||||
@@ -724,9 +710,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < selected.size(); i++) {
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
@@ -796,9 +780,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
|
||||
} else if (m == selall) {
|
||||
lastClicked = NULL;
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
selected.clear ();
|
||||
|
||||
@@ -1018,9 +1000,7 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
|
||||
|
||||
void FileBrowser::copyProfile ()
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (selected.size() == 1) {
|
||||
clipboard.setProcParams ((static_cast<FileBrowserEntry*>(selected[0]))->thumbnail->getProcParams());
|
||||
@@ -1033,9 +1013,7 @@ void FileBrowser::pasteProfile ()
|
||||
if (clipboard.hasProcParams()) {
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
for (unsigned int i = 0; i < selected.size(); i++) {
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
@@ -1075,9 +1053,7 @@ void FileBrowser::partPasteProfile ()
|
||||
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
for (unsigned int i = 0; i < selected.size(); i++) {
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
@@ -1129,9 +1105,7 @@ void FileBrowser::openDefaultViewer (int destination)
|
||||
bool success = true;
|
||||
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (selected.size() == 1) {
|
||||
success = (static_cast<FileBrowserEntry*>(selected[0]))->thumbnail->openDefaultViewer(destination);
|
||||
@@ -1365,10 +1339,7 @@ int FileBrowser::getThumbnailHeight ()
|
||||
|
||||
void FileBrowser::applyMenuItemActivated (ProfileStoreLabel *label)
|
||||
{
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
const rtengine::procparams::PartialProfile* partProfile = profileStore.getProfile (label->entry);
|
||||
|
||||
@@ -1393,9 +1364,7 @@ void FileBrowser::applyPartialMenuItemActivated (ProfileStoreLabel *label)
|
||||
{
|
||||
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (!tbl || selected.empty()) {
|
||||
return;
|
||||
@@ -1411,9 +1380,7 @@ void FileBrowser::applyPartialMenuItemActivated (ProfileStoreLabel *label)
|
||||
|
||||
if (partialPasteDlg.run() == Gtk::RESPONSE_OK) {
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (bppcl) {
|
||||
bppcl->beginBatchPParamsChange(selected.size());
|
||||
@@ -1450,9 +1417,7 @@ void FileBrowser::applyFilter (const BrowserFilter& filter)
|
||||
bool selchanged = false;
|
||||
numFiltered = 0;
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW); // Don't make this a writer lock! HOMBRE: Why? 'selected' is modified here
|
||||
#endif
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
|
||||
if (filter.showOriginal) {
|
||||
findOriginalEntries(fd);
|
||||
@@ -1703,9 +1668,7 @@ void FileBrowser::requestRanking(int rank)
|
||||
{
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < selected.size(); i++) {
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
@@ -1719,9 +1682,7 @@ void FileBrowser::requestColorLabel(int colorlabel)
|
||||
{
|
||||
std::vector<FileBrowserEntry*> mselected;
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
for (size_t i = 0; i < selected.size(); i++) {
|
||||
mselected.push_back (static_cast<FileBrowserEntry*>(selected[i]));
|
||||
@@ -1761,9 +1722,7 @@ void FileBrowser::buttonPressed (LWButton* button, int actionCode, void* actionD
|
||||
|
||||
void FileBrowser::openNextImage ()
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (!fd.empty() && selected.size() > 0 && !options.tabbedUI) {
|
||||
|
||||
@@ -1785,16 +1744,12 @@ void FileBrowser::openNextImage ()
|
||||
selected.push_back (fd[k]);
|
||||
//queue_draw ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
// this will require a read access
|
||||
notifySelectionListener ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_ACQUIRE(l);
|
||||
#endif
|
||||
|
||||
// scroll to the selected position
|
||||
double h1, v1;
|
||||
@@ -1806,9 +1761,7 @@ void FileBrowser::openNextImage ()
|
||||
Thumbnail* thumb = (static_cast<FileBrowserEntry*>(fd[k]))->thumbnail;
|
||||
int minWidth = get_width() - fd[k]->getMinimalWidth();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
// scroll only when selected[0] is outside of the displayed bounds
|
||||
if (h2 + minWidth - h1 > get_width()) {
|
||||
@@ -1834,9 +1787,7 @@ void FileBrowser::openNextImage ()
|
||||
|
||||
void FileBrowser::openPrevImage ()
|
||||
{
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (!fd.empty() && selected.size() > 0 && !options.tabbedUI) {
|
||||
|
||||
@@ -1858,16 +1809,12 @@ void FileBrowser::openPrevImage ()
|
||||
selected.push_back (fd[k]);
|
||||
//queue_draw ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
// this will require a read access
|
||||
notifySelectionListener ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_ACQUIRE(l);
|
||||
#endif
|
||||
|
||||
// scroll to the selected position
|
||||
double h1, v1;
|
||||
@@ -1879,9 +1826,7 @@ void FileBrowser::openPrevImage ()
|
||||
Thumbnail* thumb = (static_cast<FileBrowserEntry*>(fd[k]))->thumbnail;
|
||||
int minWidth = get_width() - fd[k]->getMinimalWidth();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
// scroll only when selected[0] is outside of the displayed bounds
|
||||
if (h2 + minWidth - h1 > get_width()) {
|
||||
@@ -1910,10 +1855,7 @@ void FileBrowser::selectImage (Glib::ustring fname)
|
||||
{
|
||||
|
||||
// need to clear the filter in filecatalog
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
if (!fd.empty() && !options.tabbedUI) {
|
||||
for (size_t i = 0; i < fd.size(); i++) {
|
||||
@@ -1932,24 +1874,18 @@ void FileBrowser::selectImage (Glib::ustring fname)
|
||||
selected.push_back (fd[i]);
|
||||
queue_draw ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
// this will require a read access
|
||||
notifySelectionListener ();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_ACQUIRE(l);
|
||||
#endif
|
||||
|
||||
// scroll to the selected position
|
||||
double h = selected[0]->getStartX();
|
||||
double v = selected[0]->getStartY();
|
||||
|
||||
#if PROTECT_VECTORS
|
||||
MYWRITERLOCK_RELEASE(l);
|
||||
#endif
|
||||
|
||||
setScrollPosition(h, v);
|
||||
|
||||
@@ -2000,9 +1936,7 @@ void FileBrowser::notifySelectionListener ()
|
||||
{
|
||||
|
||||
if (tbl) {
|
||||
#if PROTECT_VECTORS
|
||||
MYREADERLOCK(l, entryRW);
|
||||
#endif
|
||||
|
||||
std::vector<Thumbnail*> thm;
|
||||
|
||||
|
Reference in New Issue
Block a user