Пример #1
0
static WndForm* InitStartup(BYTE mode) {
    WndForm * pWndForm = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_STARTUP_L : IDR_XML_STARTUP_P);
    if(pWndForm) {

        WindowControl * pWndClose = pWndForm->FindByName(TEXT("cmdClose"));
        WndProperty* pWndProfile = static_cast<WndProperty*>(pWndForm->FindByName(TEXT("prpProfile")));

        if (ScreenLandscape) {
            const int PROFWIDTH = IBLSCALE(256);
            const int PROFACCEPTWIDTH = NIBLSCALE(60);
            const int PROFHEIGHT = NIBLSCALE(30);
            const int PROFSEPARATOR = NIBLSCALE(4);

            if(pWndClose) {
                pWndClose->SetWidth(PROFACCEPTWIDTH);
                pWndClose->SetLeft((((ScreenSizeX - PROFWIDTH - PROFSEPARATOR - PROFACCEPTWIDTH) / 2) + PROFSEPARATOR + PROFWIDTH) - NIBLSCALE(2));
                pWndClose->SetHeight(PROFHEIGHT - NIBLSCALE(4));
            }

            if(pWndProfile) {
                pWndProfile->SetLeft(((ScreenSizeX - PROFWIDTH - PROFSEPARATOR - PROFACCEPTWIDTH) / 2) - NIBLSCALE(2));
                pWndProfile->SetHeight(PROFHEIGHT);
                pWndProfile->SetWidth(PROFWIDTH);
            }


        } else {
            const int PROFWIDTH = IBLSCALE(236);
            const int PROFHEIGHT = NIBLSCALE(25);
            int h = ScreenSizeY - IBLSCALE(65); //

            if(pWndClose) {
                pWndClose->SetWidth(ScreenSizeX - NIBLSCALE(6));
                pWndClose->SetLeft(NIBLSCALE(2));
                pWndClose->SetTop(h);
            }
            if(pWndProfile) {
                pWndProfile->SetTop(h + IBLSCALE(35));
                pWndProfile->SetLeft(0);
                pWndProfile->SetHeight(PROFHEIGHT);
                pWndProfile->SetWidth(PROFWIDTH);
            }

        }
        //
        // File selection shared  by PROFILEs choices
        //
        if (pWndProfile) {
            DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(pWndProfile->GetDataField());
            if(dfe) {
                if (mode == RUN_PROFILE) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_PRF));
                    dfe->addFile(MsgToken(1741), _T("PROFILE_RESET"));
                    dfe->Lookup(startProfileFile);

                } else if (mode == RUN_AIRCRAFT) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_AIRCRAFT));
                    dfe->Lookup(startAircraftFile);

                } else if (mode == RUN_DEVICE) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_DEVICE));
                    dfe->Lookup(startDeviceFile);

                } else if (mode == RUN_PILOT) {
                    dfe->ScanDirectoryTop(_T(LKD_CONF), _T("*" LKS_PILOT));
                    dfe->Lookup(startPilotFile);
                }
            }
            pWndProfile->RefreshDisplay();
        }

    }
    return pWndForm;
}