bugfixes for the linux version

This commit is contained in:
Basile Burg 2014-06-20 23:28:39 +02:00
parent ff1e518e5a
commit c38d76d1b1
9 changed files with 203 additions and 169 deletions

View File

@ -73,7 +73,7 @@ type
function getAbsoluteFilename(const aFilename: string): string;
procedure addSource(const aFilename: string);
function addConfiguration: TCompilerConfiguration;
function getOpts: string;
procedure getOpts(const aList: TStrings);
//
property configuration[ix: integer]: TCompilerConfiguration read getConfig;
property currentConfiguration: TCompilerConfiguration read getCurrConf;
@ -313,11 +313,23 @@ begin
end;
procedure TCEProject.doChanged;
{$IFDEF DEBUG}
var
lst: TStringList;
{$ENDIF}
begin
fModified := true;
if assigned(fOnChange) then fOnChange(Self);
{$IFDEF DEBUG}
writeln(getOpts);
lst := TStringList.Create;
try
lst.Add('---------begin----------');
getOpts(lst);
lst.Add('---------end----------');
writeln(lst.Text);
finally
lst.Free;
end;
{$ENDIF}
end;
@ -366,18 +378,17 @@ begin
afterChanged;
end;
function TCEProject.getOpts: string;
procedure TCEProject.getOpts(const aList: TStrings);
var
rel, abs: string;
begin
result := '';
if fConfIx = -1 then exit;
for rel in fSrcs do
for rel in fSrcs do if rel <> '' then
begin
abs := expandFilenameEx(fBasePath,rel);
result += '"' + abs + '" ' ;
aList.Add(abs); // process.inc ln 249. double quotes are added anyway if there's a space...
end;
result += TCompilerConfiguration(fOptsColl.Items[fConfIx]).getOpts;
TCompilerConfiguration(fOptsColl.Items[fConfIx]).getOpts(aList);
end;
function TCEProject.getAbsoluteSourceName(const aIndex: integer): string;

View File

