void dlgTextEntryKeyboardShowModal(TCHAR *text, int width, unsigned ResID)
{
  wf = NULL;
  if (width==0) {
    width = MAX_TEXTENTRY;
  }
  max_width = min(MAX_TEXTENTRY, width);
  wf = dlgLoadFromXML(CallBackTable, ResID);
  if (!wf) return;

 // cursor = _tcslen(text);
  ClearText();

  if (_tcslen(text)>0) {
    CharUpper(text);
    LK_tcsncpy(edittext, text, max_width-1);
    // show previous test.
    // this text is replaced by first key down
    // but used if "OK" is clicked first for don't reset current value.
  }
  cursor = _tcslen(edittext);
  UpdateTextboxProp();

  WindowControl* pBtHelp = wf->FindByName(TEXT("cmdHelp"));
  if(pBtHelp) {
     pBtHelp->SetVisible(wKeyboardPopupWndProperty && wKeyboardPopupWndProperty->HasHelpText());
  }

  wf->SetKeyDownNotify(FormKeyDown);
  wf->ShowModal();
  LK_tcsncpy(text, edittext, max_width-1);
 // cursor = _tcslen(text);
  delete wf;
  wf=NULL;
}
Example #2
0
void dlgProgress::SetProgressText(const TCHAR* szText) {
    WindowControl* wText = _WndForm->FindByName(TEXT("frmText")); 
    if(wText) {
        wText->SetCaption(szText);
        wText->Redraw();
#ifndef USE_GDI
        MainWindow.Refresh();
#endif
    }
}
Example #3
0
/**
 * Loads the color information from the XMLNode and sets the fore- and
 * background color of the given WindowControl
 * @param wc The WindowControl
 * @param node The XMLNode
 */
static void
LoadColors(WindowControl &wc, const XMLNode &node)
{
  Color color;

  if (StringToColor(node.getAttribute(_T("BackColor")), color))
    wc.SetBackColor(color);

  if (StringToColor(node.getAttribute(_T("ForeColor")), color))
    wc.SetForeColor(color);
}
Example #4
0
dlgProgress::dlgProgress() {
    
    _WndForm = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_PROGRESS_L : IDR_XML_PROGRESS_P);
    LKASSERT(_WndForm);
    if(_WndForm) {
        WindowControl* wSplash = _WndForm->FindByName(TEXT("frmSplash")); 
        if(wSplash) {
            wSplash->SetWidth(_WndForm->GetWidth());
        }
        WindowControl* wText = _WndForm->FindByName(TEXT("frmText")); 
        if(wText) {
            wText->SetWidth(_WndForm->GetWidth());
            wText->SetTop(ScreenSizeY - IBLSCALE(35));
        }
        _WndForm->Show();
        _WndForm->Redraw();
    }
}
Example #5
0
    void NextPage(int Step) {
        if( ((CurrentPage+Step) >= 0) && ((CurrentPage+Step) < lstPageWnd.size()) ) {
            lstPageWnd[CurrentPage]->Close();
            CurrentPage+=Step;
            lstPageWnd[CurrentPage]->Show();
            
            WindowControl * pWnd = wfDlg->FindByName(_T("cmdNext"));
            if(pWnd) {
                pWnd->SetVisible(CurrentPage<(lstPageWnd.size()-1));
            }
            pWnd = wfDlg->FindByName(_T("cmdPrev"));
            if(pWnd) {
                pWnd->SetVisible(CurrentPage>0);
            }

            TCHAR szTmp[50] = {0};
            _stprintf(szTmp, _T("BlueFlyVario %d/%d"), CurrentPage+1, lstPageWnd.size());
            wfDlg->SetCaption(szTmp);
        }
    }
