I implemented a new feature: an Editor File Manager. It can be found as the first item in Windows menu. It becomes very useful when you have lots of files open. Please check out and give comments.
Juha

Mailing lists / lazarus / 2012-02
14 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
I implemented a new feature: an Editor File Manager. It can be found as the first item in Windows menu. It becomes very useful when you have lots of files open. Please check out and give comments.
Juha
Nice.
Sorting would be nice. By either file or full name. Often I know in which directory a file is, so if they were sorted....
Maybe multiply columns: folder / file / which window(s) / tab-index ...
Maybe allow to specify the sort order for the menu too.
Why is it modal?
I implemented a new feature: an Editor File Manager. It can be found as the first item in…
I implemented a new feature: an Editor File Manager. It can be found as the first item in Windows menu. It becomes very useful when you have lots of files open. Please check out and give comments.
Caption needs a resourcestring.
The file list needs scrollbars.
While loading IDEImages: Resource "laz_close" not found
Mattias
Why is it modal?
2012/2/17, Martin :
I am happy you answered, Martin. I wanted to ask you about saving files. If you look at the source, there is
SrcEdit: TSourceEditor;I can do
SrcEdit.Activate;which is very intuitive. I can also do:
SrcEdit.SourceNotebook.CloseFile(SrcEdit.PageIndex);which is ok, too. But I cannot do:
SrcEdit.Save;or anything similar.
So the question is how to save the files?
Sorting would be nice. By either file or full name. Often I know in which directory a file is, so if they were sorted....
Can be done.
Maybe multiply columns: folder / file / which window(s) / tab-index ...
It should use TListView then. It can be done but requires lots of changes. The checkboxes must be dumped and selections used instead. I don't have a FilterEdit control for TListView yet although it can be implemented. The filter is a very nice thing to have with any GUI container.
It means I will not implement columns very soon but maybe later, yes.
Maybe allow to specify the sort order for the menu too.
Do you mean changing the editor tab order from the manager window? I am planning to do it.
Maybe I have ask you again about how to do it best using the editor interface.
Why is it modal?
Because a modeless window would require lots of synchronizing between other parts of Lazarus. Editor windows can be opened, closed, renamed and modified in many ways.
If there is a good notification API for it, please tell me.
The manager window is very useful even when it is modal.
I took a similar challenge when I changed the TabOrder dialog from modal to modeless some time ago. It required lots of synchronization with the form designer. The notification mechanism was already there so it was not very hard after all.
Juha
SrcEditor is display, save etc, is done in main.pp.
You can always track back the UserCommandEvet (send by synedit to src edit for keypress, and src-edit to main)
procedure ProcessCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data:
pointer);
procedure ProcessUserCommand(Sender: TObject;
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data:
pointer);at the end of the 2nd:
TSourceNotebook(FaOwner).ProcessParentCommand(self,Command,aChar,Data,
Handled);
It either goes to
IDECmd:=IDECommandList.FindIDECommand(Command);
Otherwise there is
Manager.OnProcessUserCommand(Self,Command,Handled);
which is set in main.pp
SourceEditorManager.OnProcessUserCommand := @OnProcessIDECommand;in
procedure TMainIDE.OnProcessIDECommand(Sender: TObject;
Command: word; var Handled: boolean);
ecSave:
if (Sender is TDesigner) then begin
GetDesignerUnit(TDesigner(Sender),ASrcEdit,AnUnitInfo);
if (AnUnitInfonil) and (AnUnitInfo.OpenEditorInfoCount > 0) then
DoSaveEditorFile(ASrcEdit, [sfCheckAmbiguousFiles]);
end else if (Sender is TObjectInspectorDlg) then begin
GetObjectInspectorUnit(ASrcEdit,AnUnitInfo);
if (AnUnitInfonil) and (AnUnitInfo.OpenEditorInfoCount > 0) then
DoSaveEditorFile(ASrcEdit, [sfCheckAmbiguousFiles]);
end else if Sender is TSourceNotebook then
mnuSaveClicked(Self);---------------------------------
so much for theory
easiest is (EditorComponent is synedit)
SrcEdit.EditorComponent.CommandProcessor(ecSave, '', nil)
acts exactly like as if triggered by keys.
Selection is easier anyway IMHO.
If I want a single file (saved or closed), then checkbox is rather annoying.
I meant the order in the list (like click on column header (if there were any))
SrcEditor has some events, but probably not enough
TsemChangeReason = (
semWindowCreate, // Called after creation of a Window semWindowDestroy, // Called after removal of a Window semWindowActivate, // Window is now ActiveSourceWindow (does not vave to be focused)
semWindowFocused, // The window became the active win of the application
semEditorCreate,
semEditorDestroy,
semEditorActivate, // Editor is ActiveEditor
semEditorStatus // any status change of the editor (Caret, Selection, topline, ...)
);TSourceEditorManagerInterface (base class of SrcNotebook)
procedure RegisterChangeEvent(AReason: TsemChangeReason; AHandler:
TNotifyEvent); virtual; abstract;
procedure UnRegisterChangeEvent(AReason: TsemChangeReason;
AHandler: TNotifyEvent); virtual; abstract;semEditorStatus goes for EVERY keypress, so only fast handlers it has synedits modified flag, which equals saved/modified To avoid slow down, there should be a filtered wersion, for the desired flags only
- rename can probably be added
If there is a good notification API for it, please tell me.
On Fri, 17 Feb 2012 14:59:32 +0200 Caption needs a resourcestring. The file list needs…
2012/2/17, Mattias Gaertner :
Caption needs a resourcestring. The file list needs scrollbars. While loading IDEImages: Resource "laz_close" not found
I fixed the caption and image. A vertical scrollbar is there automatically. I didn't find a way to set a horizontal scrollbar in TChecklistBox.
Juha
SrcEdit.EditorComponent.CommandProcessor(ecSave, '', nil) did not really work, but this did:
LazarusIDE.DoSaveEditorFile(SrcEdit, [])
Selection is easier anyway IMHO. If I want a single file (saved or closed), then checkbox is rather annoying.
Now these 2 things are mixed. You can use a single selection to activate and close a file (there is a popup menu). But, you must use checkboxes for multiple file operations. I understand it could be done with selections, too.
Maybe I must rethink it...
Martin, one more question if you don't mind: How to change editor tab order? If you don't remember the answer by hart, I can study the code later and find out myself.
Thanks for all the info. I will look at it later.
Juha
2012/2/17, Juha Manninen :
procedure TSourceNotebook.MoveEditor(OldPageIndex, NewPageIndex: integer);If you allow sorting tabs, how do you display files, that are open in several windows?
Nice. Sorting would be nice. By either file or full name. Often I know in which directory…
+1
Maybe multiply columns: folder / file / which window(s) / tab-index ...
tab index / unit name + (filename without path)/ changed-not changed (can be just asterisk) / full path
+1
Maybe allow to specify the sort order for the menu too.
Sort order for the menu ?
zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120218/8723af20/attachment.html>
2012/2/17, Mattias Gaertner : I fixed the caption and image. A vertical scrollbar is…
Why don't you use TListView + Checkable ?
zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120218/0bc80960/attachment.html>
procedure TSourceNotebook.MoveEditor(OldPageIndex, NewPageIndex: integer); If you allow…
2012/2/17, Martin :
procedure TSourceNotebook.MoveEditor(OldPageIndex, NewPageIndex: integer);
TSourceNotebook.MoveEditor(...)
is protected, so I used:
TSourceNotebook.NotebookPages.Move(...)
If you allow sorting tabs, how do you display files, that are open in several windows?
Now it lists all windows in all editor windows and allows moving them inside the same window. If you try to move over the boundary, you get a "List index out bounds" error.
I will look at it later.
Zeljan, a future version will use TListView + Checkable. It may take some time though. I would like to implement the filter edit control for TListView at the same go.
Juha
That is dangerous, yuo must also do
UpdatePageNames;
UpdateProjectFiles;At least the 2nd is needed or changes do not go into the session (and maybe other problems...
But more so, yours is not future save....
Feel free to make MoveEditors public
(Note there is a version with window-index too. best keep them together)
General rule here is.
Things are added and kept none public, if not needed. Helps future refactoring.
If needed, then most methods can be made public
2012/2/19, Martin :
Feel free to make MoveEditors public (Note there is a version with window-index too. best keep them together)
Done.
The EditorFileManager behaves quite well now.
Juha