added catalan

git-svn-id: trunk@4707 -
This commit is contained in:
mattias 2003-10-11 08:33:22 +00:00
parent 48f29ad4c9
commit 1b77f736e7
7 changed files with 118 additions and 74 deletions

View File

@ -89,17 +89,35 @@ const
{ IDE Language (Human, not computer) }
type
TLazarusLanguage = (llAutomatic,
llEnglish, llGerman, llSpanish, llFrench, llRussian, llPolish);
TLazarusLanguage = (
llAutomatic,
llCatalan,
llEnglish,
llFrench,
llGerman,
llItalian,
llPolish,
llRussian,
llSpanish
);
const
// language names for the config files
// for the translations see function GetLazarusLanguageNames below
LazarusLanguageNames: array[TLazarusLanguage] of string = (
'Automatic (default is english)',
'English', 'Deutsch', 'Spanish', 'French', 'Russian', 'Polish'
'Catalan',
'English',
'French',
'German',
'Italian',
'Polish',
'Russian',
'Spanish'
);
LazarusLanguageIDs: array[TLazarusLanguage] of string = (
'', 'en', 'de', 'es', 'fr', 'ru', 'pl'
'', 'ca', 'en', 'fr', 'de', 'it', 'pl', 'ru', 'es'
);
@ -651,6 +669,8 @@ begin
llFrench : Result:=rsLanguageFrench;
llRussian : Result:=rsLanguageRussian;
llPolish : Result:=rsLanguagePolish;
llItalian : Result:=rsLanguageItalian;
llCatalan : Result:=rsLanguageCatalan;
end;
end;

View File

@ -1241,10 +1241,12 @@ resourcestring
rsLanguageAutomatic = 'Automatic (or english)';
rsLanguageEnglish = 'English';
rsLanguageDeutsch = 'Deutsch';
rsLanguageSpanish = 'Español';
rsLanguageSpanish = 'Spanish';
rsLanguageFrench = 'French';
rsLanguageRussian = 'òÕÓÓËÉÊ';
rsLanguageRussian = 'Russian';
rsLanguagePolish = 'polski';
rsLanguageItalian = 'Italian';
rsLanguageCatalan = 'Catalan';
//Units dependencies
dlgUnitDepCaption = 'Unit dependencies';
@ -1606,6 +1608,8 @@ resourcestring
lisNewDlgCreateANewProgram = 'Create a new '
+'program.%sThe program file is maintained by Lazarus.';
lisNewDlgCreateANewCustomProgram = 'Create a new program.';
lisNewCreateANewCgiApplicationTheProgramFileIsMaintained = 'Create a new '
+'cgi application.%sThe program file is maintained by Lazarus.';
lisNewDlgCreateANewStandardPackageAPackageIsACollectionOfUn = 'Create a new '
+'standard package.%sA package is a collection of units and components.';

View File