Example #6
0
static void SetValues(WndForm* wf) {

  
  WndProperty* wp;
  WndButton *wb;
  TCHAR buffer[80];
  TCHAR buffer2[160]; // must contain buffer

  int bearing;
  int hdist;
  int vdist;

  
  bool inside = false;
  {
    ScopeLock guard(CAirspaceManager::Instance().MutexRef());
    CAirspace* airspace = CAirspaceManager::Instance().GetAirspacesForDetails();
    if(airspace) {
        // Get an object instance copy with actual values
        airspace_copy = CAirspaceManager::Instance().GetAirspaceCopy(airspace);
        inside = CAirspaceManager::Instance().AirspaceCalculateDistance( airspace, &hdist, &bearing, &vdist);
    } else {
        // error : CAirspaceManager are closed ?
        return;
    }
  }
  
  if (wf!=NULL) {
	TCHAR capbuffer[250];
	_stprintf(capbuffer,_T("%s ("),airspace_copy.Name());
        if (airspace_copy.Enabled()) {
        	_tcscat(capbuffer,MsgToken(1643)); // ENABLED
        } else {
        	_tcscat(capbuffer,MsgToken(1600)); // DISABLED
        }
        _tcscat(capbuffer,_T(")")); // DISABLED
	wf->SetCaption(capbuffer);
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpType"));
  if (wp) {
	if (airspace_copy.Flyzone()) {
	  _stprintf(buffer,TEXT("%s %s"), CAirspaceManager::GetAirspaceTypeText(airspace_copy.Type()), TEXT("FLY"));
/*
	  if( _tcsnicmp(  airspace_copy.Name(),   airspace_copy.TypeName() ,_tcslen(airspace_copy.TypeName())) == 0)
		_stprintf(buffer,TEXT("%s"),airspace_copy.Name());
	  else
	    _stprintf(buffer,TEXT("%s %s"),airspace_copy.TypeName()   // fixed strings max. 20
			                          ,airspace_copy.Name());     // NAME_SIZE          30   => max. 30 char
*/
	} else {
	  _stprintf(buffer,TEXT("%s %s"), TEXT("NOFLY"), CAirspaceManager::GetAirspaceTypeText(airspace_copy.Type()));
	}

	wp->SetText( buffer );
//    wp->SetBackColor( airspace_copy.TypeColor());
//	wp->SetForeColor( ContrastTextColor(airspace_copy.TypeColor()));
    wp->RefreshDisplay();
  }
  
  wp = (WndProperty*)wf->FindByName(TEXT("prpTop"));
  if (wp) {
	CAirspaceManager::Instance().GetAirspaceAltText(buffer, sizeof(buffer)/sizeof(buffer[0]), airspace_copy.Top());
    wp->SetText(buffer);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpBase"));
  if (wp) {
	CAirspaceManager::Instance().GetAirspaceAltText(buffer, sizeof(buffer)/sizeof(buffer[0]), airspace_copy.Base());
    wp->SetText(buffer);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpRange"));
  if (wp) {
    Units::FormatUserDistance(abs(hdist), buffer, 20);
    if (inside) {
	  // LKTOKEN  _@M359_ = "Inside" 
      wp->SetCaption(MsgToken(359));
    }
    if (hdist < 0) {
	  // LKTOKEN _@M1257_ "to leave"
	  _stprintf(buffer2, TEXT("%s %d%s %s"), buffer, iround(bearing), MsgToken(2179), MsgToken(1257));
    } else {
	  // LKTOKEN _@M1258_ "to enter"
	  _stprintf(buffer2, TEXT("%s %d%s %s"), buffer, iround(bearing), MsgToken(2179), MsgToken(1258));
	}
    wp->SetText(buffer2);
    wp->RefreshDisplay();
  }


  WindowControl* wDetails = wf->FindByName(TEXT("cmdDetails"));
  {
    ScopeLock guard(CAirspaceManager::Instance().MutexRef());
    CAirspace* airspace = CAirspaceManager::Instance().GetAirspacesForDetails();
  	if(airspace->Comment() != NULL)
  	{
      if(_tcslen(airspace->Comment()) > 10 )    
      {
        WindowControl* wSelect = wf->FindByName(TEXT("cmdSelect"));
        if(wSelect) {
          wSelect->SetLeft(IBLSCALE(155));
          wSelect->SetWidth(IBLSCALE(80));
        }

        wDetails->SetLeft(IBLSCALE(80));
        wDetails->SetWidth(IBLSCALE(75));
        wDetails->Enable(true);
      }
      else wDetails->Enable(false);
    }
  }

#ifdef  RADIO_ACTIVE

  WindowControl* wFreq = wf->FindByName(TEXT("cmdSFrequency"));
  if (wFreq) {
    bool bRadio = false;

    if(RadioPara.Enabled) {

	  double fASFrequency = ExtractFrequency((TCHAR*)airspace_copy.Name());
	  if(!ValidFrequency(fASFrequency))
	  {
		fASFrequency = ExtractFrequency((TCHAR*)airspace_copy.Comment());
	  }
	  
      if(ValidFrequency(fASFrequency)) {

        WindowControl* wClose = wf->FindByName(TEXT("cmdClose"));
        if(wClose) {
          wClose->SetLeft(IBLSCALE(115));
          wClose->SetWidth(IBLSCALE(120));
        }

        wFreq->SetLeft(IBLSCALE(3));
        wFreq->SetWidth(IBLSCALE(110));

        _stprintf(buffer2,_T("%7.3fMHz"),fASFrequency);
        wFreq->SetCaption(buffer2);
        wFreq->Redraw();
        bRadio = true;
      }
    }
    wFreq->SetVisible(bRadio);
  }

#else
  WndProperty* wFreq = wf->FindByName(TEXT("cmdSFrequency"));
  if (wFreq) {
    wFreq->Hide();
  }
#endif  // RADIO_ACTIVE        
  // ONLY for DIAGNOSTICS- ENABLE ALSO XML
  #if 0
  wp = (WndProperty*)wf->FindByName(TEXT("prpWarnLevel"));
  if (wp) {
	  switch (airspace_copy.WarningLevel()) {
		default:
		  // LKTOKEN _@M765_ "Unknown"
		  wp->SetText(MsgToken(765));
		  break;
		  
		case awNone:
		  // LKTOKEN _@M479_ "None"
  		  wp->SetText(MsgToken(479));
		  break;

		case awYellow:
			// LKTOKEN _@M1255_ "YELLOW WARNING"
			wp->SetText(MsgToken(1255));
		  break;
		
		case awRed:
			// LKTOKEN _@M1256_ "RED WARNING"
			wp->SetText(MsgToken(1256));
		  break;
	  }//sw
	  wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAckLevel"));
  if (wp) {
      if (airspace_copy.Enabled()) {
        switch (airspace_copy.WarningAckLevel()) {
          default:
            // LKTOKEN _@M765_ "Unknown"
            wp->SetText(MsgToken(765));
            break;
            
          case awNone:
            // LKTOKEN _@M479_ "None"
            wp->SetText(MsgToken(479));
            break;

          case awYellow:
              // LKTOKEN _@M1267_ "Yellow acknowledged"
              wp->SetText(MsgToken(1267));
            break;
          
          case awRed:
              // LKTOKEN _@M1268_ "Red acknowledged"
              wp->SetText(MsgToken(1268));
            break;

        }//sw
      } else {
          // LKTOKEN _@M1269_ "Disabled"
          wp->SetText(MsgToken(1269));
      }
	  wp->RefreshDisplay();
  }
  #endif

  wb = (WndButton*)wf->FindByName(TEXT("cmdFly"));
  if (wb) {
	if (airspace_copy.Flyzone()) {
	  // LKTOKEN _@M1271_ "NOFLY"
	  wb->SetCaption(MsgToken(1271));
	} else {
	  // LKTOKEN _@M1270_ "FLY"
	  wb->SetCaption(MsgToken(1270));
	}
	wb->Redraw();
  }

  wb = (WndButton*)wf->FindByName(TEXT("cmdSelect"));
  if (wb) {
	if (airspace_copy.Selected()) {
	  wb->SetCaption(MsgToken(1656)); // SELECTED!
	} else {
	  wb->SetCaption(MsgToken(1654)); // SELECT
	}
	wb->Redraw();
  }

  wb = (WndButton*)wf->FindByName(TEXT("cmdAcknowledge"));
  if (wb) {
    if (airspace_copy.Enabled()) {
      // LKTOKEN _@M1283_ "Disable"
      wb->SetCaption(MsgToken(1283));
    } else {
      // LKTOKEN _@M1282_ "Enable"
      wb->SetCaption(MsgToken(1282));
    }
    wb->Redraw();
  }

}
Example #7
0
static void SetWaypointValues(bool first=false) {
  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATType"));
  if (wp) {
    DataField* dfe = wp->GetDataField();
    if (first) {
	// LKTOKEN  _@M210_ = "Cylinder" 
      dfe->addEnumText(MsgToken(210));
	// LKTOKEN  _@M590_ = "Sector" 
      dfe->addEnumText(MsgToken(590));
      if(DoOptimizeRoute()) {
        // Conical ESS
        dfe->addEnumText(MsgToken(2175));
        // Circle ESS
        dfe->addEnumText(MsgToken(2189));
      }
    }
    dfe->SetDetachGUI(true); // disable call to OnAATEnabled
    dfe->Set(Task[twItemIndex].AATType);
    dfe->SetDetachGUI(false);
    wp->RefreshDisplay();
  }

  WindowControl* pFrm = wf->FindByName(_T("frmCircle"));
  if(pFrm) {
    pFrm->SetVisible((Task[twItemIndex].AATType==0) || (Task[twItemIndex].AATType==3));
  }
  pFrm = wf->FindByName(_T("frmSector"));
  if(pFrm) {
    pFrm->SetVisible(Task[twItemIndex].AATType==1);
  }
  pFrm = wf->FindByName(_T("frmCone"));
  if(pFrm) {
    pFrm->SetVisible(Task[twItemIndex].AATType==2);
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATCircleRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(round(Task[twItemIndex].AATCircleRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATSectorRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(round(Task[twItemIndex].AATSectorRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->RefreshDisplay();    
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATStartRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Task[twItemIndex].AATStartRadial);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATFinishRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Task[twItemIndex].AATFinishRadial);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpOutCircle"));
  if (wp) {
	  DataField* dfe = wp->GetDataField();
	  if (dfe) {
		  if (first) {
			  // LKTOKEN  _@M2226_ = "Enter" 
			  dfe->addEnumText(MsgToken(2145));
			  // LKTOKEN  _@M2227_ = "Exit" 
			  dfe->addEnumText(MsgToken(2146));
		  }
		  dfe->Set(Task[twItemIndex].OutCircle);
	  }
	  wp->SetVisible(DoOptimizeRoute());
	  wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConeSlope"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Task[twItemIndex].PGConeSlope);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpConeBase"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Task[twItemIndex].PGConeBase*ALTITUDEMODIFY);
    wp->GetDataField()->SetUnits(Units::GetAltitudeName());
    wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpConeRadius"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(round(Task[twItemIndex].PGConeBaseRadius
                                          *DISTANCEMODIFY*DISTANCE_ROUNDING)/DISTANCE_ROUNDING);
    wp->GetDataField()->SetUnits(Units::GetDistanceName());
    wp->RefreshDisplay();
  }
  
}
Example #8
0
int dlgComboPicker(WndProperty* theProperty){

  static bool bInComboPicker=false;
  bool bInitialPage=true;
  bool bOpenCombo=true; // used to exit loop (optionally reruns combo with 
                        //lower/higher index of items for int/float

  if (bInComboPicker) // prevents multiple instances
    return 0;
  else
    bInComboPicker=true;

  while (bOpenCombo)
  {
    LKASSERT(theProperty!=NULL);
    wComboPopupWndProperty = theProperty;

    wf = dlgLoadFromXML(CallBackTable, 
                          ScreenLandscape ? TEXT("dlgComboPicker_L.xml") : TEXT("dlgComboPicker_P.xml"),
                          ScreenLandscape ? IDR_XML_COMBOPICKER_L : IDR_XML_COMBOPICKER_P);

    if (!wf) return -1;

    wf->SetCaption(theProperty->GetCaption());

    wComboPopupListFrame = (WndListFrame*)wf->FindByName(TEXT("frmComboPopupList"));
    LKASSERT(wComboPopupListFrame!=NULL);
    wComboPopupListFrame->SetBorderKind(BORDERLEFT | BORDERTOP | BORDERRIGHT|BORDERBOTTOM);
    wComboPopupListFrame->SetEnterCallback(OnComboPopupListEnter);

    // allow item to be focused / hightlighted
    wComboPopupListEntry = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmComboPopupListEntry"));
    LKASSERT(wComboPopupListEntry!=NULL);
    wComboPopupListEntry->SetCanFocus(true);

    ComboPopupDataField = wComboPopupWndProperty->GetDataField();
    ComboListPopup = ComboPopupDataField->GetCombo();
    LKASSERT(ComboPopupDataField!=NULL);

    ComboPopupDataField->CreateComboList();
    wComboPopupListFrame->ResetList();
    wComboPopupListFrame->SetItemIndex(ComboListPopup->ComboPopupItemSavedIndex);
    if (bInitialPage) { // save values for "Cancel" from first page only
      bInitialPage=false;
      iSavedInitialDataIndex=ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupItemSavedIndex]->DataFieldIndex;
      ComboPopupDataField->CopyString(sSavedInitialValue,false);
    }
   
    WindowControl* pBtHelp = wf->FindByName(TEXT("cmdHelp"));
    if(pBtHelp) {
       pBtHelp->SetVisible(wComboPopupWndProperty->HasHelpText());
    }

    wf->ShowModal();

    bOpenCombo=false;  //tell  combo to exit loop after close

    if (ComboListPopup->ComboPopupItemIndex >=0) // OK/Select
    {
      #if 0
      ComboPopupDataField->GetCombo()->LastModalResult=1; // OK Hit Used then calling via SendMessage()
      #endif

      if (ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupItemIndex]->DataFieldIndex
                          ==ComboPopupReopenMOREDataIndex)
      { // we're last in list and the want more past end of list so select last real list item and reopen
        ComboPopupDataField->SetDetachGUI(true);  // we'll reopen, so don't call xcsoar data changed routine yet
        ComboListPopup->ComboPopupItemIndex--;
        bOpenCombo=true; // reopen combo with new selected index at center
      }
      else if (ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupItemIndex]->DataFieldIndex
                          ==ComboPopupReopenLESSDataIndex) // same as above but lower items needed
      { 
        ComboPopupDataField->SetDetachGUI(true); 
        ComboListPopup->ComboPopupItemIndex++;
        bOpenCombo=true; 
      }
      int iDataIndex = ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupItemIndex]->DataFieldIndex;
      ComboPopupDataField->SetFromCombo(iDataIndex, 
        ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupItemIndex]->StringValue);
    }
    else // Cancel
    { // if we've detached the GUI during the load, then there is nothing to do here
      #if 0
      ComboPopupDataField->GetCombo()->LastModalResult=0; // Cancel Hit.  Used then calling via SendMessage()
      #endif
      // NOTE 130206 : we are missing currently the Cancel return status .
      // The list selection does not return the Cancel button status, because so far we have been setting an empty
      // value on entry, and we check on exit if it is still empty. In such case, a no/action is performed, either
      // because the user did not select anything with Select (click on empty field at the top) or because he really
      // clicked on Cancel and we returned again the initial empty value.
      // BUT, in some cases, like on TaskOverview, we set the initial item of the list to Default.task, 
      // and in this case a Cancel will return correctly Default.tsk!
      // This is why we get the confirmation message for loading default task, instead of a quiet return.
      // Solution: either use a WindowControl variable, or a more simple global for ComboCancel.
      // This would be an hack, but quick and dirty solution with no disde effects.
      // Set ComboCancel true if we are here, otherwise false, and check that after 
      // dfe = (DataFieldFileReader*) wp->GetDataField()
      // If ever we want to manage this Cancel button correctly, we should use one of these approaches.

      LKASSERT(iSavedInitialDataIndex >=0);
      if (iSavedInitialDataIndex >=0) {
        ComboPopupDataField->SetFromCombo(iSavedInitialDataIndex, sSavedInitialValue);
      }
    }


    wComboPopupWndProperty->RefreshDisplay();
    ComboListPopup->FreeComboPopupItemList();

    delete wf;

    wf = NULL;

  } // loop reopen combo if <<More>> << LESS>> picked

  bInComboPicker=false;
  return 1;  

}
Example #9
0
// Will return 0 if cancel or error, 1 if details needed, 2 if goto, 3 if alt1, 4 if alt2
short dlgWayQuickShowModal(void){

  TCHAR sTmp[128];

  wf = dlgLoadFromXML(CallBackTable, 
            ScreenLandscape ? TEXT("dlgWayQuick_L.xml") : TEXT("dlgWayQuick_P.xml"),
            ScreenLandscape ? IDR_XML_WAYPOINTQUICK_L : IDR_XML_WAYPOINTQUICK_P);

  if (!wf) return 0;

  retStatus=0;
  if (WPLSEL.Format == LKW_CUP) {
        TCHAR ttmp[50];
        // and it is landable
        if ((WPLSEL.Style>1) && (WPLSEL.Style<6) ) {

                _stprintf(sTmp, TEXT("%s "), WPLSEL.Name);
		if (_tcslen(sTmp)>9) {
			sTmp[9]='\0';
			_tcscat(sTmp, _T(" "));
		}

                if ( _tcslen(WPLSEL.Freq)>0 )  {
                        _stprintf(ttmp,_T("%s "),WPLSEL.Freq);
                        _tcscat(sTmp, ttmp);
                }

                if ( WPLSEL.RunwayDir>=0 )  {
                        _stprintf(ttmp,_T("RW %d "),WPLSEL.RunwayDir);
                        _tcscat(sTmp, ttmp);
                }
                if ( WPLSEL.RunwayLen>0 )  {
                        // we use Altitude instead of distance, to keep meters and feet
                        _stprintf(ttmp,_T("%.0f%s"),Units::ToUserAltitude((double)WPLSEL.RunwayLen), Units::GetAltitudeName());
                        _tcscat(sTmp, ttmp);
                }

        } else {
		_stprintf(sTmp, _T(" %s"),WayPointList[SelectedWaypoint].Name);
        }
  } else {
	_stprintf(sTmp, _T(" %s"),WayPointList[SelectedWaypoint].Name);
  }
  wf->SetCaption(sTmp);

#ifdef RADIO_ACTIVE
    const bool bRadioFreq = (_tcstol(WayPointList[SelectedWaypoint].Freq, nullptr, 10) > 0) && RadioPara.Enabled;
#else
    const bool bRadioFreq = false;
#endif // RADIO_ACTIVE       
  
  if (ScreenLandscape) {
    PixelScalar left = 0;
    WindowControl* pWnd = wf->FindByName(TEXT("cmdGoto"));
    if(pWnd) {
      left = pWnd->GetLeft();
      pWnd->SetWidth(ScreenSizeX-NIBLSCALE(5)-left);
    }

	pWnd = wf->FindByName(TEXT("cmdSetAlt1"));
    if(pWnd) {
      pWnd->SetWidth((ScreenSizeX/2)-NIBLSCALE(5));
	  pWnd->SetLeft(NIBLSCALE(3));
    }

	pWnd = wf->FindByName(TEXT("cmdSetAlt2"));
    if(pWnd) {
      pWnd->SetWidth((ScreenSizeX/2)-NIBLSCALE(7));
	  pWnd->SetLeft((ScreenSizeX/2)+NIBLSCALE(2));
    }
	pWnd = wf->FindByName(TEXT("cmdDetails"));
    if(pWnd) {
      pWnd->SetWidth((ScreenSizeX/2)-NIBLSCALE(5));
	  pWnd->SetLeft(NIBLSCALE(3));
    }
	pWnd = wf->FindByName(TEXT("cmdTask"));
    if(pWnd) {
      pWnd->SetWidth((ScreenSizeX/2)-NIBLSCALE(7));
	  pWnd->SetLeft((ScreenSizeX/2)+NIBLSCALE(2));
    }

	if(bRadioFreq) {
	  pWnd = wf->FindByName(TEXT("cmdCancel"));
      if(pWnd) {
        pWnd->SetLeft(NIBLSCALE(3));
	    pWnd->SetWidth((ScreenSizeX/2)-NIBLSCALE(5));
      }

	  pWnd = wf->FindByName(TEXT("cmdRadioFreq"));
      if(pWnd) {
        pWnd->SetWidth((ScreenSizeX/2)-NIBLSCALE(7));
	    pWnd->SetLeft((ScreenSizeX/2)+NIBLSCALE(2));
      }
	} else {
      pWnd = wf->FindByName(TEXT("cmdCancel"));
      if(pWnd) {
        pWnd->SetLeft(NIBLSCALE(3));
        pWnd->SetWidth((ScreenSizeX)-NIBLSCALE(8));
      }

	  pWnd = wf->FindByName(TEXT("cmdRadioFreq"));
      if(pWnd) {
        pWnd->SetVisible(false);
	  }
    }
  } else {
	if(bRadioFreq) {
#warning "TODO : don't work on 4/3 Portrait mode"
    } else {
      WindowControl* pWndCancel = wf->FindByName(TEXT("cmdCancel"));
      WindowControl* pWndFreq = wf->FindByName(TEXT("cmdRadioFreq"));
      if(pWndCancel && pWndFreq) {
        pWndCancel->SetTop(pWndFreq->GetTop());
      }
      if(pWndFreq) {
          pWndFreq->SetVisible(false);
      }
    }
  } 

  wf->ShowModal();

  delete wf;

  wf = NULL;

  return retStatus;

}
Example #10
0
static void RefreshCalculator(void) {
  WndProperty* wp;

  RefreshTask();
  RefreshTaskStatistics();
  target_point = max(target_point,ActiveWayPoint);

  bool nodisplay = !AATEnabled 
    || (target_point==0) 
    || !ValidTaskPoint(target_point+1);

  if (btnMove) {
    if (nodisplay) {
      btnMove->SetVisible(false);
      TargetMoveMode = false;
    } else {
      btnMove->SetVisible(true);
    }
  } 

  nodisplay = nodisplay || TargetMoveMode;

  wp = (WndProperty*)wf->FindByName(TEXT("prpTaskPoint"));
  if (wp) {
    if (TargetMoveMode) {
      wp->SetVisible(false);
    } else {
      wp->SetVisible(true);
    }
  }

  WindowControl* wc = (WindowControl*)wf->FindByName(TEXT("btnOK"));
  if (wc) {
    if (TargetMoveMode) {
      wc->SetVisible(false);
    } else {
      wc->SetVisible(true);
    }
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpAATTargetLocked"));
  if (wp) {
    wp->GetDataField()->Set(Task[target_point].AATTargetLocked);
    wp->RefreshDisplay();
    if (nodisplay) {
      wp->SetVisible(false);
    } else {
      wp->SetVisible(true);
    }
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpRange"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Range*100.0);
    wp->RefreshDisplay();
    if (nodisplay) {
      wp->SetVisible(false);
    } else {
      wp->SetVisible(true);
    }
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpRadial"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Radial);
    wp->RefreshDisplay();
    if (nodisplay) {
      wp->SetVisible(false);
    } else {
      wp->SetVisible(true);
    }
  }

  // update outputs
  double dd = CALCULATED_INFO.TaskTimeToGo;
  if ((CALCULATED_INFO.TaskStartTime>0.0)&&(CALCULATED_INFO.Flying)) {
    dd += GPS_INFO.Time-CALCULATED_INFO.TaskStartTime;
  }
  dd= min(24.0*60.0,dd/60.0);
  wp = (WndProperty*)wf->FindByName(TEXT("prpAATEst"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(dd);
    wp->RefreshDisplay();
  }
  wp = (WndProperty*)wf->FindByName(TEXT("prpAATDelta"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(dd-AATTaskLength);
    if (AATEnabled) {
      wp->SetVisible(true);
    } else {
      wp->SetVisible(false);
    }
    wp->RefreshDisplay();
  }

  double v1;
  if (CALCULATED_INFO.TaskTimeToGo>0) {
    v1 = CALCULATED_INFO.TaskDistanceToGo/
      CALCULATED_INFO.TaskTimeToGo;
  } else {
    v1 = 0;
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpSpeedRemaining"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(v1*TASKSPEEDMODIFY);
    wp->GetDataField()->SetUnits(Units::GetTaskSpeedName());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpSpeedAchieved"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(CALCULATED_INFO.TaskSpeed*TASKSPEEDMODIFY);
    wp->GetDataField()->SetUnits(Units::GetTaskSpeedName());
    wp->RefreshDisplay();
  }

}
Example #11
0
short dlgStartupShowModal(void) {
    WndProperty* wp = nullptr;

#if TESTBENCH
    StartupStore(TEXT(". Startup dialog, RUN_MODE=%d %s"), RUN_MODE, NEWLINE);
#endif

    switch(RUN_MODE) {
        case RUN_WELCOME: // FLY SIM PROFILE EXIT
            wf = InitFlySim();
            break;
        case RUN_DUALPROF: //  PROFILE AIRCRAFT  CLOSE
            wf = InitDualProfile();
            break;
        case RUN_PROFILE:
        case RUN_AIRCRAFT:
        case RUN_PILOT:
        case RUN_DEVICE:
            // CHOOSE PROFILE
            wf = InitStartup(RUN_MODE);
            break;
    }
    if (!wf) {
        return 0;
    }

    wf->SetHeight(ScreenSizeY);
    wf->SetWidth(ScreenSizeX);

    WindowControl* wSplash = wf->FindByName(TEXT("frmSplash"));
    if(wSplash) {
        wSplash->SetWidth(ScreenSizeX);
        // wSplash->SetHeight(ScreenSizeY);// - IBLSCALE(55));
    }




    if (!CheckRootDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];

        LocalPath(mydir, _T(""));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("NO LK8000 DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 000"), mbOk);
        MessageBoxX(mes, _T("NO LK8000 DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    if (!CheckDataDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];

        SystemPath(mydir, _T(LKD_SYSTEM));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("NO SYSTEM DIRECTORY\nCheck Installation!"), _T("FATAL ERROR 001"), mbOk);
        MessageBoxX(mes, _T("NO SYSTEM DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    if (!CheckLanguageDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK LANGUAGE DIRECTORY FAILED!%s"), NEWLINE);

        LocalPath(mydir, _T(LKD_LANGUAGE));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("LANGUAGE DIRECTORY CHECK FAIL\nCheck Language Install"), _T("FATAL ERROR 002"), mbOk);
        MessageBoxX(mes, _T("NO LANGUAGE DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }
    if (!CheckLanguageEngMsg()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK LANGUAGE ENG_MSG FAILED!%s"), NEWLINE);
        LocalPath(mydir, _T(LKD_LANGUAGE));
        _stprintf(mes, _T("%s/ENG_MSG.TXT"), mydir);
        MessageBoxX(_T("ENG_MSG.TXT MISSING in LANGUAGE\nCheck Language Install"), _T("FATAL ERROR 012"), mbOk);
        MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }
    if (!CheckSystemDefaultMenu()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK SYSTEM DEFAULT_MENU.TXT FAILED!%s"), NEWLINE);
        SystemPath(mydir, _T(LKD_SYSTEM));
        _stprintf(mes, _T("%s/DEFAULT_MENU.TXT"), mydir);
        MessageBoxX(_T("DEFAULT_MENU.TXT MISSING in SYSTEM\nCheck System Install"), _T("FATAL ERROR 022"), mbOk);
        MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    if (!CheckSystemBitmaps()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK SYSTEM _BITMAPSH FAILED!%s"), NEWLINE);
        SystemPath(mydir, _T(LKD_BITMAPS));
        _stprintf(mes, _T("%s/_BITMAPSH"), mydir);
        MessageBoxX(_T("_BITMAPSH MISSING in SYSTEM Bitmaps\nCheck System Install"), _T("FATAL ERROR 032"), mbOk);
        MessageBoxX(mes, _T("MISSING FILE!"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    extern unsigned short Bitmaps_Errors;
    if (Bitmaps_Errors) {
        TCHAR mes[MAX_PATH];
        _stprintf(mes, _T("MISSING %d SYSTEM BITMAPS! CHECK INSTALLATION."), Bitmaps_Errors);
        MessageBoxX(mes, _T("MISSING FILES!"), mbOk, true);
    }

    if (!CheckPolarsDir()) {
        TCHAR mydir[MAX_PATH];
        TCHAR mes[MAX_PATH];
        StartupStore(_T("... CHECK POLARS DIRECTORY FAILED!%s"), NEWLINE);

        LocalPath(mydir, _T(LKD_POLARS));
        _stprintf(mes, _T("%s"), mydir);
        MessageBoxX(_T("NO POLARS DIRECTORY\nCheck Install"), _T("FATAL ERROR 003"), mbOk);
        MessageBoxX(mes, _T("NO POLARS DIRECTORY"), mbOk, true);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }

    extern bool CheckFilesystemWritable(void);
    if (!CheckFilesystemWritable()) {
        MessageBoxX(_T("LK8000 CANNOT WRITE IN MEMORY CARD!\nCARD IS LOCKED, OR DAMAGED, OR FULL."), _T("CRITICAL PROBLEM"), mbOk);
        RUN_MODE = RUN_EXIT;
        Shutdown();
        goto _exit;
    }



    // Standby for a system request to close the application during this phase.
    wf->SetTimerNotify(500, OnTimerNotify);
    if (wf->ShowModal() == mrCancel) {
        RUN_MODE = RUN_EXIT;
    }
    if (RUN_MODE == RUN_SHUTDOWN) goto _exit;

    wp = (WndProperty*) wf->FindByName(TEXT("prpProfile"));
    if (wp) {
        DataFieldFileReader* dfe = (DataFieldFileReader*) wp->GetDataField();

        if (RUN_MODE == RUN_PROFILE) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startProfileFile)) { // if they are not the same
                    _tcscpy(startProfileFile, dfe->GetPathFile());
                    if (_tcscmp(startProfileFile, _T("PROFILE_RESET")) == 0) {
#if TESTBENCH
                        StartupStore(_T("... Selected FULL RESET virtual profile\n"));
#endif
                        MessageBoxX(MsgToken(1758), MsgToken(1757), mbOk);
                        FullResetAsked = true;
                    } else {
#if TESTBENCH
                        StartupStore(_T("... Selected new profile, preloading..\n"));
#endif
                        FullResetAsked = false;
                    }
                }
            }
        }
        if (RUN_MODE == RUN_AIRCRAFT) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startAircraftFile)) { // if they are not the same
                    _tcscpy(startAircraftFile, dfe->GetPathFile());
#if TESTBENCH
                    StartupStore(_T("... Selected new aircraft, preloading..\n"));
#endif
                }
            }
        }
        if (RUN_MODE == RUN_DEVICE) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startDeviceFile)) { // if they are not the same
                    _tcscpy(startDeviceFile, dfe->GetPathFile());
#if TESTBENCH
                    StartupStore(_T("... Selected new device, preloading..\n"));
#endif
                }
            }
        }
        if (RUN_MODE == RUN_PILOT) {
            if (_tcslen(dfe->GetPathFile()) > 0) {
                if (_tcscmp(dfe->GetPathFile(), startPilotFile)) { // if they are not the same
                    _tcscpy(startPilotFile, dfe->GetPathFile());
#if TESTBENCH
                    StartupStore(_T("... Selected new pilot, preloading..\n"));
#endif
                }
            }
        }
        RUN_MODE = RUN_DUALPROF;
    }
    if (RUN_MODE == RUN_EXIT) {
#if __linux__
        RUN_MODE = RUN_WELCOME;
#endif
        LKSound(_T("LK_SLIDE.WAV"));
        if (MessageBoxX(
                // LKTOKEN  _@M198_ = "Confirm Exit?"
                MsgToken(198),
                TEXT("LK8000"), mbYesNo) == IdYes) {
            Shutdown();
        } else {
            RUN_MODE = RUN_WELCOME;
        }
    }


