Директива {$Title ' '}

Добавляет описание файлу. К примеру, в диспетчере задач у программы с данной директивой будет указано описание из директивы.
This commit is contained in:
Kotov 2019-04-22 22:12:15 +03:00 committed by GitHub
parent 7ded3e1535
commit e414042e8d
10 changed files with 59 additions and 5 deletions

View file

@ -1919,12 +1919,17 @@ namespace PascalABCCompiler
{
cdo.Copyright = cds[0].directive;
}
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.title_string, out cds))
{
cdo.Title = cds[0].directive;
}
if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.main_resource_string, out cds))
{
if (compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.product_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.version_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.company_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.trademark_string))
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.trademark_string) ||
compilerDirectives.ContainsKey(TreeConverter.compiler_string_consts.title_string))
{
ErrorsList.Add(new MainResourceNotAllowed(cds[0].location));
}
@ -1978,6 +1983,8 @@ namespace PascalABCCompiler
cdo.TradeMark = project.trademark;
if (!string.IsNullOrEmpty(project.copyright))
cdo.Copyright = project.copyright;
if (!string.IsNullOrEmpty(project.title))
cdo.Title = project.title;
if (!string.IsNullOrEmpty(project.app_icon) && false)
{
//cdo.MainResourceFileName = project.app_icon;

View file

@ -101,6 +101,12 @@ namespace PascalABCCompiler
set;
}
string Title
{
get;
set;
}
string CommandLineArguments
{
get;

View file

@ -29,6 +29,7 @@ namespace PascalABCCompiler
private string _company;
private string _trademark;
private string _copyright;
private string _title;
private PascalABCCompiler.ProjectType _project_type;
private List<SourceCodeFileInfo> _source_files = new List<SourceCodeFileInfo>();
private List<ReferenceInfo> _references = new List<ReferenceInfo>();
@ -190,7 +191,19 @@ namespace PascalABCCompiler
}
}
public string path
public string title
{
get
{
return _title;
}
set
{
_title = value;
}
}
public string path
{
get
{
@ -467,6 +480,7 @@ namespace PascalABCCompiler
writer.WriteAttributeString("Company", company);
writer.WriteAttributeString("Trademark", trademark);
writer.WriteAttributeString("Copyright", copyright);
writer.WriteAttributeString("Title", title);
writer.WriteAttributeString("MajorVersion", Convert.ToString(major_version));
writer.WriteAttributeString("MinorVersion", Convert.ToString(minor_version));
writer.WriteAttributeString("BuildVersion", Convert.ToString(build_version));
@ -532,6 +546,8 @@ namespace PascalABCCompiler
company = reader.GetAttribute("Company");
trademark = reader.GetAttribute("Trademark");
copyright = reader.GetAttribute("Copyright");
title = reader.GetAttribute("Title");
if (title == null) title = ""; //Проверка на null, так как раньше этого атрибута не было
major_version = Convert.ToInt32(reader.GetAttribute("MajorVersion"));
minor_version = Convert.ToInt32(reader.GetAttribute("MinorVersion"));
build_version = Convert.ToInt32(reader.GetAttribute("BuildVersion"));
@ -731,6 +747,18 @@ namespace PascalABCCompiler
_copyright = value;
}
}
public string Title
{
get
{
return _title;
}
set
{
_title = value;
}
}
}
public class SourceCodeFileInfo : PascalABCCompiler.IFileInfo

View file

@ -86,6 +86,13 @@ namespace PascalABCCompiler.NETGenerator
get { return _TradeMark; }
set { _TradeMark = value; NeedDefineVersionInfo = true; }
}
private string _Title = "";
public string Title
{
get { return _Title; }
set { _Title = value; NeedDefineVersionInfo = true; }
}
public string MainResourceFileName = null;
@ -896,6 +903,8 @@ namespace PascalABCCompiler.NETGenerator
ab.SetCustomAttribute(typeof(System.Runtime.CompilerServices.CompilationRelaxationsAttribute).GetConstructor(new Type[1] { TypeFactory.Int32Type }),
new byte[] { 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 });
ab.SetCustomAttribute(new CustomAttributeBuilder(typeof(System.Reflection.AssemblyTitleAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { options.Title }));
if (RunOnly)
{
object main_class = ab.CreateInstance(cur_unit + ".Program");

View file

@ -338,6 +338,7 @@ namespace PascalABCCompiler.TreeConverter
public static string copyright_string = "copyright";
public static string trademark_string = "trademark";
public static string main_resource_string = "mainresource";
public static string title_string = "title";
public static string system_unit_marker = "__IS_SYSTEM_MODULE";
public static string system_unit_file_name = "PABCSystem";

View file

@ -469,6 +469,7 @@ namespace VisualPascalABC
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox tbTradeMark;
private System.Windows.Forms.TextBox tbCopyright;
//private System.Windows.Forms.TextBox tbTitle;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;

View file

@ -51,6 +51,7 @@ namespace VisualPascalABC
this.tbCompany.Text = prj.Company;
this.tbTradeMark.Text = prj.Trademark;
this.tbCopyright.Text = prj.Copyright;
//this.tbTitle.Text = prj.Title;
}
public void SetOptions(PascalABCCompiler.IProjectInfo prj)
@ -78,6 +79,7 @@ namespace VisualPascalABC
prj.Company = this.tbCompany.Text;
prj.Trademark = this.tbTradeMark.Text;
prj.Copyright = this.tbCopyright.Text;
//prj.Title = this.tbTitle.Text;
}
private void ProjectProperties_FormClosing(object sender, FormClosingEventArgs e)

View file

@ -12,7 +12,7 @@ CYCLIC_UNIT_REFERENCE_WITH_UNIT_{0}=Cyclic unit reference with unit '{0}'
UNDEFINED_SEMANTIC_ERROR{0}=Undefined semantic error : {0}
RESOURCEFILE_{0}_NOT_FOUND=Resource file '{0}' not found
DUPLICATE_USES_UNIT{0}=Duplicate identifier '{0}' in uses section
MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: product, version, company, trademark
MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: product, version, company, trademark, title
DUPLICATE_DIRECTIVE{0}=Duplicate directive {0}
FILE_{0}_NOT_FOUND=File '{0}' not found

View file

@ -12,7 +12,7 @@ CYCLIC_UNIT_REFERENCE_WITH_UNIT_{0}=Циклическая связь с мод
UNDEFINED_SEMANTIC_ERROR{0}=Неопределенная семантическая ошибка : {0}
RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не найден
DUPLICATE_USES_UNIT{0}=Повторное подключение модуля {0} в секции uses
MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное использование директивы mainresource и директив product, version, company, trademark
MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное использование директивы mainresource и директив product, version, company, trademark, title
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
FILE_{0}_NOT_FOUND=Файл '{0}' не найден

View file

@ -12,7 +12,7 @@ CYCLIC_UNIT_REFERENCE_WITH_UNIT_{0}=Циклічний зв'язок з моду
UNDEFINED_SEMANTIC_ERROR{0}=Невизначена семантична помилка : {0}
RESOURCEFILE_{0}_NOT_FOUND=Файл '{0}' не знайдено
DUPLICATE_USES_UNIT{0}=Повторне підключення модуля {0} в секції uses
MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне використання директиви mainresource і директив product, version, company, trademark
MAINRESOURCE_NOT_ALLOWED=Неприпустимо сумісне використання директиви mainresource і директив product, version, company, trademark, title
DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0}
FILE_{0}_NOT_FOUND=Файл '{0}' не знайдено