diff --git a/VERSION b/VERSION index ab779774..bc7f8f55 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.333 +1.2.334 diff --git a/src/gui/windows.f90 b/src/gui/windows.f90 index 464eef3e..97757ecc 100644 --- a/src/gui/windows.f90 +++ b/src/gui/windows.f90 @@ -212,6 +212,8 @@ module windows procedure :: draw_vibrations ! rebond procedure :: draw_rebond + ! geometry + procedure :: draw_geometry ! preferences procedure :: draw_preferences end type window @@ -244,6 +246,7 @@ module windows integer, parameter, public :: wintype_rebond = 14 integer, parameter, public :: wintype_preferences = 15 integer, parameter, public :: wintype_treeplot = 16 + integer, parameter, public :: wintype_geometry = 17 ! window purposes integer, parameter, public :: wpurp_unknown = 0 @@ -451,6 +454,9 @@ end subroutine draw_vibrations module subroutine draw_rebond(w) class(window), intent(inout), target :: w end subroutine draw_rebond + module subroutine draw_geometry(w) + class(window), intent(inout), target :: w + end subroutine draw_geometry end interface end module windows diff --git a/src/gui/windows@proc.f90 b/src/gui/windows@proc.f90 index 1e94e766..f0c4b36b 100644 --- a/src/gui/windows@proc.f90 +++ b/src/gui/windows@proc.f90 @@ -310,12 +310,13 @@ module function stack_create_window(type,isopen,purpose,isys,irep,idcaller,perma if (orraise < 0) then raiseid = 0 do i = 1, nwin - ! wintype_dialog ok = win(i)%type == type .and. win(i)%isopen + ! specific tests according to type if (ok.and.type == wintype_dialog) ok = (win(i)%dialog_data%purpose == purpose) if (ok.and.type == wintype_editrep) ok = (win(i)%isys == isys .and.& win(i)%irep == irep .and. win(i)%idparent == idcaller) if (ok.and.type == wintype_scfplot) ok = (win(i)%isys == isys) + if (ok.and.type == wintype_geometry) ok = (win(i)%isys == isys) if (ok) then raiseid = i exit @@ -517,6 +518,10 @@ module subroutine window_init(w,type,isopen,id,purpose,isys,irep,idcaller) ! recalculate bonds window if (.not.present(isys)) & call ferror('window_init','rebond requires isys',faterr) + elseif (type == wintype_geometry) then + ! geometry window + if (.not.present(isys)) & + call ferror('window_init','geometry requires isys',faterr) end if end subroutine window_init @@ -736,6 +741,12 @@ module subroutine window_draw(w) inisize%x = 55 * fontsize%x inisize%y = 23 * fontsize%y call igSetNextWindowSize(inisize,ImGuiCond_FirstUseEver) + elseif (w%type == wintype_geometry) then + w%name = "Geometry##" // string(w%id) // c_null_char + w%flags = ImGuiWindowFlags_None + inisize%x = 55 * fontsize%x + inisize%y = 23 * fontsize%y + call igSetNextWindowSize(inisize,ImGuiCond_FirstUseEver) elseif (w%type == wintype_preferences) then w%name = "Preferences##" // string(w%id) // c_null_char w%flags = ImGuiWindowFlags_None @@ -797,6 +808,8 @@ module subroutine window_draw(w) call w%draw_vibrations() elseif (w%type == wintype_rebond) then call w%draw_rebond() + elseif (w%type == wintype_rebond) then + call w%draw_geometry() elseif (w%type == wintype_preferences) then call w%draw_preferences() elseif (w%type == wintype_treeplot) then diff --git a/src/gui/windows@tree.f90 b/src/gui/windows@tree.f90 index 95138e13..d76fedda 100644 --- a/src/gui/windows@tree.f90 +++ b/src/gui/windows@tree.f90 @@ -95,6 +95,7 @@ module subroutine draw_tree(w) logical, save :: ttshown = .false. ! tooltip flag integer(c_int), save :: iresample(3) = (/0,0,0/) ! for the grid resampling menu option integer(c_int), save :: idrebond = 0 ! ID of the window used to rebond the sytsem + integer(c_int), save :: idgeometry = 0 ! ID of the window used for geometry view/edit integer(c_int), save :: shown_after_filter = 0 ! number of systems shown after the filter real*8, save :: timelastupdate = 0d0 real*8, save :: timelastresize = 0d0 @@ -123,8 +124,9 @@ module subroutine draw_tree(w) if (timelastsort < sysc(i)%timelastchange) w%forcesort = .true. end do - ! update the window ID for the rebond dialog + ! update the window ID for the dialogs call update_window_id(idrebond) + call update_window_id(idgeometry) ! Tree options button export = .false. @@ -1001,13 +1003,13 @@ subroutine write_maybe_selectable(isys,tooltipstr) end if ! geometry submenu (system) - strpop = "Geometry" // c_null_char + strpop = "System" // c_null_char if (igBeginMenu(c_loc(strpop),.true._c_bool)) then - ! ! Geometry - ! strpop = "Geometry Information" // c_null_char - ! if (igMenuItem_Bool(c_loc(strpop),c_null_ptr,.false._c_bool,enabled)) & - ! idrebond = stack_create_window(wintype_rebond,.true.,isys=isys,orraise=-1) - ! call iw_tooltip("Recalculate the covalent bonds in this system and the molecular structures",ttshown) + ! Geometry + strpop = "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) ! rebond strpop = "Recalculate Bonds" // c_null_char @@ -1165,6 +1167,7 @@ subroutine select_system(i,force) if (tree_select_updates_view .or. force) & call win(iwin_view)%select_view(i) if (idrebond > 0) win(idrebond)%isys = i + if (idgeometry > 0) win(idgeometry)%isys = i end subroutine select_system @@ -2769,4 +2772,35 @@ end subroutine getname end subroutine draw_treeplot + !> Draw the geometry window. + module subroutine draw_geometry(w) + use keybindings, only: is_bind_event, BIND_CLOSE_FOCUSED_DIALOG,& + BIND_OK_FOCUSED_DIALOG, BIND_CLOSE_ALL_DIALOGS + use gui_main, only: nsys, sysc, sys, sys_init, g + use utils, only: iw_text, iw_tooltip, iw_calcwidth, iw_button, iw_calcheight + use global, only: bondfactor_def + use tools_io, only: string, nameguess + use param, only: atmcov0, maxzat0, bohrtoa, newline + class(window), intent(inout), target :: w + + logical :: doquit + + ! initialize + doquit = .false. + + ! xxxx + + ! close button + doquit = (w%focused() .and. (is_bind_event(BIND_OK_FOCUSED_DIALOG) .or.& + is_bind_event(BIND_CLOSE_FOCUSED_DIALOG) .or.& + is_bind_event(BIND_CLOSE_ALL_DIALOGS))) + doquit = doquit .or. iw_button("Close",sameline=.true.) + + ! quit the window + if (doquit) then + call w%end() + end if + + end subroutine draw_geometry + end submodule tree