From addfeda28def0d6ab771e4e966248aa0cabb5690 Mon Sep 17 00:00:00 2001 From: Alberto Otero de la Roza Date: Sun, 24 Nov 2024 11:30:28 +0100 Subject: [PATCH] started tools menu --- VERSION | 2 +- src/gui/gui_main@proc.F90 | 29 +++++++++++++++++++++++------ src/gui/scenes.f90 | 2 +- src/gui/windows@tree.f90 | 2 +- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index 1c347498..d719af3c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.335 +1.2.336 diff --git a/src/gui/gui_main@proc.F90 b/src/gui/gui_main@proc.F90 index aff7173b..37bc7b34 100644 --- a/src/gui/gui_main@proc.F90 +++ b/src/gui/gui_main@proc.F90 @@ -812,7 +812,7 @@ subroutine show_main_menu() iwin_console_output, iwin_about, stack_create_window, wintype_dialog,& wpurp_dialog_openfiles, wintype_new_struct, wintype_new_struct_library,& wintype_preferences, wintype_view, wpurp_view_alternate,& - wintype_about + wintype_about, wintype_geometry use utils, only: igIsItemHovered_delayed, iw_tooltip, iw_text, iw_calcwidth use keybindings, only: BIND_QUIT, BIND_OPEN, BIND_NEW, get_bind_keyname, is_bind_event use interfaces_glfw, only: GLFW_TRUE, glfwSetWindowShouldClose @@ -827,7 +827,8 @@ subroutine show_main_menu() character(kind=c_char,len=:), allocatable, target :: str1, str2 integer(c_int) :: idum logical :: launchquit, launch(4) - integer :: iaux + logical(c_bool) :: system_ok + integer :: isys logical, save :: ttshown = .false. ! tooltip flag @@ -882,7 +883,7 @@ subroutine show_main_menu() ! Edit -> Preferences... str1 = "Preferences..." // c_null_char if (igMenuItem_Bool(c_loc(str1),c_null_ptr,.false._c_bool,.true._c_bool)) & - iaux = stack_create_window(wintype_preferences,.true.,orraise=-1) + idum = stack_create_window(wintype_preferences,.true.,orraise=-1) call iw_tooltip("Change the user interface settings and key bindings",ttshown) call igEndMenu() @@ -931,6 +932,22 @@ subroutine show_main_menu() ttshown = .false. end if + ! Windows + str1 = "Tools" // c_null_char + if (igBeginMenu(c_loc(str1),.true._c_bool)) then + str2 = "View/Edit Geometry..." // c_null_char + isys = win(iwin_tree)%table_selected + system_ok = (isys > 0 .and. isys <= nsys) + if (system_ok) system_ok = (sysc(isys)%status == sys_init) + if (igMenuItem_Bool(c_loc(str2),c_null_ptr,.false._c_bool,system_ok)) & + idum = stack_create_window(wintype_geometry,.true.,isys=isys,orraise=-1) + call iw_tooltip("View and edit the atomic positions, bonds, etc.",ttshown) + + call igEndMenu() + else + ttshown = .false. + end if + ! Help str1 = "Help" // c_null_char if (igBeginMenu(c_loc(str1),.true._c_bool)) then @@ -965,11 +982,11 @@ subroutine show_main_menu() ! process launches if (launch(d_new)) & - iaux = stack_create_window(wintype_new_struct,.true.,orraise=-1) + idum = stack_create_window(wintype_new_struct,.true.,orraise=-1) if (launch(d_newlib)) & - iaux = stack_create_window(wintype_new_struct_library,.true.,orraise=-1) + idum = stack_create_window(wintype_new_struct_library,.true.,orraise=-1) if (launch(d_open)) & - iaux = stack_create_window(wintype_dialog,.true.,wpurp_dialog_openfiles,orraise=-1) + idum = stack_create_window(wintype_dialog,.true.,wpurp_dialog_openfiles,orraise=-1) if (launchquit) then if (are_threads_running()) & call kill_initialization_thread() diff --git a/src/gui/scenes.f90 b/src/gui/scenes.f90 index 66136f9d..a0f69ad2 100644 --- a/src/gui/scenes.f90 +++ b/src/gui/scenes.f90 @@ -77,7 +77,7 @@ module scenes real(c_float), allocatable :: rgb(:,:) ! color (3,ntype) real(c_float), allocatable :: rad(:) ! radius (ntype) real(c_float) :: border_size = 0._c_float ! border size - real(c_float) :: rgbborder(3) ! border color + real(c_float) :: rgbborder(3) ! border color end type draw_style_atom public :: draw_style_atom diff --git a/src/gui/windows@tree.f90 b/src/gui/windows@tree.f90 index eca5f540..92948d1f 100644 --- a/src/gui/windows@tree.f90 +++ b/src/gui/windows@tree.f90 @@ -971,7 +971,7 @@ subroutine write_maybe_selectable(isys,tooltipstr) strpop = "System" // c_null_char if (igBeginMenu(c_loc(strpop),.true._c_bool)) then ! Geometry - strpop = "Geometry" // c_null_char + strpop = "View/Edit Geometry" // c_null_char if (igMenuItem_Bool(c_loc(strpop),c_null_ptr,.false._c_bool,enabled)) & idgeometry = stack_create_window(wintype_geometry,.true.,isys=isys,orraise=-1) call iw_tooltip("View and edit the atomic positions, bonds, etc.",ttshown)