public SettingsControl(SettingsWindow window, SolutionSettings settings) { Win = window; Options = settings; InitializeComponent(); CreateGrid(); }
public SettingsWindow(SolutionSettings settings) { Title = "Struct Layout Options"; WindowStartupLocation = WindowStartupLocation.CenterScreen; SizeToContent = SizeToContent.Height; Width = 900; this.Content = new SettingsControl(this, settings == null? new SolutionSettings() : settings); }
public SettingsControl(SettingsWindow window, SolutionSettings settings) { ThreadHelper.ThrowIfNotOnUIThread(); Win = window; Options = settings; InitializeComponent(); CreateGrid(); }
protected void AddCustomSettings(ProjectProperties projProperties, IMacroEvaluator evaluator) { ThreadHelper.ThrowIfNotOnUIThread(); SolutionSettings customSettings = SettingsManager.Instance.Settings; if (customSettings != null) { var evaluatorExtra = new MacroEvaluatorExtra(); AppendMSBuildStringToList(projProperties.IncludeDirectories, evaluator.Evaluate(evaluatorExtra.Evaluate(customSettings.AdditionalIncludeDirs))); AppendMSBuildStringToList(projProperties.ForceIncludes, evaluator.Evaluate(evaluatorExtra.Evaluate(customSettings.AdditionalForceIncludes))); AppendMSBuildStringToList(projProperties.PrepocessorDefinitions, evaluator.Evaluate(evaluatorExtra.Evaluate(customSettings.AdditionalPreprocessorDefinitions))); projProperties.ExtraArguments = evaluator.Evaluate(evaluatorExtra.Evaluate(customSettings.AdditionalCommandLine)); projProperties.ShowWarnings = customSettings.EnableWarnings; } }
private ProjectProperties GetProjectData() { ThreadHelper.ThrowIfNotOnUIThread(); Solution solution = GetActiveSolution(); if (solution == null) { return(null); } Project project = GetActiveProject(); if (project == null) { return(null); } VCProject prj = project.Object as VCProject; if (prj == null) { return(null); } VCConfiguration config = prj.ActiveConfiguration; if (config == null) { return(null); } VCPlatform platform = config.Platform; if (platform == null) { return(null); } var vctools = config.Tools as IVCCollection; if (vctools == null) { return(null); } var midl = vctools.Item("VCMidlTool") as VCMidlTool; ProjectProperties ret = new ProjectProperties(); ret.Target = midl != null && midl.TargetEnvironment == midlTargetEnvironment.midlTargetWin32 ? ProjectProperties.TargetType.x86 : ProjectProperties.TargetType.x64; //Working directory (always local to processed file) ret.WorkingDirectory = Path.GetDirectoryName(project.FullName); //TODO ~ ramonv ~ find a way to extract the /std value //Include dirs / files and preprocessor AppendMSBuildStringToList(ret.IncludeDirectories, platform.Evaluate(platform.IncludeDirectories)); AppendProjectProperties(ret, vctools.Item("VCCLCompilerTool") as VCCLCompilerTool, vctools.Item("VCNMakeTool") as VCNMakeTool, platform); try { //Get settings from the single file (this might fail badly if there are no settings to catpure) var applicationObject = ServiceProvider.GetService(typeof(DTE)) as EnvDTE80.DTE2; Assumes.Present(applicationObject); ProjectItem item = applicationObject.ActiveDocument.ProjectItem; VCFile vcfile = item.Object as VCFile; IVCCollection fileCfgs = (IVCCollection)vcfile.FileConfigurations; VCFileConfiguration fileConfig = fileCfgs.Item(config.Name) as VCFileConfiguration; AppendProjectProperties(ret, fileConfig.Tool as VCCLCompilerTool, fileConfig.Tool as VCNMakeTool, platform); } catch (Exception) {} SolutionSettings customSettings = SettingsManager.Instance.Settings; if (customSettings != null) { AppendMSBuildStringToList(ret.IncludeDirectories, platform.Evaluate(customSettings.AdditionalIncludeDirs)); AppendMSBuildStringToList(ret.ForceIncludes, platform.Evaluate(customSettings.AdditionalForceIncludes)); AppendMSBuildStringToList(ret.PrepocessorDefinitions, platform.Evaluate(customSettings.AdditionalPreprocessorDefinitions)); ret.ExtraArguments = platform.Evaluate(customSettings.AdditionalCommandLine); ret.ShowWarnings = customSettings.EnableWarnings; } //Exclude directories RemoveMSBuildStringFromList(ret.IncludeDirectories, platform.Evaluate(platform.ExcludeDirectories)); return(ret); }