Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
Updated to version 0.2.4
  • Loading branch information
aferrero2707 committed Nov 2, 2015
2 parents 799b5c6 + cbaa285 commit 2292670
Show file tree
Hide file tree
Showing 20 changed files with 301 additions and 152 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
=========================================
Version 0.2.4

* Bug fixes:

- The tools reset button now works also with curves
- The target channel selector has been removed from tools that do not correctly implementing this feature
- Impulse noise reduction tool: fixed memory leak
- Fixed crashes on some Xfce-based systems
- Perspective correction tool: initial region set to rectangle (therefore no correction is initially applied)
- Curves tool: sampling of curve points is now associated to Ctrl+Alt+left_click mouse gesture. For this to work, the curves tool has to be set in "edting" mode
- Clone stamp tool: the sampling region is now selected by a Ctrl+Alt+left_click in the preview area.
- Image preview: fixed possible memory corruption when drawing vertical lines on top of the preview image
- Improved compatibility with GTK3. GTKMM3 support can now be activated via -DUSE_GTKMM3=1 cmake option.

=========================================
Version 0.2.3

Expand Down
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@ pkg_check_modules(GTHREAD gthread-2.0)
pkg_check_modules(GOBJECT gobject-2.0)
pkg_check_modules(GLIBMM glibmm-2.4)
#pkg_check_modules(GTKMM3 gtkmm-3.0<=3.4.0)
pkg_check_modules(GTKMM2 REQUIRED gtkmm-2.4)
if(NOT GTKMM2_FOUND)

if(USE_GTKMM3)
pkg_check_modules(GTKMM3 REQUIRED gtkmm-3.0)
#MESSAGE( STATUS "GTKMM2_INCLUDE_DIRS: " ${GTKMM2_INCLUDE_DIRS} )
#MESSAGE( STATUS "GTKMM2_LIBRARY_DIRS: " ${GTKMM2_LIBRARY_DIRS} )
endif()
MESSAGE( STATUS "GTKMM2_FOUND: " ${GTKMM2_FOUND} )
MESSAGE( STATUS "GTKMM3_FOUND: " ${GTKMM3_FOUND} )
else(USE_GTKMM3)
pkg_check_modules(GTKMM2 REQUIRED gtkmm-2.4)
endif(USE_GTKMM3)

MESSAGE( STATUS "GTKMM2_FOUND: " ${GTKMM2_FOUND} )
MESSAGE( STATUS "GTKMM3_FOUND: " ${GTKMM3_FOUND} )


IF(NOT MINGW)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.3
0.2.4
2 changes: 1 addition & 1 deletion help/en/clone_stamp.hlp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The healing brush tool allows to clone pixels from one part of the image to another.

To define the source region, left-click on the preview area while holding down the Ctrl key.
To define the source region, set the tool in "editing" mode and left-click on the preview area while holding down the Ctrl+Alt key.

Once the source region is defined, the pixels can be cloned by dragging the mouse while holding down the left button.

Expand Down
1 change: 1 addition & 0 deletions src/base/operation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ namespace PF

