IDE: Add Source/Insert General/MIT Notice. Issue #22151, patch from Reinier Olislagers

git-svn-id: trunk@37466 -
This commit is contained in:
juha 2012-05-30 16:56:55 +00:00
parent 56bf9efdff
commit b1a2dfb791
8 changed files with 56 additions and 4 deletions

View File

@ -457,6 +457,7 @@ begin
ecInsertGPLNotice : Result:= srkmecInsertGPLNotice;
ecInsertLGPLNotice : Result:= srkmecInsertLGPLNotice;
ecInsertModifiedLGPLNotice: Result:= srkmecInsertModifiedLGPLNotice;
ecInsertMITNotice : Result:= srkmecInsertMITNotice;
ecInsertUserName : Result:= srkmecInsertUserName;
ecInsertDateTime : Result:= srkmecInsertDateTime;
ecInsertChangeLogEntry : Result:= srkmecInsertChangeLogEntry;
@ -959,6 +960,7 @@ begin
ecInsertGPLNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertLGPLNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertModifiedLGPLNotice:SetSingle(VK_UNKNOWN,[]);
ecInsertMITNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertUserName: SetSingle(VK_UNKNOWN,[]);
ecInsertDateTime: SetSingle(VK_UNKNOWN,[]);
ecInsertChangeLogEntry:SetSingle(VK_UNKNOWN,[]);
@ -1403,6 +1405,7 @@ begin
ecInsertGPLNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertLGPLNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertModifiedLGPLNotice:SetSingle(VK_UNKNOWN,[]);
ecInsertMITNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertUserName: SetSingle(VK_UNKNOWN,[]);
ecInsertDateTime: SetSingle(VK_UNKNOWN,[]);
ecInsertChangeLogEntry:SetSingle(VK_UNKNOWN,[]);
@ -2008,6 +2011,7 @@ begin
ecInsertGPLNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertLGPLNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertModifiedLGPLNotice:SetSingle(VK_UNKNOWN,[]);
ecInsertMITNotice: SetSingle(VK_UNKNOWN,[]);
ecInsertUserName: SetSingle(VK_UNKNOWN,[]);
ecInsertDateTime: SetSingle(VK_UNKNOWN,[]);
ecInsertChangeLogEntry:SetSingle(VK_UNKNOWN,[]);
@ -2533,6 +2537,7 @@ begin
AddDefault(C, 'Insert GPL notice', srkmecInsertGPLNotice, ecInsertGPLNotice);
AddDefault(C, 'Insert LGPL notice', srkmecInsertLGPLNotice, ecInsertLGPLNotice);
AddDefault(C, 'Insert modified LGPL notice', srkmecInsertModifiedLGPLNotice, ecInsertModifiedLGPLNotice);
AddDefault(C, 'Insert MIT notice', srkmecInsertMITNotice, ecInsertMITNotice);
AddDefault(C, 'Insert username', lisKMInsertUsername, ecInsertUserName);
AddDefault(C, 'Insert date and time', lisKMInsertDateAndTime, ecInsertDateTime);
AddDefault(C, 'Insert ChangeLog entry', srkmecInsertChangeLogEntry, ecInsertChangeLogEntry);

View File

