aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2023-01-06 21:40:12 +0200
committerIgor Pashev <pashev.igor@gmail.com>2023-01-07 08:44:45 +0200
commit33931bfb76035c2d8a89898f604577407f9dbdf2 (patch)
tree37dbcf7193b31095b4ea3474e9cd68633734f236
parenta561b6e7394e19517b3463e6e94e9c90e4817926 (diff)
downloadiscan-master.tar.gz
Fix region selectionHEADmaster
The selected rectangle was moving to the bottom-right on each mouse up event. The reason was dumb transformation from pixels to inches and back: inches2clientpix(clientpix2inches((58,174))) = (78,194) WTF?
-rw-r--r--frontend/pisa_tool.cc31
-rw-r--r--frontend/pisa_tool.h8
2 files changed, 10 insertions, 29 deletions
diff --git a/frontend/pisa_tool.cc b/frontend/pisa_tool.cc
index 34864db..16cb73c 100644
--- a/frontend/pisa_tool.cc
+++ b/frontend/pisa_tool.cc
@@ -1,4 +1,4 @@
-/*
+/*
SANE EPSON backend
Copyright (C) 2001 SEIKO EPSON CORPORATION
@@ -34,21 +34,6 @@
#include "gettext.h"
#define _(msg_id) gettext (msg_id)
-template <>
-double similarity <double> ( const double & A,
- const double & a,
- const double & b )
-{
- double B;
-
- if ( a == 0 )
- return 0;
-
- B = ( b * A ) / a;
-
- return B;
-}
-
/*--------------------------------------------------------------*/
GtkWidget * xpm2widget ( GtkWidget * widget, char ** xpm_data )
{
@@ -63,7 +48,7 @@ GtkWidget * xpm2widget ( GtkWidget * widget, char ** xpm_data )
& mask,
& style->bg [ GTK_STATE_NORMAL ],
xpm_data );
-
+
pixmap_widget = ::gtk_pixmap_new ( pixmap, mask );
::gtk_widget_show ( pixmap_widget );
@@ -82,11 +67,11 @@ GtkWidget * xpmlabelbox ( GtkWidget * parent, char ** xpm_data,
hbox = ::gtk_hbox_new ( FALSE, 0 );
::gtk_container_border_width ( GTK_CONTAINER ( hbox ), 3 );
-
+
img = ::xpm2widget ( parent, xpm_data );
::gtk_box_pack_start ( GTK_BOX ( hbox ), img, FALSE, FALSE, 3 );
::gtk_widget_show ( img );
-
+
label = ::gtk_label_new ( text );
::gtk_box_pack_start ( GTK_BOX ( hbox ), label, FALSE, FALSE, 3 );
::gtk_widget_show ( label );
@@ -121,7 +106,7 @@ GtkWidget * pisa_create_toolbar ( const GtkWidget * parent,
}
else
::gtk_toolbar_append_space ( GTK_TOOLBAR ( toolbar ) );
-
+
list++;
}
@@ -171,14 +156,14 @@ GtkWidget * pisa_create_scale ( scale_items * list )
list->page,
0 );
list->adjust = GTK_ADJUSTMENT ( adjust );
-
+
::gtk_signal_connect ( adjust, "value_changed",
GTK_SIGNAL_FUNC ( list->func ),
( void * ) & list->id );
-
+
scale = ::gtk_hscale_new ( GTK_ADJUSTMENT ( adjust ) );
list->widget = scale;
-
+
return scale;
}
diff --git a/frontend/pisa_tool.h b/frontend/pisa_tool.h
index e4edae3..39980b4 100644
--- a/frontend/pisa_tool.h
+++ b/frontend/pisa_tool.h
@@ -1,4 +1,4 @@
-/*
+/*
SANE EPSON backend
Copyright (C) 2001 SEIKO EPSON CORPORATION
@@ -45,11 +45,7 @@ Type similarity ( const Type & A,
if ( a == 0 )
return 0;
- if ( 0 < A )
- B = ( b * A + a / 2 ) / a;
- else
- B = ( b * A - a / 2 ) / a;
-
+ B = ( b * A ) / a;
return B;
}