Example #1
0
 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();
 }
Example #2
0
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();
  }
}
Example #3
0
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();
}
Example #4
0
    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;
        }
    }
Example #5
0
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;
}
Example #6
0
    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();
            }
        }
    }
Example #7
0
    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();
            }
        }
    }