-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing max height of histogram #17045
Open
johnlb
wants to merge
4
commits into
darktable-org:master
Choose a base branch
from
johnlb:no-resize-limit-for-histogram
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0fbdff3
When implementing height limits on modules, the histogram container was
johnlb c676fbe
Merge branch 'darktable-org:master' into no-resize-limit-for-histogram
johnlb e3b7de2
Merge branch 'darktable-org:master' into no-resize-limit-for-histogram
johnlb 0e8d3b8
merged with most recent branch
johnlb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3870,19 +3870,38 @@ static gboolean _resize_wrap_scroll(GtkScrolledWindow *sw, | |
return TRUE; | ||
} | ||
|
||
static gboolean _scroll_wrap_height(GtkWidget *w, | ||
GdkEventScroll *event, | ||
const char *config_str) | ||
gboolean _config_uses_height(const char *config_str) | ||
{ | ||
// Determine whether to use height or aspect ratio based on config_str | ||
if(g_str_has_suffix(config_str, "graphheight")) { | ||
return TRUE; | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
||
static gboolean _scroll_wrap(GtkWidget *w, | ||
GdkEventScroll *event, | ||
const char *config_str) | ||
{ | ||
const gboolean use_height = _config_uses_height(config_str); | ||
|
||
if(dt_modifier_is(event->state, GDK_SHIFT_MASK | GDK_MOD1_MASK)) | ||
{ | ||
int delta_y; | ||
if(dt_gui_get_scroll_unit_delta(event, &delta_y)) | ||
{ | ||
//adjust height | ||
const int height = dt_conf_get_int(config_str) + delta_y; | ||
dt_conf_set_int(config_str, height); | ||
dtgtk_drawing_area_set_height(w, height); | ||
if(use_height) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likewise |
||
//adjust height | ||
const int height = dt_conf_get_int(config_str) + delta_y; | ||
dt_conf_set_int(config_str, height); | ||
dtgtk_drawing_area_set_height(w, height); | ||
} else { | ||
//adjust aspect | ||
const int aspect = dt_conf_get_int(config_str); | ||
dt_conf_set_int(config_str, aspect + delta_y); | ||
dtgtk_drawing_area_set_aspect_ratio(w, aspect / 100.0); | ||
} | ||
} | ||
return TRUE; | ||
} | ||
|
@@ -3918,14 +3937,22 @@ static gboolean _resize_wrap_motion(GtkWidget *widget, | |
GdkEventMotion *event, | ||
const char *config_str) | ||
{ | ||
const gboolean use_height = _config_uses_height(config_str); | ||
|
||
if(_resize_wrap_dragging) | ||
{ | ||
if(DTGTK_IS_DRAWING_AREA(widget)) | ||
{ | ||
// enforce configuration limits | ||
dt_conf_set_int(config_str, event->y); | ||
const int height = dt_conf_get_int(config_str); | ||
dtgtk_drawing_area_set_height(widget, height); | ||
if(use_height) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. likewise, and many others. |
||
dt_conf_set_int(config_str, event->y); | ||
dtgtk_drawing_area_set_height(widget, event->y); | ||
} else { | ||
dt_conf_set_int(config_str, | ||
100.0 * event->y / gtk_widget_get_allocated_width(widget)); | ||
const float aspect = dt_conf_get_int(config_str); | ||
dtgtk_drawing_area_set_aspect_ratio(widget, aspect / 100.0); | ||
} | ||
} | ||
else | ||
{ | ||
|
@@ -3991,19 +4018,30 @@ GtkWidget *dt_ui_resize_wrap(GtkWidget *w, | |
const gint min_size, | ||
char *config_str) | ||
{ | ||
if(!w) | ||
w = dtgtk_drawing_area_new_with_height(min_size); | ||
const gboolean use_height = _config_uses_height(config_str); | ||
|
||
if(!w) { | ||
if(use_height) | ||
w = dtgtk_drawing_area_new_with_height(min_size); | ||
else | ||
w = dtgtk_drawing_area_new_with_aspect_ratio(1.0); | ||
} | ||
|
||
gtk_widget_set_has_tooltip(w, TRUE); | ||
g_object_set_data(G_OBJECT(w), "scroll-resize-tooltip", GINT_TO_POINTER(TRUE)); | ||
|
||
if(DTGTK_IS_DRAWING_AREA(w)) | ||
{ | ||
const float height = dt_conf_get_int(config_str); | ||
dtgtk_drawing_area_set_height(w, height); | ||
if(use_height) { | ||
const int height = dt_conf_get_int(config_str); | ||
dtgtk_drawing_area_set_height(w, height); | ||
} else { | ||
const float aspect = dt_conf_get_int(config_str); | ||
dtgtk_drawing_area_set_aspect_ratio(w, aspect / 100.0); | ||
} | ||
g_signal_connect(G_OBJECT(w), | ||
"scroll-event", | ||
G_CALLBACK(_scroll_wrap_height), | ||
G_CALLBACK(_scroll_wrap), | ||
config_str); | ||
} | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The
{
should be on next line. See current code.