예제 #1
0
void
LayoutConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  const UISettings &ui_settings = CommonInterface::GetUISettings();

  RowFormWidget::Prepare(parent, rc);

  if (Display::RotateSupported())
    AddEnum(_("Display orientation"), _("Rotate the display on devices that support it."),
            display_orientation_list, (unsigned)ui_settings.display.orientation);
  else
    AddDummy();

  AddEnum(_("InfoBox geometry"),
          _("A list of possible InfoBox layouts. Do some trials to find the best for your screen size."),
          info_box_geometry_list, (unsigned)ui_settings.info_boxes.geometry);

  AddEnum(_("FLARM display"), _("Choose a location for the FLARM display."),
          flarm_display_location_list,
          (unsigned)ui_settings.traffic.gauge_location);
  SetExpertRow(AppFlarmLocation);

  AddEnum(_("Tab dialog style"), nullptr,
          tabdialog_style_list, (unsigned)ui_settings.dialog.tab_style);

  AddEnum(_("Message display"), nullptr,
          popup_msg_position_list,
          (unsigned)ui_settings.popup_message_position);
  SetExpertRow(AppStatusMessageAlignment);

  AddBoolean(_("Inverse InfoBoxes"), _("If true, the InfoBoxes are white on black, otherwise black on white."),
             ui_settings.info_boxes.inverse);
  SetExpertRow(AppInverseInfoBox);

  if (HasColors()) {
    AddBoolean(_("Colored InfoBoxes"),
               _("If true, certain InfoBoxes will have coloured text.  For example, the active waypoint "
                 "InfoBox will be blue when the glider is above final glide."),
               ui_settings.info_boxes.use_colors);
    SetExpertRow(AppInfoBoxColors);
  } else
    AddDummy();

  AddEnum(_("InfoBox border"), nullptr, infobox_border_list,
          unsigned(ui_settings.info_boxes.border_style));
  SetExpertRow(AppInfoBoxBorder);

#ifdef KOBO
  AddBoolean(_("Show Menubutton"), _("Show the Menubutton"),
             ui_settings.show_menu_button);
  SetExpertRow(ShowMenuButton);
#endif

}
void
AirspaceClassRendererSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  // Save a working copy
  settings = CommonInterface::GetMapSettings().airspace.classes[type];

  // Add controls
  AddButton(_("Change Border Color"), *this, BorderColor);
  AddButton(_("Change Fill Color"), *this, FillColor);

#ifdef HAVE_HATCHED_BRUSH
#ifdef HAVE_ALPHA_BLEND
  bool transparency = CommonInterface::GetMapSettings().airspace.transparency;
  if (!transparency || !AlphaBlendAvailable())
#endif
    AddButton(_("Change Fill Brush"), *this, FillBrush);
#ifdef HAVE_ALPHA_BLEND
  else
    AddDummy();
#endif
#else
  AddDummy();
