atomes 1.1.15
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
gui.c File Reference

GUI of the main window
Menu elements of the workspace menu
Creation of menu items, actions, used in the entire atomes software. More...

#include "global.h"
#include "callbacks.h"
#include "interface.h"
#include "project.h"
#include "workspace.h"
+ Include dependency graph for gui.c:

Go to the source code of this file.

Functions

GtkWidget * curvetbox ()
 create the curve tool box window
 
GtkWidget * work_menu (int p, int c)
 create the workspace popup menu
 
G_MODULE_EXPORT void compute_this_prop (GtkWidget *widg, gpointer data)
 to compute the 'calc_to_compute'
 
G_MODULE_EXPORT void on_create_new_project (GtkWidget *widg, gpointer data)
 create a new project
 
int get_atom_id_from_periodic_table (atom_search *asearch)
 get atom Z from selection in the periodic table
 
G_MODULE_EXPORT void leaving_from_menu (GtkWidget *widg, gpointer data)
 leaving atomes ?
 
G_MODULE_EXPORT void on_edit_activate (GtkWidget *widg, gpointer data)
 create an edition dialog - prepare the dialog
 
G_MODULE_EXPORT void on_calc_activate (GtkWidget *widg, gpointer data)
 create a calculation dialog - prepare the dialog
 
GtkWidget * shortcuts_window (int sections, int group_by_section[sections], int groups, int shortcut_by_group[groups], gchar *section_names[sections], gchar *group_names[groups], shortcuts shortcs[])
 Create the shortcuts information window.
 
void clean_view ()
 clean the main window
 
void view_buffer (GtkTextBuffer *buffer)
 set a text buffer in the main window or an image
 
void atomes_key_pressed (guint keyval, GdkModifierType state)
 main window key actions callbacks
 
void add_action (GSimpleAction *action)
 add action to the main window action map
 
void remove_action (gchar *action_name)
 add action from the main window action map
 
void remove_edition_actions ()
 remove all edition actions
 
void remove_edition_and_analyze_actions ()
 remove all edition and analysis action
 
G_MODULE_EXPORT void show_periodic_table (GtkWidget *widg, gpointer data)
 show the periodic table of the elements
 
G_MODULE_EXPORT void atomes_menu_bar_action (GSimpleAction *action, GVariant *parameter, gpointer data)
 atomes menu bar actions
 
GIcon * get_gicon_from_data (int format, const gchar *icon)
 create a new icon using data
 
void widget_add_action (GSimpleActionGroup *action_group, const gchar *act, GCallback handler, gpointer data, gboolean check, gboolean status, gboolean radio, const gchar *stat)
 add an action to an action group
 
