calling updating notebook tab after realize, needed for close btns

git-svn-id: trunk@6138 -
This commit is contained in:
mattias 2004-10-15 12:04:09 +00:00
parent 2b55646f6f
commit 8f32b28a3f
14 changed files with 429 additions and 417 deletions

View File

@ -133,9 +133,7 @@ end;
---------------------------------------------------------------------------}
function FindDefaultCompilerPath: string;
begin
Result:=SearchFileInPath(GetDefaultCompilerFilename,'',
{$IFDEF Ver1_0}GetEnv{$ELSE}FpGetEnv{$ENDIF}('PATH'),':',
[sffDontSearchInBasePath]);
Result:=FindDefaultExecutablePath(GetDefaultCompilerFilename);
end;
{---------------------------------------------------------------------------
@ -143,9 +141,7 @@ end;
---------------------------------------------------------------------------}
function FindDefaultMakePath: string;
begin
Result:=SearchFileInPath('make','',
{$IFDEF Ver1_0}GetEnv{$ELSE}FpGetEnv{$ENDIF}('PATH'),':',
[sffDontSearchInBasePath]);
Result:=FindDefaultExecutablePath('make');
end;
{---------------------------------------------------------------------------

View File

@ -383,6 +383,9 @@ resourcestring
+'directory %s%s%s is invalid.%sPlease choose a complete path.';
lisUnableToCleanUpDestinationDirectory = 'Unable to clean up destination '
+'directory';
lisCommandAfterInvalid = 'Command after invalid';
lisTheCommandAfterPublishingIsInvalid = 'The command after publishing is '
+'invalid:%s%s%s%s';
lisUnableToCleanUpPleaseCheckPermissions = 'Unable to clean up %s%s%s.%'
+'sPlease check permissions.';
lisCommandAfterPublishingModule = 'Command after publishing module';

View File

@ -83,6 +83,7 @@ const
function GetDefaultTestBuildDirectory: string;
function FindDefaultExecutablePath(const Executable: string): string;
function FindDefaultCompilerPath: string;
function FindDefaultMakePath: string;
function FindDefaultFPCSrcDirectory: string;
@ -118,6 +119,16 @@ implementation
{$I lazconf.inc}
function FindDefaultExecutablePath(const Executable: string): string;
begin
if FilenameIsAbsolute(Executable) then
Result:=Executable
else
Result:=SearchFileInPath(Executable,'',
GetEnvironmentVariable('PATH'),':',
[sffDontSearchInBasePath]);
end;
function GetDefaultLCLLibPaths(const Prefix, Postfix, Separator: string): string;
var
List: TStringList;
@ -206,6 +217,9 @@ end.
{
$Log$
Revision 1.32 2004/10/15 12:04:08 mattias
calling updating notebook tab after realize, needed for close btns
Revision 1.31 2004/09/27 22:05:40 vincents
splitted off unit FileUtil, it doesn't depend on other LCL units

View File

@ -7347,9 +7347,15 @@ begin
exit;
end;
SplitCmdLine(CommandAfter,CmdAfterExe,CmdAfterParams);
if (CmdAfterExe<>'') and not FileIsExecutable(CmdAfterExe) then begin
Result:=mrCancel;
exit;
if (CmdAfterExe<>'') then begin
CmdAfterExe:=FindDefaultExecutablePath(CmdAfterExe);
if not FileIsExecutable(CmdAfterExe) then begin
MessageDlg(lisCommandAfterInvalid,
Format(lisTheCommandAfterPublishingIsInvalid, [#13, '"', CmdAfterExe,
'"']), mtError, [mbCancel], 0);
Result:=mrCancel;
exit;
end;
end;
// clear destination directory
@ -7374,6 +7380,7 @@ begin
if not CopyDirectoryWithMethods(SrcDir,DestDir,
@OnCopyFile,@OnCopyError,Options) then
begin
debugln('TMainIDE.DoPublishModule CopyDirectoryWithMethods failed');
Result:=mrCancel;
exit;
end;
@ -7385,7 +7392,10 @@ begin
DeleteFile(NewProjectFilename);
Result:=CurProject.WriteProject(CurProject.PublishOptions.WriteFlags,
NewProjectFilename);
if Result<>mrOk then exit;
if Result<>mrOk then begin
debugln('TMainIDE.DoPublishModule CurProject.WriteProject failed');
exit;
end;
end;
// execute 'CommandAfter'
@ -10911,6 +10921,9 @@ end.
{ =============================================================================
$Log$
Revision 1.784 2004/10/15 12:04:08 mattias
calling updating notebook tab after realize, needed for close btns
Revision 1.783 2004/10/11 17:48:59 vincents
Command line help for --debug-log.

View File

@ -1,21 +1,22 @@
object PublishProjectDialog: TPublishProjectDialog
Caption = 'Publish Project'
ClientHeight = 462
ClientHeight = 465
ClientWidth = 469
OnResize = PublishProjectDialogRESIZE
PixelsPerInch = 90
Position = poScreenCenter
HorzScrollBar.Page = 470
VertScrollBar.Page = 463
VertScrollBar.Page = 466
Left = 307
Height = 462
Height = 465
Top = 165
Width = 469
object OkButton: TButton
Anchors = [akTop, akRight]
ModalResult = 1
Caption = 'Ok'
TabOrder = 0
ModalResult = 1
OnClick = OkButtonCLICK
TabOrder = 0
Left = 72
Height = 25
Top = 432
@ -23,8 +24,8 @@ object PublishProjectDialog: TPublishProjectDialog
end
object CancelButton: TButton
Anchors = [akTop, akRight]
ModalResult = 2
Caption = 'Cancel'
ModalResult = 2
TabOrder = 1
Left = 371
Height = 25
@ -32,6 +33,7 @@ object PublishProjectDialog: TPublishProjectDialog
Width = 75
end
object DestDirGroupBox: TGroupBox
Anchors = [akTop, akLeft, akRight]
Caption = 'Destination directory'
ClientHeight = 94
ClientWidth = 446
@ -44,6 +46,7 @@ object PublishProjectDialog: TPublishProjectDialog
Top = 8
Width = 450
object DestDirComboBox: TComboBox
Anchors = [akTop, akLeft, akRight]
MaxLength = 0
ParentCtl3D = False
TabOrder = 0
@ -54,16 +57,17 @@ object PublishProjectDialog: TPublishProjectDialog
Width = 350
end
object BrowseDestDirBitBtn: TBitBtn
OnClick = BrowseDestDirBitBtnCLICK
Anchors = [akTop, akRight]
Caption = 'Browse'
TabOrder = 1
OnClick = BrowseDestDirBitBtnCLICK
TabOrder = 1
Left = 366
Height = 25
Top = 1
Width = 72
end
object CommandAfterCombobox: TComboBox
Anchors = [akTop, akLeft, akRight]
MaxLength = 0
ParentCtl3D = False
TabOrder = 2
@ -74,6 +78,7 @@ object PublishProjectDialog: TPublishProjectDialog
Width = 430
end
object CommandAfterLabel: TLabel
Anchors = [akTop, akLeft, akRight]
Caption = 'Command after:'
Left = 6
Height = 17
@ -82,6 +87,7 @@ object PublishProjectDialog: TPublishProjectDialog
end
end
object FilesGroupbox: TGroupBox
Anchors = [akTop, akLeft, akRight]
Caption = 'Files'
ClientHeight = 27
ClientWidth = 446
@ -95,17 +101,18 @@ object PublishProjectDialog: TPublishProjectDialog
Width = 450
object IgnoreBinariesCheckbox: TCheckBox
AllowGrayed = True
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Ignore binaries'
DragCursor = 65524
TabOrder = 0
Left = 6
Height = 20
Top = 1
Width = 161
Width = 428
end
end
object ProjectInfoGroupbox: TGroupBox
Anchors = [akTop, akLeft, akRight]
Caption = 'Project Information'
ClientHeight = 52
ClientWidth = 446
@ -119,9 +126,9 @@ object PublishProjectDialog: TPublishProjectDialog
Width = 450
object SaveClosedEditorFilesInfoCheckbox: TCheckBox
AllowGrayed = True
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Save editor info of closed files'
DragCursor = 65524
TabOrder = 0
Left = 4
Height = 20
@ -130,9 +137,9 @@ object PublishProjectDialog: TPublishProjectDialog
end
object SaveEditorInfoOfNonProjectFilesCheckbox: TCheckBox
AllowGrayed = True
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Save editor info of non project files'
DragCursor = 65524
TabOrder = 1
Left = 4
Height = 20
@ -143,14 +150,15 @@ object PublishProjectDialog: TPublishProjectDialog
object SaveSettingsButton: TButton
Anchors = [akTop, akRight]
Caption = 'Save settings'
TabOrder = 5
OnClick = SaveSettingsButtonCLICK
TabOrder = 5
Left = 198
Height = 25
Top = 432
Width = 120
end
object IncludeFilterGroupbox: TGroupBox
Anchors = [akTop, akLeft, akRight]
Caption = 'Include Filter'
ClientHeight = 58
ClientWidth = 446
@ -167,7 +175,6 @@ object PublishProjectDialog: TPublishProjectDialog
AllowGrayed = True
AutoSize = True
Caption = 'Use Include Filter'
DragCursor = 65524
TabOrder = 0
Left = 6
Height = 20
@ -178,14 +185,14 @@ object PublishProjectDialog: TPublishProjectDialog
AllowGrayed = True
AutoSize = True
Caption = 'Simple Syntax'
DragCursor = 65524
TabOrder = 1
Left = 196
Height = 20
Top = 2
Width = 201
Width = 215
end
object IncludeFilterCombobox: TComboBox
Anchors = [akTop, akLeft, akRight]
MaxLength = 0
ParentCtl3D = False
TabOrder = 2
@ -197,6 +204,7 @@ object PublishProjectDialog: TPublishProjectDialog
end
end
object ExcludeFilterGroupbox: TGroupBox
Anchors = [akTop, akLeft, akRight]
Caption = 'Exclude Filter'
ClientHeight = 62
ClientWidth = 444
@ -213,18 +221,16 @@ object PublishProjectDialog: TPublishProjectDialog
AllowGrayed = True
AutoSize = True
Caption = 'Use Exclude Filter'
DragCursor = 65524
TabOrder = 0
Left = 6
Height = 20
Top = 5
Width = 151
Width = 184
end
object ExcFilterSimpleSyntaxCheckbox: TCheckBox
AllowGrayed = True
AutoSize = True
Caption = 'Simple Syntax'
DragCursor = 65524
TabOrder = 1
Left = 199
Height = 20
@ -232,6 +238,7 @@ object PublishProjectDialog: TPublishProjectDialog
Width = 212
end
object ExcludeFilterCombobox: TComboBox
Anchors = [akTop, akLeft, akRight]
MaxLength = 0
ParentCtl3D = False
TabOrder = 2

View File

@ -2,69 +2,75 @@
LazarusResources.Add('TPublishProjectDialog','FORMDATA',[
'TPF0'#21'TPublishProjectDialog'#20'PublishProjectDialog'#7'Caption'#6#15'Pub'
+'lish Project'#12'ClientHeight'#3#206#1#11'ClientWidth'#3#213#1#8'OnResize'#7
+#26'PublishProjectDialogRESIZE'#8'Position'#7#14'poScreenCenter'#18'HorzScro'
+'llBar.Page'#3#214#1#18'VertScrollBar.Page'#3#207#1#4'Left'#3'3'#1#6'Height'
+#3#206#1#3'Top'#3#165#0#5'Width'#3#213#1#0#7'TButton'#8'OkButton'#7'Anchors'
+#11#5'akTop'#7'akRight'#0#11'ModalResult'#2#1#7'Caption'#6#2'Ok'#8'TabOrder'
+#2#0#7'OnClick'#7#13'OkButtonCLICK'#4'Left'#2'H'#6'Height'#2#25#3'Top'#3#176
+#1#5'Width'#2'K'#0#0#7'TButton'#12'CancelButton'#7'Anchors'#11#5'akTop'#7'ak'
+'Right'#0#11'ModalResult'#2#2#7'Caption'#6#6'Cancel'#8'TabOrder'#2#1#4'Left'
+#3's'#1#6'Height'#2#25#3'Top'#3#176#1#5'Width'#2'K'#0#0#9'TGroupBox'#15'Dest'
+'DirGroupBox'#7'Caption'#6#21'Destination directory'#12'ClientHeight'#2'^'#11
+'ClientWidth'#3#190#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#2#8
+'OnResize'#7#21'DestDirGroupBoxRESIZE'#4'Left'#2#8#6'Height'#2'o'#3'Top'#2#8
+#5'Width'#3#194#1#0#9'TComboBox'#15'DestDirComboBox'#9'MaxLength'#2#0#11'Par'
+'entCtl3D'#8#8'TabOrder'#2#0#4'Text'#6#15'DestDirComboBox'#4'Left'#2#6#6'Hei'
+'ght'#2#25#3'Top'#2#1#5'Width'#3'^'#1#0#0#7'TBitBtn'#19'BrowseDestDirBitBtn'
+#7'OnClick'#7#24'BrowseDestDirBitBtnCLICK'#7'Caption'#6#6'Browse'#8'TabOrder'
+#2#1#7'OnClick'#7#24'BrowseDestDirBitBtnCLICK'#4'Left'#3'n'#1#6'Height'#2#25
+#3'Top'#2#1#5'Width'#2'H'#0#0#9'TComboBox'#20'CommandAfterCombobox'#9'MaxLen'
+'gth'#2#0#11'ParentCtl3D'#8#8'TabOrder'#2#2#4'Text'#6#20'CommandAfterCombobo'
+'x'#4'Left'#2#6#6'Height'#2#25#3'Top'#2':'#5'Width'#3#174#1#0#0#6'TLabel'#17
+'CommandAfterLabel'#7'Caption'#6#14'Command after:'#4'Left'#2#6#6'Height'#2
+#17#3'Top'#2'!'#5'Width'#3#172#1#0#0#0#9'TGroupBox'#13'FilesGroupbox'#7'Capt'
+'ion'#6#5'Files'#12'ClientHeight'#2#27#11'ClientWidth'#3#190#1#11'ParentColo'
+'r'#9#11'ParentCtl3D'#8#8'TabOrder'#2#3#8'OnResize'#7#19'FilesGroupboxRESIZE'
+#4'Left'#2#8#6'Height'#2','#3'Top'#3#128#0#5'Width'#3#194#1#0#9'TCheckBox'#22
+'IgnoreBinariesCheckbox'#11'AllowGrayed'#9#8'AutoSize'#9#7'Caption'#6#15'Ign'
+'ore binaries'#10'DragCursor'#4#244#255#0#0#8'TabOrder'#2#0#4'Left'#2#6#6'He'
+'ight'#2#20#3'Top'#2#1#5'Width'#3#161#0#0#0#0#9'TGroupBox'#19'ProjectInfoGro'
+'upbox'#7'Caption'#6#19'Project Information'#12'ClientHeight'#2'4'#11'Client'
+'Width'#3#190#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#4#8'OnResi'
+'ze'#7#25'ProjectInfoGroupboxRESIZE'#4'Left'#2#8#6'Height'#2'E'#3'Top'#3'X'#1
+#5'Width'#3#194#1#0#9'TCheckBox!SaveClosedEditorFilesInfoCheckbox'#11'AllowG'
+'rayed'#9#8'AutoSize'#9#7'Caption'#6' Save editor info of closed files'#10'D'
+'ragCursor'#4#244#255#0#0#8'TabOrder'#2#0#4'Left'#2#4#6'Height'#2#20#3'Top'#2
+#1#5'Width'#3#176#1#0#0#9'TCheckBox''SaveEditorInfoOfNonProjectFilesCheckbox'
+#11'AllowGrayed'#9#8'AutoSize'#9#7'Caption'#6'%Save editor info of non proje'
+'ct files'#10'DragCursor'#4#244#255#0#0#8'TabOrder'#2#1#4'Left'#2#4#6'Height'
+#2#20#3'Top'#2#26#5'Width'#3#176#1#0#0#0#7'TButton'#18'SaveSettingsButton'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#13'Save settings'#8'TabOrder'
+#2#5#7'OnClick'#7#23'SaveSettingsButtonCLICK'#4'Left'#3#198#0#6'Height'#2#25
+#3'Top'#3#176#1#5'Width'#2'x'#0#0#9'TGroupBox'#21'IncludeFilterGroupbox'#7'C'
+'aption'#6#14'Include Filter'#12'ClientHeight'#2':'#11'ClientWidth'#3#190#1
+#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#6#7'TabStop'#9#8'OnResize'
+#7#27'IncludeFilterGroupboxRESIZE'#4'Left'#2#8#6'Height'#2'K'#3'Top'#3#176#0
+#5'Width'#3#194#1#0#9'TCheckBox'#24'UseIncludeFilterCheckbox'#11'AllowGrayed'
+#9#8'AutoSize'#9#7'Caption'#6#18'Use Include Filter'#10'DragCursor'#4#244#255
+#0#0#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#20#3'Top'#2#1#5'Width'#3#171#0#0
+#0#9'TCheckBox'#29'IncFilterSimpleSyntaxCheckbox'#11'AllowGrayed'#9#8'AutoSi'
+'ze'#9#7'Caption'#6#13'Simple Syntax'#10'DragCursor'#4#244#255#0#0#8'TabOrde'
+'r'#2#1#4'Left'#3#196#0#6'Height'#2#20#3'Top'#2#2#5'Width'#3#201#0#0#0#9'TCo'
+'mboBox'#21'IncludeFilterCombobox'#9'MaxLength'#2#0#11'ParentCtl3D'#8#8'TabO'
+'rder'#2#2#4'Text'#6#21'IncludeFilterCombobox'#4'Left'#2#6#6'Height'#2#25#3
+'Top'#2#25#5'Width'#3#174#1#0#0#0#9'TGroupBox'#21'ExcludeFilterGroupbox'#7'C'
+'aption'#6#14'Exclude Filter'#12'ClientHeight'#2'>'#11'ClientWidth'#3#188#1
+#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#7#7'TabStop'#9#8'OnResize'
+#7#27'ExcludeFilterGroupboxRESIZE'#4'Left'#2#8#6'Height'#2'O'#3'Top'#3#0#1#5
+'Width'#3#192#1#0#9'TCheckBox'#24'UseExcludeFilterCheckbox'#11'AllowGrayed'#9
+#8'AutoSize'#9#7'Caption'#6#18'Use Exclude Filter'#10'DragCursor'#4#244#255#0
+#0#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#20#3'Top'#2#5#5'Width'#3#151#0#0#0
+#9'TCheckBox'#29'ExcFilterSimpleSyntaxCheckbox'#11'AllowGrayed'#9#8'AutoSize'
+#9#7'Caption'#6#13'Simple Syntax'#10'DragCursor'#4#244#255#0#0#8'TabOrder'#2
+#1#4'Left'#3#199#0#6'Height'#2#20#3'Top'#2#6#5'Width'#3#212#0#0#0#9'TComboBo'
+'x'#21'ExcludeFilterCombobox'#9'MaxLength'#2#0#11'ParentCtl3D'#8#8'TabOrder'
,#2#2#4'Text'#6#21'ExcludeFilterCombobox'#4'Left'#2#6#6'Height'#2#25#3'Top'#2
+#30#5'Width'#3#174#1#0#0#0#0
+'lish Project'#12'ClientHeight'#3#209#1#11'ClientWidth'#3#213#1#8'OnResize'#7
+#26'PublishProjectDialogRESIZE'#13'PixelsPerInch'#2'Z'#8'Position'#7#14'poSc'
+'reenCenter'#18'HorzScrollBar.Page'#3#214#1#18'VertScrollBar.Page'#3#210#1#4
+'Left'#3'3'#1#6'Height'#3#209#1#3'Top'#3#165#0#5'Width'#3#213#1#0#7'TButton'
+#8'OkButton'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#2'Ok'#11'Modal'
+'Result'#2#1#7'OnClick'#7#13'OkButtonCLICK'#8'TabOrder'#2#0#4'Left'#2'H'#6'H'
+'eight'#2#25#3'Top'#3#176#1#5'Width'#2'K'#0#0#7'TButton'#12'CancelButton'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2
+#8'TabOrder'#2#1#4'Left'#3's'#1#6'Height'#2#25#3'Top'#3#176#1#5'Width'#2'K'#0
+#0#9'TGroupBox'#15'DestDirGroupBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRig'
+'ht'#0#7'Caption'#6#21'Destination directory'#12'ClientHeight'#2'^'#11'Clien'
+'tWidth'#3#190#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#2#8'OnRes'
+'ize'#7#21'DestDirGroupBoxRESIZE'#4'Left'#2#8#6'Height'#2'o'#3'Top'#2#8#5'Wi'
+'dth'#3#194#1#0#9'TComboBox'#15'DestDirComboBox'#7'Anchors'#11#5'akTop'#6'ak'
+'Left'#7'akRight'#0#9'MaxLength'#2#0#11'ParentCtl3D'#8#8'TabOrder'#2#0#4'Tex'
+'t'#6#15'DestDirComboBox'#4'Left'#2#6#6'Height'#2#25#3'Top'#2#1#5'Width'#3'^'
+#1#0#0#7'TBitBtn'#19'BrowseDestDirBitBtn'#7'Anchors'#11#5'akTop'#7'akRight'#0
+#7'Caption'#6#6'Browse'#7'OnClick'#7#24'BrowseDestDirBitBtnCLICK'#8'TabOrder'
+#2#1#4'Left'#3'n'#1#6'Height'#2#25#3'Top'#2#1#5'Width'#2'H'#0#0#9'TComboBox'
+#20'CommandAfterCombobox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#9'Ma'
+'xLength'#2#0#11'ParentCtl3D'#8#8'TabOrder'#2#2#4'Text'#6#20'CommandAfterCom'
+'bobox'#4'Left'#2#6#6'Height'#2#25#3'Top'#2':'#5'Width'#3#174#1#0#0#6'TLabel'
+#17'CommandAfterLabel'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Capti'
+'on'#6#14'Command after:'#4'Left'#2#6#6'Height'#2#17#3'Top'#2'!'#5'Width'#3
+#172#1#0#0#0#9'TGroupBox'#13'FilesGroupbox'#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#0#7'Caption'#6#5'Files'#12'ClientHeight'#2#27#11'ClientWidth'#3
+#190#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#3#8'OnResize'#7#19
+'FilesGroupboxRESIZE'#4'Left'#2#8#6'Height'#2','#3'Top'#3#128#0#5'Width'#3
+#194#1#0#9'TCheckBox'#22'IgnoreBinariesCheckbox'#11'AllowGrayed'#9#7'Anchors'
+#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6#15'Ignore bin'
+'aries'#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#20#3'Top'#2#1#5'Width'#3#172
+#1#0#0#0#9'TGroupBox'#19'ProjectInfoGroupbox'#7'Anchors'#11#5'akTop'#6'akLef'
+'t'#7'akRight'#0#7'Caption'#6#19'Project Information'#12'ClientHeight'#2'4'
+#11'ClientWidth'#3#190#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#4
+#8'OnResize'#7#25'ProjectInfoGroupboxRESIZE'#4'Left'#2#8#6'Height'#2'E'#3'To'
+'p'#3'X'#1#5'Width'#3#194#1#0#9'TCheckBox!SaveClosedEditorFilesInfoCheckbox'
+#11'AllowGrayed'#9#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'
+#9#7'Caption'#6' Save editor info of closed files'#8'TabOrder'#2#0#4'Left'#2
+#4#6'Height'#2#20#3'Top'#2#1#5'Width'#3#176#1#0#0#9'TCheckBox''SaveEditorInf'
+'oOfNonProjectFilesCheckbox'#11'AllowGrayed'#9#7'Anchors'#11#5'akTop'#6'akLe'
+'ft'#7'akRight'#0#8'AutoSize'#9#7'Caption'#6'%Save editor info of non projec'
+'t files'#8'TabOrder'#2#1#4'Left'#2#4#6'Height'#2#20#3'Top'#2#26#5'Width'#3
+#176#1#0#0#0#7'TButton'#18'SaveSettingsButton'#7'Anchors'#11#5'akTop'#7'akRi'
+'ght'#0#7'Caption'#6#13'Save settings'#7'OnClick'#7#23'SaveSettingsButtonCLI'
+'CK'#8'TabOrder'#2#5#4'Left'#3#198#0#6'Height'#2#25#3'Top'#3#176#1#5'Width'#2
+'x'#0#0#9'TGroupBox'#21'IncludeFilterGroupbox'#7'Anchors'#11#5'akTop'#6'akLe'
+'ft'#7'akRight'#0#7'Caption'#6#14'Include Filter'#12'ClientHeight'#2':'#11'C'
+'lientWidth'#3#190#1#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#6#7'T'
+'abStop'#9#8'OnResize'#7#27'IncludeFilterGroupboxRESIZE'#4'Left'#2#8#6'Heigh'
+'t'#2'K'#3'Top'#3#176#0#5'Width'#3#194#1#0#9'TCheckBox'#24'UseIncludeFilterC'
+'heckbox'#11'AllowGrayed'#9#8'AutoSize'#9#7'Caption'#6#18'Use Include Filter'
+#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#20#3'Top'#2#1#5'Width'#3#171#0#0#0#9
+'TCheckBox'#29'IncFilterSimpleSyntaxCheckbox'#11'AllowGrayed'#9#8'AutoSize'#9
+#7'Caption'#6#13'Simple Syntax'#8'TabOrder'#2#1#4'Left'#3#196#0#6'Height'#2
+#20#3'Top'#2#2#5'Width'#3#215#0#0#0#9'TComboBox'#21'IncludeFilterCombobox'#7
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#9'MaxLength'#2#0#11'ParentCtl3D'
+#8#8'TabOrder'#2#2#4'Text'#6#21'IncludeFilterCombobox'#4'Left'#2#6#6'Height'
+#2#25#3'Top'#2#25#5'Width'#3#174#1#0#0#0#9'TGroupBox'#21'ExcludeFilterGroupb'
+'ox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#14'Exclude F'
+'ilter'#12'ClientHeight'#2'>'#11'ClientWidth'#3#188#1#11'ParentColor'#9#11'P'
+'arentCtl3D'#8#8'TabOrder'#2#7#7'TabStop'#9#8'OnResize'#7#27'ExcludeFilterGr'
+'oupboxRESIZE'#4'Left'#2#8#6'Height'#2'O'#3'Top'#3#0#1#5'Width'#3#192#1#0#9
+'TCheckBox'#24'UseExcludeFilterCheckbox'#11'AllowGrayed'#9#8'AutoSize'#9#7'C'
,'aption'#6#18'Use Exclude Filter'#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#20
+#3'Top'#2#5#5'Width'#3#184#0#0#0#9'TCheckBox'#29'ExcFilterSimpleSyntaxCheckb'
+'ox'#11'AllowGrayed'#9#8'AutoSize'#9#7'Caption'#6#13'Simple Syntax'#8'TabOrd'
+'er'#2#1#4'Left'#3#199#0#6'Height'#2#20#3'Top'#2#6#5'Width'#3#212#0#0#0#9'TC'
+'omboBox'#21'ExcludeFilterCombobox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRig'
+'ht'#0#9'MaxLength'#2#0#11'ParentCtl3D'#8#8'TabOrder'#2#2#4'Text'#6#21'Exclu'
+'deFilterCombobox'#4'Left'#2#6#6'Height'#2#25#3'Top'#2#30#5'Width'#3#174#1#0
+#0#0#0
]);

View File

@ -146,30 +146,14 @@ end;
procedure TPublishProjectDialog.ExcludeFilterGroupboxRESIZE(Sender: TObject);
begin
with ExcludeFilterCombobox do
Width:=ExcludeFilterGroupbox.ClientWidth-2*Left;
end;
procedure TPublishProjectDialog.FilesGroupboxRESIZE(Sender: TObject);
begin
with FilesGroupbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with CommandAfterLabel do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with UseIncludeFilterCheckbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with IncludeFilterCombobox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with UseExcludeFilterCheckbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with ExcludeFilterCombobox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
end;
procedure TPublishProjectDialog.IncludeFilterGroupboxRESIZE(Sender: TObject);
begin
with IncludeFilterCombobox do
Width:=IncludeFilterGroupbox.ClientWidth-2*Left;
end;
procedure TPublishProjectDialog.OkButtonCLICK(Sender: TObject);
@ -180,24 +164,10 @@ end;
procedure TPublishProjectDialog.ProjectInfoGroupboxResize(Sender: TObject);
begin
with SaveEditorInfoOfNonProjectFilesCheckbox do
SetBounds(Left,Top,Parent.ClientWidth-Left,Height);
with SaveClosedEditorFilesInfoCheckbox do
SetBounds(Left,Top,Parent.ClientWidth-Left,Height);
end;
procedure TPublishProjectDialog.PublishProjectDialogResize(Sender: TObject);
begin
with DestDirGroupBox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with FilesGroupbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with ProjectInfoGroupbox do
SetBounds(Left,Top,Parent.ClientWidth-2*Left,Height);
with IncludeFilterGroupbox do
Width:=Parent.ClientWidth-2*Left;
with ExcludeFilterGroupbox do
Width:=Parent.ClientWidth-2*Left;
end;
procedure TPublishProjectDialog.SaveSettingsButtonClick(Sender: TObject);
@ -218,25 +188,31 @@ var
begin
// destination directories
List:=InputHistories.HistoryLists.GetList(hlPublishProjectDestDirs,true);
List.AppendEntry('$(TestDir)/publishedproject/');
List.AppendEntry('$(TestDir)/publishedpackage/');
List.AppendEntry('$(ProjectDir)/published/');
List.AppendEntry(SetDirSeparators('$(TestDir)/publishedproject/'));
List.AppendEntry(SetDirSeparators('$(TestDir)/publishedpackage/'));
List.AppendEntry(SetDirSeparators('$(ProjectDir)/published/'));
DestDirComboBox.Items.Assign(List);
// command after
List:=InputHistories.HistoryLists.GetList(hlPublishProjectCommandsAfter,true);
List.AppendEntry('/bin/tar czf $(TestDir)/project.tgz -C $(TestDir) publishedproject');
List.AppendEntry('/bin/tar czf $(TestDir)/package.tgz -C $(TestDir) publishedpackage');
List.AppendEntry(SetDirSeparators(
'tar czf $MakeFile($(ProjPublishDir)).tgz $(ProjPublishDir)'));
List.AppendEntry(SetDirSeparators(
'tar czf $(TestDir)/project.tgz -C $(TestDir) publishedproject'));
List.AppendEntry(SetDirSeparators(
'tar czf $(TestDir)/package.tgz -C $(TestDir) publishedpackage'));
CommandAfterCombobox.Items.Assign(List);
// file filter
List:=InputHistories.HistoryLists.GetList(hlPublishProjectIncludeFileFilter,true);
List:=InputHistories.HistoryLists.GetList(hlPublishProjectIncludeFileFilter,
true);
if List.Count=0 then begin
List.Add(DefPublProjIncFilter);
end;
IncludeFilterCombobox.Items.Assign(List);
List:=InputHistories.HistoryLists.GetList(hlPublishProjectExcludeFileFilter,true);
List:=InputHistories.HistoryLists.GetList(hlPublishProjectExcludeFileFilter,
true);
if List.Count=0 then begin
List.Add(DefPublProjExcFilter);
end;

View File

@ -257,6 +257,8 @@ type
FShortcut : Longint;
FSpacing : integer;
FTransparent : Boolean;
FDCNowAvailable : Boolean; //this is for gtk1, DeviceContext not available during creation process????
FDownWaiting : Boolean; //when this one is true, need to down button when DC is available
function GetGlyph : TBitmap;
procedure UpdateExclusive;
procedure SetAllowAllUp(Value: Boolean);
@ -381,6 +383,9 @@ end.
{ =============================================================================
$Log$
Revision 1.80 2004/10/15 12:04:09 mattias
calling updating notebook tab after realize, needed for close btns
Revision 1.79 2004/09/17 10:56:24 micha
convert LM_SHORTCUT message to interface methods

View File

@ -756,34 +756,13 @@ begin
TWSCustomNotebookClass(WidgetSetClass).SetTabPosition(Self, FTabPosition);
end;
{------------------------------------------------------------------------------
TCustomNotebook InternalSetMultiLine
------------------------------------------------------------------------------}
{function TCustomNotebook.InternalSetMultiLine(Value: boolean): boolean;
begin
Result := FMultiLine <> Value;
if Result then begin
if not Value and ((TabPosition = tpLeft) or (TabPosition = tpRight)) then
raise Exception.Create(
'TCustomNotebook.InternalSetMultiLine: Tab must be multiline');
FMultiLine := Value;
//if not Value then FScrollOpposite := False;
end;
end;}
{------------------------------------------------------------------------------
TCustomNotebook SetMultiLine
------------------------------------------------------------------------------}
{procedure TCustomNotebook.SetMultiLine(Value: boolean);
begin
if InternalSetMultiLine(Value) then RecreateWnd;
end;}
{ =============================================================================
$Log$
Revision 1.65 2004/10/15 12:04:09 mattias
calling updating notebook tab after realize, needed for close btns
Revision 1.64 2004/09/24 20:23:33 vincents
fixed fpc 1.0.x compilation

View File

@ -255,6 +255,9 @@ begin
ModifyWidgetStyle(TheWinControl,Widget);
{$ENDIF}
UpdateWidgetStyleOfControl(TheWinControl);
if TheWinControl is TCustomPage then
UpdateNotebookPageTab(nil,TheWinControl);
end;
end;
@ -2906,6 +2909,9 @@ end;
{ =============================================================================
$Log$
Revision 1.249 2004/10/15 12:04:09 mattias
calling updating notebook tab after realize, needed for close btns
Revision 1.248 2004/09/21 10:05:26 mattias
fixed disable at designtime and bounding TProgressBar position

View File

@ -3662,6 +3662,269 @@ begin
end;
end;
var
{$IFDef GTK1}
NoteBookCloseBtnPixmapImg: PGdkPixmap {$ifndef VER1_0} = nil {$endif};
NoteBookCloseBtnPixmapMask: PGdkPixmap {$ifndef VER1_0} = nil {$endif};
{$Else}
NoteBookCloseBtnPixbuf: PGdkPixbuf {$ifndef VER1_0} = nil {$endif};
{$EndIf}
{-------------------------------------------------------------------------------
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
Removes the dummy page.
See also AddDummyNoteBookPage
-------------------------------------------------------------------------------}
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
var
DummyWidget: PGtkWidget;
begin
DummyWidget:=GetGtkNoteBookDummyPage(NoteBookWidget);
if DummyWidget=nil then exit;
gtk_notebook_remove_page(NoteBookWidget,
gtk_notebook_page_num(NoteBookWidget,DummyWidget));
DummyWidget:=nil;
SetGtkNoteBookDummyPage(NoteBookWidget,DummyWidget);
end;
{-------------------------------------------------------------------------------
method GetNoteBookCloseBtnImage
Params:
Result: none
Loads the image for the close button in the tabs of the TCustomNoteBook(s).
-------------------------------------------------------------------------------}
{$IfDef GTK1}
procedure GetNoteBookCloseBtnImage(Window: PGdkWindow;
var Img, Mask: PGdkPixmap);
begin
if (NoteBookCloseBtnPixmapImg=nil)
and (Window<>nil) then begin
LoadXPMFromLazResource('tnotebook_close_tab',Window,
NoteBookCloseBtnPixmapImg,NoteBookCloseBtnPixmapMask);
end;
Img:=NoteBookCloseBtnPixmapImg;
Mask:=NoteBookCloseBtnPixmapMask;
end;
{$Else}
procedure GetNoteBookCloseBtnImage(var Img: PGdkPixbuf);
begin
if (NoteBookCloseBtnPixbuf=nil) then
LoadPixbufFromLazResource('tnotebook_close_tab', NoteBookCloseBtnPixbuf);
Img:=NoteBookCloseBtnPixbuf;
end;
{$EndIF}
{-------------------------------------------------------------------------------
method UpdateNotebookPageTab
Params: ANoteBook: TCustomNotebook; APage: TCustomPage
Result: none
Updates the tab of a page of a notebook. This contains the image to the left
side, the label, the close button, the menu image and the menu label.
-------------------------------------------------------------------------------}
procedure UpdateNotebookPageTab(ANoteBook, APage: TObject);
var
TheNoteBook: TCustomNotebook;
ThePage: TCustomPage;
NoteBookWidget: PGtkWidget; // the notebook
PageWidget: PGtkWidget; // the page (content widget)
TabWidget: PGtkWidget; // the tab (hbox containing a pixmap, a label
// and a close button)
TabImageWidget: PGtkWidget; // the icon widget in the tab (a fixed widget)
TabLabelWidget: PGtkWidget; // the label in the tab
TabCloseBtnWidget: PGtkWidget;// the close button in the tab
TabCloseBtnImageWidget: PGtkWidget; // the pixmap in the close button
MenuWidget: PGtkWidget; // the popup menu (hbox containing a pixmap and
// a label)
MenuImageWidget: PGtkWidget; // the icon widget in the popup menu item (a fixed widget)
MenuLabelWidget: PGtkWidget; // the label in the popup menu item
procedure UpdateTabImage;
var
HasIcon: Boolean;
IconSize: TPoint;
begin
HasIcon:=false;
IconSize:=Point(0,0);
if (TheNoteBook.Images<>nil)
and (ThePage.ImageIndex>=0)
and (ThePage.ImageIndex<TheNoteBook.Images.Count) then begin
// page has valid image
IconSize:=Point(TheNoteBook.Images.Width,TheNoteBook.Images.Height);
HasIcon:=(IconSize.X>0) and (IconSize.Y>0);
end;
if HasIcon then begin
// page has an image
if TabImageWidget<>nil then begin
// there is already an icon widget for the image in the tab
// -> resize the icon widget
gtk_widget_set_usize(TabImageWidget,IconSize.X,IconSize.Y);
end else begin
// there is no pixmap for the image in the tab
// -> insert one ot the left side of the label
TabImageWidget:= gtk_label_new(#0);
g_signal_connect(PgtkObject(TabImageWidget), 'expose_event',
TGTKSignalFunc(@PageIconWidgetExposeAfter), ThePage);
{$IFNDEF GTK2}
g_signal_connect(PgtkObject(TabImageWidget), 'draw',
TGTKSignalFunc(@PageIconWidgetDrawAfter), ThePage);
{$ENDIF}
gtk_object_set_data(PGtkObject(TabWidget),'TabImage',TabImageWidget);
gtk_widget_set_usize(TabImageWidget,IconSize.X,IconSize.Y);
gtk_widget_show(TabImageWidget);
gtk_box_pack_start_defaults(PGtkBox(TabWidget),TabImageWidget);
gtk_box_reorder_child(PGtkBox(TabWidget),TabImageWidget,0);
end;
if MenuImageWidget<>nil then begin
// there is already an icon widget for the image in the menu
// -> resize the icon widget
gtk_widget_set_usize(MenuImageWidget,IconSize.X,IconSize.Y);
end else begin
// there is no icon widget for the image in the menu
// -> insert one at the left side of the label
MenuImageWidget:=gtk_label_new(#0);
g_signal_connect_after(PgtkObject(MenuImageWidget), 'expose_event',
TGTKSignalFunc(@PageIconWidgetExposeAfter), ThePage);
{$IFNDEF GTK2}
g_signal_connect_after(PgtkObject(MenuImageWidget), 'draw',
TGTKSignalFunc(@PageIconWidgetDrawAfter), ThePage);
{$ENDIF}
gtk_widget_set_usize(MenuImageWidget,IconSize.X,IconSize.Y);
gtk_object_set_data(PGtkObject(MenuWidget),'TabImage',MenuImageWidget);
gtk_widget_show(MenuImageWidget);
gtk_box_pack_start_defaults(PGtkBox(MenuWidget),MenuImageWidget);
gtk_box_reorder_child(PGtkBox(MenuWidget),MenuImageWidget,0);
end;
end else begin
// page does not have an image
if TabImageWidget<>nil then begin
// there is a pixmap for an old image in the tab
// -> remove the icon widget
DestroyWidget(TabImageWidget);
gtk_object_set_data(PGtkObject(TabWidget), 'TabImage', nil);
TabImageWidget:=nil;
end;
if MenuImageWidget<>nil then begin
// there is a pixmap for an old image in the menu
// -> remove the icon widget
DestroyWidget(MenuImageWidget);
gtk_object_set_data(PGtkObject(MenuWidget), 'TabImage', nil);
MenuImageWidget:=nil;
end;
end;
end;
procedure UpdateTabLabel;
var TheCaption: PChar;
begin
TheCaption:=PChar(ThePage.Caption);
if TheCaption=nil then
TheCaption:=#0;
gtk_label_set_text(PGtkLabel(TabLabelWidget),TheCaption);
if MenuLabelWidget<>nil then
gtk_label_set_text(PGtkLabel(MenuLabelWidget),TheCaption);
end;
procedure UpdateTabCloseBtn;
var
{$IfDef GTK1}
Img: PGdkPixmap;
Mask: PGdkBitmap;
{$Else}
Img: PGdkPixbuf;
{$EndIf}
begin
{$IfDef GTK1}
//debugln('UpdateTabCloseBtn ',GetWidgetDebugReport(NoteBookWidget));
GetNoteBookCloseBtnImage(GetControlWindow(NoteBookWidget),Img,Mask);
{$Else}
GetNoteBookCloseBtnImage(Img);
{$EndIf}
//debugln('UpdateTabCloseBtn ',dbgs(nboShowCloseButtons in TheNotebook.Options),' ',dbgs(Img<>nil));
if (nboShowCloseButtons in TheNotebook.Options) and (Img<>nil) then begin
// close buttons enabled
if TabCloseBtnWidget=nil then begin
// there is no close button yet
// -> add one to the right side of the label in the tab
TabCloseBtnWidget:=gtk_button_new;
gtk_object_set_data(PGtkObject(TabWidget), 'TabCloseBtn',
TabCloseBtnWidget);
begin
// put a pixmap into the button
{$IfDef GTK1}
TabCloseBtnImageWidget:=gtk_pixmap_new(Img,Mask);
{$Else}
TabCloseBtnImageWidget:=gtk_image_new_from_pixbuf(Img);
{$EndIf}
gtk_object_set_data(PGtkObject(TabCloseBtnWidget),'TabCloseBtnImage',
TabCloseBtnImageWidget);
gtk_widget_show(TabCloseBtnImageWidget);
gtk_container_add(PGtkContainer(TabCloseBtnWidget),
TabCloseBtnImageWidget);
end;
gtk_widget_show(TabCloseBtnWidget);
g_signal_connect(PGtkObject(TabCloseBtnWidget), 'clicked',
TGTKSignalFunc(@gtkNoteBookCloseBtnClicked), APage);
gtk_box_pack_start_defaults(PGtkBox(TabWidget),TabCloseBtnWidget);
end;
end else begin
// close buttons disabled
if TabCloseBtnWidget<>nil then begin
// there is a close button
// -> remove it
gtk_object_set_data(PGtkObject(TabWidget), 'TabCloseBtn',
nil);
DestroyWidget(TabCloseBtnWidget);
TabCloseBtnWidget:=nil;
end;
end;
end;
begin
ThePage:=TCustomPage(APage);
TheNoteBook:=TCustomNotebook(ANoteBook);
if (APage=nil) or (not ThePage.HandleAllocated) then exit;
if TheNoteBook=nil then begin
TheNoteBook:=TCustomNotebook(ThePage.Parent);
if TheNoteBook=nil then exit;
end;
NoteBookWidget:=PGtkWidget(TWinControl(TheNoteBook).Handle);
PageWidget:=PGtkWidget(TWinControl(ThePage).Handle);
// get the tab container and the tab components: pixmap, label and closebtn
TabWidget:=gtk_notebook_get_tab_label(PGtkNoteBook(NotebookWidget),
PageWidget);
if TabWidget<>nil then begin
TabImageWidget:=gtk_object_get_data(PGtkObject(TabWidget), 'TabImage');
TabLabelWidget:=gtk_object_get_data(PGtkObject(TabWidget), 'TabLabel');
TabCloseBtnWidget:=gtk_object_get_data(PGtkObject(TabWidget),'TabCloseBtn');
end else begin
TabImageWidget:=nil;
TabLabelWidget:=nil;
TabCloseBtnWidget:=nil;
end;
// get the menu container and its components: pixmap and label
MenuWidget:=gtk_notebook_get_menu_label(PGtkNoteBook(NotebookWidget),
PageWidget);
if MenuWidget<>nil then begin
MenuImageWidget:=gtk_object_get_data(PGtkObject(MenuWidget), 'TabImage');
MenuLabelWidget:=gtk_object_get_data(PGtkObject(MenuWidget), 'TabLabel');
end else begin
MenuImageWidget:=nil;
MenuLabelWidget:=nil;
end;
UpdateTabImage;
UpdateTabLabel;
UpdateTabCloseBtn;
end;
{-------------------------------------------------------------------------------
GetWidgetScreenPos
@ -7365,6 +7628,9 @@ end;
{ =============================================================================
$Log$
Revision 1.313 2004/10/15 12:04:09 mattias
calling updating notebook tab after realize, needed for close btns
Revision 1.312 2004/09/30 10:35:50 mazen
* Fix compile probelem under GTK2 related to
THandle <--> Pointer conversion

View File

@ -433,6 +433,8 @@ procedure SetGtkNoteBookDummyPage(ANoteBookWidget: PGtkNoteBook;
DummyWidget: PGtkWidget);
procedure UpdateNoteBookClientWidget(ANoteBook: TObject);
function GetGtkNoteBookPageCount(ANoteBookWidget: PGtkNoteBook): integer;
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
procedure UpdateNotebookPageTab(ANoteBook, APage: TObject);
// coordinate transformation
function GetWidgetOrigin(TheWidget: PGtkWidget): TPoint;

View File

@ -211,269 +211,8 @@ type
public
end;
implementation
var
{$IFDef GTK1}
NoteBookCloseBtnPixmapImg: PGdkPixmap {$ifndef VER1_0} = nil {$endif};
NoteBookCloseBtnPixmapMask: PGdkPixmap {$ifndef VER1_0} = nil {$endif};
{$Else}
NoteBookCloseBtnPixbuf: PGdkPixbuf {$ifndef VER1_0} = nil {$endif};
{$EndIf}
{-------------------------------------------------------------------------------
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
Removes the dummy page.
See also AddDummyNoteBookPage
-------------------------------------------------------------------------------}
procedure RemoveDummyNoteBookPage(NoteBookWidget: PGtkNotebook);
var
DummyWidget: PGtkWidget;
begin
DummyWidget:=GetGtkNoteBookDummyPage(NoteBookWidget);
if DummyWidget=nil then exit;
gtk_notebook_remove_page(NoteBookWidget,
gtk_notebook_page_num(NoteBookWidget,DummyWidget));
DummyWidget:=nil;
SetGtkNoteBookDummyPage(NoteBookWidget,DummyWidget);
end;
{-------------------------------------------------------------------------------
method GetNoteBookCloseBtnImage
Params:
Result: none
Loads the image for the close button in the tabs of the TCustomNoteBook(s).
-------------------------------------------------------------------------------}
{$IfDef GTK1}
procedure GetNoteBookCloseBtnImage(Window: PGdkWindow;
var Img, Mask: PGdkPixmap);
begin
if (NoteBookCloseBtnPixmapImg=nil)
and (Window<>nil) then begin
LoadXPMFromLazResource('tnotebook_close_tab',Window,
NoteBookCloseBtnPixmapImg,NoteBookCloseBtnPixmapMask);
end;
Img:=NoteBookCloseBtnPixmapImg;
Mask:=NoteBookCloseBtnPixmapMask;
end;
{$Else}
procedure GetNoteBookCloseBtnImage(var Img: PGdkPixbuf);
begin
if (NoteBookCloseBtnPixbuf=nil) then
LoadPixbufFromLazResource('tnotebook_close_tab', NoteBookCloseBtnPixbuf);
Img:=NoteBookCloseBtnPixbuf;
end;
{$EndIF}
{-------------------------------------------------------------------------------
method UpdateNotebookPageTab
Params: ANoteBook: TCustomNotebook; APage: TCustomPage
Result: none
Updates the tab of a page of a notebook. This contains the image to the left
side, the label, the close button, the menu image and the menu label.
-------------------------------------------------------------------------------}
procedure UpdateNotebookPageTab(ANoteBook, APage: TObject);
var
TheNoteBook: TCustomNotebook;
ThePage: TCustomPage;
NoteBookWidget: PGtkWidget; // the notebook
PageWidget: PGtkWidget; // the page (content widget)
TabWidget: PGtkWidget; // the tab (hbox containing a pixmap, a label
// and a close button)
TabImageWidget: PGtkWidget; // the icon widget in the tab (a fixed widget)
TabLabelWidget: PGtkWidget; // the label in the tab
TabCloseBtnWidget: PGtkWidget;// the close button in the tab
TabCloseBtnImageWidget: PGtkWidget; // the pixmap in the close button
MenuWidget: PGtkWidget; // the popup menu (hbox containing a pixmap and
// a label)
MenuImageWidget: PGtkWidget; // the icon widget in the popup menu item (a fixed widget)
MenuLabelWidget: PGtkWidget; // the label in the popup menu item
procedure UpdateTabImage;
var
HasIcon: Boolean;
IconSize: TPoint;
begin
HasIcon:=false;
IconSize:=Point(0,0);
if (TheNoteBook.Images<>nil)
and (ThePage.ImageIndex>=0)
and (ThePage.ImageIndex<TheNoteBook.Images.Count) then begin
// page has valid image
IconSize:=Point(TheNoteBook.Images.Width,TheNoteBook.Images.Height);
HasIcon:=(IconSize.X>0) and (IconSize.Y>0);
end;
if HasIcon then begin
// page has an image
if TabImageWidget<>nil then begin
// there is already an icon widget for the image in the tab
// -> resize the icon widget
gtk_widget_set_usize(TabImageWidget,IconSize.X,IconSize.Y);
end else begin
// there is no pixmap for the image in the tab
// -> insert one ot the left side of the label
TabImageWidget:= gtk_label_new(#0);
g_signal_connect(PgtkObject(TabImageWidget), 'expose_event',
TGTKSignalFunc(@PageIconWidgetExposeAfter), ThePage);
{$IFNDEF GTK2}
g_signal_connect(PgtkObject(TabImageWidget), 'draw',
TGTKSignalFunc(@PageIconWidgetDrawAfter), ThePage);
{$ENDIF}
gtk_object_set_data(PGtkObject(TabWidget),'TabImage',TabImageWidget);
gtk_widget_set_usize(TabImageWidget,IconSize.X,IconSize.Y);
gtk_widget_show(TabImageWidget);
gtk_box_pack_start_defaults(PGtkBox(TabWidget),TabImageWidget);
gtk_box_reorder_child(PGtkBox(TabWidget),TabImageWidget,0);
end;
if MenuImageWidget<>nil then begin
// there is already an icon widget for the image in the menu
// -> resize the icon widget
gtk_widget_set_usize(MenuImageWidget,IconSize.X,IconSize.Y);
end else begin
// there is no icon widget for the image in the menu
// -> insert one at the left side of the label
MenuImageWidget:=gtk_label_new(#0);
g_signal_connect_after(PgtkObject(MenuImageWidget), 'expose_event',
TGTKSignalFunc(@PageIconWidgetExposeAfter), ThePage);
{$IFNDEF GTK2}
g_signal_connect_after(PgtkObject(MenuImageWidget), 'draw',
TGTKSignalFunc(@PageIconWidgetDrawAfter), ThePage);
{$ENDIF}
gtk_widget_set_usize(MenuImageWidget,IconSize.X,IconSize.Y);
gtk_object_set_data(PGtkObject(MenuWidget),'TabImage',MenuImageWidget);
gtk_widget_show(MenuImageWidget);
gtk_box_pack_start_defaults(PGtkBox(MenuWidget),MenuImageWidget);
gtk_box_reorder_child(PGtkBox(MenuWidget),MenuImageWidget,0);
end;
end else begin
// page does not have an image
if TabImageWidget<>nil then begin
// there is a pixmap for an old image in the tab
// -> remove the icon widget
DestroyWidget(TabImageWidget);
gtk_object_set_data(PGtkObject(TabWidget), 'TabImage', nil);
TabImageWidget:=nil;
end;
if MenuImageWidget<>nil then begin
// there is a pixmap for an old image in the menu
// -> remove the icon widget
DestroyWidget(MenuImageWidget);
gtk_object_set_data(PGtkObject(MenuWidget), 'TabImage', nil);
MenuImageWidget:=nil;
end;
end;
end;
procedure UpdateTabLabel;
var TheCaption: PChar;
begin
TheCaption:=PChar(ThePage.Caption);
if TheCaption=nil then
TheCaption:=#0;
gtk_label_set_text(PGtkLabel(TabLabelWidget),TheCaption);
if MenuLabelWidget<>nil then
gtk_label_set_text(PGtkLabel(MenuLabelWidget),TheCaption);
end;
procedure UpdateTabCloseBtn;
var
{$IfDef GTK1}
Img: PGdkPixmap;
Mask: PGdkBitmap;
{$Else}
Img: PGdkPixbuf;
{$EndIf}
begin
{$IfDef GTK1}
GetNoteBookCloseBtnImage(GetControlWindow(NoteBookWidget),Img,Mask);
{$Else}
GetNoteBookCloseBtnImage(Img);
{$EndIf}
if (nboShowCloseButtons in TheNotebook.Options) and (Img<>nil) then begin
// close buttons enabled
if TabCloseBtnWidget=nil then begin
// there is no close button yet
// -> add one to the right side of the label in the tab
TabCloseBtnWidget:=gtk_button_new;
gtk_object_set_data(PGtkObject(TabWidget), 'TabCloseBtn',
TabCloseBtnWidget);
begin
// put a pixmap into the button
{$IfDef GTK1}
TabCloseBtnImageWidget:=gtk_pixmap_new(Img,Mask);
{$Else}
TabCloseBtnImageWidget:=gtk_image_new_from_pixbuf(Img);
{$EndIf}
gtk_object_set_data(PGtkObject(TabCloseBtnWidget),'TabCloseBtnImage',
TabCloseBtnImageWidget);
gtk_widget_show(TabCloseBtnImageWidget);
gtk_container_add(PGtkContainer(TabCloseBtnWidget),
TabCloseBtnImageWidget);
end;
gtk_widget_show(TabCloseBtnWidget);
g_signal_connect(PGtkObject(TabCloseBtnWidget), 'clicked',
TGTKSignalFunc(@gtkNoteBookCloseBtnClicked), APage);
gtk_box_pack_start_defaults(PGtkBox(TabWidget),TabCloseBtnWidget);
end;
end else begin
// close buttons disabled
if TabCloseBtnWidget<>nil then begin
// there is a close button
// -> remove it
gtk_object_set_data(PGtkObject(TabWidget), 'TabCloseBtn',
nil);
DestroyWidget(TabCloseBtnWidget);
TabCloseBtnWidget:=nil;
end;
end;
end;
begin
ThePage:=TCustomPage(APage);
TheNoteBook:=TCustomNotebook(ANoteBook);
if (APage=nil) or (not ThePage.HandleAllocated) then exit;
if TheNoteBook=nil then begin
TheNoteBook:=TCustomNotebook(ThePage.Parent);
if TheNoteBook=nil then exit;
end;
NoteBookWidget:=PGtkWidget(TWinControl(TheNoteBook).Handle);
PageWidget:=PGtkWidget(TWinControl(ThePage).Handle);
// get the tab container and the tab components: pixmap, label and closebtn
TabWidget:=gtk_notebook_get_tab_label(PGtkNoteBook(NotebookWidget),
PageWidget);
if TabWidget<>nil then begin
TabImageWidget:=gtk_object_get_data(PGtkObject(TabWidget), 'TabImage');
TabLabelWidget:=gtk_object_get_data(PGtkObject(TabWidget), 'TabLabel');
TabCloseBtnWidget:=gtk_object_get_data(PGtkObject(TabWidget),'TabCloseBtn');
end else begin
TabImageWidget:=nil;
TabLabelWidget:=nil;
TabCloseBtnWidget:=nil;
end;
// get the menu container and its components: pixmap and label
MenuWidget:=gtk_notebook_get_menu_label(PGtkNoteBook(NotebookWidget),
PageWidget);
if MenuWidget<>nil then begin
MenuImageWidget:=gtk_object_get_data(PGtkObject(MenuWidget), 'TabImage');
MenuLabelWidget:=gtk_object_get_data(PGtkObject(MenuWidget), 'TabLabel');
end else begin
MenuImageWidget:=nil;
MenuLabelWidget:=nil;
end;
UpdateTabImage;
UpdateTabLabel;
UpdateTabCloseBtn;
end;
{ TGtkWSCustomPage }
procedure TGtkWSCustomPage.UpdateProperties(const ACustomPage: TCustomPage);

View File

@ -85,7 +85,7 @@ type
class procedure DestroyHandle(const AWinControl: TWinControl); virtual;
class procedure Invalidate(const AWinControl: TWinControl); virtual;
class procedure ShowHide(const AWinControl: TWinControl); virtual;
end;
end;
TWSWinControlClass = class of TWSWinControl;
{ TWSGraphicControl }