@ -288,6 +288,7 @@ resourcestring
lisMenuInsertGPLNotice = 'GPL Notice';
lisMenuInsertLGPLNotice = 'LGPL Notice';
lisMenuInsertModifiedLGPLNotice = 'Modified LGPL Notice';
lisMenuInsertMITNotice = 'MIT Notice';
lisMenuInsertUserName = 'Current Username';
lisMenuInsertDateTime = 'Current Date and Time';
lisMenuInsertChangeLogEntry = 'ChangeLog Entry';
@ -1038,6 +1039,30 @@ resourcestring
+'along with this library; if not, write to the Free Software '
+'Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.';
// MIT license aka Expat license see: http://www.opensource.org/licenses/MIT
lisMITNotice =
'<description>'
+'%s'
+'Copyright (c) <year> <copyright holders>'
+'%s'
+'Permission is hereby granted, free of charge, to any person obtaining a copy of '
+'this software and associated documentation files (the "Software"), to deal in '
+'the Software without restriction, including without limitation the rights to '
+'use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of '
+'the Software, and to permit persons to whom the Software is furnished to do so, '
+'subject to the following conditions:'
+'%s'
+'The above copyright notice and this permission notice shall be included in all '
+'copies or substantial portions of the Software.'
+'%s'
+'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR '
+'IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, '
+'FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE '
+'AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER '
+'LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, '
+'OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE '
+'SOFTWARE.';
// Options dialog groups
dlgGroupEnvironment = 'Environment';
dlgGroupEditor = 'Editor';
@ -2665,6 +2690,7 @@ resourcestring
srkmecInsertGPLNotice = 'Insert GPL notice';
srkmecInsertLGPLNotice = 'Insert LGPL notice';
srkmecInsertModifiedLGPLNotice = 'Insert modified LGPL notice';
srkmecInsertMITNotice = 'Insert MIT notice';
lisKMInsertUsername = 'Insert username';
lisKMInsertDateAndTime = 'Insert date and time';
srkmecInsertUserName = 'Insert current username';

View File

@ -280,6 +280,7 @@ type
procedure mnuSourceInsertGPLNoticeClick(Sender: TObject);
procedure mnuSourceInsertLGPLNoticeClick(Sender: TObject);
procedure mnuSourceInsertModifiedLGPLNoticeClick(Sender: TObject);
procedure mnuSourceInsertMITNoticeClick(Sender: TObject);
procedure mnuSourceInsertUsernameClick(Sender: TObject);
procedure mnuSourceInsertDateTimeClick(Sender: TObject);
procedure mnuSourceInsertChangeLogEntryClick(Sender: TObject);
@ -2641,6 +2642,7 @@ begin
itmSourceInsertGPLNotice.OnClick:=@mnuSourceInsertGPLNoticeClick;
itmSourceInsertLGPLNotice.OnClick:=@mnuSourceInsertLGPLNoticeClick;
itmSourceInsertModifiedLGPLNotice.OnClick:=@mnuSourceInsertModifiedLGPLNoticeClick;
itmSourceInsertMITNotice.OnClick:=@mnuSourceInsertMITNoticeClick;
itmSourceInsertUsername.OnClick:=@mnuSourceInsertUsernameClick;
itmSourceInsertDateTime.OnClick:=@mnuSourceInsertDateTimeClick;
itmSourceInsertChangeLogEntry.OnClick:=@mnuSourceInsertChangeLogEntryClick;
@ -4050,6 +4052,7 @@ begin
itmSourceInsertGPLNotice.Enabled:=Editable;
itmSourceInsertLGPLNotice.Enabled:=Editable;
itmSourceInsertModifiedLGPLNotice.Enabled:=Editable;
itmSourceInsertMITNotice.Enabled:=Editable;
itmSourceInsertUsername.Enabled:=Editable;
itmSourceInsertDateTime.Enabled:=Editable;
itmSourceInsertChangeLogEntry.Enabled:=Editable;
@ -18910,6 +18913,11 @@ begin
DoSourceEditorCommand(ecInsertModifiedLGPLNotice,false);
end;
procedure TMainIDE.mnuSourceInsertMITNoticeClick(Sender: TObject);
begin
DoSourceEditorCommand(ecInsertMITNotice,false);
end;
procedure TMainIDE.mnuSourceInsertUsernameClick(Sender: TObject);
begin
DoSourceEditorCommand(ecInsertUserName,false);

View File

@ -226,6 +226,7 @@ type
itmSourceInsertGPLNotice: TIDEMenuCommand;
itmSourceInsertLGPLNotice: TIDEMenuCommand;
itmSourceInsertModifiedLGPLNotice: TIDEMenuCommand;
itmSourceInsertMITNotice: TIDEMenuCommand;
itmSourceInsertUsername: TIDEMenuCommand;
itmSourceInsertDateTime: TIDEMenuCommand;
itmSourceInsertChangeLogEntry: TIDEMenuCommand;

