Solving issue 735 : "Zooming with mouse wheel should zoom where the mouse is".

The scroll wheel is now used for scrolling the editor's tab content. If you want
to change the spin button's/slider's value or combobox entry, press the SHIFT key
while using the scroll wheel.

This patch also:
- reduce the spin buttons size (50px wide, instead of 70px)
- reduce the minimum size of the combobox (tool panels can now be narrower before
  showing the horizontal scrollbar)

Note to developers:
-------------------
When creating GUI for editor tools, please use the MyComboBox, MyComboBoxText,
MySpinButton and MyFileChooserButton derived class only in order to handle
the scroll wheel properly (-> #include <guiutils.h>).

Known bug: The MyFileChooserButton thas is a FILE_CHOOSER_ACTION_SELECT_FOLDER
does not respond correctly to the new behaviour.
This commit is contained in:
natureh 2011-09-02 15:16:30 +02:00
parent aaaccfa451
commit 42ba3169e0
42 changed files with 309 additions and 141 deletions

View File

@ -39,7 +39,7 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep
addMode = false;
// TODO: let the user chose the default value of Adjuster::delay, for slow machines
delay = options.adjusterDelay; // delay is no more static, so we can set the delay individually (usefull for the RAW editor tab)
delay = options.adjusterDelay; // delay is no more static, so we can set the delay individually (useful for the RAW editor tab)
set_border_width (2);
@ -65,14 +65,13 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep
hbox->pack_end (*reset, Gtk::PACK_SHRINK, 0);
spin = Gtk::manage (new Gtk::SpinButton ());
spin->set_size_request (70, -1);
spin = Gtk::manage (new MySpinButton ());
hbox->pack_end (*spin, Gtk::PACK_SHRINK, 0);
reset->set_size_request (-1, spin->get_height());
slider = Gtk::manage (new Gtk::HScale ());
slider = Gtk::manage (new MyHScale ());
slider->set_draw_value (false);
pack_start (*hbox, false, false);
@ -338,4 +337,3 @@ float Adjuster::trimValue (float& val) {
else if (val < (float)vMin) val = (float)vMin; // shapeValue(vMin) ?
return val;
}

View File

@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <editedstate.h>
#include <guiutils.h>
class Adjuster;
class AdjusterListener {
@ -35,8 +36,8 @@ class Adjuster : public Gtk::VBox {
protected:
Gtk::HBox* hbox;
Gtk::Label* label;
Gtk::HScale* slider;
Gtk::SpinButton* spin;
MyHScale* slider;
MySpinButton* spin;
Gtk::Button* reset;
AdjusterListener* adjusterListener;
sigc::connection delayConnection;

View File

@ -64,7 +64,7 @@ BatchQueuePanel::BatchQueuePanel () {
Gtk::HBox* hb3 = Gtk::manage (new Gtk::HBox ());
useFolder = Gtk::manage (new Gtk::RadioButton (M("PREFERENCES_OUTDIRFOLDER")+":"));
hb3->pack_start (*useFolder, Gtk::PACK_SHRINK,4);
outdirFolder = Gtk::manage (new Gtk::FileChooserButton (M("PREFERENCES_OUTDIRFOLDER"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
outdirFolder = Gtk::manage (new MyFileChooserButton (M("PREFERENCES_OUTDIRFOLDER"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER));
hb3->pack_start (*outdirFolder);
odvb->pack_start (*hb3, Gtk::PACK_SHRINK, 4);
outdirFolder->set_tooltip_markup (M("PREFERENCES_OUTDIRFOLDERHINT"));
@ -87,7 +87,7 @@ BatchQueuePanel::BatchQueuePanel () {
// setup signal handlers
outdirTemplate->signal_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
outdirFolder->signal_current_folder_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::pathFolderChanged));
outdirFolder->signal_current_folder_changed().connect (sigc::mem_fun(*this, &BatchQueuePanel::pathFolderChanged));
useTemplate->signal_toggled().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
useFolder->signal_toggled().connect (sigc::mem_fun(*this, &BatchQueuePanel::saveOptions));
saveFormatPanel->setListener (this);
@ -101,7 +101,6 @@ BatchQueuePanel::BatchQueuePanel () {
topBox->pack_start (*fformat, Gtk::PACK_SHRINK, 4);
// add middle browser area
Gtk::HBox* hBox = Gtk::manage (new Gtk::HBox ());
pack_start (*batchQueue);
// lower box with thumbnail zoom

View File

@ -22,6 +22,7 @@
#include <gtkmm.h>
#include <batchqueue.h>
#include <saveformatpanel.h>
#include <guiutils.h>
class RTWindow;
class BatchQueuePanel : public Gtk::VBox,
@ -37,7 +38,7 @@ class BatchQueuePanel : public Gtk::VBox,
sigc::connection stopConnection;
Gtk::Entry* outdirTemplate;
Gtk::FileChooserButton* outdirFolder;
MyFileChooserButton* outdirFolder;
Gtk::RadioButton* useTemplate;
Gtk::RadioButton* useFolder;
SaveFormatPanel* saveFormatPanel;

View File

@ -18,7 +18,6 @@
*/
#include <crop.h>
#include <options.h>
#include <guiutils.h>
using namespace rtengine;
using namespace rtengine::procparams;
@ -50,12 +49,12 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
hb1->pack_start (*Gtk::manage (new Gtk::Label (Glib::ustring(" ") + M("TP_CROP_X") +": ")));
x = Gtk::manage (new Gtk::SpinButton ());
x = Gtk::manage (new MySpinButton ());
x->set_size_request (60, -1);
hb1->pack_start (*x);
hb1->pack_start (*Gtk::manage (new Gtk::Label (Glib::ustring(" ") + M("TP_CROP_Y") + ": ")));
y = Gtk::manage (new Gtk::SpinButton ());
y = Gtk::manage (new MySpinButton ());
y->set_size_request (60, -1);
hb1->pack_start (*y);
@ -64,12 +63,12 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
Gtk::HBox* hb2 = Gtk::manage (new Gtk::HBox ());
hb2->pack_start (*Gtk::manage (new Gtk::Label (M("TP_CROP_W") + ": ")));
w = Gtk::manage (new Gtk::SpinButton ());
w = Gtk::manage (new MySpinButton ());
w->set_size_request (60, -1);
hb2->pack_start (*w);
hb2->pack_start (*Gtk::manage (new Gtk::Label (M("TP_CROP_H") + ": ")));
h = Gtk::manage (new Gtk::SpinButton ());
h = Gtk::manage (new MySpinButton ());
h->set_size_request (60, -1);
hb2->pack_start (*h);
@ -87,10 +86,10 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
hb3->pack_start (*fixr, Gtk::PACK_SHRINK, 4);
ratio = Gtk::manage (new Gtk::ComboBoxText ());
hb3->pack_start (*ratio, Gtk::PACK_SHRINK, 4);
ratio = Gtk::manage (new MyComboBoxText ());
hb3->pack_start (*ratio, Gtk::PACK_EXPAND_WIDGET, 4);
orientation = Gtk::manage (new Gtk::ComboBoxText ());
orientation = Gtk::manage (new MyComboBoxText ());
hb3->pack_start (*orientation);
pack_start (*hb3, Gtk::PACK_SHRINK, 4);
@ -98,7 +97,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
Gtk::HBox* hb31 = Gtk::manage (new Gtk::HBox ());
hb31->pack_start (*Gtk::manage (new Gtk::Label (M("TP_CROP_GUIDETYPE"))), Gtk::PACK_SHRINK, 4);
guide = Gtk::manage (new Gtk::ComboBoxText ());
guide = Gtk::manage (new MyComboBoxText ());
hb31->pack_start (*guide);
pack_start (*hb31, Gtk::PACK_SHRINK, 4);
@ -109,7 +108,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
Gtk::HBox* hb4 = Gtk::manage (new Gtk::HBox ());
hb4->pack_start (*Gtk::manage (new Gtk::Label (M("TP_CROP_PPI"))));
ppi = Gtk::manage (new Gtk::SpinButton ());
ppi = Gtk::manage (new MySpinButton ());
ppi->set_size_request (60, -1);
hb4->pack_start (*ppi);

View File

@ -22,6 +22,7 @@
#include <gtkmm.h>
#include <cropguilistener.h>
#include <toolpanel.h>
#include <guiutils.h>
class CropPanelListener {
@ -35,17 +36,17 @@ class Crop : public Gtk::VBox, public CropGUIListener, public FoldableToolPanel,
protected:
Gtk::CheckButton* enabled;
Gtk::CheckButton* fixr;
Gtk::ComboBoxText* ratio;
Gtk::ComboBoxText* orientation;
Gtk::ComboBoxText* guide;
MyComboBoxText* ratio;
MyComboBoxText* orientation;
MyComboBoxText* guide;
Gtk::Button* selectCrop;
CropPanelListener* clistener;
int opt;
Gtk::SpinButton* x;
Gtk::SpinButton* y;
Gtk::SpinButton* w;
Gtk::SpinButton* h;
Gtk::SpinButton* ppi;
MySpinButton* x;
MySpinButton* y;
MySpinButton* w;
MySpinButton* h;
MySpinButton* ppi;
Gtk::Label* sizecm;
Gtk::Label* sizein;
Gtk::VBox* ppibox;

View File

@ -802,16 +802,51 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr) {
// printf ("etime --> %d, %d\n", t2.etime (t1), t4.etime (t3));
}
// zoom* is called from the zoomPanel
void CropWindow::zoomIn () {
// calculate the center of the zommed in/out preview given a cursor position
void CropWindow::findCenter (int deltaZoom, int& x, int& y) {
int cursorX, cursorY;
translateCoord(x, y, cursorX, cursorY);
changeZoom (cropZoom+1);
fitZoom = false;
int cropX, cropY, cropW, cropH, skip;
cropHandler.getWindow (cropX, cropY, cropW, cropH, skip);
int currCenterX = cropX + cropW/2;
int currCenterY = cropY + cropH/2;
int deltaX = currCenterX - cursorX;
int deltaY = currCenterY - cursorY;
double factor = zoomSteps[cropZoom].zoom / zoomSteps[cropZoom+deltaZoom].zoom;
x = cursorX + (int)((double)(deltaX)*factor);
y = cursorY + (int)((double)(deltaY)*factor);
}
void CropWindow::zoomOut () {
// zoom* is called from the zoomPanel or the scroll wheel in the preview area
void CropWindow::zoomIn (bool toCursor, int cursorX, int cursorY) {
changeZoom (cropZoom-1);
int x = -1;
int y = -1;
if (toCursor) {
x = cursorX;
y = cursorY;
}
changeZoom (cropZoom+1, true, x, y);
fitZoom = false;
}
void CropWindow::zoomOut (bool toCursor, int cursorX, int cursorY) {
int x = -1;
int y = -1;
if (toCursor) {
x = cursorX;
y = cursorY;
}
changeZoom (cropZoom-1, true, x, y);
fitZoom = false;
}
@ -826,6 +861,14 @@ double CropWindow::getZoom () {
return zoomSteps[cropZoom].zoom;
}
bool CropWindow::isMinZoom () {
return cropZoom <= 0;
}
bool CropWindow::isMaxZoom () {
return cropZoom >= MAXZOOMSTEPS;
}
void CropWindow::setZoom (double zoom) {
int cz = MAXZOOMSTEPS;
if (zoom < zoomSteps[0].zoom)

View File

@ -43,14 +43,14 @@ class ImageArea;
class CropWindow : public LWButtonListener, public CropHandlerListener {
// state management
ImgEditState state; // current state of user (see enum State)
ImgEditState state; // current state of user (see enum State)
int action_x, action_y, press_x, press_y;
double rot_deg;
bool onResizeArea;
bool deleted;
bool fitZoomEnabled;
bool fitZoom;
bool isLowUpdatePriority;
bool isLowUpdatePriority;
// decoration
Cairo::RefPtr<Cairo::ImageSurface> resizeSurface;
@ -59,7 +59,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener {
Glib::ustring cropLabel;
int backColor;
bool decorated;
// crop frame description
int titleHeight, sideBorderWidth, lowerBorderWidth, upperBorderWidth, sepWidth, minWidth;
// size & position of the crop relative to the top left corner
@ -69,12 +69,12 @@ class CropWindow : public LWButtonListener, public CropHandlerListener {
int imgAreaX, imgAreaY, imgAreaW, imgAreaH;
// size & pos of the piece of preview image relative to the top left corner of the crop
int imgX, imgY, imgW, imgH;
// image handling
ImageArea* iarea;
int cropZoom; // *1000
// crop gui listener
CropGUIListener* cropgl;
PointerMotionListener* pmlistener;
@ -83,40 +83,44 @@ class CropWindow : public LWButtonListener, public CropHandlerListener {
CropWindow* observedCropWin;
bool onArea (CursorArea a, int x, int y);
void updateCursor (int x, int y);
void drawDecoration (Cairo::RefPtr<Cairo::Context> cr);
void drawStraightenGuide (Cairo::RefPtr<Cairo::Context> cr);
void drawSpotWBRectangle (Cairo::RefPtr<Cairo::Context> cr);
void drawObservedFrame (Cairo::RefPtr<Cairo::Context> cr, int rw=0, int rh=0);
void translateCoord (int phyx, int phyy, int& imgx, int& imgy);
void changeZoom (int zoom, bool notify=true, int centerx=-1, int centery=-1);
void getObservedFrameArea(int& x, int& y, int& w, int& h, int rw=0, int rh=0);
bool onArea (CursorArea a, int x, int y);
void updateCursor (int x, int y);
void drawDecoration (Cairo::RefPtr<Cairo::Context> cr);
void drawStraightenGuide (Cairo::RefPtr<Cairo::Context> cr);
void drawSpotWBRectangle (Cairo::RefPtr<Cairo::Context> cr);
void drawObservedFrame (Cairo::RefPtr<Cairo::Context> cr, int rw=0, int rh=0);
void translateCoord (int phyx, int phyy, int& imgx, int& imgy);
void changeZoom (int zoom, bool notify=true, int centerx=-1, int centery=-1);
void getObservedFrameArea(int& x, int& y, int& w, int& h, int rw=0, int rh=0);
public:
CropHandler cropHandler;
CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_, bool isLowUpdatePriority_);
~CropWindow ();
void setDecorated (bool decorated) { this->decorated = decorated; }
void setFitZoomEnabled (bool fze) { fitZoomEnabled = fze; }
void setObservedCropWin (CropWindow* cw) { observedCropWin = cw; }
void setPosition (int x, int y);
void getPosition (int& x, int& y);
void setSize (int w, int h, bool norefresh=false);
void getSize (int& w, int& h);
// zoomlistener interface
void zoomIn ();
void zoomOut ();
void zoomIn (bool toCursor=false, int cursorX=-1, int cursorY=-1);
void zoomOut (bool toCursor=false, int cursorX=-1, int cursorY=-1);
void zoom11 ();
void zoomFit ();
double getZoom ();
void setZoom (double zoom);
bool isMinZoom ();
bool isMaxZoom ();
void setZoom (double zoom);
void findCenter (int deltaZoom, int& x, int& y);
bool isInside (int x, int y);
void buttonPress (int button, int num, int state, int x, int y);
void buttonRelease (int button, int num, int state, int x, int y);
void pointerMoved (int x, int y);
@ -126,27 +130,27 @@ class CropWindow : public LWButtonListener, public CropHandlerListener {
// interface lwbuttonlistener
void buttonPressed (LWButton* button, int actionCode, void* actionData);
void redrawNeeded (LWButton* button);
// crop handling
void getCropRectangle (int& x, int& y, int& w, int& h);
void getCropPosition (int& x, int& y);
void setCropPosition (int x, int y);
void getCropSize (int& w, int& h);
// listeners
void setCropGUIListener (CropGUIListener* cgl) { cropgl = cgl; }
void setPointerMotionListener (PointerMotionListener* pml) { pmlistener = pml; }
void setPointerMotionHListener (PointerMotionListener* pml) { pmhlistener = pml; }
void setPointerMotionListener (PointerMotionListener* pml) { pmlistener = pml; }
void setPointerMotionHListener (PointerMotionListener* pml) { pmhlistener = pml; }
// crop window listeners
void addCropWindowListener (CropWindowListener* l) { listeners.push_back (l); }
void delCropWindowListener (CropWindowListener* l);
// crophandlerlistener interface
void cropImageUpdated ();
void cropWindowChanged ();
void initialImageArrived ();
void remoteMove (int deltaX, int deltaY);
void remoteMoveReady ();
};

View File

@ -28,7 +28,7 @@ using namespace rtengine::procparams;
DarkFrame::DarkFrame () : Gtk::VBox(), FoldableToolPanel(this)
{
hbdf = Gtk::manage(new Gtk::HBox());
darkFrameFile = Gtk::manage(new Gtk::FileChooserButton(M("TP_DARKFRAME_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
darkFrameFile = Gtk::manage(new MyFileChooserButton(M("TP_DARKFRAME_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
dfLabel = Gtk::manage(new Gtk::Label(M("GENERAL_FILE")));
btnReset = Gtk::manage(new Gtk::Button());
btnReset->set_image (*Gtk::manage(new Gtk::Image (Gtk::StockID("gtk-cancel"), Gtk::ICON_SIZE_BUTTON)));

View File

@ -22,6 +22,7 @@
#include <gtkmm.h>
#include <toolpanel.h>
#include <rawimage.h>
#include <guiutils.h>
class DFProvider {
public:
@ -33,8 +34,7 @@ class DarkFrame : public Gtk::VBox, public FoldableToolPanel {
protected:
Gtk::ComboBoxText* darkFrameMethod;
Gtk::FileChooserButton *darkFrameFile;
MyFileChooserButton *darkFrameFile;
Gtk::HBox *hbdf;
Gtk::Button *btnReset;
Gtk::Label *dfLabel;

View File

@ -18,6 +18,7 @@
*/
#include <exifpanel.h>
#include <safegtk.h>
#include <guiutils.h>
using namespace rtengine;
using namespace rtengine::procparams;
@ -26,7 +27,7 @@ extern Glib::ustring argv0;
ExifPanel::ExifPanel () : idata(NULL) {
recursiveOp = true;
recursiveOp = true;
exifTree = Gtk::manage(new Gtk::TreeView());
scrolledWindow = Gtk::manage(new Gtk::ScrolledWindow());
@ -366,7 +367,7 @@ void ExifPanel::addPressed () {
Gtk::HBox* hb2 = new Gtk::HBox ();
Gtk::Label* tlabel = new Gtk::Label (M("EXIFPANEL_ADDTAGDLG_SELECTTAG")+":");
Gtk::ComboBoxText* tcombo = new Gtk::ComboBoxText ();
MyComboBoxText* tcombo = new MyComboBoxText ();
tcombo->append_text ("Artist");
tcombo->append_text ("Copyright");

View File

@ -28,7 +28,7 @@ using namespace rtengine::procparams;
FlatField::FlatField () : Gtk::VBox(), FoldableToolPanel(this)
{
hbff = Gtk::manage(new Gtk::HBox());
flatFieldFile = Gtk::manage(new Gtk::FileChooserButton(M("TP_FLATFIELD_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
flatFieldFile = Gtk::manage(new MyFileChooserButton(M("TP_FLATFIELD_LABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
ffLabel = Gtk::manage(new Gtk::Label(M("GENERAL_FILE")));
flatFieldFileReset = Gtk::manage(new Gtk::Button());
flatFieldFileReset->set_image (*Gtk::manage(new Gtk::Image (Gtk::StockID("gtk-cancel"), Gtk::ICON_SIZE_BUTTON)));
@ -45,7 +45,7 @@ FlatField::FlatField () : Gtk::VBox(), FoldableToolPanel(this)
Gtk::HBox* hbffbt = Gtk::manage (new Gtk::HBox ());
hbffbt->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_FLATFIELD_BLURTYPE") +": ")));
flatFieldBlurType = Gtk::manage (new Gtk::ComboBoxText ());
flatFieldBlurType = Gtk::manage (new MyComboBoxText ());
flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_AREA"));
flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_VERTICAL"));
flatFieldBlurType->append_text(M("TP_FLATFIELD_BT_HORIZONTAL"));

View File

@ -23,6 +23,7 @@
#include <adjuster.h>
#include <toolpanel.h>
#include <rawimage.h>
#include <guiutils.h>
class FFProvider {
public:
@ -34,13 +35,13 @@ class FlatField : public Gtk::VBox, public AdjusterListener, public FoldableTool
protected:
Gtk::FileChooserButton *flatFieldFile;
MyFileChooserButton *flatFieldFile;
Gtk::Label *ffLabel;
Gtk::Label *ffInfo;
Gtk::Button *flatFieldFileReset;
Gtk::CheckButton* flatFieldAutoSelect;
Adjuster* flatFieldBlurRadius;
Gtk::ComboBoxText* flatFieldBlurType;
MyComboBoxText* flatFieldBlurType;
Gtk::HBox *hbff;
bool ffChanged;
bool lastFFAutoSelect;

View File

@ -227,3 +227,89 @@ void drawCrop (Cairo::RefPtr<Cairo::Context> cr, int imx, int imy, int imw, int
}
cr->reset_clip ();
}
/*
*
* Derived class of some widgets to properly handle the scroll wheel ;
* the user has to use the Shift key to be able to change the widget's value,
* otherwise the mouse wheel will scroll the editor's tabs content.
*
*/
MyComboBoxText::MyComboBoxText () {
set_size_request(40, -1);
}
bool MyComboBoxText::on_scroll_event (GdkEventScroll* event) {
// If Shift is pressed, the widget is modified
if (event->state & GDK_SHIFT_MASK) {
Gtk::ComboBoxText::on_scroll_event(event);
return true;
}
// ... otherwise the scroll event is sent back to an upper level
return false;
}
MyComboBox::MyComboBox () {
set_size_request(40, -1);
}
bool MyComboBox::on_scroll_event (GdkEventScroll* event) {
// If Shift is pressed, the widget is modified
if (event->state & GDK_SHIFT_MASK) {
Gtk::ComboBox::on_scroll_event(event);
return true;
}
// ... otherwise the scroll event is sent back to an upper level
return false;
}
MySpinButton::MySpinButton () {
set_size_request(50, -1);
Gtk::Border border;
border.bottom = 0;
border.top = 0;
border.left = 0;
border.right = 0;
set_inner_border(border);
}
bool MySpinButton::on_scroll_event (GdkEventScroll* event) {
// If Shift is pressed, the widget is modified
if (event->state & GDK_SHIFT_MASK) {
Gtk::SpinButton::on_scroll_event(event);
return true;
}
// ... otherwise the scroll event is sent back to an upper level
return false;
}
bool MyHScale::on_scroll_event (GdkEventScroll* event) {
// If Shift is pressed, the widget is modified
if (event->state & GDK_SHIFT_MASK) {
Gtk::HScale::on_scroll_event(event);
return true;
}
// ... otherwise the scroll event is sent back to an upper level
return false;
}
MyFileChooserButton::MyFileChooserButton (const Glib::ustring& title, Gtk::FileChooserAction action) : Gtk::FileChooserButton(title, action) {
set_size_request(20, -1);
};
// For an unknown reason (a bug ?), it doesn't work when action = FILE_CHOOSER_ACTION_SELECT_FOLDER !
bool MyFileChooserButton::on_scroll_event (GdkEventScroll* event) {
// If Shift is pressed, the widget is modified
if (event->state & GDK_SHIFT_MASK) {
Gtk::FileChooserButton::on_scroll_event(event);
return true;
}
// ... otherwise the scroll event is sent back to an upper level
return false;
}

View File

@ -71,4 +71,42 @@ public:
}
};
class MyComboBox : public Gtk::ComboBox {
bool on_scroll_event (GdkEventScroll* event);
public:
MyComboBox ();
};
class MyComboBoxText : public Gtk::ComboBoxText {
bool on_scroll_event (GdkEventScroll* event);
public:
MyComboBoxText ();
};
class MySpinButton : public Gtk::SpinButton {
bool on_scroll_event (GdkEventScroll* event);
public:
MySpinButton ();
};
class MyHScale : public Gtk::HScale {
bool on_scroll_event (GdkEventScroll* event);
};
class MyFileChooserButton : public Gtk::FileChooserButton {
protected:
bool on_scroll_event (GdkEventScroll* event);
public:
MyFileChooserButton (const Glib::ustring& title, Gtk::FileChooserAction action=Gtk::FILE_CHOOSER_ACTION_OPEN);
};
#endif

View File

@ -28,7 +28,7 @@ HLRecovery::HLRecovery () : Gtk::VBox(), FoldableToolPanel(this) {
enabled->set_active (false);
pack_start (*enabled);
method = Gtk::manage (new Gtk::ComboBoxText ());
method = Gtk::manage (new MyComboBoxText ());
method->append_text (M("TP_HLREC_LUMINANCE"));
method->append_text (M("TP_HLREC_CIELAB"));
method->append_text (M("TP_HLREC_COLOR"));

View File

@ -21,12 +21,13 @@
#include <gtkmm.h>
#include <toolpanel.h>
#include <guiutils.h>
class HLRecovery : public Gtk::VBox, public FoldableToolPanel {
protected:
Gtk::CheckButton* enabled;
Gtk::ComboBoxText* method;
MyComboBoxText* method;
sigc::connection methconn;
sigc::connection enaconn;
bool lastEnabled;

View File

@ -35,7 +35,6 @@ class HSVEqualizer : public Gtk::VBox, public AdjusterListener, public FoldableT
protected:
Gtk::CheckButton * enabled;
Gtk::ComboBoxText* hsvchannel;
CurveEditorGroup* curveEditorG;
FlatCurveEditor* hshape;

View File

@ -33,7 +33,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
// set_border_width (4);
ipDialog = Gtk::manage (new Gtk::FileChooserButton (M("TP_ICM_INPUTDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
ipDialog = Gtk::manage (new MyFileChooserButton (M("TP_ICM_INPUTDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN));
Gtk::Label* ilab = Gtk::manage (new Gtk::Label ());
ilab->set_alignment (0.0, 0.5);
@ -86,7 +86,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
wlab->set_markup (Glib::ustring("<b>") + M("TP_ICM_WORKINGPROFILE") + "</b>");
pack_start (*wlab, Gtk::PACK_SHRINK, 4);
wnames = Gtk::manage (new Gtk::ComboBoxText ());
wnames = Gtk::manage (new MyComboBoxText ());
pack_start (*wnames, Gtk::PACK_SHRINK, 4);
Gtk::HSeparator* hsep2 = Gtk::manage (new Gtk::HSeparator ());
@ -97,7 +97,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
olab->set_markup (Glib::ustring("<b>") + M("TP_ICM_OUTPUTPROFILE") + "</b>");
pack_start (*olab, Gtk::PACK_SHRINK, 4);
onames = Gtk::manage (new Gtk::ComboBoxText ());
onames = Gtk::manage (new MyComboBoxText ());
pack_start (*onames, Gtk::PACK_SHRINK, 4);
std::vector<std::string> wpnames = rtengine::getWorkingProfiles ();
@ -113,7 +113,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL),
galab->set_markup (Glib::ustring("<b>") + M("TP_GAMMA_OUTPUT") + "</b>");
pack_start (*galab, Gtk::PACK_SHRINK, 4);
wgamma = Gtk::manage (new Gtk::ComboBoxText ());
wgamma = Gtk::manage (new MyComboBoxText ());
pack_start (*wgamma, Gtk::PACK_SHRINK, 4);
Gtk::HSeparator* hsep23 = Gtk::manage (new Gtk::HSeparator ());

View File

@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <adjuster.h>
#include <guiutils.h>
#include <toolpanel.h>
@ -48,14 +49,14 @@ class ICMPanel : public Gtk::VBox, public AdjusterListener, public FoldableToolP
Gtk::RadioButton* ifromfile;
Gtk::CheckButton* igamma;
Gtk::CheckButton* ckbBlendCMSMatrix;
Gtk::ComboBoxText* wnames;
Gtk::ComboBoxText* wgamma;
MyComboBoxText* wnames;
MyComboBoxText* wgamma;
Gtk::ComboBoxText* onames;
MyComboBoxText* onames;
Gtk::RadioButton* ofromdir;
Gtk::RadioButton* ofromfile;
Gtk::RadioButton* iunchanged;
Gtk::FileChooserButton* ipDialog;
MyFileChooserButton* ipDialog;
Gtk::RadioButton::Group opts;
Gtk::Button* saveRef;
sigc::connection ipc;

View File

@ -220,11 +220,16 @@ bool ImageArea::on_scroll_event (GdkEventScroll* event) {
CropWindow* cw = getCropWindow (event->x, event->y);
if (cw) {
if (event->direction==GDK_SCROLL_UP)
cw->zoomIn ();
else
cw->zoomOut ();
return true;
int newCenterX = (int)event->x;
int newCenterY = (int)event->y;
if (event->direction==GDK_SCROLL_UP && !cw->isMaxZoom()) {
cw->findCenter (1, newCenterX, newCenterY);
cw->zoomIn (true, newCenterX, newCenterY);
}
else if (!cw->isMinZoom()) {
cw->findCenter (-1, newCenterX, newCenterY);
cw->zoomOut (true, newCenterX, newCenterY);
}
}
return true;
}

View File

@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <toolpanel.h>
#include <guiutils.h>
class IPTCPanel : public Gtk::VBox, public ToolPanel {

View File

@ -290,26 +290,6 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) {
listener->panelChanged (EvLSatLimit, costr);
}
//attempt to hide unused channels
/*void LCurve::channel_changed () {
removeIfThere (this, lcurve, false);
removeIfThere (this, acurve, false);
removeIfThere (this, bcurve, false);
if (channel->get_active_row_number()==0)
pack_start (*lcurve);
else if (channel->get_active_row_number()==1)
pack_start (*acurve);
else if (method->get_active_row_number()==2)
pack_start (*bcurve);
if (listener && enabled->get_active ())
listener->panelChanged (EvLabCurvetype, channel->get_active_text ());
}*/
void LCurve::colorForValue (double valX, double valY) {
CurveEditor* ce = curveEditorG->getDisplayedCurve();

View File

@ -29,8 +29,6 @@
class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider {
protected:
Gtk::ComboBoxText* channel;
CurveEditorGroup* curveEditorG;
Adjuster* brightness;
Adjuster* contrast;

View File

@ -32,7 +32,7 @@ ProfilePanel::ProfilePanel () {
tpc = NULL;
profiles = Gtk::manage (new Gtk::ComboBoxText ());
profiles = Gtk::manage (new MyComboBoxText ());
Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox ());
hbox->show ();
// pack_start (*profiles, Gtk::PACK_SHRINK, 4);

View File

@ -24,6 +24,7 @@
#include <rtengine.h>
#include <pparamschangelistener.h>
#include <profilechangelistener.h>
#include <guiutils.h>
class ProfilePanel : public Gtk::VBox, public PParamsChangeListener {
@ -33,7 +34,7 @@ class ProfilePanel : public Gtk::VBox, public PParamsChangeListener {
Gtk::Button* load;
Gtk::Button* copy;
Gtk::Button* paste;
Gtk::ComboBoxText* profiles;
MyComboBoxText* profiles;
std::vector<Glib::ustring> pparams;
rtengine::procparams::ProcParams* custom;
rtengine::procparams::ProcParams* lastsaved;

View File

@ -26,7 +26,7 @@ RawProcess::RawProcess () : Gtk::VBox(), FoldableToolPanel(this)
{
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") +": ")),Gtk::PACK_SHRINK, 4);
dmethod = Gtk::manage (new Gtk::ComboBoxText ());
dmethod = Gtk::manage (new MyComboBoxText ());
for( size_t i=0; i< procparams::RAWParams::numMethods;i++)
dmethod->append_text(procparams::RAWParams::methodstring[i]);

View File

@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <adjuster.h>
#include <guiutils.h>
#include <toolpanel.h>
@ -28,7 +29,7 @@ class RawProcess : public Gtk::VBox, public AdjusterListener, public FoldableToo
protected:
Gtk::ComboBoxText* dmethod;
MyComboBoxText* dmethod;
Gtk::Label* methodl;
Adjuster* ccSteps;
Gtk::VBox *dcbOptions;

View File

@ -19,9 +19,11 @@
#include <recentbrowser.h>
#include <multilangmgr.h>
using namespace rtengine;
RecentBrowser::RecentBrowser () : listener (NULL) {
recentDirs = Gtk::manage (new Gtk::ComboBoxText ());
recentDirs = Gtk::manage (new MyComboBoxText ());
Gtk::Frame* frame = Gtk::manage (new Gtk::Frame (M("MAIN_FRAME_RECENT")));
frame->add (*recentDirs);

View File

@ -23,10 +23,11 @@
#include <dirbrowserremoteinterface.h>
#include <dirselectionlistener.h>
#include <multilangmgr.h>
#include <guiutils.h>
class RecentBrowser : public Gtk::VBox, public DirSelectionListener {
Gtk::ComboBoxText* recentDirs;
Gtk::ComboBoxText* recentDirs;
sigc::connection conn;
DirBrowserRemoteInterface* listener;

View File

@ -38,7 +38,7 @@ RenameDialog::RenameDialog (Gtk::Window* parent)
Gtk::HBox* tbox = Gtk::manage (new Gtk::HBox());
useTmpl = Gtk::manage (new Gtk::CheckButton (M("FILEBROWSER_USETEMPLATE")));
templates = Gtk::manage (new Gtk::ComboBox ());
templates = Gtk::manage (new MyComboBox ());
templateModel = Gtk::ListStore::create (templateColumns);
templates->set_model (templateModel);
templates->pack_start (templateColumns.tmplName);

View File

@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <cacheimagedata.h>
#include <guiutils.h>
#define RESPONSE_ALL 100
@ -41,7 +42,7 @@ class RenameDialog : public Gtk::Dialog {
Gtk::Label* oldName;
Gtk::Entry* newName;
Gtk::CheckButton* useTmpl;
Gtk::ComboBox* templates;
MyComboBox* templates;
Gtk::Button* all;
const CacheImageData* imageData;

View File

@ -34,7 +34,7 @@ Resize::Resize () : Gtk::VBox(), FoldableToolPanel(this), maxw(100000), maxh(100
Gtk::Table* combos = Gtk::manage (new Gtk::Table (2, 2));
appliesTo = Gtk::manage (new Gtk::ComboBoxText ());
appliesTo = Gtk::manage (new MyComboBoxText ());
appliesTo->append_text (M("TP_RESIZE_CROPPEDAREA"));
appliesTo->append_text (M("TP_RESIZE_FULLIMAGE"));
appliesTo->set_active (0);
@ -42,7 +42,7 @@ Resize::Resize () : Gtk::VBox(), FoldableToolPanel(this), maxw(100000), maxh(100
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_APPLIESTO"))), 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*appliesTo, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
method = Gtk::manage (new Gtk::ComboBoxText ());
method = Gtk::manage (new MyComboBoxText ());
method->append_text (M("TP_RESIZE_NEAREST"));
method->append_text (M("TP_RESIZE_BILINEAR"));
method->append_text (M("TP_RESIZE_BICUBIC"));
@ -56,7 +56,7 @@ Resize::Resize () : Gtk::VBox(), FoldableToolPanel(this), maxw(100000), maxh(100
combos->attach (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_METHOD"))), 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
combos->attach (*method, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2);
spec = Gtk::manage (new Gtk::ComboBoxText ());
spec = Gtk::manage (new MyComboBoxText ());
spec->append_text (M("TP_RESIZE_SCALE"));
spec->append_text (M("TP_RESIZE_WIDTH"));
spec->append_text (M("TP_RESIZE_HEIGHT"));
@ -78,8 +78,8 @@ Resize::Resize () : Gtk::VBox(), FoldableToolPanel(this), maxw(100000), maxh(100
Gtk::HBox* sbox = Gtk::manage (new Gtk::HBox ());
Gtk::HBox* wbox = Gtk::manage (new Gtk::HBox ());
Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox ());
w = Gtk::manage (new Gtk::SpinButton ());
h = Gtk::manage (new Gtk::SpinButton ());
w = Gtk::manage (new MySpinButton ());
h = Gtk::manage (new MySpinButton ());
wbox->pack_start (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_W"))), Gtk::PACK_SHRINK, 4);
wbox->pack_start (*w);
hbox->pack_start (*Gtk::manage (new Gtk::Label (M("TP_RESIZE_H"))), Gtk::PACK_SHRINK, 4);

View File

@ -21,7 +21,9 @@
#include <gtkmm.h>
#include <adjuster.h>
#include <guiutils.h>
#include <toolpanel.h>
#include <guiutils.h>
class Resize : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel, public rtengine::SizeListener {
@ -29,11 +31,11 @@ class Resize : public Gtk::VBox, public AdjusterListener, public FoldableToolPan
Gtk::CheckButton* enabled;
Adjuster* scale;
Gtk::VBox* sizeBox;
Gtk::ComboBoxText* appliesTo;
Gtk::ComboBoxText* method;
Gtk::ComboBoxText* spec;
Gtk::SpinButton* w;
Gtk::SpinButton* h;
MyComboBoxText* appliesTo;
MyComboBoxText* method;
MyComboBoxText* spec;
MySpinButton* w;
MySpinButton* h;
int maxw, maxh;
int cropw, croph;
sigc::connection sconn, aconn, wconn, hconn, enaConn;

View File

@ -35,7 +35,7 @@ SaveFormatPanel::SaveFormatPanel () : listener (NULL) {
Gtk::HBox* hb1 = Gtk::manage (new Gtk::HBox ());
Gtk::Label* flab = Gtk::manage (new Gtk::Label (M("SAVEDLG_FILEFORMAT")+":"));
hb1->pack_start (*flab, Gtk::PACK_SHRINK,4);
format = Gtk::manage (new Gtk::ComboBoxText ());
format = Gtk::manage (new MyComboBoxText ());
format->append_text ("JPEG (8 bit)");
format->append_text ("TIFF (8 bit)");
format->append_text ("TIFF (16 bit)");

View File

@ -21,6 +21,7 @@
#include <gtkmm.h>
#include <adjuster.h>
#include <guiutils.h>
#include <options.h>
class FormatChangeListener {
@ -36,7 +37,7 @@ class SaveFormatPanel : public Gtk::VBox, public AdjusterListener {
Adjuster* jpegqual;
Adjuster* pngcompr;
Gtk::CheckButton* tiffuncompressed;
Gtk::ComboBoxText* format;
MyComboBoxText* format;
Gtk::VBox* formatopts;
int oformat;
FormatChangeListener* listener;

View File

@ -39,7 +39,7 @@ Sharpening::Sharpening () : Gtk::VBox(), FoldableToolPanel(this) {
hb->show ();
Gtk::Label* ml = Gtk::manage (new Gtk::Label (M("TP_SHARPENING_METHOD")+":"));
ml->show ();
method = Gtk::manage (new Gtk::ComboBoxText ());
method = Gtk::manage (new MyComboBoxText ());
method->append_text (M("TP_SHARPENING_USM"));
method->append_text (M("TP_SHARPENING_RLD"));
method->show ();

View File

@ -21,12 +21,13 @@
#include <gtkmm.h>
#include <adjuster.h>
#include <guiutils.h>
#include <toolpanel.h>
class Sharpening : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel {
protected:
Gtk::ComboBoxText* method;
MyComboBoxText* method;
Adjuster* dradius;
Adjuster* damount;
Adjuster* ddamping;

View File

@ -20,7 +20,6 @@
#include <adjuster.h>
#include <sigc++/class_slot.h>
#include <iomanip>
#include <guiutils.h>
using namespace rtengine;
using namespace rtengine::procparams;
@ -34,7 +33,7 @@ ToneCurve::ToneCurve () : Gtk::VBox(), FoldableToolPanel(this) {
autolevels = Gtk::manage (new Gtk::ToggleButton (M("TP_EXPOSURE_AUTOLEVELS")));
autoconn = autolevels->signal_toggled().connect( sigc::mem_fun(*this, &ToneCurve::autolevels_toggled) );
sclip = Gtk::manage (new Gtk::SpinButton ());
sclip = Gtk::manage (new MySpinButton ());
sclip->set_range (0.0, 0.9999);
sclip->set_increments (0.001, 0.01);
sclip->set_value (0.002);

View File

@ -25,13 +25,14 @@
#include <curveeditor.h>
#include <curveeditorgroup.h>
#include <mycurve.h>
#include <guiutils.h>
class ToneCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoExpListener, public CurveListener {
protected:
Gtk::HBox* abox;
Gtk::ToggleButton* autolevels;
Gtk::SpinButton* sclip;
MySpinButton* sclip;
Adjuster* expcomp;
Adjuster* brightness;
Adjuster* black;

View File

@ -35,7 +35,7 @@ WhiteBalance::WhiteBalance () : Gtk::VBox(), FoldableToolPanel(this), wbp(NULL),
hbox->show ();
Gtk::Label* lab = Gtk::manage (new Gtk::Label (M("TP_WBALANCE_METHOD")));
lab->show ();
method = Gtk::manage (new Gtk::ComboBoxText ());
method = Gtk::manage (new MyComboBoxText ());
method->show ();
method->append_text (M("TP_WBALANCE_CAMERA"));
method->append_text (M("TP_WBALANCE_AUTO"));
@ -60,7 +60,7 @@ WhiteBalance::WhiteBalance () : Gtk::VBox(), FoldableToolPanel(this), wbp(NULL),
Gtk::Label* slab = Gtk::manage (new Gtk::Label (M("TP_WBALANCE_SIZE")));
slab->show ();
spotsize = Gtk::manage (new Gtk::ComboBoxText ());
spotsize = Gtk::manage (new MyComboBoxText ());
spotsize->show ();
spotsize->append_text ("2");
spotsize->append_text ("4");
@ -69,7 +69,7 @@ WhiteBalance::WhiteBalance () : Gtk::VBox(), FoldableToolPanel(this), wbp(NULL),
spotsize->append_text ("32");
spotsize->set_active (2);
spotbox->pack_end (*spotsize, Gtk::PACK_SHRINK, 4);
spotbox->pack_end (*spotsize, Gtk::PACK_EXPAND_WIDGET, 4);
spotbox->pack_end (*slab, Gtk::PACK_SHRINK, 4);
pack_start (*spotbox, Gtk::PACK_SHRINK, 4);

View File

@ -22,6 +22,7 @@
#include <gtkmm.h>
#include <toolpanel.h>
#include <adjuster.h>
#include <guiutils.h>
#include <wbprovider.h>
class SpotWBListener {
@ -33,8 +34,8 @@ class SpotWBListener {
class WhiteBalance : public Gtk::VBox, public AdjusterListener, public FoldableToolPanel {
protected:
Gtk::ComboBoxText* method;
Gtk::ComboBoxText* spotsize;
MyComboBoxText* method;
MyComboBoxText* spotsize;
Adjuster* temp;
Adjuster* green;
Gtk::Button* spotbutton;