aboutsummaryrefslogtreecommitdiff
path: root/src/mandelbrot-zoom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mandelbrot-zoom.c')
-rw-r--r--src/mandelbrot-zoom.c103
1 files changed, 65 insertions, 38 deletions
diff --git a/src/mandelbrot-zoom.c b/src/mandelbrot-zoom.c
index 4f23696..7aecae4 100644
--- a/src/mandelbrot-zoom.c
+++ b/src/mandelbrot-zoom.c
@@ -14,37 +14,47 @@ int main(int argc, char **argv)
builder = gtk_builder_new();
gtk_builder_add_from_file (builder, "C:/Users/Superleo1810/eclipse-workspace/mandelbrot-zoom/glade/settings.glade", NULL); // gtk = zu behindert für relative pfade
- ui.settings = GTK_WIDGET(gtk_builder_get_object(builder, "settings"));
+ ui.settings = GTK_WINDOW(gtk_builder_get_object(builder, "settings"));
//gtk_builder_connect_signals(builder, NULL);
- ui.exportCb = GTK_WIDGET(gtk_builder_get_object(builder, "exportCb"));
- ui.gifRd = GTK_WIDGET(gtk_builder_get_object(builder, "gifRd"));
- ui.widthSp = GTK_WIDGET(gtk_builder_get_object(builder, "widthSp"));
- ui.heightSp = GTK_WIDGET(gtk_builder_get_object(builder, "heightSp"));
- ui.fpsRenderSp = GTK_WIDGET(gtk_builder_get_object(builder, "fpsRenderSp"));
- ui.fpsVideoSp = GTK_WIDGET(gtk_builder_get_object(builder, "fpsVideoSp"));
- ui.bitrateSp = GTK_WIDGET(gtk_builder_get_object(builder, "bitrateSp"));
- ui.exportTf = GTK_WIDGET(gtk_builder_get_object(builder, "exportTf"));
- ui.startBtn = GTK_WIDGET(gtk_builder_get_object(builder, "startBtn"));
- ui.exitBtn = GTK_WIDGET(gtk_builder_get_object(builder, "exitBtn"));
-
- gtk_spin_button_set_increments((GtkSpinButton *)ui.widthSp, 1, 2);
- gtk_spin_button_set_increments((GtkSpinButton *)ui.heightSp, 1, 2);
- gtk_spin_button_set_increments((GtkSpinButton *)ui.fpsRenderSp, 1, 2);
- gtk_spin_button_set_increments((GtkSpinButton *)ui.fpsVideoSp, 1, 2);
- gtk_spin_button_set_increments((GtkSpinButton *)ui.bitrateSp, 1, 2);
-
- gtk_spin_button_set_value((GtkSpinButton *)ui.widthSp, 1920);
- gtk_spin_button_set_value((GtkSpinButton *)ui.heightSp, 1080);
- gtk_spin_button_set_value((GtkSpinButton *)ui.fpsRenderSp, 30);
- gtk_spin_button_set_value((GtkSpinButton *)ui.fpsVideoSp, 30);
- gtk_spin_button_set_value((GtkSpinButton *)ui.bitrateSp, 1000);
-
- gtk_spin_button_set_range((GtkSpinButton *)ui.widthSp, 1, 1920);
- gtk_spin_button_set_range((GtkSpinButton *)ui.heightSp, 1, 1080);
- gtk_spin_button_set_range((GtkSpinButton *)ui.fpsRenderSp, 1, 60);
- gtk_spin_button_set_range((GtkSpinButton *)ui.fpsVideoSp, 1, 60);
- gtk_spin_button_set_range((GtkSpinButton *)ui.bitrateSp, 1, 65535);
-
+ ui.iterationsSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "iterationsSp"));
+ ui.colorFromBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorFromBtn"));
+ ui.colorToBtn = GTK_BUTTON(gtk_builder_get_object(builder, "colorToBtn"));
+ ui.exportCb = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, "exportCb"));
+ ui.gifRd = GTK_RADIO_BUTTON(gtk_builder_get_object(builder, "gifRd"));
+ ui.widthSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "widthSp"));
+ ui.heightSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "heightSp"));
+ ui.fpsRenderSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "fpsRenderSp"));
+ ui.fpsVideoSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "fpsVideoSp"));
+ ui.bitrateSp = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "bitrateSp"));
+ ui.exportTf = GTK_ENTRY(gtk_builder_get_object(builder, "exportTf"));
+ ui.startBtn = GTK_BUTTON(gtk_builder_get_object(builder, "startBtn"));
+ ui.exitBtn = GTK_BUTTON(gtk_builder_get_object(builder, "exitBtn"));
+ ui.colorDialog = GTK_COLOR_SELECTION_DIALOG(gtk_builder_get_object(builder, "colorDialog"));
+
+ gtk_spin_button_set_increments(ui.iterationsSp, 1, 2);
+ gtk_spin_button_set_increments(ui.widthSp, 1, 2);
+ gtk_spin_button_set_increments(ui.heightSp, 1, 2);
+ gtk_spin_button_set_increments(ui.fpsRenderSp, 1, 2);
+ gtk_spin_button_set_increments(ui.fpsVideoSp, 1, 2);
+ gtk_spin_button_set_increments(ui.bitrateSp, 1, 2);
+
+ gtk_spin_button_set_value(ui.iterationsSp, 1000);
+ gtk_spin_button_set_value(ui.widthSp, 1920);
+ gtk_spin_button_set_value(ui.heightSp, 1080);
+ gtk_spin_button_set_value(ui.fpsRenderSp, 30);
+ gtk_spin_button_set_value(ui.fpsVideoSp, 30);
+ gtk_spin_button_set_value(ui.bitrateSp, 1000);
+
+ gtk_spin_button_set_range(ui.iterationsSp, 1, 16777215); // 3 bytes á 8 bit = 24 bit
+ gtk_spin_button_set_range(ui.widthSp, 1, 1920);
+ gtk_spin_button_set_range(ui.heightSp, 1, 1080);
+ gtk_spin_button_set_range(ui.fpsRenderSp, 1, 60);
+ gtk_spin_button_set_range(ui.fpsVideoSp, 1, 60);
+ gtk_spin_button_set_range(ui.bitrateSp, 1, 65535);
+
+ g_signal_connect(ui.iterationsSp, "value-changed", G_CALLBACK(on_iterationsSp_valueChanged), NULL);
+ g_signal_connect(ui.colorFromBtn, "clicked", G_CALLBACK(on_colorFromBtn_clicked), NULL);
+ g_signal_connect(ui.colorToBtn, "clicked", G_CALLBACK(on_colorToBtn_clicked), NULL);
g_signal_connect(ui.exportCb, "toggled", G_CALLBACK(on_exportCb_toggled), NULL);
g_signal_connect(ui.widthSp, "value-changed", G_CALLBACK(on_widthSp_valueChanged), NULL);
g_signal_connect(ui.heightSp, "value-changed", G_CALLBACK(on_heightSp_valueChanged), NULL);
@@ -56,44 +66,61 @@ int main(int argc, char **argv)
g_signal_connect(ui.exitBtn, "clicked", G_CALLBACK(on_exitBtn_clicked), NULL);
g_object_unref(builder);
- gtk_widget_show(ui.settings);
+ gtk_widget_show(GTK_WIDGET(ui.settings));
gtk_main();
return 0;
}
+void on_iterationsSp_valueChanged()
+{
+ config.iterations = gtk_spin_button_get_value(ui.widthSp);
+}
+
+void on_colorFromBtn_clicked()
+{
+ currentColor = COLOR_FROM;
+ gtk_dialog_run(ui.colorDialog);
+}
+
+void on_colorToBtn_clicked()
+{
+ currentColor = COLOR_TO;
+ gtk_dialog_run(ui.colorDialog);
+}
+
void on_exportCb_toggled()
{
- config.video = gtk_toggle_button_get_active((GtkToggleButton *)ui.exportCb);
+ config.video = gtk_toggle_button_get_active(ui.exportCb);
}
void on_exportTf_changed()
{
- config.path = CHAR_PTR(gtk_entry_get_text((GtkEntry *)ui.exportTf));
+ config.path = CHAR_PTR(gtk_entry_get_text(ui.exportTf));
}
void on_widthSp_valueChanged()
{
- config.width = gtk_spin_button_get_value((GtkSpinButton *)ui.widthSp);
+ config.width = gtk_spin_button_get_value(ui.widthSp);
}
void on_heightSp_valueChanged()
{
- config.height = gtk_spin_button_get_value((GtkSpinButton *)ui.heightSp);
+ config.height = gtk_spin_button_get_value(ui.heightSp);
}
void on_fpsRenderSp_valueChanged()
{
- config.renderFPS = gtk_spin_button_get_value((GtkSpinButton *)ui.fpsRenderSp);
+ config.renderFPS = gtk_spin_button_get_value(ui.fpsRenderSp);
}
void on_fpsVideoSp_valueChanged()
{
- config.videoFPS = gtk_spin_button_get_value((GtkSpinButton *)ui.fpsVideoSp);
+ config.videoFPS = gtk_spin_button_get_value(ui.fpsVideoSp);
}
void on_bitrateSp_valueChanged()
{
- config.bitrate = gtk_spin_button_get_value((GtkSpinButton *)ui.bitrateSp);
+ config.bitrate = gtk_spin_button_get_value(ui.bitrateSp);
}
void on_startBtn_clicked()