void FLauncherProfileManager::LoadProfiles( ) { TArray<FString> ProfileFileNames; IFileManager::Get().FindFiles(ProfileFileNames, *(GetProfileFolder() / TEXT("*.ulp")), true, false); for (TArray<FString>::TConstIterator It(ProfileFileNames); It; ++It) { FString ProfileFilePath = GetProfileFolder() / *It; FArchive* ProfileFileReader = IFileManager::Get().CreateFileReader(*ProfileFilePath); if (ProfileFileReader != nullptr) { ILauncherProfilePtr LoadedProfile = LoadProfile(*ProfileFileReader); delete ProfileFileReader; if (LoadedProfile.IsValid()) { AddProfile(LoadedProfile.ToSharedRef()); } else { IFileManager::Get().Delete(*ProfileFilePath); } } } }
BOOL CTyDataDlg::OnInitDialog() { CPropertyPageEx::OnInitDialog(); LoadProfile( ); UpdateData( FALSE ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void vtFence3d::SetParams(const vtLinearParams ¶ms) { // Reload profile, if we know it is different than before bool bReload = (params.m_iConnectType == 3 && params.m_ConnectProfile != m_Params.m_ConnectProfile); m_Params = params; if (bReload) LoadProfile(); }
//------------------------------------------------------------------------------ FContextMenuTargetProfile::FContextMenuTargetProfile(const FBlueprintActionContext& MenuContext) : ProfileSaveName(ContextMenuTargetProfileImpl::GetProfileSaveName(MenuContext)) , HasComponentsMask(0) , IncompatibleTargetFlags(ContextMenuTargetProfileImpl::GetIncompatibleTargetFlags(MenuContext, HasComponentsMask)) , SavedTargetFlags(~IncompatibleTargetFlags) { const UBlueprintEditorSettings* BpSettings = GetDefault<UBlueprintEditorSettings>(); FString const BpConfigKey = BpSettings->GetClass()->GetPathName(); bool bOldUseTargetContextForNodeMenu = true; if (GConfig->GetBool(*BpConfigKey, TEXT("bUseTargetContextForNodeMenu"), bOldUseTargetContextForNodeMenu, GEditorPerProjectIni) && !bOldUseTargetContextForNodeMenu) { SavedTargetFlags = 0; } if (!LoadProfile()) { // maybe they were originally using the shared context profile? so let's default to that FString CachedProfileSaveName = ProfileSaveName; ProfileSaveName = ContextMenuTargetProfileImpl::SharedProfileName; LoadProfile(); ProfileSaveName = CachedProfileSaveName; } }
void CPreview::Update(const char *fpath) { cmpack_preview_set_model(CMPACK_PREVIEW(m_Preview), NULL); cmpack_preview_set_text(CMPACK_PREVIEW(m_Preview), NULL); gtk_text_buffer_set_text(m_Buffer, "", -1); if (m_Data) { g_object_unref(m_Data); m_Data = NULL; } m_FileType = TYPE_UNKNOWN; if (fpath) { SetPath(fpath); switch (FileType(fpath)) { case TYPE_IMAGE: LoadImage(fpath); break; case TYPE_PHOT: LoadChart(fpath); break; case TYPE_CAT: LoadCatalog(fpath); break; case TYPE_TABLE: LoadTable(fpath); break; case TYPE_VARFIND: LoadVarFind(fpath); break; case TYPE_PROJECT: LoadProject(fpath); break; case TYPE_PROFILE: LoadProfile(fpath); break; default: break; } if (m_Data) cmpack_preview_set_model(CMPACK_PREVIEW(m_Preview), m_Data); } }
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////// CTor/DTor /////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// CUIManager::CUIManager() : m_bPickupMsgVisible(false) { IUIEventSystemFactory *pFactory = IUIEventSystemFactory::GetFirst(); while(pFactory) { IUIGameEventSystem *pGameEvent = pFactory->Create(); CRY_ASSERT_MESSAGE(pGameEvent, "Invalid IUIEventSystemFactory!"); const char *name = pGameEvent->GetTypeName(); TUIEventSystems::const_iterator it = m_EventSystems.find(name); if(it == m_EventSystems.end()) { m_EventSystems[name] = pGameEvent; } else { string str; str.Format("IUIGameEventSystem \"%s\" already exists!", name); CRY_ASSERT_MESSAGE(false, str.c_str()); SAFE_DELETE(pGameEvent); } pFactory = pFactory->GetNext(); } TUIEventSystems::const_iterator it = m_EventSystems.begin(); TUIEventSystems::const_iterator end = m_EventSystems.end(); for(; it != end; ++it) { it->second->InitEventSystem(); } m_soundListener = gEnv->pSoundSystem->CreateListener(); InitSound(); gEnv->pSystem->GetISystemEventDispatcher()->RegisterListener(this); LoadProfile(); }
/** * "Boots" up XCSoar * @param hInstance Instance handle * @param lpCmdLine Command line string * @return True if bootup successful, False otherwise */ bool XCSoarInterface::Startup() { VerboseOperationEnvironment operation; // Set the application title to "XCSoar" TCHAR szTitle[] = _T("XCSoar"); //If "XCSoar" is already running, stop this instance if (MainWindow::find(szTitle)) return false; LogStartUp(_T("Display dpi=%u,%u"), Display::GetXDPI(), Display::GetYDPI()); // Creates the main window LogStartUp(_T("Create main window")); TopWindowStyle style; if (CommandLine::full_screen) style.FullScreen(); if (CommandLine::resizable) style.Resizable(); main_window.Set(szTitle, SystemWindowSize(), style); if (!main_window.IsDefined()) return false; #ifdef ENABLE_OPENGL LogStartUp(_T("OpenGL: " #ifdef HAVE_EGL "egl=%d " #endif "npot=%d vbo=%d fbo=%d"), #ifdef HAVE_EGL OpenGL::egl, #endif OpenGL::texture_non_power_of_two, OpenGL::vertex_buffer_object, OpenGL::frame_buffer_object); #endif main_window.Initialise(); #ifdef SIMULATOR_AVAILABLE // prompt for simulator if not set by command line argument "-simulator" or "-fly" if (!sim_set_in_cmd_line_flag) { DialogLook white_look; white_look.Initialise(Fonts::map_bold, Fonts::map, Fonts::map_label, Fonts::map_bold, Fonts::map_bold); white_look.SetBackgroundColor(COLOR_WHITE); SetXMLDialogLook(white_look); SimulatorPromptResult result = dlgSimulatorPromptShowModal(); switch (result) { case SPR_QUIT: return false; case SPR_FLY: global_simulator_flag = false; break; case SPR_SIMULATOR: global_simulator_flag = true; break; } } #endif SetXMLDialogLook(main_window.GetLook().dialog); SetSystemSettings().SetDefaults(); SetComputerSettings().SetDefaults(); SetUISettings().SetDefaults(); SetUIState().Clear(); if (!LoadProfile()) return false; operation.SetText(_("Initialising")); /* create XCSoarData on the first start */ CreateDataPath(); Display::LoadOrientation(operation); main_window.InitialiseConfigured(); TCHAR path[MAX_PATH]; LocalPath(path, _T("cache")); file_cache = new FileCache(path); ReadLanguageFile(); status_messages.LoadFile(); InputEvents::readFile(); // Initialize DeviceBlackboard device_blackboard = new DeviceBlackboard(); DeviceListInitialise(); // Initialize Markers marks = new Markers(); protected_marks = new ProtectedMarkers(*marks); #ifdef HAVE_AYGSHELL_DLL const AYGShellDLL &ayg = main_window.ayg_shell_dll; ayg.SHSetAppKeyWndAssoc(VK_APP1, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP2, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP3, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP4, main_window); // Typical Record Button // Why you can't always get this to work // http://forums.devbuzz.com/m_1185/mpage_1/key_/tm.htm // To do with the fact it is a global hotkey, but you can with code above // Also APPA is record key on some systems ayg.SHSetAppKeyWndAssoc(VK_APP5, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP6, main_window); #endif // Initialize main blackboard data task_manager = new TaskManager(GetComputerSettings().task, way_points); task_manager->SetTaskEvents(task_events); task_manager->Reset(); protected_task_manager = new ProtectedTaskManager(*task_manager, XCSoarInterface::GetComputerSettings().task); // Read the terrain file operation.SetText(_("Loading Terrain File...")); LogStartUp(_T("OpenTerrain")); terrain = RasterTerrain::OpenTerrain(file_cache, operation); glide_computer = new GlideComputer(way_points, airspace_database, *protected_task_manager, task_events); glide_computer->ReadComputerSettings(GetComputerSettings()); glide_computer->SetTerrain(terrain); glide_computer->SetLogger(&logger); glide_computer->Initialise(); replay = new Replay(&logger, *protected_task_manager); // Load the EGM96 geoid data EGM96::Load(); GlidePolar &gp = SetComputerSettings().polar.glide_polar_task; gp = GlidePolar(fixed_zero); gp.SetMC(GetComputerSettings().task.safety_mc); gp.SetBugs(GetComputerSettings().polar.degradation_factor); PlaneGlue::FromProfile(SetComputerSettings().plane); PlaneGlue::Synchronize(GetComputerSettings().plane, SetComputerSettings(), gp); task_manager->SetGlidePolar(gp); // Read the topography file(s) topography = new TopographyStore(); LoadConfiguredTopography(*topography, operation); // Read the waypoint files WaypointGlue::LoadWaypoints(way_points, terrain, operation); // Read and parse the airfield info file WaypointDetails::ReadFileFromProfile(way_points, operation); // Set the home waypoint WaypointGlue::SetHome(way_points, terrain, SetComputerSettings(), device_blackboard, false); // ReSynchronise the blackboards here since SetHome touches them device_blackboard->Merge(); ReadBlackboardBasic(device_blackboard->Basic()); // Scan for weather forecast LogStartUp(_T("RASP load")); RASP.ScanAll(Basic().location, operation); // Reads the airspace files ReadAirspace(airspace_database, terrain, GetComputerSettings().pressure, operation); { const AircraftState aircraft_state = ToAircraftState(device_blackboard->Basic(), device_blackboard->Calculated()); ProtectedAirspaceWarningManager::ExclusiveLease lease(glide_computer->GetAirspaceWarnings()); lease->Reset(aircraft_state); lease->SetConfig(CommonInterface::GetComputerSettings().airspace.warnings); } #ifdef HAVE_NET noaa_store = new NOAAStore(); noaa_store->LoadFromProfile(); #endif AudioVarioGlue::Initialise(); AudioVarioGlue::Configure(GetComputerSettings().sound); // Start the device thread(s) operation.SetText(_("Starting devices")); devStartup(); /* -- Reset polar in case devices need the data LogStartUp(_T("GlidePolar::UpdatePolar")); GlidePolar::UpdatePolar(true, GetComputerSettings()); This should be done inside devStartup if it is really required */ operation.SetText(_("Initialising display")); GlueMapWindow *map_window = main_window.GetMap(); if (map_window != NULL) { map_window->SetWaypoints(&way_points); map_window->SetTask(protected_task_manager); map_window->SetRoutePlanner(&glide_computer->GetProtectedRoutePlanner()); map_window->SetGlideComputer(glide_computer); map_window->SetAirspaces(&airspace_database); map_window->SetTopography(topography); map_window->SetTerrain(terrain); map_window->SetWeather(&RASP); map_window->SetMarks(protected_marks); map_window->SetLogger(&logger); /* show map at home waypoint until GPS fix becomes available */ if (GetComputerSettings().poi.home_location_available) map_window->SetLocation(GetComputerSettings().poi.home_location); } // Finally ready to go.. all structures must be present before this. // Create the drawing thread #ifndef ENABLE_OPENGL LogStartUp(_T("CreateDrawingThread")); draw_thread = new DrawThread(*map_window); draw_thread->Start(true); #endif // Show the infoboxes LogStartUp(_T("ShowInfoBoxes")); InfoBoxManager::Show(); // Create the calculation thread LogStartUp(_T("CreateCalculationThread")); CreateCalculationThread(); // Find unique ID of this PDA ReadAssetNumber(); glide_computer_events.Reset(); GetLiveBlackboard().AddListener(glide_computer_events); if (CommonInterface::GetComputerSettings().logger.enable_flight_logger) { flight_logger = new GlueFlightLogger(GetLiveBlackboard()); LocalPath(path, _T("flights.log")); flight_logger->SetPath(path); } if (CommonInterface::GetComputerSettings().logger.enable_nmea_logger) NMEALogger::enabled = true; LogStartUp(_T("ProgramStarted")); // Give focus to the map main_window.SetDefaultFocus(); Pages::Initialise(GetUISettings().pages); // Start calculation thread merge_thread->Start(); calculation_thread->Start(); #ifdef HAVE_TRACKING tracking = new TrackingGlue(); tracking->SetSettings(GetComputerSettings().tracking); #endif globalRunningEvent.Signal(); AfterStartup(); operation.Hide(); main_window.ResumeThreads(); return true; }
/** * "Boots" up XCSoar * @param hInstance Instance handle * @param lpCmdLine Command line string * @return True if bootup successful, False otherwise */ bool XCSoarInterface::Startup(HINSTANCE hInstance) { // Set the application title to "XCSoar" TCHAR szTitle[] = _T("XCSoar"); // Store instance handle in our global variable #ifdef WIN32 ResourceLoader::Init(hInstance); #endif //If "XCSoar" is already running, stop this instance if (MainWindow::find(szTitle)) return false; // Register window classes PaintWindow::register_class(hInstance); MainWindow::register_class(hInstance); // Creates the main window LogStartUp(_T("Create main window")); PixelRect WindowSize = SystemWindowSize(); main_window.set(szTitle, WindowSize.left, WindowSize.top, WindowSize.right, WindowSize.bottom); if (!main_window.defined()) return false; main_window.Initialise(); #ifdef SIMULATOR_AVAILABLE // prompt for simulator if not set by command line argument "-simulator" or "-fly" if (!sim_set_in_cmd_line_flag) { SimulatorPromptResult result = dlgSimulatorPromptShowModal(); switch (result) { case SPR_QUIT: return false; case SPR_FLY: global_simulator_flag = false; break; case SPR_SIMULATOR: global_simulator_flag = true; break; } } #endif if (!LoadProfile()) return false; ProgressGlue::Create(_("Initialising")); LoadDisplayOrientation(); main_window.InitialiseConfigured(); TCHAR path[MAX_PATH]; LocalPath(path, _T("cache")); file_cache = new FileCache(path); Graphics::InitialiseConfigured(SettingsMap()); ReadLanguageFile(); status_messages.LoadFile(); InputEvents::readFile(); // Initialize DeviceBlackboard device_blackboard.Initialise(); // Initialize Marks marks = new Marks(); // Send the SettingsMap to the DeviceBlackboard SendSettingsMap(); // Show the main and map windows LogStartUp(_T("Create map window")); main_window.show(); main_window.map.show(); #ifdef HAVE_AYGSHELL_DLL const AYGShellDLL &ayg = main_window.ayg_shell_dll; ayg.SHSetAppKeyWndAssoc(VK_APP1, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP2, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP3, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP4, main_window); // Typical Record Button // Why you can't always get this to work // http://forums.devbuzz.com/m_1185/mpage_1/key_/tm.htm // To do with the fact it is a global hotkey, but you can with code above // Also APPA is record key on some systems ayg.SHSetAppKeyWndAssoc(VK_APP5, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP6, main_window); #endif // Initialize main blackboard data task_manager = new TaskManager(task_events, way_points); task_manager->reset(); protected_task_manager = new ProtectedTaskManager(*task_manager, XCSoarInterface::SettingsComputer(), task_events, airspace_database); airspace_warning = new AirspaceWarningManager(airspace_database, *task_manager); airspace_warnings = new ProtectedAirspaceWarningManager(*airspace_warning); // Read the terrain file ProgressGlue::Create(_("Loading Terrain File...")); LogStartUp(_T("OpenTerrain")); terrain = RasterTerrain::OpenTerrain(file_cache); glide_computer = new GlideComputer(way_points, *protected_task_manager, *airspace_warnings, task_events); glide_computer->set_terrain(terrain); glide_computer->SetLogger(&logger); glide_computer->Initialise(); replay = new Replay(*protected_task_manager); // Load the EGM96 geoid data OpenGeoid(); GlidePolar &gp = SetSettingsComputer().glide_polar_task; gp = GlidePolar(fixed_zero); PolarGlue::LoadFromProfile(gp, SetSettingsComputer()); task_manager->set_glide_polar(gp); task_manager->set_contest(SettingsComputer().contest); // Read the topography file(s) topography = new TopographyStore(); LoadConfiguredTopography(*topography); // Read the waypoint files WayPointGlue::LoadWaypoints(way_points, terrain); // Read and parse the airfield info file ReadAirfieldFile(way_points); // Set the home waypoint WayPointGlue::SetHome(way_points, terrain, SetSettingsComputer(), false); // ReSynchronise the blackboards here since SetHome touches them ReadBlackboardBasic(device_blackboard.Basic()); // Scan for weather forecast ProgressGlue::Create(_("Scanning weather forecast")); LogStartUp(_T("RASP load")); RASP.ScanAll(Basic().Location); // Reads the airspace files ReadAirspace(airspace_database, terrain, SettingsComputer().pressure); const AIRCRAFT_STATE aircraft_state = ToAircraftState(device_blackboard.Basic(), device_blackboard.Calculated()); airspace_warning->reset(aircraft_state); airspace_warning->set_config(CommonInterface::SettingsComputer().airspace.warnings); // Read the FLARM details file FlarmDetails::Load(); #ifndef DISABLEAUDIOVARIO /* VarioSound_Init(); VarioSound_EnableSound(EnableSoundVario); VarioSound_SetVdead(SoundDeadband); VarioSound_SetV(0); VarioSound_SetSoundVolume(SoundVolume); */ #endif // Start the device thread(s) ProgressGlue::Create(_("Starting devices")); devStartup(); /* -- Reset polar in case devices need the data LogStartUp(_T("GlidePolar::UpdatePolar")); GlidePolar::UpdatePolar(true, SettingsComputer()); This should be done inside devStartup if it is really required */ ProgressGlue::Create(_("Initialising display")); main_window.map.set_way_points(&way_points); main_window.map.set_task(protected_task_manager); main_window.map.set_airspaces(&airspace_database, airspace_warnings); main_window.map.set_topography(topography); main_window.map.set_terrain(terrain); main_window.map.set_weather(&RASP); main_window.map.set_marks(marks); main_window.map.SetLogger(&logger); // Finally ready to go.. all structures must be present before this. // Create the drawing thread #ifndef ENABLE_OPENGL LogStartUp(_T("CreateDrawingThread")); draw_thread = new DrawThread(main_window.map, main_window.flarm, main_window.ta); draw_thread->start(); #endif // Show the infoboxes LogStartUp(_T("ShowInfoBoxes")); InfoBoxManager::Show(); // Create the calculation thread LogStartUp(_T("CreateCalculationThread")); CreateCalculationThread(); // Find unique ID of this PDA ReadAssetNumber(); LogStartUp(_T("ProgramStarted")); // Give focus to the map main_window.map.set_focus(); Pages::LoadFromProfile(); // Start calculation thread calculation_thread->start(); globalRunningEvent.trigger(); AfterStartup(); #ifndef ENABLE_OPENGL draw_thread->resume(); #endif return true; }
int main_PY() { // int c; //用于保存用户输入的参数 // Bool bBackground = True; // char *imname=(char *)NULL; extern Bool bPYBaseDictLoaded; extern Bool bPYOtherDictLoaded; initConfig(); //szj initConfig2(); //szj if (!InitX ()){}; //exit (1); /*加载用户配置文件,通常是“~/.fcitx/config”,如果该文件不存在就从安装目录中拷贝 * “/data/config”到“~/.fcitx/config” */ LoadConfig (True); /*创建字体。实际上,就是根据用户的设置,使用xft读取字体的相关信息。 * xft是x11提供的处理字体的相关函数集 */ CreateFont (); //根据字体计算输入窗口的高度 CalculateInputWindowHeight (); /*加载配置文件,这个配置文件不是用户配置的,而是用于记录fctix的运行状态的, * 比如是全角还是半角等等。通常是“~/.fcitx/profile”,如果该文件不存在就从安装 * 目录中拷贝“/data/profile”到“~/.fcitx/profile” */ LoadProfile (); //加载标点字典文件 LoadPuncDict (); //加载成语 LoadQuickPhrase (); /*从 ~/.fcitx/AutoEng.dat (如果不存在, * 则从 /usr/local/share/fcitx/data/AutoEng.dat) * 读取需要自动转换到英文输入状态的情况的数据 */ LoadAutoEng (); //以下是界面的处理 CreateMainWindow (); //创建主窗口,即输入法状态窗口 CreateVKWindow (); //创建候选词窗口 CreateInputWindow (); //创建输入窗口 //szj CreateAboutWindow (); //创建关于窗口 //处理颜色,即候选词窗口的颜色,也就是我们在“~/.fcitx/config”定义的那些颜色信息 InitGC (inputWindow); //将本程序加入到输入法组,告诉系统,使用我输入字符 SetIM (); //处理主窗口的显示 if (hideMainWindow != HM_HIDE) { DisplayMainWindow (); DrawMainWindow (); } if (!bPYBaseDictLoaded) LoadPYBaseDict (); if (!bPYOtherDictLoaded) LoadPYOtherDict (); //以后台方式运行 #ifdef _ENABLE_TRAY CreateTrayWindow (); //创建系统托盘窗口 DrawTrayWindow (INACTIVE_ICON); //显示托盘图标 #endif return 0; }
bool CGUIWindowLoginScreen::OnMessage(CGUIMessage& message) { switch ( message.GetMessage() ) { case GUI_MSG_WINDOW_DEINIT: { m_vecItems->Clear(); } break; case GUI_MSG_CLICKED: { int iControl = message.GetSenderId(); if (iControl == CONTROL_BIG_LIST) { int iAction = message.GetParam1(); // iItem is checked for validity inside these routines if (iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_RIGHT_CLICK) { int iItem = m_viewControl.GetSelectedItem(); bool bResult = OnPopupMenu(m_viewControl.GetSelectedItem()); if (bResult) { Update(); CGUIMessage msg(GUI_MSG_ITEM_SELECT,GetID(),CONTROL_BIG_LIST,iItem); OnMessage(msg); } return bResult; } else if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK) { int iItem = m_viewControl.GetSelectedItem(); bool bCanceled; bool bOkay = g_passwordManager.IsProfileLockUnlocked(iItem, bCanceled); if (bOkay) { LoadProfile(iItem); } else { if (!bCanceled && iItem != 0) CGUIDialogOK::ShowAndGetInput(20068,20117,20022,20022); } } } } break; case GUI_MSG_SETFOCUS: { if (m_viewControl.HasControl(message.GetControlId()) && m_viewControl.GetCurrentControl() != message.GetControlId()) { m_viewControl.SetFocused(); return true; } } default: break; } return CGUIWindow::OnMessage(message); }
void ConfigManager::Read() { wxTextFile fil(filename); if (!fil.Exists()) return; fil.Open(); wxString key, value; long l; for ( wxString str = fil.GetFirstLine(); !fil.Eof(); str = fil.GetNextLine() ) { if (str[0]=='#') { continue; } else { key=str.BeforeFirst('='); value=str.AfterFirst('='); if (key=="version") { value.ToLong(&l); version=l; lang.Reset(version); } else if (key=="font_size") { value.ToLong(&l); font_size=l; } else if (key=="tabWidth") { value.ToLong(&l); tabw=l; } else if (key=="size_x") { value.ToLong(&l); size_x=l; } else if (key=="size_y") { value.ToLong(&l); size_y=l; } else if (key=="pos_x") { value.ToLong(&l); pos_x=l; } else if (key=="pos_y") { value.ToLong(&l); pos_y=l; } else if (key=="debug_port") { value.ToLong(&l); debug_port=l; } else if (key=="comm_port") { value.ToLong(&l); comm_port=l; } else if (key=="use_psterm") use_psterm=utils->IsTrue(value); else if (key=="use_dark_psterm") use_dark_psterm=utils->IsTrue(value); else if (key=="check_for_updates") check_for_updates=utils->IsTrue(value); else if (key=="fixed_port") fixed_port=utils->IsTrue(value); else if (key=="stepstep_tspeed") { value.ToLong(&l); stepstep_tspeed=l; } else if (key=="rt_syntax") rt_syntax=utils->IsTrue(value); else if (key=="smart_indent") smart_indent=utils->IsTrue(value); else if (key=="show_commands") show_commands=utils->IsTrue(value); else if (key=="show_vars") show_vars=utils->IsTrue(value); else if (key=="show_opers") show_opers=utils->IsTrue(value); else if (key=="show_debug_panel") show_debug_panel=utils->IsTrue(value); else if (key=="show_toolbar") show_toolbar=utils->IsTrue(value); else if (key=="auto_quickhelp") auto_quickhelp=utils->IsTrue(value); else if (key=="calltip_helps") calltip_helps=utils->IsTrue(value); else if (key=="autocomp") autocomp=utils->IsTrue(value); else if (key=="highlight_blocks") highlight_blocks=utils->IsTrue(value); else if (key=="autoclose") autoclose=utils->IsTrue(value); else if (key=="shape_colors") shape_colors=utils->IsTrue(value); else if (key=="colour_sintax") colour_sintax=utils->IsTrue(value); else if (key=="use_colors") use_colors=utils->IsTrue(value); else if (key=="animate_gui") animate_gui=utils->IsTrue(value); else if (key=="reorganize_for_debug") reorganize_for_debug=utils->IsTrue(value); else if (key=="images_path") images_path=value; else if (key=="help_dir") help_dir=value; else if (key=="proxy") proxy=value; else if (key=="profiles_dir") profiles_dir=value; else if (key=="profile") profile=value; else if (key=="examples_dir") examples_dir=value; else if (key=="last_dir") last_dir=value; else if (key=="temp_dir") temp_dir=value; // else if (key=="pseint_command") pseint_command=value; // else if (key=="psterm_command") psterm_command=value; // else if (key=="psexport_command") psexport_command=value; // else if (key=="psdrawe_command") psdrawe_command=value; // else if (key=="psdraw3_command") psdraw3_command=value; else if (key=="terminal") { tty_command=value; } else if (key=="history") last_files.Add(value); else lang.ProcessConfigLine(key.c_str(),value.c_str()); } } fil.Close(); LoadProfile(profile); lang.Fix(); if (version<20130805) use_psterm=true; }
void FLauncherProfileManager::LoadProfiles( ) { TArray<FString> ProfileFileNames; //load and move legacy profiles { IFileManager::Get().FindFilesRecursive(ProfileFileNames, *GetLegacyProfileFolder(), TEXT("*.ulp"), true, false); for (TArray<FString>::TConstIterator It(ProfileFileNames); It; ++It) { FString ProfileFilePath = *It; FArchive* ProfileFileReader = IFileManager::Get().CreateFileReader(*ProfileFilePath); if (ProfileFileReader != nullptr) { ILauncherProfilePtr LoadedProfile = LoadProfile(*ProfileFileReader); delete ProfileFileReader; //re-save profile to new location if (LoadedProfile.IsValid()) { SaveProfile(LoadedProfile.ToSharedRef()); } //delete legacy profile. IFileManager::Get().Delete(*ProfileFilePath); } } } //load and re-save legacy profiles { IFileManager::Get().FindFilesRecursive(ProfileFileNames, *FLauncherProfile::GetProfileFolder(), TEXT("*.ulp"), true, false); for (TArray<FString>::TConstIterator It(ProfileFileNames); It; ++It) { FString ProfileFilePath = *It; FArchive* ProfileFileReader = IFileManager::Get().CreateFileReader(*ProfileFilePath); if (ProfileFileReader != nullptr) { ILauncherProfilePtr LoadedProfile = LoadProfile(*ProfileFileReader); delete ProfileFileReader; //re-save profile to the new format if (LoadedProfile.IsValid()) { if (ProfileFilePath.Contains("NotForLicensees")) { LoadedProfile->SetNotForLicensees(); } SaveJSONProfile(LoadedProfile.ToSharedRef()); } //delete legacy profile. IFileManager::Get().Delete(*ProfileFilePath); } } } ProfileFileNames.Reset(); IFileManager::Get().FindFilesRecursive(ProfileFileNames, *FLauncherProfile::GetProfileFolder(), TEXT("*.ulp2"), true, false); for (TArray<FString>::TConstIterator It(ProfileFileNames); It; ++It) { FString ProfileFilePath = *It; ILauncherProfilePtr LoadedProfile = LoadJSONProfile(*ProfileFilePath); if (LoadedProfile.IsValid()) { if (ProfileFilePath.Contains("NotForLicensees")) { LoadedProfile->SetNotForLicensees(); } AddProfile(LoadedProfile.ToSharedRef()); } else { IFileManager::Get().Delete(*ProfileFilePath); } } }
void vtFence3d::ProfileChanged() { // When we know the profile has changed, reload it. LoadProfile(); }
phStatus_t NfcRdLibInit(void) { phStatus_t status; /* * Initialize the Reader BAL (Bus Abstraction Layer) component */ status = phbalReg_Stub_Init(&sBalReader, sizeof(phbalReg_Stub_DataParams_t)); CHECK_SUCCESS(status); /* * Initialize the OSAL Events. */ status = phOsal_Event_Init(); CHECK_STATUS(status); // Start interrupt thread Set_Interrupt(); /* * Set HAL type in BAL */ #ifdef NXPBUILD__PHHAL_HW_PN5180 status = phbalReg_SetConfig(&sBalReader, PHBAL_REG_CONFIG_HAL_HW_TYPE, PHBAL_REG_HAL_HW_PN5180); #endif #ifdef NXPBUILD__PHHAL_HW_RC523 status = phbalReg_SetConfig(&sBalReader, PHBAL_REG_CONFIG_HAL_HW_TYPE, PHBAL_REG_HAL_HW_RC523); #endif #ifdef NXPBUILD__PHHAL_HW_RC663 status = phbalReg_SetConfig(&sBalReader, PHBAL_REG_CONFIG_HAL_HW_TYPE, PHBAL_REG_HAL_HW_RC663); #endif CHECK_STATUS(status); status = phbalReg_SetPort(&sBalReader, (uint8_t *) SPI_CONFIG); CHECK_STATUS(status); /* * Open BAL */ status = phbalReg_OpenPort(&sBalReader); CHECK_STATUS(status); /* * Initialize the Reader HAL (Hardware Abstraction Layer) component */ status = phhalHw_Nfc_IC_Init(&sHal_Nfc_Ic, sizeof(phhalHw_Nfc_Ic_DataParams_t), &sBalReader, 0, bHalBufferTx, sizeof(bHalBufferTx), bHalBufferRx, sizeof(bHalBufferRx)); CHECK_SUCCESS(status); /* * Set the parameter to use the SPI interface */ sHal_Nfc_Ic.sHal.bBalConnectionType = PHHAL_HW_BAL_CONNECTION_SPI; Configure_Device(&sHal_Nfc_Ic); /* * Set the generic pointer */ pHal = &sHal_Nfc_Ic.sHal; /* * Initializing specific objects for the communication with MIFARE (R) Classic cards. The MIFARE (R) Classic card * is compliant of ISO 14443-3 and ISO 14443-4 */ /* * Initialize the I14443-A PAL layer */ status = phpalI14443p3a_Sw_Init(&spalI14443p3a, sizeof(phpalI14443p3a_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the I14443-A PAL component */ status = phpalI14443p4a_Sw_Init(&spalI14443p4a, sizeof(phpalI14443p4a_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the I14443-4 PAL component */ status = phpalI14443p4_Sw_Init(&spalI14443p4, sizeof(phpalI14443p4_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the I14443-B PAL component */ status = phpalI14443p3b_Sw_Init(&spalI14443p3b, sizeof(phpalI14443p3b_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the MIFARE PAL component */ status = phpalMifare_Sw_Init(&spalMifare, sizeof(phpalMifare_Sw_DataParams_t), &sHal_Nfc_Ic.sHal, NULL); CHECK_STATUS(status); /* * Initialize the discover component */ status = phacDiscLoop_Sw_Init(&sDiscLoop, sizeof(phacDiscLoop_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_SUCCESS(status); /* * Load profile for Discovery loop */ LoadProfile(); status = phalMfc_Sw_Init(&salMfc, sizeof(phalMfc_Sw_DataParams_t), &spalMifare, NULL); CHECK_STATUS(status); /* * Read the version of the reader IC */ #if defined NXPBUILD__PHHAL_HW_RC523 status = phhalHw_Rc523_ReadRegister(&sHal_Nfc_Ic.sHal, PHHAL_HW_RC523_REG_VERSION, &bDataBuffer[0]); CHECK_SUCCESS(status); #endif #if defined NXPBUILD__PHHAL_HW_RC663 status = phhalHw_Rc663_ReadRegister(&sHal_Nfc_Ic.sHal, PHHAL_HW_RC663_REG_VERSION, &bDataBuffer[0]); CHECK_SUCCESS(status); #endif /* * Return Success */ return PH_ERR_SUCCESS; }
mxProfile::mxProfile(wxWindow *parent):wxDialog(parent,wxID_ANY,_Z("Opciones del Lenguaje"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER),old_config(LS_INIT) { text=NULL; // para que no procese el evento de seleccion al crear la lista old_config=config->lang; old_profile=config->profile; wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer *search_sizer = new wxBoxSizer(wxHORIZONTAL); search=new wxTextCtrl(this,wxID_FIND,""); search_sizer->Add(new wxStaticText(this,wxID_ANY,_Z("Buscar: ")),wxSizerFlags().Center()); search_sizer->Add(search,wxSizerFlags().Proportion(1).Expand()); sizer->Add(search_sizer,wxSizerFlags().Proportion(0).Expand().Border(wxALL,5)); wxBoxSizer *button_sizer = new wxBoxSizer(wxHORIZONTAL); wxDir dir(config->profiles_dir); if ( dir.IsOpened() ) { wxString filename; wxString spec; bool cont = dir.GetFirst(&filename, spec , wxDIR_FILES); while ( cont ) { perfiles.Add(filename); cont = dir.GetNext(&filename); } } perfiles.Sort(comp_nocase); for(unsigned int i=0;i<perfiles.GetCount();i++) { LangSettings l(LS_INIT); l.Load(DIR_PLUS_FILE(config->profiles_dir,perfiles[i])); descripciones.Add(l.descripcion.c_str()); } list = new wxListCtrl(this,wxID_ANY,wxDefaultPosition,wxSize(200,200),wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL); list->InsertColumn(0,_Z("Perfil")); wxImageList *iml = new wxImageList(24,24,true); wxBitmap noimage(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"null.png"),wxBITMAP_TYPE_PNG); for(unsigned int i=0;i<perfiles.GetCount();i++) { wxString ficon=DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),perfiles[i]+".png"); if (wxFileName::FileExists(ficon)) iml->Add(wxBitmap(ficon,wxBITMAP_TYPE_PNG)); else iml->Add(noimage); } iml->Add(wxBitmap(DIR_PLUS_FILE(DIR_PLUS_FILE(config->profiles_dir,"icons"),"personalizado.png"),wxBITMAP_TYPE_PNG)); list->AssignImageList(iml,wxIMAGE_LIST_SMALL); Search(); text = new wxTextCtrl(this,wxID_ANY,_T(""),wxDefaultPosition,wxDefaultSize,wxTE_MULTILINE|wxTE_READONLY); LoadProfile(); wxButton *options_button = new mxBitmapButton (this, wxID_ABOUT, bitmaps->buttons.next, _Z("Personalizar...")); wxButton *ok_button = new mxBitmapButton (this, wxID_OK, bitmaps->buttons.ok, _Z("Aceptar")); wxButton *cancel_button = new mxBitmapButton (this, wxID_CANCEL, bitmaps->buttons.cancel, _Z("Cancelar")); button_sizer->Add(options_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand()); button_sizer->AddStretchSpacer(1); button_sizer->Add(cancel_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand()); button_sizer->Add(ok_button,wxSizerFlags().Border(wxALL,5).Proportion(0).Expand()); sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Seleccione un perfil para configurar las reglas del lenguaje: ")),wxSizerFlags().Expand().Proportion(0).Border(wxTOP,5)); sizer->Add(list,wxSizerFlags().Expand().Proportion(3).FixedMinSize()); sizer->Add(new wxStaticText(this,wxID_ANY,_Z("")),wxSizerFlags().Expand().Proportion(0)); sizer->Add(new wxStaticText(this,wxID_ANY,_Z(" Descripción del perfil seleccionado:")),wxSizerFlags().Expand().Proportion(0)); sizer->Add(text,wxSizerFlags().Expand().Proportion(1).FixedMinSize()); sizer->Add(new wxStaticText(this,wxID_ANY,""),wxSizerFlags().Expand().Proportion(0)); sizer->Add(button_sizer,wxSizerFlags().Expand().Proportion(0)); ok_button->SetDefault(); SetEscapeId(wxID_CANCEL); SetSizerAndFit(sizer); this->Layout(); // para ajustar el tamaño de la columna de la lista list->SetColumnWidth(0,list->GetSize().GetWidth()-32); search->SetFocus(); ShowModal(); }
void mxProfile::OnListSelect(wxListEvent &evt) { evt.Skip(); LoadProfile(); }
/** * "Boots" up XCSoar * @param hInstance Instance handle * @param lpCmdLine Command line string * @return True if bootup successful, False otherwise */ bool Startup() { VerboseOperationEnvironment operation; #ifdef HAVE_DOWNLOAD_MANAGER Net::DownloadManager::Initialise(); #endif LogFormat("Display dpi=%u,%u", Display::GetXDPI(), Display::GetYDPI()); // Creates the main window TopWindowStyle style; if (CommandLine::full_screen) style.FullScreen(); style.Resizable(); MainWindow *const main_window = CommonInterface::main_window = new MainWindow(); main_window->Create(SystemWindowSize(), style); if (!main_window->IsDefined()) return false; #ifdef ENABLE_OPENGL LogFormat("OpenGL: " #ifdef ANDROID #ifdef USE_EGL "egl=native " #else "egl=no " #endif #endif #ifdef HAVE_OES_DRAW_TEXTURE "oesdt=%d " #endif #ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS "mda=%d " #endif "npot=%d vbo=%d fbo=%d stencil=%#x", #ifdef HAVE_OES_DRAW_TEXTURE OpenGL::oes_draw_texture, #endif #ifdef HAVE_DYNAMIC_MULTI_DRAW_ARRAYS GLExt::HaveMultiDrawElements(), #endif OpenGL::texture_non_power_of_two, OpenGL::vertex_buffer_object, OpenGL::frame_buffer_object, OpenGL::render_buffer_stencil); #endif CommonInterface::SetUISettings().SetDefaults(); main_window->Initialise(); #ifdef SIMULATOR_AVAILABLE // prompt for simulator if not set by command line argument "-simulator" or "-fly" if (!sim_set_in_cmd_line_flag) { SimulatorPromptResult result = dlgSimulatorPromptShowModal(); switch (result) { case SPR_QUIT: return false; case SPR_FLY: global_simulator_flag = false; break; case SPR_SIMULATOR: global_simulator_flag = true; break; } } #endif CommonInterface::SetSystemSettings().SetDefaults(); CommonInterface::SetComputerSettings().SetDefaults(); CommonInterface::SetUIState().Clear(); const auto &computer_settings = CommonInterface::GetComputerSettings(); const auto &ui_settings = CommonInterface::GetUISettings(); auto &live_blackboard = CommonInterface::GetLiveBlackboard(); if (!LoadProfile()) return false; operation.SetText(_("Initialising")); /* create XCSoarData on the first start */ CreateDataPath(); Display::LoadOrientation(operation); main_window->CheckResize(); main_window->InitialiseConfigured(); { file_cache = new FileCache(LocalPath(_T("cache"))); } ReadLanguageFile(); InputEvents::readFile(); // Initialize DeviceBlackboard device_blackboard = new DeviceBlackboard(); devices = new MultipleDevices(); device_blackboard->SetDevices(*devices); // Initialize main blackboard data task_events = new GlideComputerTaskEvents(); task_manager = new TaskManager(computer_settings.task, way_points); task_manager->SetTaskEvents(*task_events); task_manager->Reset(); protected_task_manager = new ProtectedTaskManager(*task_manager, computer_settings.task); // Read the terrain file operation.SetText(_("Loading Terrain File...")); LogFormat("OpenTerrain"); terrain = RasterTerrain::OpenTerrain(file_cache, operation); logger = new Logger(); glide_computer = new GlideComputer(way_points, airspace_database, *protected_task_manager, *task_events); glide_computer->ReadComputerSettings(computer_settings); glide_computer->SetTerrain(terrain); glide_computer->SetLogger(logger); glide_computer->Initialise(); replay = new Replay(logger, *protected_task_manager); #ifdef HAVE_CMDLINE_REPLAY if (CommandLine::replay_path != nullptr) { Error error; if (!replay->Start(Path(CommandLine::replay_path), error)) LogError(error); } #endif GlidePolar &gp = CommonInterface::SetComputerSettings().polar.glide_polar_task; gp = GlidePolar(0); gp.SetMC(computer_settings.task.safety_mc); gp.SetBugs(computer_settings.polar.degradation_factor); PlaneGlue::FromProfile(CommonInterface::SetComputerSettings().plane, Profile::map); PlaneGlue::Synchronize(computer_settings.plane, CommonInterface::SetComputerSettings(), gp); task_manager->SetGlidePolar(gp); // Read the topography file(s) topography = new TopographyStore(); LoadConfiguredTopography(*topography, operation); // Read the waypoint files WaypointGlue::LoadWaypoints(way_points, terrain, operation); // Read and parse the airfield info file WaypointDetails::ReadFileFromProfile(way_points, operation); // Set the home waypoint WaypointGlue::SetHome(way_points, terrain, CommonInterface::SetComputerSettings().poi, CommonInterface::SetComputerSettings().team_code, device_blackboard, false); // ReSynchronise the blackboards here since SetHome touches them device_blackboard->Merge(); CommonInterface::ReadBlackboardBasic(device_blackboard->Basic()); // Scan for weather forecast LogFormat("RASP load"); rasp = new RaspStore(); rasp->ScanAll(); // Reads the airspace files ReadAirspace(airspace_database, terrain, computer_settings.pressure, operation); { const AircraftState aircraft_state = ToAircraftState(device_blackboard->Basic(), device_blackboard->Calculated()); ProtectedAirspaceWarningManager::ExclusiveLease lease(glide_computer->GetAirspaceWarnings()); lease->Reset(aircraft_state); } #ifdef HAVE_NOAA noaa_store = new NOAAStore(); noaa_store->LoadFromProfile(); #endif AudioVarioGlue::Initialise(); AudioVarioGlue::Configure(ui_settings.sound.vario); // Start the device thread(s) operation.SetText(_("Starting devices")); devStartup(); /* -- Reset polar in case devices need the data GlidePolar::UpdatePolar(true, computer_settings); This should be done inside devStartup if it is really required */ operation.SetText(_("Initialising display")); GlueMapWindow *map_window = main_window->GetMap(); if (map_window != nullptr) { map_window->SetWaypoints(&way_points); map_window->SetTask(protected_task_manager); map_window->SetRoutePlanner(&glide_computer->GetProtectedRoutePlanner()); map_window->SetGlideComputer(glide_computer); map_window->SetAirspaces(&airspace_database); map_window->SetTopography(topography); map_window->SetTerrain(terrain); map_window->SetWeather(rasp); #ifdef HAVE_NOAA map_window->SetNOAAStore(noaa_store); #endif /* show map at home waypoint until GPS fix becomes available */ if (computer_settings.poi.home_location_available) map_window->SetLocation(computer_settings.poi.home_location); } // Finally ready to go.. all structures must be present before this. // Create the drawing thread #ifndef ENABLE_OPENGL draw_thread = new DrawThread(*map_window); draw_thread->Start(true); #endif // Show the infoboxes InfoBoxManager::Show(); // Create the calculation thread CreateCalculationThread(); // Find unique ID of this PDA ReadAssetNumber(); glide_computer_events = new GlideComputerEvents(); glide_computer_events->Reset(); live_blackboard.AddListener(*glide_computer_events); all_monitors = new AllMonitors(); if (!is_simulator() && computer_settings.logger.enable_flight_logger) { flight_logger = new GlueFlightLogger(live_blackboard); flight_logger->SetPath(LocalPath(_T("flights.log"))); } if (computer_settings.logger.enable_nmea_logger) NMEALogger::enabled = true; LogFormat("ProgramStarted"); // Give focus to the map main_window->SetDefaultFocus(); // Start calculation thread merge_thread->Start(); calculation_thread->Start(); PageActions::Update(); #ifdef HAVE_TRACKING tracking = new TrackingGlue(); tracking->SetSettings(computer_settings.tracking); #ifdef HAVE_SKYLINES_TRACKING_HANDLER if (map_window != nullptr) map_window->SetSkyLinesData(&tracking->GetSkyLinesData()); #endif #endif assert(!global_running); global_running = true; AfterStartup(); operation.Hide(); main_window->FinishStartup(); return true; }
/* Actually initialize console ... */ void InitConsole(void) { /* Use this to activate full screen mode after console has been ** initialized. */ unsigned char init[6] = {0xC2, 0x11, 0x40, 0x40, 0, 0}; int i; /* Array for checking is PSS fonts are loaded */ char pss[256]; /* Allocate memory */ ScrBuf=malloc(4100); if (ScrBuf==NULL) { puts("Cannot mallocate memory for screen buffer!"); exit(77); } /* Block system standarts... */ system("cp set msg off"); system("cp set emsg off"); system("cp set imsg off"); system("cp term brkkey none"); /* Test PSS */ system("desbuf"); system("query display (stack"); gets(pss); i=1; if (pss[63]!='P') i=0; if (pss[64]!='S') i=0; if (pss[65]!='S') i=0; if (pss[72]!='0') i=0; if (pss[73]!='1') i=0; if (pss[74]!='A') i=0; if (pss[75]!='B') i=0; if (i==0) { /* No PSS. Cannot run without them... */ puts("ERROR: Cannot run without PSS fonts!"); exit(77); } ScrBuf[0]=0xC2; ScrBuf[1]=0; BufLen=1; /* Allocate memory */ InBuf=malloc(200); if (InBuf==NULL) { puts("Cannot mallocate memory for screen buffer!"); exit(77); } /* Okay, lets make some intial assigments */ InBuf[0]=0; ComBuf[0]=0; ComPtr=ComBuf; LastCmd[0]=0; GetAddr(FIELD_SY, FIELD_SX, ScrField); GetAddr(FIELD_EY, FIELD_EX, ScrField+11); GetAddr(FIELD_SY, FIELD_SX+1, wiping); GetAddr(FIELD_SY, FIELD_SX+1, CursorHome); /* Initialize console */ cnsxinit(cons, 0x9, 1, CNSHD); /* Activate full-screen mode */ cnswrite(cons, init, 6); /* No lines on screen were changed */ for (i=1; i<25; i++) DISP[i]=0; /* Corsor home... */ AddScrBuf(CursorHome, sizeof(CursorHome)); /* No console interrupt yet */ CNSINTR=0; /* No check keypresses yet */ kbhitcount=0; /* Let's load 'profile angband' for PFs settings */ LoadProfile(); }