View File

@ -610,6 +610,7 @@ begin
CreateMenuItem(SubParentMI,itmSourceInsertGPLNotice,'itmSourceInsertGPLNotice',lisMenuInsertGPLNotice);
CreateMenuItem(SubParentMI,itmSourceInsertLGPLNotice,'itmSourceInsertLGPLNotice',lisMenuInsertLGPLNotice);
CreateMenuItem(SubParentMI,itmSourceInsertModifiedLGPLNotice,'itmSourceInsertModifiedLGPLNotice',lisMenuInsertModifiedLGPLNotice);
CreateMenuItem(SubParentMI,itmSourceInsertMITNotice,'itmSourceInsertMITNotice',lisMenuInsertMITNotice);
CreateMenuItem(SubParentMI,itmSourceInsertUsername,'itmSourceInsertUsername',lisMenuInsertUsername);
CreateMenuItem(SubParentMI,itmSourceInsertDateTime,'itmSourceInsertDateTime',lisMenuInsertDateTime);
CreateMenuItem(SubParentMI,itmSourceInsertChangeLogEntry,'itmSourceInsertChangeLogEntry',lisMenuInsertChangeLogEntry);
@ -944,6 +945,7 @@ begin
itmSourceInsertGPLNotice.Command:=GetCommand(ecInsertGPLNotice);
itmSourceInsertLGPLNotice.Command:=GetCommand(ecInsertLGPLNotice);
itmSourceInsertModifiedLGPLNotice.Command:=GetCommand(ecInsertModifiedLGPLNotice);
itmSourceInsertMITNotice.Command:=GetCommand(ecInsertMITNotice);
itmSourceInsertUsername.Command:=GetCommand(ecInsertUserName);
itmSourceInsertDateTime.Command:=GetCommand(ecInsertDateTime);
itmSourceInsertChangeLogEntry.Command:=GetCommand(ecInsertChangeLogEntry);

View File

@ -10,8 +10,8 @@ inherited SourceNotebook: TSourceNotebook
OnMouseUp = FormMouseUp
object StatusBar: TStatusBar[0]
Left = 0
Height = 23
Top = 277
Height = 22
Top = 278
Width = 400
Panels = <
item

View File

@ -405,6 +405,7 @@ type
procedure InsertGPLNotice(CommentType: TCommentType);
procedure InsertLGPLNotice(CommentType: TCommentType);
procedure InsertModifiedLGPLNotice(CommentType: TCommentType);
procedure InsertMITNotice(CommentType: TCommentType);
procedure InsertUsername;
procedure InsertDateTime;
procedure InsertChangeLogEntry;
@ -3192,6 +3193,9 @@ Begin
ecInsertModifiedLGPLNotice:
InsertModifiedLGPLNotice(comtDefault);
ecInsertMITNotice:
InsertMITNotice(comtDefault);
ecInsertUserName:
InsertUsername;
@ -3641,6 +3645,11 @@ begin
InsertLicenseNotice(lisModifiedLGPLNotice, CommentType);
end;
procedure TSourceEditor.InsertMITNotice(CommentType: TCommentType);
begin
InsertLicenseNotice(lisMITNotice, CommentType);
end;
procedure TSourceEditor.InsertUsername;
begin
if ReadOnly then Exit;

View File

@ -115,8 +115,9 @@ const
ecInsertCVSRevision = ecFirstLazarus + 92;
ecInsertCVSSource = ecFirstLazarus + 93;
ecInsertModifiedLGPLNotice= ecFirstLazarus + 94;
ecInsertGUID = ecFirstLazarus + 95;
ecInsertFilename = ecFirstLazarus + 96;
ecInsertMITNotice = ecFirstLazarus + 95;
ecInsertGUID = ecFirstLazarus + 96;
ecInsertFilename = ecFirstLazarus + 97;
// source tools
ecWordCompletion = ecFirstLazarus + 100;