/////////////////////////////////////////////////////////////////////////////// // Selects the entire current line and converts it to the current keyboard layout void SwitchAndConvert(void*) { SendKeyCombo(VK_CONTROL, 'A', TRUE); HKL sourceLayout = GetCurrentLayout(); HKL targetLayout = SwitchLayout(); ConvertSelectedTextInActiveWindow(sourceLayout, targetLayout); }
void PageActions::SetCustomBottom(Widget *widget) { assert(widget != nullptr); PagesState &state = CommonInterface::SetUIState().pages; state.special_page = GetCurrentLayout(); state.special_page.bottom = PageLayout::Bottom::CUSTOM; CommonInterface::main_window->SetBottomWidget(widget); }
void PageActions::ShowThermalAssistant() { PageLayout layout = GetCurrentLayout(); if (layout.main == PageLayout::Main::THERMAL_ASSISTANT) /* already showing the traffic radar */ return; if (GetConfiguredLayout().main == PageLayout::Main::THERMAL_ASSISTANT) /* the configured page is a traffic radar page: restore it */ Restore(); else { /* generate a "special" page based on the current page */ layout.main = PageLayout::Main::THERMAL_ASSISTANT; layout.bottom = PageLayout::Bottom::NOTHING; OpenLayout(layout); } }
void PageActions::ShowTrafficRadar() { PageLayout layout = GetCurrentLayout(); if (layout.main == PageLayout::Main::FLARM_RADAR) /* already showing the traffic radar */ return; if (GetConfiguredLayout().main == PageLayout::Main::FLARM_RADAR) /* the configured page is a traffic radar page: restore it */ Restore(); else { /* generate a "special" page based on the current page */ layout.main = PageLayout::Main::FLARM_RADAR; layout.bottom = PageLayout::Bottom::NOTHING; OpenLayout(layout); } }
GlueMapWindow * PageActions::ShowMap() { PageLayout layout = GetCurrentLayout(); if (layout.main != PageLayout::Main::MAP) { /* not showing map currently: activate it */ if (GetConfiguredLayout().main == PageLayout::Main::MAP) /* the configured page is a map page: restore it */ Restore(); else { /* generate a "special" map page based on the current page */ layout.main = PageLayout::Main::MAP; OpenLayout(layout); } } return CommonInterface::main_window->ActivateMap(); }
/////////////////////////////////////////////////////////////////////////////// // Switches the current language HKL SwitchLayout() { HWND hwnd = RemoteGetFocus(); HKL currentLayout = GetCurrentLayout(); // Find the current keyboard layout's index UINT i; for(i = 0; i < g_keyboardInfo.count; i++) { if(g_keyboardInfo.hkls[i] == currentLayout) break; } UINT currentLanguageIndex = i; // Find the next active layout BOOL found = FALSE; UINT newLanguage = currentLanguageIndex; for(UINT i = 0; i < g_keyboardInfo.count; i++) { newLanguage = (newLanguage + 1) % g_keyboardInfo.count; if(g_keyboardInfo.inUse[newLanguage]) { found = TRUE; break; } } // Activate the selected language if(found) { g_keyboardInfo.current = newLanguage; PostMessage(hwnd, WM_INPUTLANGCHANGEREQUEST, 0, (LPARAM)(g_keyboardInfo.hkls[g_keyboardInfo.current])); #ifdef _DEBUG PrintDebugString("Language set to %S", g_keyboardInfo.names[g_keyboardInfo.current]); #endif return g_keyboardInfo.hkls[g_keyboardInfo.current]; } return NULL; }
void PageActions::Update() { LoadLayout(GetCurrentLayout()); }