void SSessionConsoleShortcutWindow::Construct( const FArguments& InArgs )
{
	OnCommandSubmitted = InArgs._OnCommandSubmitted;

	ChildSlot
	[
		SNew(SVerticalBox)

		+ SVerticalBox::Slot()
			.FillHeight(1.0f)
			.Padding(6.0f, 0.0f, 0.0f, 0.0f)
			[
				SAssignNew(ShortcutListView, SListView<TSharedPtr<FConsoleShortcutData>>)
					.ItemHeight(24.0f)
					.ListItemsSource(&Shortcuts)
					.SelectionMode(ESelectionMode::None)
					.OnGenerateRow(this, &SSessionConsoleShortcutWindow::HandleShortcutListViewGenerateRow)
					.HeaderRow
					(
						SNew(SHeaderRow)

						+ SHeaderRow::Column("Command")
							.DefaultLabel(LOCTEXT("ShortcutHeaderText", "Shortcuts"))
					)
			]
	];

	LoadShortcuts();
	RebuildUI();
}
Пример #2
0
void CCustomPreferences::Load(CInifile* I)
{
    psDeviceFlags.flags		= R_U32_SAFE	("editor_prefs","device_flags",	psDeviceFlags.flags);
    psSoundFlags.flags		= R_U32_SAFE	("editor_prefs","sound_flags",	psSoundFlags.flags)

    Tools->m_Settings.flags	= R_U32_SAFE	("editor_prefs","tools_settings",Tools->m_Settings.flags);
    
    view_np				= R_FLOAT_SAFE	("editor_prefs","view_np"			,view_np		 	);
    view_fp				= R_FLOAT_SAFE	("editor_prefs","view_fp"			,view_fp		 	);
    view_fov			= R_FLOAT_SAFE	("editor_prefs","view_fov"			,view_fov			);

    fog_color			= R_U32_SAFE	("editor_prefs","fog_color"			,fog_color			);
    fog_fogness			= R_FLOAT_SAFE	("editor_prefs","fog_fogness"		,fog_fogness	 	);

    cam_fly_speed		= R_FLOAT_SAFE	("editor_prefs","cam_fly_speed"		,cam_fly_speed		);
    cam_fly_alt			= R_FLOAT_SAFE	("editor_prefs","cam_fly_alt"		,cam_fly_alt	 	);
    cam_sens_rot		= R_FLOAT_SAFE	("editor_prefs","cam_sens_rot"		,cam_sens_rot		);
    cam_sens_move		= R_FLOAT_SAFE	("editor_prefs","cam_sens_move"		,cam_sens_move		);

    tools_sens_move		= R_FLOAT_SAFE	("editor_prefs","tools_sens_move"	,tools_sens_move  	);
    tools_sens_rot		= R_FLOAT_SAFE	("editor_prefs","tools_sens_rot"	,tools_sens_rot		);
    tools_sens_scale	= R_FLOAT_SAFE	("editor_prefs","tools_sens_scale"	,tools_sens_scale	);
    
    bp_lim_depth		= R_BOOL_SAFE	("editor_prefs","bp_lim_depth"		,bp_lim_depth		);
    bp_cull				= R_BOOL_SAFE	("editor_prefs","bp_lim_depth"		,bp_cull		  	);
    bp_depth_tolerance	= R_FLOAT_SAFE	("editor_prefs","tools_sens_rot"	,bp_depth_tolerance	);

    snap_angle			= R_FLOAT_SAFE	("editor_prefs","snap_angle"		,snap_angle			);
    snap_move			= R_FLOAT_SAFE	("editor_prefs","snap_move"			,snap_move			);
    snap_moveto			= R_FLOAT_SAFE	("editor_prefs","snap_moveto"		,snap_moveto	   	);

    grid_cell_size		= R_FLOAT_SAFE	("editor_prefs","grid_cell_size"	,grid_cell_size		);
    grid_cell_count		= R_U32_SAFE	("editor_prefs","grid_cell_count"	,grid_cell_count   	);

    scene_undo_level	= R_U32_SAFE	("editor_prefs","scene_undo_level"	,scene_undo_level	);
    scene_recent_count	= R_U32_SAFE	("editor_prefs","scene_recent_count",scene_recent_count	);
    scene_clear_color	= R_U32_SAFE	("editor_prefs","scene_clear_color"	,scene_clear_color	);

    object_flags.flags	= R_U32_SAFE	("editor_prefs","object_flags"		,object_flags.flags );

	// read recent list    
    for (u32 i=0; i<scene_recent_count; i++){
    	shared_str fn  	= R_STRING_SAFE	("editor_prefs",AnsiString().sprintf("recent_files_%d",i).c_str(),shared_str("") );
        if (fn.size())	scene_recent_list.push_back(*fn);
    }
    sWeather = R_STRING_SAFE	("editor_prefs", "weather", shared_str("") );
    // load shortcuts
    LoadShortcuts		(I);

    UI->LoadSettings	(I);
}
Пример #3
0
BOOL CShortcut::LoadShortcuts(CArrayFP<CShortcut*>& aShortcuts,BYTE bLoadFlags)
{
	CRegKey2 RegKey;
	if (RegKey.OpenKey(HKCU,"\\General",CRegKey::defRead)!=ERROR_SUCCESS)
		return FALSE;

	DWORD dwDataLength=RegKey.QueryValueLength("Shortcuts");
	if (dwDataLength<4)
		return FALSE;

	BYTE* pData=new BYTE[dwDataLength];
	RegKey.QueryValue("Shortcuts",(LPSTR)pData,dwDataLength,NULL);
	RegKey.CloseKey();

	BOOL bRet=LoadShortcuts(pData,dwDataLength,aShortcuts,bLoadFlags);
	delete[] pData;
	return bRet;
}
Пример #4
0
void CCustomPreferences::OnKeyboardCommonFileClick(ButtonValue* B, bool& bModif, bool&)
{
    bModif = false;
    xr_string fn;
	switch(B->btn_num){
    case 0:
        if(EFS.GetOpenName("$import$", fn, false, NULL, 6)){
            CInifile* 	I 	= xr_new<CInifile>(fn.c_str(), TRUE, TRUE, TRUE);
		    LoadShortcuts	(I);
            xr_delete		(I);
            m_ItemProps->RefreshForm();
        }
    break;
    case 1:
        if(EFS.GetSaveName("$import$", fn, NULL, 6)){
		    CInifile* 	I 	= xr_new<CInifile>(fn.c_str(), FALSE, TRUE, TRUE);
		    SaveShortcuts	(I);
            xr_delete		(I);
        }
    break;
	}
}
Пример #5
0
BOOL CShortcut::GetDefaultShortcuts(CArrayFP<CShortcut*>& aShortcuts,BYTE bLoadFlag)
{
	// This code saves currently saved shortcuts to correct file
	// Uncommend and run once

	
	/*
	// BEGIN 
	{
	LPCSTR szFile="C:\\Users\\jmhuttun\\Programming\\projects\\Locate\\Locate32\\commonres\\defaultshortcuts.dat";
	CRegKey2 RegKey;
	if (RegKey.OpenKey(HKCU,"\\General",CRegKey::defRead)!=ERROR_SUCCESS)
		return FALSE;
	DWORD dwDataLength=RegKey.QueryValueLength("Shortcuts");
	if (dwDataLength<4)
		return FALSE;
	BYTE* pData=new BYTE[dwDataLength];
	RegKey.QueryValue("Shortcuts",(LPSTR)pData,dwDataLength,NULL);
	RegKey.CloseKey();
	CFile File(TRUE);
	File.CloseOnDelete();
		

	try {
		File.Open(szFile,CFile::defWrite);
		File.Write(pData,dwDataLength);
		File.Close();
	}
	catch (...)
	{
	}
	}
	// END
	*/
	

	// Check file
	CStringW Path(GetLocateApp()->GetExeNameW());
	Path.FreeExtra(Path.FindLast(L'\\')+1);
	Path << L"defshrtc.dat";
    
	BYTE* pData=NULL;
	DWORD dwLength;
	try {
		CFile File(Path,CFile::defRead|CFile::otherErrorWhenEOF,TRUE);
		File.CloseOnDelete();

		dwLength=File.GetLength();
		pData=new BYTE[dwLength];
		File.Read(pData,dwLength);
		File.Close();
		BOOL bRet=LoadShortcuts(pData,dwLength,aShortcuts,bLoadFlag);
		delete[] pData;
		
		if (bRet)
            return TRUE;
	}
	catch (...)
	{
		if (pData!=NULL)
			delete[] pData;
	}



	HRSRC hRsrc=FindResource(GetInstanceHandle(),MAKEINTRESOURCE(IDR_DEFAULTSHORTCUTS),"DATA");
    if (hRsrc==NULL)
		return FALSE;
    	
	dwLength=SizeofResource(GetInstanceHandle(),hRsrc);
	if (dwLength<4)
		return FALSE;

	HGLOBAL hGlobal=LoadResource(GetInstanceHandle(),hRsrc);
	if (hGlobal==NULL)
		return FALSE;

	return LoadShortcuts((const BYTE*)LockResource(hGlobal),dwLength,aShortcuts,bLoadFlag);
}