Ide/EditorMacros: changed flag-names for internal/pseudo files

git-svn-id: trunk@38392 -
This commit is contained in:
martin 2012-08-26 16:09:17 +00:00
parent f6e9182888
commit c34825f8a2
4 changed files with 16 additions and 9 deletions

View File

@ -241,6 +241,9 @@ var
// SelectedEditorMacro: Selected, for playing with default shortcut // SelectedEditorMacro: Selected, for playing with default shortcut
SelectedEditorMacro: TEditorMacro = nil; SelectedEditorMacro: TEditorMacro = nil;
const
EditorMacroVirtualDrive = '//EMacro:/';
implementation implementation
var var
@ -1064,8 +1067,8 @@ begin
M := CurrentEditorMacroList.Macros[lbRecordedView.ItemIndex]; M := CurrentEditorMacroList.Macros[lbRecordedView.ItemIndex];
if M = nil then exit; if M = nil then exit;
LazarusIDE.DoOpenEditorFile( LazarusIDE.DoOpenEditorFile(
'//EMacro:/'+MacroListToName(CurrentEditorMacroList)+'/'+M.MacroName, EditorMacroVirtualDrive+MacroListToName(CurrentEditorMacroList)+'/'+M.MacroName,
-1, -1, [ofVirtualFile, ofEditorMacro]); -1, -1, [ofVirtualFile, ofInternalFile]);
end; end;
procedure TMacroListView.btnRecordClick(Sender: TObject); procedure TMacroListView.btnRecordClick(Sender: TObject);

View File

@ -8802,7 +8802,7 @@ begin
SrcNotebook := SourceEditorManager.SourceWindows[WindowIndex]; SrcNotebook := SourceEditorManager.SourceWindows[WindowIndex];
// get syntax highlighter type // get syntax highlighter type
if (uifEditorMacro in AnUnitInfo.Flags) then if (uifInternalFile in AnUnitInfo.Flags) then
AnUnitInfo.UpdateDefaultHighlighter(lshFreePascal) AnUnitInfo.UpdateDefaultHighlighter(lshFreePascal)
else else
AnUnitInfo.UpdateDefaultHighlighter(FilenameToLazSyntaxHighlighter(AFilename)); AnUnitInfo.UpdateDefaultHighlighter(FilenameToLazSyntaxHighlighter(AFilename));
@ -9311,7 +9311,9 @@ begin
if not (sfProjectSaving in Flags) then if not (sfProjectSaving in Flags) then
SaveSourceEditorChangesToCodeCache(nil); SaveSourceEditorChangesToCodeCache(nil);
if uifEditorMacro in AnUnitInfo.Flags then begin if (uifInternalFile in AnUnitInfo.Flags) and
(copy(AnUnitInfo.Filename, 1, length(EditorMacroVirtualDrive)) = EditorMacroVirtualDrive)
then begin
// save to macros // save to macros
EMacro := MacroListViewer.MacroByFullName(AnUnitInfo.Filename); EMacro := MacroListViewer.MacroByFullName(AnUnitInfo.Filename);
if EMacro <> nil then begin if EMacro <> nil then begin
@ -9726,7 +9728,7 @@ begin
UnitIndex:=Project1.IndexOfFilename(AFilename); UnitIndex:=Project1.IndexOfFilename(AFilename);
if (UnitIndex > 0) then begin if (UnitIndex > 0) then begin
NewUnitInfo:=Project1.Units[UnitIndex]; NewUnitInfo:=Project1.Units[UnitIndex];
if (uifEditorMacro in NewUnitInfo.Flags) and if (uifInternalFile in NewUnitInfo.Flags) and
(NewUnitInfo.OpenEditorInfoCount > 0) (NewUnitInfo.OpenEditorInfoCount > 0)
then begin then begin
NewEditorInfo := NewUnitInfo.OpenEditorInfo[0]; NewEditorInfo := NewUnitInfo.OpenEditorInfo[0];
@ -9739,7 +9741,9 @@ begin
end; end;
end; end;
if (ofEditorMacro in Flags) then begin if (ofInternalFile in Flags) and
(copy(AFileName, 1, length(EditorMacroVirtualDrive)) = EditorMacroVirtualDrive)
then begin
FilenameNoPath := AFileName; FilenameNoPath := AFileName;
UnitIndex:=Project1.IndexOfFilename(AFilename); UnitIndex:=Project1.IndexOfFilename(AFilename);
@ -9755,7 +9759,7 @@ begin
else begin else begin
NewUnitInfo:=Project1.Units[UnitIndex]; NewUnitInfo:=Project1.Units[UnitIndex];
end; end;
NewUnitInfo.Flags := NewUnitInfo.Flags + [uifEditorMacro]; NewUnitInfo.Flags := NewUnitInfo.Flags + [uifInternalFile];
if NewUnitInfo.OpenEditorInfoCount > 0 then begin if NewUnitInfo.OpenEditorInfoCount > 0 then begin
NewEditorInfo := NewUnitInfo.OpenEditorInfo[0]; NewEditorInfo := NewUnitInfo.OpenEditorInfo[0];

View File

@ -160,7 +160,7 @@ type
uifComponentUsedByDesigner, uifComponentUsedByDesigner,
uifComponentIndirectlyUsedByDesigner, uifComponentIndirectlyUsedByDesigner,
uifMarked, uifMarked,
uifEditorMacro uifInternalFile // data from an internal source (e.g. an editor macro (pascal script) from memory)
); );
TUnitInfoFlags = set of TUnitInfoFlag; TUnitInfoFlags = set of TUnitInfoFlag;

View File

@ -42,7 +42,7 @@ type
ofDoLoadResource,// do open form, datamodule, ... (overriding default) ofDoLoadResource,// do open form, datamodule, ... (overriding default)
ofLoadHiddenResource,// load component hidden ofLoadHiddenResource,// load component hidden
ofAddToProject, // add file to project (if exists) ofAddToProject, // add file to project (if exists)
ofEditorMacro // opening an editor macro (pascal script) from memory ofInternalFile // opening data from an internal source (e.g. an editor macro (pascal script) from memory)
); );
TOpenFlags = set of TOpenFlag; TOpenFlags = set of TOpenFlag;