mirror of https://gitlab.com/basile.b/dexed.git
This commit is contained in:
parent
3fd4bb6ac7
commit
5591812bae
|
@ -126,7 +126,7 @@
|
|||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="9">
|
||||
<Units Count="10">
|
||||
<Unit0>
|
||||
<Filename Value="coedit.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
|
@ -187,6 +187,11 @@
|
|||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_synmemo"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="..\src\ce_dmdwrap.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ce_dmdwrap"/>
|
||||
</Unit9>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
|
|
@ -8,7 +8,7 @@ uses
|
|||
{$ENDIF}{$ENDIF}
|
||||
Interfaces,
|
||||
Forms, lazcontrols, ce_main, ce_widget, ce_common,
|
||||
ce_messages, ce_editor, ce_project, ce_synmemo;
|
||||
ce_messages, ce_editor, ce_project, ce_synmemo, ce_dmdwrap;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@ unit ce_common;
|
|||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ce_dmdwrap;
|
||||
Classes, SysUtils, ce_dmdwrap, ActnList;
|
||||
|
||||
type
|
||||
|
||||
TCEProject = class;
|
||||
|
||||
(**
|
||||
* An implementer is informed when a new document is added, focused or closed.
|
||||
*)
|
||||
|
@ -17,20 +19,20 @@ type
|
|||
procedure docClose(const aNewIndex: integer);
|
||||
end;
|
||||
|
||||
(**
|
||||
* An implementer informs when a new document is added, focused or closed.
|
||||
*)
|
||||
ICEMultiDocEmitter = interface(ICEMultiDocMonitor)
|
||||
end;
|
||||
|
||||
(**
|
||||
* An implementer adds some menu actions when its context is valid.
|
||||
* Called from mainForm to a widget when necessary.
|
||||
*)
|
||||
ICEContextualActions = interface
|
||||
function contextName: string;
|
||||
function contextActionCount: integer;
|
||||
function contextAction(index: integer): TBasicAction;
|
||||
function contextAction(index: integer): TAction;
|
||||
end;
|
||||
|
||||
(**
|
||||
* An implementer is informed when a project changes.
|
||||
*)
|
||||
ICEProjectMonitor = interface
|
||||
procedure projChange(const aProject: TCEProject);
|
||||
end;
|
||||
|
||||
(*****************************************************************************
|
||||
|
@ -38,50 +40,163 @@ type
|
|||
*)
|
||||
TCEProject = class(TComponent)
|
||||
private
|
||||
fOnChange: TNotifyEvent;
|
||||
fModified: boolean;
|
||||
fFilename: string;
|
||||
fBasePath: string;
|
||||
fOptsColl: TCollection;
|
||||
fSrcs: TStringList; // an editor can be associated to a file using the Object[] property
|
||||
fSrcs, fSrcsCop: TStringList; // an editor can be associated to a file using the Object[] property
|
||||
fConfIx: Integer;
|
||||
procedure doChanged;
|
||||
procedure subMemberChanged(sender : TObject);
|
||||
procedure setOptsColl(const aValue: TCollection);
|
||||
procedure setFname(const aValue: string);
|
||||
procedure setSrcs(const aValue: TStringList);
|
||||
procedure setConfIx(aValue: Integer);
|
||||
function getConfig(const ix: integer): TCompilerConfiguration;
|
||||
function getSrcs: TStringList;
|
||||
published
|
||||
property OptionsCollection: TCollection read fOptsColl write setOptsColl;
|
||||
property Sources: TStringList read fSrcs write setSrcs;
|
||||
property Sources: TStringList read fSrcs write setSrcs; // 'read' should return a copy to avoid abs/rel errors
|
||||
property ConfigurationIndex: Integer read fConfIx write setConfIx;
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
procedure reset;
|
||||
function getAbsoluteSourceName(const aIndex: integer): string;
|
||||
procedure addSource(const aFilename: string);
|
||||
function addConfiguration: TCompilerConfiguration;
|
||||
function getOpts: string;
|
||||
//
|
||||
property configuration[ix: integer]: TCompilerConfiguration read getConfig;
|
||||
property fileName: string read fFilename write setFname;
|
||||
property onChange: TNotifyEvent read fOnChange write fOnChange;
|
||||
end;
|
||||
|
||||
procedure saveCompToTxtFile(const aComp: TComponent; const aFilename: string);
|
||||
procedure loadCompFromTxtFile(const aComp: TComponent; const aFilename: string);
|
||||
function expandFilenameEx(const aBasePath, aFilename: string): string;
|
||||
function getModuleName(const aSource: TStrings): string;
|
||||
|
||||
implementation
|
||||
|
||||
(*****************************************************************************
|
||||
* Routines
|
||||
*)
|
||||
procedure saveCompToTxtFile(const aComp: TComponent; const aFilename: string);
|
||||
var
|
||||
str1, str2: TMemoryStream;
|
||||
begin
|
||||
str1 := TMemoryStream.Create;
|
||||
str2 := TMemoryStream.Create;
|
||||
try
|
||||
str1.WriteComponent(aComp);
|
||||
str1.Position := 0;
|
||||
ObjectBinaryToText(str1,str2);
|
||||
str2.SaveToFile(aFilename);
|
||||
finally
|
||||
str1.Free;
|
||||
str2.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure loadCompFromTxtFile(const aComp: TComponent; const aFilename: string);
|
||||
var
|
||||
str1, str2: TMemoryStream;
|
||||
begin
|
||||
str1 := TMemoryStream.Create;
|
||||
str2 := TMemoryStream.Create;
|
||||
try
|
||||
str1.LoadFromFile(aFilename);
|
||||
str1.Position := 0;
|
||||
ObjectTextToBinary(str1,str2);
|
||||
str2.Position := 0;
|
||||
str2.ReadComponent(aComp);
|
||||
finally
|
||||
str1.Free;
|
||||
str2.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function expandFilenameEx(const aBasePath, aFilename: string): string;
|
||||
var
|
||||
curr: string;
|
||||
begin
|
||||
curr := '';
|
||||
getDir(0,curr);
|
||||
try
|
||||
if curr <> aBasePath then
|
||||
chDir(aBasePath);
|
||||
result := expandFileName(aFilename);
|
||||
finally
|
||||
chDir(curr);
|
||||
end;
|
||||
end;
|
||||
|
||||
// TODO: comments handling
|
||||
function getModuleName(const aSource: TStrings): string;
|
||||
var
|
||||
ln: string;
|
||||
pos: NativeInt;
|
||||
id: string;
|
||||
tok: boolean;
|
||||
begin
|
||||
result := '';
|
||||
tok := false;
|
||||
for ln in aSource do
|
||||
begin
|
||||
pos := 1;
|
||||
id := '';
|
||||
|
||||
while(true) do
|
||||
begin
|
||||
if pos > length(ln) then
|
||||
break;
|
||||
|
||||
if ln[pos] in [#0..#32] then
|
||||
begin
|
||||
Inc(pos);
|
||||
id := '';
|
||||
continue;
|
||||
end;
|
||||
|
||||
if tok then if ln[pos] = ';'then
|
||||
begin
|
||||
result := id;
|
||||
exit;
|
||||
end;
|
||||
|
||||
id += ln[pos];
|
||||
Inc(pos);
|
||||
|
||||
if id = 'module' then
|
||||
begin
|
||||
tok := true;
|
||||
id := '';
|
||||
continue;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
(*****************************************************************************
|
||||
* TProject
|
||||
*)
|
||||
constructor TCEProject.create(aOwner: TComponent);
|
||||
var
|
||||
defConf: TCompilerConfiguration;
|
||||
begin
|
||||
inherited create(aOwner);
|
||||
fSrcs := TStringList.Create;
|
||||
fSrcsCop := TStringList.Create;
|
||||
fSrcs.OnChange := @subMemberChanged;
|
||||
fOptsColl := TCollection.create(TCompilerConfiguration);
|
||||
|
||||
defConf := addConfiguration;
|
||||
defConf.name := 'default';
|
||||
reset;
|
||||
end;
|
||||
|
||||
destructor TCEProject.destroy;
|
||||
begin
|
||||
fSrcs.free;
|
||||
fSrcsCop.Free;
|
||||
fOptsColl.free;
|
||||
inherited;
|
||||
end;
|
||||
|
@ -97,17 +212,42 @@ begin
|
|||
fOptsColl.Assign(aValue);
|
||||
end;
|
||||
|
||||
procedure TCEProject.addSource(const aFilename: string);
|
||||
var
|
||||
relSrc, absSrc: string;
|
||||
begin
|
||||
for relSrc in fSrcs do
|
||||
begin
|
||||
absSrc := expandFilenameEx(fBasePath,relsrc);
|
||||
if aFilename = absSrc then exit;
|
||||
end;
|
||||
fSrcs.Add(ExtractRelativepath(fBasePath,aFilename));
|
||||
end;
|
||||
|
||||
procedure TCEProject.setFname(const aValue: string);
|
||||
var
|
||||
oldAbs, newRel, oldBase: string;
|
||||
i: NativeInt;
|
||||
begin
|
||||
if fFilename = aValue then exit;
|
||||
fFilename := aValue;
|
||||
subMemberChanged(nil);
|
||||
oldBase := fBasePath;
|
||||
fBasePath := extractFilePath(fFilename);
|
||||
//
|
||||
for i:= 0 to fSrcs.Count-1 do
|
||||
begin
|
||||
oldAbs := expandFilenameEx(oldBase,fSrcs[i]);
|
||||
newRel := ExtractRelativepath(fBasePath, oldAbs);
|
||||
fSrcs[i] := newRel;
|
||||
end;
|
||||
//
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TCEProject.setSrcs(const aValue: TStringList);
|
||||
begin
|
||||
fSrcs.Assign(aValue);
|
||||
subMemberChanged(nil);
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TCEProject.setConfIx(aValue: Integer);
|
||||
|
@ -116,12 +256,19 @@ begin
|
|||
if aValue < 0 then aValue := 0;
|
||||
if aValue > fOptsColl.Count-1 then aValue := fOptsColl.Count-1;
|
||||
fConfIx := aValue;
|
||||
subMemberChanged(nil);
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TCEProject.subMemberChanged(sender : TObject);
|
||||
begin
|
||||
fModified := true;
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TCEProject.doChanged;
|
||||
begin
|
||||
fModified := true;
|
||||
if assigned(fOnChange) then fOnChange(Self);
|
||||
end;
|
||||
|
||||
function TCEProject.getConfig(const ix: integer): TCompilerConfiguration;
|
||||
|
@ -129,5 +276,59 @@ begin
|
|||
result := TCompilerConfiguration(fOptsColl.Items[ix]);
|
||||
end;
|
||||
|
||||
function TCEProject.getSrcs: TStringList;
|
||||
var
|
||||
str: TMemoryStream;
|
||||
begin
|
||||
if not (csReading in componentState) or (csWriting in componentState) then
|
||||
begin
|
||||
str := TMemoryStream.Create;
|
||||
try
|
||||
fSrcs.SaveToStream(str);
|
||||
str.Position:=0;
|
||||
fSrcsCop.Clear;
|
||||
fSrcsCop.LoadFromStream(str);
|
||||
finally
|
||||
str.Free;
|
||||
end;
|
||||
result := fSrcsCop;
|
||||
end
|
||||
else result := fSrcs;
|
||||
end;
|
||||
|
||||
procedure TCEProject.reset;
|
||||
var
|
||||
defConf: TCompilerConfiguration;
|
||||
begin
|
||||
fOptsColl.Clear;
|
||||
defConf := addConfiguration;
|
||||
defConf.name := 'default';
|
||||
fSrcs.Clear;
|
||||
fFilename := '';
|
||||
fModified := true;
|
||||
fConfIx := 0;
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
function TCEProject.getOpts: string;
|
||||
var
|
||||
rel, abs: string;
|
||||
begin
|
||||
result := '';
|
||||
for rel in fSrcs do
|
||||
begin
|
||||
abs := expandFilenameEx(fBasePath,rel);
|
||||
result += '"' + abs + '"';
|
||||
end;
|
||||
result += TCompilerConfiguration(fOptsColl.Items[fConfIx]).getOpts;
|
||||
end;
|
||||
|
||||
function TCEProject.getAbsoluteSourceName(const aIndex: integer): string;
|
||||
begin
|
||||
if aIndex < 0 then exit;
|
||||
if aIndex > fSrcs.Count-1 then exit;
|
||||
result := expandFileNameEx(fBasePath,fSrcs.Strings[aIndex]);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ type
|
|||
public
|
||||
constructor create(aCollection: TCollection); override;
|
||||
destructor destroy; override;
|
||||
property cmdLine: string read getCmdLine;
|
||||
property getOpts: string read getCmdLine;
|
||||
property onChanged: TNotifyEvent read fOnChanged write fOnChanged;
|
||||
end;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ inherited CEEditorWidget: TCEEditorWidget
|
|||
ClientWidth = 477
|
||||
object PageControl: TExtendedNotebook[0]
|
||||
Left = 2
|
||||
Height = 483
|
||||
Height = 460
|
||||
Top = 2
|
||||
Width = 473
|
||||
Align = alClient
|
||||
|
@ -28,6 +28,23 @@ inherited CEEditorWidget: TCEEditorWidget
|
|||
TabOrder = 0
|
||||
OnChange = PageControlChange
|
||||
end
|
||||
object editorStatus: TStatusBar[1]
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 464
|
||||
Width = 477
|
||||
Panels = <
|
||||
item
|
||||
Width = 100
|
||||
end
|
||||
item
|
||||
Width = 150
|
||||
end
|
||||
item
|
||||
Width = 200
|
||||
end>
|
||||
SimplePanel = False
|
||||
end
|
||||
end
|
||||
inherited Header: TPanel
|
||||
Width = 481
|
||||
|
@ -75,4 +92,7 @@ inherited CEEditorWidget: TCEEditorWidget
|
|||
0000000000000000000000000000
|
||||
}
|
||||
end
|
||||
object ApplicationProperties1: TApplicationProperties[3]
|
||||
left = 64
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,20 +6,28 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, ExtendedNotebook, Forms, Controls, Graphics,
|
||||
SynEditKeyCmds, ComCtrls, SynEditHighlighter, SynEditHighlighterFoldBase, SynMacroRecorder,
|
||||
SynPluginSyncroEdit, SynEdit, Dialogs, ExtCtrls, ce_widget, ce_d2syn, ce_synmemo;
|
||||
SynEditKeyCmds, ComCtrls, SynEditHighlighter, SynEditHighlighterFoldBase,
|
||||
SynMacroRecorder, SynPluginSyncroEdit, SynEdit, Dialogs, ExtCtrls, ce_widget,
|
||||
ce_d2syn, ce_synmemo, ce_common;
|
||||
|
||||
type
|
||||
{ TCEEditorWidget }
|
||||
TCEEditorWidget = class(TCEWidget)
|
||||
ApplicationProperties1: TApplicationProperties;
|
||||
imgList: TImageList;
|
||||
PageControl: TExtendedNotebook;
|
||||
macRecorder: TSynMacroRecorder;
|
||||
editorStatus: TStatusBar;
|
||||
procedure PageControlChange(Sender: TObject);
|
||||
protected
|
||||
procedure UpdaterProc; override;
|
||||
private
|
||||
// a TSynPluginSyncroEdit cannot be created from design(comp streaming err.)
|
||||
// http://bugs.freepascal.org/view.php?id=26329
|
||||
fSyncEdit: TSynPluginSyncroEdit;
|
||||
procedure focusedEditorChanged;
|
||||
procedure memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure memoChange(Sender: TObject);
|
||||
function getCurrentEditor: TCESynMemo;
|
||||
function getEditor(index: NativeInt): TCESynMemo;
|
||||
function getEditorCount: NativeInt;
|
||||
|
@ -30,9 +38,6 @@ type
|
|||
destructor destroy; override;
|
||||
procedure addEditor;
|
||||
//
|
||||
procedure memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
//
|
||||
property currentEditor: TCESynMemo read getCurrentEditor;
|
||||
property editor[index: NativeInt]: TCESynMemo read getEditor;
|
||||
property editorCount: NativeInt read getEditorCount;
|
||||
|
@ -85,9 +90,16 @@ begin
|
|||
end;
|
||||
|
||||
procedure TCEEditorWidget.focusedEditorChanged;
|
||||
var
|
||||
curr: TCESynMemo;
|
||||
md: string;
|
||||
begin
|
||||
macRecorder.Editor := getCurrentEditor;
|
||||
fSyncEdit.Editor := getCurrentEditor;
|
||||
curr := getCurrentEditor;
|
||||
macRecorder.Editor := curr;
|
||||
fSyncEdit.Editor := curr;
|
||||
identifierToD2Syn(curr);
|
||||
md := getModuleName(curr.Lines);
|
||||
pageControl.ActivePage.Caption := md;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.PageControlChange(Sender: TObject);
|
||||
|
@ -101,6 +113,7 @@ var
|
|||
sheet: TTabSheet;
|
||||
memo: TCESynMemo;
|
||||
begin
|
||||
fNeedUpdate := true;
|
||||
sheet := pageControl.AddTabSheet;
|
||||
memo := TCESynMemo.Create(sheet);
|
||||
//
|
||||
|
@ -110,6 +123,7 @@ begin
|
|||
memo.OnKeyDown := @memoKeyDown;
|
||||
memo.OnKeyUp := @memoKeyDown;
|
||||
memo.OnMouseDown := @memoMouseDown;
|
||||
memo.OnChange := @memoChange;
|
||||
//
|
||||
//http://bugs.freepascal.org/view.php?id=26320
|
||||
focusedEditorChanged;
|
||||
|
@ -122,16 +136,41 @@ end;
|
|||
|
||||
procedure TCEEditorWidget.memoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
fNeedUpdate := true;
|
||||
if (sender is TCESynMemo) then
|
||||
identifierToD2Syn(TCESynMemo(Sender));
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.memoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
fNeedUpdate := true;
|
||||
if (sender is TCESynMemo) then
|
||||
identifierToD2Syn(TCESynMemo(Sender));
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.memoChange(Sender: TObject);
|
||||
var
|
||||
ed: TCESynMemo;
|
||||
begin
|
||||
fNeedUpdate := true;
|
||||
ed := TCESynMemo(sender);
|
||||
ed.modified := true;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.UpdaterProc;
|
||||
const
|
||||
modstr: array[boolean] of string = ('...','MODIFIED');
|
||||
var
|
||||
ed: TCESynMemo;
|
||||
begin
|
||||
ed := getCurrentEditor;
|
||||
if ed <> nil then
|
||||
begin
|
||||
editorStatus.Panels[0].Text := format('%d : %d',[ed.CaretY, ed.CaretX]);
|
||||
editorStatus.Panels[1].Text := modstr[ed.modified];
|
||||
editorStatus.Panels[2].Text := ed.fileName;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@ object CEMainForm: TCEMainForm
|
|||
object MenuItem4: TMenuItem
|
||||
Action = actSaveFile
|
||||
end
|
||||
object MenuItem25: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MenuItem26: TMenuItem
|
||||
Action = actAddCurrToProj
|
||||
end
|
||||
end
|
||||
object MenuItem7: TMenuItem
|
||||
Caption = 'Edit'
|
||||
|
@ -60,6 +66,21 @@ object CEMainForm: TCEMainForm
|
|||
end
|
||||
object MenuItem14: TMenuItem
|
||||
Caption = 'Project'
|
||||
object MenuItem31: TMenuItem
|
||||
Action = actNewProj
|
||||
end
|
||||
object MenuItem30: TMenuItem
|
||||
Action = actOpenProj
|
||||
end
|
||||
object MenuItem29: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MenuItem27: TMenuItem
|
||||
Action = actSaveProj
|
||||
end
|
||||
object MenuItem28: TMenuItem
|
||||
Action = actSaveProjAs
|
||||
end
|
||||
end
|
||||
object MenuItem8: TMenuItem
|
||||
Caption = 'Run'
|
||||
|
@ -94,9 +115,10 @@ object CEMainForm: TCEMainForm
|
|||
OnExecute = actCopyExecute
|
||||
ShortCut = 16451
|
||||
end
|
||||
object Action3: TAction
|
||||
object actSaveProj: TAction
|
||||
Category = 'Project'
|
||||
Caption = 'Action3'
|
||||
Caption = 'Save project'
|
||||
OnExecute = actSaveProjExecute
|
||||
end
|
||||
object Action4: TAction
|
||||
Category = 'Windows'
|
||||
|
@ -135,9 +157,10 @@ object CEMainForm: TCEMainForm
|
|||
Category = 'Run'
|
||||
Caption = 'Compile and run project'
|
||||
end
|
||||
object Action1: TAction
|
||||
object actSaveProjAs: TAction
|
||||
Category = 'Project'
|
||||
Caption = 'Action1'
|
||||
Caption = 'Save project as...'
|
||||
OnExecute = actSaveProjAsExecute
|
||||
end
|
||||
object actPaste: TAction
|
||||
Category = 'Edit'
|
||||
|
@ -180,6 +203,21 @@ object CEMainForm: TCEMainForm
|
|||
Caption = 'New runnable module'
|
||||
OnExecute = actNewRunnableExecute
|
||||
end
|
||||
object actAddCurrToProj: TAction
|
||||
Category = 'File'
|
||||
Caption = 'Add file to project'
|
||||
OnExecute = actAddCurrToProjExecute
|
||||
end
|
||||
object actOpenProj: TAction
|
||||
Category = 'Project'
|
||||
Caption = 'Open project...'
|
||||
OnExecute = actOpenProjExecute
|
||||
end
|
||||
object actNewProj: TAction
|
||||
Category = 'Project'
|
||||
Caption = 'New project'
|
||||
OnExecute = actNewProjExecute
|
||||
end
|
||||
end
|
||||
object imgList: TImageList
|
||||
left = 64
|
||||
|
|
180
src/ce_main.pas
180
src/ce_main.pas
|
@ -17,8 +17,11 @@ type
|
|||
actCompileProj: TAction;
|
||||
ActCompileAndRunProj: TAction;
|
||||
ActCompAndRunFileWithArgs: TAction;
|
||||
Action1: TAction;
|
||||
actNewProj: TAction;
|
||||
actOpenProj: TAction;
|
||||
actSaveProjAs: TAction;
|
||||
actCut: TAction;
|
||||
actAddCurrToProj: TAction;
|
||||
actNewRunnable: TAction;
|
||||
actMacPlay: TAction;
|
||||
actMacStartStop: TAction;
|
||||
|
@ -30,7 +33,7 @@ type
|
|||
actSaveFileAs: TAction;
|
||||
actSaveFile: TAction;
|
||||
actCopy: TAction;
|
||||
Action3: TAction;
|
||||
actSaveProj: TAction;
|
||||
Action4: TAction;
|
||||
Actions: TActionList;
|
||||
imgList: TImageList;
|
||||
|
@ -52,13 +55,21 @@ type
|
|||
MenuItem22: TMenuItem;
|
||||
MenuItem23: TMenuItem;
|
||||
MenuItem24: TMenuItem;
|
||||
MenuItem25: TMenuItem;
|
||||
MenuItem26: TMenuItem;
|
||||
MenuItem27: TMenuItem;
|
||||
MenuItem28: TMenuItem;
|
||||
MenuItem29: TMenuItem;
|
||||
MenuItem3: TMenuItem;
|
||||
MenuItem30: TMenuItem;
|
||||
MenuItem31: TMenuItem;
|
||||
MenuItem4: TMenuItem;
|
||||
MenuItem5: TMenuItem;
|
||||
MenuItem6: TMenuItem;
|
||||
MenuItem7: TMenuItem;
|
||||
MenuItem8: TMenuItem;
|
||||
MenuItem9: TMenuItem;
|
||||
procedure actAddCurrToProjExecute(Sender: TObject);
|
||||
procedure actCompAndRunFileExecute(Sender: TObject);
|
||||
procedure ActCompAndRunFileWithArgsExecute(Sender: TObject);
|
||||
procedure actCopyExecute(Sender: TObject);
|
||||
|
@ -67,12 +78,16 @@ type
|
|||
procedure actMacPlayExecute(Sender: TObject);
|
||||
procedure actMacStartStopExecute(Sender: TObject);
|
||||
procedure actNewFileExecute(Sender: TObject);
|
||||
procedure actNewProjExecute(Sender: TObject);
|
||||
procedure actNewRunnableExecute(Sender: TObject);
|
||||
procedure actOpenFileExecute(Sender: TObject);
|
||||
procedure actOpenProjExecute(Sender: TObject);
|
||||
procedure actPasteExecute(Sender: TObject);
|
||||
procedure actRedoExecute(Sender: TObject);
|
||||
procedure actSaveFileAsExecute(Sender: TObject);
|
||||
procedure actSaveFileExecute(Sender: TObject);
|
||||
procedure actSaveProjAsExecute(Sender: TObject);
|
||||
procedure actSaveProjExecute(Sender: TObject);
|
||||
procedure actUndoExecute(Sender: TObject);
|
||||
private
|
||||
fProject: TCEProject;
|
||||
|
@ -80,20 +95,35 @@ type
|
|||
fMesgWidg: TCEMessagesWidget;
|
||||
fEditWidg: TCEEditorWidget;
|
||||
fProjWidg: TCEProjectWidget;
|
||||
//
|
||||
|
||||
// widget interfaces subroutines
|
||||
procedure checkWidgetActions(const aWidget: TCEWidget);
|
||||
|
||||
// run & exec sub routines
|
||||
procedure ProcessOutputToMsg(const aProcess: TProcess);
|
||||
//
|
||||
procedure compileAndRunFile(const edIndex: NativeInt; const runArgs: string = '');
|
||||
|
||||
// file sub routines
|
||||
procedure newFile;
|
||||
function findFile(const aFilename: string): NativeInt;
|
||||
procedure openFile(const aFilename: string);
|
||||
procedure saveFile(const edIndex: NativeInt);
|
||||
procedure saveFileAs(const edIndex: NativeInt; const aFilename: string);
|
||||
//
|
||||
procedure compileAndRunFile(const edIndex: NativeInt; const runArgs: string = '');
|
||||
|
||||
// project sub routines
|
||||
procedure projChange(sender: TObject);
|
||||
procedure newProj;
|
||||
procedure saveProj;
|
||||
procedure saveProjAs(const aFilename: string);
|
||||
procedure openProj(const aFilename: string);
|
||||
procedure closeProj;
|
||||
procedure addSource(const aFilename: string);
|
||||
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
//
|
||||
procedure openFile(const aFilename: string);
|
||||
//
|
||||
property WidgetList: TCEWidgetList read fWidgList;
|
||||
property MessageWidget: TCEMessagesWidget read fMesgWidg;
|
||||
property EditWidget: TCEEditorWidget read fEditWidg;
|
||||
|
@ -123,12 +153,15 @@ begin
|
|||
fWidgList.addWidget(@fEditWidg);
|
||||
fWidgList.addWidget(@fProjWidg);
|
||||
|
||||
checkWidgetActions(fMesgWidg);
|
||||
|
||||
fMesgWidg.Show;
|
||||
fEditWidg.Show;
|
||||
fProjWidg.Show;
|
||||
|
||||
fProject := TCEProject.Create(self);
|
||||
fProjWidg.project := fProject;
|
||||
fProject.onChange := @projChange;
|
||||
|
||||
end;
|
||||
|
||||
destructor TCEMainForm.destroy;
|
||||
|
@ -165,6 +198,7 @@ begin
|
|||
//
|
||||
actSaveFile.Enabled := true;
|
||||
actSaveFileAs.Enabled := true;
|
||||
actAddCurrToProj.Enabled := true;
|
||||
end
|
||||
else begin
|
||||
actCopy.Enabled := false;
|
||||
|
@ -180,6 +214,30 @@ begin
|
|||
//
|
||||
actSaveFile.Enabled := false;
|
||||
actSaveFileAs.Enabled := false;
|
||||
actAddCurrToProj.Enabled := false;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.checkWidgetActions(const aWidget: TCEWidget);
|
||||
var
|
||||
tlt: string;
|
||||
cnt, i: NativeInt;
|
||||
prt, itm: TMenuItem;
|
||||
begin
|
||||
tlt := aWidget.contextName;
|
||||
if tlt = '' then exit;
|
||||
cnt := aWidget.contextActionCount;
|
||||
if cnt = 0 then exit;
|
||||
//
|
||||
prt := TMenuItem.Create(self);
|
||||
prt.Caption := tlt;
|
||||
mainMenu.Items.Add(prt);
|
||||
for i := 0 to cnt-1 do
|
||||
begin
|
||||
itm := TMenuItem.Create(self);
|
||||
itm.Action := aWidget.contextAction(i);
|
||||
prt.Add(itm);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
@ -188,20 +246,20 @@ end;
|
|||
{$REGION file ******************************************************************}
|
||||
procedure TCEMainForm.newFile;
|
||||
var
|
||||
i: NativeInt;
|
||||
i, j: NativeInt;
|
||||
str: string;
|
||||
begin
|
||||
if fEditWidg = nil then exit;
|
||||
//
|
||||
i := fEditWidg.editorCount;
|
||||
fEditWidg.addEditor;
|
||||
i := 0;
|
||||
j := 0;
|
||||
while(true) do
|
||||
begin
|
||||
str := format('<new %d>',[i]);
|
||||
str := format('<new %d>',[j]);
|
||||
if findFile(str) = -1 then break;
|
||||
if i >= high(NativeInt) then break;
|
||||
i += 1;
|
||||
if j >= high(NativeInt) then break;
|
||||
j += 1;
|
||||
end;
|
||||
fEditWidg.editor[i].fileName := str;
|
||||
fEditWidg.editor[i].modified := true;
|
||||
|
@ -215,11 +273,7 @@ begin
|
|||
result := -1;
|
||||
if fEditWidg = nil then exit;
|
||||
for i := 0 to fEditWidg.editorCount-1 do
|
||||
if fEditWidg.editor[i].fileName = aFilename then
|
||||
begin
|
||||
result := i;
|
||||
exit;
|
||||
end;
|
||||
if fEditWidg.editor[i].fileName = aFilename then exit(i);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.openFile(const aFilename: string);
|
||||
|
@ -237,6 +291,7 @@ begin
|
|||
i := fEditWidg.editorCount;
|
||||
fEditWidg.addEditor;
|
||||
fEditWidg.editor[i].Lines.LoadFromFile(aFilename);
|
||||
fEditWidg.editor[i].fileName := aFilename;
|
||||
fEditWidg.PageControl.PageIndex := i;
|
||||
end;
|
||||
|
||||
|
@ -302,7 +357,7 @@ begin
|
|||
'{' + #13#10 +
|
||||
' writeln("runnable module is just a `toy feature`");' + #13#10 +
|
||||
' writeln;' + #13#10 +
|
||||
' writeln("coedit just saves a temporar d module before compiling it and running it...");' + #13#10 +
|
||||
' writeln("coedit just saves a temporary d module before compiling it and running it...");' + #13#10 +
|
||||
'}' + #13#10;
|
||||
end;
|
||||
|
||||
|
@ -333,6 +388,17 @@ begin
|
|||
if fileExists(str) then saveFile(fEditWidg.editorIndex)
|
||||
else actSaveFileAs.Execute;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actAddCurrToProjExecute(Sender: TObject);
|
||||
var
|
||||
str: string;
|
||||
begin
|
||||
if fEditWidg = nil then exit;
|
||||
if fEditWidg.editorIndex < 0 then exit;
|
||||
//
|
||||
str := fEditWidg.editor[fEditWidg.editorIndex].fileName;
|
||||
fProject.addSource(str);
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION edit ******************************************************************}
|
||||
|
@ -442,7 +508,7 @@ begin
|
|||
dmdproc := TProcess.Create(nil);
|
||||
runproc := TProcess.Create(nil);
|
||||
try
|
||||
temppath := '';
|
||||
temppath := GetTempDir;
|
||||
{$IFDEF DEBUG}{$WARNINGS OFF}{$HINTS OFF}{$ENDIF}
|
||||
fname := temppath + format('temp_%.8x',[LongWord(@dmdproc)]);
|
||||
{$IFDEF DEBUG}{$WARNINGS ON}{$HINTS ON}{$ENDIF}
|
||||
|
@ -508,4 +574,78 @@ end;
|
|||
{$REGION view ******************************************************************}
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION project ***************************************************************}
|
||||
procedure TCEMainForm.projChange(sender: TObject);
|
||||
var
|
||||
i: NativeInt;
|
||||
begin
|
||||
for i:= 0 to WidgetList.Count-1 do
|
||||
widgetList.widget[i].projChange(fProject);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.newProj;
|
||||
begin
|
||||
fProject.reset;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.saveProj;
|
||||
begin
|
||||
saveCompToTxtFile(fProject, fProject.fileName);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.saveProjAs(const aFilename: string);
|
||||
begin
|
||||
fProject.fileName := aFilename;
|
||||
saveCompToTxtFile(fProject, aFilename);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.openProj(const aFilename: string);
|
||||
begin
|
||||
newProj;
|
||||
fProject.fileName := aFilename;
|
||||
loadCompFromTxtFile(fProject, aFilename);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.closeProj;
|
||||
begin
|
||||
newProj;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actNewProjExecute(Sender: TObject);
|
||||
begin
|
||||
closeProj;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.addSource(const aFilename: string);
|
||||
begin
|
||||
if fProject.Sources.IndexOf(aFilename) >= 0 then exit;
|
||||
fProject.addSource(aFilename);
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actSaveProjAsExecute(Sender: TObject);
|
||||
begin
|
||||
with TSaveDialog.Create(nil) do
|
||||
try
|
||||
if execute then saveProjAs(filename);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actSaveProjExecute(Sender: TObject);
|
||||
begin
|
||||
if fProject.fileName <> '' then saveProj
|
||||
else actSaveProjAs.Execute;
|
||||
end;
|
||||
|
||||
procedure TCEMainForm.actOpenProjExecute(Sender: TObject);
|
||||
begin
|
||||
with TOpenDialog.Create(nil) do
|
||||
try
|
||||
if execute then openProj(filename);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
end.
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
inherited CEMessagesWidget: TCEMessagesWidget
|
||||
Left = 1249
|
||||
Left = 1248
|
||||
Height = 186
|
||||
Top = 643
|
||||
Width = 656
|
||||
Width = 657
|
||||
Caption = 'MessagesWidget'
|
||||
ClientHeight = 186
|
||||
ClientWidth = 656
|
||||
ClientWidth = 657
|
||||
inherited Back: TPanel
|
||||
Height = 186
|
||||
Width = 656
|
||||
Width = 657
|
||||
ClientHeight = 186
|
||||
ClientWidth = 656
|
||||
ClientWidth = 657
|
||||
inherited Content: TScrollBox
|
||||
Height = 160
|
||||
Width = 656
|
||||
HorzScrollBar.Page = 652
|
||||
Width = 657
|
||||
HorzScrollBar.Page = 653
|
||||
VertScrollBar.Page = 156
|
||||
ClientHeight = 156
|
||||
ClientWidth = 652
|
||||
ClientWidth = 653
|
||||
object List: TListView[0]
|
||||
Left = 2
|
||||
Height = 152
|
||||
Top = 2
|
||||
Width = 648
|
||||
Width = 649
|
||||
Align = alClient
|
||||
AutoSort = False
|
||||
AutoWidthLastColumn = True
|
||||
BorderSpacing.Around = 2
|
||||
Columns = <
|
||||
item
|
||||
Width = 644
|
||||
Width = 645
|
||||
end>
|
||||
GridLines = True
|
||||
IconOptions.Arrangement = iaLeft
|
||||
|
@ -40,7 +40,108 @@ inherited CEMessagesWidget: TCEMessagesWidget
|
|||
end
|
||||
end
|
||||
inherited Header: TPanel
|
||||
Width = 656
|
||||
Width = 657
|
||||
end
|
||||
end
|
||||
object imgList: TImageList[1]
|
||||
Bitmap = {
|
||||
4C69030000001000000010000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF003B85CC003B85CC003B85CC003B85CC003B85
|
||||
CC003B85CC003983CA213384CDFF3384CDFF3983CA213B85CC003B85CC003B85
|
||||
CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85
|
||||
CC003983CB00337EC7CF84C3F1FF84C3F1FF337EC7CF3983CB003B85CC003B85
|
||||
CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003A84
|
||||
CB003580CA6D5398D7FFC1F0FFFFC1F0FFFF5398D7FF3580CA6D3A84CB003B85
|
||||
CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003882
|
||||
CA0A3A83CBFFB2E5FFFF9EC8DEFF9EC8DEFFB2E5FFFF3A83CBFF3882CA0A3B85
|
||||
CC003B85CC003B85CC003B85CC003B85CC003B85CC003B85CC003983CB00337E
|
||||
C8CF86BEEAFFA4ECFFFF6C5D53FF6C5D53FFA4ECFFFF86BEEAFF337EC8CF3983
|
||||
CB003B85CC003B85CC003B85CC003B85CC003B85CC003A84CC003580C9585797
|
||||
D5FFC6F3FFFF3ACAFFFF6C5B54FF6C5B54FF3ACAFFFFC6F3FFFF5797D5FF3580
|
||||
C9583A84CC003B85CC003B85CC003B85CC003B85CC003882CA003C82C9FFC1E8
|
||||
FDFF50CCFFFF27C5FFFF69554CFF69554CFF27C5FFFF50CCFFFFC1E8FDFF3C82
|
||||
C9FF3882CA003B85CC003B85CC003B85CC003983CB00337EC8BB90BFE6FF6FD7
|
||||
FFFF32C3FFFF34CBFFFF644B3FFF644B3FFF34CBFFFF32C3FFFF6FD7FFFF90BF
|
||||
E6FF337EC8BB3983CB003B85CC003A84CC003680C9445B97D4FF9EE8FFFF38C7
|
||||
FFFF3DC8FFFF3DCFFFFF4BBCE9FF4BBCE9FF3DCFFFFF3DC8FFFF38C7FFFF9EE8
|
||||
FFFF5B97D4FF3680C9443A84CC003982CB003F82C9FFA3E0FAFF40CFFFFF44CE
|
||||
FFFF46CFFFFF44D6FFFF775C50FF775C50FF44D6FFFF46CFFFFF44CEFFFF40CF
|
||||
FFFFA3E0FAFF3F82C9FF3982CB003880C9947AB8E4FF52DBFFFF4BD5FFFF4DD5
|
||||
FFFF4DD6FFFF4BDCFFFF67493FFF67493FFF4BDCFFFF4DD6FFFF4DD5FFFF4BD5
|
||||
FFFF52DBFFFF7AB8E4FF3880C9943B86CDFF55E3FFFF55E3FFFF56E1FFFF56E1
|
||||
FFFF56E2FFFF56E5FFFF55E9FFFF55E9FFFF56E5FFFF56E2FFFF56E1FFFF56E1
|
||||
FFFF55E3FFFF55E3FFFF3B86CDFF3A82CAFF397FC8FF387DC7FF387CC7FF397C
|
||||
C7FF397CC7FF387DC7FF387EC9FF387EC9FF387DC7FF397CC7FF397CC7FF387C
|
||||
C7FF387DC7FF397FC8FF3A82CAFF000000330000003300000033000000330000
|
||||
0033000000330000003300000033000000330000003300000033000000330000
|
||||
0033000000330000003300000033FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
|
||||
000000000000000000001B73A8FF000000000000000000000000000000000000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000000000
|
||||
000000000000186EA4FFD0F9FFFF186EA3FF0000000000000000000000000000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000000000
|
||||
00001B6FA3FF83DCFFFF16B2FFFF82DBFFFF1A6EA2FF00000000000000000000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000001B6F
|
||||
A3FF52B8F1FF22B9FFFF23BAFFFF21B8FFFF81DDFFFF1A6DA2FF000000000000
|
||||
00000000000000000000FFFFFF000000000000000000000000001A6EA2FF7EDF
|
||||
FFFF29BBFFFF2AC0FFFF3B1707FF2AC0FFFF27BAFFFF7DDEFFFF1A6DA2FF0000
|
||||
00000000000000000000FFFFFF0000000000000000001A6DA2FF7CDFFFFF2CBD
|
||||
FFFF2FBEFFFF2FC7FFFF452619FF2FC6FFFF2EBEFFFF2CBDFFFF7CDFFFFF1A6D
|
||||
A2FF0000000000000000FFFFFF0000000000196DA3FF78E0FFFF32C1FFFF34C0
|
||||
FFFF35C2FFFF34CBFFFF503024FF34CBFFFF35C2FFFF34C0FFFF32C1FFFF78E0
|
||||
FFFF196DA3FF00000000FFFFFF001C73A8FF9BF5FFFF36C8FFFF39C4FFFF3BC4
|
||||
FFFF3BC6FFFF39CEFFFF5A3A2DFF39CEFFFF3BC6FFFF3BC4FFFF39C4FFFF36C8
|
||||
FFFF9BF5FFFF1C73A8FFFFFFFF0000000033196DA3FF6FE2FFFF3ECCFFFF3FC9
|
||||
FFFF3FCAFFFF3DD1FFFF654233FF3DD1FFFF3FCAFFFF3FC9FFFF3ECCFFFF6FE2
|
||||
FFFF196DA3FF00000033FFFFFF0000000000000000331B6DA3FF4EC1F0FF44D1
|
||||
FFFF44CEFFFF44D4FFFF3AA1CAFF44D4FFFF44CEFFFF44D0FFFF4EC1F0FF1B6D
|
||||
A3FF0000003300000000FFFFFF000000000000000000000000331B6DA3FF6AE6
|
||||
FFFF4BD5FFFF4AD7FFFF471D11FF49D6FFFF4AD4FFFF6AE5FFFF1B6DA3FF0000
|
||||
00330000000000000000FFFFFF00000000000000000000000000000000331B6D
|
||||
A3FF4DC4F0FF4FDBFFFF4DDAFFFF4EDAFFFF66E6FFFF1A6CA2FF000000330000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000000000
|
||||
00331B6DA3FF63E8FFFF55E0FFFF63E7FFFF1A6CA2FF00000033000000000000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000000000
|
||||
0000000000331B6DA4FF66F0FFFF1B6DA3FF0000003300000000000000000000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000000000
|
||||
000000000000000000331E73A8FF000000330000000000000000000000000000
|
||||
00000000000000000000FFFFFF00000000000000000000000000000000000000
|
||||
0000000000000000000000000033000000000000000000000000000000000000
|
||||
00000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00D898
|
||||
5223D4964D7DD2924CDBCD8C45F3CB8B41F3C98B40DBC78B407DC5873D23FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00D6974F53D191
|
||||
49E6D0A06AFFE0BFA0FFE3C5AEFFE3C5AEFFDFBC9FFFC89762FFBD7D35E6BC7E
|
||||
3553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00D4964D53CF8D47F4D9B2
|
||||
8CFFE6CDB8FFE0BA9DFFD7AB85FFD6A982FFD9B391FFE1C2ABFFD4AE86FFB16B
|
||||
35F4B16F3553FFFFFF00FFFFFF00FFFFFF00D2934C22CE8E47E5D9B28CFFE6CA
|
||||
B3FFD6A97DFFD1A579FFE2C4A8FFE1C3A8FFD0A276FFD1A477FFDDBDA2FFD0AC
|
||||
85FFAB6635E5A9653522FFFFFF00FFFFFF00CE91477ECD9C68FFE7CBB4FFD4A5
|
||||
7AFFD0A077FFCF9E74FFFBF8F5FFFBF8F5FFCB9E71FFCB9D71FFCDA177FFDFC0
|
||||
A5FFB98A5BFFA45C347EFFFFFF00FFFFFF00CB8E41DBE0BC9FFFDBB393FFCFA0
|
||||
75FFCD9E72FFCB9C71FFDDBFA3FFDDBFA2FFC5996BFFC5996BFFC4986BFFD1AB
|
||||
85FFD8BA97FF9E5635DBFFFFFF00FFFFFF00C5853BF6E4C9B0FFD0A37AFFCC9D
|
||||
71FFC79A6CFFC5986BFFFFFFFFFFFFFFFEFFC39669FFC19468FFC29468FFC398
|
||||
6DFFDFC5ABFF955334F6FFFFFF00FFFFFF00BF7E35F6E3C7AFFFD0A276FFC599
|
||||
6BFFC4976AFFC49669FFEEE0D4FFFBF7F4FFBF9066FFBE8F65FFBE8F64FFBE92
|
||||
69FFDFC6AAFF925034F6FFFFFF00FFFFFF00BC7E35DBDBBC9CFFD5AD89FFC798
|
||||
6CFFC39569FFC19367FFEDDFD3FFFAF7F4FFBB8B63FFB98A63FFB88A62FFC59D
|
||||
78FFD2B893FF905135DBFFFFFF00FFFFFF00B878357EBF915EFFE0C2A8FFC596
|
||||
6CFFC29169FFE1CBB8FFFEFDFCFFFFFFFEFFEADCD0FFB4855EFFB3855EFFD4B5
|
||||
99FFAE7B56FF8F51357EFFFFFF00FFFFFF00AF703522AB6935E5CFAA81FFDABC
|
||||
A2FFBE9166FFBA8C62FFB7895FFFB3845EFFB1835DFFB0835CFFCDAA8DFFC6A5
|
||||
79FF895034E589503522FFFFFF00FFFFFF00FFFFFF00A76234539F5533F4CBA7
|
||||
7DFFD8BB9FFFC39C77FFB68A62FFB48660FFBE9672FFD1B397FFC5A377FF844F
|
||||
35F489503553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF009F5634539955
|
||||
34E6B28057FFD5B793FFDBC3A6FFDAC3A6FFD2B490FFAB7A52FF864F34E68850
|
||||
3553FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF009754
|
||||
35239453347D925234DB8A5034F3884F34F3895035DB8950357D84503623FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,22 +6,28 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
|
||||
ExtCtrls, ComCtrls, ce_widget, ce_common;
|
||||
ExtCtrls, ComCtrls, ce_widget, ActnList;
|
||||
|
||||
type
|
||||
|
||||
{ TCEMessagesWidget }
|
||||
TCEMessagesWidget = class(TCEWidget,ICEMultiDocMonitor)
|
||||
TCEMessagesWidget = class(TCEWidget)
|
||||
imgList: TImageList;
|
||||
List: TListView;
|
||||
private
|
||||
fActClear: TAction;
|
||||
fActSaveMsg: TAction;
|
||||
procedure actClearExecute(Sender: TObject);
|
||||
procedure actSaveMsgExecute(Sender: TObject);
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
//
|
||||
procedure addMessage(const aMsg: string);
|
||||
//
|
||||
procedure docChange(const aNewIndex: integer);
|
||||
procedure docClose(const aNewIndex: integer);
|
||||
function contextName: string; override;
|
||||
function contextActionCount: integer; override;
|
||||
function contextAction(index: integer): TAction; override;
|
||||
end;
|
||||
|
||||
PTCEMessageItem = ^TCEMessageItem;
|
||||
|
@ -38,6 +44,13 @@ constructor TCEMessagesWidget.create(aOwner: TComponent);
|
|||
begin
|
||||
inherited;
|
||||
fID := 'ID_MSGS';
|
||||
//
|
||||
fActClear := TAction.Create(self);
|
||||
fActClear.OnExecute := @actClearExecute;
|
||||
fActClear.caption := 'Clear messages';
|
||||
fActSaveMsg := TAction.Create(self);
|
||||
fActSaveMsg.OnExecute := @actSaveMsgExecute;
|
||||
fActSaveMsg.caption := 'Save messages to...';
|
||||
end;
|
||||
|
||||
destructor TCEMessagesWidget.destroy;
|
||||
|
@ -55,15 +68,50 @@ begin
|
|||
List.Items.AddItem(item);
|
||||
end;
|
||||
|
||||
procedure TCEMessagesWidget.docChange(const aNewIndex: integer);
|
||||
function TCEMessagesWidget.contextName: string;
|
||||
begin
|
||||
// can grow the list...
|
||||
// can display matching msgs from a list...
|
||||
result := 'Messages';
|
||||
end;
|
||||
|
||||
procedure TCEMessagesWidget.docClose(const aNewIndex: integer);
|
||||
function TCEMessagesWidget.contextActionCount: integer;
|
||||
begin
|
||||
// can shrink the list...
|
||||
result := 2;
|
||||
end;
|
||||
|
||||
function TCEMessagesWidget.contextAction(index: integer): TAction;
|
||||
begin
|
||||
case index of
|
||||
0: result := fActClear;
|
||||
1: result := fActSaveMsg;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEMessagesWidget.actClearExecute(Sender: TObject);
|
||||
begin
|
||||
List.Clear;
|
||||
end;
|
||||
|
||||
procedure TCEMessagesWidget.actSaveMsgExecute(Sender: TObject);
|
||||
var
|
||||
lst: TStringList;
|
||||
itm: TListItem;
|
||||
begin
|
||||
with TSaveDialog.Create(nil) do
|
||||
try
|
||||
if execute then
|
||||
begin
|
||||
lst := TStringList.Create;
|
||||
try
|
||||
for itm in List.Items do
|
||||
lst.Add(itm.Caption);
|
||||
lst.SaveToFile(filename);
|
||||
finally
|
||||
lst.Free;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -24,14 +24,158 @@ inherited CEProjectWidget: TCEProjectWidget
|
|||
Top = 2
|
||||
Width = 155
|
||||
Align = alTop
|
||||
AutoExpand = True
|
||||
BorderSpacing.Around = 2
|
||||
DefaultItemHeight = 18
|
||||
Images = imgList
|
||||
ReadOnly = True
|
||||
ScrollBars = ssAutoBoth
|
||||
ShowRoot = False
|
||||
TabOrder = 0
|
||||
Options = [tvoAutoExpand, tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoToolTips, tvoThemedDraw]
|
||||
Items.Data = {
|
||||
F9FFFFFF020002000000000000000000000000000000FFFFFFFF000000000000
|
||||
0000000C000000536F757263652066696C6573010000000100000001000000FF
|
||||
FFFFFF0000000000000000000E000000436F6E66696775726174696F6E73
|
||||
}
|
||||
end
|
||||
end
|
||||
inherited Header: TPanel
|
||||
Width = 163
|
||||
end
|
||||
end
|
||||
object imgList: TImageList[2]
|
||||
top = 3
|
||||
Bitmap = {
|
||||
4C69040000001000000010000000B3B3B1EFB0B0ADFFAEAEACFFAEAEACFFAEAE
|
||||
ACFFAFAFACFFAFAFADFFB1B1AFD5B4B4B100B5B5B300B5B5B300B5B5B300B5B5
|
||||
B300B5B5B300B5B5B300B5B5B300AFAFADFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFEDEDEEFFB3B3B0A4B5B5B300B5B5B300B5B5B300B5B5
|
||||
B300B5B5B300B5B5B300B5B5B300AEAEACFFFFFFFFFFE3E3E2FFBEBEBCFFA8A8
|
||||
A6FFA8A8A6FFACACAAFFB0B0ADFFB2B2B0FFB3B3B1FFB4B4B2A8B4B4B200B4B4
|
||||
B200B4B4B200B5B5B300B5B5B300AEAEABFFFFFFFFFFE9E8E7FFA8A8A6FFFFFF
|
||||
FFFFFFFFFFFFD1D1D0FFADADABFFADADABFFAEAEABFFADADABFFAEAEABFFAFAF
|
||||
ADFFB0B0AEACB3B3B100B5B5B300ADADABFFFFFFFFFFEDECECFFA8A8A5FFFFFF
|
||||
FFFFE4E4E3FFA9A9A6FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFE9E9E9FFAFAFADA7B3B3B100ADADABFFFFFFFFFFF1F1F0FFA7A7A5FFFFFF
|
||||
FFFFEAE8E7FFA8A8A6FFFFFFFFFFE0E0DFFFE0E0DFFFE0E0DFFFFFFFFFFFA4A4
|
||||
A2FFFFFFFFFFE9E9E9FFB0B0AEACADADABFFFFFFFFFFF5F5F4FFA7A7A5FFFFFF
|
||||
FFFFEDECECFFA8A8A5FFFFFFFFFFE5E4E3FFE6E5E4FFE5E4E3FFFFFFFFFFCACA
|
||||
C9FFA4A4A2FFFFFFFFFFAFAFADFFADADABFFFFFFFFFFF9F8F8FFA7A7A5FFFFFF
|
||||
FFFFF1F1F0FFA7A7A5FFFFFFFFFFE9E8E8FFEAE8E9FFE9E8E8FFF3F2F2FFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFAEAEABFFADADABFFFFFFFFFFFDFCFCFFA6A7A4FFFFFF
|
||||
FFFFF5F5F4FFA7A7A5FFFFFFFFFFECECEBFFEDEDECFFEDEDECFFECECEBFFEBEB
|
||||
EAFFEBEBEAFFFFFFFFFFADADABFFAEAEABFFFFFFFFFFFFFFFFFFA7A7A4FFFFFF
|
||||
FFFFF9F8F8FFA7A7A4FFFFFFFFFFF0F0EFFFF0F0EFFFF0F0EFFFF0F0EFFFEFEF
|
||||
EEFFEFEFEEFFFFFFFFFFADADABFFB0B0ADFFFFFFFFFFFFFFFFFFA8A8A6FFFFFF
|
||||
FFFFFDFCFCFFA6A7A4FFFFFFFFFFF4F3F3FFF4F3F3FFF4F3F3FFF4F3F3FFF4F3
|
||||
F3FFF4F3F3FFFFFFFFFFADADABFFB0B0AEF1B0B0AEFFAFAFADFFACACA9FFFFFF
|
||||
FFFFFFFFFFFFA6A7A4FFFFFFFFFFF7F6F6FFF7F6F6FFF7F6F6FFF7F6F6FFF7F6
|
||||
F6FFF7F6F6FFFFFFFFFFADADABFF0000002F6666655D54545351AFAFADFFFFFF
|
||||
FFFFFFFFFFFFA8A8A6FFFFFFFFFFFCFCFCFFFBFBFCFFFBFBFCFFFBFBFCFFFBFB
|
||||
FCFFFCFCFCFFFFFFFFFFAEAEABFFB5B5B3000000000B00000008A4A4A2BDB0B0
|
||||
AEFFAFAFADFFADADABFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFB0B0ADFFB5B5B300B5B5B300B5B5B300000000230000
|
||||
003300000033AFAFADECAFAFADFFAEAEABFFADADABFFADADABFFADADABFFADAD
|
||||
ABFFAEAEABFFAFAFADFFB1B1AFF2000000000000000000000000000000000000
|
||||
0000000000000000002E00000033000000330000003300000033000000330000
|
||||
0033000000330000003300000030FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF009E9E9E709C9C9CD69B9B9BFB9999
|
||||
99FBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF009D9D9D709B9B9BF5E4E4E4FFEEEEEEFF9696
|
||||
96FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF009B9B9BD6E2E2E2FFE7E7E7FFB9B9B9FF9393
|
||||
93FFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00989898FBE4E4E4FFCFCFCFFF929292C2FFFF
|
||||
FF008E8E8EFF8C8C8CFF8A8A8AFBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00969696FCDDDDDDFFC5C5C5FF8F8F8FC18D8D
|
||||
8DC3ACACACFFD7D7D7FF878787FBFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF0095959548939393FED4D4D4FFC8C8C8FFBCBCBCFFBABA
|
||||
BAFFC2C2C2FFC4C4C4FF858585D6FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00E3AD8B92DAA788CF929292FBC7C7C7FFCCCCCCFFC7C7C7FFC6C6C6FFC3C3
|
||||
C3FFC0C0C0FF848484F582828270FFFFFF00FFFFFF00FFFFFF00FFFFFF00E1A9
|
||||
8992E7B99CFFE6B698FFD8A98CFFD2D2D2FFB5B5B5FF898989FE878787FB8585
|
||||
85FB838383D681818170FFFFFF00FFFFFF00FFFFFF00FFFFFF00E1A98792E6B7
|
||||
9CFFEFCFBCFFEECEBAFFE2AE8CFFD29B7BFF888888F786868623FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E1A78592E6B799FFEECE
|
||||
BBFFE9C0A7FFE8BDA3FFECC8B3FFDFA481FFD2895DC9FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00DFA58392E6B498FFEECDBAFFE9BF
|
||||
A5FFE5B496FFE7B99DFFEBC6AEFFDE9F79FFD58351AAFFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00DFA57F92E6B394FFEECCB8FFE9BEA5FFE5B3
|
||||
94FFE6B79BFFEAC4ADFFDE9E78FFD3814FACFFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00DD9F79FFEDCCB7FFE8BDA3FFE4B192FFE6B6
|
||||
9AFFEAC3ACFFDE9C74FFD37F4DACFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00DB976FFFEDC8B3FFE7B89BFFE6B498FFEAC3
|
||||
ABFFDE9C73FFD17D49AFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00D99165CCDFA481FFEAC2ABFFEAC0A8FFDC99
|
||||
71FFD17B47AFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00D58757D5D58351FFD17D4BFFD179
|
||||
45AFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00BB871F00BB871F00BB871E00B9841A00B67E
|
||||
0FEAC4973BFFC79D49FFC39538FFB37904FFB47A07FFB47A07FFB47A08FFB57C
|
||||
0AFFB67F0FFFB88114FFBA851B23BB871F00BB871F00BA861D00B7801283E4CF
|
||||
A7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFE9DABAFFEEE2C9FFB67F14BFBB871F00BB871F00B9851B00B27A09E5FFFF
|
||||
FFFFFFFFFFFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFCFFFFFFFDFFFFFFFEFFFFFF
|
||||
FFFFC69941FFECDFC2FFC19234FFBB871F00BB871E00B9831800C89E4AFFFFFF
|
||||
FFFFFFFDF7FFFFFCF5FFFFFCF4FFFEFBF4FFFEFBF3FFFFFCF4FFFFFDF6FFFFFF
|
||||
FFFFB27701FFBA851CFFBC8922FFBB871F00BB861E00B882150CCDA557FFFFFF
|
||||
FFFF96989BFFC3C1BEFFC2C0BDFFC0BFBCFFFFFBF0FF96979AFFC3C2C2FFFFFF
|
||||
FFFFAA7508D00000003300000033BB871F00BB861D00B07B1134DDC18AFFFFFF
|
||||
FFFFFFF9EBFFFFF9EAFFFEF7E9FFFDF7E9FFFEF7E9FFFFF8E9FFFFFFFAFFF0E4
|
||||
CAFFA8740CB2BA851C00BD8C2800BB871F00BA861D00AE790F73EDDDBDFFC1C4
|
||||
C7FFA8A9A9FFC2C1BAFFC0BFB9FFFBF4E1FF989A9EFFC0BFB8FFFFFFFCFFE4D0
|
||||
A4FFA2710E90BA861D00BB871E00BB871F00BA851C00AB770C9BF3E6CDFFFDF5
|
||||
E4FFFAF2DBFFFAF1DBFFF8EFDAFFF7EFD9FFFAF0DAFFF8EFD9FFFFFFFFFFD7B8
|
||||
79FF9A6C106BBB861D00BB871F00BB871F00BA851C00B07A0BD2FFFFFFFF999D
|
||||
A4FFC0BFB8FFBFBEB8FFBEBDB7FFF6EDD4FF999BA2FFBEBCB5FFFFFFFFFFC9A0
|
||||
4BFF90661141BB871E00BB871F00BB871E00B9841900B8821BEFFFFFFFFFF4EC
|
||||
D4FFF5ECD3FFF4EBD4FFF4EBD3FFF3EAD4FFF3E9D1FFF1E6CCFFFFFFFFFFC190
|
||||
31FF0000000ABB871F00BB871F00B98419FFB67E0EFFB67F10FFC0902EFFBF8E
|
||||
2AFFBF8E29FFC08E2AFFC08F2BFFC0902DFFD8BB7DFFF1E9D2FFFFFFFDFFB57C
|
||||
0AFFBA851B00BB871F00BB871F00B78012FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFE9D9B7FFBB861DFFF4EEDCFFF6F0E2FFB17B
|
||||
0FE8BA851D00BB871F00BB871F00AC7A14CADCC189FFF5F0E0FFF4EDDBFFF4ED
|
||||
DBFFF4EDDBFFF4EDDBFFF5EFDDFFF7F2E3FFDFCA99FFF8F4EAFFCFAB61FF9D6F
|
||||
1399BB861E00BB871F00BB871F0060440E44B88114FFB67E0FFFB57D0DFFB57D
|
||||
0CFFB57D0CFFB57D0CFFB67D0DFFB67E0FFFB77F11FFB78012FFB58016EE0000
|
||||
001ABB871F00BB871F00BB871F00000000070000003300000033000000330000
|
||||
00330000003300000033000000330000003300000033000000330000002F0000
|
||||
0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF0000000000000000000000000000000000898785FF898785FF0000
|
||||
0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00000000008D8B89FF999795FF84828044B8B6B4FFB8B6B4FF8482
|
||||
8044999795FF8E8C8AFF00000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF0000000000989694FFDDDBDAFF9F9D9BFFD3D1D0FFD3D1D0FF9F9D
|
||||
9BFFDDDBDAFF92908EFF00000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00000000006D6B6A9B9E9C9AFFBFBDBCFF999796FF999796FFBFBD
|
||||
BCFF9E9C9AFF6C6B699B00000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00858381FFB2B0AFFFCFCDCCFF989693FF3332314A3332314A9896
|
||||
93FFCECCCCFFB1AFAEFF8F8D8BFFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00848280FFB1AFAEFFCCCAC9FF959392FF00000006000000069593
|
||||
92FFCCCAC9FFB0AEADFF8E8C8AFFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF00000000336563618B999796FFB8B6B5FF949290FF949290FFB8B6
|
||||
B5FF999796FF6563618B00000033FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF0000000000918F8DFFD1CFCEFF989695FFC8C6C5FFC8C6C5FF9896
|
||||
95FFD1CFCEFF8A8888FF00000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF0000000000868482FF8A8885FF52504F69AAA8A7FFAAA8A7FF5250
|
||||
4F698A8886FF868482FF00000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF000000000000000033000000330000000E7F7D7CFF7F7D7CFF0000
|
||||
000E000000330000003300000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||
FF00FFFFFF000000000000000000000000000000000000000033000000330000
|
||||
0000000000000000000000000000
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,29 +9,35 @@ uses
|
|||
ComCtrls, ce_common, ce_widget;
|
||||
|
||||
type
|
||||
|
||||
{ TCEWidgetProject }
|
||||
|
||||
{ TCEProjectWidget }
|
||||
TCEProjectWidget = class(TCEWidget)
|
||||
imgList: TImageList;
|
||||
Tree: TTreeView;
|
||||
private
|
||||
fProject: TCEProject;
|
||||
fFileNode, fConfNode: TTreeNode;
|
||||
procedure updateView;
|
||||
procedure setProject(aValue: TCEProject);
|
||||
procedure TreeDblClick(sender: TObject);
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
//
|
||||
property project: TCEProject read fProject write setProject;
|
||||
procedure projChange(const aProject: TCEProject); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
ce_main;
|
||||
|
||||
constructor TCEProjectWidget.create(aOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
fID := 'ID_PROJ';
|
||||
Tree.OnDblClick := @TreeDblClick;
|
||||
fFileNode := Tree.Items[0];
|
||||
fConfNode := Tree.Items[1];
|
||||
end;
|
||||
|
||||
destructor TCEProjectWidget.destroy;
|
||||
|
@ -39,17 +45,60 @@ begin
|
|||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCEProjectWidget.setProject(aValue: TCEProject);
|
||||
procedure TCEProjectWidget.projChange(const aProject: TCEProject);
|
||||
begin
|
||||
if fProject = aValue then exit;
|
||||
fProject := aValue;
|
||||
if aValue = nil then exit;
|
||||
fProject := aProject;
|
||||
updateView;
|
||||
end;
|
||||
|
||||
procedure TCEProjectWidget.updateView;
|
||||
procedure TCEProjectWidget.TreeDblClick(sender: TObject);
|
||||
var
|
||||
fname: string;
|
||||
i: NativeInt;
|
||||
begin
|
||||
if fProject = nil then exit;
|
||||
if Tree.Selected = nil then exit;
|
||||
//
|
||||
if Tree.Selected.Parent = fFileNode then
|
||||
begin
|
||||
fname := Tree.Selected.Text;
|
||||
i := fProject.Sources.IndexOf(fname);
|
||||
if i > -1 then
|
||||
begin
|
||||
fname := fProject.getAbsoluteSourceName(i);
|
||||
mainForm.openFile(fname);
|
||||
end;
|
||||
end
|
||||
else if Tree.Selected.Parent = fConfNode then
|
||||
begin
|
||||
i := Tree.Selected.Index;
|
||||
fProject.ConfigurationIndex:= i;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCEProjectWidget.updateView;
|
||||
var
|
||||
src, conf: string;
|
||||
itm: TTreeNode;
|
||||
i: NativeInt;
|
||||
begin
|
||||
if fProject = nil then exit;
|
||||
//
|
||||
fConfNode.DeleteChildren;
|
||||
fFileNode.DeleteChildren;
|
||||
for src in fProject.Sources do
|
||||
begin
|
||||
itm := Tree.Items.AddChild(fFileNode, src);
|
||||
itm.ImageIndex := 2;
|
||||
itm.SelectedIndex := 2;
|
||||
end;
|
||||
for i := 0 to fProject.OptionsCollection.Count-1 do
|
||||
begin
|
||||
conf := fProject.configuration[i].name;
|
||||
itm := Tree.Items.AddChild(fConfNode, conf);
|
||||
itm.ImageIndex := 3;
|
||||
itm.SelectedIndex:= 3;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
object CEWidget: TCEWidget
|
||||
Left = 1337
|
||||
Left = 1373
|
||||
Height = 327
|
||||
Top = 424
|
||||
Top = 440
|
||||
Width = 320
|
||||
Caption = 'CEWidget'
|
||||
ClientHeight = 327
|
||||
|
@ -38,4 +38,7 @@ object CEWidget: TCEWidget
|
|||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object Updater: TTimer
|
||||
Interval = 50
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, DividerBevel, Forms, Controls, ExtCtrls,
|
||||
ce_common;
|
||||
ce_common, ActnList;
|
||||
|
||||
type
|
||||
|
||||
|
@ -16,17 +16,28 @@ type
|
|||
PTCEWidget = ^TCEWidget;
|
||||
|
||||
{ TCEWidget }
|
||||
TCEWidget = class(TForm)
|
||||
TCEWidget = class(TForm, ICEContextualActions, ICEProjectMonitor)
|
||||
Content: TScrollBox;
|
||||
Back: TPanel;
|
||||
Header: TPanel;
|
||||
Updater: TTimer;
|
||||
private
|
||||
procedure updaterTimer(Sender: TObject);
|
||||
protected
|
||||
fID: string;
|
||||
fNeedUpdate: boolean;
|
||||
procedure UpdaterProc; virtual;
|
||||
published
|
||||
property ID: string read fID write fID;
|
||||
public
|
||||
constructor create(aOwner: TComponent); override;
|
||||
destructor destroy; override;
|
||||
//
|
||||
procedure projChange(const aProject: TCEProject); virtual;
|
||||
//
|
||||
function contextName: string; virtual;
|
||||
function contextActionCount: integer; virtual;
|
||||
function contextAction(index: integer): TAction; virtual;
|
||||
end;
|
||||
|
||||
(**
|
||||
|
@ -37,17 +48,20 @@ type
|
|||
function getWidget(index: integer): TCEWidget;
|
||||
public
|
||||
procedure addWidget(aValue: PTCEWidget);
|
||||
property frame[index: integer]: TCEWidget read getWidget;
|
||||
property widget[index: integer]: TCEWidget read getWidget;
|
||||
end;
|
||||
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
|
||||
|
||||
(*******************************************************************************
|
||||
* TCEWidget
|
||||
*)
|
||||
constructor TCEWidget.create(aOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
fID := 'ID_XXXX';
|
||||
Updater.OnTimer := @updaterTimer;
|
||||
end;
|
||||
|
||||
destructor TCEWidget.destroy;
|
||||
|
@ -55,8 +69,38 @@ begin
|
|||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCEWidget.updaterTimer(Sender: TObject);
|
||||
begin
|
||||
if not fNeedUpdate then exit;
|
||||
fNeedUpdate := false;
|
||||
UpdaterProc;
|
||||
end;
|
||||
|
||||
procedure TCEWidget.UpdaterProc;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TCEWidget.projChange(const aProject: TCEProject);
|
||||
begin
|
||||
end;
|
||||
|
||||
function TCEWidget.contextName: string;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
function TCEWidget.contextActionCount: integer;
|
||||
begin
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
function TCEWidget.contextAction(index: integer): TAction;
|
||||
begin
|
||||
result := nil;
|
||||
end;
|
||||
|
||||
(*******************************************************************************
|
||||
* TFrameList
|
||||
* TCEWidgetList
|
||||
*)
|
||||
function TCEWidgetList.getWidget(index: integer): TCEWidget;
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue