summaryrefslogtreecommitdiff
path: root/examples/apps
diff options
context:
space:
mode:
Diffstat (limited to 'examples/apps')
-rw-r--r--examples/apps/debugserver/frm_main.pas2
-rw-r--r--examples/apps/fpcunit/fpg_guitestrunner.pas30
-rw-r--r--examples/apps/ide/TODO8
-rw-r--r--examples/apps/ide/src/extrafpc.cfg5
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas8
-rw-r--r--examples/apps/ide/src/frm_configureide.pas4
-rw-r--r--examples/apps/ide/src/frm_main.pas62
-rw-r--r--examples/apps/ide/src/frm_projectoptions.pas10
-rw-r--r--examples/apps/ide/src/maximus.lpi33
-rw-r--r--examples/apps/ide/src/maximus.lpr1
-rw-r--r--examples/apps/ide/src/unitlist.pas32
-rw-r--r--examples/apps/ide/src/units/i386-freebsd/.gitignore1
-rw-r--r--examples/apps/ide/src/units/i386-linux/.gitignore1
-rw-r--r--examples/apps/ide/src/units/i386-win32/.gitignore1
-rw-r--r--examples/apps/ide/src/units/x86_64-freebsd/.gitignore1
-rw-r--r--examples/apps/ide/src/units/x86_64-linux/.gitignore1
16 files changed, 132 insertions, 68 deletions
diff --git a/examples/apps/debugserver/frm_main.pas b/examples/apps/debugserver/frm_main.pas
index 436a170c..27ac382c 100644
--- a/examples/apps/debugserver/frm_main.pas
+++ b/examples/apps/debugserver/frm_main.pas
@@ -307,7 +307,7 @@ begin
//else
// grdMessages.Items.InsertItem(LI, 0);
grdMessages.Cells[0, r] := IntToStr(AMsg.MsgType);
- grdMessages.Cells[1, r] := FormatDateTime('HH:mm:ss', AMsg.MsgTimeStamp);
+ grdMessages.Cells[1, r] := FormatDateTime('HH:nn:ss', AMsg.MsgTimeStamp);
grdMessages.Cells[2, r] := AMsg.Msg;
grdMessages.FocusCol := 0;
grdMessages.FocusRow := grdMessages.RowCount-1;
diff --git a/examples/apps/fpcunit/fpg_guitestrunner.pas b/examples/apps/fpcunit/fpg_guitestrunner.pas
index ca1a7f81..400fa0d1 100644
--- a/examples/apps/fpcunit/fpg_guitestrunner.pas
+++ b/examples/apps/fpcunit/fpg_guitestrunner.pas
@@ -7,11 +7,10 @@ interface
uses
SysUtils, Classes,
// fpGUI toolkit
- fpg_base, fpg_main, fpg_edit, fpg_widget, fpg_form, fpg_label, fpg_button,
- fpg_listbox, fpg_memo, fpg_combobox, fpg_basegrid, fpg_grid,
- fpg_dialogs, fpg_checkbox, fpg_tree, fpg_trackbar, fpg_progressbar,
- fpg_radiobutton, fpg_tab, fpg_menu, fpg_panel, fpg_popupcalendar,
- fpg_gauge, fpg_splitter, fpg_imagelist,
+ fpg_base, fpg_main, fpg_form, fpg_label, fpg_button,
+ fpg_memo,
+ fpg_dialogs, fpg_tree, fpg_progressbar,
+ fpg_menu, fpg_panel, fpg_splitter, fpg_imagelist,
// FPCUnit support
fpcunit, testregistry, testdecorator;
@@ -310,6 +309,7 @@ end;
procedure TGUITestRunnerForm.btnRunClicked(Sender: TObject);
begin
+ tvTests.FullExpand;
if tvTests.Selection = nil then
begin
TfpgMessageDialog.Critical('No selection', 'Please select a test case first.');
@@ -474,16 +474,6 @@ begin
SetPosition(305, 196, 530, 547);
WindowTitle := 'GUI Test Runner';
- bvlTree := TfpgBevel.Create(self);
- with bvlTree do
- begin
- Name := 'bvlTree';
- SetPosition(4, 8, 512, 364);
- Shape := bsSpacer;
- MinHeight := 200;
- Align := alClient;
- end;
-
bvlButtons := TfpgBevel.Create(self);
with bvlButtons do
begin
@@ -511,6 +501,16 @@ begin
Align := alBottom;
end;
+ bvlTree := TfpgBevel.Create(self);
+ with bvlTree do
+ begin
+ Name := 'bvlTree';
+ SetPosition(4, 8, 512, 364);
+ Shape := bsSpacer;
+ MinHeight := 200;
+ Align := alClient;
+ end;
+
pbName1 := TfpgProgressBar.Create(bvlTree);
with pbName1 do
begin
diff --git a/examples/apps/ide/TODO b/examples/apps/ide/TODO
index 9a90c33e..72b9f0db 100644
--- a/examples/apps/ide/TODO
+++ b/examples/apps/ide/TODO
@@ -1,6 +1,6 @@
Personal todo list for fpGUI IDE project
-
+
Legend
======
@@ -22,8 +22,8 @@ fpGUI IDE
[ ] Assembly window
[ ] CPU window
[x] Syntax highlighting with descent speed.
-[ ] Basic Search dialog
-[x] Find in Files dialog
+[x] Basic Search dialog
+[ ] Find in Files dialog
[ ] Regex support in all search dialogs
[ ] External Tools setup and usage
[ ] Keyboard Shortcuts dialog
@@ -36,7 +36,7 @@ fpGUI IDE
[ ] Unit Testing framework integration (with DUnit2 project)
[ ] Code Templates support
[o] File Browser tabsheet implementation. File navigation and opening of files.
-[ ] GoTo Line Number dialog
+[x] GoTo Line Number dialog
[ ] Converting all UI to MiG Layout Manager based dialogs.
[ ] TextEdit: enable line drawing functionality. eg: some key combination with
the cursor (arrow) keys allows line drawing. Double and single line
diff --git a/examples/apps/ide/src/extrafpc.cfg b/examples/apps/ide/src/extrafpc.cfg
index 2132065d..7d50b94c 100644
--- a/examples/apps/ide/src/extrafpc.cfg
+++ b/examples/apps/ide/src/extrafpc.cfg
@@ -1,9 +1,6 @@
--FUunits
+-FUunits/$fpctarget
-Fu../../../../lib/$fpctarget
-Fi.
--Xs
--XX
--CX
#ifdef mswindows
-WG
#endif
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index 3e88f3d1..6acea537 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -1583,17 +1583,20 @@ begin
ckCopy:
begin
CopyToClipboard;
+ consumed := True;
end;
ckPaste:
begin
// if not ReadOnly then
PasteFromClipboard;
+ consumed := True;
end;
ckCut:
begin
CutToClipboard;
+ consumed := True;
end;
end;
@@ -1611,6 +1614,8 @@ begin
SLine := FLines[CaretPos.Y];
+ if not consumed then
+ begin
case keycode of
keyBackspace:
begin
@@ -1728,7 +1733,8 @@ begin
end;
consumed := True;
end;
- end;
+ end; // case keycode
+ end; // if not consumed
if CaretScroll then
begin
diff --git a/examples/apps/ide/src/frm_configureide.pas b/examples/apps/ide/src/frm_configureide.pas
index fad0418f..51061a42 100644
--- a/examples/apps/ide/src/frm_configureide.pas
+++ b/examples/apps/ide/src/frm_configureide.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -229,7 +229,6 @@ constructor TConfigureIDEForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FInternalMacroList := TIDEMacroList.Create;
- OnKeyPress := @FormKeyPressed;
end;
destructor TConfigureIDEForm.Destroy;
@@ -248,6 +247,7 @@ begin
Hint := '';
ShowHint := True;
WindowPosition := wpOneThirdDown;
+ OnKeyPress := @FormKeyPressed;
btnCancel := TfpgButton.Create(self);
with btnCancel do
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index fe903c31..8a8f3c12 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -118,6 +118,7 @@ type
procedure AddUnitToProject(const AUnitName: TfpgString);
procedure miProjectAddUnitToProject(Sender: TObject);
procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure tvProjectKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
procedure TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet);
procedure BuildTerminated(Sender: TObject);
@@ -541,18 +542,18 @@ var
r: TfpgTreeNode;
n: TfpgTreeNode;
begin
- u := TUnit.Create;
- u.FileName := AUnitName;
- u.Opened := True;
- GProject.UnitList.Add(u);
- // add reference to tabsheet
- pcEditor.ActivePage.TagPointer := u;
- s := fpgExtractRelativepath(GProject.ProjectDir, u.FileName);
- r := GetUnitsNode;
- n := r.AppendText(s);
- // add reference to treenode
- n.Data := u;
- tvProject.Invalidate;
+ u := GProject.UnitList.AddFilename(AUnitName);
+ if Assigned(n) then
+ begin
+ // add reference to tabsheet
+ pcEditor.ActivePage.TagPointer := u;
+ s := u.GetRelativePath;
+ r := GetUnitsNode;
+ n := r.AppendText(s);
+ // add reference to treenode
+ n.Data := u;
+ tvProject.Invalidate;
+ end;
end;
procedure TMainForm.miProjectAddUnitToProject(Sender: TObject);
@@ -587,6 +588,38 @@ begin
end;
end;
+procedure TMainForm.tvProjectKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+var
+ r: TfpgTreeNode;
+ n: TfpgTreeNode;
+ i: integer;
+begin
+ if keyCode = keyDelete then
+ begin
+ r := GetUnitsNode;
+ if r.FindSubNode(tvProject.Selection.Text, False) = tvProject.Selection then
+ begin
+ // remove from project, then from tree view
+ n := tvProject.Selection;
+ tvProject.GotoNextNodeUp;
+ r.Remove(n);
+ tvProject.Invalidate;
+ GProject.UnitList.Remove(TUnit(n.Data));
+
+ for i := 0 to pcEditor.PageCount-1 do
+ begin
+ if pcEditor.Pages[i].TagPointer = n.Data then
+ begin
+ pcEditor.Pages[i].TagPointer := nil;
+ break
+ end;
+ end;
+ TUnit(n.Data).Free;
+ n.Free;
+ end;
+ end;
+end;
+
procedure TMainForm.grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
var
cr: TClipboardKeyType;
@@ -1478,6 +1511,7 @@ begin
Hint := '';
TabOrder := 20;
OnDoubleClick := @tvProjectDoubleClick;
+ OnKeyPress := @tvProjectKeyPressed;
end;
tsFiles := TfpgTabSheet.Create(pnlTool);
@@ -1597,7 +1631,7 @@ begin
begin
Name := 'mnuProject';
SetPosition(476, 140, 172, 20);
- AddMenuItem('Options...', rsKeyCtrl+rsKeyShift+'O', @miProjectOptions);
+ AddMenuItem('Options...', rsKeyCtrl+rsKeyShift+'F11', @miProjectOptions);
AddMenuItem('-', '', nil);
AddMenuItem('New (empty)...', '', @miProjectNew);
AddMenuItem('New from Template...', '', @miProjectNewFromTemplate);
diff --git a/examples/apps/ide/src/frm_projectoptions.pas b/examples/apps/ide/src/frm_projectoptions.pas
index 1e1c318a..a3e43d6a 100644
--- a/examples/apps/ide/src/frm_projectoptions.pas
+++ b/examples/apps/ide/src/frm_projectoptions.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -103,6 +103,7 @@ type
procedure CleanupCompilerDirs;
procedure CleanupUserMacrosGrid;
procedure SaveToMacroList(AList: TIDEMacroList);
+ procedure FormKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -582,6 +583,12 @@ begin
// AList.SetValue(cMacro_FPCSrcDir, edtFPCSrcDir.Directory);
end;
+procedure TProjectOptionsForm.FormKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if KeyCode = keyEscape then
+ Close;
+end;
+
constructor TProjectOptionsForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@@ -603,6 +610,7 @@ begin
WindowTitle := 'Project Options';
Hint := '';
ShowHint := True;
+ OnKeyPress := @FormKeyPressed;
btnCancel := TfpgButton.Create(self);
with btnCancel do
diff --git a/examples/apps/ide/src/maximus.lpi b/examples/apps/ide/src/maximus.lpi
index accb3570..01a377d7 100644
--- a/examples/apps/ide/src/maximus.lpi
+++ b/examples/apps/ide/src/maximus.lpi
@@ -42,7 +42,6 @@
<Unit0>
<Filename Value="maximus.lpr"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="maximus"/>
</Unit0>
<Unit1>
<Filename Value="frm_main.pas"/>
@@ -52,7 +51,6 @@
<Unit2>
<Filename Value="frm_configureide.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_configureide"/>
</Unit2>
<Unit3>
<Filename Value="ideconst.pas"/>
@@ -67,7 +65,6 @@
<Unit5>
<Filename Value="frm_debug.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_debug"/>
</Unit5>
<Unit6>
<Filename Value="project.pas"/>
@@ -77,7 +74,6 @@
<Unit7>
<Filename Value="unitlist.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="UnitList"/>
</Unit7>
<Unit8>
<Filename Value="frm_projectoptions.pas"/>
@@ -97,47 +93,42 @@
<Unit11>
<Filename Value="ideimages.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="ideimages"/>
</Unit11>
<Unit12>
<Filename Value="stringhelpers.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="stringhelpers"/>
</Unit12>
<Unit13>
<Filename Value="frm_procedurelist.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_procedurelist"/>
</Unit13>
<Unit14>
- <Filename Value="mpaslex.pas"/>
+ <Filename Value="filemonitor.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="mPasLex"/>
+ <UnitName Value="filemonitor"/>
</Unit14>
<Unit15>
- <Filename Value="filemonitor.pas"/>
+ <Filename Value="synregexpr.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="filemonitor"/>
</Unit15>
<Unit16>
- <Filename Value="synregexpr.pas"/>
+ <Filename Value="fpg_textedit.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="SynRegExpr"/>
+ <UnitName Value="fpg_textedit"/>
</Unit16>
<Unit17>
- <Filename Value="fpg_textedit.pas"/>
+ <Filename Value="frm_find.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="fpg_textedit"/>
</Unit17>
<Unit18>
- <Filename Value="frm_find.pas"/>
+ <Filename Value="sha1.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="frm_find"/>
+ <UnitName Value="Sha1"/>
</Unit18>
<Unit19>
- <Filename Value="sha1.pas"/>
+ <Filename Value="mPasLex.pas"/>
<IsPartOfProject Value="True"/>
- <UnitName Value="Sha1"/>
+ <UnitName Value="mPasLex"/>
</Unit19>
</Units>
</ProjectOptions>
@@ -162,11 +153,7 @@
</Optimizations>
</CodeGeneration>
<Other>
- <CompilerMessages>
- <UseMsgFile Value="True"/>
- </CompilerMessages>
<CustomOptions Value="-dDEBUGSVRx"/>
- <CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</CONFIG>
diff --git a/examples/apps/ide/src/maximus.lpr b/examples/apps/ide/src/maximus.lpr
index cf9c439f..13a2047e 100644
--- a/examples/apps/ide/src/maximus.lpr
+++ b/examples/apps/ide/src/maximus.lpr
@@ -39,7 +39,6 @@ uses
ideimages,
stringhelpers,
frm_procedurelist,
- mPasLex,
filemonitor,
SynRegExpr,
fpg_textedit,
diff --git a/examples/apps/ide/src/unitlist.pas b/examples/apps/ide/src/unitlist.pas
index 827326e7..e6c09a69 100644
--- a/examples/apps/ide/src/unitlist.pas
+++ b/examples/apps/ide/src/unitlist.pas
@@ -1,7 +1,7 @@
{
fpGUI IDE - Maximus
- Copyright (C) 2012 - 2013 Graeme Geldenhuys
+ Copyright (C) 2012 - 2014 Graeme Geldenhuys
See the file COPYING.modifiedLGPL, included in this distribution,
for details about redistributing fpGUI.
@@ -31,6 +31,7 @@ type
function GetUnitName: TfpgString;
public
constructor Create;
+ function GetRelativePath: TfpgString;
property FileName: TfpgString read FFilename write FFilename;
property UnitName: TfpgString read GetUnitName;
property Opened: Boolean read FOpened write FOpened;
@@ -48,6 +49,8 @@ type
function Count: integer;
function FindByName(const AUnitName: TfpgString): TUnit;
function FileExists(const AFilename: TfpgString): Boolean;
+ function AddFileName(const AFilename: TfpgString): TUnit;
+ function Remove(AUnit: TUnit): integer;
procedure Add(NewUnit: TUnit);
procedure Clear;
procedure Delete(AIndex: integer);
@@ -58,7 +61,8 @@ type
implementation
uses
- fpg_utils;
+ fpg_utils,
+ project;
{ TUnitList }
@@ -128,6 +132,25 @@ begin
end;
end;
+function TUnitList.AddFileName(const AFilename: TfpgString): TUnit;
+var
+ u: TUnit;
+begin
+ if not FileExists(AFilename) then
+ begin
+ u := TUnit.Create;
+ u.FileName := AFilename;
+ u.Opened := True;
+ Add(u);
+ Result := u;
+ end;
+end;
+
+function TUnitList.Remove(AUnit: TUnit): integer;
+begin
+ Result := FList.Remove(AUnit);
+end;
+
procedure TUnitList.Add(NewUnit: TUnit);
var
l: Integer;
@@ -176,6 +199,11 @@ begin
Result := fpgExtractFileName(Filename);
end;
+function TUnit.GetRelativePath: TfpgString;
+begin
+ Result := fpgExtractRelativepath(GProject.ProjectDir, FileName);
+end;
+
constructor TUnit.Create;
begin
inherited Create;
diff --git a/examples/apps/ide/src/units/i386-freebsd/.gitignore b/examples/apps/ide/src/units/i386-freebsd/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/i386-freebsd/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/i386-linux/.gitignore b/examples/apps/ide/src/units/i386-linux/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/i386-linux/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/i386-win32/.gitignore b/examples/apps/ide/src/units/i386-win32/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/i386-win32/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/x86_64-freebsd/.gitignore b/examples/apps/ide/src/units/x86_64-freebsd/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/x86_64-freebsd/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/examples/apps/ide/src/units/x86_64-linux/.gitignore b/examples/apps/ide/src/units/x86_64-linux/.gitignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/examples/apps/ide/src/units/x86_64-linux/.gitignore
@@ -0,0 +1 @@
+*