#endif

  AddInteger(_("Border Width"),
             _("The width of the border drawn around each airspace. "
               "Set this value to zero to hide the border."),
             _T("%d"), _T("%d"), 0, 5, 1, settings.border_width);

  static constexpr StaticEnumChoice fill_mode_list[] = {
    { (unsigned)AirspaceClassRendererSettings::FillMode::ALL, N_("Filled"), },
    { (unsigned)AirspaceClassRendererSettings::FillMode::PADDING, N_("Only padding"), },
    { (unsigned)AirspaceClassRendererSettings::FillMode::NONE, N_("Not filled"), },
    { 0 }
  };

  AddEnum(_("Fill Mode"),
          _("Defines how the airspace is filled with the configured color."),
          fill_mode_list, (unsigned)settings.fill_mode);
}
예제 #3
0
void
SectorZoneEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  ObservationZoneEditWidget::Prepare(parent, rc);

  const auto shape = GetObject().GetShape();

  AddFloat(_("Radius"), _("Radius of the OZ sector."),
           _T("%.1f %s"), _T("%.1f"),
           0.1, 200, 1, true,
           UnitGroup::DISTANCE, GetObject().GetRadius(),
           this);

  if (shape == ObservationZone::Shape::SYMMETRIC_QUADRANT) {
    AddDummy();
    AddDummy();
  } else {
    AddAngle(_("Start radial"), _("Start radial of the OZ area"),
             GetObject().GetStartRadial(), 10, true,
             this);

    AddAngle(_("Finish radial"), _("Finish radial of the OZ area"),
             GetObject().GetEndRadial(), 10, true,
             this);
  }

  if (shape == ObservationZonePoint::Shape::ANNULAR_SECTOR) {
    const AnnularSectorZone &annulus = (const AnnularSectorZone &)GetObject();

    AddFloat(_("Inner radius"), _("Inner radius of the OZ sector."),
             _T("%.1f %s"), _T("%.1f"),
             0.1, 100, 1, true,
             UnitGroup::DISTANCE, annulus.GetInnerRadius(),
             this);
  }
}
예제 #4
0
void
WindSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  const WindSettings &settings = CommonInterface::GetComputerSettings().wind;
  const MapSettings &map_settings = CommonInterface::GetMapSettings();

  static constexpr StaticEnumChoice auto_wind_list[] = {
    { AUTOWIND_NONE, N_("Manual"),
      N_("When the algorithm is switched off, the pilot is responsible for setting the wind estimate.") },
    { AUTOWIND_CIRCLING, N_("Circling"),
      N_("Requires only a GPS source.") },
    { AUTOWIND_ZIGZAG, N_("ZigZag"),
      N_("Requires GPS and an intelligent vario with airspeed output.") },
    { AUTOWIND_CIRCLING | AUTOWIND_ZIGZAG, N_("Both"),
      N_("Use ZigZag and circling.") },
    { 0 }
  };

  AddEnum(_("Auto wind"),
          _("This allows switching on or off the automatic wind algorithm."),
          auto_wind_list, settings.GetLegacyAutoWindMode());

  if (edit_trail_drift)
    AddBoolean(_("Trail drift"),
               _("Determines whether the snail trail is drifted with the wind "
                 "when displayed in circling mode. Switched Off, "
                 "the snail trail stays uncompensated for wind drift."),
               map_settings.trail.wind_drift_enabled);
  else
    AddDummy();

  if (edit_manual_wind) {
    SpeedVector manual_wind = CommonInterface::Calculated().GetWindOrZero();

    AddReadOnly(_("Source"));

    WndProperty *wp =
      AddFloat(_("Speed"), _("Manual adjustment of wind speed."),
               _T("%.0f %s"), _T("%.0f"),
               fixed(0),
               Units::ToUserWindSpeed(Units::ToSysUnit(fixed(200),
                                                       Unit::KILOMETER_PER_HOUR)),
               fixed(1), false,
               Units::ToUserWindSpeed(manual_wind.norm),
               this);
    DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField();
    df.SetUnits(Units::GetWindSpeedName());
    wp->RefreshDisplay();

    wp = AddAngle(_("Direction"), _("Manual adjustment of wind direction."),
                  manual_wind.bearing, 5u, false,
                  this);

    manual_modified = false;
  }

  if (clear_manual_button)
    AddButton(_("Clear"), *this, CLEAR_MANUAL);

  UpdateVector();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : pszName - 
