From bf949cb2ef2ef24339ea4ba5c5928b15b8afe310 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 12:21:29 +0000 Subject: ide: Project -> Save As... will add new name to Recent Files list. --- examples/apps/ide/src/frm_main.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 92d5243e..e13f102b 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -471,6 +471,7 @@ begin s := s + cProjectExt; try GProject.Save(s); + FRecentFiles.AddItem(s); except on E: Exception do begin -- cgit v1.2.3-70-g09d2 From 350e85c64e3ea2cb56e0a2a2454bb13d36a3e39a Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 12:22:12 +0000 Subject: ide: Adds the ability to copy the Messages output to the clipboard --- examples/apps/ide/src/frm_main.pas | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index e13f102b..f5adaec6 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -97,6 +97,7 @@ type procedure miProjectSaveAs(Sender: TObject); procedure miProjectAddUnitToProject(Sender: TObject); procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean); procedure TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet); procedure BuildTerminated(Sender: TObject); procedure BuildOutput(Sender: TObject; const ALine: string); @@ -529,6 +530,22 @@ begin end; end; +procedure TMainForm.grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean); +var + cr: TClipboardKeyType; + i: integer; + s: TfpgString; +begin + cr := CheckClipboardKey(KeyCode, ShiftState); + if cr = ckCopy then + begin + s := ''; + for i := 0 to grdMessages.RowCount-1 do + s := s + grdMessages.Cells[0, i] + LineEnding; + fpgClipboard.Text := s; + end; +end; + procedure TMainForm.TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet); var u: TUnit; @@ -1326,6 +1343,7 @@ begin RowSelect := True; ShowHeader := False; TabOrder := 13; + OnKeyPress := @grdMessageKeyPressed; end; tsScribble := TfpgTabSheet.Create(pnlWindow); -- cgit v1.2.3-70-g09d2 From 61533659afd28fdcb47ccf11e521c4bbf1061dc6 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 14:48:45 +0000 Subject: textedit: Ctrl+Home/End handling is now fixed. Old behaviour took you to the correct location, but the vertical scrollbar position was never updated. So if you then did a PgUp/PgDn or a Mouse Wheel Scroll, you suddenly jumped to a different location in the source code. --- examples/apps/ide/src/fpg_textedit.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index b68c78b3..86f4f6fb 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -971,6 +971,8 @@ begin CaretPos.Y := 0; CaretPos.X := 0; end; + ScrollPos_V := 0; + UpdateScrollBars; Exit; end; if ssShift in ShiftState then @@ -1017,6 +1019,8 @@ begin CaretPos.Y := pred(FLines.Count); CaretPos.X := Length(FLines[CaretPos.Y]); end; + ScrollPos_V := CaretPos.Y - FVisLines; + UpdateScrollBars; Exit; end; if ssShift in ShiftState then -- cgit v1.2.3-70-g09d2 From 709941315130cfe089dc11811d113ac8a8c02dcb Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 14:49:31 +0000 Subject: textedit: correctly decrement the vertical scrollbar max limit when deleting a line --- examples/apps/ide/src/fpg_textedit.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index 86f4f6fb..9f456d66 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -1681,6 +1681,7 @@ begin if SLine = '' then // short circut the code block begin FLines.Delete(CaretPos.Y); + FVScrollBar.Max := FVScrollBar.Max - 1; end else begin -- cgit v1.2.3-70-g09d2 From c5241ae83570635083d4157b474d2f0b6ff7bd57 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 14:50:32 +0000 Subject: textedit: correctly named an identifier based on its usage --- examples/apps/ide/src/fpg_textedit.pas | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index 9f456d66..c6236cfc 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -666,7 +666,7 @@ end; to set selection if Shift key is pressed. } procedure TfpgBaseTextEdit.KeyboardCaretNav(const ShiftState: TShiftState; const AKeyCode: Word); var - SaveXCaret: Integer; + SaveYCaretOffset: Integer; procedure CtrlKeyLeftKey; var @@ -1052,7 +1052,7 @@ begin FSelStartNo := CaretPos.Y; FSelStartOffs := CaretPos.X; end; - SaveXCaret := CaretPos.Y - FTopLine; + SaveYCaretOffset := CaretPos.Y - FTopLine; if AKeyCode = keyPageUp then begin if VPos = 0 then @@ -1066,11 +1066,11 @@ begin if FVScrollBar.Visible then FVScrollBar.PageUp; // restore caret at same line offset as before - CaretPos.Y := FTopLine + SaveXCaret; + CaretPos.Y := FTopLine + SaveYCaretOffset; end; end else - begin + begin { PageDown handling } if VPos > (FLines.Count - FVisLines) then begin CaretPos.Y := FLines.Count-1; @@ -1082,7 +1082,7 @@ begin if FVScrollBar.Visible then FVScrollBar.PageDown; // restore caret at same line offset as before - CaretPos.Y := FTopLine + SaveXCaret; + CaretPos.Y := FTopLine + SaveYCaretOffset; end; end; if ssShift in ShiftState then -- cgit v1.2.3-70-g09d2 From 0ab06d1208c264023e2aebb37ba83b761219ff87 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 14:51:22 +0000 Subject: textedit: correctly set caret x position using UTF-8 Length() method --- examples/apps/ide/src/fpg_textedit.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index c6236cfc..7c8ef151 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -1074,7 +1074,7 @@ begin if VPos > (FLines.Count - FVisLines) then begin CaretPos.Y := FLines.Count-1; - CaretPos.X := Length(FLines[CaretPos.Y]); + CaretPos.X := UTF8Length(FLines[CaretPos.Y]); end else begin -- cgit v1.2.3-70-g09d2 From 1a584b775c87368998f7497e1cbe289fa8dda581 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 15:00:10 +0000 Subject: ide: Find dialog can now be closed/cancelled with Esc key. --- examples/apps/ide/src/frm_find.pas | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_find.pas b/examples/apps/ide/src/frm_find.pas index 03e27dd2..652d104d 100644 --- a/examples/apps/ide/src/frm_find.pas +++ b/examples/apps/ide/src/frm_find.pas @@ -88,6 +88,11 @@ begin begin Consumed := True; btnFind.Click; + end + else if KeyCode = keyEscape then + begin + Consumed := True; + Close; end; end; -- cgit v1.2.3-70-g09d2 From 346fade465eca0b7354213ec62d6a79e8386831c Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 15:01:58 +0000 Subject: ide: disable unnecessary debug output when using Proc List dialog. --- examples/apps/ide/src/frm_procedurelist.pas | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_procedurelist.pas b/examples/apps/ide/src/frm_procedurelist.pas index 4b5b7548..b62e9a7f 100644 --- a/examples/apps/ide/src/frm_procedurelist.pas +++ b/examples/apps/ide/src/frm_procedurelist.pas @@ -194,7 +194,7 @@ begin { E := TSimpleEngine.Create; try - writeln(Format('Parsing file <%s> for OS <%s> and CPU <%s>', [FFilename, OSTarget, CPUTarget])); +// writeln(Format('Parsing file <%s> for OS <%s> and CPU <%s>', [FFilename, OSTarget, CPUTarget])); M := ParseSource(E, FFilename, OSTarget, CPUTarget); { Cool, we successfully parsed the unit. @@ -203,8 +203,7 @@ begin for I := 0 to Decls.Count - 1 do begin p := TObject(Decls[I]) as TPasElement; - Writeln('Interface item ', I, ': ' + p.Name + ' [line ' + IntToStr(p.SourceLinenumber) + ']'); - +// Writeln('Interface item ', I, ': ' + p.Name + ' [line ' + IntToStr(p.SourceLinenumber) + ']'); end; FreeAndNil(M); finally @@ -357,7 +356,7 @@ begin else if StrContains('destructor', ProcName, False) then // Do not localize. Result := ImageIndexTrash else if StrBeginsWith('class proc', ProcName, False) // Do not localize. - or StrContains('class func', ProcName, False) + or StrContains('class func', ProcName, False) or (ProcClass <> '') then Result := ImageIndexGear else @@ -991,7 +990,7 @@ begin finally SFile.Free; end; - SendDebug('Procedure List: Starting Parse'); +// SendDebug('Procedure List: Starting Parse'); case Language of ltPas: Parser.Origin := MemStream.Memory; // ltCpp: CParser.SetOrigin(MemStream.Memory, MemStream.Size); @@ -1004,7 +1003,7 @@ begin finally LoadObjectCombobox; end; - SendDebug('Procedure List: QuickSorting procedures'); +// SendDebug('Procedure List: QuickSorting procedures'); QuickSort(0, FProcList.Count - 1); // StatusBar.Panels[1].Text := Trim(IntToStr(lvProcs.Items.Count)); finally @@ -1155,7 +1154,7 @@ begin FLanguage := ltPas; FSearchAll := True; // search anywhere in a method name // FImageList := TfpgImageList.Create; - + // CreateImage_BMP(@grdimg_destructor_16, SizeOf(grdimg_destructor_16)); fpgImages.AddMaskedBMP( // 16x16 image -- cgit v1.2.3-70-g09d2 From af52877ff7530061eaa9657ccf5544e4e4425e04 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 15 Mar 2013 15:05:45 +0000 Subject: ide: Adds template files (units, programs etc) Soon the IDE will be able to select and process these files correctly. --- .../apps/ide/src/templates/default/program.pas | 11 +++++ examples/apps/ide/src/templates/fpgui/mainform.pas | 45 ++++++++++++++++++ examples/apps/ide/src/templates/fpgui/program.pas | 31 ++++++++++++ .../ide/src/templates/fpgui/program_all_in_one.pas | 55 ++++++++++++++++++++++ .../apps/ide/src/templates/fpgui/simpleform.pas | 45 ++++++++++++++++++ examples/apps/ide/src/templates/fptest/program.pas | 30 ++++++++++++ .../apps/ide/src/templates/fptest/testunit.pas | 39 +++++++++++++++ 7 files changed, 256 insertions(+) create mode 100644 examples/apps/ide/src/templates/default/program.pas create mode 100644 examples/apps/ide/src/templates/fpgui/mainform.pas create mode 100644 examples/apps/ide/src/templates/fpgui/program.pas create mode 100644 examples/apps/ide/src/templates/fpgui/program_all_in_one.pas create mode 100644 examples/apps/ide/src/templates/fpgui/simpleform.pas create mode 100644 examples/apps/ide/src/templates/fptest/program.pas create mode 100644 examples/apps/ide/src/templates/fptest/testunit.pas (limited to 'examples/apps') diff --git a/examples/apps/ide/src/templates/default/program.pas b/examples/apps/ide/src/templates/default/program.pas new file mode 100644 index 00000000..d901e3ac --- /dev/null +++ b/examples/apps/ide/src/templates/default/program.pas @@ -0,0 +1,11 @@ +program ${PROGRAMNAME}; + +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils; + +begin + WriteLn('Hello'); +end. diff --git a/examples/apps/ide/src/templates/fpgui/mainform.pas b/examples/apps/ide/src/templates/fpgui/mainform.pas new file mode 100644 index 00000000..6b9500ac --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/mainform.pas @@ -0,0 +1,45 @@ +unit frm_main; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_form; + +type + + TMainForm = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: MainForm} + {@VFD_HEAD_END: MainForm} + public + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + +implementation + +{@VFD_NEWFORM_IMPL} + +procedure TMainForm.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: MainForm} + Name := 'MainForm'; + SetPosition(374, 228, 490, 258); + WindowTitle := 'MainForm'; + Hint := ''; + WindowPosition := wpOneThirdDown; + + {@VFD_BODY_END: MainForm} + {%endregion} +end; + + +end. diff --git a/examples/apps/ide/src/templates/fpgui/program.pas b/examples/apps/ide/src/templates/fpgui/program.pas new file mode 100644 index 00000000..7f3f9732 --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/program.pas @@ -0,0 +1,31 @@ +program ${PROGRAMNAME}; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + fpg_main, + frm_main; + + +procedure MainProc; +var + frm: TMainForm; +begin + fpgApplication.Initialize; + frm := TMainForm.Create(nil); + try + frm.Show; + fpgApplication.Run; + finally + frm.Free; + end; +end; + +begin + MainProc; +end. + diff --git a/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas new file mode 100644 index 00000000..0b17ee85 --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas @@ -0,0 +1,55 @@ +program ${PROJECTNAME}; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, fpg_main, fpg_form; + +type + + TMainForm = class(TfpgForm) + public + {@VFD_HEAD_BEGIN: MainForm} + {@VFD_HEAD_END: MainForm} + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + + + +{@VFD_NEWFORM_IMPL} + +procedure TMainForm.AfterCreate; +begin + {@VFD_BODY_BEGIN: MainForm} + Name := 'MainForm'; + SetPosition(316, 186, 300, 250); + WindowTitle := 'MainForm'; + + {@VFD_BODY_END: MainForm} +end; + + +procedure MainProc; +var + frm: TMainForm; +begin + fpgApplication.Initialize; + frm := TMainForm.Create(nil); + try + frm.Show; + fpgApplication.Run; + finally + frm.Free; + end; +end; + +begin + MainProc; +end. + + diff --git a/examples/apps/ide/src/templates/fpgui/simpleform.pas b/examples/apps/ide/src/templates/fpgui/simpleform.pas new file mode 100644 index 00000000..d804f4a3 --- /dev/null +++ b/examples/apps/ide/src/templates/fpgui/simpleform.pas @@ -0,0 +1,45 @@ +unit ${UNITNAME}; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils, + Classes, + fpg_base, + fpg_main, + fpg_form; + +type + + T${FORMNAME} = class(TfpgForm) + private + {@VFD_HEAD_BEGIN: ${FORMNAME}} + {@VFD_HEAD_END: ${FORMNAME}} + public + procedure AfterCreate; override; + end; + +{@VFD_NEWFORM_DECL} + +implementation + +{@VFD_NEWFORM_IMPL} + +procedure T${FORMNAME}.AfterCreate; +begin + {%region 'Auto-generated GUI code' -fold} + {@VFD_BODY_BEGIN: ${FORMNAME}} + Name := '${FORMNAME}'; + SetPosition(374, 228, 490, 258); + WindowTitle := 'New Form'; + Hint := ''; + WindowPosition := wpOneThirdDown; + + {@VFD_BODY_END: ${FORMNAME}} + {%endregion} +end; + + +end. diff --git a/examples/apps/ide/src/templates/fptest/program.pas b/examples/apps/ide/src/templates/fptest/program.pas new file mode 100644 index 00000000..8c4729bc --- /dev/null +++ b/examples/apps/ide/src/templates/fptest/program.pas @@ -0,0 +1,30 @@ +program ${%PROGRAMNAME%}; + +{$Mode objfpc}{$H+} + + +{$Define TextRunner} +{.$Define GUIRunner} + + +{$ifdef GuiRunner} + {$apptype gui} +{$endif} + + +uses + {$IFDEF TextRunner} + TextTestRunner, + {$ENDIF} + {$IFDEF GUIRunner} + GUITestRunner, + {$ENDIF} + Classes, + SampleTests; + +begin + // Register all tests + SampleTests.RegisterTests; + + RunRegisteredTests; +end. diff --git a/examples/apps/ide/src/templates/fptest/testunit.pas b/examples/apps/ide/src/templates/fptest/testunit.pas new file mode 100644 index 00000000..83d2a624 --- /dev/null +++ b/examples/apps/ide/src/templates/fptest/testunit.pas @@ -0,0 +1,39 @@ +unit ${UNITNAME}; + +{$mode objfpc}{$H+} + +interface + +uses + TestFramework; + +type + TMyTestCase = class(TTestCase) + published + procedure FirstTest; + end; + + +procedure RegisterTests; + + +implementation + +//uses +// SomeUnitToTest; + + +procedure RegisterTests; +begin + TestFramework.RegisterTest(TMyTestCase.Suite); +end; + +{ TMyTestCase } + +procedure TMyTestCase.FirstTest; +begin + Check(2, 1+1, 'Failed on 1'); +end; + + +end. -- cgit v1.2.3-70-g09d2 From 02ff580a564d9cf3356bbfa91d4b2a15af43aae1 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 17 Mar 2013 00:18:14 +0000 Subject: textedit: access to caret pos H. --- examples/apps/ide/src/fpg_textedit.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index 7c8ef151..aa5354a6 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -124,10 +124,12 @@ type function GetGutterVisible: Boolean; function GetHScrollPos: Integer; function GetVScrollPos: Integer; + function GetCaretPosH: Integer; procedure SetFontDesc(const AValue: string); procedure SetGutterShowLineNumbers(const AValue: Boolean); procedure SetGutterVisible(const AValue: Boolean); procedure SetHScrollPos(const AValue: Integer); + procedure SetCaretPosH(const AValue: Integer); procedure SetLines(const AValue: TStrings); procedure SetScrollBarStyle(const AValue: TfpgScrollStyle); procedure SetTabWidth(const AValue: Integer); @@ -196,6 +198,7 @@ type procedure SaveToFile(const AFileName: TfpgString); procedure LoadFromFile(const AFileName: TfpgString); procedure FindText(TextToFind: TfpgString; FindOptions: TfpgFindOptions; Backward: Boolean = False); + property CaretPos_H: Integer read GetCaretPosH write SetCaretPosH; property FontHeight: Integer read FChrH; property FontWidth: Integer read FChrW; property ScrollPos_H: Integer read GetHScrollPos write SetHScrollPos; @@ -418,6 +421,11 @@ begin Result := VPos; end; +function TfpgBaseTextEdit.GetCaretPosH: Integer; +begin + Result := CaretPos.Y; +end; + procedure TfpgBaseTextEdit.SetFontDesc(const AValue: string); begin FFont.Free; @@ -455,6 +463,11 @@ begin FTabWidth := AValue; end; +procedure TfpgBaseTextEdit.SetCaretPosH(const AValue: integer); +begin + CaretPos.Y := AValue; +end; + procedure TfpgBaseTextEdit.SetVScrollPos(const AValue: Integer); begin SetVPos(AValue); -- cgit v1.2.3-70-g09d2 From e3ed1e992eda0b4cdff876d7762803932f30aa1b Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 17 Mar 2013 12:18:16 +0000 Subject: textedit: Adds access to the Caret Vertical position. --- examples/apps/ide/src/fpg_textedit.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index aa5354a6..c69ca907 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -125,11 +125,13 @@ type function GetHScrollPos: Integer; function GetVScrollPos: Integer; function GetCaretPosH: Integer; + function GetCaretPosV: Integer; procedure SetFontDesc(const AValue: string); procedure SetGutterShowLineNumbers(const AValue: Boolean); procedure SetGutterVisible(const AValue: Boolean); procedure SetHScrollPos(const AValue: Integer); procedure SetCaretPosH(const AValue: Integer); + procedure SetCaretPosV(const AValue: Integer); procedure SetLines(const AValue: TStrings); procedure SetScrollBarStyle(const AValue: TfpgScrollStyle); procedure SetTabWidth(const AValue: Integer); @@ -199,6 +201,7 @@ type procedure LoadFromFile(const AFileName: TfpgString); procedure FindText(TextToFind: TfpgString; FindOptions: TfpgFindOptions; Backward: Boolean = False); property CaretPos_H: Integer read GetCaretPosH write SetCaretPosH; + property CaretPos_V: Integer read GetCaretPosV write SetCaretPosV; property FontHeight: Integer read FChrH; property FontWidth: Integer read FChrW; property ScrollPos_H: Integer read GetHScrollPos write SetHScrollPos; @@ -426,6 +429,11 @@ begin Result := CaretPos.Y; end; +function TfpgBaseTextEdit.GetCaretPosV: Integer; +begin + Result := CaretPos.X; +end; + procedure TfpgBaseTextEdit.SetFontDesc(const AValue: string); begin FFont.Free; @@ -468,6 +476,11 @@ begin CaretPos.Y := AValue; end; +procedure TfpgBaseTextEdit.SetCaretPosV(const AValue: integer); +begin + CaretPos.X := AValue; +end; + procedure TfpgBaseTextEdit.SetVScrollPos(const AValue: Integer); begin SetVPos(AValue); -- cgit v1.2.3-70-g09d2 From 08ef76a72589a985b33fd010058f74879ae4f736 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 17 Mar 2013 12:18:55 +0000 Subject: textedit: temporary work-around to update scrollbars when setting caret position --- examples/apps/ide/src/fpg_textedit.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index c69ca907..013ad86b 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -138,7 +138,6 @@ type procedure SetVScrollPos(const AValue: Integer); procedure UpdateCharBounds; procedure GetSelBounds(var AStartNo, AEndNo, AStartOffs, AEndOffs: Integer); - procedure UpdateScrollBars; procedure VScrollBarMove(Sender: TObject; position: integer); procedure HScrollBarMove(Sender: TObject; position: integer); procedure SetVPos(p: Integer); @@ -185,6 +184,7 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; + procedure UpdateScrollBars; function GetClientRect: TfpgRect; override; function GetWordAtPos(const X, Y: Integer; out XBegin: Integer): TfpgString; procedure GetRowColAtPos(const X, Y: Integer; out Row, Col: Integer); -- cgit v1.2.3-70-g09d2 From a4e31a2c6404cf45a02ea3a481210af4fddf00fc Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 17 Mar 2013 12:20:05 +0000 Subject: ide: restore caret and scroll bar position after a file reload. For some reason the caret isn't displayed until the arrow keys are pressed, but it is in the correct location. --- examples/apps/ide/src/frm_main.pas | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index f5adaec6..821bcbf0 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -684,6 +684,8 @@ var ext: TfpgString; pos_h: integer; pos_v: integer; + cur_pos_h: integer; + cur_pos_v: integer; editor: TfpgTextEdit; begin s := AFilename; @@ -702,10 +704,15 @@ begin editor := TfpgTextEdit(pcEditor.Pages[i].Components[0]); pos_h := editor.ScrollPos_H; pos_v := editor.ScrollPos_V; + cur_pos_h := editor.CaretPos_H; + cur_pos_v := editor.CaretPos_V; editor.Lines.BeginUpdate; editor.LoadFromFile(s); editor.ScrollPos_H := pos_h; editor.ScrollPos_V := pos_v; + editor.CaretPos_H := cur_pos_h; + editor.CaretPos_V := cur_pos_v; + editor.UpdateScrollBars; editor.Lines.EndUpdate; pcEditor.ActivePageIndex := i; ts := pcEditor.ActivePage; -- cgit v1.2.3-70-g09d2 From bad688e8bff861be35d38534be7fe385e53d5065 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 17 Mar 2013 17:30:42 +0000 Subject: ide: refactored out the creation of a new editor tab sheet. --- examples/apps/ide/src/frm_main.pas | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 821bcbf0..e3876da4 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -109,6 +109,7 @@ type procedure ClearMessagesWindow; procedure CloseAllTabs; procedure LoadProject(const AFilename: TfpgString); + function CreateNewEditorTab(const ATitle: TfpgString): TfpgTabSheet; function OpenEditorPage(const AFilename: TfpgString): TfpgTabSheet; procedure miTest(Sender: TObject); function GetUnitsNode: TfpgTreeNode; @@ -673,6 +674,20 @@ begin AddMessage('Project loaded'); end; +function TMainForm.CreateNewEditorTab(const ATitle: TfpgString): TfpgTabSheet; +var + m: TfpgTextEdit; +begin + Result := pcEditor.AppendTabSheet(ATitle); + m := TfpgTextEdit.Create(Result); + m.SetPosition(1, 1, 200, 20); + m.Align := alClient; + m.FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2'); + m.GutterVisible := True; + m.GutterShowLineNumbers := True; + m.RightEdge := True; +end; + function TMainForm.OpenEditorPage(const AFilename: TfpgString): TfpgTabSheet; var s: TfpgString; @@ -680,7 +695,6 @@ var i: integer; found: Boolean; ts: TfpgTabSheet; - m: TfpgTextEdit; ext: TfpgString; pos_h: integer; pos_v: integer; @@ -721,17 +735,12 @@ begin else begin // we need a new tabsheet - ts := pcEditor.AppendTabSheet(f); - m := TfpgTextEdit.Create(ts); - m.SetPosition(1, 1, 200, 20); - m.Align := alClient; - m.FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2'); - m.GutterVisible := True; - m.GutterShowLineNumbers := True; - m.RightEdge := True; - TfpgTextEdit(ts.Components[0]).Lines.BeginUpdate; - TfpgTextEdit(ts.Components[0]).Lines.LoadFromFile(s); - TfpgTextEdit(ts.Components[0]).Lines.EndUpdate; + ts := CreateNewEditorTab(f); + editor := ts.Components[0] as TfpgTextEdit; + editor.Lines.BeginUpdate; + if fpgFileExists(s) then + editor.Lines.LoadFromFile(s); + editor.Lines.EndUpdate; if gINI.ReadBool(cEditor, 'SyntaxHighlighting', True) then begin ext := fpgExtractFileExt(AFilename); -- cgit v1.2.3-70-g09d2 From bb57101afc1d5cc6fbd523841d68a92071ecaf33 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 17 Mar 2013 17:41:00 +0000 Subject: ide: refactor out Adding Unit To Project code into separate method. --- examples/apps/ide/src/frm_main.pas | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index e3876da4..46d51352 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -95,6 +95,7 @@ type procedure miRecentProjectsClick(Sender: TObject; const FileName: String); procedure miProjectSave(Sender: TObject); procedure miProjectSaveAs(Sender: TObject); + procedure AddUnitToProject(const AUnitName: TfpgString); procedure miProjectAddUnitToProject(Sender: TObject); procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean); @@ -485,21 +486,15 @@ begin end; end; -procedure TMainForm.miProjectAddUnitToProject(Sender: TObject); +procedure TMainForm.AddUnitToProject(const AUnitName: TfpgString); var u: TUnit; s: TfpgString; r: TfpgTreeNode; n: TfpgTreeNode; begin - s := pcEditor.ActivePage.Hint; -// writeln('adding unit: ', s); - if s = '' then - Exit; - if GProject.UnitList.FileExists(s) then - Exit; u := TUnit.Create; - u.FileName := s; + u.FileName := AUnitName; u.Opened := True; GProject.UnitList.Add(u); // add reference to tabsheet @@ -512,6 +507,19 @@ begin tvProject.Invalidate; end; +procedure TMainForm.miProjectAddUnitToProject(Sender: TObject); +var + s: TfpgString; +begin + s := pcEditor.ActivePage.Hint; +// writeln('adding unit: ', s); + if s = '' then + Exit; + if GProject.UnitList.FileExists(s) then + Exit; + AddUnitToProject(s); +end; + procedure TMainForm.tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); var r: TfpgTreeNode; -- cgit v1.2.3-70-g09d2 From 485f07fba6f36c6dce3eb6d0c97756bbc4ec088e Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 09:29:04 +0000 Subject: ide: removed unused (debug) widgets from main form --- examples/apps/ide/src/frm_main.pas | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 46d51352..5c56a33e 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -39,8 +39,6 @@ type tsFiles: TfpgTabSheet; grdFiles: TfpgFileGrid; Splitter2: TfpgSplitter; - grdOpenFiles: TfpgStringGrid; - Splitter3: TfpgSplitter; pcEditor: TfpgPageControl; tseditor: TfpgTabSheet; TextEditor: TfpgTextEdit; @@ -1463,31 +1461,6 @@ begin Align := alLeft; end; - grdOpenFiles := TfpgStringGrid.Create(pnlClientArea); - with grdOpenFiles do - begin - Name := 'grdOpenFiles'; - SetPosition(516, 2, 120, 279); - Align := alRight; - BackgroundColor := TfpgColor($80000002); - AddColumn('File', 100, taLeftJustify); - FontDesc := '#Grid'; - HeaderFontDesc := '#GridHeader'; - Hint := ''; - RowCount := 0; - RowSelect := True; - ShowHeader := False; - TabOrder := 24; - end; - - Splitter3 := TfpgSplitter.Create(pnlClientArea); - with Splitter3 do - begin - Name := 'Splitter3'; - SetPosition(508, 2, 8, 279); - Align := alRight; - end; - pcEditor := TfpgPageControl.Create(pnlClientArea); with pcEditor do begin -- cgit v1.2.3-70-g09d2 From 56d6631a25ec08834b11bc911321a0c233cdf1e6 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 09:44:36 +0000 Subject: ide: hide debug button and messages via DEBUGSVR compiler define --- examples/apps/ide/src/frm_main.pas | 38 +++++++++++++++++++---------------- examples/apps/ide/src/maximus.project | 26 +++++++++++++----------- 2 files changed, 35 insertions(+), 29 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 5c56a33e..dacacc2a 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -22,7 +22,6 @@ type btnOpen: TfpgButton; btnSave: TfpgButton; btnSaveAll: TfpgButton; - btnTest: TfpgButton; pnlStatusBar: TfpgBevel; lblStatus: TfpgLabel; pnlClientArea: TfpgBevel; @@ -52,6 +51,9 @@ type mnuSettings: TfpgPopupMenu; mnuHelp: TfpgPopupMenu; {@VFD_HEAD_END: MainForm} + {$ifdef DEBUGSVR} + btnTest: TfpgButton; + {$endif} pmOpenRecentMenu: TfpgPopupMenu; miRecentProjects: TfpgMenuItem; FRecentFiles: TfpgMRU; @@ -773,12 +775,14 @@ var s: TfpgString; r: TfpgString; begin + {$ifdef DEBUGSVR} TempHourGlassCursor(TfpgWidget(self)); s := cMacro_Compiler + ' -FU' +cMacro_Target+' -Fu' + cMacro_FPGuiLibDir; -// writeln('source string = ', s); + SendDebug('source string = ' + s); r := GMacroList.ExpandMacro(s); -// writeln('expanded string = ', r); + SendDebug('expanded string = ' + r); sleep(5000); + {$endif} end; function TMainForm.GetUnitsNode: TfpgTreeNode; @@ -1283,20 +1287,6 @@ begin TabOrder := 6; end; - btnTest := TfpgButton.Create(Toolbar); - with btnTest do - begin - Name := 'btnTest'; - SetPosition(168, 2, 80, 24); - Text := 'test'; - Down := False; - FontDesc := '#Label1'; - Hint := ''; - ImageName := ''; - TabOrder := 7; - OnClick := @miTest; - end; - pnlStatusBar := TfpgBevel.Create(self); with pnlStatusBar do begin @@ -1659,6 +1649,20 @@ begin FRecentFiles.LoadMRU; {$IFDEF DEBUGSVR} + btnTest := TfpgButton.Create(Toolbar); + with btnTest do + begin + Name := 'btnTest'; + SetPosition(168, 2, 80, 24); + Text := 'test'; + Down := False; + FontDesc := '#Label1'; + Hint := ''; + ImageName := ''; + TabOrder := 7; + OnClick := @miTest; + end; + SendMethodExit('TMainForm.AfterCreate'); {$ENDIF} end; diff --git a/examples/apps/ide/src/maximus.project b/examples/apps/ide/src/maximus.project index 8c2f4261..6dab3088 100644 --- a/examples/apps/ide/src/maximus.project +++ b/examples/apps/ide/src/maximus.project @@ -3,16 +3,16 @@ ProjectName=maximus.project MainUnit=maximus.lpr TargetFile=maximus${EXEEXT} DefaultMake=0 -MakeOptionsCount=5 +MakeOptionsCount=6 MakeOptionEnabled1=1,1,1,1,1,1 MakeOptionEnabled2=1,1,1,1,1,0 -MakeOptionEnabled3=0,1,0,0,0,1 +MakeOptionEnabled3=1,1,0,0,0,1 MakeOptionEnabled4=0,0,0,0,1,1 -MacroCount=6 -Macro1=TargetCPU=x86_64 -Macro2=TargetOS=linux -Macro3=TargetCPU=i386 -Macro4=TargetOS=win32 +MacroCount=4 +Macro1=TargetCPU=i386 +Macro2=TargetOS=win32 +Macro3=FPGUI_DIR=/home/graemeg/programming/fpgui/ +Macro4=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/ Macro5=FPGUI_DIR=/home/graemeg/programming/fpgui/ Macro6=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/ UnitDirsCount=7 @@ -26,11 +26,13 @@ UnitDirEnabled7=0,0,0,0,1,1,1,0,0,0 UnitDirEnabled8=0,0,0,0,0,1,1,0,0,0 UnitOutputDir=units/${TARGET}/ MakeOptionEnabled5=1,0,0,0,0,0 +MakeOptionEnabled6=0,0,0,0,0,0 MakeOption1=-l -Mobjfpc -Sch MakeOption2=-g -gl -O- -gw2 -godwarfsets MakeOption3=-B MakeOption4=-O2 -XX -Xs -CX MakeOption5=-veiw +MakeOption6=-dDEBUGSVR UnitDir1=${FPGUIDIR}src/ UnitDir2=${FPGUIDIR}src/corelib/ UnitDir3=${FPGUIDIR}src/corelib/x11/ @@ -43,21 +45,21 @@ UnitDir7=${FPGUILIBDIR} UnitCount=20 Unit1=builderthread.pas,0 Unit2=filemonitor.pas,0 -Unit3=fpg_textedit.pas,0 +Unit3=fpg_textedit.pas,-1 Unit4=frm_configureide.pas,0 Unit5=frm_debug.pas,0 Unit6=frm_find.pas,-1 Unit7=frm_main.pas,-1 -Unit8=frm_procedurelist.pas,0 -Unit9=frm_projectoptions.pas,0 +Unit8=frm_procedurelist.pas,-1 +Unit9=frm_projectoptions.pas,-1 Unit10=ideconst.pas,0 Unit11=ideimages.pas,0 -Unit12=idemacros.pas,0 +Unit12=idemacros.pas,-1 Unit13=ideutils.pas,0 Unit14=maximus.lpr,0 Unit15=mPasLex.pas,0 Unit16=project.pas,-1 Unit17=sha1.pas,0 Unit18=stringhelpers.pas,0 -Unit19=synregexpr.pas,-1 +Unit19=synregexpr.pas,0 Unit20=unitlist.pas,0 -- cgit v1.2.3-70-g09d2 From bd19c7d966bcf7b1f7cf5f91eaae0347d5b29b39 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 10:34:56 +0000 Subject: ide: added copyright notices to the source code units. --- examples/apps/ide/src/builderthread.pas | 18 +++++++++++++++++- examples/apps/ide/src/filemonitor.pas | 16 ++++++++++++++++ examples/apps/ide/src/frm_configureide.pas | 16 ++++++++++++++++ examples/apps/ide/src/frm_debug.pas | 16 ++++++++++++++++ examples/apps/ide/src/frm_find.pas | 16 ++++++++++++++++ examples/apps/ide/src/frm_main.pas | 18 ++++++++++++++++++ examples/apps/ide/src/frm_procedurelist.pas | 16 ++++++++++++++++ examples/apps/ide/src/frm_projectoptions.pas | 16 ++++++++++++++++ examples/apps/ide/src/ideconst.pas | 16 ++++++++++++++++ examples/apps/ide/src/ideimages.pas | 16 ++++++++++++++++ examples/apps/ide/src/idemacros.pas | 16 ++++++++++++++++ examples/apps/ide/src/ideutils.pas | 20 ++++++++++++++++++-- examples/apps/ide/src/maximus.lpr | 16 ++++++++++++++++ examples/apps/ide/src/project.pas | 16 ++++++++++++++++ examples/apps/ide/src/stringhelpers.pas | 16 ++++++++++++++++ examples/apps/ide/src/unitlist.pas | 16 ++++++++++++++++ 16 files changed, 261 insertions(+), 3 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/builderthread.pas b/examples/apps/ide/src/builderthread.pas index bfdc48b1..b5a1ad6f 100644 --- a/examples/apps/ide/src/builderthread.pas +++ b/examples/apps/ide/src/builderthread.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit BuilderThread; {$mode objfpc}{$H+} @@ -115,7 +131,7 @@ begin finally FreeAndNil(p); end; - + end; procedure TBuilderThread.DoOutputLine; diff --git a/examples/apps/ide/src/filemonitor.pas b/examples/apps/ide/src/filemonitor.pas index 1c97185a..6d28642c 100644 --- a/examples/apps/ide/src/filemonitor.pas +++ b/examples/apps/ide/src/filemonitor.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit filemonitor; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/frm_configureide.pas b/examples/apps/ide/src/frm_configureide.pas index 2b2e42c1..fad0418f 100644 --- a/examples/apps/ide/src/frm_configureide.pas +++ b/examples/apps/ide/src/frm_configureide.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit frm_configureide; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/frm_debug.pas b/examples/apps/ide/src/frm_debug.pas index 267871c2..6991b916 100644 --- a/examples/apps/ide/src/frm_debug.pas +++ b/examples/apps/ide/src/frm_debug.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit frm_debug; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/frm_find.pas b/examples/apps/ide/src/frm_find.pas index 652d104d..3ec856f7 100644 --- a/examples/apps/ide/src/frm_find.pas +++ b/examples/apps/ide/src/frm_find.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit frm_find; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index dacacc2a..48e5b8b1 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -1,3 +1,21 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + Maximus IDE is an example application, to showcase a bit more of + what fpGUI can do in a larger project. It also ties in a lot of + various fpGUI widgets and framework functionality. +} + unit frm_main; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/frm_procedurelist.pas b/examples/apps/ide/src/frm_procedurelist.pas index b62e9a7f..14eb77dd 100644 --- a/examples/apps/ide/src/frm_procedurelist.pas +++ b/examples/apps/ide/src/frm_procedurelist.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit frm_procedurelist; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/frm_projectoptions.pas b/examples/apps/ide/src/frm_projectoptions.pas index 74178090..1e1c318a 100644 --- a/examples/apps/ide/src/frm_projectoptions.pas +++ b/examples/apps/ide/src/frm_projectoptions.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit frm_projectoptions; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/ideconst.pas b/examples/apps/ide/src/ideconst.pas index 03c43ec4..38973457 100644 --- a/examples/apps/ide/src/ideconst.pas +++ b/examples/apps/ide/src/ideconst.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit ideconst; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/ideimages.pas b/examples/apps/ide/src/ideimages.pas index 6963e6e9..929267af 100644 --- a/examples/apps/ide/src/ideimages.pas +++ b/examples/apps/ide/src/ideimages.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit ideimages; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/idemacros.pas b/examples/apps/ide/src/idemacros.pas index deee6507..e7632a07 100644 --- a/examples/apps/ide/src/idemacros.pas +++ b/examples/apps/ide/src/idemacros.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit idemacros; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/ideutils.pas b/examples/apps/ide/src/ideutils.pas index 672103f3..3a75dc0b 100644 --- a/examples/apps/ide/src/ideutils.pas +++ b/examples/apps/ide/src/ideutils.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit ideutils; {$mode objfpc}{$H+} @@ -101,7 +117,7 @@ type constructor Create(var AWidget: TfpgWidget); destructor Destroy; override; end; - + constructor TTempHourClassCursor.Create(var AWidget: TfpgWidget); begin inherited Create; @@ -115,7 +131,7 @@ begin FWidget.MouseCursor := FOldCursor; inherited Destroy; end; - + function TempHourGlassCursor(var AWidget: TfpgWidget): IInterface; diff --git a/examples/apps/ide/src/maximus.lpr b/examples/apps/ide/src/maximus.lpr index d481ba4a..1f758a43 100644 --- a/examples/apps/ide/src/maximus.lpr +++ b/examples/apps/ide/src/maximus.lpr @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + program maximus; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/project.pas b/examples/apps/ide/src/project.pas index cde77fdf..a337b81b 100644 --- a/examples/apps/ide/src/project.pas +++ b/examples/apps/ide/src/project.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit Project; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/stringhelpers.pas b/examples/apps/ide/src/stringhelpers.pas index 35fb9060..6e563da5 100644 --- a/examples/apps/ide/src/stringhelpers.pas +++ b/examples/apps/ide/src/stringhelpers.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit stringhelpers; {$mode objfpc}{$H+} diff --git a/examples/apps/ide/src/unitlist.pas b/examples/apps/ide/src/unitlist.pas index b8ca59ad..827326e7 100644 --- a/examples/apps/ide/src/unitlist.pas +++ b/examples/apps/ide/src/unitlist.pas @@ -1,3 +1,19 @@ +{ + fpGUI IDE - Maximus + + Copyright (C) 2012 - 2013 Graeme Geldenhuys + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + --- +} + unit UnitList; {$mode objfpc}{$H+} -- cgit v1.2.3-70-g09d2 From be0b02c02346b9dd17f37295bc84a3693c011a9b Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 10:38:00 +0000 Subject: ide: replaces RTL functions with fpGUI wrapper versions. --- examples/apps/ide/src/frm_main.pas | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 48e5b8b1..2c658fde 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -517,7 +517,7 @@ begin GProject.UnitList.Add(u); // add reference to tabsheet pcEditor.ActivePage.TagPointer := u; - s := ExtractRelativepath(GProject.ProjectDir, u.FileName); + s := fpgExtractRelativepath(GProject.ProjectDir, u.FileName); r := GetUnitsNode; n := r.AppendText(s); // add reference to treenode @@ -623,8 +623,7 @@ begin begin for i := 0 to GProject.UnitList.Count-1 do begin - {$Note ExtractRelativePath still needs a fpGUI wrapper } - s := ExtractRelativepath(GProject.ProjectDir, GProject.UnitList[i].FileName); + s := fpgExtractRelativepath(GProject.ProjectDir, GProject.UnitList[i].FileName); n := r.AppendText(s); n.Data := GProject.UnitList[i]; end; -- cgit v1.2.3-70-g09d2 From 3d6095876e7ec0bbd7b37f6f96ba8a6aa749e92d Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 11:32:12 +0000 Subject: ide: Adds the ability to add a new empty unit The new unit will be based on the ${templates}/default/unit.pas file. --- examples/apps/ide/src/frm_main.pas | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 2c658fde..6ef73f50 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -73,6 +73,7 @@ type btnTest: TfpgButton; {$endif} pmOpenRecentMenu: TfpgPopupMenu; + miFile: TfpgMenuItem; miRecentProjects: TfpgMenuItem; FRecentFiles: TfpgMRU; FRegex: TRegExpr; @@ -86,6 +87,7 @@ type procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure btnQuitClicked(Sender: TObject); procedure btnOpenFileClicked(Sender: TObject); + procedure miFileNewUnit(Sender: TObject); procedure miFileSave(Sender: TObject); procedure miFileSaveAs(Sender: TObject); procedure miEditCutClicked(Sender: TObject); @@ -197,6 +199,34 @@ begin end; end; +procedure TMainForm.miFileNewUnit(Sender: TObject); +var + newunit: TfpgString; + sl: TStringList; + FInternalMacroList: TIDEMacroList; + i: integer; +begin + if fpgInputQuery('New Unit', 'Please give the new unit a file name', newunit) then + begin + if GProject.UnitList.FileExists(newunit) then + begin + ShowMessage(Format('The unit <%s> already exists in the project', [newunit])); + Exit; + end; + sl := TStringList.Create; + try + sl.LoadFromFile(GMacroList.ExpandMacro('${TEMPLATEDIR}default/unit.pas')); + sl.Text := StringReplace(sl.Text, '${UNITNAME}', fpgChangeFileExt(fpgExtractFileName(newunit), ''), [rfReplaceAll, rfIgnoreCase]); + sl.SaveToFile(GProject.ProjectDir + newunit); + finally + sl.Free; + end; +// AddUnitToProject(newunit); + + OpenEditorPage(newunit); + end; +end; + procedure TMainForm.miFileSave(Sender: TObject); var s: TfpgString; @@ -1506,7 +1536,7 @@ begin begin Name := 'mnuFile'; SetPosition(476, 61, 172, 20); - AddMenuItem('New...', rsKeyCtrl+'N', nil).Enabled := False; + miFile := AddMenuItem('New...', rsKeyCtrl+'N', @miFileNewUnit); AddMenuItem('-', '', nil); AddMenuItem('Open...', rsKeyCtrl+'O', @btnOpenFileClicked); AddMenuItem('Open Recent', '', nil).Enabled := False; -- cgit v1.2.3-70-g09d2 From fec41b17a973b4e4e8d3dba75aef4634a1c72365 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 11:35:36 +0000 Subject: ide: set current directory as we load a project file. This means relative paths, used throughout the project, will be correct --- examples/apps/ide/src/project.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/project.pas b/examples/apps/ide/src/project.pas index a337b81b..a82a23c5 100644 --- a/examples/apps/ide/src/project.pas +++ b/examples/apps/ide/src/project.pas @@ -270,6 +270,7 @@ begin FIniFile := TfpgINIFile.CreateExt(AProjectFile); ProjectDir := fpgExtractFilePath(AProjectFile); + fpgSetCurrentDir(ProjectDir); ProjectName := FIniFile.ReadString(cProjectOptions, 'ProjectName', fpgChangeFileExt(fpgExtractFileName(AProjectFile), '')); MainUnit := FIniFile.ReadString(cProjectOptions, 'MainUnit', ''); TargetFile := FIniFile.ReadString(cProjectOptions, 'TargetFile', ''); -- cgit v1.2.3-70-g09d2 From 2d6b4ea463d5cae01af47d8763677ecc707d05a2 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 18 Mar 2013 11:36:08 +0000 Subject: ide: new empty unit template file. --- examples/apps/ide/src/templates/default/unit.pas | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 examples/apps/ide/src/templates/default/unit.pas (limited to 'examples/apps') diff --git a/examples/apps/ide/src/templates/default/unit.pas b/examples/apps/ide/src/templates/default/unit.pas new file mode 100644 index 00000000..b3837ea3 --- /dev/null +++ b/examples/apps/ide/src/templates/default/unit.pas @@ -0,0 +1,9 @@ +unit ${UNITNAME}; + +{$mode objfpc}{$H+} + +interface + +implementation + +end. -- cgit v1.2.3-70-g09d2 From 053f7cb975dbe506446fe2600e6a1e284ce45106 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 27 Mar 2013 17:38:32 +0000 Subject: maximus: new compiler options added for the Maximus project --- examples/apps/ide/src/maximus.project | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/ide/src/maximus.project b/examples/apps/ide/src/maximus.project index 6dab3088..31af43e3 100644 --- a/examples/apps/ide/src/maximus.project +++ b/examples/apps/ide/src/maximus.project @@ -3,7 +3,7 @@ ProjectName=maximus.project MainUnit=maximus.lpr TargetFile=maximus${EXEEXT} DefaultMake=0 -MakeOptionsCount=6 +MakeOptionsCount=7 MakeOptionEnabled1=1,1,1,1,1,1 MakeOptionEnabled2=1,1,1,1,1,0 MakeOptionEnabled3=1,1,0,0,0,1 @@ -15,7 +15,7 @@ Macro3=FPGUI_DIR=/home/graemeg/programming/fpgui/ Macro4=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/ Macro5=FPGUI_DIR=/home/graemeg/programming/fpgui/ Macro6=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/ -UnitDirsCount=7 +UnitDirsCount=8 UnitDirEnabled1=1,1,1,1,0,0,0,1,0,0 UnitDirEnabled2=1,1,1,1,0,0,1,1,0,0 UnitDirEnabled3=1,1,1,0,0,0,1,1,0,0 @@ -23,16 +23,18 @@ UnitDirEnabled4=0,0,0,1,0,0,1,1,0,0 UnitDirEnabled5=1,1,1,1,0,0,1,1,0,0 UnitDirEnabled6=1,1,1,1,0,0,1,0,0,0 UnitDirEnabled7=0,0,0,0,1,1,1,0,0,0 -UnitDirEnabled8=0,0,0,0,0,1,1,0,0,0 +UnitDirEnabled8=1,0,0,0,0,0,1,1,0,0 UnitOutputDir=units/${TARGET}/ MakeOptionEnabled5=1,0,0,0,0,0 -MakeOptionEnabled6=0,0,0,0,0,0 +MakeOptionEnabled6=1,0,0,0,0,0 +MakeOptionEnabled7=0,0,0,0,0,0 MakeOption1=-l -Mobjfpc -Sch MakeOption2=-g -gl -O- -gw2 -godwarfsets MakeOption3=-B MakeOption4=-O2 -XX -Xs -CX MakeOption5=-veiw MakeOption6=-dDEBUGSVR +MakeOption7=-dAGGCanvas UnitDir1=${FPGUIDIR}src/ UnitDir2=${FPGUIDIR}src/corelib/ UnitDir3=${FPGUIDIR}src/corelib/x11/ @@ -40,6 +42,7 @@ UnitDir4=${FPGUIDIR}src/corelib/gdi/ UnitDir5=${FPGUIDIR}src/gui/ UnitDir6=${FPGUIDIR}src/gui/db/ UnitDir7=${FPGUILIBDIR} +UnitDir8=${FPGUIDIR}src/corelib/render/software/ [Units] UnitCount=20 -- cgit v1.2.3-70-g09d2 From eeb8104ccaf2c75d4c36011983334c771ed855c3 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 3 Apr 2013 00:36:58 +0100 Subject: example: updates project file settings using a newer Laz IDE version --- examples/apps/docedit/docedit.lpi | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'examples/apps') diff --git a/examples/apps/docedit/docedit.lpi b/examples/apps/docedit/docedit.lpi index 640d3114..3e06fdd7 100644 --- a/examples/apps/docedit/docedit.lpi +++ b/examples/apps/docedit/docedit.lpi @@ -1,7 +1,7 @@ - + @@ -9,11 +9,13 @@ - - + + + + @@ -69,9 +71,19 @@ - + + + + + + + + + + + + - -- cgit v1.2.3-70-g09d2 From e0e06046ccff835ffd43f06337123d8970946f24 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 3 Apr 2013 00:37:19 +0100 Subject: examples: updates project to fix compiler error. --- examples/apps/docedit/frm_main.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/apps') diff --git a/examples/apps/docedit/frm_main.pas b/examples/apps/docedit/frm_main.pas index f6404b79..884a2d5b 100644 --- a/examples/apps/docedit/frm_main.pas +++ b/examples/apps/docedit/frm_main.pas @@ -63,7 +63,9 @@ type implementation uses - fpg_dialogs, frm_options; + fpg_dialogs, + fpg_constants, + frm_options; const -- cgit v1.2.3-70-g09d2 From bcd692ff5c6343ecfef3c4ad5c745b54e35ebf95 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 5 Apr 2013 13:33:36 +0100 Subject: fpGUI Debug Server now defaults executable name to 'dbugsrv'. This means that if we use the dbugintf unit, that we could automatically launch the debug server (if it is in the system PATH) if it is not already running. --- examples/apps/debugserver/fpgDebugServer.lpi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/apps') diff --git a/examples/apps/debugserver/fpgDebugServer.lpi b/examples/apps/debugserver/fpgDebugServer.lpi index da1b22f2..f26f35ee 100644 --- a/examples/apps/debugserver/fpgDebugServer.lpi +++ b/examples/apps/debugserver/fpgDebugServer.lpi @@ -54,7 +54,7 @@ - + -- cgit v1.2.3-70-g09d2