WIP: cleaning (headers, licences, authors, formats,...)
This commit is contained in:
parent
4409ed5cd9
commit
0487a15b65
|
@ -1,16 +0,0 @@
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
enum choice_EXEC_EDIT { EXEC, EDIT };
|
|
||||||
enum choice_STATE_RULES_DATA { STATE, RULES, DATA };
|
|
||||||
// MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE }; ?
|
|
||||||
|
|
||||||
void set_EXEC_EDIT (int prescribed);
|
|
||||||
void set_STATE_RULES_DATA (int prescribed);
|
|
||||||
|
|
||||||
int get_EXEC_EDIT ();
|
|
||||||
int get_STATE_RULES_DATA ();
|
|
||||||
|
|
||||||
// char *get_str_EXEC_EDIT (int value);
|
|
||||||
// char *get_str_STATE_RULES_DATA (int value);
|
|
||||||
|
|
111
include/base.h
111
include/base.h
|
@ -1,26 +1,31 @@
|
||||||
/*
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* Gem-graph OpenGL experiments
|
* *
|
||||||
*
|
* Gem-graph client *
|
||||||
* Desc: Base header
|
* *
|
||||||
*
|
* Base header *
|
||||||
* Copyright (C) 2023 Arthur Menges <arthur.menges@a-lec.org>
|
* *
|
||||||
* Copyright (C) 2023 Adrien Bourmault <neox@a-lec.org>
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
*
|
* Copyright © 2023 Adrien Bourmault <neox@a-lec.org> *
|
||||||
* This file is part of Gem-graph.
|
* Copyright © 2023 Arthur Menges <arthur.menges@a-lec.org> *
|
||||||
*
|
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||||
* 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
|
* This file is part of Gem-graph. *
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* *
|
||||||
* (at your option) any later version.
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
*
|
* under the terms of the GNU Affero General Public License *
|
||||||
* This program is distributed in the hope that it will be useful,
|
* as publishedby the Free Software Foundation, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* either version 3 of the License, or (at your option) any later version. *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* *
|
||||||
* GNU Affero General Public License for more details.
|
* This program is distributed in the hope that it will be useful, *
|
||||||
*
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
#pragma once
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -35,24 +40,60 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <glib-2.0/glib.h>
|
#include <glib-2.0/glib.h>
|
||||||
//#define G_APPLICATION_DEFAULT_FLAGS 0
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
|
// #define G_APPLICATION_DEFAULT_FLAGS 0 < work TODO here ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* S T A T E M A C H I N E */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
enum choice_EXEC_EDIT { EXEC, EDIT }; // xor
|
||||||
|
enum choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
|
||||||
|
|
||||||
|
void set_EXEC_EDIT (int prescribed);
|
||||||
|
void set_STATE_RULES_DATA (int prescribed);
|
||||||
|
|
||||||
|
int get_EXEC_EDIT ();
|
||||||
|
int get_STATE_RULES_DATA ();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* S P A C E S T R U C T U R E S */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS }; // < used by graph_area.h
|
||||||
|
|
||||||
|
struct arrow_t { uint load; uint site; uint x; uint y; uint z; };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* U T I L I T I E S */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS }; // < used by : graph_area.h
|
|
||||||
enum { HOME_MODE, RUN_MODE, EDIT_MODE, PRESENTATION_MODE, N_MODE }; // Gem-graph modes
|
|
||||||
struct arrow_t { uint load; uint site; uint x; uint y; uint z; }; // describes an arrow
|
|
||||||
static inline char *read_file(char *filename); // < used by : init.c
|
static inline char *read_file(char *filename); // < used by : init.c
|
||||||
|
|
||||||
/* I'm standing on Earth (or any spinning spheroid) and looking towards its North pole, then :
|
/*
|
||||||
X - X = EAST - WEST = rouge - cyan
|
I'm standing on Earth (or any spinning spheroid),
|
||||||
Y - Y = ZENITH - NADIR = vert - magenta (fuschia)
|
looking towards its North pole.
|
||||||
Z - Z = NORTH - SOUTH = bleu - jaune */
|
|
||||||
|
|
||||||
#define EAST 0 // + x rouge
|
Then :
|
||||||
|
|
||||||
|
X - X = EAST - WEST = red - cyan
|
||||||
|
Y - Y = ZENITH - NADIR = green - magenta (fuschia)
|
||||||
|
Z - Z = NORTH - SOUTH = blue - yellow
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define EAST 0 // + x red
|
||||||
#define WEST 1 // - x cyan
|
#define WEST 1 // - x cyan
|
||||||
#define ZENITH 2 // + y vert
|
#define ZENITH 2 // + y green
|
||||||
#define NADIR 3 // - y magenta
|
#define NADIR 3 // - y magenta
|
||||||
#define SOUTH 4 // + z bleu
|
#define SOUTH 4 // + z blue
|
||||||
#define NORTH 5 // - z jaune
|
#define NORTH 5 // - z yellow
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,9 +1,38 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* *
|
||||||
|
* Callbacks header *
|
||||||
|
* *
|
||||||
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
|
* Copyright © 2023 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 publishedby 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/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
|
// void on_auto_notification (const char *message);
|
||||||
|
|
||||||
void on_main_window_activation (GtkApplication *app, gpointer user_data);
|
void on_main_window_activation (GtkApplication *app, gpointer user_data);
|
||||||
void on_dialog_window_activation (GtkApplication *app, gpointer user_data);
|
void on_dialog_window_activation (GtkApplication *app, gpointer user_data);
|
||||||
void on_auto_notification (const char *message);
|
|
||||||
|
|
||||||
void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data);
|
void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data);
|
||||||
void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data);
|
void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data);
|
||||||
|
|
|
@ -1,11 +1,30 @@
|
||||||
//******************************************************************************/
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
/* */
|
* *
|
||||||
/* E coli by David S. Goodsell (2009) */
|
* Gem-graph client *
|
||||||
/* --- */
|
* *
|
||||||
/* Let this freeze frame guide us towards the model */
|
* Widgets header *
|
||||||
/* that alone can account for the phenomenon ! */
|
* *
|
||||||
/* */
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
/******************************************************************************/
|
* Copyright © 2023 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 publishedby 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/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
|
@ -17,19 +36,6 @@
|
||||||
#define W_IMAGE_LOCAL W / 16
|
#define W_IMAGE_LOCAL W / 16
|
||||||
#define H_IMAGE_LOCAL H / 16
|
#define H_IMAGE_LOCAL H / 16
|
||||||
|
|
||||||
/*
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
#define MY_TYPE_WINDOW (my_window_get_type())
|
|
||||||
G_DECLARE_FINAL_TYPE (MyWindow, my_window, MY, WINDOW, GtkApplicationWindow)
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
#define MY_TYPE_APPLICATION (my_application_get_type())
|
|
||||||
G_DECLARE_FINAL_TYPE (MyApplication, my_application, MY, APPLICATION, GtkApplication)
|
|
||||||
MyApplication *my_application_new (const char *application_id, GApplicationFlags flags);
|
|
||||||
G_END_DECLS
|
|
||||||
*/
|
|
||||||
|
|
||||||
void main_window_design (GtkWindow *main_window);
|
void main_window_design (GtkWindow *main_window);
|
||||||
void set_check_button_active (GtkButton *button, int active);
|
void set_check_button_active (GtkButton *button, int active);
|
||||||
void two_notebooks_in_two_panes (GtkWindow *window);
|
void two_notebooks_in_two_panes (GtkWindow *window);
|
||||||
|
|
|
@ -1,7 +1,31 @@
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
// Main //
|
||||||
|
// //
|
||||||
|
// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
|
||||||
|
// Copyright © 2024 Jean Sirmai (jean@a-lec.org) //
|
||||||
|
// Copyright © 2024 Adrien Bourmault (neox@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 <https://www.gnu.org/licenses/>. //
|
||||||
|
//=-------------------------------------------------------------------------=//
|
||||||
|
|
||||||
|
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include "../include/base.h"
|
||||||
#include "../include/callback.h"
|
#include "../include/callback.h"
|
||||||
#include "../include/automaton.h"
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
167
src/callback.c
167
src/callback.c
|
@ -1,3 +1,28 @@
|
||||||
|
//----------------------------------------------------------------------------//
|
||||||
|
// //
|
||||||
|
// callback //
|
||||||
|
// //
|
||||||
|
// Copyright © 2021 Libre en Communs (contact@a-lec.org) //
|
||||||
|
// Copyright © 2024 Jean Sirmai (jean@a-lec.org) //
|
||||||
|
// Copyright © 2024 Adrien Bourmault (neox@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 <https://www.gnu.org/licenses/>. //
|
||||||
|
//---------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
|
@ -7,33 +32,42 @@
|
||||||
#include "../include/contain.h"
|
#include "../include/contain.h"
|
||||||
#include "../include/dialog.h"
|
#include "../include/dialog.h"
|
||||||
#include "../include/texts.h"
|
#include "../include/texts.h"
|
||||||
#include "../include/automaton.h"
|
#include "../include/base.h"
|
||||||
#include "../include/parsing.h"
|
#include "../include/parsing.h"
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graph_area.h"
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* W I N D O W S A C T I V A T I O N */
|
/* W I N D O W S A C T I V A T I O N S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
static GtkWindow *main_window, *dialog_window;
|
static GtkWindow *main_window, *dialog_window;
|
||||||
|
|
||||||
void on_main_window_activation (GtkApplication *app, gpointer no_user_data)
|
|
||||||
|
void on_main_window_activation (GtkApplication *app,
|
||||||
|
gpointer no_user_data)
|
||||||
{
|
{
|
||||||
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
main_window_design (main_window);
|
main_window_design (main_window);
|
||||||
g_signal_connect (app, "activate", G_CALLBACK (on_dialog_window_activation), main_window);
|
g_signal_connect (app,
|
||||||
|
"activate",
|
||||||
|
G_CALLBACK (on_dialog_window_activation),
|
||||||
|
main_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_dialog_window_activation (GtkApplication *app, gpointer no_user_data)
|
|
||||||
|
void on_dialog_window_activation (GtkApplication *app,
|
||||||
|
gpointer no_user_data)
|
||||||
{
|
{
|
||||||
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
dialog_window_design (main_window, dialog_window);
|
dialog_window_design (main_window,
|
||||||
|
dialog_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void on_auto_notification (const char *message)
|
static void on_auto_notification (const char *message)
|
||||||
{
|
{
|
||||||
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily
|
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily
|
||||||
|
|
||||||
if (window->toast_revealer == NULL) {
|
if (window->toast_revealer == NULL) {
|
||||||
g_printerr("Can't find app->toast_overlay !\n");
|
g_printerr("Can't find app->toast_overlay !\n");
|
||||||
|
@ -51,32 +85,53 @@ void on_auto_notification (const char *message)
|
||||||
g_printerr("%s\n", message);
|
g_printerr("%s\n", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* T R E E */
|
/* T R E E */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data)
|
|
||||||
|
void on_user_tree_expander_toggled (GtkExpander *expander,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
|
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
|
||||||
gboolean is_expanded = gtk_tree_list_row_get_expanded(row);
|
gboolean is_expanded = gtk_tree_list_row_get_expanded (row);
|
||||||
gtk_tree_list_row_set_expanded (row, !is_expanded);
|
gtk_tree_list_row_set_expanded (row,
|
||||||
|
!is_expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* object, gpointer user_data)
|
|
||||||
|
void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
|
||||||
|
GObject* object,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GtkListItem *list_item = GTK_LIST_ITEM (object); assert (list_item);
|
GtkListItem *list_item = GTK_LIST_ITEM (object);
|
||||||
GtkTreeListRow *row = gtk_list_item_get_item (list_item); assert (row); // if (row != NULL) {...} ?
|
assert (list_item);
|
||||||
const gchar *text = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_tree_list_row_get_item (row)));
|
|
||||||
|
GtkTreeListRow *row = gtk_list_item_get_item (list_item);
|
||||||
|
assert (row); // if (row != NULL) {...} do something ?
|
||||||
|
|
||||||
|
const gchar *text = gtk_string_object_get_string (
|
||||||
|
GTK_STRING_OBJECT (gtk_tree_list_row_get_item (row)));
|
||||||
GtkWidget *expander = gtk_list_item_get_child (list_item);
|
GtkWidget *expander = gtk_list_item_get_child (list_item);
|
||||||
gtk_expander_set_label (GTK_EXPANDER (expander), text);
|
gtk_expander_set_label (GTK_EXPANDER (expander), text);
|
||||||
g_signal_handlers_disconnect_by_func(expander, G_CALLBACK (on_user_tree_expander_toggled), row);
|
g_signal_handlers_disconnect_by_func (expander,
|
||||||
g_signal_connect(expander, "activate", G_CALLBACK (on_user_tree_expander_toggled), row);
|
G_CALLBACK (on_user_tree_expander_toggled),
|
||||||
gtk_widget_set_margin_start(expander, gtk_tree_list_row_get_depth(row) * 20);
|
row);
|
||||||
|
g_signal_connect (expander,
|
||||||
|
"activate",
|
||||||
|
G_CALLBACK (on_user_tree_expander_toggled),
|
||||||
|
row);
|
||||||
|
gtk_widget_set_margin_start (expander,
|
||||||
|
gtk_tree_list_row_get_depth(row) * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* G L A R E A */
|
/* G L A R E A */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
gboolean on_glarea_render(GtkGLArea *area, GdkGLContext *context)
|
|
||||||
|
gboolean on_glarea_render(GtkGLArea *area,
|
||||||
|
GdkGLContext *context)
|
||||||
{
|
{
|
||||||
// Check if the widget is a glarea
|
// Check if the widget is a glarea
|
||||||
if(gtk_gl_area_get_error(area) != NULL) {
|
if(gtk_gl_area_get_error(area) != NULL) {
|
||||||
|
@ -168,23 +223,42 @@ void on_axis_value_change(GtkAdjustment *adjustment, gpointer data)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
static void switch_STATE_RULES_DATA() {
|
static void switch_STATE_RULES_DATA() {
|
||||||
|
|
||||||
switch (get_STATE_RULES_DATA()) {
|
switch (get_STATE_RULES_DATA()) {
|
||||||
case (STATE) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE())); break;
|
|
||||||
case (RULES) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_RULES())); break;
|
case (STATE) :
|
||||||
case (DATA) : gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA())); break;
|
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_STATE()));
|
||||||
default : printf("default in callback.on_toggle_STATE_RULES_DATA()\n");
|
break;
|
||||||
|
|
||||||
|
case (RULES) :
|
||||||
|
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_RULES()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (DATA) :
|
||||||
|
gtk_window_set_child (main_window, GTK_WIDGET (get_window_child_DATA()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
printf("default in callback.on_toggle_STATE_RULES_DATA()\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data) {
|
void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data) {
|
||||||
|
|
||||||
if (get_EXEC_EDIT ()) {
|
if (get_EXEC_EDIT ()) {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "power-profile-balanced-rtl-symbolic");
|
|
||||||
|
gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
|
||||||
|
"power-profile-balanced-rtl-symbolic");
|
||||||
set_EXEC_EDIT (EXEC);
|
set_EXEC_EDIT (EXEC);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gtk_button_set_icon_name (GTK_BUTTON (toggled_button), "text-editor-symbolic");
|
|
||||||
// https://docs.gtk.org/gtk4/class.Window.html TODO
|
gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
|
||||||
gtk_window_present (GTK_WINDOW (dialog_window));
|
"text-editor-symbolic");
|
||||||
|
|
||||||
|
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
|
||||||
|
gtk_window_present (GTK_WINDOW (dialog_window)); // works once only !
|
||||||
|
|
||||||
set_EXEC_EDIT (EDIT);
|
set_EXEC_EDIT (EDIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,28 +267,43 @@ void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data) {
|
||||||
|
|
||||||
void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data) {
|
void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data) {
|
||||||
|
|
||||||
const char *toggled_button_name = gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
|
const char *toggled_button_name
|
||||||
|
= gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
|
||||||
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
|
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
|
||||||
|
|
||||||
if (! strcmp (toggled_button_name, "state")) set_STATE_RULES_DATA (STATE);
|
if (! strcmp (toggled_button_name, "state")) {
|
||||||
if (! strcmp (toggled_button_name, "rules")) set_STATE_RULES_DATA (RULES);
|
set_STATE_RULES_DATA (STATE);
|
||||||
if (! strcmp (toggled_button_name, "data analysis")) set_STATE_RULES_DATA (DATA);
|
}
|
||||||
|
|
||||||
if (is_active) switch_STATE_RULES_DATA();
|
if (! strcmp (toggled_button_name, "rules")) {
|
||||||
|
set_STATE_RULES_DATA (RULES);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! strcmp (toggled_button_name, "data analysis")) {
|
||||||
|
set_STATE_RULES_DATA (DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_active) {
|
||||||
|
switch_STATE_RULES_DATA();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
void on_SAVE_CURRENT_MODEL_BEFORE_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
|
gpointer data) {
|
||||||
printf ("callback.c (line 201) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
|
gtk_widget_set_sensitive (GTK_WIDGET (data),
|
||||||
|
TRUE);
|
||||||
|
printf ("callback.c (line 294) - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL, gpointer data) {
|
void on_DISCARD_CURRENT_MODEL_AND_START_EDITING (GtkWidget *btt_SAVE_CURRENT_MODEL,
|
||||||
|
gpointer data) {
|
||||||
gtk_window_close (GTK_WINDOW (data));
|
gtk_window_close (GTK_WINDOW (data));
|
||||||
printf ("callback.c (line 206) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n");
|
printf ("callback.c (line 300) - DISCARD_CURRENT_MODEL_AND_START_EDITING\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL, gpointer data) {
|
void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL,
|
||||||
|
gpointer data) {
|
||||||
gtk_window_close (GTK_WINDOW (data));
|
gtk_window_close (GTK_WINDOW (data));
|
||||||
printf ("callback.c (line 211) - WRITE_CURRENT_MODEL\n");
|
printf ("callback.c (line 306) - WRITE_CURRENT_MODEL\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "../include/graph_area.h"
|
#include "../include/graph_area.h"
|
||||||
#include "../include/callback.h"
|
#include "../include/callback.h"
|
||||||
#include "../include/automaton.h"
|
#include "../include/base.h"
|
||||||
#include "../include/display.h"
|
#include "../include/display.h"
|
||||||
#include "../include/tree.h"
|
#include "../include/tree.h"
|
||||||
#include "../include/texts.h"
|
#include "../include/texts.h"
|
||||||
|
|
41
src/main.c
41
src/main.c
|
@ -1,11 +1,31 @@
|
||||||
/******************************************************************************/
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
/* */
|
* *
|
||||||
/* E coli by David S. Goodsell (2009) */
|
* Gem-graph client *
|
||||||
/* --- */
|
* *
|
||||||
/* Let this freeze frame guide us towards the model */
|
* Main *
|
||||||
/* that alone can account for the phenomenon ! */
|
* *
|
||||||
/* */
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||||
/******************************************************************************/
|
* Copyright © 2023 Adrien Bourmault <neox@a-lec.org> *
|
||||||
|
* Copyright © 2023 Arthur Menges <arthur.menges@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 publishedby 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/>. *
|
||||||
|
* *
|
||||||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
||||||
#include "../include/callback.h"
|
#include "../include/callback.h"
|
||||||
|
|
||||||
|
@ -14,13 +34,14 @@ int main (int argc, char **argv)
|
||||||
GtkApplication *app;
|
GtkApplication *app;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
app = gtk_application_new ("org.jean.GTK4_GG_hack", G_APPLICATION_DEFAULT_FLAGS);
|
app = gtk_application_new ("org.jean.GG_hack", G_APPLICATION_DEFAULT_FLAGS);
|
||||||
g_signal_connect (app, "activate", G_CALLBACK (on_main_window_activation), NULL);
|
g_signal_connect (app, "activate", G_CALLBACK (on_main_window_activation), NULL);
|
||||||
g_signal_connect (app, "activate", G_CALLBACK (on_dialog_window_activation), NULL);
|
g_signal_connect (app, "activate", G_CALLBACK (on_dialog_window_activation), NULL);
|
||||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||||
g_object_unref (app);
|
g_object_unref (app);
|
||||||
|
|
||||||
printf("in contain.get_SPACE_VIEW_box() (line 138) > ui_setup_glarea (0, GTK_WIDGET (middle_box)); < commented 2024/06/27 > TODO\n");
|
printf("\nTODO (2024-06-30) OpenGL see : contain.get_SPACE_VIEW_box()\
|
||||||
|
\nline 138 > ui_setup_glarea (0, GTK_WIDGET (middle_box));\n\n");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue