int dlgAirspacePatternsShowModal(void){ if (!Layout::landscape) { wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, _T("IDR_XML_AIRSPACEPATTERNS_L")); } else { wf = LoadDialog(CallBackTable, XCSoarInterface::main_window, _T("IDR_XML_AIRSPACEPATTERNS")); } if (!wf) return -1; assert(wf!=NULL); WndListFrame *wAirspacePatternsList = (WndListFrame*)wf->FindByName(_T("frmAirspacePatternsList")); assert(wAirspacePatternsList!=NULL); wAirspacePatternsList->SetActivateCallback(OnAirspacePatternsListEnter); wAirspacePatternsList->SetPaintItemCallback(OnAirspacePatternsPaintListItem); wAirspacePatternsList->SetLength(NUMAIRSPACEBRUSHES); int result = wf->ShowModal(); result = result == mrOK ? (int)wAirspacePatternsList->GetCursorIndex() : -1; // now retrieve back the properties... delete wf; wf = NULL; return result; }
bool dlgAirspaceShowModal(bool coloredit){ colormode = coloredit; WndForm *wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_AIRSPACE_L : IDR_XML_AIRSPACE_P); if (!wf) return false; WndListFrame* wAirspaceList = (WndListFrame*)wf->FindByName(TEXT("frmAirspaceList")); LKASSERT(wAirspaceList!=NULL); wAirspaceList->SetBorderKind(BORDERLEFT); wAirspaceList->SetEnterCallback(OnAirspaceListEnter); WndOwnerDrawFrame* wAirspaceListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmAirspaceListEntry")); if(wAirspaceListEntry) { wAirspaceListEntry->SetCanFocus(true); } UpdateList(wAirspaceList); changed = false; wf->ShowModal(); delete wf; return changed; }
void set(const DialogLook &look, int left, int top, unsigned width, unsigned height) { SingleWindow::set(_T("RunRenderOZ"), _T("RunRenderOZ"), left, top, width, height); const PixelRect rc = get_client_rect(); WindowStyle with_border; with_border.border(); oz.set(*this, rc.right / 2, 0, rc.right - (rc.right / 2), rc.bottom, with_border); oz_window = &oz; type_list = new WndListFrame(*this, look, 0, 0, rc.right / 2, rc.bottom - 30, with_border, 25); type_list->SetPaintItemCallback(paint_oz_type_name); type_list->SetCursorCallback(oz_type_cursor_callback); type_list->SetLength(NUM_OZ_TYPES); close_button.set(*this, _T("Close"), ID_CLOSE, 0, rc.bottom - 30, rc.right / 2, 30); oz.set_shape(ObservationZonePoint::LINE); type_list->set_focus(); }
void DevicesConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc) { instance = this; LoadWindow(NULL, parent, Layout::landscape ? _T("IDR_XML_DEVICESCONFIGPANEL") : _T("IDR_XML_DEVICESCONFIGPANEL_L")); current_device = 0; for (unsigned i = 0; i < NUMDEV; ++i) Profile::GetDeviceConfig(i, device_config[i]); DockWindow *dock = (DockWindow *)form.FindByName(_T("edit")); assert(dock != NULL); DeviceEditWidget *edit = new DeviceEditWidget(device_config[0]); dock->SetWidget(edit); WndListFrame *list = (WndListFrame *)form.FindByName(_T("list")); assert(list != NULL); list->SetPaintItemCallback(PaintDeviceListItem); list->SetLength(2); list->SetCursorCallback(DeviceListCursorCallback); LoadFormProperty(form, _T("prpSetSystemTimeFromGPS"), CommonInterface::GetComputerSettings().set_system_time_from_gps); LoadFormProperty(form, _T("prpIgnoreNMEAChecksum"), NMEAParser::ignore_checksum); }
void OnLookup(WndButton* pWnd) { StartHourglassCursor(); CBtHandler * pBtHandler = CBtHandler::Get(); if (pBtHandler && pBtHandler->StartHW() && pBtHandler->LookupDevices()) { WndListFrame* BthList = (WndListFrame*) wfBth->FindByName(TEXT("frmBthList")); if (BthList) { BthList->ResetList(); BthList->Redraw(); } } StopHourglassCursor(); }
static void NextPage(WndForm* pForm, int Step){ if(!pForm) { return; } TCHAR buffer[200]; page += Step; if (page>=nLists) { page=0; } if (page<0) { page= nLists-1; } WndOwnerDrawFrame* wDetailsEntry = (WndOwnerDrawFrame*)pForm->FindByName(TEXT("frmDetailsEntry")); if(!wDetailsEntry) { return; } LKWindowSurface Surface(*wDetailsEntry); Surface.SelectObject(wDetailsEntry->GetFont()); aTextLine.update(Surface, wDetailsEntry->GetWidth(), ChecklistText[page]); switch(nLists) { case 0: _stprintf(buffer, _T("%s %s"),NoteModeTitle,MsgToken(1750)); // empty break; case 1: _stprintf(buffer, _T("%s"),NoteModeTitle); break; default: _stprintf(buffer, _T("%s %d/%d"),NoteModeTitle,page+1,nLists); break; } if (ChecklistTitle[page] && (_tcslen(ChecklistTitle[page])>0) && (_tcslen(ChecklistTitle[page])<60)) { _tcscat(buffer, TEXT(": ")); _tcscat(buffer, ChecklistTitle[page]); } pForm->SetCaption(buffer); WndListFrame* wDetails = (WndListFrame*)pForm->FindByName(TEXT("frmDetails")); if(wDetails) { wDetails->ResetList(); wDetails->Redraw(); } }
void dlgHelpShowModal(const TCHAR* Caption, const TCHAR* HelpText) { if (!Caption || !HelpText) { return; } std::unique_ptr<WndForm> wf(dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_HELP_L : IDR_XML_HELP_P)); if(!wf) { return; } WndListFrame* wHelp = static_cast<WndListFrame*>(wf->FindByName(TEXT("frmDetails"))); if(!wHelp) { return; } wHelp->SetBorderKind(BORDERLEFT); WndOwnerDrawFrame* wHelpEntry = static_cast<WndOwnerDrawFrame*>(wf->FindByName(TEXT("frmDetailsEntry"))); if (!wHelpEntry) { return; }; wHelpEntry->SetCanFocus(true); DrawListIndex=0; TCHAR fullcaption[100]; _stprintf(fullcaption,TEXT("%s: %s"), MsgToken(336), Caption); // Help wf->SetCaption(fullcaption); aTextLine.clear(); { LKWindowSurface Surface(*wHelpEntry); const auto oldFont = Surface.SelectObject(wHelpEntry->GetFont()); const int minHeight = Surface.GetTextHeight(_T("dp")) + 2 * DLGSCALE(2); const int wHeight = wHelpEntry->GetHeight(); if(minHeight != wHeight) { wHelpEntry->SetHeight(minHeight); } aTextLine.update(Surface, wHelpEntry->GetWidth(), LKgethelptext(HelpText)); Surface.SelectObject(oldFont); } wHelp->ResetList(); wHelp->Redraw(); wf->ShowModal(); aTextLine.clear(); }
// checklistmode: 0=notepad 1=logbook 2=... void dlgChecklistShowModal(short checklistmode){ WndListFrame* wDetails = NULL; WndOwnerDrawFrame* wDetailsEntry = NULL; InitNotepad(); LoadChecklist(checklistmode); // check if loaded really something WndForm* wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_CHECKLIST_L : IDR_XML_CHECKLIST_P); aTextLine.clear(); if (!wf) goto deinit; wf->SetKeyDownNotify(FormKeyDown); ((WndButton *)wf->FindByName(TEXT("cmdClose")))->SetOnClickNotify(OnCloseClicked); wDetails = (WndListFrame*)wf->FindByName(TEXT("frmDetails")); if (!wDetails) { StartupStore(_T("..... NOTEPAD ERROR NULL frmDetails!\n")); goto deinit; } wDetails->SetBorderKind(BORDERLEFT); wDetailsEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmDetailsEntry")); if (!wDetailsEntry) { StartupStore(_T("..... NOTEPAD ERROR NULL frmDetailsEntry!\n")); goto deinit; } wDetailsEntry->SetCanFocus(true); page = 0; NextPage(wf, 0); wf->ShowModal(); deinit: delete wf; DeinitNotepad(); }
void OnUnpair(WndButton* pWnd) { CBtHandler* pBtHandler = CBtHandler::Get(); if (pBtHandler) { CBtDevice * SelectedDevice = pBtHandler->GetDevice(ItemIndex); if (SelectedDevice && SelectedDevice->m_src != BDSRC_LOOKUP) { if (!pBtHandler->Unpair(SelectedDevice->m_ba)) { StartupStore(_T("%s[%s] : UnPairing Error%s"), SelectedDevice->GetName().c_str(), SelectedDevice->BTPortName().c_str(), NEWLINE); } else { pBtHandler->RemoveDevice(SelectedDevice->m_ba); } } WndListFrame* BthList = (WndListFrame*) wfBth->FindByName(TEXT("frmBthList")); if (BthList) { BthList->ResetList(); BthList->Redraw(); } } }
void OnPair(WndButton* pWnd) { CBtHandler* pBtHandler = CBtHandler::Get(); if (pBtHandler) { CBtDevice * SelectedDevice = pBtHandler->GetDevice(ItemIndex); if (SelectedDevice && SelectedDevice->m_src == BDSRC_LOOKUP) { TCHAR szPin[20] = {0}; dlgTextEntryShowModal(szPin, 20, false); if (!pBtHandler->Pair(SelectedDevice->m_ba, SelectedDevice->GetName().c_str(), szPin)) { StartupStore(_T("Bluetooth pairing <%s> : Failed%s"), SelectedDevice->GetName().c_str(), NEWLINE); MessageBoxX(LKGetText(TEXT("_@M1835_")), TEXT("Bluetooth"), mbOk, false); } else { StartupStore(_T("Bluetooth pairing <%s> : success%s"), SelectedDevice->GetName().c_str(), NEWLINE); SelectedDevice->m_src |= BDSRC_REGNAV; } } WndListFrame* BthList = (WndListFrame*) wfBth->FindByName(TEXT("frmBthList")); if (BthList) { BthList->ResetList(); BthList->Redraw(); } } }
void Show() { TCHAR filename[MAX_PATH]; const TCHAR *resName = NULL; if (!ScreenLandscape) { LocalPathS(filename, TEXT("dlgBluetooth_L.xml")); resName = TEXT("IDR_XML_BLUETOOTH_L"); } else { LocalPathS(filename, TEXT("dlgBluetooth.xml")); resName = TEXT("IDR_XML_BLUETOOTH"); } wfBth = dlgLoadFromXML(CallBackTable, filename, resName); if (wfBth) { WndListFrame* BthList = (WndListFrame*) wfBth->FindByName(TEXT("frmBthList")); if (BthList) { BthList->SetBorderKind(BORDERLEFT | BORDERTOP | BORDERRIGHT | BORDERBOTTOM); BthList->SetWidth(wfBth->GetWidth() - BthList->GetLeft() - IBLSCALE(4)); // Bug : we need ClientHeight, but Cleint Rect is Calculated by OnPaint // BthList->SetHeight(wfBth->GetHeight() - BthList->GetTop() - 2); if (BthList->ScrollbarWidth == -1) { BthList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale); } WndOwnerDrawFrame* BthListEntry = (WndOwnerDrawFrame*) wfBth->FindByName(TEXT("frmBthListEntry")); if (BthListEntry) { BthListEntry->SetCanFocus(true); BthListEntry->SetWidth(BthList->GetWidth() - BthList->ScrollbarWidth - 5); } BthList->ResetList(); BthList->Redraw(); } if (wfBth->ShowModal()) { CBtHandler * pBtHandler = CBtHandler::Get(); if (pBtHandler) { pBtHandler->ClearDevices(); pBtHandler->FillDevices(); } RefreshComPortList(); } delete wfBth; wfBth = NULL; } }
void dlgIgcFileShowModal() { TCHAR filename[MAX_PATH]; const TCHAR *resName = NULL; if (!ScreenLandscape) { LocalPathS(filename, TEXT("dlgIgcFile.xml")); resName = TEXT("IDR_XML_IGCFILE"); } else { LocalPathS(filename, TEXT("dlgIgcFile_L.xml")); resName = TEXT("IDR_XML_IGCFILE_L"); } wfDlg = dlgLoadFromXML(DlgIgcFile::CallBackTable, filename, resName); if (wfDlg) { WndListFrame* wndFileList = (WndListFrame*) wfDlg->FindByName(TEXT("frmIgcFileList")); if (wndFileList) { wndFileList->SetBorderKind(BORDERLEFT | BORDERTOP | BORDERRIGHT | BORDERBOTTOM); wndFileList->SetWidth(wfDlg->GetWidth() - wndFileList->GetLeft() - IBLSCALE(4)); // Bug : we need ClientHeight, but Cleint Rect is Calculated by OnPaint // wndFileList->SetHeight(wfDlg->GetHeight() - wndFileList->GetTop() - 2); if (wndFileList->ScrollbarWidth == -1) { wndFileList->ScrollbarWidth = (int) (SCROLLBARWIDTH_INITIAL * ScreenDScale); } WndOwnerDrawFrame* FileListEntry = (WndOwnerDrawFrame*) wfDlg->FindByName(TEXT("frmIgcFileListEntry")); if (FileListEntry) { FileListEntry->SetCanFocus(true); FileListEntry->SetWidth(wndFileList->GetWidth() - wndFileList->ScrollbarWidth - 5); } DlgIgcFile::ScanFile(); wndFileList->ResetList(); wndFileList->Redraw(); } } if (wfDlg->ShowModal()) { } delete wfDlg; wfDlg = NULL; }