GMenuItem * create_gmenu_item (const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
 create menu item
 
void append_submenu (GMenu *menu, const gchar *label, GMenu *submenu)
 append a GMenuItem with a subenu to a GMenu, and use markup for the GMenuItem
 
void append_menu_item (GMenu *menu, const gchar *label, const gchar *action, const gchar *accel, const gchar *custom, int format, const gchar *icon, gboolean check, gboolean status, gboolean radio, const gchar *rstatus)
 create a menu item, then append it to a menu
 
GMenu * workspace_section (gchar *act, int pop)
 create the workspace section
 
GMenu * port_section (gchar *act, int pop, int port)
 create the import/export menu items
 
GMenu * project_section (gchar *act, int pop_up, int proj, int calc)
 create the project section
 
GMenu * import_section (gchar *act)
 create the 'Import' submenu
 
GMenu * quit_section (gchar *act)
 create the 'Quit' menu item
 
GMenu * workspace_title ()
 create the 'Workspace' menu item
 
GMenu * project_title (int pop_up, int proj)
 create project title menu item
 
GMenu * create_workspace_menu (gchar *act, int pop_up, int proj, int calc)
 create atomes 'workspace' menu
 
GMenu * create_edit_menu ()
 create atomes 'edit' menu
 
GMenu * tool_box_section ()
 create toolboxes menu item
 
GMenu * create_analyze_menu ()
 create atomes 'analyze' menu
 
GMenu * create_help_menu ()
 create atomes 'help' menu
 
GMenu * atomes_menu_bar ()
 create atomes menu bar
 
GtkWidget * create_main_window (GApplication *atomes)
 create the main application window
 

Variables

int objects [3]
 
int * object_was_selected [3]
 
int ** tmp_object_id [3]
 
gchar * dots [NDOTS]
 
gchar * calc_img [NCALCS-2]
 
gchar * graph_img [NGRAPHS]
 
atomes_action edition_acts []
 
atomes_action analyze_acts []
 
char * calc_name [NCALCS-2]
 
char * graph_name [NGRAPHS]
 
tint cut_sel
 
tint cut_lab
 
dint davect [9]
 
ColRGBA std [6]
 
shortcuts main_shortcuts []
 
gchar * main_section_names [] = { "Main" }
 
int main_group_by_section [] = { 3 }
 
gchar * main_group_names [] = { "General", "Workspace", "Projects" }
 
int main_shortcut_by_group [] = { 3, 3, 2 }
 

Detailed Description

GUI of the main window
Menu elements of the workspace menu
Creation of menu items, actions, used in the entire atomes software.

Author
Sébastien Le Roux sebas.nosp@m.tien.nosp@m..lero.nosp@m.ux@i.nosp@m.pcms..nosp@m.unis.nosp@m.tra.f.nosp@m.r

Definition in file gui.c.

Function Documentation

◆ add_action()

void add_action ( GSimpleAction * action)

add action to the main window action map

Parameters
actionthe GAction sending the signal the action to add

Definition at line 400 of file gui.c.

◆ append_menu_item()

void append_menu_item ( GMenu * menu,
const gchar * label,
const gchar * action,
const gchar * accel,
const gchar * custom,
int format,
const gchar * icon,
gboolean check,
gboolean status,
gboolean radio,
const gchar * rstatus )

create a menu item, then append it to a menu

Parameters
menuthe menu to insert the item in
labelLabel of the menu item
actionAction of the menu item
accelKeyboard accelerator, if any
customCustom menu item ? NULL otherwise
formatImage format if not IMG_NONE
iconImage data if not NULL
checkCheck menu item ?
statusIf check then status
radioRadio menu item ?
rstatusIf radio then variant parameter

Definition at line 758 of file gui.c.

◆ append_submenu()

void append_submenu ( GMenu * menu,
const gchar * label,
GMenu * submenu )

append a GMenuItem with a subenu to a GMenu, and use markup for the GMenuItem

Parameters
menuthe GMenu to insert the item with a submenu
labelthe text for the menu item
submenuthe submenu to add to the menu item

Definition at line 728 of file gui.c.

◆ atomes_key_pressed()

void atomes_key_pressed ( guint keyval,
GdkModifierType state )

main window key actions callbacks

Parameters
keyvalkey id
statemodifier (Ctrl, Alt ...)

Definition at line 352 of file gui.c.

◆ atomes_menu_bar()

GMenu * atomes_menu_bar ( )

create atomes menu bar

Definition at line 1030 of file gui.c.

◆ atomes_menu_bar_action()

G_MODULE_EXPORT void atomes_menu_bar_action ( GSimpleAction * action,
GVariant * parameter,
gpointer data )

atomes menu bar actions

Parameters
actionthe GAction sending the signal the GSimpleAction sending the signal
parameterGVariant parameter of the GAction, if any
datathe associated data pointer

Definition at line 462 of file gui.c.

◆ clean_view()

void clean_view ( )

clean the main window

Definition at line 286 of file gui.c.

◆ compute_this_prop()

G_MODULE_EXPORT void compute_this_prop ( GtkWidget * widg,
gpointer data )
extern

to compute the 'calc_to_compute'

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 105 of file work_menu.c.

◆ create_analyze_menu()

GMenu * create_analyze_menu ( )

create atomes 'analyze' menu

Definition at line 995 of file gui.c.

◆ create_edit_menu()

GMenu * create_edit_menu ( )

create atomes 'edit' menu

Definition at line 969 of file gui.c.

◆ create_gmenu_item()

GMenuItem * create_gmenu_item ( const gchar * label,
const gchar * action,
const gchar * accel,
const gchar * custom,
int format,
const gchar * icon,
gboolean check,
gboolean status,
gboolean radio,
const gchar * rstatus )

create menu item

Parameters
labelLabel of the menu item
actionAction of the menu item
accelKeyboard accelerator, if any
customCustom menu item ? NULL otherwise
formatImage format if not IMG_NONE
iconImage data if not NULL
checkCheck menu item ?
statusIf check then status
radioRadio menu item ?
rstatusIf radio then variant parameter

Definition at line 682 of file gui.c.

◆ create_help_menu()

GMenu * create_help_menu ( )

create atomes 'help' menu

Definition at line 1016 of file gui.c.

◆ create_main_window()

GtkWidget * create_main_window ( GApplication * atomes)

create the main application window

Parameters
atomesthe initial GtkApplication

Definition at line 1087 of file gui.c.

◆ create_workspace_menu()

GMenu * create_workspace_menu ( gchar * act,
int pop_up,
int proj,
int calc )

create atomes 'workspace' menu

Parameters
act"app" or "pop" key for the GAction
pop_upfrom main app (0) or contextual (1)
projproject id, if any (or -1)
calccalculation id, if any (or -1)

Definition at line 952 of file gui.c.

◆ curvetbox()

GtkWidget * curvetbox ( )
extern

create the curve tool box window

Definition at line 321 of file tools.c.

◆ get_atom_id_from_periodic_table()

int get_atom_id_from_periodic_table ( atom_search * asearch)
extern

get atom Z from selection in the periodic table

Parameters
asearchtarget atom search, if any

Definition at line 672 of file w_periodic.c.

◆ get_gicon_from_data()

GIcon * get_gicon_from_data ( int format,
const gchar * icon )

create a new icon using data

Parameters
formatfor the data
iconimage name or file name

Definition at line 610 of file gui.c.

◆ import_section()

GMenu * import_section ( gchar * act)

create the 'Import' submenu

Parameters
act"app" or "pop" key for the GAction

Definition at line 883 of file gui.c.

◆ leaving_from_menu()

G_MODULE_EXPORT void leaving_from_menu ( GtkWidget * widg,
gpointer data )
extern

leaving atomes ?

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 86 of file work_menu.c.

◆ on_calc_activate()

G_MODULE_EXPORT void on_calc_activate ( GtkWidget * widg,
gpointer data )
extern

create a calculation dialog - prepare the dialog

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 1387 of file calc_menu.c.

◆ on_create_new_project()

G_MODULE_EXPORT void on_create_new_project ( GtkWidget * widg,
gpointer data )
extern

create a new project

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 62 of file work_menu.c.

◆ on_edit_activate()

G_MODULE_EXPORT void on_edit_activate ( GtkWidget * widg,
gpointer data )
extern

create an edition dialog - prepare the dialog

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 835 of file edit_menu.c.

◆ port_section()

GMenu * port_section ( gchar * act,
int pop,
int port )

create the import/export menu items

Parameters
act"app" or "pop" key for the GAction
popfrom main app (0) or contextual (1)
portImport (1) or Export (0)

Definition at line 806 of file gui.c.

◆ project_section()

GMenu * project_section ( gchar * act,
int pop_up,
int proj,
int calc )

create the project section

Parameters
act"app" or "pop" key for the GAction
pop_upfrom main app (0) or contextual (1)
projproject id, if any (or -1)
calccalculation id, if any (or -1)

Definition at line 830 of file gui.c.

◆ project_title()

GMenu * project_title ( int pop_up,
int proj )

create project title menu item

Parameters
pop_upfrom main app (0) or contextual (1)
projproject id, if any (or -1)

Definition at line 926 of file gui.c.

◆ quit_section()

GMenu * quit_section ( gchar * act)

create the 'Quit' menu item

Parameters
act"app" or "pop" key for the GAction

Definition at line 897 of file gui.c.

◆ remove_action()

void remove_action ( gchar * action_name)

add action from the main window action map

Parameters
action_namethe action to remove

Definition at line 412 of file gui.c.

◆ remove_edition_actions()

void remove_edition_actions ( )

remove all edition actions

Definition at line 422 of file gui.c.

◆ remove_edition_and_analyze_actions()

void remove_edition_and_analyze_actions ( )

remove all edition and analysis action

Definition at line 433 of file gui.c.

◆ shortcuts_window()

GtkWidget * shortcuts_window ( int sections,
int group_by_section[sections],
int groups,
int shortcut_by_group[groups],
gchar * section_names[sections],
gchar * group_names[groups],
shortcuts shortcs[] )

Create the shortcuts information window.

Parameters
sectionsnumber of shortcut sections
group_by_sectionnumber of group by section
groupsnumber of groups
shortcut_by_groupnumber of shortcuts by group
shortcsshortcuts information

Definition at line 181 of file gui.c.

◆ show_periodic_table()

G_MODULE_EXPORT void show_periodic_table ( GtkWidget * widg,
gpointer data )

show the periodic table of the elements

Parameters
widgthe GtkWidget sending the signal
datathe associated data pointer

Definition at line 448 of file gui.c.

◆ tool_box_section()

GMenu * tool_box_section ( )

create toolboxes menu item

Definition at line 983 of file gui.c.

◆ view_buffer()

void view_buffer ( GtkTextBuffer * buffer)

set a text buffer in the main window or an image

Parameters
bufferthe GtkTextBuffer to display

Definition at line 309 of file gui.c.

◆ widget_add_action()

void widget_add_action ( GSimpleActionGroup * action_group,
const gchar * act,
GCallback handler,
gpointer data,
gboolean check,
gboolean status,
gboolean radio,
const gchar * stat )

add an action to an action group

Parameters
action_groupthe action group to add an action to
actthe name of the action to add
handlerthe associated callback
datathe associated data pointer
checkis the action a check (1/0)
statusif check or radio, status of the action (1/0)
radiois the action a radio (1/0)
statif radio variant parameter of the action

Definition at line 641 of file gui.c.

◆ work_menu()

GtkWidget * work_menu ( int p,
int c )
extern

create the workspace popup menu

Parameters
pproject id, or -1
ccalculation id, or -1

Definition at line 202 of file work_menu.c.

◆ workspace_section()

GMenu * workspace_section ( gchar * act,
int pop )

create the workspace section

Parameters
actapp" or "pop" key for the GAction
popfrom main app (0) or contextual (1)

Definition at line 775 of file gui.c.

◆ workspace_title()

GMenu * workspace_title ( )

create the 'Workspace' menu item

Definition at line 911 of file gui.c.

Variable Documentation

◆ analyze_acts

atomes_action analyze_acts[]
Initial value:
= {{"analyze.gr", GINT_TO_POINTER(0)},
{"analyze.sq", GINT_TO_POINTER(1)},
{"analyze.sk", GINT_TO_POINTER(2)},
{"analyze.gk", GINT_TO_POINTER(3)},
{"analyze.bonds", GINT_TO_POINTER(4)},
{"analyze.rings", GINT_TO_POINTER(5)},
{"analyze.chains", GINT_TO_POINTER(6)},
{"analyze.sp", GINT_TO_POINTER(7)},
{"analyze.msd", GINT_TO_POINTER(8)}}

Definition at line 112 of file gui.c.

◆ calc_img

gchar* calc_img[NCALCS-2]

Definition at line 105 of file gui.c.

◆ calc_name

char* calc_name[NCALCS-2]
Initial value:
= {"g(r)/G(r)",
"S(q) from FFT[g(r)]",
"S(q) from Debye equation",
"g(r)/G(r) from FFT[S(q)]",
"Bonds and angles",
"Ring statistics",
"Chain statistics",
"Spherical harmonics",
"Mean Squared Displacement",
"Bond valence"}

Definition at line 122 of file gui.c.

◆ cut_lab

tint cut_lab

Definition at line 145 of file gui.c.

◆ cut_sel

tint cut_sel

Definition at line 144 of file gui.c.

◆ davect

dint davect[9]

Definition at line 146 of file gui.c.

◆ dots

gchar* dots[NDOTS]

Definition at line 104 of file gui.c.

◆ edition_acts

atomes_action edition_acts[]
Initial value:
= {{"edit.chemistry", GINT_TO_POINTER(0)},
{"edit.periodicity", GINT_TO_POINTER(1)},
{"edit.cutoffs", GINT_TO_POINTER(2)}}

Definition at line 108 of file gui.c.

◆ graph_img

gchar* graph_img[NGRAPHS]

Definition at line 106 of file gui.c.

◆ graph_name

char* graph_name[NGRAPHS]
Initial value:
= {"g(r)/G(r)",
"S(q) from FFT[g(r)]",
"S(q) from Debye equation",
"g(r)/G(r) from FFT[S(q)]",
"Bonds properties",
"Angle distributions",
"Ring statistics",
"Chain statistics",
"Spherical harmonics",
"Mean Squared Displacement"}

Definition at line 133 of file gui.c.

◆ main_group_by_section

int main_group_by_section[] = { 3 }

Definition at line 165 of file gui.c.

◆ main_group_names

gchar* main_group_names[] = { "General", "Workspace", "Projects" }

Definition at line 166 of file gui.c.

◆ main_section_names

gchar* main_section_names[] = { "Main" }

Definition at line 164 of file gui.c.

◆ main_shortcut_by_group

int main_shortcut_by_group[] = { 3, 3, 2 }

Definition at line 167 of file gui.c.

◆ main_shortcuts

shortcuts main_shortcuts[]
Initial value:
= {
{ "About", "open about dialog", GDK_KEY_a, "<Ctrl>a" },
{ "Periodic table", "open periodic table", GDK_KEY_p, "<Ctrl>p" },
{ "Quit", "quit atomes", GDK_KEY_q, "<Ctrl>q" },
{ "Open workspace", "open atomes workspace", GDK_KEY_w, "<Ctrl>w" },
{ "Save workspace", "save atomes workspace", GDK_KEY_s, "<Ctrl>s" },
{ "Close workspace", "close atomes workspace", GDK_KEY_c, "<Ctrl>c" },
{ "New project", "create new atomes project", GDK_KEY_n, "<Ctrl>n" },
{ "Open project", "open atomes project", GDK_KEY_o, "<Ctrl>o" }
}

Definition at line 149 of file gui.c.

◆ object_was_selected

int* object_was_selected[3]
extern

Definition at line 213 of file selection.c.

◆ objects

int objects[3]
extern

Definition at line 212 of file selection.c.

◆ std

ColRGBA std[6]

Definition at line 147 of file gui.c.

◆ tmp_object_id

int** tmp_object_id[3]
extern

Definition at line 214 of file selection.c.