mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Restore previous scroll position after saving routine, trigger, event or view. See https://www.heidisql.com/forum.php?t=40291
This commit is contained in:
@@ -14,7 +14,7 @@ uses
|
||||
System.Win.Registry, System.DateUtils, System.Generics.Collections, System.Contnrs, System.StrUtils, System.AnsiStrings, Winapi.TlHelp32, System.Types,
|
||||
dbconnection, dbstructures, dbstructures.mysql, SynMemo, Vcl.Menus, Winapi.WinInet, gnugettext, Vcl.Themes,
|
||||
System.Character, Vcl.ImgList, System.UITypes, Vcl.ActnList, Winapi.WinSock, System.IOUtils, Vcl.StdCtrls, Vcl.ComCtrls,
|
||||
Winapi.CommCtrl, Winapi.KnownFolders, SynUnicode;
|
||||
Winapi.CommCtrl, Winapi.KnownFolders, SynUnicode, SynEdit;
|
||||
|
||||
type
|
||||
|
||||
@@ -45,6 +45,8 @@ type
|
||||
FModified: Boolean;
|
||||
procedure SetModified(Value: Boolean);
|
||||
protected
|
||||
FMainSynMemo: TSynMemo; // Main editor in case of routine, view, trigger or event
|
||||
FMainSynMemoPreviousTopLine: Integer;
|
||||
function ObjectExists: Boolean;
|
||||
public
|
||||
DBObject: TDBObject;
|
||||
@@ -1883,6 +1885,8 @@ begin
|
||||
// Do not set alClient via DFM! In conjunction with ExplicitXXX properties that
|
||||
// repeatedly breaks the GUI layout when you reload the project
|
||||
Align := alClient;
|
||||
FMainSynMemo := nil;
|
||||
DBObject := nil;
|
||||
TranslateComponent(Self);
|
||||
end;
|
||||
|
||||
@@ -1908,10 +1912,16 @@ var
|
||||
popup: TPopupMenu;
|
||||
Item: TMenuItem;
|
||||
i: Integer;
|
||||
IsRefresh: Boolean;
|
||||
begin
|
||||
Mainform.ShowStatusMsg(_('Initializing editor ...'));
|
||||
Mainform.LogSQL(Self.ClassName+'.Init, using object "'+Obj.Name+'"', lcDebug);
|
||||
TExtForm.FixControls(Self);
|
||||
IsRefresh := Assigned(DBObject) and DBObject.IsSameAs(Obj);
|
||||
if IsRefresh and Assigned(FMainSynMemo) then
|
||||
FMainSynMemoPreviousTopLine := FMainSynMemo.TopLine
|
||||
else
|
||||
FMainSynMemoPreviousTopLine := 0;
|
||||
DBObject := TDBObject.Create(Obj.Connection);
|
||||
DBObject.Assign(Obj);
|
||||
Mainform.UpdateEditorTab;
|
||||
@@ -1976,6 +1986,7 @@ begin
|
||||
Result := mrOk;
|
||||
if Modified then begin
|
||||
ObjType := _(LowerCase(DBObject.ObjType));
|
||||
// Todo: no save button for objects without minimum requirements, such as name. See #1134
|
||||
if DBObject.Name <> '' then
|
||||
Msg := f_('Save modified %s "%s"?', [ObjType, DBObject.Name])
|
||||
else
|
||||
|
||||
@@ -80,6 +80,7 @@ begin
|
||||
comboEveryInterval.Items := Explode('|', 'YEAR|QUARTER|MONTH|DAY|HOUR|MINUTE|WEEK|SECOND|YEAR_MONTH|'+
|
||||
'DAY_HOUR|DAY_MINUTE|DAY_SECOND|HOUR_MINUTE|HOUR_SECOND|MINUTE_SECOND');
|
||||
grpState.Items := Explode('|', 'Enable|Disable|Disable on slave');
|
||||
FMainSynMemo := SynMemoBody;
|
||||
end;
|
||||
|
||||
|
||||
@@ -187,6 +188,7 @@ begin
|
||||
SynMemoBody.Text := rx.Match[1];
|
||||
|
||||
rx.Free;
|
||||
SynMemoBody.TopLine := FMainSynMemoPreviousTopLine;
|
||||
|
||||
end;
|
||||
radioScheduleClick(Self);
|
||||
|
||||
@@ -114,6 +114,7 @@ begin
|
||||
Mainform.SynCompletionProposal.AddEditor(SynMemoBody);
|
||||
Parameters := TRoutineParamList.Create;
|
||||
editName.MaxLength := NAME_LEN;
|
||||
FMainSynMemo := SynMemoBody;
|
||||
end;
|
||||
|
||||
|
||||
@@ -164,6 +165,7 @@ begin
|
||||
lblDisabledWhy.Visible := Obj.Body = '';
|
||||
PageControlMain.Enabled := not lblDisabledWhy.Visible;
|
||||
SynMemoBody.Enabled := PageControlMain.Enabled;
|
||||
SynMemoBody.TopLine := FMainSynMemoPreviousTopLine;
|
||||
end else begin
|
||||
editName.Text := '';
|
||||
end;
|
||||
|
||||
@@ -76,6 +76,7 @@ begin
|
||||
SynCompletionProposalStatement.Options := Mainform.SynCompletionProposal.Options;
|
||||
SynCompletionProposalStatement.TimerInterval := Mainform.SynCompletionProposal.TimerInterval;
|
||||
SynCompletionProposalStatement.Margin := Mainform.SynCompletionProposal.Margin;
|
||||
FMainSynMemo := SynMemoBody;
|
||||
end;
|
||||
|
||||
|
||||
@@ -140,6 +141,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
SynMemoBody.Text := Body;
|
||||
SynMemoBody.TopLine := FMainSynMemoPreviousTopLine;
|
||||
Found := True;
|
||||
break;
|
||||
end;
|
||||
|
||||
@@ -64,6 +64,7 @@ begin
|
||||
editName.MaxLength := NAME_LEN;
|
||||
comboSecurity.Items.Add('Definer');
|
||||
comboSecurity.Items.Add('Invoker');
|
||||
FMainSynMemo := SynMemoBody;
|
||||
end;
|
||||
|
||||
|
||||
@@ -103,6 +104,7 @@ begin
|
||||
rgAlgorithm.Enabled := editName.Enabled;
|
||||
rgCheck.Enabled := rgAlgorithm.Enabled;
|
||||
SynMemoBody.Enabled := rgAlgorithm.Enabled;
|
||||
SynMemoBody.TopLine := FMainSynMemoPreviousTopLine;
|
||||
end else begin
|
||||
// Create mode
|
||||
editName.Text := '';
|
||||
|
||||
Reference in New Issue
Block a user