#include "../Inc/MainForm.h" #include #include #include "../Inc/error.h" void close_main_window(void){ _ResetPressure(); gtk_main_quit(); } GtkWidget* create_main_window() { GtkWidget *window; widgets.gpio_triggered = 0; widgets.ErrorTreeView = NULL; widgets.ErrorListStore = NULL; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Стенд проверки датчиков"); gtk_container_set_border_width(GTK_CONTAINER(window), 50); gtk_window_set_default_size(GTK_WINDOW(window), 600, 400); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(close_main_window), NULL); widgets.GridBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_add(GTK_CONTAINER(window), widgets.GridBox); GtkWidget *label_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_box_pack_start(GTK_BOX(widgets.GridBox), label_box, FALSE, FALSE, 0); widgets.LabelCurrentPressure = gtk_label_new("Текущее давление: 0.0"); gtk_box_pack_start(GTK_BOX(label_box), widgets.LabelCurrentPressure, FALSE, FALSE, 0); gtk_widget_set_valign(widgets.LabelCurrentPressure, GTK_ALIGN_START); widgets.LabelSensorPressure = gtk_label_new("Датчик не найден"); gtk_box_pack_start(GTK_BOX(label_box), widgets.LabelSensorPressure, FALSE, FALSE, 0); gtk_widget_set_valign(widgets.LabelSensorPressure, GTK_ALIGN_START); // widgets.LabelRequiredPressure = gtk_label_new("Необходимое давление: 6.4"); // gtk_box_pack_start(GTK_BOX(label_box), widgets.LabelRequiredPressure, FALSE, FALSE, 0); // gtk_widget_set_valign(widgets.LabelRequiredPressure, GTK_ALIGN_START); widgets.ButtonMain = gtk_button_new_with_label("Начать работу"); gtk_box_pack_start(GTK_BOX(widgets.GridBox), widgets.ButtonMain, FALSE, FALSE, 0); g_signal_connect(GTK_BUTTON(widgets.ButtonMain), "clicked", G_CALLBACK(ButtonMain_Handler), NULL); widgets.ButtonReprint = gtk_button_new_with_label("Повторная печать"); gtk_box_pack_start(GTK_BOX(widgets.GridBox), widgets.ButtonReprint, FALSE, FALSE, 0); g_signal_connect(GTK_BUTTON(widgets.ButtonReprint), "clicked", G_CALLBACK(ButtonReprint_Handler), NULL); // Создаем таблицу ошибок initialize_error_table(); update_error_table(0); set_button_color_white(widgets.ButtonMain); gtk_widget_show_all(window); return window; }