mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 22:15:55 +02:00
Added a few files for the start of creating classes for the editor. [SHANE]
git-svn-id: trunk@32 -
This commit is contained in:
parent
5672e45e1d
commit
92b80ced3a
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -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
|
||||
|
41
designer/abstracteditor.pp
Normal file
41
designer/abstracteditor.pp
Normal file
@ -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.
|
65
designer/abstractfilesystem.pp
Normal file
65
designer/abstractfilesystem.pp
Normal file
@ -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.
|
57
designer/customeditor.pp
Normal file
57
designer/customeditor.pp
Normal file
@ -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.
|
114
designer/filesystem.pp
Normal file
114
designer/filesystem.pp
Normal file
@ -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.
|
@ -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...');
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user