MCPcopy Create free account
hub / github.com/OpenBoardView/OpenBoardView / Update

Method Update

src/openboardview/BoardView.cpp:890–1308  ·  view source on GitHub ↗

UPDATE Logic region * * * * */

Source from the content-addressed store, hash-verified

888 *
889 */
890void BoardView::Update() {
891 bool open_file = false;
892 char *preset_filename = NULL;
893 ImGuiIO &io = ImGui::GetIO();
894
895 // Window is probably minimized, do not attempt to draw anything as our code will not handle screen size of 0 properly and crash (ocornut/imgui@bb2529d)
896 if (io.DisplaySize.x <= 0.0f || io.DisplaySize.y <= 0.0f) {
897 return;
898 }
899
900 // Set global font size and scale with user-defined DPI
901 // Do not use DPIF() here as we do not want to apply display_scale, it is already applied through style.FontScaleDpi
902 ImGui::PushFont(nullptr, (config.fontSize * getDPI()) / 100.0f);
903
904 /**
905 * ** FIXME
906 * This should be handled in the keyboard section, not here
907 */
908 if (keybindings.isPressed("Open")) {
909 open_file = true;
910 // the dialog will likely eat our WM_KEYUP message for CTRL and O:
911 io.AddKeyEvent(ImGuiKey_RightCtrl, false);
912 io.AddKeyEvent(ImGuiKey_LeftCtrl, false);
913 io.AddKeyEvent(ImGuiKey_O, false);
914
915 }
916
917 if (keybindings.isPressed("Quit")) {
918 m_wantsQuit = true;
919 }
920
921 if (ImGui::BeginMainMenuBar()) {
922 m_menu_height = ImGui::GetWindowHeight();
923
924 /*
925 * Create these dialogs, but they're not actually
926 * visible until they're called up by the respective
927 * flags.
928 */
929 SearchComponent();
930 ContextMenu();
931
932 if (ImGui::BeginMenu("File")) {
933 if (ImGui::MenuItem("Open", keybindings.getKeyNames("Open").c_str())) {
934 open_file = true;
935 }
936
937 /// Generate file history - PLD20160618-2028
938 ImGui::Separator();
939 {
940 int i;
941 for (i = 0; i < fhistory.count; i++) {
942 std::string history_item(fhistory.Trim_filename(fhistory.history[i], 2));
943 history_item += "##History" + std::to_string(i);
944 if (ImGui::MenuItem(history_item.c_str())) {
945 open_file = true;
946 preset_filename = fhistory.history[i];
947 }

Callers 2

mainFunction · 0.45
ContextMenuMethod · 0.45

Calls 15

getDPIFunction · 0.85
MenuItemWithCheckboxFunction · 0.85
DPIFunction · 0.85
DPIFFunction · 0.85
getKeyNamesMethod · 0.80
Trim_filenameMethod · 0.80
WriteBoolMethod · 0.80
mount_type_strMethod · 0.80
show_file_pickerFunction · 0.70
isPressedMethod · 0.45
menuItemMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected