added Message Composer package from Salvatore Coppola (issue #10994)

git-svn-id: trunk@14781 -
This commit is contained in:
vincents 2008-04-08 10:23:16 +00:00
parent fa76d74554
commit 5baa3b91de
5 changed files with 1619 additions and 0 deletions

4
.gitattributes vendored
View File

@ -641,6 +641,9 @@ components/memds/memdsicons.lrs svneol=native#text/pascal
components/memds/memdslaz.lpk svneol=native#text/pascal
components/memds/memdslaz.pas svneol=native#text/pascal
components/memds/tmemdataset.png -text svneol=unset#image/png
components/messagecomposer/messagecomposer.lfm svneol=native#text/plain
components/messagecomposer/messagecomposer.lrs svneol=native#text/plain
components/messagecomposer/messagecomposer.pas svneol=native#text/plain
components/mpaslex/mpaslex.pp svneol=native#text/pascal
components/opengl/agl.pp svneol=native#text/plain
components/opengl/example/mainunit.lfm svneol=native#text/plain
@ -3472,6 +3475,7 @@ packager/globallinks/lazparadox-0.lpl svneol=native#text/plain
packager/globallinks/lazreport-0.9.5.lpl svneol=native#text/plain
packager/globallinks/lazthread-0.lpl svneol=native#text/plain
packager/globallinks/macosfiles-0.lpl svneol=native#text/plain
packager/globallinks/messagecomposerpkg-0.lpl svneol=native#text/plain
packager/globallinks/popupnotifierlaz-0.lpl svneol=native#text/plain
packager/globallinks/prettyformat-0.lpl svneol=native#text/plain
packager/globallinks/prettymessages-0.lpl svneol=native#text/plain

View File

@ -0,0 +1,601 @@
object FormMessagesComposer: TFormMessagesComposer
Left = 206
Height = 586
Top = 47
Width = 728
HorzScrollBar.Page = 727
VertScrollBar.Page = 585
ActiveControl = CaptionEdit
BorderIcons = [biSystemMenu]
BorderStyle = bsDialog
Caption = 'Messages Composer'
OnCreate = MessagesInitExecute
Position = poScreenCenter
object CaptionLabel: TLabel
Left = 8
Height = 14
Top = 8
Width = 37
Caption = 'Caption'
Color = clNone
ParentColor = False
end
object MsgLabel: TLabel
Left = 8
Height = 14
Top = 56
Width = 47
Caption = 'MsgLabel'
Color = clNone
ParentColor = False
end
object DlgTypeLabel: TLabel
Left = 108
Height = 14
Top = 8
Width = 41
Caption = 'DlgType'
Color = clNone
ParentColor = False
end
object HelpContextLabel: TLabel
Left = 8
Height = 14
Top = 278
Width = 62
Caption = 'Help Context'
Color = clNone
ParentColor = False
end
object HelpKeyWordLabel: TLabel
Left = 103
Height = 14
Top = 278
Width = 70
Caption = 'Help KeyWord'
Color = clNone
ParentColor = False
end
object XLabel: TLabel
Left = 8
Height = 14
Top = 242
Width = 8
Caption = 'X'
Color = clNone
ParentColor = False
end
object YLabel: TLabel
Left = 112
Height = 14
Top = 242
Width = 8
Caption = 'Y'
Color = clNone
ParentColor = False
end
object HelpFileNameLabel: TLabel
Left = 8
Height = 14
Top = 328
Width = 70
Caption = 'Help FileName'
Color = clNone
ParentColor = False
end
object PromptLabel: TLabel
Left = 8
Height = 14
Top = 112
Width = 60
Caption = 'PromptLabel'
Color = clNone
ParentColor = False
end
object ValueLabel: TLabel
Left = 8
Height = 14
Top = 181
Width = 52
Caption = 'Value (var)'
Color = clNone
ParentColor = False
end
object DefaultValue: TLabel
Left = 108
Height = 14
Top = 181
Width = 35
Caption = 'Default'
Color = clNone
ParentColor = False
end
object Bevel1: TBevel
Left = 10
Height = 9
Top = 103
Width = 205
Shape = bsTopLine
end
object Bevel2: TBevel
Left = 8
Height = 9
Top = 225
Width = 207
Shape = bsTopLine
end
object Bevel3: TBevel
Left = 8
Height = 9
Top = 269
Width = 207
Shape = bsTopLine
end
object CaptionEdit: TEdit
Left = 8
Height = 23
Top = 24
Width = 93
TabOrder = 0
Text = 'CaptionEdit'
end
object MsgEdit: TEdit
Left = 8
Height = 23
Top = 72
Width = 207
OnEditingDone = GetParamsFmtExecute
TabOrder = 1
Text = 'MsgEdit'
end
object KindMessageRadioGroup: TRadioGroup
Left = 224
Height = 360
Top = 7
Width = 497
AutoFill = True
Caption = 'KindMessageRadioGroup'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ItemIndex = 0
Items.Strings = (
'MessageDlg[Msg, DlgType, Buttons(TMsgDlgButtons), HelpCtx]'
'MessageDlg[Caption, Msg, DlgType, Buttons(TMsgDlgButtons), HelpCtx]'
'MessageDlg[Caption, Msg, DlgType, Buttons(TMsgDlgButtons), HelpKeyword]'
'MessageDlgPos[Msg, DlgType, Buttons(TMsgDlgButtons), HelpCtx, X, Y]'
'MessageDlgPosHelp[Msg, DlgType, Buttons(TMsgDlgButtons), HelpCtx, X, Y, HelpFileName]'
'QuestionDlg[Caption, Msg, DlgType, Buttons(array of const), HelpCtx]'
'QuestionDlg[Caption, Msg, DlgType, Buttons(array of const), HelpKeyword]'
'ShowMessage[Msg: string];'
'ShowMessageFmt[Msg, Params(array of const)];'
'ShowMessagePos[Msg, X, Y];'
'InputQuery[Caption, Prompt, MaskInput(Boolean), Value(String)]'
'InputQuery[Caption, Prompt, Value(String)]'
'InputBox[Caption, Prompt, Default]'
'PasswordBox[Caption, Prompt]'
)
OnClick = MessageSetupExecute
TabOrder = 2
end
object DlgTypeComboBox: TComboBox
Left = 108
Height = 21
Top = 26
Width = 107
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
ItemIndex = 0
Items.Strings = (
'mtWarning'
'mtError'
'mtInformation'
'mtConfirmation'
'mtCustom'
)
MaxLength = 0
Style = csDropDownList
TabOrder = 3
Text = 'mtWarning'
end
object ButtonsCheckGroup: TCheckGroup
Left = 527
Height = 177
Top = 369
Width = 194
AutoFill = True
Caption = 'BUTTONS (TMsgDlgButtons)'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
Columns = 2
Items.Strings = (
'mbYes'
'mbNo'
'mbOK'
'mbCancel'
'mbAbort'
'mbRetry'
'mbIgnore'
'mbAll'
'mbNoToAll'
'mbYesToAll'
'mbHelp'
'mbClose'
)
OnItemClick = ButtonsCheckGroupItemClick
TabOrder = 4
Data = {
0C000000020203030202020202020202
}
end
object HelpContextSpinEdit: TSpinEdit
Left = 8
Height = 23
Top = 297
Width = 17
MaxValue = 9999
TabOrder = 5
end
object HelpKeyWordEdit: TEdit
Left = 103
Height = 23
Top = 297
Width = 112
TabOrder = 6
Text = 'HelpKeyWordEdit'
end
object ButtonsPanel: TPanel
Left = 297
Height = 170
Top = 376
Width = 221
TabOrder = 7
object ButtonsStringGrid: TStringGrid
Left = 1
Height = 138
Top = 1
Width = 219
Align = alTop
ColCount = 2
FixedColor = clBtnFace
FixedCols = 0
GridLineWidth = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
RowCount = 4
ScrollBars = ssAutoBoth
TabOrder = 0
TabStop = True
OnPickListSelect = UpdateQuestioDlgResultExecute
OnSelectEditor = ButtonsStringGridSelectEditor
ColWidths = (
138
77
)
Cells = (
8
0
0
'BUTTONS (array of const)'
0
1
'Yes'
0
2
'No'
0
3
'Cancel'
1
0
'Modal Result'
1
1
'mrYes'
1
2
'mrNo'
1
3
'mrCancel'
)
end
object Panel2: TPanel
Left = 1
Height = 30
Top = 139
Width = 219
Align = alClient
BevelInner = bvLowered
BevelOuter = bvSpace
TabOrder = 1
object BitBtn1: TBitBtn
Left = 2
Height = 26
Top = 2
Width = 101
Action = AddConst
Align = alLeft
NumGlyphs = 0
TabOrder = 0
end
object BitBtn2: TBitBtn
Left = 111
Height = 26
Top = 2
Width = 106
Action = DelConst
Align = alRight
NumGlyphs = 0
TabOrder = 1
end
end
end
object XSpinEdit: TSpinEdit
Left = 46
Height = 23
Top = 237
Width = 17
AutoSize = True
TabOrder = 8
end
object YSpinEdit: TSpinEdit
Left = 144
Height = 23
Top = 237
Width = 17
AutoSize = True
TabOrder = 9
end
object HelpFileNameEdit: TFileNameEdit
Left = 8
Height = 23
Top = 344
Width = 185
ButtonWidth = 23
NumGlyphs = 1
ParentColor = False
TabOrder = 10
end
object PromptEdit: TEdit
Left = 8
Height = 23
Top = 128
Width = 207
TabOrder = 11
Text = 'PromptEdit'
end
object MaskInputCheckBox: TCheckBox
Left = 8
Height = 13
Top = 156
Width = 70
Caption = 'MaskInput'
TabOrder = 12
end
object ValueEdit: TEdit
Left = 8
Height = 23
Top = 197
Width = 80
TabOrder = 13
Text = 'ValueEdit'
end
object DefaultEdit: TEdit
Left = 106
Height = 23
Top = 197
Width = 109
TabOrder = 14
Text = 'DefaultEdit'
end
object Button1: TButton
Left = 297
Height = 25
Top = 552
Width = 221
Action = Test
BorderSpacing.InnerBorder = 4
TabOrder = 15
end
object Button2: TBitBtn
Left = 527
Height = 25
Top = 552
Width = 97
Caption = '&OK'
Default = True
Kind = bkOK
ModalResult = 1
NumGlyphs = 0
TabOrder = 16
end
object Button3: TBitBtn
Left = 628
Height = 25
Top = 552
Width = 93
Cancel = True
Caption = 'Cancel'
Kind = bkCancel
ModalResult = 2
NumGlyphs = 0
TabOrder = 17
end
object SourceWrapperGroupBox: TGroupBox
Left = 8
Height = 208
Top = 369
Width = 280
Caption = 'SourceWrapperGroupBox'
TabOrder = 18
object Label1: TLabel
Left = 7
Height = 14
Top = 9
Width = 62
Caption = '"if" RESULT'
Color = clNone
ParentColor = False
end
object StringResultLabel: TLabel
Left = 7
Height = 14
Top = 59
Width = 74
Caption = 'String RESULT'
Color = clNone
ParentColor = False
end
object IfThenRadioButton: TRadioButton
Left = 7
Height = 13
Top = 111
Width = 64
Caption = 'if...then...'
OnClick = SetIfOrCaseExecute
TabOrder = 0
end
object IfThenElseRadioButton: TRadioButton
Left = 7
Height = 13
Top = 129
Width = 95
Caption = 'if...then...else ...'
OnClick = SetIfOrCaseExecute
TabOrder = 1
end
object CaseOfEndRadioButton: TRadioButton
Left = 142
Height = 13
Top = 151
Width = 103
Caption = 'case ... of ... end;'
OnClick = SetIfOrCaseExecute
TabOrder = 2
end
object CaseOfEndElseRadioButton: TRadioButton
Left = 142
Height = 13
Top = 169
Width = 113
Caption = 'case ... of ... else ...'
OnClick = SetIfOrCaseExecute
TabOrder = 3
end
object BeginEndCheckBox: TCheckBox
Left = 7
Height = 13
Top = 159
Width = 79
Caption = 'begin ... end'
TabOrder = 4
end
object IfResultComboBox: TComboBox
Left = 7
Height = 21
Top = 25
Width = 119
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
ItemIndex = 0
Items.Strings = (
'mbOK'
'mbCancel'
)
MaxLength = 0
Style = csDropDownList
TabOrder = 5
Text = 'mbOK'
end
object CaseResultCheckGroup: TCheckGroup
Left = 142
Height = 146
Top = -1
Width = 129
AutoFill = True
Caption = '"case" RESULT'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
Items.Strings = (
'mbOK'
'mbCancel'
)
TabOrder = 6
Data = {
020000000302
}
end
object StringResultEdit: TEdit
Left = 7
Height = 23
Top = 74
Width = 119
TabOrder = 7
Text = 'StringResultEdit'
end
end
object ActionList1: TActionList
left = 472
top = 480
object AddConst: TAction
Caption = 'AddConst'
DisableIfNoHandler = True
OnExecute = AddConstExecute
end
object DelConst: TAction
Caption = 'DelConst'
DisableIfNoHandler = True
OnExecute = DelConstExecute
end
object MessageSetup: TAction
Caption = 'MessageSetup'
DisableIfNoHandler = True
OnExecute = MessageSetupExecute
end
object MessagesInit: TAction
Caption = 'MessagesInit'
DisableIfNoHandler = True
OnExecute = MessagesInitExecute
end
object Test: TAction
Caption = 'Test'
DisableIfNoHandler = True
OnExecute = TestExecute
end
object GetMessageForSource: TAction
Caption = 'GetMessageForSource'
DisableIfNoHandler = True
OnExecute = GetMessageForSourceExecute
end
object GetParamsFmt: TAction
Caption = 'GetParamsFmt'
DisableIfNoHandler = True
OnExecute = GetParamsFmtExecute
end
object SetIfOrCase: TAction
Caption = 'SetIfOrCase'
DisableIfNoHandler = True
OnExecute = SetIfOrCaseExecute
end
object UpdateQuestioDlgResult: TAction
Caption = 'UpdateQuestioDlgResult'
DisableIfNoHandler = True
OnExecute = UpdateQuestioDlgResultExecute
end
end
end

View File

@ -0,0 +1,165 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TFormMessagesComposer','FORMDATA',[
'TPF0'#21'TFormMessagesComposer'#20'FormMessagesComposer'#4'Left'#3#206#0#6'H'
+'eight'#3'J'#2#3'Top'#2'/'#5'Width'#3#216#2#18'HorzScrollBar.Page'#3#215#2#18
+'VertScrollBar.Page'#3'I'#2#13'ActiveControl'#7#11'CaptionEdit'#11'BorderIco'
+'ns'#11#12'biSystemMenu'#0#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#17'Mes'
+'sages Composer'#8'OnCreate'#7#19'MessagesInitExecute'#8'Position'#7#14'poSc'
+'reenCenter'#0#6'TLabel'#12'CaptionLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#2
+#8#5'Width'#2'%'#7'Caption'#6#7'Caption'#5'Color'#7#6'clNone'#11'ParentColor'
+#8#0#0#6'TLabel'#8'MsgLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'8'#5'Width'
+#2'/'#7'Caption'#6#8'MsgLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6
+'TLabel'#12'DlgTypeLabel'#4'Left'#2'l'#6'Height'#2#14#3'Top'#2#8#5'Width'#2
+')'#7'Caption'#6#7'DlgType'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLa'
+'bel'#16'HelpContextLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#3#22#1#5'Width'
+#2'>'#7'Caption'#6#12'Help Context'#5'Color'#7#6'clNone'#11'ParentColor'#8#0
+#0#6'TLabel'#16'HelpKeyWordLabel'#4'Left'#2'g'#6'Height'#2#14#3'Top'#3#22#1#5
+'Width'#2'F'#7'Caption'#6#12'Help KeyWord'#5'Color'#7#6'clNone'#11'ParentCol'
+'or'#8#0#0#6'TLabel'#6'XLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#3#242#0#5'W'
+'idth'#2#8#7'Caption'#6#1'X'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TL'
+'abel'#6'YLabel'#4'Left'#2'p'#6'Height'#2#14#3'Top'#3#242#0#5'Width'#2#8#7'C'
+'aption'#6#1'Y'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#17'Help'
+'FileNameLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#3'H'#1#5'Width'#2'F'#7'Cap'
+'tion'#6#13'Help FileName'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLab'
+'el'#11'PromptLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#2'p'#5'Width'#2'<'#7
+'Caption'#6#11'PromptLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLa'
+'bel'#10'ValueLabel'#4'Left'#2#8#6'Height'#2#14#3'Top'#3#181#0#5'Width'#2'4'
+#7'Caption'#6#11'Value (var)'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'T'
+'Label'#12'DefaultValue'#4'Left'#2'l'#6'Height'#2#14#3'Top'#3#181#0#5'Width'
+#2'#'#7'Caption'#6#7'Default'#5'Color'#7#6'clNone'#11'ParentColor'#8#0#0#6'T'
+'Bevel'#6'Bevel1'#4'Left'#2#10#6'Height'#2#9#3'Top'#2'g'#5'Width'#3#205#0#5
+'Shape'#7#9'bsTopLine'#0#0#6'TBevel'#6'Bevel2'#4'Left'#2#8#6'Height'#2#9#3'T'
+'op'#3#225#0#5'Width'#3#207#0#5'Shape'#7#9'bsTopLine'#0#0#6'TBevel'#6'Bevel3'
+#4'Left'#2#8#6'Height'#2#9#3'Top'#3#13#1#5'Width'#3#207#0#5'Shape'#7#9'bsTop'
+'Line'#0#0#5'TEdit'#11'CaptionEdit'#4'Left'#2#8#6'Height'#2#23#3'Top'#2#24#5
+'Width'#2']'#8'TabOrder'#2#0#4'Text'#6#11'CaptionEdit'#0#0#5'TEdit'#7'MsgEdi'
+'t'#4'Left'#2#8#6'Height'#2#23#3'Top'#2'H'#5'Width'#3#207#0#13'OnEditingDone'
+#7#19'GetParamsFmtExecute'#8'TabOrder'#2#1#4'Text'#6#7'MsgEdit'#0#0#11'TRadi'
+'oGroup'#21'KindMessageRadioGroup'#4'Left'#3#224#0#6'Height'#3'h'#1#3'Top'#2
+#7#5'Width'#3#241#1#8'AutoFill'#9#7'Caption'#6#21'KindMessageRadioGroup'#28
+'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'C'
+'hildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing'
+'.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHoriz'
+'ontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChi'
+'lds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSiz'
+'ing.ControlsPerLine'#2#1#9'ItemIndex'#2#0#13'Items.Strings'#1#6':MessageDlg'
+'[Msg, DlgType, Buttons(TMsgDlgButtons), HelpCtx]'#6'CMessageDlg[Caption, Ms'
+'g, DlgType, Buttons(TMsgDlgButtons), HelpCtx]'#6'GMessageDlg[Caption, Msg, '
+'DlgType, Buttons(TMsgDlgButtons), HelpKeyword]'#6'CMessageDlgPos[Msg, DlgTy'
+'pe, Buttons(TMsgDlgButtons), HelpCtx, X, Y]'#6'UMessageDlgPosHelp[Msg, DlgT'
+'ype, Buttons(TMsgDlgButtons), HelpCtx, X, Y, HelpFileName]'#6'DQuestionDlg['
+'Caption, Msg, DlgType, Buttons(array of const), HelpCtx]'#6'HQuestionDlg[Ca'
+'ption, Msg, DlgType, Buttons(array of const), HelpKeyword]'#6#25'ShowMessag'
+'e[Msg: string];'#6',ShowMessageFmt[Msg, Params(array of const)];'#6#26'Show'
+'MessagePos[Msg, X, Y];'#6'>InputQuery[Caption, Prompt, MaskInput(Boolean), '
+'Value(String)]'#6'*InputQuery[Caption, Prompt, Value(String)]'#6'"InputBox['
+'Caption, Prompt, Default]'#6#28'PasswordBox[Caption, Prompt]'#0#7'OnClick'#7
+#19'MessageSetupExecute'#8'TabOrder'#2#2#0#0#9'TComboBox'#15'DlgTypeComboBox'
+#4'Left'#2'l'#6'Height'#2#21#3'Top'#2#26#5'Width'#2'k'#16'AutoCompleteText'
+#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#9'ItemIndex'#2#0#13
+'Items.Strings'#1#6#9'mtWarning'#6#7'mtError'#6#13'mtInformation'#6#14'mtCon'
+'firmation'#6#8'mtCustom'#0#9'MaxLength'#2#0#5'Style'#7#14'csDropDownList'#8
+'TabOrder'#2#3#4'Text'#6#9'mtWarning'#0#0#11'TCheckGroup'#17'ButtonsCheckGro'
+'up'#4'Left'#3#15#2#6'Height'#3#177#0#3'Top'#3'q'#1#5'Width'#3#194#0#8'AutoF'
+'ill'#9#7'Caption'#6#24'BUTTONS (TMsgDlgButtons)'#28'ChildSizing.LeftRightSp'
+'acing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.EnlargeHoriz'
+'ontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeVertical'#7#24
,'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7#14'crsScaleChi'
+'lds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'ChildSizing.Lay'
+'out'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine'#2#2
+#7'Columns'#2#2#13'Items.Strings'#1#6#5'mbYes'#6#4'mbNo'#6#4'mbOK'#6#8'mbCan'
+'cel'#6#7'mbAbort'#6#7'mbRetry'#6#8'mbIgnore'#6#5'mbAll'#6#9'mbNoToAll'#6#10
+'mbYesToAll'#6#6'mbHelp'#6#7'mbClose'#0#11'OnItemClick'#7#26'ButtonsCheckGro'
+'upItemClick'#8'TabOrder'#2#4#4'Data'#10#16#0#0#0#12#0#0#0#2#2#3#3#2#2#2#2#2
+#2#2#2#0#0#9'TSpinEdit'#19'HelpContextSpinEdit'#4'Left'#2#8#6'Height'#2#23#3
+'Top'#3')'#1#5'Width'#2#17#8'MaxValue'#3#15''''#8'TabOrder'#2#5#0#0#5'TEdit'
+#15'HelpKeyWordEdit'#4'Left'#2'g'#6'Height'#2#23#3'Top'#3')'#1#5'Width'#2'p'
+#8'TabOrder'#2#6#4'Text'#6#15'HelpKeyWordEdit'#0#0#6'TPanel'#12'ButtonsPanel'
+#4'Left'#3')'#1#6'Height'#3#170#0#3'Top'#3'x'#1#5'Width'#3#221#0#8'TabOrder'
+#2#7#0#11'TStringGrid'#17'ButtonsStringGrid'#4'Left'#2#1#6'Height'#3#138#0#3
+'Top'#2#1#5'Width'#3#219#0#5'Align'#7#5'alTop'#8'ColCount'#2#2#10'FixedColor'
+#7#9'clBtnFace'#9'FixedCols'#2#0#13'GridLineWidth'#2#0#7'Options'#11#15'goFi'
+'xedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSe'
+'lect'#9'goEditing'#14'goSmoothScroll'#0#8'RowCount'#2#4#10'ScrollBars'#7#10
+'ssAutoBoth'#8'TabOrder'#2#0#7'TabStop'#9#16'OnPickListSelect'#7#29'UpdateQu'
+'estioDlgResultExecute'#14'OnSelectEditor'#7#29'ButtonsStringGridSelectEdito'
+'r'#9'ColWidths'#1#3#138#0#2'M'#0#5'Cells'#1#2#8#2#0#2#0#6#24'BUTTONS (array'
+' of const)'#2#0#2#1#6#3'Yes'#2#0#2#2#6#2'No'#2#0#2#3#6#6'Cancel'#2#1#2#0#6
+#12'Modal Result'#2#1#2#1#6#5'mrYes'#2#1#2#2#6#4'mrNo'#2#1#2#3#6#8'mrCancel'
+#0#0#0#6'TPanel'#6'Panel2'#4'Left'#2#1#6'Height'#2#30#3'Top'#3#139#0#5'Width'
+#3#219#0#5'Align'#7#8'alClient'#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'
+#7#7'bvSpace'#8'TabOrder'#2#1#0#7'TBitBtn'#7'BitBtn1'#4'Left'#2#2#6'Height'#2
+#26#3'Top'#2#2#5'Width'#2'e'#6'Action'#7#8'AddConst'#5'Align'#7#6'alLeft'#9
+'NumGlyphs'#2#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#7'BitBtn2'#4'Left'#2'o'#6'Hei'
+'ght'#2#26#3'Top'#2#2#5'Width'#2'j'#6'Action'#7#8'DelConst'#5'Align'#7#7'alR'
+'ight'#9'NumGlyphs'#2#0#8'TabOrder'#2#1#0#0#0#0#9'TSpinEdit'#9'XSpinEdit'#4
+'Left'#2'.'#6'Height'#2#23#3'Top'#3#237#0#5'Width'#2#17#8'AutoSize'#9#8'TabO'
+'rder'#2#8#0#0#9'TSpinEdit'#9'YSpinEdit'#4'Left'#3#144#0#6'Height'#2#23#3'To'
+'p'#3#237#0#5'Width'#2#17#8'AutoSize'#9#8'TabOrder'#2#9#0#0#13'TFileNameEdit'
+#16'HelpFileNameEdit'#4'Left'#2#8#6'Height'#2#23#3'Top'#3'X'#1#5'Width'#3#185
+#0#11'ButtonWidth'#2#23#9'NumGlyphs'#2#1#11'ParentColor'#8#8'TabOrder'#2#10#0
+#0#5'TEdit'#10'PromptEdit'#4'Left'#2#8#6'Height'#2#23#3'Top'#3#128#0#5'Width'
+#3#207#0#8'TabOrder'#2#11#4'Text'#6#10'PromptEdit'#0#0#9'TCheckBox'#17'MaskI'
+'nputCheckBox'#4'Left'#2#8#6'Height'#2#13#3'Top'#3#156#0#5'Width'#2'F'#7'Cap'
+'tion'#6#9'MaskInput'#8'TabOrder'#2#12#0#0#5'TEdit'#9'ValueEdit'#4'Left'#2#8
+#6'Height'#2#23#3'Top'#3#197#0#5'Width'#2'P'#8'TabOrder'#2#13#4'Text'#6#9'Va'
+'lueEdit'#0#0#5'TEdit'#11'DefaultEdit'#4'Left'#2'j'#6'Height'#2#23#3'Top'#3
+#197#0#5'Width'#2'm'#8'TabOrder'#2#14#4'Text'#6#11'DefaultEdit'#0#0#7'TButto'
+'n'#7'Button1'#4'Left'#3')'#1#6'Height'#2#25#3'Top'#3'('#2#5'Width'#3#221#0#6
+'Action'#7#4'Test'#25'BorderSpacing.InnerBorder'#2#4#8'TabOrder'#2#15#0#0#7
+'TBitBtn'#7'Button2'#4'Left'#3#15#2#6'Height'#2#25#3'Top'#3'('#2#5'Width'#2
+'a'#7'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9
+'NumGlyphs'#2#0#8'TabOrder'#2#16#0#0#7'TBitBtn'#7'Button3'#4'Left'#3't'#2#6
+'Height'#2#25#3'Top'#3'('#2#5'Width'#2']'#6'Cancel'#9#7'Caption'#6#6'Cancel'
+#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#17
+#0#0#9'TGroupBox'#21'SourceWrapperGroupBox'#4'Left'#2#8#6'Height'#3#208#0#3
+'Top'#3'q'#1#5'Width'#3#24#1#7'Caption'#6#21'SourceWrapperGroupBox'#8'TabOrd'
+'er'#2#18#0#6'TLabel'#6'Label1'#4'Left'#2#7#6'Height'#2#14#3'Top'#2#9#5'Widt'
+'h'#2'>'#7'Caption'#6#11'"if" RESULT'#5'Color'#7#6'clNone'#11'ParentColor'#8
+#0#0#6'TLabel'#17'StringResultLabel'#4'Left'#2#7#6'Height'#2#14#3'Top'#2';'#5
+'Width'#2'J'#7'Caption'#6#13'String RESULT'#5'Color'#7#6'clNone'#11'ParentCo'
+'lor'#8#0#0#12'TRadioButton'#17'IfThenRadioButton'#4'Left'#2#7#6'Height'#2#13
+#3'Top'#2'o'#5'Width'#2'@'#7'Caption'#6#12'if...then...'#7'OnClick'#7#18'Set'
+'IfOrCaseExecute'#8'TabOrder'#2#0#0#0#12'TRadioButton'#21'IfThenElseRadioBut'
+'ton'#4'Left'#2#7#6'Height'#2#13#3'Top'#3#129#0#5'Width'#2'_'#7'Caption'#6#20
+'if...then...else ...'#7'OnClick'#7#18'SetIfOrCaseExecute'#8'TabOrder'#2#1#0
+#0#12'TRadioButton'#20'CaseOfEndRadioButton'#4'Left'#3#142#0#6'Height'#2#13#3
+'Top'#3#151#0#5'Width'#2'g'#7'Caption'#6#20'case ... of ... end;'#7'OnClick'
+#7#18'SetIfOrCaseExecute'#8'TabOrder'#2#2#0#0#12'TRadioButton'#24'CaseOfEndE'
+'lseRadioButton'#4'Left'#3#142#0#6'Height'#2#13#3'Top'#3#169#0#5'Width'#2'q'
+#7'Caption'#6#24'case ... of ... else ...'#7'OnClick'#7#18'SetIfOrCaseExecut'
,'e'#8'TabOrder'#2#3#0#0#9'TCheckBox'#16'BeginEndCheckBox'#4'Left'#2#7#6'Heig'
+'ht'#2#13#3'Top'#3#159#0#5'Width'#2'O'#7'Caption'#6#13'begin ... end'#8'TabO'
+'rder'#2#4#0#0#9'TComboBox'#16'IfResultComboBox'#4'Left'#2#7#6'Height'#2#21#3
+'Top'#2#25#5'Width'#2'w'#16'AutoCompleteText'#11#22'cbactEndOfLineComplete'
+#20'cbactSearchAscending'#0#9'ItemIndex'#2#0#13'Items.Strings'#1#6#4'mbOK'#6
+#8'mbCancel'#0#9'MaxLength'#2#0#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#5
+#4'Text'#6#4'mbOK'#0#0#11'TCheckGroup'#20'CaseResultCheckGroup'#4'Left'#3#142
+#0#6'Height'#3#146#0#3'Top'#2#255#5'Width'#3#129#0#8'AutoFill'#9#7'Caption'#6
+#13'"case" RESULT'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBo'
+'ttomSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#24'crsHomogenousChildR'
+'esize'#27'ChildSizing.EnlargeVertical'#7#24'crsHomogenousChildResize'#28'Ch'
+'ildSizing.ShrinkHorizontal'#7#14'crsScaleChilds'#26'ChildSizing.ShrinkVerti'
+'cal'#7#14'crsScaleChilds'#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTop'
+'ToBottom'#27'ChildSizing.ControlsPerLine'#2#1#13'Items.Strings'#1#6#4'mbOK'
+#6#8'mbCancel'#0#8'TabOrder'#2#6#4'Data'#10#6#0#0#0#2#0#0#0#3#2#0#0#5'TEdit'
+#16'StringResultEdit'#4'Left'#2#7#6'Height'#2#23#3'Top'#2'J'#5'Width'#2'w'#8
+'TabOrder'#2#7#4'Text'#6#16'StringResultEdit'#0#0#0#11'TActionList'#11'Actio'
+'nList1'#4'left'#3#216#1#3'top'#3#224#1#0#7'TAction'#8'AddConst'#7'Caption'#6
+#8'AddConst'#18'DisableIfNoHandler'#9#9'OnExecute'#7#15'AddConstExecute'#0#0
+#7'TAction'#8'DelConst'#7'Caption'#6#8'DelConst'#18'DisableIfNoHandler'#9#9
+'OnExecute'#7#15'DelConstExecute'#0#0#7'TAction'#12'MessageSetup'#7'Caption'
+#6#12'MessageSetup'#18'DisableIfNoHandler'#9#9'OnExecute'#7#19'MessageSetupE'
+'xecute'#0#0#7'TAction'#12'MessagesInit'#7'Caption'#6#12'MessagesInit'#18'Di'
+'sableIfNoHandler'#9#9'OnExecute'#7#19'MessagesInitExecute'#0#0#7'TAction'#4
+'Test'#7'Caption'#6#4'Test'#18'DisableIfNoHandler'#9#9'OnExecute'#7#11'TestE'
+'xecute'#0#0#7'TAction'#19'GetMessageForSource'#7'Caption'#6#19'GetMessageFo'
+'rSource'#18'DisableIfNoHandler'#9#9'OnExecute'#7#26'GetMessageForSourceExec'
+'ute'#0#0#7'TAction'#12'GetParamsFmt'#7'Caption'#6#12'GetParamsFmt'#18'Disab'
+'leIfNoHandler'#9#9'OnExecute'#7#19'GetParamsFmtExecute'#0#0#7'TAction'#11'S'
+'etIfOrCase'#7'Caption'#6#11'SetIfOrCase'#18'DisableIfNoHandler'#9#9'OnExecu'
+'te'#7#18'SetIfOrCaseExecute'#0#0#7'TAction'#22'UpdateQuestioDlgResult'#7'Ca'
+'ption'#6#22'UpdateQuestioDlgResult'#18'DisableIfNoHandler'#9#9'OnExecute'#7
+#29'UpdateQuestioDlgResultExecute'#0#0#0#0
]);

View File

@ -0,0 +1,847 @@
{ Copyright (C) 2007 Salvatore Coppola
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Abstract:
This unit is a message dialog composer for Lazarus/FPC. It take in account all message dialogs platform indipendent.
}
unit MessageComposer;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, LCLType, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, Spin, Grids, ActnList, ComCtrls, Buttons, EditBtn;
type
{ TFormMessagesComposer }
TFormMessagesComposer = class(TForm)
UpdateQuestioDlgResult: TAction;
SetIfOrCase: TAction;
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
CaseResultCheckGroup: TCheckGroup;
BeginEndCheckBox: TCheckBox;
IfResultComboBox: TComboBox;
StringResultEdit: TEdit;
GetParamsFmt: TAction;
Button2: TBitBtn;
Button3: TBitBtn;
GetMessageForSource: TAction;
Label1: TLabel;
StringResultLabel: TLabel;
IfThenRadioButton: TRadioButton;
IfThenElseRadioButton: TRadioButton;
CaseOfEndRadioButton: TRadioButton;
CaseOfEndElseRadioButton: TRadioButton;
SourceWrapperGroupBox: TGroupBox;
Test: TAction;
Button1: TButton;
MaskInputCheckBox: TCheckBox;
PromptEdit: TEdit;
ValueEdit: TEdit;
PromptLabel: TLabel;
HelpFileNameEdit: TFileNameEdit;
HelpFileNameLabel: TLabel;
MessagesInit: TAction;
DefaultEdit: TEdit;
ValueLabel: TLabel;
DefaultValue: TLabel;
XLabel: TLabel;
YLabel: TLabel;
MessageSetup: TAction;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
DelConst: TAction;
AddConst: TAction;
ActionList1: TActionList;
CaptionEdit: TEdit;
ButtonsCheckGroup: TCheckGroup;
DlgTypeComboBox: TComboBox;
DlgTypeLabel: TLabel;
HelpKeyWordEdit: TEdit;
HelpContextLabel: TLabel;
HelpKeyWordLabel: TLabel;
KindMessageRadioGroup: TRadioGroup;
MsgEdit: TEdit;
CaptionLabel: TLabel;
MsgLabel: TLabel;
HelpContextSpinEdit: TSpinEdit;
ButtonsStringGrid: TStringGrid;
ButtonsPanel: TPanel;
Panel2: TPanel;
XSpinEdit: TSpinEdit;
YSpinEdit: TSpinEdit;
procedure AddConstExecute(Sender: TObject);
procedure ButtonsCheckGroupItemClick(Sender: TObject; Index: integer);
procedure ButtonsStringGridSelectEditor(Sender: TObject; aCol,
aRow: Integer; var Editor: TWinControl);
procedure DelConstExecute(Sender: TObject);
procedure GetMessageForSourceExecute(Sender: TObject);
procedure GetParamsFmtExecute(Sender: TObject);
procedure MessageSetupExecute(Sender: TObject);
procedure MessagesInitExecute(Sender: TObject);
procedure SetIfOrCaseExecute(Sender: TObject);
procedure TestExecute(Sender: TObject);
procedure UpdateQuestioDlgResultExecute(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
procedure Register;
var
srcMessage: string;
implementation
uses IDECommands, MenuIntf, LazIDEIntf, SrcEditorIntf;
const
cMessageComposer = 'Message Composer';
DoubleSpace = ' ';
resourcestring
SMessageComposerCaption = 'Message Composer ...';
SMsgCaption = 'The message to be shown';
SPromptCaption = 'The text asking the user for his input';
SMaskInput = 'Mask Input';
SSourceWrapper = 'SOURCE WRAPPER';
SKindofMessage = 'KIND OF MESSAGE';
SNotImplementedYet = 'Not Implemented Yet';
var
CmdMessageComposer: TIDECommand;
{ This is where it all starts. Gets called from Lazarus. }
procedure ExecuteMessagesComposer(Sender: TObject);
var FormMessagesComposer: TFormMessagesComposer;
procedure FormatSrcMessage;
var ListSrcMessages: TStringList;
indx: integer;
BaseStart: string;
begin
BaseStart := EmptyStr;
for indx := 1 to SourceEditorWindow.ActiveEditor.CursorTextXY.x-
Length(SourceEditorWindow.ActiveEditor.Selection)-1 do
BaseStart := BaseStart+#32;
ListSrcMessages := TStringList.Create;
ListSrcMessages.Text := srcMessage;
if (Pos('if ',srcMessage) = 1)or(Pos('case ',srcMessage) = 1) then
for indx := 1 to ListSrcMessages.Count-1 do
ListSrcMessages.Strings[indx] := BaseStart+ListSrcMessages.Strings[indx];
if Pos('case ',srcMessage) = 1 then
for indx := 1 to ListSrcMessages.Count-2 do
ListSrcMessages.Strings[indx] := DoubleSpace+ListSrcMessages.Strings[indx];
srcMessage := ListSrcMessages.Text;
ListSrcMessages.Free;
end;
begin
Assert(Sender <> nil); // removes compiler warning
if SourceEditorWindow.ActiveEditor = nil then exit;
FormMessagesComposer := TFormMessagesComposer.Create(nil);
try
FormMessagesComposer.ShowModal;
if FormMessagesComposer.ModalResult = mrOK then begin
FormMessagesComposer.GetMessageForSource.Execute;
FormatSrcMessage;
SourceEditorWindow.ActiveEditor.Selection := srcMessage;
end;
finally
FormMessagesComposer.Free;
end;
end;
{ TFormMessagesComposer }
procedure TFormMessagesComposer.AddConstExecute(Sender: TObject);
begin
ButtonsStringGrid.RowCount := ButtonsStringGrid.RowCount+1;
UpdateQuestioDlgResult.Execute;
end;
procedure TFormMessagesComposer.ButtonsCheckGroupItemClick(Sender: TObject;
Index: integer);
begin
MessageSetup.Execute;
end;
procedure TFormMessagesComposer.ButtonsStringGridSelectEditor(Sender: TObject; aCol,
aRow: Integer; var Editor: TWinControl);
begin
if aCol<>1 then exit;
case KindMessageRadioGroup.ItemIndex of
5, 6: begin
Editor := TStringGrid(Sender).EditorByStyle(cbsPickList);
TPickListCellEditor(Editor).Style := csDropDownList;
TPickListCellEditor(Editor).Clear;
TPickListCellEditor(Editor).Items.Add('mrNone');
TPickListCellEditor(Editor).Items.Add('mrOK');
TPickListCellEditor(Editor).Items.Add('mrCancel');
TPickListCellEditor(Editor).Items.Add('mrAbort');
TPickListCellEditor(Editor).Items.Add('mrRetry');
TPickListCellEditor(Editor).Items.Add('mrIgnore');
TPickListCellEditor(Editor).Items.Add('mrYes');
TPickListCellEditor(Editor).Items.Add('mrNo');
TPickListCellEditor(Editor).Items.Add('mrAll');
TPickListCellEditor(Editor).Items.Add('mrNoToAll');
TPickListCellEditor(Editor).Items.Add('mrYesToAll');
end;
8: begin
Editor := TStringGrid(Sender).EditorByStyle(cbsAuto);
//D Decimal format. Precision digits in it
//E Scientific format. Args is a Floating point value. Precision is used to specify the total number of decimals (exponent is3 digits)
//F Fixed point format. Args is a floating point value. Precision indicates the number of digits following the decimal point.
//G General number format. Args is a floating point value. The argument is converted to a decimal string using fixed point notation or scientific notation, depending on which gives the shortest result. Precision is used to determine the number of digits after the decimal point.
//M Currency format. Args must be a floating point value. The argument is converted to a decimal string using currency notation. This means that fixed-point notation is used, but that the currency symbol is appended. If precision is specified, then then it overrides the CurrencyDecimals global variable used in the FloatToStrF
//N Number format. This is the same as fixed point format, except that thousand separators are inserted in the resulting string.
//P Pointer format. The next argument in the Args array must be a pointer (typed or untyped). The pointer value is converted to a string of length 8, representing the hexadecimal value of the pointer.
//S String format. The next argument in the Args array must be a string. The argument is simply copied to the result string. If Precision is specified, then only Precision characters are copied to the result string.
//U Unsigned decimal format. The next argument in the Args array should be an unsigned integer. The argument is converted to a decimal string. If precision is specified, then the string will have at least Precision digits in it. If needed, the string is (left) padded with zeroes.
//X hexadecimal format. The next argument in the Args array must be an integer. The argument is converted to a hexadecimal string with just enough characters to contain the value of the integer. If Precision is specified then the resulting hexadecimal representation will have at least Precision characters in it (with a maximum value of 32).
end;
end;
end;
procedure TFormMessagesComposer.DelConstExecute(Sender: TObject);
begin
if ButtonsStringGrid.RowCount = 1 then exit;
ButtonsStringGrid.RowCount := ButtonsStringGrid.RowCount-1;
UpdateQuestioDlgResult.Execute;
end;
procedure TFormMessagesComposer.GetMessageForSourceExecute(Sender: TObject);
var Msg, MsgCaption, MsgHelpKeyword, HelpFileName, Prompt, MsgDefault,
Value, DlgType, MsgButtons, HelpCtx, X, Y, strParam: string;
i: integer;
intParam: integer;
floatParam: double;
begin
Msg := QuotedStr(MsgEdit.Text);
DlgType := DlgTypeComboBox.Text;
MsgButtons := EmptyStr;
if ButtonsCheckGroup.Enabled then begin //MessageDlg();
if ButtonsCheckGroup.Checked[0] then
MsgButtons := MsgButtons+' mbYes,';
if ButtonsCheckGroup.Checked[1] then
MsgButtons := MsgButtons+' mbNo,';
if ButtonsCheckGroup.Checked[2] then
MsgButtons := MsgButtons+' mbOK,';
if ButtonsCheckGroup.Checked[3] then
MsgButtons := MsgButtons+' mbCancel,';
if ButtonsCheckGroup.Checked[4] then
MsgButtons := MsgButtons+' mbAbort,';
if ButtonsCheckGroup.Checked[5] then
MsgButtons := MsgButtons+' mbRetry,';
if ButtonsCheckGroup.Checked[6] then
MsgButtons := MsgButtons+' mbIgnore,';
if ButtonsCheckGroup.Checked[7] then
MsgButtons := MsgButtons+' mbAll,';
if ButtonsCheckGroup.Checked[8] then
MsgButtons := MsgButtons+' mbNoToAll,';
if ButtonsCheckGroup.Checked[9] then
MsgButtons := MsgButtons+' mbYesToAll,';
if ButtonsCheckGroup.Checked[10] then
MsgButtons := MsgButtons+' mbHelp,';
if ButtonsCheckGroup.Checked[11] then
MsgButtons := MsgButtons+' mbClose,';
end else begin //maybe QuestionDlg() or ShowMessageFmt();
if KindMessageRadioGroup.ItemIndex=8 then begin //ShowMessageFmt();
for i := 1 to ButtonsStringGrid.RowCount-1 do begin
//'D', 'E', 'F', 'G', 'M', 'N', 'P', 'S', 'U', 'X' format
strParam := #32;
if (ButtonsStringGrid.Cells[0, i] = '%D') then begin
intParam := StrToIntDef(ButtonsStringGrid.Cells[1, i], 0);
strParam := IntToStr(intParam);
end;
if (ButtonsStringGrid.Cells[0, i] = '%E')or
(ButtonsStringGrid.Cells[0, i] = '%F')or
(ButtonsStringGrid.Cells[0, i] = '%G')or
(ButtonsStringGrid.Cells[0, i] = '%M')or
(ButtonsStringGrid.Cells[0, i] = '%N') then begin
floatParam := StrToFloatDef(ButtonsStringGrid.Cells[1, i], 0.0);
strParam := FloatToStr(floatParam);
if pos('.',strParam) = 0 then
strParam := strParam+'.0';
end;
if (ButtonsStringGrid.Cells[0, i] = '%P') then
strParam := ButtonsStringGrid.Cells[1, i];//user must knows pointer var in his source
if (ButtonsStringGrid.Cells[0, i] = '%S') then
strParam := QuotedStr(ButtonsStringGrid.Cells[1, i]);
if (ButtonsStringGrid.Cells[0, i] = '%U') then begin
intParam := abs(StrToIntDef(ButtonsStringGrid.Cells[1, i], 0));
strParam := IntToStr(intParam);
end;
if (ButtonsStringGrid.Cells[0, i] = '%X') then begin
intParam := StrToIntDef(ButtonsStringGrid.Cells[1, i], 0);
strParam := IntToStr(intParam);
end;
if strParam<>#32 then
MsgButtons := MsgButtons+#32+strParam+',';
end;
if strParam=#32 then
MsgButtons := strParam+',';
end else
for i := 1 to ButtonsStringGrid.RowCount-1 do begin
if (ButtonsStringGrid.Cells[1, i] = EmptyStr)or
(ButtonsStringGrid.Cells[0, i] = EmptyStr) then continue;
MsgButtons := MsgButtons+#32+ButtonsStringGrid.Cells[1, i]+', '+
QuotedStr(ButtonsStringGrid.Cells[0, i])+',';
end;
end;
if MsgButtons<>EmptyStr then begin
MsgButtons[1] := '[';
MsgButtons[Length(MsgButtons)] := ']';
end;
MsgCaption := QuotedStr(CaptionEdit.Text);
HelpCtx := HelpContextSpinEdit.Text;
MsgHelpKeyword := QuotedStr(HelpKeyWordEdit.Text);
HelpFileName := QuotedStr(HelpFileNameEdit.Text);
X := XSpinEdit.Text;
Y := YSpinEdit.Text;
Prompt := QuotedStr(PromptEdit.Text);
MsgDefault := QuotedStr(DefaultEdit.Text);
Value := ValueEdit.Text;//user must knows Value var in his source
case KindMessageRadioGroup.ItemIndex of
0: srcMessage := 'MessageDlg('+Msg+', '+DlgType+', '+MsgButtons+','+HelpCtx+')';
1: srcMessage := 'MessageDlg('+MsgCaption+', '+Msg+', '+DlgType+', '+
MsgButtons+', '+HelpCtx+')';
2: srcMessage := 'MessageDlg('+MsgCaption+', '+Msg+', '+DlgType+', '+
MsgButtons+', '+MsgHelpKeyword+')';
3: srcMessage := 'MessageDlgPos('+Msg+', '+DlgType+', '+MsgButtons+', '+
HelpCtx+', '+X+', '+Y+')';
4: srcMessage := 'MessageDlgPosHelp('+Msg+', '+DlgType+', '+MsgButtons+', '+
HelpCtx+', '+X+', '+Y+', '+HelpFileName+')';
5: srcMessage := 'QuestionDlg('+MsgCaption+', '+Msg+', '+DlgType+', '+
MsgButtons+', '+HelpCtx+')';
6: srcMessage := 'QuestionDlg('+MsgCaption+', '+Msg+', '+DlgType+', '+
MsgButtons+', '+MsgHelpKeyword+')';
7: srcMessage := 'ShowMessage('+Msg+')';
8: srcMessage := 'ShowMessageFmt('+Msg+', '+MsgButtons+')';
9: srcMessage := 'ShowMessagePos('+Msg+', '+X+', '+Y+')';
10: srcMessage := 'InputQuery('+MsgCaption+', '+Prompt+', '+
LowerCase(BoolToStr(MaskInputCheckBox.Checked))+', '+Value+')';
11: srcMessage := 'InputQuery('+MsgCaption+', '+Prompt+', '+Value+')';
12: srcMessage := 'InputBox('+MsgCaption+', '+Prompt+', '+MsgDefault+')';
13: srcMessage := 'PasswordBox('+MsgCaption+', '+Prompt+')'
end;
if SourceWrapperGroupBox.Enabled then begin //no showmessages
if (IfThenRadioButton.Checked)or(IfThenElseRadioButton.Checked) then begin
srcMessage := 'if '+srcMessage+' = ';
if IfResultComboBox.Enabled then
srcMessage := srcMessage+IfResultComboBox.Text
else
srcMessage := srcMessage+QuotedStr(StringResultEdit.Text);
srcMessage := srcMessage+' then';
if BeginEndCheckBox.Checked then
srcMessage := srcMessage+' begin '+LineEnding+'end';
end;
if IfThenElseRadioButton.Checked then begin
srcMessage := srcMessage+LineEnding+'else';
if BeginEndCheckBox.Checked then
srcMessage := srcMessage+' begin '+LineEnding+'end';
end;
if CaseOfEndRadioButton.Checked then begin
srcMessage := 'case '+srcMessage+' of'+LineEnding;
for i := 0 to CaseResultCheckGroup.Items.Count-1 do begin
if not CaseResultCheckGroup.Checked[i] then continue;
if BeginEndCheckBox.Checked then
srcMessage := srcMessage+CaseResultCheckGroup.Items[i]+
': begin'+LineEnding+'end;'+LineEnding
else
srcMessage := srcMessage+CaseResultCheckGroup.Items[i]+
': ;'+LineEnding;
end;
srcMessage := srcMessage+'end;'
end;
if CaseOfEndElseRadioButton.Checked then begin
srcMessage := 'case '+srcMessage+' of'+LineEnding;
for i := 0 to CaseResultCheckGroup.Items.Count-1 do begin
if not CaseResultCheckGroup.Checked[i] then continue;
if BeginEndCheckBox.Checked then
srcMessage := srcMessage+CaseResultCheckGroup.Items[i]+
': begin'+LineEnding+'end;'+LineEnding
else
srcMessage := srcMessage+CaseResultCheckGroup.Items[i]+
': ;'+LineEnding;
end;
if BeginEndCheckBox.Checked then
srcMessage := srcMessage+'else begin'+LineEnding+'end;'+LineEnding
else
srcMessage := srcMessage+'else'+LineEnding;
srcMessage := srcMessage+'end;'
end;
end;
end;
procedure TFormMessagesComposer.GetParamsFmtExecute(Sender: TObject);
const FormatParams = ['D', 'E', 'F', 'G', 'M', 'N', 'P', 'S', 'U', 'X'];
var strtmp: string;
ListParams: TStringList;
indx: integer;
chrtmp: Char;
begin
if KindMessageRadioGroup.ItemIndex<>8 then exit;
ButtonsStringGrid.Cells[0, 0] := 'Params (array of const)';
ButtonsStringGrid.Cells[1, 0] := 'Values';
ButtonsStringGrid.FixedCols := 1;
Panel2.Visible := false;
ListParams := TStringList.Create;
strtmp := UpperCase(MsgEdit.Text);
indx := pos('%', strtmp);
while (indx>0)and(indx<Length(strtmp)) do begin
chrtmp := strtmp[indx+1];
if chrtmp in FormatParams then
ListParams.Add('%'+chrtmp);
Delete(strtmp, indx, 1);
indx := pos('%',strtmp);
end;
if ListParams.Count>0 then begin
ListParams.Insert(0,'Params (array of const)');
ButtonsStringGrid.RowCount := ListParams.Count;
if ButtonsStringGrid.Cols[0].Text<>ListParams.Text then
ButtonsStringGrid.Cols[0] := ListParams;
end;
ListParams.Free;
end;
procedure TFormMessagesComposer.MessageSetupExecute(Sender: TObject);
var indx: integer;
ListResult: TStringList;
begin
//Msg
case KindMessageRadioGroup.ItemIndex of
0,1,2,3,4,5,6,7,8,9: begin
MsgEdit.Color := clWindow;
MsgEdit.Enabled := true;
end;
else begin
MsgEdit.Color := clBtnFace;
MsgEdit.Enabled := false;
end;
end;
//Caption
case KindMessageRadioGroup.ItemIndex of
1,2,5,6,10,11,12,13: begin
CaptionEdit.Color := clWindow;
CaptionEdit.Enabled := true;
end;
else begin
CaptionEdit.Color := clBtnFace;
CaptionEdit.Enabled := false;
end;
end;
//DlgType;
case KindMessageRadioGroup.ItemIndex of
0,1,2,3,4,5,6: begin
DlgTypeComboBox.Color := clWindow;
DlgTypeComboBox.Enabled := true;
end;
else begin
DlgTypeComboBox.Color := clBtnFace;
DlgTypeComboBox.Enabled := false;
end;
end;
//BUTTONS (TMsgDlgButtons)
case KindMessageRadioGroup.ItemIndex of
0,1,2,3,4: begin
ButtonsCheckGroup.Enabled := true;
end;
else begin
ButtonsCheckGroup.Enabled := false;
end;
end;
//HelpContext
case KindMessageRadioGroup.ItemIndex of
0,1,3,4,5: begin
HelpContextSpinEdit.Color := clWindow;
HelpContextSpinEdit.Enabled := true;
end;
else begin
HelpContextSpinEdit.Color := clBtnFace;
HelpContextSpinEdit.Enabled := false;
end;
end;
//HelpKeyword
case KindMessageRadioGroup.ItemIndex of
2,6: begin
HelpKeyWordEdit.Color := clWindow;
HelpKeyWordEdit.Enabled := true;
end;
else begin
HelpKeyWordEdit.Color := clBtnFace;
HelpKeyWordEdit.Enabled := false;
end;
end;
//Position X Y
case KindMessageRadioGroup.ItemIndex of
3,4,9: begin
XSpinEdit.Color := clWindow;
XSpinEdit.Enabled := true;
YSpinEdit.Color := clWindow;
YSpinEdit.Enabled := true;
end;
else begin
XSpinEdit.Color := clBtnFace;
XSpinEdit.Enabled := false;
YSpinEdit.Color := clBtnFace;
YSpinEdit.Enabled := false;
end;
end;
//HelpFileName
case KindMessageRadioGroup.ItemIndex of
4: begin
HelpFileNameEdit.Color := clWindow;
HelpFileNameEdit.Enabled := true;
end;
else begin
HelpFileNameEdit.Color := clBtnFace;
HelpFileNameEdit.Enabled := false;
end;
end;
//Params BUTTONS (array of const)
case KindMessageRadioGroup.ItemIndex of
5,6,8: begin
ButtonsPanel.Enabled := true;
ButtonsStringGrid.Color := clWindow;
end;
else begin
ButtonsPanel.Enabled := false;
ButtonsStringGrid.Color := clBtnFace;
end;
end;
//Params (array of const)
case KindMessageRadioGroup.ItemIndex of
8: begin
GetParamsFmt.Execute;
end;
else begin
ButtonsStringGrid.Cells[0, 0] := 'BUTTONS (array of const)';
ButtonsStringGrid.Cells[1, 0] := 'Modal Result';
ButtonsStringGrid.FixedCols := 0;
Panel2.Visible := true;
end;
end;
//Prompt
case KindMessageRadioGroup.ItemIndex of
10,11,12,13: begin
PromptEdit.Color := clWindow;
PromptEdit.Enabled := true;
end;
else begin
PromptEdit.Color := clBtnFace;
PromptEdit.Enabled := false;
end;
end;
//MaskInput
case KindMessageRadioGroup.ItemIndex of
10: begin
MaskInputCheckBox.Enabled := true;
end;
else begin
MaskInputCheckBox.Enabled := false;
end;
end;
//Value
case KindMessageRadioGroup.ItemIndex of
10,11: begin
ValueEdit.Color := clWindow;
ValueEdit.Enabled := true;
end;
else begin
ValueEdit.Color := clBtnFace;
ValueEdit.Enabled := false;
end;
end;
//Default
case KindMessageRadioGroup.ItemIndex of
12: begin
DefaultEdit.Color := clWindow;
DefaultEdit.Enabled := true;
end;
else begin
DefaultEdit.Color := clBtnFace;
DefaultEdit.Enabled := false;
end;
end;
///// Results and Source Wrapper for message //////
//InputBox(); PasswordBox();
case KindMessageRadioGroup.ItemIndex of
12,13: begin
StringResultEdit.Enabled := true;
StringResultEdit.Color := clWindow;
IfResultComboBox.Enabled := false;
IfResultComboBox.Color := clBtnFace;
CaseResultCheckGroup.Enabled := false;
CaseOfEndElseRadioButton.Enabled := false;
CaseOfEndRadioButton.Enabled := false;
end;
else
StringResultEdit.Enabled := false;
StringResultEdit.Color := clBtnFace;
IfResultComboBox.Enabled := true;
IfResultComboBox.Color := clWindow;
CaseResultCheckGroup.Enabled := true;
CaseOfEndElseRadioButton.Enabled := true;
CaseOfEndRadioButton.Enabled := true;
end;
//ShowMessage(); ShowMessageFmt(); ShowMessagePos();
case KindMessageRadioGroup.ItemIndex of
7,8,9: SourceWrapperGroupBox.Enabled := false;
else
SourceWrapperGroupBox.Enabled := true;
end;
//MessageDlg() Result
case KindMessageRadioGroup.ItemIndex of
0,1,2,3,4: begin
ListResult := TStringList.Create;
for indx := 0 to ButtonsCheckGroup.Items.Count-1 do
if ButtonsCheckGroup.Checked[indx] then begin
if ButtonsCheckGroup.Items[indx] = 'mbOK' then
ListResult.Add('mrOK');
if ButtonsCheckGroup.Items[indx] = 'mbCancel' then
ListResult.Add('mrCancel');
if ButtonsCheckGroup.Items[indx] = 'mbYes' then
ListResult.Add('mrYes');
if ButtonsCheckGroup.Items[indx] = 'mbNo' then
ListResult.Add('mrNo');
if ButtonsCheckGroup.Items[indx] = 'mbAbort' then
ListResult.Add('mrAbort');
if ButtonsCheckGroup.Items[indx] = 'mbRetry' then
ListResult.Add('mrRetry');
if ButtonsCheckGroup.Items[indx] = 'mbIgnore' then
ListResult.Add('mrIgnore');
if ButtonsCheckGroup.Items[indx] = 'mbAll' then
ListResult.Add('mrAll');
if ButtonsCheckGroup.Items[indx] = 'mbNoToAll' then
ListResult.Add('mrNoToAll');
if ButtonsCheckGroup.Items[indx] = 'mbYesToAll' then
ListResult.Add('mrYesToAll');
if (ButtonsCheckGroup.Items[indx] = 'mbClose')and
(ListResult.IndexOf('mrCancel') = -1) then
ListResult.Add('mrCancel');
end;
if ListResult.Text<>IfResultComboBox.Items.Text then begin
IfResultComboBox.Items := ListResult;
CaseResultCheckGroup.Items := ListResult;
if ListResult.Count>0 then begin
IfResultComboBox.ItemIndex := 0;
CaseResultCheckGroup.Checked[0] := true;
end;
end;
ListResult.Free;
end;
end;
//QuestionDlg() Result
case KindMessageRadioGroup.ItemIndex of
5,6: begin
ListResult := TStringList.Create;
ListResult.Assign(ButtonsStringGrid.Cols[1]);
ListResult.Delete(0);
if ListResult.Text<>IfResultComboBox.Items.Text then begin
IfResultComboBox.Items := ListResult;
CaseResultCheckGroup.Items := ListResult;
if ListResult.Count>0 then begin
IfResultComboBox.ItemIndex := 0;
CaseResultCheckGroup.Checked[0] := true;
end;
end;
ListResult.Free;
end;
end;
//InputQuery() Result
case KindMessageRadioGroup.ItemIndex of
10,11: if CaseResultCheckGroup.Items[0]<>'false' then begin
CaseResultCheckGroup.Items.Clear;
CaseResultCheckGroup.Items.Add('false');
CaseResultCheckGroup.Items.Add('true');
IfResultComboBox.Items := CaseResultCheckGroup.Items;
IfResultComboBox.ItemIndex := 0;
CaseResultCheckGroup.Checked[0] := true;
end;
end;
end;
procedure TFormMessagesComposer.MessagesInitExecute(Sender: TObject);
begin
XSpinEdit.MaxValue := Screen.Width;
XLabel.Caption := 'X'+IntToStr(Screen.Width);
YSpinEdit.MaxValue := Screen.Height;
YLabel.Caption := 'Y'+IntToStr(Screen.Height);
HelpContextSpinEdit.Width := 80;
XSpinEdit.Width := 60;
YSpinEdit.Width := 60;
Caption := SMessageComposerCaption;
MsgLabel.Caption := SMsgCaption;
PromptLabel.Caption := SPromptCaption;
MaskInputCheckBox.Caption := SMaskInput;
SourceWrapperGroupBox.Caption := SSourceWrapper;
KindMessageRadioGroup.Caption := SKindofMessage;
MessageSetup.Execute;
end;
procedure TFormMessagesComposer.SetIfOrCaseExecute(Sender: TObject);
begin
if (KindMessageRadioGroup.ItemIndex = 12)or
(KindMessageRadioGroup.ItemIndex = 13) then exit;
if (Sender=IfThenRadioButton)or(Sender=IfThenElseRadioButton) then begin
IfResultComboBox.Color := clWindow;
IfResultComboBox.Enabled := true;
CaseResultCheckGroup.Enabled := false;
end else begin
IfResultComboBox.Color := clBtnFace;
IfResultComboBox.Enabled := false;
CaseResultCheckGroup.Enabled := true;
end;
end;
procedure TFormMessagesComposer.TestExecute(Sender: TObject);
var Msg, MsgCaption, MsgHelpKeyword, HelpFileName, Prompt,
MsgDefault, Value: string;
DlgType: TMsgDlgType;
MsgButtons: TMsgDlgButtons;
HelpCtx: Longint;
X, Y: integer;
begin
Msg := MsgEdit.Text;
DlgType := TMsgDlgType(DlgTypeComboBox.ItemIndex);
MsgButtons := [];
if ButtonsCheckGroup.Checked[0] then
MsgButtons := MsgButtons+[mbYes];
if ButtonsCheckGroup.Checked[1] then
MsgButtons := MsgButtons+[mbNo];
if ButtonsCheckGroup.Checked[2] then
MsgButtons := MsgButtons+[mbOK];
if ButtonsCheckGroup.Checked[3] then
MsgButtons := MsgButtons+[mbCancel];
if ButtonsCheckGroup.Checked[4] then
MsgButtons := MsgButtons+[mbAbort];
if ButtonsCheckGroup.Checked[5] then
MsgButtons := MsgButtons+[mbRetry];
if ButtonsCheckGroup.Checked[6] then
MsgButtons := MsgButtons+[mbIgnore];
if ButtonsCheckGroup.Checked[7] then
MsgButtons := MsgButtons+[mbAll];
if ButtonsCheckGroup.Checked[8] then
MsgButtons := MsgButtons+[mbNoToAll];
if ButtonsCheckGroup.Checked[9] then
MsgButtons := MsgButtons+[mbYesToAll];
if ButtonsCheckGroup.Checked[10] then
MsgButtons := MsgButtons+[mbHelp];
if ButtonsCheckGroup.Checked[11] then
MsgButtons := MsgButtons+[mbClose];
MsgCaption := CaptionEdit.Text;
HelpCtx := HelpContextSpinEdit.Value;
HelpKeyword := HelpKeyWordEdit.Text;
X := XSpinEdit.Value;
Y := YSpinEdit.Value;
Prompt := PromptEdit.Text;
MsgDefault := DefaultEdit.Text;
Value := ValueEdit.Text;
case KindMessageRadioGroup.ItemIndex of
0: MessageDlg(Msg, DlgType, MsgButtons, HelpCtx);
1: MessageDlg(MsgCaption, Msg, DlgType, MsgButtons, HelpCtx);
2: MessageDlg(MsgCaption, Msg, DlgType, MsgButtons, MsgHelpKeyword);
3: MessageDlgPos(Msg, DlgType, MsgButtons, HelpCtx, X, Y);
4: MessageDlgPosHelp(Msg, DlgType, MsgButtons, HelpCtx, X, Y, HelpFileName);
5: QuestionDlg(MsgCaption, Msg+' ('+SNotImplementedYet+')', DlgType, [mrYes, 'Yes', mrNo, 'No',
mrCancel, 'Cancel'], HelpCtx);
6: QuestionDlg(MsgCaption, Msg+' ('+SNotImplementedYet+')', DlgType, [mrYes, 'Yes', mrNo, 'No',
mrCancel, 'Cancel'], HelpKeyword);
7: ShowMessage(Msg);
8: ShowMessageFmt(Msg+' ('+SNotImplementedYet+')', ['Yes','No','Cancel']);
9: ShowMessagePos(Msg, X, Y);
10: InputQuery(MsgCaption, Prompt, MaskInputCheckBox.Checked, Value);
11: InputQuery(MsgCaption, Prompt, Value);
12: InputBox(Caption, Prompt, MsgDefault);
13: PasswordBox(MsgCaption, Prompt)
end;
end;
procedure TFormMessagesComposer.UpdateQuestioDlgResultExecute(Sender: TObject);
var ListResult: TStringList;
begin
ListResult := TStringList.Create;
ListResult.Assign(ButtonsStringGrid.Cols[1]);
ListResult.Delete(0);
if ListResult.Text<>IfResultComboBox.Items.Text then begin
IfResultComboBox.Items := ListResult;
CaseResultCheckGroup.Items := ListResult;
if ListResult.Count>0 then begin
IfResultComboBox.ItemIndex := 0;
CaseResultCheckGroup.Checked[0] := true;
end;
end;
ListResult.Free;
end;
{ Registers a keyboard shortcut and menu item in Lazarus}
procedure Register;
var
Key1,Key2: TIDEShortCut;
Cat: TIDECommandCategory;
begin
Key1 := IDEShortCut(VK_M, [ssCtrl], VK_UNKNOWN, []);
Key2 := IDEShortCut(VK_UNKNOWN, [], VK_UNKNOWN, []);
Cat := IDECommandList.CreateCategory(Nil, cMessageComposer,
SMessageComposerCaption,
IDECmdScopeSrcEditOnly);
CmdMessageComposer := RegisterIDECommand(Cat, cMessageComposer,
SMessageComposerCaption,
Key1, Key2,nil,
@ExecuteMessagesComposer);
RegisterIDEMenuCommand(itmEditMenuCodeTools, cMessageComposer,
SMessageComposerCaption,
nil, nil, CmdMessageComposer);
end;
initialization
{$I messagecomposer.lrs}
end.

View File

@ -0,0 +1,2 @@
$(LazarusDir)/components/messagecomposer/messagecomposerpkg.lpk