mirror of https://gitlab.com/basile.b/dexed.git
or_3
This commit is contained in:
parent
c4ec74e3e1
commit
5987571333
|
@ -15,8 +15,7 @@ uses
|
|||
type
|
||||
|
||||
{ TCEEditorWidget }
|
||||
|
||||
TCEEditorWidget = class(TCEWidget, ICEProjectObserver)
|
||||
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEProjectObserver)
|
||||
imgList: TImageList;
|
||||
PageControl: TExtendedNotebook;
|
||||
macRecorder: TSynMacroRecorder;
|
||||
|
@ -33,6 +32,7 @@ type
|
|||
private
|
||||
fKeyChanged: boolean;
|
||||
fProj: TCEProject;
|
||||
fDoc: TCESynMemo;
|
||||
|
||||
// http://bugs.freepascal.org/view.php?id=26329
|
||||
fSyncEdit: TSynPluginSyncroEdit;
|
||||
|
@ -44,7 +44,6 @@ type
|
|||
procedure memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure memoChange(Sender: TObject);
|
||||
procedure memoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
function getCurrentEditor: TCESynMemo;
|
||||
function getEditor(index: NativeInt): TCESynMemo;
|
||||
function getEditorCount: NativeInt;
|
||||
function getEditorIndex: NativeInt;
|
||||
|
@ -58,16 +57,19 @@ type
|
|||
procedure focusedEditorChanged;
|
||||
function getEditorHint: string;
|
||||
//
|
||||
procedure docNew(const aDoc: TCESynMemo);
|
||||
procedure docClosing(const aDoc: TCESynMemo);
|
||||
procedure docFocused(const aDoc: TCESynMemo);
|
||||
procedure docChanged(const aDoc: TCESynMemo);
|
||||
//
|
||||
procedure projNew(const aProject: TCEProject);
|
||||
procedure projClosing(const aProject: TCEProject);
|
||||
procedure projFocused(const aProject: TCEProject);
|
||||
procedure projChanged(const aProject: TCEProject);
|
||||
|
||||
//
|
||||
procedure projCompile(const aProject: TCEProject); //warning: removed from itf
|
||||
procedure projRun(const aProject: TCEProject); //warning: removed from itf
|
||||
|
||||
//
|
||||
property currentEditor: TCESynMemo read getCurrentEditor;
|
||||
property editor[index: NativeInt]: TCESynMemo read getEditor;
|
||||
property editorCount: NativeInt read getEditorCount;
|
||||
property editorIndex: NativeInt read getEditorIndex;
|
||||
|
@ -80,6 +82,7 @@ implementation
|
|||
uses
|
||||
ce_main, ce_messages;
|
||||
|
||||
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||
constructor TCEEditorWidget.create(aOwner: TComponent);
|
||||
var
|
||||
bmp: TBitmap;
|
||||
|
@ -97,6 +100,8 @@ begin
|
|||
finally
|
||||
bmp.Free;
|
||||
end;
|
||||
//
|
||||
EntitiesConnector.addObserver(self);
|
||||
end;
|
||||
|
||||
destructor TCEEditorWidget.destroy;
|
||||
|
@ -105,6 +110,64 @@ begin
|
|||
errLst.Free;
|
||||
inherited;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEMultiDocObserver ---------------------------------------------------}
|
||||
procedure TCEEditorWidget.docNew(const aDoc: TCESynMemo);
|
||||
begin
|
||||
fDoc := aDoc;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.docClosing(const aDoc: TCESynMemo);
|
||||
begin
|
||||
fDoc := nil;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.docFocused(const aDoc: TCESynMemo);
|
||||
begin
|
||||
fDoc := aDoc;
|
||||
focusedEditorChanged;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.docChanged(const aDoc: TCESynMemo);
|
||||
begin
|
||||
if fDoc <> aDoc then exit;
|
||||
fKeyChanged := true;
|
||||
beginUpdateByDelay;
|
||||
UpdateByEvent;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEProjectObserver ----------------------------------------------------}
|
||||
procedure TCEEditorWidget.projNew(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := aProject;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projClosing(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := nil;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projFocused(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := aProject;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projChanged(const aProject: TCEProject);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projCompile(const aProject: TCEProject);
|
||||
begin
|
||||
endUpdateByDelay; // warning not trigered anymore
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projRun(const aProject: TCEProject);
|
||||
begin
|
||||
endUpdateByDelay; // warning not trigered anymore
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
function TCEEditorWidget.getEditorCount: NativeInt;
|
||||
begin
|
||||
|
@ -118,41 +181,27 @@ begin
|
|||
else result := -1;
|
||||
end;
|
||||
|
||||
function TCEEditorWidget.getCurrentEditor: TCESynMemo;
|
||||
begin
|
||||
if pageControl.PageCount = 0 then result := nil
|
||||
else result := TCESynMemo(pageControl.ActivePage.Controls[0]);
|
||||
end;
|
||||
|
||||
function TCEEditorWidget.getEditor(index: NativeInt): TCESynMemo;
|
||||
begin
|
||||
result := TCESynMemo(pageControl.Pages[index].Controls[0]);
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.focusedEditorChanged;
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := getCurrentEditor;
|
||||
macRecorder.Editor := curr;
|
||||
fSyncEdit.Editor := curr;
|
||||
completion.Editor := curr;
|
||||
if fDoc = nil then exit;
|
||||
//
|
||||
if pageControl.ActivePageIndex <> -1 then
|
||||
macRecorder.Editor := fDoc;
|
||||
fSyncEdit.Editor := fDoc;
|
||||
completion.Editor := fDoc;
|
||||
if (pageControl.ActivePage.Caption = '') then
|
||||
begin
|
||||
//CEMainForm.docFocusedNotify(Self, pageControl.ActivePageIndex);
|
||||
if (pageControl.ActivePage.Caption = '') then
|
||||
begin
|
||||
fKeyChanged := true;
|
||||
beginUpdateByDelay;
|
||||
end;
|
||||
fKeyChanged := true;
|
||||
beginUpdateByDelay;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.PageControlChange(Sender: TObject);
|
||||
begin
|
||||
//http://bugs.freepascal.org/view.php?id=26320
|
||||
focusedEditorChanged;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.completionExecute(Sender: TObject);
|
||||
|
@ -189,14 +238,14 @@ begin
|
|||
memo.OnKeyUp := @memoKeyDown;
|
||||
memo.OnKeyPress := @memoKeyPress;
|
||||
memo.OnMouseDown := @memoMouseDown;
|
||||
memo.OnChange := @memoChange;
|
||||
//memo.OnChange := @memoChange;
|
||||
|
||||
memo.OnMouseMove := @memoMouseMove;
|
||||
//
|
||||
pageControl.ActivePage := sheet;
|
||||
|
||||
//http://bugs.freepascal.org/view.php?id=26320
|
||||
focusedEditorChanged;
|
||||
//focusedEditorChanged;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.removeEditor(const aIndex: NativeInt);
|
||||
|
@ -222,7 +271,6 @@ end;
|
|||
procedure TCEEditorWidget.memoKeyPress(Sender: TObject; var Key: char);
|
||||
var
|
||||
pt: Tpoint;
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
fKeyChanged := true;
|
||||
if Key = '.' then
|
||||
|
@ -250,65 +298,30 @@ end;
|
|||
|
||||
procedure TCEEditorWidget.memoChange(Sender: TObject);
|
||||
begin
|
||||
fKeyChanged := true;
|
||||
beginUpdateByDelay;
|
||||
UpdateByEvent;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projNew(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := aProject;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projClosing(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := nil;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projFocused(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := aProject;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projChanged(const aProject: TCEProject);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projCompile(const aProject: TCEProject);
|
||||
begin
|
||||
endUpdateByDelay; // warning not trigered anymore
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.projRun(const aProject: TCEProject);
|
||||
begin
|
||||
endUpdateByDelay; // warning not trigered anymore
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.getSymbolLoc;
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
str: TMemoryStream;
|
||||
srcpos: Integer;
|
||||
ftempname, fname: string;
|
||||
begin
|
||||
if not dcdOn then exit;
|
||||
//
|
||||
curr := getCurrentEditor;
|
||||
if curr = nil then exit;
|
||||
if fDoc = nil then exit;
|
||||
//
|
||||
str := TMemoryStream.Create;
|
||||
try
|
||||
ftempname := curr.tempFilename;
|
||||
curr.Lines.SaveToStream(str);
|
||||
ftempname := fDoc.tempFilename;
|
||||
fDoc.Lines.SaveToStream(str);
|
||||
str.SaveToFile(ftempname);
|
||||
fname := ftempname;
|
||||
srcpos := curr.SelStart;
|
||||
if curr.GetWordAtRowCol(curr.LogicalCaretXY) <> '' then
|
||||
srcpos := fDoc.SelStart;
|
||||
if fDoc.GetWordAtRowCol(fDoc.LogicalCaretXY) <> '' then
|
||||
ce_dcd.getSymbolLoc(fname, srcpos);
|
||||
if fname <> ftempname then if fileExists(fname) then
|
||||
CEMainForm.openFile(fname);
|
||||
if srcpos <> -1 then
|
||||
getCurrentEditor.SelStart := srcpos;
|
||||
fDoc.SelStart := srcpos; // fDoc probably not be updated
|
||||
finally
|
||||
str.Free;
|
||||
end;
|
||||
|
@ -316,23 +329,20 @@ end;
|
|||
|
||||
procedure TCEEditorWidget.getCompletionList;
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
str: TMemoryStream;
|
||||
srcpos: NativeInt;
|
||||
fname: string;
|
||||
begin
|
||||
if not dcdOn then exit;
|
||||
//
|
||||
curr := getCurrentEditor;
|
||||
if curr = nil then exit;
|
||||
if fDoc = nil then exit;
|
||||
//
|
||||
str := TMemoryStream.Create;
|
||||
try
|
||||
completion.Position := 0; // previous index could cause an error here.
|
||||
fname := curr.tempFilename;
|
||||
curr.Lines.SaveToStream(str);
|
||||
fname := fDoc.tempFilename;
|
||||
fDoc.Lines.SaveToStream(str);
|
||||
str.SaveToFile(fname);
|
||||
srcpos := curr.SelStart;
|
||||
srcpos := fDoc.SelStart;
|
||||
completion.ItemList.Clear;
|
||||
ce_dcd.getCompletion(fname, srcpos, completion.ItemList);
|
||||
finally
|
||||
|
@ -342,7 +352,6 @@ end;
|
|||
|
||||
function TCEEditorWidget.getEditorHint: string;
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
str: TMemoryStream;
|
||||
lst: TStringList;
|
||||
srcpos: NativeInt;
|
||||
|
@ -350,18 +359,16 @@ var
|
|||
begin
|
||||
result := '';
|
||||
if not dcdOn then exit;
|
||||
//
|
||||
curr := getCurrentEditor;
|
||||
if curr = nil then exit;
|
||||
if fDoc = nil then exit;
|
||||
//
|
||||
str := TMemoryStream.Create;
|
||||
lst := TStringList.Create;
|
||||
try
|
||||
fname := curr.tempFilename;
|
||||
curr.Lines.SaveToStream(str);
|
||||
fname := fDoc.tempFilename;
|
||||
fDoc.Lines.SaveToStream(str);
|
||||
str.SaveToFile(fname);
|
||||
srcpos := curr.SelStart;
|
||||
if curr.GetWordAtRowCol(curr.LogicalCaretXY) <> '' then
|
||||
srcpos := fDoc.SelStart;
|
||||
if fDoc.GetWordAtRowCol(fDoc.LogicalCaretXY) <> '' then
|
||||
ce_dcd.getHint(fname, srcpos, lst);
|
||||
result := lst.Text;
|
||||
finally
|
||||
|
@ -373,31 +380,25 @@ end;
|
|||
procedure TCEEditorWidget.UpdateByEvent;
|
||||
const
|
||||
modstr: array[boolean] of string = ('...', 'MODIFIED');
|
||||
var
|
||||
ed: TCESynMemo;
|
||||
begin
|
||||
ed := getCurrentEditor;
|
||||
if ed = nil then exit;
|
||||
if fDoc = nil then exit;
|
||||
//
|
||||
editorStatus.Panels[0].Text := format('%d : %d',[ed.CaretY, ed.CaretX]);
|
||||
editorStatus.Panels[1].Text := modstr[ed.modified];
|
||||
editorStatus.Panels[2].Text := ed.fileName;
|
||||
editorStatus.Panels[0].Text := format('%d : %d',[fDoc.CaretY, fDoc.CaretX]);
|
||||
editorStatus.Panels[1].Text := modstr[fDoc.modified];
|
||||
editorStatus.Panels[2].Text := fDoc.fileName;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.UpdateByDelay;
|
||||
var
|
||||
dt: PMessageItemData;
|
||||
ed: TCESynMemo;
|
||||
err: TLexError;
|
||||
md: string;
|
||||
begin
|
||||
ed := getCurrentEditor;
|
||||
if ed = nil then exit;
|
||||
if fDoc = nil then exit;
|
||||
if not fKeyChanged then exit;
|
||||
//
|
||||
fKeyChanged := false;
|
||||
//CEMainForm.docChangeNotify(Self, editorIndex);
|
||||
if ed.Lines.Count = 0 then exit;
|
||||
if fDoc.Lines.Count = 0 then exit;
|
||||
//
|
||||
if fProj = nil then
|
||||
CEMainForm.MessageWidget.ClearMessages(mcEditor)
|
||||
|
@ -405,14 +406,14 @@ begin
|
|||
// if the source is in proj then we want to keep messages to correct mistakes.
|
||||
end;
|
||||
|
||||
lex(ed.Lines.Text, tokLst);
|
||||
lex(fDoc.Lines.Text, tokLst);
|
||||
|
||||
if ed.isDSource then
|
||||
if fDoc.isDSource then
|
||||
begin
|
||||
checkSyntacticErrors(tokLst, errLst);
|
||||
for err in errLst do begin
|
||||
dt := newMessageData;
|
||||
dt^.editor := ed;
|
||||
dt^.editor := fDoc;
|
||||
dt^.position := point(err.position.x, err.position.y);
|
||||
dt^.ctxt := mcEditor;
|
||||
CEMainForm.MessageWidget.addMessage(format( '%s (@line:%.4d @char:%.4d)',
|
||||
|
@ -421,9 +422,9 @@ begin
|
|||
end;
|
||||
|
||||
md := '';
|
||||
if ed.isDSource then
|
||||
if fDoc.isDSource then
|
||||
md := getModuleName(tokLst);
|
||||
if md = '' then md := extractFileName(ed.fileName);
|
||||
if md = '' then md := extractFileName(fDoc.fileName);
|
||||
pageControl.ActivePage.Caption := md;
|
||||
|
||||
CEMainForm.MessageWidget.scrollToBack;
|
||||
|
|
101
src/ce_main.pas
101
src/ce_main.pas
|
@ -1015,7 +1015,7 @@ end;
|
|||
procedure TCEMainForm.actFileNewRunExecute(Sender: TObject);
|
||||
begin
|
||||
newFile;
|
||||
fEditWidg.currentEditor.Text :=
|
||||
fDoc.Text :=
|
||||
'module runnable;' + LineEnding +
|
||||
'' + LineEnding +
|
||||
'import std.stdio;' + LineEnding +
|
||||
|
@ -1098,80 +1098,61 @@ end;
|
|||
|
||||
{$REGION edit ------------------------------------------------------------------}
|
||||
procedure TCEMainForm.actEdCopyExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.CopyToClipboard;
|
||||
if assigned(fDoc) then
|
||||
fDoc.CopyToClipboard;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdCutExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.CutToClipboard;
|
||||
if assigned(fDoc) then
|
||||
fDoc.CutToClipboard;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdPasteExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.PasteFromClipboard;
|
||||
if assigned(fDoc) then
|
||||
fDoc.PasteFromClipboard;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdUndoExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.Undo;
|
||||
if assigned(fDoc) then
|
||||
fDoc.Undo;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdRedoExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.Redo;
|
||||
if assigned(fDoc) then
|
||||
fDoc.Redo;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdMacPlayExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then fEditWidg.macRecorder.PlaybackMacro(curr);
|
||||
if assigned(fDoc) then
|
||||
fEditWidg.macRecorder.PlaybackMacro(fDoc);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdMacStartStopExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then
|
||||
if assigned(fDoc) then
|
||||
begin
|
||||
if fEditWidg.macRecorder.State = msRecording then
|
||||
fEditWidg.macRecorder.Stop
|
||||
else fEditWidg.macRecorder.RecordMacro(curr);
|
||||
else fEditWidg.macRecorder.RecordMacro(fDoc);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdIndentExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.ExecuteCommand(ecBlockIndent, '', nil);
|
||||
if assigned(fDoc) then
|
||||
fDoc.ExecuteCommand(ecBlockIndent, '', nil);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdUnIndentExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := fEditWidg.currentEditor;
|
||||
if assigned(curr) then curr.ExecuteCommand(ecBlockUnIndent, '', nil);
|
||||
if assigned(fDoc) then
|
||||
fDoc.ExecuteCommand(ecBlockUnIndent, '', nil);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actEdFindExecute(Sender: TObject);
|
||||
|
@ -1184,11 +1165,11 @@ begin
|
|||
if win = nil then exit;
|
||||
win.Show;
|
||||
win.BringToFront;
|
||||
ed := fEditWidg.currentEditor;
|
||||
if ed = nil then exit;
|
||||
if ed.SelAvail then
|
||||
str := ed.SelText
|
||||
else str := ed.Identifier;
|
||||
if fDoc = nil then exit;
|
||||
//
|
||||
if fDoc.SelAvail then
|
||||
str := fDoc.SelText
|
||||
else str := fDoc.Identifier;
|
||||
ffindwidg.cbToFind.Text := str;
|
||||
ffindwidg.cbToFindChange(nil);
|
||||
end;
|
||||
|
@ -1232,9 +1213,12 @@ begin
|
|||
dt^.ctxt := aCtxt;
|
||||
dt^.project := fProject;
|
||||
dt^.position := getLineFromDmdMessage(msg);
|
||||
dt^.editor := getFileFromDmdMessage(msg);
|
||||
if openFileFromDmdMessage(msg) then
|
||||
dt^.editor := fDoc
|
||||
else
|
||||
dt^.editor := nil;
|
||||
if dt^.editor = nil then
|
||||
dt^.editor := EditWidget.currentEditor
|
||||
dt^.editor := fDoc
|
||||
else
|
||||
dt^.ctxt := mcEditor;
|
||||
fEditWidg.endUpdatebyDelay; // messages would be cleared by the delayed module name detection.
|
||||
|
@ -1479,15 +1463,12 @@ begin
|
|||
end;
|
||||
|
||||
procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject);
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
begin
|
||||
curr := EditWidget.currentEditor;
|
||||
if curr = nil then exit;
|
||||
if not fileExists(curr.fileName) then exit;
|
||||
if fDoc = nil then exit;
|
||||
if not fileExists(fDoc.fileName) then exit;
|
||||
//
|
||||
DockMaster.GetAnchorSite(fExplWidg).Show;
|
||||
fExplWidg.expandPath(extractFilePath(curr.fileName));
|
||||
fExplWidg.expandPath(extractFilePath(fDoc.fileName));
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actProjCompileExecute(Sender: TObject);
|
||||
|
@ -1695,7 +1676,7 @@ begin
|
|||
if not fileExists(fProject.fileName) then exit;
|
||||
//
|
||||
openFile(fProject.fileName);
|
||||
EditWidget.currentEditor.Highlighter := LfmSyn;
|
||||
fDoc.Highlighter := LfmSyn;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actProjOptViewExecute(Sender: TObject);
|
||||
|
@ -1923,24 +1904,24 @@ begin
|
|||
'CFF', 'CurrentFileFile':
|
||||
begin
|
||||
result += '`';
|
||||
if EditWidget.currentEditor <> nil then
|
||||
if fileExists(EditWidget.currentEditor.fileName) then
|
||||
result += EditWidget.currentEditor.fileName;
|
||||
if fDoc <> nil then
|
||||
if fileExists(fDoc.fileName) then
|
||||
result += fDoc.fileName;
|
||||
result += '`';
|
||||
end;
|
||||
'CFP', 'CurrentFilePath':
|
||||
begin
|
||||
result += '`';
|
||||
if EditWidget.currentEditor <> nil then
|
||||
if fileExists(EditWidget.currentEditor.fileName) then
|
||||
result += extractFilePath(EditWidget.currentEditor.fileName);
|
||||
if fDoc <> nil then
|
||||
if fileExists(fDoc.fileName) then
|
||||
result += extractFilePath(fDoc.fileName);
|
||||
result += '`';
|
||||
end;
|
||||
'CI', 'CurrentIdentifier':
|
||||
begin
|
||||
result += '`';
|
||||
if EditWidget.currentEditor <> nil then
|
||||
result += EditWidget.currentEditor.Identifier;
|
||||
if fDoc <> nil then
|
||||
result += fDoc.Identifier;
|
||||
result += '`';
|
||||
end;
|
||||
'CAF', 'CoeditApplicationFile':
|
||||
|
|
|
@ -85,7 +85,7 @@ type
|
|||
|
||||
function semanticMsgAna(const aMessg: string): TMessageKind;
|
||||
function getLineFromDmdMessage(const aMessage: string): TPoint;
|
||||
function getFileFromDmdMessage(const aMessage: string): TCESynMemo;
|
||||
function openFileFromDmdMessage(const aMessage: string): boolean;
|
||||
function newMessageData: PMessageItemData;
|
||||
|
||||
implementation
|
||||
|
@ -250,7 +250,7 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEProjectMonitor -----------------------------------------------------}
|
||||
{$REGION ICEProjectObserver ----------------------------------------------------}
|
||||
procedure TCEMessagesWidget.projNew(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := aProject;
|
||||
|
@ -276,7 +276,7 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEMultiDocMonitor ----------------------------------------------------}
|
||||
{$REGION ICEMultiDocObserver ---------------------------------------------------}
|
||||
procedure TCEMessagesWidget.docNew(const aDoc: TCESynMemo);
|
||||
begin
|
||||
fDoc := aDoc;
|
||||
|
@ -374,7 +374,7 @@ end;
|
|||
|
||||
procedure TCEMessagesWidget.ClearMessages(aCtxt: TMessageContext);
|
||||
var
|
||||
i: NativeInt;
|
||||
i: Integer;
|
||||
dt: TMessageItemData;
|
||||
begin
|
||||
for i := List.Items.Count-1 downto 0 do
|
||||
|
@ -542,7 +542,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function getFileFromDmdMessage(const aMessage: string): TCESynMemo;
|
||||
function openFileFromDmdMessage(const aMessage: string): boolean;
|
||||
var
|
||||
i: NativeInt;
|
||||
ident: string;
|
||||
|
@ -550,7 +550,7 @@ var
|
|||
begin
|
||||
ident := '';
|
||||
i := 0;
|
||||
result := nil;
|
||||
result := false;
|
||||
while(true) do
|
||||
begin
|
||||
inc(i);
|
||||
|
@ -561,7 +561,7 @@ begin
|
|||
ext := extractFileExt(ident);
|
||||
if not (ext = '.d') or (ext = '.di') then exit;
|
||||
CEMainForm.openFile(ident);
|
||||
result := CEMainForm.EditWidget.currentEditor;
|
||||
exit(true);
|
||||
end;
|
||||
ident += aMessage[i];
|
||||
end;
|
||||
|
|
|
@ -7,7 +7,7 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
Menus, ComCtrls, Buttons, ce_widget, lcltype, strutils;
|
||||
Menus, ComCtrls, Buttons, lcltype, strutils, ce_widget, ce_common;
|
||||
|
||||
type
|
||||
TCEMiniExplorerWidget = class(TCEWidget)
|
||||
|
@ -64,7 +64,7 @@ implementation
|
|||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
ce_main, ce_common;
|
||||
ce_main;
|
||||
|
||||
{$REGION Standard Comp/Obj------------------------------------------------------}
|
||||
constructor TCEMiniExplorerWidget.create(aIwner: TComponent);
|
||||
|
|
|
@ -54,6 +54,7 @@ begin
|
|||
EntitiesConnector.addObserver(self);
|
||||
end;
|
||||
|
||||
|
||||
procedure TCEProjectConfigurationWidget.projNew(const aProject: TCEProject);
|
||||
begin
|
||||
beginUpdateByEvent;
|
||||
|
|
|
@ -6,7 +6,7 @@ unit ce_project;
|
|||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ce_dmdwrap, ce_libman, ce_observer;
|
||||
Classes, SysUtils, ce_common, ce_dmdwrap, ce_libman, ce_observer;
|
||||
|
||||
type
|
||||
|
||||
|
@ -79,7 +79,7 @@ type
|
|||
implementation
|
||||
|
||||
uses
|
||||
ce_common, ce_interfaces, dialogs;
|
||||
ce_interfaces;
|
||||
|
||||
constructor TCEProject.create(aOwner: TComponent);
|
||||
begin
|
||||
|
@ -92,8 +92,6 @@ begin
|
|||
fSrcsCop := TStringList.Create;
|
||||
fOptsColl := TCollection.create(TCompilerConfiguration);
|
||||
//
|
||||
//subjProjNew(TCEProjectSubject(fProjectSubject), self);
|
||||
//
|
||||
reset;
|
||||
addDefaults;
|
||||
//
|
||||
|
|
|
@ -43,7 +43,6 @@ type
|
|||
procedure projClosing(const aProject: TCEProject);
|
||||
procedure projFocused(const aProject: TCEProject);
|
||||
procedure projChanged(const aProject: TCEProject);
|
||||
|
||||
//
|
||||
function contextName: string; override;
|
||||
function contextActionCount: integer; override;
|
||||
|
@ -107,8 +106,8 @@ end;
|
|||
{$REGION ICEProjectMonitor -----------------------------------------------------}
|
||||
procedure TCEProjectInspectWidget.projNew(const aProject: TCEProject);
|
||||
begin
|
||||
//fProject := aProject;
|
||||
//UpdateByEvent;
|
||||
fProject := aProject;
|
||||
UpdateByEvent;
|
||||
end;
|
||||
|
||||
procedure TCEProjectInspectWidget.projClosing(const aProject: TCEProject);
|
||||
|
|
|
@ -274,7 +274,7 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEMultiDocMonitor ----------------------------------------------------}
|
||||
{$REGION ICEMultiDocObserver ---------------------------------------------------}
|
||||
procedure TCESearchWidget.docNew(const aDoc: TCESynMemo);
|
||||
begin
|
||||
fEditor := aDoc;
|
||||
|
|
|
@ -14,7 +14,7 @@ uses
|
|||
type
|
||||
|
||||
{ TCEStaticExplorerWidget }
|
||||
TCEStaticExplorerWidget = class(TCEWidget)
|
||||
TCEStaticExplorerWidget = class(TCEWidget, ICEProjectObserver, ICEMultiDocObserver)
|
||||
btnRefresh: TBitBtn;
|
||||
imgList: TImageList;
|
||||
Panel1: TPanel;
|
||||
|
@ -222,7 +222,7 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEMultiDocMonitor ----------------------------------------------------}
|
||||
{$REGION ICEMultiDocObserver ---------------------------------------------------}
|
||||
procedure TCEStaticExplorerWidget.docNew(const aDoc: TCESynMemo);
|
||||
begin
|
||||
end;
|
||||
|
@ -249,7 +249,7 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEProjectMonitor -----------------------------------------------------}
|
||||
{$REGION ICEProjectObserver ----------------------------------------------------}
|
||||
procedure TCEStaticExplorerWidget.projNew(const aProject: TCEProject);
|
||||
begin
|
||||
fProj := aProject;
|
||||
|
|
|
@ -57,7 +57,7 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
graphics, ce_main, forms, ce_interfaces;
|
||||
graphics, ce_main, ce_interfaces;
|
||||
|
||||
constructor TCESynMemo.Create(aOwner: TComponent);
|
||||
begin
|
||||
|
@ -118,6 +118,7 @@ begin
|
|||
inherited;
|
||||
if not Visible then exit;
|
||||
identifierToD2Syn;
|
||||
subjDocFocused(TCEMultiDocSubject(fMultiDocSubject), self);
|
||||
end;
|
||||
|
||||
procedure TCESynMemo.DoEnter;
|
||||
|
|
|
@ -190,50 +190,6 @@ begin
|
|||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEMultiDocObserver ----------------------------------------------------}
|
||||
//procedure TCEWidget.docNew(const aDoc: TCESynMemo);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.docFocused(const aDoc: TCESynMemo);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.docChanged(const aDoc: TCESynMemo);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.docClose(const aDoc: TCESynMemo);
|
||||
//begin
|
||||
//end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION ICEProjectObserver -----------------------------------------------------}
|
||||
//procedure TCEWidget.projNew(const aProject: TCEProject);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.projChange(const aProject: TCEProject);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.projClose(const aProject: TCEProject);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.projCompile(const aProject: TCEProject);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.projRun(const aProject: TCEProject);
|
||||
//begin
|
||||
//end;
|
||||
//
|
||||
//procedure TCEWidget.projFocused(const aProject: TCEProject);
|
||||
//begin
|
||||
//end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION Updaters---------------------------------------------------------------}
|
||||
procedure TCEWidget.setDelayDur(aValue: Integer);
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue