This commit is contained in:
Basile Burg 2015-05-10 04:11:16 +02:00
parent f0cee13fc7
commit c0440b4555
3 changed files with 31 additions and 64 deletions

View File

@ -50,24 +50,6 @@ type
procedure Assign(aValue: TPersistent); procedure Assign(aValue: TPersistent);
end; end;
(**
* Makes TReader.ReadProperties visible
*)
TReaderEx = class helper for TReader
public
procedure ReadPersistent(aValue: TPersistent);
end;
(**
* Makes TWriter.WriteProperties visible
* W
*)
TWriterEx = class helper for TWriter
public
// works as bin but raises because of 'ObjectBinaryToText'
procedure WritePersistent(aValue: TPersistent);
end;
(** (**
* Save a component with a readable aspect. * Save a component with a readable aspect.
*) *)
@ -122,7 +104,7 @@ type
(** (**
* Returns an unique object identifier, based on its heap address. * Returns an unique object identifier, based on its heap address.
*) *)
function uniqueObjStr(const aObject: Tobject): string; function uniqueObjStr(const aObject: TObject): string;
(** (**
* Reduces a filename if its length is over the threshold defined by charThresh. * Reduces a filename if its length is over the threshold defined by charThresh.
@ -136,7 +118,7 @@ type
function getUserDocPath: string; function getUserDocPath: string;
(** (**
* Returns the folder Coedit documents and settings. * Returns the documents and settings folder for Coedit.
*) *)
function getCoeditDocPath: string; function getCoeditDocPath: string;
@ -187,7 +169,7 @@ type
procedure processOutputToStream(aProcess: TProcess; output: TMemoryStream); procedure processOutputToStream(aProcess: TProcess; output: TMemoryStream);
(** (**
* Terminates and frees aProcess; * Terminates and frees aProcess.
*) *)
procedure killProcess(var aProcess: TAsyncProcess); procedure killProcess(var aProcess: TAsyncProcess);
@ -224,13 +206,14 @@ begin
inherited; inherited;
fTimer := TIdleTimer.Create(self); fTimer := TIdleTimer.Create(self);
fTimer.Enabled := false; fTimer.Enabled := false;
fTimer.Interval :=50; fTimer.Interval := 50;
fTimer.AutoEnabled := false; fTimer.AutoEnabled := false;
end; end;
procedure TCheckedAsyncProcess.Execute; procedure TCheckedAsyncProcess.Execute;
begin begin
if OnTerminate <> nil then fTimer.Enabled :=true; if OnTerminate <> nil then
fTimer.Enabled :=true;
fTimer.OnTimer := @checkTerminated; fTimer.OnTimer := @checkTerminated;
inherited; inherited;
end; end;
@ -244,9 +227,6 @@ begin
end; end;
{$ENDIF} {$ENDIF}
// https://stackoverflow.com/questions/25438091/objectbinarytotext-error-with-a-treader-twriter-helper-class
// http://forum.lazarus.freepascal.org/index.php/topic,25557.0.html
procedure TProcessEx.Assign(aValue: TPersistent); procedure TProcessEx.Assign(aValue: TPersistent);
var var
src: TProcess; src: TProcess;
@ -278,21 +258,6 @@ begin
else inherited; else inherited;
end; end;
procedure TReaderEx.ReadPersistent(aValue: TPersistent);
begin
ReadListBegin;
while not EndOfList do
ReadProperty(aValue);
ReadListEnd;
end;
procedure TWriterEx.WritePersistent(aValue: TPersistent);
begin
WriteListBegin;
WriteProperties(aValue);
WriteListEnd;
end;
procedure saveCompToTxtFile(const aComp: TComponent; const aFilename: string); procedure saveCompToTxtFile(const aComp: TComponent; const aFilename: string);
var var
str1, str2: TMemoryStream; str1, str2: TMemoryStream;
@ -400,14 +365,6 @@ begin
end; end;
end; end;
function stripFileExt(const aFilename: string): string;
begin
if Pos('.', aFilename) > 1 then
exit(ChangeFileExt(aFilename, ''))
else
exit(aFilename);
end;
function patchPlateformExt(const aFilename: string): string; function patchPlateformExt(const aFilename: string): string;
var var
ext, newext: string; ext, newext: string;
@ -446,6 +403,14 @@ begin
result := ChangeFileExt(aFilename, newext); result := ChangeFileExt(aFilename, newext);
end; end;
function stripFileExt(const aFilename: string): string;
begin
if Pos('.', aFilename) > 1 then
exit(ChangeFileExt(aFilename, ''))
else
exit(aFilename);
end;
function dlgOkCancel(const aMsg: string): TModalResult; function dlgOkCancel(const aMsg: string): TModalResult;
const const
Btns = [mbOK,mbCancel]; Btns = [mbOK,mbCancel];

View File

@ -592,7 +592,7 @@ begin
try try
DockMaster.SaveLayoutToConfig(xcfg); DockMaster.SaveLayoutToConfig(xcfg);
xcfg.WriteToDisk; xcfg.WriteToDisk;
// TODO: this when AnchorDocking wiont save anymore invalid layout // TODO: remove this when AnchorDocking wiont save anymore invalid layout
with TMemoryStream.Create do try with TMemoryStream.Create do try
LoadFromFile(getCoeditDocPath + 'docking.xml.tmp'); LoadFromFile(getCoeditDocPath + 'docking.xml.tmp');
if Size < 10000 then if Size < 10000 then
@ -905,13 +905,16 @@ begin
for i:= 0 to fActionHandler.observersCount-1 do for i:= 0 to fActionHandler.observersCount-1 do
begin begin
prov := fActionHandler[i] as ICEActionProvider; prov := fActionHandler[i] as ICEActionProvider;
if not prov.actHandlerWantRecollect then continue; if not prov.actHandlerWantRecollect then
continue;
// //
for j := Actions.ActionCount-1 downto 0 do for j := Actions.ActionCount-1 downto 0 do
begin begin
act := Actions.Actions[j]; act := Actions.Actions[j];
if act.Owner = Self then continue; if act.Owner = Self then
if act.Tag <> PtrInt(prov) then continue; continue;
if act.Tag <> PtrInt(prov) then
continue;
// //
act.ActionList := nil; act.ActionList := nil;
end; end;
@ -938,7 +941,8 @@ begin
for i:= 0 to fActionHandler.observersCount-1 do for i:= 0 to fActionHandler.observersCount-1 do
begin begin
prov := fActionHandler[i] as ICEActionProvider; prov := fActionHandler[i] as ICEActionProvider;
if not prov.actHandlerWantFirst then continue; if not prov.actHandlerWantFirst then
continue;
// //
act := nil; act := nil;
cat := ''; cat := '';
@ -1006,9 +1010,7 @@ begin
try try
filter := DdiagFilter; filter := DdiagFilter;
if execute then if execute then
begin
openFile(filename); openFile(filename);
end;
finally finally
free; free;
end; end;
@ -1069,7 +1071,8 @@ begin
str := fDoc.fileName; str := fDoc.fileName;
if (str <> fDoc.tempFilename) and (fileExists(str)) then if (str <> fDoc.tempFilename) and (fileExists(str)) then
saveFile(fDoc) saveFile(fDoc)
else actFileSaveAs.Execute; else
actFileSaveAs.Execute;
end; end;
procedure TCEMainForm.actFileAddToProjExecute(Sender: TObject); procedure TCEMainForm.actFileAddToProjExecute(Sender: TObject);
@ -1182,7 +1185,8 @@ begin
// //
if fDoc.SelAvail then if fDoc.SelAvail then
str := fDoc.SelText str := fDoc.SelText
else str := fDoc.Identifier; else
str := fDoc.Identifier;
ffindwidg.cbToFind.Text := str; ffindwidg.cbToFind.Text := str;
ffindwidg.cbToFindChange(nil); ffindwidg.cbToFindChange(nil);
end; end;
@ -1234,11 +1238,9 @@ begin
finally finally
lst.Free; lst.Free;
end; end;
//if proc = fPrInpWidg.process then
//fPrInpWidg.process := nil;
inph := EntitiesConnector.getSingleService('ICEProcInputHandler'); inph := EntitiesConnector.getSingleService('ICEProcInputHandler');
if (inph <> nil) then (inph as ICEProcInputHandler).removeProcess(proc); if (inph <> nil) then
(inph as ICEProcInputHandler).removeProcess(proc);
end; end;
procedure TCEMainForm.compileAndRunFile(unittest: boolean = false; redirect: boolean = true; procedure TCEMainForm.compileAndRunFile(unittest: boolean = false; redirect: boolean = true;
@ -1791,6 +1793,4 @@ begin
end; end;
{$ENDREGION} {$ENDREGION}
initialization
RegisterClasses([TCEOptions]);
end. end.

View File

@ -68,4 +68,6 @@ begin
subjSesOptsAfterLoad(TCESessionOptionsSubject(fSubjPersObservers)); subjSesOptsAfterLoad(TCESessionOptionsSubject(fSubjPersObservers));
end; end;
initialization
RegisterClasses([TCEOptions]);
end. end.