From 92b80ced3adc6dde8d9ac6915e22dca42d1f6c9c Mon Sep 17 00:00:00 2001 From: lazarus Date: Mon, 28 Aug 2000 14:23:49 +0000 Subject: [PATCH] Added a few files for the start of creating classes for the editor. [SHANE] git-svn-id: trunk@32 - --- .gitattributes | 4 + designer/abstracteditor.pp | 41 +++++++++++ designer/abstractfilesystem.pp | 65 ++++++++++++++++ designer/customeditor.pp | 57 +++++++++++++++ designer/filesystem.pp | 114 +++++++++++++++++++++++++++++ ide/ideeditor.pp | 10 ++- lcl/interfaces/gtk/gtkcallback.inc | 4 +- 7 files changed, 293 insertions(+), 2 deletions(-) create mode 100644 designer/abstracteditor.pp create mode 100644 designer/abstractfilesystem.pp create mode 100644 designer/customeditor.pp create mode 100644 designer/filesystem.pp diff --git a/.gitattributes b/.gitattributes index a5bc123bfe..f8c14454ce 100644 --- a/.gitattributes +++ b/.gitattributes @@ -67,10 +67,14 @@ components/synedit/source/syneditstrconst.pas svneol=native#text/pascal components/synedit/source/synedittextbuffer.pas svneol=native#text/pascal components/synedit/source/synedittypes.pas svneol=native#text/pascal components/synedit/source/utextdrawer.pas svneol=native#text/pascal +designer/abstracteditor.pp svneol=native#text/pascal +designer/abstractfilesystem.pp svneol=native#text/pascal designer/controlselection.pp svneol=native#text/pascal +designer/customeditor.pp svneol=native#text/pascal designer/designer.pp svneol=native#text/pascal designer/designerform.pp svneol=native#text/pascal designer/designerwidget.pp svneol=native#text/pascal +designer/filesystem.pp svneol=native#text/pascal designer/widgetstack.pp svneol=native#text/pascal examples/bitbtnform.pp svneol=native#text/pascal examples/bitbutton.pp svneol=native#text/pascal diff --git a/designer/abstracteditor.pp b/designer/abstracteditor.pp new file mode 100644 index 0000000000..f22e44d69a --- /dev/null +++ b/designer/abstracteditor.pp @@ -0,0 +1,41 @@ +{ + /*************************************************************************** + AbstractEditor.pp + ------------------- + + + + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +} +unit AbstractEditor; + +{$mode objfpc} + +interface + +uses + classes, Controls, forms,buttons,sysutils, Graphics,Extctrls; + +type + + TAbstractEditor = class + public + Function BufferModified : Boolean; virtual; abstract; + Function LinesInBuffer : Longint; virtual; abstract; + Function Filename : String; virtual; abstract; + end; + + +implementation + +end. diff --git a/designer/abstractfilesystem.pp b/designer/abstractfilesystem.pp new file mode 100644 index 0000000000..9018896ccb --- /dev/null +++ b/designer/abstractfilesystem.pp @@ -0,0 +1,65 @@ + { + /*************************************************************************** + AbstractFileSystem.pp + ------------------- + + + + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +} +unit AbstractFileSystem; + +{$mode objfpc} + +interface + +uses + classes; + +type + TFilename : String; + +{ TAbstractFileSystem + FileAge -- Returns the date/time of the file in a longint. + + GetFileStream -- Creates and returns a TStream for the Filename + passed into it. + + RenameFile -- Renames a file. Returns TRUE is successful + + IsReadOnly -- Returns TRUE if file is READONLY. + + DeleteFile -- Returns TRUE if successful; + + FileExists -- Returns TRUE if the file exists + + GetBackupFileName -- Returns a string which represents the backup name for + the filename passed into the function. It uses the + name passed into it to calculate the backup name. +} + + TAbstractFileSystem = class + public + Function FileAge(const Filename : TFilename) : Longint; virtual; abstract; + Function GetFileStream(const Filename : TFilename; Mode : Integer): TStream; virtual; abstract; + Function RenameFile(const Oldname, Newname : TFilename): Boolean; virtual; abstract; + Function IsReadOnly(const Filename : TFilename): Boolean; virtual; abstract; + Function DeleteFile(const Filename : TFilename): Boolean; virtual; abstract; + Function FileExists(const Filename : TFilename) : Boolean; virtual; abstract + Function GetBackupFileName(const Filename : TFilename): TFilename; virtual; abstract; + end; + + +implementation + +end. diff --git a/designer/customeditor.pp b/designer/customeditor.pp new file mode 100644 index 0000000000..90afa0f198 --- /dev/null +++ b/designer/customeditor.pp @@ -0,0 +1,57 @@ +{ + /*************************************************************************** + CustomEditor.pp + ------------------- + + + + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +} +unit CustomEditor; + +{$mode objfpc} + +interface + +uses + classes,AbstractEditor, FileSystem; + +type + + TCustomEditor = class(TAbstractEditor) + private + FSource : TStrings; //Holds the source retrieved from TFileSystem + Function GetSource: TStrings; //Returns the source from TFileSystem + Procedure SetSource(value : TStrings); //Set's the source in the TFileSystem + public + constructor Create; + destructor destroy; + Function Filename : String; override; + property Source: TStrings read GetSource write SetSource; //Holds the source retrieved from TFileSystem + end; + + +implementation + +constructor TCustomEditor.Create; +Begin +//Create the TFileSystem +end; + +Function TCustomEditor.GetSource : TStrings; +Begin +Result := nil; +End; + + +end. diff --git a/designer/filesystem.pp b/designer/filesystem.pp new file mode 100644 index 0000000000..db560808ad --- /dev/null +++ b/designer/filesystem.pp @@ -0,0 +1,114 @@ + { + /*************************************************************************** + FileSystem.pp + ------------------- + + + + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +} +unit FileSystem; + +{$mode objfpc} + +interface + +uses + classes; + +type + +{ TFileSystem + FileAge -- Returns the date/time of the file in a longint. + + GetFileStream -- Creates and returns a TStream for the Filename + passed into it. + + RenameFile -- Renames a file. Returns TRUE is successful + + IsReadOnly -- Returns TRUE if file is READONLY. + + DeleteFile -- Returns TRUE if successful; + + FileExists -- Returns TRUE if the file exists + + GetBackupFileName -- Returns a string which represents the backup name for + the filename passed into the function. It uses the + name passed into it to calculate the backup name. +} + + TFileSystem = class(TAbstractFileSystem) + private + FileStream : TFileStream; + public + constructor Create; + Function FileAge(const Filename : TFilename) : Longint; override; + Function GetFileStream(const Filename : TFilename; Mode : Integer): TStream; override; + Function RenameFile(const Oldname, Newname : TFilename): Boolean; override; + Function IsReadOnly(const Filename : TFilename): Boolean; override; + Function DeleteFile(const Filename : TFilename): Boolean; override; + Function FileExists(const Filename : TFilename) : Boolean; override; + Function GetBackupFileName(const Filename : TFilename): TFilename; override; + end; + + +implementation + +constructor TFileSystem.Create; +Begin +//don't create the file stream here. It's created by the GEtFileStream + +end; + +Function TFileSystem.FileAge(const Filename : TFilename) : Longint; +Begin + +end; + +Function TFileSystem.GetFileStream(const Filename : TFilename; Mode : Integer): TStream; +Begin +if Assigned(FileStream) then + Begin + + end; +FFileStream := TFIleStream.Create(FileName,Mode); +Result := FFileStream; +end; + +Function TFileSystem.RenameFile(const Oldname, Newname : TFilename): Boolean; +Begin + +end; + +Function TFileSystem.IsReadOnly(const Filename : TFilename): Boolean; +Begin + +end; + +Function TFileSystem.DeleteFile(const Filename : TFilename): Boolean; +Begin + +end; + +Function TFileSystem.FileExists(const Filename : TFilename) : Boolean; +Begin + +end; + +Function TFileSystem.GetBackupFileName(const Filename : TFilename): TFilename; +Begin + +end; + + +end. diff --git a/ide/ideeditor.pp b/ide/ideeditor.pp index 93992a8477..6687fa5f4b 100644 --- a/ide/ideeditor.pp +++ b/ide/ideeditor.pp @@ -69,6 +69,7 @@ type Procedure DeletePage(Value : Integer); Function GetEditorfromPage(Value : Integer) : TmwCustomEdit; Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer); + Procedure KeyPressed(Sender : TObject; var key: char); property CurrentSource : TStrings read GetCurrentSource; property CurrentCursorXLine : Integer read GetCurrentCursorXLine write SetCurrentCursorXLine; property CurrentCursorYLine : Integer read GetCurrentCursorYLine write SetCurrentCursorYLine; @@ -169,11 +170,18 @@ begin // TmwPasSyn(HighLighter).CommentAttri.Foreground := clNavy; // TmwPasSyn(HighLighter).NumberAttri.Foreground := clRed; // TmwPasSyn(HighLighter).KeyAttri.Foreground := clGreen; - + OnKeyPress := @KeyPRessed; end; end; +Procedure TIDEEditor.KeyPressed(Sender : TObject; var key: char); +Begin +writeln('KEYPRESS '+inttostr(ord(key))); +end; + + + Procedure TIDEEditor.IDEEditorPaint(Sender : TObject); Begin Assert(False, 'Trace:IDEEDitor paint...'); diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index 0ba48e4c37..17a1341b5d 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -1023,7 +1023,6 @@ begin if VirtKeyCode = VK_UNKNOWN then ListCode := KEYMAP_VKUNKNOWN and KeyCode else ListCode := VirtKeyCode; - if Extended then ListCode := ListCode or KEYMAP_EXTENDED; case theType of @@ -1069,6 +1068,9 @@ end; { ============================================================================= $Log$ + Revision 1.5 2000/08/28 14:23:49 lazarus + Added a few files for the start of creating classes for the editor. [SHANE] + Revision 1.4 2000/08/11 14:59:09 lazarus Adding all the Synedit files. Changed the GDK_KEY_PRESS and GDK_KEY_RELEASE stuff to fix the problem in the editor with the shift key being ignored.