virtual bool has_intensity() { return true; }
virtual bool has_opacity() { return true; }
virtual bool has_target_channel() { return false; }
virtual bool needs_input() { return true; }
virtual bool needs_caching() { return false; }
virtual bool init_hidden() { return false; }
Expand Down
7 changes: 6 additions & 1 deletion src/base/splinecurve.hh
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,13 @@ namespace PF
class Property<SplineCurve>: public PropertyBase
{
SplineCurve curve;
SplineCurve default_curve;
public:
Property(std::string name, OpParBase* par): PropertyBase(name, par), curve() {}
Property(std::string name, OpParBase* par): PropertyBase(name, par), curve(), default_curve() {}

void reset() { set(default_curve); }

void store_default() { default_curve = curve;}

void set(const SplineCurve& newval) {
if( curve != newval )
Expand Down
5 changes: 5 additions & 0 deletions src/gui/doublebuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ void PF::PixelBuffer::draw_line( int x1, int y1, int x2, int y2 )

for( int y = y1; y <= y2; y++ ) {

if( y < buf_top ) continue;
if( y > buf_bottom ) continue;

int x = x1 + (y-y1)*dx/dy;
if( x < buf_left ) continue;
if( x > buf_right ) continue;
guint8* p = px + rs*(y-buf_top) + (x-buf_left)*bl;
PX_MOD( p[0] ); PX_MOD( p[1] ); PX_MOD( p[2] );
}
Expand Down
18 changes: 11 additions & 7 deletions src/gui/histogram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ bool PF::Histogram::on_expose_event (GdkEventExpose * event)

Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();

#endif
#ifdef GTKMM_3
bool PF::Histogram::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
int border_size = 2;
Gtk::Allocation allocation = get_allocation();
const int width = allocation.get_width() - border_size*2;
const int height = allocation.get_height() - border_size*2;
const int x0 = border_size;
const int y0 = border_size;
#endif
cr->save();
cr->set_source_rgba(0.2, 0.2, 0.2, 1.0);
cr->paint();
Expand Down Expand Up @@ -215,15 +226,8 @@ bool PF::Histogram::on_expose_event (GdkEventExpose * event)

return TRUE;
}
#endif


#ifdef GTKMM_3
bool PF::Histogram::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
return true;
}
#endif



Expand Down
17 changes: 9 additions & 8 deletions src/gui/imageeditor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1000,8 +1000,9 @@ bool PF::ImageEditor::my_button_press_event( GdkEventButton* button )
gdouble y = button->y;

int mod_key = PF::MOD_KEY_NONE;
if( button->state & GDK_CONTROL_MASK ) mod_key += PF::MOD_KEY_CTRL;
if( button->state & GDK_SHIFT_MASK ) mod_key += PF::MOD_KEY_SHIFT;
if( button->state & GDK_CONTROL_MASK ) mod_key |= PF::MOD_KEY_CTRL;
if( button->state & GDK_MOD1_MASK ) mod_key |= PF::MOD_KEY_ALT;
if( button->state & GDK_SHIFT_MASK ) mod_key |= PF::MOD_KEY_SHIFT;

#ifndef NDEBUG
std::cout<<" pointer @ "<<x<<","<<y<<std::endl;
Expand Down Expand Up @@ -1060,9 +1061,9 @@ bool PF::ImageEditor::my_button_release_event( GdkEventButton* button )
gdouble y = button->y;

int mod_key = PF::MOD_KEY_NONE;
if( button->state & GDK_CONTROL_MASK ) mod_key += PF::MOD_KEY_CTRL;
if( button->state & GDK_MOD1_MASK ) mod_key += PF::MOD_KEY_ALT;
if( button->state & GDK_SHIFT_MASK ) mod_key += PF::MOD_KEY_SHIFT;
if( button->state & GDK_CONTROL_MASK ) mod_key |= PF::MOD_KEY_CTRL;
if( button->state & GDK_MOD1_MASK ) mod_key |= PF::MOD_KEY_ALT;
if( button->state & GDK_SHIFT_MASK ) mod_key |= PF::MOD_KEY_SHIFT;

if( mod_key == PF::MOD_KEY_CTRL ) {
return false;
Expand Down Expand Up @@ -1120,9 +1121,9 @@ bool PF::ImageEditor::my_motion_notify_event( GdkEventMotion* event )
if(state & GDK_BUTTON5_MASK) button = 5;

int mod_key = PF::MOD_KEY_NONE;
if( event->state & GDK_CONTROL_MASK ) mod_key += PF::MOD_KEY_CTRL;
if( event->state & GDK_MOD1_MASK ) mod_key += PF::MOD_KEY_ALT;
if( event->state & GDK_SHIFT_MASK ) mod_key += PF::MOD_KEY_SHIFT;
if( event->state & GDK_CONTROL_MASK ) mod_key |= PF::MOD_KEY_CTRL;
if( event->state & GDK_MOD1_MASK ) mod_key |= PF::MOD_KEY_ALT;
if( event->state & GDK_SHIFT_MASK ) mod_key |= PF::MOD_KEY_SHIFT;

if( mod_key == PF::MOD_KEY_CTRL ) {
return false;
Expand Down
23 changes: 16 additions & 7 deletions src/gui/operation_config_gui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,20 @@ PF::OperationConfigGUI::OperationConfigGUI(PF::Layer* layer, const Glib::ustring
frame_top_box_4.pack_start( frame_box_4_padding, Gtk::PACK_EXPAND_WIDGET );
controls_box.pack_start( frame_top_box_4, Gtk::PACK_SHRINK, 0 );

if(par && par->has_opacity() ) {
frame_shift_box.pack_start( shift_x, Gtk::PACK_SHRINK, 2 );
frame_shift_box.pack_start( shift_y, Gtk::PACK_SHRINK, 2 );
frame_top_box_3.pack_start( frame_shift_box, Gtk::PACK_SHRINK, 5 );
if(par && par->has_target_channel() ) {
frame_top_box_3.pack_start( frame_chsel_box, Gtk::PACK_SHRINK, 5 );
}
if(par && par->has_opacity() ) {
if( par && par->has_target_channel() ) {
frame_shift_box.pack_start( shift_x, Gtk::PACK_SHRINK, 2 );
frame_shift_box.pack_start( shift_y, Gtk::PACK_SHRINK, 2 );
frame_top_box_3.pack_start( frame_shift_box, Gtk::PACK_SHRINK, 5 );
} else {
frame_top_box_3.pack_start( shift_x, Gtk::PACK_SHRINK, 5 );
frame_top_box_3.pack_start( shift_y, Gtk::PACK_SHRINK, 5 );
}
}

controls_box.pack_start( frame_top_box_3, Gtk::PACK_SHRINK, 0 );

controls_box.pack_start( hline2, Gtk::PACK_SHRINK, 5 );
Expand Down Expand Up @@ -224,10 +232,10 @@ PF::OperationConfigGUI::OperationConfigGUI(PF::Layer* layer, const Glib::ustring
aux_controls_hbox.pack_start( blendSelector2, Gtk::PACK_SHRINK );
aux_controls_box.pack_start( opacitySlider2, Gtk::PACK_SHRINK );
}
if(par && par->has_intensity() ) {
if(false && par && par->has_intensity() ) {
aux_controls_box.pack_start( intensitySlider2, Gtk::PACK_SHRINK );
}
aux_controls_box.set_size_request(100,200);
aux_controls_box.set_size_request(100,80);

frame_visible.set_tooltip_text( _("toggle layer visibility on/off") );
frame_mask.set_tooltip_text( _("enable/disable layer mask(s)") );
Expand Down Expand Up @@ -754,7 +762,8 @@ void PF::OperationConfigGUI::do_update()
// Update target channel selector
if( get_layer() && get_layer()->get_image() &&
get_layer()->get_processor() &&
get_layer()->get_processor()->get_par() ) {
get_layer()->get_processor()->get_par() &&
get_layer()->get_processor()->get_par()->has_target_channel() ) {
#ifndef NDEBUG
std::cout<<"OperationConfigDialog::update() for "<<get_layer()->get_name()<<" called"<<std::endl;
#endif
Expand Down
13 changes: 8 additions & 5 deletions src/gui/operations/clone_stamp_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void PF::CloneStampConfigGUI::draw_point( double x, double y )
bool PF::CloneStampConfigGUI::pointer_press_event( int button, double x, double y, int mod_key )
{
if( button != 1 ) return false;
if( (mod_key & PF::MOD_KEY_CTRL) != 0 ) return false;
if( (mod_key != PF::MOD_KEY_NONE) && (mod_key != (PF::MOD_KEY_CTRL+PF::MOD_KEY_ALT)) ) return false;

double lx = x, ly = y, lw = 1, lh = 1;
screen2layer( lx, ly, lw, lh );
Expand All @@ -252,21 +252,23 @@ bool PF::CloneStampConfigGUI::pointer_press_event( int button, double x, double
image->update();

draw_point( lx, ly );
return false;
return true;
}


bool PF::CloneStampConfigGUI::pointer_release_event( int button, double x, double y, int mod_key )
{
if( button != 1 ) return false;
if( (mod_key & PF::MOD_KEY_CTRL) != 0 ) {
if( (mod_key == (PF::MOD_KEY_CTRL+PF::MOD_KEY_ALT)) ) {
mouse_x = x; mouse_y = y;
double lx = x, ly = y, lw = 1, lh = 1;
screen2layer( lx, ly, lw, lh );
srcpt_row = ly;
srcpt_col = lx;
srcpt_ready = true;
srcpt_changed = true;
stroke_started = false;
return true;
} else {
//draw_point( x, y );
}
Expand All @@ -278,7 +280,7 @@ bool PF::CloneStampConfigGUI::pointer_motion_event( int button, double x, double
{
mouse_x = x; mouse_y = y;
if( button != 1 ) return true;
if( (mod_key & PF::MOD_KEY_CTRL) != 0 ) return true;
if( mod_key != PF::MOD_KEY_NONE ) return true;
#ifndef NDEBUG
std::cout<<"PF::CloneStampConfigGUI::pointer_motion_event() called."<<std::endl;
#endif
Expand Down Expand Up @@ -335,7 +337,8 @@ bool PF::CloneStampConfigGUI::modify_preview( PixelBuffer& buf_in, PixelBuffer&
buf_out.draw_circle( x0, y0, pensize );
tx = srcpt_col; ty = srcpt_row; tw = 1; th = 1;
layer2screen( tx, ty, tw, th );
buf_out.draw_circle( tx, ty, pensize );
if( (tx!=x0) && (ty!=y0) )
buf_out.draw_circle( tx, ty, pensize );
} else {
buf_out.draw_circle( x0, y0, pensize );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/operations/curves_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ bool PF::CurvesConfigGUI::pointer_press_event( int button, double x, double y, i
bool PF::CurvesConfigGUI::pointer_release_event( int button, double x, double y, int mod_key )
{
std::cout<<"CurvesConfigGUI::pointer_release_event(): button="<<button<<" x="<<x<<" y="<<y<<" mod_key="<<mod_key<<std::endl;
if( button != 1 || mod_key != PF::MOD_KEY_ALT ) return false;
if( button != 1 || mod_key != (PF::MOD_KEY_CTRL+PF::MOD_KEY_ALT) ) return false;

// Retrieve the layer associated to the filter
PF::Layer* layer = get_layer();
Expand Down
8 changes: 6 additions & 2 deletions src/gui/operations/gradient_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ bool PF::GradientConfigGUI::pointer_press_event( int button, double sx, double s
// Retrieve the pipeline #0 (full resolution preview)
PF::Pipeline* pipeline = image->get_pipeline( 0 );
if( !pipeline ) return false;
int level = pipeline->get_level();
float scale = 1;
for( int i = 1; i <= level; i++ ) scale *= 2;

// Find the pipeline node associated to the current layer
PF::PipelineNode* node = pipeline->get_node( layer->get_id() );
Expand All @@ -288,8 +291,9 @@ bool PF::GradientConfigGUI::pointer_press_event( int button, double sx, double s
if( par->get_gradient_type() == GRADIENT_HORIZONTAL ) ppoints = &(par->get_hmod().get_points());
const std::vector< std::pair<float,float> >& points = *ppoints;

double x = sx, y = sy, w = 1, h = 1;
double x = sx, y = sy, w = 10, h = 10;
screen2layer( x, y, w, h );
int D = w;

// Find handle point
active_point_id = -1;
Expand All @@ -305,7 +309,7 @@ bool PF::GradientConfigGUI::pointer_press_event( int button, double sx, double s
}
double dx = x - px;
double dy = y - py;
if( (fabs(dx) > 10) || (fabs(dy) > 10) ) continue;
if( (fabs(dx) > D) || (fabs(dy) > D) ) continue;
active_point_id = i;
break;
}
Expand Down
18 changes: 18 additions & 0 deletions src/gui/widgets/curveeditor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@ namespace PF {

~CurveEditor() {}

virtual void reset() {
PFWidget::reset();
SplineCurve& curve = curve_area->get_curve();
curve.update_spline();
curve_area->set_selected_point( 0 );
curve_area->queue_draw();
inhibit_value_changed = true;
#ifdef GTKMM_2
xadjustment.set_value( curve.get_points()[0].first*(xmax-xmin)+xmin );
yadjustment.set_value( curve.get_points()[0].second*(ymax-ymin)+ymin );
#endif
#ifdef GTKMM_3
xadjustment->set_value( curve.get_points()[0].first*(xmax-xmin)+xmin );
yadjustment->set_value( curve.get_points()[0].second*(ymax-ymin)+ymin );
#endif
inhibit_value_changed = false;
}

void add_point( float x )
{
SplineCurve& curve = curve_area->get_curve();
Expand Down
4 changes: 3 additions & 1 deletion src/gui/widgets/slider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ void PF::Slider::get_value()
if( !get_prop() ) return;
double val;
get_prop()->get(val);
//std::cout<<"PF::Slider::get_value(): value="<<val<<std::endl;
#ifdef GTKMM_2
adjustment.set_value( val*multiplier );
#endif
#ifdef GTKMM_3
adjustment->set_value( val*multiplier );
spinButton.update();
//std::cout<<"PF::Slider::get_value("<<get_prop_name()<<"): spinButton.value="<<spinButton.get_value()<<std::endl;
//std::cout<<"PF::Slider::get_value("<<get_prop_name()<<"): adjustment.value="<<adjustment->get_value()<<std::endl;
#endif
}

Expand Down
4 changes: 3 additions & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ int main (int argc, char *argv[])
Gtk::RC::set_default_files (files);
Gtk::RC::reparse_all (Gtk::Settings::get_default());
GdkEventClient event = { GDK_CLIENT_EVENT, NULL, TRUE, gdk_atom_intern("_GTK_READ_RCFILES", FALSE), 8 };
gdk_event_send_clientmessage_toall ((GdkEvent*)&event);
//gdk_event_send_clientmessage_toall ((GdkEvent*)&event);
}
#endif
//#endif
Expand All @@ -219,6 +219,7 @@ int main (int argc, char *argv[])
Gtk::Settings::get_default()->property_gtk_application_prefer_dark_theme().set_value(true);

int stat_result = stat((themesPath + "/photoflow-dark.css").c_str(), &buffer);
//int stat_result = stat((themesPath + "/gtk-3.0/gtk.css").c_str(), &buffer);
//stat_result = 1;
if( stat_result == 0 ) {
Glib::RefPtr<Gtk::CssProvider> css = Gtk::CssProvider::create();
Expand All @@ -231,6 +232,7 @@ int main (int argc, char *argv[])
cntx->add_provider_for_screen(screen, css, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
//cntx->invalidate();
css->load_from_path(themesPath + "/photoflow-dark.css");
//css->load_from_path(themesPath + "/gtk-3.0/gtk.css");
//css->load_from_path("themes/photoflow-dark/gtk.css");
}
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/operations/impulse_nr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ public:
}
}
}

for (int i = 0; i < iheight; i++) {
delete[] impish[i];
}
delete[] impish;
}
};

Expand Down
1 change: 1 addition & 0 deletions src/operations/invert.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace PF
InvertPar();

bool has_intensity() { return false; }
bool has_target_channel() { return true; }
};


Expand Down
Loading

0 comments on commit 2292670

Please sign in to comment.