Makefile (+) #define W_GL_AREA 1800 - 34 #define H_GL_AREA 1000 - 6

This commit is contained in:
Jean Sirmai 2024-05-05 20:53:52 +02:00
parent 7cb3804d01
commit 109f40423e
Signed by: jean
GPG Key ID: FB3115C340E057E3
19 changed files with 77 additions and 29 deletions

View File

@ -1,39 +1,63 @@
SHELL = /bin/sh .PHONY: run clean install all
.SUFFIXES: .DEFAULT_GOAL: all
.SUFFIXES: .c .o
.PHONY = run
.PHONY = clean
.PHONY: Makefile
CC=gcc 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 WARNINGS = -Wall
DEBUG = -ggdb -fno-omit-frame-pointer DEBUG = -ggdb -fno-omit-frame-pointer
OPTIMIZE = -O2 OPTIMIZE = -O3
all: sources = $(shell find . -maxdepth 1 -type f -name "*.c")
exec objects = $(patsubst %.c,%.o,$(sources))
dependencies = $(patsubst %.c,%.d,$(sources))
exec.o: hot.c warm.c cold.c main.c Makefile all: myprogram
$(CC) $(CFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) hot.c warm.c cold.c -o $@ main.c
clean: -include $(dependencies)
rm -f exec.o
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: install:
echo "Installing is not supported" echo "Installing is not supported"
run: exec.o run: myprogram
./exec.o ./myprogram
clean:
rm -f myprogram
rm -f *.o
rm -f *.d
# /!\ erreur fatale: GL/glu.h <?> # /!\ erreur fatale: GL/glu.h <?>
# gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g -Wall -Wextra # 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` # -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)

2
cold.c
View File

@ -56,7 +56,7 @@ GtkWidget *get_rules_page_new(){
gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1)); gtk_paned_set_start_child (GTK_PANED(hpaned), GTK_WIDGET (frame1));
gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2)); gtk_paned_set_end_child (GTK_PANED(hpaned), GTK_WIDGET (frame2));
gtk_widget_set_size_request (hpaned, W, H); 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_widget_set_size_request (frame2, 50, 100);
// gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1); // gtk_grid_attach (GTK_GRID (rules_grid), hpaned, 0, 0, 1, 1);

1
cold.d Normal file
View File

@ -0,0 +1 @@
cold.o: cold.c cold.h

2
cold.h
View File

@ -2,6 +2,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#define W 1830 #define W 1830
#define H 1000 #define H 1000
#define W_GL_AREA 1800 - 34
#define H_GL_AREA 1000 - 6
void print_text(GtkWidget *widget, gpointer data); void print_text(GtkWidget *widget, gpointer data);

BIN
cold.o Normal file

Binary file not shown.

BIN
exec.o

Binary file not shown.

25
hot.c
View File

@ -8,14 +8,19 @@
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
GtkWidget *get_space_page_new(){ GtkWidget *get_space_page_new(){
GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_VERTICAL, 0));
gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP")); 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); // 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_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 ("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 ("step by step"));
GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ()); 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_progress_bar_set_show_text (buffer, TRUE);
gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----")); 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); 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(); 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_button_new_with_label ("Objects / Situations (transparences, styles)"), 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_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_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); // gtk_grid_attach (GTK_GRID(space_grid), gtk_button_new_with_label ("?"), 1, 1, 1, 1);

3
hot.d Normal file
View File

@ -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

BIN
hot.o Normal file

Binary file not shown.

0
junk Normal file
View File

3
main.d Normal file
View File

@ -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

BIN
main.o Normal file

Binary file not shown.

BIN
myprogram Executable file

Binary file not shown.

6
warm.c
View File

@ -1,14 +1,14 @@
#include <stdio.h> #include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
//#include "warm.h" #include "warm.h"
#include "cold.h" #include "cold.h"
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery // https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
GtkScrolledWindow *get_scrolled_gl_area(){ GtkScrolledWindow *get_scrolled_gl_area(){
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new()); GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new());
gtk_scrolled_window_set_min_content_width (scrolled, W); gtk_scrolled_window_set_min_content_width (scrolled, W_GL_AREA);
gtk_scrolled_window_set_min_content_height (scrolled, H); gtk_scrolled_window_set_min_content_height (scrolled, H_GL_AREA);
// GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000); // GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
// GtkAdjustment *height = 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) // (value, lower, upper, step_increment, page_increment, page_size)

3
warm.d Normal file
View File

@ -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

3
warm.h
View File

@ -14,7 +14,8 @@
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
#include "cold.h" #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 GtkWidget *get_space_page_new_2024_04_30(); // sécurité 2024_04_30 1ère version
/* /*

BIN
warm.o Normal file

Binary file not shown.