diff --git a/Makefile b/Makefile index 851b5ea..2288c42 100644 --- a/Makefile +++ b/Makefile @@ -1,39 +1,63 @@ -SHELL = /bin/sh -.SUFFIXES: -.SUFFIXES: .c .o -.PHONY = run -.PHONY = clean -.PHONY: Makefile - +.PHONY: run clean install all +.DEFAULT_GOAL: all CC=gcc -CFLAGS=`pkg-config --cflags gtk4 --libs gtk4` # --libs gl` # --libs glib-2.0 +CFLAGS=`pkg-config --cflags gtk4 gl glib-2.0` +LDFLAGS=`pkg-config --libs gtk4 gl glib-2.0` WARNINGS = -Wall DEBUG = -ggdb -fno-omit-frame-pointer -OPTIMIZE = -O2 +OPTIMIZE = -O3 -all: - exec +sources = $(shell find . -maxdepth 1 -type f -name "*.c") +objects = $(patsubst %.c,%.o,$(sources)) +dependencies = $(patsubst %.c,%.d,$(sources)) -exec.o: hot.c warm.c cold.c main.c Makefile - $(CC) $(CFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) hot.c warm.c cold.c -o $@ main.c +all: myprogram -clean: - rm -f exec.o +-include $(dependencies) + +myprogram: $(objects) + $(CC) $(LDFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) $^ -o $@ + +%.o: %.c Makefile + $(CC) $(CFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) -c $< -o $@ + +%.d: %.c Makefile + $(CC) $(CFLAGS) -MM -MT $(@:%.d=%.o) -MF $@ $< install: echo "Installing is not supported" -run: exec.o - ./exec.o +run: myprogram + ./myprogram +clean: + rm -f myprogram + rm -f *.o + rm -f *.d # /!\ erreur fatale: GL/glu.h # gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g -Wall -Wextra # -std=c99 -lm *.c -o formattage `pkg-config --cflags --libs glib-2.0` +#------------------------------------------------------------------------------# +# 'make' has an implicit rule for updating a ‘.o’ file # +# from a correspondingly named ‘.c’ file # +# using a ‘cc -c’ command. # +# Implicit rules are listed and applied in a predefined order (C before P...) # +# Predefined implicit rules are implemented in make as suffix rules # +# The default suffix list is: .out, .a, .ln, .o, .c, .cc, .C, .cpp, .p,... # +# Rules whose suffixes fail to be on the list are disabled. # +# You can define your own implicit rules by writing pattern rules. # +#------------------------------------------------------------------------------# +# If there are many implicit rules with the same target pattern, +# the rule that actually applies is the one whose prerequisites exist or can be made +# ex: a .o can be made from a .c (C compiler) or a .p (Pascal compiler) +# Variables allow a text string to be defined once +# and substituted in multiple places later. +# (see Chapter 6 [How to Use Variables], page 65) diff --git a/cold.c b/cold.c index 74f28a1..50199eb 100644 --- a/cold.c +++ b/cold.c @@ -56,7 +56,7 @@ GtkWidget *get_rules_page_new(){ gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); gtk_widget_set_size_request (hpaned, W, H); - gtk_widget_set_size_request (frame1, 100, 0); // < utile seulement pour la largeur min/max + gtk_widget_set_size_request (frame1, 100, H); // < utile seulement pour la largeur min/max // gtk_widget_set_size_request (frame2, 50, 100); // gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); diff --git a/cold.d b/cold.d new file mode 100644 index 0000000..49544c2 --- /dev/null +++ b/cold.d @@ -0,0 +1 @@ +cold.o: cold.c cold.h diff --git a/cold.h b/cold.h index e683998..aab5101 100644 --- a/cold.h +++ b/cold.h @@ -2,6 +2,8 @@ #include #define W 1830 #define H 1000 +#define W_GL_AREA 1800 - 34 +#define H_GL_AREA 1000 - 6 void print_text(GtkWidget *widget, gpointer data); diff --git a/cold.o b/cold.o new file mode 100644 index 0000000..d14ab50 Binary files /dev/null and b/cold.o differ diff --git a/exec.o b/exec.o deleted file mode 100755 index 4154afa..0000000 Binary files a/exec.o and /dev/null differ diff --git a/hot.c b/hot.c index 53c2080..bba010e 100644 --- a/hot.c +++ b/hot.c @@ -8,14 +8,19 @@ // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery GtkWidget *get_space_page_new(){ - GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); - gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP")); + GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)); + gtk_box_append (controls_box, gtk_button_new_with_label ("RUN")); + GtkAdjustment *speed_adjust = gtk_adjustment_new (0, 0, 100, 1, 0, 0); + GtkWidget *scroll_speed = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, speed_adjust); +// gtk_box_append (controls_box, scroll_speed); + gtk_box_append (controls_box, gtk_button_new_with_label ("step")); + // GtkLevelBar *slow_speed = GTK_LEVEL_BAR (gtk_level_bar_new ()); // or __new_for_interval(0,100); // gtk_level_bar_set_mode (slow_speed, GTK_LEVEL_BAR_MODE_CONTINUOUS); //_DISCRETE - gtk_box_append (controls_box, gtk_button_new_with_label ("slow down / speed up")); // GTK_WIDGET(slow_speed)); - gtk_box_append (controls_box, gtk_button_new_with_label ("step by step")); +// gtk_box_append (controls_box, gtk_button_new_with_label ("slow down / speed up")); // GTK_WIDGET(slow_speed)); +// gtk_box_append (controls_box, gtk_button_new_with_label ("step by step")); GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); - gtk_progress_bar_set_text (buffer, "<<-- BUFFER -->>"); + gtk_progress_bar_set_text (buffer, "<>"); gtk_progress_bar_set_show_text (buffer, TRUE); gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----")); @@ -42,8 +47,14 @@ GtkWidget *get_space_page_new(){ gtk_grid_attach (GTK_GRID(bottom_grid), gtk_button_new_with_label ("zoom, +/- grid,\npresentation,\nstyles,..."), 1, 0, 1, 2); GtkWidget *space_grid = gtk_grid_new(); - gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_scrolled_gl_area()), 0, 0, 1, 1); -// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("Objects / Situations (transparences, styles)"), 0, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(get_scrolled_gl_area()), 0, 1, 1, 10); + gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("RUN"), 1, 0, 1, 1); + gtk_grid_attach (GTK_GRID(space_grid), scroll_speed, 1, 1, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("STEP"), 1, 2, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(controls_box), 1, 3, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(buffer), 1, 3, 1, 1); +// gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(XYZ_box), 1, 3, 1, 1); // gtk_grid_attach (GTK_GRID(space_grid), GTK_WIDGET(bottom_grid), 0, 1, 2, 1); // ?! échec x_size // gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("?"), 1, 1, 1, 1); diff --git a/hot.d b/hot.d new file mode 100644 index 0000000..0108b09 --- /dev/null +++ b/hot.d @@ -0,0 +1,3 @@ +hot.o: hot.c warm.h \ + /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ + cold.h diff --git a/hot.o b/hot.o new file mode 100644 index 0000000..4103ee8 Binary files /dev/null and b/hot.o differ diff --git a/junk b/junk new file mode 100644 index 0000000..e69de29 diff --git a/0_application.c b/junks/0_application.c similarity index 100% rename from 0_application.c rename to junks/0_application.c diff --git a/0_window.c b/junks/0_window.c similarity index 100% rename from 0_window.c rename to junks/0_window.c diff --git a/main.d b/main.d new file mode 100644 index 0000000..cb66cb3 --- /dev/null +++ b/main.d @@ -0,0 +1,3 @@ +main.o: main.c hot.h warm.h \ + /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ + cold.h diff --git a/main.o b/main.o new file mode 100644 index 0000000..eaf6c6a Binary files /dev/null and b/main.o differ diff --git a/myprogram b/myprogram new file mode 100755 index 0000000..306f41e Binary files /dev/null and b/myprogram differ diff --git a/warm.c b/warm.c index 3e5293e..dd35605 100644 --- a/warm.c +++ b/warm.c @@ -1,14 +1,14 @@ #include #include -//#include "warm.h" +#include "warm.h" #include "cold.h" // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery GtkScrolledWindow *get_scrolled_gl_area(){ GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); - gtk_scrolled_window_set_min_content_width (scrolled, W); - gtk_scrolled_window_set_min_content_height (scrolled, H); + gtk_scrolled_window_set_min_content_width (scrolled, W_GL_AREA); + gtk_scrolled_window_set_min_content_height (scrolled, H_GL_AREA); // GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); // GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); // (value, lower, upper, step_increment, page_increment, page_size) diff --git a/warm.d b/warm.d new file mode 100644 index 0000000..85cf6d4 --- /dev/null +++ b/warm.d @@ -0,0 +1,3 @@ +warm.o: warm.c warm.h \ + /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ + cold.h diff --git a/warm.h b/warm.h index 15b5337..4bf9edb 100644 --- a/warm.h +++ b/warm.h @@ -14,7 +14,8 @@ #include #include "cold.h" -GtkWidget *get_scrolled_gl_area(); + +GtkScrolledWindow *get_scrolled_gl_area(); GtkWidget *get_space_page_new_2024_04_30(); // sécurité 2024_04_30 1ère version /* diff --git a/warm.o b/warm.o new file mode 100644 index 0000000..bb7d5b9 Binary files /dev/null and b/warm.o differ