cleaning & simplifying
This commit is contained in:
parent
0d7f90cf18
commit
3d71b6e9c1
|
@ -31,7 +31,7 @@
|
|||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <gtk-4.0/gtk/gtk.h> // << ? TODO > Check
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
/******************************************************************************/
|
||||
/* S T A T E M A C H I N E */
|
||||
|
@ -51,8 +51,7 @@ bool fsm_init ();
|
|||
|
||||
void fsm_measures_list_init ();
|
||||
void fsm_results_list_init ();
|
||||
void prefer_displayable_list_init ();
|
||||
// TODO Eh oui ! Il y a des préférences qui sont des états de la fsm... How to ?
|
||||
void fsm_displayable_list_init ();
|
||||
|
||||
int fsm_get_exec_edit ();
|
||||
int fsm_get_state_rules_data ();
|
||||
|
@ -71,12 +70,12 @@ void *fsm_add_result (char *result_name);
|
|||
|
||||
void fsm_debug (int choice, int value, char *string, int sub_automaton);
|
||||
|
||||
void pref_set_store_restore_reset (int choice, int value);
|
||||
const char *get_button_icon_name (int n);
|
||||
void fsm_store_restore_reset (int choice, int value);
|
||||
const char *fsm_get_button_icon_name (int n);
|
||||
|
||||
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
|
||||
|
||||
void *fsm_add_displayable (char *displayable_name);
|
||||
|
||||
void prefer_init ();
|
||||
void fsm_preferences_init ();
|
||||
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* *
|
||||
* Gem-graph client *
|
||||
* *
|
||||
* Main *
|
||||
* *
|
||||
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
||||
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
|
||||
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||
* *
|
||||
* This file is part of Gem-graph. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Affero General Public License *
|
||||
* as published by the Free Software Foundation, *
|
||||
* either version 3 of the License, *
|
||||
* or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; *
|
||||
* without even the implied warranty of MERCHANTABILITY *
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
void pref_set_store_restore_reset (int choice, int value);
|
||||
const char get_button_icon_name (int n);
|
||||
|
||||
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
|
||||
|
||||
void *fsm_add_displayable (char *displayable_name);
|
||||
|
||||
void prefer_init ();
|
||||
|
|
@ -64,7 +64,8 @@ bool fsm_init ()
|
|||
{
|
||||
fsm_measures_list_init ();
|
||||
fsm_results_list_init ();
|
||||
// prefer_displayable_list_init (); <> see prefer_init ()
|
||||
fsm_displayable_list_init ();
|
||||
fsm_preferences_init ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
// 2) dans signal.c on_updating_objects_transparencies()
|
||||
// où ils servent à identifier le bouton source (activé)
|
||||
// Cette identification va déterminer le choix du switch
|
||||
// de la fonction : pref_set_store_restore_reset ()
|
||||
// de la fonction : fsm_store_restore_reset()
|
||||
|
||||
// ! WARNING ! Cette méthode d'identification est dangereuse:
|
||||
// Si un utilisateur modifie l'apparence d'un bouton (parce que préférence...)
|
||||
|
@ -56,7 +56,7 @@ static const char *icon_name [3] = {
|
|||
"view-refresh-symbolic"
|
||||
};
|
||||
// transtypage vers un pointeur depuis un entier de taille différente vvv TODO
|
||||
const char *get_button_icon_name (int n) {return (const char*) icon_name [n];}
|
||||
const char *fsm_get_button_icon_name (int n) {return (const char*) icon_name [n];}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -71,7 +71,7 @@ struct preferences *pref_jean = NULL; // TODO (voir graphics_init(...))
|
|||
// en attendant:
|
||||
static int p[n_objects] = {};
|
||||
|
||||
void pref_set_store_restore_reset (int choice, int value)
|
||||
void fsm_store_restore_reset (int choice, int value)
|
||||
{
|
||||
switch (choice) {
|
||||
case (STORE) :
|
||||
|
@ -126,6 +126,6 @@ void *fsm_add_displayable (char *displayable_name)
|
|||
}
|
||||
|
||||
|
||||
void prefer_init () {prefer_displayable_list_init ();}
|
||||
void prefer_displayable_list_init ()
|
||||
{ printf("prefer <> prefer_displayable_list_init() < in the fsm ? < TODO\n");}
|
||||
void fsm_preferences_init () {fsm_displayable_list_init ();}
|
||||
void fsm_displayable_list_init ()
|
||||
{ printf("fsm prefer <> fsm_displayable_list_init() < in the fsm ? < TODO\n");}
|
||||
|
|
|
@ -154,7 +154,6 @@ int main (int argc, char **argv)
|
|||
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||
|
||||
fsm_init (); // fsm = finite state machine (see src/fsm/dispatch)
|
||||
prefer_init (); // preferences (see src/prefer/dispatch)
|
||||
|
||||
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||
// on_windows_activation <> is in src/widget/dispatch
|
||||
|
|
|
@ -337,9 +337,9 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
|
|||
const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source));
|
||||
int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar));
|
||||
|
||||
if ( ! strcmp (btt_name, "document-revert-rtl-symbolic")) pref_set_store_restore_reset (STORE, value);
|
||||
if ( ! strcmp (btt_name, "edit-undo-symbolic")) pref_set_store_restore_reset (RESTORE, value);
|
||||
if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value);
|
||||
if ( ! strcmp (btt_name, "document-revert-rtl-symbolic")) fsm_store_restore_reset (STORE, value);
|
||||
if ( ! strcmp (btt_name, "edit-undo-symbolic")) fsm_store_restore_reset (RESTORE, value);
|
||||
if ( ! strcmp (btt_name, "view-refresh-symbolic")) fsm_store_restore_reset (RESET, value);
|
||||
|
||||
fsm_set_preferences_state (TRUE); // << à détailler TODO
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue