Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
yad
Commits
87bc1e94
Commit
87bc1e94
authored
Aug 10, 2019
by
Pat Brands
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated scale dialog so moving the slider with the mouse will snap to the
closest step instead of allowing any arbitrary value to be selected
parent
7155bb0a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
configure.ac
configure.ac
+2
-0
scale.c
src/scale.c
+10
-1
No files found.
configure.ac
View file @
87bc1e94
...
...
@@ -111,6 +111,8 @@ AM_CONDITIONAL([BUILD_IB], [test x$build_ib = xyes])
# GSettings
GLIB_GSETTINGS
AC_SEARCH_LIBS(round, m)
# *******************************
# Internationalization
# *******************************
...
...
src/scale.c
View file @
87bc1e94
...
...
@@ -18,12 +18,14 @@
*/
#include "yad.h"
#include <math.h>
enum
{
PLUS_BTN
=
0
,
MINUS_BTN
,
};
static
GtkAdjustment
*
adj
;
static
GtkWidget
*
scale
;
static
GtkWidget
*
plus_btn
=
NULL
;
static
GtkWidget
*
minus_btn
=
NULL
;
...
...
@@ -31,6 +33,14 @@ static GtkWidget *minus_btn = NULL;
static
void
value_changed_cb
(
GtkWidget
*
w
,
gpointer
data
)
{
/* Make sure the new value corresponds to a step in the range. This is needed
* since the user can move the slider with the mouse which doesn't obey the
* step constraint like the keyboard or buttons
*/
gdouble
value
=
gtk_adjustment_get_value
((
GtkAdjustment
*
)
adj
);
gdouble
new_value
=
(
gdouble
)
round
(
value
/
options
.
scale_data
.
step
)
*
options
.
scale_data
.
step
;
gtk_adjustment_set_value
((
GtkAdjustment
*
)
adj
,
new_value
);
if
(
options
.
scale_data
.
print_partial
)
g_print
(
"%.0f
\n
"
,
gtk_range_get_value
(
GTK_RANGE
(
scale
)));
...
...
@@ -72,7 +82,6 @@ GtkWidget *
scale_create_widget
(
GtkWidget
*
dlg
)
{
GtkWidget
*
w
;
GtkAdjustment
*
adj
;
gint
page
;
if
(
options
.
scale_data
.
min_value
>=
options
.
scale_data
.
max_value
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment