Merge pull request #6814 from Lawrence37/multi-editor-tabs-external-editor-bugfix

External editor button: synchronize in multiple editors layout
This commit is contained in:
Lawrence37 2023-08-18 21:03:18 -07:00 committed by GitHub
commit a56c11570f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 4 deletions

View File

@ -488,6 +488,13 @@ void EditWindow::set_title_decorated(Glib::ustring fname)
set_title("RawTherapee " + M("EDITWINDOW_TITLE") + subtitle); set_title("RawTherapee " + M("EDITWINDOW_TITLE") + subtitle);
} }
void EditWindow::updateExternalEditorWidget(int selectedIndex, const std::vector<ExternalEditor> &editors)
{
for (const auto& panel : epanels) {
panel.second->updateExternalEditorWidget(selectedIndex, editors);
}
}
void EditWindow::updateToolPanelToolLocations( void EditWindow::updateToolPanelToolLocations(
const std::vector<Glib::ustring> &favorites, bool cloneFavoriteTools) const std::vector<Glib::ustring> &favorites, bool cloneFavoriteTools)
{ {

View File

@ -24,6 +24,7 @@
#include "guiutils.h" #include "guiutils.h"
class EditorPanel; class EditorPanel;
class ExternalEditor;
class RTWindow; class RTWindow;
class EditWindow : class EditWindow :
@ -66,6 +67,7 @@ public:
bool selectEditorPanel(const std::string &name); bool selectEditorPanel(const std::string &name);
bool closeOpenEditors(); bool closeOpenEditors();
bool isProcessing(); bool isProcessing();
void updateExternalEditorWidget(int selectedIndex, const std::vector<ExternalEditor> &editors);
void updateToolPanelToolLocations( void updateToolPanelToolLocations(
const std::vector<Glib::ustring> &favorites, bool cloneFavoriteTools); const std::vector<Glib::ustring> &favorites, bool cloneFavoriteTools);

View File

@ -20,10 +20,12 @@
*/ */
#include <gtkmm.h> #include <gtkmm.h>
#include "guiutils.h"
#include "multilangmgr.h" #include "multilangmgr.h"
#include "popupcommon.h" #include "popupcommon.h"
#include "rtimage.h" #include "rtimage.h"
#include "guiutils.h" #include "threadutils.h"
PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label) PopUpCommon::PopUpCommon (Gtk::Button* thisButton, const Glib::ustring& label)
: buttonImage (nullptr) : buttonImage (nullptr)
@ -203,6 +205,15 @@ void PopUpCommon::changeImage(const Glib::ustring& fileName, const Glib::RefPtr<
void PopUpCommon::entrySelected(Gtk::Widget* widget) void PopUpCommon::entrySelected(Gtk::Widget* widget)
{ {
if (widget != menu->get_active()) { // Not actually selected.
return;
}
if (!entrySelectionMutex.trylock()) { // Already being updated.
return;
}
entrySelectionMutex.unlock();
int i = 0; int i = 0;
for (const auto & child : menu->get_children()) { for (const auto & child : menu->get_children()) {
if (widget == child) { if (widget == child) {
@ -249,7 +260,8 @@ bool PopUpCommon::setSelected (int entryNum)
setButtonHint(); setButtonHint();
auto radioMenuItem = dynamic_cast<Gtk::RadioMenuItem*>(menu->get_children()[entryNum]); auto radioMenuItem = dynamic_cast<Gtk::RadioMenuItem*>(menu->get_children()[entryNum]);
if (radioMenuItem && menu->get_active() != radioMenuItem) { if (radioMenuItem && !radioMenuItem->get_active()) {
MyMutex::MyLock updateLock(entrySelectionMutex);
radioMenuItem->set_active(); radioMenuItem->set_active();
} }

View File

@ -20,12 +20,13 @@
*/ */
#pragma once #pragma once
#include "glibmm/refptr.h" #include "threadutils.h"
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h> #include <glibmm/ustring.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
namespace Gio namespace Gio
@ -91,6 +92,7 @@ private:
Gtk::Button* arrowButton; Gtk::Button* arrowButton;
int selected; int selected;
bool hasMenu; bool hasMenu;
MyMutex entrySelectionMutex;
void changeImage(int position); void changeImage(int position);
void changeImage(const Glib::ustring& fileName, const Glib::RefPtr<const Gio::Icon>& gIcon); void changeImage(const Glib::ustring& fileName, const Glib::RefPtr<const Gio::Icon>& gIcon);

View File

@ -589,6 +589,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name)
} else { } else {
ep->setParent (this); ep->setParent (this);
ep->setParentWindow (this); ep->setParentWindow (this);
ep->setExternalEditorChangedSignal(&externalEditorChangedSignal);
// construct closeable tab for the image // construct closeable tab for the image
Gtk::Grid* titleGrid = Gtk::manage (new Gtk::Grid ()); Gtk::Grid* titleGrid = Gtk::manage (new Gtk::Grid ());
@ -637,6 +638,7 @@ void RTWindow::remEditorPanel (EditorPanel* ep)
wndEdit->remEditorPanel (ep); wndEdit->remEditorPanel (ep);
} else { } else {
bool queueHadFocus = (mainNB->get_current_page() == mainNB->page_num (*bpanel)); bool queueHadFocus = (mainNB->get_current_page() == mainNB->page_num (*bpanel));
ep->setExternalEditorChangedSignal(nullptr);
epanels.erase (ep->getFileName()); epanels.erase (ep->getFileName());
filesEdited.erase (ep->getFileName ()); filesEdited.erase (ep->getFileName ());
fpanel->refreshEditedState (filesEdited); fpanel->refreshEditedState (filesEdited);
@ -1060,6 +1062,15 @@ void RTWindow::updateExternalEditorWidget(int selectedIndex, const std::vector<E
if (epanel) { if (epanel) {
epanel->updateExternalEditorWidget(selectedIndex, editors); epanel->updateExternalEditorWidget(selectedIndex, editors);
} }
for (auto panel : epanels) {
panel.second->updateExternalEditorWidget(selectedIndex, editors);
}
if (options.multiDisplayMode > 0) {
EditWindow::getInstance(this)
->updateExternalEditorWidget(selectedIndex, editors);
}
} }
void RTWindow::updateProfiles (const Glib::ustring &printerProfile, rtengine::RenderingIntent printerIntent, bool printerBPC) void RTWindow::updateProfiles (const Glib::ustring &printerProfile, rtengine::RenderingIntent printerIntent, bool printerBPC)

View File

@ -20,6 +20,7 @@
#include <set> #include <set>
#include <gtkmm.h> #include <gtkmm.h>
#include <sigc++/signal.h>
#if defined(__APPLE__) #if defined(__APPLE__)
#include <gtkosxapplication.h> #include <gtkosxapplication.h>
@ -48,6 +49,8 @@ private:
std::set<Glib::ustring> filesEdited; std::set<Glib::ustring> filesEdited;
std::map<Glib::ustring, EditorPanel*> epanels; std::map<Glib::ustring, EditorPanel*> epanels;
sigc::signal<void> externalEditorChangedSignal;
Splash* splash; Splash* splash;
Gtk::ProgressBar prProgBar; Gtk::ProgressBar prProgBar;
PLDBridge* pldBridge; PLDBridge* pldBridge;