@ -22,7 +22,8 @@ type
protected
property onChange: TNotifyEvent read fOnChange write fOnChange;
public
function getOpts: string; virtual; abstract;
//function getOpts: string; virtual; abstract;
procedure getOpts(const aList: TStrings); virtual; abstract;
end;
(*****************************************************************************
@ -45,7 +46,7 @@ type
property JSONFilename: string read fJsonFname write setJSONFile;
public
procedure assign(aValue: TPersistent); override;
function getOpts: string; override;
procedure getOpts(const aList: TStrings); override;
end;
@ -81,7 +82,7 @@ type
public
constructor create;
procedure assign(aValue: TPersistent); override;
function getOpts: string; override;
procedure getOpts(const aList: TStrings); override;
end;
(*****************************************************************************
@ -132,7 +133,7 @@ type
property versionIdentifier: string read fVerId write setVerId;
public
procedure assign(aValue: TPersistent); override;
function getOpts: string; override;
procedure getOpts(const aList: TStrings); override;
end;
(**
@ -158,7 +159,7 @@ type
property generateMapFile: boolean read fMap write setMap;
public
procedure assign(aValue: TPersistent); override;
function getOpts: string; override;
procedure getOpts(const aList: TStrings); override;
end;
(*****************************************************************************
@ -186,7 +187,7 @@ type
constructor create;
destructor destroy; override;
procedure assign(aValue: TPersistent); override;
function getOpts: string; override;
procedure getOpts(const aList: TStrings); override;
end;
(*****************************************************************************
@ -202,7 +203,7 @@ type
constructor create;
destructor destroy; override;
procedure assign(aValue: TPersistent); override;
function getOpts: string; override;
procedure getOpts(const aList: TStrings); override;
end;
(*****************************************************************************
@ -229,7 +230,6 @@ type
procedure setOthers(const aValue: TOtherOpts);
protected
function nameFromID: string;
function getCmdLine: string;
published
property name: string read fName write setName;
property documentationOptions: TDocOpts read fDocOpts write setDocOpts;
@ -242,7 +242,7 @@ type
constructor create(aCollection: TCollection); override;
destructor destroy; override;
procedure assign(aValue: TPersistent); override;
property getOpts: string read getCmdLine;
procedure getOpts(const aList: TStrings);
property onChanged: TNotifyEvent read fOnChanged write fOnChanged;
end;
@ -259,13 +259,12 @@ end;
(*******************************************************************************
* TDocOpts
*)
function TDocOpts.getOpts: string;
procedure TDocOpts.getOpts(const aList: TStrings);
begin
result := '';
if fGenDoc then result += '-D ';
if fGenJson then result += '-X ';
if fDocDir <> '' then result += '-Dd' + '"' + fDocDir + '" ';
if fJsonFname <> '' then result += '-Xf' + '"'+ fJsonFname + '" ';
if fGenDoc then aList.Add('-D');
if fGenJson then aList.Add('-X');
if fDocDir <> '' then aList.Add('-Dd' + fDocDir);
if fJsonFname <> '' then aList.Add('-Xf' + fJsonFname);
end;
procedure TDocOpts.assign(aValue: TPersistent);
@ -319,16 +318,19 @@ begin
fDepHandling := TDepHandling.warning;
end;
function TMsgOpts.getOpts: string;
procedure TMsgOpts.getOpts(const aList: TStrings);
var
opt : string;
const
DepStr : array[TDepHandling] of string = ('-d ',''(*-dw*), '-de ');
DepStr : array[TDepHandling] of string = ('-d', '', '-de');
begin
result := DepStr[fDepHandling];
if fVerb then result += '-v ';
if fWarn then result += '-w ';
if fWarnEx then result += '-wi ';
if fVtls then result += '-vtls ';
if fQuiet then result += '-quiet ';
opt := DepStr[fDepHandling];
if opt <> '' then aList.Add(opt);
if fVerb then aList.Add('-v');
if fWarn then aList.Add('-w');
if fWarnEx then aList.Add('-wi');
if fVtls then aList.Add('-vtls');
if fQuiet then aList.Add('-quiet');
end;
procedure TMsgOpts.assign(aValue: TPersistent);
@ -393,21 +395,25 @@ end;
(*******************************************************************************
* TOutputOpts
*)
function TOutputOpts.getOpts: string;
procedure TOutputOpts.getOpts(const aList: TStrings);
var
opt: string;
const
trgKindStr: array[TTargetSystem] of string = ('', '-m32 ','-m64 ');
binKindStr: array[TBinaryKind] of string = ('', '-lib ', '-shared ', '-c ');
trgKindStr: array[TTargetSystem] of string = ('', '-m32','-m64');
binKindStr: array[TBinaryKind] of string = ('', '-lib', '-shared', '-c');
begin
result := binKindStr[fBinKind];
result += trgKindStr[fTrgKind];
if fUt then result += '-unittest ';
if fVerId <> '' then result += '-version=' + fVerId + ' ';;
if fInline then result += '-inline ';
if fNoBounds then result += '-noboundscheck ';
if fOptimz then result += '-O ';
if fGenStack then result += '-gs ';
if fMain then result += '-main ';
if fRelease then result += '-release ';
opt := binKindStr[fBinKind];
if opt <> '' then aList.Add(opt);
opt := trgKindStr[fTrgKind];
if opt <> '' then aList.Add(opt);
if fUt then aList.Add('-unittest');
if fVerId <> '' then aList.Add('-version=' + fVerId);
if fInline then aList.Add('-inline');
if fNoBounds then aList.Add('-noboundscheck');
if fOptimz then aList.Add('-O');
if fGenStack then aList.Add('-gs');
if fMain then aList.Add('-main');
if fRelease then aList.Add('-release');
end;
procedure TOutputOpts.assign(aValue: TPersistent);
@ -504,14 +510,13 @@ end;
(*******************************************************************************
* TDebugOpts
*)
function TDebugOpts.getOpts: string;
procedure TDebugOpts.getOpts(const aList: TStrings);
begin
result := '';
if fDbg then result += '-debug ';
if fDbgIdent <> '' then result += '-debug=' + fDbgIdent + ' ';
if fDbgD then result += '-g ';
if fDbgC then result += '-gc ';
if fMap then result += '-map ';
if fDbg then aList.Add('-debug');
if fDbgIdent <> '' then aList.Add('-debug=' + fDbgIdent);
if fDbgD then aList.Add('-g');
if fDbgC then aList.Add('-gc');
if fMap then aList.Add('-map');
end;
procedure TDebugOpts.assign(aValue: TPersistent);
@ -568,19 +573,18 @@ end;
(*******************************************************************************
* TPathsOpts
*)
function TPathsOpts.getOpts: string;
procedure TPathsOpts.getOpts(const aList: TStrings);
var
str: string;
begin
result := '';
for str in fSrcs do
result += '"'+ str +'" ';
for str in fIncl do
result += '-I"'+ str +'" ';
for str in fImpt do
result += '-J"'+ str +'" ';
if fFname <> '' then result += '-of"' + fFname + '" ';
if fObjDir <> '' then result += '-od"' + fObjDir + '" ';
for str in fSrcs do if str <> '' then
aList.Add(str);
for str in fIncl do if str <> '' then
aList.Add('-I'+ str);
for str in fImpt do if str <> '' then
aList.Add('-J'+ str);
if fFname <> '' then aList.Add('-of' + fFname);
if fObjDir <> '' then aList.Add('-od' + fObjDir);
end;
constructor TPathsOpts.create;
@ -672,13 +676,12 @@ begin
inherited;
end;
function TOtherOpts.getOpts: string;
procedure TOtherOpts.getOpts(const aList: TStrings);
var
str: string;
begin
result := '';
for str in fCustom do
result += str + ' ';
for str in fCustom do if str <> '' then
aList.Add(str);
end;
procedure TOtherOpts.setCustom(const aValue: TStringList);
@ -745,13 +748,14 @@ begin
result := format('<configuration %d>',[ID]);
end;
function TCompilerConfiguration.getCmdLine: string;
procedure TCompilerConfiguration.getOpts(const aList: TStrings);
begin
result :=
fDocOpts.getOpts + fDebugOpts.getOpts + fMsgOpts.getOpts
+ fOutputOpts.getOpts + fPathsOpts.getOpts + fOthers.getOpts;
if length(result) > 0 then if result[length(result)] = ' ' then
setlength(result, length(result)-1);
fDocOpts.getOpts(aList);
fDebugOpts.getOpts(aList);
fMsgOpts.getOpts(aList);
fOutputOpts.getOpts(aList);
fPathsOpts.getOpts(aList);
fOthers.getOpts(aList);
end;
procedure TCompilerConfiguration.setName(const aValue: string);

View File

@ -1,27 +1,27 @@
inherited CEEditorWidget: TCEEditorWidget
Left = 1163
Left = 1159
Height = 382
Top = 91
Width = 461
Width = 465
Caption = 'Source editor'
ClientHeight = 382
ClientWidth = 461
ClientWidth = 465
inherited Back: TPanel
Height = 382
Width = 461
Width = 465
ClientHeight = 382
ClientWidth = 461
ClientWidth = 465
inherited Content: TPanel
Height = 382
Width = 461
Width = 465
BevelOuter = bvRaised
ClientHeight = 382
ClientWidth = 461
ClientWidth = 465
object PageControl: TExtendedNotebook[0]
Left = 3
Height = 351
Top = 3
Width = 455
Width = 459
Align = alClient
BorderSpacing.Around = 2
Images = imgList
@ -36,7 +36,7 @@ inherited CEEditorWidget: TCEEditorWidget
Left = 3
Height = 23
Top = 356
Width = 455
Width = 459
BorderSpacing.Around = 2
Panels = <
item

View File

@ -1,8 +1,8 @@
object CEMainForm: TCEMainForm
Left = 1162
Left = 1158
Height = 53
Top = 0
Width = 741
Width = 745
AllowDropFiles = True
Caption = 'Coedit'
ChildSizing.Layout = cclLeftToRightThenTopToBottom

View File

@ -134,6 +134,7 @@ type
procedure FormDropFiles(Sender: TObject; const FileNames: array of String);
procedure FormShow(Sender: TObject);
private
fUpdateCount: NativeInt;
fProject: TCEProject;
fWidgList: TCEWidgetList;
fMesgWidg: TCEMessagesWidget;
@ -263,57 +264,67 @@ var
hasProj: boolean;
begin
if fEditWidg = nil then exit;
//
curr := fEditWidg.currentEditor;
hasEd := curr <> nil;
if hasEd then
begin
actEdCopy.Enabled := curr.SelAvail;
actEdCut.Enabled := curr.SelAvail;
actEdPaste.Enabled := curr.CanPaste;
actEdUndo.Enabled := curr.CanUndo;
actEdRedo.Enabled := curr.CanRedo;
actEdMacPlay.Enabled := true;
actEdMacStartStop.Enabled := true;
//
actFileCompAndRun.Enabled := true;
actFileCompAndRunWithArgs.Enabled := true;
actFileSave.Enabled := true;
actFileSaveAs.Enabled := true;
actFileClose.Enabled := true;
actFileSaveAll.Enabled := true;
end
else begin
actEdCopy.Enabled := false;
actEdCut.Enabled := false ;
actEdPaste.Enabled := false ;
actEdUndo.Enabled := false ;
actEdRedo.Enabled := false ;
actEdMacPlay.Enabled := false;
actEdMacStartStop.Enabled := false;
//
actFileCompAndRun.Enabled := false;
actFileCompAndRunWithArgs.Enabled := false;
actFileSave.Enabled := false;
actFileSaveAs.Enabled := false;
actFileClose.Enabled := false;
actFileSaveAll.Enabled := false;
if fUpdateCount > 0 then exit;
Inc(fUpdateCount);
try
curr := fEditWidg.currentEditor;
hasEd := curr <> nil;
if hasEd then
begin
actEdCopy.Enabled := curr.SelAvail;
actEdCut.Enabled := curr.SelAvail;
actEdPaste.Enabled := curr.CanPaste;
{$IFDEF MSWINDOWS}
// close file : raises a segfault on linux UndoStuff.>>fList<<.Count...
actEdUndo.Enabled := curr.CanUndo;
actEdRedo.Enabled := curr.CanRedo;
{$ENDIF}
actEdMacPlay.Enabled := true;
actEdMacStartStop.Enabled := true;
//
actFileCompAndRun.Enabled := true;
actFileCompAndRunWithArgs.Enabled := true;
actFileSave.Enabled := true;
actFileSaveAs.Enabled := true;
actFileClose.Enabled := true;
actFileSaveAll.Enabled := true;
end
else begin
actEdCopy.Enabled := false;
actEdCut.Enabled := false ;
actEdPaste.Enabled := false;
{$IFDEF MSWINDOWS}
actEdUndo.Enabled := false;
actEdRedo.Enabled := false;
{$ENDIF}
actEdMacPlay.Enabled := false;
actEdMacStartStop.Enabled := false;
//
actFileCompAndRun.Enabled := false;
actFileCompAndRunWithArgs.Enabled := false;
actFileSave.Enabled := false;
actFileSaveAs.Enabled := false;
actFileClose.Enabled := false;
actFileSaveAll.Enabled := false;
end;
hasProj := fProject <> nil;
actProjSave.Enabled := hasProj;
actProjSaveAs.Enabled := hasProj;
actProjOpts.Enabled := hasProj;
actProjClose.Enabled := hasProj;
actProjCompile.Enabled := hasProj;
actProjCompileAndRun.Enabled := hasProj;
actProjCompAndRunWithArgs.Enabled := hasProj;
actProjRun.Enabled := hasProj;
actProjRunWithArgs.Enabled := hasProj;
actProjSource.Enabled := hasProj;
actFileAddToProj.Enabled := hasEd and hasProj;
finally
Dec(fUpdateCount);
end;
hasProj := fProject <> nil;
actProjSave.Enabled := hasProj;
actProjSaveAs.Enabled := hasProj;
actProjOpts.Enabled := hasProj;
actProjClose.Enabled := hasProj;
actProjCompile.Enabled := hasProj;
actProjCompileAndRun.Enabled := hasProj;
actProjCompAndRunWithArgs.Enabled := hasProj;
actProjRun.Enabled := hasProj;
actProjRunWithArgs.Enabled := hasProj;
actProjSource.Enabled := hasProj;
actFileAddToProj.Enabled := hasEd and hasProj;
end;
procedure TCEMainForm.checkWidgetActions(const aWidget: TCEWidget);
@ -648,13 +659,13 @@ begin
temppath := GetTempDir(false);
chDir(temppath);
{$IFDEF DEBUG}{$WARNINGS OFF}{$HINTS OFF}{$ENDIF}
fname := temppath + format('temp_%.8x', [LongWord(@dmdproc)]);
fname := temppath + format('temp_%.8x', [NativeInt(@dmdproc)]);
{$IFDEF DEBUG}{$WARNINGS ON}{$HINTS ON}{$ENDIF}
fEditWidg.editor[edIndex].Lines.SaveToFile(fname + '.d');
dmdproc.Options:= [poWaitOnExit, poStdErrToOutput, poUsePipes];
dmdproc.Executable:= 'dmd';
dmdproc.Parameters.Text := '"'+ fname +'.d"';
dmdproc.Parameters.Add(fname + '.d');
try
dmdproc.Execute;
ProcessOutputToMsg(dmdproc);
@ -731,7 +742,7 @@ begin
procopts[aProject.currentConfiguration.messagesOptions.verbose];
dmdproc.Executable := 'dmd';
dmdproc.Parameters.Text := aProject.getOpts;
aProject.getOpts(dmdproc.Parameters);
try
dmdproc.Execute;
ProcessOutputToMsg(dmdproc);

View File

@ -1,33 +1,33 @@
inherited CEMessagesWidget: TCEMessagesWidget
Left = 1163
Left = 1160
Height = 172
Top = 511
Width = 741
Width = 744
Caption = 'Messages'
ClientHeight = 172
ClientWidth = 741
ClientWidth = 744
inherited Back: TPanel
Height = 172
Width = 741
Width = 744
ClientHeight = 172
ClientWidth = 741
ClientWidth = 744
inherited Content: TPanel
Height = 172
Width = 741
Width = 744
ClientHeight = 172
ClientWidth = 741
ClientWidth = 744
object List: TListView[0]
Left = 2
Height = 168
Top = 2
Width = 737
Width = 740
Align = alClient
AutoSort = False
AutoWidthLastColumn = True
BorderSpacing.Around = 2
Columns = <
item
Width = 733
Width = 736
end>
HideSelection = False
IconOptions.WrapText = False

View File

@ -1,23 +1,24 @@
inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
Left = 1163
Height = 278
Width = 471
Left = 1160
Height = 276
Top = 723
Width = 474
Caption = 'Project configuration'
ClientHeight = 278
ClientWidth = 471
ClientHeight = 276
ClientWidth = 474
inherited Back: TPanel
Height = 278
Width = 471
ClientHeight = 278
ClientWidth = 471
Height = 276
Width = 474
ClientHeight = 276
ClientWidth = 474
inherited Content: TPanel
Height = 278
Width = 471
ClientHeight = 278
ClientWidth = 471
Height = 276
Width = 474
ClientHeight = 276
ClientWidth = 474
object Tree: TTreeView[0]
Left = 4
Height = 244
Height = 242
Hint = 'filter configuration elements'
Top = 30
Width = 150
@ -52,19 +53,19 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
Left = 2
Height = 24
Top = 2
Width = 467
Width = 470
Align = alTop
BorderSpacing.Around = 2
BevelOuter = bvNone
ClientHeight = 24
ClientWidth = 467
ClientWidth = 470
TabOrder = 1
object selConf: TComboBox
Left = 0
Height = 23
Hint = 'select a configuration'
Top = 1
Width = 376
Width = 379
Align = alClient
BorderSpacing.Top = 1
BorderSpacing.Right = 1
@ -74,7 +75,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
TabOrder = 0
end
object btnAddConf: TSpeedButton
Left = 377
Left = 380
Height = 24
Hint = 'add an empty configuration'
Top = 0
@ -120,7 +121,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
ShowCaption = False
end
object btnDelConf: TSpeedButton
Left = 407
Left = 410
Height = 24
Hint = 'remove selected configuration'
Top = 0
@ -166,7 +167,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
ShowCaption = False
end
object btnCloneConf: TSpeedButton
Left = 437
Left = 440
Height = 24
Hint = 'clone selected configuration'
Top = 0
@ -214,15 +215,15 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
end
object Splitter1: TSplitter[2]
Left = 154
Height = 250
Height = 248
Top = 28
Width = 5
end
object Grid: TTIPropertyGrid[3]
Left = 159
Height = 244
Height = 242
Top = 30
Width = 308
Width = 311
Align = alClient
BorderSpacing.Top = 4
BorderSpacing.Right = 4
@ -232,6 +233,7 @@ inherited CEProjectConfigurationWidget: TCEProjectConfigurationWidget
Indent = 16
NameFont.Color = clWindowText
OnEditorFilter = GridEditorFilter
OnModified = GridModified
PreferredSplitterX = 145
SplitterX = 145
ValueFont.Color = clMaroon

View File

@ -26,6 +26,7 @@ type
procedure btnDelConfClick(Sender: TObject);
procedure btnCloneCurrClick(Sender: TObject);
procedure GridEditorFilter(Sender: TObject; aEditor: TPropertyEditor;var aShow: boolean);
procedure GridModified(Sender: TObject);
procedure selConfChange(Sender: TObject);
procedure TreeChange(Sender: TObject; Node: TTreeNode);
private
@ -94,6 +95,11 @@ begin
if aEditor.ClassType = TCollectionPropertyEditor then aShow := false;
end;
procedure TCEProjectConfigurationWidget.GridModified(Sender: TObject);
begin
setFocus;
end;
procedure TCEProjectConfigurationWidget.btnAddConfClick(Sender: TObject);
var
nme: string;

View File

@ -42,11 +42,11 @@ begin
Options2 := [eoEnhanceEndKey, eoFoldedCopyPaste, eoOverwriteBlock];
//
Gutter.LineNumberPart.ShowOnlyLineNumbersMultiplesOf := 5;
Gutter.LineNumberPart.MarkupInfo.Foreground := clSilver;
Gutter.LineNumberPart.MarkupInfo.Foreground := clGray;
Gutter.SeparatorPart.LineOffset:=1;
Gutter.SeparatorPart.LineWidth:=1;
Gutter.SeparatorPart.MarkupInfo.Foreground := clSilver;
Gutter.CodeFoldPart.MarkupInfo.Foreground := clSilver;
Gutter.SeparatorPart.MarkupInfo.Foreground := clGray;
Gutter.CodeFoldPart.MarkupInfo.Foreground := clGray;
//
Highlighter := D2Syn;
end;