| 713 | } |
| 714 | |
| 715 | void BoardView::SearchComponent(void) { |
| 716 | bool dummy = true; |
| 717 | ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x/2, DPI(100)), 0, ImVec2(0.5f, 0.0f)); |
| 718 | ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f); |
| 719 | if (ImGui::BeginPopupModal("Search for Component / Network", |
| 720 | &dummy, |
| 721 | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings)) { |
| 722 | // char cs[128]; |
| 723 | const char *first_button[] = {m_search[0], m_search[1], m_search[2]}; |
| 724 | |
| 725 | bool search_params_changed = m_showSearch; //treat initiail popup reopening similar to later search option changes |
| 726 | if (m_showSearch) { |
| 727 | m_showSearch = false; |
| 728 | // fprintf(stderr, "Tooltips disabled\n"); |
| 729 | } |
| 730 | |
| 731 | // Column 1, implied. |
| 732 | // |
| 733 | // |
| 734 | if (ImGui::Button("Search")) { |
| 735 | // FindComponent(first_button); |
| 736 | SearchCompound(first_button[0]); |
| 737 | SearchCompoundNoClear(first_button[1]); |
| 738 | SearchCompoundNoClear(first_button[2]); |
| 739 | CenterZoomSearchResults(); |
| 740 | ImGui::CloseCurrentPopup(); |
| 741 | } // search button |
| 742 | |
| 743 | ImGui::SameLine(); |
| 744 | if (ImGui::Button("Reset")) { |
| 745 | FindComponent(""); |
| 746 | ResetSearch(); |
| 747 | } // reset button |
| 748 | |
| 749 | ImGui::SameLine(); |
| 750 | if (ImGui::Button("Exit") || keybindings.isPressed("CloseDialog")) { |
| 751 | FindComponent(""); |
| 752 | ResetSearch(); |
| 753 | ImGui::CloseCurrentPopup(); |
| 754 | } // exit button |
| 755 | |
| 756 | ImGui::SameLine(); |
| 757 | // ImGui::Dummy(ImVec2(DPI(200), 1)); |
| 758 | // ImGui::SameLine(); |
| 759 | ImGui::PushItemWidth(-1); |
| 760 | ImGui::Text("ENTER: Search, ESC: Exit, TAB: next field"); |
| 761 | |
| 762 | { |
| 763 | ImGui::Separator(); |
| 764 | search_params_changed |= ImGui::Checkbox("Components", &m_searchComponents); |
| 765 | |
| 766 | ImGui::SameLine(); |
| 767 | search_params_changed |= ImGui::Checkbox("Nets", &m_searchNets); |
| 768 | |
| 769 | ImGui::SameLine(); |
| 770 | search_params_changed |= ImGui::Checkbox("Including details", &searcher.configSearchDetails()); |
| 771 | |
| 772 | ImGui::Text(" Search mode: "); |