mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-30 17:07:22 +01:00
DocEditor: improve the Enabled-state of some actions
git-svn-id: trunk@38067 -
This commit is contained in:
parent
d8c4a67f36
commit
e57bce7f59
@ -7,7 +7,7 @@ object MainForm: TMainForm
|
|||||||
VertScrollBar.Page = 523
|
VertScrollBar.Page = 523
|
||||||
ActiveControl = Splitter1
|
ActiveControl = Splitter1
|
||||||
Caption = 'MainForm'
|
Caption = 'MainForm'
|
||||||
ClientHeight = 523
|
ClientHeight = 517
|
||||||
ClientWidth = 602
|
ClientWidth = 602
|
||||||
Menu = MMain
|
Menu = MMain
|
||||||
OnCloseQuery = MainFormCloseQuery
|
OnCloseQuery = MainFormCloseQuery
|
||||||
@ -130,20 +130,20 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object StatusBar1: TStatusBar
|
object StatusBar1: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 20
|
Height = 22
|
||||||
Top = 503
|
Top = 495
|
||||||
Width = 602
|
Width = 602
|
||||||
Panels = <>
|
Panels = <>
|
||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 473
|
Height = 465
|
||||||
Top = 30
|
Top = 30
|
||||||
Width = 5
|
Width = 5
|
||||||
end
|
end
|
||||||
object PCFiles: TPageControl
|
object PCFiles: TPageControl
|
||||||
Left = 5
|
Left = 5
|
||||||
Height = 473
|
Height = 465
|
||||||
Top = 30
|
Top = 30
|
||||||
Width = 597
|
Width = 597
|
||||||
Align = alClient
|
Align = alClient
|
||||||
@ -1157,7 +1157,7 @@ object MainForm: TMainForm
|
|||||||
Hint = 'Insert a new module'
|
Hint = 'Insert a new module'
|
||||||
ImageIndex = 4
|
ImageIndex = 4
|
||||||
OnExecute = InsertStructure
|
OnExecute = InsertStructure
|
||||||
OnUpdate = HaveEditor
|
OnUpdate = HaveEditorAndPackage
|
||||||
end
|
end
|
||||||
object AInsertElement: TAction
|
object AInsertElement: TAction
|
||||||
Tag = 3
|
Tag = 3
|
||||||
@ -1166,7 +1166,7 @@ object MainForm: TMainForm
|
|||||||
Hint = 'Insert a new element'
|
Hint = 'Insert a new element'
|
||||||
ImageIndex = 6
|
ImageIndex = 6
|
||||||
OnExecute = InsertStructure
|
OnExecute = InsertStructure
|
||||||
OnUpdate = HaveEditor
|
OnUpdate = HaveEditorAndModule
|
||||||
end
|
end
|
||||||
object AInsertTopic: TAction
|
object AInsertTopic: TAction
|
||||||
Tag = 4
|
Tag = 4
|
||||||
@ -1175,7 +1175,7 @@ object MainForm: TMainForm
|
|||||||
Hint = 'Insert a new topic'
|
Hint = 'Insert a new topic'
|
||||||
ImageIndex = 5
|
ImageIndex = 5
|
||||||
OnExecute = InsertStructure
|
OnExecute = InsertStructure
|
||||||
OnUpdate = HaveEditor
|
OnUpdate = HaveEditorAndTopicOrSomething
|
||||||
end
|
end
|
||||||
object AInsertLink: TAction
|
object AInsertLink: TAction
|
||||||
Category = 'Insert'
|
Category = 'Insert'
|
||||||
|
|||||||
@ -163,6 +163,9 @@ type
|
|||||||
procedure ASaveExecute(Sender: TObject);
|
procedure ASaveExecute(Sender: TObject);
|
||||||
procedure DoFormat(Sender: TObject);
|
procedure DoFormat(Sender: TObject);
|
||||||
procedure HaveEditor(Sender: TObject);
|
procedure HaveEditor(Sender: TObject);
|
||||||
|
procedure HaveEditorAndModule(Sender: TObject);
|
||||||
|
procedure HaveEditorAndPackage(Sender: TObject);
|
||||||
|
procedure HaveEditorAndTopicOrSomething(Sender: TObject);
|
||||||
procedure InsertStructure(Sender: TObject);
|
procedure InsertStructure(Sender: TObject);
|
||||||
procedure MainFormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure MainFormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure MainFormCreate(Sender: TObject);
|
procedure MainFormCreate(Sender: TObject);
|
||||||
@ -425,6 +428,26 @@ begin
|
|||||||
(Sender as TAction).Enabled:=(CurrentEditor <> nil);
|
(Sender as TAction).Enabled:=(CurrentEditor <> nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.HaveEditorAndModule(Sender: TObject);
|
||||||
|
begin
|
||||||
|
(Sender as TAction).Enabled:=(CurrentEditor <> nil) and
|
||||||
|
(Currenteditor.CurrentModule <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.HaveEditorAndPackage(Sender: TObject);
|
||||||
|
begin
|
||||||
|
(Sender as TAction).Enabled:=(CurrentEditor <> nil) and
|
||||||
|
(Currenteditor.CurrentPackage <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.HaveEditorAndTopicOrSomething(Sender: TObject);
|
||||||
|
begin
|
||||||
|
(Sender as TAction).Enabled:=(CurrentEditor <> nil) and
|
||||||
|
( (Currenteditor.CurrentTopic <> nil)
|
||||||
|
or (Currenteditor.CurrentModule <> nil)
|
||||||
|
or (Currenteditor.CurrentPackage <> nil) );
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.InsertStructure(Sender: TObject);
|
procedure TMainForm.InsertStructure(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
InsertNode(TNodeType((Sender as TAction).Tag));
|
InsertNode(TNodeType((Sender as TAction).Tag));
|
||||||
|
|||||||
@ -470,9 +470,7 @@ begin
|
|||||||
if (CurrentTopic<>Nil) then
|
if (CurrentTopic<>Nil) then
|
||||||
begin
|
begin
|
||||||
M:=CurrentTopic.ParentNode as TDomElement;
|
M:=CurrentTopic.ParentNode as TDomElement;
|
||||||
If M.NodeName='module' then
|
If (M.NodeName='module') or (M.NodeName='topic') then
|
||||||
P:=M
|
|
||||||
else if M.NodeName='topic' then
|
|
||||||
P:=M
|
P:=M
|
||||||
else
|
else
|
||||||
P:=CurrentTopic;
|
P:=CurrentTopic;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user