mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 10:19:13 +02:00
MG: added project bookmark support
git-svn-id: trunk@302 -
This commit is contained in:
parent
9df86b0fa9
commit
8bdc13024b
43
ide/main.pp
43
ide/main.pp
@ -1985,7 +1985,7 @@ end;
|
|||||||
function TMainIDE.DoOpenEditorFile(AFileName:string;
|
function TMainIDE.DoOpenEditorFile(AFileName:string;
|
||||||
ProjectLoading:boolean):TModalResult;
|
ProjectLoading:boolean):TModalResult;
|
||||||
var Ext,ACaption,AText:string;
|
var Ext,ACaption,AText:string;
|
||||||
i,ProgramNameStart,ProgramNameEnd:integer;
|
i,BookmarkID,ProgramNameStart,ProgramNameEnd:integer;
|
||||||
ReOpen:boolean;
|
ReOpen:boolean;
|
||||||
NewUnitInfo:TUnitInfo;
|
NewUnitInfo:TUnitInfo;
|
||||||
NewPageName, NewLFMFilename, NewProgramName, NewSource: string;
|
NewPageName, NewLFMFilename, NewProgramName, NewSource: string;
|
||||||
@ -2035,7 +2035,7 @@ writeln('TMainIDE.DoOpenEditorFile "',AFilename,'"');
|
|||||||
if FileExists(ChangeFileExt(AFilename,'.lpi')) then begin
|
if FileExists(ChangeFileExt(AFilename,'.lpi')) then begin
|
||||||
AText:='The file "'+AFilename+'"'
|
AText:='The file "'+AFilename+'"'
|
||||||
+' seems to be the program file of an existing lazarus project.'
|
+' seems to be the program file of an existing lazarus project.'
|
||||||
+' Open project?';
|
+' Open project? Cancel will load the source.';
|
||||||
ACaption:='Project info file detected';
|
ACaption:='Project info file detected';
|
||||||
if Application.MessageBox(PChar(AText),PChar(ACaption)
|
if Application.MessageBox(PChar(AText),PChar(ACaption)
|
||||||
,MB_OKCANCEL)=mrOk then begin
|
,MB_OKCANCEL)=mrOk then begin
|
||||||
@ -2045,7 +2045,8 @@ writeln('TMainIDE.DoOpenEditorFile "',AFilename,'"');
|
|||||||
end else begin
|
end else begin
|
||||||
AText:='The file "'+AFilename+'"'
|
AText:='The file "'+AFilename+'"'
|
||||||
+' seems to be a program. Close current project'
|
+' seems to be a program. Close current project'
|
||||||
+' and create a new lazarus project for this program?';
|
+' and create a new lazarus project for this program?'
|
||||||
|
+' Cancel will load the source.';
|
||||||
ACaption:='Program detected';
|
ACaption:='Program detected';
|
||||||
if Application.MessageBox(PChar(AText),PChar(ACaption)
|
if Application.MessageBox(PChar(AText),PChar(ACaption)
|
||||||
,MB_OKCANCEL)=mrOK then begin
|
,MB_OKCANCEL)=mrOK then begin
|
||||||
@ -2085,14 +2086,29 @@ writeln('TMainIDE.DoOpenEditorFile "',AFilename,'"');
|
|||||||
sl.Text:=NewUnitInfo.Source.Source;
|
sl.Text:=NewUnitInfo.Source.Source;
|
||||||
SourceNotebook.NewFile(NewPageName,sl);
|
SourceNotebook.NewFile(NewPageName,sl);
|
||||||
sl.Free;
|
sl.Free;
|
||||||
if not ProjectLoading then
|
|
||||||
Project.InsertEditorIndex(SourceNotebook.NoteBook.PageIndex);
|
|
||||||
NewUnitInfo.EditorIndex:=SourceNotebook.NoteBook.PageIndex;
|
|
||||||
NewSrcEdit:=SourceNotebook.GetActiveSE;
|
NewSrcEdit:=SourceNotebook.GetActiveSE;
|
||||||
|
if not ProjectLoading then
|
||||||
|
Project.InsertEditorIndex(SourceNotebook.NoteBook.PageIndex)
|
||||||
|
else begin
|
||||||
|
for BookmarkID:=0 to 9 do begin
|
||||||
|
i:=Project.Bookmarks.IndexOfID(BookmarkID);
|
||||||
|
if (i>=0) and (Project.Bookmarks[i].EditorIndex=NewUnitInfo.EditorIndex)
|
||||||
|
then begin
|
||||||
|
NewSrcEdit.EditorComponent.SetBookmark(BookmarkID,
|
||||||
|
Project.Bookmarks[i].CursorPos.X,Project.Bookmarks[i].CursorPos.Y);
|
||||||
|
while i>=0 do begin
|
||||||
|
Project.Bookmarks.Delete(i);
|
||||||
|
i:=Project.Bookmarks.IndexOfID(BookmarkID);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
NewUnitInfo.EditorIndex:=SourceNotebook.NoteBook.PageIndex;
|
||||||
NewSrcEdit.SyntaxHighlighterType:=NewUnitInfo.SyntaxHighlighter;
|
NewSrcEdit.SyntaxHighlighterType:=NewUnitInfo.SyntaxHighlighter;
|
||||||
NewSrcEdit.EditorComponent.CaretXY:=NewUnitInfo.CursorPos;
|
NewSrcEdit.EditorComponent.CaretXY:=NewUnitInfo.CursorPos;
|
||||||
NewSrcEdit.EditorComponent.TopLine:=NewUnitInfo.TopLine;
|
NewSrcEdit.EditorComponent.TopLine:=NewUnitInfo.TopLine;
|
||||||
NewSrcEdit.EditorComponent.LeftChar:=1;
|
NewSrcEdit.EditorComponent.LeftChar:=1;
|
||||||
|
|
||||||
NewUnitInfo.Loaded:=true;
|
NewUnitInfo.Loaded:=true;
|
||||||
// read form data
|
// read form data
|
||||||
if (NewUnitInfo.Unitname<>'') then begin
|
if (NewUnitInfo.Unitname<>'') then begin
|
||||||
@ -2366,7 +2382,7 @@ var MainUnitSrcEdit, ASrcEdit: TSourceEditor;
|
|||||||
MainUnitInfo, AnUnitInfo: TUnitInfo;
|
MainUnitInfo, AnUnitInfo: TUnitInfo;
|
||||||
SaveDialog: TSaveDialog;
|
SaveDialog: TSaveDialog;
|
||||||
NewFilename, NewProgramFilename, NewPageName, AText, ACaption, Ext: string;
|
NewFilename, NewProgramFilename, NewPageName, AText, ACaption, Ext: string;
|
||||||
i:integer;
|
i, BookmarkID, BookmarkX, BookmarkY :integer;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
if ToolStatus<>itNone then begin
|
if ToolStatus<>itNone then begin
|
||||||
@ -2402,6 +2418,7 @@ writeln('TMainIDE.DoSaveProject A');
|
|||||||
MainUnitInfo:=nil;
|
MainUnitInfo:=nil;
|
||||||
|
|
||||||
// save some information of the loaded files
|
// save some information of the loaded files
|
||||||
|
Project.Bookmarks.Clear;
|
||||||
for i:=0 to Project.UnitCount-1 do begin
|
for i:=0 to Project.UnitCount-1 do begin
|
||||||
AnUnitInfo:=Project.Units[i];
|
AnUnitInfo:=Project.Units[i];
|
||||||
if AnUnitInfo.Loaded then begin
|
if AnUnitInfo.Loaded then begin
|
||||||
@ -2409,6 +2426,13 @@ writeln('TMainIDE.DoSaveProject A');
|
|||||||
AnUnitInfo.EditorIndex);
|
AnUnitInfo.EditorIndex);
|
||||||
AnUnitInfo.TopLine:=ASrcEdit.EditorComponent.TopLine;
|
AnUnitInfo.TopLine:=ASrcEdit.EditorComponent.TopLine;
|
||||||
AnUnitInfo.CursorPos:=ASrcEdit.EditorComponent.CaretXY;
|
AnUnitInfo.CursorPos:=ASrcEdit.EditorComponent.CaretXY;
|
||||||
|
for BookmarkID:=0 to 9 do begin
|
||||||
|
if (ASrcEdit.EditorComponent.GetBookMark(BookmarkID,BookmarkX,BookmarkY))
|
||||||
|
and (Project.Bookmarks.IndexOfID(BookmarkID)<0) then begin
|
||||||
|
Project.Bookmarks.Add(TProjectBookmark.Create(BookmarkX,BookmarkX,
|
||||||
|
AnUnitInfo.EditorIndex,BookmarkID));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2616,9 +2640,7 @@ writeln('TMainIDE.DoOpenProjectFile A "'+AFileName+'"');
|
|||||||
Project.Modified:=false;
|
Project.Modified:=false;
|
||||||
EnvironmentOptions.LastSavedProjectFile:=Project.ProjectInfoFile;
|
EnvironmentOptions.LastSavedProjectFile:=Project.ProjectInfoFile;
|
||||||
EnvironmentOptions.Save(false);
|
EnvironmentOptions.Save(false);
|
||||||
|
|
||||||
writeln('TMainIDE.DoOpenProjectFile end ');
|
writeln('TMainIDE.DoOpenProjectFile end ');
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoCreateProjectForProgram(ProgramFilename
|
function TMainIDE.DoCreateProjectForProgram(ProgramFilename
|
||||||
@ -3463,6 +3485,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.104 2001/06/27 21:43:23 lazarus
|
||||||
|
MG: added project bookmark support
|
||||||
|
|
||||||
Revision 1.103 2001/06/26 00:08:35 lazarus
|
Revision 1.103 2001/06/26 00:08:35 lazarus
|
||||||
MG: added code for form icons from Rene E. Beszon
|
MG: added code for form icons from Rene E. Beszon
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ type
|
|||||||
fEditorIndex: integer;
|
fEditorIndex: integer;
|
||||||
fID: integer;
|
fID: integer;
|
||||||
public
|
public
|
||||||
|
constructor Create;
|
||||||
|
constructor Create(X,Y, AnEditorIndex, AnID: integer);
|
||||||
property CursorPos: TPoint read fCursorPos write fCursorPos;
|
property CursorPos: TPoint read fCursorPos write fCursorPos;
|
||||||
property EditorIndex: integer read fEditorIndex write fEditorIndex;
|
property EditorIndex: integer read fEditorIndex write fEditorIndex;
|
||||||
property ID:integer read fID write fID;
|
property ID:integer read fID write fID;
|
||||||
@ -312,9 +314,24 @@ end;
|
|||||||
|
|
||||||
{ TProjectBookmark }
|
{ TProjectBookmark }
|
||||||
|
|
||||||
|
constructor TProjectBookmark.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TProjectBookmark.Create(X,Y, AnEditorIndex, AnID: integer);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
fCursorPos.X:=X;
|
||||||
|
fCursorPos.Y:=Y;
|
||||||
|
fEditorIndex:=AnEditorIndex;
|
||||||
|
fID:=AnID;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectBookmark.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
procedure TProjectBookmark.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||||
Path: string);
|
Path: string);
|
||||||
begin
|
begin
|
||||||
|
XMLConfig.SetValue(Path+'ID',ID);
|
||||||
XMLConfig.SetValue(Path+'CursorPosX',CursorPos.X);
|
XMLConfig.SetValue(Path+'CursorPosX',CursorPos.X);
|
||||||
XMLConfig.SetValue(Path+'CursorPosY',CursorPos.Y);
|
XMLConfig.SetValue(Path+'CursorPosY',CursorPos.Y);
|
||||||
XMLConfig.SetValue(Path+'EditorIndex',EditorIndex);
|
XMLConfig.SetValue(Path+'EditorIndex',EditorIndex);
|
||||||
@ -323,6 +340,7 @@ end;
|
|||||||
procedure TProjectBookmark.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
procedure TProjectBookmark.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
||||||
Path: string);
|
Path: string);
|
||||||
begin
|
begin
|
||||||
|
ID:=XMLConfig.GetValue(Path+'ID',-1);
|
||||||
CursorPos.X:=XMLConfig.GetValue(Path+'CursorPosX',0);
|
CursorPos.X:=XMLConfig.GetValue(Path+'CursorPosX',0);
|
||||||
CursorPos.Y:=XMLConfig.GetValue(Path+'CursorPosY',0);
|
CursorPos.Y:=XMLConfig.GetValue(Path+'CursorPosY',0);
|
||||||
EditorIndex:=XMLConfig.GetValue(Path+'EditorIndex',-1);
|
EditorIndex:=XMLConfig.GetValue(Path+'EditorIndex',-1);
|
||||||
@ -1398,6 +1416,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.25 2001/06/27 21:43:23 lazarus
|
||||||
|
MG: added project bookmark support
|
||||||
|
|
||||||
Revision 1.24 2001/06/04 09:32:17 lazarus
|
Revision 1.24 2001/06/04 09:32:17 lazarus
|
||||||
MG: fixed bugs and cleaned up messages
|
MG: fixed bugs and cleaned up messages
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ type
|
|||||||
Procedure BookMarkToggle(Value : Integer);
|
Procedure BookMarkToggle(Value : Integer);
|
||||||
protected
|
protected
|
||||||
ccSelection : String;
|
ccSelection : String;
|
||||||
|
|
||||||
Function CreateNotebook : Boolean;
|
Function CreateNotebook : Boolean;
|
||||||
Function DisplayPage(SE : TSourceEditor) : Boolean;
|
Function DisplayPage(SE : TSourceEditor) : Boolean;
|
||||||
Function NewSE(Pagenum : Integer) : TSourceEditor;
|
Function NewSE(Pagenum : Integer) : TSourceEditor;
|
||||||
@ -1099,6 +1099,7 @@ writeln('TSourceEditor.CreateEditor FEditorName="',NewName,'"');
|
|||||||
Name:=NewName;
|
Name:=NewName;
|
||||||
Parent := AParent;
|
Parent := AParent;
|
||||||
Align := alClient;
|
Align := alClient;
|
||||||
|
BookMarkOptions.EnableKeys := false;
|
||||||
OnStatusChange := @EditorStatusChanged;
|
OnStatusChange := @EditorStatusChanged;
|
||||||
OnProcessUserCommand := @ProcessUserCommand;
|
OnProcessUserCommand := @ProcessUserCommand;
|
||||||
OnReplaceText := @OnReplace;
|
OnReplaceText := @OnReplace;
|
||||||
@ -2036,8 +2037,8 @@ Begin
|
|||||||
if TempEditor <> nil then TempEditor.FindAgain;
|
if TempEditor <> nil then TempEditor.FindAgain;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
Procedure TSourceNotebook.BookMarkClicked(Sender : TObject);
|
Procedure TSourceNotebook.BookMarkClicked(Sender : TObject);
|
||||||
|
// popup menu toggle bookmark clicked
|
||||||
var
|
var
|
||||||
MenuItem : TMenuItem;
|
MenuItem : TMenuItem;
|
||||||
Begin
|
Begin
|
||||||
@ -2046,6 +2047,7 @@ Begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.BookMarkGotoClicked(Sender : TObject);
|
Procedure TSourceNotebook.BookMarkGotoClicked(Sender : TObject);
|
||||||
|
// popup menu goto bookmark clicked
|
||||||
var
|
var
|
||||||
MenuItem : TMenuItem;
|
MenuItem : TMenuItem;
|
||||||
Begin
|
Begin
|
||||||
@ -2336,7 +2338,8 @@ begin
|
|||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceNotebook.FindPageWithEditor(ASourceEditor: TSourceEditor):integer;
|
function TSourceNotebook.FindPageWithEditor(
|
||||||
|
ASourceEditor: TSourceEditor):integer;
|
||||||
var i:integer;
|
var i:integer;
|
||||||
begin
|
begin
|
||||||
if Notebook=nil then begin
|
if Notebook=nil then begin
|
||||||
@ -2346,7 +2349,7 @@ begin
|
|||||||
while (Result>=0) do begin
|
while (Result>=0) do begin
|
||||||
with Notebook.Page[Result] do
|
with Notebook.Page[Result] do
|
||||||
for I := 0 to ControlCount-1 do
|
for I := 0 to ControlCount-1 do
|
||||||
if Controls[I]=TControl(ASourceEditor) then exit;
|
if Controls[I]=ASourceEditor.EditorComponent then exit;
|
||||||
dec(Result);
|
dec(Result);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2391,7 +2394,7 @@ begin
|
|||||||
|
|
||||||
ecJumpToEditor :
|
ecJumpToEditor :
|
||||||
Begin
|
Begin
|
||||||
//This is NOT implemented yet
|
// This is NOT implemented yet
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2401,8 +2404,16 @@ begin
|
|||||||
|
|
||||||
ecToggleFormUnit:
|
ecToggleFormUnit:
|
||||||
ToggleFormUnitClicked(self);
|
ToggleFormUnitClicked(self);
|
||||||
|
|
||||||
|
ecGotoMarker0..ecGotoMarker9:
|
||||||
|
BookMarkGoto(Command - ecGotoMarker0);
|
||||||
|
|
||||||
|
ecSetMarker0..ecSetMarker9:
|
||||||
|
BookMarkToggle(Command - ecSetMarker0);
|
||||||
|
|
||||||
end; //case
|
end; //case
|
||||||
|
|
||||||
|
writeln('******* ',ecGotoMarker4,',',Command);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure TSourceNotebook.ReloadEditorOptions;
|
Procedure TSourceNotebook.ReloadEditorOptions;
|
||||||
|
@ -889,7 +889,6 @@ begin
|
|||||||
with Message do
|
with Message do
|
||||||
begin
|
begin
|
||||||
ShiftState := KeyDataToShiftState(KeyData);
|
ShiftState := KeyDataToShiftState(KeyData);
|
||||||
ShiftState := [];
|
|
||||||
if not (csNoStdEvents in ControlStyle)
|
if not (csNoStdEvents in ControlStyle)
|
||||||
then begin
|
then begin
|
||||||
KeyUp(CharCode, ShiftState);
|
KeyUp(CharCode, ShiftState);
|
||||||
@ -1960,6 +1959,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.34 2001/06/27 21:43:23 lazarus
|
||||||
|
MG: added project bookmark support
|
||||||
|
|
||||||
Revision 1.33 2001/06/15 10:31:06 lazarus
|
Revision 1.33 2001/06/15 10:31:06 lazarus
|
||||||
MG: set longstrings as default
|
MG: set longstrings as default
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user