//			piIndex - 
//			bDummy - 
// Output : 
//-----------------------------------------------------------------------------
IEditorTexture *CTextureSystem::FindActiveTexture(LPCSTR pszInputName, int *piIndex, BOOL bDummy)
{

	// The .vmf file format gets confused if there are backslashes in material names,
	// so make sure they're all using forward slashes here.
	char szName[MAX_PATH];
	Q_StrSubst( pszInputName, "\\", "/", szName, sizeof( szName ) );
	const char *pszName = szName;
	IEditorTexture *pTex = NULL;
	//
	// Check the cache first.
	//
	if (m_pLastTex && !stricmp(pszName, m_pLastTex->GetName()))
	{
		if (piIndex)
		{
			*piIndex = m_nLastIndex;
		}

		return m_pLastTex;
	}

	int iIndex = 0;

	// We're finding by name, so we don't care what the format is as long as the name matches.
	if ( m_pActiveGroup )
	{
		pTex = m_pActiveGroup->FindTextureByName( pszName, &iIndex, tfNone );
		if ( pTex )
		{
			if ( piIndex )
				*piIndex = iIndex;
			
			m_pLastTex = pTex;
			m_nLastIndex = iIndex;
			
			return pTex;
		}
	}

	//
	// Let's try again, this time with \textures\ decoration
	// TODO: remove this?
	//
	{
		iIndex = 0;
		char szBuf[512];

		sprintf(szBuf, "textures\\%s", pszName);

		for (int i = strlen(szBuf) -1; i >= 0; i--)
		{
			if (szBuf[i] == '/')
				szBuf[i] = '\\';
		}

		strlwr(szBuf);

		if ( m_pActiveGroup )
		{
			pTex = m_pActiveGroup->FindTextureByName( szBuf, &iIndex, tfNone );
			if ( pTex )
			{
				if ( piIndex )
					*piIndex = iIndex;
				
				m_pLastTex = pTex;
				m_nLastIndex = iIndex;
				
				return pTex;
			}
		}
	}
	//
	// Caller doesn't want dummies.
	//
	if (!bDummy)
	{
		return(NULL);
	}

	Assert(!piIndex);

	//
	// Check the list of dummies for a texture with the same name and texture format.
	//
	if (m_pActiveContext)
	{
		int nDummyCount = m_pActiveContext->Dummies.Count();
		for (int nDummy = 0; nDummy < nDummyCount; nDummy++)
		{
			IEditorTexture *pTex = m_pActiveContext->Dummies.Element(nDummy);
			if (!strcmpi(pszName, pTex->GetName()))
			{
				m_pLastTex = pTex;
				m_nLastIndex = -1;
				return(pTex);
			}
		}

		//
		// Not found; add a dummy as a placeholder for the missing texture.
		//
		pTex = AddDummy(pszName, g_pGameConfig->GetTextureFormat());
	}

	if (pTex != NULL)
	{
		m_pLastTex = pTex;
		m_nLastIndex = -1;
	}

	return(pTex);
}
예제 #6
0
파일: far.cpp 프로젝트: crom83/cromfarplugs
int MrRipper::ProcessKey(int Key, unsigned int ControlState)
{
        switch (ControlState)
        {               
        case (PKF_CONTROL|PKF_SHIFT): 
            if (Key==VK_F3) ConvView = (Opt.DoConv)?FALSE:TRUE;                 
            return Key==VK_F4?TRUE:FALSE;        
            break;
        case (PKF_SHIFT): 
                        if (Key == VK_F4){
                                AddDummy();
                                Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                                Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                                return TRUE;
                        }
                        if (Key == VK_F3){
                                SplitFile();
                                Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                                Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                                return TRUE;
                        }                       
                        if (Key == VK_F1){
                                Opt.UseLists = !Opt.UseLists;                                
                                Free_shownfiles();
                                Free_copyfiles();
                                Free_dirs();
                                Free_dummyfiles();    
                                FAT.ReInitFAT();
                                Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                                Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                                SetRegKey(HKEY_CURRENT_USER,"",StrUseLists,   Opt.UseLists);
                                return TRUE;
                        }                       
                        if (Key == VK_F2){
                                SaveList(FALSE);                                
                                return TRUE;
                        }                       
                                                  return (Key==VK_F5)||
                                 (Key==VK_F6)||
                                 (Key==VK_F7)||
                                 (Key==VK_F8)?TRUE:FALSE;
                break;
        case (PKF_ALT):  return (Key==VK_F6)?TRUE:FALSE;
                break;
        case (PKF_CONTROL):                     
            if (Key==VK_F9) {
                if (DefineRange(Opt.StartOffset, Opt.EndOffset)) {
                    Opt.UserScanRange = TRUE;
                    FAT.ReInitFAT();
                    Free_shownfiles();
                    Free_dirs();
                    Free_copyfiles();
                    Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                    Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                    return TRUE;
                }
            }
            if (Key==VK_F8) {
                Opt.UserScanRange = FALSE;
                FAT.ReInitFAT();
                Free_shownfiles();
                Free_dirs();
                Free_copyfiles();
                Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                return TRUE;
            }
            if (Key==VK_F5) {
                FAT.ReInitFAT();
                Free_shownfiles();
                Free_copyfiles();
                Free_dirs();
                Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                return TRUE;
            }
            return (Key==VK_F11)?TRUE:FALSE;
                break;        
        default: 
            if (Key==VK_F3) ConvView = (Opt.DoConv)?TRUE:FALSE;
            if (Key==VK_F5) ConvView = Opt.DoConv;
            if (Key==VK_F6) {
                if (bPluginManager) return SavePlugins();
            }
            if (Key==VK_F7){
                if (!bPluginManager) {
                    DelDup = !DelDup;                
                    Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1);
                    Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL);
                    return TRUE;
                } else {
                    CreateSheme();
                    return TRUE;
                }
            }
            if (Key==VK_F8) 
                if (bPluginManager) {
                    LoadSheme();
                    return TRUE;
                }

            return (Key==VK_F4)?TRUE:FALSE;                   
            break;
        }
        return FALSE;
}