_exit:
    if (wf != NULL) {
        delete wf;
        wf = NULL;
    }

    StartBitmap.Release();
    ProfileBitmap.Release();


    if (RUN_MODE == RUN_FLY || RUN_MODE == RUN_SIM) {
        LKSound(_T("LK_SLIDE.WAV"));
        return 0; // do not repeat dialog
    }

    if (RUN_MODE == RUN_EXIT || RUN_MODE == RUN_SHUTDOWN)
        return -1; // terminate
    else
        return 1; // repeat dialog

}
Example #12
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;
}
Example #13
0
static WndForm* InitDualProfile() {

    WndForm* pWndForm = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_DUALPROFILE_L : IDR_XML_DUALPROFILE_P);

    if(pWndForm) {
        WindowControl * pWnd = nullptr;

        if (ScreenLandscape) {

            const unsigned int SPACEBORDER = NIBLSCALE(2);

            const unsigned w =  (ScreenSizeX - (SPACEBORDER * 6)) / 5;

            int lx = SPACEBORDER - 1; // count from 0
            pWnd = pWndForm->FindByName(TEXT("cmdAIRCRAFT"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdPROFILE"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdDEVICE"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdPILOT"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdCLOSE"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
            }

        } else {
            const unsigned SPACEBORDER = NIBLSCALE(2);
            unsigned w = (ScreenSizeX - (SPACEBORDER * 3)) / 2;
            int h = ScreenSizeY - IBLSCALE(90); // 40+5+40+5

            int lx = SPACEBORDER - 1; // count from 0
            pWnd = pWndForm->FindByName(TEXT("cmdAIRCRAFT"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
                pWnd->SetTop(h);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdPROFILE"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
                pWnd->SetTop(h);
            }

            w = (ScreenSizeX - (SPACEBORDER * 4)) / 3;
            lx = SPACEBORDER - 1; // count from 0
            pWnd = pWndForm->FindByName(TEXT("cmdDEVICE"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
                pWnd->SetTop(h + IBLSCALE(45));
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdPILOT"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
                pWnd->SetTop(h + IBLSCALE(45));
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdCLOSE"));
            if(pWnd) {
                pWnd->SetLeft(lx);
                pWnd->SetWidth(w);
                pWnd->SetTop(h + IBLSCALE(45));
            }
        }
    }
    return pWndForm;
}
Example #14
0
static WndForm* InitFlySim() {

    WndForm* pWndForm = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_FLYSIM_L : IDR_XML_FLYSIM_P);
    if(pWndForm) {

        WindowControl * pWnd = nullptr;

        if (ScreenLandscape) {

#ifdef KOBO
            const unsigned int SPACEBORDER = 1;
            const unsigned int w = (ScreenSizeX - (SPACEBORDER * 6)) / 5;
#else
            const unsigned int SPACEBORDER = NIBLSCALE(2);
            const unsigned int w = (ScreenSizeX - (SPACEBORDER * 5)) / 4;
#endif
            unsigned int lx = SPACEBORDER - 1; // count from 0

            pWnd = pWndForm->FindByName(TEXT("cmdFLY"));
            if(pWnd) {
                pWnd->SetWidth(w);
                pWnd->SetLeft(lx);
            }

#ifdef KOBO
            lx += w + SPACEBORDER;
            WndButton* pWndNickel = new WndButton(pWndForm, _T("cmdNICKEL"), _T("KOBO"), lx , IBLSCALE(205), w, IBLSCALE(30), &OnNickelClick );
            if(pWndNickel) {

            }
#endif
            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdDUALPROFILE"));
            if(pWnd) {
                pWnd->SetWidth(w);
                pWnd->SetLeft(lx);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdEXIT"));
            if(pWnd) {
                pWnd->SetWidth(w);
                pWnd->SetLeft(lx);
#ifdef KOBO
                pWnd->SetCaption(MsgToken(1901)); // POWER OFF
#endif
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdSIM"));
            if(pWnd) {
                pWnd->SetWidth(w);
                pWnd->SetLeft(lx);
            }
        } else {
            const unsigned SPACEBORDER = NIBLSCALE(2);
            unsigned w = (ScreenSizeX - (SPACEBORDER * 3)) / 2;
            int h = ScreenSizeY - IBLSCALE(90); // 40+5+40+5

            int lx = SPACEBORDER - 1; // count from 0
            pWnd = pWndForm->FindByName(TEXT("cmdFLY"));
            if(pWnd) {
                pWnd->SetTop(h + IBLSCALE(45));
                pWnd->SetLeft(lx);
                pWnd->SetHeight(IBLSCALE(40));
                pWnd->SetWidth(w);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdSIM"));
            if(pWnd) {
                pWnd->SetTop(h + IBLSCALE(45));
                pWnd->SetLeft(lx);
                pWnd->SetHeight(IBLSCALE(40));
                pWnd->SetWidth(w);
            }


#ifdef KOBO
            lx = SPACEBORDER - 1; // count from 0

            WndButton* pWndNickel = new WndButton(pWndForm, _T("cmdNICKEL"), _T("KOBO"), lx , h, w, IBLSCALE(40), &OnNickelClick );
            if(pWndNickel) {
                w = (ScreenSizeX - (SPACEBORDER * 4)) / 3;
                pWndNickel->SetTop(h);
                pWndNickel->SetLeft(lx);
                pWndNickel->SetHeight(IBLSCALE(40));
                pWndNickel->SetWidth(w);
            }

            lx += w + SPACEBORDER;
#else
            lx = SPACEBORDER - 1; // count from 0
#endif
            pWnd = pWndForm->FindByName(TEXT("cmdDUALPROFILE"));
            if(pWnd) {
                pWnd->SetTop(h);
                pWnd->SetLeft(lx);
                pWnd->SetHeight(IBLSCALE(40));
                pWnd->SetWidth(w);
            }

            lx += w + SPACEBORDER;
            pWnd = pWndForm->FindByName(TEXT("cmdEXIT"));
            if(pWnd) {
                pWnd->SetTop(h);
                pWnd->SetLeft(lx);
                pWnd->SetHeight(IBLSCALE(40));
                pWnd->SetWidth(w);
#ifdef KOBO
                pWnd->SetCaption(MsgToken(1901)); // POWER OFF
#endif
            }
        }
    }
    return pWndForm;
}