@ -3886,7 +3886,8 @@ begin
AText:=Format(lisAFileAlreadyExistsReplaceIt, ['"', NewFilename, '"', #13]);
Result:=MessageDlg(ACaption, AText, mtConfirmation, [mbOk, mbCancel], 0);
if Result=mrCancel then exit;
end else if Project1.ProjectType in [ptProgram, ptApplication] then begin
end else if Project1.ProjectType in [ptProgram,ptApplication,ptCGIApplication]
then begin
if FileExists(NewProgramFilename) then begin
ACaption:=lisOverwriteFile;
AText:=Format(lisAFileAlreadyExistsReplaceIt, ['"', NewProgramFilename,
@ -4096,7 +4097,7 @@ begin
// create source code
if nfCreateDefaultSrc in NewFlags then begin
if NewUnitType in [nuForm,nuDataModule] then begin
if NewUnitType in [nuForm,nuDataModule,nuCGIDataModule] then begin
NewUnitInfo.ComponentName:=Project1.NewUniqueComponentName(NewUnitType);
NewUnitInfo.ComponentResourceName:='';
CodeToolBoss.CreateFile(ChangeFileExt(NewFilename,ResourceFileExt));
@ -4118,12 +4119,13 @@ begin
and (not (nfIsNotPartOfProject in NewFlags)));
end;
if OldUnitIndex<0 then begin
Project1.AddUnit(NewUnitInfo,(NewUnitType in [nuForm, nuUnit, nuDataModule])
and NewUnitInfo.IsPartOfProject);
Project1.AddUnit(NewUnitInfo,
(NewUnitType in [nuForm,nuUnit,nuDataModule,nuCGIDataModule])
and NewUnitInfo.IsPartOfProject);
end;
// syntax highlighter type
if NewUnitType in [nuForm,nuUnit,nuDataModule] then begin
if NewUnitType in [nuForm,nuUnit,nuDataModule,nuCGIDataModule] then begin
NewUnitInfo.SyntaxHighlighter:=lshFreePascal;
end else begin
NewUnitInfo.SyntaxHighlighter:=
@ -4146,6 +4148,9 @@ begin
case NewUnitType of
nuForm: AncestorType:=TForm;
nuDataModule: AncestorType:=TDataModule;
{$IFDEF HasCGIModules}
nuCGIDataModule: AncestorType:=TCGIDataModule;
{$ENDIF}
else AncestorType:=nil;
end;
if AncestorType<>nil then begin
@ -4200,6 +4205,7 @@ begin
niiApplication: DoNewProject(ptApplication);
niiFPCProject: DoNewProject(ptProgram);
niiCustomProject: DoNewProject(ptCustomProgram);
niiCGIApplication: DoNewProject(ptCGIApplication);
// packages
niiPackage: PkgBoss.DoNewPackage;
else
@ -4656,7 +4662,8 @@ Begin
Project1.Units[i].UnitName,i,Project1.Units[i]=ActiveUnitInfo));
end else if Project1.MainUnitID=i then begin
MainUnitInfo:=Project1.MainUnitInfo;
if Project1.ProjectType in [ptProgram,ptApplication,ptCustomProgram]
if Project1.ProjectType in [ptProgram,ptApplication,ptCustomProgram,
ptCGIApplication]
then begin
MainUnitName:=CreateSrcEditPageName(MainUnitInfo.UnitName,
MainUnitInfo.Filename,MainUnitInfo.EditorIndex);
@ -4986,6 +4993,11 @@ writeln('TMainIDE.DoNewProject A');
ptProgram,ptCustomProgram:
// show program unit
DoOpenMainUnit(false);
ptCGIApplication:
// create a first datamodule
DoNewEditorFile(nuCGIDataModule,'','',
[nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
end;
@ -5445,7 +5457,7 @@ begin
s:='"'+ActiveUnitInfo.Filename+'"'
else
s:='"'+ActiveSourceEditor.PageName+'"';
if (Project1.ProjectType in [ptProgram, ptApplication])
if (Project1.ProjectType in [ptProgram, ptApplication, ptCGIApplication])
and (ActiveUnitInfo.UnitName<>'')
and (Project1.IndexOfUnitWithName(ActiveUnitInfo.UnitName,
true,ActiveUnitInfo)>=0) then
@ -5463,7 +5475,8 @@ begin
if Result<>mrOk then exit;
ActiveUnitInfo.IsPartOfProject:=true;
if (FilenameIsPascalUnit(ActiveUnitInfo.Filename))
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
and (Project1.ProjectType in [ptProgram,ptApplication,ptCGIApplication])
then begin
ActiveUnitInfo.ReadUnitNameFromSource(false);
ShortUnitName:=ActiveUnitInfo.CreateUnitName;
if (ShortUnitName<>'') then begin
@ -5510,7 +5523,8 @@ Begin
AnUnitInfo:=Project1.Units[TViewUnitsEntry(UnitList[i]).ID];
AnUnitInfo.IsPartOfProject:=false;
if (Project1.MainUnitID>=0)
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
and (Project1.ProjectType in [ptProgram,ptApplication,ptCGIApplication])
then begin
if (AnUnitInfo.UnitName<>'') then begin
if CodeToolBoss.RemoveUnitFromAllUsesSections(
Project1.MainUnitInfo.Source,AnUnitInfo.UnitName)
@ -5720,7 +5734,8 @@ begin
Result := mrCancel;
// Check if we can run this project
if not (Project1.ProjectType in [ptProgram, ptApplication, ptCustomProgram])
if not (Project1.ProjectType in [ptProgram, ptApplication, ptCustomProgram,
ptCGIApplication])
or (Project1.MainUnitID < 0)
or (ToolStatus <> itNone)
then Exit;
@ -9180,7 +9195,8 @@ begin
BeginCodeTool(ActiveSourceEditor,ActiveUnitInfo,[]);
AnUnitInfo.IsPartOfProject:=true;
if FilenameIsPascalUnit(AnUnitInfo.Filename)
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
and (Project1.ProjectType in [ptProgram, ptApplication, ptCGIApplication])
then begin
AnUnitInfo.ReadUnitNameFromSource(false);
ShortUnitName:=AnUnitInfo.UnitName;
if (ShortUnitName<>'') then begin
@ -9209,7 +9225,8 @@ begin
Result:=mrOk;
AnUnitInfo.IsPartOfProject:=false;
if (Project1.MainUnitID>=0)
and (Project1.ProjectType in [ptProgram, ptApplication]) then begin
and (Project1.ProjectType in [ptProgram, ptApplication, ptCGIApplication])
then begin
BeginCodeTool(ActiveSourceEditor,ActiveUnitInfo,[]);
ShortUnitName:=AnUnitInfo.UnitName;
if (ShortUnitName<>'') then begin
@ -9800,6 +9817,9 @@ end.
{ =============================================================================
$Log$
Revision 1.655 2003/10/11 08:33:22 mattias
added catalan
Revision 1.654 2003/10/08 08:22:32 mattias
improved FPC Src template for new chaotic FPC sources

View File

@ -55,6 +55,7 @@ type
niiApplication,// Project: Application
niiFPCProject, // Project: with hidden main file
niiCustomProject,// Project: pascal program without any specials
niiCGIApplication,// Project: TCGIApplication using package cgilaz
niiPackage // standard package
);
TNewIDEItemTypes = set of TNewIDEItemType;
@ -517,6 +518,10 @@ begin
niiCustomProject:
Result:=lisNewDlgCreateANewCustomProgram;
niiCGIApplication:
Result:=Format(lisNewCreateANewCgiApplicationTheProgramFileIsMaintained, [
#13]);
niiPackage:
Result:=Format(
lisNewDlgCreateANewStandardPackageAPackageIsACollectionOfUn, [#13#13]);
@ -563,14 +568,16 @@ begin
TNewIDEItemTemplate.Create(niiFPCProject,'FPC Project',niifCopy,[]));
NewCategory.Add(
TNewIDEItemTemplate.Create(niiCustomProject,'Custom Project',niifCopy,[]));
{$IFDEF HasCGIModules}
NewCategory.Add(
TNewIDEItemTemplate.Create(niiCGIApplication,'CGI Application',niifCopy,[]));
{$ENDIF}
{$IFNDEF DisablePkgs}
// category package
NewCategory:=TNewIDEItemCategory.Create('Package');
Add(NewCategory);
NewCategory.Add(
TNewIDEItemTemplate.Create(niiPackage,'Standard Package',niifCopy,[]));
{$ENDIF}
end;
destructor TNewIDEItemCategories.Destroy;

View File

@ -264,7 +264,7 @@ type
{ TProject }
TProjectType = // for a description see ProjectTypeDescriptions below
(ptApplication, ptProgram, ptCustomProgram);
(ptApplication, ptProgram, ptCustomProgram, ptCGIApplication);
TProjectFlag = (
pfSaveClosedUnits, // save info about closed files (not part of project)
@ -299,7 +299,7 @@ type
fJumpHistory: TProjectJumpHistory;
fLastReadLPIFileDate: TDateTime;
fLastReadLPIFilename: string;
fMainUnitID: Integer; // only for ptApplication, ptProgram
fMainUnitID: Integer; // only for ptApplication, ptProgram, ptCGIApplication
fModified: boolean;
FOnBeginUpdate: TNotifyEvent;
FOnEndUpdate: TEndUpdateProjectEvent;
@ -490,7 +490,7 @@ const
ResourceFileExt = '.lrs';
ProjectTypeNames : array[TProjectType] of string = (
'Application', 'Program', 'Custom program'
'Application', 'Program', 'Custom program', 'CGI Application'
);
ProjectTypeDescriptions : array[TProjectType] of string = (
@ -507,14 +507,19 @@ const
// ptCustomProgram
,'Custom program:'#13
+'A freepascal program.'
// ptCGIApplication
,'CGI Application'#13
+'A cgi freepascal program. The program file is '
+'automatically maintained by lazarus.'#13
);
ProjectDefaultExt : array[TProjectType] of string = (
'.lpr','.pas','.pas'
'.lpr','.pas','.pas', 'pas'
);
UnitTypeDefaultExt: array[TNewUnitType] of string = (
'.pas', '.pas', '.pas', '.pas', '.txt', '.pas'
'.pas', '.pas', '.pas', '.pas', '.pas', '.txt', '.pas'
);
DefaultProjectFlags = [pfSaveClosedUnits];
@ -970,7 +975,7 @@ begin
if fSource=nil then exit;
NewSource:='';
LE:=EndOfLine;
if NewUnitType in [nuForm,nuUnit,nuDataModule] then begin
if NewUnitType in [nuForm,nuUnit,nuDataModule,nuCGIDataModule] then begin
fUnitName:=NewUnitName;
AResourceFilename:=fUnitName+ResourceFileExt;
NewSource:=Beautified(
@ -991,18 +996,32 @@ begin
+'implementation'+LE);
end;
nuForm, nuDataModule:
nuForm, nuDataModule, nuCGIDataModule:
begin
NewSource:=NewSource+Beautified(
' Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;'+LE
+LE
+'type'+LE);
if NewUnitType=nuForm then
NewSource:=NewSource+Beautified(
' Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;'+LE
+LE
+'type'+LE)
else if NewUnitType=nuDataModule then
NewSource:=NewSource+Beautified(
' Classes, SysUtils, LResources, Forms, Controls, Dialogs;'+LE
+LE
+'type'+LE)
else if NewUnitType=nuCGIDataModule then
NewSource:=NewSource+Beautified(
' Classes, SysUtils, LResources, cgiModules;'+LE
+LE
+'type'+LE);
if NewUnitType=nuForm then
NewSource:=NewSource+Beautified(
+' T'+fComponentName+' = class(TForm)'+LE)
else
else if NewUnitType=nuDataModule then
NewSource:=NewSource+Beautified(
+' T'+fComponentName+' = class(TDataModule)'+LE);
+' T'+fComponentName+' = class(TDataModule)'+LE)
else if NewUnitType=nuCGIDataModule then
NewSource:=NewSource+Beautified(
+' T'+fComponentName+' = class(TCGIDataModule)'+LE);
NewSource:=NewSource+Beautified(
' private'+LE);
NewSource:=NewSource
@ -1029,6 +1048,7 @@ begin
+LE
+'end.'+LE
+LE);
end else if NewUnitType in [nuCustomProgram] then begin
NewSource:=NewSource+Beautified(
+'program CustomProgram;'+LE
@ -1228,7 +1248,7 @@ begin
// create program source
NewSource:=TStringList.Create;
case fProjectType of
ptProgram, ptApplication, ptCustomProgram:
ptProgram, ptApplication, ptCustomProgram, ptCGIApplication:
begin
NewPrgBuf:=CodeToolBoss.CreateFile(
'project1'+ProjectDefaultExt[fProjectType]);
@ -1252,6 +1272,8 @@ begin
Add(' Interfaces,');
Add(' Forms;');
end;
ptCGIApplication:
Add(' cgiModules;');
else
Add(' { add your units here };');
end;
@ -1784,7 +1806,7 @@ var u:integer;
begin
u:=1;
case NewUnitType of
nuForm,nuUnit,nuDataModule: Prefix:='unit';
nuForm,nuUnit,nuDataModule,nuCGIDataModule: Prefix:='unit';
else Prefix:='text'
end;
while (UnitNameExists(Prefix+IntToStr(u))) do inc(u);
@ -1818,6 +1840,7 @@ begin
case NewUnitType of
nuForm, nuUnit: Prefix:='Form';
nuDataModule: Prefix:='DataModule';
nuCGIDataModule: Prefix:='CGIDataModule';
else
Prefix:='form';
end;
@ -2435,7 +2458,8 @@ begin
end;
end;
end;
if (OldUnitName<>'') and (ProjectType in [ptProgram, ptApplication]) then
if (OldUnitName<>'')
and (ProjectType in [ptProgram, ptApplication, ptCGIApplication]) then
begin
// rename unit in program uses section
CodeToolBoss.RenameUsedUnit(MainUnitInfo.Source
@ -2712,6 +2736,9 @@ end.
{
$Log$
Revision 1.138 2003/10/11 08:33:22 mattias
added catalan
Revision 1.137 2003/09/18 09:21:02 mattias
renamed LCLLinux to LCLIntf

View File

@ -53,6 +53,7 @@ type
nuUnit, // unit
nuForm, // unit with form
nuDataModule, // unit with data module
nuCGIDataModule, // unit with cgi data module
nuText,
nuCustomProgram // program
);

View File

@ -1154,8 +1154,8 @@ end;
function InitResourceComponent(Instance: TComponent;
RootAncestor: TClass):Boolean;
function InitComponent(ClassType: TClass): Boolean;
{ Old hack. Do we still need this?
procedure ApplyVisible;
var
i: integer;
@ -1174,43 +1174,8 @@ function InitResourceComponent(Instance: TComponent;
AControl.ControlState-[csVisibleSetInLoading];
end;
end;
end;
end;}
var
CompResource:TLResource;
MemStream: TMemoryStream;
begin
//writeln('[InitComponent] ',ClassType.Classname,' ',Instance<>nil);
Result:=false;
if (ClassType=TComponent) or (ClassType=RootAncestor) then exit;
if Assigned(ClassType.ClassParent) then
Result:=InitComponent(ClassType.ClassParent);
CompResource:=LazarusResources.Find(ClassType.ClassName);
if (CompResource = nil) or (CompResource.Value='') then exit;
//writeln('[InitComponent] CompResource found for ',ClassType.Classname);
if (ClassType.InheritsFrom(TForm))
and (CompResource.ValueType<>'FORMDATA') then exit;
MemStream:=TMemoryStream.Create;
try
MemStream.Write(CompResource.Value[1],length(CompResource.Value));
MemStream.Position:=0;
//writeln('Form Stream "',ClassType.ClassName,'" Signature=',copy(CompResource.Value,1,4));
try
Instance:=MemStream.ReadComponent(Instance);
except
on E: Exception do begin
writeln(Format(rsFormStreamingError, [ClassType.ClassName, E.Message])
);
exit;
end;
end;
finally
//ApplyVisible;
MemStream.Free;
end;
Result:=true;
end;
// InitResourceComponent
//var LocalizedLoading: Boolean;
begin