diff --git a/src/c-interface-ligands-gui.cc b/src/c-interface-ligands-gui.cc index 5ab0e832b..79d738c1a 100644 --- a/src/c-interface-ligands-gui.cc +++ b/src/c-interface-ligands-gui.cc @@ -1364,8 +1364,44 @@ PyObject *get_ligand_distortion_summary_info_py(int imol, PyObject *residue_spec void show_acedrg_link_interface_overlay() { - GtkWidget *w = widget_from_builder("acedrg_link_interface_frame"); - gtk_widget_set_visible(w, TRUE); + GtkWidget *w = widget_from_builder("acedrg_link_interface_frame"); + gtk_widget_set_visible(w, TRUE); + + // what is the residue at the centre of the screen? + // Fill the comboboxes dependent on that + + std::pair > pp = active_atom_spec(); + if (pp.first) { + int imol = pp.second.first; + const auto &atom_spec = pp.second.second; + auto res_spec = coot::residue_spec_t(atom_spec); + std::string rn = graphics_info_t::molecules[imol].get_residue_name(res_spec); + if (graphics_info_t::Geom_p()) { + if (! rn.empty()) { + std::pair p = + graphics_info_t::Geom_p()->get_monomer_restraints(rn, imol); + if (p.first) { + GtkWidget *entry = widget_from_builder("acedrg_link_first_residue_name_entry"); + GtkWidget *combobox = widget_from_builder("acedrg_link_first_atom_name_chooser_combobox"); + if (entry) { + if (combobox) { + std::cout << "add " << rn << " to " << entry << std::endl; + gtk_editable_set_text(GTK_EDITABLE(entry), rn.c_str()); + const auto &rest = p.second; + const std::vector &atoms = rest.atom_info; + gtk_cell_layout_clear(GTK_CELL_LAYOUT(combobox)); + for(const auto &atom : atoms) { + const std::string &atom_name = atom.atom_id_4c; + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox), atom_name.c_str()); + } + } + } + } + } + } else { + std::cout << "ERROR:: Geom_p() is null" << std::endl; + } + } } diff --git a/src/glade-callbacks-main-window.cc b/src/glade-callbacks-main-window.cc index cdc35d976..525457269 100644 --- a/src/glade-callbacks-main-window.cc +++ b/src/glade-callbacks-main-window.cc @@ -893,10 +893,46 @@ void on_acedrg_link_ok_button_clicked(GtkButton *button, gpointer user_data) { - std::cout << "OK - now do something" << std::endl; - GtkWidget *w = widget_from_builder("acedrg_link_interface_frame"); - gtk_widget_set_visible(w, FALSE); - + std::cout << "OK - now do something" << std::endl; + GtkWidget *w = widget_from_builder("acedrg_link_interface_frame"); + gtk_widget_set_visible(w, FALSE); + + GtkWidget *entry_first = widget_from_builder("acedrg_link_first_residue_name_entry"); + GtkWidget *atom_name_combobox_first = widget_from_builder("acedrg_link_first_atom_name_chooser_combobox"); + GtkWidget *delete_atom_checkbutton_first = widget_from_builder("acedrg_link_first_delete_atom_checkbutton"); + GtkWidget *delete_atom_combobox_first = widget_from_builder("acedrg_link_first_delete_atom_chooser_combobox"); + GtkWidget *change_bond_order_checkbutton_first = widget_from_builder("acedrg_link_first_change_bond_order_checkbutton"); + GtkWidget *change_bond_order_combobox_first = widget_from_builder("acedrg_link_first_change_bond_order_combobox"); + + GtkWidget *entry_second = widget_from_builder("acedrg_link_second_residue_name_entry"); + GtkWidget *atom_name_combobox_second = widget_from_builder("acedrg_link_second_atom_name_chooser_combobox"); + GtkWidget *delete_atom_checkbutton_second = widget_from_builder("acedrg_link_second_delete_atom_checkbutton"); + GtkWidget *delete_atom_combobox_second = widget_from_builder("acedrg_link_second_delete_atom_chooser_combobox"); + GtkWidget *change_bond_order_checkbutton_second = widget_from_builder("acedrg_link_second_change_bond_order_checkbutton"); + GtkWidget *change_bond_order_combobox_second = widget_from_builder("acedrg_link_second_change_bond_order_combobox"); + + if (entry_first && atom_name_combobox_first && delete_atom_combobox_first && delete_atom_checkbutton_first) { + if (change_bond_order_combobox_first && change_bond_order_checkbutton_first) { + if (entry_second && atom_name_combobox_second && delete_atom_combobox_second && delete_atom_checkbutton_second) { + if (change_bond_order_combobox_second && change_bond_order_checkbutton_second) { + bool change_bond_order_first = false; + bool change_bond_order_second = false; + if (gtk_check_button_get_active(GTK_CHECK_BUTTON(change_bond_order_checkbutton_first))) change_bond_order_first = true; + if (gtk_check_button_get_active(GTK_CHECK_BUTTON(change_bond_order_checkbutton_second))) change_bond_order_second = true; + bool delete_atom_first = false; + bool delete_atom_second = false; + if (gtk_check_button_get_active(GTK_CHECK_BUTTON(delete_atom_checkbutton_first))) change_bond_order_first = true; + if (gtk_check_button_get_active(GTK_CHECK_BUTTON(delete_atom_checkbutton_second))) change_bond_order_second = true; + std::string residue_name_first = gtk_editable_get_text(GTK_EDITABLE(entry_first)); + std::string residue_name_second = gtk_editable_get_text(GTK_EDITABLE(entry_second)); + char *da_first = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(delete_atom_combobox_first); + char *da_second = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(delete_atom_combobox_second); + char *cbo_first = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(change_bond_order_first); + char *cbo_second = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(change_bond_order_second); + } + } + } + } } extern "C" G_MODULE_EXPORT diff --git a/src/new-startup.cc b/src/new-startup.cc index 69748912b..72a08ff86 100644 --- a/src/new-startup.cc +++ b/src/new-startup.cc @@ -825,6 +825,7 @@ new_startup_application_activate(GtkApplication *application, }; graphics_info_t graphics_info; + graphics_info.init(); // added 20241231 // use this to look up things - and it is used to attach the lidia // application window @@ -837,7 +838,8 @@ new_startup_application_activate(GtkApplication *application, // but let's do it once at least! // this is done in the python startup now. - // std::cout << "#################### new_startup_application_activate() calling graphics_info.init() " << std::endl; + // std::cout << "#################### new_startup_application_activate() calling graphics_info.init() " + // << std::endl; // graphics_info.init(); GtkBuilder *builder = gtk_builder_new();