diff --git a/rtdata/images/Dark/actions/previewmodeBC0-off.png b/rtdata/images/Dark/actions/previewmodeBC0-off.png
new file mode 100644
index 000000000..d59363703
Binary files /dev/null and b/rtdata/images/Dark/actions/previewmodeBC0-off.png differ
diff --git a/rtdata/images/Dark/actions/previewmodeBC0-on.png b/rtdata/images/Dark/actions/previewmodeBC0-on.png
new file mode 100644
index 000000000..06f12ef93
Binary files /dev/null and b/rtdata/images/Dark/actions/previewmodeBC0-on.png differ
diff --git a/rtdata/images/Dark/actions/previewmodeBC1-off.png b/rtdata/images/Dark/actions/previewmodeBC1-off.png
new file mode 100644
index 000000000..77dce6dc9
Binary files /dev/null and b/rtdata/images/Dark/actions/previewmodeBC1-off.png differ
diff --git a/rtdata/images/Dark/actions/previewmodeBC1-on.png b/rtdata/images/Dark/actions/previewmodeBC1-on.png
new file mode 100644
index 000000000..451c1fa46
Binary files /dev/null and b/rtdata/images/Dark/actions/previewmodeBC1-on.png differ
diff --git a/rtdata/images/Dark/actions/previewmodeBC2-off.png b/rtdata/images/Dark/actions/previewmodeBC2-off.png
new file mode 100644
index 000000000..4eac31180
Binary files /dev/null and b/rtdata/images/Dark/actions/previewmodeBC2-off.png differ
diff --git a/rtdata/images/Dark/actions/previewmodeBC2-on.png b/rtdata/images/Dark/actions/previewmodeBC2-on.png
new file mode 100644
index 000000000..8a6ad5903
Binary files /dev/null and b/rtdata/images/Dark/actions/previewmodeBC2-on.png differ
diff --git a/rtdata/images/Light/actions/previewmodeBC0-off.png b/rtdata/images/Light/actions/previewmodeBC0-off.png
new file mode 100644
index 000000000..d59363703
Binary files /dev/null and b/rtdata/images/Light/actions/previewmodeBC0-off.png differ
diff --git a/rtdata/images/Light/actions/previewmodeBC0-on.png b/rtdata/images/Light/actions/previewmodeBC0-on.png
new file mode 100644
index 000000000..06f12ef93
Binary files /dev/null and b/rtdata/images/Light/actions/previewmodeBC0-on.png differ
diff --git a/rtdata/images/Light/actions/previewmodeBC1-off.png b/rtdata/images/Light/actions/previewmodeBC1-off.png
new file mode 100644
index 000000000..77dce6dc9
Binary files /dev/null and b/rtdata/images/Light/actions/previewmodeBC1-off.png differ
diff --git a/rtdata/images/Light/actions/previewmodeBC1-on.png b/rtdata/images/Light/actions/previewmodeBC1-on.png
new file mode 100644
index 000000000..451c1fa46
Binary files /dev/null and b/rtdata/images/Light/actions/previewmodeBC1-on.png differ
diff --git a/rtdata/images/Light/actions/previewmodeBC2-off.png b/rtdata/images/Light/actions/previewmodeBC2-off.png
new file mode 100644
index 000000000..4eac31180
Binary files /dev/null and b/rtdata/images/Light/actions/previewmodeBC2-off.png differ
diff --git a/rtdata/images/Light/actions/previewmodeBC2-on.png b/rtdata/images/Light/actions/previewmodeBC2-on.png
new file mode 100644
index 000000000..8a6ad5903
Binary files /dev/null and b/rtdata/images/Light/actions/previewmodeBC2-on.png differ
diff --git a/rtdata/languages/default b/rtdata/languages/default
index d64a3d8a0..d5fb666f3 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -504,6 +504,9 @@ MAIN_TAB_TAGGING;Tagging
MAIN_TAB_TRANSFORM;Transform
MAIN_TAB_TRANSFORM_TOOLTIP;Shortcut: Alt-T
MAIN_TOGGLE_BEFORE_AFTER;B|A
+MAIN_TOOLTIP_BACKCOLOR0;Background color of the preview: Theme-based\nShortcut: 8
+MAIN_TOOLTIP_BACKCOLOR1;Background color of the preview: Black\nShortcut: 9
+MAIN_TOOLTIP_BACKCOLOR2;Background color of the preview: White\nShortcut: 0
MAIN_TOOLTIP_BEFOREAFTERLOCK;Lock / Unlock the Before view\n\nLock: keep the Before view unchanged.\nUseful to evaluate the cumulative effect of multiple tools.\nAdditionally, comparisons can be made to any state in the History\n\nUnlock: the Before view will follow the After view one step behind, showing the image before the effect of the currently used tool.
MAIN_TOOLTIP_HIDEFP;Show/Hide the bottom panel (directory and file browser).\nShortcut: F
MAIN_TOOLTIP_HIDEHP;Show/Hide the left panel (including the history).\nShortcut: l
diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc
index f59c804a3..d2717e72c 100644
--- a/rtgui/cropwindow.cc
+++ b/rtgui/cropwindow.cc
@@ -236,10 +236,11 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) {
zoom11 ();
state = SNormal;
}
- else if (button==1 && type==GDK_2BUTTON_PRESS && onArea (CropBorder, x, y)) {
+ //below code is no longer working/needed after adding buttons for each of the backColor values
+ /*else if (button==1 && type==GDK_2BUTTON_PRESS && onArea (CropBorder, x, y)) {
backColor = (backColor+1) % 3;
options.bgcolor = backColor;
- }
+ }*/
else if (button==1 && type==GDK_BUTTON_PRESS && state==SNormal && onArea (CropToolBar, x, y)) {
if (!decorated || !buttonSet.pressNotify (x, y)) {
state = SCropWinMove;
@@ -638,6 +639,8 @@ void CropWindow::expose (Cairo::RefPtr cr) {
int x = xpos, y = ypos, h = height, w = width;
// draw the background
+ backColor = iarea->previewModePanel->GetbackColor();
+ options.bgcolor = backColor;
if (backColor==0) {
Gdk::Color cback = iarea->get_style()->get_bg(Gtk::STATE_NORMAL);
cr->set_source_rgb (cback.get_red_p(), cback.get_green_p(), cback.get_blue_p());
diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc
index 7c07f8d9c..4b3b4ab1c 100644
--- a/rtgui/editorpanel.cc
+++ b/rtgui/editorpanel.cc
@@ -842,6 +842,16 @@ bool EditorPanel::handleShortcutKey (GdkEventKey* event) {
iareapanel->imageArea->zoomPanel->zoom11Clicked();
return true;
+ case GDK_8: //background color of the preview 0
+ iareapanel->imageArea->previewModePanel->togglebackColor0();
+ return true;
+ case GDK_9: //background color of the preview 1
+ iareapanel->imageArea->previewModePanel->togglebackColor1();
+ return true;
+ case GDK_0: //background color of the preview 2
+ iareapanel->imageArea->previewModePanel->togglebackColor2();
+ return true;
+
case GDK_r: //preview mode Red
iareapanel->imageArea->previewModePanel->toggleR();
return true;
diff --git a/rtgui/previewmodepanel.cc b/rtgui/previewmodepanel.cc
index 3707ba385..f1194ba34 100644
--- a/rtgui/previewmodepanel.cc
+++ b/rtgui/previewmodepanel.cc
@@ -28,12 +28,33 @@ PreviewModePanel::PreviewModePanel (ImageArea* ia) : imageArea(ia) {
iB = new RTImage ("previewmodeB-on.png");
iL = new RTImage ("previewmodeL-on.png");
iF = new RTImage ("previewmodeF-on.png");
-
+ iBC0= new RTImage ("previewmodeBC0-on.png");
+ iBC1= new RTImage ("previewmodeBC1-on.png");
+ iBC2= new RTImage ("previewmodeBC2-on.png");
+
igR = new RTImage ("previewmodeR-off.png");
igG = new RTImage ("previewmodeG-off.png");
igB = new RTImage ("previewmodeB-off.png");
igL = new RTImage ("previewmodeL-off.png");
igF = new RTImage ("previewmodeF-off.png");
+ igBC0= new RTImage ("previewmodeBC0-off.png");
+ igBC1= new RTImage ("previewmodeBC1-off.png");
+ igBC2= new RTImage ("previewmodeBC2-off.png");
+
+ backColor0 = Gtk::manage (new Gtk::ToggleButton ());
+ backColor0->set_relief(Gtk::RELIEF_NONE);
+ backColor0->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR0"));
+ backColor0->set_image(options.bgcolor==0?*iBC0:*igBC0);
+
+ backColor1 = Gtk::manage (new Gtk::ToggleButton ());
+ backColor1->set_relief(Gtk::RELIEF_NONE);
+ backColor1->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR1"));
+ backColor1->set_image(options.bgcolor==1?*iBC1:*igBC1);
+
+ backColor2 = Gtk::manage (new Gtk::ToggleButton ());
+ backColor2->set_relief(Gtk::RELIEF_NONE);
+ backColor2->set_tooltip_markup (M("MAIN_TOOLTIP_BACKCOLOR2"));
+ backColor2->set_image(options.bgcolor==2?*iBC2:*igBC2);
previewR = Gtk::manage (new Gtk::ToggleButton ());
previewR->set_relief(Gtk::RELIEF_NONE);
@@ -66,6 +87,17 @@ PreviewModePanel::PreviewModePanel (ImageArea* ia) : imageArea(ia) {
previewL->set_active (false);
previewFocusMask->set_active (false);
+ backColor0->set_active (options.bgcolor==0?true:false);
+ backColor1->set_active (options.bgcolor==1?true:false);
+ backColor2->set_active (options.bgcolor==2?true:false);
+
+ vbbackColor = Gtk::manage (new Gtk::VBox ());
+ vbbackColor->set_border_width (0);
+ vbbackColor->pack_start (*backColor0, Gtk::PACK_SHRINK, 0);
+ vbbackColor->pack_start (*backColor1, Gtk::PACK_SHRINK, 0);
+ vbbackColor->pack_start (*backColor2, Gtk::PACK_SHRINK, 0);
+ pack_start (*vbbackColor, Gtk::PACK_SHRINK, 0);
+
pack_start (*previewR, Gtk::PACK_SHRINK, 0);
pack_start (*previewG, Gtk::PACK_SHRINK, 0);
pack_start (*previewB, Gtk::PACK_SHRINK, 0);
@@ -78,6 +110,10 @@ PreviewModePanel::PreviewModePanel (ImageArea* ia) : imageArea(ia) {
connL = previewL->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &PreviewModePanel::buttonToggled),previewL) );
connFocusMask = previewFocusMask->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &PreviewModePanel::buttonToggled),previewFocusMask) );
+ connbackColor0 = backColor0->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &PreviewModePanel::buttonToggled_backColor),backColor0) );
+ connbackColor1 = backColor1->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &PreviewModePanel::buttonToggled_backColor),backColor1) );
+ connbackColor2 = backColor2->signal_toggled().connect( sigc::bind(sigc::mem_fun(*this, &PreviewModePanel::buttonToggled_backColor),backColor2) );
+
//show_all ();
}
@@ -87,13 +123,19 @@ PreviewModePanel::~PreviewModePanel (){
delete iB;
delete iL;
delete iF;
+ delete iBC0;
+ delete iBC1;
+ delete iBC2;
delete igR;
delete igG;
delete igB;
delete igL;
delete igF;
+ delete igBC0;
+ delete igBC1;
+ delete igBC2;
}
-//TODO: use functions below for shortcuts
+//toggle Functions below are for shortcuts
void PreviewModePanel::toggleR () {
previewR->set_active(!previewR->get_active());
}
@@ -110,6 +152,16 @@ void PreviewModePanel::toggleFocusMask () {
previewFocusMask->set_active(!previewFocusMask->get_active());
}
+void PreviewModePanel::togglebackColor0 () {
+ backColor0->set_active(!backColor0->get_active());
+}
+void PreviewModePanel::togglebackColor1 () {
+ backColor1->set_active(!backColor1->get_active());
+}
+void PreviewModePanel::togglebackColor2 () {
+ backColor2->set_active(!backColor2->get_active());
+}
+
void PreviewModePanel::buttonToggled (Gtk::ToggleButton* tbpreview) {
connR.block(true);
@@ -146,3 +198,46 @@ void PreviewModePanel::buttonToggled (Gtk::ToggleButton* tbpreview) {
if (imageArea->iLinkedImageArea!=NULL)
imageArea->iLinkedImageArea->queue_draw ();
}
+
+int PreviewModePanel::GetbackColor(){
+ int backColor;
+ if (backColor0->get_active ()) backColor=0;
+ if (backColor1->get_active ()) backColor=1;
+ if (backColor2->get_active ()) backColor=2;
+
+ return backColor;
+}
+
+void PreviewModePanel::buttonToggled_backColor (Gtk::ToggleButton* tbbackColor) {
+
+ connbackColor0.block(true);
+ connbackColor1.block(true);
+ connbackColor2.block(true);
+
+ // control the state of the buttons
+ // Exactly 1 button at a time must remain pressed
+ if (tbbackColor==backColor0 && !backColor0->get_active()) backColor0->set_active(true);
+ if (tbbackColor==backColor1 && !backColor1->get_active()) backColor1->set_active(true);
+ if (tbbackColor==backColor2 && !backColor2->get_active()) backColor2->set_active(true);
+
+ if (tbbackColor!=backColor0) backColor0->set_active(false);
+ if (tbbackColor!=backColor1) backColor1->set_active(false);
+ if (tbbackColor!=backColor2) backColor2->set_active(false);
+
+ // set image based on button's state
+ backColor0->set_image(backColor0->get_active()?*iBC0:*igBC0);
+ backColor1->set_image(backColor1->get_active()?*iBC1:*igBC1);
+ backColor2->set_image(backColor2->get_active()?*iBC2:*igBC2);
+
+ connbackColor0.block(false);
+ connbackColor1.block(false);
+ connbackColor2.block(false);
+
+ //TODO not sure if queue_draw is necessary, but will need to reach to backColor of the Before view
+ imageArea->queue_draw ();
+
+ // this will redraw the linked Before image area
+ // which is set when before/after view is enabled
+ if (imageArea->iLinkedImageArea!=NULL)
+ imageArea->iLinkedImageArea->queue_draw ();
+}
diff --git a/rtgui/previewmodepanel.h b/rtgui/previewmodepanel.h
index 5b1b22e9e..cc2edd33f 100644
--- a/rtgui/previewmodepanel.h
+++ b/rtgui/previewmodepanel.h
@@ -30,6 +30,10 @@ class PreviewModePanel : public Gtk::HBox {
Gtk::ToggleButton* previewB;
Gtk::ToggleButton* previewL;
Gtk::ToggleButton* previewFocusMask;
+ Gtk::ToggleButton* backColor0;
+ Gtk::ToggleButton* backColor1;
+ Gtk::ToggleButton* backColor2;
+ Gtk::VBox* vbbackColor;
ImageArea* imageArea;
Gtk::Image* iR, *igR;
@@ -37,6 +41,9 @@ class PreviewModePanel : public Gtk::HBox {
Gtk::Image* iB, *igB;
Gtk::Image* iL, *igL;
Gtk::Image* iF, *igF;
+ Gtk::Image* iBC0, *igBC0;
+ Gtk::Image* iBC1, *igBC1;
+ Gtk::Image* iBC2, *igBC2;
public:
PreviewModePanel (ImageArea* ia);
@@ -47,16 +54,21 @@ class PreviewModePanel : public Gtk::HBox {
void toggleB ();
void toggleL ();
void toggleFocusMask ();
+ void togglebackColor0();
+ void togglebackColor1();
+ void togglebackColor2();
- sigc::connection connR, connB, connG, connL, connFocusMask;
+ sigc::connection connR, connB, connG, connL, connFocusMask, connbackColor0, connbackColor1, connbackColor2;
void buttonToggled(Gtk::ToggleButton* tbpreview);
+ void buttonToggled_backColor(Gtk::ToggleButton* tbbackColor);
bool showR () { return previewR->get_active (); }
bool showG () { return previewG->get_active (); }
bool showB () { return previewB->get_active (); }
bool showL () { return previewL->get_active (); }
bool showFocusMask () { return previewFocusMask->get_active (); }
+ int GetbackColor();
};