WIP: un [mode_console] pour tester la logique des commandes DO UNDO REDO ?
This commit is contained in:
parent
0bf0a4fd19
commit
5ed02a396e
9
(notes)
9
(notes)
|
@ -1,4 +1,11 @@
|
|||
https://developer.gnome.org/hig/principles.html
|
||||
|
||||
|
||||
https://www.man-linux-magique.net/man3/gets.html
|
||||
https://zestedesavoir.com/tutoriels/755/le-langage-c-1/1043_aggregats-memoire-et-fichiers/4911_les-fichiers/
|
||||
|
||||
=================================================
|
||||
|
||||
ttps://developer.gnome.org/hig/principles.html
|
||||
|
||||
// https://docs.gtk.org/gio/class.MenuModel.html
|
||||
// https://www.geany.org/manual/gtk/gobject/index.html
|
||||
|
|
|
@ -126,4 +126,6 @@ void fsm_disp_add_chart (disp_list d, int *p_chart);
|
|||
int fsm_disp_get_chart (disp_list d, int from, int to);
|
||||
void fsm_disp_remove_chart (disp_list d, int *p_chart);
|
||||
|
||||
// --------------------------------------------------------------- WIP ------
|
||||
void fsm_another_proto_engine ();
|
||||
void *fsm_get_engine_page();
|
||||
|
|
|
@ -160,4 +160,4 @@ void on_skip_this_step (GtkWidget *btt, gpointer data);
|
|||
void on_something_else (GtkWidget *btt, gpointer data);
|
||||
void on_closing_page (GtkWidget *btt, gpointer data);
|
||||
|
||||
|
||||
void on_start_new_engine (GtkWidget *btt, gpointer data);
|
||||
|
|
|
@ -108,6 +108,7 @@ void *widget_get_state_page(); // in : widget / state / dispatch.c
|
|||
void *widget_get_rules_page(); // in : widget / rules / dispatch.c
|
||||
void *widget_get_data_page(); // in : widget / data / dispatch.c
|
||||
void *widget_get_measure_page();// in : widget / measure / dispatch.c
|
||||
void *widget_get_engine_page(); // in : fsm / engine / engine.c
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include "../../../include/fsm.h"
|
||||
#include "../../../include/widget.h"
|
||||
#include "../../../include/signal.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -43,55 +45,29 @@
|
|||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
static void listen (struct timespec rem, struct timespec req)
|
||||
{
|
||||
|
||||
printf("\n\x1b[1F\x1b[2K"); // move to the beginning of previous line and clear it
|
||||
nanosleep(&req , &rem);
|
||||
}
|
||||
static void fsm_strange_engine()
|
||||
{
|
||||
int milliseconds = 100;
|
||||
struct timespec rem;
|
||||
struct timespec req= {
|
||||
(int)(milliseconds / 1000), /* secs (Must be Non-Negative) */
|
||||
(milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */
|
||||
(int)(milliseconds / 1000), // secs (Must be Non-Negative)
|
||||
(milliseconds % 1000) * 1000000 // nano (Must be in range of 0 to 999999999)
|
||||
};
|
||||
|
||||
printf("fsm mode_console 😇️ (see@ 'src/engine/engine.c\n");
|
||||
|
||||
int stop = 0;
|
||||
while (! stop) {
|
||||
printf(" | M . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | W . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | MO * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | W=-O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | D=-- -O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | =- - - O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | -- O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | - O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | (*O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | D . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | M- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | W =- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | M = --- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | W =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | M=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
printf(" | W- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||
stop = (getchar() == '\n');
|
||||
printf(" | °°°°°°°°°°°°°°°° |"); listen (rem, req);
|
||||
printf(" | ************* *************|"); listen (rem, req);
|
||||
// stop = (getchar() == '\n');
|
||||
}
|
||||
printf("\x1b[1Fsrc/fsm/engine.c | src/fsm/engine.c fsm_strange_engine stopped\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,8 +75,31 @@ void fsm_engine_init()
|
|||
{
|
||||
if (1) printf ("src/fsm/engine.c | src/fsm/engine.c fsm_engine_init()\n");
|
||||
fsm_strange_engine();
|
||||
// \x1b[1F \x1b[2K == move to the beginning of previous line and clear it
|
||||
printf("src/fsm/engine.c | src/fsm/engine.c fsm_strange_engine stopped\n");
|
||||
//fsm_another_proto_engine();
|
||||
}
|
||||
|
||||
static GtkBox *engine_page;
|
||||
static GtkBox *edit_a_new_engine_box;
|
||||
static GtkWidget *factory;
|
||||
static GtkWidget *btt_edit_a_new_engine;
|
||||
|
||||
|
||||
void *fsm_get_engine_page()
|
||||
{
|
||||
engine_page = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
edit_a_new_engine_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
||||
factory = gtk_picture_new_for_filename
|
||||
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/factory.png");
|
||||
btt_edit_a_new_engine = gtk_toggle_button_new_with_label ("edit a new engine");
|
||||
g_signal_connect (btt_edit_a_new_engine, "toggled",
|
||||
G_CALLBACK (on_start_new_engine), NULL);
|
||||
|
||||
gtk_box_append (edit_a_new_engine_box, GTK_WIDGET (factory));
|
||||
gtk_box_append (edit_a_new_engine_box, GTK_WIDGET (btt_edit_a_new_engine));
|
||||
gtk_box_append (engine_page, GTK_WIDGET (edit_a_new_engine_box));
|
||||
|
||||
gtk_widget_set_size_request (GTK_WIDGET (engine_page), 1000, 400);
|
||||
|
||||
return engine_page;
|
||||
}
|
||||
|
|
|
@ -139,13 +139,13 @@ int main (int argc, char **argv)
|
|||
|
||||
GtkApplication *app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||
|
||||
fsm_engine_init(); // def: fsm/engine/engine;
|
||||
fsm_init (); // fsm = finite state machine (see : src/fsm/dispatch.c)
|
||||
|
||||
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||
// on_windows_activation <> see: src/widget/dispatch.c (NOT src/signal.c)
|
||||
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
|
||||
g_object_unref (app);
|
||||
|
||||
return status;
|
||||
|
|
17
src/signal.c
17
src/signal.c
|
@ -366,8 +366,17 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
|
|||
void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
|
||||
{
|
||||
// fsm_measures_sorted_list_do something ();
|
||||
|
||||
// 2024-09-03 - experimental area -
|
||||
// j'essaie d'interagir avec l'affichage console
|
||||
// widget_get_measure_page() < demeure intact (valide)
|
||||
// pour revenir en arrière,
|
||||
// il n'y a qu'à remplacer fsm_get_engine_page()
|
||||
// par widget_get_measure_page() dans l'instruction suivante.
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
|
||||
GTK_WIDGET (widget_get_measure_page()));
|
||||
// GTK_WIDGET (widget_get_measure_page()));
|
||||
GTK_WIDGET (fsm_get_engine_page()));
|
||||
}
|
||||
|
||||
void on_start_new_measure (GtkWidget *btt, gpointer data)
|
||||
|
@ -454,4 +463,10 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data
|
|||
GTK_WIDGET (widget_measure_third_event_occurences_in_between()));
|
||||
}
|
||||
|
||||
void on_start_new_engine (GtkWidget *btt, gpointer data)
|
||||
{
|
||||
printf("src/signal.c | on_start_new_engine() > fsm_engine_init();\n");
|
||||
fsm_engine_init();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "../../../include/base.h"
|
||||
#include "../../../include/signal.h"
|
||||
#include "../../../include/widget.h"
|
||||
#include "../../../include/fsm.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ void window_design_topbar_left (GtkWidget *header_bar)
|
|||
|
||||
|
||||
#define YOU_WANT_TO_START_ON_ANOTHER_PAGE 0
|
||||
#define YOU_DON_T_WANT_THE_MODE_CONSOLE 0
|
||||
/******************************************************************************/
|
||||
/* use the next lineS to select the page that will be presented first */
|
||||
/* it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) */
|
||||
|
@ -92,6 +93,7 @@ void window_design_topbar_left (GtkWidget *header_bar)
|
|||
/* the last one is the winner (and the winner takes it all !...) */
|
||||
/* THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) */
|
||||
/******************************************************************************/
|
||||
if (YOU_DON_T_WANT_THE_MODE_CONSOLE)
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
|
||||
if (YOU_WANT_TO_START_ON_ANOTHER_PAGE) { // select one
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
|
||||
|
|
Loading…
Reference in New Issue