void InfoBoxManager::InfoBoxDrawIfDirty() { // No need to redraw map or infoboxes if screen is blanked. // This should save lots of battery power due to CPU usage // of drawing the screen if (InfoBoxesDirty && !XCSoarInterface::SettingsMap().ScreenBlanked) { DisplayInfoBox(); InfoBoxesDirty = false; } }
void InfoBoxManager::InfoBoxDrawIfDirty() { // No need to redraw map or infoboxes if screen is blanked. // This should save lots of battery power due to CPU usage // of drawing the screen if (infoboxes_dirty && !infoboxes_hidden && !CommonInterface::GetUIState().screen_blanked) { DisplayInfoBox(); infoboxes_dirty = false; } }
void InfoBoxManager::ShowInfoBoxPicker(const int id) { int i; if (id < 0) i = GetFocused(); else i = id; if (i < 0) return; InfoBoxSettings &settings = CommonInterface::SetUISettings().info_boxes; const unsigned panel_index = CommonInterface::GetUIState().panel_index; InfoBoxSettings::Panel &panel = settings.panels[panel_index]; const InfoBoxFactory::Type old_type = panel.contents[i]; ComboList list; for (unsigned j = InfoBoxFactory::MIN_TYPE_VAL; j < InfoBoxFactory::NUM_TYPES; j++) { const TCHAR *desc = InfoBoxFactory::GetDescription((InfoBoxFactory::Type)j); list.Append(j, gettext(InfoBoxFactory::GetName((InfoBoxFactory::Type)j)), gettext(InfoBoxFactory::GetName((InfoBoxFactory::Type)j)), desc != NULL ? gettext(desc) : NULL); } list.Sort(); list.current_index = list.LookUp(old_type); /* let the user select */ StaticString<20> caption; caption.Format(_T("%s: %d"), _("InfoBox"), i + 1); int result = ComboPicker(caption, list, nullptr, true); if (result < 0) return; /* was there a modification? */ InfoBoxFactory::Type new_type = (InfoBoxFactory::Type)list[result].int_value; if (new_type == old_type) return; /* yes: apply and save it */ panel.contents[i] = new_type; DisplayInfoBox(); Profile::Save(panel, panel_index); }
void InfoBoxManager::SetupFocused() { int i = GetFocused(); if (i < 0) return; const enum mode mode = GetCurrentMode(); int old_type = GetType(i, mode); /* create a fake WndProperty for dlgComboPicker() */ /* XXX reimplement properly */ DataFieldEnum *dfe = new DataFieldEnum(old_type, NULL); for (unsigned i = 0; i < InfoBoxFactory::NUM_TYPES; i++) dfe->addEnumText(gettext(GetTypeDescription(i))); dfe->Sort(0); dfe->Set(old_type); ComboList *list = dfe->CreateComboList(); delete dfe; /* let the user select */ info_box_combo_list = list; int result = ComboPicker(XCSoarInterface::main_window, _("InfoBox"), *list, OnInfoBoxHelp); if (result < 0) { delete list; return; } /* was there a modification? */ int new_type = (*list)[result].DataFieldIndex; delete list; if (new_type == old_type) return; /* yes: apply and save it */ SetType(i, new_type, mode); DisplayInfoBox(); Profile::SetInfoBoxes(i, GetTypes(i)); }
void InfoBoxManager::SetupFocused(const int id) { int i; if (id < 0) i = GetFocused(); else i = id; if (i < 0) return; const unsigned panel = GetCurrentPanel(); int old_type = GetType(i, panel); ComboList list; for (unsigned i = 0; i < InfoBoxFactory::NUM_TYPES; i++) list.Append(i, gettext(InfoBoxFactory::GetName(i))); list.Sort(); list.ComboPopupItemSavedIndex = list.LookUp(old_type); /* let the user select */ TCHAR caption[20]; _stprintf(caption, _T("%s: %d"), _("InfoBox"), i + 1); info_box_combo_list = &list; int result = ComboPicker(XCSoarInterface::main_window, caption, list, OnInfoBoxHelp); if (result < 0) return; /* was there a modification? */ int new_type = list[result].DataFieldIndex; if (new_type == old_type) return; /* yes: apply and save it */ SetType(i, new_type, panel); DisplayInfoBox(); Profile::SetInfoBoxManagerConfig(infoBoxManagerConfig); }