home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 October
/
Chip_2001-10_cd1.bin
/
zkuste
/
delphi
/
nastroje
/
d3456
/
KBMWABD.ZIP
/
WABD_Reg.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
2001-07-16
|
16KB
|
631 lines
unit WABD_Reg;
{$include kbmWABD.inc}
interface
uses
Classes,
WABD_Objects,
{$ifdef LEVEL6}
PropertyCategories,
DesignEditors,
DesignIntf
{$else}
DsgnIntf
{$endif}
;
type
TWABDAboutProperty = class(TClassProperty)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TWABD_Form_Comp_Editor = class(TComponentEditor)
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
public
procedure DesignForm;
end;
TTable_Strings_Editor = class(TPropertyEditor)
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TString_List_Editor = class(TPropertyEditor)
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TWABDEditFormProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
function GetName: string; override;
end;
TWABDEditFramesetProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
function GetName: string; override;
end;
TWABDEditTreeNodes = class(TComponentEditor)
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string; override;
function GetVerbCount: Integer; override;
public
procedure DesignForm;
end;
TWABDEditTreeProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
function GetName: string; override;
end;
TWABDHotSpotProperty = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TWABDFileNameProperty = class(TStringProperty)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
TWABDJSFunctionProperty = class(TClassProperty)
public
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;
procedure Register;
procedure RegisterWABDComponent(WABDClass: TWABD_ObjectClass);
procedure RegisterWABDComponents(WABDClasses: array of TWABD_ObjectClass);
function GetWABDClassListCount: integer;
function GetWABDClassListItem(i: integer): TWABD_ObjectClass;
var
WABDClassList : TList;
implementation
uses
Dialogs,
Forms,
SysUtils,
WABD_About,
WABD_FormEditor,
WABD_FormSecEditor,
WABD_FramesetEditor,
WABD_HotspotEditor,
WABD_StrListEditor,
WABD_TableStrEditor,
WABD_TreeEditor,
WABD_EditTable;
var
FormEditor : TWABDFormEditor;
FramesetEditor : TWABDFramesetEditor;
HotSpotEditor : THSEditForm;
TreeEditor : TWABDTreeEditor;
// ************************************************************************
// About box property editor.
// ************************************************************************
procedure TWABDAboutProperty.Edit;
var
f : TWABDAboutForm;
begin
f := TWABDAboutForm.Create(Application);
try
f.ShowModal;
Modified;
finally
f.Free;
end;
end;
function TWABDAboutProperty.GetValue: string;
begin
Result := '(Click Me)';
end;
function TWABDAboutProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
// ************************************************************************
// Form property editor.
// ************************************************************************
procedure TWABD_Form_Comp_Editor.DesignForm;
begin
if FormEditor=nil then FormEditor := TWABDFormEditor.Create(nil);
FormEditor.WABDForm := Component as TWABD_Form;
FormEditor.MyDesigner := Designer;
FormEditor.Initialize;
FormEditor.Show;
end;
procedure TWABD_Form_Comp_Editor.ExecuteVerb(Index: Integer);
begin
case Index of
0: DesignForm;
end;
end;
function TWABD_Form_Comp_Editor.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := '&Design WABD Form...';
end;
end;
function TWABD_Form_Comp_Editor.GetVerbCount: Integer;
begin
Result := 1;
end;
// ************************************************************************
// Table strings property editor.
// ************************************************************************
procedure TTable_Strings_Editor.Edit;
var
d : TTableStrings_Editor;
begin
d := TTableStrings_Editor.Create(nil);
try
d.EditStrings(TWABD_Table_Strings(GetOrdValue));
SetOrdValue(GetOrdValue);
finally
d.Free;
end;
end;
function TTable_Strings_Editor.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TTable_Strings_Editor.GetValue: string;
begin
Result := '(Table Strings)';
end;
// ************************************************************************
// TStrings property editor.
// ************************************************************************
procedure TString_List_Editor.Edit;
var
d : TStringList_Editor;
S: TStrings;
n: Integer;
begin
d := TStringList_Editor.Create(nil);
try
S := TStrings(Pointer(GetOrdValue));
D.Caption := 'Edit - '+ GetName;
D.Memo.Lines.Text := S.Text;
D.ShowModal;
for n := 0 to PropCount-1 do begin
S := TStrings(Pointer(GetOrdValueAt(n)));
S.Text := D.Memo.Lines.Text;
end;
try
Modified;
except
end;
finally
d.Free;
end;
end;
function TString_List_Editor.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TString_List_Editor.GetValue: string;
begin
Result := '(Strings)';
end;
// ************************************************************************
// Form property editor.
// ************************************************************************
function TWABDEditFormProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TWABDEditFormProperty.GetValue: string;
begin
Result := '(Click_Me)';
end;
function TWABDEditFormProperty.GetName: string;
begin
Result := 'Edit Form';
end;
procedure TWABDEditFormProperty.Edit;
begin
if FormEditor=nil then FormEditor := TWABDFormEditor.Create(nil);
FormEditor.WABDForm := TWABDEditForm(GetOrdValue).ParForm;
FormEditor.MyDesigner := Designer;
FormEditor.Initialize;
FormEditor.Show;
end;
// ************************************************************************
// Frameset property editor.
// ************************************************************************
function TWABDEditFramesetProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TWABDEditFramesetProperty.GetValue: string;
begin
Result := '(Click_Me)';
end;
function TWABDEditFramesetProperty.GetName: string;
begin
Result := 'Edit Frameset';
end;
procedure TWABDEditFramesetProperty.Edit;
begin
if FramesetEditor=nil then FramesetEditor := TWABDFramesetEditor.Create(nil);
FramesetEditor.WABDFrameset := TWABDEditFrameset(GetOrdValue).ParFrameset;
FramesetEditor.MyDesigner := Designer;
FramesetEditor.Initialize;
FramesetEditor.Show;
end;
// ************************************************************************
// Tree nodes property editor.
// ************************************************************************
procedure TWABDEditTreeNodes.DesignForm;
begin
if TreeEditor=nil then TreeEditor := TWABDTreeEditor.Create(nil);
TreeEditor.ParTree := Component as TWABD_Tree;
TreeEditor.MyDesigner := Designer;
TreeEditor.Init;
TreeEditor.Show;
end;
procedure TWABDEditTreeNodes.ExecuteVerb(Index: Integer);
begin
case Index of
0: DesignForm;
end;
end;
function TWABDEditTreeNodes.GetVerb(Index: Integer): string;
begin
case Index of
0: Result := '&Design WABD Tree structure...';
end;
end;
function TWABDEditTreeNodes.GetVerbCount: Integer;
begin
Result := 1;
end;
// ************************************************************************
// Tree property editor.
// ************************************************************************
function TWABDEditTreeProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TWABDEditTreeProperty.GetValue: string;
begin
Result := '(Click_Me)';
end;
function TWABDEditTreeProperty.GetName: string;
begin
Result := 'Edit Tree';
end;
procedure TWABDEditTreeProperty.Edit;
begin
if TreeEditor=nil then TreeEditor := TWABDTreeEditor.Create(nil);
TreeEditor.MyDesigner := Designer;
TreeEditor.ParTree := TWABDEditTree(GetOrdValue).ParTree;
TreeEditor.Init;
TreeEditor.Show;
end;
// ************************************************************************
// Hotspot property editor.
// ************************************************************************
procedure TWABDHotSpotProperty.Edit;
begin
if HotSpotEditor=nil then HotSpotEditor := THSEditForm.Create(nil);
HotSpotEditor.MyDesigner := Designer;
HotSpotEditor.ParImage := TWABD_HotSpots(GetOrdValue).ParImage;
HotSpotEditor.Init;
HotSpotEditor.Show;
end;
function TWABDHotSpotProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TWABDHotSpotProperty.GetValue: string;
begin
Result := '(Click_Me)';
end;
// ************************************************************************
// JSFunction property editor.
// ************************************************************************
function TWABDJSFunctionProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paSubProperties,paReadOnly];
end;
function TWABDJSFunctionProperty.GetValue: string;
var
p:pointer;
f:TWABD_JS_Function;
begin
p:=Pointer(GetOrdValue);
if (p = nil) then Result:=''
else begin
f:=TWABD_JS_Function(p);
Result:=f.Script;
end;
end;
// ************************************************************************
// Filename property editor.
// ************************************************************************
procedure TWABDFileNameProperty.Edit;
var
fo: TOpenDialog;
begin
fo := TOpenDialog.Create(nil);
fo.Filename := GetValue;
fo.Options := [ofPathMustExist,ofFileMustExist];
try
if fo.Execute then SetValue(fo.Filename);
finally
fo.Free;
end;
end;
function TWABDFileNameProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
function TWABDFileNameProperty.GetValue: string;
begin
Result := GetStrValue;
end;
// ************************************************************************
// RegisterWABDComponent - so you can create your own HTML components!
// ************************************************************************
procedure RegisterWABDComponents(WABDClasses: array of TWABD_ObjectClass);
var
i : integer;
begin
for i := Low(WABDClasses) to High(WABDClasses) do begin
RegisterWABDComponent(WABDClasses[i]);
end;
end;
procedure RegisterWABDComponent(WABDClass: TWABD_ObjectClass);
begin
if WABDClassList.IndexOf(WABDClass) = -1 then
WABDClassList.Add(WABDClass);
RegisterClasses([WABDClass]);
end;
function GetWABDClassListCount: integer;
begin
Result := WABDClassList.Count;
end;
function GetWABDClassListItem(i: integer): TWABD_ObjectClass;
begin
if (i < 0) or (i >= GetWABDClassListCount) then
Result := nil
else
Result := WABDClassList.Items[i];
end;
// ************************************************************************
// Registration
// ************************************************************************
procedure Register;
begin
RegisterComponentEditor(TWABD_Form, TWABD_Form_Comp_Editor);
RegisterPropertyEditor(TypeInfo(TWABD_Table_Strings), nil, '', TTable_Strings_Editor);
RegisterPropertyEditor(TypeInfo(TStrings), nil, '', TString_List_Editor);
RegisterPropertyEditor(TypeInfo(TWABDAbout), NIL, '', TWABDAboutProperty);
RegisterPropertyEditor(TypeInfo(TWABDEditForm), NIL, '', TWABDEditFormProperty);
RegisterPropertyEditor(TypeInfo(TWABDEditFrameset), NIL, '', TWABDEditFramesetProperty);
RegisterPropertyEditor(TypeInfo(TWABD_HotSpots), NIL, '', TWABDHotSpotProperty);
RegisterPropertyEditor(TypeInfo(TFileName), TWABD_Base_Image, '', TWABDFileNameProperty);
RegisterPropertyEditor(TypeInfo(TWABD_JS_Function), nil, '', TWABDJSFunctionProperty);
RegisterComponentEditor(TWABD_Tree, TWABDEditTreeNodes);
RegisterPropertyEditor(TypeInfo(TWABDEditTree), NIL, '', TWABDEditTreeProperty);
RegisterComponents('kbmWABD', [
TWABD_SessionMgr,
TWABD_Session,
TWABD_Admin,
TWABD_Setup,
TWABD_Frameset,
TWABD_Frame,
TWABD_ExternalFrame,
TWABD_MenuTree,
TWABD_Form,
TWABD_HTML,
TWABD_HTMLFile,
TWABD_Javascript]);
RegisterNoIcon([
TWABD_FormSection,
TWABD_Header,
TWABD_HTMLSection,
TWABD_HTMLFileSection,
TWABD_Expires,
TWABD_Autorefresh,
TWABD_Autoload,
TWABD_Table,
TWABD_DataTable,
TWABD_EditTable,
TWABD_DBEditTable,
TWABD_Hidden,
TWABD_BlankLines,
TWABD_Anchor,
TWABD_Image,
TWABD_LiveImage,
TWABD_HotSpot,
TWABD_TreeNode,
TWABD_Label,
TWABD_HTMLEmbed,
TWABD_HTMLFileEmbed,
TWABD_Memo,
TWABD_Button,
TWABD_Edit,
TWABD_ComboBox,
TWABD_RadioButton,
TWABD_ListBox,
TWABD_CheckBox,
TWABD_Chart,
{ TWABD_DBNavigator, }
TWABD_UploadFile]);
end;
initialization
Randomize;
WABDClassList := TList.Create;
IsMultiThread := true;
FormEditor := nil;
FramesetEditor := nil;
HotSpotEditor := nil;
TreeEditor := nil;
RegisterWABDComponents([
TWABD_FormSection,
TWABD_Header,
TWABD_HTMLSection,
TWABD_HTMLFileSection,
TWABD_Autoload,
TWABD_Expires,
TWABD_AutoRefresh,
TWABD_Table,
TWABD_DataTable,
TWABD_Hidden,
TWABD_BlankLines,
TWABD_EditTable,
{ TWABD_DBNavigator, }
TWABD_DBEditTable]);
RegisterClasses([
TWABD_Admin,
TWABD_Setup,
TWABD_Frameset,
TWABD_Frame,
TWABD_ExternalFrame,
TWABD_FormSection,
TWABD_Header,
TWABD_HTMLSection,
TWABD_HTMLFileSection,
TWABD_JS_Function,
TWABD_Autoload,
TWABD_Expires,
TWABD_AutoRefresh,
TWABD_Table,
TWABD_DataTable,
TWABD_Hidden,
TWABD_BlankLines,
TWABD_Anchor,
TWABD_Image,
TWABD_LiveImage,
TWABD_HotSpot,
TWABD_TreeNode,
TWABD_Label,
TWABD_HTMLEmbed,
TWABD_HTMLFileEmbed,
TWABD_Memo,
TWABD_Button,
TWABD_Edit,
TWABD_ComboBox,
TWABD_RadioButton,
TWABD_ListBox,
TWABD_CheckBox,
TWABD_UploadFile,
TWABD_Table_Strings,
TWABD_HotSpots,
TWABD_Chart,
TWABD_MenuTree,
TWABD_EditTable,
TWABD_DBEditTable]);
finalization
WABDClassList.Free;
FormEditor.Free;
FramesetEditor.Free;
HotSpotEditor.Free;
TreeEditor.Free;
end.