SourceEditor: Display stop button, while macro recording

git-svn-id: trunk@37719 -
This commit is contained in:
martin 2012-06-21 18:23:39 +00:00
parent d8a58b3abc
commit 2dfbcd88d3
2 changed files with 47 additions and 6 deletions

View File

@ -10,13 +10,17 @@ inherited SourceNotebook: TSourceNotebook
OnMouseUp = FormMouseUp
object StatusBar: TStatusBar[0]
Left = 0
Height = 22
Top = 278
Height = 23
Top = 277
Width = 400
Panels = <
item
Width = 100
end
item
Style = psOwnerDraw
Width = 0
end
item
Width = 150
end
@ -29,6 +33,8 @@ inherited SourceNotebook: TSourceNotebook
end>
SimpleText = 'This is a test'
SimplePanel = False
OnClick = StatusBarClick
OnDblClick = StatusBarDblClick
OnDrawPanel = StatusBarDrawPanel
end
end

View File

@ -568,7 +568,10 @@ type
StatusBar: TStatusBar;
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure StatusBarClick(Sender: TObject);
procedure StatusBarDblClick(Sender: TObject);
procedure StatusBarDrawPanel(AStatusBar: TStatusBar; APanel: TStatusPanel;
const ARect: TRect);
private
FNotebook: TExtendedNotebook;
FBaseCaption: String;
@ -621,6 +624,7 @@ type
FProcessingCommand: boolean;
FSourceEditorList: TList; // list of TSourceEditor
FHistoryList: TList; // list of TSourceEditor page order for when a window closes
FStopBtnIdx: Integer;
private
FUpdateTabAndPageTimer: TTimer;
// PopupMenu
@ -5252,6 +5256,8 @@ begin
CreateNotebook;
Application.AddOnUserInputHandler(@OnApplicationUserInput,true);
FStopBtnIdx := IDEImages.LoadImage(16, 'menu_stop');
end;
destructor TSourceNotebook.Destroy;
@ -6948,16 +6954,26 @@ end;
procedure TSourceNotebook.StatusBarDblClick(Sender: TObject);
var
P: TPoint;
i: Integer;
begin
P := StatusBar.ScreenToClient(Mouse.CursorPos);
i := StatusBar.GetPanelIndexAt(P.X, P.Y);
// if we clicked on first panel which shows position in code
if assigned(Manager) and (StatusBar.GetPanelIndexAt(P.X, P.Y) = 0) then
if assigned(Manager) and (i = 0) then
begin
// then show goto line dialog
Manager.GotoLineClicked(nil);
end;
end;
procedure TSourceNotebook.StatusBarDrawPanel(AStatusBar: TStatusBar; APanel: TStatusPanel;
const ARect: TRect);
begin
if APanel = StatusBar.Panels[1] then begin
IDEImages.Images_16.Draw(StatusBar.Canvas, ARect.Left, ARect.Top, FStopBtnIdx);
end;
end;
procedure TSourceNotebook.ToggleBreakpointClicked(Sender: TObject);
var
ASrcEdit: TSourceEditor;
@ -7139,6 +7155,18 @@ begin
Cursor:=crDefault;
end;
procedure TSourceNotebook.StatusBarClick(Sender: TObject);
var
P: TPoint;
i: Integer;
begin
P := StatusBar.ScreenToClient(Mouse.CursorPos);
i := StatusBar.GetPanelIndexAt(P.X, P.Y);
if (i = 1) then
Manager.MacroRecorder.Stop;
end;
procedure TSourceNotebook.ExecuteEditorItemClick(Sender: TObject);
var
Editor: TSourceEditor;
@ -7362,9 +7390,16 @@ begin
PanelCharMode := uepOvr;
Statusbar.Panels[0].Text := PanelXY;
StatusBar.Panels[1].Text := PanelFileMode;
Statusbar.Panels[2].Text := PanelCharMode;
Statusbar.Panels[3].Text := PanelFilename;
StatusBar.Panels[2].Text := PanelFileMode;
Statusbar.Panels[3].Text := PanelCharMode;
Statusbar.Panels[4].Text := PanelFilename;
if (Manager.MacroRecorder.State in [msRecording, msPaused]) and
(Manager.MacroRecorder.CurrentEditor = CurEditor)
then
Statusbar.Panels[1].Width := 20
else
Statusbar.Panels[1].Width := 0;
end;
Statusbar.EndUpdate;