Skip to content

Commit

Permalink
oscplot: win correction check fixes
Browse files Browse the repository at this point in the history
window correction enabled by default
check button becomes inactive when plot is running

Signed-off-by: Cristina Suteu <[email protected]>
  • Loading branch information
cristina-suteu committed Dec 4, 2023
1 parent 2fe837c commit 5c3fcaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions glade/oscplot.glade
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@
<property name="label" translatable="yes">Enable/ Disable</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
</object>
<packing>
Expand Down
7 changes: 6 additions & 1 deletion oscplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2428,6 +2428,7 @@ static void update_transform_settings(OscPlot *plot, Transform *transform)
if (plot_type == FFT_PLOT) {
FFT_SETTINGS(transform)->fft_size = comboboxtext_get_active_text_as_int(GTK_COMBO_BOX_TEXT(priv->fft_size_widget));
FFT_SETTINGS(transform)->fft_win = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(priv->fft_win_widget));
FFT_SETTINGS(transform)->window_correction = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fft_win_correction));
FFT_SETTINGS(transform)->fft_avg = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->fft_avg_widget));
FFT_SETTINGS(transform)->fft_pwr_off = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->fft_pwr_offset_widget));
FFT_SETTINGS(transform)->fft_alg_data.cached_fft_size = -1;
Expand Down Expand Up @@ -2479,6 +2480,7 @@ static void update_transform_settings(OscPlot *plot, Transform *transform)
FREQ_SPECTRUM_SETTINGS(transform)->filter_bandwidth = priv->filter_bw;
FREQ_SPECTRUM_SETTINGS(transform)->fft_size = comboboxtext_get_active_text_as_int(GTK_COMBO_BOX_TEXT(priv->fft_size_widget));
FREQ_SPECTRUM_SETTINGS(transform)->fft_win = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(priv->fft_win_widget));
FREQ_SPECTRUM_SETTINGS(transform)->window_correction = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fft_win_correction));
FREQ_SPECTRUM_SETTINGS(transform)->fft_avg = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->fft_avg_widget));
FREQ_SPECTRUM_SETTINGS(transform)->fft_pwr_off = gtk_spin_button_get_value(GTK_SPIN_BUTTON(priv->fft_pwr_offset_widget));
FREQ_SPECTRUM_SETTINGS(transform)->maxXaxis = malloc(sizeof(unsigned int) * (MAX_MARKERS + 1));
Expand All @@ -2502,7 +2504,7 @@ static Transform* add_transform_to_list(OscPlot *plot, int tr_type, GSList *chan
struct _freq_spectrum_settings *freq_spectrum_settings;
GSList *node;

gboolean window_correction = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(plot->priv->fft_win_correction));
bool window_correction = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(plot->priv->fft_win_correction));

transform = Transform_new(tr_type);
transform->graph_color = &color_graph[priv->transform_list->size];
Expand Down Expand Up @@ -5355,6 +5357,7 @@ int osc_plot_ini_read_handler (OscPlot *plot, int line, const char *section,
priv->read_scale_params = 0;
}
check_valid_setup(plot);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->fft_win_correction), false);
priv->profile_loaded_scale = TRUE;
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(priv->capture_button), atoi(value));
priv->profile_loaded_scale = FALSE;
Expand Down Expand Up @@ -7311,6 +7314,8 @@ static void create_plot(OscPlot *plot)
"capture_domain", "sensitive", G_BINDING_INVERT_BOOLEAN);
g_builder_bind_property(builder, "capture_button", "active",
"fft_size", "sensitive", G_BINDING_INVERT_BOOLEAN);
g_builder_bind_property(builder, "capture_button", "active",
"fft_win_correction", "sensitive", G_BINDING_INVERT_BOOLEAN);
g_builder_bind_property(builder, "capture_button", "active",
"fft_win", "sensitive", G_BINDING_INVERT_BOOLEAN);
g_builder_bind_property(builder, "capture_button", "active",
Expand Down

0 comments on commit 5c3fcaa

Please sign in to comment.