WIP: cleaning run_xor_stop_exec must depend on exec_edit_mode < TODO
This commit is contained in:
parent
c8c3c03641
commit
7820dde7c2
2
(notes)
2
(notes)
|
@ -109,6 +109,8 @@ GtkScrolledWindow *get_scrolled_gl_area(){
|
|||
|
||||
|
||||
|
||||
// https://docs.gtk.org/gtk4/getting_started.html (m'aura bien servi, quand même !)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
32
callback.c
32
callback.c
|
@ -24,7 +24,6 @@ void ui_main_window (GtkApplication *self, gpointer user_data)
|
|||
/******************************************************************************/
|
||||
void on_user_tree_expander_toggled (GtkExpander *expander, gpointer user_data)
|
||||
{
|
||||
// This is a conceptual callback for when an expander is toggled
|
||||
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
|
||||
gboolean is_expanded = gtk_tree_list_row_get_expanded(row);
|
||||
gtk_tree_list_row_set_expanded (row, !is_expanded);
|
||||
|
@ -33,32 +32,37 @@ void on_user_tree_expander_toggled(GtkExpander *expander, 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);
|
||||
GtkTreeListRow *row = gtk_list_item_get_item (list_item); assert (row);
|
||||
// if (row != NULL) {
|
||||
GtkTreeListRow *row = gtk_list_item_get_item (list_item); assert (row); // if (row != NULL) {...} ?
|
||||
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);
|
||||
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_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);
|
||||
gboolean is_expanded = gtk_tree_list_row_get_expanded(row);
|
||||
if (0) printf("[on_bind_user_tree_factory] row content is [%s] and expander is [%d]\n", text, is_expanded);
|
||||
// } else if (0) printf("[on_bind_user_tree_factory] row == NULL\n");
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* B U T T O N S */
|
||||
/******************************************************************************/
|
||||
void ui_toggle_run_edit (GtkWidget *btt_run_xor_edit, gpointer data)
|
||||
void ui_toggle_exec_edit (GtkWidget *btt_exec_xor_edit, gpointer data)
|
||||
{
|
||||
printf("window.ui_toggle_run_edit() >>> mode = %d", get_run_edit_mode ());
|
||||
if (get_run_edit_mode()) {
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "system-run-symbolic");
|
||||
set_run_edit_mode (0);
|
||||
if (get_exec_edit_mode()) {
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "system-run-symbolic");
|
||||
set_exec_edit_mode (0);
|
||||
} else {
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "document-edit-symbolic");
|
||||
set_run_edit_mode (1);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_exec_xor_edit), "document-edit-symbolic");
|
||||
set_exec_edit_mode (1);
|
||||
}
|
||||
}
|
||||
|
||||
void ui_toggle_model_exec (GtkWidget *btt_run_stop_model_exec, gpointer data)
|
||||
{
|
||||
if (get_run_xor_stop_exec()) {
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-start-symbolic");
|
||||
set_run_xor_stop_exec (0);
|
||||
} else {
|
||||
gtk_button_set_icon_name (GTK_BUTTON (btt_run_stop_model_exec), "media-playback-pause-symbolic");
|
||||
set_run_xor_stop_exec (1);
|
||||
}
|
||||
printf(" > %d\n", get_run_edit_mode ());
|
||||
}
|
||||
|
||||
|
|
11
callback.h
11
callback.h
|
@ -1,4 +1,3 @@
|
|||
//#include <stdio.h>
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
void ui_main_window (GtkApplication *app, gpointer user_data);
|
||||
|
@ -6,19 +5,13 @@ void ui_main_window (GtkApplication *app, gpointer user_data);
|
|||
void ui_enable_action (const char *name);
|
||||
void ui_disable_action (const char *name);
|
||||
|
||||
void set_run_edit_mode(int prescribed_mode);
|
||||
int get_run_edit_mode();
|
||||
|
||||
// je vais déjà voir si j'arrive à manoeuvrer ces deux là... (2024-05-30)
|
||||
// GtkWidget *btt_run_xor_edit = gtk_toggle_button_new ();
|
||||
// GtkWidget *btt_run_stop_exec = gtk_toggle_button_new ();
|
||||
|
||||
// https://docs.gtk.org/gio/method.ActionMap.add_action_entries.html
|
||||
// A function for creating multiple GSimpleAction instances and adding them to a GActionMap.
|
||||
// @see application . gem_graph_client_application_init (GemGraphClientApplication *self) {
|
||||
// g_action_map_add_action_entries (G_ACTION_MAP(self), app_actions, G_N_ELEMENTS(app_actions), self); ...
|
||||
|
||||
void ui_toggle_run_edit();
|
||||
void ui_toggle_exec_edit ();
|
||||
void ui_toggle_model_exec ();
|
||||
|
||||
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
|
||||
|
|
41
contain.c
41
contain.c
|
@ -196,7 +196,6 @@ GtkWidget *get_run_space_page_new(){
|
|||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_OBJECTS_and_SITUATIONS()));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
|
||||
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
|
||||
gtk_box_append (page_box, GTK_WIDGET (get_TIME_EXEC_controls_box()));
|
||||
|
@ -281,17 +280,22 @@ void window_header_bar (GtkWindow *window, char *title){
|
|||
// GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START
|
||||
// gtk_window_controls_set_decoration_layout (GTK_WINDOW_CONTROLS(my_window_controls), NULL); // const char* layout);
|
||||
|
||||
gtk_button_set_icon_name (get_btt_run_xor_edit(), "document-edit-symbolic");
|
||||
gtk_button_set_icon_name (get_btt_run_xor_edit(), "text-editor-symbolic");
|
||||
gtk_button_set_icon_name (get_btt_run_xor_edit(), "system-run-symbolic");
|
||||
GtkButton *exec_xor_edit = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
// gtk_button_set_icon_name (exec_xor_edit, "system-run-symbolic");
|
||||
// g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_toggle_run_edit), NULL);
|
||||
gtk_button_set_icon_name (exec_xor_edit, "document-edit-symbolic");
|
||||
gtk_button_set_icon_name (exec_xor_edit, "text-editor-symbolic");
|
||||
gtk_button_set_icon_name (exec_xor_edit, "system-run-symbolic");
|
||||
g_signal_connect (exec_xor_edit, "clicked", G_CALLBACK (ui_toggle_exec_edit), NULL);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (exec_xor_edit));
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (get_btt_run_xor_edit()));
|
||||
gtk_window_set_titlebar (window, header_bar);
|
||||
|
||||
GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_button_new ());
|
||||
GtkButton *run_stop_model_exec = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (run_stop_model_exec, "system-shutdown-symbolic");
|
||||
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-start-symbolic");
|
||||
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-pause-symbolic");
|
||||
gtk_button_set_icon_name (run_stop_model_exec, "media-playback-start-symbolic");
|
||||
g_signal_connect (run_stop_model_exec, "clicked", G_CALLBACK (ui_toggle_model_exec), NULL);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (run_stop_model_exec));
|
||||
|
||||
icons_for_fun (GTK_HEADER_BAR (header_bar)); // https://iconduck.com/sets/adwaita-icon-theme
|
||||
|
@ -318,26 +322,15 @@ void two_notebooks_in_two_panes (GtkWindow *window) {
|
|||
gtk_notebook_append_page (edit_notebook, get_edit_discuss_page_new(), gtk_label_new ("interpret"));
|
||||
gtk_notebook_append_page (edit_notebook, get_edit_help_page_new(), gtk_label_new ("help"));
|
||||
|
||||
GtkWidget *run_xor_edit_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_widget_set_size_request (run_xor_edit_horizontal_pane, 0, 0);
|
||||
gtk_paned_set_start_child (GTK_PANED(run_xor_edit_horizontal_pane), GTK_WIDGET (run_notebook));
|
||||
gtk_paned_set_end_child (GTK_PANED(run_xor_edit_horizontal_pane), GTK_WIDGET (edit_notebook));
|
||||
gtk_paned_set_position (GTK_PANED (run_xor_edit_horizontal_pane), W_IMAGE + 350); // '350' : AD HOC
|
||||
gtk_window_set_child (window, GTK_WIDGET(run_xor_edit_horizontal_pane));
|
||||
GtkWidget *exec_xor_edit_horizontal_pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_widget_set_size_request (exec_xor_edit_horizontal_pane, 0, 0);
|
||||
gtk_paned_set_start_child (GTK_PANED(exec_xor_edit_horizontal_pane), GTK_WIDGET (run_notebook));
|
||||
gtk_paned_set_end_child (GTK_PANED(exec_xor_edit_horizontal_pane), GTK_WIDGET (edit_notebook));
|
||||
gtk_paned_set_position (GTK_PANED (exec_xor_edit_horizontal_pane), W_IMAGE + 350); // '350' : AD HOC
|
||||
gtk_window_set_child (window, GTK_WIDGET(exec_xor_edit_horizontal_pane));
|
||||
|
||||
gtk_notebook_set_current_page (run_notebook, 0); // @see hot.c 2024-05-11 (line 68)
|
||||
gtk_notebook_set_current_page (edit_notebook, 1); // @see hot.c 2024-05-11 (line 68)
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkButton *get_btt_run_xor_edit() {
|
||||
GtkButton *run_xor_edit = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (run_xor_edit, "system-run-symbolic");
|
||||
g_signal_connect (run_xor_edit, "clicked", G_CALLBACK (ui_toggle_run_edit), NULL);
|
||||
return run_xor_edit;
|
||||
}
|
||||
|
||||
// https://docs.gtk.org/gtk4/getting_started.html (m'aura bien servi, quand même !)
|
||||
|
||||
|
||||
|
|
27
in_depth.c
27
in_depth.c
|
@ -1,8 +1,29 @@
|
|||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include <assert.h>
|
||||
#include "callback.h"
|
||||
|
||||
static int run_edit_mode_val = 0;
|
||||
enum { EXEC_MODE, EDIT_MODE, N_MODE };
|
||||
static int run_edit_mode_val = EXEC_MODE;
|
||||
|
||||
void set_run_edit_mode (int prescribed_mode) {run_edit_mode_val = prescribed_mode;}
|
||||
int get_run_edit_mode () {return run_edit_mode_val;}
|
||||
enum { STOP, RUN };
|
||||
static int run_stop_val = STOP;
|
||||
|
||||
|
||||
// --- EXEC / EDIT ---------------------------------------------------------
|
||||
|
||||
int get_exec_edit_mode () {return run_edit_mode_val;}
|
||||
void set_exec_edit_mode (int prescribed_mode)
|
||||
{
|
||||
run_edit_mode_val = prescribed_mode;
|
||||
if (! run_stop_val) {
|
||||
run_stop_val = STOP;
|
||||
// Là, il faut envoyer un signal > signal connect
|
||||
// set_run_xor_stop_exec (STOP);
|
||||
}
|
||||
}
|
||||
|
||||
// --- RUN / STOP ----------------------------------------------------------
|
||||
|
||||
int get_run_xor_stop_exec () {return run_stop_val;}
|
||||
void set_run_xor_stop_exec (int prescribed_state) {run_stop_val = prescribed_state;}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include <assert.h>
|
||||
|
||||
void set_run_edit_mode (int prescribed_mode);
|
||||
int get_run_edit_mode ();
|
||||
void set_exec_edit_mode (int prescribed_mode);
|
||||
int get_exec_edit_mode ();
|
||||
|
||||
void set_run_xor_stop_exec (int prescribed_state);
|
||||
int get_run_xor_stop_exec ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue