[sword-cvs] sword/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Design TntActnList.dcr,NONE,1.1 TntButtons.dcr,NONE,1.1 TntComCtrls.dcr,NONE,1.1 TntComCtrls_Design.pas,NONE,1.1 TntDesignEditors_Design.pas,NONE,1.1 TntExtCtrls.dcr,NONE,1.1 TntForms.dcr,NONE,1.1 TntForms_Design.pas,NONE,1.1 TntGrids.dcr,NONE,1.1 TntMenus.dcr,NONE,1.1 TntMenus_Design.pas,NONE,1.1 TntStdCtrls.dcr,NONE,1.1 TntStrEdit_Design.dfm,NONE,1.1 TntStrEdit_Design.pas,NONE,1.1 TntThemeMgr.DCR,NONE,1.1 TntUnicodeVcl_Register.pas,NONE,1.1
sword@www.crosswire.org
sword@www.crosswire.org
Wed, 22 Jan 2003 17:02:45 -0700
- Previous message: [sword-cvs] sword/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Example - New directory
- Next message: [sword-cvs] sword/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Example ExampleUnicode.cfg,NONE,1.1 ExampleUnicode.dof,NONE,1.1 ExampleUnicode.dpr,NONE,1.1 ExampleUnicode.res,NONE,1.1 MainFrm.dfm,NONE,1.1 MainFrm.pas,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/local/cvsroot/sword/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Design
In directory www:/tmp/cvs-serv22744/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Design
Added Files:
TntActnList.dcr TntButtons.dcr TntComCtrls.dcr
TntComCtrls_Design.pas TntDesignEditors_Design.pas
TntExtCtrls.dcr TntForms.dcr TntForms_Design.pas TntGrids.dcr
TntMenus.dcr TntMenus_Design.pas TntStdCtrls.dcr
TntStrEdit_Design.dfm TntStrEdit_Design.pas TntThemeMgr.DCR
TntUnicodeVcl_Register.pas
Log Message:
Update TntUnicodeControls to that of January 18 2003
includes bcb projects for BCB5 and BCB6 that should be added to the respective sword workspaces
removed files that weren't need any more
needs tested for BCB5
updated BCB6 project that actually works will follow asap
--- NEW FILE: TntActnList.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntButtons.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntComCtrls.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntComCtrls_Design.pas ---
unit TntComCtrls_Design;
interface
uses
{$IFDEF VER130} DsgnIntf, Menus, {$ELSE} DesignIntf, DesignMenus, DesignEditors, {$ENDIF}
Classes, ComCtrls;
type
{$IFDEF VER130}
IPrepareMenuItem = TMenuItem{TNT-ALLOW TMenuItem};
{$ELSE}
IPrepareMenuItem = IMenuItem;
{$ENDIF}
TTntListViewEditor = class(TComponentEditor)
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string{TNT-ALLOW string}; override;
function GetVerbCount: Integer; override;
end;
TTntPageControlEditor = class(TComponentEditor)
private
function PageControl: TPageControl{TNT-ALLOW TPageControl};
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string{TNT-ALLOW string}; override;
function GetVerbCount: Integer; override;
procedure PrepareItem(Index: Integer; const AItem: IPrepareMenuItem); override;
end;
procedure Register;
implementation
uses {$IFNDEF VER130} DsnConst, {$ENDIF} TntComCtrls, TntDesignEditors_Design;
procedure Register;
begin
RegisterComponentEditor(TTntListView, TTntListViewEditor);
RegisterComponentEditor(TTntPageControl, TTntPageControlEditor);
RegisterComponentEditor(TTntTabSheet, TTntPageControlEditor);
end;
{ TTntListViewEditor }
function TTntListViewEditor.GetVerbCount: Integer;
begin
Result := 2;
end;
{$IFDEF VER130}
resourcestring
SListColumnsEditor = 'Columns Editor...';
SListItemsEditor = 'Items Editor...';
{$ENDIF}
function TTntListViewEditor.GetVerb(Index: Integer): string{TNT-ALLOW string};
begin
case Index of
0: Result := SListColumnsEditor;
1: Result := SListItemsEditor;
end;
end;
procedure TTntListViewEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0: EditPropertyWithDialog(Component, 'Columns', Designer);
1: EditPropertyWithDialog(Component, 'Items', Designer);
end;
end;
{ TTntPageControlEditor }
function TTntPageControlEditor.PageControl: TPageControl{TNT-ALLOW TPageControl};
begin
if Component is TTabSheet{TNT-ALLOW TTabSheet} then
Result := TTabSheet{TNT-ALLOW TTabSheet}(Component).PageControl
else
Result := Component as TPageControl{TNT-ALLOW TPageControl};
end;
function TTntPageControlEditor.GetVerbCount: Integer;
begin
Result := 4;
end;
{$IFDEF VER130}
resourcestring
SNewPage = 'New Page';
SNextPage = 'Next Page';
SPrevPage = 'Previous Page';
SDeletePage = 'Delete Page';
{$ENDIF}
function TTntPageControlEditor.GetVerb(Index: Integer): string{TNT-ALLOW string};
begin
case Index of
0: Result := SNewPage;
1: Result := SNextPage;
2: Result := SPrevPage;
3: Result := SDeletePage;
end;
end;
procedure TTntPageControlEditor.PrepareItem(Index: Integer; const AItem: IPrepareMenuItem);
begin
AItem.Enabled := (Index <> 3) or (PageControl.PageCount > 0);
end;
type TAccessPageControl = class(TPageControl{TNT-ALLOW TPageControl});
procedure TTntPageControlEditor.ExecuteVerb(Index: Integer);
procedure CreateNewTabSheet;
var
NewTabsheet: TTntTabSheet;
begin
NewTabSheet := TTntTabSheet.Create(PageControl.Owner);
NewTabSheet.PageControl := Self.PageControl;
with NewTabSheet do begin
Name := Designer.UniqueName(ClassName);
Caption := Name;
Visible := True;
end;
PageControl.ActivePage := NewTabSheet;
end;
{$IFDEF VER130}
procedure SelectNextPage(GoForward: Boolean);
var
Page: TTabSheet{TNT-ALLOW TTabSheet};
begin
with TAccessPageControl(PageControl) do begin
Page := FindNextPage(ActivePage, GoForward, False);
if (Page <> nil) and (Page <> ActivePage) and CanChange then
begin
ActivePage := Page;
Change;
end;
end;
end;
{$ELSE}
procedure SelectNextPage(GoForward: Boolean);
begin
PageControl.SelectNextPage(GoForward, False);
end;
{$ENDIF}
begin
case Index of
0: CreateNewTabSheet;
1: SelectNextPage(True);
2: SelectNextPage(False);
3: if PageControl.ActivePage <> nil then
PageControl.ActivePage.Free;
end;
end;
end.
--- NEW FILE: TntDesignEditors_Design.pas ---
{*******************************************************}
{ The Delphi Unicode Controls Project }
{ }
{ http://home.ccci.org/wolbrink }
{ }
{ Copyright (c) 2002, Troy Wolbrink (wolbrink@ccci.org) }
{ }
{*******************************************************}
unit TntDesignEditors_Design;
interface
uses Classes, Messages, Windows, Graphics, Controls, Forms, TypInfo,
{$IFDEF VER130} DsgnIntf; {$ELSE} DesignIntf, DesignEditors, VCLEditors; {$ENDIF}
type
{$IFDEF VER130}
ICreateDesigner = IFormDesigner;
{$ELSE}
ICreateDesigner = IDesigner;
{$ENDIF}
{$IFDEF VER130}
TWideStringProperty = class(TPropertyEditor)
{$ELSE}
TWideStringProperty = class(TPropertyEditor, ICustomPropertyDrawing)
{$ENDIF}
private
FActivateWithoutGetValue: Boolean;
FPropList: PInstPropList;
protected
{$IFDEF VER130}
procedure SetPropEntry(Index: Integer; AInstance: TPersistent; APropInfo: PPropInfo);
{$ELSE}
procedure SetPropEntry(Index: Integer; AInstance: TPersistent; APropInfo: PPropInfo); override;
{$ENDIF}
function GetWideStrValueAt(Index: Integer): WideString;
function GetWideStrValue: WideString;
procedure SetWideStrValue(const Value: WideString);
function GetWideVisualValue: WideString;
public
constructor Create(const ADesigner: ICreateDesigner; APropCount: Integer); override;
destructor Destroy; override;
{$IFDEF VER130}
procedure Initialize; override;
{$ENDIF}
procedure Activate; override;
procedure PropDrawName(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); {$IFDEF VER130} override; {$ENDIF}
procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); {$IFDEF VER130} override; {$ENDIF}
function AllEqual: Boolean; override;
function GetEditLimit: Integer; override;
function GetValue: AnsiString; override;
procedure SetValue(const Value: AnsiString); override;
end;
TWideCaptionProperty = class(TWideStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
end;
function GetObjectInspectorForm: TCustomForm;
procedure EditPropertyWithDialog(Component: TPersistent; const PropName: AnsiString; const Designer: ICreateDesigner);
procedure Register;
implementation
uses SysUtils, StdCtrls, TntClasses, TntGraphics, TntControls, TntWideStrPropHelper;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(WideString), nil, '', TWideStringProperty);
RegisterPropertyEditor(TypeInfo(TWideCaption), nil, '', TWideCaptionProperty);
end;
{//------------------------------
// Helpful discovery routines to explore the components and classes inside the IDE...
//
procedure EnumerateComponents(Comp: TComponent);
var
i: integer;
begin
for i := Comp.ComponentCount - 1 downto 0 do
MessageBoxW(0, PWideChar(WideString(Comp.Components[i].Name + ': ' + Comp.Components[i].ClassName)),
PWideChar(WideString(Comp.Name)), 0);
end;
procedure EnumerateClasses(Comp: TComponent);
var
AClass: TClass;
begin
AClass := Comp.ClassType;
repeat
MessageBoxW(0, PWideChar(WideString(AClass.ClassName)),
PWideChar(WideString(Comp.Name)), 0);
AClass := Aclass.ClassParent;
until AClass = nil;
end;
//------------------------------}
//------------------------------
function GetIdeMainForm: TCustomForm;
var
Comp: TComponent;
begin
Result := nil;
if Application <> nil then begin
Comp := Application.FindComponent('AppBuilder');
if Comp is TCustomForm then
Result := TCustomForm(Comp);
end;
end;
function GetObjectInspectorForm: TCustomForm;
var
Comp: TComponent;
IdeMainForm: TCustomForm;
begin
Result := nil;
IdeMainForm := GetIdeMainForm;
if IdeMainForm <> nil then begin
Comp := IdeMainForm.FindComponent('PropertyInspector');
if Comp is TCustomForm then
Result := TCustomForm(Comp);
end;
end;
function GetOIInspListBox: TWinControl;
var
ObjectInspectorForm: TCustomForm;
Comp: TComponent;
begin
Result := nil;
ObjectInspectorForm := GetObjectInspectorForm;
if ObjectInspectorForm <> nil then begin
Comp := ObjectInspectorForm.FindComponent('PropList');
if Comp is TWinControl then
Result := TWinControl(Comp);
end;
end;
function GetOIPropInspEdit: TCustomEdit{TNT-ALLOW TCustomEdit};
var
OIInspListBox: TWinControl;
Comp: TComponent;
begin
Result := nil;
OIInspListBox := GetOIInspListBox;
if OIInspListBox <> nil then begin
Comp := OIInspListBox.FindComponent('EditControl');
if Comp is TCustomEdit{TNT-ALLOW TCustomEdit} then
Result := TCustomEdit{TNT-ALLOW TCustomEdit}(Comp);
end;
end;
//------------------------------
type TAccessWinControl = class(TWinControl);
{ TWideStringProperty }
var
WideStringPropertyCount: Integer = 0;
constructor TWideStringProperty.Create(const ADesigner: ICreateDesigner; APropCount: Integer);
begin
inherited;
Inc(WideStringPropertyCount);
GetMem(FPropList, APropCount * SizeOf(TInstProp));
end;
destructor TWideStringProperty.Destroy;
var
Edit: TCustomEdit{TNT-ALLOW TCustomEdit};
begin
Dec(WideStringPropertyCount);
if (WideStringPropertyCount = 0)
and (Win32PlatformIsUnicode) then begin
Edit := GetOIPropInspEdit;
if Assigned(Edit)
and IsWindowUnicode(Edit.Handle) then
TAccessWinControl(Edit).RecreateWnd;
end;
if FPropList <> nil then
FreeMem(FPropList, PropCount * SizeOf(TInstProp));
inherited;
end;
{$IFDEF VER130}
type
TDelphi_5_PropertyEditor = class
FDesigner: IFormDesigner;
FPropList: PInstPropList;
end;
procedure TWideStringProperty.Initialize;
var
I: Integer;
begin
for I := 0 to PropCount - 1 do
with TDelphi_5_PropertyEditor(Self).FPropList[I] do
SetPropEntry(I, Instance, PropInfo);
end;
{$ENDIF}
procedure TWideStringProperty.Activate;
var
Edit: TCustomEdit{TNT-ALLOW TCustomEdit};
begin
FActivateWithoutGetValue := True;
if (Win32PlatformIsUnicode) then begin
Edit := GetOIPropInspEdit;
if Assigned(Edit)
and (not IsWindowUnicode(Edit.Handle)) then
ReCreateUnicodeWnd(Edit, 'EDIT', True);
end;
end;
procedure TWideStringProperty.SetPropEntry(Index: Integer;
AInstance: TPersistent; APropInfo: PPropInfo);
begin
inherited;
with FPropList^[Index] do
begin
Instance := AInstance;
PropInfo := APropInfo;
end;
end;
function TWideStringProperty.GetWideStrValueAt(Index: Integer): WideString;
begin
with FPropList^[Index] do Result := GetWideStrProp(Instance, PropInfo);
end;
function TWideStringProperty.GetWideStrValue: WideString;
begin
Result := GetWideStrValueAt(0);
end;
procedure TWideStringProperty.SetWideStrValue(const Value: WideString);
var
I: Integer;
begin
for I := 0 to PropCount - 1 do
with FPropList^[I] do SetWideStrProp(Instance, PropInfo, Value);
Modified;
end;
function TWideStringProperty.GetWideVisualValue: WideString;
begin
if AllEqual then
Result := GetWideStrValue
else
Result := '';
end;
procedure TWideStringProperty.PropDrawName(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
begin
{$IFDEF VER130}
inherited;
{$ELSE}
DefaultPropertyDrawName(Self, ACanvas, ARect);
{$ENDIF}
end;
procedure TWideStringProperty.PropDrawValue(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
begin
WideCanvasTextRect(ACanvas, ARect, ARect.Left + 1, ARect.Top + 1, GetWideVisualValue);
end;
function TWideStringProperty.AllEqual: Boolean;
var
I: Integer;
V: WideString;
begin
Result := False;
if PropCount > 1 then
begin
V := GetWideStrValue;
for I := 1 to PropCount - 1 do
if GetWideStrValueAt(I) <> V then Exit;
end;
Result := True;
end;
function TWideStringProperty.GetEditLimit: Integer;
var
Edit: TCustomEdit{TNT-ALLOW TCustomEdit};
begin
Result := MaxInt;
// GetEditLimit is called right after the inplace editor text has been set
if Win32PlatformIsUnicode then begin
Edit := GetOIPropInspEdit;
if Assigned(Edit) then begin
WideSetWindowText(Edit, GetWideStrValue);
WideSetWindowHint(Edit, GetWideStrValue);
end;
end;
end;
function TWideStringProperty.GetValue: AnsiString;
begin
FActivateWithoutGetValue := False;
Result := GetWideStrValue;
end;
procedure TWideStringProperty.SetValue(const Value: AnsiString);
var
Edit: TCustomEdit{TNT-ALLOW TCustomEdit};
begin
if (not FActivateWithoutGetValue) then begin
Edit := GetOIPropInspEdit;
if Assigned(Edit) and Win32PlatformIsUnicode then
SetWideStrValue(WideGetWindowText(Edit))
else
SetWideStrValue(Value);
end;
end;
{ TWideCaptionProperty }
function TWideCaptionProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect, paAutoUpdate, paRevertable];
end;
{ TPropertyEditorWithDialog }
type
TPropertyEditorWithDialog = class
private
FPropName: AnsiString;
{$IFDEF VER130}
procedure CheckEditProperty(Prop: TPropertyEditor);
{$ELSE}
procedure CheckEditProperty(const Prop: IProperty);
{$ENDIF}
procedure EditProperty(Component: TPersistent; const PropName: AnsiString; const Designer: ICreateDesigner);
end;
{$IFDEF VER130}
procedure TPropertyEditorWithDialog.CheckEditProperty(Prop: TPropertyEditor);
begin
if Prop.GetName = FPropName then
Prop.Edit;
end;
procedure TPropertyEditorWithDialog.EditProperty(Component: TPersistent; const PropName: AnsiString; const Designer: ICreateDesigner);
var
Components: TDesignerSelectionList;
begin
FPropName := PropName;
Components := TDesignerSelectionList.Create;
try
Components.Add(Component);
GetComponentProperties(Components, [tkClass], Designer, CheckEditProperty);
finally
Components.Free;
end;
end;
{$ELSE}
procedure TPropertyEditorWithDialog.CheckEditProperty(const Prop: IProperty);
begin
if Prop.GetName = FPropName then
Prop.Edit;
end;
procedure TPropertyEditorWithDialog.EditProperty(Component: TPersistent; const PropName: AnsiString; const Designer: ICreateDesigner);
var
Components: IDesignerSelections;
begin
FPropName := PropName;
Components := TDesignerSelections.Create;
Components.Add(Component);
GetComponentProperties(Components, [tkClass], Designer, CheckEditProperty);
end;
{$ENDIF}
procedure EditPropertyWithDialog(Component: TPersistent; const PropName: AnsiString; const Designer: ICreateDesigner);
begin
with TPropertyEditorWithDialog.Create do
try
EditProperty(Component, PropName, Designer);
finally
Free;
end;
end;
end.
--- NEW FILE: TntExtCtrls.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntForms.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntForms_Design.pas ---
{*******************************************************}
{ The Delphi Unicode Controls Project }
{ }
{ http://home.ccci.org/wolbrink }
{ }
{ Copyright (c) 2002, Troy Wolbrink (wolbrink@ccci.org) }
{ }
{*******************************************************}
unit TntForms_Design;
interface
uses Classes, Windows, ExptIntf;
type
TTntNewFormExpert = class(TIExpert)
protected
function ThisFormName: WideString;
function ThisFormClass: TComponentClass; virtual; abstract;
public
function GetName: AnsiString; override;
function GetAuthor: AnsiString; override;
function GetPage: AnsiString; override;
function GetGlyph: HICON; override;
function GetStyle: TExpertStyle; override;
function GetState: TExpertState; override;
function GetIDString: AnsiString; override;
function GetMenuText: AnsiString; override;
procedure Execute; override;
end;
procedure Register;
implementation
uses TntForms, {$IFDEF VER130} DsgnIntf, {$ELSE} DesignIntf, DesignEditors, {$ENDIF}
EditIntf, ToolIntf, WCtlForm, TypInfo, SysUtils;
type
TTntNewTntFormExpert = class(TTntNewFormExpert)
protected
function ThisFormClass: TComponentClass; override;
public
function GetName: AnsiString; override;
function GetComment: AnsiString; override;
end;
TTntNewTntFrameExpert = class(TTntNewFormExpert)
protected
function ThisFormClass: TComponentClass; override;
public
function GetName: AnsiString; override;
function GetComment: AnsiString; override;
end;
TTntFrameCustomModule = class(TWinControlCustomModule)
public
{$IFDEF VER130}
class function Nestable: Boolean; override;
{$ELSE}
function Nestable: Boolean; override;
{$ENDIF}
end;
TTntFormCustomModule = class(TCustomModule)
{$IFNDEF VER130}
class function DesignClass: TComponentClass; override;
{$ENDIF}
end;
procedure SafeRegisterLibraryExpert(Expert: TIExpert);
begin
try
RegisterLibraryExpert(Expert);
except
{ Sometimes the IDE thinks an expert is being registered twice when a }
{ required package is recompiled causing this package to be reloaded. }
{ Ignoring this error seems to cause no problems. }
end;
end;
procedure Register;
begin
RegisterCustomModule(TTntFrame{TNT-ALLOW TTntFrame}, TTntFrameCustomModule);
SafeRegisterLibraryExpert(TTntNewTntFrameExpert.Create);
RegisterClasses([TTntFrame{TNT-ALLOW TTntFrame}]);
//--
RegisterCustomModule(TTntForm{TNT-ALLOW TTntForm}, TTntFormCustomModule);
SafeRegisterLibraryExpert(TTntNewTntFormExpert.Create);
RegisterClasses([TTntForm{TNT-ALLOW TTntForm}]);
end;
{ TTntNewFormExpert }
function TTntNewFormExpert.ThisFormName: WideString;
begin
Result := ThisFormClass.ClassName;
Delete(Result, 1, 1); // drop the 'T'
end;
function TTntNewFormExpert.GetName: AnsiString;
begin
Result := ThisFormName;
end;
function TTntNewFormExpert.GetAuthor: AnsiString;
begin
Result := 'Troy Wolbrink';
end;
function TTntNewFormExpert.GetPage: AnsiString;
begin
Result := 'New';
end;
function TTntNewFormExpert.GetGlyph: HICON;
begin
Result := 0;
end;
function TTntNewFormExpert.GetStyle: TExpertStyle;
begin
Result := esForm;
end;
function TTntNewFormExpert.GetState: TExpertState;
begin
Result := [esEnabled];
end;
function TTntNewFormExpert.GetIDString: AnsiString;
begin
Result := 'Tnt.Create_'+ThisFormName+'.Wizard';
end;
function TTntNewFormExpert.GetMenuText: AnsiString;
begin
Result := '';
end;
procedure AddUnitToUses(Module: TIModuleInterface; UnitName: WideString);
const
UnitFileSize = 8192; // 8k ought to be enough for everybody!
var
Editor: TIEditorInterface;
Reader: TIEditReader;
Writer: TIEditWriter;
Buffer, P: PAnsiChar;
StartPos: Integer;
begin
(* Warning: add the necessary routines for C++Builder *)
Buffer := StrAlloc(UnitFileSize);
Editor := Module.GetEditorInterface;
try
Reader := Editor.CreateReader;
try
StartPos := Reader.GetText(0, Buffer, UnitFileSize);
P := StrPos{TNT-ALLOW StrPos}(Buffer, 'uses'); // Locate uses
P := StrPos{TNT-ALLOW StrPos}(P, ';'); // Locate the semi-colon afterwards
if Assigned(P) then
StartPos := Integer(P - Buffer)
else
StartPos := -1;
finally
Reader.Free;
end;
if StartPos <> -1 then
begin
Writer := Editor.CreateWriter;
try
Writer.CopyTo(StartPos);
Writer.Insert(PAnsiChar(AnsiString(', ' + UnitName)));
finally
Writer.Free;
end;
end;
finally
Editor.Release;
StrDispose(Buffer);
end;
end;
procedure TTntNewFormExpert.Execute;
var
ModuleName, FormName, FileName: AnsiString;
Module: TIModuleInterface;
begin
ToolServices.GetNewModuleAndClassName(ThisFormName, ModuleName, FormName, FileName);
Module := ToolServices.CreateModuleEx(FileName, FormName, ThisFormName, '', nil, nil,
[cmNewForm, cmUnNamed, cmMarkModified, cmAddToProject, cmShowForm, cmShowSource]);
try
AddUnitToUses(Module, GetTypeData(PTypeInfo(ThisFormClass.ClassInfo)).UnitName);
except
end;
end;
{ TTntNewTntFormExpert }
function TTntNewTntFormExpert.ThisFormClass: TComponentClass;
begin
Result := TTntForm{TNT-ALLOW TTntForm};
end;
function TTntNewTntFormExpert.GetName: AnsiString;
begin
Result := ThisFormName + ' (Unicode)'
end;
function TTntNewTntFormExpert.GetComment: AnsiString;
begin
Result := 'Creates a new Unicode enabled TntForm';
end;
{ TTntNewTntFrameExpert }
function TTntNewTntFrameExpert.ThisFormClass: TComponentClass;
begin
Result := TTntFrame{TNT-ALLOW TTntFrame};
end;
function TTntNewTntFrameExpert.GetName: AnsiString;
begin
Result := ThisFormName + ' (Unicode)'
end;
function TTntNewTntFrameExpert.GetComment: AnsiString;
begin
Result := 'Creates a new Unicode enabled TntFrame';
end;
{ TTntFrameCustomModule }
{$IFDEF VER130}
class function TTntFrameCustomModule.Nestable: Boolean;
{$ELSE}
function TTntFrameCustomModule.Nestable: Boolean;
{$ENDIF}
begin
Result := True;
end;
{ TTntFormCustomModule }
{$IFNDEF VER130}
class function TTntFormCustomModule.DesignClass: TComponentClass;
begin
Result := TTntForm{TNT-ALLOW TTntForm};
end;
{$ENDIF}
end.
--- NEW FILE: TntGrids.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntMenus.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntMenus_Design.pas ---
{*******************************************************}
{ The Delphi Unicode Controls Project }
{ }
{ http://home.ccci.org/wolbrink }
{ }
{ Copyright (c) 2002, Troy Wolbrink (wolbrink@ccci.org) }
{ }
{*******************************************************}
{ Special Thanks to Francisco Leong for getting these }
{ menu designer enhancements to work on Delphi 5. }
{*******************************************************}
unit TntMenus_Design;
interface
uses Windows, Classes, Menus, TntMenus, Forms, Messages, Controls,
{$IFDEF VER130} DsgnIntf; {$ELSE} MnuBuild, DesignEditors, DesignIntf; {$ENDIF}
type
TTntMenuEditor = class(TComponentEditor)
public
procedure ExecuteVerb(Index: Integer); override;
function GetVerb(Index: Integer): string{TNT-ALLOW string}; override;
function GetVerbCount: Integer; override;
end;
procedure Register;
implementation
uses {$IFDEF VER130} DsgnWnds, {$ELSE} MnuConst, {$ENDIF} SysUtils, Graphics, ActnList,
Dialogs, TntDesignEditors_Design;
procedure Register;
begin
RegisterComponentEditor(TTntMainMenu, TTntMenuEditor);
RegisterComponentEditor(TTntPopupMenu, TTntMenuEditor);
end;
function GetMenuBuilder: TForm{TNT-ALLOW TForm};
{$IFNDEF VER130}
begin
Result := MenuEditor;
{$ELSE}
var
Comp: TComponent;
begin
Result := nil;
if Application <> nil then
begin
Comp := Application.FindComponent('MenuBuilder');
if Comp is TForm{TNT-ALLOW TForm} then
Result := TForm{TNT-ALLOW TForm}(Comp);
end;
{$ENDIF}
end;
{$IFDEF VER130}
type
THackMenuBuilder = class(TDesignWindow)
protected
Fields: array[1..23] of TObject;
FWorkMenu: TMenuItem{TNT-ALLOW TMenuItem};
end;
{$ENDIF}
function GetMenuBuilder_WorkMenu(MenuBuilder: TForm{TNT-ALLOW TForm}): TMenuItem{TNT-ALLOW TMenuItem};
begin
if MenuBuilder = nil then
Result := nil
else begin
{$IFDEF VER130}
Result := THackMenuBuilder(MenuBuilder).FWorkMenu;
Assert((Result = nil) or (Result is TMenuItem{TNT-ALLOW TMenuItem}),
'TNT Internal Error: THackMenuBuilder has incorrect internal layout.');
{$ELSE}
Result := MenuEditor.WorkMenu;
{$ENDIF}
end;
end;
{$IFDEF VER130}
type
THackMenuItemWin = class(TCustomControl)
protected
FxxxxCaptionExtent: Integer;
FMenuItem: TMenuItem{TNT-ALLOW TMenuItem};
end;
{$ENDIF}
function GetMenuItem(Control: TWinControl; DoVerify: Boolean = True): TMenuItem{TNT-ALLOW TMenuItem};
begin
{$IFDEF VER130}
if Control.ClassName = 'TMenuItemWin' then begin
Result := THackMenuItemWin(Control).FMenuItem;
Assert((Result = nil) or (Result is TMenuItem{TNT-ALLOW TMenuItem}), 'TNT Internal Error: Unexpected TMenuItem field layout.');
end
{$ELSE}
if Control is TMenuItemWin then
Result := TMenuItemWin(Control).MenuItem
{$ENDIF}
else if DoVerify then
raise Exception.Create('TNT Internal Error: Control is not a TMenuItemWin.')
else
Result := nil;
end;
procedure SetMenuItem(Control: TWinControl; Item: TMenuItem{TNT-ALLOW TMenuItem});
begin
{$IFDEF VER130}
if Control.ClassName = 'TMenuItemWin' then begin
THackMenuItemWin(Control).FMenuItem := Item;
// quick and dirty way to update object inspector (this doesn't seem to make a difference)
with GetMenuBuilder do
begin
LockWindowUpdate(GetDesktopWindow);
try
Hide;
Show;
finally
LockWindowUpdate(0);
end;
end;
end
{$ELSE}
if Control is TMenuItemWin then
TMenuItemWin(Control).MenuItem := Item
{$ENDIF}
else
raise Exception.Create('TNT Internal Error: Control is not a TMenuItemWin.');
end;
procedure ReplaceMenuItem(Control: TWinControl; ANewItem: TMenuItem{TNT-ALLOW TMenuItem});
var
OldItem: TMenuItem{TNT-ALLOW TMenuItem};
OldName: string{TNT-ALLOW string};
begin
OldItem := GetMenuItem(Control, True);
OldName := OldItem.Name;
{$IFDEF VER130}
SetMenuItem(Control, ANewItem);
FreeAndNil(OldItem);
ANewItem.Name := OldName; { assume old name }
{$ELSE}
FreeAndNil(OldItem);
ANewItem.Name := OldName; { assume old name }
SetMenuItem(Control, ANewItem);
{$ENDIF}
end;
{ TTntMenuBuilderChecker }
type
TMenuBuilderChecker = class(TComponent)
private
FMenuBuilder: TForm{TNT-ALLOW TForm};
FCheckMenuAction: TAction;
FLastCaption: string{TNT-ALLOW string};
FLastActiveControl: TControl;
FLastMenuItem: TMenuItem{TNT-ALLOW TMenuItem};
procedure CheckMenuItems(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
var MenuBuilderChecker: TMenuBuilderChecker = nil;
constructor TMenuBuilderChecker.Create(AOwner: TComponent);
begin
inherited;
MenuBuilderChecker := Self;
FCheckMenuAction := TAction.Create(Self);
FCheckMenuAction.OnUpdate := CheckMenuItems;
FCheckMenuAction.OnExecute := CheckMenuItems;
FMenuBuilder := AOwner as TForm{TNT-ALLOW TForm};
FMenuBuilder.Action := FCheckMenuAction;
end;
destructor TMenuBuilderChecker.Destroy;
begin
FMenuBuilder := nil;
MenuBuilderChecker := nil;
inherited;
end;
function CreateTntMenuItem(OldItem: TMenuItem{TNT-ALLOW TMenuItem}): TTntMenuItem;
var
OldName: AnsiString;
OldParent: TMenuItem{TNT-ALLOW TMenuItem};
OldIndex: Integer;
OldItemsList: TList;
j: integer;
begin
// item should be converted.
OldItemsList := TList.Create;
try
// clone properties
Result := TTntMenuItem.Create(OldItem.Owner);
Result.Action := OldItem.Action;
{$IFNDEF VER130}
Result.AutoCheck := OldItem.AutoCheck;
{$ENDIF}
Result.AutoHotkeys := OldItem.AutoHotkeys;
Result.AutoLineReduction := OldItem.AutoLineReduction;
Result.Bitmap := OldItem.Bitmap;
Result.Break := OldItem.Break;
Result.Caption := OldItem.Caption;
Result.Checked := OldItem.Checked;
Result.Default := OldItem.Default;
Result.Enabled := OldItem.Enabled;
Result.GroupIndex := OldItem.GroupIndex;
Result.HelpContext := OldItem.HelpContext;
Result.Hint := OldItem.Hint;
Result.ImageIndex := OldItem.ImageIndex;
Result.MenuIndex := OldItem.MenuIndex;
Result.RadioItem := OldItem.RadioItem;
Result.ShortCut := OldItem.ShortCut;
Result.SubMenuImages := OldItem.SubMenuImages;
Result.Visible := OldItem.Visible;
Result.Tag := OldItem.Tag;
// clone events
Result.OnAdvancedDrawItem := OldItem.OnAdvancedDrawItem;
Result.OnClick := OldItem.OnClick;
Result.OnDrawItem := OldItem.OnDrawItem;
Result.OnMeasureItem := OldItem.OnMeasureItem;
// remember name, parent, index, children
OldName := OldItem.Name;
OldParent := OldItem.Parent;
OldIndex := OldItem.MenuIndex;
for j := OldItem.Count - 1 downto 0 do begin
OldItemsList.Insert(0, OldItem.Items[j]);
OldItem.Remove(OldItem.Items[j]);
end;
// clone final parts of old item
for j := 0 to OldItemsList.Count - 1 do
Result.Add(TMenuItem{TNT-ALLOW TMenuItem}(OldItemsList[j])); { add children }
if OldParent <> nil then
OldParent.Insert(OldIndex, Result); { insert into parent }
finally
OldItemsList.Free;
end;
end;
procedure CheckMenuItemWin(MenuItemWin: TWinControl; PartOfATntMenu: Boolean);
var
OldItem: TMenuItem{TNT-ALLOW TMenuItem};
begin
OldItem := GetMenuItem(MenuItemWin);
if OldItem = nil then
exit;
if (OldItem.ClassType = TMenuItem{TNT-ALLOW TMenuItem})
and (PartOfATntMenu or (OldItem.Parent is TTntMenuItem)) then
begin
{$IFNDEF VER130}
if MenuItemWin.Focused then
MenuItemWin.Parent.SetFocus; {Lose focus and regain later to ensure object inspector gets updated.}
{$ENDIF}
ReplaceMenuItem(MenuItemWin, CreateTntMenuItem(OldItem));
end else if (OldItem.ClassType = TTntMenuItem)
and (OldItem.Parent = nil) and (OldItem.Caption = '') and (OldItem.Name = '')
and not (PartOfATntMenu or (OldItem.Parent is TTntMenuItem)) then begin
{$IFNDEF VER130}
if MenuItemWin.Focused then
MenuItemWin.Parent.SetFocus; {Lose focus and regain later to ensure object inspector gets updated.}
{$ENDIF}
ReplaceMenuItem(MenuItemWin, TMenuItem{TNT-ALLOW TMenuItem}.Create(OldItem.Owner));
end;
end;
procedure TMenuBuilderChecker.CheckMenuItems(Sender: TObject);
var
a, i: integer;
MenuWin: TWinControl;
MenuItemWin: TWinControl;
SaveFocus: HWND;
PartOfATntMenu: Boolean;
WorkMenu: TMenuItem{TNT-ALLOW TMenuItem};
begin
if (FMenuBuilder <> nil)
and (FMenuBuilder.Action = FCheckMenuAction) then begin
if (FLastCaption <> FMenuBuilder.Caption)
or (FLastActiveControl <> FMenuBuilder.ActiveControl)
or (FLastMenuItem <> GetMenuItem(FMenuBuilder.ActiveControl, False))
then begin
try
try
with FMenuBuilder do begin
WorkMenu := GetMenuBuilder_WorkMenu(FMenuBuilder);
PartOfATntMenu := (WorkMenu <> nil)
and ((WorkMenu.Owner is TTntMainMenu) or (WorkMenu.Owner is TTntPopupMenu));
SaveFocus := Windows.GetFocus;
for a := ComponentCount - 1 downto 0 do begin
{$IFDEF VER130}
if Components[a].ClassName = 'TMenuWin' then begin
{$ELSE}
if Components[a] is TMenuWin then begin
{$ENDIF}
MenuWin := Components[a] as TWinControl;
with MenuWin do begin
for i := ComponentCount - 1 downto 0 do begin
{$IFDEF VER130}
if Components[i].ClassName = 'TMenuItemWin' then begin
{$ELSE}
if Components[i] is TMenuItemWin then begin
{$ENDIF}
MenuItemWin := Components[i] as TWinControl;
CheckMenuItemWin(MenuItemWin, PartOfATntMenu);
end;
end;
end;
end;
end;
if SaveFocus <> Windows.GetFocus then
Windows.SetFocus(SaveFocus);
end;
except
on E: Exception do begin
FMenuBuilder.Action := nil;
end;
end;
finally
FLastCaption := FMenuBuilder.Caption;
FLastActiveControl := FMenuBuilder.ActiveControl;
FLastMenuItem := GetMenuItem(FMenuBuilder.ActiveControl, False);
end;
end;
end;
end;
{ TTntMenuEditor }
function TTntMenuEditor.GetVerbCount: Integer;
begin
Result := 1;
end;
{$IFDEF VER130}
resourcestring
SMenuDesigner = 'Menu Designer...';
{$ENDIF}
function TTntMenuEditor.GetVerb(Index: Integer): string{TNT-ALLOW string};
begin
Result := SMenuDesigner;
end;
procedure TTntMenuEditor.ExecuteVerb(Index: Integer);
var
MenuBuilder: TForm{TNT-ALLOW TForm};
begin
EditPropertyWithDialog(Component, 'Items', Designer);
MenuBuilder := GetMenuBuilder;
if Assigned(MenuBuilder) then begin
if (MenuBuilderChecker = nil) or (MenuBuilderChecker.FMenuBuilder <> MenuBuilder) then begin
MenuBuilderChecker.Free;
MenuBuilderChecker := TMenuBuilderChecker.Create(MenuBuilder);
end;
EditPropertyWithDialog(Component, 'Items', Designer); // update menu builder caption
end;
end;
initialization
finalization
MenuBuilderChecker.Free; // design package might be recompiled
end.
--- NEW FILE: TntStdCtrls.dcr ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntStrEdit_Design.dfm ---
object TntStrEditDlg: TTntStrEditDlg
Left = 239
Top = 211
BorderStyle = bsDialog
Caption = 'Wide String List Editor'
ClientHeight = 279
ClientWidth = 430
Color = clBtnFace
ParentFont = True
OldCreateOrder = True
PopupMenu = StringEditorMenu
Position = poScreenCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Bevel1: TTntBevel
Left = 8
Top = 8
Width = 413
Height = 229
Shape = bsFrame
end
object LineCount: TTntLabel
Left = 12
Top = 12
Width = 169
Height = 17
AutoSize = False
Caption = '0 lines'
end
object UnicodeEnabledLbl: TTntLabel
Left = 334
Top = 12
Width = 79
Height = 13
Alignment = taRightJustify
Caption = 'Unicode Enabled'
Font.Charset = DEFAULT_CHARSET
Font.Color = clGreen
Font.Height = -11
Font.Name = 'MS Shell Dlg 2'
Font.Style = []
ParentFont = False
Visible = False
end
object CodeWndBtn: TTntButton
Left = 8
Top = 248
Width = 75
Height = 25
Caption = '&Code Editor...'
TabOrder = 0
OnClick = CodeWndBtnClick
end
object HelpButton: TTntButton
Left = 345
Top = 248
Width = 75
Height = 25
Caption = '&Help'
TabOrder = 3
OnClick = HelpButtonClick
end
object OKButton: TTntButton
Left = 185
Top = 248
Width = 75
Height = 25
Caption = '&OK'
Default = True
ModalResult = 1
TabOrder = 1
end
object CancelButton: TTntButton
Left = 265
Top = 248
Width = 75
Height = 25
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 2
end
object Memo: TTntMemo
Left = 16
Top = 31
Width = 397
Height = 197
ScrollBars = ssBoth
TabOrder = 4
WordWrap = False
OnChange = UpdateStatus
OnKeyDown = Memo1KeyDown
end
object OpenDialog: TOpenDialog
HelpContext = 26040
DefaultExt = 'TXT'
Filter =
'Text files (*.TXT)|*.TXT|Config files (*.SYS;*.INI)|*.SYS;*.INI|' +
'Batch files (*.BAT)|*.BAT|All files (*.*)|*.*'
Options = [ofHideReadOnly, ofShowHelp, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Title = 'Load string list'
Left = 200
Top = 88
end
object SaveDialog: TSaveDialog
HelpContext = 26050
Filter =
'Text files (*.TXT)|*.TXT|Config files (*.SYS;*.INI)|*.SYS;*.INI|' +
'Batch files (*.BAT)|*.BAT|All files (*.*)|*.*'
Options = [ofOverwritePrompt, ofHideReadOnly, ofShowHelp, ofPathMustExist, ofEnableSizing]
Title = 'Save string list'
Left = 228
Top = 88
end
object StringEditorMenu: TTntPopupMenu
Left = 168
Top = 88
object LoadItem: TTntMenuItem
Caption = '&Load...'
OnClick = FileOpenClick
end
object SaveItem: TTntMenuItem
Caption = '&Save...'
OnClick = FileSaveClick
end
object CodeEditorItem: TTntMenuItem
Caption = '&Code Editor...'
Visible = False
OnClick = CodeWndBtnClick
end
end
end
--- NEW FILE: TntStrEdit_Design.pas ---
{*******************************************************}
{ The Delphi Unicode Controls Project }
{ }
{ http://home.ccci.org/wolbrink }
{ }
{ Copyright (c) 2002, Troy Wolbrink (wolbrink@ccci.org) }
{ }
{*******************************************************}
// The following unit is adapted from StrEdit.pas.
unit TntStrEdit_Design;
interface
uses Windows, Classes, Graphics, Forms, Controls, Buttons, Dialogs, Menus, StdCtrls,
TntStdCtrls, ExtCtrls, {$IFDEF VER130} DsgnIntf, {$ELSE} DesignEditors, DesignIntf, {$ENDIF}
{$IFDEF JCL} JclUnicode, {$ELSE} Unicode, {$ENDIF} TntForms, TntMenus,
TntExtCtrls;
type
TTntStrEditDlg = class(TTntForm{TNT-ALLOW TTntForm})
CodeWndBtn: TTntButton;
OpenDialog: TOpenDialog{TNT-ALLOW TOpenDialog};
SaveDialog: TSaveDialog{TNT-ALLOW TSaveDialog};
HelpButton: TTntButton;
OKButton: TTntButton;
CancelButton: TTntButton;
StringEditorMenu: TTntPopupMenu;
LoadItem: TTntMenuItem;
SaveItem: TTntMenuItem;
CodeEditorItem: TTntMenuItem;
Bevel1: TTntBevel;
Memo: TTntMemo;
LineCount: TTntLabel;
UnicodeEnabledLbl: TTntLabel;
procedure FileOpenClick(Sender: TObject);
procedure FileSaveClick(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
procedure CodeWndBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Memo1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure UpdateStatus(Sender: TObject);
private
SingleLine: WideString;
MultipleLines: WideString;
protected
FModified: Boolean;
function GetLines: TWideStrings;
procedure SetLines(const Value: TWideStrings);
function GetLinesControl: TWinControl;
public
property Lines: TWideStrings read GetLines write SetLines;
end;
type
TWideStringListProperty = class(TClassProperty)
protected
function EditDialog: TTntStrEditDlg; virtual;
function GetStrings: TWideStrings; virtual;
procedure SetStrings(const Value: TWideStrings); virtual;
public
function GetAttributes: TPropertyAttributes; override;
procedure Edit; override;
end;
procedure Register;
implementation
{$R *.dfm}
uses ActiveX, SysUtils, DesignConst, ToolsAPI, IStreams, LibHelp,
StFilSys, TypInfo, TntDesignEditors_Design, TntClasses;
procedure Register;
begin
RegisterPropertyEditor(TypeInfo(TWideStrings), nil, '', TWideStringListProperty);
end;
type
TStringsModuleCreator = class(TInterfacedObject, IOTACreator, IOTAModuleCreator)
private
FFileName: WideString;
FStream: TStringStream{TNT-ALLOW TStringStream};
FAge: TDateTime;
public
constructor Create(const FileName: WideString; Stream: TStringStream{TNT-ALLOW TStringStream}; Age: TDateTime);
destructor Destroy; override;
{ IOTACreator }
function GetCreatorType: AnsiString;
function GetExisting: Boolean;
function GetFileSystem: AnsiString;
function GetOwner: IOTAModule;
function GetUnnamed: Boolean;
{ IOTAModuleCreator }
function GetAncestorName: AnsiString;
function GetImplFileName: AnsiString;
function GetIntfFileName: AnsiString;
function GetFormName: AnsiString;
function GetMainForm: Boolean;
function GetShowForm: Boolean;
function GetShowSource: Boolean;
function NewFormFile(const FormIdent, AncestorIdent: AnsiString): IOTAFile;
function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: AnsiString): IOTAFile;
function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: AnsiString): IOTAFile;
procedure FormCreated(const FormEditor: IOTAFormEditor);
end;
TOTAFile = class(TInterfacedObject, IOTAFile)
private
FSource: WideString;
FAge: TDateTime;
public
constructor Create(const ASource: WideString; AAge: TDateTime);
{ IOTAFile }
function GetSource: AnsiString;
function GetAge: TDateTime;
end;
{ TOTAFile }
constructor TOTAFile.Create(const ASource: WideString; AAge: TDateTime);
begin
inherited Create;
FSource := ASource;
FAge := AAge;
end;
function TOTAFile.GetAge: TDateTime;
begin
Result := FAge;
end;
function TOTAFile.GetSource: AnsiString;
begin
Result := FSource;
end;
{ TStringsModuleCreator }
constructor TStringsModuleCreator.Create(const FileName: WideString; Stream: TStringStream{TNT-ALLOW TStringStream};
Age: TDateTime);
begin
inherited Create;
FFileName := FileName;
FStream := Stream;
FAge := Age;
end;
destructor TStringsModuleCreator.Destroy;
begin
FStream.Free;
inherited;
end;
procedure TStringsModuleCreator.FormCreated(const FormEditor: IOTAFormEditor);
begin
{ Nothing to do }
end;
function TStringsModuleCreator.GetAncestorName: AnsiString;
begin
Result := '';
end;
function TStringsModuleCreator.GetCreatorType: AnsiString;
begin
Result := sText;
end;
function TStringsModuleCreator.GetExisting: Boolean;
begin
{$IFDEF VER130}
Result := False;
{$ELSE}
Result := True;
{$ENDIF}
end;
function TStringsModuleCreator.GetFileSystem: AnsiString;
begin
Result := sTStringsFileSystem;
end;
function TStringsModuleCreator.GetFormName: AnsiString;
begin
Result := '';
end;
function TStringsModuleCreator.GetImplFileName: AnsiString;
begin
Result := FFileName;
end;
function TStringsModuleCreator.GetIntfFileName: AnsiString;
begin
Result := '';
end;
function TStringsModuleCreator.GetMainForm: Boolean;
begin
Result := False;
end;
function TStringsModuleCreator.GetOwner: IOTAModule;
begin
Result := nil;
end;
function TStringsModuleCreator.GetShowForm: Boolean;
begin
Result := False;
end;
function TStringsModuleCreator.GetShowSource: Boolean;
begin
Result := True;
end;
function TStringsModuleCreator.GetUnnamed: Boolean;
begin
Result := False;
end;
function TStringsModuleCreator.NewFormFile(const FormIdent,
AncestorIdent: AnsiString): IOTAFile;
begin
Result := nil;
end;
function TStringsModuleCreator.NewImplSource(const ModuleIdent, FormIdent,
AncestorIdent: AnsiString): IOTAFile;
begin
Result := TOTAFile.Create(FStream.DataString, FAge);
end;
function TStringsModuleCreator.NewIntfSource(const ModuleIdent, FormIdent,
AncestorIdent: AnsiString): IOTAFile;
begin
Result := nil;
end;
{ TTntStrEditDlg }
procedure TTntStrEditDlg.FormCreate(Sender: TObject);
begin
HelpContext := hcDStringListEditor;
OpenDialog.HelpContext := hcDStringListLoad;
SaveDialog.HelpContext := hcDStringListSave;
SingleLine := srLine;
MultipleLines := srLines;
UnicodeEnabledLbl.Visible := IsWindowUnicode(Memo.Handle);
end;
procedure TTntStrEditDlg.FileOpenClick(Sender: TObject);
begin
with OpenDialog do
if Execute then Lines.LoadFromFile(FileName);
end;
procedure TTntStrEditDlg.FileSaveClick(Sender: TObject);
begin
SaveDialog.FileName := OpenDialog.FileName;
with SaveDialog do
if Execute then Lines.SaveToFile(FileName);
end;
procedure TTntStrEditDlg.HelpButtonClick(Sender: TObject);
begin
Application.HelpContext(HelpContext);
end;
procedure TTntStrEditDlg.CodeWndBtnClick(Sender: TObject);
begin
if (Memo.Text = WideString(AnsiString(Memo.Text)))
or (mrYes = MessageDlg(
'These strings contain extended characters which can not be converted to ANSI.'#13#10
+ 'Using the code editor could cause the loss of these extended characters.'#13#10
+ #13#10
+ 'Do you want to continue?', mtWarning, mbYesNoCancel, 0))
then
ModalResult := mrYes;
end;
function TTntStrEditDlg.GetLinesControl: TWinControl;
begin
Result := Memo;
end;
procedure TTntStrEditDlg.Memo1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_ESCAPE then CancelButton.Click;
end;
procedure TTntStrEditDlg.UpdateStatus(Sender: TObject);
var
Count: Integer;
LineText: WideString;
begin
if Sender = Memo then FModified := True;
Count := Lines.Count;
if Count = 1 then LineText := SingleLine
else LineText := MultipleLines;
LineCount.Caption := WideFormat('%d %s', [Count, LineText]);
end;
function TTntStrEditDlg.GetLines: TWideStrings;
begin
Result := Memo.Lines;
end;
procedure TTntStrEditDlg.SetLines(const Value: TWideStrings);
begin
Memo.Lines.Assign(Value);
end;
{ TWideStringListProperty }
function TWideStringListProperty.EditDialog: TTntStrEditDlg;
begin
Result := TTntStrEditDlg.Create(Application);
end;
function TWideStringListProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [paDialog] - [paSubProperties];
end;
function TWideStringListProperty.GetStrings: TWideStrings;
begin
Result := TWideStrings(GetOrdValue);
end;
procedure TWideStringListProperty.SetStrings(const Value: TWideStrings);
begin
SetOrdValue(Longint(Value));
end;
procedure TWideStringListProperty.Edit;
var
Ident: WideString;
Component: TComponent;
Module: IOTAModule;
Editor: IOTAEditor;
ModuleServices: IOTAModuleServices;
Stream: TStringStream{TNT-ALLOW TStringStream};
Age: TDateTime;
begin
Component := TComponent(GetComponent(0));
ModuleServices := BorlandIDEServices as IOTAModuleServices;
if (TObject(Component) is TComponent)
and (Component.Owner = Self.Designer.GetRoot)
{$IFNDEF VER130}
and (Self.Designer.GetRoot.Name <> '')
{$ENDIF}
then begin
Ident := Self.Designer.GetRoot.Name + DotSep +
Component.Name + DotSep + GetName;
Module := ModuleServices.FindModule(Ident);
end else Module := nil;
if (Module <> nil) and (Module.GetModuleFileCount > 0) then
Module.GetModuleFileEditor(0).Show
else with EditDialog do
try
if GetObjectInspectorForm <> nil then
Font.Assign(GetObjectInspectorForm.Font);
Lines := GetStrings;
UpdateStatus(nil);
FModified := False;
ActiveControl := GetLinesControl;
CodeEditorItem.Enabled := Ident <> '';
CodeWndBtn.Enabled := Ident <> '';
case ShowModal of
mrOk: SetStrings(Lines);
mrYes:
begin
{$IFNDEF VER130}
// this used to be done in LibMain's TLibrary.Create but now its done here
// the unregister is done over in ComponentDesigner's finalization
StFilSys.Register;
{$ENDIF}
Stream := TStringStream{TNT-ALLOW TStringStream}.Create('');
Lines.SaveToStream(Stream);
Stream.Position := 0;
Age := Now;
Module := ModuleServices.CreateModule(
TStringsModuleCreator.Create(Ident, Stream, Age));
if Module <> nil then
begin
with StringsFileSystem.GetTStringsProperty(Ident, Component, GetName) do
DiskAge := DateTimeToFileDate(Age);
Editor := Module.GetModuleFileEditor(0);
if FModified then
Editor.MarkModified;
Editor.Show;
end;
end;
end;
finally
Free;
end;
end;
end.
--- NEW FILE: TntThemeMgr.DCR ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: TntUnicodeVcl_Register.pas ---
unit TntUnicodeVcl_Register;
interface
procedure Register;
implementation
uses Classes, TntForms, TntMenus, TntStdCtrls, TntCheckLst, TntGrids, TntExtCtrls, TntComCtrls,
TntButtons;
const
TNT_STANDARD = 'Tnt Standard';
TNT_ADDITIONAL = 'Tnt Additional';
TNT_WIN32 = 'Tnt Win32';
// TNT_DATA_CONTROLS = 'Tnt Data Controls';
procedure Register;
begin
// ------- Standard -------
RegisterComponents(TNT_STANDARD, [TTntMainMenu]);
RegisterComponents(TNT_STANDARD, [TTntPopupMenu]);
RegisterComponents(TNT_STANDARD, [TTntLabel]);
RegisterComponents(TNT_STANDARD, [TTntEdit]);
RegisterComponents(TNT_STANDARD, [TTntMemo]);
RegisterComponents(TNT_STANDARD, [TTntButton]);
RegisterComponents(TNT_STANDARD, [TTntCheckBox]);
RegisterComponents(TNT_STANDARD, [TTntRadioButton]);
RegisterComponents(TNT_STANDARD, [TTntListBox]);
RegisterComponents(TNT_STANDARD, [TTntComboBox]);
RegisterComponents(TNT_STANDARD, [TTntScrollBar]);
RegisterComponents(TNT_STANDARD, [TTntGroupBox]);
{ -- TTntRadioGroup goes here -- }
RegisterComponents(TNT_STANDARD, [TTntPanel]);
{ -- TTntActionList goes here -- }
// ------- Additional -------
RegisterComponents(TNT_ADDITIONAL, [TTntBitBtn]);
RegisterComponents(TNT_ADDITIONAL, [TTntSpeedButton]);
{ -- TTntMaskEdit goes here -- }
RegisterComponents(TNT_ADDITIONAL, [TTntStringGrid]);
RegisterComponents(TNT_ADDITIONAL, [TTntDrawGrid]);
RegisterComponents(TNT_ADDITIONAL, [TTntImage]);
RegisterComponents(TNT_ADDITIONAL, [TTntShape]);
RegisterComponents(TNT_ADDITIONAL, [TTntBevel]);
RegisterComponents(TNT_ADDITIONAL, [TTntScrollBox]);
RegisterComponents(TNT_ADDITIONAL, [TTntCheckListBox]);
{ -- TTntSplitter goes here -- }
RegisterComponents(TNT_ADDITIONAL, [TTntStaticText]);
RegisterComponents(TNT_ADDITIONAL, [TTntControlBar]);
// ------- Win32 -------
RegisterComponents(TNT_WIN32, [TTntTabControl]);
RegisterComponents(TNT_WIN32, [TTntPageControl]);
RegisterComponents(TNT_WIN32, [TTntRichEdit]);
RegisterComponents(TNT_WIN32, [TTntTrackBar]);
RegisterComponents(TNT_WIN32, [TTntProgressBar]);
RegisterComponents(TNT_WIN32, [TTntUpDown]);
{ -- TTntHotKey goes here -- }
{ -- TTntAnimate goes here -- }
RegisterComponents(TNT_WIN32, [TTntDateTimePicker]);
RegisterComponents(TNT_WIN32, [TTntMonthCalendar]);
{ -- TTntTreeView goes here -- }
RegisterComponents(TNT_WIN32, [TTntListView]);
{ -- TTntHeader goes here -- }
{ -- TTntStatusBar goes here -- }
{ -- TTntToolBar goes here -- }
{ -- TTntCoolBar goes here -- }
RegisterComponents(TNT_WIN32, [TTntPageScroller]);
{ -- TTntComboBoxEx goes here -- }
// ------- System -------
RegisterComponents(TNT_ADDITIONAL, [TTntPaintBox]);
{ -- TTntMediaPlayer goes here -- }
{ -- TTntOleContainer goes here -- }
// ------- Data Controls -------
//RegisterComponents(TNT_DATA_CONTROLS, [TTntDBGrid]);
{ -- TTntDBNavigator goes here -- }
{ -- TTntDBText goes here -- }
// RegisterComponents(TNT_DATA_CONTROLS, [TTntDBEdit]);
{ -- TTntDBMemo goes here -- }
{ -- TTntDBImage goes here -- }
{ -- TTntDBListBox goes here -- }
// RegisterComponents(TNT_DATA_CONTROLS, [TTntDBComboBox]);
// RegisterComponents(TNT_DATA_CONTROLS, [TTntDBCheckBox]);
{ -- TTntDBRadioGroup goes here -- }
{ -- TTntDBLookupListBox goes here -- }
{ -- TTntDBLookupComboBox goes here -- }
{ -- TTntDBRichEdit goes here -- }
{ -- TTntDBCtrlGrid here -- }
{ -- TTntDBLookupListBox goes here -- }
{ -- TTntDBChart goes here -- }
end;
end.
- Previous message: [sword-cvs] sword/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Example - New directory
- Next message: [sword-cvs] sword/apps/windoze/CBuilder5/BibleCS/TntUnicodeControls/Example ExampleUnicode.cfg,NONE,1.1 ExampleUnicode.dof,NONE,1.1 ExampleUnicode.dpr,NONE,1.1 ExampleUnicode.res,NONE,1.1 MainFrm.dfm,NONE,1.1 MainFrm.pas,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]