Enable opening two separate files with the same filename (issue 2268 - Thanks, Ingo!)

This commit is contained in:
michael
2014-06-25 07:19:42 -04:00
parent f9e7072194
commit 3d0a164941
4 changed files with 14 additions and 14 deletions

View File

@@ -126,7 +126,8 @@ void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) {
// construct closeable tab for the image // construct closeable tab for the image
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ()); Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
hb->pack_start (*Gtk::manage (new RTImage ("rtwindow.png"))); hb->pack_start (*Gtk::manage (new RTImage ("rtwindow.png")));
hb->pack_start (*Gtk::manage (new Gtk::Label (name))); hb->pack_start (*Gtk::manage (new Gtk::Label (Glib::path_get_basename (name))));
hb->set_tooltip_markup (name);
Gtk::Button* closeb = Gtk::manage (new Gtk::Button ()); Gtk::Button* closeb = Gtk::manage (new Gtk::Button ());
closeb->set_image (*Gtk::manage(new RTImage ("gtk-close.png"))); closeb->set_image (*Gtk::manage(new RTImage ("gtk-close.png")));
closeb->set_relief (Gtk::RELIEF_NONE); closeb->set_relief (Gtk::RELIEF_NONE);
@@ -153,8 +154,8 @@ void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) {
} }
void EditWindow::remEditorPanel (EditorPanel* ep) { void EditWindow::remEditorPanel (EditorPanel* ep) {
epanels.erase (ep->getShortName()); epanels.erase (ep->getFileName());
filesEdited.erase (ep->getShortName ()); filesEdited.erase (ep->getFileName ());
parent->fpanel->refreshEditedState (filesEdited); parent->fpanel->refreshEditedState (filesEdited);
mainNB->remove_page (*ep); mainNB->remove_page (*ep);

View File

@@ -702,12 +702,10 @@ void FileCatalog::_openImage (std::vector<Thumbnail*> tmb) {
if (enabled && listener!=NULL) { if (enabled && listener!=NULL) {
bool continueToLoad=true; bool continueToLoad=true;
for (size_t i=0; i< tmb.size() && continueToLoad; i++) { for (size_t i=0; i< tmb.size() && continueToLoad; i++) {
if (editedFiles.find (tmb[i]->getFileName())==editedFiles.end()){ // Open the image here, and stop if in Single Editor mode, or if an image couldn't
// Open the image here, and stop if in Single Editor mode, or if an image couldn't // be opened, would it be because the file doesn't exist or because of lack of RAM
// be opened, would it be because the file doesn't exist or because of lack of RAM if( !(listener->fileSelected (tmb[i])) && !options.tabbedUI )
if( !(listener->fileSelected (tmb[i])) && !options.tabbedUI ) continueToLoad = false;
continueToLoad = false;
}
tmb[i]->decreaseRef (); tmb[i]->decreaseRef ();
} }
} }

View File

@@ -168,7 +168,7 @@ bool FilePanel::fileSelected (Thumbnail* thm) {
return false; return false;
// Check if it's already open BEFORE loading the file // Check if it's already open BEFORE loading the file
if (options.tabbedUI && parent->selectEditorPanel(Glib::path_get_basename (thm->getFileName()))) if (options.tabbedUI && parent->selectEditorPanel(thm->getFileName()))
return true; return true;
// try to open the file // try to open the file
@@ -189,7 +189,7 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
{ {
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
epanel = Gtk::manage (new EditorPanel ()); epanel = Gtk::manage (new EditorPanel ());
parent->addEditorPanel (epanel,Glib::path_get_basename (thm->getFileName())); parent->addEditorPanel (epanel,thm->getFileName());
} }
epanel->open(thm, pc->returnValue() ); epanel->open(thm, pc->returnValue() );
} else { } else {

View File

@@ -390,7 +390,8 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) {
// construct closeable tab for the image // construct closeable tab for the image
Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ()); Gtk::HBox* hb = Gtk::manage (new Gtk::HBox ());
hb->pack_start (*Gtk::manage (new RTImage ("rtwindow.png"))); hb->pack_start (*Gtk::manage (new RTImage ("rtwindow.png")));
hb->pack_start (*Gtk::manage (new Gtk::Label (name))); hb->pack_start (*Gtk::manage (new Gtk::Label (Glib::path_get_basename (name))));
hb->set_tooltip_markup (name);
Gtk::Button* closeb = Gtk::manage (new Gtk::Button ()); Gtk::Button* closeb = Gtk::manage (new Gtk::Button ());
closeb->set_image (*Gtk::manage(new RTImage ("gtk-close.png"))); closeb->set_image (*Gtk::manage(new RTImage ("gtk-close.png")));
closeb->set_relief (Gtk::RELIEF_NONE); closeb->set_relief (Gtk::RELIEF_NONE);
@@ -425,8 +426,8 @@ void RTWindow::remEditorPanel (EditorPanel* ep) {
EditWindow * wndEdit = EditWindow::getInstance(this); EditWindow * wndEdit = EditWindow::getInstance(this);
wndEdit->remEditorPanel(ep); wndEdit->remEditorPanel(ep);
} else { } else {
epanels.erase (ep->getShortName()); epanels.erase (ep->getFileName());
filesEdited.erase (ep->getShortName ()); filesEdited.erase (ep->getFileName ());
fpanel->refreshEditedState (filesEdited); fpanel->refreshEditedState (filesEdited);
mainNB->remove_page (*ep); mainNB->remove_page (*ep);