Fixed image should not open multiple times

see issue 1024
This commit is contained in:
Oliver Duis
2011-10-03 19:04:44 +02:00
parent f5d3f60789
commit 6f5eb6b371
5 changed files with 32 additions and 7 deletions

View File

@@ -115,13 +115,6 @@ void EditWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) {
}
void EditWindow::addEditorPanel (EditorPanel* ep, const std::string &name) {
if (epanels.find(name)!=epanels.end()) {
// remove existing panel
mainNB->remove_page (*epanels[name]);
epanels.erase (name);
filesEdited.erase (name);
}
ep->setParent (parent);
// construct closeable tab for the image
@@ -162,6 +155,16 @@ void EditWindow::remEditorPanel (EditorPanel* ep) {
// TODO: save options if wanted
}
bool EditWindow::selectEditorPanel(const std::string &name) {
std::map<Glib::ustring, EditorPanel*>::iterator iep = epanels.find(name);
if (iep!=epanels.end()) {
mainNB->set_current_page (mainNB->page_num (*iep->second));
return true;
}
return false;
}
bool EditWindow::keyPressed (GdkEventKey* event) {
if(event->keyval == GDK_F11) {
toggleFullscreen();

View File

@@ -45,6 +45,7 @@ class EditWindow : public Gtk::Window {
void addEditorPanel (EditorPanel* ep,const std::string &name);
void remEditorPanel (EditorPanel* ep);
bool selectEditorPanel(const std::string &name);
bool keyPressed (GdkEventKey* event);
bool on_delete_event(GdkEventAny* event);

View File

@@ -150,6 +150,10 @@ bool FilePanel::fileSelected (Thumbnail* thm) {
if (!parent)
return false;
// Check if it's already open BEFORE loading the file
if (options.tabbedUI && parent->selectEditorPanel(Glib::path_get_basename (thm->getFileName())))
return true;
// try to open the file
bool loading = thm->imageLoad( true );
if( !loading ) return false;

View File

@@ -292,6 +292,22 @@ void RTWindow::remEditorPanel (EditorPanel* ep) {
}
}
bool RTWindow::selectEditorPanel(const std::string &name) {
if (EditWindow::isMultiDisplayEnabled()) {
EditWindow * wndEdit = EditWindow::getInstance(this);
if (wndEdit->selectEditorPanel(name)) return true;
} else {
std::map<Glib::ustring, EditorPanel*>::iterator iep = epanels.find(name);
if (iep!=epanels.end()) {
mainNB->set_current_page (mainNB->page_num (*iep->second));
return true;
}
}
return false;
}
bool RTWindow::keyPressed (GdkEventKey* event) {
bool ctrl = event->state & GDK_CONTROL_MASK;

View File

@@ -51,6 +51,7 @@ class RTWindow : public Gtk::Window, public rtengine::ProgressListener{
void addEditorPanel (EditorPanel* ep,const std::string &name);
void remEditorPanel (EditorPanel* ep);
bool selectEditorPanel(const std::string &name);
void addBatchQueueJob (BatchQueueEntry* bqe, bool head=false);
void addBatchQueueJobs (std::vector<BatchQueueEntry*> &entries);