text stringlengths 14 6.51M |
|---|
unit WordUtils;
(*************************************************************
Copyright © 2012 Toby Allen (https://github.com/tobya)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice, and every other copyright notice found in this software, and all the attributions in every file, and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
****************************************************************)
interface
uses Classes, MainUtils, ResourceUtils, ActiveX, ComObj, WinINet, Variants, sysutils, Types, StrUtils,Word_TLB_Constants;
type
TWordDocConverter = Class(TDocumentConverter)
Private
FWordVersion : String;
WordApp : OleVariant;
WarnBeforeSavingPrintingSendingMarkup_Origional : Boolean;
public
Constructor Create();
function CreateOfficeApp() : boolean; override;
function DestroyOfficeApp() : boolean; override;
function ExecuteConversion(fileToConvert: String; OutputFilename: String; OutputFileFormat : Integer): TConversionInfo; override;
function AvailableFormats() : TStringList; override;
function FormatsExtensions(): TStringList; override;
function WordConstants: TStringList;
function OfficeAppVersion() : String; override;
procedure BeforeListConvert(); override;
Procedure AfterListConvert(); override;
End;
implementation
function TWordDocConverter.AvailableFormats() : TStringList;
begin
Formats := TResourceStrings.Create('WORDFORMATS');
result := Formats;
end;
function TWordDocConverter.FormatsExtensions() : TStringList;
begin
fFormatsExtensions := TResourceStrings.Create('DOCEXTENSIONS');
result := fFormatsExtensions;
end;
function TWordDocConverter.WordConstants() : TStringList;
var
Constants : TResourceStrings;
begin
Constants := TResourceStrings.Create('WORDCONSTANTS');
result := Constants;
end;
function TWordDocConverter.OfficeAppVersion(): String;
var
WdVersion: String;
decimalPos : integer;
begin
FWordVersion := ReadOfficeAppVersion();
if FWordVersion = '' then
begin
CreateOfficeApp();
WdVersion := Wordapp.Version;
//Get Major version as that is all we are interested in and strtofloat causes errors Issue#31
decimalPos := pos('.',WdVersion);
FWordVersion := LeftStr(WdVersion,decimalPos -1);
WriteOfficeAppVersion(FWordVersion);
end;
result := FWordVersion;
end;
{ TWordDocConverter }
procedure TWordDocConverter.BeforeListConvert;
begin
inherited;
// If Word Options->Trust Center->Privacy Options-> "Warn before printing, saving or sending a file that contains tracked changes or comments"
// is checked it will pop up a dialog on conversion. Makes not sense for a commandline util to have this set to true
// So we turn if off but reset it to origional value after.
WarnBeforeSavingPrintingSendingMarkup_Origional := WordApp.Options.WarnBeforeSavingPrintingSendingMarkup;
if WarnBeforeSavingPrintingSendingMarkup_Origional then
begin
WordApp.Options.WarnBeforeSavingPrintingSendingMarkup := false;
LogDebug('[SETTING] Setting WordApp.Options.WarnBeforeSavingPrintingSendingMarkup = false', VERBOSE);
end;
end;
procedure TWordDocConverter.AfterListConvert;
begin
inherited;
// set back to originoal value if required.
if WarnBeforeSavingPrintingSendingMarkup_Origional then
begin
WordApp.Options.WarnBeforeSavingPrintingSendingMarkup := true;
LogDebug('[SETTING] Restoring WordApp.Options.WarnBeforeSavingPrintingSendingMarkup = true', VERBOSE);
end;
end;
constructor TWordDocConverter.Create;
begin
inherited;
InputExtension := '.doc*';
LogFilename := 'DocTo.Log';
OfficeAppName := 'Word';
end;
function TWordDocConverter.CreateOfficeApp: boolean;
begin
if VarIsEmpty(WordApp) then
begin
Wordapp := CreateOleObject('Word.Application');
Wordapp.Visible := false;
end;
Result := true;
end;
function TWordDocConverter.DestroyOfficeApp: boolean;
begin
if not VarIsEmpty(WordApp) then
begin
WordApp.Quit();
end;
Result := true;
end;
function TWordDocConverter.ExecuteConversion(fileToConvert: String; OutputFilename: String; OutputFileFormat : Integer): TConversionInfo;
var
EncodingValue : OleVariant;
NonsensePassword : OleVariant;
ExitAction : TExitAction;
begin
ExitAction := aSave;
Result.Successful := false;
Result.InputFile := fileToConvert;
logInfo('ExecuteConversion:' + fileToConvert, Verbose);
// disable auto macro
if (fDisableMacros) then
begin
WordApp.WordBasic.DisableAutoMacros ;
end;
// Check if document has password as per
// https://wordmvp.com/FAQs/MacrosVBA/CheckIfPWProtectB4Open.htm
// Always open with password, if none it will be ignored,
// if the file has a password set then we can catch error.
NonsensePassword := 'tfm554!ghAGWRDD';
try
// Open doc and save in requested format.
Wordapp.documents.OpenNoRepairDialog( FileToConvert, // FileName
false, // ConfirmConversions
true, // ReadOnly
EmptyParam, // AddToRecentFiles,
NonsensePassword // PasswordDocument,
);
// For some reason if the document contains a TableofContents, it hangs Word. In older
// versions it popped up a dialog. Until someone can find a work around, the docs will be skipped.
// Issue #40 - experimental as it gets some false positives.
if SkipDocsWithTOC then
begin
if Wordapp.ActiveDocument.TablesOfContents.count > 0 then
begin
logInfo('[SKIPPED] - Document has TOC: ' + fileToConvert , STANDARD);
Result.Successful := false;
Result.Error := '[SKIPPED] - Document has Table of Contents.';
ExitAction := aClose;
end;
end;
except
on E: Exception do
begin
// if Error contains EOleException The password is incorrect.
// then it is password protected and should be skipped.
if ContainsStr(E.Message, 'The password is incorrect' ) then
begin
logInfo('[SKIPPED] - Password Protected:' + fileToConvert, STANDARD);
Result.Successful := false;
Result.Error := '[SKIPPED] - Password Protected:';
ExitAction := aExit;
end
else
begin
// fallback error log
logerror(ConvertErrorText(E.ClassName) + ' ' + ConvertErrorText(E.Message));
Result.Successful := false;
Result.OutputFile := '';
Result.Error := E.Message;
Exit();
end;
end;
end;
// Encoding can be set. If a HTML type, then additional values
// need to be set for Weboptions.encoding
if Encoding = -1 then
begin
EncodingValue := EmptyParam;
end
else
begin
if (OutputFileFormat = wdFormatHTML)
or (OutputFileFormat = wdFormatFilteredHTML)
or (OutputFileFormat = wdFormatWebArchive)
then
begin
LogDebug('Setting WebOptions.Encoding ',Verbose);
WordApp.ActiveDocument.WebOptions.Encoding := Encoding;
end;
EncodingValue := Encoding;
end;
case ExitAction of
aExit :
begin
// document wasn't opened, so just exit function.
Result.Successful := false;
Result.OutputFile := '';
Exit();
end;
aClose:
begin
WordApp.activeDocument.Close(wdDoNotSaveChanges);
end;
aSave:
begin
try
if (OutputFileFormat = wdFormatPDF) or
(OutputFileFormat = wdFormatXPS) then
begin
// Saveas works for PDF but github issue 79 requestes exporting bookmarks
// also which requires ExportAsFixedFormat
// https://docs.microsoft.com/en-us/office/vba/api/word.document.exportasfixedformat
WordApp.ActiveDocument.ExportAsFixedFormat(
OutputFilename, // OutputFileName:=
OutputfileFormat, // ExportFormat:=
PDFOpenAfterExport, // OpenAfterExport
pdfOptimizeFor ,// OptimizeFor:= _wdExportOptimizeForPrint
pdfExportRange,// Range
pdfPrintFromPage,// From:=1,
pdfprintTopage,// To:=1, _
ExportMarkup,// Item:=
IncludeDocProps,// IncludeDocProps:=True,
KeepIRM,// KeepIRM:=True, _
BookmarkSource,// CreateBookmarks
DocStructureTags,// DocStructureTags:=True, _
BitmapMissingFonts,// BitmapMissingFonts:=True,
useISO190051 // UseISO19005_1:=False
);
end else
begin
//SaveAs2 was introduced in 2010 V 14 by this list
//https://stackoverflow.com/a/29077879/6244
if (strtoint( OfficeAppVersion) < 14) then
begin
logDebug('Version < 14 Using Saveas Function', VERBOSE);
if ( OutputFileFormat = wdFormatPDF )then
begin
LogInfo('This version of Word does not appear to support saving as PDF. You will need to install a later version. Word 2010 is the first to support Native saving as PDF.');
end;
Wordapp.activedocument.Saveas(OutputFilename ,
OutputFileFormat,
EmptyParam, //LockComments,
EmptyParam, //Password,
EmptyParam, //AddToRecentFiles,
EmptyParam, //WritePassword,
EmptyParam, //ReadOnlyRecommended,
EmptyParam, //EmbedTrueTypeFonts,
EmptyParam, //SaveNativePictureFormat,
EmptyParam, //SaveFormsData,
EmptyParam, //SaveAsAOCELetter,
EncodingValue, //Encoding,
EmptyParam, //InsertLineBreaks,
EmptyParam, //AllowSubstitutions,
EmptyParam, //LineEnding,
EmptyParam //AddBiDiMarks
);
end
else
begin
logDebug('Version >= 14 Using Saveas2 Function', VERBOSE);
Wordapp.activedocument.Saveas2(OutputFilename ,OutputFileFormat,
EmptyParam, //LockComments
EmptyParam, //Password
EmptyParam, //AddToRecentFiles
EmptyParam, //WritePassword
EmptyParam, //ReadOnlyRecommended
EmptyParam, //EmbedTrueTypeFonts
EmptyParam, //SaveNativePictureFo
EmptyParam, //SaveFormsData
EmptyParam, //SaveAsAOCELetter
EncodingValue, //Encoding
EmptyParam, //InsertLineBreaks
EmptyParam, //AllowSubstitutions
EmptyParam, //LineEnding
EmptyParam, //AddBiDiMarks
CompatibilityMode //CompatibilityMode
);
end;
end;
Result.Successful := true;
Result.OutputFile := OutputFilename;
Result.Error := '';
// loginfo('FileCreated: ' + OutputFilename, STANDARD);
finally
// Close the document - do not save changes if doc has changed in any way.
Wordapp.activedocument.Close(wdDoNotSaveChanges);
end;
end;
end;
end;
end.
|
unit AboutKeywordsPack;
{* Набор слов словаря для доступа к экземплярам контролов формы About }
// Модуль: "w:\garant6x\implementation\Garant\GbaNemesis\View\Common\AboutKeywordsPack.pas"
// Стереотип: "ScriptKeywordsPack"
// Элемент модели: "AboutKeywordsPack" MUID: (7A2FEC0CB105)
{$Include w:\garant6x\implementation\Garant\nsDefine.inc}
interface
{$If NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts)}
uses
l3IntfUses
{$If NOT Defined(NoVCL)}
, ExtCtrls
{$IfEnd} // NOT Defined(NoVCL)
, vtLabel
, vtGroupBox
, vtButton
;
{$IfEnd} // NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts)
implementation
{$If NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts)}
uses
l3ImplUses
, About_Form
, tfwControlString
{$If NOT Defined(NoVCL)}
, kwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
, tfwScriptingInterfaces
, tfwPropertyLike
, TypInfo
, tfwTypeInfo
, TtfwClassRef_Proxy
, SysUtils
, TtfwTypeRegistrator_Proxy
, tfwScriptingTypes
;
type
Tkw_Form_About = {final} class(TtfwControlString)
{* Слово словаря для идентификатора формы About
----
*Пример использования*:
[code]
'aControl' форма::About TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_Form_About
Tkw_About_Control_pbLogo = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола pbLogo
----
*Пример использования*:
[code]
контрол::pbLogo TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_pbLogo
Tkw_About_Control_pbLogo_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола pbLogo
----
*Пример использования*:
[code]
контрол::pbLogo:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_pbLogo_Push
Tkw_About_Control_ShellInfoLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола ShellInfoLabel
----
*Пример использования*:
[code]
контрол::ShellInfoLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_ShellInfoLabel
Tkw_About_Control_ShellInfoLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола ShellInfoLabel
----
*Пример использования*:
[code]
контрол::ShellInfoLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_ShellInfoLabel_Push
Tkw_About_Control_AdapterInfoLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола AdapterInfoLabel
----
*Пример использования*:
[code]
контрол::AdapterInfoLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_AdapterInfoLabel
Tkw_About_Control_AdapterInfoLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола AdapterInfoLabel
----
*Пример использования*:
[code]
контрол::AdapterInfoLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_AdapterInfoLabel_Push
Tkw_About_Control_UserCountLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола UserCountLabel
----
*Пример использования*:
[code]
контрол::UserCountLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserCountLabel
Tkw_About_Control_UserCountLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола UserCountLabel
----
*Пример использования*:
[code]
контрол::UserCountLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserCountLabel_Push
Tkw_About_Control_OwnerLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола OwnerLabel
----
*Пример использования*:
[code]
контрол::OwnerLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_OwnerLabel
Tkw_About_Control_OwnerLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола OwnerLabel
----
*Пример использования*:
[code]
контрол::OwnerLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_OwnerLabel_Push
Tkw_About_Control_ShellCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола ShellCaptionLabel
----
*Пример использования*:
[code]
контрол::ShellCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_ShellCaptionLabel
Tkw_About_Control_ShellCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола ShellCaptionLabel
----
*Пример использования*:
[code]
контрол::ShellCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_ShellCaptionLabel_Push
Tkw_About_Control_OwnerCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола OwnerCaptionLabel
----
*Пример использования*:
[code]
контрол::OwnerCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_OwnerCaptionLabel
Tkw_About_Control_OwnerCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола OwnerCaptionLabel
----
*Пример использования*:
[code]
контрол::OwnerCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_OwnerCaptionLabel_Push
Tkw_About_Control_UserInfoGroupBox = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола UserInfoGroupBox
----
*Пример использования*:
[code]
контрол::UserInfoGroupBox TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserInfoGroupBox
Tkw_About_Control_UserInfoGroupBox_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола UserInfoGroupBox
----
*Пример использования*:
[code]
контрол::UserInfoGroupBox:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserInfoGroupBox_Push
Tkw_About_Control_EMailCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола EMailCaptionLabel
----
*Пример использования*:
[code]
контрол::EMailCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_EMailCaptionLabel
Tkw_About_Control_EMailCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола EMailCaptionLabel
----
*Пример использования*:
[code]
контрол::EMailCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_EMailCaptionLabel_Push
Tkw_About_Control_EMailLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола EMailLabel
----
*Пример использования*:
[code]
контрол::EMailLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_EMailLabel
Tkw_About_Control_EMailLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола EMailLabel
----
*Пример использования*:
[code]
контрол::EMailLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_EMailLabel_Push
Tkw_About_Control_LoginCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола LoginCaptionLabel
----
*Пример использования*:
[code]
контрол::LoginCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_LoginCaptionLabel
Tkw_About_Control_LoginCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола LoginCaptionLabel
----
*Пример использования*:
[code]
контрол::LoginCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_LoginCaptionLabel_Push
Tkw_About_Control_UserCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола UserCaptionLabel
----
*Пример использования*:
[code]
контрол::UserCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserCaptionLabel
Tkw_About_Control_UserCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола UserCaptionLabel
----
*Пример использования*:
[code]
контрол::UserCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserCaptionLabel_Push
Tkw_About_Control_UserNameLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола UserNameLabel
----
*Пример использования*:
[code]
контрол::UserNameLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserNameLabel
Tkw_About_Control_UserNameLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола UserNameLabel
----
*Пример использования*:
[code]
контрол::UserNameLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserNameLabel_Push
Tkw_About_Control_LoginLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола LoginLabel
----
*Пример использования*:
[code]
контрол::LoginLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_LoginLabel
Tkw_About_Control_LoginLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола LoginLabel
----
*Пример использования*:
[code]
контрол::LoginLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_LoginLabel_Push
Tkw_About_Control_CopyrightCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола CopyrightCaptionLabel
----
*Пример использования*:
[code]
контрол::CopyrightCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_CopyrightCaptionLabel
Tkw_About_Control_CopyrightCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола CopyrightCaptionLabel
----
*Пример использования*:
[code]
контрол::CopyrightCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_CopyrightCaptionLabel_Push
Tkw_About_Control_OkButton = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола OkButton
----
*Пример использования*:
[code]
контрол::OkButton TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_OkButton
Tkw_About_Control_OkButton_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола OkButton
----
*Пример использования*:
[code]
контрол::OkButton:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_OkButton_Push
Tkw_About_Control_UserCountCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола UserCountCaptionLabel
----
*Пример использования*:
[code]
контрол::UserCountCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserCountCaptionLabel
Tkw_About_Control_UserCountCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола UserCountCaptionLabel
----
*Пример использования*:
[code]
контрол::UserCountCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_UserCountCaptionLabel_Push
Tkw_About_Control_AdapterCaptionLabel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола AdapterCaptionLabel
----
*Пример использования*:
[code]
контрол::AdapterCaptionLabel TryFocus ASSERT
[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_AdapterCaptionLabel
Tkw_About_Control_AdapterCaptionLabel_Push = {final} class({$If NOT Defined(NoVCL)}
TkwBynameControlPush
{$IfEnd} // NOT Defined(NoVCL)
)
{* Слово словаря для контрола AdapterCaptionLabel
----
*Пример использования*:
[code]
контрол::AdapterCaptionLabel:push pop:control:SetFocus ASSERT
[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_About_Control_AdapterCaptionLabel_Push
TkwEfAboutPbLogo = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.pbLogo }
private
function pbLogo(const aCtx: TtfwContext;
aefAbout: TefAbout): TPaintBox;
{* Реализация слова скрипта .TefAbout.pbLogo }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutPbLogo
TkwEfAboutShellInfoLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.ShellInfoLabel }
private
function ShellInfoLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.ShellInfoLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutShellInfoLabel
TkwEfAboutAdapterInfoLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.AdapterInfoLabel }
private
function AdapterInfoLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.AdapterInfoLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutAdapterInfoLabel
TkwEfAboutUserCountLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.UserCountLabel }
private
function UserCountLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserCountLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutUserCountLabel
TkwEfAboutOwnerLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.OwnerLabel }
private
function OwnerLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.OwnerLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutOwnerLabel
TkwEfAboutShellCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.ShellCaptionLabel }
private
function ShellCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.ShellCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutShellCaptionLabel
TkwEfAboutOwnerCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.OwnerCaptionLabel }
private
function OwnerCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.OwnerCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutOwnerCaptionLabel
TkwEfAboutUserInfoGroupBox = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.UserInfoGroupBox }
private
function UserInfoGroupBox(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtGroupBox;
{* Реализация слова скрипта .TefAbout.UserInfoGroupBox }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutUserInfoGroupBox
TkwEfAboutEMailCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.EMailCaptionLabel }
private
function EMailCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.EMailCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutEMailCaptionLabel
TkwEfAboutEMailLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.EMailLabel }
private
function EMailLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.EMailLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutEMailLabel
TkwEfAboutLoginCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.LoginCaptionLabel }
private
function LoginCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.LoginCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutLoginCaptionLabel
TkwEfAboutUserCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.UserCaptionLabel }
private
function UserCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutUserCaptionLabel
TkwEfAboutUserNameLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.UserNameLabel }
private
function UserNameLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserNameLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutUserNameLabel
TkwEfAboutLoginLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.LoginLabel }
private
function LoginLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.LoginLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutLoginLabel
TkwEfAboutCopyrightCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.CopyrightCaptionLabel }
private
function CopyrightCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.CopyrightCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutCopyrightCaptionLabel
TkwEfAboutOkButton = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.OkButton }
private
function OkButton(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtButton;
{* Реализация слова скрипта .TefAbout.OkButton }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutOkButton
TkwEfAboutUserCountCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.UserCountCaptionLabel }
private
function UserCountCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserCountCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutUserCountCaptionLabel
TkwEfAboutAdapterCaptionLabel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TefAbout.AdapterCaptionLabel }
private
function AdapterCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.AdapterCaptionLabel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwEfAboutAdapterCaptionLabel
function Tkw_Form_About.GetString: AnsiString;
begin
Result := 'efAbout';
end;//Tkw_Form_About.GetString
class function Tkw_Form_About.GetWordNameForRegister: AnsiString;
begin
Result := 'форма::About';
end;//Tkw_Form_About.GetWordNameForRegister
function Tkw_About_Control_pbLogo.GetString: AnsiString;
begin
Result := 'pbLogo';
end;//Tkw_About_Control_pbLogo.GetString
class procedure Tkw_About_Control_pbLogo.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TPaintBox);
end;//Tkw_About_Control_pbLogo.RegisterInEngine
class function Tkw_About_Control_pbLogo.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::pbLogo';
end;//Tkw_About_Control_pbLogo.GetWordNameForRegister
procedure Tkw_About_Control_pbLogo_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('pbLogo');
inherited;
end;//Tkw_About_Control_pbLogo_Push.DoDoIt
class function Tkw_About_Control_pbLogo_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::pbLogo:push';
end;//Tkw_About_Control_pbLogo_Push.GetWordNameForRegister
function Tkw_About_Control_ShellInfoLabel.GetString: AnsiString;
begin
Result := 'ShellInfoLabel';
end;//Tkw_About_Control_ShellInfoLabel.GetString
class procedure Tkw_About_Control_ShellInfoLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_ShellInfoLabel.RegisterInEngine
class function Tkw_About_Control_ShellInfoLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ShellInfoLabel';
end;//Tkw_About_Control_ShellInfoLabel.GetWordNameForRegister
procedure Tkw_About_Control_ShellInfoLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('ShellInfoLabel');
inherited;
end;//Tkw_About_Control_ShellInfoLabel_Push.DoDoIt
class function Tkw_About_Control_ShellInfoLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ShellInfoLabel:push';
end;//Tkw_About_Control_ShellInfoLabel_Push.GetWordNameForRegister
function Tkw_About_Control_AdapterInfoLabel.GetString: AnsiString;
begin
Result := 'AdapterInfoLabel';
end;//Tkw_About_Control_AdapterInfoLabel.GetString
class procedure Tkw_About_Control_AdapterInfoLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_AdapterInfoLabel.RegisterInEngine
class function Tkw_About_Control_AdapterInfoLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::AdapterInfoLabel';
end;//Tkw_About_Control_AdapterInfoLabel.GetWordNameForRegister
procedure Tkw_About_Control_AdapterInfoLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('AdapterInfoLabel');
inherited;
end;//Tkw_About_Control_AdapterInfoLabel_Push.DoDoIt
class function Tkw_About_Control_AdapterInfoLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::AdapterInfoLabel:push';
end;//Tkw_About_Control_AdapterInfoLabel_Push.GetWordNameForRegister
function Tkw_About_Control_UserCountLabel.GetString: AnsiString;
begin
Result := 'UserCountLabel';
end;//Tkw_About_Control_UserCountLabel.GetString
class procedure Tkw_About_Control_UserCountLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_UserCountLabel.RegisterInEngine
class function Tkw_About_Control_UserCountLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserCountLabel';
end;//Tkw_About_Control_UserCountLabel.GetWordNameForRegister
procedure Tkw_About_Control_UserCountLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('UserCountLabel');
inherited;
end;//Tkw_About_Control_UserCountLabel_Push.DoDoIt
class function Tkw_About_Control_UserCountLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserCountLabel:push';
end;//Tkw_About_Control_UserCountLabel_Push.GetWordNameForRegister
function Tkw_About_Control_OwnerLabel.GetString: AnsiString;
begin
Result := 'OwnerLabel';
end;//Tkw_About_Control_OwnerLabel.GetString
class procedure Tkw_About_Control_OwnerLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_OwnerLabel.RegisterInEngine
class function Tkw_About_Control_OwnerLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::OwnerLabel';
end;//Tkw_About_Control_OwnerLabel.GetWordNameForRegister
procedure Tkw_About_Control_OwnerLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('OwnerLabel');
inherited;
end;//Tkw_About_Control_OwnerLabel_Push.DoDoIt
class function Tkw_About_Control_OwnerLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::OwnerLabel:push';
end;//Tkw_About_Control_OwnerLabel_Push.GetWordNameForRegister
function Tkw_About_Control_ShellCaptionLabel.GetString: AnsiString;
begin
Result := 'ShellCaptionLabel';
end;//Tkw_About_Control_ShellCaptionLabel.GetString
class procedure Tkw_About_Control_ShellCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_ShellCaptionLabel.RegisterInEngine
class function Tkw_About_Control_ShellCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ShellCaptionLabel';
end;//Tkw_About_Control_ShellCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_ShellCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('ShellCaptionLabel');
inherited;
end;//Tkw_About_Control_ShellCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_ShellCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ShellCaptionLabel:push';
end;//Tkw_About_Control_ShellCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_OwnerCaptionLabel.GetString: AnsiString;
begin
Result := 'OwnerCaptionLabel';
end;//Tkw_About_Control_OwnerCaptionLabel.GetString
class procedure Tkw_About_Control_OwnerCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_OwnerCaptionLabel.RegisterInEngine
class function Tkw_About_Control_OwnerCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::OwnerCaptionLabel';
end;//Tkw_About_Control_OwnerCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_OwnerCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('OwnerCaptionLabel');
inherited;
end;//Tkw_About_Control_OwnerCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_OwnerCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::OwnerCaptionLabel:push';
end;//Tkw_About_Control_OwnerCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_UserInfoGroupBox.GetString: AnsiString;
begin
Result := 'UserInfoGroupBox';
end;//Tkw_About_Control_UserInfoGroupBox.GetString
class procedure Tkw_About_Control_UserInfoGroupBox.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtGroupBox);
end;//Tkw_About_Control_UserInfoGroupBox.RegisterInEngine
class function Tkw_About_Control_UserInfoGroupBox.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserInfoGroupBox';
end;//Tkw_About_Control_UserInfoGroupBox.GetWordNameForRegister
procedure Tkw_About_Control_UserInfoGroupBox_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('UserInfoGroupBox');
inherited;
end;//Tkw_About_Control_UserInfoGroupBox_Push.DoDoIt
class function Tkw_About_Control_UserInfoGroupBox_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserInfoGroupBox:push';
end;//Tkw_About_Control_UserInfoGroupBox_Push.GetWordNameForRegister
function Tkw_About_Control_EMailCaptionLabel.GetString: AnsiString;
begin
Result := 'EMailCaptionLabel';
end;//Tkw_About_Control_EMailCaptionLabel.GetString
class procedure Tkw_About_Control_EMailCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_EMailCaptionLabel.RegisterInEngine
class function Tkw_About_Control_EMailCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::EMailCaptionLabel';
end;//Tkw_About_Control_EMailCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_EMailCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('EMailCaptionLabel');
inherited;
end;//Tkw_About_Control_EMailCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_EMailCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::EMailCaptionLabel:push';
end;//Tkw_About_Control_EMailCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_EMailLabel.GetString: AnsiString;
begin
Result := 'EMailLabel';
end;//Tkw_About_Control_EMailLabel.GetString
class procedure Tkw_About_Control_EMailLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_EMailLabel.RegisterInEngine
class function Tkw_About_Control_EMailLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::EMailLabel';
end;//Tkw_About_Control_EMailLabel.GetWordNameForRegister
procedure Tkw_About_Control_EMailLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('EMailLabel');
inherited;
end;//Tkw_About_Control_EMailLabel_Push.DoDoIt
class function Tkw_About_Control_EMailLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::EMailLabel:push';
end;//Tkw_About_Control_EMailLabel_Push.GetWordNameForRegister
function Tkw_About_Control_LoginCaptionLabel.GetString: AnsiString;
begin
Result := 'LoginCaptionLabel';
end;//Tkw_About_Control_LoginCaptionLabel.GetString
class procedure Tkw_About_Control_LoginCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_LoginCaptionLabel.RegisterInEngine
class function Tkw_About_Control_LoginCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::LoginCaptionLabel';
end;//Tkw_About_Control_LoginCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_LoginCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('LoginCaptionLabel');
inherited;
end;//Tkw_About_Control_LoginCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_LoginCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::LoginCaptionLabel:push';
end;//Tkw_About_Control_LoginCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_UserCaptionLabel.GetString: AnsiString;
begin
Result := 'UserCaptionLabel';
end;//Tkw_About_Control_UserCaptionLabel.GetString
class procedure Tkw_About_Control_UserCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_UserCaptionLabel.RegisterInEngine
class function Tkw_About_Control_UserCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserCaptionLabel';
end;//Tkw_About_Control_UserCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_UserCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('UserCaptionLabel');
inherited;
end;//Tkw_About_Control_UserCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_UserCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserCaptionLabel:push';
end;//Tkw_About_Control_UserCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_UserNameLabel.GetString: AnsiString;
begin
Result := 'UserNameLabel';
end;//Tkw_About_Control_UserNameLabel.GetString
class procedure Tkw_About_Control_UserNameLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_UserNameLabel.RegisterInEngine
class function Tkw_About_Control_UserNameLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserNameLabel';
end;//Tkw_About_Control_UserNameLabel.GetWordNameForRegister
procedure Tkw_About_Control_UserNameLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('UserNameLabel');
inherited;
end;//Tkw_About_Control_UserNameLabel_Push.DoDoIt
class function Tkw_About_Control_UserNameLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserNameLabel:push';
end;//Tkw_About_Control_UserNameLabel_Push.GetWordNameForRegister
function Tkw_About_Control_LoginLabel.GetString: AnsiString;
begin
Result := 'LoginLabel';
end;//Tkw_About_Control_LoginLabel.GetString
class procedure Tkw_About_Control_LoginLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_LoginLabel.RegisterInEngine
class function Tkw_About_Control_LoginLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::LoginLabel';
end;//Tkw_About_Control_LoginLabel.GetWordNameForRegister
procedure Tkw_About_Control_LoginLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('LoginLabel');
inherited;
end;//Tkw_About_Control_LoginLabel_Push.DoDoIt
class function Tkw_About_Control_LoginLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::LoginLabel:push';
end;//Tkw_About_Control_LoginLabel_Push.GetWordNameForRegister
function Tkw_About_Control_CopyrightCaptionLabel.GetString: AnsiString;
begin
Result := 'CopyrightCaptionLabel';
end;//Tkw_About_Control_CopyrightCaptionLabel.GetString
class procedure Tkw_About_Control_CopyrightCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_CopyrightCaptionLabel.RegisterInEngine
class function Tkw_About_Control_CopyrightCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::CopyrightCaptionLabel';
end;//Tkw_About_Control_CopyrightCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_CopyrightCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('CopyrightCaptionLabel');
inherited;
end;//Tkw_About_Control_CopyrightCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_CopyrightCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::CopyrightCaptionLabel:push';
end;//Tkw_About_Control_CopyrightCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_OkButton.GetString: AnsiString;
begin
Result := 'OkButton';
end;//Tkw_About_Control_OkButton.GetString
class procedure Tkw_About_Control_OkButton.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtButton);
end;//Tkw_About_Control_OkButton.RegisterInEngine
class function Tkw_About_Control_OkButton.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::OkButton';
end;//Tkw_About_Control_OkButton.GetWordNameForRegister
procedure Tkw_About_Control_OkButton_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('OkButton');
inherited;
end;//Tkw_About_Control_OkButton_Push.DoDoIt
class function Tkw_About_Control_OkButton_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::OkButton:push';
end;//Tkw_About_Control_OkButton_Push.GetWordNameForRegister
function Tkw_About_Control_UserCountCaptionLabel.GetString: AnsiString;
begin
Result := 'UserCountCaptionLabel';
end;//Tkw_About_Control_UserCountCaptionLabel.GetString
class procedure Tkw_About_Control_UserCountCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_UserCountCaptionLabel.RegisterInEngine
class function Tkw_About_Control_UserCountCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserCountCaptionLabel';
end;//Tkw_About_Control_UserCountCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_UserCountCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('UserCountCaptionLabel');
inherited;
end;//Tkw_About_Control_UserCountCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_UserCountCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::UserCountCaptionLabel:push';
end;//Tkw_About_Control_UserCountCaptionLabel_Push.GetWordNameForRegister
function Tkw_About_Control_AdapterCaptionLabel.GetString: AnsiString;
begin
Result := 'AdapterCaptionLabel';
end;//Tkw_About_Control_AdapterCaptionLabel.GetString
class procedure Tkw_About_Control_AdapterCaptionLabel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtLabel);
end;//Tkw_About_Control_AdapterCaptionLabel.RegisterInEngine
class function Tkw_About_Control_AdapterCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::AdapterCaptionLabel';
end;//Tkw_About_Control_AdapterCaptionLabel.GetWordNameForRegister
procedure Tkw_About_Control_AdapterCaptionLabel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('AdapterCaptionLabel');
inherited;
end;//Tkw_About_Control_AdapterCaptionLabel_Push.DoDoIt
class function Tkw_About_Control_AdapterCaptionLabel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::AdapterCaptionLabel:push';
end;//Tkw_About_Control_AdapterCaptionLabel_Push.GetWordNameForRegister
function TkwEfAboutPbLogo.pbLogo(const aCtx: TtfwContext;
aefAbout: TefAbout): TPaintBox;
{* Реализация слова скрипта .TefAbout.pbLogo }
begin
Result := aefAbout.pbLogo;
end;//TkwEfAboutPbLogo.pbLogo
class function TkwEfAboutPbLogo.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.pbLogo';
end;//TkwEfAboutPbLogo.GetWordNameForRegister
function TkwEfAboutPbLogo.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TPaintBox);
end;//TkwEfAboutPbLogo.GetResultTypeInfo
function TkwEfAboutPbLogo.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutPbLogo.GetAllParamsCount
function TkwEfAboutPbLogo.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutPbLogo.ParamsTypes
procedure TkwEfAboutPbLogo.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству pbLogo', aCtx);
end;//TkwEfAboutPbLogo.SetValuePrim
procedure TkwEfAboutPbLogo.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(pbLogo(aCtx, l_aefAbout));
end;//TkwEfAboutPbLogo.DoDoIt
function TkwEfAboutShellInfoLabel.ShellInfoLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.ShellInfoLabel }
begin
Result := aefAbout.ShellInfoLabel;
end;//TkwEfAboutShellInfoLabel.ShellInfoLabel
class function TkwEfAboutShellInfoLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.ShellInfoLabel';
end;//TkwEfAboutShellInfoLabel.GetWordNameForRegister
function TkwEfAboutShellInfoLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutShellInfoLabel.GetResultTypeInfo
function TkwEfAboutShellInfoLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutShellInfoLabel.GetAllParamsCount
function TkwEfAboutShellInfoLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutShellInfoLabel.ParamsTypes
procedure TkwEfAboutShellInfoLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству ShellInfoLabel', aCtx);
end;//TkwEfAboutShellInfoLabel.SetValuePrim
procedure TkwEfAboutShellInfoLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(ShellInfoLabel(aCtx, l_aefAbout));
end;//TkwEfAboutShellInfoLabel.DoDoIt
function TkwEfAboutAdapterInfoLabel.AdapterInfoLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.AdapterInfoLabel }
begin
Result := aefAbout.AdapterInfoLabel;
end;//TkwEfAboutAdapterInfoLabel.AdapterInfoLabel
class function TkwEfAboutAdapterInfoLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.AdapterInfoLabel';
end;//TkwEfAboutAdapterInfoLabel.GetWordNameForRegister
function TkwEfAboutAdapterInfoLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutAdapterInfoLabel.GetResultTypeInfo
function TkwEfAboutAdapterInfoLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutAdapterInfoLabel.GetAllParamsCount
function TkwEfAboutAdapterInfoLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutAdapterInfoLabel.ParamsTypes
procedure TkwEfAboutAdapterInfoLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству AdapterInfoLabel', aCtx);
end;//TkwEfAboutAdapterInfoLabel.SetValuePrim
procedure TkwEfAboutAdapterInfoLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(AdapterInfoLabel(aCtx, l_aefAbout));
end;//TkwEfAboutAdapterInfoLabel.DoDoIt
function TkwEfAboutUserCountLabel.UserCountLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserCountLabel }
begin
Result := aefAbout.UserCountLabel;
end;//TkwEfAboutUserCountLabel.UserCountLabel
class function TkwEfAboutUserCountLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.UserCountLabel';
end;//TkwEfAboutUserCountLabel.GetWordNameForRegister
function TkwEfAboutUserCountLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutUserCountLabel.GetResultTypeInfo
function TkwEfAboutUserCountLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutUserCountLabel.GetAllParamsCount
function TkwEfAboutUserCountLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutUserCountLabel.ParamsTypes
procedure TkwEfAboutUserCountLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству UserCountLabel', aCtx);
end;//TkwEfAboutUserCountLabel.SetValuePrim
procedure TkwEfAboutUserCountLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(UserCountLabel(aCtx, l_aefAbout));
end;//TkwEfAboutUserCountLabel.DoDoIt
function TkwEfAboutOwnerLabel.OwnerLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.OwnerLabel }
begin
Result := aefAbout.OwnerLabel;
end;//TkwEfAboutOwnerLabel.OwnerLabel
class function TkwEfAboutOwnerLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.OwnerLabel';
end;//TkwEfAboutOwnerLabel.GetWordNameForRegister
function TkwEfAboutOwnerLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutOwnerLabel.GetResultTypeInfo
function TkwEfAboutOwnerLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutOwnerLabel.GetAllParamsCount
function TkwEfAboutOwnerLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutOwnerLabel.ParamsTypes
procedure TkwEfAboutOwnerLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству OwnerLabel', aCtx);
end;//TkwEfAboutOwnerLabel.SetValuePrim
procedure TkwEfAboutOwnerLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(OwnerLabel(aCtx, l_aefAbout));
end;//TkwEfAboutOwnerLabel.DoDoIt
function TkwEfAboutShellCaptionLabel.ShellCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.ShellCaptionLabel }
begin
Result := aefAbout.ShellCaptionLabel;
end;//TkwEfAboutShellCaptionLabel.ShellCaptionLabel
class function TkwEfAboutShellCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.ShellCaptionLabel';
end;//TkwEfAboutShellCaptionLabel.GetWordNameForRegister
function TkwEfAboutShellCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutShellCaptionLabel.GetResultTypeInfo
function TkwEfAboutShellCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutShellCaptionLabel.GetAllParamsCount
function TkwEfAboutShellCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutShellCaptionLabel.ParamsTypes
procedure TkwEfAboutShellCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству ShellCaptionLabel', aCtx);
end;//TkwEfAboutShellCaptionLabel.SetValuePrim
procedure TkwEfAboutShellCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(ShellCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutShellCaptionLabel.DoDoIt
function TkwEfAboutOwnerCaptionLabel.OwnerCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.OwnerCaptionLabel }
begin
Result := aefAbout.OwnerCaptionLabel;
end;//TkwEfAboutOwnerCaptionLabel.OwnerCaptionLabel
class function TkwEfAboutOwnerCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.OwnerCaptionLabel';
end;//TkwEfAboutOwnerCaptionLabel.GetWordNameForRegister
function TkwEfAboutOwnerCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutOwnerCaptionLabel.GetResultTypeInfo
function TkwEfAboutOwnerCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutOwnerCaptionLabel.GetAllParamsCount
function TkwEfAboutOwnerCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutOwnerCaptionLabel.ParamsTypes
procedure TkwEfAboutOwnerCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству OwnerCaptionLabel', aCtx);
end;//TkwEfAboutOwnerCaptionLabel.SetValuePrim
procedure TkwEfAboutOwnerCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(OwnerCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutOwnerCaptionLabel.DoDoIt
function TkwEfAboutUserInfoGroupBox.UserInfoGroupBox(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtGroupBox;
{* Реализация слова скрипта .TefAbout.UserInfoGroupBox }
begin
Result := aefAbout.UserInfoGroupBox;
end;//TkwEfAboutUserInfoGroupBox.UserInfoGroupBox
class function TkwEfAboutUserInfoGroupBox.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.UserInfoGroupBox';
end;//TkwEfAboutUserInfoGroupBox.GetWordNameForRegister
function TkwEfAboutUserInfoGroupBox.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtGroupBox);
end;//TkwEfAboutUserInfoGroupBox.GetResultTypeInfo
function TkwEfAboutUserInfoGroupBox.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutUserInfoGroupBox.GetAllParamsCount
function TkwEfAboutUserInfoGroupBox.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutUserInfoGroupBox.ParamsTypes
procedure TkwEfAboutUserInfoGroupBox.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству UserInfoGroupBox', aCtx);
end;//TkwEfAboutUserInfoGroupBox.SetValuePrim
procedure TkwEfAboutUserInfoGroupBox.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(UserInfoGroupBox(aCtx, l_aefAbout));
end;//TkwEfAboutUserInfoGroupBox.DoDoIt
function TkwEfAboutEMailCaptionLabel.EMailCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.EMailCaptionLabel }
begin
Result := aefAbout.EMailCaptionLabel;
end;//TkwEfAboutEMailCaptionLabel.EMailCaptionLabel
class function TkwEfAboutEMailCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.EMailCaptionLabel';
end;//TkwEfAboutEMailCaptionLabel.GetWordNameForRegister
function TkwEfAboutEMailCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutEMailCaptionLabel.GetResultTypeInfo
function TkwEfAboutEMailCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutEMailCaptionLabel.GetAllParamsCount
function TkwEfAboutEMailCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutEMailCaptionLabel.ParamsTypes
procedure TkwEfAboutEMailCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству EMailCaptionLabel', aCtx);
end;//TkwEfAboutEMailCaptionLabel.SetValuePrim
procedure TkwEfAboutEMailCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(EMailCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutEMailCaptionLabel.DoDoIt
function TkwEfAboutEMailLabel.EMailLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.EMailLabel }
begin
Result := aefAbout.EMailLabel;
end;//TkwEfAboutEMailLabel.EMailLabel
class function TkwEfAboutEMailLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.EMailLabel';
end;//TkwEfAboutEMailLabel.GetWordNameForRegister
function TkwEfAboutEMailLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutEMailLabel.GetResultTypeInfo
function TkwEfAboutEMailLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutEMailLabel.GetAllParamsCount
function TkwEfAboutEMailLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutEMailLabel.ParamsTypes
procedure TkwEfAboutEMailLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству EMailLabel', aCtx);
end;//TkwEfAboutEMailLabel.SetValuePrim
procedure TkwEfAboutEMailLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(EMailLabel(aCtx, l_aefAbout));
end;//TkwEfAboutEMailLabel.DoDoIt
function TkwEfAboutLoginCaptionLabel.LoginCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.LoginCaptionLabel }
begin
Result := aefAbout.LoginCaptionLabel;
end;//TkwEfAboutLoginCaptionLabel.LoginCaptionLabel
class function TkwEfAboutLoginCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.LoginCaptionLabel';
end;//TkwEfAboutLoginCaptionLabel.GetWordNameForRegister
function TkwEfAboutLoginCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutLoginCaptionLabel.GetResultTypeInfo
function TkwEfAboutLoginCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutLoginCaptionLabel.GetAllParamsCount
function TkwEfAboutLoginCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutLoginCaptionLabel.ParamsTypes
procedure TkwEfAboutLoginCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству LoginCaptionLabel', aCtx);
end;//TkwEfAboutLoginCaptionLabel.SetValuePrim
procedure TkwEfAboutLoginCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(LoginCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutLoginCaptionLabel.DoDoIt
function TkwEfAboutUserCaptionLabel.UserCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserCaptionLabel }
begin
Result := aefAbout.UserCaptionLabel;
end;//TkwEfAboutUserCaptionLabel.UserCaptionLabel
class function TkwEfAboutUserCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.UserCaptionLabel';
end;//TkwEfAboutUserCaptionLabel.GetWordNameForRegister
function TkwEfAboutUserCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutUserCaptionLabel.GetResultTypeInfo
function TkwEfAboutUserCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutUserCaptionLabel.GetAllParamsCount
function TkwEfAboutUserCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutUserCaptionLabel.ParamsTypes
procedure TkwEfAboutUserCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству UserCaptionLabel', aCtx);
end;//TkwEfAboutUserCaptionLabel.SetValuePrim
procedure TkwEfAboutUserCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(UserCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutUserCaptionLabel.DoDoIt
function TkwEfAboutUserNameLabel.UserNameLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserNameLabel }
begin
Result := aefAbout.UserNameLabel;
end;//TkwEfAboutUserNameLabel.UserNameLabel
class function TkwEfAboutUserNameLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.UserNameLabel';
end;//TkwEfAboutUserNameLabel.GetWordNameForRegister
function TkwEfAboutUserNameLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutUserNameLabel.GetResultTypeInfo
function TkwEfAboutUserNameLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutUserNameLabel.GetAllParamsCount
function TkwEfAboutUserNameLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutUserNameLabel.ParamsTypes
procedure TkwEfAboutUserNameLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству UserNameLabel', aCtx);
end;//TkwEfAboutUserNameLabel.SetValuePrim
procedure TkwEfAboutUserNameLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(UserNameLabel(aCtx, l_aefAbout));
end;//TkwEfAboutUserNameLabel.DoDoIt
function TkwEfAboutLoginLabel.LoginLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.LoginLabel }
begin
Result := aefAbout.LoginLabel;
end;//TkwEfAboutLoginLabel.LoginLabel
class function TkwEfAboutLoginLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.LoginLabel';
end;//TkwEfAboutLoginLabel.GetWordNameForRegister
function TkwEfAboutLoginLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutLoginLabel.GetResultTypeInfo
function TkwEfAboutLoginLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutLoginLabel.GetAllParamsCount
function TkwEfAboutLoginLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutLoginLabel.ParamsTypes
procedure TkwEfAboutLoginLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству LoginLabel', aCtx);
end;//TkwEfAboutLoginLabel.SetValuePrim
procedure TkwEfAboutLoginLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(LoginLabel(aCtx, l_aefAbout));
end;//TkwEfAboutLoginLabel.DoDoIt
function TkwEfAboutCopyrightCaptionLabel.CopyrightCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.CopyrightCaptionLabel }
begin
Result := aefAbout.CopyrightCaptionLabel;
end;//TkwEfAboutCopyrightCaptionLabel.CopyrightCaptionLabel
class function TkwEfAboutCopyrightCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.CopyrightCaptionLabel';
end;//TkwEfAboutCopyrightCaptionLabel.GetWordNameForRegister
function TkwEfAboutCopyrightCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutCopyrightCaptionLabel.GetResultTypeInfo
function TkwEfAboutCopyrightCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutCopyrightCaptionLabel.GetAllParamsCount
function TkwEfAboutCopyrightCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutCopyrightCaptionLabel.ParamsTypes
procedure TkwEfAboutCopyrightCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству CopyrightCaptionLabel', aCtx);
end;//TkwEfAboutCopyrightCaptionLabel.SetValuePrim
procedure TkwEfAboutCopyrightCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(CopyrightCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutCopyrightCaptionLabel.DoDoIt
function TkwEfAboutOkButton.OkButton(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtButton;
{* Реализация слова скрипта .TefAbout.OkButton }
begin
Result := aefAbout.OkButton;
end;//TkwEfAboutOkButton.OkButton
class function TkwEfAboutOkButton.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.OkButton';
end;//TkwEfAboutOkButton.GetWordNameForRegister
function TkwEfAboutOkButton.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtButton);
end;//TkwEfAboutOkButton.GetResultTypeInfo
function TkwEfAboutOkButton.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutOkButton.GetAllParamsCount
function TkwEfAboutOkButton.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutOkButton.ParamsTypes
procedure TkwEfAboutOkButton.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству OkButton', aCtx);
end;//TkwEfAboutOkButton.SetValuePrim
procedure TkwEfAboutOkButton.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(OkButton(aCtx, l_aefAbout));
end;//TkwEfAboutOkButton.DoDoIt
function TkwEfAboutUserCountCaptionLabel.UserCountCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.UserCountCaptionLabel }
begin
Result := aefAbout.UserCountCaptionLabel;
end;//TkwEfAboutUserCountCaptionLabel.UserCountCaptionLabel
class function TkwEfAboutUserCountCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.UserCountCaptionLabel';
end;//TkwEfAboutUserCountCaptionLabel.GetWordNameForRegister
function TkwEfAboutUserCountCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutUserCountCaptionLabel.GetResultTypeInfo
function TkwEfAboutUserCountCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutUserCountCaptionLabel.GetAllParamsCount
function TkwEfAboutUserCountCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutUserCountCaptionLabel.ParamsTypes
procedure TkwEfAboutUserCountCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству UserCountCaptionLabel', aCtx);
end;//TkwEfAboutUserCountCaptionLabel.SetValuePrim
procedure TkwEfAboutUserCountCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(UserCountCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutUserCountCaptionLabel.DoDoIt
function TkwEfAboutAdapterCaptionLabel.AdapterCaptionLabel(const aCtx: TtfwContext;
aefAbout: TefAbout): TvtLabel;
{* Реализация слова скрипта .TefAbout.AdapterCaptionLabel }
begin
Result := aefAbout.AdapterCaptionLabel;
end;//TkwEfAboutAdapterCaptionLabel.AdapterCaptionLabel
class function TkwEfAboutAdapterCaptionLabel.GetWordNameForRegister: AnsiString;
begin
Result := '.TefAbout.AdapterCaptionLabel';
end;//TkwEfAboutAdapterCaptionLabel.GetWordNameForRegister
function TkwEfAboutAdapterCaptionLabel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtLabel);
end;//TkwEfAboutAdapterCaptionLabel.GetResultTypeInfo
function TkwEfAboutAdapterCaptionLabel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwEfAboutAdapterCaptionLabel.GetAllParamsCount
function TkwEfAboutAdapterCaptionLabel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TefAbout)]);
end;//TkwEfAboutAdapterCaptionLabel.ParamsTypes
procedure TkwEfAboutAdapterCaptionLabel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству AdapterCaptionLabel', aCtx);
end;//TkwEfAboutAdapterCaptionLabel.SetValuePrim
procedure TkwEfAboutAdapterCaptionLabel.DoDoIt(const aCtx: TtfwContext);
var l_aefAbout: TefAbout;
begin
try
l_aefAbout := TefAbout(aCtx.rEngine.PopObjAs(TefAbout));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aefAbout: TefAbout : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(AdapterCaptionLabel(aCtx, l_aefAbout));
end;//TkwEfAboutAdapterCaptionLabel.DoDoIt
initialization
Tkw_Form_About.RegisterInEngine;
{* Регистрация Tkw_Form_About }
Tkw_About_Control_pbLogo.RegisterInEngine;
{* Регистрация Tkw_About_Control_pbLogo }
Tkw_About_Control_pbLogo_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_pbLogo_Push }
Tkw_About_Control_ShellInfoLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_ShellInfoLabel }
Tkw_About_Control_ShellInfoLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_ShellInfoLabel_Push }
Tkw_About_Control_AdapterInfoLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_AdapterInfoLabel }
Tkw_About_Control_AdapterInfoLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_AdapterInfoLabel_Push }
Tkw_About_Control_UserCountLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserCountLabel }
Tkw_About_Control_UserCountLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserCountLabel_Push }
Tkw_About_Control_OwnerLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_OwnerLabel }
Tkw_About_Control_OwnerLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_OwnerLabel_Push }
Tkw_About_Control_ShellCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_ShellCaptionLabel }
Tkw_About_Control_ShellCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_ShellCaptionLabel_Push }
Tkw_About_Control_OwnerCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_OwnerCaptionLabel }
Tkw_About_Control_OwnerCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_OwnerCaptionLabel_Push }
Tkw_About_Control_UserInfoGroupBox.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserInfoGroupBox }
Tkw_About_Control_UserInfoGroupBox_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserInfoGroupBox_Push }
Tkw_About_Control_EMailCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_EMailCaptionLabel }
Tkw_About_Control_EMailCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_EMailCaptionLabel_Push }
Tkw_About_Control_EMailLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_EMailLabel }
Tkw_About_Control_EMailLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_EMailLabel_Push }
Tkw_About_Control_LoginCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_LoginCaptionLabel }
Tkw_About_Control_LoginCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_LoginCaptionLabel_Push }
Tkw_About_Control_UserCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserCaptionLabel }
Tkw_About_Control_UserCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserCaptionLabel_Push }
Tkw_About_Control_UserNameLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserNameLabel }
Tkw_About_Control_UserNameLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserNameLabel_Push }
Tkw_About_Control_LoginLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_LoginLabel }
Tkw_About_Control_LoginLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_LoginLabel_Push }
Tkw_About_Control_CopyrightCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_CopyrightCaptionLabel }
Tkw_About_Control_CopyrightCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_CopyrightCaptionLabel_Push }
Tkw_About_Control_OkButton.RegisterInEngine;
{* Регистрация Tkw_About_Control_OkButton }
Tkw_About_Control_OkButton_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_OkButton_Push }
Tkw_About_Control_UserCountCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserCountCaptionLabel }
Tkw_About_Control_UserCountCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_UserCountCaptionLabel_Push }
Tkw_About_Control_AdapterCaptionLabel.RegisterInEngine;
{* Регистрация Tkw_About_Control_AdapterCaptionLabel }
Tkw_About_Control_AdapterCaptionLabel_Push.RegisterInEngine;
{* Регистрация Tkw_About_Control_AdapterCaptionLabel_Push }
TkwEfAboutPbLogo.RegisterInEngine;
{* Регистрация efAbout_pbLogo }
TkwEfAboutShellInfoLabel.RegisterInEngine;
{* Регистрация efAbout_ShellInfoLabel }
TkwEfAboutAdapterInfoLabel.RegisterInEngine;
{* Регистрация efAbout_AdapterInfoLabel }
TkwEfAboutUserCountLabel.RegisterInEngine;
{* Регистрация efAbout_UserCountLabel }
TkwEfAboutOwnerLabel.RegisterInEngine;
{* Регистрация efAbout_OwnerLabel }
TkwEfAboutShellCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_ShellCaptionLabel }
TkwEfAboutOwnerCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_OwnerCaptionLabel }
TkwEfAboutUserInfoGroupBox.RegisterInEngine;
{* Регистрация efAbout_UserInfoGroupBox }
TkwEfAboutEMailCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_EMailCaptionLabel }
TkwEfAboutEMailLabel.RegisterInEngine;
{* Регистрация efAbout_EMailLabel }
TkwEfAboutLoginCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_LoginCaptionLabel }
TkwEfAboutUserCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_UserCaptionLabel }
TkwEfAboutUserNameLabel.RegisterInEngine;
{* Регистрация efAbout_UserNameLabel }
TkwEfAboutLoginLabel.RegisterInEngine;
{* Регистрация efAbout_LoginLabel }
TkwEfAboutCopyrightCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_CopyrightCaptionLabel }
TkwEfAboutOkButton.RegisterInEngine;
{* Регистрация efAbout_OkButton }
TkwEfAboutUserCountCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_UserCountCaptionLabel }
TkwEfAboutAdapterCaptionLabel.RegisterInEngine;
{* Регистрация efAbout_AdapterCaptionLabel }
TtfwTypeRegistrator.RegisterType(TypeInfo(TefAbout));
{* Регистрация типа TefAbout }
TtfwTypeRegistrator.RegisterType(TypeInfo(TPaintBox));
{* Регистрация типа TPaintBox }
TtfwTypeRegistrator.RegisterType(TypeInfo(TvtLabel));
{* Регистрация типа TvtLabel }
TtfwTypeRegistrator.RegisterType(TypeInfo(TvtGroupBox));
{* Регистрация типа TvtGroupBox }
TtfwTypeRegistrator.RegisterType(TypeInfo(TvtButton));
{* Регистрация типа TvtButton }
{$IfEnd} // NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts)
end.
|
unit ActionListWordsPack;
// Модуль: "w:\common\components\rtl\Garant\ScriptEngine\ActionListWordsPack.pas"
// Стереотип: "ScriptKeywordsPack"
// Элемент модели: "ActionListWordsPack" MUID: (55B8E44302B1)
{$Include w:\common\components\rtl\Garant\ScriptEngine\seDefine.inc}
interface
{$If NOT Defined(NoScripts) AND NOT Defined(NoVCL)}
uses
l3IntfUses
//#UC START# *55B8E44302B1intf_uses*
//#UC END# *55B8E44302B1intf_uses*
;
{$IfEnd} // NOT Defined(NoScripts) AND NOT Defined(NoVCL)
implementation
{$If NOT Defined(NoScripts) AND NOT Defined(NoVCL)}
uses
l3ImplUses
, ActnList
, tfwClassLike
, tfwScriptingInterfaces
, TypInfo
, ContainedActionsWordspack
, SysUtils
, TtfwTypeRegistrator_Proxy
, tfwScriptingTypes
//#UC START# *55B8E44302B1impl_uses*
{$IfDef XE}
, System.Actions
{$EndIf}
//#UC END# *55B8E44302B1impl_uses*
;
type
TkwPopActionListFindAction = {final} class(TtfwClassLike)
{* Слово скрипта pop:ActionList:FindAction }
private
function FindAction(const aCtx: TtfwContext;
aActionList: TActionList;
const anActionName: AnsiString): TContainedAction;
{* Реализация слова скрипта pop:ActionList:FindAction }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
end;//TkwPopActionListFindAction
function TkwPopActionListFindAction.FindAction(const aCtx: TtfwContext;
aActionList: TActionList;
const anActionName: AnsiString): TContainedAction;
{* Реализация слова скрипта pop:ActionList:FindAction }
//#UC START# *55B8E46F00AF_55B8E46F00AF_4EF32DDB0235_Word_var*
var
l_Index : Integer;
//#UC END# *55B8E46F00AF_55B8E46F00AF_4EF32DDB0235_Word_var*
begin
//#UC START# *55B8E46F00AF_55B8E46F00AF_4EF32DDB0235_Word_impl*
Result := nil;
for l_Index := 0 to aActionList.ActionCount - 1 do
begin
Result := aActionList.Actions[l_Index];
if (Result.Name = anActionName) then
Break
else
Result := nil;
end; // for i := 0 to l_ActList.ActionCount - 1 do
//#UC END# *55B8E46F00AF_55B8E46F00AF_4EF32DDB0235_Word_impl*
end;//TkwPopActionListFindAction.FindAction
class function TkwPopActionListFindAction.GetWordNameForRegister: AnsiString;
begin
Result := 'pop:ActionList:FindAction';
end;//TkwPopActionListFindAction.GetWordNameForRegister
function TkwPopActionListFindAction.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TContainedAction);
end;//TkwPopActionListFindAction.GetResultTypeInfo
function TkwPopActionListFindAction.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 2;
end;//TkwPopActionListFindAction.GetAllParamsCount
function TkwPopActionListFindAction.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TActionList), @tfw_tiString]);
end;//TkwPopActionListFindAction.ParamsTypes
procedure TkwPopActionListFindAction.DoDoIt(const aCtx: TtfwContext);
var l_aActionList: TActionList;
var l_anActionName: AnsiString;
begin
try
l_aActionList := TActionList(aCtx.rEngine.PopObjAs(TActionList));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра aActionList: TActionList : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
try
l_anActionName := aCtx.rEngine.PopDelphiString;
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра anActionName: AnsiString : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(FindAction(aCtx, l_aActionList, l_anActionName));
end;//TkwPopActionListFindAction.DoDoIt
initialization
TkwPopActionListFindAction.RegisterInEngine;
{* Регистрация pop_ActionList_FindAction }
TtfwTypeRegistrator.RegisterType(TypeInfo(TActionList));
{* Регистрация типа TActionList }
TtfwTypeRegistrator.RegisterType(TypeInfo(TContainedAction));
{* Регистрация типа TContainedAction }
TtfwTypeRegistrator.RegisterType(@tfw_tiString);
{* Регистрация типа AnsiString }
{$IfEnd} // NOT Defined(NoScripts) AND NOT Defined(NoVCL)
end.
|
unit nscTasksPanelGroupsIterator;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Библиотека "Nemesis"
// Автор: Люлин А.В.
// Модуль: "w:/common/components/gui/Garant/Nemesis/nscTasksPanelGroupsIterator.pas"
// Начат: 17.01.2011 15:06
// Родные Delphi интерфейсы (.pas)
// Generated from UML model, root element: <<SimpleClass::Class>> Shared Delphi For F1::Nemesis::TasksPanel::TnscTasksPanelGroupsIterator
//
//
// Все права принадлежат ООО НПП "Гарант-Сервис".
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ! Полностью генерируется с модели. Править руками - нельзя. !
{$Include ..\Nemesis\nscDefine.inc}
interface
{$If defined(Nemesis)}
uses
Classes
{$If not defined(NoVCM)}
,
vcmTaskPanelInterfaces
{$IfEnd} //not NoVCM
,
l3ProtoObject,
nscTasksPanelGroupDescList
;
{$IfEnd} //Nemesis
{$If defined(Nemesis)}
type
TnscTasksPanelGroupsIterator = class(Tl3ProtoObject {$If not defined(NoVCM)}, IvcmCustOpsGroupsIterator{$IfEnd} //not NoVCM
)
private
// private fields
f_Groups : TnscTasksPanelGroupDescList;
f_Current : Integer;
protected
// realized methods
{$If not defined(NoVCM)}
function Next: IvcmCustOpsGroup;
{$IfEnd} //not NoVCM
protected
// overridden protected methods
procedure Cleanup; override;
{* Функция очистки полей объекта. }
public
// public methods
constructor Create(aGroups: TnscTasksPanelGroupDescList); reintroduce;
class function Make(aGroups: TnscTasksPanelGroupDescList): IvcmCustOpsGroupsIterator; reintroduce;
{* Сигнатура фабрики TnscTasksPanelGroupsIterator.Make }
end;//TnscTasksPanelGroupsIterator
{$IfEnd} //Nemesis
implementation
{$If defined(Nemesis)}
uses
nscTasksPanelGroup,
SysUtils,
l3Base
;
{$IfEnd} //Nemesis
{$If defined(Nemesis)}
// start class TnscTasksPanelGroupsIterator
constructor TnscTasksPanelGroupsIterator.Create(aGroups: TnscTasksPanelGroupDescList);
//#UC START# *4D343C3502B5_4D3430A7028D_var*
//#UC END# *4D343C3502B5_4D3430A7028D_var*
begin
//#UC START# *4D343C3502B5_4D3430A7028D_impl*
inherited Create;
f_Current := -1;
l3Set(f_Groups, aGroups);
//#UC END# *4D343C3502B5_4D3430A7028D_impl*
end;//TnscTasksPanelGroupsIterator.Create
class function TnscTasksPanelGroupsIterator.Make(aGroups: TnscTasksPanelGroupDescList): IvcmCustOpsGroupsIterator;
var
l_Inst : TnscTasksPanelGroupsIterator;
begin
l_Inst := Create(aGroups);
try
Result := l_Inst;
finally
l_Inst.Free;
end;//try..finally
end;
{$If not defined(NoVCM)}
function TnscTasksPanelGroupsIterator.Next: IvcmCustOpsGroup;
//#UC START# *4992FE89024F_4D3430A7028D_var*
//#UC END# *4992FE89024F_4D3430A7028D_var*
begin
//#UC START# *4992FE89024F_4D3430A7028D_impl*
while true do
begin
Inc(f_Current);
if (f_Current < f_Groups.Count) then
begin
if f_Groups[f_Current].rControl.Visible then
begin
Result := TnscTasksPanelGroup.Make(f_Current, f_Groups[f_Current]);
break;
end//f_Groups[f_Current].rControl.Visible
else
continue;
end//f_Current < f_Groups.Count
else
begin
Result := nil;
break;
end;//f_Current < f_Groups.Count
end;//while true
//#UC END# *4992FE89024F_4D3430A7028D_impl*
end;//TnscTasksPanelGroupsIterator.Next
{$IfEnd} //not NoVCM
procedure TnscTasksPanelGroupsIterator.Cleanup;
//#UC START# *479731C50290_4D3430A7028D_var*
//#UC END# *479731C50290_4D3430A7028D_var*
begin
//#UC START# *479731C50290_4D3430A7028D_impl*
FreeAndNil(f_Groups);
inherited;
//#UC END# *479731C50290_4D3430A7028D_impl*
end;//TnscTasksPanelGroupsIterator.Cleanup
{$IfEnd} //Nemesis
end. |
unit Main;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TMainForm = class(TForm)
btnChrono: TButton;
lblElapsedTime: TLabel;
lblElapsedTimeLong: TLabel;
tiChrono: TTimer;
Label3: TLabel;
lblTimer: TLabel;
lblShortFormat: TLabel;
lblLongFormat: TLabel;
cbPrecissionFormat: TComboBox;
Label1: TLabel;
procedure btnChronoClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure tiChronoTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
StartDate : TDateTime;
implementation
uses
Quick.Chrono;
var
crono : TChronometer;
hola : string;
{$R *.dfm}
procedure TMainForm.btnChronoClick(Sender: TObject);
begin
if btnChrono.Caption = 'Start' then
begin
crono.ReportFormatPrecission := TPrecissionFormat(cbPrecissionFormat.ItemIndex);
StartDate := Now();
tiChrono.Enabled := True;
crono.Start;
btnChrono.Caption := 'Stop';
end
else
begin
crono.Stop;
tiChrono.Enabled := False;
btnChrono.Caption := 'Start';
lblElapsedTime.Caption := crono.ElapsedTime;
lblElapsedTimeLong.Caption := crono.ElapsedTime(True);
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
crono := TChronometer.Create(False);
end;
procedure TMainForm.tiChronoTimer(Sender: TObject);
var
newtime : string;
begin
tiChrono.Enabled := False;
try
newtime := FormatDateTime('hh:mm:ss',Now()-StartDate);
if newtime <> lblTimer.Caption then lblTimer.Caption := newtime;
finally
tiChrono.Enabled := True;
end;
end;
end.
|
inherited dmRotasEspecificas: TdmRotasEspecificas
OldCreateOrder = True
inherited qryManutencao: TIBCQuery
SQLInsert.Strings = (
'INSERT INTO STWOPETROTE'
' (CGC, CID_ORIG, EST_ORIG, CID_DEST, EST_DEST, FILIAL, TARIFA, ' +
'TX_ENTREGA, PEDAGIO_IDA, PEDAGIO_VOLTA, DT_ALTERACAO, OPERADOR, ' +
'VLR_PED_EIXO, KM_ROTA, FRETE_TRUCK, FRETE_CARRETA, ADICIONAL_TRU' +
'CK, ADICIONAL_CARRETA)'
'VALUES'
' (:CGC, :CID_ORIG, :EST_ORIG, :CID_DEST, :EST_DEST, :FILIAL, :T' +
'ARIFA, :TX_ENTREGA, :PEDAGIO_IDA, :PEDAGIO_VOLTA, :DT_ALTERACAO,' +
' :OPERADOR, :VLR_PED_EIXO, :KM_ROTA, :FRETE_TRUCK, :FRETE_CARRET' +
'A, :ADICIONAL_TRUCK, :ADICIONAL_CARRETA)')
SQLDelete.Strings = (
'DELETE FROM STWOPETROTE'
'WHERE'
' CGC = :Old_CGC AND CID_ORIG = :Old_CID_ORIG AND EST_ORIG = :Ol' +
'd_EST_ORIG AND CID_DEST = :Old_CID_DEST AND EST_DEST = :Old_EST_' +
'DEST')
SQLUpdate.Strings = (
'UPDATE STWOPETROTE'
'SET'
' CGC = :CGC, CID_ORIG = :CID_ORIG, EST_ORIG = :EST_ORIG, CID_DE' +
'ST = :CID_DEST, EST_DEST = :EST_DEST, FILIAL = :FILIAL, TARIFA =' +
' :TARIFA, TX_ENTREGA = :TX_ENTREGA, PEDAGIO_IDA = :PEDAGIO_IDA, ' +
'PEDAGIO_VOLTA = :PEDAGIO_VOLTA, DT_ALTERACAO = :DT_ALTERACAO, OP' +
'ERADOR = :OPERADOR, VLR_PED_EIXO = :VLR_PED_EIXO, KM_ROTA = :KM_' +
'ROTA, FRETE_TRUCK = :FRETE_TRUCK, FRETE_CARRETA = :FRETE_CARRETA' +
', ADICIONAL_TRUCK = :ADICIONAL_TRUCK, ADICIONAL_CARRETA = :ADICI' +
'ONAL_CARRETA'
'WHERE'
' CGC = :Old_CGC AND CID_ORIG = :Old_CID_ORIG AND EST_ORIG = :Ol' +
'd_EST_ORIG AND CID_DEST = :Old_CID_DEST AND EST_DEST = :Old_EST_' +
'DEST')
SQLRefresh.Strings = (
'SELECT CGC, CID_ORIG, EST_ORIG, CID_DEST, EST_DEST, FILIAL, TARI' +
'FA, TX_ENTREGA, PEDAGIO_IDA, PEDAGIO_VOLTA, DT_ALTERACAO, OPERAD' +
'OR, VLR_PED_EIXO, KM_ROTA, FRETE_TRUCK, FRETE_CARRETA, ADICIONAL' +
'_TRUCK, ADICIONAL_CARRETA FROM STWOPETROTE'
'WHERE'
' CGC = :Old_CGC AND CID_ORIG = :Old_CID_ORIG AND EST_ORIG = :Ol' +
'd_EST_ORIG AND CID_DEST = :Old_CID_DEST AND EST_DEST = :Old_EST_' +
'DEST')
SQLLock.Strings = (
'SELECT NULL FROM STWOPETROTE'
'WHERE'
'CGC = :Old_CGC AND CID_ORIG = :Old_CID_ORIG AND EST_ORIG = :Old_' +
'EST_ORIG AND CID_DEST = :Old_CID_DEST AND EST_DEST = :Old_EST_DE' +
'ST'
'FOR UPDATE WITH LOCK')
SQL.Strings = (
'SELECT'
' ROTE.CGC, '
' ROTE.CID_ORIG, '
' ROTE.EST_ORIG, '
' ROTE.CID_DEST, '
' ROTE.EST_DEST, '
' ROTE.FILIAL, '
' ROTE.TARIFA, '
' ROTE.TX_ENTREGA, '
' ROTE.PEDAGIO_IDA, '
' ROTE.PEDAGIO_VOLTA, '
' ROTE.DT_ALTERACAO, '
' ROTE.OPERADOR, '
' ROTE.VLR_PED_EIXO, '
' ROTE.KM_ROTA, '
' ROTE.FRETE_TRUCK, '
' ROTE.FRETE_CARRETA, '
' ROTE.ADICIONAL_TRUCK, '
' ROTE.ADICIONAL_CARRETA,'
' FIL.NOME NM_FILIAL,'
' CL.NOME NM_CLIENTE'
'FROM STWOPETROTE ROTE'
'LEFT JOIN STWOPETFIL FIL ON FIL.FILIAL = ROTE.FILIAL'
'JOIN STWOPETCLI CL ON CL.CGC = ROTE.CGC')
object qryManutencaoCGC: TStringField
FieldName = 'CGC'
Required = True
Size = 18
end
object qryManutencaoCID_ORIG: TStringField
FieldName = 'CID_ORIG'
Required = True
Size = 30
end
object qryManutencaoEST_ORIG: TStringField
FieldName = 'EST_ORIG'
Required = True
Size = 2
end
object qryManutencaoCID_DEST: TStringField
FieldName = 'CID_DEST'
Required = True
Size = 30
end
object qryManutencaoEST_DEST: TStringField
FieldName = 'EST_DEST'
Required = True
Size = 2
end
object qryManutencaoFILIAL: TStringField
FieldName = 'FILIAL'
Size = 3
end
object qryManutencaoTARIFA: TStringField
FieldName = 'TARIFA'
Size = 7
end
object qryManutencaoTX_ENTREGA: TFloatField
FieldName = 'TX_ENTREGA'
end
object qryManutencaoPEDAGIO_IDA: TSmallintField
FieldName = 'PEDAGIO_IDA'
end
object qryManutencaoPEDAGIO_VOLTA: TSmallintField
FieldName = 'PEDAGIO_VOLTA'
end
object qryManutencaoDT_ALTERACAO: TDateTimeField
FieldName = 'DT_ALTERACAO'
end
object qryManutencaoOPERADOR: TStringField
FieldName = 'OPERADOR'
end
object qryManutencaoVLR_PED_EIXO: TFloatField
FieldName = 'VLR_PED_EIXO'
end
object qryManutencaoKM_ROTA: TFloatField
FieldName = 'KM_ROTA'
end
object qryManutencaoFRETE_TRUCK: TFloatField
FieldName = 'FRETE_TRUCK'
end
object qryManutencaoFRETE_CARRETA: TFloatField
FieldName = 'FRETE_CARRETA'
end
object qryManutencaoADICIONAL_TRUCK: TFloatField
FieldName = 'ADICIONAL_TRUCK'
end
object qryManutencaoADICIONAL_CARRETA: TFloatField
FieldName = 'ADICIONAL_CARRETA'
end
object qryManutencaoNM_FILIAL: TStringField
FieldName = 'NM_FILIAL'
ProviderFlags = []
ReadOnly = True
Size = 40
end
object qryManutencaoNM_CLIENTE: TStringField
FieldName = 'NM_CLIENTE'
ProviderFlags = []
ReadOnly = True
Size = 40
end
end
inherited qryLocalizacao: TIBCQuery
SQL.Strings = (
'SELECT'
' ROTE.CGC, '
' ROTE.CID_ORIG, '
' ROTE.EST_ORIG, '
' ROTE.CID_DEST, '
' ROTE.EST_DEST, '
' ROTE.FILIAL, '
' ROTE.TARIFA, '
' ROTE.TX_ENTREGA, '
' ROTE.PEDAGIO_IDA, '
' ROTE.PEDAGIO_VOLTA, '
' ROTE.DT_ALTERACAO, '
' ROTE.OPERADOR, '
' ROTE.VLR_PED_EIXO, '
' ROTE.KM_ROTA, '
' ROTE.FRETE_TRUCK, '
' ROTE.FRETE_CARRETA, '
' ROTE.ADICIONAL_TRUCK, '
' ROTE.ADICIONAL_CARRETA,'
' FIL.NOME NM_FILIAL,'
' CL.NOME NM_CLIENTE'
'FROM STWOPETROTE ROTE'
'LEFT JOIN STWOPETFIL FIL ON FIL.FILIAL = ROTE.FILIAL'
'JOIN STWOPETCLI CL ON CL.CGC = ROTE.CGC')
object qryLocalizacaoCGC: TStringField
FieldName = 'CGC'
Required = True
Size = 18
end
object qryLocalizacaoCID_ORIG: TStringField
FieldName = 'CID_ORIG'
Required = True
Size = 30
end
object qryLocalizacaoEST_ORIG: TStringField
FieldName = 'EST_ORIG'
Required = True
Size = 2
end
object qryLocalizacaoCID_DEST: TStringField
FieldName = 'CID_DEST'
Required = True
Size = 30
end
object qryLocalizacaoEST_DEST: TStringField
FieldName = 'EST_DEST'
Required = True
Size = 2
end
object qryLocalizacaoFILIAL: TStringField
FieldName = 'FILIAL'
Size = 3
end
object qryLocalizacaoTARIFA: TStringField
FieldName = 'TARIFA'
Size = 7
end
object qryLocalizacaoTX_ENTREGA: TFloatField
FieldName = 'TX_ENTREGA'
end
object qryLocalizacaoPEDAGIO_IDA: TSmallintField
FieldName = 'PEDAGIO_IDA'
end
object qryLocalizacaoPEDAGIO_VOLTA: TSmallintField
FieldName = 'PEDAGIO_VOLTA'
end
object qryLocalizacaoDT_ALTERACAO: TDateTimeField
FieldName = 'DT_ALTERACAO'
end
object qryLocalizacaoOPERADOR: TStringField
FieldName = 'OPERADOR'
end
object qryLocalizacaoVLR_PED_EIXO: TFloatField
FieldName = 'VLR_PED_EIXO'
end
object qryLocalizacaoKM_ROTA: TFloatField
FieldName = 'KM_ROTA'
end
object qryLocalizacaoFRETE_TRUCK: TFloatField
FieldName = 'FRETE_TRUCK'
end
object qryLocalizacaoFRETE_CARRETA: TFloatField
FieldName = 'FRETE_CARRETA'
end
object qryLocalizacaoADICIONAL_TRUCK: TFloatField
FieldName = 'ADICIONAL_TRUCK'
end
object qryLocalizacaoADICIONAL_CARRETA: TFloatField
FieldName = 'ADICIONAL_CARRETA'
end
object qryLocalizacaoNM_FILIAL: TStringField
FieldName = 'NM_FILIAL'
ProviderFlags = []
ReadOnly = True
Size = 40
end
object qryLocalizacaoNM_CLIENTE: TStringField
FieldName = 'NM_CLIENTE'
ProviderFlags = []
ReadOnly = True
Required = True
Size = 40
end
end
end
|
{$MODE OBJFPC}
type time = record
h:0..23;
m,s:0..59;
end;
var a,b:time;
operator <(a,b:time):boolean;
begin
result:=(a.h*3600+a.m*60+a.s)<(b.h*3600+b.m*60+b.s);
end;
begin
read(a.h,a.m,a.s);
read(b.h,b.m,b.s);
write(a<b);
end. |
unit ChOwn1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ButtonChange: TButton;
ButtonList: TButton;
ListBox1: TListBox;
procedure ButtonChangeClick(Sender: TObject);
procedure ButtonListClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ChOwn2;
{$R *.DFM}
procedure ChangeOwner (Component, NewOwner: TComponent);
begin
Component.Owner.RemoveComponent (Component);
NewOwner.InsertComponent (Component);
end;
procedure TForm1.ButtonChangeClick(Sender: TObject);
begin
if Assigned (Button1) then
begin
// change parent
Button1.Parent := Form2;
// change owner
ChangeOwner (Button1, Form2);
end;
end;
procedure TForm1.ButtonListClick(Sender: TObject);
var
I: Integer;
begin
ListBox1.Items.Clear;
for I := 0 to ComponentCount - 1 do
ListBox1.Items.Add (Components[I].Name);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage ('My owner is ' +
((Sender as TButton).Owner as TForm).Caption);
end;
end.
|
unit uMatricula;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uBase, Data.DB, Vcl.Grids, Vcl.DBGrids,
Vcl.Buttons, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Mask, FireDAC.Stan.Intf,
FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS,
FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Stan.Async, FireDAC.DApt,
FireDAC.Comp.DataSet, FireDAC.Comp.Client;
type
TfrmCadastroAlunoDisciplina = class(TfrmCadastroBase)
Label3: TLabel;
edtCpf: TMaskEdit;
Label2: TLabel;
edtAluno: TEdit;
qrDados: TFDQuery;
dsDados: TDataSource;
qrAluno: TFDQuery;
cbDisciplina: TComboBox;
Label1: TLabel;
cbProfessores: TComboBox;
Label4: TLabel;
qrDisciplina: TFDQuery;
qrDiscip_Prof: TFDQuery;
procedure edtCpfExit(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure cbDisciplinaClick(Sender: TObject);
procedure sbNovoClick(Sender: TObject);
procedure sbSalvarClick(Sender: TObject);
procedure cbProfessoresClick(Sender: TObject);
procedure sbExcluirClick(Sender: TObject);
procedure dbCellClick(Column: TColumn);
procedure sbEditarClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
procedure LimparCampos;
procedure CarregarDisciplinas;
procedure CarregarProfessores;
procedure ExibirRegistros;
end;
var
frmCadastroAlunoDisciplina: TfrmCadastroAlunoDisciplina;
id_matricula : integer;
codigo_aluno : integer;
codigo_disciplina : integer;
codigo_professor : integer;
implementation
{$R *.dfm}
uses uModulo, uCadastroAluno, uSystemUtils;
procedure TfrmCadastroAlunoDisciplina.CarregarDisciplinas;
begin
ExibirRegistros;
cbDisciplina.Items.Clear;
qrDisciplina.Close;
qrDisciplina.SQL.Clear;
qrDisciplina.SQL.Add('SELECT * FROM disciplinas');
qrDisciplina.Open();
while not qrDisciplina.Eof do
begin
cbDisciplina.Items.AddObject(qrDisciplina.FieldByName('descricao').AsString, TObject(qrDisciplina.FieldByName('id').AsInteger));
qrDisciplina.Next;
end;
qrDisciplina.Open();
end;
procedure TfrmCadastroAlunoDisciplina.CarregarProfessores;
begin
qrDiscip_Prof.Close;
qrDiscip_Prof.SQL.Clear;
qrDiscip_Prof.SQL.Add('SELECT * FROM professor');
qrDiscip_Prof.SQL.Add(' WHERE id = :id');
qrDiscip_Prof.ParamByName('id').AsInteger := Integer(cbProfessores.Items.Objects[cbProfessores.ItemIndex]);
qrDiscip_Prof.Open();
codigo_professor := qrDiscip_Prof.FieldByName('id').AsInteger;
end;
procedure TfrmCadastroAlunoDisciplina.cbDisciplinaClick(Sender: TObject);
begin
inherited;
qrDisciplina.Close;
qrDisciplina.SQL.Clear;
qrDisciplina.SQL.Add('SELECT * FROM disciplinas');
qrDisciplina.SQL.Add(' WHERE id = :id');
qrDisciplina.ParamByName('id').AsInteger := Integer(cbDisciplina.Items.Objects[cbDisciplina.ItemIndex]);
qrDisciplina.Open();
codigo_disciplina := qrDisciplina.FieldByName('id').AsInteger;
cbProfessores.Items.Clear;
qrDiscip_Prof.Close;
qrDiscip_Prof.SQL.Clear;
qrDiscip_Prof.SQL.Add('SELECT p.id, p.nome ');
qrDiscip_Prof.SQL.Add(' FROM professor p ');
qrDiscip_Prof.SQL.Add(' INNER JOIN disciplina_professor dp ');
qrDiscip_Prof.SQL.Add(' ON p.id = dp.codigo_professor ');
qrDiscip_Prof.SQL.Add(' WHERE dp.codigo_disciplina = :codigo_disciplina');
qrDiscip_Prof.ParamByName('codigo_disciplina').AsInteger := codigo_disciplina;
qrDiscip_Prof.Open();
qrDiscip_Prof.First;
while not qrDiscip_Prof.Eof do
begin
cbProfessores.Items.AddObject(qrDiscip_Prof.FieldByName('nome').AsString, TObject(qrDiscip_Prof.FieldByName('id').AsInteger));
cbProfessores.ItemIndex := 0;
qrDiscip_Prof.Next;
end;
qrDiscip_Prof.Open();
if qrDiscip_Prof.FieldByName('nome').AsString <> '' then
CarregarProfessores
else
begin
ShowMessage('Disciplina não possui professor cadastrado.');
exit
end;
end;
procedure TfrmCadastroAlunoDisciplina.cbProfessoresClick(Sender: TObject);
begin
inherited;
CarregarProfessores;
end;
procedure TfrmCadastroAlunoDisciplina.dbCellClick(Column: TColumn);
begin
inherited;
if qrDados.FieldByName('id').AsString <> null then
begin
id_matricula := qrDados.FieldByName('id').AsInteger;
cbDisciplina.Text := qrDados.FieldByName('descricao').AsString;
cbProfessores.Text := qrDados.FieldByName('nome').AsString;
end;
end;
procedure TfrmCadastroAlunoDisciplina.edtCpfExit(Sender: TObject);
begin
inherited;
qrAluno.Close;
qrAluno.SQL.Clear;
qrAluno.SQL.Add('SELECT * FROM aluno');
qrAluno.SQL.Add(' WHERE cpf = :cpf');
qrAluno.ParamByName('cpf').AsString := edtCpf.Text;
qrAluno.Open();
if qrAluno.IsEmpty then
begin
ShowMessage('CPF não encontrado.');
LimparCampos;
edtCpf.SetFocus;
Exit;
end
else
begin
ExibirRegistros;
codigo_aluno := qrAluno.FieldByName('id').AsInteger;
edtCpf.Text := qrAluno.FieldByName('cpf').AsString;
edtAluno.Text := qrAluno.FieldByName('nome').AsString;
edtAluno.Enabled := True;
cbDisciplina.Enabled := True;
cbProfessores.Enabled := True;
end;
end;
procedure TfrmCadastroAlunoDisciplina.ExibirRegistros;
begin
qrDados.Close;
qrDados.SQL.Clear;
qrDados.SQL.Add('SELECT da.id ');
qrDados.SQL.Add(' ,d.descricao ');
qrDados.SQL.Add(' ,p.nome ');
qrDados.SQL.Add(' FROM disciplina_aluno da ');
qrDados.SQL.Add(' INNER JOIN disciplinas d ');
qrDados.SQL.Add(' ON d.id = da.codigo_disciplina ');
qrDados.SQL.Add(' INNER JOIN professor p ');
qrDados.SQL.Add(' ON p.id = da.codigo_professor ');
qrDados.SQL.Add(' INNER JOIN aluno a ');
qrDados.SQL.Add(' ON a.id = da.codigo_aluno ');
qrDados.SQL.Add(' WHERE a.cpf = :cpf ');
qrDados.SQL.Add(' ORDER BY id ASC ');
qrDados.ParamByName('cpf').AsString := edtCpf.Text;
qrDados.Open();
end;
procedure TfrmCadastroAlunoDisciplina.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
frmCadastroAlunoDisciplina := nil;
end;
procedure TfrmCadastroAlunoDisciplina.FormShow(Sender: TObject);
begin
inherited;
CarregarDisciplinas;
ExibirRegistros;
edtAluno.Enabled := False;
cbDisciplina.Enabled := False;
cbProfessores.Enabled := False;
end;
procedure TfrmCadastroAlunoDisciplina.LimparCampos;
begin
edtCpf.Text := '';
edtAluno.Text := '';
end;
procedure TfrmCadastroAlunoDisciplina.sbEditarClick(Sender: TObject);
begin
inherited;
if cbDisciplina.ItemIndex = -1 then
begin
ShowMessage('Selecione um registro para atualização.');
Exit;
end;
if id_matricula = 0 then
begin
ShowMessage('Selecione um registro para atualização.');
Exit;
end;
qrDados.Close;
qrDados.SQL.Clear;
qrDados.SQL.Add('SELECT * FROM disciplina_aluno');
qrDados.SQL.Add(' WHERE codigo_disciplina = :codigo_disciplina');
qrDados.SQL.Add(' AND codigo_professor = :codigo_professor');
qrDados.ParamByName('codigo_disciplina').AsInteger := codigo_disciplina;
qrDados.ParamByName('codigo_professor').AsInteger := codigo_professor;
qrDados.Open;
if qrDados.IsEmpty then
begin
qrDados.Close;
qrDados.SQL.Clear;
qrDados.SQL.Add('UPDATE disciplina_aluno');
qrDados.SQL.Add('SET codigo_disciplina = :codigo_disciplina, codigo_professor = :codigo_professor');
qrDados.SQL.Add('WHERE id = :id');
qrDados.ParamByName('id').AsInteger := id_matricula;
qrDados.ParamByName('codigo_disciplina').AsInteger := codigo_disciplina;
qrDados.ParamByName('codigo_professor').AsInteger := codigo_professor;
qrDados.ExecSQL;
ShowMessage('Cadastro atualizado com sucesso.');
cbDisciplina.Text := '';
cbProfessores.Text := '';
ExibirRegistros;
end
else
begin
ExibirRegistros;
ShowMessage('Disciplina já possui cadastro.');
Exit;
end;
end;
procedure TfrmCadastroAlunoDisciplina.sbExcluirClick(Sender: TObject);
begin
inherited;
if not db.Columns.Grid.Focused then
begin
ShowMessage('Selecione um registro para exclusão.');
Exit;
end;
if Trim(cbDisciplina.Text) = '' then
begin
ShowMessage('Selecione um registro para atualização.');
Exit;
end;
if MsgConfirm('Deseja excluir disciplina?') then
begin
qrDados.Close;
qrDados.SQL.Clear;
qrDados.SQL.Add('DELETE FROM disciplina_aluno WHERE id = :id');
qrDados.ParamByName('id').AsInteger := id_matricula;
qrDados.ExecSQL;
ExibirRegistros;
ShowMessage('Registro excluido com sucesso.');
cbProfessores.ItemIndex := -1;
db.SetFocus;
end;
end;
procedure TfrmCadastroAlunoDisciplina.sbNovoClick(Sender: TObject);
begin
inherited;
edtCpf.Text := '';
edtAluno.Text := '';
cbDisciplina.Items.Clear;
cbProfessores.Items.Clear;
end;
procedure TfrmCadastroAlunoDisciplina.sbSalvarClick(Sender: TObject);
begin
inherited;
if Trim(edtCpf.Text) = '' then
begin
ShowMessage('Campo CPF obrigatório.');
edtCpf.SetFocus;
Exit;
end;
if Trim(edtAluno.Text) = '' then
begin
ShowMessage('Campo nome obrigatório.');
edtAluno.SetFocus;
Exit;
end;
if cbDisciplina.ItemIndex = - 1 then
begin
ShowMessage('Campo disciplina obrigatório.');
cbDisciplina.SetFocus;
Exit;
end;
if cbProfessores.ItemIndex = - 1 then
begin
ShowMessage('Campo professor obrigatório.');
cbDisciplina.SetFocus;
Exit;
end;
qrDados.Close;
qrDados.SQL.Clear;
qrDados.SQL.Add('SELECT * FROM disciplina_aluno');
qrDados.SQL.Add(' WHERE codigo_disciplina = :codigo_disciplina');
qrDados.SQL.Add(' AND codigo_aluno = :codigo_aluno');
qrDados.ParamByName('codigo_disciplina').AsInteger := codigo_disciplina;
qrDados.ParamByName('codigo_aluno').AsInteger := codigo_aluno;
qrDados.Open;
if qrDados.IsEmpty then
begin
qrDados.Close;
qrDados.SQL.Clear;
qrDados.SQL.Add('INSERT INTO disciplina_aluno (codigo_aluno ,codigo_disciplina, codigo_professor)');
qrDados.SQL.Add('VALUES (:codigo_aluno, :codigo_disciplina, :codigo_professor)');
qrDados.ParamByName('codigo_aluno').AsInteger := codigo_aluno;
qrDados.ParamByName('codigo_disciplina').AsInteger := codigo_disciplina;
qrDados.ParamByName('codigo_professor').AsInteger := codigo_professor;
qrDados.ExecSQL;
ExibirRegistros;
ShowMessage('Cadastro realizado com sucesso.');
cbDisciplina.ItemIndex := -1;
cbProfessores.ItemIndex := -1;
Exit;
end
else
begin
ExibirRegistros;
ShowMessage('Disciplina possui cadastro.');
Exit;
end;
end;
end.
|
unit uROIndyHTTPWebsocketChannel;
interface
uses
Classes, SyncObjs,
uROIndyHTTPChannel, uROClientIntf,
IdHTTPWebsocketClient, IdHTTP, IdWinsock2;
type
TROIndyHTTPWebsocketChannel = class(TROIndyHTTPChannel,
IROActiveEventChannel)
private
function GetHost: string;
function GetPort: integer;
procedure SetHost(const Value: string);
procedure SetPort(const Value: integer);
function GetIndyClient: TIdHTTPWebsocketClient;
procedure SetWSResourceName(const Value: string);
function GetWSResourceName: string;
protected
FTriedUpgrade: Boolean;
FEventReceivers: TInterfaceList;
FMessageNr: Integer;
procedure IntDispatchEvent(aEvent: TStream);
procedure SocketConnected(Sender: TObject);
procedure ResetChannel;
function TryUpgradeToWebsocket: Boolean;
protected
procedure IntDispatch(aRequest, aResponse: TStream); override;
function CreateIndyClient: TIdHTTP; override;
protected
{IROActiveEventChannel}
procedure RegisterEventReceiver (aReceiver: IROEventReceiver);
procedure UnregisterEventReceiver(aReceiver: IROEventReceiver);
public
procedure AfterConstruction;override;
destructor Destroy; override;
published
property IndyClient: TIdHTTPWebsocketClient read GetIndyClient;
property Port: integer read GetPort write SetPort;
property Host: string read GetHost write SetHost;
property WSResourceName: string read GetWSResourceName write SetWSResourceName;
end;
TROIndyWSMultiChannelReadThread = class(TThread)
private
class var FInstance: TROIndyWSMultiChannelReadThread;
protected
FTempHandle: THandle;
FPendingBreak: Boolean;
Freadset, Fexceptionset: TFDSet;
Finterval: TTimeVal;
procedure InitSpecialEventSocket;
procedure ResetSpecialEventSocket;
procedure BreakSelectWait;
protected
FChannels: TThreadList;
procedure ReadFromAllChannels;
procedure Execute; override;
public
procedure AfterConstruction;override;
destructor Destroy; override;
procedure Terminate;
procedure AddChannel(aChannel: TROIndyHTTPWebsocketChannel);
procedure RemoveChannel(aChannel: TROIndyHTTPWebsocketChannel);
class function Instance: TROIndyWSMultiChannelReadThread;
end;
implementation
uses
SysUtils, Windows,
IdStack, IdStackConsts, IdGlobal, IdStackBSDBase,
uRORes, uROIndySupport, IdIOHandlerWebsocket;
{ TROIndyHTTPChannel_Websocket }
procedure TROIndyHTTPWebsocketChannel.AfterConstruction;
begin
inherited;
FEventReceivers := TInterfaceList.Create;
//not needed, is ignored at server now, but who knows later? :) e.g. support multiple sub protocols
WSResourceName := 'RemObjects';
end;
destructor TROIndyHTTPWebsocketChannel.Destroy;
begin
TROIndyWSMultiChannelReadThread.Instance.RemoveChannel(Self);
FEventReceivers.Free;
inherited;
end;
function TROIndyHTTPWebsocketChannel.GetIndyClient: TIdHTTPWebsocketClient;
begin
Result := inherited IndyClient as TIdHTTPWebsocketClient;
end;
procedure TROIndyHTTPWebsocketChannel.SetHost(const Value: string);
begin
IndyClient.Host := Value;
TargetURL := Format('ws://%s:%d/%s', [Host, Port, WSResourceName]);
end;
procedure TROIndyHTTPWebsocketChannel.SetPort(const Value: integer);
begin
IndyClient.Port := Value;
TargetURL := Format('ws://%s:%d/%s', [Host, Port, WSResourceName]);
end;
procedure TROIndyHTTPWebsocketChannel.SetWSResourceName(const Value: string);
begin
IndyClient.WSResourceName := Value;
TargetURL := Format('ws://%s:%d/%s', [Host, Port, WSResourceName]);
end;
function TROIndyHTTPWebsocketChannel.GetHost: string;
begin
Result := IndyClient.Host;
end;
function TROIndyHTTPWebsocketChannel.GetPort: integer;
begin
Result := IndyClient.Port;
end;
function TROIndyHTTPWebsocketChannel.GetWSResourceName: string;
begin
Result := IndyClient.WSResourceName;
end;
function TROIndyHTTPWebsocketChannel.CreateIndyClient: TIdHTTP;
var
wsclient: TIdHTTPWebsocketClient;
begin
//Result := inherited CreateIndyClient;
wsclient := TIdHTTPWebsocketClient.Create(Self);
wsclient.Request.UserAgent := uRORes.str_ProductName;
wsclient.Port := 80;
wsclient.Host := '127.0.0.1';
wsclient.OnConnected := SocketConnected;
TargetURL := '';
Result := wsclient;
end;
procedure TROIndyHTTPWebsocketChannel.SocketConnected(Sender: TObject);
begin
if DisableNagle then
uROIndySupport.Indy_DisableNagle(IndyClient);
end;
function TROIndyHTTPWebsocketChannel.TryUpgradeToWebsocket: Boolean;
begin
try
Result := (IndyClient as TIdHTTPWebsocketClient).TryUpgradeToWebsocket;
if Result then
begin
Self.IndyClient.IOHandler.InputBuffer.Clear;
//background wait for data in single thread
TROIndyWSMultiChannelReadThread.Instance.AddChannel(Self);
end;
except
ResetChannel;
raise;
end;
end;
procedure TROIndyHTTPWebsocketChannel.IntDispatch(aRequest, aResponse: TStream);
var
cWSNR: array[0..3] of AnsiChar;
iMsgNr, iMsgNr2: Integer;
ws: TIdIOHandlerWebsocket;
begin
//http server supports websockets?
if not FTriedUpgrade then
begin
TryUpgradeToWebsocket;
FTriedUpgrade := True; //one shot
end;
ws := IndyClient.IOHandler as TIdIOHandlerWebsocket;
if not ws.IsWebsocket then
//normal http dispatch
inherited IntDispatch(aRequest, aResponse)
else
//websocket dispatch
begin
ws.Lock;
try
//write messagenr at end
aRequest.Position := aRequest.Size;
Inc(FMessageNr);
iMsgNr := FMessageNr;
aRequest.Write(AnsiString('WSNR'), Length('WSNR'));
aRequest.Write(iMsgNr, SizeOf(iMsgNr));
aRequest.Position := 0;
//write
IndyClient.IOHandler.Write(aRequest);
iMsgNr2 := 0;
while iMsgNr2 <= 0 do
begin
//first is the data type TWSDataType(text or bin), but is ignore/not needed
IndyClient.IOHandler.ReadLongInt;
//next the size + data = stream
IndyClient.IOHandler.ReadStream(aResponse);
//get event or message nr
aResponse.Position := aResponse.Size - Length('WSNR') - SizeOf(iMsgNr2);
aResponse.Read(cWSNR[0], Length(cWSNR));
Assert(cWSNR = 'WSNR');
aResponse.Read(iMsgNr2, SizeOf(iMsgNr2));
aResponse.Size := aResponse.Size - Length('WSNR') - SizeOf(iMsgNr2); //trunc
aResponse.Position := 0;
//event?
if iMsgNr2 < 0 then
begin
ws.Unlock;
try
IntDispatchEvent(aResponse);
aResponse.Size := 0;
finally
ws.Lock;
end;
end;
end;
except
ws.Unlock; //always unlock
ResetChannel;
Raise;
end;
ws.Unlock; //normal unlock (no extra try finally needed)
if iMsgNr2 <> iMsgNr then
Assert(iMsgNr2 = iMsgNr, 'Message number mismatch between send and received!');
end;
end;
procedure TROIndyHTTPWebsocketChannel.IntDispatchEvent(aEvent: TStream);
var
i: Integer;
eventrecv: IROEventReceiver;
begin
for i := 0 to FEventReceivers.Count - 1 do
begin
aEvent.Position := 0;
eventrecv := FEventReceivers.Items[i] as IROEventReceiver;
try
eventrecv.Dispatch(aEvent, TThread.CurrentThread);
except
//ignore errors within events, so normal communication is preserved
end;
end;
end;
procedure TROIndyHTTPWebsocketChannel.RegisterEventReceiver(
aReceiver: IROEventReceiver);
begin
FEventReceivers.Add(aReceiver);
end;
procedure TROIndyHTTPWebsocketChannel.ResetChannel;
var
ws: TIdIOHandlerWebsocket;
begin
FTriedUpgrade := False; //reset
TROIndyWSMultiChannelReadThread.Instance.RemoveChannel(Self);
IndyClient.IOHandler.InputBuffer.Clear;
//close/disconnect internal socket
ws := IndyClient.IOHandler as TIdIOHandlerWebsocket;
ws.Close;
IndyClient.Disconnect(False);
end;
procedure TROIndyHTTPWebsocketChannel.UnregisterEventReceiver(
aReceiver: IROEventReceiver);
begin
FEventReceivers.Remove(aReceiver);
end;
{ TMultiChannelReadThread }
procedure TROIndyWSMultiChannelReadThread.AfterConstruction;
begin
inherited;
FChannels := TThreadList.Create;
FillChar(Freadset, SizeOf(Freadset), 0);
FillChar(Fexceptionset, SizeOf(Fexceptionset), 0);
InitSpecialEventSocket;
end;
destructor TROIndyWSMultiChannelReadThread.Destroy;
begin
IdWinsock2.closesocket(FTempHandle);
FChannels.Free;
inherited;
end;
procedure TROIndyWSMultiChannelReadThread.Execute;
begin
Self.NameThreadForDebugging(AnsiString(Self.ClassName));
while not Terminated do
begin
try
while not Terminated do
ReadFromAllChannels;
except
//continue
end;
end;
end;
procedure TROIndyWSMultiChannelReadThread.ReadFromAllChannels;
var
l: TList;
chn: TROIndyHTTPWebsocketChannel;
iCount,
i, iEventNr: Integer;
cWSNR: array[0..3] of AnsiChar;
iResult: NativeInt;
strmEvent: TMemoryStream;
ws: TIdIOHandlerWebsocket;
wscode: TWSDataCode;
begin
l := FChannels.LockList;
try
iCount := 0;
Freadset.fd_count := iCount;
for i := 0 to l.Count - 1 do
begin
chn := TROIndyHTTPWebsocketChannel(l.Items[i]);
//valid?
if //not chn.Busy and also take busy channels (will be ignored later), otherwise we have to break/reset for each RO function execution
(chn.IndyClient.Socket.Binding.Handle > 0) and
(chn.IndyClient.Socket.Binding.Handle <> INVALID_SOCKET) then
begin
Freadset.fd_count := iCount+1;
Freadset.fd_array[iCount] := chn.IndyClient.Socket.Binding.Handle;
Inc(iCount);
end;
end;
if FPendingBreak then
ResetSpecialEventSocket;
finally
FChannels.UnlockList;
end;
//special helper socket to be able to stop "select" from waiting
Fexceptionset.fd_count := 1;
Fexceptionset.fd_array[0] := FTempHandle;
//wait 15s till some data
Finterval.tv_sec := 15; //15s
Finterval.tv_usec := 0;
//nothing to wait for? then sleep some time to prevent 100% CPU
if iCount = 0 then
begin
iResult := IdWinsock2.select(0, nil, nil, @Fexceptionset, @Finterval);
if iResult = SOCKET_ERROR then
iResult := 1; //ignore errors
end
//wait till a socket has some data (or a signal via exceptionset is fired)
else
iResult := IdWinsock2.select(0, @Freadset, nil, @Fexceptionset, @Finterval);
if iResult = SOCKET_ERROR then
//raise EIdWinsockStubError.Build(WSAGetLastError, '', []);
//ignore error during wait: socket disconnected etc
Exit;
//some data?
if (iResult > 0) then
begin
strmEvent := nil;
l := FChannels.LockList;
try
//check for data for all channels
for i := 0 to l.Count - 1 do
begin
chn := TROIndyHTTPWebsocketChannel(l.Items[i]);
try
//try to process all events
while not chn.Busy and //no client call pending
chn.IndyClient.IOHandler.Readable(0) do //has some data
begin
ws := chn.IndyClient.IOHandler as TIdIOHandlerWebsocket;
//no pending dispatch active? (so actually we only read events here?)
if ws.TryLock then
begin
try
if strmEvent = nil then
strmEvent := TMemoryStream.Create;
strmEvent.Clear;
//first is the data type TWSDataType(text or bin), but is ignore/not needed
wscode := TWSDataCode(chn.IndyClient.IOHandler.ReadLongWord);
//next the size + data = stream
chn.IndyClient.IOHandler.ReadStream(strmEvent);
//ignore ping/pong messages
if wscode in [wdcPing, wdcPong] then Continue;
if strmEvent.Size < Length('WSNR') + SizeOf(iEventNr) then Continue;
//get event nr
strmEvent.Position := strmEvent.Size - Length('WSNR') - SizeOf(iEventNr);
strmEvent.Read(cWSNR[0], Length(cWSNR));
Assert(cWSNR = 'WSNR');
strmEvent.Read(iEventNr, SizeOf(iEventNr));
Assert(iEventNr < 0);
//trunc
strmEvent.Size := strmEvent.Size - Length('WSNR') - SizeOf(iEventNr);
finally
ws.Unlock;
end;
//fire event
chn.IntDispatchEvent(strmEvent);
end;
end;
except
chn.ResetChannel;
raise;
end;
end;
if FPendingBreak then
ResetSpecialEventSocket;
finally
FChannels.UnlockList;
strmEvent.Free;
end;
end;
end;
procedure TROIndyWSMultiChannelReadThread.RemoveChannel(
aChannel: TROIndyHTTPWebsocketChannel);
begin
FChannels.Remove(aChannel);
end;
procedure TROIndyWSMultiChannelReadThread.AddChannel(
aChannel: TROIndyHTTPWebsocketChannel);
var l: TList;
begin
Assert( (aChannel.IndyClient.IOHandler as TIdIOHandlerWebsocket).IsWebsocket, 'Channel is not a websocket');
l := FChannels.LockList;
try
Assert(l.Count < 64, 'Max 64 connections can be handled by one read thread!'); //due to restrictions of the "select" API
l.Add(aChannel);
//trigger the "select" wait
BreakSelectWait;
finally
FChannels.UnlockList;
end;
end;
class function TROIndyWSMultiChannelReadThread.Instance: TROIndyWSMultiChannelReadThread;
begin
if FInstance = nil then
begin
FInstance := TROIndyWSMultiChannelReadThread.Create(True);
FInstance.Start;
end;
Result := FInstance;
end;
procedure TROIndyWSMultiChannelReadThread.InitSpecialEventSocket;
var
param: Cardinal;
iResult: Integer;
begin
//alloc socket
FTempHandle := GStack.NewSocketHandle(Id_SOCK_STREAM, Id_IPPROTO_IP, Id_IPv4, False);
Assert(FTempHandle <> Id_INVALID_SOCKET);
//non block mode
param := 1; // enable NON blocking mode
iResult := ioctlsocket(FTempHandle, FIONBIO, param);
GStack.CheckForSocketError(iResult);
end;
procedure TROIndyWSMultiChannelReadThread.BreakSelectWait;
var
iResult: Integer;
LAddr: TSockAddrIn6;
begin
FillChar(LAddr, SizeOf(LAddr), 0);
//Id_IPv4
with PSOCKADDR(@LAddr)^ do
begin
sin_family := Id_PF_INET4;
//dummy address and port
(GStack as TIdStackBSDBase).TranslateStringToTInAddr('0.0.0.0', sin_addr, Id_IPv4);
sin_port := htons(1);
end;
FPendingBreak := True;
//connect to non-existing address to stop "select" from waiting
//Note: this is some kind of "hack" because there is no nice way to stop it
//The only(?) other possibility is to make a "socket pair" and send a byte to it,
//but this requires a dynamic server socket (which can trigger a firewall
//exception/question popup in WindowsXP+)
iResult := IdWinsock2.connect(FTempHandle, PSOCKADDR(@LAddr), SIZE_TSOCKADDRIN);
//non blocking socket, so will always result in "would block"!
if (iResult <> Id_SOCKET_ERROR) or
(GStack.WSGetLastError <> WSAEWOULDBLOCK)
then
GStack.CheckForSocketError(iResult);
end;
procedure TROIndyWSMultiChannelReadThread.ResetSpecialEventSocket;
begin
Assert(FPendingBreak);
FPendingBreak := False;
IdWinsock2.closesocket(FTempHandle);
InitSpecialEventSocket;
end;
procedure TROIndyWSMultiChannelReadThread.Terminate;
begin
inherited Terminate;
FChannels.LockList;
try
//fire a signal, so the "select" wait will quit and thread can stop
BreakSelectWait;
finally
FChannels.UnlockList;
end;
end;
end.
|
{ Leap Websocket interface Usign BauglirWebsocket
Copyright (C) 2013 Michael Van Canneyt (michael@freepascal.org);
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version with the following modification:
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent modules,and
to copy and distribute the resulting executable under terms of your choice,
provided that you also meet, for each linked independent module, the terms
and conditions of the license of that module. An independent module is a
module which is not derived from or based on this library. If you modify
this library, you may extend this exception to your version of the library,
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.
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. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit wsleap;
interface
uses
Classes, SysUtils, leapdata,
dleapjson, websocket2;
Type
{ TWebSocketLeapController }
TFrameErrorEvent = Procedure (Sender : TObject; Error : Exception) of object;
TWebSocketLeapController = Class(TLeapController)
procedure DoOnOpen(aSender: TWebSocketCustomConnection);
private
FEnabled: Boolean;
FHostName: String;
FOnFrameError: TFrameErrorEvent;
FPort: Integer;
FPackets : Integer;
FwebSocket: TWebSocketClientConnection;
FConverter : TJSONFrameConverter;
procedure ReadFrame(Data: TStream);
procedure SetEnabled(AValue: Boolean);
procedure SethostName(AValue: String);
procedure SetPort(AValue: Integer);
protected
Procedure DoFrameError(E : Exception); virtual;
procedure ReadVersion(Data: TStream);virtual;
procedure OnReadPacket(aSender: TWebSocketCustomConnection; aFinal, aRes1, aRes2, aRes3: boolean; aCode: integer; aData: TMemoryStream);virtual;
Procedure CheckInactive(Const AOperation : String = '');
Procedure ConnectWebSocket;
Procedure DisconnectWebSocket;
Property WebSocket : TWebSocketClientConnection Read FwebSocket;
Public
Constructor Create(AOwner : TComponent);override;
Destructor Destroy; override;
Property Packets : Integer Read FPackets;
Published
Property HostName : String Read FHostName Write SethostName;
Property Port : Integer Read FPort Write SetPort;
Property Enabled : Boolean Read FEnabled Write SetEnabled;
Property OnFrameError : TFrameErrorEvent Read FOnFrameError Write FOnFrameError;
end;
implementation
{ TWebSocketLeapController }
procedure TWebSocketLeapController.ReadVersion(Data : TStream);
begin
SetVersion(ExtractVersion(Data));
end;
procedure TWebSocketLeapController.DoOnOpen(aSender: TWebSocketCustomConnection);
begin
aSender.SendText(WriteEnableGestures(EnableGestures));
end;
procedure TWebSocketLeapController.ReadFrame(Data : TStream);
Var
F : TFrame;
begin
If (FConverter=Nil) then
FConverter:=TJSONFrameConverter.Create(Self);
Data.Position:=0;
F:=Nil;
try
F:=FConverter.FrameFromStream(Data);
except
On E : Exception do
DoFrameError(E);
end;
AddFrame(F);
end;
procedure TWebSocketLeapController.OnReadPacket(
aSender: TWebSocketCustomConnection; aFinal, aRes1, aRes2, aRes3: boolean;
aCode: integer; aData: TMemoryStream);
begin
Inc(FPackets);
If (Fpackets=1) then
ReadVersion(AData)
else
ReadFrame(AData);
end;
procedure TWebSocketLeapController.SetEnabled(AValue: Boolean);
begin
if FEnabled=AValue then Exit;
If AValue then
ConnectWebSocket
else
DisConnectWebSocket;
FEnabled:=AValue;
end;
procedure TWebSocketLeapController.SethostName(AValue: String);
begin
if FHostName=AValue then Exit;
CheckInActive('Set hostname');
FHostName:=AValue;
end;
procedure TWebSocketLeapController.SetPort(AValue: Integer);
begin
if FPort=AValue then Exit;
CheckInActive('Set port');
FPort:=AValue;
end;
procedure TWebSocketLeapController.DoFrameError(E: Exception);
begin
if Assigned(FOnFrameError) then
FOnFrameError(Self,E);
end;
procedure TWebSocketLeapController.CheckInactive(const AOperation: String);
Var
M : String;
begin
If Enabled then
begin
If (AOperation='') then
M:='Cannot perform this operation while active.'
else
M:=Format('Cannot perform operation "%s" while active.',[AOperation]);
Raise ELeap.Create(M);
end;
end;
procedure TWebSocketLeapController.ConnectWebSocket;
begin
if (FWebSocket=Nil) then
begin
FWebSocket:=TWebSocketClientConnection.Create(HostName,IntToStr(Port),'/');
FWebSocket.OnRead:=@OnReadPacket;
FWebSocket.OnOpen:=@DoOnOpen;
FWebSocket.Start;
end;
FPackets:=0;
end;
procedure TWebSocketLeapController.DisconnectWebSocket;
begin
FWebSocket.FreeOnTerminate:=True;
FWebSocket.Close(wsCloseNormal,'');
end;
constructor TWebSocketLeapController.Create(AOwner: TComponent);
begin
Inherited;
FHostName:='127.0.0.1';
FPort:= 6437;
end;
destructor TWebSocketLeapController.Destroy;
begin
FreeAndNil(FConverter);
inherited Destroy;
end;
end.
|
unit WebCam;
interface
uses
Windows, Messages;
type
TWebcam = class
constructor Create(
const WindowName: String = '';
ParentWnd: Hwnd = 0;
Left: Integer = 0;
Top: Integer = 0;
Width: Integer = 0;
height: Integer = 0;
Style: Cardinal = WS_CHILD or WS_VISIBLE;
WebcamID: Integer = 0);
public
const
WM_Connect = WM_USER + 10;
WM_Disconnect = WM_USER + 11;
WM_GrabFrame = WM_USER + 60;
WM_SaveDIB = WM_USER + 25;
WM_Preview = WM_USER + 50;
WM_PreviewRate = WM_USER + 52;
WM_Configure = WM_USER + 41;
public
procedure Connect;
procedure Disconnect;
procedure GrabFrame;
procedure SaveDIB(const FileName: String = 'webcam.bmp');
procedure Preview(&on: Boolean = True);
procedure PreviewRate(Rate: Integer = 42);
procedure Configure;
private
CaptureWnd: HWnd;
end;
implementation
function capCreateCaptureWindowA(
WindowName: PChar;
dwStyle: Cardinal;
x,y,width,height: Integer;
ParentWin: HWnd;
WebcamID: Integer): Hwnd; stdcall external 'AVICAP32.dll';
{ TWebcam }
procedure TWebcam.Configure;
begin
if CaptureWnd <> 0 then
SendMessage(CaptureWnd, WM_Configure, 0, 0);
end;
procedure TWebcam.Connect;
begin
if CaptureWnd <> 0 then
SendMessage(CaptureWnd, WM_Connect, 0, 0);
end;
constructor TWebcam.Create(const WindowName: String; ParentWnd: Hwnd; Left, Top,
Width, height: Integer; Style: Cardinal; WebcamID: Integer);
begin
CaptureWnd := capCreateCaptureWindowA(PChar(WindowName), Style, Left, Top, Width, Height,
ParentWnd, WebcamID);
end;
procedure TWebcam.Disconnect;
begin
if CaptureWnd <> 0 then
SendMessage(CaptureWnd, WM_Disconnect, 0, 0);
end;
procedure TWebcam.GrabFrame;
begin
if CaptureWnd <> 0 then
SendMessage(CaptureWnd, WM_GrabFrame, 0, 0);
end;
procedure TWebcam.Preview(&on: Boolean);
begin
if CaptureWnd <> 0 then
if &on then
SendMessage(CaptureWnd, WM_Preview, 1, 0)
else
SendMessage(CaptureWnd, WM_Preview, 0, 0);
end;
procedure TWebcam.PreviewRate(Rate: Integer);
begin
if CaptureWnd <> 0 then
SendMessage(CaptureWnd, WM_PreviewRate, Rate, 0);
end;
procedure TWebcam.SaveDIB(const FileName: String);
begin
if CaptureWnd <> 0 then
SendMessage(CaptureWnd, WM_SaveDIB, 0, Cardinal(PChar(FileName)));
end;
end.
|
program ejercicio4;
const
Df = 9300;
precioMIN = 3.40;
precioBM = 1.34
type
cliente = record
codigo : Integer;
canLineas: Integer;
end;
linea = record
nTelefono : Integer;
canMinutos: Real;
cantMB : Real;
end;
procedure leerCliente(var c: cliente);
begin
write('Ingrese el CODIGO del cliente: ');
readln(c.codigo);
write('Ingrese cantidad de lineas a su nombre: ');
readln(c.canLineas);
end;
procedure leerLinea(var l:linea);
begin
write('Ingrese el NUMERO DE TELEFONO: ');
readln(l.nTelefono);
write('Ingrese la cantidad de MINUTOS: ')
readln(l.canMinutos);
write('Ingrese la cantidad de MB: ');
readln(l.cantMB);
end;
procedure calcularTotales(c:cliente; var totalMin, totalBM: Real);
var
l: linea;
begin
for i := 1 to c.canLineas do
begin
leerLinea(l);
totalMin:= totalMin + l.canMinutos;
totalBM:= totalBM + l.cantMB;
end;
end;
var
c: cliente;
l:linea;
total,totalMin,totalBM: Real;
begin
totalMin:=0;
totalBM:=0;
for i := 1 to Df do
begin
leerCliente(c);
calcularTotales(c,totalMin, totalBM);
total:= (totalMin * precioMIN) + (totalBM * precioBM);
writeln('El monto toal a facturar para el cliente ', c.codigo, ' es ', total)
end
end.
|
unit fScrollEditor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, GR32_Image, GR32, StdCtrls, ExtCtrls, ComCtrls, ToolWin, ImgList,
Buttons, cMegaROM, cConfiguration;
type
TfrmScrollEditor = class(TForm)
cmdOK: TButton;
cmdCancel: TButton;
imgScroll: TImage32;
lstScrollProperties: TListBox;
ImageList1: TImageList;
cmdSetScrollStart: TSpeedButton;
cmdSetCheckPoint1: TSpeedButton;
cmdSetCheckPoint2: TSpeedButton;
cmdScrollKey: TButton;
chkSimpleMode: TCheckBox;
procedure FormShow(Sender: TObject);
procedure lstScrollPropertiesDblClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
procedure lstScrollPropertiesDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
procedure cmdSetStartScrollDataClick(Sender: TObject);
procedure cmdSetCheckPoint1Click(Sender: TObject);
procedure cmdSetCheckPoint2Click(Sender: TObject);
procedure cmdOKClick(Sender: TObject);
procedure cmdScrollKeyClick(Sender: TObject);
procedure lstScrollPropertiesClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure chkSimpleModeClick(Sender: TObject);
private
_ROMData : TMegamanROM;
_EditorConfig : TRRConfig;
_ScrollStart, _ScrollChk1Respawn,_ScrollChk2Respawn, ItemIndex : Byte;
Chk1Respawn,Chk2Respawn : TBitmap;
procedure DrawScroll();
function WorkOutEndOfScrollData() : Integer;
function CreateScrollText(pID : Byte): String;
procedure LoadScrollData();
{ Private declarations }
public
property ScrollStart : Byte read _ScrollStart write _ScrollStart;
property ScrollChk1Respawn : Byte read _ScrollChk1Respawn write _ScrollChk1Respawn;
property ScrollChk2Respawn : Byte read _ScrollChk2Respawn write _ScrollChk2Respawn;
property ROMData : TMegamanROM read _ROMData write _ROMData;
property EditorConfig : TRRConfig read _EditorConfig write _EditorConfig;
{ Public declarations }
end;
var
frmScrollEditor: TfrmScrollEditor;
implementation
uses uglobal, fScrKey,fHexadecimalEntry, fSimpleScrollEdit;
{$R *.dfm}
procedure TfrmScrollEditor.DrawScroll();
var
DrawBitmap : TBitmap32;
begin
DrawBitmap := TBitmap32.Create;
try
DrawBitmap.Height := 400;
DrawBitmap.Width := 400;
_ROMData.DrawScrollData(DrawBitmap, _ScrollStart, _ScrollChk1Respawn, _ScrollChk2Respawn);
imgScroll.Bitmap := DrawBitmap;
finally
FreeAndNil(DrawBitmap);
end;
end;
procedure TfrmScrollEditor.LoadScrollData();
var
i : Integer;
begin
// lstScrollProperties.Items.BeginUpdate;
lstScrollProperties.Items.Clear;
if chkSimpleMode.checked = True then
begin
for i := 0 to _ROMData.CurrLevel.ScrollData.Count -1 do
begin
lstScrollProperties.Items.Add(CreateScrollText(_ROMData.CurrLevel.ScrollData[i]));
end;
end
else
begin
for i := 0 to _ROMData.CurrLevel.ScrollData.Count - 1 do
begin
lstScrollProperties.Items.Add(IntToHex(_ROMData.CurrLevel.ScrollData[i],2));
end;
end;
lstScrollProperties.ItemIndex := _ScrollStart;
// lstScrollProperties.Items.EndUpdate;
lstScrollproperties.Refresh;
end;
function TfrmScrollEditor.CreateScrollText(pID : Byte): String;
var
res : String;
begin
if pID = $FF then
begin
result := 'Nothing';
exit;
end
else if pID = $00 then
begin
result := 'Boss/End';
exit;
end;
// up
if pID and $80 = $80 then
begin
res := 'Up After ';
end
// down
else if pID and $40 = $40 then
begin
res := 'Down After ';
end
// stop.
else if pID and $20 = $20 then
begin
res := 'Right - Stop ';
end
else
begin
res := 'Right ';
end;
res := res + IntToStr(pID and $1F + 1);
result := res;
end;
procedure TfrmScrollEditor.FormShow(Sender: TObject);
begin
Chk1Respawn := TBitmap.Create;
Chk1Respawn.LoadFromFile(ExtractFileDir(Application.ExeName) + '\Data\chk1.bmp');
Chk1Respawn.TransparentMode := tmFixed;
Chk1Respawn.TransparentColor := Chk1Respawn.Canvas.Pixels[0,0];
Chk1Respawn.Transparent := True;
Chk2Respawn := TBitmap.Create;
Chk2Respawn.LoadFromFile(ExtractFileDir(Application.ExeName) + '\Data\chk2.bmp');
Chk2Respawn.TransparentMode := tmFixed;
Chk2Respawn.TransparentColor := Chk2Respawn.Canvas.Pixels[0,0];
Chk2Respawn.Transparent := True;
_ScrollStart := _ROMData.CurrLevel.ScrollStart;
_ScrollChk1Respawn := _ROMData.CurrLevel.Properties['ScrollPosChk1'].Value;
_ScrollChk2Respawn := _ROMData.CurrLevel.Properties['ScrollPosChk2'].Value;
DrawScroll();
LoadScrollData();
end;
procedure TfrmScrollEditor.lstScrollPropertiesDblClick(Sender: TObject);
var
// NewVal : String;
Hex : TfrmHex;
ScrEd : TfrmSimpleScrollEd;
begin
if chkSimpleMode.Checked = false then
begin
Hex := TfrmHex.Create(self);
try
Hex.Caption := 'Scroll Byte Entry';
Hex.Description := 'Please enter a scroll byte:';
Hex.InitValue := lstScrollProperties.Items[lstScrollProperties.ItemIndex];
if Hex.ShowModal = mrOk then
begin
_ROMData.CurrLevel.ScrollData[lstScrollProperties.ItemIndex] := Hex.ReturnValue;
LoadScrollData();
DrawScroll();
end;
finally
FreeAndNil(Hex);
end;
end
else
begin
ScrEd := TfrmSimpleScrollEd.Create(self);
try
ScrEd.ScrollByte := _ROMData.CurrLevel.ScrollData[lstScrollProperties.ItemIndex];
if ScrEd.ShowModal = mrOk then
begin
_ROMData.CurrLevel.ScrollData[lstScrollProperties.ItemIndex] := ScrEd.ScrollByte;
LoadScrollData();
DrawScroll();
end;
finally
FreeAndNil(ScrEd);
end;
end;
end;
procedure TfrmScrollEditor.cmdCancelClick(Sender: TObject);
begin
_ROMData.LoadScrollData;
end;
procedure TfrmScrollEditor.lstScrollPropertiesDrawItem(
Control: TWinControl; Index: Integer; Rect: TRect;
State: TOwnerDrawState);
begin
lstScrollProperties.Canvas.Brush.Color := clWhite;
lstScrollProperties.Canvas.FillRect(Rect);
if (Index >= _ScrollStart) and (Index <= WorkOutEndOfScrollData()) then
begin
lstScrollProperties.Canvas.Brush.Color := clSkyBlue;
lstScrollProperties.Canvas.FillRect(Rect);
lstScrollProperties.Canvas.Font.Color := clBlack;
lstScrollProperties.Canvas.TextOut(Rect.Left + 1,Rect.Top + 1,lstScrollProperties.Items[index]);
end
else
begin
lstScrollProperties.Canvas.Brush.Color := clWhite;
lstScrollProperties.Canvas.FillRect(Rect);
lstScrollProperties.Canvas.Font.Color := clBlack;
lstScrollProperties.Canvas.TextOut(Rect.Left + 1,Rect.Top + 1,lstScrollProperties.Items[index]);
end;
if Index = _ScrollChk1Respawn then
begin
lstScrollProperties.Canvas.Draw(80,Rect.Top,Chk1Respawn);
end;
if Index = _ScrollChk2Respawn then
begin
lstScrollProperties.Canvas.Draw(96,Rect.Top,Chk2Respawn);
end;
if odSelected in State then
begin
lstScrollProperties.Canvas.FrameRect(Rect);
lstScrollProperties.Font.Color := clBlack;
end;
end;
function TfrmScrollEditor.WorkOutEndOfScrollData() : Integer;
var
pos : Integer;
begin
pos := _ScrollStart;
while (_ROMData.CurrLevel.ScrollData[pos] <> $00) and (pos < _ROMData.CurrLevel.ScrollData.Count) do
begin
inc(pos);
end;
result := pos;
end;
procedure TfrmScrollEditor.cmdSetStartScrollDataClick(Sender: TObject);
begin
if lstScrollProperties.ItemIndex > -1 then
begin
_ScrollStart := lstScrollProperties.ItemIndex;
DrawScroll;
lstScrollProperties.Refresh;
end;
end;
procedure TfrmScrollEditor.cmdSetCheckPoint1Click(Sender: TObject);
begin
if lstScrollProperties.ItemIndex > -1 then
begin
_ScrollChk1Respawn := lstScrollProperties.ItemIndex;
DrawScroll();
lstScrollProperties.Refresh;
end;
end;
procedure TfrmScrollEditor.cmdSetCheckPoint2Click(Sender: TObject);
begin
if lstScrollProperties.ItemIndex > -1 then
begin
_ScrollChk2Respawn := lstScrollProperties.ItemIndex;
DrawScroll();
lstScrollProperties.Refresh;
end;
end;
procedure TfrmScrollEditor.cmdOKClick(Sender: TObject);
begin
// Run a check that the check point 1+2 are inside the range of the
// scroll for this level.
if (_ScrollChk1Respawn < _ScrollStart) or (_ScrollChk2Respawn < _ScrollStart) then
begin
showmessage('One of the scroll checkpoints are not located within the scroll data.');
modalresult := mrNone;
exit;
end;
// Check that scroll checkpoint 1 isn't greater than scroll checkpoint 2.
if (_ScrollChk1Respawn > _ScrollChk2Respawn) then
begin
showmessage('Scroll checkpoint 1 is greater than scroll checkpoint 2. This could cause anomalous effects.');
modalresult := mrNone;
exit;
end;
// Check that scroll checkpoint 1+2 are not outside of the range
// of the scroll data.
if (_ScrollChk1Respawn > WorkOutEndOfScrollData) or (_ScrollChk2Respawn > WorkOutEndOfScrollData) then
begin
showmessage('Scroll checkpoint 1 or 2 is outside of the scroll data. Please fix this.');
modalresult := mrNone;
exit;
end;
end;
procedure TfrmScrollEditor.cmdScrollKeyClick(Sender: TObject);
var
ScrKey : TfrmScrollKey;
begin
ScrKey := TfrmScrollKey.Create(self);
try
ScrKey.ShowModal;
finally
FreeAndNil(ScrKey);
end;
end;
procedure TfrmScrollEditor.lstScrollPropertiesClick(Sender: TObject);
begin
ItemIndex := lstScrollProperties.ItemIndex;
end;
procedure TfrmScrollEditor.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
FreeAndNil(Chk1Respawn);
FreeAndNil(Chk2Respawn);
end;
procedure TfrmScrollEditor.chkSimpleModeClick(Sender: TObject);
begin
LoadScrollData();
end;
end.
|
unit pacland_hw;
interface
uses {$IFDEF WINDOWS}windows,{$ENDIF}
m6809,m680x,namco_snd,main_engine,controls_engine,gfx_engine,rom_engine,
pal_engine,sound_engine;
function iniciar_pacland:boolean;
implementation
const
pacland_rom:array[0..5] of tipo_roms=(
(n:'pl5_01b.8b';l:$4000;p:$0;crc:$b0ea7631),(n:'pl5_02.8d';l:$4000;p:$4000;crc:$d903e84e),
(n:'pl1_3.8e';l:$4000;p:$8000;crc:$aa9fa739),(n:'pl1_4.8f';l:$4000;p:$c000;crc:$2b895a90),
(n:'pl1_5.8h';l:$4000;p:$10000;crc:$7af66200),(n:'pl3_6.8j';l:$4000;p:$14000;crc:$2ffe3319));
pacland_char:tipo_roms=(n:'pl2_12.6n';l:$2000;p:0;crc:$a63c8726);
pacland_tiles:tipo_roms=(n:'pl4_13.6t';l:$2000;p:0;crc:$3ae582fd);
pacland_sprites:array[0..3] of tipo_roms=(
(n:'pl1-9.6f';l:$4000;p:0;crc:$f5d5962b),(n:'pl1-8.6e';l:$4000;p:$4000;crc:$a2ebfa4a),
(n:'pl1-10.7e';l:$4000;p:$8000;crc:$c7cf1904),(n:'pl1-11.7f';l:$4000;p:$c000;crc:$6621361a));
pacland_mcu:array[0..1] of tipo_roms=(
(n:'pl1_7.3e';l:$2000;p:$8000;crc:$8c5becae),(n:'cus60-60a1.mcu';l:$1000;p:$f000;crc:$076ea82a));
pacland_prom:array[0..4] of tipo_roms=(
(n:'pl1-2.1t';l:$400;p:$0;crc:$472885de),(n:'pl1-1.1r';l:$400;p:$400;crc:$a78ebdaf),
(n:'pl1-5.5t';l:$400;p:$800;crc:$4b7ee712),(n:'pl1-4.4n';l:$400;p:$c00;crc:$3a7be418),
(n:'pl1-3.6l';l:$400;p:$1000;crc:$80558da8));
pacland_dip_a:array [0..4] of def_dip=(
(mask:$3;name:'Coin B';number:4;dip:((dip_val:$0;dip_name:'3C 1C'),(dip_val:$1;dip_name:'2C 1C'),(dip_val:$3;dip_name:'1C 1C'),(dip_val:$2;dip_name:'1C 2C'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$4;name:'Demo Sounds';number:2;dip:((dip_val:$0;dip_name:'Off'),(dip_val:$4;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$18;name:'Coin A';number:4;dip:((dip_val:$0;dip_name:'3C 1C'),(dip_val:$8;dip_name:'2C 1C'),(dip_val:$18;dip_name:'1C 1C'),(dip_val:$10;dip_name:'1C 2C'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$60;name:'Lives';number:4;dip:((dip_val:$40;dip_name:'2'),(dip_val:$60;dip_name:'3'),(dip_val:$20;dip_name:'4'),(dip_val:$0;dip_name:'5'),(),(),(),(),(),(),(),(),(),(),(),())),());
pacland_dip_b:array [0..5] of def_dip=(
(mask:$1;name:'Trip Select';number:2;dip:((dip_val:$0;dip_name:'Off'),(dip_val:$1;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$2;name:'Freeze';number:2;dip:((dip_val:$2;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$4;name:'Round Select';number:2;dip:((dip_val:$4;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$18;name:'Difficulty';number:4;dip:((dip_val:$10;dip_name:'B (Easy)'),(dip_val:$18;dip_name:'A (Average)'),(dip_val:$8;dip_name:'C (Hard)'),(dip_val:$0;dip_name:'D (Very Hard)'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$e0;name:'Bonus Life';number:8;dip:((dip_val:$e0;dip_name:'30K 80K 150K 300K 500K 1M'),(dip_val:$80;dip_name:'30K 80K 100K+'),(dip_val:$40;dip_name:'30K 80K 150K'),(dip_val:$c0;dip_name:'30K 100K 200K 400K 600K 1M'),(dip_val:$a0;dip_name:'40K 100K 180K 300K 500K 1M'),(dip_val:$20;dip_name:'40K 100K 200K'),(dip_val:$0;dip_name:'40K'),(dip_val:$60;dip_name:'50K 150K 200K+'),(),(),(),(),(),(),(),())),());
pacland_dip_c:array [0..1] of def_dip=(
(mask:$80;name:'Cabinet';number:2;dip:((dip_val:$80;dip_name:'Upright'),(dip_val:$0;dip_name:'Cocktail'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),());
var
rom_bank:array[0..7,0..$1fff] of byte;
pal_proms:array[0..$7ff] of byte;
rom_nbank,palette_bank:byte;
scroll_x1,scroll_x2:word;
irq_enable,irq_enable_mcu:boolean;
procedure update_video_pacland;
procedure put_sprite_pacland(nchar,color:word;flipx,flipy:boolean;pri:byte);
var
x,y,punto:byte;
temp:pword;
pos,post:pbyte;
begin
pos:=gfx[2].datos;
inc(pos,nchar*16*16);
if flipx then begin
for y:=0 to 15 do begin
post:=pos;
inc(post,(y*16)+15);
temp:=punbuf;
for x:=15 downto 0 do begin
punto:=gfx[2].colores[post^+color];
case pri of
0:if punto<$80 then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
1:if (punto and $7f)<>$7f then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
2:if ((punto>$ef) and (punto<>$ff)) then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
end;
inc(temp);
dec(post);
end;
if flipy then putpixel(0,(15-y),16,punbuf,PANT_SPRITES)
else putpixel(0,y,16,punbuf,PANT_SPRITES);
end;
end else begin
for y:=0 to 15 do begin
temp:=punbuf;
for x:=0 to 15 do begin
punto:=gfx[2].colores[pos^+color];
case pri of
0:if punto<$80 then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
1:if (punto and $7f)<>$7f then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
2:if ((punto>$ef) and (punto<>$ff)) then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
end;
inc(temp);
inc(pos);
end;
if flipy then putpixel(0,(15-y),16,punbuf,PANT_SPRITES)
else putpixel(0,y,16,punbuf,PANT_SPRITES);
end;
end;
end;
procedure draw_sprites(pri:byte);
const
gfx_offs:array[0..1,0..1] of byte=((0,1),(2,3));
var
f:byte;
nchar,color,sx,sy,tile:word;
flipx,flipy,atrib:byte;
sizex,sizey,x,y:word;
begin
for f:=0 to $3f do begin
atrib:=memoria[$3780+(f*2)];
nchar:=memoria[$2780+(f*2)]+((atrib and $80) shl 1);
color:=(memoria[$2781+(f*2)] and $3f) shl 4;
sx:=memoria[$2f81+(f*2)]+((memoria[$3781+(f*2)] and 1) shl 8)-47;
sy:=256-memoria[$2f80+(f*2)]+9;
flipx:=atrib and $01;
flipy:=(atrib shr 1) and $01;
sizex:=(atrib shr 2) and $01;
sizey:=(atrib shr 3) and $01;
nchar:=nchar and not(sizex) and (not(sizey shl 1));
sy:=((sy-16*sizey) and $ff)-32;
for y:=0 to sizey do begin
for x:=0 to sizex do begin
tile:=nchar+gfx_offs[y xor (sizey*flipy),x xor (sizex*flipx)];
put_sprite_pacland(tile,color,flipx<>0,flipy<>0,pri);
actualiza_gfx_sprite(sx+16*x,sy+16*y,3,2);
end;
end;
end;
end;
procedure put_gfx_pacland(pos_x,pos_y,nchar:dword;color:word;screen,ngfx:byte;flipx,flipy:boolean);
var
x,y,py,cant_x,cant_y,punto:byte;
temp,temp2:pword;
pos:pbyte;
dir_x,dir_y:integer;
begin
pos:=gfx[ngfx].datos;
cant_y:=gfx[ngfx].y;
cant_x:=gfx[ngfx].x;
inc(pos,nchar*cant_x*gfx[ngfx].y);
if flipy then begin
py:=cant_y-1;
dir_y:=-1;
end else begin
py:=0;
dir_y:=1;
end;
if flipx then begin
temp2:=punbuf;
inc(temp2,cant_x-1);
dir_x:=-1;
end else begin
temp2:=punbuf;
dir_x:=1;
end;
for y:=0 to (cant_y-1) do begin
temp:=temp2;
for x:=0 to (cant_x-1) do begin
punto:=gfx[ngfx].colores[pos^+color];
if (punto and $7f)<$7f then temp^:=paleta[punto]
else temp^:=paleta[MAX_COLORES];
inc(pos);
inc(temp,dir_x);
end;
putpixel_gfx_int(pos_x,pos_y+py,cant_x,screen);
py:=py+dir_y;
end;
end;
var
f,color,nchar:word;
x,y,atrib:byte;
begin
for f:=0 to $7ff do begin
x:=f mod 64;
y:=f div 64;
//Background
if gfx[1].buffer[f] then begin
atrib:=memoria[$1001+(f*2)];
nchar:=memoria[$1000+(f*2)]+(atrib and $1) shl 8;
color:=(((atrib and $3e) shr 1)+((nchar and $1c0) shr 1)) shl 2;
put_gfx_pacland(x*8,y*8,nchar,color,1,1,(atrib and $40)<>0,(atrib and $80)<>0);
gfx[1].buffer[f]:=false;
end;
//Foreground
if gfx[0].buffer[f] then begin
atrib:=memoria[$1+(f*2)];
nchar:=memoria[$0+(f*2)]+(atrib and $1) shl 8;
color:=(((atrib and $1e) shr 1)+((nchar and $1e0) shr 1)) shl 2;
put_gfx_pacland(x*8,y*8,nchar,color,2,0,(atrib and $40)<>0,(atrib and $80)<>0);
if (atrib and $20)<>0 then put_gfx_pacland(x*8,y*8,nchar,color,4,0,(atrib and $40)<>0,(atrib and $80)<>0)
else put_gfx_block_trans(x*8,y*8,4,8,8);
gfx[0].buffer[f]:=false;
end;
end;
fill_full_screen(3,0);
draw_sprites(0);
scroll__x(1,3,scroll_x2-3);
scroll__x_part(2,3,0,0,0,40);
scroll__x_part(2,3,scroll_x1,0,40,192);
scroll__x_part(2,3,0,0,232,16);
draw_sprites(1);
scroll__x_part(4,3,0,0,0,40);
scroll__x_part(4,3,scroll_x1,0,40,192);
scroll__x_part(4,3,0,0,232,16);
draw_sprites(2);
actualiza_trozo_final(24,16,288,224,3);
end;
procedure eventos_pacland;
begin
if event.arcade then begin
//P1 & P2
if arcade_input.but0[0] then marcade.in0:=(marcade.in0 and $f7) else marcade.in0:=(marcade.in0 or $8);
if arcade_input.left[0] then marcade.in0:=(marcade.in0 and $ef) else marcade.in0:=(marcade.in0 or $10);
if arcade_input.right[0] then marcade.in0:=(marcade.in0 and $df) else marcade.in0:=(marcade.in0 or $20);
if arcade_input.but0[1] then marcade.in0:=(marcade.in0 and $bf) else marcade.in0:=(marcade.in0 or $40);
if arcade_input.left[1] then marcade.in0:=(marcade.in0 and $7f) else marcade.in0:=(marcade.in0 or $80);
//System
if arcade_input.right[1] then marcade.in1:=(marcade.in1 and $fe) else marcade.in1:=(marcade.in1 or $1);
if arcade_input.coin[0] then marcade.in1:=(marcade.in1 and $fb) else marcade.in1:=(marcade.in1 or $4);
if arcade_input.coin[1] then marcade.in1:=(marcade.in1 and $f7) else marcade.in1:=(marcade.in1 or $8);
if arcade_input.start[0] then marcade.in1:=(marcade.in1 and $ef) else marcade.in1:=(marcade.in1 or $10);
if arcade_input.start[1] then marcade.in1:=(marcade.in1 and $df) else marcade.in1:=(marcade.in1 or $20);
end;
end;
procedure pacland_principal;
var
f:word;
frame_m,frame_mcu:single;
begin
init_controls(false,false,false,true);
frame_m:=m6809_0.tframes;
frame_mcu:=m6800_0.tframes;
while EmuStatus=EsRuning do begin
for f:=0 to 263 do begin
//Main CPU
m6809_0.run(frame_m);
frame_m:=frame_m+m6809_0.tframes-m6809_0.contador;
//Sound CPU
m6800_0.run(frame_mcu);
frame_mcu:=frame_mcu+m6800_0.tframes-m6800_0.contador;
if f=239 then begin
if irq_enable then m6809_0.change_irq(ASSERT_LINE);
if irq_enable_mcu then m6800_0.change_irq(ASSERT_LINE);
update_video_pacland;
end;
end;
eventos_pacland;
video_sync;
end;
end;
function pacland_getbyte(direccion:word):byte;
begin
case direccion of
0..$37ff,$8000..$ffff:pacland_getbyte:=memoria[direccion];
$4000..$5fff:pacland_getbyte:=rom_bank[rom_nbank,direccion and $1fff];
$6800..$6bff:pacland_getbyte:=namco_snd_0.namcos1_cus30_r(direccion and $3ff);
end;
end;
procedure pacland_putbyte(direccion:word;valor:byte);
procedure cambiar_paleta;
var
colores:tpaleta;
f,bit0,bit1,bit2,bit3,tmp:byte;
begin
for f:=0 to $ff do begin
tmp:=pal_proms[palette_bank*$100+f];
bit0:=(tmp shr 0) and $1;
bit1:=(tmp shr 1) and $1;
bit2:=(tmp shr 2) and $1;
bit3:=(tmp shr 3) and $1;
colores[f].r:=$0e*bit0+$1f*bit1+$43*bit2+$8f*bit3;
bit0:=(tmp shr 4) and $1;
bit1:=(tmp shr 5) and $1;
bit2:=(tmp shr 6) and $1;
bit3:=(tmp shr 7) and $1;
colores[f].g:=$0e*bit0+$1f*bit1+$43*bit2+$8f*bit3;
tmp:=pal_proms[palette_bank*$100+$400+f];
bit0:=(tmp shr 0) and $1;
bit1:=(tmp shr 1) and $1;
bit2:=(tmp shr 2) and $1;
bit3:=(tmp shr 3) and $1;
colores[f].b:=$0e*bit0+$1f*bit1+$43*bit2+$8f*bit3;
end;
set_pal(colores,$100);
end;
begin
case direccion of
$0..$fff:if memoria[direccion]<>valor then begin
gfx[0].buffer[direccion shr 1]:=true;
memoria[direccion]:=valor;
end;
$1000..$1fff:if memoria[direccion]<>valor then begin
gfx[1].buffer[(direccion and $fff) shr 1]:=true;
memoria[direccion]:=valor;
end;
$2000..$37ff:memoria[direccion]:=valor;
$3800:scroll_x1:=valor;
$3801:scroll_x1:=valor+256;
$3a00:scroll_x2:=valor;
$3a01:scroll_x2:=valor+256;
$3c00:begin
rom_nbank:=valor and $7;
if palette_bank<>((valor and $18) shr 3) then
palette_bank:=(valor and $18) shr 3;
fillchar(gfx[0].buffer[0],$800,1);
fillchar(gfx[1].buffer[0],$800,1);
cambiar_paleta;
end;
$4000..$5fff,$a000..$ffff:;
$6800..$6bff:namco_snd_0.namcos1_cus30_w(direccion and $3ff,valor);
$7000..$7fff:begin
irq_enable:=(direccion and $800)=0;
if not(irq_enable) then m6809_0.change_irq(CLEAR_LINE);
end;
$8000..$8fff:if ((direccion and $800)=0) then m6800_0.reset;
$9000..$9fff:main_screen.flip_main_screen:=(direccion and $800)=0;
end;
end;
function mcu_getbyte(direccion:word):byte;
begin
case direccion of
$0..$ff:mcu_getbyte:=m6800_0.m6803_internal_reg_r(direccion);
$1000..$13ff:mcu_getbyte:=namco_snd_0.namcos1_cus30_r(direccion and $3ff);
$8000..$c7ff,$f000..$ffff:mcu_getbyte:=mem_snd[direccion];
$d000:mcu_getbyte:=(marcade.dswa and $f0) or (marcade.dswb shr 4);
$d001:mcu_getbyte:=((marcade.dswa and $f) shl 4) or (marcade.dswb and $f);
$d002:mcu_getbyte:=(marcade.in1 and $f0) or marcade.dswc or $f;
$d003:mcu_getbyte:=((marcade.in1 and $f) shl 4) or $f;
end;
end;
procedure mcu_putbyte(direccion:word;valor:byte);
begin
case direccion of
$0..$ff:m6800_0.m6803_internal_reg_w(direccion,valor);
$1000..$13ff:namco_snd_0.namcos1_cus30_w(direccion and $3ff,valor);
$4000..$7fff:begin
irq_enable_mcu:=((direccion and $2000)=0);
if not(irq_enable_mcu) then m6800_0.change_irq(CLEAR_LINE);
end;
$8000..$bfff,$f000..$ffff:;
$c000..$c7ff:mem_snd[direccion]:=valor;
end;
end;
function in_port1:byte;
begin
in_port1:=marcade.in0;
end;
function in_port2:byte;
begin
in_port2:=$ff; //Sin uso
end;
procedure pacland_sound_update;
begin
namco_snd_0.update;
end;
//Main
procedure reset_pacland;
begin
m6809_0.reset;
m6800_0.reset;
namco_snd_0.reset;
reset_audio;
marcade.in0:=$ff;
marcade.in1:=$7f;
rom_nbank:=0;
irq_enable:=false;
irq_enable_mcu:=false;
scroll_x1:=0;
scroll_x2:=0;
palette_bank:=$ff;
end;
function iniciar_pacland:boolean;
var
f:word;
memoria_temp:array[0..$17fff] of byte;
const
pc_x:array[0..7] of dword=(8*8, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 );
ps_x:array[0..15] of dword=(0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3,
16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3);
ps_y:array[0..15] of dword=(0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8);
begin
iniciar_pacland:=false;
llamadas_maquina.bucle_general:=pacland_principal;
llamadas_maquina.reset:=reset_pacland;
llamadas_maquina.fps_max:=60.60606060606060;
iniciar_audio(false);
screen_init(1,512,256,true);
screen_mod_scroll(1,512,512,511,256,256,255);
screen_init(2,512,256,true);
screen_mod_scroll(2,512,512,511,256,256,255);
screen_init(3,512,256,false,true);
screen_init(4,512,256,true);
screen_mod_scroll(4,512,512,511,256,256,255);
iniciar_video(288,224);
//Main CPU
m6809_0:=cpu_m6809.Create(1536000,264,TCPU_M6809);
m6809_0.change_ram_calls(pacland_getbyte,pacland_putbyte);
//MCU CPU
m6800_0:=cpu_m6800.create(6144000,264,TCPU_HD63701);
m6800_0.change_ram_calls(mcu_getbyte,mcu_putbyte);
m6800_0.change_io_calls(in_port1,in_port2,nil,nil,nil,nil,nil,nil);
m6800_0.init_sound(pacland_sound_update);
//cargar roms
if not(roms_load(@memoria_temp,pacland_rom)) then exit;
//Pongo las ROMs en su banco
copymemory(@memoria[$8000],@memoria_temp[$0],$8000);
for f:=0 to 7 do copymemory(@rom_bank[f,0],@memoria_temp[$8000+(f*$2000)],$2000);
//Cargar MCU
if not(roms_load(@mem_snd,pacland_mcu)) then exit;
namco_snd_0:=namco_snd_chip.create(8,true);
//convertir chars
if not(roms_load(@memoria_temp,pacland_char)) then exit;
init_gfx(0,8,8,$200);
gfx[0].trans[0]:=true;
gfx_set_desc_data(2,0,16*8,0,4);
convert_gfx(0,0,@memoria_temp,@pc_x,@ps_y,false,false);
//tiles
if not(roms_load(@memoria_temp,pacland_tiles)) then exit;
init_gfx(1,8,8,$200);
gfx_set_desc_data(2,0,16*8,0,4);
convert_gfx(1,0,@memoria_temp,@pc_x,@ps_y,false,false);
//sprites
if not(roms_load(@memoria_temp,pacland_sprites)) then exit;
init_gfx(2,16,16,$200);
gfx_set_desc_data(4,0,64*8,0,4,$200*64*8+0,$200*64*8+4);
convert_gfx(2,0,@memoria_temp,@ps_x,@ps_y,false,false);
//Paleta
if not(roms_load(@memoria_temp,pacland_prom)) then exit;
copymemory(@pal_proms,@memoria_temp,$800);
// tiles/sprites color table
for f:=$0 to $3ff do begin
gfx[0].colores[f]:=memoria_temp[$800+f];
gfx[1].colores[f]:=memoria_temp[$c00+f];
gfx[2].colores[f]:=memoria_temp[$1000+f];
end;
//Dip
marcade.dswa:=$ff;
marcade.dswa_val:=@pacland_dip_a;
marcade.dswb:=$ff;
marcade.dswb_val:=@pacland_dip_b;
marcade.dswc:=$80;
marcade.dswc_val:=@pacland_dip_c;
//final
reset_pacland;
iniciar_pacland:=true;
end;
end.
|
unit uPrincipal;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.SvcMgr, Vcl.Dialogs,
IniFiles, Vcl.ExtCtrls, Registry;
type
TFPrincipal = class(TService)
TimerDesligar: TTimer;
procedure ServiceStart(Sender: TService; var Started: Boolean);
procedure TimerDesligarTimer(Sender: TObject);
procedure ServiceAfterInstall(Sender: TService);
procedure ServiceBeforeUninstall(Sender: TService);
procedure ServiceStop(Sender: TService; var Stopped: Boolean);
private
vlsHoraConfigurada : String;
procedure gravarLogTXT(psMensagem: String);
{ Private declarations }
public
function GetServiceController: TServiceController; override;
{ Public declarations }
end;
var
FPrincipal: TFPrincipal;
implementation
{$R *.dfm}
procedure ServiceController(CtrlCode: DWord); stdcall;
begin
FPrincipal.Controller(CtrlCode);
end;
function TFPrincipal.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TFPrincipal.gravarLogTXT(psMensagem: String);
var
vloTexto:TStringList;
vlsCaminhoTXT: String;
begin
vloTexto := TStringList.Create;
try
vlsCaminhoTXT := 'C:\Servicos\LogsTxt\'+FormatDateTime('ddmmyyyy',Date)+'.txt';
if not DirectoryExists('C:\Servicos\LogsTxt\') then
ForceDirectories('C:\Servicos\LogsTxt\');
if FileExists(vlsCaminhoTXT) then
vloTexto.LoadFromFile(vlsCaminhoTXT);
vloTexto.Add(DateToStr(Date)+' '+TimeToStr(Time) +' - '+ psMensagem);
vloTexto.SaveToFile(vlsCaminhoTXT);
finally
vloTexto.Free;
end;
end;
procedure TFPrincipal.ServiceAfterInstall(Sender: TService);
var
regEdit : TRegistry;
begin
regEdit := TRegistry.Create(KEY_READ or KEY_WRITE);
try
regEdit.RootKey := HKEY_LOCAL_MACHINE;
if regEdit.OpenKey('\SYSTEM\CurrentControlSet\Services\' + Name,False) then
begin
regEdit.WriteString('Description','Serviço para desligar automaticamente o computador em horário definido');
regEdit.CloseKey;
end;
finally
FreeAndNil(regEdit);
end;
end;
procedure TFPrincipal.ServiceBeforeUninstall(Sender: TService);
begin
TimerDesligar.Enabled := False;
end;
procedure TFPrincipal.ServiceStart(Sender: TService; var Started: Boolean);
var
vloIni: TIniFile;
begin
gravarLogTXT('Serviço iniciado com sucesso!');
try
if FileExists('C:\Servicos\Config.Ini') then
begin
vloIni := TIniFile.Create('C:\Servicos\Config.Ini');
vlsHoraConfigurada := vloIni.ReadString('Config', 'Hora Desligamento', '18:20');
end
else
begin
vloIni := TIniFile.Create('C:\Servicos\Config.Ini');
vlsHoraConfigurada := '18:20';
vloIni.WriteString('Config', 'Hora Desligamento', vlsHoraConfigurada);
end;
finally
if Assigned(vloIni) then
FreeAndNil(vloIni);
end;
TimerDesligar.Interval := 60000;
if (vlsHoraConfigurada) <> '' then
TimerDesligar.Enabled := True;
end;
procedure TFPrincipal.ServiceStop(Sender: TService; var Stopped: Boolean);
begin
gravarLogTXT('Serviço parado com sucesso!');
TimerDesligar.Enabled := False;
end;
procedure TFPrincipal.TimerDesligarTimer(Sender: TObject);
begin
if (vlsHoraConfigurada) <> '' then
BEGIN
if FormatDateTime('HH:MM', StrToTime(vlsHoraConfigurada)) <=
FormatDateTime('HH:MM', Now) then
begin
TimerDesligar.Enabled := False;
WinExec('cmd /c shutdown -s -t 60',SW_NORMAL);
end;
END;
end;
end.
|
unit sqldbex;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, DB, sqldb, odbcconn, odbcsqldyn;
type
{ TExODBCConnection }
TExODBCConnection = class(TODBCConnection)
protected
FGetNext: Boolean;
FNextStmt: SQLHStmt;
procedure PrepareStatement(cursor:TSQLCursor; ATransaction:TSQLTransaction; buf:string; AParams:TParams); override;
procedure UnPrepareStatement(cursor:TSQLCursor); override;
procedure Execute(cursor:TSQLCursor; ATransaction:TSQLTransaction; AParams:TParams); override;
procedure UpdateIndexDefs(IndexDefs: TIndexDefs; TableName: string); override;
end;
{ TExSQLQuery }
TExSQLQuery = class(TSQLQuery)
private
function OdbcNextResultSet: Boolean;
public
// Get next resultset if it is exists.
// Return true if resultset has take, otherwise return false
function NextResultSet: Boolean;
end;
implementation
uses dynlibs;
type
TODBCCursorCrack = class(TODBCCursor);
{ TExODBCConnection }
procedure TExODBCConnection.Execute(cursor: TSQLCursor;
ATransaction: TSQLTransaction; AParams: TParams);
begin
if FGetNext then
begin
TODBCCursorCrack(cursor).FSTMTHandle := Self.FNextStmt;
cursor.FSelectable:= True;
end
else
inherited;
end;
procedure TExODBCConnection.PrepareStatement(cursor: TSQLCursor;
ATransaction: TSQLTransaction; buf: string; AParams: TParams);
begin
if FGetNext then
begin
cursor.FPrepared:= True;
end
else
inherited;
end;
procedure TExODBCConnection.UnPrepareStatement(cursor: TSQLCursor);
begin
if FGetNext then
cursor.FPrepared := False
else
inherited;
end;
procedure TExODBCConnection.UpdateIndexDefs(IndexDefs: TIndexDefs;
TableName: string);
begin
if not FGetNext then
inherited UpdateIndexDefs(IndexDefs, TableName);
end;
{ TExSQLQuery }
function TExSQLQuery.NextResultSet: Boolean;
begin
if Self.DataBase is TExODBCConnection then
begin
Result := OdbcNextResultSet;
end
else
DatabaseError('Not support multiple result sets', Self);
end;
type
TSQLMoreResults = function(
HStmt: SQLHStmt
): SQLRETURN; {$IFDEF Windows}stdcall{$ELSE} cdecl {$ENDIF};
var
SQLMoreResults: TSQLMoreResults;
procedure LoadFunc;
begin
if SQLMoreResults = nil then
pointer(SQLMoreResults) := GetProcedureAddress(ODBCLibraryHandle,'SQLMoreResults');
end;
function ODBCSuccess(const Res:SQLRETURN):boolean;
begin
Result:=(Res=SQL_SUCCESS) or (Res=SQL_SUCCESS_WITH_INFO);
end;
procedure OdbcCheck(res: SQLRETURN);
begin
if ODBCSuccess(Res) then Exit;
DatabaseError('odbc error code: ' + IntToStr(res));
end;
function TExSQLQuery.OdbcNextResultSet: Boolean;
var
cur: TODBCCursorCrack;
savedStmt: Pointer;
res: SQLRETURN;
colCount: SQLSMALLINT;
begin
LoadFunc;
cur := TODBCCursorCrack(Self.Cursor);
savedStmt := cur.FSTMTHandle;
while True do
begin
res := SQLMoreResults(savedStmt);
if res = SQL_NO_DATA then
begin
Result := False;
Exit;
end;
OdbcCheck(res);
// if column count is 0, this is not a resultset
if ODBCSuccess(SQLNumResultCols(savedStmt, ColCount)) then
begin
if colCount > 0 then Break;
end;
end;
OdbcCheck(SQLFreeStmt(savedStmt, SQL_UNBIND));
cur.FSTMTHandle := nil; // prevent from release this stmt on close
Close;
FieldDefs.Updated:= False;
// Reopen dataset and use next resultset.
TExODBCConnection(Self.DataBase).FGetNext:= True;
TExODBCConnection(Self.DataBase).FNextStmt:= savedStmt;
try
Open;
finally
TExODBCConnection(Self.DataBase).FGetNext:= False;
TExODBCConnection(Self.DataBase).FNextStmt:= nil;
end;
Result := True;
end;
end.
|
unit OldSituationSearchKeywordsPack;
{* Набор слов словаря для доступа к экземплярам контролов формы OldSituationSearch }
// Модуль: "w:\garant6x\implementation\Garant\GbaNemesis\View\Search\Forms\OldSituationSearchKeywordsPack.pas"
// Стереотип: "ScriptKeywordsPack"
// Элемент модели: "OldSituationSearchKeywordsPack" MUID: (4AB8D885020F_Pack)
{$Include w:\garant6x\implementation\Garant\nsDefine.inc}
interface
{$If NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts) AND NOT Defined(NoVCL)}
uses
l3IntfUses
;
{$IfEnd} // NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts) AND NOT Defined(NoVCL)
implementation
{$If NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts) AND NOT Defined(NoVCL)}
uses
l3ImplUses
, OldSituationSearch_Form
, tfwPropertyLike
, vtPanel
, tfwScriptingInterfaces
, TypInfo
, tfwTypeInfo
{$If Defined(Nemesis)}
, nscContextFilter
{$IfEnd} // Defined(Nemesis)
, vtProportionalPanel
, vtSizeablePanel
, tfwControlString
, kwBynameControlPush
, TtfwClassRef_Proxy
, SysUtils
, TtfwTypeRegistrator_Proxy
, tfwScriptingTypes
//#UC START# *4AB8D885020F_Packimpl_uses*
//#UC END# *4AB8D885020F_Packimpl_uses*
;
type
TkwCfOldSituationSearchBackgroundPanel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.BackgroundPanel }
private
function BackgroundPanel(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.BackgroundPanel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchBackgroundPanel
TkwCfOldSituationSearchContextFilter = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.ContextFilter }
private
function ContextFilter(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TnscContextFilter;
{* Реализация слова скрипта .TcfOldSituationSearch.ContextFilter }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchContextFilter
TkwCfOldSituationSearchInnerBackgroundPanel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.InnerBackgroundPanel }
private
function InnerBackgroundPanel(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtProportionalPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.InnerBackgroundPanel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchInnerBackgroundPanel
TkwCfOldSituationSearchBotomPanel = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.BotomPanel }
private
function BotomPanel(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtSizeablePanel;
{* Реализация слова скрипта .TcfOldSituationSearch.BotomPanel }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchBotomPanel
TkwCfOldSituationSearchParentZone = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.ParentZone }
private
function ParentZone(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.ParentZone }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchParentZone
TkwCfOldSituationSearchZoneContainer = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.ZoneContainer }
private
function ZoneContainer(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtProportionalPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.ZoneContainer }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchZoneContainer
TkwCfOldSituationSearchChildZone = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.ChildZone }
private
function ChildZone(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.ChildZone }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchChildZone
TkwCfOldSituationSearchMainZone = {final} class(TtfwPropertyLike)
{* Слово скрипта .TcfOldSituationSearch.MainZone }
private
function MainZone(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtSizeablePanel;
{* Реализация слова скрипта .TcfOldSituationSearch.MainZone }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
public
function GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo; override;
function GetAllParamsCount(const aCtx: TtfwContext): Integer; override;
function ParamsTypes: PTypeInfoArray; override;
procedure SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext); override;
end;//TkwCfOldSituationSearchMainZone
Tkw_Form_OldSituationSearch = {final} class(TtfwControlString)
{* Слово словаря для идентификатора формы OldSituationSearch
----
*Пример использования*:
[code]форма::OldSituationSearch TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_Form_OldSituationSearch
Tkw_OldSituationSearch_Control_BackgroundPanel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола BackgroundPanel
----
*Пример использования*:
[code]контрол::BackgroundPanel TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_BackgroundPanel
Tkw_OldSituationSearch_Control_BackgroundPanel_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола BackgroundPanel
----
*Пример использования*:
[code]контрол::BackgroundPanel:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_BackgroundPanel_Push
Tkw_OldSituationSearch_Control_ContextFilter = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола ContextFilter
----
*Пример использования*:
[code]контрол::ContextFilter TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ContextFilter
Tkw_OldSituationSearch_Control_ContextFilter_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола ContextFilter
----
*Пример использования*:
[code]контрол::ContextFilter:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ContextFilter_Push
Tkw_OldSituationSearch_Control_InnerBackgroundPanel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола InnerBackgroundPanel
----
*Пример использования*:
[code]контрол::InnerBackgroundPanel TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel
Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола InnerBackgroundPanel
----
*Пример использования*:
[code]контрол::InnerBackgroundPanel:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push
Tkw_OldSituationSearch_Control_BotomPanel = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола BotomPanel
----
*Пример использования*:
[code]контрол::BotomPanel TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_BotomPanel
Tkw_OldSituationSearch_Control_BotomPanel_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола BotomPanel
----
*Пример использования*:
[code]контрол::BotomPanel:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_BotomPanel_Push
Tkw_OldSituationSearch_Control_ParentZone = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола ParentZone
----
*Пример использования*:
[code]контрол::ParentZone TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ParentZone
Tkw_OldSituationSearch_Control_ParentZone_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола ParentZone
----
*Пример использования*:
[code]контрол::ParentZone:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ParentZone_Push
Tkw_OldSituationSearch_Control_ZoneContainer = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола ZoneContainer
----
*Пример использования*:
[code]контрол::ZoneContainer TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ZoneContainer
Tkw_OldSituationSearch_Control_ZoneContainer_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола ZoneContainer
----
*Пример использования*:
[code]контрол::ZoneContainer:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ZoneContainer_Push
Tkw_OldSituationSearch_Control_ChildZone = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола ChildZone
----
*Пример использования*:
[code]контрол::ChildZone TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ChildZone
Tkw_OldSituationSearch_Control_ChildZone_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола ChildZone
----
*Пример использования*:
[code]контрол::ChildZone:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_ChildZone_Push
Tkw_OldSituationSearch_Control_MainZone = {final} class(TtfwControlString)
{* Слово словаря для идентификатора контрола MainZone
----
*Пример использования*:
[code]контрол::MainZone TryFocus ASSERT[code] }
protected
function GetString: AnsiString; override;
class procedure RegisterInEngine; override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_MainZone
Tkw_OldSituationSearch_Control_MainZone_Push = {final} class(TkwBynameControlPush)
{* Слово словаря для контрола MainZone
----
*Пример использования*:
[code]контрол::MainZone:push pop:control:SetFocus ASSERT[code] }
protected
procedure DoDoIt(const aCtx: TtfwContext); override;
class function GetWordNameForRegister: AnsiString; override;
end;//Tkw_OldSituationSearch_Control_MainZone_Push
function TkwCfOldSituationSearchBackgroundPanel.BackgroundPanel(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.BackgroundPanel }
begin
Result := acfOldSituationSearch.BackgroundPanel;
end;//TkwCfOldSituationSearchBackgroundPanel.BackgroundPanel
class function TkwCfOldSituationSearchBackgroundPanel.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.BackgroundPanel';
end;//TkwCfOldSituationSearchBackgroundPanel.GetWordNameForRegister
function TkwCfOldSituationSearchBackgroundPanel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtPanel);
end;//TkwCfOldSituationSearchBackgroundPanel.GetResultTypeInfo
function TkwCfOldSituationSearchBackgroundPanel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchBackgroundPanel.GetAllParamsCount
function TkwCfOldSituationSearchBackgroundPanel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchBackgroundPanel.ParamsTypes
procedure TkwCfOldSituationSearchBackgroundPanel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству BackgroundPanel', aCtx);
end;//TkwCfOldSituationSearchBackgroundPanel.SetValuePrim
procedure TkwCfOldSituationSearchBackgroundPanel.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(BackgroundPanel(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchBackgroundPanel.DoDoIt
function TkwCfOldSituationSearchContextFilter.ContextFilter(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TnscContextFilter;
{* Реализация слова скрипта .TcfOldSituationSearch.ContextFilter }
begin
Result := acfOldSituationSearch.ContextFilter;
end;//TkwCfOldSituationSearchContextFilter.ContextFilter
class function TkwCfOldSituationSearchContextFilter.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.ContextFilter';
end;//TkwCfOldSituationSearchContextFilter.GetWordNameForRegister
function TkwCfOldSituationSearchContextFilter.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TnscContextFilter);
end;//TkwCfOldSituationSearchContextFilter.GetResultTypeInfo
function TkwCfOldSituationSearchContextFilter.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchContextFilter.GetAllParamsCount
function TkwCfOldSituationSearchContextFilter.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchContextFilter.ParamsTypes
procedure TkwCfOldSituationSearchContextFilter.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству ContextFilter', aCtx);
end;//TkwCfOldSituationSearchContextFilter.SetValuePrim
procedure TkwCfOldSituationSearchContextFilter.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(ContextFilter(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchContextFilter.DoDoIt
function TkwCfOldSituationSearchInnerBackgroundPanel.InnerBackgroundPanel(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtProportionalPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.InnerBackgroundPanel }
begin
Result := acfOldSituationSearch.InnerBackgroundPanel;
end;//TkwCfOldSituationSearchInnerBackgroundPanel.InnerBackgroundPanel
class function TkwCfOldSituationSearchInnerBackgroundPanel.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.InnerBackgroundPanel';
end;//TkwCfOldSituationSearchInnerBackgroundPanel.GetWordNameForRegister
function TkwCfOldSituationSearchInnerBackgroundPanel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtProportionalPanel);
end;//TkwCfOldSituationSearchInnerBackgroundPanel.GetResultTypeInfo
function TkwCfOldSituationSearchInnerBackgroundPanel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchInnerBackgroundPanel.GetAllParamsCount
function TkwCfOldSituationSearchInnerBackgroundPanel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchInnerBackgroundPanel.ParamsTypes
procedure TkwCfOldSituationSearchInnerBackgroundPanel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству InnerBackgroundPanel', aCtx);
end;//TkwCfOldSituationSearchInnerBackgroundPanel.SetValuePrim
procedure TkwCfOldSituationSearchInnerBackgroundPanel.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(InnerBackgroundPanel(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchInnerBackgroundPanel.DoDoIt
function TkwCfOldSituationSearchBotomPanel.BotomPanel(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtSizeablePanel;
{* Реализация слова скрипта .TcfOldSituationSearch.BotomPanel }
begin
Result := acfOldSituationSearch.BotomPanel;
end;//TkwCfOldSituationSearchBotomPanel.BotomPanel
class function TkwCfOldSituationSearchBotomPanel.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.BotomPanel';
end;//TkwCfOldSituationSearchBotomPanel.GetWordNameForRegister
function TkwCfOldSituationSearchBotomPanel.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtSizeablePanel);
end;//TkwCfOldSituationSearchBotomPanel.GetResultTypeInfo
function TkwCfOldSituationSearchBotomPanel.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchBotomPanel.GetAllParamsCount
function TkwCfOldSituationSearchBotomPanel.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchBotomPanel.ParamsTypes
procedure TkwCfOldSituationSearchBotomPanel.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству BotomPanel', aCtx);
end;//TkwCfOldSituationSearchBotomPanel.SetValuePrim
procedure TkwCfOldSituationSearchBotomPanel.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(BotomPanel(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchBotomPanel.DoDoIt
function TkwCfOldSituationSearchParentZone.ParentZone(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.ParentZone }
begin
Result := acfOldSituationSearch.ParentZone;
end;//TkwCfOldSituationSearchParentZone.ParentZone
class function TkwCfOldSituationSearchParentZone.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.ParentZone';
end;//TkwCfOldSituationSearchParentZone.GetWordNameForRegister
function TkwCfOldSituationSearchParentZone.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtPanel);
end;//TkwCfOldSituationSearchParentZone.GetResultTypeInfo
function TkwCfOldSituationSearchParentZone.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchParentZone.GetAllParamsCount
function TkwCfOldSituationSearchParentZone.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchParentZone.ParamsTypes
procedure TkwCfOldSituationSearchParentZone.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству ParentZone', aCtx);
end;//TkwCfOldSituationSearchParentZone.SetValuePrim
procedure TkwCfOldSituationSearchParentZone.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(ParentZone(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchParentZone.DoDoIt
function TkwCfOldSituationSearchZoneContainer.ZoneContainer(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtProportionalPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.ZoneContainer }
begin
Result := acfOldSituationSearch.ZoneContainer;
end;//TkwCfOldSituationSearchZoneContainer.ZoneContainer
class function TkwCfOldSituationSearchZoneContainer.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.ZoneContainer';
end;//TkwCfOldSituationSearchZoneContainer.GetWordNameForRegister
function TkwCfOldSituationSearchZoneContainer.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtProportionalPanel);
end;//TkwCfOldSituationSearchZoneContainer.GetResultTypeInfo
function TkwCfOldSituationSearchZoneContainer.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchZoneContainer.GetAllParamsCount
function TkwCfOldSituationSearchZoneContainer.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchZoneContainer.ParamsTypes
procedure TkwCfOldSituationSearchZoneContainer.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству ZoneContainer', aCtx);
end;//TkwCfOldSituationSearchZoneContainer.SetValuePrim
procedure TkwCfOldSituationSearchZoneContainer.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(ZoneContainer(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchZoneContainer.DoDoIt
function TkwCfOldSituationSearchChildZone.ChildZone(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtPanel;
{* Реализация слова скрипта .TcfOldSituationSearch.ChildZone }
begin
Result := acfOldSituationSearch.ChildZone;
end;//TkwCfOldSituationSearchChildZone.ChildZone
class function TkwCfOldSituationSearchChildZone.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.ChildZone';
end;//TkwCfOldSituationSearchChildZone.GetWordNameForRegister
function TkwCfOldSituationSearchChildZone.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtPanel);
end;//TkwCfOldSituationSearchChildZone.GetResultTypeInfo
function TkwCfOldSituationSearchChildZone.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchChildZone.GetAllParamsCount
function TkwCfOldSituationSearchChildZone.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchChildZone.ParamsTypes
procedure TkwCfOldSituationSearchChildZone.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству ChildZone', aCtx);
end;//TkwCfOldSituationSearchChildZone.SetValuePrim
procedure TkwCfOldSituationSearchChildZone.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(ChildZone(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchChildZone.DoDoIt
function TkwCfOldSituationSearchMainZone.MainZone(const aCtx: TtfwContext;
acfOldSituationSearch: TcfOldSituationSearch): TvtSizeablePanel;
{* Реализация слова скрипта .TcfOldSituationSearch.MainZone }
begin
Result := acfOldSituationSearch.MainZone;
end;//TkwCfOldSituationSearchMainZone.MainZone
class function TkwCfOldSituationSearchMainZone.GetWordNameForRegister: AnsiString;
begin
Result := '.TcfOldSituationSearch.MainZone';
end;//TkwCfOldSituationSearchMainZone.GetWordNameForRegister
function TkwCfOldSituationSearchMainZone.GetResultTypeInfo(const aCtx: TtfwContext): PTypeInfo;
begin
Result := TypeInfo(TvtSizeablePanel);
end;//TkwCfOldSituationSearchMainZone.GetResultTypeInfo
function TkwCfOldSituationSearchMainZone.GetAllParamsCount(const aCtx: TtfwContext): Integer;
begin
Result := 1;
end;//TkwCfOldSituationSearchMainZone.GetAllParamsCount
function TkwCfOldSituationSearchMainZone.ParamsTypes: PTypeInfoArray;
begin
Result := OpenTypesToTypes([TypeInfo(TcfOldSituationSearch)]);
end;//TkwCfOldSituationSearchMainZone.ParamsTypes
procedure TkwCfOldSituationSearchMainZone.SetValuePrim(const aValue: TtfwStackValue;
const aCtx: TtfwContext);
begin
RunnerError('Нельзя присваивать значение readonly свойству MainZone', aCtx);
end;//TkwCfOldSituationSearchMainZone.SetValuePrim
procedure TkwCfOldSituationSearchMainZone.DoDoIt(const aCtx: TtfwContext);
var l_acfOldSituationSearch: TcfOldSituationSearch;
begin
try
l_acfOldSituationSearch := TcfOldSituationSearch(aCtx.rEngine.PopObjAs(TcfOldSituationSearch));
except
on E: Exception do
begin
RunnerError('Ошибка при получении параметра acfOldSituationSearch: TcfOldSituationSearch : ' + E.Message, aCtx);
Exit;
end;//on E: Exception
end;//try..except
aCtx.rEngine.PushObj(MainZone(aCtx, l_acfOldSituationSearch));
end;//TkwCfOldSituationSearchMainZone.DoDoIt
function Tkw_Form_OldSituationSearch.GetString: AnsiString;
begin
Result := 'cfOldSituationSearch';
end;//Tkw_Form_OldSituationSearch.GetString
class procedure Tkw_Form_OldSituationSearch.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TcfOldSituationSearch);
end;//Tkw_Form_OldSituationSearch.RegisterInEngine
class function Tkw_Form_OldSituationSearch.GetWordNameForRegister: AnsiString;
begin
Result := 'форма::OldSituationSearch';
end;//Tkw_Form_OldSituationSearch.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_BackgroundPanel.GetString: AnsiString;
begin
Result := 'BackgroundPanel';
end;//Tkw_OldSituationSearch_Control_BackgroundPanel.GetString
class procedure Tkw_OldSituationSearch_Control_BackgroundPanel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtPanel);
end;//Tkw_OldSituationSearch_Control_BackgroundPanel.RegisterInEngine
class function Tkw_OldSituationSearch_Control_BackgroundPanel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::BackgroundPanel';
end;//Tkw_OldSituationSearch_Control_BackgroundPanel.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_BackgroundPanel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('BackgroundPanel');
inherited;
end;//Tkw_OldSituationSearch_Control_BackgroundPanel_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_BackgroundPanel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::BackgroundPanel:push';
end;//Tkw_OldSituationSearch_Control_BackgroundPanel_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_ContextFilter.GetString: AnsiString;
begin
Result := 'ContextFilter';
end;//Tkw_OldSituationSearch_Control_ContextFilter.GetString
class procedure Tkw_OldSituationSearch_Control_ContextFilter.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TnscContextFilter);
end;//Tkw_OldSituationSearch_Control_ContextFilter.RegisterInEngine
class function Tkw_OldSituationSearch_Control_ContextFilter.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ContextFilter';
end;//Tkw_OldSituationSearch_Control_ContextFilter.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_ContextFilter_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('ContextFilter');
inherited;
end;//Tkw_OldSituationSearch_Control_ContextFilter_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_ContextFilter_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ContextFilter:push';
end;//Tkw_OldSituationSearch_Control_ContextFilter_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_InnerBackgroundPanel.GetString: AnsiString;
begin
Result := 'InnerBackgroundPanel';
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel.GetString
class procedure Tkw_OldSituationSearch_Control_InnerBackgroundPanel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtProportionalPanel);
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel.RegisterInEngine
class function Tkw_OldSituationSearch_Control_InnerBackgroundPanel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::InnerBackgroundPanel';
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('InnerBackgroundPanel');
inherited;
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::InnerBackgroundPanel:push';
end;//Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_BotomPanel.GetString: AnsiString;
begin
Result := 'BotomPanel';
end;//Tkw_OldSituationSearch_Control_BotomPanel.GetString
class procedure Tkw_OldSituationSearch_Control_BotomPanel.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtSizeablePanel);
end;//Tkw_OldSituationSearch_Control_BotomPanel.RegisterInEngine
class function Tkw_OldSituationSearch_Control_BotomPanel.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::BotomPanel';
end;//Tkw_OldSituationSearch_Control_BotomPanel.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_BotomPanel_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('BotomPanel');
inherited;
end;//Tkw_OldSituationSearch_Control_BotomPanel_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_BotomPanel_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::BotomPanel:push';
end;//Tkw_OldSituationSearch_Control_BotomPanel_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_ParentZone.GetString: AnsiString;
begin
Result := 'ParentZone';
end;//Tkw_OldSituationSearch_Control_ParentZone.GetString
class procedure Tkw_OldSituationSearch_Control_ParentZone.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtPanel);
end;//Tkw_OldSituationSearch_Control_ParentZone.RegisterInEngine
class function Tkw_OldSituationSearch_Control_ParentZone.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ParentZone';
end;//Tkw_OldSituationSearch_Control_ParentZone.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_ParentZone_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('ParentZone');
inherited;
end;//Tkw_OldSituationSearch_Control_ParentZone_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_ParentZone_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ParentZone:push';
end;//Tkw_OldSituationSearch_Control_ParentZone_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_ZoneContainer.GetString: AnsiString;
begin
Result := 'ZoneContainer';
end;//Tkw_OldSituationSearch_Control_ZoneContainer.GetString
class procedure Tkw_OldSituationSearch_Control_ZoneContainer.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtProportionalPanel);
end;//Tkw_OldSituationSearch_Control_ZoneContainer.RegisterInEngine
class function Tkw_OldSituationSearch_Control_ZoneContainer.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ZoneContainer';
end;//Tkw_OldSituationSearch_Control_ZoneContainer.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_ZoneContainer_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('ZoneContainer');
inherited;
end;//Tkw_OldSituationSearch_Control_ZoneContainer_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_ZoneContainer_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ZoneContainer:push';
end;//Tkw_OldSituationSearch_Control_ZoneContainer_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_ChildZone.GetString: AnsiString;
begin
Result := 'ChildZone';
end;//Tkw_OldSituationSearch_Control_ChildZone.GetString
class procedure Tkw_OldSituationSearch_Control_ChildZone.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtPanel);
end;//Tkw_OldSituationSearch_Control_ChildZone.RegisterInEngine
class function Tkw_OldSituationSearch_Control_ChildZone.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ChildZone';
end;//Tkw_OldSituationSearch_Control_ChildZone.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_ChildZone_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('ChildZone');
inherited;
end;//Tkw_OldSituationSearch_Control_ChildZone_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_ChildZone_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::ChildZone:push';
end;//Tkw_OldSituationSearch_Control_ChildZone_Push.GetWordNameForRegister
function Tkw_OldSituationSearch_Control_MainZone.GetString: AnsiString;
begin
Result := 'MainZone';
end;//Tkw_OldSituationSearch_Control_MainZone.GetString
class procedure Tkw_OldSituationSearch_Control_MainZone.RegisterInEngine;
begin
inherited;
TtfwClassRef.Register(TvtSizeablePanel);
end;//Tkw_OldSituationSearch_Control_MainZone.RegisterInEngine
class function Tkw_OldSituationSearch_Control_MainZone.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::MainZone';
end;//Tkw_OldSituationSearch_Control_MainZone.GetWordNameForRegister
procedure Tkw_OldSituationSearch_Control_MainZone_Push.DoDoIt(const aCtx: TtfwContext);
begin
aCtx.rEngine.PushString('MainZone');
inherited;
end;//Tkw_OldSituationSearch_Control_MainZone_Push.DoDoIt
class function Tkw_OldSituationSearch_Control_MainZone_Push.GetWordNameForRegister: AnsiString;
begin
Result := 'контрол::MainZone:push';
end;//Tkw_OldSituationSearch_Control_MainZone_Push.GetWordNameForRegister
initialization
TkwCfOldSituationSearchBackgroundPanel.RegisterInEngine;
{* Регистрация cfOldSituationSearch_BackgroundPanel }
TkwCfOldSituationSearchContextFilter.RegisterInEngine;
{* Регистрация cfOldSituationSearch_ContextFilter }
TkwCfOldSituationSearchInnerBackgroundPanel.RegisterInEngine;
{* Регистрация cfOldSituationSearch_InnerBackgroundPanel }
TkwCfOldSituationSearchBotomPanel.RegisterInEngine;
{* Регистрация cfOldSituationSearch_BotomPanel }
TkwCfOldSituationSearchParentZone.RegisterInEngine;
{* Регистрация cfOldSituationSearch_ParentZone }
TkwCfOldSituationSearchZoneContainer.RegisterInEngine;
{* Регистрация cfOldSituationSearch_ZoneContainer }
TkwCfOldSituationSearchChildZone.RegisterInEngine;
{* Регистрация cfOldSituationSearch_ChildZone }
TkwCfOldSituationSearchMainZone.RegisterInEngine;
{* Регистрация cfOldSituationSearch_MainZone }
Tkw_Form_OldSituationSearch.RegisterInEngine;
{* Регистрация Tkw_Form_OldSituationSearch }
Tkw_OldSituationSearch_Control_BackgroundPanel.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_BackgroundPanel }
Tkw_OldSituationSearch_Control_BackgroundPanel_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_BackgroundPanel_Push }
Tkw_OldSituationSearch_Control_ContextFilter.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ContextFilter }
Tkw_OldSituationSearch_Control_ContextFilter_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ContextFilter_Push }
Tkw_OldSituationSearch_Control_InnerBackgroundPanel.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_InnerBackgroundPanel }
Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_InnerBackgroundPanel_Push }
Tkw_OldSituationSearch_Control_BotomPanel.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_BotomPanel }
Tkw_OldSituationSearch_Control_BotomPanel_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_BotomPanel_Push }
Tkw_OldSituationSearch_Control_ParentZone.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ParentZone }
Tkw_OldSituationSearch_Control_ParentZone_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ParentZone_Push }
Tkw_OldSituationSearch_Control_ZoneContainer.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ZoneContainer }
Tkw_OldSituationSearch_Control_ZoneContainer_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ZoneContainer_Push }
Tkw_OldSituationSearch_Control_ChildZone.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ChildZone }
Tkw_OldSituationSearch_Control_ChildZone_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_ChildZone_Push }
Tkw_OldSituationSearch_Control_MainZone.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_MainZone }
Tkw_OldSituationSearch_Control_MainZone_Push.RegisterInEngine;
{* Регистрация Tkw_OldSituationSearch_Control_MainZone_Push }
TtfwTypeRegistrator.RegisterType(TypeInfo(TcfOldSituationSearch));
{* Регистрация типа TcfOldSituationSearch }
TtfwTypeRegistrator.RegisterType(TypeInfo(TvtPanel));
{* Регистрация типа TvtPanel }
{$If Defined(Nemesis)}
TtfwTypeRegistrator.RegisterType(TypeInfo(TnscContextFilter));
{* Регистрация типа TnscContextFilter }
{$IfEnd} // Defined(Nemesis)
TtfwTypeRegistrator.RegisterType(TypeInfo(TvtProportionalPanel));
{* Регистрация типа TvtProportionalPanel }
TtfwTypeRegistrator.RegisterType(TypeInfo(TvtSizeablePanel));
{* Регистрация типа TvtSizeablePanel }
{$IfEnd} // NOT Defined(Admin) AND NOT Defined(Monitorings) AND NOT Defined(NoScripts) AND NOT Defined(NoVCL)
end.
|
unit AddConfigValueUnit;
interface
uses SysUtils, BaseExampleUnit, EnumsUnit;
type
TAddConfigValue = class(TBaseExample)
public
function Execute(Key, Value: String): boolean;
end;
implementation
function TAddConfigValue.Execute(Key, Value: String): boolean;
var
ErrorString: String;
begin
Result := Route4MeManager.User.AddConfigValue(Key, Value, ErrorString);
WriteLn('');
if (ErrorString = EmptyStr) then
begin
if Result then
WriteLn('AddConfigValue successfully')
else
WriteLn('AddConfigValue error');
WriteLn('');
end
else
WriteLn(Format('AddConfigValue error: "%s"', [ErrorString]));
end;
end.
|
{ *********************************************************** }
{ * TForge Library * }
{ * Copyright (c) Sergey Kasandrov 1997, 2016 * }
{ *********************************************************** }
unit tfExceptions;
interface
uses SysUtils, tfTypes;
type
EForgeError = class(Exception)
private
FCode: TF_RESULT;
public
constructor Create(ACode: TF_RESULT; const Msg: string = '');
property Code: TF_RESULT read FCode;
end;
ERandError = class(EForgeError);
EByteArrayError = class(EForgeError);
procedure ForgeError(ACode: TF_RESULT; const Msg: string = '');
function ForgeInfo(ACode: TF_RESULT): string;
implementation
{ EForgeError }
constructor EForgeError.Create(ACode: TF_RESULT; const Msg: string);
begin
if Msg = '' then
inherited Create(Format('Forge Error 0x%.8x (%s)', [ACode, ForgeInfo(ACode)]))
else
inherited Create(Msg);
FCode:= ACode;
end;
function ForgeInfo(ACode: TF_RESULT): string;
begin
case ACode of
TF_S_OK: Result:= 'TF_S_OK';
TF_S_FALSE: Result:= 'TF_S_FALSE';
TF_E_FAIL: Result:= 'TF_E_FAIL';
TF_E_INVALIDARG: Result:= 'TF_E_INVALIDARG';
TF_E_NOINTERFACE: Result:= 'TF_E_NOINTERFACE';
TF_E_NOTIMPL: Result:= 'TF_E_NOTIMPL';
TF_E_OUTOFMEMORY: Result:= 'TF_E_OUTOFMEMORY';
TF_E_UNEXPECTED: Result:= 'TF_E_UNEXPECTED';
TF_E_NOMEMORY: Result:= 'TF_E_NOMEMORY';
TF_E_LOADERROR: Result:= 'TF_E_LOADERROR';
else
Result:= 'Unknown';
end;
end;
procedure ForgeError(ACode: TF_RESULT; const Msg: string);
begin
raise EForgeError.Create(ACode, Msg);
end;
end.
|
unit Options;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons, ComCtrls, Menus, ImgList;
type
TfrmOptions = class(TForm)
pnlCont: TPanel;
pnlText: TPanel;
lblPluginVersion: TLabel;
btnAbout: TBitBtn;
btnOK: TBitBtn;
btnCancel: TBitBtn;
btnApply: TBitBtn;
pgcOptions: TPageControl;
tsGeneral: TTabSheet;
tsAdvanced: TTabSheet;
tsCL: TTabSheet;
tsXStatus: TTabSheet;
tsConnection: TTabSheet;
gbUpdater: TGroupBox;
chkUpdaterCheckingUpdates: TCheckBox;
lblUpdaterInterval: TLabel;
edtUpdaterInterval: TEdit;
udUpdaterInterval: TUpDown;
lblUpdaterIntervalUnit: TLabel;
btnUpdaterCheckUpdate: TBitBtn;
gbProxy: TGroupBox;
lblProxyServerInfo: TLabel;
edtProxyServer: TEdit;
pmTemplates: TPopupMenu;
miTemplates_Values: TMenuItem;
miTemplates_Texts: TMenuItem;
miTemplates_CapitalFollowingLetter: TMenuItem;
chkEnableXStatus: TCheckBox;
rbChangeIfMusic: TRadioButton;
rbChangeIfAny: TRadioButton;
gbXStatus: TGroupBox;
lblXStatusTitle: TLabel;
lblXStatusText: TLabel;
edtXStatusText: TMemo;
edtXStatusTitle: TEdit;
btnXStatusDefault: TBitBtn;
btnXStatusTitleTemplates: TBitBtn;
btnXStatusTextTemplates: TBitBtn;
gbSkin: TGroupBox;
lblInfoSkinAuthor: TLabel;
lblInfoSkinEmail: TLabel;
lblSkinAuthor: TLabel;
lblSkinEmail: TLabel;
lblInfoSkinWeb: TLabel;
lblSkinWeb: TLabel;
cmbSkin: TComboBox;
chkUseQIPMute: TCheckBox;
chkPlayOnStart: TCheckBox;
chkEnableEqualizer: TCheckBox;
tsHotKeys: TTabSheet;
gbHotKeys: TGroupBox;
lblHotKeyFMtune: TLabel;
lblHotKeyMute: TLabel;
lblHotKeyVolumeUp: TLabel;
lblHotKeyVolumeDown: TLabel;
HotKey1: THotKey;
chkUseHotKeys: TCheckBox;
HotKey2: THotKey;
HotKey3: THotKey;
HotKey4: THotKey;
gbLanguage: TGroupBox;
lblInfoTransAuthor: TLabel;
lblInfoTransEmail: TLabel;
lblTransAuthor: TLabel;
lblTransEmail: TLabel;
lblInfoTransWeb: TLabel;
lblTransURL: TLabel;
lblLanguage: TLabel;
lstMenu: TListBox;
btnEqualizerSetup: TButton;
lblInfoSkinVersion: TLabel;
lblSkinVersion: TLabel;
BottomLine: TShape;
lblLanguageVersion: TLabel;
gbAdvancedOptions: TGroupBox;
gbXStatusOptions: TGroupBox;
cmbLangs: TComboBox;
chkAnnounceBeta: TCheckBox;
lblLanguageRem: TLabel;
gbAutomaticOnOffRadio: TGroupBox;
imgStatusLunch: TImage;
imgStatusAway: TImage;
imgStatusNA: TImage;
imgStatusOccupied: TImage;
imgStatusDND: TImage;
imgStatusOnline: TImage;
imgStatusOffline: TImage;
imgStatusFFC: TImage;
imgStatusEvil: TImage;
imgStatusDepres: TImage;
imgStatusAtHome: TImage;
imgStatusAtWork: TImage;
imgStatusInvisible: TImage;
chkStatusFFCAuto: TComboBox;
chkStatusEvilAuto: TComboBox;
chkStatusDepresAuto: TComboBox;
chkStatusAtHomeAuto: TComboBox;
chkStatusAtWorkAuto: TComboBox;
chkStatusLunchAuto: TComboBox;
chkStatusAwayAuto: TComboBox;
chkStatusNAAuto: TComboBox;
chkStatusOccupiedAuto: TComboBox;
chkStatusDNDAuto: TComboBox;
chkStatusOnlineAuto: TComboBox;
chkStatusInvisibleAuto: TComboBox;
chkStatusOfflineAuto: TComboBox;
chkAutoUseWherePlaying: TCheckBox;
ImageList1: TImageList;
HotKey5: THotKey;
HotKey6: THotKey;
lblHotKeyStationPrev: TLabel;
lblHotKeyStationNext: TLabel;
btnXStatusPreview: TBitBtn;
btnSyntax: TBitBtn;
chkSaveLastStream: TCheckBox;
lblHotKeyEnableDisableXStatus: TLabel;
HotKey7: THotKey;
chkShowComments: TCheckBox;
tsPopUp: TTabSheet;
gbSetPopUp: TGroupBox;
rbPopUpShowAsXStatus: TRadioButton;
rbPopUpPersonalSettings: TRadioButton;
chkShowPopups: TCheckBox;
gbPopUp: TGroupBox;
edtPopUp: TMemo;
btnPopUpPreview: TBitBtn;
btnPopUpTemplates: TBitBtn;
btnPopUpSyntax: TBitBtn;
btnPopUpDefault: TBitBtn;
chkShowPopUpIfChangeInfo: TCheckBox;
gbSpecContact: TGroupBox;
lblSpecCntLine1: TLabel;
edtSpecCntLine1: TMemo;
btnSpecCntDefault: TBitBtn;
btnSpecCntLine1Templates: TBitBtn;
btnSpecCntLine2Templates: TBitBtn;
btnSpecCntPreview: TBitBtn;
btnSpecCntSyntax: TBitBtn;
edtSpecCntLine2: TMemo;
chkSpecCntLine1ScrollText: TCheckBox;
chkSpecCntLine2ScrollText: TCheckBox;
chkSpecCntShowLine2: TCheckBox;
tsExtSources: TTabSheet;
gbExtSourceOptions: TGroupBox;
chkLoadSongsExternal: TCheckBox;
chkShowCovers: TCheckBox;
chkSaveCovers: TCheckBox;
rbProxyQIPConf: TRadioButton;
rbProxyManualConf: TRadioButton;
rbNoProxy: TRadioButton;
procedure btnAboutClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnApplyClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure miTemplates_ValuesClick(Sender: TObject);
procedure miTemplates_TextsClick(Sender: TObject);
procedure miTemplates_CapitalFollowingLetterClick(Sender: TObject);
procedure cmbSkinChange(Sender: TObject);
procedure udUpdaterIntervalClick(Sender: TObject; Button: TUDBtnType);
procedure lblSkinEmailClick(Sender: TObject);
procedure lblTransEmailClick(Sender: TObject);
procedure lblTransURLClick(Sender: TObject);
procedure lblSkinWebClick(Sender: TObject);
procedure btnXStatusDefaultClick(Sender: TObject);
procedure btnUpdaterCheckUpdateClick(Sender: TObject);
procedure lstMenuClick(Sender: TObject);
procedure btnEqualizerSetupClick(Sender: TObject);
procedure chkEnableEqualizerClick(Sender: TObject);
procedure lstMenuDrawItem(Control: TWinControl; Index: Integer; Rect: TRect;
State: TOwnerDrawState);
procedure MeasureMenu(Sender: TObject;
ACanvas: TCanvas; var Width, Height: Integer);
procedure DrawMenu(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; Selected: Boolean);
procedure cmbLangsChange(Sender: TObject);
procedure GetOffHotKey(Sender: TObject);
procedure GetHotKeysActivate(Sender: TObject);
procedure btnXStatusPreviewClick(Sender: TObject);
procedure btnSyntaxClick(Sender: TObject);
procedure lstMenuMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure rbPopUpPersonalSettingsClick(Sender: TObject);
procedure rbPopUpShowAsXStatusClick(Sender: TObject);
procedure btnPopUpPreviewClick(Sender: TObject);
procedure chkShowPopupsClick(Sender: TObject);
procedure btnXStatusTitleTemplatesMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure btnXStatusTextTemplatesMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure btnPopUpDefaultClick(Sender: TObject);
procedure btnXStatusTitleTemplatesClick(Sender: TObject);
procedure btnXStatusTextTemplatesClick(Sender: TObject);
procedure btnPopUpTemplatesClick(Sender: TObject);
procedure chkEnableXStatusClick(Sender: TObject);
procedure btnSpecCntLine1TemplatesClick(Sender: TObject);
procedure btnSpecCntLine2TemplatesClick(Sender: TObject);
procedure btnSpecCntPreviewClick(Sender: TObject);
procedure btnSpecCntDefaultClick(Sender: TObject);
procedure lblSkinEmailMouseEnter(Sender: TObject);
procedure lblSkinWebMouseEnter(Sender: TObject);
procedure lblSkinWebMouseLeave(Sender: TObject);
procedure lblSkinEmailMouseLeave(Sender: TObject);
procedure lblTransEmailMouseEnter(Sender: TObject);
procedure lblTransEmailMouseLeave(Sender: TObject);
procedure lblTransURLMouseLeave(Sender: TObject);
procedure lblTransURLMouseEnter(Sender: TObject);
procedure chkShowCoversClick(Sender: TObject);
procedure PridejMenu;
procedure chkUseProxyServerClick(Sender: TObject);
procedure rbProxyManualConfClick(Sender: TObject);
procedure rbProxyQIPConfClick(Sender: TObject);
procedure rbNoProxyClick(Sender: TObject);
procedure chkUseHotKeysClick(Sender: TObject);
procedure chkUpdaterCheckingUpdatesClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure ShowSkinInfo;
procedure ShowLanguageInfo;
end;
var
frmOptions: TfrmOptions;
TemplatesValues : TStringList;
TemplatesValuesInfo : TStringList;
pmTemplates_Type : Integer;
TemplatesTexts : TStringList;
TemplatesTextsInfo : TStringList;
implementation
uses General, IniFiles, UpdaterUnit, TextSearch, Convs, Drawing,
u_lang_ids,
u_qip_plugin,
uLNG,
uSuperReplace,
uToolTip,
uComments,
uTheme,
uEqualizer,
uLinks,
uINI,
uImage,
uIcon;
{$R *.dfm}
procedure TfrmOptions.udUpdaterIntervalClick(Sender: TObject;
Button: TUDBtnType);
begin
edtUpdaterInterval.Text := IntToStr( udUpdaterInterval.Position );
end;
procedure TfrmOptions.ShowSkinInfo;
var sAuthor, sEmail, sURL, sTrans, sTransInfo, sVersion: WideString;
iFS, iFS1, iFS2: Integer;
INI : TIniFile;
begin
INI := TiniFile.Create(PluginDllPath +
'Skins\' + cmbSkin.Text + '\skin.ini');
sTrans := INIReadStringUTF8(INI, 'Info', 'Author', LNG('Texts','unknown', 'unknown'));
sVersion := INIReadStringUTF8(INI, 'Info', 'Version', LNG('Texts','unknown', 'unknown'));
INIFree(INI);
iFS := StrPosE(sTrans,' [',1,False);
sAuthor := Copy(sTrans, 1, iFS);
sTransInfo := FoundStr(sTrans, ' [', ']', 1, iFS, iFS1, iFS2);
sEmail := FoundStr(sTransInfo, 'EMAIL="', '"', 1, iFS, iFS1, iFS2);
sURL := FoundStr(sTransInfo, 'URL="', '"', 1, iFS, iFS1, iFS2);
lblSkinAuthor.Caption := sAuthor;
lblSkinVersion.Caption := sVersion;
sEmail := Trim(sEmail);
sURL := Trim(sURL);
if sEmail<>'' then
begin
lblSkinEmail.Enabled := True;
lblSkinEmail.Caption := sEmail;
end
else
begin
lblSkinEmail.Enabled := False;
lblSkinEmail.Caption := LNG('Texts','unknown', 'unknown');
end;
if sURL<>'' then
begin
lblSkinWeb.Enabled := True;
lblSkinWeb.Caption := sURL;
end
else
begin
lblSkinWeb.Enabled := False;
lblSkinWeb.Caption := LNG('Texts','unknown', 'unknown');
end;
end;
procedure TfrmOptions.ShowLanguageInfo;
var sAuthor, sEmail, sURL, sTrans, sTransInfo, sVersion, sLang: WideString;
iFS, iFS1, iFS2: Integer;
INI : TIniFile;
begin
if Copy(cmbLangs.Text,1,1)='<' then
INI := TIniFile.Create(PluginDllPath +
'Langs\' + QIPInfiumLanguage + '.lng')
else
INI := TIniFile.Create(PluginDllPath +
'Langs\' + cmbLangs.Text + '.lng');
sTrans := INIReadStringUTF8(INI, 'Info', 'Translator', LNG('Texts','unknown', 'unknown'));
sVersion := INIReadStringUTF8(INI, 'Info', 'Version', '0.0.0');
INIFree(INI);
sLang := PluginLanguage;
PluginLanguage := cmbLangs.Text;
if sVersion < PluginVersionWithoutBuild then
lblLanguageVersion.Caption := '(' + LNG('FORM Options', 'Language.VersionError', 'version of translation is not actual') + ')'
else
lblLanguageVersion.Caption := '';
PluginLanguage := sLang;
lblLanguageVersion.Left := cmbLangs.Left + cmbLangs.Width + 4;
iFS := StrPosE(sTrans,' [',1,False);
sAuthor := Copy(sTrans, 1, iFS);
sTransInfo := FoundStr(sTrans, ' [', ']', 1, iFS, iFS1, iFS2);
sEmail := FoundStr(sTransInfo, 'EMAIL="', '"', 1, iFS, iFS1, iFS2);
sURL := FoundStr(sTransInfo, 'URL="', '"', 1, iFS, iFS1, iFS2);
lblTransAuthor.Caption := sAuthor;
sEmail := Trim(sEmail);
sURL := Trim(sURL);
if sEmail<>'' then
begin
lblTransEmail.Enabled := True;
lblTransEmail.Caption := sEmail;
end
else
begin
lblTransEmail.Enabled := False;
lblTransEmail.Caption := LNG('Texts','unknown', 'unknown');
end;
if sURL<>'' then
begin
lblTransURL.Enabled := True;
lblTransURL.Caption := sURL;
end
else
begin
lblTransURL.Enabled := False;
lblTransURL.Caption := LNG('Texts','unknown', 'unknown');
end;
end;
procedure TfrmOptions.btnAboutClick(Sender: TObject);
begin
OpenAbout;
end;
procedure TfrmOptions.btnApplyClick(Sender: TObject);
var
INI : TIniFile;
ActualMenu: Integer;
begin
(* X-Status *)
XStatus_Boolean := chkEnableXStatus.Checked;
EnDisXStatus(BoolToInt(XStatus_Boolean), XSTATUS_MODE_SILENCE);
if rbChangeIfMusic.Checked = True then
XStatus_Type := 1
else
XStatus_Type := 2;
if not (XStatus_Title = edtXStatusTitle.Text) then
ChangeXStatus := True;
if not (XStatus_Text = edtXStatusText.Text) then
ChangeXStatus := True;
XStatus_Title := edtXStatusTitle.Text;
XStatus_Text := edtXStatusText.Text;
(* *)
if rbPopUpShowAsXStatus.Checked = True then
PopupType := 1
else
PopupType := 2;
ShowPopups := chkShowPopups.Checked;
PopupText := edtPopup.Text;
ShowPopUpIfChangeInfo := chkShowPopUpIfChangeInfo.Checked;
UseQIPMute := chkUseQIPMute.Checked;
ShowComments := chkShowComments.Checked;
LoadSongsExternal := chkLoadSongsExternal.Checked;
ShowCover := chkShowCovers.Checked;
SaveCover := chkSaveCovers.Checked;
if (not LoadSongsExternal) and RadioExternalInfo then
begin
iSong := '';
iBitrate := '';
iRadio := LNG('PLAYER', 'Connecting', 'Connecting...');
iCover := '';
CoverFile := iCover;
end;
SaveLastStream := chkSaveLastStream.Checked;
if rbNoProxy.Checked = True then
Proxy_Mode := 0
else
if rbProxyQIPConf.Checked = True then
Proxy_Mode := 1
else
if rbProxyManualConf.Checked = True then
Proxy_Mode := 2;
Proxy_Server := edtProxyServer.Text;
PlayOnStart := chkPlayOnStart.Checked;
EqualizerEnabled := chkEnableEqualizer.Checked;
CheckUpdates := chkUpdaterCheckingUpdates.Checked;
CheckBetaUpdates := chkAnnounceBeta.Checked;
CheckUpdatesInterval := ConvStrToInt( edtUpdaterInterval.Text );
PluginLanguage := cmbLangs.Text;
HotKeyEnabled := chkUseHotKeys.Checked;
AutoStatusFFC := chkStatusFFCAuto.ItemIndex;
AutoStatusEvil := chkStatusEvilAuto.ItemIndex;
AutoStatusDepres := chkStatusDepresAuto.ItemIndex;
AutoStatusAtHome := chkStatusAtHomeAuto.ItemIndex;
AutoStatusAtWork := chkStatusAtWorkAuto.ItemIndex;
AutoStatusLunch := chkStatusLunchAuto.ItemIndex;
AutoStatusAway := chkStatusAwayAuto.ItemIndex;
AutoStatusNA := chkStatusNAAuto.ItemIndex;
AutoStatusOccupied := chkStatusOccupiedAuto.ItemIndex;
AutoStatusDND := chkStatusDNDAuto.ItemIndex;
AutoStatusOnline := chkStatusOnlineAuto.ItemIndex;
AutoStatusInvisible := chkStatusInvisibleAuto.ItemIndex;
AutoStatusOffline := chkStatusOfflineAuto.ItemIndex;
AutoUseWherePlaying := chkAutoUseWherePlaying.Checked;
SpecCntLine1Text := edtSpecCntLine1.Text;
SpecCntLine2Text := edtSpecCntLine2.Text;
SpecCntLine1ScrollText := chkSpecCntLine1ScrollText.Checked;
SpecCntLine2ScrollText := chkSpecCntLine2ScrollText.Checked;
SpecCntShowLine2 := chkSpecCntShowLine2.Checked;
HotKeyFMtune := HotKey1.HotKey;
HotKeyVolumeUp := HotKey3.HotKey;
HotKeyVolumeDown := HotKey4.HotKey;
HotKeyMute := HotKey2.HotKey;
HotKeyStationNext := HotKey5.HotKey;
HotKeyStationPrev := HotKey6.HotKey;
HotKeyEnableDisableXStatus := HotKey7.HotKey;
INIGetProfileConfig(INI);
INIWriteBool(INI, 'Conf', 'CheckUpdates', CheckUpdates);
INIWriteInteger(INI, 'Conf', 'CheckUpdatesInterval', CheckUpdatesInterval);
INIWriteBool(INI, 'Conf', 'CheckBetaUpdates', CheckBetaUpdates);
INIWriteStringUTF8(INI, 'Conf', 'Language', PluginLanguage);
PluginTheme.Name := cmbSkin.Text;
INIWriteStringUTF8(INI, 'Conf', 'Skin', PluginTheme.Name );
OpenTheme;
INIWriteBool(INI, 'Conf', 'UseQIPMute', UseQIPMute);
INIWriteBool(INI, 'Conf', 'PlayOnStart', PlayOnStart);
INIWriteBool(INI, 'Conf', 'SaveLastStream', SaveLastStream);
INIWriteBool(INI, 'Conf', 'ShowComments', ShowComments);
INIWriteBool(INI, 'Conf', 'LoadSongsExternal', LoadSongsExternal);
INIWriteBool(INI, 'Conf', 'ShowCover', ShowCover);
INIWriteBool(INI, 'Conf', 'SaveCover', SaveCover);
INIWriteBool(INI, 'Conf', 'HotKey', HotKeyEnabled);
INIWriteInteger(INI, 'Conf', 'HotKeyFMtune', HotKeyFMtune) ;
INIWriteInteger(INI, 'Conf', 'HotKeyVolumeUp', HotKeyVolumeUp) ;
INIWriteInteger(INI, 'Conf', 'HotKeyVolumeDown', HotKeyVolumeDown) ;
INIWriteInteger(INI, 'Conf', 'HotKeyMute', HotKeyMute) ;
INIWriteInteger(INI, 'Conf', 'HotKeyStationNext', HotKeyStationNext) ;
INIWriteInteger(INI, 'Conf', 'HotKeyStationPrev', HotKeyStationPrev) ;
INIWriteInteger(INI, 'Conf', 'HotKeyEnableDisableXStatus', HotKeyEnableDisableXStatus) ;
INIWriteBool(INI, 'XStatus', 'Enabled', XStatus_Boolean);
INIWriteInteger(INI, 'XStatus', 'Type', XStatus_Type);
INIWriteStringUTF8(INI, 'XStatus', 'Title', XStatus_Title );
INIWriteStringUTF8(INI, 'XStatus', 'Text', XStatus_Text );
INIWriteBool(INI, 'Popup', 'Enabled', ShowPopups);
INIWriteInteger(INI, 'Popup', 'Type', PopupType);
INIWriteStringUTF8(INI, 'Popup', 'Text', PopupText );
INIWriteBool(INI, 'Popup', 'ShowPopUpIfChangeInfo', ShowPopUpIfChangeInfo);
INIWriteInteger(INI, 'Proxy', 'Mode', Proxy_Mode);
case Proxy_Mode of
0,
1: ;
2: INIWriteStringUTF8(INI, 'Proxy', 'Server', Proxy_Server );
end;
INIWriteBool(INI, 'Equalizer', 'Enabled', EqualizerEnabled);
INIWriteBool(INI, 'Conf', 'AutoOnOffUseWherePlaying', AutoUseWherePlaying);
INIWriteInteger(INI, 'Conf', 'AutoOnOffFFC', AutoStatusFFC );
INIWriteInteger(INI, 'Conf', 'AutoOnOffEvil', AutoStatusEvil );
INIWriteInteger(INI, 'Conf', 'AutoOnOffDepres', AutoStatusDepres );
INIWriteInteger(INI, 'Conf', 'AutoOnOffAtHome', AutoStatusAtHome );
INIWriteInteger(INI, 'Conf', 'AutoOnOffAtWork', AutoStatusAtWork );
INIWriteInteger(INI, 'Conf', 'AutoOnOffLunch', AutoStatusLunch );
INIWriteInteger(INI, 'Conf', 'AutoOnOffAway', AutoStatusAway );
INIWriteInteger(INI, 'Conf', 'AutoOnOffNA', AutoStatusNA );
INIWriteInteger(INI, 'Conf', 'AutoOnOffOccupied', AutoStatusOccupied );
INIWriteInteger(INI, 'Conf', 'AutoOnOffDND', AutoStatusDND );
INIWriteInteger(INI, 'Conf', 'AutoOnOffOnline', AutoStatusOnline );
INIWriteInteger(INI, 'Conf', 'AutoOnOffInvisible', AutoStatusInvisible );
INIWriteInteger(INI, 'Conf', 'AutoOnOffOffline', AutoStatusOffline );
INIWriteBool(INI, 'SpecCnt', 'ShowLine2', SpecCntShowLine2 );
INIWriteStringUTF8(INI, 'SpecCnt', 'L1Text', SpecCntLine1Text );
INIWriteStringUTF8(INI, 'SpecCnt', 'L2Text', SpecCntLine2Text );
INIWriteBool(INI, 'SpecCnt', 'L1ScrollText', SpecCntLine1ScrollText );
INIWriteBool(INI, 'SpecCnt', 'L2ScrollText', SpecCntLine2ScrollText );
INIFree(INI);
HotKeysDeactivate;
QIPPlugin.RemoveSpecContact( UniqContactId );
QIPPlugin.AddSpecContact( UniqContactId, SpecCntHeight );
QIPPlugin.RedrawSpecContact(UniqContactId);
ActualMenu := lstMenu.ItemIndex;
FormShow(Sender);
if HotKeyEnabled then
HotKeysActivate;
lstMenu.ItemIndex := ActualMenu;
pnlText.Caption := lstMenu.Items[ActualMenu];
pgcOptions.ActivePageIndex := ActualMenu;
AddComments(FOptions);
end;
procedure TfrmOptions.btnCancelClick(Sender: TObject);
begin
Close;
end;
procedure TfrmOptions.btnEqualizerSetupClick(Sender: TObject);
begin
OpenEqualizer;
FEqualizer.chkEnableEqualizer.Enabled := False;
end;
procedure TfrmOptions.btnOKClick(Sender: TObject);
begin
btnApplyClick(Sender);
Close;
end;
procedure TfrmOptions.btnSpecCntDefaultClick(Sender: TObject);
begin
edtSpecCntLine1.Text := LNG('DEFAULT', 'SpecCnt.Line1', '%station%');
edtSpecCntLine2.Text := LNG('DEFAULT', 'SpecCnt.Line2', '%song%');
end;
procedure TfrmOptions.btnSpecCntLine1TemplatesClick(Sender: TObject);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 4;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.btnSpecCntLine2TemplatesClick(Sender: TObject);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 5;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.btnSpecCntPreviewClick(Sender: TObject);
var
sText, sTitle: WideString;
begin
sTitle := edtSpecCntLine1.Text;
sTitle := StringReplace(sTitle, '%station%', 'BBC Radio', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%genre%', 'Pop', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%song%', 'Haddaway - What is Love', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%format%', '128kbps', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%language%', 'English', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%stationweb%', 'http://www.bbc.co.uk', [rfReplaceAll, rfIgnoreCase]);
sTitle := ReplCondBlocks(sTitle);
sText := edtSpecCntLine2.Text;
sText := StringReplace(sText, '%station%', 'BBC Radio', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%genre%', 'pop', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%song%', 'Haddaway - What is Love', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%format%', '128kbps', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%language%', 'English', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%stationweb%', 'http://www.bbc.co.uk', [rfReplaceAll, rfIgnoreCase]);
sText := ReplCondBlocks(sText);
TaskMessageDlg(sTitle, sText, mtInformation, [mbOK], 0);
end;
procedure TfrmOptions.btnSyntaxClick(Sender: TObject);
var
sText: WideString;
begin
sText := LNG('FORM Options', 'XStatus.XStatus.Syntax', 'Conditional blocks are special blocks, the text from which will be shown only at the filled data. It gives possibility to show the text defined by you (eg. song) only if the information on an album is brought in a tag[br][br]Example: {{%song%= (listening %song%)}}=I am listening to radio[br][br]Before change of the X-Status plugin checks information in %song% and if not null that will show it: listening %song%. If data is not present - the plugin will not show all conditional block[br][br]Syntax of the conditional block: {{tag=info}}[br][br]''{{'' - the beginning of the conditional block[br][br]''tag'' - a template from the list[br][br]''='' - a separator[br][br]''info'' - all text which will be shown in the presence of the information in a tag[br][br]''}}'' - the end of the conditional block[br][br]Examples:[br][br]');
sText := sText + '{{%song%=[%song%]}}[br]';
sText := sText + '{{%genre%=genre is %genre%}}[br]';
sText := sText + 'Now Listening: {{%station%=%station%}} {{%song%=- %song%}}[br]';
sText := TagsReplace(sText);
MessageDlg(sText, mtInformation, [mbOK], 0);
end;
procedure TfrmOptions.btnXStatusPreviewClick(Sender: TObject);
var
sText, sTitle: WideString;
begin
sTitle := edtXStatusTitle.Text;
sTitle := StringReplace(sTitle, '%station%', 'BBC Radio', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%genre%', 'Pop', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%song%', 'Haddaway - What is Love', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%format%', '128kbps', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%language%', 'English', [rfReplaceAll, rfIgnoreCase]);
sTitle := StringReplace(sTitle, '%stationweb%', 'http://www.bbc.co.uk', [rfReplaceAll, rfIgnoreCase]);
sTitle := ReplCondBlocks(sTitle);
sText := edtXStatusText.Text;
sText := StringReplace(sText, '%station%', 'BBC Radio', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%genre%', 'pop', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%song%', 'Haddaway - What is Love', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%format%', '128kbps', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%language%', 'English', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%stationweb%', 'http://www.bbc.co.uk', [rfReplaceAll, rfIgnoreCase]);
sText := ReplCondBlocks(sText);
TaskMessageDlg(sTitle, sText, mtInformation, [mbOK], 0);
end;
procedure TfrmOptions.btnUpdaterCheckUpdateClick(Sender: TObject);
begin
CheckNewVersion(True);
end;
procedure TfrmOptions.btnXStatusDefaultClick(Sender: TObject);
begin
edtXStatusTitle.Text := LNG('DEFAULT', 'XStatus.Title', 'I am listening to radio');
edtXStatusText.Text := LNG('DEFAULT', 'XStatus.Text', '%station%');
end;
procedure TfrmOptions.btnXStatusTextTemplatesClick(Sender: TObject);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 2;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.btnXStatusTextTemplatesMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 2;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.btnXStatusTitleTemplatesClick(Sender: TObject);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 1;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.btnXStatusTitleTemplatesMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 1;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.btnPopUpDefaultClick(Sender: TObject);
begin
edtPopUp.Text := LNG('DEFAULT', 'PopUp.Text', '%station%');
end;
procedure TfrmOptions.btnPopUpPreviewClick(Sender: TObject);
var
sText: WideString;
begin
sText := edtPopUp.Text;
sText := StringReplace(sText, '%station%', 'BBC Radio', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%genre%', 'pop', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%song%', 'Haddaway - What is Love', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%format%', '128kbps', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%language%', 'English', [rfReplaceAll, rfIgnoreCase]);
sText := StringReplace(sText, '%stationweb%', 'http://www.bbc.co.uk', [rfReplaceAll, rfIgnoreCase]);
sText := ReplCondBlocks(sText);
TaskMessageDlg('FMtune', sText, mtInformation, [mbOK], 0);
end;
procedure TfrmOptions.btnPopUpTemplatesClick(Sender: TObject);
var
where: TPoint;
begin
where := Mouse.CursorPos;
pmTemplates_Type := 3;
pmTemplates.Popup(where.X,where.Y);
end;
procedure TfrmOptions.chkEnableEqualizerClick(Sender: TObject);
begin
EqualizerEnabled := chkEnableEqualizer.Checked;
if chkEnableEqualizer.Checked then
begin
btnEqualizerSetup.Enabled := True;
if EqualizerToRadioGenre then
begin
if Stations.Count - 1 >= Radio_StationID then
ActiveEqualizer(TStation(Stations.Objects[Radio_StationID]).Genre)
end
else
ActiveEqualizer(EqualizerOption);
end
else
begin
btnEqualizerSetup.Enabled := False;
DeactiveEqualizer;
end;
end;
procedure TfrmOptions.chkEnableXStatusClick(Sender: TObject);
var
i: integer;
begin
with TCheckBox(Sender) do
begin
for i:=0 to gbXStatus.ControlCount-1 do
gbXStatus.Controls[i].Enabled := Checked;
rbChangeIfMusic.Enabled := Checked;
rbChangeIfAny.Enabled := Checked;
end;
end;
procedure TfrmOptions.chkShowCoversClick(Sender: TObject);
begin
//chkSaveCovers.Enabled := chkShowCovers.Checked;
end;
procedure TfrmOptions.chkShowPopupsClick(Sender: TObject);
var
i: integer;
begin
with TCheckBox(Sender) do
begin
if Checked then
for i:=0 to gbPopUp.ControlCount-1 do
gbPopUp.Controls[i].Enabled := rbPopUpPersonalSettings.Checked
else
for i:=0 to gbPopUp.ControlCount-1 do
gbPopUp.Controls[i].Enabled := Checked;
rbPopUpShowAsXStatus.Enabled := Checked;
rbPopUpPersonalSettings.Enabled := Checked;
//chkShowPopUpIfChangeInfo.Enabled := Checked;
end;
end;
procedure TfrmOptions.chkUpdaterCheckingUpdatesClick(Sender: TObject);
var
i: integer;
begin
with TCheckBox(Sender) do
begin
for i := 0 to gbUpdater.ControlCount-1 do
gbUpdater.Controls[i].Enabled := Checked;
Enabled := True;
btnUpdaterCheckUpdate.Enabled := True;
// pokud je plugin v testovací fázi, jsou zapnuty beta aktualizace
if Trim(PLUGIN_VER_BETA) <> '' then
chkAnnounceBeta.Enabled := False;
end;
end;
procedure TfrmOptions.chkUseHotKeysClick(Sender: TObject);
var
i: integer;
begin
with TCheckBox(Sender) do
begin
for i := 0 to gbHotKeys.ControlCount-1 do
gbHotKeys.Controls[i].Enabled := Checked;
Enabled := True;
end;
end;
procedure TfrmOptions.chkUseProxyServerClick(Sender: TObject);
var
i: integer;
begin
with TCheckBox(Sender) do
begin
for i:=0 to gbProxy.ControlCount-1 do
gbProxy.Controls[i].Enabled := Checked;
Enabled := True;
rbProxyManualConfClick(rbProxyManualConf);
end;
end;
procedure TfrmOptions.cmbLangsChange(Sender: TObject);
begin
ShowLanguageInfo;
end;
procedure TfrmOptions.cmbSkinChange(Sender: TObject);
begin
ShowSkinInfo;
end;
procedure TfrmOptions.FormClose(Sender: TObject; var Action: TCloseAction);
begin
OptionsIsShow := False;
FOptions.Destroy;
end;
procedure TfrmOptions.PridejMenu;
var
hLibraryPics : THandle;
I, Iact : Byte;
begin
hLibraryPics := LoadLibrary( PWideChar(Pics) );
PluginSkin.General.Icon := LoadImageAsIconFromResource(48, hLibraryPics);
PluginSkin.Advanced.Icon := LoadImageAsIconFromResource(49, hLibraryPics);
PluginSkin.Skin.Icon := LoadImageAsIconFromResource(50, hLibraryPics);
PluginSkin.HotKeys.Icon := LoadImageAsIconFromResource(51, hLibraryPics);
PluginSkin.Connect.Icon := LoadImageAsIconFromResource(52, hLibraryPics);
PluginSkin.PopUp.Icon := LoadImageAsIconFromResource(53, hLibraryPics);
PluginSkin.ExtSource.Icon := LoadImageAsIconFromResource(54, hLibraryPics);
FreeLibrary(hLibraryPics);
// zde se definuje pořadí karet
{ první položka }
I := 0;
Iact := TTabSheet(pgcOptions.FindChildControl('tsGeneral')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.General.Icon, I);
pgcOptions.Pages[Iact].Caption := QIPPlugin.GetLang(LI_GENERAL);
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ druhá položka }
I := 1;
Iact := TTabSheet(pgcOptions.FindChildControl('tsAdvanced')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.Advanced.Icon, I);
pgcOptions.Pages[Iact].Caption := LNG('FORM Options', 'Advanced', 'Advanced');
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ třetí položka }
I := 2;
Iact := TTabSheet(pgcOptions.FindChildControl('tsPopUp')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.PopUp.Icon, I);
pgcOptions.Pages[Iact].Caption := LNG('FORM Options', 'PopUp', 'Popup');
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ čtvrtá položka }
I := 3;
Iact := TTabSheet(pgcOptions.FindChildControl('tsCL')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.Skin.Icon, I);
pgcOptions.Pages[Iact].Caption := QIPPlugin.GetLang(LI_CONTACT_LIST);
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ pátá položka }
I := 4;
Iact := TTabSheet(pgcOptions.FindChildControl('tsXStatus')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.ST_away.Icon, I);
pgcOptions.Pages[Iact].Caption := LNG('FORM Options', 'XStatus', 'X-Status');
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ šestá položka }
I := 5;
Iact := TTabSheet(pgcOptions.FindChildControl('tsHotKeys')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.HotKeys.Icon, I);
pgcOptions.Pages[Iact].Caption := QIPPlugin.GetLang(LI_HOT_KEYS);
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ sedmá položka }
I := 6;
Iact := TTabSheet(pgcOptions.FindChildControl('tsExtSources')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.ExtSource.Icon, I);
pgcOptions.Pages[Iact].Caption := LNG('FORM Options', 'ExternalSources', 'External sources');
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
{ osmá položka }
I := 7;
Iact := TTabSheet(pgcOptions.FindChildControl('tsConnection')).PageIndex;
AddIconToStringList(PluginSkin.OptionsIcons, PluginSkin.Connect.Icon, I);
pgcOptions.Pages[Iact].Caption := QIPPlugin.GetLang(LI_CONNECTION);
pgcOptions.Pages[Iact].ImageIndex := I;
pgcOptions.Pages[Iact].PageIndex := I;
end;
procedure TfrmOptions.FormShow(Sender: TObject);
var INI : TIniFile;
idx : Integer;
rec: TSearchRec;
LngPath: WideString;
NewItem: TMenuItem;
sText: WideString;
sAuthor, sEmail, sURL, sTrans, sVersion, sTransInfo: WideString;
iFS: Integer;
begin
PridejMenu;
Color := frmBgColor;
// vytvoření šablon
TemplatesValues := TStringList.Create;
TemplatesValues.Clear;
TemplatesTexts := TStringList.Create;
TemplatesTexts.Clear;
TemplatesValuesInfo := TStringList.Create;
TemplatesValuesInfo.Clear;
TemplatesTextsInfo := TStringList.Create;
TemplatesTextsInfo.Clear;
//*** Nastavení jazyka ***
//****************************************
//--- komentáře
chkUpdaterCheckingUpdates.Hint := LNG('COMMENTS', 'CheckingUpdates', 'Plugin checks the availability of new version (of program) in the given interval.');
chkAnnounceBeta.Hint := LNG('COMMENTS', 'CheckBetaUpdates', 'Checking availability of beta version of plugin. This choice is automatically selected, if you have beta version of plugin.');
chkSaveLastStream.Hint := LNG('COMMENTS', 'SaveLastStream', 'By setting another format, this one sets as default for selected station.');
chkPlayOnStart.Hint := LNG('COMMENTS', 'PlayOnStart', 'Start playing the last known station at QIP start.');
chkShowPopupIfChangeInfo.Hint := LNG('COMMENTS', 'ShowPopupIfChangeInfo', 'Information window is shown everytime, when any information about radio is changed.');
chkEnableXStatus.Hint := LNG('COMMENTS', 'ShowXStatus', 'X-status is a status, which is shown to other users. With it''s activation the plugin changes it according to other settings.');
chkSaveCovers.Hint := LNG('COMMENTS', 'SaveCover', 'Zapnutím této volby se nestahují již stažené obrázky alb a tak při často opakujících písničkách zbytečně nestahujete.');
lblXStatusTitle.Hint := LNG('COMMENTS', 'XStatusTitleMaxChars', 'Maximální počet znaků je 20');
//---
btnAbout.Caption := LNG('FORM Options', 'About', 'About plugin...');
//--- nastavení Updater
gbUpdater.Caption := LNG('FORM Options', 'General.Updates', 'Updater');
chkUpdaterCheckingUpdates.Caption := LNG('FORM Options', 'General.CheckingUpdates', 'Checking updates');
lblUpdaterInterval.Caption := LNG('FORM Options', 'General.CheckingUpdates.Interval', 'Interval') + ':';
lblUpdaterIntervalUnit.Caption := LNG('FORM Options', 'General.CheckingUpdates.Interval.Unit', 'hours');
btnUpdaterCheckUpdate.Caption := QIPPlugin.GetLang(LI_CHECK);
chkAnnounceBeta.Caption := LNG('FORM Options', 'General.CheckingUpdates.Beta', 'Announce beta version');
edtUpdaterInterval.Left := lblUpdaterInterval.Left + lblUpdaterInterval.Width + 4;
udUpdaterInterval.Left := edtUpdaterInterval.Left + edtUpdaterInterval.Width;
lblUpdaterIntervalUnit.Left := udUpdaterInterval.Left + udUpdaterInterval.Width + 4;
btnUpdaterCheckUpdate.Left := lblUpdaterIntervalUnit.Left + lblUpdaterIntervalUnit.Width + 4;
//--- nastavení Language
gbLanguage.Caption := QIPPlugin.GetLang(LI_LANGUAGE);
lblLanguage.Caption := QIPPlugin.GetLang(LI_LANGUAGE)+':';
lblLanguageRem.Caption := LNG('FORM Options', 'Language.Rem', 'rem: Partial translation is take from QIP.');
lblInfoTransAuthor.Caption := QIPPlugin.GetLang(LI_AUTHOR) + ':';
lblInfoTransEmail.Caption := QIPPlugin.GetLang(LI_EMAIL) + ':';
lblInfoTransWeb.Caption := QIPPlugin.GetLang(LI_WEB_SITE) + ':';
//---
//--- nastavení Advanced
gbAdvancedOptions.Caption := QIPPlugin.GetLang(LI_OPTIONS);
chkUseQIPMute.Caption := LNG('FORM Options', 'Advanced.UseQIPMute', 'Use QIP mute sound');
chkPlayOnStart.Caption := LNG('FORM Options', 'Advanced.PlayOnStart', 'Play on start');
chkEnableEqualizer.Caption := LNG('FORM Options', 'Advanced.EnableEqualizer', 'Enable Equalizer');
btnEqualizerSetup.Caption := LNG('FORM Options', 'Advanced.EqualizerSetup', 'Setup');
chkSaveLastStream.Caption := LNG('FORM Options', 'Advanced.SaveLastStream', 'Save last station stream');
chkShowComments.Caption := LNG('FORM Options', 'Advanced.ShowComments', 'Show comments');
//---
//--- nastavení PopUp
gbSetPopUp.Caption := QIPPlugin.GetLang(LI_OPTIONS);
gbPopUp.Caption := LNG('FORM Options', 'PopUp', 'Popup') + ': ' + LNG('FORM Options', 'PopUp.PersonalSettings', 'Personal settings');
chkShowPopups.Caption := LNG('FORM Options', 'Advanced.ShowPopups', 'Show popups');
chkShowPopupIfChangeInfo.Caption:= LNG('FORM Options', 'PopUp.ShowPopupIfChangeInfo', 'Show popup window everytime, when any information is changed.');
rbPopUpShowAsXStatus.Caption := LNG('FORM Options', 'PopUp.ShowAsXStatus', 'Show as X-Status');
rbPopUpPersonalSettings.Caption := LNG('FORM Options', 'PopUp.PersonalSettings', 'Personal settings');
btnPopUpPreview.Caption := LNG('FORM Options', 'XStatus.XStatus.Preview', 'Preview');
btnPopUpTemplates.Caption := LNG('FORM Options', 'XStatus.XStatus.Templates', 'Templates');
btnPopUpDefault.Caption := LNG('FORM Options', 'XStatus.XStatus.Default', 'Default');
btnPopUpSyntax.Caption := LNG('FORM Options', 'Connection.Proxy.Syntax', 'Syntax');
//---
//--- nastavení Skin
gbSkin.Caption := LNG('FORM Options', 'Skin', 'Skin');
lblInfoSkinVersion.Caption := QIPPlugin.GetLang(LI_VERSION) + ':';
lblInfoSkinAuthor.Caption := QIPPlugin.GetLang(LI_AUTHOR) + ':';
lblInfoSkinEmail.Caption := QIPPlugin.GetLang(LI_EMAIL) + ':';
lblInfoSkinWeb.Caption := QIPPlugin.GetLang(LI_WEB_SITE) + ':';
gbSpecContact.Caption := QIPPlugin.GetLang(LI_CONTACT_LIST);
btnSpecCntPreview.Caption := LNG('FORM Options', 'XStatus.XStatus.Preview', 'Preview');
btnSpecCntLine1Templates.Caption := LNG('FORM Options', 'XStatus.XStatus.Templates', 'Templates');
btnSpecCntLine2Templates.Caption := LNG('FORM Options', 'XStatus.XStatus.Templates', 'Templates');
btnSpecCntDefault.Caption := LNG('FORM Options', 'XStatus.XStatus.Default', 'Default');
chkSpecCntLine1ScrollText.Caption := LNG('FORM Options', 'Advanced.ScrollText', 'Scroll text');
chkSpecCntLine2ScrollText.Caption := LNG('FORM Options', 'Advanced.ScrollText', 'Scroll text');
lblSpecCntLine1.Caption := LNG('FORM Options', 'SpecCnt.Line1', 'Line 1')+':';
chkSpecCntShowLine2.Caption := LNG('FORM Options', 'SpecCnt.Line2', 'Line 2')+':';
btnSpecCntSyntax.Caption := LNG('FORM Options', 'Connection.Proxy.Syntax', 'Syntax');
//---
//--- nastavení X-Status
gbXStatusOptions.Caption := QIPPlugin.GetLang(LI_OPTIONS);
chkEnableXStatus.Caption := LNG('FORM Options', 'XStatus.Enable', 'Enable X-Status');
rbChangeIfMusic.Caption := LNG('FORM Options', 'XStatus.ChangeIfMusic', 'Change content if X-Status is "Music"');
rbChangeIfAny.Caption := LNG('FORM Options', 'XStatus.ChangeIfAny', 'Change with any X-Status');
gbXStatus.Caption := LNG('FORM Options', 'XStatus', 'X-Stasus') + ':';
lblXStatusTitle.Caption := LNG('FORM Options', 'XStatus.XStatus.Title', 'Title') + ':';
lblXStatusText.Caption := LNG('FORM Options', 'XStatus.XStatus.Text', 'Text') + ':';
btnXStatusDefault.Caption := LNG('FORM Options', 'XStatus.XStatus.Default', 'Default');
btnXStatusPreview.Caption := LNG('FORM Options', 'XStatus.XStatus.Preview', 'Preview');
btnXStatusTitleTemplates.Caption := LNG('FORM Options', 'XStatus.XStatus.Templates', 'Templates');
btnXStatusTextTemplates.Caption := LNG('FORM Options', 'XStatus.XStatus.Templates', 'Templates');
TemplatesTexts.Add(LNG('FORM Options', 'XStatus.XStatus.TextsInfo.N/A', 'N/A'));
TemplatesTexts.Add(LNG('FORM Options', 'XStatus.XStatus.TextsInfo.NowListening', 'Now listening'));
TemplatesTexts.Add(LNG('FORM Options', 'XStatus.XStatus.TextsInfo.CoolSong', 'cool song'));
miTemplates_Values.Caption := LNG('FORM Options', 'XStatus.XStatus.Menu.Values', 'Values');
miTemplates_Texts.Caption := LNG('FORM Options', 'XStatus.XStatus.Menu.Texts', 'Texts');
miTemplates_CapitalFollowingLetter.Caption := LNG('FORM Options', 'XStatus.XStatus.Menu.CapitalFollowingLetter', 'Capital following letter') + ' %^%';
btnSyntax.Caption := LNG('FORM Options', 'Connection.Proxy.Syntax', 'Syntax');
//---
//--- nastavení On and Off radio
gbAutomaticOnOffRadio.Caption := LNG('FORM Options', 'OnOffRadio.Automatic', 'Automatic On and Off radio');
chkAutoUseWherePlaying.Caption := LNG('FORM Options', 'OnOffRadio.Automatic.UseWherePlaying', 'Use where radio playing');
chkStatusFFCAuto.Clear;
chkStatusEvilAuto.Clear;
chkStatusDepresAuto.Clear;
chkStatusAtHomeAuto.Clear;
chkStatusAtWorkAuto.Clear;
chkStatusLunchAuto.Clear;
chkStatusAwayAuto.Clear;
chkStatusNAAuto.Clear;
chkStatusOccupiedAuto.Clear;
chkStatusDNDAuto.Clear;
chkStatusOnlineAuto.Clear;
chkStatusInvisibleAuto.Clear;
chkStatusOfflineAuto.Clear;
for idx := 0 to 2 do
begin
if idx = 0 then
sText := LNG('FORM Options', 'OnOffRadio.Automatic.0', 'nothing')
else if idx = 1 then
sText := LNG('FORM Options', 'OnOffRadio.Automatic.1', 'radio On')
else if idx = 2 then
sText := LNG('FORM Options', 'OnOffRadio.Automatic.2', 'radio Off');
chkStatusFFCAuto.Items.Add(sText);
chkStatusEvilAuto.Items.Add(sText);
chkStatusDepresAuto.Items.Add(sText);
chkStatusAtHomeAuto.Items.Add(sText);
chkStatusAtWorkAuto.Items.Add(sText);
chkStatusLunchAuto.Items.Add(sText);
chkStatusAwayAuto.Items.Add(sText);
chkStatusNAAuto.Items.Add(sText);
chkStatusOccupiedAuto.Items.Add(sText);
chkStatusDNDAuto.Items.Add(sText);
chkStatusOnlineAuto.Items.Add(sText);
chkStatusInvisibleAuto.Items.Add(sText);
chkStatusOfflineAuto.Items.Add(sText);
end;
//---
//--- nastavení Hot Keys
gbHotKeys.Caption := QIPPlugin.GetLang(LI_HOT_KEYS);
chkUseHotKeys.Caption := LNG('FORM Options', 'HotKeys.Use', 'Use Hot Keys');
lblHotKeyFMtune.Caption := LNG('FORM Options', 'HotKeys.FMtune', 'FMtune') + ':';
lblHotKeyVolumeUp.Caption := LNG('FORM Options', 'HotKeys.VolumeUp', 'Volume Up') + ':';
lblHotKeyVolumeDown.Caption := LNG('FORM Options', 'HotKeys.VolumeDown', 'Volume Down') + ':';
lblHotKeyMute.Caption := LNG('FORM Options', 'HotKeys.Mute', 'Mute') + ':';
lblHotKeyStationNext.Caption := LNG('FORM Options', 'HotKeys.StationNext', 'Station Next') + ':';
lblHotKeyStationPrev.Caption := LNG('FORM Options', 'HotKeys.StationPrev', 'Station Prev') + ':';
lblHotKeyEnableDisableXStatus.Caption := LNG('FORM Options', 'HotKeys.EnableDisableXStatus', 'Enable/Disable X-Status') + ':';
//---
//--- nastavení Conncetion
gbProxy.Caption := QIPPlugin.GetLang(LI_PROXY);
rbNoProxy.Caption := QIPPlugin.GetLang(LI_CON_HAVE_DC_TO_INET);
rbProxyQIPConf.Caption := LNG('FORM Options', 'Connection.ProxyQIP', 'Configuration as QIP');
rbProxyManualConf.Caption := QIPPlugin.GetLang(LI_CON_MANUAL_PROXY);
lblProxyServerInfo.Caption := LNG('FORM Options', 'Connection.Proxy.Syntax', 'Syntax') + ': ' + LNG('FORM Options', 'Connection.Proxy.How', '[user:pass@]server:port');
//---
//--- nastavení Externí zdroje
gbExtSourceOptions.Caption := QIPPlugin.GetLang(LI_OPTIONS);
chkLoadSongsExternal.Caption := LNG('FORM Options', 'ExternalSources.LoadSongsExternal', 'Load songs from external sources');
chkShowCovers.Caption := LNG('FORM Options', 'ExternalSources.ShowCovers', 'Show cover of song');
chkSaveCovers.Caption := LNG('FORM Options', 'ExternalSources.SaveCovers', 'Save cover of song to directory');
//---
//****************************************
//*** Nastavení dalších voleb ***
//****************************************
// nastavení ikonky
Icon := PluginSkin.PluginIcon.Icon;
// nastavení mezery od Vzhled: do výběru skinu
// cmbSkin.Left := lblSkin.Left + lblSkin.Width + 4;
// nastavení hlavičky
Caption := PLUGIN_NAME + ' | ' + QIPPlugin.GetLang(LI_OPTIONS);
// hlavní tlačítka Options
btnOK.Caption := QIPPlugin.GetLang(LI_OK);
btnCancel.Caption := QIPPlugin.GetLang(LI_CANCEL);
btnApply.Caption := QIPPlugin.GetLang(LI_APPLY);
// verze pluginu
lblPluginVersion.Caption := QIPPlugin.GetLang(LI_VERSION) + ' ' + PluginVersion;
lblPluginVersion.Color := BottomLine.Brush.Color;
// časový interval aktualizací
edtUpdaterInterval.Text := IntToStr( CheckUpdatesInterval );
udUpdaterInterval.Position := CheckUpdatesInterval;
chkAnnounceBeta.Checked := CheckBetaUpdates;
// pokud je plugin v testovací fázi, jsou zapnuty beta aktualizace
if Trim(PLUGIN_VER_BETA) <> '' then
begin
chkAnnounceBeta.Enabled := False;
end;
// zjištění zašktrnutí
chkAutoUseWherePlaying.Checked := AutoUseWherePlaying;
// nastavení aktuálních nastavených hodnot
chkStatusFFCAuto.ItemIndex := AutoStatusFFC;
chkStatusEvilAuto.ItemIndex := AutoStatusEvil;
chkStatusDepresAuto.ItemIndex := AutoStatusDepres;
chkStatusAtHomeAuto.ItemIndex := AutoStatusAtHome;
chkStatusAtWorkAuto.ItemIndex := AutoStatusAtWork;
chkStatusLunchAuto.ItemIndex := AutoStatusLunch;
chkStatusAwayAuto.ItemIndex := AutoStatusAway;
chkStatusNAAuto.ItemIndex := AutoStatusNA;
chkStatusOccupiedAuto.ItemIndex := AutoStatusOccupied;
chkStatusDNDAuto.ItemIndex := AutoStatusDND;
chkStatusOnlineAuto.ItemIndex := AutoStatusOnline;
chkStatusInvisibleAuto.ItemIndex := AutoStatusInvisible;
chkStatusOfflineAuto.ItemIndex := AutoStatusOffline;
// přiřazení obrázků k On/Off radio
imgStatusFFC.Picture := PluginSkin.ST_ffc.Image.Picture;
imgStatusEvil.Picture := PluginSkin.ST_evil.Image.Picture;
imgStatusDepres.Picture := PluginSkin.ST_depression.Image.Picture;
imgStatusAtHome.Picture := PluginSkin.ST_at_home.Image.Picture;
imgStatusAtWork.Picture := PluginSkin.ST_at_work.Image.Picture;
imgStatusLunch.Picture := PluginSkin.ST_lunch.Image.Picture;
imgStatusAway.Picture := PluginSkin.ST_away.Image.Picture;
imgStatusNA.Picture := PluginSkin.ST_na.Image.Picture;
imgStatusOccupied.Picture := PluginSkin.ST_occ.Image.Picture;
imgStatusDND.Picture := PluginSkin.ST_dnd.Image.Picture;
imgStatusOnline.Picture := PluginSkin.ST_online.Image.Picture;
imgStatusInvisible.Picture := PluginSkin.ST_invisible.Image.Picture;
imgStatusOffline.Picture := PluginSkin.ST_offline.Image.Picture;
TemplatesValues.Clear;
// nastavení šablon
TemplatesValues.Add('%station%');
TemplatesValues.Add('%genre%');
TemplatesValues.Add('%song%');
TemplatesValues.Add('%format%');
TemplatesValues.Add('%bitrate%');
TemplatesValues.Add('%language%');
TemplatesValues.Add('%stationweb%');
// text - preklad
TemplatesValuesInfo.Add(LNG('FORM Options', 'XStatus.XStatus.ValuesInfo.Station', 'Station name'));
TemplatesValuesInfo.Add(LNG('FORM Options', 'XStatus.XStatus.ValuesInfo.Genre', 'Genre'));
TemplatesValuesInfo.Add(LNG('FORM Options', 'XStatus.XStatus.ValuesInfo.Song', 'Song'));
TemplatesValuesInfo.Add(LNG('FORM Options', 'XStatus.XStatus.ValuesInfo.Format', 'Format'));
TemplatesValuesInfo.Add(LNG('FORM Info', 'Bitrate', 'Bitrate'));
TemplatesValuesInfo.Add(LNG('FORM Options', 'XStatus.XStatus.ValuesInfo.Language', 'Language'));
TemplatesValuesInfo.Add(LNG('FORM Options', 'XStatus.XStatus.ValuesInfo.Web', 'Web'));
miTemplates_Values.Clear;
for idx := 0 to TemplatesValues.Count - 1 do
begin
NewItem := TMenuItem.Create(Self);
NewItem.Caption := TemplatesValues.Strings[idx] + ' - ' + TemplatesValuesInfo.Strings[idx];
NewItem.Tag := idx;
NewItem.OnClick := miTemplates_ValuesClick;
NewItem.OnDrawItem := DrawMenu;
sText := Format('TemplatesValue_%d',[idx]);
if FOptions.FindChildControl(sText) <> nil then
FOptions.FindChildControl(sText).Destroy;
NewItem.Name := sText;
NewItem.OnMeasureItem := MeasureMenu;
miTemplates_Values.Add(NewItem);
end;
miTemplates_Texts.Clear;
for idx := 0 to TemplatesTexts.Count - 1 do
begin
NewItem := TMenuItem.Create(Self);
NewItem.Caption := TemplatesTexts.Strings[idx];
NewItem.Tag := idx;
NewItem.OnClick := miTemplates_TextsClick;
NewItem.OnDrawItem := DrawMenu;
sText := Format('TemplatesText_%d',[idx]);
if FOptions.FindChildControl(sText) <> nil then
FOptions.FindChildControl(sText).Destroy;
NewItem.Name := sText;
NewItem.OnMeasureItem := MeasureMenu;
miTemplates_Texts.Add(NewItem);
end;
//****************************************
LngPath := PluginDLLPath + 'Langs\';
cmbLangs.Clear;
cmbLangs.Items.Add('<default>');
if cmbLangs.Items[cmbLangs.Items.Count - 1] = PluginLanguage then
cmbLangs.ItemIndex := cmbLangs.Items.Count - 1;
if FindFirst(LngPath + '*.lng', faAnyFile, rec) = 0 then
begin
repeat
if rec.Name = '' then
else if rec.Name = '.' then
else if rec.Name = '..' then
else
begin
cmbLangs.Items.Add( Copy(rec.Name, 1 , Length(rec.Name)-Length(ExtractFileExt(rec.Name))) ) ;
if cmbLangs.Items[cmbLangs.Items.Count - 1] = PluginLanguage then
cmbLangs.ItemIndex := cmbLangs.Items.Count - 1;
end;
until FindNext(rec) <> 0;
end;
FindClose(rec);
ShowLanguageInfo;
LngPath := PluginDllPath + 'Skins\';
cmbSkin.Clear;
if FindFirst(LngPath + '*.*', faDirectory, rec) = 0 then
begin
While FindNext(rec) = 0 do
begin
if ExtractFileExt(rec.Name) <> '' then
rec.Name := '';
if rec.Name = '' then
else if rec.Name = '.' then
else if rec.Name = '..' then
else
begin
if (FileExists(PluginDllPath + 'Skins\' + Copy(rec.Name, 1 , Length(rec.Name)) + '\skin.ini') = True) and
(FileExists(PluginDllPath + 'Skins\' + Copy(rec.Name, 1 , Length(rec.Name)) + '\graph.dll') = True) then
begin
cmbSkin.Items.Add( Copy(rec.Name, 1 , Length(rec.Name))) ;
if cmbSkin.Items[cmbSkin.Items.Count - 1] = PluginTheme.Name then
cmbSkin.ItemIndex := cmbSkin.Items.Count - 1;
end;
end;
end;
end;
FindClose(rec);
ShowSkinInfo;
chkUseQIPMute.Checked := UseQIPMute;
chkPlayOnStart.Checked := PlayOnStart;
chkEnableEqualizer.Checked := EqualizerEnabled;
chkShowComments.Checked := ShowComments;
chkLoadSongsExternal.Checked := LoadSongsExternal;
chkShowCovers.Checked := ShowCover;
chkSaveCovers.Checked := SaveCover;
btnEqualizerSetup.Enabled := EqualizerEnabled;
chkUseHotKeys.Checked := HotKeyEnabled;
chkUseHotKeysClick(chkUseHotKeys);
HotKey1.HotKey := HotKeyFMtune;
HotKey3.HotKey := HotKeyVolumeUp;
HotKey4.HotKey := HotKeyVolumeDown;
HotKey2.HotKey := HotKeyMute;
HotKey5.Hotkey := HotKeyStationNext;
HotKey6.Hotkey := HotKeyStationPrev;
HotKey7.Hotkey := HotKeyEnableDisableXStatus;
chkEnableXStatus.Checked := XStatus_Boolean;
if XStatus_Type = 1 then
rbChangeIfMusic.Checked := True
else if XStatus_Type = 2 then
rbChangeIfAny.Checked := True;
edtXStatusTitle.Text := XStatus_Title;
edtXStatusText.Text := XStatus_Text;
edtPopup.Text := PopupText;
//chkShowPopUpIfChangeInfo.Checked := ShowPopUpIfChangeInfo;
if PopupType = 1 then
begin
rbPopUpShowAsXStatus.Checked := True;
rbPopUpShowAsXStatusClick(Self);
end
else if PopupType = 2 then
begin
rbPopUpPersonalSettings.Checked := True;
rbPopUpPersonalSettingsClick(Self);
end;
chkSaveLastStream.Checked := SaveLastStream;
chkShowPopups.Checked := ShowPopups;
case Proxy_Mode of
0: rbNoProxy.Checked := True;
1: rbProxyQIPConf.Checked := True;
2: begin
rbProxyManualConf.Checked := True;
edtProxyServer.Text := Proxy_Server;
end;
end;
chkUpdaterCheckingUpdates.Checked := CheckUpdates;
edtSpecCntLine1.Text := SpecCntLine1Text;
edtSpecCntLine2.Text := SpecCntLine2Text;
chkSpecCntLine1ScrollText.Checked := SpecCntLine1ScrollText;
chkSpecCntLine2ScrollText.Checked := SpecCntLine2ScrollText;
chkSpecCntShowLine2.Checked := SpecCntShowLine2;
lstMenu.Clear;
idx:=0;
while ( idx <= pgcOptions.PageCount - 1 ) do
begin
pgcOptions.Pages[idx].TabVisible := false;
lstMenu.Items.Add ( pgcOptions.Pages[idx].Caption );
Inc(idx);
end;
// lstMenu.ItemHeight := 26;
pgcOptions.ActivePageIndex:=0;
lstMenu.ItemIndex := 0;
pnlText.Caption := lstMenu.Items[lstMenu.ItemIndex];
chkShowPopupsClick(chkShowPopups);
chkEnableXStatusClick(chkEnableXStatus);
chkShowCoversClick(nil);
AddComments(FOptions);
OptionsIsShow := True;
end;
procedure TfrmOptions.GetOffHotKey(Sender: TObject);
begin
// HotKeysDeactivate;
end;
procedure TfrmOptions.GetHotKeysActivate(Sender: TObject);
begin
// HotKeysActivate;
end;
procedure TfrmOptions.lblSkinEmailClick(Sender: TObject);
begin
LinkUrl( 'mailto:'+lblSkinEmail.Caption);
end;
procedure TfrmOptions.lblSkinEmailMouseEnter(Sender: TObject);
begin
OnMouseOverLink(Sender);
end;
procedure TfrmOptions.lblSkinEmailMouseLeave(Sender: TObject);
begin
OnMouseOutLink(Sender);
end;
procedure TfrmOptions.lblSkinWebClick(Sender: TObject);
begin
LinkUrl( lblSkinWeb.Caption);
end;
procedure TfrmOptions.lblSkinWebMouseEnter(Sender: TObject);
begin
OnMouseOverLink(Sender);
end;
procedure TfrmOptions.lblSkinWebMouseLeave(Sender: TObject);
begin
OnMouseOutLink(Sender);
end;
procedure TfrmOptions.lblTransEmailClick(Sender: TObject);
begin
LinkUrl( 'mailto:'+lblTransEmail.Caption);
end;
procedure TfrmOptions.lblTransEmailMouseEnter(Sender: TObject);
begin
OnMouseOverLink(Sender);
end;
procedure TfrmOptions.lblTransEmailMouseLeave(Sender: TObject);
begin
OnMouseOutLink(Sender);
end;
procedure TfrmOptions.lblTransURLClick(Sender: TObject);
begin
LinkUrl( lblTransURL.Caption);
end;
procedure TfrmOptions.lblTransURLMouseEnter(Sender: TObject);
begin
OnMouseOverLink(Sender);
end;
procedure TfrmOptions.lblTransURLMouseLeave(Sender: TObject);
begin
OnMouseOutLink(Sender);
end;
procedure TfrmOptions.lstMenuClick(Sender: TObject);
begin
pgcOptions.ActivePageIndex := lstMenu.ItemIndex;
pnlText.Caption := lstMenu.Items[lstMenu.ItemIndex];
lstMenu.Refresh;
lstMenu.Update;
end;
procedure TfrmOptions.lstMenuDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var CenterText : integer;
begin
if lstMenu.ItemIndex = Index then
begin
lstMenu.Canvas.Brush.Color := $FFE0C2{QIP_Colors.Focus};
lstMenu.Canvas.FillRect(Rect);
lstMenu.Canvas.Brush.Color := $FF9933{QIP_Colors.FocusFrame};
lstMenu.Canvas.FrameRect(Rect);
end
else
begin
lstMenu.Canvas.Brush.Color := clWindow;
lstMenu.Canvas.FillRect (rect);
lstMenu.Canvas.FrameRect(rect);
end;
DrawIconEx(lstMenu.Canvas.Handle, rect.Left + 4, rect.Top + 4, TIcon(PluginSkin.OptionsIcons.Objects[index]).Handle, 16, 16, 0, 0, DI_NORMAL);
//ilMenu.Draw(lstMenu.Canvas,rect.Left + 4, rect.Top + 4, index );
SetBkMode(lstMenu.Canvas.Handle, TRANSPARENT);
CenterText := ( rect.Bottom - rect.Top - lstMenu.Canvas.TextHeight(text)) div 2 ;
lstMenu.Canvas.Font.Color := clWindowText;
lstMenu.Canvas.TextOut (rect.left + {ilMenu.Width}16 + 8 , rect.Top + CenterText,
lstMenu.Items.Strings[index]);
end;
procedure TfrmOptions.lstMenuMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
pnlText.SetFocus; // odnastavení aktivity na jiný objekt (zabránění čerchovanému orámování)
end;
procedure TfrmOptions.miTemplates_CapitalFollowingLetterClick(Sender: TObject);
begin
if pmTemplates_Type=1 then
edtXStatusTitle.SelText := '%^%'
else if pmTemplates_Type=2 then
edtXStatusText.SelText := '%^%'
else if pmTemplates_Type=3 then
edtPopup.SelText := '%^%'
else if pmTemplates_Type=4 then
edtSpecCntLine1.SelText := '%^%'
else if pmTemplates_Type=5 then
edtSpecCntLine2.SelText := '%^%';
end;
procedure TfrmOptions.miTemplates_TextsClick(Sender: TObject);
var idx: Integer;
begin
if Sender <> miTemplates_Texts then
begin
idx := (Sender as TMenuItem).Tag;
if pmTemplates_Type=1 then
edtXStatusTitle.SelText := TemplatesTexts.Strings[idx]
else if pmTemplates_Type=2 then
edtXStatusText.SelText := TemplatesTexts.Strings[idx]
else if pmTemplates_Type=3 then
edtPopUp.SelText := TemplatesTexts.Strings[idx]
else if pmTemplates_Type=4 then
edtSpecCntLine1.SelText := TemplatesTexts.Strings[idx]
else if pmTemplates_Type=5 then
edtSpecCntLine2.SelText := TemplatesTexts.Strings[idx]
end;
end;
procedure TfrmOptions.miTemplates_ValuesClick(Sender: TObject);
var
idx: Integer;
Owner: TComponent;
begin
if Sender <> miTemplates_Values then
begin
//Owner := TMenuItem(Sender).Owner;
idx := (Sender as TMenuItem).Tag;
if pmTemplates_Type=1 then
edtXStatusTitle.SelText := TemplatesValues.Strings[idx]
else if pmTemplates_Type=2 then
edtXStatusText.SelText := TemplatesValues.Strings[idx]
else if pmTemplates_Type=3 then
edtPopUp.SelText := TemplatesValues.Strings[idx]
else if pmTemplates_Type=4 then
edtSpecCntLine1.SelText := TemplatesValues.Strings[idx]
else if pmTemplates_Type=5 then
edtSpecCntLine2.SelText := TemplatesValues.Strings[idx]
end;
end;
procedure TfrmOptions.rbPopUpShowAsXStatusClick(Sender: TObject);
var
i: integer;
begin
for i:=0 to gbPopUp.ControlCount-1 do
gbPopUp.Controls[i].Enabled := False;
end;
procedure TfrmOptions.rbProxyManualConfClick(Sender: TObject);
begin
edtProxyServer.Enabled := (Sender as TRadioButton).Checked;
lblProxyServerInfo.Enabled := (Sender as TRadioButton).Checked;
end;
procedure TfrmOptions.rbProxyQIPConfClick(Sender: TObject);
begin
rbProxyManualConfClick(rbProxyManualConf);
end;
procedure TfrmOptions.rbNoProxyClick(Sender: TObject);
begin
rbProxyManualConfClick(rbProxyManualConf);
end;
procedure TfrmOptions.rbPopUpPersonalSettingsClick(Sender: TObject);
var
i: integer;
begin
for i:=0 to gbPopUp.ControlCount-1 do
gbPopUp.Controls[i].Enabled := True;
end;
procedure TfrmOptions.MeasureMenu(Sender: TObject;
ACanvas: TCanvas; var Width, Height: Integer);
begin
Menu_MeasureMenu(Sender, ACanvas, Width, Height);
end;
procedure TfrmOptions.DrawMenu(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; Selected: Boolean);
begin
Menu_DrawMenu(Sender, ACanvas, ARect, Selected);
end;
end.
|
unit okFontComboBox;
interface
uses
Windows, SysUtils, Classes, Controls, StdCtrls, FR_Combo, Graphics, Messages, dialogs;
type
TokFontComboBox = class(TfrFontComboBox)
private
FOverBtn: Boolean;
FDefEditProc: Pointer;
FEditInstance: Pointer;
procedure SetOverBtn(const Value: Boolean);
procedure EditWndProc(var Message: TMessage);
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
protected
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure PaintBorder(DC: HDC; const SolidBorder: Boolean); override;
procedure PaintButton(bnStyle: Integer); override;
property OverBtn: Boolean read FOverBtn write SetOverBtn;
public
constructor Create(AOwner: TComponent); override;
procedure CreateWnd; override;
end;
TokComboBox = class(TfrComboBox)
private
FOverBtn: Boolean;
FDefEditProc: Pointer;
FEditInstance: Pointer;
procedure SetOverBtn(const Value: Boolean);
procedure EditWndProc(var Message: TMessage);
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
protected
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure PaintBorder(DC: HDC; const SolidBorder: Boolean); override;
procedure PaintButton(bnStyle: Integer); override;
property OverBtn: Boolean read FOverBtn write SetOverBtn;
public
constructor Create(AOwner: TComponent); override;
procedure CreateWnd; override;
end;
implementation
uses Types;
{ TokFontComboBox }
procedure TokFontComboBox.CMMouseEnter(var Message: TMessage);
begin
inherited;
end;
procedure TokFontComboBox.CMMouseLeave(var Message: TMessage);
begin
OverBtn := False;
inherited;
end;
constructor TokFontComboBox.Create(AOwner: TComponent);
begin
inherited;
FEditInstance := MakeObjectInstance(EditWndProc);
FDefEditProc := nil;
end;
procedure TokFontComboBox.CreateWnd;
begin
inherited;
FDefEditProc := Pointer(GetWindowLong(FEditHandle, GWL_WNDPROC));
SetWindowLong(FEditHandle, GWL_WNDPROC, Longint(FEditInstance));
end;
procedure TokFontComboBox.EditWndProc(var Message: TMessage);
procedure CallDefaultProc;
begin
with Message do
Result := CallWindowProc(FDefEditProc, FEditHandle, Msg, WParam, LParam);
end;
begin
case Message.Msg of
WM_MOUSEMOVE:
begin
OverBtn := False;
end;
else
CallDefaultProc;
end;
end;
procedure TokFontComboBox.MouseMove(Shift: TShiftState; X, Y: Integer);
var
R: TRect;
begin
SetRect(R, Width - FButtonWidth - 3, 1, Width - 1, Height - 1);
OverBtn := PtInRect(R, Point(X, Y));
end;
procedure TokFontComboBox.PaintBorder(DC: HDC; const SolidBorder: Boolean);
var
R: TRect;
BtnFaceBrush, WindowBrush, HT, BB: HBRUSH;
begin
BtnFaceBrush := GetSysColorBrush(COLOR_BTNFACE);
WindowBrush := GetSysColorBrush(COLOR_WINDOW);
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
InflateRect(R, -1, -1);
FrameRect (DC, R, WindowBrush {BtnFaceBrush});
InflateRect(R, -1, -1);
R.Right := R.Right - FButtonWidth - 1;
FrameRect (DC, R, WindowBrush);
if SolidBorder then
begin
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
// InflateRect(R, -1, -1);
HT := CreateSolidBrush(ColorToRGB(543892488));
FrameRect(DC, R, HT);
DeleteObject(HT);
end else
begin
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
// InflateRect(R, -1, -1);
BB := CreateSolidBrush(ColorToRGB(clBtnShadow));
FrameRect (DC, R, BB);
DeleteObject(BB);
end;
end;
procedure TokFontComboBox.PaintButton(bnStyle: Integer);
var
R: TRect;
DC: HDC;
Brush, SaveBrush: HBRUSH;
X, Y: Integer;
Pen, SavePen: HPEN;
WindowBrush: HBRUSH;
begin
WindowBrush := GetSysColorBrush(COLOR_WINDOW);
DC := GetWindowDC(Handle);
SetRect(R, Width - FButtonWidth - 3, 1, Width - 1, Height - 1);
X := Trunc(FButtonWidth / 2) + Width - FButtonWidth - 4;
Y := Trunc((Height - 4) / 2) + 1;
if FOverBtn
then Brush := CreateSolidBrush(ColorToRGB(550944437))
else Brush := CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
SaveBrush := SelectObject(DC, Brush);
if not OverBtn then begin
FrameRect(DC, R, WindowBrush);
InflateRect(R, -1, -1);
end;
FillRect(DC, R, Brush);
SelectObject(DC, SaveBrush);
DeleteObject(Brush);
case bnStyle of
0: begin
// FrameRect (DC, R, WindowBrush);
{ GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
InflateRect(R, -FButtonWidth - 3, -2);}
if OverBtn then begin
Pen := CreatePen(PS_SOLID, 1, ColorToRGB(clBtnShadow));
SavePen := SelectObject(DC, Pen);
MoveToEx(DC, R.Left, R.Top, nil);
LineTo(DC, R.Left, R.Bottom);
SelectObject(DC, SavePen);
DeleteObject(Pen);
end;
PaintButtonGlyph(DC, X, Y);
end;
1,2: begin
{ DrawEdge (DC, R, BDR_RAISEDINNER, BF_RECT);
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
InflateRect(R, -FButtonWidth - 3, -1);}
if OverBtn then begin
Pen := CreatePen(PS_SOLID, 1, ColorToRGB(543892488));
SavePen := SelectObject(DC, Pen);
MoveToEx(DC, R.Left, R.Top, nil);
LineTo(DC, R.Left, R.Bottom);
SelectObject(DC, SavePen);
DeleteObject(Pen);
end;
if bnStyle = 1
then PaintButtonGlyph(DC, X, Y)
else PaintButtonGlyph(DC, X + 1, Y + 1);
end;
end;
ReleaseDC(Handle, DC);
end;
procedure TokFontComboBox.SetOverBtn(const Value: Boolean);
begin
if FOverBtn = Value then Exit;
FOverBtn := Value;
PaintButton(0);
end;
{ TokComboBox }
procedure TokComboBox.CMMouseEnter(var Message: TMessage);
begin
inherited;
end;
procedure TokComboBox.CMMouseLeave(var Message: TMessage);
begin
OverBtn := False;
inherited;
end;
constructor TokComboBox.Create(AOwner: TComponent);
begin
inherited;
end;
procedure TokComboBox.CreateWnd;
begin
inherited;
end;
procedure TokComboBox.EditWndProc(var Message: TMessage);
procedure CallDefaultProc;
begin
with Message do
Result := CallWindowProc(FDefEditProc, FEditHandle, Msg, WParam, LParam);
end;
begin
case Message.Msg of
WM_MOUSEMOVE:
begin
OverBtn := False;
end;
else
CallDefaultProc;
end;
end;
procedure TokComboBox.MouseMove(Shift: TShiftState; X, Y: Integer);
var
R: TRect;
begin
SetRect(R, Width - FButtonWidth - 3, 1, Width - 1, Height - 1);
OverBtn := PtInRect(R, Point(X, Y));
end;
procedure TokComboBox.PaintBorder(DC: HDC; const SolidBorder: Boolean);
var
R: TRect;
BtnFaceBrush, WindowBrush, HT, BB: HBRUSH;
begin
BtnFaceBrush := GetSysColorBrush(COLOR_BTNFACE);
WindowBrush := GetSysColorBrush(COLOR_WINDOW);
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
InflateRect(R, -1, -1);
FrameRect (DC, R, WindowBrush {BtnFaceBrush});
InflateRect(R, -1, -1);
R.Right := R.Right - FButtonWidth - 1;
FrameRect (DC, R, WindowBrush);
if SolidBorder then
begin
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
// InflateRect(R, -1, -1);
HT := CreateSolidBrush(ColorToRGB(543892488));
FrameRect(DC, R, HT);
DeleteObject(HT);
end else
begin
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
// InflateRect(R, -1, -1);
BB := CreateSolidBrush(ColorToRGB(clBtnShadow));
FrameRect (DC, R, BB);
DeleteObject(BB);
end;
end;
procedure TokComboBox.PaintButton(bnStyle: Integer);
var
R: TRect;
DC: HDC;
Brush, SaveBrush: HBRUSH;
X, Y: Integer;
Pen, SavePen: HPEN;
WindowBrush: HBRUSH;
begin
WindowBrush := GetSysColorBrush(COLOR_WINDOW);
DC := GetWindowDC(Handle);
SetRect(R, Width - FButtonWidth - 3, 1, Width - 1, Height - 1);
X := Trunc(FButtonWidth / 2) + Width - FButtonWidth - 4;
Y := Trunc((Height - 4) / 2) + 1;
if FOverBtn
then Brush := CreateSolidBrush(ColorToRGB(550944437))
else Brush := CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
SaveBrush := SelectObject(DC, Brush);
if not OverBtn then begin
FrameRect(DC, R, WindowBrush);
InflateRect(R, -1, -1);
end;
FillRect(DC, R, Brush);
SelectObject(DC, SaveBrush);
DeleteObject(Brush);
case bnStyle of
0: begin
// FrameRect (DC, R, WindowBrush);
{ GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
InflateRect(R, -FButtonWidth - 3, -2);}
if OverBtn then begin
Pen := CreatePen(PS_SOLID, 1, ColorToRGB(clBtnShadow));
SavePen := SelectObject(DC, Pen);
MoveToEx(DC, R.Left, R.Top, nil);
LineTo(DC, R.Left, R.Bottom);
SelectObject(DC, SavePen);
DeleteObject(Pen);
end;
PaintButtonGlyph(DC, X, Y);
end;
1,2: begin
{ DrawEdge (DC, R, BDR_RAISEDINNER, BF_RECT);
GetWindowRect(Handle, R);
OffsetRect (R, -R.Left, -R.Top);
InflateRect(R, -FButtonWidth - 3, -1);}
if OverBtn then begin
Pen := CreatePen(PS_SOLID, 1, ColorToRGB(543892488));
SavePen := SelectObject(DC, Pen);
MoveToEx(DC, R.Left, R.Top, nil);
LineTo(DC, R.Left, R.Bottom);
SelectObject(DC, SavePen);
DeleteObject(Pen);
end;
if bnStyle = 1
then PaintButtonGlyph(DC, X, Y)
else PaintButtonGlyph(DC, X + 1, Y + 1);
end;
end;
ReleaseDC(Handle, DC);
end;
procedure TokComboBox.SetOverBtn(const Value: Boolean);
begin
if FOverBtn = Value then Exit;
FOverBtn := Value;
PaintButton(0);
end;
end.
|
unit FMain;
interface
uses
System.SysUtils,
System.Types,
System.UITypes,
System.Classes,
System.Variants,
FMX.Types,
FMX.Controls,
FMX.Forms,
FMX.Graphics,
FMX.Dialogs,
FMX.ScrollBox,
FMX.Memo,
FMX.StdCtrls,
FMX.Controls.Presentation,
FMX.Edit,
FMX.ListView.Types,
FMX.ListView.Appearances,
FMX.ListView.Adapters.Base,
FMX.ListView,
System.Generics.Collections,
Grijjy.TimerQueue;
type
TFormMain = class(TForm)
EditTimers: TEdit;
ButtonStart: TButton;
EditInterval: TEdit;
LabelTimers: TLabel;
LabelInterval: TLabel;
ButtonStopAll: TButton;
MemoLog: TMemo;
ListViewTimers: TListView;
ButtonStop: TButton;
ButtonClear: TButton;
ButtonSetInterval: TButton;
procedure FormCreate(Sender: TObject);
procedure ButtonStartClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ButtonStopAllClick(Sender: TObject);
procedure ButtonStopClick(Sender: TObject);
procedure ButtonClearClick(Sender: TObject);
procedure ButtonSetIntervalClick(Sender: TObject);
private
{ Private declarations }
FTimerQueue: TgoTimerQueue;
procedure OnTimer(const ASender: TObject);
public
{ Public declarations }
end;
var
FormMain: TFormMain;
implementation
{$R *.fmx}
procedure TFormMain.FormCreate(Sender: TObject);
begin
FTimerQueue := TgoTimerQueue.Create;
end;
procedure TFormMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FTimerQueue.Free;
end;
procedure TFormMain.ButtonStartClick(Sender: TObject);
var
Timers, Interval: Integer;
Handle: THandle;
I: Integer;
Item: TListViewItem;
begin
Timers := StrToIntDef(EditTimers.Text, 1);
Interval := StrToIntDef(EditInterval.Text, 1000);
for I := 0 to Timers - 1 do
begin
Handle := FTimerQueue.Add(Interval, OnTimer);
Item := ListViewTimers.Items.Add;
Item.Tag := Handle;
Item.Text := Format('Timer (%s, Interval=%d)',
[UInt32(Handle).ToHexString, Interval]);
end;
end;
procedure TFormMain.ButtonStopAllClick(Sender: TObject);
var
Handle: THandle;
Item: TListViewItem;
begin
for Item in ListViewTimers.Items do
begin
Handle := Item.Tag;
FTimerQueue.Release(Handle);
end;
ListViewTimers.Items.Clear;
end;
procedure TFormMain.ButtonStopClick(Sender: TObject);
var
Handle: THandle;
begin
if ListViewTimers.ItemIndex > -1 then
begin
Handle := ListViewTimers.Items[ListViewTimers.ItemIndex].Tag;
FTimerQueue.Release(Handle);
ListViewTimers.Items.Delete(ListViewTimers.ItemIndex);
end;
end;
procedure TFormMain.ButtonSetIntervalClick(Sender: TObject);
var
Interval: Integer;
Handle: THandle;
begin
Interval := StrToIntDef(EditInterval.Text, 1000);
if ListViewTimers.ItemIndex > -1 then
begin
Handle := ListViewTimers.Items[ListViewTimers.ItemIndex].Tag;
FTimerQueue.SetInterval(Handle, Interval);
end;
end;
procedure TFormMain.ButtonClearClick(Sender: TObject);
begin
MemoLog.Lines.Clear;
end;
procedure TFormMain.OnTimer(const ASender: TObject);
var
S: String;
Timer: TgoTimer;
begin
Timer := ASender as TgoTimer;
S := (Format('OnTimer (%s, Thread=%s, Interval=%d)',
[UInt32(Timer.Handle).ToHexString, TThread.CurrentThread.ThreadID.ToHexString, Timer.Interval]));
TThread.Synchronize(nil,
procedure
begin
MemoLog.Lines.Add(S);
MemoLog.GoToTextEnd;
end);
end;
end.
|
unit FramedButton;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, extctrls;
const
fbsNormal = 0;
fbsMouseDown = 1;
fbsMouseIn = 2;
fbsEnabled = 4;
fbsSelected = 8;
type
TFramedButtonState = byte;
TFramedButtonAlign = (fbaLeft, fbaCenter, fbaRight);
type
TFramedButton =
class(TGraphicControl)
public
constructor Create(AOwner : TComponent); override;
protected
fTextColor : TColor;
fFrameColor : TColor;
fSelFrameColor : TColor;
fSelTextColor : TColor;
fDisableColor : TColor;
fFrameMargin : integer;
fTextMargin : integer;
fState : TFramedButtonState;
fAlign : TFramedButtonAlign;
fFramed : boolean;
fHilFramed : boolean;
fNorGrpColor : TColor;
fSelGrpColor : TColor;
fGrpBkColor : TColor;
fGroupIndex : integer;
fAllowAllUp : boolean;
fTimerMouse : TTimer;
public
procedure IroClick;
private
procedure DoPaint(R : TRect; frameColor, textColor : TColor; mouseDown : boolean);
protected
procedure Paint; override;
procedure Click; override;
public
procedure CMTextChange(var Message: TMessage); message CM_TEXTCHANGED;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure UnSelectGroup;
private
procedure SetTextColor(aColor : TColor);
procedure SetSelTextColor(aColor : TColor);
procedure SetFrameColor(aColor : TColor);
procedure SetSelFrameColor(aColor : TColor);
procedure SetDisableColor(aColor : TColor);
procedure SetFrameMargin(aMargin : integer);
procedure SetTextMargin(aMargin : integer);
procedure SetAlign(anAlign : TFramedButtonAlign);
procedure SetFramed(value : boolean);
procedure SetHilFramed(value : boolean);
function GetFlags : integer;
function GetSelected : boolean;
procedure SetSelected(value : boolean);
procedure MouseUpTimer(Sender: TObject);
published
property Color;
property TextColor : TColor read fTextColor write SetTextColor;
property FrameColor : TColor read fFrameColor write SetFrameColor;
property SelTextColor : TColor read fSelTextColor write SetSelTextColor;
property DisableColor : TColor read fDisableColor write SetDisableColor;
property SelFrameColor : TColor read fSelFrameColor write SetSelFrameColor;
property FrameMargin : integer read fFrameMargin write SetFrameMargin default 2;
property TextMargin : integer read fTextMargin write SetTextMargin default 2;
property Align : TFramedButtonAlign read fAlign write SetAlign;
property Framed : boolean read fFramed write SetFramed;
property HilFramed : boolean read fHilFramed write SetHilFramed;
property NorGrpColor : TColor read fNorGrpColor write fNorGrpColor;
property SelGrpColor : TColor read fSelGrpColor write fSelGrpColor;
property GrpBkColor : TColor read fGrpBkColor write fGrpBkColor;
property GroupIndex : integer read fGroupIndex write fGroupIndex;
property Selected : boolean read GetSelected write SetSelected;
property AllowAllUp : boolean read fAllowAllUp write fAllowAllUp default false;
property Text;
property DragCursor;
property DragMode;
property Enabled;
property Font;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
//property TabOrder;
//property TabStop;
property Visible;
property OnClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
procedure Register;
implementation
constructor TFramedButton.Create(AOwner : TComponent);
begin
inherited;
fState := fbsEnabled;
fFramed := true;
fHilFramed := true;
fNorGrpColor := clBlack;
fSelGrpColor := clWhite;
fGrpBkColor := clBlack;
Cursor := crHandPoint;
fTimerMouse := TTimer.Create(self);
fTimerMouse.OnTimer := MouseUpTimer;
fTimerMouse.Interval := 1000;
fTimerMouse.Enabled := false;
end;
procedure TFramedButton.IroClick;
begin
fState := fState or fbsMouseDown;
if fGroupIndex > 0
then
begin
UnSelectGroup;
if fAllowAllUp
then
if fState and fbsSelected = 0
then fState := fState or fbsSelected
else fState := fState and not fbsSelected
else fState := fState or fbsSelected;
end;
Refresh;
end;
procedure TFramedButton.DoPaint(R : TRect; frameColor, textColor : TColor; mouseDown : boolean);
begin
if not mouseDown
then InflateRect(R, -fFrameMargin, -fFrameMargin);
if fHilFramed
then
begin
Canvas.Brush.Color := frameColor;
Canvas.FrameRect(R);
end;
if not mouseDown
then InflateRect(R, -fTextMargin, -fTextMargin)
else InflateRect(R, -(fFrameMargin + fTextMargin), -(fFrameMargin + fTextMargin));
if not mouseDown
then Canvas.Font.Color := textColor
else Canvas.Font.Color := fframeColor;
Canvas.Brush.Style := bsClear;
DrawText(Canvas.Handle, PChar(Caption), Length(Caption), R, GetFlags);
end;
procedure TFramedButton.Paint;
var
R : TRect;
begin
R := ClientRect;
Canvas.Font := Font;
if (fGroupIndex > 0) and (fState and fbsSelected <> 0) and (fState and fbsEnabled <> 0)
then
begin
Canvas.Brush.Color := fGrpBkColor;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect(R);
if fState and fbsMouseIn = 0
then DoPaint(R, fNorGrpColor, fNorGrpColor, fState and fbsMouseDown <> 0)
else DoPaint(R, fSelGrpColor, fSelGrpColor, fState and fbsMouseDown <> 0);
end
else
if (fState and fbsMouseIn = 0) or (fState and fbsEnabled = 0)
then
begin
if fState and fbsEnabled = 0
then DoPaint(R, fDisableColor, fDisableColor, false)
else DoPaint(R, fFrameColor, Font.Color, false);
end
else DoPaint(R, fSelFrameColor, fSelTextColor, fState and fbsMouseDown <> 0);
end;
procedure TFramedButton.CMTextChange(var Message: TMessage);
begin
Refresh;
end;
procedure TFramedButton.CMMouseEnter(var Message: TMessage);
begin
{
if fState and fbsMouseIn = 0
then
begin
}
Cursor := crHandPoint;
fState := fState or fbsMouseIn;
if fState and fbsMouseDown = 0
then Refresh;
{
end;
}
end;
procedure TFramedButton.CMMouseLeave(var Message: TMessage);
begin
{
if fState and fbsMouseIn <> 0
then
begin
}
Cursor := crDefault;
fState := fState and not fbsMouseIn;
if fState and fbsMouseDown = 0
then Refresh;
{
end;
}
end;
procedure TFramedButton.CMEnabledChanged(var Message: TMessage);
begin
inherited;
if Enabled
then fState := fState or fbsEnabled
else fState := fState and not fbsEnabled;
end;
procedure TFramedButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (fState and fbsMouseDown)=0
then
begin
inherited;
IroClick;
end;
end;
procedure TFramedButton.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
inherited;
{
if PtInRect(ClientRect, Point(X, Y))
then
begin
Cursor := crHandPoint;
if fState and fbsMouseIn = 0
then
begin
//MouseCapture := true;
fState := fState or fbsMouseIn;
if (fState and fbsEnabled <> 0) and (fState and fbsMouseDown = 0)
then Refresh;
end;
end;
}
end;
procedure TFramedButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
fTimerMouse.Enabled := true;
// fState := fState and not fbsMouseDown;
//Refresh;
end;
procedure TFramedButton.UnSelectGroup;
var
Ctrl : TControl;
i : integer;
cnt : integer;
begin
cnt := Parent.ControlCount;
i := 0;
while i < cnt do
begin
Ctrl := Parent.Controls[i];
if Ctrl is TFramedButton
then
if (Ctrl <> Self) and (TFramedButton(Ctrl).fGroupIndex = fGroupIndex)
then
begin
if TFramedButton(Ctrl).Selected
then i := cnt;
TFramedButton(Ctrl).Selected := false;
end;
inc(i);
end;
end;
procedure TFramedButton.SetTextColor(aColor : TColor);
begin
if fTextColor <> aColor
then
begin
fTextColor := aColor;
Refresh;
end;
end;
procedure TFramedButton.SetSelTextColor(aColor : TColor);
begin
if fSelTextColor <> aColor
then
begin
fSelTextColor := aColor;
Refresh;
end;
end;
procedure TFramedButton.SetFrameColor(aColor : TColor);
begin
if fFrameColor <> aColor
then
begin
fFrameColor := aColor;
Refresh;
end;
end;
procedure TFramedButton.SetSelFrameColor(aColor : TColor);
begin
if fSelFrameColor <> aColor
then
begin
fSelFrameColor := aColor;
Refresh;
end;
end;
procedure TFramedButton.SetDisableColor(aColor : TColor);
begin
if fDisableColor <> aColor
then
begin
fDisableColor := aColor;
Refresh;
end;
end;
procedure TFramedButton.SetFrameMargin(aMargin : integer);
begin
if fFrameMargin <> aMargin
then
begin
fFrameMargin := aMargin;
Refresh;
end;
end;
procedure TFramedButton.SetTextMargin(aMargin : integer);
begin
if fTextMargin <> aMargin
then
begin
fTextMargin := aMargin;
Refresh;
end;
end;
procedure TFramedButton.SetAlign(anAlign : TFramedButtonAlign);
begin
if fAlign <> anAlign
then
begin
fAlign := anAlign;
Refresh;
end;
end;
procedure TFramedButton.SetFramed(value : boolean);
begin
if fFramed <> value
then
begin
fFramed := value;
Refresh;
end;
end;
procedure TFramedButton.SetHilFramed(value : boolean);
begin
if fHilFramed <> value
then
begin
fHilFramed := value;
Refresh;
end;
end;
function TFramedButton.GetFlags : integer;
begin
case fAlign of
fbaLeft :
result := DT_LEFT;
fbaCenter :
result := DT_CENTER;
fbaRight :
result := DT_RIGHT;
else
result := 0
end;
result := result or DT_VCENTER or DT_SINGLELINE;// or DT_WORDBREAK;
end;
function TFramedButton.GetSelected : boolean;
begin
result := fState and fbsSelected <> 0;
end;
procedure TFramedButton.SetSelected(value : boolean);
begin
if value
then
begin
fState := fState or fbsSelected;
UnSelectGroup;
end
else fState := fState and not fbsSelected;
Refresh;
end;
procedure TFramedButton.MouseUpTimer(Sender: TObject);
begin
fTimerMouse.Enabled := false;
fState := fState and not fbsMouseDown;
Refresh;
end;
procedure TFramedButton.Click;
begin
if not fTimerMouse.Enabled
then inherited;
end;
// Register
procedure Register;
begin
RegisterComponents('Five', [TFramedButton]);
end;
end.
|
(****************************************************************************
*
* WinLIRC plug-in for jetAudio
*
* Copyright (c) 2016 Tim De Baets
*
****************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
****************************************************************************
*
* jetAudio-related utility code
*
****************************************************************************)
unit JetAudioUtil;
interface
uses Windows, JetAudio6_API;
type
TJAMode = (jamDisc, jamFile);
const
JAModes: array[TJAMode] of Integer = (CMP_CDP, CMP_DGA);
const
AspectMenuId = 6570;
function JAGetRemoconWindow: HWND;
function JAGetVideoWindow(JAWindow: HWND): HWND;
implementation
const
RemoconClass = 'COWON Jet-Audio Remocon Class';
RemoconTitle = 'Jet-Audio Remote Control';
function JAGetRemoconWindow: HWND;
begin
Result := FindWindow(RemoconClass, RemoconTitle);
end;
const
VideoWndClass = 'COWON Jet-Audio Video Viewer Window';
VideoWndTitle = 'Jet-Audio Video Viewer Window';
function EnumJAThreadWndProc(hWin: HWND; PhJAVideoWnd: PInteger): BOOL; stdcall;
var
hWndVideo: HWND;
begin
Result := True;
hWndVideo := FindWindowEx(hWin, 0, VideoWndClass, VideoWndTitle);
if hWndVideo <> 0 then begin
if Assigned(PhJAVideoWnd) then
PhJAVideoWnd^ := GetParent(hWndVideo);
Result := False;
end;
end;
function JAGetVideoWindow(JAWindow: HWND): HWND;
var
ThreadID: Integer;
begin
Result := 0;
ThreadID := GetWindowThreadProcessId(JAWindow, nil);
EnumThreadWindows(ThreadID, @EnumJAThreadWndProc, Integer(@Result));
end;
end.
|
unit ladybug_hw;
interface
uses {$IFDEF WINDOWS}windows,{$ENDIF}
nz80,main_engine,sn_76496,controls_engine,gfx_engine,rom_engine,
pal_engine,sound_engine,misc_functions;
function iniciar_ladybug:boolean;
implementation
const
//Lady Bug
ladybug_rom:array[0..5] of tipo_roms=(
(n:'l1.c4';l:$1000;p:0;crc:$d09e0adb),(n:'l2.d4';l:$1000;p:$1000;crc:$88bc4a0a),
(n:'l3.e4';l:$1000;p:$2000;crc:$53e9efce),(n:'l4.h4';l:$1000;p:$3000;crc:$ffc424d7),
(n:'l5.j4';l:$1000;p:$4000;crc:$ad6af809),(n:'l6.k4';l:$1000;p:$5000;crc:$cf1acca4));
ladybug_pal:array[0..1] of tipo_roms=(
(n:'10-2.k1';l:$20;p:0;crc:$df091e52),(n:'10-1.f4';l:$20;p:$20;crc:$40640d8f));
ladybug_char:array[0..1] of tipo_roms=(
(n:'l9.f7';l:$1000;p:0;crc:$77b1da1e),(n:'l0.h7';l:$1000;p:$1000;crc:$aa82e00b));
ladybug_sprites:array[0..1] of tipo_roms=(
(n:'l8.l7';l:$1000;p:0;crc:$8b99910b),(n:'l7.m7';l:$1000;p:$1000;crc:$86a5b448));
//Snap Jack
snapjack_rom:array[0..5] of tipo_roms=(
(n:'sj1.c4';l:$1000;p:0;crc:$6b30fcda),(n:'sj2.d4';l:$1000;p:$1000;crc:$1f1088d1),
(n:'sj3.e4';l:$1000;p:$2000;crc:$edd65f3a),(n:'sj4.h4';l:$1000;p:$3000;crc:$f4481192),
(n:'sj5.j4';l:$1000;p:$4000;crc:$1bff7d05),(n:'sj6.k4';l:$1000;p:$5000;crc:$21793edf));
snapjack_pal:array[0..1] of tipo_roms=(
(n:'10-2.k1';l:$20;p:0;crc:$cbbd9dd1),(n:'10-1.f4';l:$20;p:$20;crc:$5b16fbd2));
snapjack_char:array[0..1] of tipo_roms=(
(n:'sj9.f7';l:$1000;p:0;crc:$ff2011c7),(n:'sj0.h7';l:$1000;p:$1000;crc:$f097babb));
snapjack_sprites:array[0..1] of tipo_roms=(
(n:'sj8.l7';l:$1000;p:0;crc:$b7f105b6),(n:'sj7.m7';l:$1000;p:$1000;crc:$1cdb03a8));
//Cosmic Avenger
cavenger_rom:array[0..5] of tipo_roms=(
(n:'1.c4';l:$1000;p:0;crc:$9e0cc781),(n:'2.d4';l:$1000;p:$1000;crc:$5ce5b950),
(n:'3.e4';l:$1000;p:$2000;crc:$bc28218d),(n:'4.h4';l:$1000;p:$3000;crc:$2b32e9f5),
(n:'5.j4';l:$1000;p:$4000;crc:$d117153e),(n:'6.k4';l:$1000;p:$5000;crc:$c7d366cb));
cavenger_pal:array[0..1] of tipo_roms=(
(n:'10-2.k1';l:$20;p:0;crc:$42a24dd5),(n:'10-1.f4';l:$20;p:$20;crc:$d736b8de));
cavenger_char:array[0..1] of tipo_roms=(
(n:'9.f7';l:$1000;p:0;crc:$63357785),(n:'0.h7';l:$1000;p:$1000;crc:$52ad1133));
cavenger_sprites:array[0..1] of tipo_roms=(
(n:'8.l7';l:$1000;p:0;crc:$b022bf2d),(n:'8.l7';l:$1000;p:$1000;crc:$b022bf2d));
//Dip
ladybug_dip_a:array [0..7] of def_dip=(
(mask:$3;name:'Difficulty';number:4;dip:((dip_val:$3;dip_name:'Easy'),(dip_val:$2;dip_name:'Medium'),(dip_val:$1;dip_name:'Hard'),(dip_val:$0;dip_name:'Hardest'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$4;name:'High Score Names';number:2;dip:((dip_val:$0;dip_name:'3 Letters'),(dip_val:$4;dip_name:'10 Letters'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$8;name:'Rack Test';number:2;dip:((dip_val:$8;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$10;name:'Freeze';number:2;dip:((dip_val:$10;dip_name:'Off'),(dip_val:$0;dip_name:'On'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$20;name:'Cabinet';number:2;dip:((dip_val:$0;dip_name:'Upright'),(dip_val:$20;dip_name:'Cocktail'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$40;name:'Free Play';number:2;dip:((dip_val:$40;dip_name:'No'),(dip_val:$0;dip_name:'Yes'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$80;name:'Lives';number:2;dip:((dip_val:$80;dip_name:'3'),(dip_val:$0;dip_name:'5'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),());
ladybug_dip_b:array [0..2] of def_dip=(
(mask:$f0;name:'Coin A';number:10;dip:((dip_val:$60;dip_name:'4C 1C'),(dip_val:$80;dip_name:'3C 1C'),(dip_val:$a0;dip_name:'2C 1C'),(dip_val:$70;dip_name:'3C 2C'),(dip_val:$f0;dip_name:'1C 1C'),(dip_val:$90;dip_name:'2C 3C'),(dip_val:$e0;dip_name:'1C 2C'),(dip_val:$d0;dip_name:'1C 3C'),(dip_val:$c0;dip_name:'1C 4C'),(dip_val:$b0;dip_name:'1C 5C'),(),(),(),(),(),())),
(mask:$0f;name:'Coin B';number:10;dip:((dip_val:$06;dip_name:'4C 1C'),(dip_val:$08;dip_name:'3C 1C'),(dip_val:$0a;dip_name:'2C 1C'),(dip_val:$07;dip_name:'3C 2C'),(dip_val:$0f;dip_name:'1C 1C'),(dip_val:$09;dip_name:'2C 3C'),(dip_val:$0e;dip_name:'1C 2C'),(dip_val:$0d;dip_name:'1C 3C'),(dip_val:$0c;dip_name:'1C 4C'),(dip_val:$0b;dip_name:'1C 5C'),(),(),(),(),(),())),());
snapjack_dip_a:array [0..4] of def_dip=(
(mask:$3;name:'Difficulty';number:4;dip:((dip_val:$3;dip_name:'Easy'),(dip_val:$2;dip_name:'Medium'),(dip_val:$1;dip_name:'Hard'),(dip_val:$0;dip_name:'Hardest'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$4;name:'High Score Names';number:2;dip:((dip_val:$0;dip_name:'3 Letters'),(dip_val:$4;dip_name:'10 Letters'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$8;name:'Cabinet';number:2;dip:((dip_val:$8;dip_name:'Upright'),(dip_val:$0;dip_name:'Cocktail'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$c0;name:'Lives';number:4;dip:((dip_val:$0;dip_name:'2'),(dip_val:$c0;dip_name:'3'),(dip_val:$80;dip_name:'4'),(dip_val:$40;dip_name:'5'),(),(),(),(),(),(),(),(),(),(),(),())),());
snapjack_dip_b:array [0..2] of def_dip=(
(mask:$f0;name:'Coin A';number:11;dip:((dip_val:$50;dip_name:'4C 1C'),(dip_val:$70;dip_name:'3C 1C'),(dip_val:$a0;dip_name:'2C 1C'),(dip_val:$60;dip_name:'3C 2C'),(dip_val:$90;dip_name:'2C 2C'),(dip_val:$f0;dip_name:'1C 1C'),(dip_val:$80;dip_name:'2C 3C'),(dip_val:$e0;dip_name:'1C 2C'),(dip_val:$d0;dip_name:'1C 3C'),(dip_val:$c0;dip_name:'1C 4C'),(dip_val:$b0;dip_name:'1C 5C'),(),(),(),(),())),
(mask:$0f;name:'Coin B';number:11;dip:((dip_val:$05;dip_name:'4C 1C'),(dip_val:$07;dip_name:'3C 1C'),(dip_val:$0a;dip_name:'2C 1C'),(dip_val:$06;dip_name:'3C 2C'),(dip_val:$09;dip_name:'2C 2C'),(dip_val:$0f;dip_name:'1C 1C'),(dip_val:$08;dip_name:'2C 3C'),(dip_val:$0e;dip_name:'1C 2C'),(dip_val:$0d;dip_name:'1C 3C'),(dip_val:$0c;dip_name:'1C 4C'),(dip_val:$0b;dip_name:'1C 5C'),(),(),(),(),())),());
cavenger_dip_a:array [0..5] of def_dip=(
(mask:$3;name:'Difficulty';number:4;dip:((dip_val:$3;dip_name:'Easy'),(dip_val:$2;dip_name:'Medium'),(dip_val:$1;dip_name:'Hard'),(dip_val:$0;dip_name:'Hardest'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$4;name:'High Score Names';number:2;dip:((dip_val:$0;dip_name:'3 Letters'),(dip_val:$4;dip_name:'10 Letters'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$8;name:'Cabinet';number:2;dip:((dip_val:$0;dip_name:'Upright'),(dip_val:$8;dip_name:'Cocktail'),(),(),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$30;name:'Initial High Score';number:4;dip:((dip_val:$0;dip_name:'0'),(dip_val:$30;dip_name:'5000'),(dip_val:$20;dip_name:'8000'),(dip_val:$10;dip_name:'10000'),(),(),(),(),(),(),(),(),(),(),(),())),
(mask:$c0;name:'Lives';number:4;dip:((dip_val:$0;dip_name:'2'),(dip_val:$c0;dip_name:'3'),(dip_val:$80;dip_name:'4'),(dip_val:$40;dip_name:'5'),(),(),(),(),(),(),(),(),(),(),(),())),());
procedure update_video_ladybug;
var
f,h,color,nchar:word;
x,y,atrib:byte;
flipx,flipy:boolean;
i:integer;
scroll_y:array[0..$1f] of word;
begin
fill_full_screen(1,0);
for f:=$0 to $3ff do begin
if gfx[0].buffer[f] then begin
x:=f div 32;
y:=31-(f mod 32);
atrib:=memoria[$d400+f];
nchar:=memoria[$d000+f]+(atrib and $08) shl 5;
color:=(atrib and $7) shl 2;
put_gfx_trans(x*8,y*8,nchar,color,2,0);
gfx[0].buffer[f]:=false;
end;
end;
for f:=0 to $1f do scroll_y[f]:=not(memoria[$d000+(32*(f and 3)+(f shr 2))]);
scroll__y_part2(2,1,8,@scroll_y);
for f:=$e downto $2 do begin
i:=0;
h:=f*$40;
while ((i<$40) and (buffer_sprites[h+i]<>0)) do i:=i+4;
while (i>0) do begin
i:=i-4;
atrib:=buffer_sprites[h+i];
if (atrib and $80)<>0 then begin
color:=(buffer_sprites[$2+(h+i)] and $f) shl 2;
if main_screen.flip_main_screen then y:=buffer_sprites[$3+(h+i)]+1
else y:=241-(buffer_sprites[$3+(h+i)]);
flipy:=(atrib and $20)<>0;
flipx:=(atrib and $10)<>0;
if (atrib and $40)<>0 then begin // 16x16
nchar:=(buffer_sprites[$1+(h+i)] shr 2)+4*(buffer_sprites[$2+(h+i)] and $10);
x:=(h shr 2)-8+(atrib and $f);
if main_screen.flip_main_screen then begin
x:=240-x;
flipy:=not(flipy);
flipx:=not(flipx);
end;
put_gfx_sprite(nchar and $7f,color,flipx,flipy,1);
actualiza_gfx_sprite(x,y,1,1);
end else begin //8x8 Parece ser que LB no usa los sprites pequeños!!!
nchar:=buffer_sprites[$1+(h+i)]+16*(buffer_sprites[$2+(h+i)] and $10);
x:=(h shr 2)+(atrib and $f);
if main_screen.flip_main_screen then begin
x:=240-x;
flipy:=not(flipy);
flipx:=not(flipx);
end;
put_gfx_sprite(nchar and $1ff,color,flipx,flipy,2);
actualiza_gfx_sprite(x,y+8,1,2);
end;
end;
end;
end;
actualiza_trozo_final(32,8,192,240,1);
end;
procedure eventos_ladybug;
begin
if event.arcade then begin
//P1
if arcade_input.up[0] then marcade.in0:=(marcade.in0 and $f7) else marcade.in0:=(marcade.in0 or $8);
if arcade_input.down[0] then marcade.in0:=(marcade.in0 and $fd) else marcade.in0:=(marcade.in0 or $2);
if arcade_input.left[0] then marcade.in0:=(marcade.in0 and $fe) else marcade.in0:=(marcade.in0 or $1);
if arcade_input.right[0] then marcade.in0:=(marcade.in0 and $fb) else marcade.in0:=(marcade.in0 or $4);
if arcade_input.but0[0] then marcade.in0:=(marcade.in0 and $ef) else marcade.in0:=(marcade.in0 or $10);
if arcade_input.start[0] then marcade.in0:=(marcade.in0 and $df) else marcade.in0:=(marcade.in0 or $20);
if arcade_input.start[1] then marcade.in0:=(marcade.in0 and $bf) else marcade.in0:=(marcade.in0 or $40);
//MISC
if arcade_input.but1[0] then marcade.in2:=(marcade.in2 and $fe) else marcade.in2:=(marcade.in2 or $1);
if arcade_input.but1[1] then marcade.in2:=(marcade.in2 and $fd) else marcade.in2:=(marcade.in2 or $2);
//P2
if arcade_input.up[1] then marcade.in1:=(marcade.in1 and $f7) else marcade.in1:=(marcade.in1 or $8);
if arcade_input.down[1] then marcade.in1:=(marcade.in1 and $fd) else marcade.in1:=(marcade.in1 or $2);
if arcade_input.left[1] then marcade.in1:=(marcade.in1 and $fe) else marcade.in1:=(marcade.in1 or $1);
if arcade_input.right[1] then marcade.in1:=(marcade.in1 and $fb) else marcade.in1:=(marcade.in1 or $4);
if arcade_input.but0[1] then marcade.in1:=(marcade.in1 and $ef) else marcade.in1:=(marcade.in1 or $10);
//SYS
if arcade_input.coin[0] then z80_0.change_nmi(ASSERT_LINE) else z80_0.change_nmi(CLEAR_LINE);
if arcade_input.coin[1] then z80_0.change_irq(HOLD_LINE);
end;
end;
procedure ladybug_principal;
var
frame:single;
f:byte;
begin
init_controls(false,false,false,true);
frame:=z80_0.tframes;
while EmuStatus=EsRuning do begin
for f:=0 to $ff do begin
z80_0.run(frame);
frame:=frame+z80_0.tframes-z80_0.contador;
if f=224 then begin
marcade.in1:=$80 or (marcade.in1 and $3f);
update_video_ladybug;
copymemory(@buffer_sprites,@memoria[$7000],$400);
end;
end;
eventos_ladybug;
video_sync;
marcade.in1:=$40 or (marcade.in1 and $3f);
end;
end;
function ladybug_getbyte(direccion:word):byte;
begin
case direccion of
0..$6fff,$d000..$d7ff:ladybug_getbyte:=memoria[direccion];
$9000:ladybug_getbyte:=marcade.in0;
$9001:ladybug_getbyte:=marcade.in1;
$9002:ladybug_getbyte:=marcade.dswa;
$9003:ladybug_getbyte:=marcade.dswb;
$e000:ladybug_getbyte:=marcade.in2;
end;
end;
procedure ladybug_putbyte(direccion:word;valor:byte);
begin
case direccion of
0..$5fff:;
$6000..$73ff:memoria[direccion]:=valor;
$a000:main_screen.flip_main_screen:=(valor and 1)<>0;
$b000..$bfff:sn_76496_0.Write(valor);
$c000..$cfff:sn_76496_1.Write(valor);
$d000..$d7ff:if memoria[direccion]<>valor then begin
gfx[0].buffer[direccion and $3ff]:=true;
memoria[direccion]:=valor;
end;
end;
end;
procedure ladybug_sound_update;
begin
sn_76496_0.Update;
sn_76496_1.Update;
end;
//Main
procedure reset_ladybug;
begin
z80_0.reset;
sn_76496_0.reset;
sn_76496_1.reset;
reset_audio;
marcade.in0:=$ff;
marcade.in1:=$7f;
marcade.in2:=$ff;
end;
function iniciar_ladybug:boolean;
var
colores:tpaleta;
f:word;
bit0,bit1:byte;
memoria_temp:array[0..$1fff] of byte;
rweights,gweights,bweights:array[0..1] of single;
const
ps_x:array[0..15] of dword=(0, 2, 4, 6, 8, 10, 12, 14,
8*16+0, 8*16+2, 8*16+4, 8*16+6, 8*16+8, 8*16+10, 8*16+12, 8*16+14);
ps_y:array[0..15] of dword=(23*16, 22*16, 21*16, 20*16, 19*16, 18*16, 17*16, 16*16,
7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16);
pc_x:array[0..7] of dword=(7, 6, 5, 4, 3, 2, 1, 0);
pc_y:array[0..7] of dword=(0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8);
pss_y:array[0..7] of dword=(7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16);
resistances:array[0..1] of integer=(470,220);
begin
llamadas_maquina.bucle_general:=ladybug_principal;
llamadas_maquina.reset:=reset_ladybug;
iniciar_ladybug:=false;
iniciar_audio(false);
screen_init(1,256,256,false,true);
screen_init(2,256,256,true);
screen_mod_scroll(2,256,256,255,256,256,255);
if main_vars.tipo_maquina<>34 then main_screen.rot90_screen:=true;
iniciar_video(192,240);
//Main CPU
z80_0:=cpu_z80.create(4000000,256);
z80_0.change_ram_calls(ladybug_getbyte,ladybug_putbyte);
z80_0.init_sound(ladybug_sound_update);
//Audio chips
sn_76496_0:=sn76496_chip.Create(4000000);
sn_76496_1:=sn76496_chip.Create(4000000);
case main_vars.tipo_maquina of
34:begin //Lady bug
//cargar roms
if not(roms_load(@memoria,ladybug_rom)) then exit;
//convertir chars
if not(roms_load(@memoria_temp,ladybug_char)) then exit;
init_gfx(0,8,8,512);
gfx[0].trans[0]:=true;
gfx_set_desc_data(2,0,8*8,0,512*8*8);
convert_gfx(0,0,@memoria_temp,@pc_x,@pc_y,false,true);
//convertir sprites
if not(roms_load(@memoria_temp,ladybug_sprites)) then exit;
init_gfx(1,16,16,128);
gfx[1].trans[0]:=true;
gfx_set_desc_data(2,0,64*8,1,0);
convert_gfx(1,0,@memoria_temp,@ps_x,@ps_y,false,true);
//convetir sprites pequeños
init_gfx(2,8,8,512);
gfx[2].trans[0]:=true;
gfx_set_desc_data(2,0,16*8,1,0);
convert_gfx(2,0,@memoria_temp,@ps_x,@pss_y,false,true);
//DIP
marcade.dswa:=$df;
marcade.dswb:=$ff;
marcade.dswa_val:=@ladybug_dip_a;
marcade.dswb_val:=@ladybug_dip_b;
//poner la paleta
if not(roms_load(@memoria_temp,ladybug_pal)) then exit;
end;
200:begin //SnapJack
//cargar roms
if not(roms_load(@memoria,snapjack_rom)) then exit;
//convertir chars
if not(roms_load(@memoria_temp,snapjack_char)) then exit;
init_gfx(0,8,8,512);
gfx[0].trans[0]:=true;
gfx_set_desc_data(2,0,8*8,0,512*8*8);
convert_gfx(0,0,@memoria_temp,@pc_x,@pc_y,false,true);
//convertir sprites
if not(roms_load(@memoria_temp,snapjack_sprites)) then exit;
init_gfx(1,16,16,128);
gfx[1].trans[0]:=true;
gfx_set_desc_data(2,0,64*8,1,0);
convert_gfx(1,0,@memoria_temp,@ps_x,@ps_y,false,true);
//convetir sprites pequeños
init_gfx(2,8,8,512);
gfx[2].trans[0]:=true;
gfx_set_desc_data(2,0,16*8,1,0);
convert_gfx(2,0,@memoria_temp,@ps_x,@pss_y,false,true);
//DIP
marcade.dswa:=$c7;
marcade.dswb:=$ff;
marcade.dswa_val:=@snapjack_dip_a;
marcade.dswb_val:=@snapjack_dip_b;
//poner la paleta
if not(roms_load(@memoria_temp,snapjack_pal)) then exit;
end;
201:begin //Cosmic Avenger
//cargar roms
if not(roms_load(@memoria,cavenger_rom)) then exit;
//convertir chars
if not(roms_load(@memoria_temp,cavenger_char)) then exit;
init_gfx(0,8,8,512);
gfx[0].trans[0]:=true;
gfx_set_desc_data(2,0,8*8,0,512*8*8);
convert_gfx(0,0,@memoria_temp,@pc_x,@pc_y,false,true);
//convertir sprites
if not(roms_load(@memoria_temp,cavenger_sprites)) then exit;
init_gfx(1,16,16,128);
gfx[1].trans[0]:=true;
gfx_set_desc_data(2,0,64*8,1,0);
convert_gfx(1,0,@memoria_temp,@ps_x,@ps_y,false,true);
//convetir sprites pequeños
init_gfx(2,8,8,512);
gfx[2].trans[0]:=true;
gfx_set_desc_data(2,0,16*8,1,0);
convert_gfx(2,0,@memoria_temp,@ps_x,@pss_y,false,true);
//DIP
marcade.dswa:=$c7;
marcade.dswb:=$ff;
marcade.dswa_val:=@cavenger_dip_a;
marcade.dswb_val:=@ladybug_dip_b;
//poner la paleta
if not(roms_load(@memoria_temp,cavenger_pal)) then exit;
end;
end;
compute_resistor_weights(0, 255, -1.0,
2,@resistances[0],@rweights,470,0,
2,@resistances[0],@gweights,470,0,
2,@resistances[0],@bweights,470,0);
for f:=0 to $1f do begin
// red component */
bit0:=(not(memoria_temp[f]) shr 0) and $01;
bit1:=(not(memoria_temp[f]) shr 5) and $01;
colores[f].r:=combine_2_weights(@rweights,bit0,bit1);
// green component */
bit0:=(not(memoria_temp[f]) shr 2) and $01;
bit1:=(not(memoria_temp[f]) shr 6) and $01;
colores[f].g:=combine_2_weights(@gweights,bit0,bit1);
// blue component */
bit0:=(not(memoria_temp[f]) shr 4) and $01;
bit1:=(not(memoria_temp[f]) shr 7) and $01;
colores[f].b:=combine_2_weights(@bweights,bit0,bit1);
end;
set_pal(colores,$20);
for f:=0 to $1f do begin
gfx[0].colores[f]:=((f shl 3) and $18) or ((f shr 2) and $07);
gfx[1].colores[f]:=BITSWAP8((memoria_temp[f+$20] shr 0) and $f,7,6,5,4,0,1,2,3);
gfx[1].colores[f+$20]:=BITSWAP8((memoria_temp[f+$20] shr 4) and $f,7,6,5,4,0,1,2,3);
gfx[2].colores[f]:=gfx[1].colores[f];
gfx[2].colores[f+$20]:=gfx[1].colores[f+$20];
end;
//final
reset_ladybug;
iniciar_ladybug:=true;
end;
end.
|
unit MessageDigest5Utils;
interface
uses
SysUtils,
Classes,
IdGlobal,
IdHash,
IdHashMessageDigest;
function MD5FromString(AString: string): string;
implementation
function MD5FromString(AString: string): string;
var
md5: TIdHashMessageDigest5;
stream: TStream;
begin
md5 := TIdHashMessageDigest5.Create;
try
stream := TMemoryStream.Create;
try
WriteStringToStream(stream, AString, enUTF8);
stream.Position := 0;
Result := LowerCase(md5.HashStreamAsHex(stream));
finally
FreeAndNil(stream);
end;
finally
FreeAndNil(md5);
end;
end;
end.
|
unit xx1_TLB;
{ This file contains pascal declarations imported from a type library.
This file will be written during each import or refresh of the type
library editor. Changes to this file will be discarded during the
refresh process. }
{ xx1 Library }
{ Version 1.0 }
interface
uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
const
LIBID_xx1: TGUID = '{DFFABB20-65D3-11D1-AB0D-008029EC1811}';
const
{ Component class GUIDs }
Class_Pepito: TGUID = '{DFFABB22-65D3-11D1-AB0D-008029EC1811}';
type
{ Forward declarations: Interfaces }
IPepito = interface;
IPepitoDisp = dispinterface;
{ Forward declarations: CoClasses }
Pepito = IPepito;
{ Dispatch interface for Pepito Object }
IPepito = interface(IDispatch)
['{DFFABB21-65D3-11D1-AB0D-008029EC1811}']
function GetName: WideString; safecall;
end;
{ DispInterface declaration for Dual Interface IPepito }
IPepitoDisp = dispinterface
['{DFFABB21-65D3-11D1-AB0D-008029EC1811}']
function GetName: WideString; dispid 1;
end;
{ PepitoObject }
CoPepito = class
class function Create: IPepito;
class function CreateRemote(const MachineName: string): IPepito;
end;
implementation
uses ComObj;
class function CoPepito.Create: IPepito;
begin
Result := CreateComObject(Class_Pepito) as IPepito;
end;
class function CoPepito.CreateRemote(const MachineName: string): IPepito;
begin
Result := CreateRemoteComObject(MachineName, Class_Pepito) as IPepito;
end;
end.
|
{*******************************************************}
{ }
{ Delphi REST Client Framework }
{ }
{ Copyright(c) 2013-2019 Embarcadero Technologies, Inc. }
{ All rights reserved }
{ }
{*******************************************************}
unit REST.Response.Adapter;
interface
{$SCOPEDENUMS ON}
uses
System.JSON, System.Rtti, System.Classes, System.DateUtils,
Data.DB,
Data.Bind.Components,
REST.Client,
System.Generics.Collections,
REST.Types;
type
TOnBeforeOpenDataSetEvent = procedure(Sender: TObject) of object;
TJSONParserObjectCallback = procedure(const AJSONObject: TJSONObject) of object;
/// <summary>
/// Updates a dataset with the content of a TJSONValue. Can dynamically generate field definitions or
/// use user-specified field definitions.
/// </summary>
TCustomJSONDataSetAdapter = class abstract(TComponent)
private type
TAdaptJSONFieldType = (JSONObject, JSONArray, JSONValue);
TAdaptJSONField = record
public
Path: string;
FieldName: string;
FieldType: TAdaptJSONFieldType;
constructor Create(const AName, APath: string; AFieldType: TAdaptJSONFieldType);
end;
strict private
FDataSet: TDataSet;
FFieldDefsDS: TDataSet;
FFieldDefs: TFieldDefs;
FInternalFieldDefsDS: TDataSet;
FInternalFieldDefs: TFieldDefs;
FInternalFieldPaths: TDictionary<string, string>;
FStringFieldSize: Integer;
procedure SetFieldDefs(AValue: TFieldDefs);
procedure SetDataSet(const AValue: TDataSet);
procedure ScanJSONForFields(const AJSON: TJSONValue);
procedure TransferJSONData(const AJSON: TJSONValue);
procedure AddJSONFieldNames(const AParent: TJSONValue; const APath: string;
const AList: TList<TAdaptJSONField>; ADepth: Integer); overload;
procedure AddJSONFieldNames(const AParent: TJSONValue;
const AList: TList<TAdaptJSONField>; ADepth: Integer); overload;
procedure AddJSONDataRow(const AJSONValue: TJSONValue);
procedure AddJSONDataRows(const AJSON: TJSONValue);
protected
procedure DoBeforeOpenDataSet; virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
function GetFieldDefsClass: TFieldDefsClass; virtual;
function GetDefaultFieldName(const AJSON: TJSONValue): string; virtual;
function GetScanDepth: Integer; virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
/// <summary>
/// Clears all field definitions.
/// </summary>
procedure ResetToDefaults;
/// <summary>
/// Activates and loads the attached dataset. First, the field definitions are determined.
/// If the FieldDefs list is empty, then the JSON value will
/// be scanned for field definitions. Otherwise, the definitions in the FieldDefs list
/// will be used. Next, the field definitions are assigned to the dataset so that the dataset can create fields.
/// Finally, the dataset is loaded from the elements in the JSON value.
/// </summary>
procedure UpdateDataSet(const AJSON: TJSONValue);
/// <summary>
/// Closes the dataset and clears field definitions from the dataset.
/// </summary>
procedure ClearDataSet;
/// <summary>
/// Dataset that will be filled with values from a JSON value.
/// </summary>
property Dataset: TDataSet read FDataSet write SetDataSet;
/// <summary>
/// Optional list of field definitions. Add to this list to explicitly define the names and types of fields
/// to add to the dataset. The Name property of each field definition should correspond to a member of the JSON value.
/// Adding a field definition is one way to customize the dataset. Another way is to
/// add fields to the dataset. When adding fields to the dataset, the FieldName property of each field should correspond to a member of the JSON value.
/// </summary>
property FieldDefs: TFieldDefs read FFieldDefs write SetFieldDefs;
property StringFieldSize: Integer read FStringFieldSize write FStringFieldSize;
end;
/// <summary>
/// Updates a dataset with the JSONValue from a REST response.
/// </summary>
TCustomRESTResponseDataSetAdapter = class(TComponent)
private type
/// <summary>
/// Declare adapter responsible for writing the JSONValue to the dataset
/// </summary>
TAdapter = class(TCustomJSONDataSetAdapter)
private
FOwner: TCustomRESTResponseDataSetAdapter;
protected
procedure DoBeforeOpenDataSet; override;
function GetDefaultFieldName(const AJSON: TJSONValue): string; override;
function GetScanDepth: Integer; override;
end;
TNotify = class(TCustomRESTResponse.TNotify)
private
FOwner: TCustomRESTResponseDataSetAdapter;
constructor Create(const AOwner: TCustomRESTResponseDataSetAdapter);
public
procedure JSONValueChanged(ASender: TObject); override;
end;
public type
TJSONValueError = (NoContent, NoJSON, NoResponseComponent, InvalidRootElement);
TJSONValueErrorEvent = procedure(Sender: TObject; AUpdateError: TJSONValueError; const AMessage: string) of object;
EJSONValueError = class(ERESTException)
private
FError: TJSONValueError;
public
constructor Create(AError: TJSONValueError; const AMessage: string);
property Error: TJSONValueError read FError;
end;
strict private
FOnBeforeOpenDataSet: TOnBeforeOpenDataSetEvent;
FAdapter: TAdapter;
FResponse: TCustomRESTResponse;
FAutoUpdate: boolean;
FNotify: TNotify;
FResponseJSONIntf: IRESTResponseJSON;
FNestedElementsDepth: Integer;
FNestedElements: Boolean;
FDeferActivate: Boolean;
procedure SetResponse(const AValue: TCustomRESTResponse);
function GetDataSet: TDataSet;
function GetFieldDefs: TFieldDefs;
procedure SetDataSet(const Value: TDataSet);
procedure SetFieldDefs(const Value: TFieldDefs);
procedure SetActive(const Value: boolean);
function GetActive: boolean;
procedure SetAutoUpdate(const Value: boolean);
procedure SetResponseJSONIntf(const Value: IRESTResponseJSON);
procedure ResponseJSONChanged(Sender: TObject);
procedure SetNestedElementsDepth(const Value: Integer);
procedure InvalidateJSONValue;
procedure DoJSONValueChanged;
private
FRootElement: string;
FJSONValue: TJSONValue;
FOnUpdateError: TJSONValueErrorEvent;
procedure SetNestedElements(const Value: Boolean);
function CreateJSONValue: TJSONValue;
function GetJSONValue: TJSONValue;
function GetResponseComponent: IRESTResponseJSON;
function GetRootFieldName: string;
function GetStringFieldSize: Integer;
procedure SetStringFieldSize(const Value: Integer);
protected
procedure DoBeforeOpenDataSet; virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetRootElement(const AValue: string);
procedure Loaded; override;
procedure DoUpdateError(AError: TJSONValueError; const AMessage: string); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetDefaultFieldName(const AJSON: TJSONValue): string; deprecated;
/// <summary>
/// Set Active True to fill the dataset. Set Active False to close the dataset.
/// </summary>
property Active: boolean read GetActive write SetActive default False;
/// <summary>
/// Set to AutoUpdate True to automatically update the dataset when the JSON changes. For example,
/// if the Response property is set, then the dataset will be updated when the corresponding
/// request is executed.
/// </summary>
property AutoUpdate: boolean read FAutoUpdate write SetAutoUpdate default True;
// <summary>Associate the adapter with a REST response. When the corresponding request is execute, the dataset may be automatically filled.
property Response: TCustomRESTResponse read FResponse write SetResponse;
// <summary>Associate the adapter with an object that has a JSON value. When the JSON of the object is updated, the dataset may be automatically filled.
property ResponseJSON: IRESTResponseJSON read FResponseJSONIntf write SetResponseJSONIntf;
/// <summary>
/// Clears all field definitions.
/// </summary>
procedure ResetToDefaults;
/// <summary>
/// Activates and loads the attached dataset. First, the field definitions are determined.
/// If the FieldDefs list is empty, then the JSON value will
/// be scanned for field definitions. Otherwise, the definitions in the FieldDefs list
/// will be used. Next, the field definitions are assigned to the dataset so that the dataset can create fields.
/// Finally, the dataset is loaded from the elements in the JSON value.
/// </summary>
procedure UpdateDataSet(AJSONValue: TJSONValue = nil);
/// <summary>
/// Clears an attached dataset.
/// </summary>
procedure ClearDataSet;
property Dataset: TDataSet read GetDataSet write SetDataSet;
/// <summary>
/// Optional list of field definitions. Add to this list to explicitly define the names and types of fields
/// to add to the dataset. The Name property of each field definition should correspond to a member of the JSON value.
/// Adding a field definition is one way to customize the dataset. Another way is to
/// add fields to the dataset. When adding fields to the dataset, the FieldName property of each field should correspond to a member of the JSON value.
/// </summary>
property FieldDefs: TFieldDefs read GetFieldDefs write SetFieldDefs;
/// <summary>
/// Optional path into the JSON value. The path identifies a starting point for loading the dataset.
/// This RootElement is applied after an optionally set RootElement of the corresponding TRESTResponse was applied.
/// A Response object may also have a RootElement. In this case, the RootElement of the response object is applied before
/// the RootElement of the adapter.
/// Sample RootElement paths: "foo", "foo.bar", "[0].foo", "foo.bar[0]".
/// </summary>
property RootElement: string read FRootElement write SetRootElement;
property OnBeforeOpenDataSet: TOnBeforeOpenDataSetEvent read FOnBeforeOpenDataSet write FOnBeforeOpenDataSet;
/// <summary>
/// When NestedElements is true, JSON child elements will be used to define fields.
/// </summary>
property NestedElements: Boolean read FNestedElements write SetNestedElements default False;
/// <summary>
/// NestedElementsDepth is used when NestedElements = true. NestedElementsDepth indicate how
/// deep to scan JSON child elements for fields. The value 0 indicates a deep scan.
/// </summary>
property NestedElementsDepth: Integer read FNestedElementsDepth write SetNestedElementsDepth default 0;
property StringFieldSize: Integer read GetStringFieldSize write SetStringFieldSize default 255;
property OnUpdateError: TJSONValueErrorEvent read FOnUpdateError write FOnUpdateError;
end;
TRESTResponseDataSetAdapter = class(TCustomRESTResponseDataSetAdapter)
published
property Active;
property AutoUpdate;
property Dataset;
property FieldDefs;
property Response;
property ResponseJSON;
property RootElement;
property NestedElementsDepth;
property NestedElements;
property StringFieldSize;
property OnBeforeOpenDataSet;
property OnUpdateError;
end;
/// <summary>JSON value holder. Allows TRESTResponseDataSetAdapter to consume a JSON value
/// created by a means other than TRESTResponse.
/// To use, assign an instance of this class to TRESTREsponseDataSetAdapter.ResponseJSON.
/// </summary>
TRESTResponseJSON = class(TComponent, IRESTResponseJSON)
private
FValue: TJSONValue;
FJSONNotifyList: TList<TNotifyEvent>;
FOwnsValue: Boolean;
protected
/// <summary>Indicate that the JSON value has changed. Subscribers will be notified.</summary>
procedure ValueChanged(Sender: TObject);
{ IRESTResponseJSON }
/// <summary>Add a change event for subscribing to a change to the JSON value</summary>
procedure AddJSONChangedEvent(const ANotify: TNotifyEvent);
/// <summary>Remove a change event</summary>
procedure RemoveJSONChangedEvent(const ANotify: TNotifyEvent);
/// <summary>Get the current JSON value</summary>
procedure GetJSONResponse(out AValue: TJSONValue; out AHasOwner: Boolean);
/// <summary>Indicate if there is a JSON value</summary>
function HasJSONResponse: Boolean;
/// <summary>Indicate if there is some content. In this class, the content is always JSON</summary>
function HasResponseContent: Boolean;
public
/// <summary>Create the class with no JSON</summary>
constructor Create(AOwner: TComponent); overload; override;
/// <summary>Create the class with JSON. If AOwnsValue is true then the JSON will be freed automatically.</summary>
constructor Create(AOwner: TComponent; const AValue: TJSONValue; AOwnsValue: Boolean); reintroduce; overload;
destructor Destroy; override;
/// <summary>Set the JSON value. Subscribers will be notified. If AOwnsValue is true then the JSON will be freed automatically.</summary>
procedure SetJSONValue(const AValue: TJSONValue; AOwnsValue: Boolean);
end;
implementation
uses
System.SysUtils, System.StrUtils, System.Types,
REST.Utils, System.Math, REST.Consts,
System.Variants;
type
/// <summary>
/// we need a TDataSet-Class to maintain the FieldDefs (they're requiring a
/// "living" dataset. we cannot just use TDataSet as it contains abstract
/// methods. so we need a minimal implementation without abstract methods.
/// USED ONLY INTERNALLY
/// </summary>
TRESTAdapterDataSet = class(TDataSet)
protected
procedure InternalClose; override;
procedure InternalHandleException; override;
procedure InternalInitFieldDefs; override;
procedure InternalOpen; override;
function IsCursorOpen: boolean; override;
{$IFDEF NEXTGEN}
function GetRecord(Buffer: TRecBuf; GetMode: TGetMode; DoCheck: boolean): TGetResult; override;
{$ENDIF !NEXTGEN}
end;
function FindDefaultDataSet(AComp: TComponent): TDataSet;
begin
Result := TRESTFindDefaultComponent.FindDefaultT<TDataSet>(AComp);
end;
{ TCustomJSONDataSetAdapter }
procedure TCustomJSONDataSetAdapter.AddJSONDataRows(const AJSON: TJSONValue);
var
LJSONValue: TJSONValue;
begin
if AJSON is TJSONArray then
begin
// Multiple rows
for LJSONValue in TJSONArray(AJSON) do
AddJSONDataRow(LJSONValue);
end
else
AddJSONDataRow(AJSON);
end;
procedure TCustomJSONDataSetAdapter.AddJSONDataRow(const AJSONValue: TJSONValue);
var
LValue : variant;
LJSONValue: TJSONValue;
LField: TField;
I: Integer;
LPath: string;
LDateTime: TDateTime;
begin
Assert(FDataSet <> nil);
FDataSet.Append;
try
for I := 0 to FDataSet.Fields.Count - 1 do
begin
LField := FDataSet.Fields[I];
if not FInternalFieldPaths.TryGetValue(LField.FieldName, LPath) then
LPath := LField.FieldName;
if not AJSONValue.TryGetValue<TJSONValue>(LPath, LJSONValue) then
LJSONValue := nil;
if (LJSONValue = nil) then
LValue := System.Variants.Null
else
if (LJSONValue IS TJSONFalse) then
LValue := False
else
if (LJSONValue IS TJSONTrue) then
LValue := True
else
if (LJSONValue IS TJSONNull) then
LValue := System.Variants.Null
else
if (LJSONValue IS TJSONObject) then
LValue:= LJSONValue.ToString
else
if (LJSONValue IS TJSONArray) then
LValue:= LJSONValue.ToString
else
if LJSONValue IS TJSONString then
begin
LValue := LJSONValue.Value;
if LField.DataType = ftDateTIme then
begin
if TryISO8601ToDate(LJSONValue.Value, LDateTime) then
LValue := LDateTime
end
else if LField.DataType = ftTime then
begin
if TryISO8601ToDate(LJSONValue.Value, LDateTime) then
LValue := TTime(TimeOf(LDateTime))
end
else if LField.DataType = ftDate then
begin
if TryISO8601ToDate(LJSONValue.Value, LDateTime) then
LValue := TDate(DateOf(LDateTime));
end
end
else
LValue := LJSONValue.Value;
LField.Value := LValue;
end;
finally
FDataSet.Post;
end;
end;
procedure TCustomJSONDataSetAdapter.ClearDataSet;
begin
if Assigned(FDataSet) then
begin
FDataSet.Close;
FDataSet.FieldDefs.Clear;
end;
end;
constructor TCustomJSONDataSetAdapter.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDataSet := nil;
FFieldDefsDS := TRESTAdapterDataSet.Create(self);
FFieldDefs := GetFieldDefsClass.Create(FFieldDefsDS);
FInternalFieldDefsDS := TRESTAdapterDataSet.Create(self);
FInternalFieldDefs := GetFieldDefsClass.Create(FInternalFieldDefsDS);
FInternalFieldPaths := TDictionary<string, string>.Create;
FStringFieldSize := 255;
end;
destructor TCustomJSONDataSetAdapter.Destroy;
begin
FreeAndNIL(FFieldDefs);
FFieldDefsDS.Free;
FInternalFieldDefs.Free;
FInternalFieldDefsDS.Free;
FInternalFieldPaths.Free;
inherited;
end;
procedure TCustomJSONDataSetAdapter.DoBeforeOpenDataSet;
begin
//
end;
constructor TCustomJSONDataSetAdapter.TAdaptJSONField.Create(const AName, APath: string; AFieldType: TAdaptJSONFieldType);
begin
FieldName := AName;
Path := APath;
FieldType := AFieldType;
end;
procedure TCustomJSONDataSetAdapter.AddJSONFieldNames(const AParent: TJSONValue; const APath: string; const AList: TList<TAdaptJSONField>; ADepth: Integer);
procedure InternalAddJSONFieldNames(const AParent: TJSONValue; const AFullName, APath: string; const AList: TList<TAdaptJSONField>; ADepth: Integer);
function BuildPath(const AParentPath, AName: string): string;
begin
if Pos('.', AName) <> 0 then
Result := AParentPath + '[''' + AName + ''']'
else
begin
Result := AParentPath;
if Result <> '' then
Result := Result + '.';
Result := Result + AName;
end;
end;
function BuildFullName(const AParentName, AName: string): string;
begin
Result := AParentName;
if Result <> '' then
Result := Result + '.';
Result := Result + AName;
end;
var
LPair: TJSONPair;
LDepth: Integer;
begin
if ADepth = 0 then
Exit;
Assert((AParent is TJSONObject) or (APath <> ''));
if AParent <> nil then
if AParent is TJSONObject then
begin
if APath <> '' then
begin
AList.Add(TAdaptJSONField.Create(AFullName, APath, TAdaptJSONFieldType.JSONObject));
LDepth := ADepth - 1;
end
else
LDepth := ADepth;
for LPair in TJSONObject(AParent) do
InternalAddJSONFieldNames(LPair.JsonValue, BuildFullName(AFullName, LPair.JsonString.Value),
BuildPath(APath, LPair.JsonString.Value), AList, LDepth);
end
else if AParent is TJSONArray then
begin
if APath <> '' then
AList.Add(TAdaptJSONField.Create(AFullName, APath, TAdaptJSONFieldType.JSONArray));
end
else
begin
if APath <> '' then
AList.Add(TAdaptJSONField.Create(AFullName, APath, TAdaptJSONFieldType.JSONValue));
end;
end;
begin
InternalAddJSONFieldNames(AParent, APath, APath, AList, ADepth);
end;
procedure TCustomJSONDataSetAdapter.AddJSONFieldNames(const AParent: TJSONValue; const AList: TList<TAdaptJSONField>; ADepth: Integer);
var
LValue: TJSONValue;
begin
if ADepth = 0 then
Exit;
if AParent is TJSONObject then
AddJSONFieldNames(AParent, '', AList, ADepth)
else if AParent is TJSONArray then
begin
if TJSONArray(AParent).Count > 0 then
begin
LValue := TJSONArray(AParent).Items[0];
if LValue is TJSONObject then
AddJSONFieldNames(LValue, '', AList, ADepth)
else if LValue is TJSONArray then
AList.Add(TAdaptJSONField.Create(GetDefaultFieldName(LValue), '', TAdaptJSONFieldType.JSONArray))
else
AList.Add(TAdaptJSONField.Create(GetDefaultFieldName(LValue), '', TAdaptJSONFieldType.JSONValue))
end;
end
else
AList.Add(TAdaptJSONField.Create(GetDefaultFieldName(AParent), '', TAdaptJSONFieldType.JSONValue));
end;
procedure TCustomJSONDataSetAdapter.ScanJSONForFields(const AJSON: TJSONValue);
function AddFieldDef(const AFieldName: string; const ADataType: TFieldType): boolean;
var
LFieldDef: TFieldDef;
begin
Result := FALSE;
// we add each field only once
if FInternalFieldDefs.IndexOf(AFieldName) < 0 then
begin
LFieldDef := FInternalFieldDefs.AddFieldDef;
LFieldDef.Name := AFieldName;
LFieldDef.DataType := ADataType;
/// set size for stringtype-fields
if (ADataType in [ftString, ftWideString]) then
LFieldDef.Size := StringFieldSize;
Result := True;
end;
end;
var
LJSONFieldList: TList<TAdaptJSONField>;
LJSONField: TAdaptJSONField;
begin
Assert(FDataSet <> nil);
Assert(AJSON <> nil);
LJSONFieldList := TList<TAdaptJSONField>.Create;
try
AddJSONFieldNames(AJSON, LJSONFieldList, Max(1, GetScanDepth));
for LJSONField in LJSONFieldList do
begin
AddFieldDef(LJSONField.FieldName, ftWideString);
// Save path associated with a field
FInternalFieldPaths.AddOrSetValue(LJSONField.FieldName, LJSONField.Path);
end;
finally
LJSONFieldList.Free;
end;
end;
procedure TCustomJSONDataSetAdapter.TransferJSONData(const AJSON: TJSONValue);
var
LContext: TRTTIContext;
LType: TRTTIType;
LMethod: TRTTIMethod;
begin
Assert(Assigned(FDataSet));
Assert(Assigned(AJSON));
/// dataset MUST have fields before we can continue
if (FDataSet.Fields.Count = 0) and (FDataSet.FieldDefs.Count = 0) then
exit;
// Disable controls while creating dataset so that
// activate notification is sent after populate
FDataSet.DisableControls;
try
if not FDataSet.Active then
begin
DoBeforeOpenDataSet;
if not FDataSet.Active then
begin
LType := LContext.GetType(FDataSet.ClassType);
if LType <> nil then
begin
// Support TClientDataSet
LMethod := LType.GetMethod('CreateDataSet');
if (LMethod <> nil) and (Length(LMethod.GetParameters) = 0) then
LMethod.Invoke(FDataSet, []);
end;
end;
if not FDataSet.Active then
FDataSet.Open;
end;
AddJSONDataRows(AJSON);
/// just for convenience we relocate
/// the dataset to the first record
FDataSet.First;
finally
FDataSet.EnableControls;
end;
end;
function TCustomRESTResponseDataSetAdapter.GetActive: boolean;
begin
result := (Dataset <> nil) and Dataset.Active;
end;
function TCustomJSONDataSetAdapter.GetDefaultFieldName(
const AJSON: TJSONValue): string;
begin
Result := AJSON.ClassName.Substring(1);
end;
function TCustomJSONDataSetAdapter.GetFieldDefsClass: TFieldDefsClass;
begin
result := DefaultFieldDefsClass;
end;
function TCustomJSONDataSetAdapter.GetScanDepth: Integer;
begin
Result := 1;
end;
procedure TCustomJSONDataSetAdapter.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited;
/// clean up component-references
if (Operation = opRemove) then
begin
if (AComponent = FDataSet) then
FDataSet := nil
end;
end;
procedure TCustomJSONDataSetAdapter.ResetToDefaults;
begin
FFieldDefs.Clear;
FFieldDefsDS.Fields.Clear;
FFieldDefsDS.FieldDefs.Clear;
FInternalFieldDefsDS.Fields.Clear;
FInternalFieldDefsDS.FieldDefs.Clear;
end;
procedure TCustomJSONDataSetAdapter.SetDataSet(const AValue: TDataSet);
begin
if Assigned(FDataSet) then
FDataSet.RemoveFreeNotification(self);
FDataSet := AValue;
if Assigned(FDataSet) then
FDataSet.FreeNotification(self);
end;
procedure TCustomJSONDataSetAdapter.SetFieldDefs(AValue: TFieldDefs);
begin
FieldDefs.Assign(AValue);
end;
procedure TCustomJSONDataSetAdapter.UpdateDataSet(const AJSON: TJSONValue);
var
I: Integer;
LField: TField;
LFieldDef: TFieldDef;
begin
/// this code might get triggered even without a tdataset
/// being attached. so we should check, if we have a dataset
/// or not - both is okay. really.
if Assigned(FDataSet) and (not (csDestroying in FDataSet.ComponentState)) and
(not (csLoading in FDataSet.ComponentState)) then
begin
FInternalFieldPaths.Clear;
try
/// if we do not have any predefined fields-defs,
/// we scan the JSON for available fields
if FFieldDefs.Count = 0 then
begin
FInternalFieldDefs.Clear;
// The following may raise an exception
ScanJSONForFields(AJSON);
end
else
FInternalFieldDefs.Assign(FFieldDefs);
except
if FDataSet.Active then
FDataSet.Close;
raise;
end;
if FDataSet.Active then
FDataSet.Close;
// Synchronize fielddefs and persistent fields
if FDataSet.Fields.Count > 0 then
begin
for I := 0 to FInternalFieldDefs.Count - 1 do
begin
// Be sure fields and fields defs are compatible
LField := FDataSet.FindField(FInternalFieldDefs[I].Name);
if LField <> nil then
LField.SetFieldDefProps(FInternalFieldDefs[I]);
end;
for I := 0 to FDataSet.Fields.Count - 1 do
begin
LField := FDataSet.Fields[I];
if (FInternalFieldDefs as TDefCollection).Find(LField.FieldName) = nil then
begin
// Be sure there is a fielddef for every field
LFieldDef := FInternalFieldDefs.AddFieldDef;
LFieldDef.Name := LField.FieldName;
LField.SetFieldDefProps(LFieldDef);
end;
end;
end;
FDataSet.DisableControls;
try
FDataSet.FieldDefs.Clear;
FDataSet.FieldDefs.Assign(FInternalFieldDefs);
finally
FDataSet.EnableControls;
end;
TransferJSONData(AJSON);
end;
end;
{ TCustomRESTResponseDataSetAdapter }
procedure TCustomRESTResponseDataSetAdapter.Notification(AComponent: TComponent; Operation: TOperation);
begin
inherited;
/// clean up component-references
if (Operation = opRemove) then
begin
if (AComponent = Response) then
begin
FResponse := nil;
if not (csDestroying in ComponentState) then
DoJSONValueChanged;
end;
if (FResponseJSONIntf is TComponent) and (TComponent(FResponseJSONIntf) = AComponent) then
begin
FResponseJSONIntf := nil;
if not (csDestroying in ComponentState) then
DoJSONValueChanged;
end;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.ResetToDefaults;
begin
FAdapter.ResetToDefaults;
end;
function TCustomRESTResponseDataSetAdapter.GetResponseComponent: IRESTResponseJSON;
begin
Result := nil;
if Response <> nil then
Result := Response
else if ResponseJSON <> nil then
Result := ResponseJSON;
end;
function TCustomRESTResponseDataSetAdapter.CreateJSONValue: TJSONValue;
var
LJsonValue: TJSONValue;
LHasOwner: Boolean;
LPathValue: TJSONValue;
LRESTResponseJSON: IRESTResponseJSON;
begin
LRESTResponseJSON := GetResponseComponent;
if LRESTResponseJSON = nil then
raise EJSONValueError.Create(TJSONValueError.NoResponseComponent, sAdapterResponseComponentIsNil);
if LRESTResponseJSON.HasResponseContent then
if not LRESTResponseJSON.HasJSONResponse then
raise EJSONValueError.Create(TJSONValueError.NoJSON, sResponseContentIsNotJSON);
if LRESTResponseJSON.HasJSONResponse then
begin
LRESTResponseJSON.GetJSONResponse(LJSONValue, LHasOwner);
try
Assert(LJSONValue <> nil);
if LHasOwner then
LJSONValue := LJSONValue.Clone as TJSONValue;
LHasOwner := False;
if (RootElement <> '') and (LJsonValue <> nil) then
begin
if LJSONValue.TryGetValue<TJSONValue>(RootElement, LPathValue) then
begin
LPathValue.Owned := False; // Need to decouple from parent, to avoid memleak
LJsonValue.Free;
LJsonValue := LPathValue;
end
else
raise EJSONValueError.Create(TJSONValueError.InvalidRootElement, Format(sAdapterInvalidRootElement, [RootElement]));
end;
except
if not LHasOwner then
LJSONValue.Free;
raise;
end;
end
else
LJSONValue := TJSONArray.Create; // Empty value
Result := LJSONValue;
end;
function TCustomRESTResponseDataSetAdapter.GetJSONValue: TJSONValue;
begin
if FJSONValue = nil then
FJSONValue := CreateJSONValue;
Assert(FJSONValue <> nil);
Result := FJSONValue;
end;
procedure TCustomRESTResponseDataSetAdapter.SetActive(const Value: boolean);
begin
if Value <> Active then
begin
if csLoading in ComponentState then
FDeferActivate := Value
else
begin
if Value then
UpdateDataSet
else
ClearDataSet;
end;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.SetAutoUpdate(const Value: boolean);
begin
// Changing autoupdate does not cause an update.
FAutoUpdate := Value;
end;
procedure TCustomRESTResponseDataSetAdapter.ClearDataSet;
begin
if Assigned(FAdapter) then
FAdapter.ClearDataSet;
end;
constructor TCustomRESTResponseDataSetAdapter.Create(AOwner: TComponent);
begin
inherited;
FAutoUpdate := TRUE;
FNotify := TNotify.Create(self);
FAdapter := TAdapter.Create(Self);
FAdapter.FOwner := self;
end;
destructor TCustomRESTResponseDataSetAdapter.Destroy;
begin
FAdapter.Free;
inherited;
if FResponse <> nil then
if FResponse.NotifyList <> nil then
FResponse.NotifyList.RemoveNotify(FNotify);
FNotify.Free;
FJSONValue.Free;
end;
procedure TCustomRESTResponseDataSetAdapter.DoBeforeOpenDataSet;
begin
if Assigned(FOnBeforeOpenDataSet) then
FOnBeforeOpenDataSet(self)
end;
procedure TCustomRESTResponseDataSetAdapter.DoJSONValueChanged;
begin
InvalidateJSONValue;
if not(csLoading in ComponentState) then
if AutoUpdate then
if (GetResponseComponent <> nil) and (GetResponseComponent.HasResponseContent) then
UpdateDataSet
else
ClearDataSet;
end;
procedure TCustomRESTResponseDataSetAdapter.DoUpdateError(AError: TJSONValueError; const AMessage: string);
begin
if Assigned(FOnUpdateError) then
FOnUpdateError(Self, AError, AMessage);
end;
function TCustomRESTResponseDataSetAdapter.GetDataSet: TDataSet;
begin
if Assigned(FAdapter) then
result := FAdapter.Dataset
else
result := nil;
end;
function TCustomRESTResponseDataSetAdapter.GetDefaultFieldName(
const AJSON: TJSONValue): string;
begin
Result := FAdapter.GetDefaultFieldName(AJSON);
end;
function TCustomRESTResponseDataSetAdapter.GetRootFieldName: string;
var
I: Integer;
LRootElement: string;
begin
LRootElement := RootElement;
if LRootElement = '' then
begin
if FResponse <> nil then
LRootElement := FResponse.RootElement;
end;
if LRootElement <> '' then
begin
I := LRootElement.LastDelimiter('.');
if I >= 0 then
Result := LRootElement.Substring(I+1);
end;
end;
function TCustomRESTResponseDataSetAdapter.GetFieldDefs: TFieldDefs;
begin
if Assigned(FAdapter) then
result := FAdapter.FieldDefs
else
result := nil;
end;
function TCustomRESTResponseDataSetAdapter.GetStringFieldSize: Integer;
begin
if Assigned(FAdapter) then
Result := FAdapter.StringFieldSize
else
Result := 5000;
end;
procedure TCustomRESTResponseDataSetAdapter.InvalidateJSONValue;
begin
FreeAndNil(FJSONValue);
end;
procedure TCustomRESTResponseDataSetAdapter.Loaded;
begin
inherited;
if FDeferActivate then
begin
if (GetResponseComponent <> nil) and (GetResponseComponent.HasResponseContent) then
begin
FDeferActivate := False;
Active := True;
end;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.SetDataSet(const Value: TDataSet);
begin
if Assigned(FAdapter) then
FAdapter.Dataset := Value;
end;
procedure TCustomRESTResponseDataSetAdapter.SetFieldDefs(const Value: TFieldDefs);
begin
if Assigned(FAdapter) then
FAdapter.FieldDefs := Value;
end;
procedure TCustomRESTResponseDataSetAdapter.SetResponse(const AValue: TCustomRESTResponse);
begin
if AValue <> FResponse then
begin
if Assigned(FResponse) then
begin
FResponse.RemoveFreeNotification(self);
if FResponse.NotifyList <> nil then
FResponse.NotifyList.RemoveNotify(FNotify);
FResponse.RemoveFreeNotification(self);
end;
FResponse := AValue;
if Assigned(FResponse) then
begin
ResponseJSON := nil;
FResponse.FreeNotification(self);
if FResponse.NotifyList <> nil then
FResponse.NotifyList.AddNotify(FNotify);
FResponse.RemoveFreeNotification(self);
end;
if AutoUpdate then
DoJSONValueChanged;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.ResponseJSONChanged(Sender: TObject);
begin
DoJSONValueChanged;
end;
procedure TCustomRESTResponseDataSetAdapter.SetResponseJSONIntf(
const Value: IRESTResponseJSON);
var
LDoChange: Boolean;
begin
if FResponseJSONIntf <> Value then
begin
LDoChange := True;
if FResponseJSONIntf <> nil then
begin
if FResponseJSONIntf is TComponent then
TComponent(FResponseJSONIntf).RemoveFreeNotification(Self);
FResponseJSONIntf.RemoveJSONChangedEvent(ResponseJSONChanged);
end;
FResponseJSONIntf := Value;
if FResponseJSONIntf <> nil then
begin
LDoChange := Response = nil; // Following line will DoChange if Response <> nil
Response := nil;
if FResponseJSONIntf is TComponent then
TComponent(FResponseJSONIntf).FreeNotification(Self);
FResponseJSONIntf.AddJSONChangedEvent(ResponseJSONChanged);
end;
if LDoChange then
DoJSONValueChanged;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.SetRootElement(const AValue: string);
begin
if FRootElement <> AValue then
begin
FRootElement := AValue;
DoJSONValueChanged;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.SetNestedElements(
const Value: Boolean);
begin
if FNestedElements <> Value then
begin
FNestedElements := Value;
DoJSONValueChanged;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.SetNestedElementsDepth(const Value: Integer);
begin
if FNestedElementsDepth <> Value then
begin
FNestedElementsDepth := Value;
if FNestedElements then
DoJSONValueChanged;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.SetStringFieldSize(const Value: Integer);
begin
if StringFieldSize <> Value then
begin
if Assigned(FAdapter) then
FAdapter.StringFieldSize := Value;
DoJSONValueChanged;
end;
end;
procedure TCustomRESTResponseDataSetAdapter.UpdateDataSet(AJSONValue: TJSONValue);
begin
try
if Assigned(FAdapter) then
begin
if AJSONValue = nil then
AJSONValue := GetJSONValue;
FAdapter.UpdateDataSet(AJSONValue);
end;
except
on E: EJSONValueError do
if Assigned(FOnUpdateError) then
FOnUpdateError(Self, E.Error, E.Message)
else
raise;
else
raise;
end;
end;
{ TCustomRESTResponseDataSetAdapter.TAdapter }
procedure TCustomRESTResponseDataSetAdapter.TAdapter.DoBeforeOpenDataSet;
begin
FOwner.DoBeforeOpenDataSet;
end;
function TCustomRESTResponseDataSetAdapter.TAdapter.GetDefaultFieldName(const AJSON: TJSONValue): string;
begin
Result := FOwner.GetRootFieldName;
if Result = '' then
Result := inherited;
end;
function TCustomRESTResponseDataSetAdapter.TAdapter.GetScanDepth: Integer;
begin
if FOwner.NestedElements then
begin
Result := FOwner.NestedElementsDepth;
if Result <= 0 then
Result := MaxInt; // No limit
end
else
Result := 1;
end;
{ TRESTAdapterDataSet }
{$IFDEF NEXTGEN}
function TRESTAdapterDataSet.GetRecord(Buffer: TRecBuf; GetMode: TGetMode; DoCheck: boolean): TGetResult;
begin
result := grError;
end;
{$ENDIF}
procedure TRESTAdapterDataSet.InternalClose;
begin
// nothing to do here, implementation just to avoid
// abstract methods
end;
procedure TRESTAdapterDataSet.InternalHandleException;
begin
// nothing to do here, implementation just to avoid
// abstract methods
end;
procedure TRESTAdapterDataSet.InternalInitFieldDefs;
begin
// nothing to do here, implementation just to avoid
// abstract methods
end;
procedure TRESTAdapterDataSet.InternalOpen;
begin
// nothing to do here, implementation just to avoid
// abstract methods
end;
function TRESTAdapterDataSet.IsCursorOpen: boolean;
begin
result := FALSE;
end;
{ TCustomRESTResponseDataSetAdapter.TNotify }
constructor TCustomRESTResponseDataSetAdapter.TNotify.Create(const AOwner: TCustomRESTResponseDataSetAdapter);
begin
FOwner := AOwner;
end;
procedure TCustomRESTResponseDataSetAdapter.TNotify.JSONValueChanged(ASender: TObject);
begin
FOwner.DoJSONValueChanged;
end;
{ TCustomRESTResponseDataSetAdapter.EJSONValueError }
constructor TCustomRESTResponseDataSetAdapter.EJSONValueError.Create(
AError: TJSONValueError; const AMessage: string);
begin
inherited Create(AMessage);
end;
{ TRESTResponseJSON }
procedure TRESTResponseJSON.AddJSONChangedEvent(const ANotify: TNotifyEvent);
begin
Assert(not FJSONNotifyList.Contains(ANotify));
if not FJSONNotifyList.Contains(ANotify) then
FJSONNotifyList.Add(ANotify);
end;
constructor TRESTResponseJSON.Create(AOwner: TComponent);
begin
inherited;
FJSONNotifyList := TList<TNotifyEvent>.Create;
end;
constructor TRESTResponseJSON.Create(AOwner: TComponent; const AValue: TJSONValue; AOwnsValue: Boolean);
begin
Create(AOwner);
FValue := AValue;
FOwnsValue := AOwnsValue;
end;
destructor TRESTResponseJSON.Destroy;
begin
// We own the JSONValue, so free it.
if FOwnsValue then
FValue.Free;
FJSONNotifyList.Free;
inherited;
end;
procedure TRESTResponseJSON.GetJSONResponse(out AValue: TJSONValue;
out AHasOwner: Boolean);
begin
AValue := FValue;
AHasOwner := FOwnsValue; // We own this object
end;
function TRESTResponseJSON.HasJSONResponse: Boolean;
begin
Result := FValue <> nil;
end;
function TRESTResponseJSON.HasResponseContent: Boolean;
begin
Result := FValue <> nil;
end;
procedure TRESTResponseJSON.RemoveJSONChangedEvent(const ANotify: TNotifyEvent);
begin
Assert(FJSONNotifyList.Contains(ANotify));
FJSONNotifyList.Remove(ANotify);
end;
procedure TRESTResponseJSON.SetJSONValue(const AValue: TJSONValue;
AOwnsValue: Boolean);
begin
if FOwnsValue then
FreeAndNil(FValue);
FValue := AValue;
FOwnsValue := AOwnsValue;
ValueChanged(self);
end;
procedure TRESTResponseJSON.ValueChanged(Sender: TObject);
var
LNotifyEvent: TNotifyEvent;
begin
for LNotifyEvent in FJSONNotifyList do
LNotifyEvent(Self);
end;
end.
|
unit UIWappedPartUnit;
interface
uses
SearchOption_Intf, FMX.Controls, System.Classes;
type
TAbsUIWrappedPart = class(TAbsSearchOptionPart)
protected
FExpander: TExpander;
procedure Init(owner: TExpander);
function StrArrayToStrList(strArr: array of String): TStringList;
function StringComp(str1, str2: String): Boolean;
public
constructor Create(expander: TExpander);
function IsUse: Boolean; override;
procedure SetUse(val: Boolean); override;
end;
implementation
uses
System.SysUtils, StrUtils;
{ TUIWrappedSearchOptionPart }
constructor TAbsUIWrappedPart.Create(expander: TExpander);
begin
Init( expander );
end;
procedure TAbsUIWrappedPart.Init(owner: TExpander);
begin
FExpander := owner;
end;
function TAbsUIWrappedPart.IsUse: Boolean;
begin
result := ( FExpander.ShowCheck = false ) or
( ( FExpander.ShowCheck = true ) and ( FExpander.IsChecked = true ) );
end;
procedure TAbsUIWrappedPart.SetUse(val: Boolean);
begin
if FExpander.ShowCheck = true then
begin
FExpander.IsChecked := val;
end;
end;
function TAbsUIWrappedPart.StrArrayToStrList(
strArr: array of String): TStringList;
var
sList: TStringList;
i: Integer;
begin
sList := TStringList.Create;
for i := 0 to High( strArr ) do
begin
sList.Add( strArr[ i ] );
end;
result := sList;
end;
function TAbsUIWrappedPart.StringComp(str1, str2: String): Boolean;
var
pWideChar1, pWideChar2: PWideChar;
begin
pWideChar1 := @str1;
pWideChar2 := @str2;
result := StrComp( pWideChar1, pWideChar2 ) > 0;
end;
end.
|
unit nsUserFlagsFilters;
// Модуль: "w:\garant6x\implementation\Garant\GbaNemesis\Data\Users\nsUserFlagsFilters.pas"
// Стереотип: "SimpleClass"
// Элемент модели: "TnsUserFlagsFilters" MUID: (4901E95F019D)
{$Include w:\garant6x\implementation\Garant\nsDefine.inc}
interface
uses
l3IntfUses
, l3TreeFilters
, bsInterfaces
, l3TreeInterfaces
;
type
TnsUserFlagsFilters = class(Tl3TreeFilters, InsUserFlagsFilters)
private
f_Group: InsGroupFilter;
f_Flags: InsUserFlagsFilter;
f_PermanentFlags: InsUserFlagsFilter;
protected
function pm_GetUserFlags: InsUserFlagsFilter;
function SetUserFlag(const aFilter: InsUserFlagsFilter): InsUserFlagsFilters;
function pm_GetGroup: InsGroupFilter;
function SetGroup(const aFilter: InsGroupFilter): InsUserFlagsFilters;
function pm_GetPermanentUserFlags: InsUserFlagsFilter;
function SetPermanentUserFlag(const aFilter: InsUserFlagsFilter): InsUserFlagsFilters;
procedure Cleanup; override;
{* Функция очистки полей объекта. }
public
constructor Create(const aSource: Il3TreeFilters); override;
end;//TnsUserFlagsFilters
implementation
uses
l3ImplUses
, nsUserFlagsFilter
, SysUtils
, nsGroupFilter
//#UC START# *4901E95F019Dimpl_uses*
//#UC END# *4901E95F019Dimpl_uses*
;
function TnsUserFlagsFilters.pm_GetUserFlags: InsUserFlagsFilter;
//#UC START# *4901E691032E_4901E95F019Dget_var*
//#UC END# *4901E691032E_4901E95F019Dget_var*
begin
//#UC START# *4901E691032E_4901E95F019Dget_impl*
Result := f_Flags;
//#UC END# *4901E691032E_4901E95F019Dget_impl*
end;//TnsUserFlagsFilters.pm_GetUserFlags
function TnsUserFlagsFilters.SetUserFlag(const aFilter: InsUserFlagsFilter): InsUserFlagsFilters;
//#UC START# *4901E6C301FD_4901E95F019D_var*
//#UC END# *4901E6C301FD_4901E95F019D_var*
begin
//#UC START# *4901E6C301FD_4901E95F019D_impl*
f_Flags := aFilter;
Result := Self;
//#UC END# *4901E6C301FD_4901E95F019D_impl*
end;//TnsUserFlagsFilters.SetUserFlag
function TnsUserFlagsFilters.pm_GetGroup: InsGroupFilter;
//#UC START# *49F0161A037E_4901E95F019Dget_var*
//#UC END# *49F0161A037E_4901E95F019Dget_var*
begin
//#UC START# *49F0161A037E_4901E95F019Dget_impl*
Result := f_Group;
//#UC END# *49F0161A037E_4901E95F019Dget_impl*
end;//TnsUserFlagsFilters.pm_GetGroup
function TnsUserFlagsFilters.SetGroup(const aFilter: InsGroupFilter): InsUserFlagsFilters;
//#UC START# *49F019C2015C_4901E95F019D_var*
//#UC END# *49F019C2015C_4901E95F019D_var*
begin
//#UC START# *49F019C2015C_4901E95F019D_impl*
f_Group := aFilter;
Result := Self;
//#UC END# *49F019C2015C_4901E95F019D_impl*
end;//TnsUserFlagsFilters.SetGroup
function TnsUserFlagsFilters.pm_GetPermanentUserFlags: InsUserFlagsFilter;
//#UC START# *49F1573C02B4_4901E95F019Dget_var*
//#UC END# *49F1573C02B4_4901E95F019Dget_var*
begin
//#UC START# *49F1573C02B4_4901E95F019Dget_impl*
Result := f_PermanentFlags;
//#UC END# *49F1573C02B4_4901E95F019Dget_impl*
end;//TnsUserFlagsFilters.pm_GetPermanentUserFlags
function TnsUserFlagsFilters.SetPermanentUserFlag(const aFilter: InsUserFlagsFilter): InsUserFlagsFilters;
//#UC START# *49F157660281_4901E95F019D_var*
//#UC END# *49F157660281_4901E95F019D_var*
begin
//#UC START# *49F157660281_4901E95F019D_impl*
f_PermanentFlags := aFilter;
Result := Self;
//#UC END# *49F157660281_4901E95F019D_impl*
end;//TnsUserFlagsFilters.SetPermanentUserFlag
procedure TnsUserFlagsFilters.Cleanup;
{* Функция очистки полей объекта. }
//#UC START# *479731C50290_4901E95F019D_var*
//#UC END# *479731C50290_4901E95F019D_var*
begin
//#UC START# *479731C50290_4901E95F019D_impl*
f_Flags := nil;
f_Group := nil;
f_PermanentFlags := nil;
inherited;
//#UC END# *479731C50290_4901E95F019D_impl*
end;//TnsUserFlagsFilters.Cleanup
constructor TnsUserFlagsFilters.Create(const aSource: Il3TreeFilters);
//#UC START# *48FF4F47010F_4901E95F019D_var*
var
l_Filter: InsUserFlagsFilters;
//#UC END# *48FF4F47010F_4901E95F019D_var*
begin
//#UC START# *48FF4F47010F_4901E95F019D_impl*
inherited Create(aSource);
if Supports(aSource, InsUserFlagsFilters, l_Filter) then
begin
if Assigned(l_Filter.PermanentUserFlags) then
f_PermanentFlags := TnsUserFlagsFilter.Make(l_Filter.PermanentUserFlags.UserFlag);
if Assigned(l_Filter.UserFlags) then
f_Flags := TnsUserFlagsFilter.Make(l_Filter.UserFlags.UserFlag);
if Assigned(l_Filter.Group) then
f_Group := TnsGroupFilter.Make(l_Filter.Group.GroupUID);
end;
//#UC END# *48FF4F47010F_4901E95F019D_impl*
end;//TnsUserFlagsFilters.Create
end.
|
unit tipe_data;
interface
type
ttanggal = record
tanggal : integer;
bulan : integer;
tahun : integer;
end;
tuser = record
nama : string;
alamat : string;
username : string;
password : string;
role : string;
end;
peminjaman = record
ID_Buku : integer;
Username : string;
Judul_Buku : string;
Tanggal_Peminjaman : string;
Tanggal_Batas_Peminjaman : string;
Status_Pengembalian : boolean;
end;
buku = record
ID_Buku : integer;
Judul_Buku : string;
Author : string;
Jumlah_Buku : integer;
Tahun_Penerbit : integer;
Kategori : string;
end;
pengembalian = record
Username : string;
ID_Buku : integer;
Tanggal_Pengembalian : string;
end;
kehilangan = record
Username : string;
ID_Buku_Hilang : integer;
Tanggal_Laporan : string;
end;
tabUser = record
T : array[1..1000] of tuser;
Neff : integer; (*Nilai Efektif array*)
end;
tabBuku = record
T : array [1..1000] of buku;
Neff : integer; (*Nilai efektif array*)
end;
tabPinjam = record
T : array [1..1000] of peminjaman;
Neff : integer; (*Nilai efektif array*)
end;
tabKembali = record
T : array [1..1000] of pengembalian;
Neff : integer; (*Nilai efektif array*)
end;
tabHilang = record
T : array [1..1000] of kehilangan;
Neff : integer; (*Nilai efektif array*)
end;
implementation
end.
|
unit MarkAddressAsDetectedAsDepartedRequestUnit;
interface
uses
REST.Json.Types, SysUtils,
HttpQueryMemberAttributeUnit,
GenericParametersUnit;
type
TMarkAddressAsDetectedAsDepartedRequest = class(TGenericParameters)
private
[JSONMarshalled(False)]
[HttpQueryMember('route_id')]
FRouteId: String;
[JSONMarshalled(False)]
[HttpQueryMember('route_destination_id')]
FRouteDestinationId: Integer;
[JSONNameAttribute('is_departed')]
FIsDeparted: boolean;
public
constructor Create(RouteId: String; RouteDestinationId: Integer; IsDeparted: boolean); reintroduce;
end;
implementation
{ TMarkAddressAsDetectedAsDepartedRequest }
constructor TMarkAddressAsDetectedAsDepartedRequest.Create(RouteId: String;
RouteDestinationId: Integer; IsDeparted: boolean);
begin
Inherited Create;
FRouteId := RouteId;
FRouteDestinationId := RouteDestinationId;
FIsDeparted := IsDeparted;
end;
end.
|
{ Date Created: 5/22/00 11:17:33 AM }
unit InfoSYSTEMTable;
interface
uses
Classes, DB, DBISAMTb, SysUtils, DBISAMTableAU, DataBuf;
type
TInfoSYSTEMRecord = record
PSite: String[4];
PNextID: String[5];
End;
TInfoSYSTEMBuffer = class(TDataBuf)
protected
function PtrIndex(Index:integer):Pointer;override;
public
Data: TInfoSYSTEMRecord
end;
TEIInfoSYSTEM = (InfoSYSTEMPrimaryKey);
TInfoSYSTEMTable = class( TDBISAMTableAU )
private
FDFSite: TStringField;
FDFNextID: TStringField;
procedure SetPSite(const Value: String);
function GetPSite:String;
procedure SetPNextID(const Value: String);
function GetPNextID:String;
function GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
procedure SetEnumIndex(Value: TEIInfoSYSTEM);
function GetEnumIndex: TEIInfoSYSTEM;
protected
function CreateField( const FieldName : string ): TField;
procedure CreateFields; virtual;
procedure SetActive(Value: Boolean); override;
procedure LoadFieldDefs(AStringList:TStringList);override;
procedure LoadIndexDefs(AStringList:TStringList);override;
public
function GetDataBuffer:TInfoSYSTEMRecord;
procedure StoreDataBuffer(ABuffer:TInfoSYSTEMRecord);
property DFSite: TStringField read FDFSite;
property DFNextID: TStringField read FDFNextID;
property PSite: String read GetPSite write SetPSite;
property PNextID: String read GetPNextID write SetPNextID;
procedure Validate; virtual;
published
property Active write SetActive;
property EnumIndex: TEIInfoSYSTEM read GetEnumIndex write SetEnumIndex;
end; { TInfoSYSTEMTable }
procedure Register;
implementation
function TInfoSYSTEMTable.GenerateNewFieldName( AOwner: TComponent; const DatasetName: string; const FieldName: string ): string;
var
I: Integer;
NewName: string;
Done: Boolean;
function ComponentExists( AOwner: TComponent; const CompName: string ): Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 To AOwner.ComponentCount - 1 do
begin
if AnsiCompareText( CompName, AOwner.Components[ I ].Name ) = 0 then
begin
Result := True;
Break;
end;
end;
end; { ComponentExists }
begin { TInfoSYSTEMTable.GenerateNewFieldName }
NewName := DatasetName;
for I := 1 to Length( FieldName ) do
begin
if FieldName[ I ] in [ '0'..'9', '_', 'A'..'Z', 'a'..'z' ] then
NewName := NewName + FieldName[ I ];
end;
if ComponentExists( Owner, NewName ) then
begin
I := 1;
Done := False;
repeat
Inc( I );
if not ComponentExists( AOwner, NewName + IntToStr( I ) ) then
begin
Result := NewName + IntToStr( I );
Done := True;
end;
until Done;
end
else
Result := NewName;
end; { TInfoSYSTEMTable.GenerateNewFieldName }
function TInfoSYSTEMTable.CreateField( const FieldName : string ): TField;
begin
{ First, try to find an existing field object. FindField is the same }
{ as FieldByName, but does not raise an exception if the field object }
{ cannot be found. }
Result := FindField( FieldName );
if Result = nil then
begin
{ If an existing field object cannot be found... }
{ Instruct the FieldDefs object to create a new field object }
Result := FieldDefs.Find( FieldName ).CreateField( Owner );
{ The new field object must be given a name so that it may appear in }
{ the Object Inspector. The Delphi default naming convention is used.}
Result.Name := GenerateNewFieldName( Owner, Name, FieldName);
end;
end; { TInfoSYSTEMTable.CreateField }
procedure TInfoSYSTEMTable.CreateFields;
begin
FDFSite := CreateField( 'Site' ) as TStringField;
FDFNextID := CreateField( 'NextID' ) as TStringField;
end; { TInfoSYSTEMTable.CreateFields }
procedure TInfoSYSTEMTable.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
if Active then
CreateFields;
end; { TInfoSYSTEMTable.SetActive }
procedure TInfoSYSTEMTable.Validate;
begin
{ Enter Validation Code Here }
end; { TInfoSYSTEMTable.Validate }
procedure TInfoSYSTEMTable.SetPSite(const Value: String);
begin
DFSite.Value := Value;
end;
function TInfoSYSTEMTable.GetPSite:String;
begin
result := DFSite.Value;
end;
procedure TInfoSYSTEMTable.SetPNextID(const Value: String);
begin
DFNextID.Value := Value;
end;
function TInfoSYSTEMTable.GetPNextID:String;
begin
result := DFNextID.Value;
end;
procedure TInfoSYSTEMTable.LoadFieldDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('Site, String, 4, N');
Add('NextID, String, 5, N');
end;
end;
procedure TInfoSYSTEMTable.LoadIndexDefs(AStringList: TStringList);
begin
inherited;
with AstringList do
begin
Add('PrimaryKey, NextID, Y, Y, N, N');
end;
end;
procedure TInfoSYSTEMTable.SetEnumIndex(Value: TEIInfoSYSTEM);
begin
case Value of
InfoSYSTEMPrimaryKey : IndexName := '';
end;
end;
function TInfoSYSTEMTable.GetDataBuffer:TInfoSYSTEMRecord;
var buf: TInfoSYSTEMRecord;
begin
fillchar(buf, sizeof(buf), 0);
buf.PSite := DFSite.Value;
buf.PNextID := DFNextID.Value;
result := buf;
end;
procedure TInfoSYSTEMTable.StoreDataBuffer(ABuffer:TInfoSYSTEMRecord);
begin
DFSite.Value := ABuffer.PSite;
DFNextID.Value := ABuffer.PNextID;
end;
function TInfoSYSTEMTable.GetEnumIndex: TEIInfoSYSTEM;
var iname : string;
begin
iname := uppercase(indexname);
if iname = '' then result := InfoSYSTEMPrimaryKey;
end;
(********************************************)
(************ Register Component ************)
(********************************************)
procedure Register;
begin
RegisterComponents( 'Info Tables', [ TInfoSYSTEMTable, TInfoSYSTEMBuffer ] );
end; { Register }
function TInfoSYSTEMBuffer.PtrIndex(index:integer):Pointer;
begin
result := nil;
case index of
1 : result := @Data.PSite;
2 : result := @Data.PNextID;
end;
end;
end. { InfoSYSTEMTable }
|
{*******************************************************************************
* *
* ksSES - AWS SES Interface *
* *
* https://github.com/gmurt/ksSES *
* *
* Copyright 2015 Graham Murt *
* *
* email: graham@kernow-software.co.uk *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*******************************************************************************}
unit ksSES;
interface
uses
Sysutils, Classes;
const
C_ENDPOINT_OREGON = 'email.us-west-2.amazonaws.com';
C_ENDPOINT_NORTH_VIRGINIA = 'email.us-east-1.amazonaws.com';
C_ENDPOINT_IRELAND = 'email.eu-west-1.amazonaws.com';
type
TksSESEndpoint = (sesEndpointOregon, sesEndpointNorthVirginia, sesEndpointIreland);
TksSESSendQuota = record
Max24HourSend: Extended;
MaxSendRate: Extended;
SentLast24Hours: Extended;
end;
IksSesMessageContent = interface
['{ED3D766F-8848-4DDB-AEC2-64B2BF7E83DD}']
function GetCharset: string;
function GetData: string;
procedure SetCharset(const Value: string);
procedure SetData(const Value: string);
property Charset: string read GetCharset write SetCharset;
property Data: string read GetData write SetData;
end;
IksSesMessageDestination = interface
['{E72991E5-8C97-46B3-84BA-39E497FF86D7}']
function GetBccList: TStrings;
function GetCcList: TStrings;
function GetReipients: TStrings;
property BccList: TStrings read GetBccList;
property CcList: TStrings read GetCcList;
property Recipients: TStrings read GetReipients;
end;
IksSesMessage = interface
['{21287B27-35CE-473E-8AB0-88809492E72F}']
function GetBody: string;
function GetSubject: string;
procedure SetBody(const Value: string);
procedure SetSubject(const Value: string);
property Body: string read GetBody write SetBody;
property Subject: string read GetSubject write SetSubject;
end;
IksSES = interface
['{79EE7247-AF52-40C8-B230-321B4AF06F2C}']
function GetEndpoint: TksSESEndpoint;
procedure SetEndpoint(Value: TksSESEndpoint);
function IsEmailVerified(AEmail: string): Boolean;
function GetSendQuota: TksSESSendQuota;
procedure DeleteIdentity(AIdentity: string);
procedure GetSenders(ASenders: TStrings; AVerifiedOnly: Boolean);
procedure VerifyEmailIdentity(AEmail: string);
procedure SendEmail(AFrom, ATo, ASubject, ABody: string); overload;
procedure SendEmail(AFrom: string;
ADestination: IksSesMessageDestination;
AMessage: IksSesMessage); overload;
property Endpoint: TksSESEndpoint read GetEndpoint write SetEndpoint;
end;
function CreateSes(AEndpoint: TksSESEndpoint; APublicKey, APrivateKey: string): IksSES;
function CreateSesMessage: IksSesMessage;
function CreateSesMessageDestination: IksSesMessageDestination;
implementation
uses DateUtils, ComObj, XMLIntf, XMLDoc, synacode, System.Net.HttpClientComponent,
System.Net.HttpClient;
type
TksSesMessageContent = class(TInterfacedObject, IksSesMessageContent)
private
FCharset: string;
FData: string;
function GetCharset: string;
function GetData: string;
procedure SetCharset(const Value: string);
procedure SetData(const Value: string);
protected
property Charset: string read GetCharset write SetCharset;
property Data: string read GetData write SetData;
end;
TksSesMessageDestination = class(TInterfacedObject, IksSesMessageDestination)
private
FBccList: TStrings;
FCcList: TStrings;
FRecipients: TStrings;
function GetBccList: TStrings;
function GetCcList: TStrings;
function GetReipients: TStrings;
protected
property BccList: TStrings read GetBccList;
property CcList: TStrings read GetCcList;
property Recipients: TStrings read GetReipients;
public
constructor Create;
destructor Destroy; override;
end;
TksSesMessage = class(TInterfacedObject, IksSesMessage)
private
FBody: string;
FSubject: string;
function GetBody: string;
function GetSubject: string;
procedure SetBody(const Value: string);
procedure SetSubject(const Value: string);
protected
property Body: string read GetBody write SetBody;
property Subject: string read GetSubject write SetSubject;
end;
TksSES = class(TInterfacedObject, IksSes)
private
{ Private declarations }
FPublickey: string;
FPrivateKey: string;
FHttp: TNetHTTPClient;
FEndpoint: TksSESEndpoint;
FParams: TStrings;
function GetEndpoint: TksSESEndpoint;
procedure SetEndpoint(Value: TksSESEndpoint);
function GetEndpointStr: string;
function ExecuteCommand(ACmd: string; AParams: TStrings): string;
function GetCurrentDate(ADate: TDateTime): string;
procedure ListVerifiedEmailAddresses(ASenders: TStrings);
procedure ListIdentities(AIdentities: TStrings);
protected
function GetSendQuota: TksSESSendQuota;
function IsEmailVerified(AEmail: string): Boolean;
procedure DeleteIdentity(AIdentity: string);
procedure GetSenders(ASenders: TStrings; AVerifiedOnly: Boolean);
procedure VerifyEmailIdentity(AEmail: string);
procedure SendEmail(AFrom, ATo, ASubject, ABody: string); overload;
procedure SendEmail(AFrom: string;
ADestination: IksSesMessageDestination;
AMessage: IksSesMessage); overload;
property Endpoint: TksSESEndpoint read GetEndpoint write SetEndpoint;
public
constructor Create(AEndpoint: TksSESEndpoint; APublicKey, APrivateKey: string);
destructor Destroy; override;
{ Public declarations }
end;
function CreateSes(AEndpoint: TksSESEndpoint; APublicKey, APrivateKey: string): IksSES;
begin
Result := TksSES.Create(AEndpoint, APublicKey, APrivateKey);
end;
function CreateSesMessage: IksSesMessage;
begin
Result := TksSesMessage.Create;
end;
function CreateSesMessageDestination: IksSesMessageDestination;
begin
Result := TksSesMessageDestination.Create;
end;
constructor TksSES.Create(AEndpoint: TksSESEndpoint; APublicKey, APrivateKey: string);
begin
FParams := TStringList.Create;
FpublicKey := APublicKey;
FprivateKey := APrivateKey;
FEndpoint := AEndpoint;
end;
procedure TksSES.DeleteIdentity(AIdentity: string);
var
AParams: TStringList;
begin
AParams := TStringList.Create;
try
AParams.Values['Identity'] := AIdentity;
ExecuteCommand('DeleteIdentity', AParams);
finally
AParams.Free;
end;
end;
destructor TksSES.Destroy;
begin
FParams.Free;
inherited;
end;
function TksSES.GetCurrentDate(ADate: TDateTime): string;
const
FORMAT_HTTP_DATE = 'ddd, dd mmm yyyy hh:nn:ss "GMT"';
begin
Result := FormatDateTime(FORMAT_HTTP_DATE, TTimeZone.Local.ToUniversalTime(ADate), TFormatSettings.Create('en-US'));
end;
function TksSES.ExecuteCommand(ACmd: string; AParams: TStrings): string;
var
AResponse: IHTTPResponse;
ADate: string;
ASig: AnsiString;
ICount: integer;
AStr: string;
begin
FHttp := TNetHTTPClient.Create(nil);
FParams.Clear;
if AParams <> nil then
FParams.Assign(AParams);
FParams.Insert(0, 'Action='+ACmd);
try
ADate := GetCurrentDate(now);
ASig := EncodeBase64(HMAC_SHA1(AnsiString(ADate), AnsiString(FPrivateKey)));
FHttp.CustomHeaders['Date'] := ADate;
FHttp.CustomHeaders['Host'] := GetEndpointStr;
FHttp.CustomHeaders['Content-Type'] := 'application/x-www-form-urlencoded';
FHttp.CustomHeaders['X-Amzn-Authorization'] := 'AWS3-HTTPS AWSAccessKeyId='+FPublickey+', Algorithm=HmacSHA1, Signature='+string(ASig);
AStr := '';
for ICount := 0 to FParams.Count-1 do
begin
AStr := AStr + FParams[ICount];
if ICount < FParams.Count-1 then
AStr := AStr + '&';
end;
AResponse := FHttp.Post('https://'+GetEndpointStr, FParams);
Result := AResponse.ContentAsString;
finally
FHttp.Free;
end;
end;
function TksSES.GetEndpoint: TksSESEndpoint;
begin
Result := FEndpoint;
end;
function TksSES.GetEndpointStr: string;
begin
case FEndpoint of
sesEndpointOregon : Result := C_ENDPOINT_OREGON;
sesEndpointNorthVirginia : Result := C_ENDPOINT_NORTH_VIRGINIA;
sesEndpointIreland : Result := C_ENDPOINT_IRELAND;
end;
end;
procedure TksSES.ListVerifiedEmailAddresses(ASenders: TStrings);
var
AXml: IXMLDocument;
AResult: string;
ARoot: IXMLNode;
ANode: IXMLNode;
ICount: integer;
begin
ASenders.Clear;
AXml := TXMLDocument.Create(nil);
AResult := ExecuteCommand('ListVerifiedEmailAddresses', nil);
AXml.LoadFromXML(AResult);
ARoot := AXml.DocumentElement;
ANode := ARoot.ChildNodes['ListVerifiedEmailAddressesResult'];
ANode := ANode.ChildNodes['VerifiedEmailAddresses'];
for iCount := 0 to ANode.ChildNodes.Count -1 do
ASenders.Add(LowerCase(ANode.ChildNodes[ICount].Text));
end;
procedure TksSES.ListIdentities(AIdentities: TStrings);
var
AXml: IXMLDocument;
AResult: string;
ARoot: IXMLNode;
ANode: IXMLNode;
ICount: integer;
begin
AIdentities.Clear;
AXml := TXMLDocument.Create(nil);
AResult := ExecuteCommand('ListIdentities', nil);
AXml.LoadFromXML(AResult);
ARoot := AXml.DocumentElement;
ANode := ARoot.ChildNodes['ListIdentitiesResult'];
ANode := ANode.ChildNodes['Identities'];
for iCount := 0 to ANode.ChildNodes.Count -1 do
AIdentities.Add(LowerCase(ANode.ChildNodes[ICount].Text));
end;
procedure TksSES.GetSenders(ASenders: TStrings; AVerifiedOnly: Boolean);
begin
case AVerifiedOnly of
True: ListVerifiedEmailAddresses(ASenders);
False: ListIdentities(ASenders);
end;
end;
function TksSES.GetSendQuota: TksSESSendQuota;
var
AXml: IXMLDocument;
AResult: string;
ANode: IXMLNode;
begin
AXml := TXMLDocument.Create(nil);
AResult := ExecuteCommand('GetSendQuota', nil);
AXml.LoadFromXML(AResult);
ANode := AXml.DocumentElement.ChildNodes['GetSendQuotaResult'];
Result.Max24HourSend := StrToFloat(ANode.ChildNodes['Max24HourSend'].Text);
Result.MaxSendRate := StrToFloat(ANode.ChildNodes['MaxSendRate'].Text);
Result.SentLast24Hours := StrToFloat(ANode.ChildNodes['SentLast24Hours'].Text);
end;
function TksSES.IsEmailVerified(AEmail: string): Boolean;
var
AStrings: TStrings;
begin
AStrings := TStringList.Create;
try
GetSenders(AStrings, True);
Result := AStrings.IndexOf(LowerCase(AEmail)) > -1;
finally
AStrings.Free;
end;
end;
procedure TksSES.SendEmail(AFrom, ATo, ASubject, ABody: string);
var
AMessage: IksSesMessage;
ADestination: IksSesMessageDestination;
begin
AMessage := CreateSesMessage;
ADestination := CreateSesMessageDestination;
ADestination.Recipients.Add(ATo);
AMessage.Subject := ASubject;
AMessage.Body := ABody;
SendEmail(AFrom, ADestination, AMessage);
end;
procedure TksSES.SendEmail(AFrom: string;
ADestination: IksSesMessageDestination;
AMessage: IksSesMessage);
var
AParams: TStrings;
ICount: integer;
begin
AParams := TStringList.Create;
try
AParams.Values['Source'] := AFrom;
for ICount := 1 to ADestination.Recipients.Count do
AParams.Values['Destination.ToAddresses.member.'+IntToStr(ICount)] := ADestination.Recipients[ICount-1];
for ICount := 1 to ADestination.CcList.Count do
AParams.Values['Destination.CcAddresses.member.'+IntToStr(ICount)] := ADestination.CcList[ICount-1];
for ICount := 1 to ADestination.BccList.Count do
AParams.Values['Destination.BccAddresses.member.'+IntToStr(ICount)] := ADestination.BccList[ICount-1];
AParams.Values['Message.Subject.Data'] := AMessage.Subject;
AParams.Values['Message.Body.Text.Data'] := AMessage.Body;
ExecuteCommand('SendEmail', AParams);
finally
AParams.Free;
end;
end;
procedure TksSES.SetEndpoint(Value: TksSESEndpoint);
begin
FEndpoint := Value;
end;
procedure TksSES.VerifyEmailIdentity(AEmail: string);
var
AParams: TStrings;
begin
AParams := TStringList.Create;
try
AParams.Values['EmailAddress'] := LowerCase(AEmail);
ExecuteCommand('VerifyEmailIdentity', AParams);
finally
AParams.Free;
end;
end;
{ TksSesMessage }
function TksSesMessage.GetBody: string;
begin
Result := FBody;
end;
function TksSesMessage.GetSubject: string;
begin
Result := FSubject;
end;
procedure TksSesMessage.SetBody(const Value: string);
begin
FBody := Value;
end;
procedure TksSesMessage.SetSubject(const Value: string);
begin
FSubject := Value;
end;
{ TksSesMessageDestination }
constructor TksSesMessageDestination.Create;
begin
FBccList := TStringList.Create;
FCcList := TStringList.Create;
FRecipients := TStringList.Create;
end;
destructor TksSesMessageDestination.Destroy;
begin
FBccList.Free;
FCcList.Free;
FRecipients.Free;
inherited;
end;
function TksSesMessageDestination.GetBccList: TStrings;
begin
Result := FBccList;
end;
function TksSesMessageDestination.GetCcList: TStrings;
begin
Result := FCcList;
end;
function TksSesMessageDestination.GetReipients: TStrings;
begin
Result := FRecipients;
end;
{ TksSesMessageContent }
function TksSesMessageContent.GetCharset: string;
begin
Result := FCharset;
end;
function TksSesMessageContent.GetData: string;
begin
Result := FData;
end;
procedure TksSesMessageContent.SetCharset(const Value: string);
begin
FCharset := Value;
end;
procedure TksSesMessageContent.SetData(const Value: string);
begin
FData := Value;
end;
end.
|
unit ThumbViewerClass;
interface
uses Windows, jpeg, ComCtrls, Classes, FileUtilUnit, SysUtils, Dialogs,
Graphics, ExtCtrls, TypInfo, Controls;
const IMAGE_FILE_MASKS = '.jpeg,.jpg,.bmp';
THUMB_WIDTH = 128;
THUMB_HEIGHT = 128;
type
TItemData = class
str: string;
check: boolean;
end;
type TThumbViewerClass = class(TListView)
private
FImageList: TImageList;
FOnItemDblClick : TNotifyEvent;
FTerminate: boolean;
FsearchResult: TSearchRec;
FPath: string;
public
constructor Create(AOwner: TComponent); override;
destructor Free;
function Prepare(APath: string): boolean;
function GetNextItem: boolean;
procedure Done;
procedure ThumbDblClick(Sender: TObject);
procedure Clear;override;
procedure DoTerminate;
property Terminate: boolean read FTerminate write FTerminate;
published
property OnItemDblClick: TNotifyEvent read FOnItemDblClick write FOnItemDblClick;
end;
implementation
constructor TThumbViewerClass.Create(AOwner: TComponent);
begin
inherited;
FTerminate := False;
FImageList := TImageList.Create(Owner);
FImageList.Width := THUMB_WIDTH;
FImageList.Height := THUMB_HEIGHT;
LargeImages := FImageList;
OnDblClick := ThumbDblClick;
end;
destructor TThumbViewerClass.Free;
begin
FImageList.Free;
end;
procedure TThumbViewerClass.Clear;
begin
inherited;
FImageList.Clear;
end;
procedure TThumbViewerClass.DoTerminate;
begin
FTerminate := True;
end;
procedure TThumbViewerClass.ThumbDblClick;
var
hts : THitTests;
ht : THitTest;
sht : string;
ListViewCursosPos : TPoint;
selectedItem : TListItem;
begin
ListViewCursosPos := ScreenToClient(Mouse.CursorPos) ;
hts := GetHitTestInfoAt(ListViewCursosPos.X, ListViewCursosPos.Y) ;
for ht in hts do
sht := GetEnumName(TypeInfo(THitTest), Integer(ht)) ;
if hts <= [htOnIcon, htOnItem, htOnLabel, htOnStateIcon] then
if Assigned(FOnItemDblClick) then
FOnItemDblClick(Selected);
end;
//Поиск файлов, да - существуют, нет - не существуют
function TThumbViewerClass.Prepare(APath: string): boolean;
begin
FPath := APath;
//Обновим
//Удалим несуществующие
Clear;
if FindFirst(FPath + '\*.*', faAnyFile, FsearchResult) = 0
then Result := True
else Result := False;
end;
//взять миниатюру, да - положил, нет - кончились
function TThumbViewerClass.GetNextItem: boolean;
var
ListItem: TListItem;
ItemData:TItemData;
Bitmap: TBitmap;
Image: TImage;
i: integer;
begin
if IsFileMasked(FsearchResult.Name, IMAGE_FILE_MASKS ) then
if (FsearchResult.Attr and faDirectory ) = 0 then
begin
ItemData := TItemData.Create;
ItemData.str :=FPath + '\' + FsearchResult.Name;
ListItem := Items.Add;
ListItem.Caption := FsearchResult.Name;
ListItem.Data := ItemData;
ListItem.ImageIndex := -1;
Image := TImage.Create(self);
Bitmap := TBitmap.Create;
Bitmap.SetSize(THUMB_WIDTH, THUMB_HEIGHT);
try
Image.Picture.LoadFromFile( ItemData.str );
Bitmap.Canvas.StretchDraw(
Bitmap.Canvas.ClipRect,
Image.Picture.Graphic
);
except
on E: Exception do
begin
Bitmap.Canvas.Pen.Color := clRed;
Bitmap.Canvas.MoveTo(0,0);
Bitmap.Canvas.LineTo(Bitmap.Width,Bitmap.Height);
Bitmap.Canvas.MoveTo(Bitmap.Width,0);
Bitmap.Canvas.LineTo(0,Bitmap.Height);
end;
end;
FImageList.Add(Bitmap, nil );
ListItem.ImageIndex := FImageList.Count-1;
ListItem.Update;
Bitmap.Free;
Image.Free;
end;
if FindNext(FsearchResult) <> 0
then
begin
Result := False;
end
else Result := True;
end;
procedure TThumbViewerClass.Done;
begin
FindClose(FsearchResult);
end;
end.
|
unit Unt_DiversasThreads;
interface
uses
System.Classes,
Unt_FuncaoLog;
type
/// <summary>
/// Thread que disputará o recurso de geração de LOG
/// </summary>
TDiversaThread = class(TThread)
private
FReferencia : string;
FDescricaoErro: string;
public
/// <summary>
/// Rotina a ser executada pelo thread que eventualmente
/// gerará uma linha no arquivo de LOG
/// </summary>
procedure Execute; override;
/// <summary>
/// Referência que será escrito no arquivo
/// de LOG para sabermos de onde veio a linha
/// </summary>
property Referencia: string read FReferencia write FReferencia;
/// <summary>
/// Caso ocorra um erro durante a execução do thread
/// o erro poderá ser consultado nesta propriedade
/// </summary>
property DescricaoErro: string read FDescricaoErro;
end;
implementation
uses
System.SysUtils;
{ TDiversaThread }
procedure TDiversaThread.Execute;
var
bGerarLog: Boolean;
begin
inherited;
try
// Loop enquanto o thread não for finalizado
while not(Self.Terminated) do
begin
//Faz com que não haja um consumo elevado de CPU
Sleep(10);
//Sorteia um número e verifica se o resto da divisão por dois é zero
bGerarLog := (Random(1000000) mod 2) = 0;
if (bGerarLog) then
begin
//Invoca o método de geração de LOG
TGeraLog.Instancia.GerarLog(Self.FReferencia, Now, 'O rato roeu a roupa do Rei de Roma');
end;
end;
except
on E: EInOutError do
begin
Self.FDescricaoErro := Format('Erro de I/O #%d - %s', [E.ErrorCode, SysErrorMessage(E.ErrorCode)]);
end;
on E: Exception do
begin
Self.FDescricaoErro := Format('(%s) - %s', [E.ClassName, E.Message]);
end;
end;
end;
end.
|
unit ImageLib;
// Copyright (c) 1996 Jorge Romero Gomez, Merchise.
interface
uses
Windows, Classes,
SpriteImages, FileFolders, MemUtils, StreamUtils, ListUtils;
type
TImageInfo =
class
Image : TSpriteImage;
fRefCount : integer;
constructor Create( anImage : TSpriteImage );
procedure Reference;
function Release : integer;
end;
type
TImageLibrary =
class
protected
fFileFolder : TFileFolder;
fCurrentSize : integer;
fMaxSize : integer;
fImages : TObjectList;
function GetImage( Indx : integer ) : TSpriteImage;
public
constructor Create( const Filename : string );
destructor Destroy; override;
function Load( Indx : integer ) : TSpriteImage;
procedure Release( anImage : TSpriteImage );
procedure Allocated( Size : integer );
procedure Freed( Size : integer );
procedure UncacheAll;
procedure Uncache( Size : integer );
property CurrentSize : integer read fCurrentSize;
property Images[ Indx : integer ] : TSpriteImage read GetImage; default;
end;
var
ImageLibrary : TImageLibrary = nil;
procedure InitImageLibrary( const Filename : string );
procedure DoneImageLibrary;
implementation
function Kb( Size : integer ) : integer;
begin
Result := (Size + 1023 ) div 1024;
end;
// TImageInfo
constructor TImageInfo.Create( anImage : TSpriteImage );
begin
inherited Create;
Image := anImage;
end;
procedure TImageInfo.Reference;
begin
Inc( fRefCount );
end;
function TImageInfo.Release : integer;
begin
Dec( fRefCount );
if fRefCount = 0
then
begin
Result := Image.ImageSize;
Free;
end
else Result := 0;
end;
// TImageLibrary
constructor TImageLibrary.Create( const Filename : string );
begin
inherited Create;
fFileFolder := TFileFolder.Create( Filename );
end;
destructor TImageLibrary.Destroy;
begin
fFileFolder.Free;
inherited;
end;
function TImageLibrary.GetImage( Indx : integer ) : TSpriteImage;
var
Info : TImageInfo;
begin
Info := TImageInfo( fImages[Indx] );
if Info <> nil
then Result := Info.Image
else Result := nil;
end;
function TImageLibrary.Load( Indx : integer ) : TSpriteImage;
var
Info : TImageInfo;
Stream : TStream;
begin
Info := TImageInfo( fImages[Indx] );
if Info <> nil
then
with Info do
begin
Reference;
Result := Image;
end
else
begin
Stream := TPointerStream.Create( fFileFolder[ Indx ], MaxInt );
Result := TFrameImage.LoadFromStream( Stream ); // !!
Allocated( Result.ImageSize );
fImages[Indx] := TImageInfo.Create( Result );
end;
end;
procedure TImageLibrary.Allocated( Size : integer );
begin
Inc( fCurrentSize, Size );
if CurrentSize >= fMaxSize
then Uncache( Size );
end;
procedure TImageLibrary.Freed( Size : integer );
begin
Dec( fCurrentSize, Size );
end;
procedure TImageLibrary.Release( anImage : TSpriteImage );
var
Found : boolean;
i : integer;
begin
Found := false;
i := 0;
with fImages do
while not Found and (i < Count ) do
with TImageInfo( Items[i] ) do
if Image = anImage
then
begin
Found := true;
Release;
if CurrentSize > fMaxSize
then Uncache( CurrentSize - fMaxSize + 1 );
end
end;
procedure TImageLibrary.UncacheAll;
begin
Uncache( CurrentSize );
end;
procedure TImageLibrary.Uncache( Size : integer );
var
i : integer;
begin
i := fImages.Count - 1;
while (Size > 0 ) and (i > 0 ) do
begin
while (TImageInfo( fImages[i] ).fRefCount <> 0 ) and (i >= 0 ) do
dec( i );
if i >= 0
then
begin
fImages.Delete( i );
with TSpriteImage( Images[i] ) do
Freed( ImageSize );
end;
end;
end;
procedure InitImageLibrary( const Filename : string );
begin
ImageLibrary := TImageLibrary.Create( Filename );
end;
procedure DoneImageLibrary;
begin
FreeObject( ImageLibrary );
end;
end.
|
{-----------------------------------------------------------------------------
hpp_itemprocess (historypp project)
Version: 1.5
Created: 05.08.2004
Author: Oxygen
[ Description ]
Module for people to help get aquanted with ME_HPP_RICHEDIT_ITEMPROCESS
Has samples for SmileyAdd, TextFormat, Math Module and new procedure
called SeparateDialogs. It makes message black if previous was hour ago,
kinda of conversation separation
[ History ]
1.5 (05.08.2004)
First version
[ Modifications ]
none
[ Known Issues ]
none
Copyright (c) Art Fedorov, 2004
-----------------------------------------------------------------------------}
unit hpp_itemprocess;
interface
uses
Windows, Messages, SysUtils, Graphics,
m_globaldefs, m_api,
hpp_global, hpp_contacts, RichEdit;
type
TBBCookie = (
BBS_BOLD_S, BBS_BOLD_E,
BBS_ITALIC_S, BBS_ITALIC_E,
BBS_UNDERLINE_S, BBS_UNDERLINE_E,
BBS_STRIKEOUT_S, BBS_STRIKEOUT_E,
BBS_COLOR_S, BBS_COLOR_E);
TRTFColorTable = record
szw: WideString;
sza: String;
col: COLORREF;
end;
TBBCodeInfo = record
ssw: WideString;
esw: WideString;
ssa: String;
esa: String;
cookie: TBBCookie;
end;
function DoSupportSmileys(wParam, lParam: DWord): Integer; cdecl;
function DoSupportBBCodes(wParam, lParam: DWord): Integer; cdecl;
// math module support is out of order
function DoSupportMathModule(wParam, lParam: DWord): Integer; cdecl;
implementation
uses StrUtils;
const
bbCodes: array[0..9] of TBBCodeInfo = (
(ssw:'[b]'; esw:''; ssa:'[b]'; esa:''; cookie:BBS_BOLD_S),
(ssw:'[/b]'; esw:''; ssa:'[/b]'; esa:''; cookie:BBS_BOLD_E),
(ssw:'[i]'; esw:''; ssa:'[i]'; esa:''; cookie:BBS_ITALIC_S),
(ssw:'[/i]'; esw:''; ssa:'[/i]'; esa:''; cookie:BBS_ITALIC_E),
(ssw:'[u]'; esw:''; ssa:'[u]'; esa:''; cookie:BBS_UNDERLINE_S),
(ssw:'[/u]'; esw:''; ssa:'[/u]'; esa:''; cookie:BBS_UNDERLINE_E),
(ssw:'[s]'; esw:''; ssa:'[s]'; esa:''; cookie:BBS_STRIKEOUT_S),
(ssw:'[/s]'; esw:''; ssa:'[/s]'; esa:''; cookie:BBS_STRIKEOUT_E),
(ssw:'[color='; esw:']'; ssa:'[color='; esa:']'; cookie:BBS_COLOR_S),
(ssw:'[/color]'; esw:''; ssa:'[/color]'; esa:''; cookie:BBS_COLOR_E));
rtf_ctable: array[0..7] of TRTFColorTable = (
(szw:'red'; sza:'red'; col:$0000FF),
(szw:'blue'; sza:'blue'; col:$FF0000),
(szw:'green'; sza:'green'; col:$00FF00),
(szw:'magenta'; sza:'magenta'; col:$FF00FF),
(szw:'cyan'; sza:'cyan'; col:$FFFF00),
(szw:'yellow'; sza:'yellow'; col:$00FFFF),
(szw:'black'; sza:'black'; col:$000000),
(szw:'white'; sza:'white'; col:$FFFFFF));
function DoSupportSmileys(wParam{hRichEdit}, lParam{PItemRenderDetails}: DWord): Integer; cdecl;
var
sare: TSmAddRichEdit2;
ird: PItemRenderDetails;
begin
ird := Pointer(lParam);
sare.cbSize := SizeOf(sare);
sare.hwndRichEditControl := wParam;
sare.rangeToReplace := nil;
sare.ProtocolName := ird^.pProto;
sare.useSounds := False;
sare.disableRedraw := True;
PluginLink.CallService(MS_SMILEYADD_REPLACESMILEYS,0,Integer(@sare));
Result := 0;
end;
procedure bbCodeSimpleFunc(RichHandle: DWord; range: TCharRange; txtw: WideString; txta: string; cookie: TBBCookie; var defcf: TCharFormat);
const
em: WideString = '';
var
cf: TCharFormat;
i: integer;
found: boolean;
begin
ZeroMemory(@cf,SizeOf(cf));
cf.cbSize := SizeOf(cf);
case cookie of
BBS_BOLD_S: begin
cf.dwMask := CFM_BOLD;
cf.dwEffects := CFE_BOLD;
end;
BBS_BOLD_E: cf.dwMask := CFM_BOLD;
BBS_ITALIC_S: begin
cf.dwMask := CFM_ITALIC;
cf.dwEffects := CFE_ITALIC;
end;
BBS_ITALIC_E: cf.dwMask := CFM_ITALIC;
BBS_UNDERLINE_S: begin
cf.dwMask := CFM_UNDERLINE;
cf.dwEffects := CFE_UNDERLINE;
end;
BBS_UNDERLINE_E: cf.dwMask := CFM_UNDERLINE;
BBS_STRIKEOUT_S: begin
cf.dwMask := CFM_STRIKEOUT;
cf.dwEffects := CFE_STRIKEOUT;
end;
BBS_STRIKEOUT_E: cf.dwMask := CFM_STRIKEOUT;
BBS_COLOR_S: begin
for i := 0 to high(rtf_ctable) do begin
if hppOSUnicode then found := rtf_ctable[i].szw = txtw
else found := rtf_ctable[i].sza = txta;
if found then begin
cf.crTextColor := rtf_ctable[i].col;
cf.dwMask := CFM_COLOR;
break;
end;
end;
end;
BBS_COLOR_E: begin
cf.dwMask := CFM_COLOR;
cf.crTextColor := defcf.crTextColor;
end;
end;
SendMessage(RichHandle, EM_SETSEL, range.cpMin, -1);
SendMessage(RichHandle, EM_SETCHARFORMAT, SCF_SELECTION, integer(@cf));
SendMessage(RichHandle, EM_SETSEL, range.cpMin, range.cpMax);
SendMessage(RichHandle, EM_REPLACESEL, 0, integer(PWideChar(em)));
end;
function DoSupportBBCodes(wParam{hRichEdit}, lParam{PItemRenderDetails}: DWord): Integer; cdecl;
const
EM_FINDTEXTEXW = WM_USER + 124;
const
FR_DOWN = $00000001;
FR_WHOLEWORD = $00000002;
FR_MATCHCASE = $00000004;
var
pos,i: integer;
found: boolean;
fRange,range: CharRange;
cf: TCharFormat;
fTextW: WideString;
fTextA: String;
fBBCode: TBBCodeInfo;
fteW: FindTextExW;
fteA: FindTextExA;
trgW: TextRangeW;
trgA: TextRangeA;
begin
ZeroMemory(@cf,SizeOf(cf));
cf.cbSize := SizeOf(cf);
cf.dwMask := CFM_COLOR;
SendMessage(wParam, EM_GETCHARFORMAT, 0, integer(@cf));
pos := 0;
repeat
found := false;
fRange.cpMin := -1;
for i := 0 to High(bbCodes) do begin
if hppOSUnicode then begin
ftew.chrg.cpMin := pos;
ftew.chrg.cpMax := -1;
ftew.lpstrText := PWideChar(bbCodes[i].ssw);
if SendMessage(wParam, EM_FINDTEXTEXW, FR_DOWN, integer(@ftew)) < 0 then continue;
range := ftew.chrgText;
end else begin
ftea.chrg.cpMin := pos;
ftea.chrg.cpMax := -1;
ftea.lpstrText := PChar(bbCodes[i].ssa);
if SendMessage(wParam, EM_FINDTEXTEX, FR_DOWN, integer(@ftea)) < 0 then continue;
range := ftea.chrgText;
end;
if bbCodes[i].esw <> '' then begin
if hppOSUnicode then begin
ftew.chrg.cpMin := ftew.chrgText.cpMax;
ftew.lpstrText := PWideChar(bbCodes[i].esw);
if SendMessage(wParam, EM_FINDTEXTEXW, FR_DOWN, integer(@ftew)) < 0 then continue;
range.cpMax := ftew.chrgText.cpMax;
end else begin
ftea.chrg.cpMin := ftea.chrgText.cpMax;
ftea.lpstrText := PChar(bbCodes[i].esa);
if SendMessage(wParam, EM_FINDTEXTEX, FR_DOWN, integer(@ftea)) < 0 then continue;
range.cpMax := ftea.chrgText.cpMax;
end;
end;
if ((fRange.cpMin = -1) or (fRange.cpMin > range.cpMin)) then begin
fRange := range;
fBBCode := bbCodes[i];
found := true;
if hppOSUnicode then begin
if fTextW <> '' then fTextW := '';
end else begin
if fTextA <> '' then fTextA := '';
end;
if bbCodes[i].esw <> '' then begin
if hppOSUnicode then begin
trgw.chrg.cpMin := ftew.chrg.cpMin;
trgw.chrg.cpMax := ftew.chrgText.cpMin;
SetLength(fTextW,trgw.chrg.cpMax - trgw.chrg.cpMin);
trgw.lpstrText := @fTextW[1];
SendMessage(wParam, EM_GETTEXTRANGE, 0, integer(@trgw));
end else begin
trga.chrg.cpMin := ftea.chrg.cpMin;
trga.chrg.cpMax := ftea.chrgText.cpMin;
SetLength(fTextA,trga.chrg.cpMax - trga.chrg.cpMin);
trga.lpstrText := @fTextA[1];
SendMessage(wParam, EM_GETTEXTRANGE, 0, integer(@trga));
end;
end;
end;
end;
if found then begin
bbCodeSimpleFunc(wParam, fRange, fTextW, fTextA, fBBCode.cookie,cf);
if hppOSUnicode then begin
if fTextW <> '' then fTextW := '';
end else begin
if fTextA <> '' then fTextA := '';
end;
end;
until not found;
Result := 0;
end;
function DoSupportMathModule(wParam{hRichEdit}, lParam{PItemRenderDetails}: DWord): Integer; cdecl;
var
pc: PChar;
//cont,sd,ed: String;
cont,sd,ed: WideString;
cr_int, cr_big: TCharRange;
tr: TextRange;
//fte: TFindTextEx;
fte: TFindTextExW;
r: Integer;
begin
exit;
pc := PChar(PluginLink.CallService(MATH_GET_STARTDELIMITER,0,0));
sd := AnsiToWideString(pc,CP_ACP);
PluginLink.CallService(MTH_FREE_MATH_BUFFER,0,Integer(pc));
pc := PChar(PluginLink.CallService(MATH_GETENDDELIMITER,0,0));
ed := AnsiToWideString(pc,CP_ACP);
PluginLink.CallService(MTH_FREE_MATH_BUFFER,0,Integer(pc));
while True do begin
fte.chrg.cpMin := 0;
fte.chrg.cpMax := -1;
fte.lpstrText := PWideChar(sd);
if SendMessage(wParam,EM_FINDTEXTEX,FT_MATCHCASE,Integer(@fte)) = -1 then
break;
cr_big.cpMin := fte.chrgText.cpMin;
cr_int.cpMin := fte.chrgText.cpMax;
fte.chrg.cpMin := fte.chrgText.cpMax;
fte.lpstrText := PWideChar(ed);
if SendMessage(wParam,EM_FINDTEXTEX,0{FT_MATCHCASE},Integer(@fte)) = -1 then
break;
cr_big.cpMax := fte.chrgText.cpMax;
cr_int.cpMax := fte.chrgText.cpMin;
if cr_int.cpMin < cr_int.cpMax then begin
// check here for no objects in cr_big
SetLength(cont, cr_int.cpMax-cr_int.cpMin+1);
tr.lpstrText := @cont[1];
tr.chrg := cr_int;
SendMessage(wParam,EM_GETTEXTRANGE,0,Integer(@tr));
pc := PChar(PluginLink.CallService(MTH_GET_RTF_BITMAPTEXT,0,Integer(@cont[1])));
cont := AnsiToWideString(pc,CP_ACP);
PluginLink.CallService(MTH_FREE_RTF_BITMAPTEXT,0,Integer(pc));
end;
SendMessage(wParam,EM_EXSETSEL,0,Integer(@cr_big));
// set contens of selection
end;
{ Math module plugin doesn't have any simple
function that will do the most job for me
like SmileyAdd and TextFormat have. So we'll
let the author write this part of the sample :) }
end;
end.
|
unit kwLoadFromFile;
{* Загружает файл в форму дочернего класса TPrimTextLoadForm.
*Формат:* имя_файла LoadFromFile
*Примечание:* Создан специально для тестов DailyTests в результате переделок form:Needs. Имя файла можно подавать без пути - будет автоматически добавлен путь к данным для тестов. }
// Модуль: "w:\common\components\rtl\Garant\Keywords4Daily\kwLoadFromFile.pas"
// Стереотип: "ScriptKeyword"
// Элемент модели: "LoadFromFile" MUID: (509A5CCB022A)
// Имя типа: "TkwLoadFromFile"
interface
{$If Defined(nsTest) AND NOT Defined(NoScripts) AND NOT Defined(NoVCM)}
uses
l3IntfUses
, tfwRegisterableWord
, tfwScriptingInterfaces
;
type
_LoadUnits_Parent_ = TtfwRegisterableWord;
{$Include w:\common\components\gui\Garant\Daily\LoadUnits.imp.pas}
TkwLoadFromFile = {final} class(_LoadUnits_)
{* Загружает файл в форму дочернего класса TPrimTextLoadForm.
*Формат:* имя_файла LoadFromFile
*Примечание:* Создан специально для тестов DailyTests в результате переделок form:Needs. Имя файла можно подавать без пути - будет автоматически добавлен путь к данным для тестов. }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
end;//TkwLoadFromFile
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts) AND NOT Defined(NoVCM)
implementation
{$If Defined(nsTest) AND NOT Defined(NoScripts) AND NOT Defined(NoVCM)}
uses
l3ImplUses
, PrimTextLoad_Form
, Document_Const
//#UC START# *509A5CCB022Aimpl_uses*
//#UC END# *509A5CCB022Aimpl_uses*
;
{$Include w:\common\components\gui\Garant\Daily\LoadUnits.imp.pas}
class function TkwLoadFromFile.GetWordNameForRegister: AnsiString;
begin
Result := 'LoadFromFile';
end;//TkwLoadFromFile.GetWordNameForRegister
procedure TkwLoadFromFile.DoDoIt(const aCtx: TtfwContext);
//#UC START# *4DAEEDE10285_509A5CCB022A_var*
var
l_Form : TObject;
l_FileName : String;
//#UC END# *4DAEEDE10285_509A5CCB022A_var*
begin
//#UC START# *4DAEEDE10285_509A5CCB022A_impl*
if aCtx.rEngine.IsTopObj then
begin
l_Form := aCtx.rEngine.PopObj;
if aCtx.rEngine.IsTopString then
begin
l_FileName := aCtx.rEngine.PopDelphiString;
l_FileName := aCtx.rCaller.ResolveInputFilePath(l_FileName);
with (l_Form as TPrimTextLoadForm) do
begin
LoadManager.FileName := l_FileName;
LoadManager.Load(TextSource, k2_typDocument);
AfterLoad;
end // with (aForm as TPrimTextLoadForm) do
end
else
Assert(False, 'Не задано название файла!');
end // if aCtx.rEngine.IsTopObj then
else
Assert(False, 'Не задана форма для загрузки текста!');
//#UC END# *4DAEEDE10285_509A5CCB022A_impl*
end;//TkwLoadFromFile.DoDoIt
initialization
TkwLoadFromFile.RegisterInEngine;
{* Регистрация LoadFromFile }
{$IfEnd} // Defined(nsTest) AND NOT Defined(NoScripts) AND NOT Defined(NoVCM)
end.
|
unit Meta_Schema;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Библиотека "SandBox"
// Модуль: "Meta_Schema.pas"
// Родные Delphi интерфейсы (.pas)
// Generated from UML model, root element: TagTable::Class Shared Delphi Sand Box::SandBox::Meta::Meta
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{$Include ..\SandBox\sbDefine.inc}
interface
uses
Class_Const,
Inner_Const,
Element_Const,
dependency_Const,
operation_Const,
attribute_Const,
k2Base {a},
l3Interfaces {a},
k2Interfaces {a}
;
type
Visibility = (
public
, private
, protected
);//Visibility
Abstract = (
regular
, abstract
, final
);//Abstract
InnerTag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
public
function DoMakeTag(aType: Tk2Type): Ik2Tag; override;
end;//InnerTag
ElementTag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
public
function DoMakeTag(aType: Tk2Type): Ik2Tag; override;
end;//ElementTag
Element_Visisbility_Tag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
end;//Element_Visisbility_Tag
Element_Abstract_Tag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
end;//Element_Abstract_Tag
dependencyTag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
public
function DoMakeTag(aType: Tk2Type): Ik2Tag; override;
end;//dependencyTag
ClassTag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
public
function DoMakeTag(aType: Tk2Type): Ik2Tag; override;
end;//ClassTag
Class_Extends_Tag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
end;//Class_Extends_Tag
Class_Children_Tag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
end;//Class_Children_Tag
operationTag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
public
function DoMakeTag(aType: Tk2Type): Ik2Tag; override;
end;//operationTag
attributeTag = class(Tk2Type)
protected
function GetAsPCharLen: Tl3PCharLenPrim; override;
function InheritsFrom(anAtomType: Tk2TypePrim): Boolean; override;
public
function DoMakeTag(aType: Tk2Type): Ik2Tag; override;
end;//attributeTag
TMetaSchema = class(Tk2TypeTable)
public
// типы, определённые в данной схеме:
t_Inner : InnerTag;
t_Element : ElementTag;
t_Element_Visisbility : Element_Visisbility_Tag;
t_Element_Abstract : Element_Abstract_Tag;
t_dependency : dependencyTag;
t_Class : ClassTag;
t_Class_Extends : Class_Extends_Tag;
t_Class_Children : Class_Children_Tag;
t_operation : operationTag;
t_attribute : attributeTag;
protected
// определяем стандартные методы схемы
function pm_GetTypeByHandle(H: Integer): Tk2Type; override;
procedure Cleanup; override;
public
constructor Create; override;
end;//TMetaSchema
implementation
uses
SysUtils {a},
TypInfo {a},
k2Const {a},
k2Tags {a},
k2BaseStruct {a},
l3Types {a},
l3String {a}
;
// start class InnerTag
function InnerTag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Inner'));
end;
function InnerTag.DoMakeTag(aType: Tk2Type): Ik2Tag;
begin
Result := nil;
Assert(false,'Невозможно создать абстрактный тег Inner');
end;
function Element_Visisbility_Tag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Element_Visisbility'));
end;
function Element_Visisbility_Tag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR TMetaSchema(TypeTable).t_Enum.InheritsFrom(anAtomType);
end;
function Element_Abstract_Tag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Element_Abstract'));
end;
function Element_Abstract_Tag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR TMetaSchema(TypeTable).t_Enum.InheritsFrom(anAtomType);
end;
function ElementTag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Element'));
end;
function ElementTag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR
TMetaSchema(TypeTable).t_Inner.InheritsFrom(anAtomType);
end;
function ElementTag.DoMakeTag(aType: Tk2Type): Ik2Tag;
begin
Result := nil;
Assert(false,'Невозможно создать абстрактный тег Element');
end;
function dependencyTag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('dependency'));
end;
function dependencyTag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR
TMetaSchema(TypeTable).t_Inner.InheritsFrom(anAtomType);
end;
function dependencyTag.DoMakeTag(aType: Tk2Type): Ik2Tag;
begin
Result := nil;
Pointer(Result) := Pointer(Ik2Tag(.Create(aType)));
end;
function Class_Extends_Tag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Class_Extends'));
end;
function Class_Extends_Tag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR TMetaSchema(TypeTable).t_OList.InheritsFrom(anAtomType);
end;
function Class_Children_Tag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Class_Children'));
end;
function Class_Children_Tag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR TMetaSchema(TypeTable).t_OList.InheritsFrom(anAtomType);
end;
function ClassTag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('Class'));
end;
function ClassTag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR
TMetaSchema(TypeTable).t_Element.InheritsFrom(anAtomType);
end;
function ClassTag.DoMakeTag(aType: Tk2Type): Ik2Tag;
begin
Result := nil;
Pointer(Result) := Pointer(Ik2Tag(.Create(aType)));
end;
function operationTag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('operation'));
end;
function operationTag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR
TMetaSchema(TypeTable).t_Element.InheritsFrom(anAtomType);
end;
function operationTag.DoMakeTag(aType: Tk2Type): Ik2Tag;
begin
Result := nil;
Pointer(Result) := Pointer(Ik2Tag(.Create(aType)));
end;
function attributeTag.GetAsPCharLen: Tl3PCharLenPrim;
begin
Result := l3PCharLen(AnsiString('attribute'));
end;
function attributeTag.InheritsFrom(anAtomType: Tk2TypePrim): Boolean;
begin
Result := (Self = anAtomType) OR
TMetaSchema(TypeTable).t_Element.InheritsFrom(anAtomType);
end;
function attributeTag.DoMakeTag(aType: Tk2Type): Ik2Tag;
begin
Result := nil;
Pointer(Result) := Pointer(Ik2Tag(.Create(aType)));
end;
constructor TMetaSchema.Create;
begin
inherited;
// Inner
t_Inner := DefineType(g_InnerTypeID, [], '', InnerTag) As InnerTag; Inc(g_InnerTypeID);
with t_Inner do
begin
with DefineProperty(k2_tiStereotype, AnsiString, '') do
begin
Shared := true;
end;//Stereotype
end;//Inner
// Element
t_Element := DefineType(g_InnerTypeID, [t_Inner], '', ElementTag) As ElementTag; Inc(g_InnerTypeID);
with t_Element do
begin
with DefineProperty(k2_tiName, AnsiString, '') do
begin
Shared := true;
end;//Name
t_Element_Visisbility := Element_Visisbility_Tag.Create(Self, 'Element Visisbility');
try
t_Element_Visisbility.InheriteFrom(t_Enum);
t_Element_Visisbility.StringID := g_InnerTypeID;
k2_idElement_Visisbility := g_InnerTypeID;
Inc(g_InnerTypeID);
t_Element_Visisbility.AtomType := TypeInfo(Visibility);
DefineProperty(k2_tiVisisbility, t_Element_Visisbility, '');
t_Element_Visisbility.Recalc;
except
FreeAndNil(t_Element_Visisbility);
end;//try..except
with Tk2CustomProperty(Prop[k2_tiVisisbility]) do
begin
end;//Visisbility
t_Element_Abstract := Element_Abstract_Tag.Create(Self, 'Element Abstract');
try
t_Element_Abstract.InheriteFrom(t_Enum);
t_Element_Abstract.StringID := g_InnerTypeID;
k2_idElement_Abstract := g_InnerTypeID;
Inc(g_InnerTypeID);
t_Element_Abstract.AtomType := TypeInfo(Abstract);
DefineProperty(k2_tiAbstract, t_Element_Abstract, '');
t_Element_Abstract.Recalc;
except
FreeAndNil(t_Element_Abstract);
end;//try..except
with Tk2CustomProperty(Prop[k2_tiAbstract]) do
begin
end;//Abstract
end;//Element
// dependency
t_dependency := DefineType(g_InnerTypeID, [t_Inner], '', dependencyTag) As dependencyTag; Inc(g_InnerTypeID);
with t_dependency do
begin
end;//dependency
// Class
t_Class := DefineType(g_InnerTypeID, [t_Element], '', ClassTag) As ClassTag; Inc(g_InnerTypeID);
with t_Class do
begin
t_Class_Extends := Class_Extends_Tag.Create(Self, 'Class Extends');
try
t_Class_Extends.InheriteFrom(t_OList);
t_Class_Extends.StringID := g_InnerTypeID;
k2_idClass_Extends := g_InnerTypeID;
Inc(g_InnerTypeID);
t_Class_Extends.DefineChildrenPrim(t_Class);
DefineProperty(k2_tiExtends, t_Class_Extends, '');
t_Class_Extends.Recalc;
except
FreeAndNil(t_Class_Extends);
end;//try..except
with t_Class_Extends.ArrayProp[k2_tiChildren] do
begin
end;//Extends
with DefineProperty(k2_tiImplements, t_Class, '') do
begin
end;//Implements
t_Class_Children := Class_Children_Tag.Create(Self, 'Class ');
try
t_Class_Children.InheriteFrom(t_OList);
t_Class_Children.StringID := g_InnerTypeID;
k2_idClass_Children := g_InnerTypeID;
Inc(g_InnerTypeID);
t_Class_Children.DefineChildrenPrim(t_Inner);
DefineChildrenPrim(t_Inner, t_Class_Children);
t_Class_Children.Recalc;
except
FreeAndNil(t_Class_Children);
end;//try..except
with ArrayProp[k2_tiChildren] do
begin
end;//
end;//Class
// operation
t_operation := DefineType(g_InnerTypeID, [t_Element], '', operationTag) As operationTag; Inc(g_InnerTypeID);
with t_operation do
begin
end;//operation
// attribute
t_attribute := DefineType(g_InnerTypeID, [t_Element], '', attributeTag) As attributeTag; Inc(g_InnerTypeID);
with t_attribute do
begin
end;//attribute
t_Inner.Recalc;
t_Element.Recalc;
t_dependency.Recalc;
t_Class.Recalc;
t_operation.Recalc;
t_attribute.Recalc;
end;
// определяем стандартные методы схемы
function TMetaSchema.pm_GetTypeByHandle(H: Integer): Tk2Type;
begin
Case H of
else
begin
if (t_Element_Visisbility <> nil) AND (t_Element_Visisbility.StringID = H) then
Result := t_Element_Visisbility
else
if (t_Element_Abstract <> nil) AND (t_Element_Abstract.StringID = H) then
Result := t_Element_Abstract
else
if (t_Class_Extends <> nil) AND (t_Class_Extends.StringID = H) then
Result := t_Class_Extends
else
if (t_Class_Children <> nil) AND (t_Class_Children.StringID = H) then
Result := t_Class_Children
else
Result := inherited pm_GetTypeByHandle(H);
end;//else
end;//Case H
end;
procedure TMetaSchema.Cleanup;
begin
t_Inner.InterfaceFactory := nil;
t_Inner.ToolFactory := nil;
t_Element.InterfaceFactory := nil;
t_Element.ToolFactory := nil;
t_Element_Visisbility.InterfaceFactory := nil;
t_Element_Abstract.InterfaceFactory := nil;
t_dependency.InterfaceFactory := nil;
t_dependency.ToolFactory := nil;
t_Class.InterfaceFactory := nil;
t_Class.ToolFactory := nil;
t_Class_Extends.InterfaceFactory := nil;
t_Class_Children.InterfaceFactory := nil;
t_operation.InterfaceFactory := nil;
t_operation.ToolFactory := nil;
t_attribute.InterfaceFactory := nil;
t_attribute.ToolFactory := nil;
FreeAndNil(t_Inner);
FreeAndNil(t_Element);
FreeAndNil(t_Element_Visisbility);
FreeAndNil(t_Element_Abstract);
FreeAndNil(t_dependency);
FreeAndNil(t_Class);
FreeAndNil(t_Class_Extends);
FreeAndNil(t_Class_Children);
FreeAndNil(t_operation);
FreeAndNil(t_attribute);
inherited;
end;
initialization
TMetaSchema.SetAsDefault;
end. |
unit ProbabilityValueParsingTest;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FpcUnit, TestRegistry,
ParserBaseTestCase,
ValuesParsingBaseTest,
WpcScriptCommons,
WpcStatements,
WpcScriptParser;
type
{ TProbabilityValueParsingTest }
TProbabilityValueParsingTest = class(TValuesParsingBaseTest)
private const
ZERO_PROBABILITY = 0;
MINIMAL_PROBABILITY = 1;
MAXIMAL_PROBABILITY = 100;
protected
function ParseAndGetProbabilityValue(ProbabilityString : String) : Byte;
procedure ParseAndEnsureScriptParseException(ProbabilityString : String);
published
procedure ShouldBeAbleToParseProbabilityValue();
procedure ShouldParseZeroProbabilityValue();
procedure ShouldParseMinimalProbabilityValue();
procedure ShouldParseMaximalProbabilityValue();
procedure ShouldRaiseScriptParseExceptionIfNoProbabilityValueGiven();
procedure ShouldRaiseScriptParseExceptionIfNegativeProbabilityGiven();
procedure ShouldRaiseScriptParseExceptionIfOverflowedProbabilityGiven();
procedure ShouldRaiseScriptParseExceptionIfFractionProbabilityGiven();
procedure ShouldRaiseScriptParseExceptionIfInvalidProbabilityGiven();
end;
implementation
{ TProbabilityValueParsingTest }
function TProbabilityValueParsingTest.ParseAndGetProbabilityValue(ProbabilityString : String) : Byte;
var
StopStatement : TWpcStopStatement;
begin
ScriptLines.Add(STOP_KEYWORD + ' ' + WITH_KEYWORD + ' ' + PROBABILITY_KEYWORD + ' ' + ProbabilityString);
WrapInMainBranch(ScriptLines);
ParseScriptLines();
ReadMainBranchStatementsList();
AssertEquals(WRONG_NUMBER_OF_SATEMENTS, 1, MainBranchStatements.Count);
AssertTrue(WRONG_STATEMENT, WPC_STOP_STATEMENT_ID = MainBranchStatements[0].GetId());
StopStatement := TWpcStopStatement(MainBranchStatements[0]);
Result := StopStatement.GetProbability();
end;
procedure TProbabilityValueParsingTest.ParseAndEnsureScriptParseException(ProbabilityString : String);
begin
ScriptLines.Add(STOP_KEYWORD + ' ' + WITH_KEYWORD + ' ' + PROBABILITY_KEYWORD + ' ' + ProbabilityString);
WrapInMainBranch(ScriptLines);
AssertScriptParseExceptionOnParse(1);
end;
procedure TProbabilityValueParsingTest.ShouldBeAbleToParseProbabilityValue();
const
A_PROBABILITY = 50;
begin
AssertEquals(FAILED_TO_PARSE + IntToStr(A_PROBABILITY) + ' ' + PROBABILITY_KEYWORD,
A_PROBABILITY,
ParseAndGetProbabilityValue(IntToStr(A_PROBABILITY)));
end;
procedure TProbabilityValueParsingTest.ShouldParseZeroProbabilityValue();
begin
AssertEquals(FAILED_TO_PARSE + IntToStr(ZERO_PROBABILITY) + ' ' + PROBABILITY_KEYWORD,
ZERO_PROBABILITY,
ParseAndGetProbabilityValue(IntToStr(ZERO_PROBABILITY)));
end;
procedure TProbabilityValueParsingTest.ShouldParseMinimalProbabilityValue();
begin
AssertEquals(FAILED_TO_PARSE + IntToStr(MINIMAL_PROBABILITY) + ' ' + PROBABILITY_KEYWORD,
MINIMAL_PROBABILITY,
ParseAndGetProbabilityValue(IntToStr(MINIMAL_PROBABILITY)));
end;
procedure TProbabilityValueParsingTest.ShouldParseMaximalProbabilityValue();
begin
AssertEquals(FAILED_TO_PARSE + IntToStr(MAXIMAL_PROBABILITY) + ' ' + PROBABILITY_KEYWORD,
MAXIMAL_PROBABILITY,
ParseAndGetProbabilityValue(IntToStr(MAXIMAL_PROBABILITY)));
end;
procedure TProbabilityValueParsingTest.ShouldRaiseScriptParseExceptionIfNoProbabilityValueGiven();
begin
ParseAndEnsureScriptParseException('');
end;
procedure TProbabilityValueParsingTest.ShouldRaiseScriptParseExceptionIfNegativeProbabilityGiven();
begin
ParseAndEnsureScriptParseException('-1');
end;
procedure TProbabilityValueParsingTest.ShouldRaiseScriptParseExceptionIfOverflowedProbabilityGiven();
begin
ParseAndEnsureScriptParseException('101');
end;
procedure TProbabilityValueParsingTest.ShouldRaiseScriptParseExceptionIfFractionProbabilityGiven();
begin
ParseAndEnsureScriptParseException('50.5');
end;
procedure TProbabilityValueParsingTest.ShouldRaiseScriptParseExceptionIfInvalidProbabilityGiven();
begin
ParseAndEnsureScriptParseException('5O');
end;
initialization
RegisterTest(VALUES_PARSER_TEST_SUITE_NAME, TProbabilityValueParsingTest);
end.
|
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://www.egisnet.com.br/webservice/ServidorISAPI.dll/wsdl/IdmBloqueioLote
// >Import : http://www.egisnet.com.br/webservice/ServidorISAPI.dll/wsdl/IdmBloqueioLote>0
// Version : 1.0
// (04/05/2021 16:06:41 - - $Rev: 101104 $)
// ************************************************************************ //
unit uIdmBloqueioLote;
interface
uses Soap.InvokeRegistry, Soap.SOAPHTTPClient, System.Types, Soap.XSBuiltIns, SOAPMidas;
type
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Embarcadero types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl]
// ************************************************************************ //
// Namespace : urn:udmBloqueioLote-IdmBloqueioLote
// soapAction: urn:udmBloqueioLote-IdmBloqueioLote#envioLaudoXML
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// use : encoded
// binding : IdmBloqueioLotebinding
// service : IdmBloqueioLoteservice
// port : IdmBloqueioLotePort
// URL : http://www.egisnet.com.br/webservice/ServidorISAPI.dll/soap/IdmBloqueioLote
// ************************************************************************ //
IdmBloqueioLote = interface(IAppServerSOAP)
['{EE8B6287-61A4-E9BB-0454-7992889F81B0}']
function envioLaudoXML(const arquivo: string): string; stdcall;
end;
implementation
uses System.SysUtils;
initialization
{ IdmBloqueioLote }
InvRegistry.RegisterInterface(TypeInfo(IdmBloqueioLote), 'urn:udmBloqueioLote-IdmBloqueioLote', '');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IdmBloqueioLote), 'urn:udmBloqueioLote-IdmBloqueioLote#envioLaudoXML');
end. |
unit StdRankings;
interface
procedure RegisterRankings;
implementation
uses
SysUtils, ClassStorage, Accounts, Rankings, BasicRankings, Languages;
const
mtidNTARanking : TRegMultiString = nil;
mtidPrestigeRanking : TRegMultiString = nil;
mtidWealthRanking : TRegMultiString = nil;
mtidTournamentRanking : TRegMultiString = nil;
procedure RegisterRankings;
function GetRankeableSuperAccount( MetaAccount : TMetaAccount ) : TMetaAccount;
begin
if MetaAccount.MasterAccount = nil
then result := nil
else
if MetaAccount.MasterAccount.Rankeable
then result := MetaAccount.MasterAccount
else result := GetRankeableSuperAccount( MetaAccount.MasterAccount );
end;
var
i, count : integer;
SuperAccount : TMetaAccount;
MetaAccount : TMetaAccount;
AccRanking : TAccountRanking;
begin
// Register Overall ranking
TOverallRanking.Create( 'NTA', '', InstantiateMultiString( mtidNTARanking, [0] ), 100 ).Register( tidClassFamily_Rankings );
// Register Prestige ranking
TPrestigeRanking.Create( 'Prestige', 'NTA', InstantiateMultiString( mtidPrestigeRanking, [0] ), 100 ).Register( tidClassFamily_Rankings );
// Register Wealth ranking
TWealthRanking.Create( 'Wealth', 'NTA', InstantiateMultiString( mtidWealthRanking, [0] ), 100 ).Register( tidClassFamily_Rankings );
// Register Account-based rankings
count := TheClassStorage.ClassCount[tidClassFamily_Accounts];
for i := 0 to pred(count) do
begin
MetaAccount := TMetaAccount(TheClassStorage.ClassByIdx[tidClassFamily_Accounts, i]);
if MetaAccount.Rankeable
then
begin
SuperAccount := GetRankeableSuperAccount( MetaAccount );
if SuperAccount <> nil
then AccRanking := TAccountRanking.Create( MetaAccount.Id, SuperAccount.Id, CloneMultiString( MetaAccount.Name_MLS ), 100, MetaAccount.AccId )
else AccRanking := TAccountRanking.Create( MetaAccount.Id, 'NTA', CloneMultiString( MetaAccount.Name_MLS ), 100, MetaAccount.AccId );
AccRanking.Register( tidClassFamily_Rankings );
end;
end;
if StrToInt(TheGlobalConfigHandler.GetConfigParm('TornamentLength', '0')) > 0
then TContestRanking.Create('aTournament', '', InstantiateMultiString(mtidTournamentRanking, [0] ), 100 ).Register(tidClassFamily_Rankings);
end;
initialization
mtidNTARanking := TRegMultiString.Create( 'mtidNTARanking', 'NTA' );
mtidPrestigeRanking := TRegMultiString.Create( 'mtidPrestigeRanking', 'Prestige' );
mtidWealthRanking := TRegMultiString.Create( 'mtidWealthRanking', 'Wealth' );
mtidTournamentRanking := TRegMultiString.Create( 'mtidTournamentRanking', 'Tournament' );
end.
|
unit ExtAINetServer;
interface
uses
Windows, NetServerOverbyte,
Classes, SysUtils, Math, Generics.Collections,
ExtAICommonClasses, ExtAISharedNetworkTypes, ExtAINetworkTypes;
type
TExtAIServerClient = class;
TNewMsgEvent = procedure (aData: Pointer; aLength: Cardinal) of object;
TNewDataEvent = procedure (aData: Pointer; aDataType, aLength: Cardinal) of object;
TServerClientEvent = procedure (aServerClient: TExtAIServerClient) of object;
TClientNewIDEvent = procedure (aServerClient: TExtAIServerClient; aID: Word) of object;
TExtAIServerClient = class
private
fHandle: TExtAINetHandleIndex;
// Each client must have their own receive buffer, so partial messages don't get mixed
fpStartData: pExtAINewData;
fpEndData: pExtAINewData;
fBuffer: TKExtAIMsgStream;
fScheduledMsg: TKExtAIMsgStream;
fPerformance: record
NetPingIdx,NetPingMsgIdx: Word;
TickPingIdx,TickPingMsgIdx: Word;
NetPingArr: array [0..ExtAI_MSG_MAX_NET_PING_CNT-1] of Cardinal;
TickPingArr: array [0..ExtAI_MSG_MAX_TICK_PING_CNT-1] of Cardinal;
end;
fOnCfg: TNewDataEvent;
fOnAction: TNewDataEvent;
fOnState: TNewDataEvent;
procedure NillEvents();
procedure Cfg(aData: Pointer; aTypeCfg, aLength: Cardinal);
procedure Performance(aData: Pointer);
procedure Action(aData: Pointer; aTypeAction, aLength: Cardinal);
procedure State(aData: Pointer; aTypeState, aLength: Cardinal);
function GetNetPing(): Cardinal;
function GetTickPing(): Cardinal;
public
constructor Create(aHandle: TExtAINetHandleIndex);
destructor Destroy(); override;
property OnCfg: TNewDataEvent write fOnCfg;
property OnAction: TNewDataEvent write fOnAction;
property OnState: TNewDataEvent write fOnState;
property Handle: TExtAINetHandleIndex read fHandle;
property Buffer: TKExtAIMsgStream read fBuffer;
property ScheduledMsg: TKExtAIMsgStream read fScheduledMsg;
property NetPing: Cardinal read GetNetPing;
property TickPing: Cardinal read GetTickPing;
procedure AddScheduledMsg(aData: Pointer; aLength: Cardinal);
end;
TExtAINetServer = class
private
fServer: TNetServerOverbyte;
fClients: TObjectList<TExtAIServerClient>;
fListening: Boolean;
fNetPingLastMsg: Cardinal;
fTickPingLastMsg: Cardinal;
fServerName: AnsiString;
fRoomCount: Integer;
fOnStatusMessage: TGetStrProc;
fOnClientConnect: TServerClientEvent;
fOnClientNewID: TClientNewIDEvent;
fOnClientDisconnect: TServerClientEvent;
procedure Status(const S: string);
procedure SendServerCfg(aHandle: TExtAINetHandleIndex);
// Events from server
procedure ClientConnect(aHandle: TExtAINetHandleIndex);
procedure ClientDisconnect(aHandle: TExtAINetHandleIndex);
procedure DataAvailable(aHandle: TExtAINetHandleIndex; aData: Pointer; aLength: Cardinal);
procedure Error(const S: string);
procedure NillEvents();
// Pack and send message
procedure ScheduleSendData(aRecipient: TExtAINetHandleIndex; aData: Pointer; aLength: Cardinal; aFlushQueue: Boolean = False);
procedure SendScheduledData(aClient: TExtAIServerClient);
// Unpack and process input messages
procedure ProcessReceivedMessages(aClient: TExtAIServerClient);
// Ping
procedure SendNetPingRequest(aClient: TExtAIServerClient);
procedure SendTickPingRequest(aClient: TExtAIServerClient); // In future time to process 1 tick by ExtAI
public
constructor Create();
destructor Destroy(); override;
property OnStatusMessage: TGetStrProc write fOnStatusMessage;
property OnClientConnect: TServerClientEvent write fOnClientConnect;
property OnClientNewID: TClientNewIDEvent write fOnClientNewID;
property OnClientDisconnect: TServerClientEvent write fOnClientDisconnect;
property Listening: Boolean read fListening;
property Clients: TObjectList<TExtAIServerClient> read fClients;
property Server: TNetServerOverbyte read fServer;
procedure StartListening(aPort: Word; const aServerName: AnsiString);
procedure StopListening();
procedure UpdateState();
function GetClientByHandle(aHandle: TExtAINetHandleIndex): TExtAIServerClient;
end;
implementation
uses
KM_CommonUtils;
const
SERVER_VERSION: Cardinal = 20190622;
{ TExtAIServerClient }
constructor TExtAIServerClient.Create(aHandle: TExtAINetHandleIndex);
begin
Inherited Create;
fHandle := aHandle;
fBuffer := TKExtAIMsgStream.Create();
fScheduledMsg := TKExtAIMsgStream.Create();
fpStartData := new(pExtAINewData);
fpStartData^.Ptr := nil;
fpStartData^.Next := nil;
fpEndData := fpStartData;
with fPerformance do
begin
NetPingIdx := 0;
NetPingMsgIdx := 0;
TickPingIdx := 0;
TickPingMsgIdx := 0;
FillChar(NetPingArr[0], SizeOf(NetPingArr[0]) * Length(NetPingArr), #0);
FillChar(TickPingArr[0], SizeOf(TickPingArr[0]) * Length(TickPingArr), #0);
end;
NillEvents();
end;
destructor TExtAIServerClient.Destroy();
begin
NillEvents();
fBuffer.Free;
fScheduledMsg.Free();
repeat
fpEndData := fpStartData;
fpStartData := fpStartData.Next;
if (fpEndData^.Ptr <> nil) then
FreeMem(fpEndData^.Ptr, fpEndData^.Length);
Dispose(fpEndData);
until (fpStartData = nil);
Inherited;
end;
procedure TExtAIServerClient.NillEvents();
begin
fOnCfg := nil;
fOnAction := nil;
fOnState := nil;
end;
procedure TExtAIServerClient.Cfg(aData: Pointer; aTypeCfg, aLength: Cardinal);
begin
if Assigned(fOnCfg) then
fOnCfg(aData, aTypeCfg, aLength);
end;
procedure TExtAIServerClient.Performance(aData: Pointer);
var
//length: Cardinal;
pData: Pointer;
typePerf: TExtAIMsgTypePerformance;
begin
// Check the type of message
if (mkPerformance <> TExtAIMsgKind(aData^)) then
Exit;
// Get type of message
pData := Pointer( NativeUInt(aData) + SizeOf(TExtAIMsgKind) );
typePerf := TExtAIMsgTypePerformance(pData^);
// Get length
pData := Pointer( NativeUInt(pData) + SizeOf(TExtAIMsgTypePerformance) );
//length := Cardinal( TExtAIMsgLengthData(pData^) );
// Get pointer to data
pData := Pointer( NativeUInt(pData) + SizeOf(TExtAIMsgLengthData) );
// Process message
with fPerformance do
case typePerf of
// Read poing ID and save time
prPing : begin end;
prPong:
begin
NetPingIdx := Word( pData^ );
if (NetPingIdx < Length(NetPingArr)) then
NetPingArr[NetPingIdx] := Max(0, TimeGet() - NetPingArr[NetPingIdx] )
else
NetPingIdx := 0;
end;
prTick:
begin
end;
end;
end;
procedure TExtAIServerClient.Action(aData: Pointer; aTypeAction, aLength: Cardinal);
begin
if Assigned(fOnAction) then
fOnAction(aData, aTypeAction, aLength);
end;
procedure TExtAIServerClient.State(aData: Pointer; aTypeState, aLength: Cardinal);
begin
if Assigned(fOnState) then
fOnState(aData, aTypeState, aLength);
end;
procedure TExtAIServerClient.AddScheduledMsg(aData: Pointer; aLength: Cardinal);
begin
fScheduledMsg.Write(aData^, aLength);
end;
function TExtAIServerClient.GetNetPing(): Cardinal;
begin
with fPerformance do
Result := NetPingArr[NetPingIdx];
end;
function TExtAIServerClient.GetTickPing(): Cardinal;
begin
with fPerformance do
Result := TickPingArr[TickPingIdx];
end;
{ TExtAINetServer }
constructor TExtAINetServer.Create();
begin
Inherited Create;
fClients := TObjectList<TExtAIServerClient>.Create();
fServer := TNetServerOverbyte.Create();
fListening := False;
fRoomCount := 0;
fNetPingLastMsg := 0;
fTickPingLastMsg := 0;
NillEvents();
end;
destructor TExtAINetServer.Destroy();
begin
NillEvents();
StopListening;
fClients.Free; // Clients are freed in TObjectList
fServer.Free;
Inherited;
end;
procedure TExtAINetServer.NillEvents();
begin
fOnStatusMessage := nil;
fOnClientConnect := nil;
fOnClientNewID := nil;
fOnClientDisconnect := nil;
end;
function TExtAINetServer.GetClientByHandle(aHandle: TExtAINetHandleIndex): TExtAIServerClient;
var
K: Integer;
begin
Result := nil;
for K := 0 to fClients.Count-1 do
if (fClients[K].Handle = aHandle) then
Exit(fClients[K]);
end;
procedure TExtAINetServer.StartListening(aPort: Word; const aServerName: AnsiString);
begin
fRoomCount := 0;
fServerName := aServerName;
fServer.OnError := Error;
fServer.OnClientConnect := ClientConnect;
fServer.OnClientDisconnect := ClientDisconnect;
fServer.OnDataAvailable := DataAvailable;
fServer.StartListening(aPort);
Status(Format('Listening on port %d',[aPort]));
fListening := true;
end;
procedure TExtAINetServer.StopListening();
begin
fServer.StopListening;
fListening := false;
fRoomCount := 0;
Status('Stop listening');
end;
procedure TExtAINetServer.Error(const S: string);
begin
Status(S);
end;
procedure TExtAINetServer.Status(const S: string);
begin
if Assigned(fOnStatusMessage) then
fOnStatusMessage(Format('Server status: %s',[S]));
end;
// Send configuration of the server
procedure TExtAINetServer.SendServerCfg(aHandle: TExtAINetHandleIndex);
const
NAME: UnicodeString = 'Testing AI';
VERSION: Cardinal = 20191026;
var
M: TKExtAIMsgStream;
begin
M := TKExtAIMsgStream.Create;
try
// Add version
M.WriteMsgType(mkServerCfg, Cardinal(csVersion), SizeOf(VERSION));
M.Write(VERSION, SizeOf(VERSION));
// Add name
M.WriteMsgType(mkServerCfg, Cardinal(csName), SizeOf(Word) + SizeOf(WideChar) * Length(NAME));
M.WriteW(NAME);
// Add client ID
M.WriteMsgType(mkServerCfg, Cardinal(csClientHandle), SizeOf(aHandle));
M.Write(aHandle, SizeOf(aHandle));
// Add ExtAI ID
M.WriteMsgType(mkServerCfg, Cardinal(csExtAIID), SizeOf(aHandle));
M.Write(aHandle, SizeOf(aHandle));
// Send message
ScheduleSendData(aHandle, M.Memory, M.Size, True);
finally
M.Free;
end;
end;
procedure TExtAINetServer.SendNetPingRequest(aClient: TExtAIServerClient);
var
M: TKExtAIMsgStream;
begin
M := TKExtAIMsgStream.Create;
try
with aClient.fPerformance do
begin
// Save time
NetPingMsgIdx := (NetPingMsgIdx + 1) mod ExtAI_MSG_MAX_NET_PING_CNT;
NetPingArr[NetPingMsgIdx] := TimeGet();
// Add version
M.WriteMsgType(mkPerformance, Cardinal(prPing), SizeOf(NetPingMsgIdx));
M.Write(NetPingMsgIdx, SizeOf(NetPingMsgIdx));
end;
// Send message
ScheduleSendData(aClient.Handle, M.Memory, M.Size, True);
finally
M.Free;
end;
end;
procedure TExtAINetServer.SendTickPingRequest(aClient: TExtAIServerClient);
var
M: TKExtAIMsgStream;
begin
M := TKExtAIMsgStream.Create;
try
with aClient.fPerformance do
begin
// Save time
TickPingMsgIdx := (TickPingMsgIdx + 1) mod ExtAI_MSG_MAX_TICK_PING_CNT;
TickPingArr[TickPingMsgIdx] := TimeGet();
// Add version
M.WriteMsgType(mkPerformance, Cardinal(prTick), SizeOf(TickPingMsgIdx));
M.Write(TickPingMsgIdx, SizeOf(TickPingMsgIdx));
end;
// Send message
ScheduleSendData(aClient.Handle, M.Memory, M.Size, True);
finally
M.Free;
end;
end;
// Someone has connected
procedure TExtAINetServer.ClientConnect(aHandle: TExtAINetHandleIndex);
var
Client: TExtAIServerClient;
begin
// Add new client
Status(Format('New client: %d',[aHandle]));
Client := TExtAIServerClient.Create(aHandle);
fClients.Add(Client);
if Assigned(fOnClientConnect) then
fOnClientConnect(Client);
// Send server configuration
SendServerCfg(aHandle);
end;
// Someone has disconnected
procedure TExtAINetServer.ClientDisconnect(aHandle: TExtAINetHandleIndex);
var
Client: TExtAIServerClient;
begin
Client := GetClientByHandle(aHandle);
if (Client = nil) then
begin
Status(Format('Warning: Client %d has already been disconnected',[aHandle]));
Exit;
end;
if Assigned(fOnClientDisconnect) then
fOnClientDisconnect(Client);
fClients.Remove(Client); // TObjectList remove and free
Status(Format('Client %d has been disconnected',[aHandle]));
end;
procedure TExtAINetServer.ScheduleSendData(aRecipient: TExtAINetHandleIndex; aData: Pointer; aLength: Cardinal; aFlushQueue: Boolean = False);
var
Client: TExtAIServerClient;
begin
// Check if client is connected
Client := GetClientByHandle(aRecipient);
if (Client = nil) then
Exit;
// If the size of final message is too big, send the actual schedule
if aFlushQueue OR (Client.ScheduledMsg.Size + aLength > ExtAI_MSG_MAX_CUMULATIVE_PACKET_SIZE) then
SendScheduledData(Client);
Client.AddScheduledMsg(aData, aLength);
// Force to send the message immediately
if aFlushQueue then
SendScheduledData(Client);
end;
procedure TExtAINetServer.SendScheduledData(aClient: TExtAIServerClient);
var
Msg: TKExtAIMsgStream;
begin
if (aClient.ScheduledMsg.Position > 0) then
begin
Msg := TKExtAIMsgStream.Create();
try
// Create head
Msg.WriteHead(aClient.Handle, ExtAI_MSG_ADDRESS_SERVER, aClient.ScheduledMsg.Position);
// Copy data field
Msg.Write(aClient.ScheduledMsg.Memory^, aClient.ScheduledMsg.Position);
// Send data
//Msg.Position := 0;
fServer.SendData(aClient.Handle, Msg.Memory, Msg.Size);
aClient.ScheduledMsg.Clear;
finally
Msg.Free;
end;
end;
end;
procedure TExtAINetServer.UpdateState();
var
K: Integer;
begin
for K := 0 to fClients.Count - 1 do
begin
// Process new messages
ProcessReceivedMessages(fClients[K]);
// Check ping
if (GetTimeSince(fNetPingLastMsg) >= ExtAI_MSG_TIME_INTERVAL_NET_PING) then
SendNetPingRequest(fClients[K]);
//if (GetTimeSince(fTickPingLastMsg) >= ExtAI_MSG_TIME_INTERVAL_TICK_PING) then
// SendTickPingRequest(fClients[K]);
// Send outcoming messages
SendScheduledData(fClients[K]);
end;
if (GetTimeSince(fNetPingLastMsg) >= ExtAI_MSG_TIME_INTERVAL_NET_PING) then
fNetPingLastMsg := TimeGet();
//if (GetTimeSince(fTickPingLastMsg) >= ExtAI_MSG_TIME_INTERVAL_TICK_PING) then
// fTickPingLastMsg := TimeGet();
end;
//Someone has send us something
procedure TExtAINetServer.DataAvailable(aHandle: TExtAINetHandleIndex; aData: Pointer; aLength: Cardinal);
var
pNewData: pExtAINewData;
Client: TExtAIServerClient;
begin
//Status('Data available');
Client := GetClientByHandle(aHandle);
if (Client = nil) then
begin
Status('Warning: Data Available from an unassigned client');
Exit;
end;
// Append new data to buffer
with Client do
begin
New(pNewData);
pNewData^.Ptr := nil;
pNewData^.Next := nil;
fpEndData^.Ptr := aData;
fpEndData^.Length := aLength;
AtomicExchange(fpEndData^.Next, pNewData);
fpEndData := pNewData;
end;
// Check if new data are top prio (top prio data have its own message and are processed by NET thread)
Client.Performance( Pointer( NativeUInt(aData) + ExtAI_MSG_HEAD_SIZE ) );
end;
// Process received messages in 2 priorities:
// The first prio is for direct communication of client and server
// The second prio is for everything else so KP is master of its time
procedure TExtAINetServer.ProcessReceivedMessages(aClient: TExtAIServerClient);
var
MaxPos, DataType, DataLenIdx: Cardinal;
pData: Pointer;
pOldData: pExtAINewData;
pCopyFrom, pCopyTo: PChar;
Recipient: TExtAIMsgRecipient;
Sender: TExtAIMsgSender;
Kind: TExtAIMsgKind;
LengthMsg: TExtAIMsgLengthMsg;
LengthData: TExtAIMsgLengthData;
Buff: TKExtAIMsgStream;
begin
// Merge incoming data into memory stream (Thread safe)
with aClient do
while (fpStartData^.Next <> nil) do
begin
pOldData := fpStartData;
AtomicExchange(fpStartData, fpStartData^.Next);
Buffer.Write(pOldData^.Ptr^, pOldData^.Length);
FreeMem(pOldData^.Ptr, pOldData^.Length);
Dispose(pOldData);
end;
Buff := aClient.Buffer;
// Save size of the buffer
MaxPos := Buff.Position;
// Set actual index
Buff.Position := 0;
// Try to read new messages
while (MaxPos - Buff.Position >= ExtAI_MSG_HEAD_SIZE) do
begin
// Read head (move Buff.Position from first byte of head to first byte of data)
Buff.ReadHead(Recipient, Sender, LengthMsg);
DataLenIdx := Buff.Position + LengthMsg;
// Check if the message is complete
if (DataLenIdx <= MaxPos) then
begin
// Get data from the message
while (Buff.Position < DataLenIdx) do
begin
// Read type of the data - type is Cardinal so it can change its size in dependence on the Kind in the message
Buff.ReadMsgType(Kind, DataType, LengthData);
if (Buff.Position + LengthData <= MaxPos) then
begin
// Get pointer to data (pointer to memory of stream + idx to actual position)
pData := Pointer(NativeUInt(Buff.Memory) + Buff.Position);
// Process message
case Kind of
mkServerCfg: begin end;
mkGameCfg: begin end;
mkExtAICfg:
begin
// Check if ID was received / changed
if (TExtAIMsgTypeCfgAI(DataType) = caID) AND Assigned(fOnClientNewID) then
fOnClientNewID(aClient, Word(pData^));
aClient.Cfg(pData, DataType, LengthData);
end;
mkPerformance: begin end;
mkAction: aClient.Action(pData, DataType, LengthData);
mkEvent: begin end;
mkState: aClient.State(pData, DataType, LengthData);
end;
// Move position to next Head or Data
Buff.Position := Buff.Position + LengthData;
end
else
Error('Length of the data does not match the length of the message');
end;
end
else
break;
end;
// Copy the rest at the start of the buffer
MaxPos := MaxPos - Buff.Position;
if (Buff.Position > 0) AND (MaxPos > 0) then
begin
// Copy the rest of the stream at the start
pCopyFrom := Pointer(NativeUInt(Buff.Memory) + Buff.Position);
pCopyTo := Buff.Memory;
Move(pCopyFrom^, pCopyTo^, MaxPos);
end;
// Move position at the end
Buff.Position := MaxPos;
end;
end.
|
{
DBAExplorer - Oracle Admin Management Tool
Copyright (C) 2008 Alpaslan KILICKAYA
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 3 of the License, or
(at your option) any later version.
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. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit frmSynonyms;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, cxLookAndFeelPainters, cxGraphics, cxGroupBox,
cxRadioGroup, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit,
cxDBLookupComboBox, cxTextEdit, StdCtrls, cxPC, cxButtons, cxControls,
cxContainer, cxEdit, ora, cxListBox, cxImageComboBox, ExtCtrls, cxMemo,
cxRichEdit, OraSynonym, GenelDM, DB, DBQuery, MemDS, DBAccess, cxCheckBox;
type
TSynonymsFrm = class(TForm)
pc: TcxPageControl;
tsSynonym: TcxTabSheet;
tsDDL: TcxTabSheet;
redtDDL: TcxRichEdit;
ds: TDataSource;
query: TOraQuery;
cxGroupBox1: TcxGroupBox;
btnCancel: TcxButton;
btnExecute: TcxButton;
cxGroupBox2: TcxGroupBox;
Label2: TLabel;
Label14: TLabel;
Label1: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
edtName: TcxTextEdit;
lcObjectSchema: TcxLookupComboBox;
icbType: TcxImageComboBox;
lbObject: TcxListBox;
edtDBLink: TcxTextEdit;
cbPublic: TcxCheckBox;
cbDBLink: TcxComboBox;
Bevel2: TBevel;
procedure btnCancelClick(Sender: TObject);
procedure icbTypePropertiesEditValueChanged(Sender: TObject);
procedure pcPageChanging(Sender: TObject; NewPage: TcxTabSheet;
var AllowChange: Boolean);
procedure cbDBLinkClick(Sender: TObject);
procedure btnExecuteClick(Sender: TObject);
private
{ Private declarations }
FSynonymList : TSynonymList;
FResult : boolean;
function SetSynonymsDetail: boolean;
public
{ Public declarations }
function Init(ASynonymList : TSynonymList): boolean;
end;
var
SynonymsFrm: TSynonymsFrm;
implementation
{$R *.dfm}
uses frmSchemaBrowser, OraScripts, Util,
OraTable, OraStorage, OraView, VisualOptions;
function TSynonymsFrm.Init(ASynonymList : TSynonymList): boolean;
begin
SynonymsFrm := TSynonymsFrm.Create(Application);
Self := SynonymsFrm;
DMGenel.ChangeLanguage(self);
ChangeVisualGUI(self);
FResult := false;
FSynonymList := TSynonymList.Create;
FSynonymList := ASynonymList;
query.Session := FSynonymList.OraSession;
dmGenel.ReLoad(FSynonymList.OraSession);
lcObjectSchema.Text := FSynonymList.TableOwner;
caption := 'Create Synonym for '+ FSynonymList.TableName;
if FSynonymList.ObjectType = dbTable then
icbType.ItemIndex := 0;
if FSynonymList.ObjectType = dbView then
icbType.ItemIndex := 1;
if FSynonymList.ObjectType = dbFunctions then
icbType.ItemIndex := 2;
if FSynonymList.ObjectType = dbTypes then
icbType.ItemIndex := 3;
if FSynonymList.ObjectType = dbPackages then
icbType.ItemIndex := 4;
if FSynonymList.ObjectType = dbProcedures then
icbType.ItemIndex := 5;
if FSynonymList.ObjectType = dbSequences then
icbType.ItemIndex := 6;
ShowModal;
result := FResult;
Free;
end;
procedure TSynonymsFrm.btnCancelClick(Sender: TObject);
begin
close;
end;
procedure TSynonymsFrm.icbTypePropertiesEditValueChanged(Sender: TObject);
var
key: string;
begin
query.Close;
lbObject.Items.Clear;
if icbType.Text = 'Table' then
begin
query.SQL.Text := GetTables(lcObjectSchema.Text);
key := 'TABLE_NAME';
end;
if icbType.Text = 'View' then
begin
query.SQL.Text := GetViews(lcObjectSchema.Text);
key := 'VIEW_NAME';
end;
if key = '' then exit;
query.Open;
while not query.Eof do
begin
lbObject.Items.Add(query.FieldByName(key).AsString);
query.Next;
end;
end;
function TSynonymsFrm.SetSynonymsDetail: boolean;
var
FSynonym : TSynonym;
i: integer;
table: string;
begin
result := true;
while FSynonymList.SynonymCount > 0 do
FSynonymList.SynonymDelete(0);
if edtName.Text = '' then
begin
MessageDlg('Synonym Name must be specified', mtWarning, [mbOk], 0);
result := false;
exit;
end;
for i := 0 to lbObject.Count -1 do
if lbObject.Selected[i] then
table := lbObject.Items[i];
if (table = '') and ((icbType.Text = 'Table') or (icbType.Text = 'View')) then
begin
MessageDlg('You must select a object', mtWarning, [mbOk], 0);
result := false;
exit;
end;
if FSynonymList.ObjectType in [dbSequences,dbProcedures,dbFunctions,dbTypes,dbPackages] then
table := FSynonymList.TableName;
if FSynonymList.TableOwner = '' then
FSynonymList.TableOwner := lcObjectSchema.Text;
if FSynonymList.TableName = '' then
FSynonymList.TableName := table;
new(FSynonym);
FSynonym^.Owner := FSynonymList.TableOwner;
FSynonym^.SynonymName := edtName.Text;
FSynonym^.TableOwner := lcObjectSchema.Text;
FSynonym^.TableName := table;
if cbDBLink.Text = 'Remote' then
FSynonym^.DDLink := edtDBLink.Text
else
FSynonym^.DDLink := '';
FSynonym^.isPublic := cbPublic.Checked;
FSynonymList.SynonymAdd(FSynonym);
end;
procedure TSynonymsFrm.pcPageChanging(Sender: TObject;
NewPage: TcxTabSheet; var AllowChange: Boolean);
begin
if NewPage = tsDDL then
begin
if not SetSynonymsDetail then AllowChange := false
else redtDDL.Text := FSynonymList.GetDDL;
end;
end;
procedure TSynonymsFrm.cbDBLinkClick(Sender: TObject);
begin
edtDBLink.Enabled := cbDBLink.Text = 'Remote';
end;
procedure TSynonymsFrm.btnExecuteClick(Sender: TObject);
begin
if not SetSynonymsDetail then exit;
redtDDL.Text := FSynonymList.GetDDL;
if FSynonymList.CreateSynonym(redtDDL.Text) then
begin
FResult := true;
close;
end;
end;
end.
|
unit FiveControl;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls,
GameTypes, GameControl, LocalCacheManager, MapTypes, Map, LanderTypes;
const
cMaxZoomLevel = ord(high(TZoomRes));
cMinZoomLevel = ord(low(TZoomRes));
type
TFiveControl =
class(TGameControl)
public
constructor Create(anOwner : TComponent); override;
destructor Destroy; override;
public
procedure ZoomIn;
procedure ZoomOut;
procedure MoveTo(i, j : integer);
end;
procedure Register;
implementation
// TFiveControl
constructor TFiveControl.Create( anOwner : TComponent );
begin
inherited;
ZoomLevel := ord(zr32x64);
end;
destructor TFiveControl.Destroy;
begin
inherited;
end;
procedure TFiveControl.ZoomIn;
var
msg : TViewZoomedMsg;
begin
if (TZoomRes(ZoomLevel) < high(TZoomRes)) and (fFocus <> nil)
then
begin
msg.id := msgViewZoomed;
msg.Zoom := ZoomLevel + 1;
fFocus.Dispatch(msg);
end;
end;
procedure TFiveControl.ZoomOut;
var
msg : TViewZoomedMsg;
begin
if (TZoomRes(ZoomLevel) > low(TZoomRes)) and (fFocus <> nil)
then
begin
msg.id := msgViewZoomed;
msg.Zoom := ZoomLevel - 1;
fFocus.Dispatch(msg);
end;
end;
procedure TFiveControl.MoveTo(i, j : integer);
var
msg : TMoveToMsg;
begin
msg.id := msgMoveTo;
msg.i := i;
msg.j := j;
Focus.Dispatch(msg);
end;
procedure Register;
begin
RegisterComponents('Games', [TFiveControl]);
end;
end.
|
unit kwDialogsLockDocumentSetSkipMode;
{* Устанавливает режим работы с диалогом о залочке документа:
[code]
ar_AsUsual // Показывать диалог и проверять его результат.
ar_OpenDocument // Если есть залоченный - все равно открывать.
ar_NotOpen // Если есть залоченный - не открывать.
[code]
Формат:
[code]
aMode dialogs:LockDocument:SetSkipMode
[code] }
// Модуль: "w:\archi\source\projects\Archi\Archi_Insider_Test_Support\kwDialogsLockDocumentSetSkipMode.pas"
// Стереотип: "ScriptKeyword"
// Элемент модели: "dialogs_LockDocument_SetSkipMode" MUID: (54255FED0328)
// Имя типа: "TkwDialogsLockDocumentSetSkipMode"
{$Include w:\archi\source\projects\Archi\arDefine.inc}
interface
{$If Defined(nsTest) AND Defined(InsiderTest) AND Defined(AppClientSide) AND NOT Defined(NoScripts)}
uses
l3IntfUses
, tfwRegisterableWord
, tfwScriptingInterfaces
;
type
TkwDialogsLockDocumentSetSkipMode = {final} class(TtfwRegisterableWord)
{* Устанавливает режим работы с диалогом о залочке документа:
[code]
ar_AsUsual // Показывать диалог и проверять его результат.
ar_OpenDocument // Если есть залоченный - все равно открывать.
ar_NotOpen // Если есть залоченный - не открывать.
[code]
Формат:
[code]
aMode dialogs:LockDocument:SetSkipMode
[code] }
protected
class function GetWordNameForRegister: AnsiString; override;
procedure DoDoIt(const aCtx: TtfwContext); override;
end;//TkwDialogsLockDocumentSetSkipMode
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest) AND Defined(AppClientSide) AND NOT Defined(NoScripts)
implementation
{$If Defined(nsTest) AND Defined(InsiderTest) AND Defined(AppClientSide) AND NOT Defined(NoScripts)}
uses
l3ImplUses
, arArchiTestsAdapter
//#UC START# *54255FED0328impl_uses*
//#UC END# *54255FED0328impl_uses*
;
class function TkwDialogsLockDocumentSetSkipMode.GetWordNameForRegister: AnsiString;
begin
Result := 'dialogs:LockDocument:SetSkipMode';
end;//TkwDialogsLockDocumentSetSkipMode.GetWordNameForRegister
procedure TkwDialogsLockDocumentSetSkipMode.DoDoIt(const aCtx: TtfwContext);
//#UC START# *4DAEEDE10285_54255FED0328_var*
//#UC END# *4DAEEDE10285_54255FED0328_var*
begin
//#UC START# *4DAEEDE10285_54255FED0328_impl*
RunnerAssert(aCtx.rEngine.IsTopInt, 'Не задан режим показа диалога!', aCtx);
TarTestConfig.Instance.SkipLockDialog := TarSkipDialog(aCtx.rEngine.PopInt);
//#UC END# *4DAEEDE10285_54255FED0328_impl*
end;//TkwDialogsLockDocumentSetSkipMode.DoDoIt
initialization
TkwDialogsLockDocumentSetSkipMode.RegisterInEngine;
{* Регистрация dialogs_LockDocument_SetSkipMode }
{$IfEnd} // Defined(nsTest) AND Defined(InsiderTest) AND Defined(AppClientSide) AND NOT Defined(NoScripts)
end.
|
unit bcSettings;
interface
uses
l3StringToStringMap,
ddCSV;
type
TbcSettings = class(TddSectionedCSVLoader)
private
f_TypesMap: Tl3StringToStringMap;
f_SkipMap: Tl3StringToStringMap;
f_SourcesMap: Tl3StringToStringMap;
procedure LoadMap(const aMap: Tl3StringToStringMap; const aName: AnsiString);
function pm_GetTypesMap: Tl3StringToStringMap;
function pm_GetSkipMap: Tl3StringToStringMap;
function pm_GetSourcesMap: Tl3StringToStringMap;
protected
procedure Cleanup; override;
procedure DispatchSection; override;
public
property TypesMap: Tl3StringToStringMap read pm_GetTypesMap;
property SkipMap: Tl3StringToStringMap read pm_GetSkipMap;
property SourcesMap: Tl3StringToStringMap read pm_GetSourcesMap;
end;
implementation
uses
SysUtils,
l3Base,
l3Interfaces,
l3Except,
l3String;
procedure TbcSettings.Cleanup;
begin
FreeAndNil(f_TypesMap);
FreeAndNil(f_SourcesMap);
FreeAndNil(f_SkipMap);
inherited;
end;
procedure TbcSettings.DispatchSection;
begin
if l3Same(SectName, 'types') then
LoadMap(TypesMap, 'типы')
else
if l3Same(SectName, 'sources') then
LoadMap(SourcesMap, 'источники')
else
if l3Same(SectName, 'skip') then
LoadMap(SkipMap, 'пропускаемые документы')
else
SkipSection;
end;
procedure TbcSettings.LoadMap(const aMap: Tl3StringToStringMap; const aName: AnsiString);
var
l_Key: Il3CString;
begin
while NextLine do
begin
if ValuesCount >= 2 then
begin
l_Key := l3Upper(l3Trim(ValuesW[0]));
if not l3IsNil(l_Key) then
begin
if not aMap.Has(l_Key) then
aMap.Add(l_Key, l3CStr(l3Trim(ValuesW[1])))
else
l3System.Msg2Log('Повторяются %s в настройках: %s', [aName, l3Str(l3Trim(ValuesW[0]))]);
end;
end;
end;
end;
function TbcSettings.pm_GetTypesMap: Tl3StringToStringMap;
begin
if f_TypesMap = nil then
f_TypesMap := Tl3StringToStringMap.Create;
Result := f_TypesMap;
end;
function TbcSettings.pm_GetSkipMap: Tl3StringToStringMap;
begin
if f_SkipMap = nil then
f_SkipMap := Tl3StringToStringMap.Create;
Result := f_SkipMap;
end;
function TbcSettings.pm_GetSourcesMap: Tl3StringToStringMap;
begin
if f_SourcesMap = nil then
f_SourcesMap := Tl3StringToStringMap.Create;
Result := f_SourcesMap;
end;
end.
|
unit UMemAccount;
interface
uses
UAccountInfoKS, UDynRawBytes, URawBytes, UAccount;
{$include MemoryReductionSettings.inc}
type
{$IFDEF uselowmem}
{ In order to store less memory on RAM, those types will be used
to store in RAM memory (better than to use original ones)
This will reduce 10-15% of memory usage.
For future versions, will be a good solution to use those instead
of originals, but}
TMemAccount = Record // TAccount with less memory usage
// account number is discarded (-4 bytes)
{$IFDEF useAccountKeyStorage}
accountInfoKS : TAccountInfoKS;
{$ELSE}
accountInfo : TDynRawBytes;
{$ENDIF}
balance: UInt64;
updated_block: Cardinal;
n_operation: Cardinal;
name : TRawBytes;
account_type : Word;
previous_updated_block : Cardinal;
End;
{$ELSE}
TMemAccount = TAccount;
{$ENDIF}
procedure ToTMemAccount(Const source : TAccount; var dest : TMemAccount);
procedure ToTAccount(const source : TMemAccount; account_number : Cardinal; var dest : TAccount);
implementation
uses
UAccountKeyStorage;
procedure ToTMemAccount(Const source : TAccount; var dest : TMemAccount);
{$IFDEF uselowmem}
Var raw : TRawBytes;
{$ENDIF}
begin
{$IFDEF uselowmem}
{$IFDEF useAccountKeyStorage}
dest.accountInfoKS.state:=source.accountInfo.state;
dest.accountInfoKS.accountKeyKS:=TAccountKeyStorage.KS.AddAccountKey(source.accountInfo.accountKey);
dest.accountInfoKS.locked_until_block:=source.accountInfo.locked_until_block;
dest.accountInfoKS.price:=source.accountInfo.price;
dest.accountInfoKS.account_to_pay:=source.accountInfo.account_to_pay;
dest.accountInfoKS.new_publicKeyKS:=TAccountKeyStorage.KS.AddAccountKey(source.accountInfo.new_publicKey);
{$ELSE}
TAccountComp.AccountInfo2RawString(source.accountInfo,raw);
TBaseType.To256RawBytes(raw,dest.accountInfo);
{$ENDIF}
dest.balance := source.balance;
dest.updated_block:=source.updated_block;
dest.n_operation:=source.n_operation;
dest.name:=source.name;
dest.account_type:=source.account_type;
dest.previous_updated_block:=source.previous_updated_block;
{$ELSE}
dest := source;
{$ENDIF}
end;
procedure ToTAccount(const source : TMemAccount; account_number : Cardinal; var dest : TAccount);
{$IFDEF uselowmem}
var raw : TRawBytes;
{$ENDIF}
begin
{$IFDEF uselowmem}
dest.account:=account_number;
{$IFDEF useAccountKeyStorage}
dest.accountInfo.state:=source.accountInfoKS.state;
dest.accountInfo.accountKey:=source.accountInfoKS.accountKeyKS^;
dest.accountInfo.locked_until_block:=source.accountInfoKS.locked_until_block;
dest.accountInfo.price:=source.accountInfoKS.price;
dest.accountInfo.account_to_pay:=source.accountInfoKS.account_to_pay;
dest.accountInfo.new_publicKey:=source.accountInfoKS.new_publicKeyKS^;
{$ELSE}
TBaseType.ToRawBytes(source.accountInfo,raw);
TAccountComp.RawString2AccountInfo(raw,dest.accountInfo);
{$ENDIF}
dest.balance := source.balance;
dest.updated_block:=source.updated_block;
dest.n_operation:=source.n_operation;
dest.name:=source.name;
dest.account_type:=source.account_type;
dest.previous_updated_block:=source.previous_updated_block;
{$ELSE}
dest := source;
{$ENDIF}
end;
end.
|
unit OXmlReadWrite;
{
Author:
Ondrej Pokorny, http://www.kluug.net
All Rights Reserved.
License:
CPAL 1.0 or commercial
Please see the /license.txt file for more information.
}
{
OXmlReadWrite.pas
Basic XML reader/writer. OXmlIntfDOM.pas, OXmlPDOM.pas and OXmlSAX.pas use
this unit to read and write XML.
TXMLWriter
- fast sequential XML writer
- no real DOM validity checking - the programmer has to know what he is doing
- supports escaping of text - you should pass unescaped text to every function
(if not stated differently) and the writer takes care of valid XML escaping
- all line breaks (#10, #13, #13#10) are automatically changed to LineBreak
-> default value for LineBreak is your OS line break (sLineBreak)
-> if you don't want to process them, set LineBreak to lbDoNotProcess
- supports automatic indentation of XML
- don't use it directly. If performance is crucial for you, use SAX
which has the same performance.
TXMLReader
- fast sequential XML reader/parser
- the nodes are returned as they are found in the document
- absolutely no whitespace handling - the document is parsed exactly 1:1
-> white space is preserved also in the very beginning of the document
-> you have to care for white space handling in end-level
- only line breaks (#10, #13, #13#10) are automatically changed to LineBreak
-> default value for LineBreak is your OS line break (sLineBreak)
-> if you don't want to process them, set LineBreak to lbDoNotProcess
}
{$I OXml.inc}
{$IFDEF O_DELPHI_XE4_UP}
{$ZEROBASEDSTRINGS OFF}
{$ENDIF}
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$BOOLEVAL OFF}
interface
uses
{$IFDEF O_NAMESPACES}
System.SysUtils, System.Classes,
{$ELSE}
SysUtils, Classes,
{$ENDIF}
{$IFDEF O_GENERICS}
{$IFDEF O_NAMESPACES}
System.Generics.Collections,
{$ELSE}
Generics.Collections,
{$ENDIF}
{$ENDIF}
OHashedStrings,
OWideSupp, OXmlUtils, OTextReadWrite, OEncoding;
type
TXMLWriter = class;
TXMLWriterElementMode = (
stOpenOnly, //"<node"
stFinish, //"<node>"
stFinishClose); //"<node/>"
PXMLWriterElement = ^TXMLWriterElement;
TXMLWriterElement = {$IFDEF O_EXTRECORDS}record{$ELSE}object{$ENDIF}
private
fOwner: TXMLWriter;
fElementName: OWideString;
fOpenElementFinished: Boolean;
fChildrenWritten: Boolean;
procedure FinishOpenElement;
public
// <aElementName ... >, <aElementName ... /> etc.
procedure OpenElementR(const aElementName: OWideString;
var outElement: TXMLWriterElement;
const aMode: TXMLWriterElementMode = stOpenOnly); overload;
function OpenElementR(const aElementName: OWideString;
const aMode: TXMLWriterElementMode = stOpenOnly): TXMLWriterElement; overload;
// </fElementName> or "/>" if no children were written
procedure CloseElement(const aIndent: Boolean = True);
// write attribute of an element or declaration
procedure Attribute(const aAttrName, aAttrValue: OWideString);
// <![CDATA[aText]]>
procedure CData(const aText: OWideString);
// <!--aText-->
procedure Comment(const aText: OWideString);
// <?aTarget aContent?>
procedure ProcessingInstruction(const aTarget, aContent: OWideString);
// write escaped text, do not escape quotes
procedure Text(const aText: OWideString; const aIndent: Boolean = True);
public
property ElementName: OWideString read fElementName;
end;
TCustomXMLWriterSettings = class(TPersistent)
private
fIndentString: OWideString;
fIndentType: TXMLIndentType;
fLineBreak: TXMLLineBreak;
fUseTabCRLFEntitiesInAttributes: Boolean;
fUseGreaterThanEntity: Boolean;
fStrictXML: Boolean;
protected
procedure AssignTo(Dest: TPersistent); override;
protected
function GetWriteBOM: Boolean; virtual; abstract;
procedure SetWriteBOM(const aWriteBOM: Boolean); virtual; abstract;
public
constructor Create;
public
//write BOM (if applicable)
property WriteBOM: Boolean read GetWriteBOM write SetWriteBOM;
//process line breaks (#10, #13, #13#10) to the LineBreak character
// set to lbDoNotProcess if you don't want any processing
// default is lbLF (#10) -> according to XML specification
property LineBreak: TXMLLineBreak read fLineBreak write fLineBreak;
//should be #9, #10 and #13 in attributes saved as entities? Default = True
property UseTabCRLFEntitiesInAttributes: Boolean read fUseTabCRLFEntitiesInAttributes write fUseTabCRLFEntitiesInAttributes;
//should the '>' character be saved as an entity? (it's completely fine according to XML spec to use the '>' character in text; Default = True
property UseGreaterThanEntity: Boolean read fUseGreaterThanEntity write fUseGreaterThanEntity;
//StrictXML: document must be valid XML
// = true: element names & values checking
// = false: no element names & values checking
property StrictXML: Boolean read fStrictXML write fStrictXML;
//indent type - default is none (no indent)
property IndentType: TXMLIndentType read fIndentType write fIndentType;
//indent string - default are two space characters (#32#32)
property IndentString: OWideString read fIndentString write fIndentString;
end;
TXMLDocumentWriterSettings = class(TCustomXMLWriterSettings)
private
fWriteBOM: Boolean;
protected
function GetWriteBOM: Boolean; override;
procedure SetWriteBOM(const aWriteBOM: Boolean); override;
public
constructor Create;
end;
TXMLWriterSettings = class(TCustomXMLWriterSettings)
private
fOwner: TXMLWriter;
function GetEncoding: TEncoding;
function GetOwnsEncoding: Boolean;
procedure SetEncoding(const aEncoding: TEncoding);
procedure SetOwnsEncoding(const aOwnsEncoding: Boolean);
protected
function GetWriteBOM: Boolean; override;
procedure SetWriteBOM(const aWriteBOM: Boolean); override;
public
constructor Create(aOwner: TXMLWriter);
public
//Output encoding
property Encoding: TEncoding read GetEncoding write SetEncoding;
property OwnsEncoding: Boolean read GetOwnsEncoding write SetOwnsEncoding;
end;
TOCharTable = class(TObject)
private
fIsSupported: array[OUnicodeChar] of Boolean;
public
constructor Create(const aEncoding: TEncoding); virtual;
public
function IsSupported(const aChar: OUnicodeChar): Boolean;
function Entity(const aChar: OUnicodeChar): OWideString;
end;
TXMLWriter = class(TObject)
private
fWriter: TOTextWriter;
fWriterSettings: TXMLWriterSettings;
fDefaultIndentLevel: Integer;
fWritten: Boolean;
fIndentLevel: Integer;
function GetEncoding: TEncoding;
function GetOwnsEncoding: Boolean;
function GetWriteBOM: Boolean;
procedure SetEncoding(const aEncoding: TEncoding);
procedure SetOwnsEncoding(const aOwnsEncoding: Boolean);
procedure SetWriteBOM(const aWriteBOM: Boolean);
procedure SetDefaultIndentLevel(const aDefaultIndentLevel: Integer);
private
//encoding entities support
fUseSafeEntities: Boolean;
fCharTable: TOCharTable;
function GetCharTable: TOCharTable;
// safe write raw text: if char not present in target encoding, write its entity
procedure _DoTextSafeEntity(const aText: OUnicodeString; const aInAttributeValue: Boolean);
procedure RawUnicodeChar(const aChar: OUnicodeChar);
procedure RawUnicodeCharSafeEntity(const aChar: OUnicodeChar);
//no safe entity
procedure _DoText(const aText: OWideString; const aInAttributeValue: Boolean);
procedure DoText(const aText: OWideString; const aInAttributeValue: Boolean);
protected
//manual indentation support - you can use Indent+IncIndentLevel+DecIndentLevel
// manually if you want to. Set IndentType to itNone in this case.
procedure Indent;
procedure IncIndentLevel;
procedure DecIndentLevel;
protected
procedure DoCreate;
procedure DoInit; virtual;
public
//create
constructor Create; overload;
//create and init
constructor Create(const aStream: TStream); overload;
destructor Destroy; override;
public
//The Init* procedures initialize a document for writing.
// Please note that the file/stream/... is locked until you destroy
// TXMLWriter or call ReleaseDocument!
procedure InitFile(const aFileName: String);
procedure InitStream(const aStream: TStream);
//Release the current document (that was loaded with Init*)
procedure ReleaseDocument;
public
// default <?xml ?> declaration
procedure XMLDeclaration(
const aEncoding: Boolean = True;
const aVersion: OWideString = '1.0';
const aStandAlone: OWideString = '');
// <?xml
procedure OpenXMLDeclaration;
// ?>
procedure FinishOpenXMLDeclaration;
// <aElementName ... >, <aElementName ... /> etc.
procedure OpenElement(const aElementName: OWideString;
const aMode: TXMLWriterElementMode = stOpenOnly);
procedure OpenElementR(const aElementName: OWideString;
var outElement: TXMLWriterElement;
const aMode: TXMLWriterElementMode = stOpenOnly); overload;
function OpenElementR(const aElementName: OWideString;
const aMode: TXMLWriterElementMode = stOpenOnly): TXMLWriterElement; overload;
// >
procedure FinishOpenElement(const {%H-}aElementName: OWideString = '');//you may pass a ElementName just to make it clear for you which element you want to close
// />
procedure FinishOpenElementClose(const {%H-}aElementName: OWideString = '');//you may pass a ElementName just to make it clear for you which element you want to close
// </aElementName>, decide if you want to indent
procedure CloseElement(const aElementName: OWideString; const aIndent: Boolean = True);
// write attribute of an element or declaration
procedure Attribute(const aAttrName, aAttrValue: OWideString);
// &aEntityName;
procedure EntityReference(const aEntityName: OWideString);
// <![CDATA[aText]]>
procedure CData(const aText: OWideString; const aIndent: Boolean = True);
// <!--aText-->
procedure Comment(const aText: OWideString);
// <?aTarget aContent?>
procedure ProcessingInstruction(const aTarget, aContent: OWideString);
// <!DOCTYPE aDocTypeRawText> - aDocTypeRawText must be escaped, it won't be processed
procedure DocType(const aDocTypeRawText: OWideString);
// write escaped text, decide if you want to indent;
procedure Text(const aText: OWideString; const aIndent: Boolean = True); overload;
// write raw text, do not process it
procedure RawText(const aText: OWideString);
procedure RawChar(const aChar: OWideChar);
public
//encoding of the text writer
property Encoding: TEncoding read GetEncoding write SetEncoding;
property OwnsEncoding: Boolean read GetOwnsEncoding write SetOwnsEncoding;
//should BOM be written
property WriteBOM: Boolean read GetWriteBOM write SetWriteBOM;
//indentation level - you can change it only if nothing has been written yet
// and after the Init* call
property DefaultIndentLevel: Integer read fDefaultIndentLevel write SetDefaultIndentLevel;
property WriterSettings: TXMLWriterSettings read fWriterSettings;
end;
TXMLWriterDeclaration = class(TXMLDeclaration)
private
fEnabled: Boolean;
public
constructor Create; override;
public
procedure Write(const aWriter: TXMLWriter);
procedure WriteIfEnabled(const aWriter: TXMLWriter);
public
//Enabled -> set to true if XML declaration should be written
property Enabled: Boolean read fEnabled write fEnabled;
end;
TXMLReaderTokenType = (
rtDocumentStart,//start of reading
rtOpenXMLDeclaration,//xml declaration open element: <?xml
rtXMLDeclarationAttribute,//attribute in an xml declaration: name="value"
rtFinishXMLDeclarationClose,//xml declaration element finished and closed: ?>
rtOpenElement,//open element: <name
rtAttribute,//attribute: name="value"
rtFinishOpenElement,//open element finished but not closed: <node ... ">"
rtFinishOpenElementClose,//open element finished and closed: <node ... "/>"
rtCloseElement,//close element: "</node>"
rtText,//text: value
rtEntityReference,//&name; (value = the dereferenced entity value)
rtCData,//cdata: <![CDATA[value]]>
rtComment,//comment: <!--value-->
rtProcessingInstruction,//custom processing instruction: <?target content?>
rtDocType//doctype: <!DOCTYPE value> -> value is not unescaped by reader!!!
);
TXMLReaderToken = packed record
TokenName: OWideString;
TokenValue: OWideString;
TokenType: TXMLReaderTokenType;
end;
PXMLReaderToken = ^TXMLReaderToken;
TXMLReaderTokenList = class(TObject)
private
{$IFDEF O_GENERICS}
fReaderTokens: TList<PXMLReaderToken>;
{$ELSE}
fReaderTokens: TList;
{$ENDIF}
fCount: Integer;
function GetToken(const aIndex: Integer): PXMLReaderToken;
procedure AddLast;
function CreateNew: PXMLReaderToken;
public
procedure Clear;
procedure DeleteLast;
function IndexOf(const aToken: PXMLReaderToken): Integer;
public
constructor Create;
destructor Destroy; override;
public
property Count: Integer read fCount;
property Items[const aIndex: Integer]: PXMLReaderToken read GetToken; default;
end;
TXMLReader = class;
TXMLReaderSettings = class;
TXMLReaderEntityList = class(TPersistent)
private
fList: TOHashedStringDictionary;
function GetCount: Integer;
function GetItem(const aIndex: OHashedStringsIndex): TOHashedStringDictionaryPair;
function GetName(const aIndex: OHashedStringsIndex): OWideString;
function GetValue(const aIndex: OHashedStringsIndex): OWideString;
procedure SetValue(const aIndex: OHashedStringsIndex;
const aValue: OWideString);
protected
procedure AssignTo(Dest: TPersistent); override;
public
constructor Create;
destructor Destroy; override;
public
procedure AddOrReplace(const aEntityName, aEntityValue: OWideString);
function IndexOf(const aEntityName: OWideString): Integer;
function Find(const aEntityName: OWideString; var outEntityValue: OWideString): Boolean;
procedure Clear;//clear list and fill default XML entities
public
property EntityNames[const aIndex: OHashedStringsIndex]: OWideString read GetName;
property EntityValues[const aIndex: OHashedStringsIndex]: OWideString read GetValue write SetValue;
property Items[const aIndex: OHashedStringsIndex]: TOHashedStringDictionaryPair read GetItem;
property Count: Integer read GetCount;
end;
TXMLReaderSettings = class(TPersistent)
private
fBreakReading: TXMLBreakReading;
fLineBreak: TXMLLineBreak;
fStrictXML: Boolean;
fEntityList: TXMLReaderEntityList;
fRecognizeXMLDeclaration: Boolean;
fExpandEntities: Boolean;
fErrorHandling: TOTextReaderErrorHandling;
protected
procedure LoadDTD(const aDTDReader: TOTextReader; const aIsInnerDTD: Boolean);
procedure LoadDTDEntity(const aDTDReader: TOTextReader;
const aBuffer1, aBuffer2: TOTextBuffer);
procedure LoadDTDEntityReference(const aDTDReader: TOTextReader;
const aWriteToBuffer, aTempBuffer: TOTextBuffer);
protected
procedure AssignTo(Dest: TPersistent); override;
public
constructor Create;
destructor Destroy; override;
public
//Load external DTD
// DTD validation is NOT supported! Only defined entities will be read.
function LoadDTDFromFile(const aFileName: String; const aDefaultEncoding: TEncoding = nil): Boolean;
function LoadDTDFromStream(const aStream: TStream; const aDefaultEncoding: TEncoding = nil): Boolean;
//loads XML in default unicode encoding: UTF-16 for DELPHI, UTF-8 for FPC
function LoadDTDFromString(const aString: OWideString): Boolean;
{$IFDEF O_RAWBYTESTRING}
function LoadDTDFromString_UTF8(const aString: ORawByteString): Boolean;
{$ENDIF}
function LoadFromBuffer(const aBuffer: TBytes; const aDefaultEncoding: TEncoding = nil): Boolean; overload;
function LoadFromBuffer(const aBuffer; const aBufferLength: Integer; const aDefaultEncoding: TEncoding = nil): Boolean; overload;
public
//process known entities. add user-defined entities here
property EntityList: TXMLReaderEntityList read fEntityList;
//decide if you want to read the document after the root element has been closed
property BreakReading: TXMLBreakReading read fBreakReading write fBreakReading;
//process line breaks (#10, #13, #13#10) to the LineBreak character
// set to lbDoNotProcess if you don't want any processing
// default is your OS line break (XmlDefaultLineBreak)
property LineBreak: TXMLLineBreak read fLineBreak write fLineBreak;
//StrictXML: document must be valid XML
// = true: raise Exceptions when document is not valid
// = false: try to fix and go over document errors.
property StrictXML: Boolean read fStrictXML write fStrictXML;
//RecognizeXMLDeclaration
// if set to true the processing instruction "<?xml ... ?>" will be detected as XMLDeclaration
// and following element types will be fired:
// rtOpenXMLDeclaration, rtXMLDeclarationAttribute, rtFinishXMLDeclarationClose
// if set to false, it will be handled as a normal processing instruction
// rtProcessingInstruction
property RecognizeXMLDeclaration: Boolean read fRecognizeXMLDeclaration write fRecognizeXMLDeclaration;
//ExpandEntities
// true: entities will be directly expanded to text
// false: entities will be detected as separate tokens
// Please note that not expanding entity references may cause text content
// problems in the DOM (in combination with normalization and/or automatic whitespace handling).
// Therefore when not expanding entities, always use "wsPreserveAll" for WhiteSpaceHandling in the DOM
property ExpandEntities: Boolean read fExpandEntities write fExpandEntities;
//ErrorHandling
// determine if Exception should be raised
// ehSilent: do not raise any exceptions (check TXMLReader.ParseError for an error
// -> this is the standard behaviour of MSXML
// ehRaiseAndEat: an exception will be raised but it will be eaten automatically
// so that the user doesn't see it it appears only when debugging and it is available to error handling/logging
// -> this is the standard behaviour of OmniXML
// -> this is also the default behaviour of OXml
// ehRaise: an exception will be raised and the end-user sees it as well
// -> this is the standard behaviour of Delphi's own TXmlDocument
// ! if an error was found, the TXMLReader.ParseError will contain it in any case !
property ErrorHandling: TOTextReaderErrorHandling read fErrorHandling write fErrorHandling;
end;
TXMLReader = class(TObject)
private
fReaderSettings: TXMLReaderSettings;
fAttributeTokens: TXMLReaderTokenList;//do not destroy!!!
fOpenElementTokens: TXMLReaderTokenList;//destroy
fReader: TOTextReader;
fAllowSetEncodingFromFile: Boolean;//internal, for external use ForceEncoding
fLastTokenType: TXMLReaderTokenType;//must be used because fReaderToken can be replaced! -> do not replace it with fReaderToken.TokenType!!!
fDocumentElementFound: Boolean;
fForceEncoding: Boolean;
fElementsToClose: Integer;
fReaderToken: PXMLReaderToken;//current reader
fOwnsReaderToken: Boolean;
fMainBuffer: TOTextBuffer;
fEntityBuffer: TOTextBuffer;
function GetEncoding: TEncoding;
procedure SetEncoding(const aEncoding: TEncoding);
function GetOwnsEncoding: Boolean;
procedure SetOwnsEncoding(const aSetOwnsEncoding: Boolean);
function GetApproxStreamPosition: OStreamInt;
function GetStreamSize: OStreamInt;
function GetParseError: IOTextParseError;
private
function GetNodePath(const aIndex: Integer): OWideString;
function GetNodePathCount: Integer;
private
procedure EntityReferenceInText;
procedure EntityReferenceStandalone;
procedure ChangeEncoding(const aEncodingAlias: OWideString);
procedure OpenElement;
procedure Attribute;
procedure FinishOpenElement;
procedure FinishOpenElementClose;
procedure CloseElement;
procedure Text(const aClearCustomBuffer: Boolean = True);
procedure ExclamationNode(const aTokenType: TXMLReaderTokenType;
const aBeginTag, aEndTag: OWideString;
const aWhiteSpaceAfterBeginTag, aIsDoctype: Boolean);
procedure CData;
procedure Comment;
procedure DocType;
procedure ProcessingInstruction;
function GetFilePosition: OStreamInt;
function GetLinePosition: OStreamInt;
function GetLine: OStreamInt;
procedure RaiseException(const aErrorClass: TOTextParseErrorClass;
const aReason: String);
procedure RaiseExceptionFmt(const aErrorClass: TOTextParseErrorClass;
const aReason: String; const aArgs: array of OWideString);
private
procedure LoadDTD;
protected
procedure DoCreate;
procedure DoDestroy;
procedure DoInit(const aForceEncoding: TEncoding);
protected
procedure RemoveLastFromNodePath(const aCheckPath: Boolean);
function NodePathIsEmpty: Boolean;
public
//create
constructor Create; overload;
//create and init
constructor Create(const aStream: TStream; const aForceEncoding: TEncoding = nil); overload;
destructor Destroy; override;
public
//The Init* procedures initialize a XML document for parsing.
// Please note that the file/stream/... is locked until the end of the
// document is reached, you destroy TXMLReader or you call ReleaseDocument!
//init document from file
// if aForceEncoding = nil: in encoding specified by the document
// if aForceEncoding<>nil : enforce encoding (<?xml encoding=".."?> is ignored)
procedure InitFile(const aFileName: String; const aForceEncoding: TEncoding = nil);
//init document from file
// if aForceEncoding = nil: in encoding specified by the document
// if aForceEncoding<>nil : enforce encoding (<?xml encoding=".."?> is ignored)
procedure InitStream(const aStream: TStream; const aForceEncoding: TEncoding = nil);
//init XML in default unicode encoding: UTF-16 for DELPHI, UTF-8 for FPC
procedure InitXML(const aXML: OWideString);
{$IFDEF O_RAWBYTESTRING}
procedure InitXML_UTF8(const aXML: ORawByteString);
{$ENDIF}
//init document from TBytes buffer
// if aForceEncoding = nil: in encoding specified by the document
// if aForceEncoding<>nil : enforce encoding (<?xml encoding=".."?> is ignored)
procedure InitBuffer(const aBuffer: TBytes; const aForceEncoding: TEncoding = nil); overload;
procedure InitBuffer(const aBuffer; const aBufferLength: Integer; const aForceEncoding: TEncoding = nil); overload;
//Release the current document (that was loaded with Init*)
procedure ReleaseDocument;
public
//use ReadNextToken for reading next XML token
function ReadNextToken(var outToken: PXMLReaderToken): Boolean;
//set custom attribute tokens
procedure SetAttributeTokens(const aAttributeTokens: TXMLReaderTokenList);
//reset document element -> use if you want to reset the information that the document element has been already read
procedure ResetDocumentElement;
public
//following are functions to work with the current path in the XML document
function NodePathMatch(const aNodePath: OWideString): Boolean; overload;
function NodePathMatch(const aNodePath: TOWideStringList): Boolean; overload;
function NodePathMatch(const aNodePath: Array of OWideString): Boolean; overload;
function RefIsChildOfNodePath(const aRefNodePath: TOWideStringList): Boolean; overload;
function RefIsChildOfNodePath(const aRefNodePath: Array of OWideString): Boolean; overload;
function RefIsParentOfNodePath(const aRefNodePath: TOWideStringList): Boolean; overload;
function RefIsParentOfNodePath(const aRefNodePath: Array of OWideString): Boolean; overload;
procedure NodePathAssignTo(const aNodePath: TOWideStringList);
function NodePathAsString: OWideString;
//current path in XML document
property NodePath[const aIndex: Integer]: OWideString read GetNodePath;
//count of elements in path
property NodePathCount: Integer read GetNodePathCount;
public
//encoding of the text file, when set, the file will be read again from the start
property Encoding: TEncoding read GetEncoding write SetEncoding;
property OwnsEncoding: Boolean read GetOwnsEncoding write SetOwnsEncoding;
//if set to true, the encoding will not be changed automatically when
// <?xml encoding="..."?> is found
property ForceEncoding: Boolean read fForceEncoding write fForceEncoding;
//Reader Settings
property ReaderSettings: TXMLReaderSettings read fReaderSettings;
public
//Approximate position in original read stream
// exact position cannot be determined because of variable UTF-8 character lengths
property ApproxStreamPosition: OStreamInt read GetApproxStreamPosition;
//size of original stream
property StreamSize: OStreamInt read GetStreamSize;
//Character position in text
// -> in Lazarus, the position is always in UTF-8 characters (no way to go around that since Lazarus uses UTF-8).
// -> in Delphi the position is always correct
property FilePosition: OStreamInt read GetFilePosition;//absolute character position in file (in character units, not bytes), 1-based
property LinePosition: OStreamInt read GetLinePosition;//current character in line, 1-based
property Line: OStreamInt read GetLine;//current line, 1-based
property ParseError: IOTextParseError read GetParseError;
end;
EXmlWriterException = class(Exception);
EXmlWriterInvalidString = class(EXmlWriterException);
XMLNodeId = ONativeUInt;
ICustomXMLDocument = interface
['{7FA934A1-B42A-4D68-8B59-E33818836D6E}']
//protected
function GetCodePage: Word;
procedure SetCodePage(const aCodePage: Word);
function GetVersion: OWideString;
procedure SetVersion(const aVersion: OWideString);
function GetEncoding: OWideString;
procedure SetEncoding(const aEncoding: OWideString);
function GetStandAlone: OWideString;
procedure SetStandAlone(const aStandAlone: OWideString);
function GetWhiteSpaceHandling: TXmlWhiteSpaceHandling;
procedure SetWhiteSpaceHandling(const aWhiteSpaceHandling: TXmlWhiteSpaceHandling);
function GetWriterSettings: TXMLDocumentWriterSettings;
function GetReaderSettings: TXMLReaderSettings;
function GetAbsoluteNodeCount: XMLNodeId;
//public
function IndexOfString(const aString: OWideString): OHashedStringsIndex;
function GetString(const aStringId: OHashedStringsIndex): OWideString;
//public
//clear the whole document
procedure Clear(const aFullClear: Boolean = True);
//load document with custom reader
// return false if the XML document is invalid
function LoadFromReader(const aReader: TXMLReader; var outReaderToken: PXMLReaderToken): Boolean;
//load document from file in encoding specified by the document
function LoadFromFile(const aFileName: String; const aForceEncoding: TEncoding = nil): Boolean;
//load document from file
// if aForceEncoding = nil: in encoding specified by the document
// if aForceEncoding<>nil : enforce encoding (<?xml encoding=".."?> is ignored)
function LoadFromStream(const aStream: TStream; const aForceEncoding: TEncoding = nil): Boolean;
//loads XML in default unicode encoding: UTF-16 for DELPHI, UTF-8 for FPC
function LoadFromXML(const aXML: OWideString): Boolean;
{$IFDEF O_RAWBYTESTRING}
function LoadFromXML_UTF8(const aXML: ORawByteString): Boolean;
{$ENDIF}
//load document from TBytes buffer
// if aForceEncoding = nil: in encoding specified by the document
// if aForceEncoding<>nil : enforce encoding (<?xml encoding=".."?> is ignored)
function LoadFromBuffer(const aBuffer: TBytes; const aForceEncoding: TEncoding = nil): Boolean; overload;
function LoadFromBuffer(const aBuffer; const aBufferLength: Integer; const aForceEncoding: TEncoding = nil): Boolean; overload;
//save document with custom writer
procedure SaveToWriter(const aWriter: TXMLWriter);
//save document to file in encoding specified by the document
procedure SaveToFile(const aFileName: String);
//save document to stream in encoding specified by the document
procedure SaveToStream(const aStream: TStream);
//returns XML as string (always in the system OWideString encoding and with system line breaks)
procedure SaveToXML(var outXML: OWideString); overload;
procedure SaveToXML(var outXML: OWideString; const aIndentType: TXMLIndentType); overload;
{$IFDEF O_RAWBYTESTRING}
procedure SaveToXML_UTF8(var outXML: ORawByteString); overload;
procedure SaveToXML_UTF8(var outXML: ORawByteString; const aIndentType: TXMLIndentType); overload;
{$ENDIF}
//returns XML as a buffer in encoding specified by the document
procedure SaveToBuffer(var outBuffer: TBytes); overload;
{$IFDEF O_RAWBYTESTRING}
procedure SaveToBuffer(var outBuffer: ORawByteString); overload;
{$ENDIF}
//public
//returns XML in default unicode encoding: UTF-16 for DELPHI, UTF-8 for FPC
function XML: OWideString; overload;
function XML(const aIndentType: TXMLIndentType): OWideString; overload;
{$IFDEF O_RAWBYTESTRING}
function XML_UTF8: ORawByteString; overload;
function XML_UTF8(const aIndentType: TXMLIndentType): ORawByteString; overload;
{$ENDIF}
//public
//document whitespace handling
property WhiteSpaceHandling: TXmlWhiteSpaceHandling read GetWhiteSpaceHandling write SetWhiteSpaceHandling;
//document encoding (as integer identifier) - from <?xml encoding="???"?>
property CodePage: Word read GetCodePage write SetCodePage;
//document encoding (as string alias) - from <?xml encoding="???"?>
property Encoding: OWideString read GetEncoding write SetEncoding;
//document standalone - from <?xml standalone="???"?>
property StandAlone: OWideString read GetStandAlone write SetStandAlone;
//document version - from <?xml version="???"?>
property Version: OWideString read GetVersion write SetVersion;
//XML writer settings
property WriterSettings: TXMLDocumentWriterSettings read GetWriterSettings;
//XML reader settings
property ReaderSettings: TXMLReaderSettings read GetReaderSettings;
//ParseError has information about the error that occured when parsing a document
function GetParseError: IOTextParseError;
property ParseError: IOTextParseError read GetParseError;
//get node count that are created in the document - also those that are created but don't have any parent!
property AbsoluteNodeCount: XMLNodeId read GetAbsoluteNodeCount;
end;
EXMLReaderInvalidCharacter = class(EOTextReaderException)
public
class function GetErrorCode: Integer; override;
end;
EXMLReaderInvalidStructure = class(EOTextReaderException)
public
class function GetErrorCode: Integer; override;
end;
TXMLParseErrorInvalidCharacter = class(TOTextParseError)
function GetExceptionClass: EOTextReaderExceptionClass; override;
end;
TXMLParseErrorInvalidStructure = class(TOTextParseError)
function GetExceptionClass: EOTextReaderExceptionClass; override;
end;
implementation
uses OXmlLng;
procedure ProcessNewLineChar(
const aLastChar: OWideChar;
const aReaderSettings: TXMLReaderSettings;
const aCustomReader: TOTextReader; const aCustomBuffer: TOTextBuffer);
var
xC: OWideChar;
begin
if aReaderSettings.fLineBreak <> lbDoNotProcess then
begin
if aLastChar = #13 then
begin
//search for #13#10 sequence
if (aCustomReader.ReadNextChar({%H-}xC)) and (xC <> #10) then
aCustomReader.UndoRead;
end;
aCustomBuffer.WriteString(XmlLineBreak[aReaderSettings.fLineBreak]);
end else
aCustomBuffer.WriteChar(aLastChar);
end;
{$IFDEF O_DELPHI_5_DOWN}
function TryStrToInt(const S: string; out Value: Integer): Boolean;
var
xError: Integer;
begin
Val(S, Value, xError);
Result := (xError = 0);
end;
{$ENDIF}
function ProcessEntity(
const aReaderSettings: TXMLReaderSettings;
const aCustomReader: TOTextReader;
const aCustomBuffer: TOTextBuffer;
var outReadString, outEntityName, outEntityValue: OWideString): Boolean;
const
cEntityPrefix: array[0..2] of OWideString = ('', '#', '#x');
cEntityText = 0;
cEntityDec = 1;
cEntityHex = 2;
var
xEntityType: Byte;
xReaderStartPos: Integer;
procedure _SetReadString;
begin
outReadString := '&'+aCustomReader.ReadPreviousString(aCustomReader.TempStringPosition - xReaderStartPos);
aCustomReader.UnblockFlushTempBuffer;
end;
procedure _EntityError;
begin
outEntityName := cEntityPrefix[xEntityType]+outEntityName;
Result := False;
_SetReadString;
end;
var
xC: OWideChar;
xOutputChar: Integer;
xIsHex: Boolean;
begin
xOutputChar := -1;
aCustomBuffer.Clear(False);
aCustomReader.BlockFlushTempBuffer;
xReaderStartPos := aCustomReader.TempStringPosition;
outEntityName := '';
outEntityValue := '';
aCustomReader.ReadNextChar({%H-}xC);
if xC = '#' then
begin
//integer decimal/hexadecimal entity
aCustomReader.ReadNextChar(xC);
xIsHex := (xC = 'x');
if xIsHex then
begin
xEntityType := cEntityHex;
aCustomReader.ReadNextChar(xC);
while OXmlIsHexadecimalChar(xC) do
begin
aCustomBuffer.WriteChar(xC);
aCustomReader.ReadNextChar(xC);
end;
aCustomBuffer.GetBuffer(outEntityName);
if (xC <> ';') or not TryStrToInt('$'+outEntityName, xOutputChar) then
begin
if (xC <> ';') then
aCustomReader.UndoRead;
_EntityError;
Exit;
end;
end else
begin
xEntityType := cEntityDec;
while OXmlIsDecimalChar(xC) do
begin
aCustomBuffer.WriteChar(xC);
aCustomReader.ReadNextChar(xC);
end;
aCustomBuffer.GetBuffer(outEntityName);
if (xC <> ';') or not TryStrToInt(outEntityName, xOutputChar) then
begin
if (xC <> ';') then
aCustomReader.UndoRead;
_EntityError;
Exit;
end;
end;
end else
begin
//TEXT entity
xEntityType := cEntityText;
if not OXmlIsNameStartChar(xC) then
begin
aCustomReader.UndoRead;
_EntityError;
Exit;
end;
while OXmlIsNameChar(xC) do
begin
aCustomBuffer.WriteChar(xC);
aCustomReader.ReadNextChar(xC);
end;
aCustomBuffer.GetBuffer(outEntityName);
if (xC <> ';') or not aReaderSettings.fEntityList.Find(outEntityName, outEntityValue) then
begin
if (xC <> ';') then
aCustomReader.UndoRead;
_EntityError;
Exit;
end;
end;
if (xOutputChar > -1) and (outEntityValue = '') then
begin
{$IFDEF FPC}
//FPC, convert to UTF-8 first
outEntityValue := UTF8Encode(WideString(WideChar(xOutputChar)));//MUST BE WideString + WideChar (convert utf16 to utf8)
{$ELSE}
outEntityValue := OWideString(OWideChar(xOutputChar));
{$ENDIF}
if aReaderSettings.fStrictXML and not OXmlValidChars(outEntityValue) then
begin
_EntityError;
Exit;
end;
end;
_SetReadString;
outEntityName := cEntityPrefix[xEntityType]+outEntityName;
Result := True;
end;
{ TXMLReader }
procedure TXMLReader.FinishOpenElement;
begin
fReaderToken := fOpenElementTokens.GetToken(fOpenElementTokens.Count-1);//has TokenName already set
fReaderToken.TokenValue := '';
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute] then
fReaderToken.TokenType := rtFinishXMLDeclarationClose
else
fReaderToken.TokenType := rtFinishOpenElement;
end;
procedure TXMLReader.FinishOpenElementClose;
var
xC: OWideChar;
x: PXMLReaderToken;
begin
//opened after a '?' for PI or '/' for an element.
fReader.ReadNextChar({%H-}xC);//must be '>'
if xC <> '>' then
begin
if fReaderSettings.fStrictXML then
begin
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute] then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInElement, ['?']);
Exit;
end else
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInElement, ['/']);
Exit;
end;
end else
begin
//let's be generous and go over this invalid character
fReader.UndoRead;
ReadNextToken({%H-}x);
Exit;
end;
end;
fReaderToken := fOpenElementTokens.GetToken(fOpenElementTokens.Count-1);//has TokenName already set
fReaderToken.TokenValue := '';
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute] then
fReaderToken.TokenType := rtFinishXMLDeclarationClose
else
fReaderToken.TokenType := rtFinishOpenElementClose;
RemoveLastFromNodePath(False);
end;
procedure TXMLReader.Text(const aClearCustomBuffer: Boolean);
var
xC: OWideChar;
xCKind: TXMLCharKind;
xSquareBracketCloseCount: Integer;//the character sequence ']]>' is not allowed in text
begin
if aClearCustomBuffer then
fMainBuffer.Clear(False);
fReader.ReadNextChar({%H-}xC);
xSquareBracketCloseCount := 0;
while
not Assigned(fReader.ParseError) and
not fReader.EOF
do begin
xCKind := OXmlCharKind(xC);
case xCKind of
ckNewLine10, ckNewLine13: ProcessNewLineChar(xC, fReaderSettings, fReader, fMainBuffer);
ckAmpersand:
begin
if fReaderSettings.fExpandEntities then
EntityReferenceInText
else
Break;
end;
ckLowerThan: Break;
ckTab, ckCharacter, ckSingleQuote, ckDoubleQuote,
ckSquareBracketOpen, ckSquareBracketClose: fMainBuffer.WriteChar(xC);
ckGreaterThan:
begin
if fReaderSettings.fStrictXML and (xSquareBracketCloseCount >= 2) then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, [xC]);
Exit;
end;
fMainBuffer.WriteChar(xC);
end;
else
if not fReaderSettings.fStrictXML then
fMainBuffer.WriteChar(xC)
else
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, ['0x'+IntToHex(Ord(xC), 4)]);
end;
if fReaderSettings.fStrictXML then//"]]>" support
begin
if xCKind = ckSquareBracketClose then
Inc(xSquareBracketCloseCount)
else
xSquareBracketCloseCount := 0;
end;
fReader.ReadNextChar(xC);
end;
if not fReader.EOF then
fReader.UndoRead;
fReaderToken.TokenType := rtText;
fReaderToken.TokenName := '';
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
end;
procedure TXMLReader.Attribute;
var
xC: OWideChar;
xQuotationMark: OWideChar;
begin
if Assigned(fAttributeTokens) then
begin
fReaderToken := fAttributeTokens.CreateNew;
fAttributeTokens.AddLast;
end;
fMainBuffer.Clear(False);
fReader.ReadNextChar({%H-}xC);
if fReaderSettings.fStrictXML and not OXmlIsNameStartChar(xC) then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidAttributeStartChar, [xC]);
Exit;
end;
if not fReaderSettings.fStrictXML then
begin
//not StrictXML
repeat//read attribute name
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
until OXmlIsBreakChar(xC);
end else
begin
//StrictXML
while OXmlIsNameChar(xC) do
begin//read attribute name
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
end;
fMainBuffer.GetBuffer(fReaderToken.TokenName);
while OXmlIsWhiteSpaceChar(xC) do//jump over spaces "attr ="
fReader.ReadNextChar(xC);
if xC <> '=' then
begin
//let's be generous and allow attributes without values - even if they are not allowed by xml spec
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_EqualSignMustFollowAttribute, [fReaderToken.TokenName]);
Exit;
end else
begin
fReaderToken.TokenValue := '';
fReader.UndoRead;
end;
end else
begin
fReader.ReadNextChar(xC);
while OXmlIsWhiteSpaceChar(xC) do//jump over spaces "= value"
fReader.ReadNextChar(xC);
xQuotationMark := xC;
if (xQuotationMark = '''') or (xQuotationMark = '"') then
begin
//read attribute value in quotation marks
fMainBuffer.Clear(False);
fReader.ReadNextChar(xC);
while not (xC = xQuotationMark) and not Assigned(fReader.ParseError) and not fReader.EOF do
begin
case OXmlCharKind(xC) of
ckNewLine10, ckNewLine13: ProcessNewLineChar(xC, fReaderSettings, fReader, fMainBuffer);
ckAmpersand: EntityReferenceInText;
ckTab, ckCharacter, ckSingleQuote, ckDoubleQuote, ckGreaterThan,
ckSquareBracketOpen, ckSquareBracketClose: fMainBuffer.WriteChar(xC);
else
if not fReaderSettings.fStrictXML then
fMainBuffer.WriteChar(xC)
else
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInAttribute, [IntToHex(Ord(xC), 4)]);
end;
fReader.ReadNextChar(xC);
end;
end else
begin
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_AttributeValueMustBeEnclosed, [fReaderToken.TokenName]);
Exit;
end else
begin
//let's be generous and allow attribute values that are not enclosed in quotes
fMainBuffer.Clear(False);
while not OXmlIsBreakChar(xC) and not Assigned(fReader.ParseError) and not fReader.EOF do
begin
case OXmlCharKind(xC) of
ckNewLine10, ckNewLine13: ProcessNewLineChar(xC, fReaderSettings, fReader, fMainBuffer);
ckAmpersand: EntityReferenceInText;
ckTab, ckCharacter, ckSingleQuote, ckDoubleQuote,
ckSquareBracketOpen, ckSquareBracketClose: fMainBuffer.WriteChar(xC);
else
if not fReaderSettings.fStrictXML then
fMainBuffer.WriteChar(xC)
else
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, [IntToHex(Ord(xC), 4)]);
end;
fReader.ReadNextChar(xC);
end;
end;
end;
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
end;
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute] then
begin
fReaderToken.TokenType := rtXMLDeclarationAttribute;
if not fForceEncoding and fAllowSetEncodingFromFile and
(fReaderToken.TokenName = 'encoding')
then
ChangeEncoding(fReaderToken.TokenValue);
end else
fReaderToken.TokenType := rtAttribute;
end;
procedure TXMLReader.CData;
begin
ExclamationNode(rtCData, '<![CDATA[', ']]>', False, False);
end;
procedure TXMLReader.ChangeEncoding(const aEncodingAlias: OWideString);
var
xLastName: OWideString;
xEncoding: TEncoding;
xInXMLDeclaration: Boolean;
xReaderToken: PXMLReaderToken;
begin
if
TEncoding.EncodingFromAlias(aEncodingAlias, {%H-}xEncoding) and
(fReader.Encoding <> xEncoding)
then begin
//reload document with new encoding
fReader.Encoding := xEncoding;
if fAllowSetEncodingFromFile then
begin
fAllowSetEncodingFromFile := False;
fReader.UnblockFlushTempBuffer;//was blocked in TXMLReader.Create
end;
//go back to current position
xInXMLDeclaration := False;
xLastName := fReaderToken.TokenName;
fLastTokenType := rtDocumentStart;
fOpenElementTokens.Clear;
//parse from beginning back to the encoding attribute
while ReadNextToken({%H-}xReaderToken) do
begin
case xReaderToken.TokenType of
rtOpenXMLDeclaration: xInXMLDeclaration := True;
rtOpenElement: xInXMLDeclaration := False;
rtXMLDeclarationAttribute:
if xInXMLDeclaration and (xReaderToken.TokenName = xLastName) then
Exit;
end;
end;
end;
end;
procedure TXMLReader.Comment;
begin
ExclamationNode(rtComment, '<!--', '-->', False, False);
end;
constructor TXMLReader.Create;
begin
inherited Create;
DoCreate;
end;
constructor TXMLReader.Create(const aStream: TStream;
const aForceEncoding: TEncoding = nil);
begin
inherited Create;
DoCreate;
InitStream(aStream, aForceEncoding);
end;
procedure TXMLReader.DoInit(const aForceEncoding: TEncoding);
begin
fAllowSetEncodingFromFile := not fReader.BOMFound;
fDocumentElementFound := False;
fElementsToClose := 0;
fLastTokenType := rtDocumentStart;
fOpenElementTokens.Clear;
fReaderToken := fOpenElementTokens.CreateNew;
if Assigned(fAttributeTokens) then
fAttributeTokens.Clear;
fReader.ErrorHandling := fReaderSettings.ErrorHandling;
fReader.BlockFlushTempBuffer;//will be unblocked when fAllowSetEncodingFromFile is set to false
if Assigned(aForceEncoding) then
Self.Encoding := aForceEncoding
else
Self.fForceEncoding := False;
end;
destructor TXMLReader.Destroy;
begin
DoDestroy;
inherited;
end;
procedure TXMLReader.DoCreate;
begin
fReader := TOTextReader.Create;
fOwnsReaderToken := True;
fReaderSettings := TXMLReaderSettings.Create;
fOpenElementTokens := TXMLReaderTokenList.Create;
fReaderToken := fOpenElementTokens.CreateNew;
fMainBuffer := TOTextBuffer.Create;
fEntityBuffer := TOTextBuffer.Create(16);
end;
procedure TXMLReader.DocType;
begin
ExclamationNode(rtDocType, '<!DOCTYPE', '>', True, True);
end;
procedure TXMLReader.DoDestroy;
begin
fReader.Free;
fReaderSettings.Free;
fOpenElementTokens.Free;
fMainBuffer.Free;
fEntityBuffer.Free;
//do not destroy fAttributeTokens here!!!
end;
procedure TXMLReader.SetAttributeTokens(
const aAttributeTokens: TXMLReaderTokenList);
begin
fAttributeTokens := aAttributeTokens;
fReaderToken := fOpenElementTokens.CreateNew;//in case fReaderToken was in old fAttributeTokens
end;
procedure TXMLReader.SetEncoding(const aEncoding: TEncoding);
begin
fReader.Encoding := aEncoding;
fForceEncoding := True;
end;
procedure TXMLReader.SetOwnsEncoding(const aSetOwnsEncoding: Boolean);
begin
fReader.OwnsEncoding := aSetOwnsEncoding;
end;
procedure TXMLReader.EntityReferenceInText;
var
xReadString, xEntityName, xEntityValue: OWideString;
begin
if ProcessEntity(fReaderSettings, fReader, fEntityBuffer, {%H-}xReadString, {%H-}xEntityName, {%H-}xEntityValue) then
fMainBuffer.WriteString(xEntityValue)
else
begin
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidEntity, [xReadString]);
Exit;
end else
begin
fMainBuffer.WriteString(xReadString);
end;
end;
end;
procedure TXMLReader.EntityReferenceStandalone;
var
xReadString, xEntityName, xEntityValue: OWideString;
begin
if ProcessEntity(fReaderSettings, fReader, fEntityBuffer, {%H-}xReadString, {%H-}xEntityName, {%H-}xEntityValue) then
begin
fReaderToken.TokenType := rtEntityReference;
fReaderToken.TokenName := xEntityName;
fReaderToken.TokenValue := xEntityValue;
end else
begin
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidEntity, [xReadString]);
Exit;
end else
begin
fReaderToken.TokenType := rtText;
fReaderToken.TokenName := '';
fReaderToken.TokenValue := xReadString;
end;
end;
end;
procedure TXMLReader.ExclamationNode(
const aTokenType: TXMLReaderTokenType; const aBeginTag, aEndTag: OWideString;
const aWhiteSpaceAfterBeginTag, aIsDoctype: Boolean);
var
I: Integer;
xC: OWideChar;
xCKind: TXMLCharKind;
xPreviousC: OWideString;
xResult: Boolean;
begin
fMainBuffer.Clear(False);
fMainBuffer.WriteChar('<');
fMainBuffer.WriteChar('!');
xResult := True;
for I := 3 to Length(aBeginTag) do
begin
fReader.ReadNextChar({%H-}xC);
if aBeginTag[I] <> UpperCase(xC) then
begin
xResult := False;
fReader.UndoRead;
Break;
end;
fMainBuffer.WriteChar(xC);
end;
if aWhiteSpaceAfterBeginTag and xResult then
begin
//must be followed by a whitespace character
fReader.ReadNextChar(xC);
fMainBuffer.WriteChar(xC);
xResult := OXmlIsWhiteSpaceChar(xC);
end;
if not xResult then
begin
//header not found
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, ['<']);
Exit;
end else
begin
//output as text
if xC <> '<' then
begin
Text(False);
end else
begin
fReaderToken.TokenType := rtText;
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
fReaderToken.TokenName := '';
end;
Exit;
end;
end else
begin
fMainBuffer.Clear(False);
SetLength(xPreviousC, Length(aEndTag));
for I := 1 to Length(xPreviousC) do
xPreviousC[I] := #0;
repeat
if Length(xPreviousC) > 1 then
Move(xPreviousC[2], xPreviousC[1], (Length(xPreviousC)-1)*SizeOf(OWideChar));
fReader.ReadNextChar(xC);
xCKind := OXmlCharKind(xC);
case xCKind of
ckInvalid:
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, [IntToHex(Ord(xC), 4)]);
Exit;
end;
ckSquareBracketOpen:
if aIsDoctype then
begin
fMainBuffer.WriteChar(xC);
LoadDTD;
for I := 1 to Length(xPreviousC) do
xPreviousC[I] := #0;
Continue;
end;
end;
xPreviousC[Length(xPreviousC)] := xC;
fMainBuffer.WriteChar(xC);
until (
(xPreviousC = aEndTag) or
Assigned(fReader.ParseError) or
fReader.EOF);
for I := 1 to Length(aEndTag) do
fMainBuffer.RemoveLastChar;
fReaderToken.TokenType := aTokenType;
fReaderToken.TokenName := '';
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
end;
end;
procedure TXMLReader.OpenElement;
var
xC: OWideChar;
begin
fMainBuffer.Clear(False);
fReader.ReadNextChar({%H-}xC);
case xC of
'!':
begin
//comment or cdata
fReader.ReadNextChar(xC);
fReader.UndoRead;
case xC of
'[': CData;
'-': Comment;
'D', 'd': DocType;
else
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, ['<']);
Exit;
end else
begin
fMainBuffer.WriteChar('<');
fMainBuffer.WriteChar('!');
if xC <> '<' then
begin
Text(False);
end else
begin
fReaderToken.TokenType := rtText;
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
fReaderToken.TokenName := '';
end;
Exit;
end;
end;
Exit;
end;
'/':
begin
//close element
CloseElement;
Exit;
end;
'?':
begin
//processing instruction
ProcessingInstruction;
Exit;
end;
end;
if fReaderSettings.fStrictXML then
begin
if not OXmlIsNameStartChar(xC) then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, ['<']);
Exit;
end;
while OXmlIsNameChar(xC) do
begin
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
if (xC = '/') or (xC = '>') then
fReader.UndoRead
else if not OXmlIsWhiteSpaceChar(xC) then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidElementName, [fMainBuffer.GetBuffer+xC]);
Exit;
end;
end else
begin
if not OXmlIsNameChar(xC) then
begin
fMainBuffer.WriteChar('<');
fReader.UndoRead;
if xC <> '<' then
begin
Text(False);
end else
begin
fReaderToken.TokenType := rtText;
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
fReaderToken.TokenName := '';
end;
Exit;
end else
begin
while not OXmlIsBreakChar(xC) do
begin
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
if (xC = '/') or (xC = '>') then
fReader.UndoRead
end;
end;
if fAllowSetEncodingFromFile then
begin
fAllowSetEncodingFromFile := False;// -> first Node found, encoding change is not allowed any more
fReader.UnblockFlushTempBuffer;//was blocked in TXMLReader.Create
end;
fDocumentElementFound := True;
fMainBuffer.GetBuffer(fReaderToken.TokenName);
fReaderToken.TokenValue := '';
fReaderToken.TokenType := rtOpenElement;
fOpenElementTokens.AddLast;
if Assigned(fAttributeTokens) then
fAttributeTokens.Clear;
end;
procedure TXMLReader.RaiseException(const aErrorClass: TOTextParseErrorClass;
const aReason: String);
begin
fReader.RaiseException(aErrorClass, aReason);
end;
procedure TXMLReader.RaiseExceptionFmt(const aErrorClass: TOTextParseErrorClass;
const aReason: String; const aArgs: array of OWideString);
begin
fReader.RaiseExceptionFmt(aErrorClass, aReason, aArgs);
end;
function TXMLReader.ReadNextToken(var outToken: PXMLReaderToken): Boolean;
var
xC: OWideChar;
begin
Result := True;
if fElementsToClose > 0 then
begin
//close elements
fReaderToken := fOpenElementTokens.GetToken(fOpenElementTokens.Count-1);//has TokenName already set
fReaderToken.TokenValue := '';
fReaderToken.TokenType := rtCloseElement;
RemoveLastFromNodePath(False);
fLastTokenType := fReaderToken.TokenType;
outToken := fReaderToken;
Dec(fElementsToClose);
Exit;
end;
if (fReaderSettings.fBreakReading = brAfterDocumentElement) and
(fDocumentElementFound) and
NodePathIsEmpty
then begin
//end of root element is reached, but do not release document!!!
Result := False;
outToken := fReaderToken;
Exit;
end;
fReaderToken := fOpenElementTokens.CreateNew;//must be here and not in the beggining of the function -> due to attributes and open elements and sequential parser
if not fReader.ReadNextChar({%H-}xC) then
begin
//end of document
Result := False;
ReleaseDocument;
if fReaderSettings.fStrictXML and (NodePathCount > 0) then
RaiseExceptionFmt(TXMLParseErrorInvalidStructure,
OXmlLng_UnclosedElementsInTheEnd, [xC]);
Exit;
end;
case xC of
'<':
begin
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute, rtOpenElement, rtAttribute] then
begin
if fReaderSettings.fStrictXML then
begin
Result := False;
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInElement, [xC]);
Exit;
end else
begin
fReader.UndoRead;
Attribute;
end;
end else
begin
OpenElement;
end;
end;
'?':
begin
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute] then
begin
FinishOpenElementClose
end else
begin
//text
fReader.UndoRead;
Text;
end;
end;
'/':
begin
if fLastTokenType in [rtOpenElement, rtAttribute] then
begin
FinishOpenElementClose
end else
begin
//text
fReader.UndoRead;
Text;
end;
end;
'>':
begin
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute, rtOpenElement, rtAttribute] then
begin
FinishOpenElement;
end else
begin
//text
fReader.UndoRead;
Text;
end;
end;
else//case
if fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute, rtOpenElement, rtAttribute]
then begin
while OXmlIsWhiteSpaceChar(xC) do
fReader.ReadNextChar(xC);
if ((xC = '/') and (fLastTokenType in [rtOpenElement, rtAttribute])) or
((xC = '?') and (fLastTokenType in [rtOpenXMLDeclaration, rtXMLDeclarationAttribute]))
then begin
FinishOpenElementClose;
end else if ((xC = '>') and (fLastTokenType in [rtOpenElement, rtAttribute])) then
begin
FinishOpenElement;
end else
begin
fReader.UndoRead;
Attribute;
end;
end else
begin
//text
if not fReaderSettings.fExpandEntities and (xC = '&') then
begin
EntityReferenceStandalone;
end else
begin
fReader.UndoRead;
Text;
end;
end;
end;
outToken := fReaderToken;
fLastTokenType := fReaderToken.TokenType;
Result := not Assigned(fReader.ParseError);
end;
procedure TXMLReader.CloseElement;
var
xC: OWideChar;
begin
fMainBuffer.Clear(False);
fReader.ReadNextChar({%H-}xC);
if fReaderSettings.fStrictXML then
begin
//strict
if not OXmlIsNameStartChar(xC) then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidStringInText, ['</'+xC]);
Exit;
end;
while OXmlIsNameChar(xC) do
begin
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
while OXmlIsWhiteSpaceChar(xC) do
begin
fReader.ReadNextChar(xC);
end;
if xC <> '>' then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidStringInText, ['</'+fMainBuffer.GetBuffer]);
Exit;
end;
end else
begin
//not strict
if not OXmlIsNameChar(xC) then
begin
fMainBuffer.WriteChar('<');
fMainBuffer.WriteChar('/');
fReader.UndoRead;
if xC <> '<' then
begin
Text(False);
end else
begin
fReaderToken.TokenType := rtText;
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
fReaderToken.TokenName := '';
end;
Exit;
end else
begin
while not OXmlIsBreakChar(xC) do
begin
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
while not((xC = '>') or fReader.EOF) do
begin
fReader.ReadNextChar(xC);
end;
end;
end;
fMainBuffer.GetBuffer(fReaderToken.TokenName);
fReaderToken.TokenValue := '';
fReaderToken.TokenType := rtCloseElement;
RemoveLastFromNodePath(True);
end;
function TXMLReader.GetApproxStreamPosition: OStreamInt;
begin
Result := fReader.ApproxStreamPosition;
end;
function TXMLReader.GetEncoding: TEncoding;
begin
Result := fReader.Encoding;
end;
function TXMLReader.GetOwnsEncoding: Boolean;
begin
Result := fReader.OwnsEncoding;
end;
function TXMLReader.GetParseError: IOTextParseError;
begin
Result := fReader.ParseError;
end;
function TXMLReader.GetStreamSize: OStreamInt;
begin
Result := fReader.StreamSize;
end;
function TXMLReader.GetLinePosition: OStreamInt;
begin
Result := fReader.LinePosition;
end;
function TXMLReader.GetLine: OStreamInt;
begin
Result := fReader.Line;
end;
function TXMLReader.GetFilePosition: OStreamInt;
begin
Result := fReader.FilePosition;
end;
procedure TXMLReader.InitBuffer(const aBuffer: TBytes;
const aForceEncoding: TEncoding);
begin
fReader.InitBuffer(aBuffer, TEncoding.UTF8);
DoInit(aForceEncoding);
end;
procedure TXMLReader.InitBuffer(const aBuffer; const aBufferLength: Integer;
const aForceEncoding: TEncoding);
begin
fReader.InitBuffer(aBuffer, aBufferLength, TEncoding.UTF8);
DoInit(aForceEncoding);
end;
procedure TXMLReader.InitFile(const aFileName: String;
const aForceEncoding: TEncoding);
begin
fReader.InitFile(aFileName, TEncoding.UTF8);
DoInit(aForceEncoding);
end;
procedure TXMLReader.InitStream(const aStream: TStream;
const aForceEncoding: TEncoding);
begin
fReader.InitStream(aStream, TEncoding.UTF8);
DoInit(aForceEncoding);
end;
procedure TXMLReader.InitXML(const aXML: OWideString);
begin
fReader.InitString(aXML);
DoInit(TEncoding.OWideStringEncoding);
end;
procedure TXMLReader.LoadDTD;
var
xReaderStartPos: Integer;
begin
fReader.BlockFlushTempBuffer;
xReaderStartPos := fReader.TempStringPosition;
try
fReaderSettings.LoadDTD(fReader, True);
finally
fMainBuffer.WriteString(fReader.ReadPreviousString(fReader.TempStringPosition - xReaderStartPos));
fReader.UnblockFlushTempBuffer;
end;
end;
function TXMLReader.NodePathIsEmpty: Boolean;
begin
Result := fOpenElementTokens.Count = 0;
end;
{$IFDEF O_RAWBYTESTRING}
procedure TXMLReader.InitXML_UTF8(const aXML: ORawByteString);
begin
fReader.InitString_UTF8(aXML);
DoInit(TEncoding.UTF8);
end;
{$ENDIF}
procedure TXMLReader.ProcessingInstruction;
var
xC: OWideChar;
xPreviousC: OWideChar;
begin
fMainBuffer.Clear(False);
fReader.ReadNextChar({%H-}xC);
if fReaderSettings.fStrictXML then
begin
if not OXmlIsNameStartChar(xC) then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidStringInText, ['<?'+xC]);
Exit;
end;
while OXmlIsNameChar(xC) do
begin
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
if not OXmlIsWhiteSpaceChar(xC) and (xC <> '?') then
begin
//must be followed by a whitespace character
fMainBuffer.WriteChar(xC);
RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidStringInText, ['<?'+fMainBuffer.GetBuffer]);
Exit;
end;
end else
begin
while not OXmlIsBreakChar(xC) do
begin
fMainBuffer.WriteChar(xC);
fReader.ReadNextChar(xC);
end;
end;
fMainBuffer.GetBuffer(fReaderToken.TokenName);
if
not fDocumentElementFound and
fReaderSettings.fRecognizeXMLDeclaration and
OSameText(fReaderToken.TokenName, XML_XML)
then begin
//xml declaration: <?xml attr="value"?>
fReaderToken.TokenType := rtOpenXMLDeclaration;
fReaderToken.TokenValue := '';
fOpenElementTokens.AddLast;
Exit;
end;
//custom processing instruction
fReaderToken.TokenType := rtProcessingInstruction;
fMainBuffer.Clear(False);
if not fReaderSettings.fStrictXML and (fReaderToken.TokenName = '') then
fReader.UndoRead;
xPreviousC := xC;
fReader.ReadNextChar(xC);
while
not((xPreviousC = '?') and (xC = '>')) and
not fReader.EOF
do begin
fMainBuffer.WriteChar(xC);
xPreviousC := xC;
fReader.ReadNextChar(xC);
end;
fMainBuffer.RemoveLastChar;
fMainBuffer.GetBuffer(fReaderToken.TokenValue);
end;
procedure TXMLReader.ReleaseDocument;
begin
fReader.ReleaseDocument;
end;
procedure TXMLReader.RemoveLastFromNodePath(const aCheckPath: Boolean);
var
I: Integer;
begin
if (fOpenElementTokens.Count = 0) then
begin
//there is no open element
if fReaderSettings.fStrictXML then
begin
RaiseException(TXMLParseErrorInvalidStructure,
OXmlLng_TooManyElementsClosed);
Exit;
end;
end else
begin
if aCheckPath and
(fReaderToken.TokenName <> '') and
(fOpenElementTokens.GetToken(fOpenElementTokens.Count-1).TokenName <> fReaderToken.TokenName)
then begin
//element names do not match
if fReaderSettings.fStrictXML then
begin
RaiseExceptionFmt(TXMLParseErrorInvalidStructure,
OXmlLng_WrongElementClosed, [fReaderToken.TokenName,
fOpenElementTokens.GetToken(fOpenElementTokens.Count-1).TokenName]);
Exit;
end else
begin
//trying to close parent element
for I := fOpenElementTokens.Count-2 downto 0 do
if (fOpenElementTokens.GetToken(I).TokenName = fReaderToken.TokenName) then
begin
//parent element with the same name found, we have to close more elements in the future!!!
fElementsToClose := (fOpenElementTokens.Count - I - 1);
Break;
end;
//delete the last one from fNodePath
// + rename the element if names differ
if fReaderToken.TokenName <> '' then
fReaderToken.TokenName := fOpenElementTokens.GetToken(fOpenElementTokens.Count-1).TokenName;
fOpenElementTokens.DeleteLast;
end;
end else
begin
//everything is fine -> delete last from fNodePath
fOpenElementTokens.DeleteLast;
end;
end;
end;
procedure TXMLReader.ResetDocumentElement;
begin
fDocumentElementFound := False;
end;
function TXMLReader.GetNodePath(
const aIndex: Integer): OWideString;
begin
Result := fOpenElementTokens.GetToken(aIndex).TokenName;
end;
function TXMLReader.GetNodePathCount: Integer;
begin
Result := fOpenElementTokens.Count;
end;
procedure TXMLReader.NodePathAssignTo(
const aNodePath: TOWideStringList);
var
I: Integer;
begin
aNodePath.Clear;
for I := 0 to fOpenElementTokens.Count-1 do
aNodePath.Add(fOpenElementTokens.GetToken(I).TokenName);
end;
function TXMLReader.NodePathAsString: OWideString;
var
I: Integer;
begin
if fOpenElementTokens.Count = 0 then
begin
Result := '';
Exit;
end;
Result := fOpenElementTokens.GetToken(0).TokenName;
for I := 1 to fOpenElementTokens.Count-1 do
Result := Result + '/' + fOpenElementTokens.GetToken(I).TokenName;
end;
function TXMLReader.NodePathMatch(
const aNodePath: array of OWideString): Boolean;
var
I: Integer;
begin
Result := Length(aNodePath) = fOpenElementTokens.Count;
if not Result then
Exit;
for I := 0 to Length(aNodePath)-1 do
if aNodePath[I] <> fOpenElementTokens.GetToken(I).TokenName then
begin
Result := False;
Exit;
end;
Result := True;
end;
function TXMLReader.NodePathMatch(
const aNodePath: TOWideStringList): Boolean;
var
I: Integer;
begin
Result := aNodePath.Count = fOpenElementTokens.Count;
if not Result then
Exit;
for I := 0 to aNodePath.Count-1 do
if aNodePath[I] <> fOpenElementTokens.GetToken(I).TokenName then
begin
Result := False;
Exit;
end;
Result := True;
end;
function TXMLReader.NodePathMatch(
const aNodePath: OWideString): Boolean;
var
xNodePath: TOWideStringList;
begin
xNodePath := TOWideStringList.Create;
try
OExplode(aNodePath, '/', xNodePath);
Result := NodePathMatch(xNodePath);
finally
xNodePath.Free;
end;
end;
function TXMLReader.RefIsChildOfNodePath(
const aRefNodePath: array of OWideString): Boolean;
var
I: Integer;
begin
Result := Length(aRefNodePath) = fOpenElementTokens.Count-1;
if not Result then
Exit;
for I := 0 to Length(aRefNodePath)-1 do
if aRefNodePath[I] <> fOpenElementTokens.GetToken(I).TokenName then
begin
Result := False;
Exit;
end;
Result := True;
end;
function TXMLReader.RefIsChildOfNodePath(
const aRefNodePath: TOWideStringList): Boolean;
var
I: Integer;
begin
Result := aRefNodePath.Count = fOpenElementTokens.Count-1;
if not Result then
Exit;
for I := 0 to aRefNodePath.Count-1 do
if aRefNodePath[I] <> fOpenElementTokens.GetToken(I).TokenName then
begin
Result := False;
Exit;
end;
Result := True;
end;
function TXMLReader.RefIsParentOfNodePath(
const aRefNodePath: array of OWideString): Boolean;
var
I: Integer;
begin
Result := Length(aRefNodePath) = fOpenElementTokens.Count+1;
if not Result then
Exit;
for I := 0 to fOpenElementTokens.Count-1 do
if aRefNodePath[I] <> fOpenElementTokens.GetToken(I).TokenName then
begin
Result := False;
Exit;
end;
Result := True;
end;
function TXMLReader.RefIsParentOfNodePath(
const aRefNodePath: TOWideStringList): Boolean;
var
I: Integer;
begin
Result := aRefNodePath.Count = fOpenElementTokens.Count+1;
if not Result then
Exit;
for I := 0 to fOpenElementTokens.Count-1 do
if aRefNodePath[I] <> fOpenElementTokens.GetToken(I).TokenName then
begin
Result := False;
Exit;
end;
Result := True;
end;
{ TXMLWriter }
procedure TXMLWriter.CData(const aText: OWideString; const aIndent: Boolean);
procedure _BeginCDATA;
begin
RawChar('<');
RawChar('!');
RawChar('[');
RawChar('C');
RawChar('D');
RawChar('A');
RawChar('T');
RawChar('A');
RawChar('[');
end;
procedure _EndCDATA;
begin
RawChar(']');
RawChar(']');
RawChar('>');
end;
procedure _WriteCDataSafe(const _Text: OUnicodeString);
var
I: Integer;
begin
for I := 1 to Length(_Text) do
if GetCharTable.IsSupported(_Text[I]) then
RawUnicodeChar(_Text[I])
else
begin
_EndCDATA;
RawText(GetCharTable.Entity(_Text[I]));
_BeginCDATA;
end;
end;
begin
if fWriterSettings.fStrictXML and not OXmlValidCData(aText) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidCData, [aText]);
if aIndent then
Indent;
_BeginCDATA;
if not fUseSafeEntities then
RawText(aText)//MUST BE RAWTEXT - must contain unescaped characters
else begin
_WriteCDataSafe({$IFDEF O_UTF8}OWideToUnicode{$ENDIF}(aText));
end;
_EndCDATA;
end;
procedure TXMLWriter.Comment(const aText: OWideString);
begin
if fWriterSettings.fStrictXML and not OXmlValidComment(aText) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidComment, [aText]);
Indent;
RawChar('<');
RawChar('!');
RawChar('-');
RawChar('-');
RawText(aText);//MUST BE RAWTEXT - must contain unescaped characters
RawChar('-');
RawChar('-');
RawChar('>');
end;
constructor TXMLWriter.Create(const aStream: TStream);
begin
inherited Create;
DoCreate;
InitStream(aStream);
end;
constructor TXMLWriter.Create;
begin
inherited Create;
DoCreate;
end;
procedure TXMLWriter.DecIndentLevel;
begin
Dec(fIndentLevel);
end;
destructor TXMLWriter.Destroy;
begin
fWriter.Free;
fWriterSettings.Free;
fCharTable.Free;
inherited;
end;
procedure TXMLWriter.DoInit;
begin
fWritten := False;
fIndentLevel := fDefaultIndentLevel;
end;
procedure TXMLWriter.DoText(const aText: OWideString;
const aInAttributeValue: Boolean);
begin
if fUseSafeEntities then
_DoTextSafeEntity({$IFDEF O_UTF8}OWideToUnicode{$ENDIF}(aText), aInAttributeValue)
else
_DoText(aText, aInAttributeValue);
end;
procedure TXMLWriter._DoText(const aText: OWideString;
const aInAttributeValue: Boolean);
var
xC: OWideChar;
I, xLength: Integer;
begin
//"almost" same code as DoTextSafeEntity
xLength := Length(aText);
if xLength = 0 then
Exit;
for I := 1 to xLength do
begin
xC := aText[I];
case OXmlCharKind(xC) of
ckTab:
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XML_ENTITY_TAB)
else
RawChar(xC);
ckAmpersand: RawText(XML_ENTITY_AMP);
ckLowerThan: RawText(XML_ENTITY_LT);
ckGreaterThan:
if fWriterSettings.UseGreaterThanEntity then
RawText(XML_ENTITY_GT)
else
RawChar(xC);
ckDoubleQuote:
if aInAttributeValue then
RawText(XML_ENTITY_QUOT)
else
RawChar(xC);
ckSingleQuote:
RawChar(xC);
ckNewLine10:
if (fWriterSettings.fLineBreak = lbDoNotProcess) then//no line break handling
begin
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XML_ENTITY_LF)
else
RawChar(xC);
end else
if ((I = 1) or (aText[I-1] <> #13)) then//previous character is not #13 (i.e. this is a simple #10 not #13#10) -> write fLineBreak
begin
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XMLLineBreakEntity(fWriterSettings.fLineBreak))
else
RawText(XMLLineBreak[fWriterSettings.fLineBreak]);
end;
ckNewLine13:
if fWriterSettings.fLineBreak = lbDoNotProcess then
RawText(XML_ENTITY_CR)
else begin
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XMLLineBreakEntity(fWriterSettings.fLineBreak))
else
RawText(XmlLineBreak[fWriterSettings.fLineBreak]);
end;
ckCharacter, ckSquareBracketOpen, ckSquareBracketClose: RawChar(xC);
else
//invalid
if not fWriterSettings.fStrictXML then
RawChar(xC)
else
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidText, [aText]);
end;
end;
end;
procedure TXMLWriter._DoTextSafeEntity(const aText: OUnicodeString;
const aInAttributeValue: Boolean);
var
xC: OUnicodeChar;
I, xLength: Integer;
begin
//"almost" same code as DoText
xLength := Length(aText);
if xLength = 0 then
Exit;
for I := 1 to xLength do
begin
xC := aText[I];
case OXmlCharKind(xC) of
ckTab:
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XML_ENTITY_TAB)
else
RawChar(OWideChar(Ord(xC) and $FF));
ckAmpersand: RawText(XML_ENTITY_AMP);
ckLowerThan: RawText(XML_ENTITY_LT);
ckGreaterThan:
if fWriterSettings.UseGreaterThanEntity then
RawText(XML_ENTITY_GT)
else
RawChar(OWideChar(Ord(xC) and $FF));
ckDoubleQuote:
if aInAttributeValue then
RawText(XML_ENTITY_QUOT)
else
RawChar(OWideChar(Ord(xC) and $FF));
ckSingleQuote:
RawChar(OWideChar(Ord(xC) and $FF));
ckNewLine10:
if (fWriterSettings.fLineBreak = lbDoNotProcess) then//no line break handling
begin
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XML_ENTITY_LF)
else
RawChar(OWideChar(Ord(xC) and $FF));
end else
if ((I = 1) or (aText[I-1] <> #13)) then//previous character is not #13 (i.e. this is a simple #10 not #13#10) -> write fLineBreak
begin
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XMLLineBreakEntity(fWriterSettings.fLineBreak))
else
RawText(XmlLineBreak[fWriterSettings.fLineBreak]);
end;
ckNewLine13:
if fWriterSettings.fLineBreak = lbDoNotProcess then
RawText(XML_ENTITY_CR)
else begin
if aInAttributeValue and fWriterSettings.fUseTabCRLFEntitiesInAttributes then
RawText(XMLLineBreakEntity(fWriterSettings.fLineBreak))
else
RawText(XmlLineBreak[fWriterSettings.fLineBreak]);
end;
ckCharacter, ckSquareBracketOpen, ckSquareBracketClose: RawUnicodeCharSafeEntity(xC);
else
//invalid
if not fWriterSettings.fStrictXML then
RawChar(xC)
else
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidText, [aText]);
end;
end;
end;
procedure TXMLWriter.EntityReference(const aEntityName: OWideString);
begin
if fWriterSettings.fStrictXML and not OXmlValidEntityReference(aEntityName) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidEntity, [aEntityName]);
RawChar('&');
RawText(aEntityName);//must be rawtext, because validated!
RawChar(';');
end;
procedure TXMLWriter.DoCreate;
begin
fCharTable := nil;
fWriter := TOTextWriter.Create;
fWriterSettings := TXMLWriterSettings.Create(Self);
Encoding := TEncoding.UTF8;
WriteBOM := True;
end;
procedure TXMLWriter.DocType(const aDocTypeRawText: OWideString);
begin
Indent;
RawText('<!DOCTYPE ');
RawText(aDocTypeRawText);//MUST BE RAW ESCAPED TEXT - the programmer has to be sure that aDocTypeRawText is valid
RawChar('>');
end;
procedure TXMLWriter.CloseElement(const aElementName: OWideString; const aIndent: Boolean);
begin
DecIndentLevel;
if aIndent then
Indent;
RawChar('<');
RawChar('/');
RawText(aElementName);//must be rawtext, because validated (in OpenElement)!
RawChar('>');
end;
function TXMLWriter.GetCharTable: TOCharTable;
begin
if not Assigned(fCharTable) then
fCharTable := TOCharTable.Create(Encoding);
Result := fCharTable;
end;
function TXMLWriter.GetEncoding: TEncoding;
begin
Result := fWriter.Encoding;
end;
function TXMLWriter.GetOwnsEncoding: Boolean;
begin
Result := fWriter.OwnsEncoding;
end;
function TXMLWriter.GetWriteBOM: Boolean;
begin
Result := fWriter.WriteBOM;
end;
procedure TXMLWriter.IncIndentLevel;
begin
Inc(fIndentLevel);
end;
procedure TXMLWriter.Indent;
var I: Integer;
begin
if (fWriterSettings.fIndentType in [itFlat, itIndent]) and
fWritten//do not indent at the very beginning of the document
then
RawText(XmlLineBreak[fWriterSettings.fLineBreak]);
if fWriterSettings.fIndentType = itIndent then
for I := 1 to fIndentLevel do
RawText(fWriterSettings.fIndentString);
end;
procedure TXMLWriter.InitFile(const aFileName: String);
begin
fWriter.InitFile(aFileName);
DoInit;
end;
procedure TXMLWriter.InitStream(const aStream: TStream);
begin
fWriter.InitStream(aStream);
DoInit;
end;
procedure TXMLWriter.ProcessingInstruction(const aTarget,
aContent: OWideString);
begin
if fWriterSettings.fStrictXML and not OXmlValidName(aTarget) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidPITarget, [aTarget]);
if fWriterSettings.fStrictXML and not OXmlValidPIContent(aContent) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidPIContent, [aContent]);
Indent;
RawChar('<');
RawChar('?');
RawText(aTarget);
if (aTarget <> '') and (aContent <> '') then
RawChar(' ');
RawText(aContent);//MUST BE RAWTEXT - must contain unescaped characters
RawChar('?');
RawChar('>');
end;
procedure TXMLWriter.RawChar(const aChar: OWideChar);
begin
fWritten := True;
fWriter.WriteChar(aChar);
end;
procedure TXMLWriter.RawUnicodeCharSafeEntity(const aChar: OUnicodeChar);
begin
fWritten := True;
if GetCharTable.IsSupported(aChar) then
RawUnicodeChar(aChar)
else
RawText(GetCharTable.Entity(aChar));
end;
procedure TXMLWriter.RawText(const aText: OWideString);
begin
fWritten := True;
fWriter.WriteString(aText);
end;
procedure TXMLWriter.RawUnicodeChar(const aChar: OUnicodeChar);
begin
fWritten := True;
{$IFDEF O_UTF8}
fWriter.WriteString(OUnicodeToWide(aChar));
{$ELSE}
fWriter.WriteChar(aChar);
{$ENDIF}
end;
procedure TXMLWriter.ReleaseDocument;
begin
fWriter.ReleaseDocument;
end;
procedure TXMLWriter.Attribute(const aAttrName, aAttrValue: OWideString);
begin
if fWriterSettings.fStrictXML and not OXmlValidName(aAttrName) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidAttributeName, [aAttrName]);
RawChar(' ');
RawText(aAttrName);//can be rawtext, because validated!
RawChar('=');
RawChar('"');
DoText(aAttrValue, True);
RawChar('"');
end;
procedure TXMLWriter.SetEncoding(const aEncoding: TEncoding);
begin
fWriter.Encoding := aEncoding;
fCharTable.Free;
fCharTable := nil;
fUseSafeEntities := aEncoding.IsSingleByte;
end;
procedure TXMLWriter.SetDefaultIndentLevel(const aDefaultIndentLevel: Integer);
begin
if fWritten then
raise EXmlWriterException.Create(OXmlLng_CannotSetIndentLevelAfterWrite);
fDefaultIndentLevel := aDefaultIndentLevel;
fIndentLevel := fDefaultIndentLevel;
end;
procedure TXMLWriter.SetOwnsEncoding(const aOwnsEncoding: Boolean);
begin
fWriter.OwnsEncoding := aOwnsEncoding;
end;
procedure TXMLWriter.SetWriteBOM(const aWriteBOM: Boolean);
begin
fWriter.WriteBOM := aWriteBOM;
end;
procedure TXMLWriter.Text(const aText: OWideString; const aIndent: Boolean);
begin
if aIndent then
Indent;
DoText(aText, False);
end;
procedure TXMLWriter.OpenXMLDeclaration;
begin
Indent;
RawText('<?xml');
end;
procedure TXMLWriter.FinishOpenXMLDeclaration;
begin
RawText('?>');
end;
procedure TXMLWriter.OpenElement(const aElementName: OWideString; const aMode: TXMLWriterElementMode);
begin
if fWriterSettings.fStrictXML and not OXmlValidName(aElementName) then
raise EXmlWriterInvalidString.CreateFmt(OXmlLng_InvalidElementName, [aElementName]);
Indent;
RawChar('<');
RawText(aElementName);
case aMode of
stOpenOnly: IncIndentLevel;
stFinish:
begin
RawChar('>');
IncIndentLevel;
end;
stFinishClose:
begin
RawChar('/');
RawChar('>');
end;
end;
end;
procedure TXMLWriter.OpenElementR(const aElementName: OWideString;
var outElement: TXMLWriterElement; const aMode: TXMLWriterElementMode);
begin
OpenElement(aElementName, aMode);
if aMode = stFinishClose then
begin
outElement.fOwner := nil;//do not use after close
end else
begin
outElement.fOwner := Self;
outElement.fElementName := aElementName;
outElement.fOpenElementFinished := (aMode = stFinish);
outElement.fChildrenWritten := False;
end;
end;
procedure TXMLWriter.FinishOpenElement(const aElementName: OWideString);
begin
RawChar('>');
end;
procedure TXMLWriter.FinishOpenElementClose(const aElementName: OWideString);
begin
DecIndentLevel;
RawChar('/');
RawChar('>');
end;
function TXMLWriter.OpenElementR(const aElementName: OWideString;
const aMode: TXMLWriterElementMode): TXMLWriterElement;
begin
OpenElementR(aElementName, {%H-}Result, aMode);
end;
procedure TXMLWriter.XMLDeclaration(const aEncoding: Boolean;
const aVersion, aStandAlone: OWideString);
begin
OpenXMLDeclaration;
if aVersion <> '' then
Attribute('version', aVersion);
if aEncoding then
Attribute('encoding', fWriter.Encoding.EncodingAlias);
if aStandAlone <> '' then
Attribute('standalone', aStandAlone);
FinishOpenXMLDeclaration;
end;
{ TXMLWriterElement }
procedure TXMLWriterElement.Attribute(const aAttrName, aAttrValue: OWideString);
begin
if fOpenElementFinished then
raise EXmlDOMException.CreateFmt(OXmlLng_CannotWriteAttributesWhenFinished, [aAttrName, aAttrValue, fElementName])
else
fOwner.Attribute(aAttrName, aAttrValue);
end;
procedure TXMLWriterElement.CData(const aText: OWideString);
begin
FinishOpenElement;
fChildrenWritten := True;
fOwner.CData(aText);
end;
procedure TXMLWriterElement.Comment(const aText: OWideString);
begin
FinishOpenElement;
fChildrenWritten := True;
fOwner.Comment(aText);
end;
procedure TXMLWriterElement.CloseElement(const aIndent: Boolean);
begin
if fChildrenWritten then
fOwner.CloseElement(fElementName, aIndent)
else
fOwner.FinishOpenElementClose;
//DO NOT USE THIS RECORD ANY MORE
fOwner := nil;
fElementName := '';
end;
procedure TXMLWriterElement.ProcessingInstruction(const aTarget,
aContent: OWideString);
begin
FinishOpenElement;
fChildrenWritten := True;
fOwner.ProcessingInstruction(aTarget, aContent);
end;
procedure TXMLWriterElement.OpenElementR(const aElementName: OWideString;
var outElement: TXMLWriterElement; const aMode: TXMLWriterElementMode);
begin
FinishOpenElement;
fChildrenWritten := True;
fOwner.OpenElementR(aElementName, outElement, aMode);
end;
procedure TXMLWriterElement.FinishOpenElement;
begin
if not fOpenElementFinished then
begin
fOwner.FinishOpenElement;
fOpenElementFinished := True;
end;
end;
function TXMLWriterElement.OpenElementR(const aElementName: OWideString;
const aMode: TXMLWriterElementMode): TXMLWriterElement;
begin
OpenElementR(aElementName, {%H-}Result, aMode);
end;
procedure TXMLWriterElement.Text(const aText: OWideString; const aIndent: Boolean);
begin
FinishOpenElement;
fChildrenWritten := True;
fOwner.Text(aText, aIndent);
end;
{ TCustomXMLWriterSettings }
procedure TCustomXMLWriterSettings.AssignTo(Dest: TPersistent);
var
xDest: TCustomXMLWriterSettings;
begin
if Dest is TCustomXMLWriterSettings then
begin
xDest := TCustomXMLWriterSettings(Dest);
xDest.IndentString := Self.IndentString;
xDest.IndentType := Self.IndentType;
xDest.LineBreak := Self.LineBreak;
xDest.UseTabCRLFEntitiesInAttributes := Self.UseTabCRLFEntitiesInAttributes;
xDest.UseGreaterThanEntity := Self.UseGreaterThanEntity;
xDest.StrictXML := Self.StrictXML;
xDest.WriteBOM := Self.WriteBOM;
end else
inherited;
end;
constructor TCustomXMLWriterSettings.Create;
begin
inherited Create;
fLineBreak := lbLF;
fStrictXML := True;
fUseGreaterThanEntity := True;
fUseTabCRLFEntitiesInAttributes := True;
fIndentType := itNone;
fIndentString := #32#32;
end;
{ TXMLReaderSettings }
procedure TXMLReaderSettings.AssignTo(Dest: TPersistent);
var
xDest: TXMLReaderSettings;
begin
if Dest is TXMLReaderSettings then
begin
xDest := TXMLReaderSettings(Dest);
xDest.BreakReading := Self.BreakReading;
xDest.LineBreak := Self.LineBreak;
xDest.StrictXML := Self.StrictXML;
xDest.RecognizeXMLDeclaration := Self.RecognizeXMLDeclaration;
xDest.ErrorHandling := Self.ErrorHandling;
xDest.ExpandEntities := Self.ExpandEntities;
xDest.EntityList.Assign(Self.EntityList);
end else
inherited;
end;
constructor TXMLReaderSettings.Create;
begin
inherited Create;
fEntityList := TXMLReaderEntityList.Create;
fBreakReading := brAfterDocumentElement;
fLineBreak := XMLDefaultLineBreak;
fStrictXML := True;
fRecognizeXMLDeclaration := True;
fExpandEntities := True;
fErrorHandling := ehRaiseAndEat;
end;
destructor TXMLReaderSettings.Destroy;
begin
fEntityList.Free;
inherited Destroy;
end;
procedure TXMLReaderSettings.LoadDTD(const aDTDReader: TOTextReader;
const aIsInnerDTD: Boolean);
var
I: Integer;
xC: OWideChar;
xPreviousC: OWideString;//holds '<!ENTITY'
xInQuotes: OWideChar;
xDTDBuffer, xTempBuffer: TOTextBuffer;
const
cEntityStr: OWideString = '<!ENTITY';
begin
fEntityList.Clear;
xDTDBuffer := TOTextBuffer.Create;
xTempBuffer := TOTextBuffer.Create;
try
SetLength(xPreviousC, Length(cEntityStr));
for I := 1 to Length(xPreviousC) do
xPreviousC[I] := #0;
aDTDReader.ReadNextChar({%H-}xC);
xInQuotes := #0;//not in quotes
while
not (aIsInnerDTD and (xInQuotes = #0) and (xC = ']')) and//hold on ']' if inner DTD
not Assigned(aDTDReader.ParseError) and
not aDTDReader.EOF
do begin
if Length(xPreviousC) > 1 then
Move(xPreviousC[2], xPreviousC[1], (Length(xPreviousC)-1)*SizeOf(OWideChar));
xPreviousC[Length(xPreviousC)] := OWideChar(UpCase(Char(xC)));//use uppercase
if xPreviousC = cEntityStr then
begin
aDTDReader.ReadNextChar(xC);
if not OXmlIsWhiteSpaceChar(xC) then
begin
Continue;//go to next char
end;
LoadDTDEntity(aDTDReader, xDTDBuffer, xTempBuffer);
end else
begin
case OXmlCharKind(xC) of
ckInvalid:
if fStrictXML then
aDTDReader.RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInText, ['0x'+IntToHex(Ord(xC), 4)]);
ckDoubleQuote, ckSingleQuote:
if xInQuotes = #0 then
xInQuotes := xC
else if (xInQuotes = xC) then
xInQuotes := #0;
end;
end;
aDTDReader.ReadNextChar(xC);
end;//while
finally
xDTDBuffer.Free;
xTempBuffer.Free;
end;
end;
procedure TXMLReaderSettings.LoadDTDEntity(const aDTDReader: TOTextReader;
const aBuffer1, aBuffer2: TOTextBuffer);
var
xC, xQuotationMark: OWideChar;
xEntityName, xEntityValue: OWideString;
xIsParameterEntity: Boolean;//used only in DTD -> IGNORE!!!
begin
if not aDTDReader.ReadNextChar({%H-}xC) then
Exit;
//go over spaces
while OXmlIsWhiteSpace(xC) and not aDTDReader.EOF do
aDTDReader.ReadNextChar(xC);
//read name
xIsParameterEntity := (xC = '%');
if xIsParameterEntity then
begin
//go over spaces
aDTDReader.ReadNextChar(xC);
while OXmlIsWhiteSpace(xC) and not aDTDReader.EOF do
aDTDReader.ReadNextChar(xC);
end;
if not OXmlIsNameStartChar(xC) then
begin
aDTDReader.RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInElement, [xC]);
Exit;
end;
aBuffer1.Clear(False);
while OXmlIsNameChar(xC) and not aDTDReader.EOF do
begin
aBuffer1.WriteChar(xC);
aDTDReader.ReadNextChar(xC);
end;
aBuffer1.GetBuffer({%H-}xEntityName);
aBuffer1.Clear(False);
//go over spaces
while OXmlIsWhiteSpace(xC) and not aDTDReader.EOF do
aDTDReader.ReadNextChar(xC);
//read value
if (xC <> '"') and (xC <> '''') then
begin
aDTDReader.RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_DTDEntityValueMustBeEnclosed, [xEntityName]);
Exit;
end;
xQuotationMark := xC;
aDTDReader.ReadNextChar(xC);
while not (xC = xQuotationMark) and not Assigned(aDTDReader.ParseError) and not aDTDReader.EOF do
begin
case OXmlCharKind(xC) of
ckNewLine10, ckNewLine13: ProcessNewLineChar(xC, Self, aDTDReader, aBuffer1);
ckAmpersand: LoadDTDEntityReference(aDTDReader, aBuffer1, aBuffer2);
ckTab, ckCharacter, ckSingleQuote, ckDoubleQuote, ckGreaterThan, ckLowerThan,
ckSquareBracketOpen, ckSquareBracketClose:
aBuffer1.WriteChar(xC);
else
if not fStrictXML then
aBuffer1.WriteChar(xC)
else
aDTDReader.RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidCharacterInAttribute, ['0x'+IntToHex(Ord(xC), 4)]);
end;
aDTDReader.ReadNextChar(xC);
end;
aBuffer1.GetBuffer({%H-}xEntityValue);
//add entity to entity list
if not xIsParameterEntity then
begin
EntityList.AddOrReplace(xEntityName, xEntityValue);
end;
//find end of tag
while (xC <> '>') and not aDTDReader.EOF do
aDTDReader.ReadNextChar(xC);
end;
procedure TXMLReaderSettings.LoadDTDEntityReference(
const aDTDReader: TOTextReader; const aWriteToBuffer, aTempBuffer: TOTextBuffer);
var
xReadString, xEntityName, xEntityValue: OWideString;
begin
if ProcessEntity(Self, aDTDReader, aTempBuffer, {%H-}xReadString, {%H-}xEntityName, {%H-}xEntityValue) then
aWriteToBuffer.WriteString(xEntityValue)
else
begin
if fStrictXML then
begin
aDTDReader.RaiseExceptionFmt(TXMLParseErrorInvalidCharacter,
OXmlLng_InvalidEntity, [xReadString]);
Exit;
end else
begin
aWriteToBuffer.WriteString(xReadString);
end;
end;
end;
function TXMLReaderSettings.LoadDTDFromFile(const aFileName: String;
const aDefaultEncoding: TEncoding): Boolean;
var
xFS: TFileStream;
begin
xFS := TFileStream.Create(aFileName, fmOpenRead or fmShareDenyNone);
try
Result := LoadDTDFromStream(xFS, aDefaultEncoding);
finally
xFS.Free;
end;
end;
function TXMLReaderSettings.LoadDTDFromStream(const aStream: TStream;
const aDefaultEncoding: TEncoding): Boolean;
var
xReader: TOTextReader;
begin
xReader := TOTextReader.Create;
try
xReader.InitStream(aStream, aDefaultEncoding);
xReader.ErrorHandling := Self.ErrorHandling;
LoadDTD(xReader, False);
finally
Result := not Assigned(xReader.ParseError);
xReader.Free;
end;
end;
function TXMLReaderSettings.LoadDTDFromString(const aString: OWideString): Boolean;
var
xStream: TVirtualMemoryStream;
begin
xStream := TVirtualMemoryStream.Create;
try
xStream.SetString(aString);
Result := LoadDTDFromStream(xStream, TEncoding.OWideStringEncoding);
finally
xStream.Free;
end;
end;
{$IFDEF O_RAWBYTESTRING}
function TXMLReaderSettings.LoadDTDFromString_UTF8(
const aString: ORawByteString): Boolean;
var
xStream: TVirtualMemoryStream;
begin
xStream := TVirtualMemoryStream.Create;
try
xStream.SetString_UTF8(aString);
Result := LoadDTDFromStream(xStream, TEncoding.UTF8);
finally
xStream.Free;
end;
end;
{$ENDIF}
function TXMLReaderSettings.LoadFromBuffer(const aBuffer;
const aBufferLength: Integer; const aDefaultEncoding: TEncoding): Boolean;
var
xStream: TVirtualMemoryStream;
begin
xStream := TVirtualMemoryStream.Create;
try
xStream.SetPointer(@aBuffer, aBufferLength);
Result := LoadDTDFromStream(xStream, aDefaultEncoding);
finally
xStream.Free;
end;
end;
function TXMLReaderSettings.LoadFromBuffer(const aBuffer: TBytes;
const aDefaultEncoding: TEncoding): Boolean;
var
xStream: TVirtualMemoryStream;
begin
xStream := TVirtualMemoryStream.Create;
try
xStream.SetBuffer(aBuffer);
Result := LoadDTDFromStream(xStream, aDefaultEncoding);
finally
xStream.Free;
end;
end;
{ TXMLReaderTokenList }
procedure TXMLReaderTokenList.AddLast;
begin
Inc(fCount);
end;
procedure TXMLReaderTokenList.Clear;
begin
fCount := 0;
end;
constructor TXMLReaderTokenList.Create;
begin
inherited Create;
{$IFDEF O_GENERICS}
fReaderTokens := TList<PXMLReaderToken>.Create;
{$ELSE}
fReaderTokens := TList.Create;
{$ENDIF}
end;
function TXMLReaderTokenList.CreateNew: PXMLReaderToken;
begin
if fCount = fReaderTokens.Count then
begin
New(Result);
fReaderTokens.Add(Result);
end else
Result := GetToken(fCount);
end;
procedure TXMLReaderTokenList.DeleteLast;
begin
Dec(fCount);
if fCount < 0 then
fCount := 0;
end;
destructor TXMLReaderTokenList.Destroy;
var
I: Integer;
begin
for I := 0 to fReaderTokens.Count-1 do
Dispose(PXMLReaderToken(fReaderTokens[I]));
fReaderTokens.Free;
inherited;
end;
function TXMLReaderTokenList.GetToken(const aIndex: Integer): PXMLReaderToken;
begin
Result := PXMLReaderToken(fReaderTokens[aIndex]);
end;
function TXMLReaderTokenList.IndexOf(const aToken: PXMLReaderToken): Integer;
var
I: Integer;
begin
for I := 0 to Count-1 do
if fReaderTokens[I] = aToken then
begin
Result := I;
Exit;
end;
Result := -1;
end;
{ TXMLParseErrorInvalidCharacter }
function TXMLParseErrorInvalidCharacter.GetExceptionClass: EOTextReaderExceptionClass;
begin
Result := EXMLReaderInvalidCharacter;
end;
{ TXMLParseErrorInvalidStructure }
function TXMLParseErrorInvalidStructure.GetExceptionClass: EOTextReaderExceptionClass;
begin
Result := EXmlReaderInvalidStructure;
end;
{ EXmlReaderInvalidStructure }
class function EXmlReaderInvalidStructure.GetErrorCode: Integer;
begin
Result := HIERARCHY_REQUEST_ERR;
end;
{ TXMLReaderEntityList }
procedure TXMLReaderEntityList.AddOrReplace(const aEntityName,
aEntityValue: OWideString);
begin
fList.Add(aEntityName, aEntityValue);
end;
procedure TXMLReaderEntityList.AssignTo(Dest: TPersistent);
var
xDest: TXMLReaderEntityList;
begin
if Dest is TXMLReaderEntityList then
begin
xDest := TXMLReaderEntityList(Dest);
xDest.fList.Assign(Self.fList);
end else
inherited;
end;
procedure TXMLReaderEntityList.Clear;
begin
fList.Clear;
fList.Add('quot', '"');
fList.Add('amp', '&');
fList.Add('apos', '''');
fList.Add('lt', '<');
fList.Add('gt', '>');
end;
constructor TXMLReaderEntityList.Create;
begin
inherited;
fList := TOHashedStringDictionary.Create;
Clear;
end;
destructor TXMLReaderEntityList.Destroy;
begin
fList.Free;
inherited;
end;
function TXMLReaderEntityList.Find(const aEntityName: OWideString;
var outEntityValue: OWideString): Boolean;
begin
Result := fList.TryGetValue(aEntityName, outEntityValue);
end;
function TXMLReaderEntityList.GetCount: Integer;
begin
Result := fList.Count;
end;
function TXMLReaderEntityList.GetItem(
const aIndex: OHashedStringsIndex): TOHashedStringDictionaryPair;
begin
Result := fList.Pairs[aIndex];
end;
function TXMLReaderEntityList.GetName(
const aIndex: OHashedStringsIndex): OWideString;
begin
Result := fList.Keys[aIndex];
end;
function TXMLReaderEntityList.GetValue(
const aIndex: OHashedStringsIndex): OWideString;
begin
Result := fList.Values[aIndex];
end;
function TXMLReaderEntityList.IndexOf(const aEntityName: OWideString): Integer;
begin
Result := fList.IndexOf(aEntityName);
end;
procedure TXMLReaderEntityList.SetValue(const aIndex: OHashedStringsIndex;
const aValue: OWideString);
begin
fList.Values[aIndex] := aValue;
end;
{ EXMLReaderInvalidCharacter }
class function EXMLReaderInvalidCharacter.GetErrorCode: Integer;
begin
Result := INVALID_CHARACTER_ERR;
end;
{ TXMLWriterDeclaration }
constructor TXMLWriterDeclaration.Create;
begin
inherited Create;
Enabled := False;
end;
procedure TXMLWriterDeclaration.Write(const aWriter: TXMLWriter);
begin
aWriter.XMLDeclaration(Encoding, Version, StandAlone);
end;
procedure TXMLWriterDeclaration.WriteIfEnabled(const aWriter: TXMLWriter);
begin
if Enabled then
Write(aWriter);
end;
{ TXMLWriterSettings }
constructor TXMLWriterSettings.Create(aOwner: TXMLWriter);
begin
inherited Create;
fOwner := aOwner;
end;
function TXMLWriterSettings.GetEncoding: TEncoding;
begin
Result := fOwner.Encoding;
end;
function TXMLWriterSettings.GetOwnsEncoding: Boolean;
begin
Result := fOwner.OwnsEncoding;
end;
function TXMLWriterSettings.GetWriteBOM: Boolean;
begin
Result := fOwner.WriteBOM;
end;
procedure TXMLWriterSettings.SetEncoding(const aEncoding: TEncoding);
begin
fOwner.Encoding := aEncoding;
end;
procedure TXMLWriterSettings.SetOwnsEncoding(const aOwnsEncoding: Boolean);
begin
fOwner.OwnsEncoding := aOwnsEncoding;
end;
procedure TXMLWriterSettings.SetWriteBOM(const aWriteBOM: Boolean);
begin
fOwner.WriteBOM := aWriteBOM;
end;
{ TXMLDocumentWriterSettings }
constructor TXMLDocumentWriterSettings.Create;
begin
inherited Create;
fWriteBOM := True;
end;
function TXMLDocumentWriterSettings.GetWriteBOM: Boolean;
begin
Result := fWriteBOM;
end;
procedure TXMLDocumentWriterSettings.SetWriteBOM(const aWriteBOM: Boolean);
begin
fWriteBOM := aWriteBOM;
end;
{ TOCharTable }
constructor TOCharTable.Create(const aEncoding: TEncoding);
var
I: OUnicodeChar;
xBytes: TEncodingBuffer;
xString: OWideString;
begin
inherited Create;
for I := Low(I) to High(I) do
begin
aEncoding.StringToBuffer(I, {%H-}xBytes);
aEncoding.BufferToString(xBytes, {%H-}xString);
fIsSupported[I] := (xString = I);
end;
end;
function TOCharTable.Entity(const aChar: OUnicodeChar): OWideString;
begin
Result := '&#'+IntToStr(Ord(aChar))+';'
end;
function TOCharTable.IsSupported(const aChar: OUnicodeChar): Boolean;
begin
Result := fIsSupported[aChar];
end;
end.
|
PROGRAM HELLOWORLD(output);
VAR st : String;
BEGIN
st := 'hello world'#10'welcome to pascal!';
Writeln(st)
END.
|
unit uPrincipal;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uFrmBasePadrao, Vcl.ComCtrls,
Vcl.ToolWin, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, uFrameBotao,
Vcl.Imaging.pngimage, uListagemBase;
type
TfrmPrincipal = class(TfrmBasePadrao)
boxClientes: TPanel;
imageClientes: TImage;
btnCliente: TSpeedButton;
labelClientes: TLabel;
boxSabores: TPanel;
btnSabores: TSpeedButton;
labelSabores: TLabel;
imageSabores: TImage;
boxProdutos: TPanel;
labelProdutos: TLabel;
imageProdutos: TImage;
btnProdutos: TSpeedButton;
boxPedidos: TPanel;
imagePedidos: TImage;
labelPedidos: TLabel;
btnPedidos: TSpeedButton;
boxEstados: TPanel;
labelEstados: TLabel;
imageEstados: TImage;
btnEstados: TSpeedButton;
boxMunicípio: TPanel;
imageMunicpio: TImage;
labelMunicipio: TLabel;
btnMunicipio: TSpeedButton;
boxBairros: TPanel;
imageBairros: TImage;
labelBairros: TLabel;
btnBairros: TSpeedButton;
boxUsuários: TPanel;
imageUsuarios: TImage;
labelUsuarios: TLabel;
btnUsuarios: TSpeedButton;
boxRelatorios: TPanel;
imageRelatorios: TImage;
labelRelatorios: TLabel;
bntRelatorios: TSpeedButton;
boxSair: TPanel;
imageSair: TImage;
labelSair: TLabel;
btnSair: TSpeedButton;
procedure btnPedidosClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmPrincipal: TfrmPrincipal;
implementation
{$R *.dfm}
procedure TfrmPrincipal.btnPedidosClick(Sender: TObject);
begin
inherited;
frmListagemBase := TfrmListagemBase.Create(Self);
frmListagemBase.Show;
end;
end.
|
unit TestThermostatStates;
interface
uses
Thermostat.Classes,
TestFramework, SysUtils, Generics.Collections;
type
// Test methods for class TThermostatState
TestStates = class(TTestCase)
strict private
FThermostat: TThermostat;
private
function GetSuperState: TThermostatState;
function GetSubState: TThermostatState;
protected
property Thermostat: TThermostat read FThermostat;
property SuperState: TThermostatState read GetSuperState;
property SubState: TThermostatState read GetSubState;
published
public
procedure SetUp; override;
procedure TearDown; override;
published
procedure TestStates;
end;
implementation
uses
Thermostat.DisabledState,
Thermostat.EnabledState,
Thermostat.DisabledWaterState,
Thermostat.DisabledLowWaterState,
Thermostat.HeatingState,
Thermostat.NotHeatingState;
{ TestStates }
function TestStates.GetSubState: TThermostatState;
begin
if Assigned(Thermostat.State) then
Result := Thermostat.State.State
else Result := nil;
end;
function TestStates.GetSuperState: TThermostatState;
begin
Result := Thermostat.State;
end;
procedure TestStates.SetUp;
begin
FThermostat := TThermostat.Create;
end;
procedure TestStates.TearDown;
begin
FThermostat.Free;
FThermostat := nil;
end;
procedure TestStates.TestStates;
begin
Assert(SuperState.ClassType = TDisabledThermostatState);
Assert(SubState.ClassType = TDisabledWaterState);
Thermostat.SampleTemperature := 10;
Thermostat.TargetTemperature := 23;
Thermostat.Run;
Assert(SuperState.ClassType = TDisabledThermostatState);
Assert(SubState.ClassType = TDisabledWaterState);
Thermostat.Active := True;
Thermostat.Run;
Assert(SuperState.ClassType = TEnabledThermostatState);
Assert(SubState.ClassType = THeatingState);
Assert(Thermostat.Heater);
Thermostat.SampleTemperature := 23;
Thermostat.TargetTemperature := 23;
Thermostat.Run;
Assert(SuperState.ClassType = TEnabledThermostatState);
Assert(SubState.ClassType = TNotHeatingState);
Assert(not Thermostat.Heater);
Thermostat.SampleTemperature := 22;
Thermostat.TargetTemperature := 23;
Thermostat.Run;
Assert(SuperState.ClassType = TEnabledThermostatState);
Assert(SubState.ClassType = THeatingState);
Assert(Thermostat.Heater);
Thermostat.Active := False;
Thermostat.Run;
Assert(SuperState.ClassType = TDisabledThermostatState);
Assert(SubState.ClassType = TDisabledWaterState);
Assert(not Thermostat.Heater);
end;
initialization
RegisterTest(TestStates.Suite);
end.
|
unit Way;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, ObjectID, Station;
type
TWay=object(TObjWithID)
private
Station1:TStation;
Station2:TStation;
Time:integer;
Transition:boolean; // true - путь, false - переход.
isVisited:boolean; // При поиске пути.True - посещена.
public
Procedure SetTime(i:integer);
Function GetTime:integer;
Procedure SetFStation(S:TStation);
Function GetFStation:TStation;
Procedure SetSStation(S:TStation);
Function GetSStation:TStation;
Procedure SetTransition(b:boolean);
Function GetTransition:boolean;
Procedure SetVisited(b:boolean);
Function GetVisited:boolean;
Constructor Create;
Destructor Done;
end;
implementation
Procedure TWay.SetTime(i:integer);
begin
Time:=i;
end;
Function TWay.GetTime:integer;
begin
GetTime:=Time;
end;
Constructor TWay.Create;
begin
//Station1:=;
//Station2:=;
Time:=0;
Transition:=false;
IsVisited:=false;
end;
Procedure TWay.SetFStation(S:TStation);
Begin
Station1:=S;
end;
Function TWay.GetFStation:TStation;
Begin
GetFStation:=Station1;
end;
Procedure TWay.SetSStation(S:TStation);
begin
Station2:=S;
end;
Function TWay.GetSStation:TStation;
begin
GetSStation:=Station2;
end;
Procedure TWay.SetTransition(b:boolean);
begin
Transition:=b;
end;
Function TWay.GetTransition:boolean;
begin
GetTransition:=Transition;
end;
Procedure TWay.SetVisited(b:boolean);
begin
isVisited:=b;
end;
Function TWay.GetVisited:boolean;
begin
GetVisited:=isVisited;
end;
Destructor TWay.Done;
begin end;
end.
|
namespace Sugar.Test;
interface
uses
Sugar,
Sugar.Xml,
RemObjects.Elements.EUnit;
type
NodeTest = public class (Test)
private
Doc: XmlDocument;
Data: XmlNode;
public
method Setup; override;
method Name;
method Value;
method LocalName;
method Document;
method Parent;
method NextSibling;
method PreviousSibling;
method FirstChild;
method LastChild;
method Item;
method ChildCount;
method ChildNodes;
end;
implementation
method NodeTest.Setup;
begin
Doc := XmlDocument.FromString(XmlTestData.RssXml);
Assert.IsNotNil(Doc);
Data := Doc.FirstChild;
Assert.IsNotNil(Data);
end;
method NodeTest.Name;
begin
Assert.AreEqual(Data.Name, "rss");
var lValue := Data.FirstChild.FirstChild.NextSibling;
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.Name, "{http://www.w3.org/2005/Atom}link");
lValue := lValue.NextSibling.FirstChild;
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.Name, "#text");
end;
method NodeTest.Value;
begin
var lValue := Data.FirstChild.ChildNodes[2];
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.Value, "http://blogs.remobjects.com");
lValue.Value := "http://test.com";
Assert.AreEqual(lValue.Value, "http://test.com");
lValue := Data.FirstChild.ChildNodes[10];
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.ChildCount, 13);
lValue.Value := "Test"; //replaces all content with text node
Assert.AreEqual(lValue.ChildCount, 1);
Assert.AreEqual(lValue.Value, "Test");
lValue.Value := "";
Assert.AreEqual(lValue.ChildCount, 0);
Assert.AreEqual(lValue.Value, "");
Assert.Throws(->begin lValue.Value := nil; end);
end;
method NodeTest.LocalName;
begin
Assert.AreEqual(Data.LocalName, "rss");
var lValue := Data.FirstChild.FirstChild.NextSibling;
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.LocalName, "link");
lValue := lValue.NextSibling.FirstChild;
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.LocalName, "#text");
end;
method NodeTest.Document;
begin
Assert.IsNotNil(Data.OwnerDocument);
Assert.IsNotNil(Data.FirstChild.OwnerDocument);
Assert.IsTrue(Data.OwnerDocument.Equals(Doc));
end;
method NodeTest.Parent;
begin
Assert.IsNil(Data.Parent);
Assert.IsNotNil(Data.FirstChild.Parent);
Assert.IsTrue(Data.FirstChild.Parent.Equals(Data));
end;
method NodeTest.NextSibling;
begin
Assert.IsNil(Data.NextSibling);
var lValue := Data.FirstChild.FirstChild;
Assert.IsTrue(lValue.Equals(Data.FirstChild.ChildNodes[0]));
Assert.IsNotNil(lValue.NextSibling);
Assert.IsTrue(lValue.NextSibling.Equals(Data.FirstChild.ChildNodes[1]));
end;
method NodeTest.PreviousSibling;
begin
Assert.IsNil(Data.PreviousSibling);
var lValue := Data.FirstChild.LastChild;
Assert.IsTrue(lValue.Equals(Data.FirstChild.ChildNodes[10]));
Assert.IsNotNil(lValue.PreviousSibling);
Assert.IsTrue(lValue.PreviousSibling.Equals(Data.FirstChild.ChildNodes[9]));
end;
method NodeTest.FirstChild;
begin
Assert.IsNotNil(Data.FirstChild);
Assert.AreEqual(Data.FirstChild.LocalName, "channel");
var lValue := Data.FirstChild.FirstChild;
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.LocalName, "title");
end;
method NodeTest.LastChild;
begin
var lValue := Data.FirstChild.LastChild;
Assert.IsNotNil(lValue);
Assert.AreEqual(lValue.LocalName, "item");
end;
method NodeTest.Item;
begin
Assert.IsNotNil(Data.Item[0]);
Assert.AreEqual(Data.Item[0].LocalName, "channel");
Assert.IsNotNil(Data[0]);
Assert.AreEqual(Data[0].LocalName, "channel");
Assert.IsTrue(Data[0].Equals(Data.FirstChild));
Assert.Throws(->Data.Item[-1]);
Assert.Throws(->Data.Item[555]);
end;
method NodeTest.ChildCount;
begin
Assert.AreEqual(Data.ChildCount, 1);
Assert.AreEqual(Data.FirstChild.ChildCount, 11);
end;
method NodeTest.ChildNodes;
begin
var Expected: array of String := ["title", "link", "link", "description", "lastBuildDate", "#comment", "language", "updatePeriod", "updateFrequency", "generator", "item"];
var Actual := Data.FirstChild.ChildNodes;
Assert.AreEqual(length(Actual), 11);
for i: Integer := 0 to length(Actual) - 1 do
Assert.AreEqual(Actual[i].LocalName, Expected[i]);
end;
end. |
{-------------------------------------------------- Progressive Path Tracing ---------------------------------------------------
This unit contains the TMaterial type and also contains helper functions related to spectral conversion, such as converting a
wavelength to an RGB color. It also contains functions to manipulate RGB color, such as adding two colors together. Spectrums
are coded over 400 indices, going from ultraviolet to infrared.
-------------------------------------------------------------------------------------------------------------------------------}
unit MaterialTypes;
interface
uses Windows, SysUtils, Graphics, Math;
type
{ Just a RGB color type. }
TRGBColor = record
R, G, B: Single;
end; PRGBColor = ^TRGBColor;
TMaterial = record
AbsorptionSpectrum: array [0..399] of Double;
RefractionIndices: array [0..399] of Double;
Specularity: Double;
IsLight: Boolean;
end;
{ Adds two colors together. }
function AddColor(const A, B: TRGBColor): TRGBColor;
Var
{ This is the spectrum variable which matches a wavelength with its RGB color equivalent. }
Spectrum: array [0..399] of TRGBColor;
implementation
{ Adds two colors together. }
function AddColor(const A, B: TRGBColor): TRGBColor;
begin
Result.R := A.R + B.R;
Result.G := A.G + B.G;
Result.B := A.B + B.B;
end;
{ Procedure called at the beginning of the program, loads the Spectrum.bmp bitmap into memory in FP format. }
procedure LoadSpectrum;
Var
Bmp: TBitmap;
P: PRGBQUAD;
I: Integer;
begin
Bmp := TBitmap.Create;
Bmp.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'Spectrum.bmp');
P := Bmp.Scanline[0];
for I := 0 to 399 do
with Spectrum[I] do
begin
R := P^.rgbRed / 255 * 1 / Sqrt(2 * PI);
G := P^.rgbGreen / 255 * 1 / Sqrt(2 * PI);
B := P^.rgbBlue / 255 * 1 / Sqrt(2 * PI);
Inc(P);
end;
Bmp.Free;
end;
initialization
LoadSpectrum;
end.
|
unit Word_TLB_Constants;
(*//*************************************************************************
This file is created as a subset of Word_TLB.pas.
We do not need the Types, Classes and Interfaces, so we have copied out the
Constants part of the file. It can be updated at any time. The file needs
to have all declarations of TOLEEnum removed from the constants section.
All Values are HEX no Decimal.
I guess this is probably in some way Copyright Microsoft.
//*************************************************************************)
interface
// *********************************************************************//
// Declaration of Enumerations defined in Type Library
// *********************************************************************//
// Constants for enum WdMailSystem
const
wdNoMailSystem = $00000000;
wdMAPI = $00000001;
wdPowerTalk = $00000002;
wdMAPIandPowerTalk = $00000003;
// Constants for enum WdTemplateType
const
wdNormalTemplate = $00000000;
wdGlobalTemplate = $00000001;
wdAttachedTemplate = $00000002;
// Constants for enum WdContinue
const
wdContinueDisabled = $00000000;
wdResetList = $00000001;
wdContinueList = $00000002;
// Constants for enum WdIMEMode
const
wdIMEModeNoControl = $00000000;
wdIMEModeOn = $00000001;
wdIMEModeOff = $00000002;
wdIMEModeHiragana = $00000004;
wdIMEModeKatakana = $00000005;
wdIMEModeKatakanaHalf = $00000006;
wdIMEModeAlphaFull = $00000007;
wdIMEModeAlpha = $00000008;
wdIMEModeHangulFull = $00000009;
wdIMEModeHangul = $0000000A;
// Constants for enum WdBaselineAlignment
const
wdBaselineAlignTop = $00000000;
wdBaselineAlignCenter = $00000001;
wdBaselineAlignBaseline = $00000002;
wdBaselineAlignFarEast50 = $00000003;
wdBaselineAlignAuto = $00000004;
// Constants for enum WdIndexFilter
const
wdIndexFilterNone = $00000000;
wdIndexFilterAiueo = $00000001;
wdIndexFilterAkasatana = $00000002;
wdIndexFilterChosung = $00000003;
wdIndexFilterLow = $00000004;
wdIndexFilterMedium = $00000005;
wdIndexFilterFull = $00000006;
// Constants for enum WdIndexSortBy
const
wdIndexSortByStroke = $00000000;
wdIndexSortBySyllable = $00000001;
// Constants for enum WdJustificationMode
const
wdJustificationModeExpand = $00000000;
wdJustificationModeCompress = $00000001;
wdJustificationModeCompressKana = $00000002;
// Constants for enum WdFarEastLineBreakLevel
const
wdFarEastLineBreakLevelNormal = $00000000;
wdFarEastLineBreakLevelStrict = $00000001;
wdFarEastLineBreakLevelCustom = $00000002;
// Constants for enum WdMultipleWordConversionsMode
const
wdHangulToHanja = $00000000;
wdHanjaToHangul = $00000001;
// Constants for enum WdColorIndex
const
wdAuto = $00000000;
wdBlack = $00000001;
wdBlue = $00000002;
wdTurquoise = $00000003;
wdBrightGreen = $00000004;
wdPink = $00000005;
wdRed = $00000006;
wdYellow = $00000007;
wdWhite = $00000008;
wdDarkBlue = $00000009;
wdTeal = $0000000A;
wdGreen = $0000000B;
wdViolet = $0000000C;
wdDarkRed = $0000000D;
wdDarkYellow = $0000000E;
wdGray50 = $0000000F;
wdGray25 = $00000010;
wdClassicRed = $00000011;
wdClassicBlue = $00000012;
wdByAuthor = $FFFFFFFF;
wdNoHighlight = $00000000;
// Constants for enum WdTextureIndex
const
wdTextureNone = $00000000;
wdTexture2Pt5Percent = $00000019;
wdTexture5Percent = $00000032;
wdTexture7Pt5Percent = $0000004B;
wdTexture10Percent = $00000064;
wdTexture12Pt5Percent = $0000007D;
wdTexture15Percent = $00000096;
wdTexture17Pt5Percent = $000000AF;
wdTexture20Percent = $000000C8;
wdTexture22Pt5Percent = $000000E1;
wdTexture25Percent = $000000FA;
wdTexture27Pt5Percent = $00000113;
wdTexture30Percent = $0000012C;
wdTexture32Pt5Percent = $00000145;
wdTexture35Percent = $0000015E;
wdTexture37Pt5Percent = $00000177;
wdTexture40Percent = $00000190;
wdTexture42Pt5Percent = $000001A9;
wdTexture45Percent = $000001C2;
wdTexture47Pt5Percent = $000001DB;
wdTexture50Percent = $000001F4;
wdTexture52Pt5Percent = $0000020D;
wdTexture55Percent = $00000226;
wdTexture57Pt5Percent = $0000023F;
wdTexture60Percent = $00000258;
wdTexture62Pt5Percent = $00000271;
wdTexture65Percent = $0000028A;
wdTexture67Pt5Percent = $000002A3;
wdTexture70Percent = $000002BC;
wdTexture72Pt5Percent = $000002D5;
wdTexture75Percent = $000002EE;
wdTexture77Pt5Percent = $00000307;
wdTexture80Percent = $00000320;
wdTexture82Pt5Percent = $00000339;
wdTexture85Percent = $00000352;
wdTexture87Pt5Percent = $0000036B;
wdTexture90Percent = $00000384;
wdTexture92Pt5Percent = $0000039D;
wdTexture95Percent = $000003B6;
wdTexture97Pt5Percent = $000003CF;
wdTextureSolid = $000003E8;
wdTextureDarkHorizontal = $FFFFFFFF;
wdTextureDarkVertical = $FFFFFFFE;
wdTextureDarkDiagonalDown = $FFFFFFFD;
wdTextureDarkDiagonalUp = $FFFFFFFC;
wdTextureDarkCross = $FFFFFFFB;
wdTextureDarkDiagonalCross = $FFFFFFFA;
wdTextureHorizontal = $FFFFFFF9;
wdTextureVertical = $FFFFFFF8;
wdTextureDiagonalDown = $FFFFFFF7;
wdTextureDiagonalUp = $FFFFFFF6;
wdTextureCross = $FFFFFFF5;
wdTextureDiagonalCross = $FFFFFFF4;
// Constants for enum WdUnderline
const
wdUnderlineNone = $00000000;
wdUnderlineSingle = $00000001;
wdUnderlineWords = $00000002;
wdUnderlineDouble = $00000003;
wdUnderlineDotted = $00000004;
wdUnderlineThick = $00000006;
wdUnderlineDash = $00000007;
wdUnderlineDotDash = $00000009;
wdUnderlineDotDotDash = $0000000A;
wdUnderlineWavy = $0000000B;
wdUnderlineWavyHeavy = $0000001B;
wdUnderlineDottedHeavy = $00000014;
wdUnderlineDashHeavy = $00000017;
wdUnderlineDotDashHeavy = $00000019;
wdUnderlineDotDotDashHeavy = $0000001A;
wdUnderlineDashLong = $00000027;
wdUnderlineDashLongHeavy = $00000037;
wdUnderlineWavyDouble = $0000002B;
// Constants for enum WdEmphasisMark
const
wdEmphasisMarkNone = $00000000;
wdEmphasisMarkOverSolidCircle = $00000001;
wdEmphasisMarkOverComma = $00000002;
wdEmphasisMarkOverWhiteCircle = $00000003;
wdEmphasisMarkUnderSolidCircle = $00000004;
// Constants for enum WdInternationalIndex
const
wdListSeparator = $00000011;
wdDecimalSeparator = $00000012;
wdThousandsSeparator = $00000013;
wdCurrencyCode = $00000014;
wd24HourClock = $00000015;
wdInternationalAM = $00000016;
wdInternationalPM = $00000017;
wdTimeSeparator = $00000018;
wdDateSeparator = $00000019;
wdProductLanguageID = $0000001A;
// Constants for enum WdAutoMacros
const
wdAutoExec = $00000000;
wdAutoNew = $00000001;
wdAutoOpen = $00000002;
wdAutoClose = $00000003;
wdAutoExit = $00000004;
wdAutoSync = $00000005;
// Constants for enum WdCaptionPosition
const
wdCaptionPositionAbove = $00000000;
wdCaptionPositionBelow = $00000001;
// Constants for enum WdCountry
const
wdUS = $00000001;
wdCanada = $00000002;
wdLatinAmerica = $00000003;
wdNetherlands = $0000001F;
wdFrance = $00000021;
wdSpain = $00000022;
wdItaly = $00000027;
wdUK = $0000002C;
wdDenmark = $0000002D;
wdSweden = $0000002E;
wdNorway = $0000002F;
wdGermany = $00000031;
wdPeru = $00000033;
wdMexico = $00000034;
wdArgentina = $00000036;
wdBrazil = $00000037;
wdChile = $00000038;
wdVenezuela = $0000003A;
wdJapan = $00000051;
wdTaiwan = $00000376;
wdChina = $00000056;
wdKorea = $00000052;
wdFinland = $00000166;
wdIceland = $00000162;
// Constants for enum WdHeadingSeparator
const
wdHeadingSeparatorNone = $00000000;
wdHeadingSeparatorBlankLine = $00000001;
wdHeadingSeparatorLetter = $00000002;
wdHeadingSeparatorLetterLow = $00000003;
wdHeadingSeparatorLetterFull = $00000004;
// Constants for enum WdSeparatorType
const
wdSeparatorHyphen = $00000000;
wdSeparatorPeriod = $00000001;
wdSeparatorColon = $00000002;
wdSeparatorEmDash = $00000003;
wdSeparatorEnDash = $00000004;
// Constants for enum WdPageNumberAlignment
const
wdAlignPageNumberLeft = $00000000;
wdAlignPageNumberCenter = $00000001;
wdAlignPageNumberRight = $00000002;
wdAlignPageNumberInside = $00000003;
wdAlignPageNumberOutside = $00000004;
// Constants for enum WdBorderType
const
wdBorderTop = $FFFFFFFF;
wdBorderLeft = $FFFFFFFE;
wdBorderBottom = $FFFFFFFD;
wdBorderRight = $FFFFFFFC;
wdBorderHorizontal = $FFFFFFFB;
wdBorderVertical = $FFFFFFFA;
wdBorderDiagonalDown = $FFFFFFF9;
wdBorderDiagonalUp = $FFFFFFF8;
// Constants for enum WdBorderTypeHID
const
emptyenum = $00000000;
// Constants for enum WdFramePosition
const
wdFrameTop = $FFF0BDC1;
wdFrameLeft = $FFF0BDC2;
wdFrameBottom = $FFF0BDC3;
wdFrameRight = $FFF0BDC4;
wdFrameCenter = $FFF0BDC5;
wdFrameInside = $FFF0BDC6;
wdFrameOutside = $FFF0BDC7;
// Constants for enum WdAnimation
const
wdAnimationNone = $00000000;
wdAnimationLasVegasLights = $00000001;
wdAnimationBlinkingBackground = $00000002;
wdAnimationSparkleText = $00000003;
wdAnimationMarchingBlackAnts = $00000004;
wdAnimationMarchingRedAnts = $00000005;
wdAnimationShimmer = $00000006;
// Constants for enum WdCharacterCase
const
wdNextCase = $FFFFFFFF;
wdLowerCase = $00000000;
wdUpperCase = $00000001;
wdTitleWord = $00000002;
wdTitleSentence = $00000004;
wdToggleCase = $00000005;
wdHalfWidth = $00000006;
wdFullWidth = $00000007;
wdKatakana = $00000008;
wdHiragana = $00000009;
// Constants for enum WdCharacterCaseHID
const
emptyenum_ = $00000000;
// Constants for enum WdSummaryMode
const
wdSummaryModeHighlight = $00000000;
wdSummaryModeHideAllButSummary = $00000001;
wdSummaryModeInsert = $00000002;
wdSummaryModeCreateNew = $00000003;
// Constants for enum WdSummaryLength
const
wd10Sentences = $FFFFFFFE;
wd20Sentences = $FFFFFFFD;
wd100Words = $FFFFFFFC;
wd500Words = $FFFFFFFB;
wd10Percent = $FFFFFFFA;
wd25Percent = $FFFFFFF9;
wd50Percent = $FFFFFFF8;
wd75Percent = $FFFFFFF7;
// Constants for enum WdStyleType
const
wdStyleTypeParagraph = $00000001;
wdStyleTypeCharacter = $00000002;
wdStyleTypeTable = $00000003;
wdStyleTypeList = $00000004;
wdStyleTypeParagraphOnly = $00000005;
wdStyleTypeLinked = $00000006;
// Constants for enum WdUnits
const
wdCharacter = $00000001;
wdWord = $00000002;
wdSentence = $00000003;
wdParagraph = $00000004;
wdLine = $00000005;
wdStory = $00000006;
wdScreen = $00000007;
wdSection = $00000008;
wdColumn = $00000009;
wdRow = $0000000A;
wdWindow = $0000000B;
wdCell = $0000000C;
wdCharacterFormatting = $0000000D;
wdParagraphFormatting = $0000000E;
wdTable = $0000000F;
wdItem = $00000010;
// Constants for enum WdGoToItem
const
wdGoToBookmark = $FFFFFFFF;
wdGoToSection = $00000000;
wdGoToPage = $00000001;
wdGoToTable = $00000002;
wdGoToLine = $00000003;
wdGoToFootnote = $00000004;
wdGoToEndnote = $00000005;
wdGoToComment = $00000006;
wdGoToField = $00000007;
wdGoToGraphic = $00000008;
wdGoToObject = $00000009;
wdGoToEquation = $0000000A;
wdGoToHeading = $0000000B;
wdGoToPercent = $0000000C;
wdGoToSpellingError = $0000000D;
wdGoToGrammaticalError = $0000000E;
wdGoToProofreadingError = $0000000F;
// Constants for enum WdGoToDirection
const
wdGoToFirst = $00000001;
wdGoToLast = $FFFFFFFF;
wdGoToNext = $00000002;
wdGoToRelative = $00000002;
wdGoToPrevious = $00000003;
wdGoToAbsolute = $00000001;
// Constants for enum WdCollapseDirection
const
wdCollapseStart = $00000001;
wdCollapseEnd = $00000000;
// Constants for enum WdRowHeightRule
const
wdRowHeightAuto = $00000000;
wdRowHeightAtLeast = $00000001;
wdRowHeightExactly = $00000002;
// Constants for enum WdFrameSizeRule
const
wdFrameAuto = $00000000;
wdFrameAtLeast = $00000001;
wdFrameExact = $00000002;
// Constants for enum WdInsertCells
const
wdInsertCellsShiftRight = $00000000;
wdInsertCellsShiftDown = $00000001;
wdInsertCellsEntireRow = $00000002;
wdInsertCellsEntireColumn = $00000003;
// Constants for enum WdDeleteCells
const
wdDeleteCellsShiftLeft = $00000000;
wdDeleteCellsShiftUp = $00000001;
wdDeleteCellsEntireRow = $00000002;
wdDeleteCellsEntireColumn = $00000003;
// Constants for enum WdListApplyTo
const
wdListApplyToWholeList = $00000000;
wdListApplyToThisPointForward = $00000001;
wdListApplyToSelection = $00000002;
// Constants for enum WdAlertLevel
const
wdAlertsNone = $00000000;
wdAlertsMessageBox = $FFFFFFFE;
wdAlertsAll = $FFFFFFFF;
// Constants for enum WdCursorType
const
wdCursorWait = $00000000;
wdCursorIBeam = $00000001;
wdCursorNormal = $00000002;
wdCursorNorthwestArrow = $00000003;
// Constants for enum WdEnableCancelKey
const
wdCancelDisabled = $00000000;
wdCancelInterrupt = $00000001;
// Constants for enum WdRulerStyle
const
wdAdjustNone = $00000000;
wdAdjustProportional = $00000001;
wdAdjustFirstColumn = $00000002;
wdAdjustSameWidth = $00000003;
// Constants for enum WdParagraphAlignment
const
wdAlignParagraphLeft = $00000000;
wdAlignParagraphCenter = $00000001;
wdAlignParagraphRight = $00000002;
wdAlignParagraphJustify = $00000003;
wdAlignParagraphDistribute = $00000004;
wdAlignParagraphJustifyMed = $00000005;
wdAlignParagraphJustifyHi = $00000007;
wdAlignParagraphJustifyLow = $00000008;
wdAlignParagraphThaiJustify = $00000009;
// Constants for enum WdParagraphAlignmentHID
const
emptyenum__ = $00000000;
// Constants for enum WdListLevelAlignment
const
wdListLevelAlignLeft = $00000000;
wdListLevelAlignCenter = $00000001;
wdListLevelAlignRight = $00000002;
// Constants for enum WdRowAlignment
const
wdAlignRowLeft = $00000000;
wdAlignRowCenter = $00000001;
wdAlignRowRight = $00000002;
// Constants for enum WdTabAlignment
const
wdAlignTabLeft = $00000000;
wdAlignTabCenter = $00000001;
wdAlignTabRight = $00000002;
wdAlignTabDecimal = $00000003;
wdAlignTabBar = $00000004;
wdAlignTabList = $00000006;
// Constants for enum WdVerticalAlignment
const
wdAlignVerticalTop = $00000000;
wdAlignVerticalCenter = $00000001;
wdAlignVerticalJustify = $00000002;
wdAlignVerticalBottom = $00000003;
// Constants for enum WdCellVerticalAlignment
const
wdCellAlignVerticalTop = $00000000;
wdCellAlignVerticalCenter = $00000001;
wdCellAlignVerticalBottom = $00000003;
// Constants for enum WdTrailingCharacter
const
wdTrailingTab = $00000000;
wdTrailingSpace = $00000001;
wdTrailingNone = $00000002;
// Constants for enum WdListGalleryType
const
wdBulletGallery = $00000001;
wdNumberGallery = $00000002;
wdOutlineNumberGallery = $00000003;
// Constants for enum WdListNumberStyle
const
wdListNumberStyleArabic = $00000000;
wdListNumberStyleUppercaseRoman = $00000001;
wdListNumberStyleLowercaseRoman = $00000002;
wdListNumberStyleUppercaseLetter = $00000003;
wdListNumberStyleLowercaseLetter = $00000004;
wdListNumberStyleOrdinal = $00000005;
wdListNumberStyleCardinalText = $00000006;
wdListNumberStyleOrdinalText = $00000007;
wdListNumberStyleKanji = $0000000A;
wdListNumberStyleKanjiDigit = $0000000B;
wdListNumberStyleAiueoHalfWidth = $0000000C;
wdListNumberStyleIrohaHalfWidth = $0000000D;
wdListNumberStyleArabicFullWidth = $0000000E;
wdListNumberStyleKanjiTraditional = $00000010;
wdListNumberStyleKanjiTraditional2 = $00000011;
wdListNumberStyleNumberInCircle = $00000012;
wdListNumberStyleAiueo = $00000014;
wdListNumberStyleIroha = $00000015;
wdListNumberStyleArabicLZ = $00000016;
wdListNumberStyleBullet = $00000017;
wdListNumberStyleGanada = $00000018;
wdListNumberStyleChosung = $00000019;
wdListNumberStyleGBNum1 = $0000001A;
wdListNumberStyleGBNum2 = $0000001B;
wdListNumberStyleGBNum3 = $0000001C;
wdListNumberStyleGBNum4 = $0000001D;
wdListNumberStyleZodiac1 = $0000001E;
wdListNumberStyleZodiac2 = $0000001F;
wdListNumberStyleZodiac3 = $00000020;
wdListNumberStyleTradChinNum1 = $00000021;
wdListNumberStyleTradChinNum2 = $00000022;
wdListNumberStyleTradChinNum3 = $00000023;
wdListNumberStyleTradChinNum4 = $00000024;
wdListNumberStyleSimpChinNum1 = $00000025;
wdListNumberStyleSimpChinNum2 = $00000026;
wdListNumberStyleSimpChinNum3 = $00000027;
wdListNumberStyleSimpChinNum4 = $00000028;
wdListNumberStyleHanjaRead = $00000029;
wdListNumberStyleHanjaReadDigit = $0000002A;
wdListNumberStyleHangul = $0000002B;
wdListNumberStyleHanja = $0000002C;
wdListNumberStyleHebrew1 = $0000002D;
wdListNumberStyleArabic1 = $0000002E;
wdListNumberStyleHebrew2 = $0000002F;
wdListNumberStyleArabic2 = $00000030;
wdListNumberStyleHindiLetter1 = $00000031;
wdListNumberStyleHindiLetter2 = $00000032;
wdListNumberStyleHindiArabic = $00000033;
wdListNumberStyleHindiCardinalText = $00000034;
wdListNumberStyleThaiLetter = $00000035;
wdListNumberStyleThaiArabic = $00000036;
wdListNumberStyleThaiCardinalText = $00000037;
wdListNumberStyleVietCardinalText = $00000038;
wdListNumberStyleLowercaseRussian = $0000003A;
wdListNumberStyleUppercaseRussian = $0000003B;
wdListNumberStyleLowercaseGreek = $0000003C;
wdListNumberStyleUppercaseGreek = $0000003D;
wdListNumberStyleArabicLZ2 = $0000003E;
wdListNumberStyleArabicLZ3 = $0000003F;
wdListNumberStyleArabicLZ4 = $00000040;
wdListNumberStyleLowercaseTurkish = $00000041;
wdListNumberStyleUppercaseTurkish = $00000042;
wdListNumberStyleLowercaseBulgarian = $00000043;
wdListNumberStyleUppercaseBulgarian = $00000044;
wdListNumberStylePictureBullet = $000000F9;
wdListNumberStyleLegal = $000000FD;
wdListNumberStyleLegalLZ = $000000FE;
wdListNumberStyleNone = $000000FF;
// Constants for enum WdListNumberStyleHID
const
emptyenum___ = $00000000;
// Constants for enum WdNoteNumberStyle
const
wdNoteNumberStyleArabic = $00000000;
wdNoteNumberStyleUppercaseRoman = $00000001;
wdNoteNumberStyleLowercaseRoman = $00000002;
wdNoteNumberStyleUppercaseLetter = $00000003;
wdNoteNumberStyleLowercaseLetter = $00000004;
wdNoteNumberStyleSymbol = $00000009;
wdNoteNumberStyleArabicFullWidth = $0000000E;
wdNoteNumberStyleKanji = $0000000A;
wdNoteNumberStyleKanjiDigit = $0000000B;
wdNoteNumberStyleKanjiTraditional = $00000010;
wdNoteNumberStyleNumberInCircle = $00000012;
wdNoteNumberStyleHanjaRead = $00000029;
wdNoteNumberStyleHanjaReadDigit = $0000002A;
wdNoteNumberStyleTradChinNum1 = $00000021;
wdNoteNumberStyleTradChinNum2 = $00000022;
wdNoteNumberStyleSimpChinNum1 = $00000025;
wdNoteNumberStyleSimpChinNum2 = $00000026;
wdNoteNumberStyleHebrewLetter1 = $0000002D;
wdNoteNumberStyleArabicLetter1 = $0000002E;
wdNoteNumberStyleHebrewLetter2 = $0000002F;
wdNoteNumberStyleArabicLetter2 = $00000030;
wdNoteNumberStyleHindiLetter1 = $00000031;
wdNoteNumberStyleHindiLetter2 = $00000032;
wdNoteNumberStyleHindiArabic = $00000033;
wdNoteNumberStyleHindiCardinalText = $00000034;
wdNoteNumberStyleThaiLetter = $00000035;
wdNoteNumberStyleThaiArabic = $00000036;
wdNoteNumberStyleThaiCardinalText = $00000037;
wdNoteNumberStyleVietCardinalText = $00000038;
// Constants for enum WdNoteNumberStyleHID
const
emptyenum____ = $00000000;
// Constants for enum WdCaptionNumberStyle
const
wdCaptionNumberStyleArabic = $00000000;
wdCaptionNumberStyleUppercaseRoman = $00000001;
wdCaptionNumberStyleLowercaseRoman = $00000002;
wdCaptionNumberStyleUppercaseLetter = $00000003;
wdCaptionNumberStyleLowercaseLetter = $00000004;
wdCaptionNumberStyleArabicFullWidth = $0000000E;
wdCaptionNumberStyleKanji = $0000000A;
wdCaptionNumberStyleKanjiDigit = $0000000B;
wdCaptionNumberStyleKanjiTraditional = $00000010;
wdCaptionNumberStyleNumberInCircle = $00000012;
wdCaptionNumberStyleGanada = $00000018;
wdCaptionNumberStyleChosung = $00000019;
wdCaptionNumberStyleZodiac1 = $0000001E;
wdCaptionNumberStyleZodiac2 = $0000001F;
wdCaptionNumberStyleHanjaRead = $00000029;
wdCaptionNumberStyleHanjaReadDigit = $0000002A;
wdCaptionNumberStyleTradChinNum2 = $00000022;
wdCaptionNumberStyleTradChinNum3 = $00000023;
wdCaptionNumberStyleSimpChinNum2 = $00000026;
wdCaptionNumberStyleSimpChinNum3 = $00000027;
wdCaptionNumberStyleHebrewLetter1 = $0000002D;
wdCaptionNumberStyleArabicLetter1 = $0000002E;
wdCaptionNumberStyleHebrewLetter2 = $0000002F;
wdCaptionNumberStyleArabicLetter2 = $00000030;
wdCaptionNumberStyleHindiLetter1 = $00000031;
wdCaptionNumberStyleHindiLetter2 = $00000032;
wdCaptionNumberStyleHindiArabic = $00000033;
wdCaptionNumberStyleHindiCardinalText = $00000034;
wdCaptionNumberStyleThaiLetter = $00000035;
wdCaptionNumberStyleThaiArabic = $00000036;
wdCaptionNumberStyleThaiCardinalText = $00000037;
wdCaptionNumberStyleVietCardinalText = $00000038;
// Constants for enum WdCaptionNumberStyleHID
const
emptyenum_____ = $00000000;
// Constants for enum WdPageNumberStyle
const
wdPageNumberStyleArabic = $00000000;
wdPageNumberStyleUppercaseRoman = $00000001;
wdPageNumberStyleLowercaseRoman = $00000002;
wdPageNumberStyleUppercaseLetter = $00000003;
wdPageNumberStyleLowercaseLetter = $00000004;
wdPageNumberStyleArabicFullWidth = $0000000E;
wdPageNumberStyleKanji = $0000000A;
wdPageNumberStyleKanjiDigit = $0000000B;
wdPageNumberStyleKanjiTraditional = $00000010;
wdPageNumberStyleNumberInCircle = $00000012;
wdPageNumberStyleHanjaRead = $00000029;
wdPageNumberStyleHanjaReadDigit = $0000002A;
wdPageNumberStyleTradChinNum1 = $00000021;
wdPageNumberStyleTradChinNum2 = $00000022;
wdPageNumberStyleSimpChinNum1 = $00000025;
wdPageNumberStyleSimpChinNum2 = $00000026;
wdPageNumberStyleHebrewLetter1 = $0000002D;
wdPageNumberStyleArabicLetter1 = $0000002E;
wdPageNumberStyleHebrewLetter2 = $0000002F;
wdPageNumberStyleArabicLetter2 = $00000030;
wdPageNumberStyleHindiLetter1 = $00000031;
wdPageNumberStyleHindiLetter2 = $00000032;
wdPageNumberStyleHindiArabic = $00000033;
wdPageNumberStyleHindiCardinalText = $00000034;
wdPageNumberStyleThaiLetter = $00000035;
wdPageNumberStyleThaiArabic = $00000036;
wdPageNumberStyleThaiCardinalText = $00000037;
wdPageNumberStyleVietCardinalText = $00000038;
wdPageNumberStyleNumberInDash = $00000039;
// Constants for enum WdPageNumberStyleHID
const
emptyenum______ = $00000000;
// Constants for enum WdStatistic
const
wdStatisticWords = $00000000;
wdStatisticLines = $00000001;
wdStatisticPages = $00000002;
wdStatisticCharacters = $00000003;
wdStatisticParagraphs = $00000004;
wdStatisticCharactersWithSpaces = $00000005;
wdStatisticFarEastCharacters = $00000006;
// Constants for enum WdStatisticHID
const
emptyenum_______ = $00000000;
// Constants for enum WdBuiltInProperty
const
wdPropertyTitle = $00000001;
wdPropertySubject = $00000002;
wdPropertyAuthor = $00000003;
wdPropertyKeywords = $00000004;
wdPropertyComments = $00000005;
wdPropertyTemplate = $00000006;
wdPropertyLastAuthor = $00000007;
wdPropertyRevision = $00000008;
wdPropertyAppName = $00000009;
wdPropertyTimeLastPrinted = $0000000A;
wdPropertyTimeCreated = $0000000B;
wdPropertyTimeLastSaved = $0000000C;
wdPropertyVBATotalEdit = $0000000D;
wdPropertyPages = $0000000E;
wdPropertyWords = $0000000F;
wdPropertyCharacters = $00000010;
wdPropertySecurity = $00000011;
wdPropertyCategory = $00000012;
wdPropertyFormat = $00000013;
wdPropertyManager = $00000014;
wdPropertyCompany = $00000015;
wdPropertyBytes = $00000016;
wdPropertyLines = $00000017;
wdPropertyParas = $00000018;
wdPropertySlides = $00000019;
wdPropertyNotes = $0000001A;
wdPropertyHiddenSlides = $0000001B;
wdPropertyMMClips = $0000001C;
wdPropertyHyperlinkBase = $0000001D;
wdPropertyCharsWSpaces = $0000001E;
// Constants for enum WdLineSpacing
const
wdLineSpaceSingle = $00000000;
wdLineSpace1pt5 = $00000001;
wdLineSpaceDouble = $00000002;
wdLineSpaceAtLeast = $00000003;
wdLineSpaceExactly = $00000004;
wdLineSpaceMultiple = $00000005;
// Constants for enum WdNumberType
const
wdNumberParagraph = $00000001;
wdNumberListNum = $00000002;
wdNumberAllNumbers = $00000003;
// Constants for enum WdListType
const
wdListNoNumbering = $00000000;
wdListListNumOnly = $00000001;
wdListBullet = $00000002;
wdListSimpleNumbering = $00000003;
wdListOutlineNumbering = $00000004;
wdListMixedNumbering = $00000005;
wdListPictureBullet = $00000006;
// Constants for enum WdStoryType
const
wdMainTextStory = $00000001;
wdFootnotesStory = $00000002;
wdEndnotesStory = $00000003;
wdCommentsStory = $00000004;
wdTextFrameStory = $00000005;
wdEvenPagesHeaderStory = $00000006;
wdPrimaryHeaderStory = $00000007;
wdEvenPagesFooterStory = $00000008;
wdPrimaryFooterStory = $00000009;
wdFirstPageHeaderStory = $0000000A;
wdFirstPageFooterStory = $0000000B;
wdFootnoteSeparatorStory = $0000000C;
wdFootnoteContinuationSeparatorStory = $0000000D;
wdFootnoteContinuationNoticeStory = $0000000E;
wdEndnoteSeparatorStory = $0000000F;
wdEndnoteContinuationSeparatorStory = $00000010;
wdEndnoteContinuationNoticeStory = $00000011;
// Constants for enum WdSaveFormat
const
wdFormatDocument = $00000000;
wdFormatDocument97 = $00000000;
wdFormatTemplate = $00000001;
wdFormatTemplate97 = $00000001;
wdFormatText = $00000002;
wdFormatTextLineBreaks = $00000003;
wdFormatDOSText = $00000004;
wdFormatDOSTextLineBreaks = $00000005;
wdFormatRTF = $00000006;
wdFormatUnicodeText = $00000007;
wdFormatEncodedText = $00000007;
wdFormatHTML = $00000008;
wdFormatWebArchive = $00000009;
wdFormatFilteredHTML = $0000000A;
wdFormatXML = $0000000B;
wdFormatXMLDocument = $0000000C;
wdFormatXMLDocumentMacroEnabled = $0000000D;
wdFormatXMLTemplate = $0000000E;
wdFormatXMLTemplateMacroEnabled = $0000000F;
wdFormatDocumentDefault = $00000010;
wdFormatPDF = $00000011;
wdFormatXPS = $00000012;
wdFormatFlatXML = $00000013;
wdFormatFlatXMLMacroEnabled = $00000014;
wdFormatFlatXMLTemplate = $00000015;
wdFormatFlatXMLTemplateMacroEnabled = $00000016;
wdFormatOpenDocumentText = $00000017;
wdFormatStrictOpenXMLDocument = $00000018;
// Constants for enum WdOpenFormat
const
wdOpenFormatAuto = $00000000;
wdOpenFormatDocument = $00000001;
wdOpenFormatTemplate = $00000002;
wdOpenFormatRTF = $00000003;
wdOpenFormatText = $00000004;
wdOpenFormatUnicodeText = $00000005;
wdOpenFormatEncodedText = $00000005;
wdOpenFormatAllWord = $00000006;
wdOpenFormatWebPages = $00000007;
wdOpenFormatXML = $00000008;
wdOpenFormatXMLDocument = $00000009;
wdOpenFormatXMLDocumentMacroEnabled = $0000000A;
wdOpenFormatXMLTemplate = $0000000B;
wdOpenFormatXMLTemplateMacroEnabled = $0000000C;
wdOpenFormatDocument97 = $00000001;
wdOpenFormatTemplate97 = $00000002;
wdOpenFormatAllWordTemplates = $0000000D;
wdOpenFormatXMLDocumentSerialized = $0000000E;
wdOpenFormatXMLDocumentMacroEnabledSerialized = $0000000F;
wdOpenFormatXMLTemplateSerialized = $00000010;
wdOpenFormatXMLTemplateMacroEnabledSerialized = $00000011;
wdOpenFormatOpenDocumentText = $00000012;
// Constants for enum WdHeaderFooterIndex
const
wdHeaderFooterPrimary = $00000001;
wdHeaderFooterFirstPage = $00000002;
wdHeaderFooterEvenPages = $00000003;
// Constants for enum WdTocFormat
const
wdTOCTemplate = $00000000;
wdTOCClassic = $00000001;
wdTOCDistinctive = $00000002;
wdTOCFancy = $00000003;
wdTOCModern = $00000004;
wdTOCFormal = $00000005;
wdTOCSimple = $00000006;
// Constants for enum WdTofFormat
const
wdTOFTemplate = $00000000;
wdTOFClassic = $00000001;
wdTOFDistinctive = $00000002;
wdTOFCentered = $00000003;
wdTOFFormal = $00000004;
wdTOFSimple = $00000005;
// Constants for enum WdToaFormat
const
wdTOATemplate = $00000000;
wdTOAClassic = $00000001;
wdTOADistinctive = $00000002;
wdTOAFormal = $00000003;
wdTOASimple = $00000004;
// Constants for enum WdLineStyle
const
wdLineStyleNone = $00000000;
wdLineStyleSingle = $00000001;
wdLineStyleDot = $00000002;
wdLineStyleDashSmallGap = $00000003;
wdLineStyleDashLargeGap = $00000004;
wdLineStyleDashDot = $00000005;
wdLineStyleDashDotDot = $00000006;
wdLineStyleDouble = $00000007;
wdLineStyleTriple = $00000008;
wdLineStyleThinThickSmallGap = $00000009;
wdLineStyleThickThinSmallGap = $0000000A;
wdLineStyleThinThickThinSmallGap = $0000000B;
wdLineStyleThinThickMedGap = $0000000C;
wdLineStyleThickThinMedGap = $0000000D;
wdLineStyleThinThickThinMedGap = $0000000E;
wdLineStyleThinThickLargeGap = $0000000F;
wdLineStyleThickThinLargeGap = $00000010;
wdLineStyleThinThickThinLargeGap = $00000011;
wdLineStyleSingleWavy = $00000012;
wdLineStyleDoubleWavy = $00000013;
wdLineStyleDashDotStroked = $00000014;
wdLineStyleEmboss3D = $00000015;
wdLineStyleEngrave3D = $00000016;
wdLineStyleOutset = $00000017;
wdLineStyleInset = $00000018;
// Constants for enum WdLineWidth
const
wdLineWidth025pt = $00000002;
wdLineWidth050pt = $00000004;
wdLineWidth075pt = $00000006;
wdLineWidth100pt = $00000008;
wdLineWidth150pt = $0000000C;
wdLineWidth225pt = $00000012;
wdLineWidth300pt = $00000018;
wdLineWidth450pt = $00000024;
wdLineWidth600pt = $00000030;
// Constants for enum WdBreakType
const
wdSectionBreakNextPage = $00000002;
wdSectionBreakContinuous = $00000003;
wdSectionBreakEvenPage = $00000004;
wdSectionBreakOddPage = $00000005;
wdLineBreak = $00000006;
wdPageBreak = $00000007;
wdColumnBreak = $00000008;
wdLineBreakClearLeft = $00000009;
wdLineBreakClearRight = $0000000A;
wdTextWrappingBreak = $0000000B;
// Constants for enum WdTabLeader
const
wdTabLeaderSpaces = $00000000;
wdTabLeaderDots = $00000001;
wdTabLeaderDashes = $00000002;
wdTabLeaderLines = $00000003;
wdTabLeaderHeavy = $00000004;
wdTabLeaderMiddleDot = $00000005;
// Constants for enum WdTabLeaderHID
const
emptyenum________ = $00000000;
// Constants for enum WdMeasurementUnits
const
wdInches = $00000000;
wdCentimeters = $00000001;
wdMillimeters = $00000002;
wdPoints = $00000003;
wdPicas = $00000004;
// Constants for enum WdMeasurementUnitsHID
const
emptyenum_________ = $00000000;
// Constants for enum WdDropPosition
const
wdDropNone = $00000000;
wdDropNormal = $00000001;
wdDropMargin = $00000002;
// Constants for enum WdNumberingRule
const
wdRestartContinuous = $00000000;
wdRestartSection = $00000001;
wdRestartPage = $00000002;
// Constants for enum WdFootnoteLocation
const
wdBottomOfPage = $00000000;
wdBeneathText = $00000001;
// Constants for enum WdEndnoteLocation
const
wdEndOfSection = $00000000;
wdEndOfDocument = $00000001;
// Constants for enum WdSortSeparator
const
wdSortSeparateByTabs = $00000000;
wdSortSeparateByCommas = $00000001;
wdSortSeparateByDefaultTableSeparator = $00000002;
// Constants for enum WdTableFieldSeparator
const
wdSeparateByParagraphs = $00000000;
wdSeparateByTabs = $00000001;
wdSeparateByCommas = $00000002;
wdSeparateByDefaultListSeparator = $00000003;
// Constants for enum WdSortFieldType
const
wdSortFieldAlphanumeric = $00000000;
wdSortFieldNumeric = $00000001;
wdSortFieldDate = $00000002;
wdSortFieldSyllable = $00000003;
wdSortFieldJapanJIS = $00000004;
wdSortFieldStroke = $00000005;
wdSortFieldKoreaKS = $00000006;
// Constants for enum WdSortFieldTypeHID
const
emptyenum__________ = $00000000;
// Constants for enum WdSortOrder
const
wdSortOrderAscending = $00000000;
wdSortOrderDescending = $00000001;
// Constants for enum WdTableFormat
const
wdTableFormatNone = $00000000;
wdTableFormatSimple1 = $00000001;
wdTableFormatSimple2 = $00000002;
wdTableFormatSimple3 = $00000003;
wdTableFormatClassic1 = $00000004;
wdTableFormatClassic2 = $00000005;
wdTableFormatClassic3 = $00000006;
wdTableFormatClassic4 = $00000007;
wdTableFormatColorful1 = $00000008;
wdTableFormatColorful2 = $00000009;
wdTableFormatColorful3 = $0000000A;
wdTableFormatColumns1 = $0000000B;
wdTableFormatColumns2 = $0000000C;
wdTableFormatColumns3 = $0000000D;
wdTableFormatColumns4 = $0000000E;
wdTableFormatColumns5 = $0000000F;
wdTableFormatGrid1 = $00000010;
wdTableFormatGrid2 = $00000011;
wdTableFormatGrid3 = $00000012;
wdTableFormatGrid4 = $00000013;
wdTableFormatGrid5 = $00000014;
wdTableFormatGrid6 = $00000015;
wdTableFormatGrid7 = $00000016;
wdTableFormatGrid8 = $00000017;
wdTableFormatList1 = $00000018;
wdTableFormatList2 = $00000019;
wdTableFormatList3 = $0000001A;
wdTableFormatList4 = $0000001B;
wdTableFormatList5 = $0000001C;
wdTableFormatList6 = $0000001D;
wdTableFormatList7 = $0000001E;
wdTableFormatList8 = $0000001F;
wdTableFormat3DEffects1 = $00000020;
wdTableFormat3DEffects2 = $00000021;
wdTableFormat3DEffects3 = $00000022;
wdTableFormatContemporary = $00000023;
wdTableFormatElegant = $00000024;
wdTableFormatProfessional = $00000025;
wdTableFormatSubtle1 = $00000026;
wdTableFormatSubtle2 = $00000027;
wdTableFormatWeb1 = $00000028;
wdTableFormatWeb2 = $00000029;
wdTableFormatWeb3 = $0000002A;
// Constants for enum WdTableFormatApply
const
wdTableFormatApplyBorders = $00000001;
wdTableFormatApplyShading = $00000002;
wdTableFormatApplyFont = $00000004;
wdTableFormatApplyColor = $00000008;
wdTableFormatApplyAutoFit = $00000010;
wdTableFormatApplyHeadingRows = $00000020;
wdTableFormatApplyLastRow = $00000040;
wdTableFormatApplyFirstColumn = $00000080;
wdTableFormatApplyLastColumn = $00000100;
// Constants for enum WdLanguageID
const
wdLanguageNone = $00000000;
wdNoProofing = $00000400;
wdAfrikaans = $00000436;
wdAlbanian = $0000041C;
wdAmharic = $0000045E;
wdArabicAlgeria = $00001401;
wdArabicBahrain = $00003C01;
wdArabicEgypt = $00000C01;
wdArabicIraq = $00000801;
wdArabicJordan = $00002C01;
wdArabicKuwait = $00003401;
wdArabicLebanon = $00003001;
wdArabicLibya = $00001001;
wdArabicMorocco = $00001801;
wdArabicOman = $00002001;
wdArabicQatar = $00004001;
wdArabic = $00000401;
wdArabicSyria = $00002801;
wdArabicTunisia = $00001C01;
wdArabicUAE = $00003801;
wdArabicYemen = $00002401;
wdArmenian = $0000042B;
wdAssamese = $0000044D;
wdAzeriCyrillic = $0000082C;
wdAzeriLatin = $0000042C;
wdBasque = $0000042D;
wdByelorussian = $00000423;
wdBengali = $00000445;
wdBulgarian = $00000402;
wdBurmese = $00000455;
wdCatalan = $00000403;
wdCherokee = $0000045C;
wdChineseHongKongSAR = $00000C04;
wdChineseMacaoSAR = $00001404;
wdSimplifiedChinese = $00000804;
wdChineseSingapore = $00001004;
wdTraditionalChinese = $00000404;
wdCroatian = $0000041A;
wdCzech = $00000405;
wdDanish = $00000406;
wdDivehi = $00000465;
wdBelgianDutch = $00000813;
wdDutch = $00000413;
wdEdo = $00000466;
wdEnglishAUS = $00000C09;
wdEnglishBelize = $00002809;
wdEnglishCanadian = $00001009;
wdEnglishCaribbean = $00002409;
wdEnglishIreland = $00001809;
wdEnglishJamaica = $00002009;
wdEnglishNewZealand = $00001409;
wdEnglishPhilippines = $00003409;
wdEnglishSouthAfrica = $00001C09;
wdEnglishTrinidadTobago = $00002C09;
wdEnglishUK = $00000809;
wdEnglishUS = $00000409;
wdEnglishZimbabwe = $00003009;
wdEnglishIndonesia = $00003809;
wdEstonian = $00000425;
wdFaeroese = $00000438;
wdPersian = $00000429;
wdFilipino = $00000464;
wdFinnish = $0000040B;
wdFulfulde = $00000467;
wdBelgianFrench = $0000080C;
wdFrenchCameroon = $00002C0C;
wdFrenchCanadian = $00000C0C;
wdFrenchCotedIvoire = $0000300C;
wdFrench = $0000040C;
wdFrenchLuxembourg = $0000140C;
wdFrenchMali = $0000340C;
wdFrenchMonaco = $0000180C;
wdFrenchReunion = $0000200C;
wdFrenchSenegal = $0000280C;
wdFrenchMorocco = $0000380C;
wdFrenchHaiti = $00003C0C;
wdSwissFrench = $0000100C;
wdFrenchWestIndies = $00001C0C;
wdFrenchCongoDRC = $0000240C;
wdFrisianNetherlands = $00000462;
wdGaelicIreland = $0000083C;
wdGaelicScotland = $0000043C;
wdGalician = $00000456;
wdGeorgian = $00000437;
wdGermanAustria = $00000C07;
wdGerman = $00000407;
wdGermanLiechtenstein = $00001407;
wdGermanLuxembourg = $00001007;
wdSwissGerman = $00000807;
wdGreek = $00000408;
wdGuarani = $00000474;
wdGujarati = $00000447;
wdHausa = $00000468;
wdHawaiian = $00000475;
wdHebrew = $0000040D;
wdHindi = $00000439;
wdHungarian = $0000040E;
wdIbibio = $00000469;
wdIcelandic = $0000040F;
wdIgbo = $00000470;
wdIndonesian = $00000421;
wdInuktitut = $0000045D;
wdItalian = $00000410;
wdSwissItalian = $00000810;
wdJapanese = $00000411;
wdKannada = $0000044B;
wdKanuri = $00000471;
wdKashmiri = $00000460;
wdKazakh = $0000043F;
wdKhmer = $00000453;
wdKirghiz = $00000440;
wdKonkani = $00000457;
wdKorean = $00000412;
wdKyrgyz = $00000440;
wdLao = $00000454;
wdLatin = $00000476;
wdLatvian = $00000426;
wdLithuanian = $00000427;
wdMacedonianFYROM = $0000042F;
wdMalaysian = $0000043E;
wdMalayBruneiDarussalam = $0000083E;
wdMalayalam = $0000044C;
wdMaltese = $0000043A;
wdManipuri = $00000458;
wdMarathi = $0000044E;
wdMongolian = $00000450;
wdNepali = $00000461;
wdNorwegianBokmol = $00000414;
wdNorwegianNynorsk = $00000814;
wdOriya = $00000448;
wdOromo = $00000472;
wdPashto = $00000463;
wdPolish = $00000415;
wdPortugueseBrazil = $00000416;
wdPortuguese = $00000816;
wdPunjabi = $00000446;
wdRhaetoRomanic = $00000417;
wdRomanianMoldova = $00000818;
wdRomanian = $00000418;
wdRussianMoldova = $00000819;
wdRussian = $00000419;
wdSamiLappish = $0000043B;
wdSanskrit = $0000044F;
wdSerbianCyrillic = $00000C1A;
wdSerbianLatin = $0000081A;
wdSinhalese = $0000045B;
wdSindhi = $00000459;
wdSindhiPakistan = $00000859;
wdSlovak = $0000041B;
wdSlovenian = $00000424;
wdSomali = $00000477;
wdSorbian = $0000042E;
wdSpanishArgentina = $00002C0A;
wdSpanishBolivia = $0000400A;
wdSpanishChile = $0000340A;
wdSpanishColombia = $0000240A;
wdSpanishCostaRica = $0000140A;
wdSpanishDominicanRepublic = $00001C0A;
wdSpanishEcuador = $0000300A;
wdSpanishElSalvador = $0000440A;
wdSpanishGuatemala = $0000100A;
wdSpanishHonduras = $0000480A;
wdMexicanSpanish = $0000080A;
wdSpanishNicaragua = $00004C0A;
wdSpanishPanama = $0000180A;
wdSpanishParaguay = $00003C0A;
wdSpanishPeru = $0000280A;
wdSpanishPuertoRico = $0000500A;
wdSpanishModernSort = $00000C0A;
wdSpanish = $0000040A;
wdSpanishUruguay = $0000380A;
wdSpanishVenezuela = $0000200A;
wdSesotho = $00000430;
wdSutu = $00000430;
wdSwahili = $00000441;
wdSwedishFinland = $0000081D;
wdSwedish = $0000041D;
wdSyriac = $0000045A;
wdTajik = $00000428;
wdTamazight = $0000045F;
wdTamazightLatin = $0000085F;
wdTamil = $00000449;
wdTatar = $00000444;
wdTelugu = $0000044A;
wdThai = $0000041E;
wdTibetan = $00000451;
wdTigrignaEthiopic = $00000473;
wdTigrignaEritrea = $00000873;
wdTsonga = $00000431;
wdTswana = $00000432;
wdTurkish = $0000041F;
wdTurkmen = $00000442;
wdUkrainian = $00000422;
wdUrdu = $00000420;
wdUzbekCyrillic = $00000843;
wdUzbekLatin = $00000443;
wdVenda = $00000433;
wdVietnamese = $0000042A;
wdWelsh = $00000452;
wdXhosa = $00000434;
wdYi = $00000478;
wdYiddish = $0000043D;
wdYoruba = $0000046A;
wdZulu = $00000435;
// Constants for enum WdFieldType
const
wdFieldEmpty = $FFFFFFFF;
wdFieldRef = $00000003;
wdFieldIndexEntry = $00000004;
wdFieldFootnoteRef = $00000005;
wdFieldSet = $00000006;
wdFieldIf = $00000007;
wdFieldIndex = $00000008;
wdFieldTOCEntry = $00000009;
wdFieldStyleRef = $0000000A;
wdFieldRefDoc = $0000000B;
wdFieldSequence = $0000000C;
wdFieldTOC = $0000000D;
wdFieldInfo = $0000000E;
wdFieldTitle = $0000000F;
wdFieldSubject = $00000010;
wdFieldAuthor = $00000011;
wdFieldKeyWord = $00000012;
wdFieldComments = $00000013;
wdFieldLastSavedBy = $00000014;
wdFieldCreateDate = $00000015;
wdFieldSaveDate = $00000016;
wdFieldPrintDate = $00000017;
wdFieldRevisionNum = $00000018;
wdFieldEditTime = $00000019;
wdFieldNumPages = $0000001A;
wdFieldNumWords = $0000001B;
wdFieldNumChars = $0000001C;
wdFieldFileName = $0000001D;
wdFieldTemplate = $0000001E;
wdFieldDate = $0000001F;
wdFieldTime = $00000020;
wdFieldPage = $00000021;
wdFieldExpression = $00000022;
wdFieldQuote = $00000023;
wdFieldInclude = $00000024;
wdFieldPageRef = $00000025;
wdFieldAsk = $00000026;
wdFieldFillIn = $00000027;
wdFieldData = $00000028;
wdFieldNext = $00000029;
wdFieldNextIf = $0000002A;
wdFieldSkipIf = $0000002B;
wdFieldMergeRec = $0000002C;
wdFieldDDE = $0000002D;
wdFieldDDEAuto = $0000002E;
wdFieldGlossary = $0000002F;
wdFieldPrint = $00000030;
wdFieldFormula = $00000031;
wdFieldGoToButton = $00000032;
wdFieldMacroButton = $00000033;
wdFieldAutoNumOutline = $00000034;
wdFieldAutoNumLegal = $00000035;
wdFieldAutoNum = $00000036;
wdFieldImport = $00000037;
wdFieldLink = $00000038;
wdFieldSymbol = $00000039;
wdFieldEmbed = $0000003A;
wdFieldMergeField = $0000003B;
wdFieldUserName = $0000003C;
wdFieldUserInitials = $0000003D;
wdFieldUserAddress = $0000003E;
wdFieldBarCode = $0000003F;
wdFieldDocVariable = $00000040;
wdFieldSection = $00000041;
wdFieldSectionPages = $00000042;
wdFieldIncludePicture = $00000043;
wdFieldIncludeText = $00000044;
wdFieldFileSize = $00000045;
wdFieldFormTextInput = $00000046;
wdFieldFormCheckBox = $00000047;
wdFieldNoteRef = $00000048;
wdFieldTOA = $00000049;
wdFieldTOAEntry = $0000004A;
wdFieldMergeSeq = $0000004B;
wdFieldPrivate = $0000004D;
wdFieldDatabase = $0000004E;
wdFieldAutoText = $0000004F;
wdFieldCompare = $00000050;
wdFieldAddin = $00000051;
wdFieldSubscriber = $00000052;
wdFieldFormDropDown = $00000053;
wdFieldAdvance = $00000054;
wdFieldDocProperty = $00000055;
wdFieldOCX = $00000057;
wdFieldHyperlink = $00000058;
wdFieldAutoTextList = $00000059;
wdFieldListNum = $0000005A;
wdFieldHTMLActiveX = $0000005B;
wdFieldBidiOutline = $0000005C;
wdFieldAddressBlock = $0000005D;
wdFieldGreetingLine = $0000005E;
wdFieldShape = $0000005F;
wdFieldCitation = $00000060;
wdFieldBibliography = $00000061;
wdFieldMergeBarcode = $00000062;
wdFieldDisplayBarcode = $00000063;
// Constants for enum WdBuiltinStyle
const
wdStyleNormal = $FFFFFFFF;
wdStyleEnvelopeAddress = $FFFFFFDB;
wdStyleEnvelopeReturn = $FFFFFFDA;
wdStyleBodyText = $FFFFFFBD;
wdStyleHeading1 = $FFFFFFFE;
wdStyleHeading2 = $FFFFFFFD;
wdStyleHeading3 = $FFFFFFFC;
wdStyleHeading4 = $FFFFFFFB;
wdStyleHeading5 = $FFFFFFFA;
wdStyleHeading6 = $FFFFFFF9;
wdStyleHeading7 = $FFFFFFF8;
wdStyleHeading8 = $FFFFFFF7;
wdStyleHeading9 = $FFFFFFF6;
wdStyleIndex1 = $FFFFFFF5;
wdStyleIndex2 = $FFFFFFF4;
wdStyleIndex3 = $FFFFFFF3;
wdStyleIndex4 = $FFFFFFF2;
wdStyleIndex5 = $FFFFFFF1;
wdStyleIndex6 = $FFFFFFF0;
wdStyleIndex7 = $FFFFFFEF;
wdStyleIndex8 = $FFFFFFEE;
wdStyleIndex9 = $FFFFFFED;
wdStyleTOC1 = $FFFFFFEC;
wdStyleTOC2 = $FFFFFFEB;
wdStyleTOC3 = $FFFFFFEA;
wdStyleTOC4 = $FFFFFFE9;
wdStyleTOC5 = $FFFFFFE8;
wdStyleTOC6 = $FFFFFFE7;
wdStyleTOC7 = $FFFFFFE6;
wdStyleTOC8 = $FFFFFFE5;
wdStyleTOC9 = $FFFFFFE4;
wdStyleNormalIndent = $FFFFFFE3;
wdStyleFootnoteText = $FFFFFFE2;
wdStyleCommentText = $FFFFFFE1;
wdStyleHeader = $FFFFFFE0;
wdStyleFooter = $FFFFFFDF;
wdStyleIndexHeading = $FFFFFFDE;
wdStyleCaption = $FFFFFFDD;
wdStyleTableOfFigures = $FFFFFFDC;
wdStyleFootnoteReference = $FFFFFFD9;
wdStyleCommentReference = $FFFFFFD8;
wdStyleLineNumber = $FFFFFFD7;
wdStylePageNumber = $FFFFFFD6;
wdStyleEndnoteReference = $FFFFFFD5;
wdStyleEndnoteText = $FFFFFFD4;
wdStyleTableOfAuthorities = $FFFFFFD3;
wdStyleMacroText = $FFFFFFD2;
wdStyleTOAHeading = $FFFFFFD1;
wdStyleList = $FFFFFFD0;
wdStyleListBullet = $FFFFFFCF;
wdStyleListNumber = $FFFFFFCE;
wdStyleList2 = $FFFFFFCD;
wdStyleList3 = $FFFFFFCC;
wdStyleList4 = $FFFFFFCB;
wdStyleList5 = $FFFFFFCA;
wdStyleListBullet2 = $FFFFFFC9;
wdStyleListBullet3 = $FFFFFFC8;
wdStyleListBullet4 = $FFFFFFC7;
wdStyleListBullet5 = $FFFFFFC6;
wdStyleListNumber2 = $FFFFFFC5;
wdStyleListNumber3 = $FFFFFFC4;
wdStyleListNumber4 = $FFFFFFC3;
wdStyleListNumber5 = $FFFFFFC2;
wdStyleTitle = $FFFFFFC1;
wdStyleClosing = $FFFFFFC0;
wdStyleSignature = $FFFFFFBF;
wdStyleDefaultParagraphFont = $FFFFFFBE;
wdStyleBodyTextIndent = $FFFFFFBC;
wdStyleListContinue = $FFFFFFBB;
wdStyleListContinue2 = $FFFFFFBA;
wdStyleListContinue3 = $FFFFFFB9;
wdStyleListContinue4 = $FFFFFFB8;
wdStyleListContinue5 = $FFFFFFB7;
wdStyleMessageHeader = $FFFFFFB6;
wdStyleSubtitle = $FFFFFFB5;
wdStyleSalutation = $FFFFFFB4;
wdStyleDate = $FFFFFFB3;
wdStyleBodyTextFirstIndent = $FFFFFFB2;
wdStyleBodyTextFirstIndent2 = $FFFFFFB1;
wdStyleNoteHeading = $FFFFFFB0;
wdStyleBodyText2 = $FFFFFFAF;
wdStyleBodyText3 = $FFFFFFAE;
wdStyleBodyTextIndent2 = $FFFFFFAD;
wdStyleBodyTextIndent3 = $FFFFFFAC;
wdStyleBlockQuotation = $FFFFFFAB;
wdStyleHyperlink = $FFFFFFAA;
wdStyleHyperlinkFollowed = $FFFFFFA9;
wdStyleStrong = $FFFFFFA8;
wdStyleEmphasis = $FFFFFFA7;
wdStyleNavPane = $FFFFFFA6;
wdStylePlainText = $FFFFFFA5;
wdStyleHtmlNormal = $FFFFFFA1;
wdStyleHtmlAcronym = $FFFFFFA0;
wdStyleHtmlAddress = $FFFFFF9F;
wdStyleHtmlCite = $FFFFFF9E;
wdStyleHtmlCode = $FFFFFF9D;
wdStyleHtmlDfn = $FFFFFF9C;
wdStyleHtmlKbd = $FFFFFF9B;
wdStyleHtmlPre = $FFFFFF9A;
wdStyleHtmlSamp = $FFFFFF99;
wdStyleHtmlTt = $FFFFFF98;
wdStyleHtmlVar = $FFFFFF97;
wdStyleNormalTable = $FFFFFF96;
wdStyleNormalObject = $FFFFFF62;
wdStyleTableLightShading = $FFFFFF61;
wdStyleTableLightList = $FFFFFF60;
wdStyleTableLightGrid = $FFFFFF5F;
wdStyleTableMediumShading1 = $FFFFFF5E;
wdStyleTableMediumShading2 = $FFFFFF5D;
wdStyleTableMediumList1 = $FFFFFF5C;
wdStyleTableMediumList2 = $FFFFFF5B;
wdStyleTableMediumGrid1 = $FFFFFF5A;
wdStyleTableMediumGrid2 = $FFFFFF59;
wdStyleTableMediumGrid3 = $FFFFFF58;
wdStyleTableDarkList = $FFFFFF57;
wdStyleTableColorfulShading = $FFFFFF56;
wdStyleTableColorfulList = $FFFFFF55;
wdStyleTableColorfulGrid = $FFFFFF54;
wdStyleTableLightShadingAccent1 = $FFFFFF53;
wdStyleTableLightListAccent1 = $FFFFFF52;
wdStyleTableLightGridAccent1 = $FFFFFF51;
wdStyleTableMediumShading1Accent1 = $FFFFFF50;
wdStyleTableMediumShading2Accent1 = $FFFFFF4F;
wdStyleTableMediumList1Accent1 = $FFFFFF4E;
wdStyleListParagraph = $FFFFFF4C;
wdStyleQuote = $FFFFFF4B;
wdStyleIntenseQuote = $FFFFFF4A;
wdStyleSubtleEmphasis = $FFFFFEFB;
wdStyleIntenseEmphasis = $FFFFFEFA;
wdStyleSubtleReference = $FFFFFEF9;
wdStyleIntenseReference = $FFFFFEF8;
wdStyleBookTitle = $FFFFFEF7;
wdStyleBibliography = $FFFFFEF6;
wdStyleTocHeading = $FFFFFEF5;
// Constants for enum WdWordDialogTab
const
wdDialogToolsOptionsTabView = $000000CC;
wdDialogToolsOptionsTabGeneral = $000000CB;
wdDialogToolsOptionsTabEdit = $000000E0;
wdDialogToolsOptionsTabPrint = $000000D0;
wdDialogToolsOptionsTabSave = $000000D1;
wdDialogToolsOptionsTabProofread = $000000D3;
wdDialogToolsOptionsTabTrackChanges = $00000182;
wdDialogToolsOptionsTabUserInfo = $000000D5;
wdDialogToolsOptionsTabCompatibility = $0000020D;
wdDialogToolsOptionsTabTypography = $000002E3;
wdDialogToolsOptionsTabFileLocations = $000000E1;
wdDialogToolsOptionsTabFuzzy = $00000316;
wdDialogToolsOptionsTabHangulHanjaConversion = $00000312;
wdDialogToolsOptionsTabBidi = $00000405;
wdDialogToolsOptionsTabSecurity = $00000551;
wdDialogFilePageSetupTabMargins = $000249F0;
wdDialogFilePageSetupTabPaper = $000249F1;
wdDialogFilePageSetupTabLayout = $000249F3;
wdDialogFilePageSetupTabCharsLines = $000249F4;
wdDialogInsertSymbolTabSymbols = $00030D40;
wdDialogInsertSymbolTabSpecialCharacters = $00030D41;
wdDialogNoteOptionsTabAllFootnotes = $000493E0;
wdDialogNoteOptionsTabAllEndnotes = $000493E1;
wdDialogInsertIndexAndTablesTabIndex = $00061A80;
wdDialogInsertIndexAndTablesTabTableOfContents = $00061A81;
wdDialogInsertIndexAndTablesTabTableOfFigures = $00061A82;
wdDialogInsertIndexAndTablesTabTableOfAuthorities = $00061A83;
wdDialogOrganizerTabStyles = $0007A120;
wdDialogOrganizerTabAutoText = $0007A121;
wdDialogOrganizerTabCommandBars = $0007A122;
wdDialogOrganizerTabMacros = $0007A123;
wdDialogFormatFontTabFont = $000927C0;
wdDialogFormatFontTabCharacterSpacing = $000927C1;
wdDialogFormatFontTabAnimation = $000927C2;
wdDialogFormatBordersAndShadingTabBorders = $000AAE60;
wdDialogFormatBordersAndShadingTabPageBorder = $000AAE61;
wdDialogFormatBordersAndShadingTabShading = $000AAE62;
wdDialogToolsEnvelopesAndLabelsTabEnvelopes = $000C3500;
wdDialogToolsEnvelopesAndLabelsTabLabels = $000C3501;
wdDialogFormatParagraphTabIndentsAndSpacing = $000F4240;
wdDialogFormatParagraphTabTextFlow = $000F4241;
wdDialogFormatParagraphTabTeisai = $000F4242;
wdDialogFormatDrawingObjectTabColorsAndLines = $00124F80;
wdDialogFormatDrawingObjectTabSize = $00124F81;
wdDialogFormatDrawingObjectTabPosition = $00124F82;
wdDialogFormatDrawingObjectTabWrapping = $00124F83;
wdDialogFormatDrawingObjectTabPicture = $00124F84;
wdDialogFormatDrawingObjectTabTextbox = $00124F85;
wdDialogFormatDrawingObjectTabWeb = $00124F86;
wdDialogFormatDrawingObjectTabHR = $00124F87;
wdDialogToolsAutoCorrectExceptionsTabFirstLetter = $00155CC0;
wdDialogToolsAutoCorrectExceptionsTabInitialCaps = $00155CC1;
wdDialogToolsAutoCorrectExceptionsTabHangulAndAlphabet = $00155CC2;
wdDialogToolsAutoCorrectExceptionsTabIac = $00155CC3;
wdDialogFormatBulletsAndNumberingTabBulleted = $0016E360;
wdDialogFormatBulletsAndNumberingTabNumbered = $0016E361;
wdDialogFormatBulletsAndNumberingTabOutlineNumbered = $0016E362;
wdDialogLetterWizardTabLetterFormat = $00186A00;
wdDialogLetterWizardTabRecipientInfo = $00186A01;
wdDialogLetterWizardTabOtherElements = $00186A02;
wdDialogLetterWizardTabSenderInfo = $00186A03;
wdDialogToolsAutoManagerTabAutoCorrect = $0019F0A0;
wdDialogToolsAutoManagerTabAutoFormatAsYouType = $0019F0A1;
wdDialogToolsAutoManagerTabAutoText = $0019F0A2;
wdDialogToolsAutoManagerTabAutoFormat = $0019F0A3;
wdDialogToolsAutoManagerTabSmartTags = $0019F0A4;
wdDialogTablePropertiesTabTable = $001B7740;
wdDialogTablePropertiesTabRow = $001B7741;
wdDialogTablePropertiesTabColumn = $001B7742;
wdDialogTablePropertiesTabCell = $001B7743;
wdDialogEmailOptionsTabSignature = $001CFDE0;
wdDialogEmailOptionsTabStationary = $001CFDE1;
wdDialogEmailOptionsTabQuoting = $001CFDE2;
wdDialogWebOptionsBrowsers = $001E8480;
wdDialogWebOptionsGeneral = $001E8480;
wdDialogWebOptionsFiles = $001E8481;
wdDialogWebOptionsPictures = $001E8482;
wdDialogWebOptionsEncoding = $001E8483;
wdDialogWebOptionsFonts = $001E8484;
wdDialogToolsOptionsTabAcetate = $000004F2;
wdDialogTemplates = $00200B20;
wdDialogTemplatesXMLSchema = $00200B21;
wdDialogTemplatesXMLExpansionPacks = $00200B22;
wdDialogTemplatesLinkedCSS = $00200B23;
wdDialogStyleManagementTabEdit = $002191C0;
wdDialogStyleManagementTabRecommend = $002191C1;
wdDialogStyleManagementTabRestrict = $002191C2;
// Constants for enum WdWordDialogTabHID
const
wdDialogFilePageSetupTabPaperSize = $000249F1;
wdDialogFilePageSetupTabPaperSource = $000249F2;
// Constants for enum WdWordDialog
const
wdDialogHelpAbout = $00000009;
wdDialogHelpWordPerfectHelp = $0000000A;
wdDialogDocumentStatistics = $0000004E;
wdDialogFileNew = $0000004F;
wdDialogFileOpen = $00000050;
wdDialogMailMergeOpenDataSource = $00000051;
wdDialogMailMergeOpenHeaderSource = $00000052;
wdDialogFileSaveAs = $00000054;
wdDialogFileSummaryInfo = $00000056;
wdDialogToolsTemplates = $00000057;
wdDialogFilePrint = $00000058;
wdDialogFilePrintSetup = $00000061;
wdDialogFileFind = $00000063;
wdDialogFormatAddrFonts = $00000067;
wdDialogEditPasteSpecial = $0000006F;
wdDialogEditFind = $00000070;
wdDialogEditReplace = $00000075;
wdDialogEditStyle = $00000078;
wdDialogEditLinks = $0000007C;
wdDialogEditObject = $0000007D;
wdDialogTableToText = $00000080;
wdDialogTextToTable = $0000007F;
wdDialogTableInsertTable = $00000081;
wdDialogTableInsertCells = $00000082;
wdDialogTableInsertRow = $00000083;
wdDialogTableDeleteCells = $00000085;
wdDialogTableSplitCells = $00000089;
wdDialogTableRowHeight = $0000008E;
wdDialogTableColumnWidth = $0000008F;
wdDialogToolsCustomize = $00000098;
wdDialogInsertBreak = $0000009F;
wdDialogInsertSymbol = $000000A2;
wdDialogInsertPicture = $000000A3;
wdDialogInsertFile = $000000A4;
wdDialogInsertDateTime = $000000A5;
wdDialogInsertField = $000000A6;
wdDialogInsertMergeField = $000000A7;
wdDialogInsertBookmark = $000000A8;
wdDialogMarkIndexEntry = $000000A9;
wdDialogInsertIndex = $000000AA;
wdDialogInsertTableOfContents = $000000AB;
wdDialogInsertObject = $000000AC;
wdDialogToolsCreateEnvelope = $000000AD;
wdDialogFormatFont = $000000AE;
wdDialogFormatParagraph = $000000AF;
wdDialogFormatSectionLayout = $000000B0;
wdDialogFormatColumns = $000000B1;
wdDialogFileDocumentLayout = $000000B2;
wdDialogFilePageSetup = $000000B2;
wdDialogFormatTabs = $000000B3;
wdDialogFormatStyle = $000000B4;
wdDialogFormatDefineStyleFont = $000000B5;
wdDialogFormatDefineStylePara = $000000B6;
wdDialogFormatDefineStyleTabs = $000000B7;
wdDialogFormatDefineStyleFrame = $000000B8;
wdDialogFormatDefineStyleBorders = $000000B9;
wdDialogFormatDefineStyleLang = $000000BA;
wdDialogFormatPicture = $000000BB;
wdDialogToolsLanguage = $000000BC;
wdDialogFormatBordersAndShading = $000000BD;
wdDialogFormatFrame = $000000BE;
wdDialogToolsThesaurus = $000000C2;
wdDialogToolsHyphenation = $000000C3;
wdDialogToolsBulletsNumbers = $000000C4;
wdDialogToolsHighlightChanges = $000000C5;
wdDialogToolsRevisions = $000000C5;
wdDialogToolsCompareDocuments = $000000C6;
wdDialogTableSort = $000000C7;
wdDialogToolsOptionsGeneral = $000000CB;
wdDialogToolsOptionsView = $000000CC;
wdDialogToolsAdvancedSettings = $000000CE;
wdDialogToolsOptionsPrint = $000000D0;
wdDialogToolsOptionsSave = $000000D1;
wdDialogToolsOptionsSpellingAndGrammar = $000000D3;
wdDialogToolsOptionsUserInfo = $000000D5;
wdDialogToolsMacroRecord = $000000D6;
wdDialogToolsMacro = $000000D7;
wdDialogWindowActivate = $000000DC;
wdDialogFormatRetAddrFonts = $000000DD;
wdDialogOrganizer = $000000DE;
wdDialogToolsOptionsEdit = $000000E0;
wdDialogToolsOptionsFileLocations = $000000E1;
wdDialogToolsWordCount = $000000E4;
wdDialogControlRun = $000000EB;
wdDialogInsertPageNumbers = $00000126;
wdDialogFormatPageNumber = $0000012A;
wdDialogCopyFile = $0000012C;
wdDialogFormatChangeCase = $00000142;
wdDialogUpdateTOC = $0000014B;
wdDialogInsertDatabase = $00000155;
wdDialogTableFormula = $0000015C;
wdDialogFormFieldOptions = $00000161;
wdDialogInsertCaption = $00000165;
wdDialogInsertCaptionNumbering = $00000166;
wdDialogInsertAutoCaption = $00000167;
wdDialogFormFieldHelp = $00000169;
wdDialogInsertCrossReference = $0000016F;
wdDialogInsertFootnote = $00000172;
wdDialogNoteOptions = $00000175;
wdDialogToolsAutoCorrect = $0000017A;
wdDialogToolsOptionsTrackChanges = $00000182;
wdDialogConvertObject = $00000188;
wdDialogInsertAddCaption = $00000192;
wdDialogConnect = $000001A4;
wdDialogToolsCustomizeKeyboard = $000001B0;
wdDialogToolsCustomizeMenus = $000001B1;
wdDialogToolsMergeDocuments = $000001B3;
wdDialogMarkTableOfContentsEntry = $000001BA;
wdDialogFileMacPageSetupGX = $000001BC;
wdDialogFilePrintOneCopy = $000001BD;
wdDialogEditFrame = $000001CA;
wdDialogMarkCitation = $000001CF;
wdDialogTableOfContentsOptions = $000001D6;
wdDialogInsertTableOfAuthorities = $000001D7;
wdDialogInsertTableOfFigures = $000001D8;
wdDialogInsertIndexAndTables = $000001D9;
wdDialogInsertFormField = $000001E3;
wdDialogFormatDropCap = $000001E8;
wdDialogToolsCreateLabels = $000001E9;
wdDialogToolsProtectDocument = $000001F7;
wdDialogFormatStyleGallery = $000001F9;
wdDialogToolsAcceptRejectChanges = $000001FA;
wdDialogHelpWordPerfectHelpOptions = $000001FF;
wdDialogToolsUnprotectDocument = $00000209;
wdDialogToolsOptionsCompatibility = $0000020D;
wdDialogTableOfCaptionsOptions = $00000227;
wdDialogTableAutoFormat = $00000233;
wdDialogMailMergeFindRecord = $00000239;
wdDialogReviewAfmtRevisions = $0000023A;
wdDialogViewZoom = $00000241;
wdDialogToolsProtectSection = $00000242;
wdDialogFontSubstitution = $00000245;
wdDialogInsertSubdocument = $00000247;
wdDialogNewToolbar = $0000024A;
wdDialogToolsEnvelopesAndLabels = $0000025F;
wdDialogFormatCallout = $00000262;
wdDialogTableFormatCell = $00000264;
wdDialogToolsCustomizeMenuBar = $00000267;
wdDialogFileRoutingSlip = $00000270;
wdDialogEditTOACategory = $00000271;
wdDialogToolsManageFields = $00000277;
wdDialogDrawSnapToGrid = $00000279;
wdDialogDrawAlign = $0000027A;
wdDialogMailMergeCreateDataSource = $00000282;
wdDialogMailMergeCreateHeaderSource = $00000283;
wdDialogMailMerge = $000002A4;
wdDialogMailMergeCheck = $000002A5;
wdDialogMailMergeHelper = $000002A8;
wdDialogMailMergeQueryOptions = $000002A9;
wdDialogFileMacPageSetup = $000002AD;
wdDialogListCommands = $000002D3;
wdDialogEditCreatePublisher = $000002DC;
wdDialogEditSubscribeTo = $000002DD;
wdDialogEditPublishOptions = $000002DF;
wdDialogEditSubscribeOptions = $000002E0;
wdDialogFileMacCustomPageSetupGX = $000002E1;
wdDialogToolsOptionsTypography = $000002E3;
wdDialogToolsAutoCorrectExceptions = $000002FA;
wdDialogToolsOptionsAutoFormatAsYouType = $0000030A;
wdDialogMailMergeUseAddressBook = $0000030B;
wdDialogToolsHangulHanjaConversion = $00000310;
wdDialogToolsOptionsFuzzy = $00000316;
wdDialogEditGoToOld = $0000032B;
wdDialogInsertNumber = $0000032C;
wdDialogLetterWizard = $00000335;
wdDialogFormatBulletsAndNumbering = $00000338;
wdDialogToolsSpellingAndGrammar = $0000033C;
wdDialogToolsCreateDirectory = $00000341;
wdDialogTableWrapping = $00000356;
wdDialogFormatTheme = $00000357;
wdDialogTableProperties = $0000035D;
wdDialogEmailOptions = $0000035F;
wdDialogCreateAutoText = $00000368;
wdDialogToolsAutoSummarize = $0000036A;
wdDialogToolsGrammarSettings = $00000375;
wdDialogEditGoTo = $00000380;
wdDialogWebOptions = $00000382;
wdDialogInsertHyperlink = $0000039D;
wdDialogToolsAutoManager = $00000393;
wdDialogFileVersions = $000003B1;
wdDialogToolsOptionsAutoFormat = $000003BF;
wdDialogFormatDrawingObject = $000003C0;
wdDialogToolsOptions = $000003CE;
wdDialogFitText = $000003D7;
wdDialogEditAutoText = $000003D9;
wdDialogPhoneticGuide = $000003DA;
wdDialogToolsDictionary = $000003DD;
wdDialogFileSaveVersion = $000003EF;
wdDialogToolsOptionsBidi = $00000405;
wdDialogFrameSetProperties = $00000432;
wdDialogTableTableOptions = $00000438;
wdDialogTableCellOptions = $00000439;
wdDialogIMESetDefault = $00000446;
wdDialogTCSCTranslator = $00000484;
wdDialogHorizontalInVertical = $00000488;
wdDialogTwoLinesInOne = $00000489;
wdDialogFormatEncloseCharacters = $0000048A;
wdDialogConsistencyChecker = $00000461;
wdDialogToolsOptionsSmartTag = $00000573;
wdDialogFormatStylesCustom = $000004E0;
wdDialogCSSLinks = $000004ED;
wdDialogInsertWebComponent = $0000052C;
wdDialogToolsOptionsEditCopyPaste = $0000054C;
wdDialogToolsOptionsSecurity = $00000551;
wdDialogSearch = $00000553;
wdDialogShowRepairs = $00000565;
wdDialogMailMergeInsertAsk = $00000FCF;
wdDialogMailMergeInsertFillIn = $00000FD0;
wdDialogMailMergeInsertIf = $00000FD1;
wdDialogMailMergeInsertNextIf = $00000FD5;
wdDialogMailMergeInsertSet = $00000FD6;
wdDialogMailMergeInsertSkipIf = $00000FD7;
wdDialogMailMergeFieldMapping = $00000518;
wdDialogMailMergeInsertAddressBlock = $00000519;
wdDialogMailMergeInsertGreetingLine = $0000051A;
wdDialogMailMergeInsertFields = $0000051B;
wdDialogMailMergeRecipients = $0000051C;
wdDialogMailMergeFindRecipient = $0000052E;
wdDialogMailMergeSetDocumentType = $0000053B;
wdDialogLabelOptions = $00000557;
wdDialogXMLElementAttributes = $000005B4;
wdDialogSchemaLibrary = $00000589;
wdDialogPermission = $000005BD;
wdDialogMyPermission = $0000059D;
wdDialogXMLOptions = $00000591;
wdDialogFormattingRestrictions = $00000593;
wdDialogSourceManager = $00000780;
wdDialogCreateSource = $00000782;
wdDialogDocumentInspector = $000005CA;
wdDialogStyleManagement = $0000079C;
wdDialogInsertSource = $00000848;
wdDialogOMathRecognizedFunctions = $00000875;
wdDialogInsertPlaceholder = $0000092C;
wdDialogBuildingBlockOrganizer = $00000813;
wdDialogContentControlProperties = $0000095A;
wdDialogCompatibilityChecker = $00000987;
wdDialogExportAsFixedFormat = $0000092D;
wdDialogFileNew2007 = $0000045C;
// Constants for enum WdWordDialogHID
const
emptyenum___________ = $00000000;
// Constants for enum WdFieldKind
const
wdFieldKindNone = $00000000;
wdFieldKindHot = $00000001;
wdFieldKindWarm = $00000002;
wdFieldKindCold = $00000003;
// Constants for enum WdTextFormFieldType
const
wdRegularText = $00000000;
wdNumberText = $00000001;
wdDateText = $00000002;
wdCurrentDateText = $00000003;
wdCurrentTimeText = $00000004;
wdCalculationText = $00000005;
// Constants for enum WdChevronConvertRule
const
wdNeverConvert = $00000000;
wdAlwaysConvert = $00000001;
wdAskToNotConvert = $00000002;
wdAskToConvert = $00000003;
// Constants for enum WdMailMergeMainDocType
const
wdNotAMergeDocument = $FFFFFFFF;
wdFormLetters = $00000000;
wdMailingLabels = $00000001;
wdEnvelopes = $00000002;
wdCatalog = $00000003;
wdEMail = $00000004;
wdFax = $00000005;
wdDirectory = $00000003;
// Constants for enum WdMailMergeState
const
wdNormalDocument = $00000000;
wdMainDocumentOnly = $00000001;
wdMainAndDataSource = $00000002;
wdMainAndHeader = $00000003;
wdMainAndSourceAndHeader = $00000004;
wdDataSource = $00000005;
// Constants for enum WdMailMergeDestination
const
wdSendToNewDocument = $00000000;
wdSendToPrinter = $00000001;
wdSendToEmail = $00000002;
wdSendToFax = $00000003;
// Constants for enum WdMailMergeActiveRecord
const
wdNoActiveRecord = $FFFFFFFF;
wdNextRecord = $FFFFFFFE;
wdPreviousRecord = $FFFFFFFD;
wdFirstRecord = $FFFFFFFC;
wdLastRecord = $FFFFFFFB;
wdFirstDataSourceRecord = $FFFFFFFA;
wdLastDataSourceRecord = $FFFFFFF9;
wdNextDataSourceRecord = $FFFFFFF8;
wdPreviousDataSourceRecord = $FFFFFFF7;
// Constants for enum WdMailMergeDefaultRecord
const
wdDefaultFirstRecord = $00000001;
wdDefaultLastRecord = $FFFFFFF0;
// Constants for enum WdMailMergeDataSource
const
wdNoMergeInfo = $FFFFFFFF;
wdMergeInfoFromWord = $00000000;
wdMergeInfoFromAccessDDE = $00000001;
wdMergeInfoFromExcelDDE = $00000002;
wdMergeInfoFromMSQueryDDE = $00000003;
wdMergeInfoFromODBC = $00000004;
wdMergeInfoFromODSO = $00000005;
// Constants for enum WdMailMergeComparison
const
wdMergeIfEqual = $00000000;
wdMergeIfNotEqual = $00000001;
wdMergeIfLessThan = $00000002;
wdMergeIfGreaterThan = $00000003;
wdMergeIfLessThanOrEqual = $00000004;
wdMergeIfGreaterThanOrEqual = $00000005;
wdMergeIfIsBlank = $00000006;
wdMergeIfIsNotBlank = $00000007;
// Constants for enum WdBookmarkSortBy
const
wdSortByName = $00000000;
wdSortByLocation = $00000001;
// Constants for enum WdWindowState
const
wdWindowStateNormal = $00000000;
wdWindowStateMaximize = $00000001;
wdWindowStateMinimize = $00000002;
// Constants for enum WdPictureLinkType
const
wdLinkNone = $00000000;
wdLinkDataInDoc = $00000001;
wdLinkDataOnDisk = $00000002;
// Constants for enum WdLinkType
const
wdLinkTypeOLE = $00000000;
wdLinkTypePicture = $00000001;
wdLinkTypeText = $00000002;
wdLinkTypeReference = $00000003;
wdLinkTypeInclude = $00000004;
wdLinkTypeImport = $00000005;
wdLinkTypeDDE = $00000006;
wdLinkTypeDDEAuto = $00000007;
wdLinkTypeChart = $00000008;
// Constants for enum WdWindowType
const
wdWindowDocument = $00000000;
wdWindowTemplate = $00000001;
// Constants for enum WdViewType
const
wdNormalView = $00000001;
wdOutlineView = $00000002;
wdPrintView = $00000003;
wdPrintPreview = $00000004;
wdMasterView = $00000005;
wdWebView = $00000006;
wdReadingView = $00000007;
wdConflictView = $00000008;
// Constants for enum WdSeekView
const
wdSeekMainDocument = $00000000;
wdSeekPrimaryHeader = $00000001;
wdSeekFirstPageHeader = $00000002;
wdSeekEvenPagesHeader = $00000003;
wdSeekPrimaryFooter = $00000004;
wdSeekFirstPageFooter = $00000005;
wdSeekEvenPagesFooter = $00000006;
wdSeekFootnotes = $00000007;
wdSeekEndnotes = $00000008;
wdSeekCurrentPageHeader = $00000009;
wdSeekCurrentPageFooter = $0000000A;
// Constants for enum WdSpecialPane
const
wdPaneNone = $00000000;
wdPanePrimaryHeader = $00000001;
wdPaneFirstPageHeader = $00000002;
wdPaneEvenPagesHeader = $00000003;
wdPanePrimaryFooter = $00000004;
wdPaneFirstPageFooter = $00000005;
wdPaneEvenPagesFooter = $00000006;
wdPaneFootnotes = $00000007;
wdPaneEndnotes = $00000008;
wdPaneFootnoteContinuationNotice = $00000009;
wdPaneFootnoteContinuationSeparator = $0000000A;
wdPaneFootnoteSeparator = $0000000B;
wdPaneEndnoteContinuationNotice = $0000000C;
wdPaneEndnoteContinuationSeparator = $0000000D;
wdPaneEndnoteSeparator = $0000000E;
wdPaneComments = $0000000F;
wdPaneCurrentPageHeader = $00000010;
wdPaneCurrentPageFooter = $00000011;
wdPaneRevisions = $00000012;
wdPaneRevisionsHoriz = $00000013;
wdPaneRevisionsVert = $00000014;
// Constants for enum WdPageFit
const
wdPageFitNone = $00000000;
wdPageFitFullPage = $00000001;
wdPageFitBestFit = $00000002;
wdPageFitTextFit = $00000003;
// Constants for enum WdBrowseTarget
const
wdBrowsePage = $00000001;
wdBrowseSection = $00000002;
wdBrowseComment = $00000003;
wdBrowseFootnote = $00000004;
wdBrowseEndnote = $00000005;
wdBrowseField = $00000006;
wdBrowseTable = $00000007;
wdBrowseGraphic = $00000008;
wdBrowseHeading = $00000009;
wdBrowseEdit = $0000000A;
wdBrowseFind = $0000000B;
wdBrowseGoTo = $0000000C;
// Constants for enum WdPaperTray
const
wdPrinterDefaultBin = $00000000;
wdPrinterUpperBin = $00000001;
wdPrinterOnlyBin = $00000001;
wdPrinterLowerBin = $00000002;
wdPrinterMiddleBin = $00000003;
wdPrinterManualFeed = $00000004;
wdPrinterEnvelopeFeed = $00000005;
wdPrinterManualEnvelopeFeed = $00000006;
wdPrinterAutomaticSheetFeed = $00000007;
wdPrinterTractorFeed = $00000008;
wdPrinterSmallFormatBin = $00000009;
wdPrinterLargeFormatBin = $0000000A;
wdPrinterLargeCapacityBin = $0000000B;
wdPrinterPaperCassette = $0000000E;
wdPrinterFormSource = $0000000F;
// Constants for enum WdOrientation
const
wdOrientPortrait = $00000000;
wdOrientLandscape = $00000001;
// Constants for enum WdSelectionType
const
wdNoSelection = $00000000;
wdSelectionIP = $00000001;
wdSelectionNormal = $00000002;
wdSelectionFrame = $00000003;
wdSelectionColumn = $00000004;
wdSelectionRow = $00000005;
wdSelectionBlock = $00000006;
wdSelectionInlineShape = $00000007;
wdSelectionShape = $00000008;
// Constants for enum WdCaptionLabelID
const
wdCaptionFigure = $FFFFFFFF;
wdCaptionTable = $FFFFFFFE;
wdCaptionEquation = $FFFFFFFD;
// Constants for enum WdReferenceType
const
wdRefTypeNumberedItem = $00000000;
wdRefTypeHeading = $00000001;
wdRefTypeBookmark = $00000002;
wdRefTypeFootnote = $00000003;
wdRefTypeEndnote = $00000004;
// Constants for enum WdReferenceKind
const
wdContentText = $FFFFFFFF;
wdNumberRelativeContext = $FFFFFFFE;
wdNumberNoContext = $FFFFFFFD;
wdNumberFullContext = $FFFFFFFC;
wdEntireCaption = $00000002;
wdOnlyLabelAndNumber = $00000003;
wdOnlyCaptionText = $00000004;
wdFootnoteNumber = $00000005;
wdEndnoteNumber = $00000006;
wdPageNumber = $00000007;
wdPosition = $0000000F;
wdFootnoteNumberFormatted = $00000010;
wdEndnoteNumberFormatted = $00000011;
// Constants for enum WdIndexFormat
const
wdIndexTemplate = $00000000;
wdIndexClassic = $00000001;
wdIndexFancy = $00000002;
wdIndexModern = $00000003;
wdIndexBulleted = $00000004;
wdIndexFormal = $00000005;
wdIndexSimple = $00000006;
// Constants for enum WdIndexType
const
wdIndexIndent = $00000000;
wdIndexRunin = $00000001;
// Constants for enum WdRevisionsWrap
const
wdWrapNever = $00000000;
wdWrapAlways = $00000001;
wdWrapAsk = $00000002;
// Constants for enum WdRevisionType
const
wdNoRevision = $00000000;
wdRevisionInsert = $00000001;
wdRevisionDelete = $00000002;
wdRevisionProperty = $00000003;
wdRevisionParagraphNumber = $00000004;
wdRevisionDisplayField = $00000005;
wdRevisionReconcile = $00000006;
wdRevisionConflict = $00000007;
wdRevisionStyle = $00000008;
wdRevisionReplace = $00000009;
wdRevisionParagraphProperty = $0000000A;
wdRevisionTableProperty = $0000000B;
wdRevisionSectionProperty = $0000000C;
wdRevisionStyleDefinition = $0000000D;
wdRevisionMovedFrom = $0000000E;
wdRevisionMovedTo = $0000000F;
wdRevisionCellInsertion = $00000010;
wdRevisionCellDeletion = $00000011;
wdRevisionCellMerge = $00000012;
wdRevisionCellSplit = $00000013;
wdRevisionConflictInsert = $00000014;
wdRevisionConflictDelete = $00000015;
// Constants for enum WdRoutingSlipDelivery
const
wdOneAfterAnother = $00000000;
wdAllAtOnce = $00000001;
// Constants for enum WdRoutingSlipStatus
const
wdNotYetRouted = $00000000;
wdRouteInProgress = $00000001;
wdRouteComplete = $00000002;
// Constants for enum WdSectionStart
const
wdSectionContinuous = $00000000;
wdSectionNewColumn = $00000001;
wdSectionNewPage = $00000002;
wdSectionEvenPage = $00000003;
wdSectionOddPage = $00000004;
// Constants for enum WdSaveOptions
const
wdDoNotSaveChanges = $00000000;
wdSaveChanges = $FFFFFFFF;
wdPromptToSaveChanges = $FFFFFFFE;
// Constants for enum WdDocumentKind
const
wdDocumentNotSpecified = $00000000;
wdDocumentLetter = $00000001;
wdDocumentEmail = $00000002;
// Constants for enum WdDocumentType
const
wdTypeDocument = $00000000;
wdTypeTemplate = $00000001;
wdTypeFrameset = $00000002;
// Constants for enum WdOriginalFormat
const
wdWordDocument = $00000000;
wdOriginalDocumentFormat = $00000001;
wdPromptUser = $00000002;
// Constants for enum WdRelocate
const
wdRelocateUp = $00000000;
wdRelocateDown = $00000001;
// Constants for enum WdInsertedTextMark
const
wdInsertedTextMarkNone = $00000000;
wdInsertedTextMarkBold = $00000001;
wdInsertedTextMarkItalic = $00000002;
wdInsertedTextMarkUnderline = $00000003;
wdInsertedTextMarkDoubleUnderline = $00000004;
wdInsertedTextMarkColorOnly = $00000005;
wdInsertedTextMarkStrikeThrough = $00000006;
wdInsertedTextMarkDoubleStrikeThrough = $00000007;
// Constants for enum WdRevisedLinesMark
const
wdRevisedLinesMarkNone = $00000000;
wdRevisedLinesMarkLeftBorder = $00000001;
wdRevisedLinesMarkRightBorder = $00000002;
wdRevisedLinesMarkOutsideBorder = $00000003;
// Constants for enum WdDeletedTextMark
const
wdDeletedTextMarkHidden = $00000000;
wdDeletedTextMarkStrikeThrough = $00000001;
wdDeletedTextMarkCaret = $00000002;
wdDeletedTextMarkPound = $00000003;
wdDeletedTextMarkNone = $00000004;
wdDeletedTextMarkBold = $00000005;
wdDeletedTextMarkItalic = $00000006;
wdDeletedTextMarkUnderline = $00000007;
wdDeletedTextMarkDoubleUnderline = $00000008;
wdDeletedTextMarkColorOnly = $00000009;
wdDeletedTextMarkDoubleStrikeThrough = $0000000A;
// Constants for enum WdRevisedPropertiesMark
const
wdRevisedPropertiesMarkNone = $00000000;
wdRevisedPropertiesMarkBold = $00000001;
wdRevisedPropertiesMarkItalic = $00000002;
wdRevisedPropertiesMarkUnderline = $00000003;
wdRevisedPropertiesMarkDoubleUnderline = $00000004;
wdRevisedPropertiesMarkColorOnly = $00000005;
wdRevisedPropertiesMarkStrikeThrough = $00000006;
wdRevisedPropertiesMarkDoubleStrikeThrough = $00000007;
// Constants for enum WdFieldShading
const
wdFieldShadingNever = $00000000;
wdFieldShadingAlways = $00000001;
wdFieldShadingWhenSelected = $00000002;
// Constants for enum WdDefaultFilePath
const
wdDocumentsPath = $00000000;
wdPicturesPath = $00000001;
wdUserTemplatesPath = $00000002;
wdWorkgroupTemplatesPath = $00000003;
wdUserOptionsPath = $00000004;
wdAutoRecoverPath = $00000005;
wdToolsPath = $00000006;
wdTutorialPath = $00000007;
wdStartupPath = $00000008;
wdProgramPath = $00000009;
wdGraphicsFiltersPath = $0000000A;
wdTextConvertersPath = $0000000B;
wdProofingToolsPath = $0000000C;
wdTempFilePath = $0000000D;
wdCurrentFolderPath = $0000000E;
wdStyleGalleryPath = $0000000F;
wdBorderArtPath = $00000013;
// Constants for enum WdCompatibility
const
wdNoTabHangIndent = $00000001;
wdNoSpaceRaiseLower = $00000002;
wdPrintColBlack = $00000003;
wdWrapTrailSpaces = $00000004;
wdNoColumnBalance = $00000005;
wdConvMailMergeEsc = $00000006;
wdSuppressSpBfAfterPgBrk = $00000007;
wdSuppressTopSpacing = $00000008;
wdOrigWordTableRules = $00000009;
wdTransparentMetafiles = $0000000A;
wdShowBreaksInFrames = $0000000B;
wdSwapBordersFacingPages = $0000000C;
wdLeaveBackslashAlone = $0000000D;
wdExpandShiftReturn = $0000000E;
wdDontULTrailSpace = $0000000F;
wdDontBalanceSingleByteDoubleByteWidth = $00000010;
wdSuppressTopSpacingMac5 = $00000011;
wdSpacingInWholePoints = $00000012;
wdPrintBodyTextBeforeHeader = $00000013;
wdNoLeading = $00000014;
wdNoSpaceForUL = $00000015;
wdMWSmallCaps = $00000016;
wdNoExtraLineSpacing = $00000017;
wdTruncateFontHeight = $00000018;
wdSubFontBySize = $00000019;
wdUsePrinterMetrics = $0000001A;
wdWW6BorderRules = $0000001B;
wdExactOnTop = $0000001C;
wdSuppressBottomSpacing = $0000001D;
wdWPSpaceWidth = $0000001E;
wdWPJustification = $0000001F;
wdLineWrapLikeWord6 = $00000020;
wdShapeLayoutLikeWW8 = $00000021;
wdFootnoteLayoutLikeWW8 = $00000022;
wdDontUseHTMLParagraphAutoSpacing = $00000023;
wdDontAdjustLineHeightInTable = $00000024;
wdForgetLastTabAlignment = $00000025;
wdAutospaceLikeWW7 = $00000026;
wdAlignTablesRowByRow = $00000027;
wdLayoutRawTableWidth = $00000028;
wdLayoutTableRowsApart = $00000029;
wdUseWord97LineBreakingRules = $0000002A;
wdDontBreakWrappedTables = $0000002B;
wdDontSnapTextToGridInTableWithObjects = $0000002C;
wdSelectFieldWithFirstOrLastCharacter = $0000002D;
wdApplyBreakingRules = $0000002E;
wdDontWrapTextWithPunctuation = $0000002F;
wdDontUseAsianBreakRulesInGrid = $00000030;
wdUseWord2002TableStyleRules = $00000031;
wdGrowAutofit = $00000032;
wdUseNormalStyleForList = $00000033;
wdDontUseIndentAsNumberingTabStop = $00000034;
wdFELineBreak11 = $00000035;
wdAllowSpaceOfSameStyleInTable = $00000036;
wdWW11IndentRules = $00000037;
wdDontAutofitConstrainedTables = $00000038;
wdAutofitLikeWW11 = $00000039;
wdUnderlineTabInNumList = $0000003A;
wdHangulWidthLikeWW11 = $0000003B;
wdSplitPgBreakAndParaMark = $0000003C;
wdDontVertAlignCellWithShape = $0000003D;
wdDontBreakConstrainedForcedTables = $0000003E;
wdDontVertAlignInTextbox = $0000003F;
wdWord11KerningPairs = $00000040;
wdCachedColBalance = $00000041;
wdDisableOTKerning = $00000042;
wdFlipMirrorIndents = $00000043;
wdDontOverrideTableStyleFontSzAndJustification = $00000044;
wdUseWord2010TableStyleRules = $00000045;
wdDelayableFloatingTable = $00000046;
wdAllowHyphenationAtTrackBottom = $00000047;
wdUseWord2013TrackBottomHyphenation = $00000048;
wdUsePre2018iOSMacLayout = $00000049;
// Constants for enum WdPaperSize
const
wdPaper10x14 = $00000000;
wdPaper11x17 = $00000001;
wdPaperLetter = $00000002;
wdPaperLetterSmall = $00000003;
wdPaperLegal = $00000004;
wdPaperExecutive = $00000005;
wdPaperA3 = $00000006;
wdPaperA4 = $00000007;
wdPaperA4Small = $00000008;
wdPaperA5 = $00000009;
wdPaperB4 = $0000000A;
wdPaperB5 = $0000000B;
wdPaperCSheet = $0000000C;
wdPaperDSheet = $0000000D;
wdPaperESheet = $0000000E;
wdPaperFanfoldLegalGerman = $0000000F;
wdPaperFanfoldStdGerman = $00000010;
wdPaperFanfoldUS = $00000011;
wdPaperFolio = $00000012;
wdPaperLedger = $00000013;
wdPaperNote = $00000014;
wdPaperQuarto = $00000015;
wdPaperStatement = $00000016;
wdPaperTabloid = $00000017;
wdPaperEnvelope9 = $00000018;
wdPaperEnvelope10 = $00000019;
wdPaperEnvelope11 = $0000001A;
wdPaperEnvelope12 = $0000001B;
wdPaperEnvelope14 = $0000001C;
wdPaperEnvelopeB4 = $0000001D;
wdPaperEnvelopeB5 = $0000001E;
wdPaperEnvelopeB6 = $0000001F;
wdPaperEnvelopeC3 = $00000020;
wdPaperEnvelopeC4 = $00000021;
wdPaperEnvelopeC5 = $00000022;
wdPaperEnvelopeC6 = $00000023;
wdPaperEnvelopeC65 = $00000024;
wdPaperEnvelopeDL = $00000025;
wdPaperEnvelopeItaly = $00000026;
wdPaperEnvelopeMonarch = $00000027;
wdPaperEnvelopePersonal = $00000028;
wdPaperCustom = $00000029;
// Constants for enum WdCustomLabelPageSize
const
wdCustomLabelLetter = $00000000;
wdCustomLabelLetterLS = $00000001;
wdCustomLabelA4 = $00000002;
wdCustomLabelA4LS = $00000003;
wdCustomLabelA5 = $00000004;
wdCustomLabelA5LS = $00000005;
wdCustomLabelB5 = $00000006;
wdCustomLabelMini = $00000007;
wdCustomLabelFanfold = $00000008;
wdCustomLabelVertHalfSheet = $00000009;
wdCustomLabelVertHalfSheetLS = $0000000A;
wdCustomLabelHigaki = $0000000B;
wdCustomLabelHigakiLS = $0000000C;
wdCustomLabelB4JIS = $0000000D;
// Constants for enum WdProtectionType
const
wdNoProtection = $FFFFFFFF;
wdAllowOnlyRevisions = $00000000;
wdAllowOnlyComments = $00000001;
wdAllowOnlyFormFields = $00000002;
wdAllowOnlyReading = $00000003;
// Constants for enum WdPartOfSpeech
const
wdAdjective = $00000000;
wdNoun = $00000001;
wdAdverb = $00000002;
wdVerb = $00000003;
wdPronoun = $00000004;
wdConjunction = $00000005;
wdPreposition = $00000006;
wdInterjection = $00000007;
wdIdiom = $00000008;
wdOther = $00000009;
// Constants for enum WdSubscriberFormats
const
wdSubscriberBestFormat = $00000000;
wdSubscriberRTF = $00000001;
wdSubscriberText = $00000002;
wdSubscriberPict = $00000004;
// Constants for enum WdEditionType
const
wdPublisher = $00000000;
wdSubscriber = $00000001;
// Constants for enum WdEditionOption
const
wdCancelPublisher = $00000000;
wdSendPublisher = $00000001;
wdSelectPublisher = $00000002;
wdAutomaticUpdate = $00000003;
wdManualUpdate = $00000004;
wdChangeAttributes = $00000005;
wdUpdateSubscriber = $00000006;
wdOpenSource = $00000007;
// Constants for enum WdRelativeHorizontalPosition
const
wdRelativeHorizontalPositionMargin = $00000000;
wdRelativeHorizontalPositionPage = $00000001;
wdRelativeHorizontalPositionColumn = $00000002;
wdRelativeHorizontalPositionCharacter = $00000003;
wdRelativeHorizontalPositionLeftMarginArea = $00000004;
wdRelativeHorizontalPositionRightMarginArea = $00000005;
wdRelativeHorizontalPositionInnerMarginArea = $00000006;
wdRelativeHorizontalPositionOuterMarginArea = $00000007;
// Constants for enum WdRelativeVerticalPosition
const
wdRelativeVerticalPositionMargin = $00000000;
wdRelativeVerticalPositionPage = $00000001;
wdRelativeVerticalPositionParagraph = $00000002;
wdRelativeVerticalPositionLine = $00000003;
wdRelativeVerticalPositionTopMarginArea = $00000004;
wdRelativeVerticalPositionBottomMarginArea = $00000005;
wdRelativeVerticalPositionInnerMarginArea = $00000006;
wdRelativeVerticalPositionOuterMarginArea = $00000007;
// Constants for enum WdHelpType
const
wdHelp = $00000000;
wdHelpAbout = $00000001;
wdHelpActiveWindow = $00000002;
wdHelpContents = $00000003;
wdHelpExamplesAndDemos = $00000004;
wdHelpIndex = $00000005;
wdHelpKeyboard = $00000006;
wdHelpPSSHelp = $00000007;
wdHelpQuickPreview = $00000008;
wdHelpSearch = $00000009;
wdHelpUsingHelp = $0000000A;
wdHelpIchitaro = $0000000B;
wdHelpPE2 = $0000000C;
wdHelpHWP = $0000000D;
// Constants for enum WdHelpTypeHID
const
emptyenum____________ = $00000000;
// Constants for enum WdKeyCategory
const
wdKeyCategoryNil = $FFFFFFFF;
wdKeyCategoryDisable = $00000000;
wdKeyCategoryCommand = $00000001;
wdKeyCategoryMacro = $00000002;
wdKeyCategoryFont = $00000003;
wdKeyCategoryAutoText = $00000004;
wdKeyCategoryStyle = $00000005;
wdKeyCategorySymbol = $00000006;
wdKeyCategoryPrefix = $00000007;
// Constants for enum WdKey
const
wdNoKey = $000000FF;
wdKeyShift = $00000100;
wdKeyControl = $00000200;
wdKeyCommand = $00000200;
wdKeyAlt = $00000400;
wdKeyOption = $00000400;
wdKeyA = $00000041;
wdKeyB = $00000042;
wdKeyC = $00000043;
wdKeyD = $00000044;
wdKeyE = $00000045;
wdKeyF = $00000046;
wdKeyG = $00000047;
wdKeyH = $00000048;
wdKeyI = $00000049;
wdKeyJ = $0000004A;
wdKeyK = $0000004B;
wdKeyL = $0000004C;
wdKeyM = $0000004D;
wdKeyN = $0000004E;
wdKeyO = $0000004F;
wdKeyP = $00000050;
wdKeyQ = $00000051;
wdKeyR = $00000052;
wdKeyS = $00000053;
wdKeyT = $00000054;
wdKeyU = $00000055;
wdKeyV = $00000056;
wdKeyW = $00000057;
wdKeyX = $00000058;
wdKeyY = $00000059;
wdKeyZ = $0000005A;
wdKey0 = $00000030;
wdKey1 = $00000031;
wdKey2 = $00000032;
wdKey3 = $00000033;
wdKey4 = $00000034;
wdKey5 = $00000035;
wdKey6 = $00000036;
wdKey7 = $00000037;
wdKey8 = $00000038;
wdKey9 = $00000039;
wdKeyBackspace = $00000008;
wdKeyTab = $00000009;
wdKeyNumeric5Special = $0000000C;
wdKeyReturn = $0000000D;
wdKeyPause = $00000013;
wdKeyEsc = $0000001B;
wdKeySpacebar = $00000020;
wdKeyPageUp = $00000021;
wdKeyPageDown = $00000022;
wdKeyEnd = $00000023;
wdKeyHome = $00000024;
wdKeyInsert = $0000002D;
wdKeyDelete = $0000002E;
wdKeyNumeric0 = $00000060;
wdKeyNumeric1 = $00000061;
wdKeyNumeric2 = $00000062;
wdKeyNumeric3 = $00000063;
wdKeyNumeric4 = $00000064;
wdKeyNumeric5 = $00000065;
wdKeyNumeric6 = $00000066;
wdKeyNumeric7 = $00000067;
wdKeyNumeric8 = $00000068;
wdKeyNumeric9 = $00000069;
wdKeyNumericMultiply = $0000006A;
wdKeyNumericAdd = $0000006B;
wdKeyNumericSubtract = $0000006D;
wdKeyNumericDecimal = $0000006E;
wdKeyNumericDivide = $0000006F;
wdKeyF1 = $00000070;
wdKeyF2 = $00000071;
wdKeyF3 = $00000072;
wdKeyF4 = $00000073;
wdKeyF5 = $00000074;
wdKeyF6 = $00000075;
wdKeyF7 = $00000076;
wdKeyF8 = $00000077;
wdKeyF9 = $00000078;
wdKeyF10 = $00000079;
wdKeyF11 = $0000007A;
wdKeyF12 = $0000007B;
wdKeyF13 = $0000007C;
wdKeyF14 = $0000007D;
wdKeyF15 = $0000007E;
wdKeyF16 = $0000007F;
wdKeyScrollLock = $00000091;
wdKeySemiColon = $000000BA;
wdKeyEquals = $000000BB;
wdKeyComma = $000000BC;
wdKeyHyphen = $000000BD;
wdKeyPeriod = $000000BE;
wdKeySlash = $000000BF;
wdKeyBackSingleQuote = $000000C0;
wdKeyOpenSquareBrace = $000000DB;
wdKeyBackSlash = $000000DC;
wdKeyCloseSquareBrace = $000000DD;
wdKeySingleQuote = $000000DE;
// Constants for enum WdOLEType
const
wdOLELink = $00000000;
wdOLEEmbed = $00000001;
wdOLEControl = $00000002;
// Constants for enum WdOLEVerb
const
wdOLEVerbPrimary = $00000000;
wdOLEVerbShow = $FFFFFFFF;
wdOLEVerbOpen = $FFFFFFFE;
wdOLEVerbHide = $FFFFFFFD;
wdOLEVerbUIActivate = $FFFFFFFC;
wdOLEVerbInPlaceActivate = $FFFFFFFB;
wdOLEVerbDiscardUndoState = $FFFFFFFA;
// Constants for enum WdOLEPlacement
const
wdInLine = $00000000;
wdFloatOverText = $00000001;
// Constants for enum WdEnvelopeOrientation
const
wdLeftPortrait = $00000000;
wdCenterPortrait = $00000001;
wdRightPortrait = $00000002;
wdLeftLandscape = $00000003;
wdCenterLandscape = $00000004;
wdRightLandscape = $00000005;
wdLeftClockwise = $00000006;
wdCenterClockwise = $00000007;
wdRightClockwise = $00000008;
// Constants for enum WdLetterStyle
const
wdFullBlock = $00000000;
wdModifiedBlock = $00000001;
wdSemiBlock = $00000002;
// Constants for enum WdLetterheadLocation
const
wdLetterTop = $00000000;
wdLetterBottom = $00000001;
wdLetterLeft = $00000002;
wdLetterRight = $00000003;
// Constants for enum WdSalutationType
const
wdSalutationInformal = $00000000;
wdSalutationFormal = $00000001;
wdSalutationBusiness = $00000002;
wdSalutationOther = $00000003;
// Constants for enum WdSalutationGender
const
wdGenderFemale = $00000000;
wdGenderMale = $00000001;
wdGenderNeutral = $00000002;
wdGenderUnknown = $00000003;
// Constants for enum WdMovementType
const
wdMove = $00000000;
wdExtend = $00000001;
// Constants for enum WdConstants
const
wdUndefined = $0098967F;
wdToggle = $0098967E;
wdForward = $3FFFFFFF;
wdBackward = $C0000001;
wdAutoPosition = $00000000;
wdFirst = $00000001;
wdCreatorCode = $4D535744;
// Constants for enum WdPasteDataType
const
wdPasteOLEObject = $00000000;
wdPasteRTF = $00000001;
wdPasteText = $00000002;
wdPasteMetafilePicture = $00000003;
wdPasteBitmap = $00000004;
wdPasteDeviceIndependentBitmap = $00000005;
wdPasteHyperlink = $00000007;
wdPasteShape = $00000008;
wdPasteEnhancedMetafile = $00000009;
wdPasteHTML = $0000000A;
// Constants for enum WdPrintOutItem
const
wdPrintDocumentContent = $00000000;
wdPrintProperties = $00000001;
wdPrintComments = $00000002;
wdPrintMarkup = $00000002;
wdPrintStyles = $00000003;
wdPrintAutoTextEntries = $00000004;
wdPrintKeyAssignments = $00000005;
wdPrintEnvelope = $00000006;
wdPrintDocumentWithMarkup = $00000007;
// Constants for enum WdPrintOutPages
const
wdPrintAllPages = $00000000;
wdPrintOddPagesOnly = $00000001;
wdPrintEvenPagesOnly = $00000002;
// Constants for enum WdPrintOutRange
const
wdPrintAllDocument = $00000000;
wdPrintSelection = $00000001;
wdPrintCurrentPage = $00000002;
wdPrintFromTo = $00000003;
wdPrintRangeOfPages = $00000004;
// Constants for enum WdDictionaryType
const
wdSpelling = $00000000;
wdGrammar = $00000001;
wdThesaurus = $00000002;
wdHyphenation = $00000003;
wdSpellingComplete = $00000004;
wdSpellingCustom = $00000005;
wdSpellingLegal = $00000006;
wdSpellingMedical = $00000007;
wdHangulHanjaConversion = $00000008;
wdHangulHanjaConversionCustom = $00000009;
// Constants for enum WdDictionaryTypeHID
const
emptyenum_____________ = $00000000;
// Constants for enum WdSpellingWordType
const
wdSpellword = $00000000;
wdWildcard = $00000001;
wdAnagram = $00000002;
// Constants for enum WdSpellingErrorType
const
wdSpellingCorrect = $00000000;
wdSpellingNotInDictionary = $00000001;
wdSpellingCapitalization = $00000002;
// Constants for enum WdProofreadingErrorType
const
wdSpellingError = $00000000;
wdGrammaticalError = $00000001;
// Constants for enum WdInlineShapeType
const
wdInlineShapeEmbeddedOLEObject = $00000001;
wdInlineShapeLinkedOLEObject = $00000002;
wdInlineShapePicture = $00000003;
wdInlineShapeLinkedPicture = $00000004;
wdInlineShapeOLEControlObject = $00000005;
wdInlineShapeHorizontalLine = $00000006;
wdInlineShapePictureHorizontalLine = $00000007;
wdInlineShapeLinkedPictureHorizontalLine = $00000008;
wdInlineShapePictureBullet = $00000009;
wdInlineShapeScriptAnchor = $0000000A;
wdInlineShapeOWSAnchor = $0000000B;
wdInlineShapeChart = $0000000C;
wdInlineShapeDiagram = $0000000D;
wdInlineShapeLockedCanvas = $0000000E;
wdInlineShapeSmartArt = $0000000F;
wdInlineShapeWebVideo = $00000010;
wdInlineShapeGraphic = $00000011;
wdInlineShapeLinkedGraphic = $00000012;
wdInlineShape3DModel = $00000013;
wdInlineShapeLinked3DModel = $00000014;
// Constants for enum WdArrangeStyle
const
wdTiled = $00000000;
wdIcons = $00000001;
// Constants for enum WdSelectionFlags
const
wdSelStartActive = $00000001;
// Constants for enum WdAutoVersions
const
wdAutoVersionOff = $00000000;
wdAutoVersionOnClose = $00000001;
// Constants for enum WdOrganizerObject
const
wdOrganizerObjectStyles = $00000000;
wdOrganizerObjectAutoText = $00000001;
wdOrganizerObjectCommandBars = $00000002;
wdOrganizerObjectProjectItems = $00000003;
// Constants for enum WdFindMatch
const
wdMatchParagraphMark = $0001000F;
wdMatchTabCharacter = $00000009;
wdMatchCommentMark = $00000005;
wdMatchAnyCharacter = $0001003F;
wdMatchAnyDigit = $0001001F;
wdMatchAnyLetter = $0001002F;
wdMatchCaretCharacter = $0000000B;
wdMatchColumnBreak = $0000000E;
wdMatchEmDash = $00002014;
wdMatchEnDash = $00002013;
wdMatchEndnoteMark = $00010013;
wdMatchField = $00000013;
wdMatchFootnoteMark = $00010012;
wdMatchGraphic = $00000001;
wdMatchManualLineBreak = $0001000F;
wdMatchManualPageBreak = $0001001C;
wdMatchNonbreakingHyphen = $0000001E;
wdMatchNonbreakingSpace = $000000A0;
wdMatchOptionalHyphen = $0000001F;
wdMatchSectionBreak = $0001002C;
wdMatchWhiteSpace = $00010077;
// Constants for enum WdFindWrap
const
wdFindStop = $00000000;
wdFindContinue = $00000001;
wdFindAsk = $00000002;
// Constants for enum WdInformation
const
wdActiveEndAdjustedPageNumber = $00000001;
wdActiveEndSectionNumber = $00000002;
wdActiveEndPageNumber = $00000003;
wdNumberOfPagesInDocument = $00000004;
wdHorizontalPositionRelativeToPage = $00000005;
wdVerticalPositionRelativeToPage = $00000006;
wdHorizontalPositionRelativeToTextBoundary = $00000007;
wdVerticalPositionRelativeToTextBoundary = $00000008;
wdFirstCharacterColumnNumber = $00000009;
wdFirstCharacterLineNumber = $0000000A;
wdFrameIsSelected = $0000000B;
wdWithInTable = $0000000C;
wdStartOfRangeRowNumber = $0000000D;
wdEndOfRangeRowNumber = $0000000E;
wdMaximumNumberOfRows = $0000000F;
wdStartOfRangeColumnNumber = $00000010;
wdEndOfRangeColumnNumber = $00000011;
wdMaximumNumberOfColumns = $00000012;
wdZoomPercentage = $00000013;
wdSelectionMode = $00000014;
wdCapsLock = $00000015;
wdNumLock = $00000016;
wdOverType = $00000017;
wdRevisionMarking = $00000018;
wdInFootnoteEndnotePane = $00000019;
wdInCommentPane = $0000001A;
wdInHeaderFooter = $0000001C;
wdAtEndOfRowMarker = $0000001F;
wdReferenceOfType = $00000020;
wdHeaderFooterType = $00000021;
wdInMasterDocument = $00000022;
wdInFootnote = $00000023;
wdInEndnote = $00000024;
wdInWordMail = $00000025;
wdInClipboard = $00000026;
wdInCoverPage = $00000029;
wdInBibliography = $0000002A;
wdInCitation = $0000002B;
wdInFieldCode = $0000002C;
wdInFieldResult = $0000002D;
wdInContentControl = $0000002E;
// Constants for enum WdWrapType
const
wdWrapSquare = $00000000;
wdWrapTight = $00000001;
wdWrapThrough = $00000002;
wdWrapNone = $00000003;
wdWrapTopBottom = $00000004;
wdWrapBehind = $00000005;
wdWrapFront = $00000003;
wdWrapInline = $00000007;
// Constants for enum WdWrapSideType
const
wdWrapBoth = $00000000;
wdWrapLeft = $00000001;
wdWrapRight = $00000002;
wdWrapLargest = $00000003;
// Constants for enum WdOutlineLevel
const
wdOutlineLevel1 = $00000001;
wdOutlineLevel2 = $00000002;
wdOutlineLevel3 = $00000003;
wdOutlineLevel4 = $00000004;
wdOutlineLevel5 = $00000005;
wdOutlineLevel6 = $00000006;
wdOutlineLevel7 = $00000007;
wdOutlineLevel8 = $00000008;
wdOutlineLevel9 = $00000009;
wdOutlineLevelBodyText = $0000000A;
// Constants for enum WdTextOrientation
const
wdTextOrientationHorizontal = $00000000;
wdTextOrientationUpward = $00000002;
wdTextOrientationDownward = $00000003;
wdTextOrientationVerticalFarEast = $00000001;
wdTextOrientationHorizontalRotatedFarEast = $00000004;
wdTextOrientationVertical = $00000005;
// Constants for enum WdTextOrientationHID
const
emptyenum______________ = $00000000;
// Constants for enum WdPageBorderArt
const
wdArtApples = $00000001;
wdArtMapleMuffins = $00000002;
wdArtCakeSlice = $00000003;
wdArtCandyCorn = $00000004;
wdArtIceCreamCones = $00000005;
wdArtChampagneBottle = $00000006;
wdArtPartyGlass = $00000007;
wdArtChristmasTree = $00000008;
wdArtTrees = $00000009;
wdArtPalmsColor = $0000000A;
wdArtBalloons3Colors = $0000000B;
wdArtBalloonsHotAir = $0000000C;
wdArtPartyFavor = $0000000D;
wdArtConfettiStreamers = $0000000E;
wdArtHearts = $0000000F;
wdArtHeartBalloon = $00000010;
wdArtStars3D = $00000011;
wdArtStarsShadowed = $00000012;
wdArtStars = $00000013;
wdArtSun = $00000014;
wdArtEarth2 = $00000015;
wdArtEarth1 = $00000016;
wdArtPeopleHats = $00000017;
wdArtSombrero = $00000018;
wdArtPencils = $00000019;
wdArtPackages = $0000001A;
wdArtClocks = $0000001B;
wdArtFirecrackers = $0000001C;
wdArtRings = $0000001D;
wdArtMapPins = $0000001E;
wdArtConfetti = $0000001F;
wdArtCreaturesButterfly = $00000020;
wdArtCreaturesLadyBug = $00000021;
wdArtCreaturesFish = $00000022;
wdArtBirdsFlight = $00000023;
wdArtScaredCat = $00000024;
wdArtBats = $00000025;
wdArtFlowersRoses = $00000026;
wdArtFlowersRedRose = $00000027;
wdArtPoinsettias = $00000028;
wdArtHolly = $00000029;
wdArtFlowersTiny = $0000002A;
wdArtFlowersPansy = $0000002B;
wdArtFlowersModern2 = $0000002C;
wdArtFlowersModern1 = $0000002D;
wdArtWhiteFlowers = $0000002E;
wdArtVine = $0000002F;
wdArtFlowersDaisies = $00000030;
wdArtFlowersBlockPrint = $00000031;
wdArtDecoArchColor = $00000032;
wdArtFans = $00000033;
wdArtFilm = $00000034;
wdArtLightning1 = $00000035;
wdArtCompass = $00000036;
wdArtDoubleD = $00000037;
wdArtClassicalWave = $00000038;
wdArtShadowedSquares = $00000039;
wdArtTwistedLines1 = $0000003A;
wdArtWaveline = $0000003B;
wdArtQuadrants = $0000003C;
wdArtCheckedBarColor = $0000003D;
wdArtSwirligig = $0000003E;
wdArtPushPinNote1 = $0000003F;
wdArtPushPinNote2 = $00000040;
wdArtPumpkin1 = $00000041;
wdArtEggsBlack = $00000042;
wdArtCup = $00000043;
wdArtHeartGray = $00000044;
wdArtGingerbreadMan = $00000045;
wdArtBabyPacifier = $00000046;
wdArtBabyRattle = $00000047;
wdArtCabins = $00000048;
wdArtHouseFunky = $00000049;
wdArtStarsBlack = $0000004A;
wdArtSnowflakes = $0000004B;
wdArtSnowflakeFancy = $0000004C;
wdArtSkyrocket = $0000004D;
wdArtSeattle = $0000004E;
wdArtMusicNotes = $0000004F;
wdArtPalmsBlack = $00000050;
wdArtMapleLeaf = $00000051;
wdArtPaperClips = $00000052;
wdArtShorebirdTracks = $00000053;
wdArtPeople = $00000054;
wdArtPeopleWaving = $00000055;
wdArtEclipsingSquares2 = $00000056;
wdArtHypnotic = $00000057;
wdArtDiamondsGray = $00000058;
wdArtDecoArch = $00000059;
wdArtDecoBlocks = $0000005A;
wdArtCirclesLines = $0000005B;
wdArtPapyrus = $0000005C;
wdArtWoodwork = $0000005D;
wdArtWeavingBraid = $0000005E;
wdArtWeavingRibbon = $0000005F;
wdArtWeavingAngles = $00000060;
wdArtArchedScallops = $00000061;
wdArtSafari = $00000062;
wdArtCelticKnotwork = $00000063;
wdArtCrazyMaze = $00000064;
wdArtEclipsingSquares1 = $00000065;
wdArtBirds = $00000066;
wdArtFlowersTeacup = $00000067;
wdArtNorthwest = $00000068;
wdArtSouthwest = $00000069;
wdArtTribal6 = $0000006A;
wdArtTribal4 = $0000006B;
wdArtTribal3 = $0000006C;
wdArtTribal2 = $0000006D;
wdArtTribal5 = $0000006E;
wdArtXIllusions = $0000006F;
wdArtZanyTriangles = $00000070;
wdArtPyramids = $00000071;
wdArtPyramidsAbove = $00000072;
wdArtConfettiGrays = $00000073;
wdArtConfettiOutline = $00000074;
wdArtConfettiWhite = $00000075;
wdArtMosaic = $00000076;
wdArtLightning2 = $00000077;
wdArtHeebieJeebies = $00000078;
wdArtLightBulb = $00000079;
wdArtGradient = $0000007A;
wdArtTriangleParty = $0000007B;
wdArtTwistedLines2 = $0000007C;
wdArtMoons = $0000007D;
wdArtOvals = $0000007E;
wdArtDoubleDiamonds = $0000007F;
wdArtChainLink = $00000080;
wdArtTriangles = $00000081;
wdArtTribal1 = $00000082;
wdArtMarqueeToothed = $00000083;
wdArtSharksTeeth = $00000084;
wdArtSawtooth = $00000085;
wdArtSawtoothGray = $00000086;
wdArtPostageStamp = $00000087;
wdArtWeavingStrips = $00000088;
wdArtZigZag = $00000089;
wdArtCrossStitch = $0000008A;
wdArtGems = $0000008B;
wdArtCirclesRectangles = $0000008C;
wdArtCornerTriangles = $0000008D;
wdArtCreaturesInsects = $0000008E;
wdArtZigZagStitch = $0000008F;
wdArtCheckered = $00000090;
wdArtCheckedBarBlack = $00000091;
wdArtMarquee = $00000092;
wdArtBasicWhiteDots = $00000093;
wdArtBasicWideMidline = $00000094;
wdArtBasicWideOutline = $00000095;
wdArtBasicWideInline = $00000096;
wdArtBasicThinLines = $00000097;
wdArtBasicWhiteDashes = $00000098;
wdArtBasicWhiteSquares = $00000099;
wdArtBasicBlackSquares = $0000009A;
wdArtBasicBlackDashes = $0000009B;
wdArtBasicBlackDots = $0000009C;
wdArtStarsTop = $0000009D;
wdArtCertificateBanner = $0000009E;
wdArtHandmade1 = $0000009F;
wdArtHandmade2 = $000000A0;
wdArtTornPaper = $000000A1;
wdArtTornPaperBlack = $000000A2;
wdArtCouponCutoutDashes = $000000A3;
wdArtCouponCutoutDots = $000000A4;
// Constants for enum WdBorderDistanceFrom
const
wdBorderDistanceFromText = $00000000;
wdBorderDistanceFromPageEdge = $00000001;
// Constants for enum WdReplace
const
wdReplaceNone = $00000000;
wdReplaceOne = $00000001;
wdReplaceAll = $00000002;
// Constants for enum WdFontBias
const
wdFontBiasDontCare = $000000FF;
wdFontBiasDefault = $00000000;
wdFontBiasFareast = $00000001;
// Constants for enum WdBrowserLevel
const
wdBrowserLevelV4 = $00000000;
wdBrowserLevelMicrosoftInternetExplorer5 = $00000001;
wdBrowserLevelMicrosoftInternetExplorer6 = $00000002;
// Constants for enum WdEnclosureType
const
wdEnclosureCircle = $00000000;
wdEnclosureSquare = $00000001;
wdEnclosureTriangle = $00000002;
wdEnclosureDiamond = $00000003;
// Constants for enum WdEncloseStyle
const
wdEncloseStyleNone = $00000000;
wdEncloseStyleSmall = $00000001;
wdEncloseStyleLarge = $00000002;
// Constants for enum WdHighAnsiText
const
wdHighAnsiIsFarEast = $00000000;
wdHighAnsiIsHighAnsi = $00000001;
wdAutoDetectHighAnsiFarEast = $00000002;
// Constants for enum WdLayoutMode
const
wdLayoutModeDefault = $00000000;
wdLayoutModeGrid = $00000001;
wdLayoutModeLineGrid = $00000002;
wdLayoutModeGenko = $00000003;
// Constants for enum WdDocumentMedium
const
wdEmailMessage = $00000000;
wdDocument = $00000001;
wdWebPage = $00000002;
// Constants for enum WdMailerPriority
const
wdPriorityNormal = $00000001;
wdPriorityLow = $00000002;
wdPriorityHigh = $00000003;
// Constants for enum WdDocumentViewDirection
const
wdDocumentViewRtl = $00000000;
wdDocumentViewLtr = $00000001;
// Constants for enum WdArabicNumeral
const
wdNumeralArabic = $00000000;
wdNumeralHindi = $00000001;
wdNumeralContext = $00000002;
wdNumeralSystem = $00000003;
// Constants for enum WdMonthNames
const
wdMonthNamesArabic = $00000000;
wdMonthNamesEnglish = $00000001;
wdMonthNamesFrench = $00000002;
// Constants for enum WdCursorMovement
const
wdCursorMovementLogical = $00000000;
wdCursorMovementVisual = $00000001;
// Constants for enum WdVisualSelection
const
wdVisualSelectionBlock = $00000000;
wdVisualSelectionContinuous = $00000001;
// Constants for enum WdTableDirection
const
wdTableDirectionRtl = $00000000;
wdTableDirectionLtr = $00000001;
// Constants for enum WdFlowDirection
const
wdFlowLtr = $00000000;
wdFlowRtl = $00000001;
// Constants for enum WdDiacriticColor
const
wdDiacriticColorBidi = $00000000;
wdDiacriticColorLatin = $00000001;
// Constants for enum WdGutterStyle
const
wdGutterPosLeft = $00000000;
wdGutterPosTop = $00000001;
wdGutterPosRight = $00000002;
// Constants for enum WdGutterStyleOld
const
wdGutterStyleLatin = $FFFFFFF6;
wdGutterStyleBidi = $00000002;
// Constants for enum WdSectionDirection
const
wdSectionDirectionRtl = $00000000;
wdSectionDirectionLtr = $00000001;
// Constants for enum WdDateLanguage
const
wdDateLanguageBidi = $0000000A;
wdDateLanguageLatin = $00000409;
// Constants for enum WdCalendarTypeBi
const
wdCalendarTypeBidi = $00000063;
wdCalendarTypeGregorian = $00000064;
// Constants for enum WdCalendarType
const
wdCalendarWestern = $00000000;
wdCalendarArabic = $00000001;
wdCalendarHebrew = $00000002;
wdCalendarTaiwan = $00000003;
wdCalendarJapan = $00000004;
wdCalendarThai = $00000005;
wdCalendarKorean = $00000006;
wdCalendarSakaEra = $00000007;
wdCalendarTranslitEnglish = $00000008;
wdCalendarTranslitFrench = $00000009;
wdCalendarUmalqura = $0000000D;
// Constants for enum WdReadingOrder
const
wdReadingOrderRtl = $00000000;
wdReadingOrderLtr = $00000001;
// Constants for enum WdHebSpellStart
const
wdFullScript = $00000000;
wdPartialScript = $00000001;
wdMixedScript = $00000002;
wdMixedAuthorizedScript = $00000003;
// Constants for enum WdAraSpeller
const
wdNone = $00000000;
wdInitialAlef = $00000001;
wdFinalYaa = $00000002;
wdBoth = $00000003;
// Constants for enum WdColor
const
wdColorAutomatic = $FF000000;
wdColorBlack = $00000000;
wdColorBlue = $00FF0000;
wdColorTurquoise = $00FFFF00;
wdColorBrightGreen = $0000FF00;
wdColorPink = $00FF00FF;
wdColorRed = $000000FF;
wdColorYellow = $0000FFFF;
wdColorWhite = $00FFFFFF;
wdColorDarkBlue = $00800000;
wdColorTeal = $00808000;
wdColorGreen = $00008000;
wdColorViolet = $00800080;
wdColorDarkRed = $00000080;
wdColorDarkYellow = $00008080;
wdColorBrown = $00003399;
wdColorOliveGreen = $00003333;
wdColorDarkGreen = $00003300;
wdColorDarkTeal = $00663300;
wdColorIndigo = $00993333;
wdColorOrange = $000066FF;
wdColorBlueGray = $00996666;
wdColorLightOrange = $000099FF;
wdColorLime = $0000CC99;
wdColorSeaGreen = $00669933;
wdColorAqua = $00CCCC33;
wdColorLightBlue = $00FF6633;
wdColorGold = $0000CCFF;
wdColorSkyBlue = $00FFCC00;
wdColorPlum = $00663399;
wdColorRose = $00CC99FF;
wdColorTan = $0099CCFF;
wdColorLightYellow = $0099FFFF;
wdColorLightGreen = $00CCFFCC;
wdColorLightTurquoise = $00FFFFCC;
wdColorPaleBlue = $00FFCC99;
wdColorLavender = $00FF99CC;
wdColorGray05 = $00F3F3F3;
wdColorGray10 = $00E6E6E6;
wdColorGray125 = $00E0E0E0;
wdColorGray15 = $00D9D9D9;
wdColorGray20 = $00CCCCCC;
wdColorGray25 = $00C0C0C0;
wdColorGray30 = $00B3B3B3;
wdColorGray35 = $00A6A6A6;
wdColorGray375 = $00A0A0A0;
wdColorGray40 = $00999999;
wdColorGray45 = $008C8C8C;
wdColorGray50 = $00808080;
wdColorGray55 = $00737373;
wdColorGray60 = $00666666;
wdColorGray625 = $00606060;
wdColorGray65 = $00595959;
wdColorGray70 = $004C4C4C;
wdColorGray75 = $00404040;
wdColorGray80 = $00333333;
wdColorGray85 = $00262626;
wdColorGray875 = $00202020;
wdColorGray90 = $00191919;
wdColorGray95 = $000C0C0C;
// Constants for enum WdShapePosition
const
wdShapeTop = $FFF0BDC1;
wdShapeLeft = $FFF0BDC2;
wdShapeBottom = $FFF0BDC3;
wdShapeRight = $FFF0BDC4;
wdShapeCenter = $FFF0BDC5;
wdShapeInside = $FFF0BDC6;
wdShapeOutside = $FFF0BDC7;
// Constants for enum WdTablePosition
const
wdTableTop = $FFF0BDC1;
wdTableLeft = $FFF0BDC2;
wdTableBottom = $FFF0BDC3;
wdTableRight = $FFF0BDC4;
wdTableCenter = $FFF0BDC5;
wdTableInside = $FFF0BDC6;
wdTableOutside = $FFF0BDC7;
// Constants for enum WdDefaultListBehavior
const
wdWord8ListBehavior = $00000000;
wdWord9ListBehavior = $00000001;
wdWord10ListBehavior = $00000002;
// Constants for enum WdDefaultTableBehavior
const
wdWord8TableBehavior = $00000000;
wdWord9TableBehavior = $00000001;
// Constants for enum WdAutoFitBehavior
const
wdAutoFitFixed = $00000000;
wdAutoFitContent = $00000001;
wdAutoFitWindow = $00000002;
// Constants for enum WdPreferredWidthType
const
wdPreferredWidthAuto = $00000001;
wdPreferredWidthPercent = $00000002;
wdPreferredWidthPoints = $00000003;
// Constants for enum WdFarEastLineBreakLanguageID
const
wdLineBreakJapanese = $00000411;
wdLineBreakKorean = $00000412;
wdLineBreakSimplifiedChinese = $00000804;
wdLineBreakTraditionalChinese = $00000404;
// Constants for enum WdViewTypeOld
const
wdPageView = $00000003;
wdOnlineView = $00000006;
// Constants for enum WdFramesetType
const
wdFramesetTypeFrameset = $00000000;
wdFramesetTypeFrame = $00000001;
// Constants for enum WdFramesetSizeType
const
wdFramesetSizeTypePercent = $00000000;
wdFramesetSizeTypeFixed = $00000001;
wdFramesetSizeTypeRelative = $00000002;
// Constants for enum WdFramesetNewFrameLocation
const
wdFramesetNewFrameAbove = $00000000;
wdFramesetNewFrameBelow = $00000001;
wdFramesetNewFrameRight = $00000002;
wdFramesetNewFrameLeft = $00000003;
// Constants for enum WdScrollbarType
const
wdScrollbarTypeAuto = $00000000;
wdScrollbarTypeYes = $00000001;
wdScrollbarTypeNo = $00000002;
// Constants for enum WdTwoLinesInOneType
const
wdTwoLinesInOneNone = $00000000;
wdTwoLinesInOneNoBrackets = $00000001;
wdTwoLinesInOneParentheses = $00000002;
wdTwoLinesInOneSquareBrackets = $00000003;
wdTwoLinesInOneAngleBrackets = $00000004;
wdTwoLinesInOneCurlyBrackets = $00000005;
// Constants for enum WdHorizontalInVerticalType
const
wdHorizontalInVerticalNone = $00000000;
wdHorizontalInVerticalFitInLine = $00000001;
wdHorizontalInVerticalResizeLine = $00000002;
// Constants for enum WdHorizontalLineAlignment
const
wdHorizontalLineAlignLeft = $00000000;
wdHorizontalLineAlignCenter = $00000001;
wdHorizontalLineAlignRight = $00000002;
// Constants for enum WdHorizontalLineWidthType
const
wdHorizontalLinePercentWidth = $FFFFFFFF;
wdHorizontalLineFixedWidth = $FFFFFFFE;
// Constants for enum WdPhoneticGuideAlignmentType
const
wdPhoneticGuideAlignmentCenter = $00000000;
wdPhoneticGuideAlignmentZeroOneZero = $00000001;
wdPhoneticGuideAlignmentOneTwoOne = $00000002;
wdPhoneticGuideAlignmentLeft = $00000003;
wdPhoneticGuideAlignmentRight = $00000004;
wdPhoneticGuideAlignmentRightVertical = $00000005;
// Constants for enum WdNewDocumentType
const
wdNewBlankDocument = $00000000;
wdNewWebPage = $00000001;
wdNewEmailMessage = $00000002;
wdNewFrameset = $00000003;
wdNewXMLDocument = $00000004;
// Constants for enum WdKana
const
wdKanaKatakana = $00000008;
wdKanaHiragana = $00000009;
// Constants for enum WdCharacterWidth
const
wdWidthHalfWidth = $00000006;
wdWidthFullWidth = $00000007;
// Constants for enum WdNumberStyleWordBasicBiDi
const
wdListNumberStyleBidi1 = $00000031;
wdListNumberStyleBidi2 = $00000032;
wdCaptionNumberStyleBidiLetter1 = $00000031;
wdCaptionNumberStyleBidiLetter2 = $00000032;
wdNoteNumberStyleBidiLetter1 = $00000031;
wdNoteNumberStyleBidiLetter2 = $00000032;
wdPageNumberStyleBidiLetter1 = $00000031;
wdPageNumberStyleBidiLetter2 = $00000032;
// Constants for enum WdTCSCConverterDirection
const
wdTCSCConverterDirectionSCTC = $00000000;
wdTCSCConverterDirectionTCSC = $00000001;
wdTCSCConverterDirectionAuto = $00000002;
// Constants for enum WdDisableFeaturesIntroducedAfter
const
wd70 = $00000000;
wd70FE = $00000001;
wd80 = $00000002;
// Constants for enum WdWrapTypeMerged
const
wdWrapMergeInline = $00000000;
wdWrapMergeSquare = $00000001;
wdWrapMergeTight = $00000002;
wdWrapMergeBehind = $00000003;
wdWrapMergeFront = $00000004;
wdWrapMergeThrough = $00000005;
wdWrapMergeTopBottom = $00000006;
// Constants for enum WdRecoveryType
const
wdPasteDefault = $00000000;
wdSingleCellText = $00000005;
wdSingleCellTable = $00000006;
wdListContinueNumbering = $00000007;
wdListRestartNumbering = $00000008;
wdTableInsertAsRows = $0000000B;
wdTableAppendTable = $0000000A;
wdTableOriginalFormatting = $0000000C;
wdChartPicture = $0000000D;
wdChart = $0000000E;
wdChartLinked = $0000000F;
wdFormatOriginalFormatting = $00000010;
wdFormatSurroundingFormattingWithEmphasis = $00000014;
wdFormatPlainText = $00000016;
wdTableOverwriteCells = $00000017;
wdListCombineWithExistingList = $00000018;
wdListDontMerge = $00000019;
wdUseDestinationStylesRecovery = $00000013;
// Constants for enum WdLineEndingType
const
wdCRLF = $00000000;
wdCROnly = $00000001;
wdLFOnly = $00000002;
wdLFCR = $00000003;
wdLSPS = $00000004;
// Constants for enum WdStyleSheetLinkType
const
wdStyleSheetLinkTypeLinked = $00000000;
wdStyleSheetLinkTypeImported = $00000001;
// Constants for enum WdStyleSheetPrecedence
const
wdStyleSheetPrecedenceHigher = $FFFFFFFF;
wdStyleSheetPrecedenceLower = $FFFFFFFE;
wdStyleSheetPrecedenceHighest = $00000001;
wdStyleSheetPrecedenceLowest = $00000000;
// Constants for enum WdEmailHTMLFidelity
const
wdEmailHTMLFidelityLow = $00000001;
wdEmailHTMLFidelityMedium = $00000002;
wdEmailHTMLFidelityHigh = $00000003;
// Constants for enum WdMailMergeMailFormat
const
wdMailFormatPlainText = $00000000;
wdMailFormatHTML = $00000001;
// Constants for enum WdMappedDataFields
const
wdUniqueIdentifier = $00000001;
wdCourtesyTitle = $00000002;
wdFirstName = $00000003;
wdMiddleName = $00000004;
wdLastName = $00000005;
wdSuffix = $00000006;
wdNickname = $00000007;
wdJobTitle = $00000008;
wdCompany = $00000009;
wdAddress1 = $0000000A;
wdAddress2 = $0000000B;
wdCity = $0000000C;
wdState = $0000000D;
wdPostalCode = $0000000E;
wdCountryRegion = $0000000F;
wdBusinessPhone = $00000010;
wdBusinessFax = $00000011;
wdHomePhone = $00000012;
wdHomeFax = $00000013;
wdEmailAddress = $00000014;
wdWebPageURL = $00000015;
wdSpouseCourtesyTitle = $00000016;
wdSpouseFirstName = $00000017;
wdSpouseMiddleName = $00000018;
wdSpouseLastName = $00000019;
wdSpouseNickname = $0000001A;
wdRubyFirstName = $0000001B;
wdRubyLastName = $0000001C;
wdAddress3 = $0000001D;
wdDepartment = $0000001E;
// Constants for enum WdConditionCode
const
wdFirstRow = $00000000;
wdLastRow = $00000001;
wdOddRowBanding = $00000002;
wdEvenRowBanding = $00000003;
wdFirstColumn = $00000004;
wdLastColumn = $00000005;
wdOddColumnBanding = $00000006;
wdEvenColumnBanding = $00000007;
wdNECell = $00000008;
wdNWCell = $00000009;
wdSECell = $0000000A;
wdSWCell = $0000000B;
// Constants for enum WdCompareTarget
const
wdCompareTargetSelected = $00000000;
wdCompareTargetCurrent = $00000001;
wdCompareTargetNew = $00000002;
// Constants for enum WdMergeTarget
const
wdMergeTargetSelected = $00000000;
wdMergeTargetCurrent = $00000001;
wdMergeTargetNew = $00000002;
// Constants for enum WdUseFormattingFrom
const
wdFormattingFromCurrent = $00000000;
wdFormattingFromSelected = $00000001;
wdFormattingFromPrompt = $00000002;
// Constants for enum WdRevisionsView
const
wdRevisionsViewFinal = $00000000;
wdRevisionsViewOriginal = $00000001;
// Constants for enum WdRevisionsMode
const
wdBalloonRevisions = $00000000;
wdInLineRevisions = $00000001;
wdMixedRevisions = $00000002;
// Constants for enum WdRevisionsBalloonWidthType
const
wdBalloonWidthPercent = $00000000;
wdBalloonWidthPoints = $00000001;
// Constants for enum WdRevisionsBalloonPrintOrientation
const
wdBalloonPrintOrientationAuto = $00000000;
wdBalloonPrintOrientationPreserve = $00000001;
wdBalloonPrintOrientationForceLandscape = $00000002;
// Constants for enum WdRevisionsBalloonMargin
const
wdLeftMargin = $00000000;
wdRightMargin = $00000001;
// Constants for enum WdTaskPanes
const
wdTaskPaneFormatting = $00000000;
wdTaskPaneRevealFormatting = $00000001;
wdTaskPaneMailMerge = $00000002;
wdTaskPaneTranslate = $00000003;
wdTaskPaneSearch = $00000004;
wdTaskPaneXMLStructure = $00000005;
wdTaskPaneDocumentProtection = $00000006;
wdTaskPaneDocumentActions = $00000007;
wdTaskPaneSharedWorkspace = $00000008;
wdTaskPaneHelp = $00000009;
wdTaskPaneResearch = $0000000A;
wdTaskPaneFaxService = $0000000B;
wdTaskPaneXMLDocument = $0000000C;
wdTaskPaneDocumentUpdates = $0000000D;
wdTaskPaneSignature = $0000000E;
wdTaskPaneStyleInspector = $0000000F;
wdTaskPaneDocumentManagement = $00000010;
wdTaskPaneApplyStyles = $00000011;
wdTaskPaneNav = $00000012;
wdTaskPaneSelection = $00000013;
wdTaskPaneProofing = $00000014;
wdTaskPaneXMLMapping = $00000015;
wdTaskPaneRevPaneFlex = $00000016;
wdTaskPaneThesaurus = $00000017;
// Constants for enum WdShowFilter
const
wdShowFilterStylesAvailable = $00000000;
wdShowFilterStylesInUse = $00000001;
wdShowFilterStylesAll = $00000002;
wdShowFilterFormattingInUse = $00000003;
wdShowFilterFormattingAvailable = $00000004;
wdShowFilterFormattingRecommended = $00000005;
// Constants for enum WdMergeSubType
const
wdMergeSubTypeOther = $00000000;
wdMergeSubTypeAccess = $00000001;
wdMergeSubTypeOAL = $00000002;
wdMergeSubTypeOLEDBWord = $00000003;
wdMergeSubTypeWorks = $00000004;
wdMergeSubTypeOLEDBText = $00000005;
wdMergeSubTypeOutlook = $00000006;
wdMergeSubTypeWord = $00000007;
wdMergeSubTypeWord2000 = $00000008;
// Constants for enum WdDocumentDirection
const
wdLeftToRight = $00000000;
wdRightToLeft = $00000001;
// Constants for enum WdLanguageID2000
const
wdChineseHongKong = $00000C04;
wdChineseMacao = $00001404;
wdEnglishTrinidad = $00002C09;
// Constants for enum WdRectangleType
const
wdTextRectangle = $00000000;
wdShapeRectangle = $00000001;
wdMarkupRectangle = $00000002;
wdMarkupRectangleButton = $00000003;
wdPageBorderRectangle = $00000004;
wdLineBetweenColumnRectangle = $00000005;
wdSelection = $00000006;
wdSystem = $00000007;
wdMarkupRectangleArea = $00000008;
wdReadingModeNavigation = $00000009;
wdMarkupRectangleMoveMatch = $0000000A;
wdReadingModePanningArea = $0000000B;
wdMailNavArea = $0000000C;
wdDocumentControlRectangle = $0000000D;
// Constants for enum WdLineType
const
wdTextLine = $00000000;
wdTableRow = $00000001;
// Constants for enum WdXMLNodeType
const
wdXMLNodeElement = $00000001;
wdXMLNodeAttribute = $00000002;
// Constants for enum WdXMLSelectionChangeReason
const
wdXMLSelectionChangeReasonMove = $00000000;
wdXMLSelectionChangeReasonInsert = $00000001;
wdXMLSelectionChangeReasonDelete = $00000002;
// Constants for enum WdXMLNodeLevel
const
wdXMLNodeLevelInline = $00000000;
wdXMLNodeLevelParagraph = $00000001;
wdXMLNodeLevelRow = $00000002;
wdXMLNodeLevelCell = $00000003;
// Constants for enum WdSmartTagControlType
const
wdControlSmartTag = $00000001;
wdControlLink = $00000002;
wdControlHelp = $00000003;
wdControlHelpURL = $00000004;
wdControlSeparator = $00000005;
wdControlButton = $00000006;
wdControlLabel = $00000007;
wdControlImage = $00000008;
wdControlCheckbox = $00000009;
wdControlTextbox = $0000000A;
wdControlListbox = $0000000B;
wdControlCombo = $0000000C;
wdControlActiveX = $0000000D;
wdControlDocumentFragment = $0000000E;
wdControlDocumentFragmentURL = $0000000F;
wdControlRadioGroup = $00000010;
// Constants for enum WdEditorType
const
wdEditorEveryone = $FFFFFFFF;
wdEditorOwners = $FFFFFFFC;
wdEditorEditors = $FFFFFFFB;
wdEditorCurrent = $FFFFFFFA;
// Constants for enum WdXMLValidationStatus
const
wdXMLValidationStatusOK = $00000000;
wdXMLValidationStatusCustom = $C00CE000;
// Constants for enum WdStyleSort
const
wdStyleSortByName = $00000000;
wdStyleSortRecommended = $00000001;
wdStyleSortByFont = $00000002;
wdStyleSortByBasedOn = $00000003;
wdStyleSortByType = $00000004;
// Constants for enum WdRemoveDocInfoType
const
wdRDIComments = $00000001;
wdRDIRevisions = $00000002;
wdRDIVersions = $00000003;
wdRDIRemovePersonalInformation = $00000004;
wdRDIEmailHeader = $00000005;
wdRDIRoutingSlip = $00000006;
wdRDISendForReview = $00000007;
wdRDIDocumentProperties = $00000008;
wdRDITemplate = $00000009;
wdRDIDocumentWorkspace = $0000000A;
wdRDIInkAnnotations = $0000000B;
wdRDIDocumentServerProperties = $0000000E;
wdRDIDocumentManagementPolicy = $0000000F;
wdRDIContentType = $00000010;
wdRDITaskpaneWebExtensions = $00000011;
wdRDIAtMentions = $00000012;
wdRDIDocumentTasks = $00000013;
wdRDIAll = $00000063;
// Constants for enum WdCheckInVersionType
const
wdCheckInMinorVersion = $00000000;
wdCheckInMajorVersion = $00000001;
wdCheckInOverwriteVersion = $00000002;
// Constants for enum WdMoveToTextMark
const
wdMoveToTextMarkNone = $00000000;
wdMoveToTextMarkBold = $00000001;
wdMoveToTextMarkItalic = $00000002;
wdMoveToTextMarkUnderline = $00000003;
wdMoveToTextMarkDoubleUnderline = $00000004;
wdMoveToTextMarkColorOnly = $00000005;
wdMoveToTextMarkStrikeThrough = $00000006;
wdMoveToTextMarkDoubleStrikeThrough = $00000007;
// Constants for enum WdMoveFromTextMark
const
wdMoveFromTextMarkHidden = $00000000;
wdMoveFromTextMarkDoubleStrikeThrough = $00000001;
wdMoveFromTextMarkStrikeThrough = $00000002;
wdMoveFromTextMarkCaret = $00000003;
wdMoveFromTextMarkPound = $00000004;
wdMoveFromTextMarkNone = $00000005;
wdMoveFromTextMarkBold = $00000006;
wdMoveFromTextMarkItalic = $00000007;
wdMoveFromTextMarkUnderline = $00000008;
wdMoveFromTextMarkDoubleUnderline = $00000009;
wdMoveFromTextMarkColorOnly = $0000000A;
// Constants for enum WdOMathFunctionType
const
wdOMathFunctionAcc = $00000001;
wdOMathFunctionBar = $00000002;
wdOMathFunctionBox = $00000003;
wdOMathFunctionBorderBox = $00000004;
wdOMathFunctionDelim = $00000005;
wdOMathFunctionEqArray = $00000006;
wdOMathFunctionFrac = $00000007;
wdOMathFunctionFunc = $00000008;
wdOMathFunctionGroupChar = $00000009;
wdOMathFunctionLimLow = $0000000A;
wdOMathFunctionLimUpp = $0000000B;
wdOMathFunctionMat = $0000000C;
wdOMathFunctionNary = $0000000D;
wdOMathFunctionPhantom = $0000000E;
wdOMathFunctionScrPre = $0000000F;
wdOMathFunctionRad = $00000010;
wdOMathFunctionScrSub = $00000011;
wdOMathFunctionScrSubSup = $00000012;
wdOMathFunctionScrSup = $00000013;
wdOMathFunctionText = $00000014;
wdOMathFunctionNormalText = $00000015;
wdOMathFunctionLiteralText = $00000016;
// Constants for enum WdOMathHorizAlignType
const
wdOMathHorizAlignCenter = $00000000;
wdOMathHorizAlignLeft = $00000001;
wdOMathHorizAlignRight = $00000002;
// Constants for enum WdOMathVertAlignType
const
wdOMathVertAlignCenter = $00000000;
wdOMathVertAlignTop = $00000001;
wdOMathVertAlignBottom = $00000002;
// Constants for enum WdOMathFracType
const
wdOMathFracBar = $00000000;
wdOMathFracNoBar = $00000001;
wdOMathFracSkw = $00000002;
wdOMathFracLin = $00000003;
// Constants for enum WdOMathSpacingRule
const
wdOMathSpacingSingle = $00000000;
wdOMathSpacing1pt5 = $00000001;
wdOMathSpacingDouble = $00000002;
wdOMathSpacingExactly = $00000003;
wdOMathSpacingMultiple = $00000004;
// Constants for enum WdOMathType
const
wdOMathDisplay = $00000000;
wdOMathInline = $00000001;
// Constants for enum WdOMathShapeType
const
wdOMathShapeCentered = $00000000;
wdOMathShapeMatch = $00000001;
// Constants for enum WdOMathJc
const
wdOMathJcCenterGroup = $00000001;
wdOMathJcCenter = $00000002;
wdOMathJcLeft = $00000003;
wdOMathJcRight = $00000004;
wdOMathJcInline = $00000007;
// Constants for enum WdOMathBreakBin
const
wdOMathBreakBinBefore = $00000000;
wdOMathBreakBinAfter = $00000001;
wdOMathBreakBinRepeat = $00000002;
// Constants for enum WdOMathBreakSub
const
wdOMathBreakSubMinusMinus = $00000000;
wdOMathBreakSubPlusMinus = $00000001;
wdOMathBreakSubMinusPlus = $00000002;
// Constants for enum WdReadingLayoutMargin
const
wdAutomaticMargin = $00000000;
wdSuppressMargin = $00000001;
wdFullMargin = $00000002;
// Constants for enum WdContentControlType
const
wdContentControlRichText = $00000000;
wdContentControlText = $00000001;
wdContentControlPicture = $00000002;
wdContentControlComboBox = $00000003;
wdContentControlDropdownList = $00000004;
wdContentControlBuildingBlockGallery = $00000005;
wdContentControlDate = $00000006;
wdContentControlGroup = $00000007;
wdContentControlCheckBox = $00000008;
wdContentControlRepeatingSection = $00000009;
// Constants for enum WdCompareDestination
const
wdCompareDestinationOriginal = $00000000;
wdCompareDestinationRevised = $00000001;
wdCompareDestinationNew = $00000002;
// Constants for enum WdGranularity
const
wdGranularityCharLevel = $00000000;
wdGranularityWordLevel = $00000001;
// Constants for enum WdMergeFormatFrom
const
wdMergeFormatFromOriginal = $00000000;
wdMergeFormatFromRevised = $00000001;
wdMergeFormatFromPrompt = $00000002;
// Constants for enum WdShowSourceDocuments
const
wdShowSourceDocumentsNone = $00000000;
wdShowSourceDocumentsOriginal = $00000001;
wdShowSourceDocumentsRevised = $00000002;
wdShowSourceDocumentsBoth = $00000003;
// Constants for enum WdPasteOptions
const
wdKeepSourceFormatting = $00000000;
wdMatchDestinationFormatting = $00000001;
wdKeepTextOnly = $00000002;
wdUseDestinationStyles = $00000003;
// Constants for enum WdBuildingBlockTypes
const
wdTypeQuickParts = $00000001;
wdTypeCoverPage = $00000002;
wdTypeEquations = $00000003;
wdTypeFooters = $00000004;
wdTypeHeaders = $00000005;
wdTypePageNumber = $00000006;
wdTypeTables = $00000007;
wdTypeWatermarks = $00000008;
wdTypeAutoText = $00000009;
wdTypeTextBox = $0000000A;
wdTypePageNumberTop = $0000000B;
wdTypePageNumberBottom = $0000000C;
wdTypePageNumberPage = $0000000D;
wdTypeTableOfContents = $0000000E;
wdTypeCustomQuickParts = $0000000F;
wdTypeCustomCoverPage = $00000010;
wdTypeCustomEquations = $00000011;
wdTypeCustomFooters = $00000012;
wdTypeCustomHeaders = $00000013;
wdTypeCustomPageNumber = $00000014;
wdTypeCustomTables = $00000015;
wdTypeCustomWatermarks = $00000016;
wdTypeCustomAutoText = $00000017;
wdTypeCustomTextBox = $00000018;
wdTypeCustomPageNumberTop = $00000019;
wdTypeCustomPageNumberBottom = $0000001A;
wdTypeCustomPageNumberPage = $0000001B;
wdTypeCustomTableOfContents = $0000001C;
wdTypeCustom1 = $0000001D;
wdTypeCustom2 = $0000001E;
wdTypeCustom3 = $0000001F;
wdTypeCustom4 = $00000020;
wdTypeCustom5 = $00000021;
wdTypeBibliography = $00000022;
wdTypeCustomBibliography = $00000023;
// Constants for enum WdAlignmentTabRelative
const
wdMargin = $00000000;
wdIndent = $00000001;
// Constants for enum WdAlignmentTabAlignment
const
wdLeft = $00000000;
wdCenter = $00000001;
wdRight = $00000002;
// Constants for enum WdCellColor
const
wdCellColorByAuthor = $FFFFFFFF;
wdCellColorNoHighlight = $00000000;
wdCellColorPink = $00000001;
wdCellColorLightBlue = $00000002;
wdCellColorLightYellow = $00000003;
wdCellColorLightPurple = $00000004;
wdCellColorLightOrange = $00000005;
wdCellColorLightGreen = $00000006;
wdCellColorLightGray = $00000007;
// Constants for enum WdTextboxTightWrap
const
wdTightNone = $00000000;
wdTightAll = $00000001;
wdTightFirstAndLastLines = $00000002;
wdTightFirstLineOnly = $00000003;
wdTightLastLineOnly = $00000004;
// Constants for enum WdShapePositionRelative
const
wdShapePositionRelativeNone = $FFF0BDC1;
// Constants for enum WdShapeSizeRelative
const
wdShapeSizeRelativeNone = $FFF0BDC1;
// Constants for enum WdRelativeHorizontalSize
const
wdRelativeHorizontalSizeMargin = $00000000;
wdRelativeHorizontalSizePage = $00000001;
wdRelativeHorizontalSizeLeftMarginArea = $00000002;
wdRelativeHorizontalSizeRightMarginArea = $00000003;
wdRelativeHorizontalSizeInnerMarginArea = $00000004;
wdRelativeHorizontalSizeOuterMarginArea = $00000005;
// Constants for enum WdRelativeVerticalSize
const
wdRelativeVerticalSizeMargin = $00000000;
wdRelativeVerticalSizePage = $00000001;
wdRelativeVerticalSizeTopMarginArea = $00000002;
wdRelativeVerticalSizeBottomMarginArea = $00000003;
wdRelativeVerticalSizeInnerMarginArea = $00000004;
wdRelativeVerticalSizeOuterMarginArea = $00000005;
// Constants for enum WdThemeColorIndex
const
wdNotThemeColor = $FFFFFFFF;
wdThemeColorMainDark1 = $00000000;
wdThemeColorMainLight1 = $00000001;
wdThemeColorMainDark2 = $00000002;
wdThemeColorMainLight2 = $00000003;
wdThemeColorAccent1 = $00000004;
wdThemeColorAccent2 = $00000005;
wdThemeColorAccent3 = $00000006;
wdThemeColorAccent4 = $00000007;
wdThemeColorAccent5 = $00000008;
wdThemeColorAccent6 = $00000009;
wdThemeColorHyperlink = $0000000A;
wdThemeColorHyperlinkFollowed = $0000000B;
wdThemeColorBackground1 = $0000000C;
wdThemeColorText1 = $0000000D;
wdThemeColorBackground2 = $0000000E;
wdThemeColorText2 = $0000000F;
// Constants for enum WdExportFormat
const
wdExportFormatPDF = $00000011;
wdExportFormatXPS = $00000012;
// Constants for enum WdExportOptimizeFor
const
wdExportOptimizeForPrint = $00000000;
wdExportOptimizeForOnScreen = $00000001;
// Constants for enum WdExportCreateBookmarks
const
wdExportCreateNoBookmarks = $00000000;
wdExportCreateHeadingBookmarks = $00000001;
wdExportCreateWordBookmarks = $00000002;
// Constants for enum WdExportItem
const
wdExportDocumentContent = $00000000;
wdExportDocumentWithMarkup = $00000007;
// Constants for enum WdExportRange
const
wdExportAllDocument = $00000000;
wdExportSelection = $00000001;
wdExportCurrentPage = $00000002;
wdExportFromTo = $00000003;
// Constants for enum WdFrenchSpeller
const
wdFrenchBoth = $00000000;
wdFrenchPreReform = $00000001;
wdFrenchPostReform = $00000002;
// Constants for enum WdDocPartInsertOptions
const
wdInsertContent = $00000000;
wdInsertParagraph = $00000001;
wdInsertPage = $00000002;
// Constants for enum WdContentControlDateStorageFormat
const
wdContentControlDateStorageText = $00000000;
wdContentControlDateStorageDate = $00000001;
wdContentControlDateStorageDateTime = $00000002;
// Constants for enum XlChartSplitType
const
xlSplitByPosition = $00000001;
xlSplitByPercentValue = $00000003;
xlSplitByCustomSplit = $00000004;
xlSplitByValue = $00000002;
// Constants for enum XlSizeRepresents
const
xlSizeIsWidth = $00000002;
xlSizeIsArea = $00000001;
// Constants for enum XlAxisGroup
const
xlPrimary = $00000001;
xlSecondary = $00000002;
// Constants for enum XlBackground
const
xlBackgroundAutomatic = $FFFFEFF7;
xlBackgroundOpaque = $00000003;
xlBackgroundTransparent = $00000002;
// Constants for enum XlChartGallery
const
xlBuiltIn = $00000015;
xlUserDefined = $00000016;
xlAnyGallery = $00000017;
// Constants for enum XlChartPicturePlacement
const
xlSides = $00000001;
xlEnd = $00000002;
xlEndSides = $00000003;
xlFront = $00000004;
xlFrontSides = $00000005;
xlFrontEnd = $00000006;
xlAllFaces = $00000007;
// Constants for enum XlDataLabelSeparator
const
xlDataLabelSeparatorDefault = $00000001;
// Constants for enum XlPattern
const
xlPatternAutomatic = $FFFFEFF7;
xlPatternChecker = $00000009;
xlPatternCrissCross = $00000010;
xlPatternDown = $FFFFEFE7;
xlPatternGray16 = $00000011;
xlPatternGray25 = $FFFFEFE4;
xlPatternGray50 = $FFFFEFE3;
xlPatternGray75 = $FFFFEFE2;
xlPatternGray8 = $00000012;
xlPatternGrid = $0000000F;
xlPatternHorizontal = $FFFFEFE0;
xlPatternLightDown = $0000000D;
xlPatternLightHorizontal = $0000000B;
xlPatternLightUp = $0000000E;
xlPatternLightVertical = $0000000C;
xlPatternNone = $FFFFEFD2;
xlPatternSemiGray75 = $0000000A;
xlPatternSolid = $00000001;
xlPatternUp = $FFFFEFBE;
xlPatternVertical = $FFFFEFBA;
xlPatternLinearGradient = $00000FA0;
xlPatternRectangularGradient = $00000FA1;
// Constants for enum XlPictureAppearance
const
xlPrinter = $00000002;
xlScreen = $00000001;
// Constants for enum XlCopyPictureFormat
const
xlBitmap = $00000002;
xlPicture = $FFFFEFCD;
// Constants for enum XlRgbColor
const
xlAliceBlue = $00FFF8F0;
xlAntiqueWhite = $00D7EBFA;
xlAqua = $00FFFF00;
xlAquamarine = $00D4FF7F;
xlAzure = $00FFFFF0;
xlBeige = $00DCF5F5;
xlBisque = $00C4E4FF;
xlBlack = $00000000;
xlBlanchedAlmond = $00CDEBFF;
xlBlue = $00FF0000;
xlBlueViolet = $00E22B8A;
xlBrown = $002A2AA5;
xlBurlyWood = $0087B8DE;
xlCadetBlue = $00A09E5F;
xlChartreuse = $0000FF7F;
xlCoral = $00507FFF;
xlCornflowerBlue = $00ED9564;
xlCornsilk = $00DCF8FF;
xlCrimson = $003C14DC;
xlDarkBlue = $008B0000;
xlDarkCyan = $008B8B00;
xlDarkGoldenrod = $000B86B8;
xlDarkGreen = $00006400;
xlDarkGray = $00A9A9A9;
xlDarkGrey = $00A9A9A9;
xlDarkKhaki = $006BB7BD;
xlDarkMagenta = $008B008B;
xlDarkOliveGreen = $002F6B55;
xlDarkOrange = $00008CFF;
xlDarkOrchid = $00CC3299;
xlDarkRed = $0000008B;
xlDarkSalmon = $007A96E9;
xlDarkSeaGreen = $008FBC8F;
xlDarkSlateBlue = $008B3D48;
xlDarkSlateGray = $004F4F2F;
xlDarkSlateGrey = $004F4F2F;
xlDarkTurquoise = $00D1CE00;
xlDarkViolet = $00D30094;
xlDeepPink = $009314FF;
xlDeepSkyBlue = $00FFBF00;
xlDimGray = $00696969;
xlDimGrey = $00696969;
xlDodgerBlue = $00FF901E;
xlFireBrick = $002222B2;
xlFloralWhite = $00F0FAFF;
xlForestGreen = $00228B22;
xlFuchsia = $00FF00FF;
xlGainsboro = $00DCDCDC;
xlGhostWhite = $00FFF8F8;
xlGold = $0000D7FF;
xlGoldenrod = $0020A5DA;
xlGray = $00808080;
xlGreen = $00008000;
xlGrey = $00808080;
xlGreenYellow = $002FFFAD;
xlHoneydew = $00F0FFF0;
xlHotPink = $00B469FF;
xlIndianRed = $005C5CCD;
xlIndigo = $0082004B;
xlIvory = $00F0FFFF;
xlKhaki = $008CE6F0;
xlLavender = $00FAE6E6;
xlLavenderBlush = $00F5F0FF;
xlLawnGreen = $0000FC7C;
xlLemonChiffon = $00CDFAFF;
xlLightBlue = $00E6D8AD;
xlLightCoral = $008080F0;
xlLightCyan = $008B8B00;
xlLightGoldenrodYellow = $00D2FAFA;
xlLightGray = $00D3D3D3;
xlLightGreen = $0090EE90;
xlLightGrey = $00D3D3D3;
xlLightPink = $00C1B6FF;
xlLightSalmon = $007AA0FF;
xlLightSeaGreen = $00AAB220;
xlLightSkyBlue = $00FACE87;
xlLightSlateGray = $00998877;
xlLightSlateGrey = $00998877;
xlLightSteelBlue = $00DEC4B0;
xlLightYellow = $00E0FFFF;
xlLime = $0000FF00;
xlLimeGreen = $0032CD32;
xlLinen = $00E6F0FA;
xlMaroon = $00000080;
xlMediumAquamarine = $00AAFF66;
xlMediumBlue = $00CD0000;
xlMediumOrchid = $00D355BA;
xlMediumPurple = $00DB7093;
xlMediumSeaGreen = $0071B33C;
xlMediumSlateBlue = $00EE687B;
xlMediumSpringGreen = $009AFA00;
xlMediumTurquoise = $00CCD148;
xlMediumVioletRed = $008515C7;
xlMidnightBlue = $00701919;
xlMintCream = $00FAFFF5;
xlMistyRose = $00E1E4FF;
xlMoccasin = $00B5E4FF;
xlNavajoWhite = $00ADDEFF;
xlNavy = $00800000;
xlNavyBlue = $00800000;
xlOldLace = $00E6F5FD;
xlOlive = $00008080;
xlOliveDrab = $00238E6B;
xlOrange = $0000A5FF;
xlOrangeRed = $000045FF;
xlOrchid = $00D670DA;
xlPaleGoldenrod = $006BE8EE;
xlPaleGreen = $0098FB98;
xlPaleTurquoise = $00EEEEAF;
xlPaleVioletRed = $009370DB;
xlPapayaWhip = $00D5EFFF;
xlPeachPuff = $00B9DAFF;
xlPeru = $003F85CD;
xlPink = $00CBC0FF;
xlPlum = $00DDA0DD;
xlPowderBlue = $00E6E0B0;
xlPurple = $00800080;
xlRed = $000000FF;
xlRosyBrown = $008F8FBC;
xlRoyalBlue = $00E16941;
xlSalmon = $007280FA;
xlSandyBrown = $0060A4F4;
xlSeaGreen = $00578B2E;
xlSeashell = $00EEF5FF;
xlSienna = $002D52A0;
xlSilver = $00C0C0C0;
xlSkyBlue = $00EBCE87;
xlSlateBlue = $00CD5A6A;
xlSlateGray = $00908070;
xlSlateGrey = $00908070;
xlSnow = $00FAFAFF;
xlSpringGreen = $007FFF00;
xlSteelBlue = $00B48246;
xlTan = $008CB4D2;
xlTeal = $00808000;
xlThistle = $00D8BFD8;
xlTomato = $004763FF;
xlTurquoise = $00D0E040;
xlYellow = $0000FFFF;
xlYellowGreen = $0032CD9A;
xlViolet = $00EE82EE;
xlWheat = $00B3DEF5;
xlWhite = $00FFFFFF;
xlWhiteSmoke = $00F5F5F5;
// Constants for enum XlConstants
const
xlAutomatic = $FFFFEFF7;
xlCombination = $FFFFEFF1;
xlCustom = $FFFFEFEE;
xlBar = $00000002;
xlColumn = $00000003;
xl3DBar = $FFFFEFFD;
xl3DSurface = $FFFFEFF9;
xlDefaultAutoFormat = $FFFFFFFF;
xlNone = $FFFFEFD2;
xlAbove = $00000000;
xlBelow = $00000001;
xlBoth = $00000001;
xlBottom = $FFFFEFF5;
xlCenter = $FFFFEFF4;
xlChecker = $00000009;
xlCircle = $00000008;
xlCorner = $00000002;
xlCrissCross = $00000010;
xlCross = $00000004;
xlDiamond = $00000002;
xlDistributed = $FFFFEFEB;
xlFill = $00000005;
xlFixedValue = $00000001;
xlGeneral = $00000001;
xlGray16 = $00000011;
xlGray25 = $FFFFEFE4;
xlGray50 = $FFFFEFE3;
xlGray75 = $FFFFEFE2;
xlGray8 = $00000012;
xlGrid = $0000000F;
xlHigh = $FFFFEFE1;
xlInside = $00000002;
xlJustify = $FFFFEFDE;
xlLeft = $FFFFEFDD;
xlLightDown = $0000000D;
xlLightHorizontal = $0000000B;
xlLightUp = $0000000E;
xlLightVertical = $0000000C;
xlLow = $FFFFEFDA;
xlMaximum = $00000002;
xlMinimum = $00000004;
xlMinusValues = $00000003;
xlNextToAxis = $00000004;
xlOpaque = $00000003;
xlOutside = $00000003;
xlPercent = $00000002;
xlPlus = $00000009;
xlPlusValues = $00000002;
xlRight = $FFFFEFC8;
xlScale = $00000003;
xlSemiGray75 = $0000000A;
xlShowLabel = $00000004;
xlShowLabelAndPercent = $00000005;
xlShowPercent = $00000003;
xlShowValue = $00000002;
xlSingle = $00000002;
xlSolid = $00000001;
xlSquare = $00000001;
xlStar = $00000005;
xlStError = $00000004;
xlTop = $FFFFEFC0;
xlTransparent = $00000002;
xlTriangle = $00000003;
// Constants for enum XlReadingOrder
const
xlContext = $FFFFEC76;
xlLTR = $FFFFEC75;
xlRTL = $FFFFEC74;
// Constants for enum XlBorderWeight
const
xlHairline = $00000001;
xlMedium = $FFFFEFD6;
xlThick = $00000004;
xlThin = $00000002;
// Constants for enum XlLegendPosition
const
xlLegendPositionBottom = $FFFFEFF5;
xlLegendPositionCorner = $00000002;
xlLegendPositionLeft = $FFFFEFDD;
xlLegendPositionRight = $FFFFEFC8;
xlLegendPositionTop = $FFFFEFC0;
xlLegendPositionCustom = $FFFFEFBF;
// Constants for enum XlUnderlineStyle
const
xlUnderlineStyleDouble = $FFFFEFE9;
xlUnderlineStyleDoubleAccounting = $00000005;
xlUnderlineStyleNone = $FFFFEFD2;
xlUnderlineStyleSingle = $00000002;
xlUnderlineStyleSingleAccounting = $00000004;
// Constants for enum XlColorIndex
const
xlColorIndexAutomatic = $FFFFEFF7;
xlColorIndexNone = $FFFFEFD2;
// Constants for enum XlMarkerStyle
const
xlMarkerStyleAutomatic = $FFFFEFF7;
xlMarkerStyleCircle = $00000008;
xlMarkerStyleDash = $FFFFEFED;
xlMarkerStyleDiamond = $00000002;
xlMarkerStyleDot = $FFFFEFEA;
xlMarkerStyleNone = $FFFFEFD2;
xlMarkerStylePicture = $FFFFEFCD;
xlMarkerStylePlus = $00000009;
xlMarkerStyleSquare = $00000001;
xlMarkerStyleStar = $00000005;
xlMarkerStyleTriangle = $00000003;
xlMarkerStyleX = $FFFFEFB8;
// Constants for enum XlRowCol
const
xlColumns = $00000002;
xlRows = $00000001;
// Constants for enum XlDataLabelsType
const
xlDataLabelsShowNone = $FFFFEFD2;
xlDataLabelsShowValue = $00000002;
xlDataLabelsShowPercent = $00000003;
xlDataLabelsShowLabel = $00000004;
xlDataLabelsShowLabelAndPercent = $00000005;
xlDataLabelsShowBubbleSizes = $00000006;
// Constants for enum XlErrorBarInclude
const
xlErrorBarIncludeBoth = $00000001;
xlErrorBarIncludeMinusValues = $00000003;
xlErrorBarIncludeNone = $FFFFEFD2;
xlErrorBarIncludePlusValues = $00000002;
// Constants for enum XlErrorBarType
const
xlErrorBarTypeCustom = $FFFFEFEE;
xlErrorBarTypeFixedValue = $00000001;
xlErrorBarTypePercent = $00000002;
xlErrorBarTypeStDev = $FFFFEFC5;
xlErrorBarTypeStError = $00000004;
// Constants for enum XlErrorBarDirection
const
xlChartX = $FFFFEFB8;
xlChartY = $00000001;
// Constants for enum XlChartPictureType
const
xlStackScale = $00000003;
xlStack = $00000002;
xlStretch = $00000001;
// Constants for enum XlChartItem
const
xlDataLabel = $00000000;
xlChartArea = $00000002;
xlSeries = $00000003;
xlChartTitle = $00000004;
xlWalls = $00000005;
xlCorners = $00000006;
xlDataTable = $00000007;
xlTrendline = $00000008;
xlErrorBars = $00000009;
xlXErrorBars = $0000000A;
xlYErrorBars = $0000000B;
xlLegendEntry = $0000000C;
xlLegendKey = $0000000D;
xlShape = $0000000E;
xlMajorGridlines = $0000000F;
xlMinorGridlines = $00000010;
xlAxisTitle = $00000011;
xlUpBars = $00000012;
xlPlotArea = $00000013;
xlDownBars = $00000014;
xlAxis = $00000015;
xlSeriesLines = $00000016;
xlFloor = $00000017;
xlLegend = $00000018;
xlHiLoLines = $00000019;
xlDropLines = $0000001A;
xlRadarAxisLabels = $0000001B;
xlNothing = $0000001C;
xlLeaderLines = $0000001D;
xlDisplayUnitLabel = $0000001E;
xlPivotChartFieldButton = $0000001F;
xlPivotChartDropZone = $00000020;
// Constants for enum XlBarShape
const
xlBox = $00000000;
xlPyramidToPoint = $00000001;
xlPyramidToMax = $00000002;
xlCylinder = $00000003;
xlConeToPoint = $00000004;
xlConeToMax = $00000005;
// Constants for enum XlEndStyleCap
const
xlCap = $00000001;
xlNoCap = $00000002;
// Constants for enum XlTrendlineType
const
xlExponential = $00000005;
xlLinear = $FFFFEFDC;
xlLogarithmic = $FFFFEFDB;
xlMovingAvg = $00000006;
xlPolynomial = $00000003;
xlPower = $00000004;
// Constants for enum XlAxisType
const
xlCategory = $00000001;
xlSeriesAxis = $00000003;
xlValue = $00000002;
// Constants for enum XlAxisCrosses
const
xlAxisCrossesAutomatic = $FFFFEFF7;
xlAxisCrossesCustom = $FFFFEFEE;
xlAxisCrossesMaximum = $00000002;
xlAxisCrossesMinimum = $00000004;
// Constants for enum XlTickMark
const
xlTickMarkCross = $00000004;
xlTickMarkInside = $00000002;
xlTickMarkNone = $FFFFEFD2;
xlTickMarkOutside = $00000003;
// Constants for enum XlScaleType
const
xlScaleLinear = $FFFFEFDC;
xlScaleLogarithmic = $FFFFEFDB;
// Constants for enum XlTickLabelPosition
const
xlTickLabelPositionHigh = $FFFFEFE1;
xlTickLabelPositionLow = $FFFFEFDA;
xlTickLabelPositionNextToAxis = $00000004;
xlTickLabelPositionNone = $FFFFEFD2;
// Constants for enum XlTimeUnit
const
xlDays = $00000000;
xlMonths = $00000001;
xlYears = $00000002;
// Constants for enum XlCategoryType
const
xlCategoryScale = $00000002;
xlTimeScale = $00000003;
xlAutomaticScale = $FFFFEFF7;
// Constants for enum XlDisplayUnit
const
xlHundreds = $FFFFFFFE;
xlThousands = $FFFFFFFD;
xlTenThousands = $FFFFFFFC;
xlHundredThousands = $FFFFFFFB;
xlMillions = $FFFFFFFA;
xlTenMillions = $FFFFFFF9;
xlHundredMillions = $FFFFFFF8;
xlThousandMillions = $FFFFFFF7;
xlMillionMillions = $FFFFFFF6;
// Constants for enum XlOrientation
const
xlDownward = $FFFFEFB6;
xlHorizontal = $FFFFEFE0;
xlUpward = $FFFFEFB5;
xlVertical = $FFFFEFBA;
// Constants for enum XlTickLabelOrientation
const
xlTickLabelOrientationAutomatic = $FFFFEFF7;
xlTickLabelOrientationDownward = $FFFFEFB6;
xlTickLabelOrientationHorizontal = $FFFFEFE0;
xlTickLabelOrientationUpward = $FFFFEFB5;
xlTickLabelOrientationVertical = $FFFFEFBA;
// Constants for enum XlDisplayBlanksAs
const
xlInterpolated = $00000003;
xlNotPlotted = $00000001;
xlZero = $00000002;
// Constants for enum XlDataLabelPosition
const
xlLabelPositionCenter = $FFFFEFF4;
xlLabelPositionAbove = $00000000;
xlLabelPositionBelow = $00000001;
xlLabelPositionLeft = $FFFFEFDD;
xlLabelPositionRight = $FFFFEFC8;
xlLabelPositionOutsideEnd = $00000002;
xlLabelPositionInsideEnd = $00000003;
xlLabelPositionInsideBase = $00000004;
xlLabelPositionBestFit = $00000005;
xlLabelPositionMixed = $00000006;
xlLabelPositionCustom = $00000007;
// Constants for enum XlPivotFieldOrientation
const
xlColumnField = $00000002;
xlDataField = $00000004;
xlHidden = $00000000;
xlPageField = $00000003;
xlRowField = $00000001;
// Constants for enum XlHAlign
const
xlHAlignCenter = $FFFFEFF4;
xlHAlignCenterAcrossSelection = $00000007;
xlHAlignDistributed = $FFFFEFEB;
xlHAlignFill = $00000005;
xlHAlignGeneral = $00000001;
xlHAlignJustify = $FFFFEFDE;
xlHAlignLeft = $FFFFEFDD;
xlHAlignRight = $FFFFEFC8;
// Constants for enum XlVAlign
const
xlVAlignBottom = $FFFFEFF5;
xlVAlignCenter = $FFFFEFF4;
xlVAlignDistributed = $FFFFEFEB;
xlVAlignJustify = $FFFFEFDE;
xlVAlignTop = $FFFFEFC0;
// Constants for enum XlLineStyle
const
xlContinuous = $00000001;
xlDash = $FFFFEFED;
xlDashDot = $00000004;
xlDashDotDot = $00000005;
xlDot = $FFFFEFEA;
xlDouble = $FFFFEFE9;
xlSlantDashDot = $0000000D;
xlLineStyleNone = $FFFFEFD2;
// Constants for enum XlChartElementPosition
const
xlChartElementPositionAutomatic = $FFFFEFF7;
xlChartElementPositionCustom = $FFFFEFEE;
// Constants for enum WdUpdateStyleListBehavior
const
wdListBehaviorKeepPreviousPattern = $00000000;
wdListBehaviorAddBulletsNumbering = $00000001;
// Constants for enum WdApplyQuickStyleSets
const
wdSessionStartSet = $00000001;
wdTemplateSet = $00000002;
// Constants for enum WdLigatures
const
wdLigaturesNone = $00000000;
wdLigaturesStandard = $00000001;
wdLigaturesContextual = $00000002;
wdLigaturesHistorical = $00000004;
wdLigaturesDiscretional = $00000008;
wdLigaturesStandardContextual = $00000003;
wdLigaturesStandardHistorical = $00000005;
wdLigaturesContextualHistorical = $00000006;
wdLigaturesStandardDiscretional = $00000009;
wdLigaturesContextualDiscretional = $0000000A;
wdLigaturesHistoricalDiscretional = $0000000C;
wdLigaturesStandardContextualHistorical = $00000007;
wdLigaturesStandardContextualDiscretional = $0000000B;
wdLigaturesStandardHistoricalDiscretional = $0000000D;
wdLigaturesContextualHistoricalDiscretional = $0000000E;
wdLigaturesAll = $0000000F;
// Constants for enum WdNumberForm
const
wdNumberFormDefault = $00000000;
wdNumberFormLining = $00000001;
wdNumberFormOldStyle = $00000002;
// Constants for enum WdNumberSpacing
const
wdNumberSpacingDefault = $00000000;
wdNumberSpacingProportional = $00000001;
wdNumberSpacingTabular = $00000002;
// Constants for enum WdStylisticSet
const
wdStylisticSetDefault = $00000000;
wdStylisticSet01 = $00000001;
wdStylisticSet02 = $00000002;
wdStylisticSet03 = $00000004;
wdStylisticSet04 = $00000008;
wdStylisticSet05 = $00000010;
wdStylisticSet06 = $00000020;
wdStylisticSet07 = $00000040;
wdStylisticSet08 = $00000080;
wdStylisticSet09 = $00000100;
wdStylisticSet10 = $00000200;
wdStylisticSet11 = $00000400;
wdStylisticSet12 = $00000800;
wdStylisticSet13 = $00001000;
wdStylisticSet14 = $00002000;
wdStylisticSet15 = $00004000;
wdStylisticSet16 = $00008000;
wdStylisticSet17 = $00010000;
wdStylisticSet18 = $00020000;
wdStylisticSet19 = $00040000;
wdStylisticSet20 = $00080000;
// Constants for enum WdSpanishSpeller
const
wdSpanishTuteoOnly = $00000000;
wdSpanishTuteoAndVoseo = $00000001;
wdSpanishVoseoOnly = $00000002;
// Constants for enum WdLockType
const
wdLockNone = $00000000;
wdLockReservation = $00000001;
wdLockEphemeral = $00000002;
wdLockChanged = $00000003;
// Constants for enum XlPieSliceLocation
const
xlHorizontalCoordinate = $00000001;
xlVerticalCoordinate = $00000002;
// Constants for enum XlPieSliceIndex
const
xlOuterCounterClockwisePoint = $00000001;
xlOuterCenterPoint = $00000002;
xlOuterClockwisePoint = $00000003;
xlMidClockwiseRadiusPoint = $00000004;
xlCenterPoint = $00000005;
xlMidCounterClockwiseRadiusPoint = $00000006;
xlInnerClockwisePoint = $00000007;
xlInnerCenterPoint = $00000008;
xlInnerCounterClockwisePoint = $00000009;
// Constants for enum WdCompatibilityMode
const
wdWord2003 = $0000000B;
wdWord2007 = $0000000C;
wdWord2010 = $0000000E;
wdWord2013 = $0000000F;
wdCurrent = $0000FFFF;
// Constants for enum WdProtectedViewCloseReason
const
wdProtectedViewCloseNormal = $00000000;
wdProtectedViewCloseEdit = $00000001;
wdProtectedViewCloseForced = $00000002;
// Constants for enum WdPortugueseReform
const
wdPortuguesePreReform = $00000001;
wdPortuguesePostReform = $00000002;
wdPortugueseBoth = $00000003;
// Constants for enum WdContentControlAppearance
const
wdContentControlBoundingBox = $00000000;
wdContentControlTags = $00000001;
wdContentControlHidden = $00000002;
// Constants for enum WdContentControlLevel
const
wdContentControlLevelInline = $00000000;
wdContentControlLevelParagraph = $00000001;
wdContentControlLevelRow = $00000002;
wdContentControlLevelCell = $00000003;
// Constants for enum XlCategoryLabelLevel
const
xlCategoryLabelLevelNone = $FFFFFFFD;
xlCategoryLabelLevelCustom = $FFFFFFFE;
xlCategoryLabelLevelAll = $FFFFFFFF;
// Constants for enum XlSeriesNameLevel
const
xlSeriesNameLevelNone = $FFFFFFFD;
xlSeriesNameLevelCustom = $FFFFFFFE;
xlSeriesNameLevelAll = $FFFFFFFF;
// Constants for enum WdPageColor
const
wdPageColorNone = $00000000;
wdPageColorSepia = $00000001;
wdPageColorInverse = $00000002;
// Constants for enum WdColumnWidth
const
wdColumnWidthNarrow = $00000001;
wdColumnWidthDefault = $00000002;
wdColumnWidthWide = $00000003;
// Constants for enum WdRevisionsMarkup
const
wdRevisionsMarkupNone = $00000000;
wdRevisionsMarkupSimple = $00000001;
wdRevisionsMarkupAll = $00000002;
// Constants for enum XlParentDataLabelOptions
const
xlParentDataLabelOptionsNone = $00000000;
xlParentDataLabelOptionsBanner = $00000001;
xlParentDataLabelOptionsOverlapping = $00000002;
// Constants for enum XlBinsType
const
xlBinsTypeAutomatic = $00000000;
xlBinsTypeCategorical = $00000001;
xlBinsTypeManual = $00000002;
xlBinsTypeBinSize = $00000003;
xlBinsTypeBinCount = $00000004;
// Constants for enum XlCategorySortOrder
const
xlIndexAscending = $00000000;
xlIndexDescending = $00000001;
xlCategoryAscending = $00000002;
xlCategoryDescending = $00000003;
// Constants for enum XlValueSortOrder
const
xlValueNone = $00000000;
xlValueAscending = $00000001;
xlValueDescending = $00000002;
// Constants for enum XlGeoProjectionType
const
xlGeoProjectionTypeAutomatic = $00000000;
xlGeoProjectionTypeMercator = $00000001;
xlGeoProjectionTypeMiller = $00000002;
xlGeoProjectionTypeAlbers = $00000003;
xlGeoProjectionTypeRobinson = $00000004;
// Constants for enum XlGeoMappingLevel
const
xlGeoMappingLevelAutomatic = $00000000;
xlGeoMappingLevelDataOnly = $00000001;
xlGeoMappingLevelPostalCode = $00000002;
xlGeoMappingLevelCounty = $00000003;
xlGeoMappingLevelState = $00000004;
xlGeoMappingLevelCountryRegion = $00000005;
xlGeoMappingLevelCountryRegionList = $00000006;
xlGeoMappingLevelWorld = $00000007;
// Constants for enum XlRegionLabelOptions
const
xlRegionLabelOptionsNone = $00000000;
xlRegionLabelOptionsBestFitOnly = $00000001;
xlRegionLabelOptionsShowAll = $00000002;
// Constants for enum XlSeriesColorGradientStyle
const
xlSeriesColorGradientStyleSequential = $00000000;
xlSeriesColorGradientStyleDiverging = $00000001;
// Constants for enum XlGradientStopPositionType
const
xlGradientStopPositionTypeExtremeValue = $00000000;
xlGradientStopPositionTypeNumber = $00000001;
xlGradientStopPositionTypePercent = $00000002;
// Constants for enum WdPageMovementType
const
wdVertical = $00000001;
wdSideToSide = $00000002;
implementation
end.
|
{$MODE OBJFPC}
{$DEFINE RELEASE}
{$R-,Q-,S-,I-}
{$OPTIMIZATION LEVEL2}
{$INLINE ON}
program ConvexHull;
const
InputFile = 'CONVEXHULL.INP';
OutputFile = 'CONVEXHULL.OUT';
maxN = Round(1E5);
type
TPoint = record
x, y: Int64;
end;
TVector = TPoint;
var
p, q: array[1..maxN] of TPoint;
stack: array[1..maxN] of Integer;
top: Integer;
base: TPoint;
n: Integer;
Area: Int64;
resS: AnsiString;
procedure Enter;
var
f: TextFile;
i: Integer;
begin
AssignFile(f, InputFile); Reset(f);
try
ReadLn(f, n);
for i := 1 to n do
with p[i] do ReadLn(f, x, y);
finally
CloseFile(f);
end;
end;
operator =(const u, v: TVector): Boolean; inline;
begin
Result := (u.x = v.x) and (u.y = v.y);
end;
operator -(const u, v: TVector): TVector; inline;
begin
Result.x := u.x - v.x;
Result.y := u.y - v.y;
end;
operator ><(const u, v: TVector): Int64; inline; //CCW function
begin
Result := u.x * v.y - u.y * v.x;
end;
procedure Sort(L, H: Integer);
var
i, j: Integer;
pivot: TPoint;
begin
if L >= H then Exit;
i := L + Random(H - L + 1);
pivot := p[i]; p[i] := p[L];
i := L; j := H;
repeat
while (pivot >< p[j] > 0) and (i < j) do Dec(j);
if i < j then
begin
p[i] := p[j]; Inc(i);
end
else Break;
while (pivot >< p[i] < 0) and (i < j) do Inc(i);
if i < j then
begin
p[j] := p[i]; Dec(j);
end
else Break;
until i = j;
p[i] := pivot;
Sort(L, i - 1); Sort(i + 1, H);
end;
procedure Init;
var
imin, i, j: Integer;
begin
imin := 1;
for i := 2 to n do
if (p[i].y < p[imin].y) or
(p[i].y = p[imin].y) and (p[i].x < p[imin].x) then imin := i;
base := p[imin]; j := 0;
for i := 1 to n do
if p[i] <> base then
begin
Inc(j); p[j] := p[i] - base;
end;
n := j + 1;
p[n].x := 0; p[n].y := 0;
Sort(1, n - 1);
end;
function Distance(const p: TPoint): Integer; inline; //manhatan distance
begin
Result := Abs(p.x) + Abs(p.y);
end;
function TurnLeft(const a, b, c: TPoint): Boolean; inline;
begin
Result := (b - a) >< (c - b) > 0;
end;
procedure Solve;
var
i: Integer;
begin
stack[1] := n; top := 1;
for i := 1 to n - 1 do
begin
if (top > 1) and (p[i] >< p[stack[top]] = 0) then
if Distance(p[i]) > Distance(p[stack[top]]) then
Dec(top)
else
Continue;
while (top > 1) and
not TurnLeft(p[stack[top - 1]], p[stack[top]], p[i]) do Dec(top);
Inc(top);
stack[top] := i;
end;
Area := 0;
for i := 3 to top do
Area := Area + p[stack[i - 1]] >< p[stack[i]];
Str(Area div 2, resS);
if Odd(Area) then resS := resS + '.5'
else resS := resS + '.0';
end;
procedure PrintResult;
var
f: TextFile;
i: Integer;
begin
AssignFile(f, OutputFile); Rewrite(f);
try
WriteLn(f, top);
WriteLn(f, resS);
for i := 1 to top do
with p[stack[i]] do
WriteLn(f, x + base.x, ' ', y + base.y);
finally
CloseFile(f);
end;
end;
begin
Enter;
Init;
Solve;
PrintResult;
end.
|
unit AreaEditForma;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrlsEh, DBLookupEh, DB, FIBDataSet, pFIBDataSet,
Mask, OkCancel_frame, DBCtrls, StdCtrls, FIBDatabase, pFIBDatabase,
CnErrorProvider, PrjConst;
type
TAreaViewForm = class(TForm)
Label2: TLabel;
Label3: TLabel;
OkCancelFrame: TOkCancelFrame;
dbEditCode: TDBEditEh;
dbeName: TDBEditEh;
Label4: TLabel;
DBMemo1: TDBMemoEh;
trSRead: TpFIBTransaction;
trSWrite: TpFIBTransaction;
dsArea: TpFIBDataSet;
srcArea: TDataSource;
CnErrors: TCnErrorProvider;
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure dblu_AreasExit(Sender: TObject);
procedure dbeNameChange(Sender: TObject);
procedure dbEditCodeChange(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure OkCancelFramebbOkClick(Sender: TObject);
procedure dbeNameEnter(Sender: TObject);
private
{ Private declarations }
procedure CheckData;
public
{ Public declarations }
end;
function EditArea(const aArea_ID:Int64): Int64;
implementation
uses DM;
{$R *.dfm}
function EditArea(const aArea_ID:Int64): Int64;
var
vArea_ID : Int64;
begin
result := -1;
with TAreaViewForm.Create(Application) do
try
trSWrite.Active := true;
trSRead.Active := true;
dsArea.ParamByName('AREA_ID').AsInteger := aArea_ID;
dsArea.Open;
if aArea_ID = -1
then dsArea.Insert
else dsArea.Edit;
CheckData;
if ShowModal = mrOk
then begin
try
if aArea_ID = -1
then begin
vArea_ID := dmMain.dbTV.Gen_Id('GEN_OPERATIONS_UID',1, dmMain.trWriteQ);
dsArea['AREA_ID'] := vArea_ID;
end
else vArea_ID := aArea_ID;
dsArea.Post;
result := vArea_ID;
except
result := -1;
end;
end
else dsArea.Cancel;
dsArea.Close;
finally
free
end;
end;
procedure TAreaViewForm.CheckData;
var
En : Boolean;
begin
en := ((dmMain.AllowedAction(rght_Dictionary_full) or dmMain.AllowedAction(rght_Dictionary_Areas)));
if not en then
CnErrors.SetError(OkCancelFrame.bbOk, rsNoRights, iaTopCenter, bsNeverBlink);
if dbeName.Text = '' then begin
CnErrors.SetError(dbeName, rsSelectCity, iaTopCenter, bsNeverBlink);
en := False;
end
else CnErrors.Dispose(dbeName);
OkCancelFrame.bbOk.Enabled := en;
end;
procedure TAreaViewForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Shift = [ssCtrl]) and (Ord(Key) = VK_RETURN) and (OkCancelFrame.bbOk.Enabled)
then OkCancelFrame.actExitExecute(Sender);
end;
procedure TAreaViewForm.FormKeyPress(Sender: TObject; var Key: Char);
var
go:Boolean;
begin
go:=True;
if (Key=#13) then
begin
if (ActiveControl is TDBLookupComboboxEh)
then go := not (ActiveControl as TDBLookupComboboxEh).ListVisible;
if go
then begin
Key := #0; // eat enter key
PostMessage( Self.Handle, WM_NEXTDLGCTL, 0, 0);
end;
end;
end;
procedure TAreaViewForm.OkCancelFramebbOkClick(Sender: TObject);
begin
OkCancelFrame.actExitExecute(Sender);
end;
procedure TAreaViewForm.dblu_AreasExit(Sender: TObject);
begin
CheckData
end;
procedure TAreaViewForm.dbeNameChange(Sender: TObject);
begin
CheckData
end;
procedure TAreaViewForm.dbeNameEnter(Sender: TObject);
begin
CnErrors.Dispose(dbeName);
end;
procedure TAreaViewForm.dbEditCodeChange(Sender: TObject);
begin
CheckData
end;
end.
|
unit msmDrawArrow;
interface
uses
Windows
, Graphics
, l3Units
;
procedure DrawArrow(const AFromPoint: Tl3SPoint; const AToPoint: Tl3SPoint; ACanvas: TCanvas; APolygon: Boolean);
implementation
uses
Types,
Math
;
procedure DrawArrow(const AFromPoint: Tl3SPoint; const AToPoint: Tl3SPoint; ACanvas: TCanvas; APolygon: Boolean);
const
cArrowAngle: Single = 25.0;
cArrowSize: Integer = 15;
var
ArrowAngleRad: Single;
LLineAngle: Single;
RLineAngle: Single;
LineAngle: Single;
ArrowPoints: array[0..1] of TPoint;
PolygonArr: array[0..2] of TPoint;
begin
ArrowAngleRad := DegToRad(cArrowAngle);
LineAngle := ArcTan2(AFromPoint.Y - AToPoint.Y, AToPoint.X - AFromPoint.X);
LLineAngle := -(LineAngle + ArrowAngleRad);
RLineAngle := -(LineAngle - ArrowAngleRad);
//ACanvas.MoveTo(AFromPoint.X, AFromPoint.Y);
//ACanvas.LineTo(AToPoint.X, AToPoint.Y);
ACanvas.MoveTo(AToPoint.X, AToPoint.Y);
ArrowPoints[0].X := Round(AToPoint.X - (cArrowSize * Cos(LLineAngle)));
ArrowPoints[0].Y := Round(AToPoint.Y - (cArrowSize * Sin(LLineAngle)));
ArrowPoints[1].X := Round(AToPoint.X - (cArrowSize * Cos(RLineAngle)));
ArrowPoints[1].Y := Round(AToPoint.Y - (cArrowSize * Sin(RLineAngle)));
if not APolygon then
begin
ACanvas.MoveTo(AToPoint.X, AToPoint.Y);
ACanvas.LineTo(ArrowPoints[0].X, ArrowPoints[0].Y);
ACanvas.MoveTo(AToPoint.X, AToPoint.Y);
ACanvas.LineTo(ArrowPoints[1].X, ArrowPoints[1].Y);
end
else
begin
PolygonArr[0] := Point(AToPoint.X, AToPoint.Y);
PolygonArr[1] := ArrowPoints[0];
PolygonArr[2] := ArrowPoints[1];
ACanvas.Polygon(PolygonArr);
end;
end;
end.
|
unit Entidade.FormaPagamento;
interface
uses SimpleAttributes;
type
TFORMA_PAGAMENTO = class
private
FDESCRICAO: string;
FID: Integer;
procedure SetDESCRICAO(const Value: string);
procedure SetID(const Value: Integer);
published
[PK,AutoInc]
property ID:Integer read FID write SetID;
property DESCRICAO:string read FDESCRICAO write SetDESCRICAO;
end;
implementation
{ TFORMA_PAGAMENTO }
procedure TFORMA_PAGAMENTO.SetDESCRICAO(const Value: string);
begin
FDESCRICAO := Value;
end;
procedure TFORMA_PAGAMENTO.SetID(const Value: Integer);
begin
FID := Value;
end;
end.
|
{***********************************************************************************************************************
*
* TERRA Game Engine
* ==========================================
*
* Copyright (C) 2003, 2014 by SÚrgio Flores (relfos@gmail.com)
*
***********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
**********************************************************************************************************************
* TERRA_MusicTrack
* Implements a generic music track, which can be inherited from.
***********************************************************************************************************************
}
Unit TERRA_MusicTrack;
{$I terra.inc}
Interface
Uses TERRA_String, TERRA_Utils, TERRA_AL, TERRA_OGG, TERRA_SoundStreamer;
Type
MusicTrackClass = Class Of MusicTrack;
MusicTrack = Class(TERRAObject)
Protected
_FileName:TERRAString;
_Volume:Single;
Procedure ChangeVolume(Volume:Single); Virtual; Abstract;
Public
Constructor Create(FileName:TERRAString; Volume:Single);
Procedure Release; Override;
Procedure Init(); Virtual; Abstract;
Procedure Play(); Virtual; Abstract;
Procedure Update; Virtual;
Procedure Stop; Virtual; Abstract;
Procedure SetVolume(Volume:Single);
Class Function Supports(Const Extension:TERRAString):Boolean; Virtual;
Property FileName:TERRAString Read _FileName;
Property Volume:Single Read _Volume Write SetVolume;
End;
StreamingMusicTrack = Class(MusicTrack)
Protected
_Stream:SoundStream;
Procedure ChangeVolume(Volume:Single); Override;
Public
Procedure Release; Override;
Procedure Init(); Override;
Procedure Play(); Override;
Procedure Update; Override;
Procedure Stop; Override;
Class Function Supports(Const Extension:TERRAString):Boolean; Override;
End;
Implementation
Uses TERRA_FileManager, TERRA_Stream;
{ MusicTrack }
Constructor MusicTrack.Create(FileName: TERRAString; Volume:Single);
Begin
_FileName := FileName;
_Volume := Volume;
End;
Procedure MusicTrack.Release;
Begin
// do nothing
End;
Procedure MusicTrack.SetVolume(Volume: Single);
Begin
If (Volume<0) Then
Volume := 0
Else
If (Volume>1) Then
Volume := 1;
If (Volume = _Volume) Then
Exit;
_Volume := Volume;
Self.ChangeVolume(Volume);
End;
Class Function MusicTrack.Supports(const Extension: TERRAString): Boolean;
Begin
Result := False;
End;
Procedure MusicTrack.Update;
Begin
// do nothing
End;
{ StreamingMusicTrack }
Procedure StreamingMusicTrack.Init;
Var
Source:Stream;
Begin
If (OpenALHandle=0) Then
Exit;
Source := FileManager.Instance().OpenStream(FileName);
_Stream := CreateSoundStream(Source);
End;
Procedure StreamingMusicTrack.Release;
Begin
ReleaseObject(_Stream);
End;
Procedure StreamingMusicTrack.Play();
Begin
If Assigned(_Stream) Then
Begin
SetVolume(_Volume);
_Stream.Play;
End;
End;
Procedure StreamingMusicTrack.Update;
Begin
If Assigned(_Stream) Then
_Stream.Update;
End;
Procedure StreamingMusicTrack.Stop;
Begin
If Assigned(_Stream) Then
_Stream.Stop;
End;
Procedure StreamingMusicTrack.ChangeVolume(Volume:Single);
Begin
If Assigned(_Stream) Then
_Stream.Volume := _Volume;
End;
Class Function StreamingMusicTrack.Supports(Const Extension: TERRAString):Boolean;
Begin
Result := (Extension = 'ogg');
End;
End.
|
unit LzmaEnc;
interface
uses System.SysUtils, Winapi.Windows, LzmaTypes, LzFind, LzFindMt;
{$Z4}
type
TCLzmaEncHandle = Pointer;
TCLzmaEncProps = record
level: Integer; (* 0 <= level <= 9 *)
dictSize: UInt32; (* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
(1 << 12) <= dictSize <= (1 << 30) for 64-bit version
default = (1 << 24) *)
lc: Integer; (* 0 <= lc <= 8, default = 3 *)
lp: Integer; (* 0 <= lp <= 4, default = 0 *)
pb: Integer; (* 0 <= pb <= 4, default = 2 *)
algo: Integer; (* 0 - fast, 1 - normal, default = 1 *)
fb: Integer; (* 5 <= fb <= 273, default = 32 *)
btMode: Integer; (* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 *)
numHashBytes: Integer; (* 2, 3 or 4, default = 4 *)
mc: UInt32; (* 1 <= mc <= (1 << 30), default = 32 *)
writeEndMark: Cardinal; (* 0 - do not write EOPM, 1 - write EOPM, default = 0 *)
numThreads: Integer; (* 1 or 2, default = 2 *)
end;
function LzmaEnc_Create(var alloc: TISzAlloc): TCLzmaEncHandle; cdecl; external
name _PU + 'LzmaEnc_Create';
procedure LzmaEnc_Destroy(p: TCLzmaEncHandle; var alloc: TISzAlloc; var
allocBig: TISzAlloc); cdecl; external name _PU + 'LzmaEnc_Destroy';
procedure LzmaEncProps_Init(var p: TCLzmaEncProps); cdecl; external name _PU +
'LzmaEncProps_Init';
function LzmaEnc_SetProps(p: TCLzmaEncHandle; var props: TCLzmaEncProps):
TSRes; cdecl; external name _PU + 'LzmaEnc_SetProps';
function LzmaEnc_WriteProperties(p: TCLzmaEncHandle; properties: TBytes; var
size: SIZE_T): TSRes; cdecl; external name _PU + 'LzmaEnc_WriteProperties';
function LzmaEnc_Encode(p: TCLzmaEncHandle; outStream: PISeqOutStream;
inStream: PISeqInStream; progress: PICompressProgress; var alloc:
TISzAlloc; var allocBig: TISzAlloc): TSRes; cdecl; external name _PU +
'LzmaEnc_Encode';
implementation
uses System.Win.Crtl;
{$ifdef Win32}
{$L Win32\LzmaEnc.obj}
{$else}
{$L Win64\LzmaEnc.o}
{$endif}
end.
|
unit nsTypedIntegerValueMap;
{* реализация мапы "строка"-"число" для чистой замены array [TSomeType] of _string}
{$Include nsDefine.inc }
interface
// <no_string>
uses
Classes,
TypInfo,
l3Interfaces,
l3BaseWithID,
l3ValueMap,
l3Types,
vcmExternalInterfaces,
vcmInterfaces,
L10nInterfaces
;
type
TnsTypedIntegerValueMap = class(Tl3ValueMap, InsIntegerValueMap, InsStringsSource)
private
f_Values: array of PvcmStringID;
f_TypeData: PTypeData;
private
// Il3IntegerValueMap
function DisplayNameToValue(const aDisplayName: Il3CString): Integer;
function ValueToDisplayName(aValue: Integer): Il3CString;
// InsStringsSource
procedure FillStrings(const aStrings: IvcmStrings);
protected
procedure DoGetDisplayNames(const aList: Il3StringsEx);
override;
function GetMapSize: Integer;
override;
protected
procedure Cleanup;
override;
public
constructor Create(aID: TnsValueMapID; aTypeInfo: PTypeInfo; const aValues: array of PvcmStringID);
reintroduce;
class function Make(aID: TnsValueMapID; aTypeInfo: PTypeInfo; const aValues: array of PvcmStringID): InsIntegerValueMap;
reintroduce;
end;//TnsTypedIntegerValueMap
implementation
uses
SysUtils,
l3Base,
l3String,
vcmBase,
vcmUtils,
nsTypes
;
{ TnsTypedIntegerValueMap }
procedure TnsTypedIntegerValueMap.Cleanup;
begin
f_Values := nil;
inherited Cleanup;
end;
constructor TnsTypedIntegerValueMap.Create(aID: TnsValueMapID;
aTypeInfo: PTypeInfo; const aValues: array of PvcmStringID);
var
l_Index: Integer;
begin
inherited Create(aID);
Assert(Assigned(aTypeInfo),Format('Typed map %s - Unspecified typeinfo',[rMapID.rName]));
Assert(aTypeInfo^.Kind in [tkInteger, tkChar, tkEnumeration, tkWChar],Format('Typed map %s - Unsupported type',[rMapID.rName]));
f_TypeData := GetTypeData(aTypeInfo);
Assert(Assigned(f_TypeData),Format('Typed map %s - Can''t find type data',[rMapID.rName]));
Assert(Length(aValues)=(f_TypeData.MaxValue-f_TypeData.MinValue+1),Format('Typed map %s - Mismatch map size',[rMapID.rName]));
SetLength(f_Values, f_TypeData.MaxValue-f_TypeData.MinValue+1);
for l_Index := Low(aValues) to High(aValues) do
f_Values[l_Index-Low(aValues)+Low(f_Values)] := aValues[l_Index];
Assert(Length(aValues)=(f_TypeData.MaxValue-f_TypeData.MinValue+1),Format('Typed map %s - Mismatch map size',[rMapID.rName]));
end;
function TnsTypedIntegerValueMap.DisplayNameToValue(const aDisplayName: Il3CString): Integer;
{-}
var
l_Index: Integer;
begin
for l_Index := Low(f_Values) to High(f_Values) do
if l3Same(aDisplayName, vcmCStr(f_Values[l_Index]^)) then
begin
Result := l_Index + f_TypeData.MinValue - Low(f_Values);
exit;
end;//l3Same(aDisplayName,
raise El3ValueMapValueNotFound.CreateFmt('Display name %s not found in Map %d', [nsEStr(aDisplayName),rMapID.rID]);
end;
procedure TnsTypedIntegerValueMap.FillStrings(const aStrings: IvcmStrings);
var
l_Index: Integer;
begin
aStrings.Clear;
for l_Index := Low(f_Values) To High(f_Values) Do
aStrings.Add(vcmCStr(f_values[l_Index]^));
end;
procedure TnsTypedIntegerValueMap.DoGetDisplayNames(const aList: Il3StringsEx);
var
l_Index: Integer;
begin
inherited;
for l_Index := Low(f_Values) To High(f_Values) Do
aList.Add(vcmCStr(f_values[l_Index]^));
end;
class function TnsTypedIntegerValueMap.Make(aID: TnsValueMapID;
aTypeInfo: PTypeInfo; const aValues: array of PvcmStringID): InsIntegerValueMap;
var
l_Map: TnsTypedIntegerValueMap;
begin
l_Map := Create(aID, aTypeInfo, aValues);
try
Result := l_Map;
finally
vcmFree(l_Map);
end;
end;
function TnsTypedIntegerValueMap.GetMapSize: Integer;
begin
Result := Length(f_Values);
end;
function TnsTypedIntegerValueMap.ValueToDisplayName(aValue: Integer): Il3CString;
begin
if (aValue<f_TypeData.MinValue) or (aValue>f_TypeData.MaxValue) then
raise El3ValueMapValueNotFound.CreateFmt('Value %d not found in Map %s',[aValue,rMapID.rName]);
Result := vcmCStr(f_Values[aValue - f_TypeData.MinValue + Low(f_Values)]^);
end;
end.
|
unit WpcScript;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
Fgl,
WpcStatements,
WpcExceptions;
const
MAIN_BARNCH = 'Main';
type
{ TWpcScript }
TWpcScript = class(TObject)
private type
TWpcScriptBranches = specialize TFPGMap<String, TWpcBranchStatement>;
private
FBranches : TWpcScriptBranches;
public
constructor Create();
destructor Destroy(); override;
public
procedure AddBranch(Name : String; Branch : TWpcBranchStatement);
function GetBranch(BranchName : String) : TWpcBranchStatement;
function GetBranchNames() : TStringList;
end;
implementation
{ TWpcScript }
constructor TWpcScript.Create();
begin
FBranches := TWpcScriptBranches.Create();
end;
destructor TWpcScript.Destroy();
var
i : Integer;
begin
for i:=0 to (FBranches.Count - 1) do
FBranches.Data[i].Free();
FBranches.Free();
inherited Destroy;
end;
procedure TWpcScript.AddBranch(Name : String; Branch: TWpcBranchStatement);
begin
if (FBranches.IndexOf(Name) <> -1) then
raise TWpcUseErrorException.Create('Attempt to add already existing branch "' + Name + '".');
FBranches.Add(Name, Branch);
end;
{
Returns Branch statement or nil if branch with given name doesn't exist.
}
function TWpcScript.GetBranch(BranchName: String): TWpcBranchStatement;
var
Index : Integer;
begin
Index := FBranches.IndexOf(BranchName);
if (Index <> -1) then
Result := FBranches.Data[Index]
else
Result := nil;
end;
{
Returns list of names of all branches.
Note, that returning list should be freed by invoker.
}
function TWpcScript.GetBranchNames() : TStringList;
var
BranchesNames : TStringList;
i : Integer;
begin
BranchesNames := TStringList.Create();
for i:=0 to (FBranches.Count - 1) do
BranchesNames.Add(FBranches.Keys[i]);
Result := BranchesNames;
end;
end.
|
unit SMCheck;
interface
uses
ShareMem;
implementation
uses
SysUtils;
type
PInteger = ^integer;
const
Magic = (ord('A') shl 24) or (ord('B') shl 16) or (ord('C') shl 8) or ord('D');
var
OldMemMgr: TMemoryManager;
function SysGetMemCheck(Size: Integer): Pointer;
var
p : pchar;
begin
if Size > 0
then
begin
inc(Size, 8);
result := OldMemMgr.GetMem(size);
if result <> nil
then
begin
PInteger(result)^ := Size;
p := pchar(result)+Size-4;
PInteger(p)^ := Magic;
inc(pchar(result), 4);
end;
end
else result := nil;
end;
function SysFreeMemCheck(P: Pointer): Integer;
var
q : pchar;
begin
if p <> nil
then
begin
dec(pchar(p), 4);
q := pchar(p)+ PInteger(p)^-4;
if PInteger(q)^= Magic
then result := OldMemMgr.FreeMem(P)
else raise Exception.Create(format('Memory corrupted detected, address: %x', [integer(p)]));
end
else result := 0;
end;
function SysReallocMemCheck(P: Pointer; Size: Integer): Pointer;
var
q : pchar;
begin
if p <> nil
then
begin
dec(pchar(p), 4);
q := pchar(p)+ PInteger(p)^-4;
if PInteger(q)^=Magic
then
begin
inc(size, 8);
result := OldMemMgr.ReallocMem(P, size);
end
else raise Exception.Create(format('Memory corrupted detected, address: %x', [integer(p)]));
if result <> nil
then
begin
PInteger(result)^ := Size;
q := pchar(result)+Size-4;
PInteger(q)^ := Magic;
inc(pchar(result), 4);
end;
end
else result := SysGetMemCheck(Size);
end;
procedure InitMemoryManager;
var
SharedMemoryManager: TMemoryManager;
begin
SharedMemoryManager.GetMem := SysGetMemCheck;
SharedMemoryManager.FreeMem := SysFreeMemCheck;
SharedMemoryManager.ReallocMem := SysReallocMemCheck;
GetMemoryManager(OldMemMgr);
SetMemoryManager(SharedMemoryManager);
end;
initialization
InitMemoryManager;
finalization
SetMemoryManager(OldMemMgr);
end.
|
unit uBarangUtils;
interface
uses
uDBUtils, uAppUtils, uModel, System.SysUtils, System.StrUtils;
type
TBarangUtils = class
public
class function IsKodeBarangSudahAda(AKode , AID : String): Boolean;
class function KonversiUOM(ABarangID, AUOMID : string) : Double;
end;
implementation
class function TBarangUtils.IsKodeBarangSudahAda(AKode , AID : String): Boolean;
var
sSQL: string;
begin
Result := False;
sSQL := 'select count(id)' +
' from tbarang where id <> ' + QuotedStr(AID) +
' and sku = ' + QuotedStr(AKode);
with TDBUtils.OpenDataset(sSQL) do
begin
try
if Fields[0].AsInteger > 0 then
begin
Result := True;
Exit;
end;
finally
Free;
end;
end;
end;
{ TBarangUtils }
class function TBarangUtils.KonversiUOM(ABarangID, AUOMID: string): Double;
var
sSQL : string;
begin
Result := 0;
sSQL := 'select konversi from tbarangsatuanitem '
+ ' where barang = ' + QuotedStr(ABarangID)
+ ' and uom = ' + QuotedStr(AUOMID);
with TDBUtils.OpenDataset(sSQL) do
begin
try
while not Eof do
begin
Result := FieldByName('Konversi').AsFloat;
Next;
end;
finally
Free;
end;
end;
end;
end.
|
{*******************************************************}
{ Проект: Repository }
{ Модуль: uPermissionImpl.pas }
{ Описание: Реализация IPermission }
{ Copyright (C) 2015 Боборыкин В.В. (bpost@yandex.ru) }
{ }
{ Распространяется по лицензии GPLv3 }
{*******************************************************}
unit uPermissionImpl;
interface
uses
uServices, Classes;
function CreatePermission: IPermission;
implementation
type
TPermission = class(TInterfacedObject, IPermission)
private
FAccessType: TAccessType;
FGranted: Boolean;
FRoles: TStringList;
FTokenName: string;
public
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
function GetAccessType: TAccessType; stdcall;
function GetGranted: Boolean; stdcall;
function GetRoles: TStringList; stdcall;
function GetTokenName: string; stdcall;
procedure SetAccessType(Value: TAccessType); stdcall;
procedure SetGranted(Value: Boolean); stdcall;
procedure SetTokenName(const Value: string); stdcall;
property AccessType: TAccessType read GetAccessType write SetAccessType;
property Granted: Boolean read GetGranted write SetGranted;
property Roles: TStringList read GetRoles;
property TokenName: string read GetTokenName write SetTokenName;
end;
{
********************************* TPermission **********************************
}
procedure TPermission.AfterConstruction;
begin
inherited;
FRoles := TStringList.Create;
FRoles.Duplicates := dupIgnore;
end;
procedure TPermission.BeforeDestruction;
begin
FRoles.Free;
inherited;
end;
function TPermission.GetAccessType: TAccessType;
begin
Result := FAccessType;
end;
function TPermission.GetGranted: Boolean;
begin
Result := FGranted;
end;
function TPermission.GetRoles: TStringList;
begin
Result := FRoles;
end;
function TPermission.GetTokenName: string;
begin
Result := FTokenName;
end;
procedure TPermission.SetAccessType(Value: TAccessType);
begin
if FAccessType <> Value then
begin
FAccessType := Value;
end;
end;
procedure TPermission.SetGranted(Value: Boolean);
begin
if FGranted <> Value then
begin
FGranted := Value;
end;
end;
procedure TPermission.SetTokenName(const Value: string);
begin
if FTokenName <> Value then
begin
FTokenName := Value;
end;
end;
function CreatePermission: IPermission;
begin
Result := TPermission.Create();
end;
end.
|
unit SandboxEnvironment;
interface
uses
JunoApi4Delphi.Interfaces;
type
TSandboxEnvironment = class(TInterfacedObject, iEnvironment)
private
CONST
AUTHORIZATION_SERVER = 'https://sandbox.boletobancario.com/authorization-server';
RESOURCE_SERVER = 'https://sandbox.boletobancario.com/api-integration';
public
constructor Create;
destructor Destroy; override;
class function New : iEnvironment;
function AuthorizationServerEndpoint : String;
function ResourceServerEndpoint : String;
end;
implementation
{ TSandboxEnvironment }
function TSandboxEnvironment.AuthorizationServerEndpoint: String;
begin
Result := AUTHORIZATION_SERVER;
end;
constructor TSandboxEnvironment.Create;
begin
end;
destructor TSandboxEnvironment.Destroy;
begin
inherited;
end;
class function TSandboxEnvironment.New: iEnvironment;
begin
Result := Self.Create;
end;
function TSandboxEnvironment.ResourceServerEndpoint: String;
begin
Result := RESOURCE_SERVER;
end;
end.
|
unit gdax.api.currencies;
{$i gdax.inc}
interface
uses
Classes, SysUtils, gdax.api.consts, gdax.api, gdax.api.types;
type
{ TGDAXCurrenciesImpl }
TGDAXCurrenciesImpl = class(TGDAXRestApi,IGDAXCurrencies)
strict private
FCurrencies: TCurrencyArray;
protected
function GetCount: Cardinal;
function GetCurrencies: TCurrencyArray;
strict protected
function GetEndpoint(Const AOperation: TRestOperation): String; override;
function DoGetSupportedOperations: TRestOperations; override;
function DoLoadFromJSON(Const AJSON: String;
out Error: String): Boolean;override;
public
property Currencies : TCurrencyArray read GetCurrencies;
property Count : Cardinal read GetCount;
end;
implementation
uses
fpjson,
jsonparser;
{ TGDAXCurrenciesImpl }
function TGDAXCurrenciesImpl.GetCount: Cardinal;
begin
Result := Length(FCurrencies);
end;
function TGDAXCurrenciesImpl.GetCurrencies: TCurrencyArray;
begin
Result := FCurrencies;
end;
function TGDAXCurrenciesImpl.GetEndpoint(Const AOperation: TRestOperation): String;
begin
Result:='';
if AOperation=roGet then
Result := GDAX_END_API_CURRENCIES;
end;
function TGDAXCurrenciesImpl.DoGetSupportedOperations: TRestOperations;
begin
Result:=[roGet];
end;
function TGDAXCurrenciesImpl.DoLoadFromJSON(Const AJSON: String; out
Error: String): Boolean;
var
I : Integer;
LJSON : TJSONArray;
LCurrency : TCurrency;
begin
Result := False;
try
//clear old entries
SetLength(FCurrencies,0);
LJSON := TJSONArray(GetJSON(AJSON));
if not Assigned(LJSON) then
raise Exception.Create(E_BADJSON);
try
//iterate and load currencies by json
for I:=0 to Pred(LJSON.Count) do
begin
LCurrency := TCurrency.Create(LJSON.Items[I].AsJSON);
SetLength(FCurrencies, Succ(Length(FCurrencies)));
FCurrencies[High(FCurrencies)]:=LCurrency;
end;
Result := True;
finally
LJSON.Free;
end;
except on E:Exception do
Error := E.Message;
end;
end;
end.
|
unit MainClientForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdTCPServer, IdTCPConnection, IdTCPClient, IdBaseComponent,
IdComponent, ShowDlgThreadUnit;
type
TMainForm = class(TForm)
IdTCPServer: TIdTCPServer;
IdTCPClient: TIdTCPClient;
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure IdTCPServerExecute(AThread: TIdPeerThread);
private
FMessages: TStringList;
FShowThread: TShowDlgThread;
procedure SendNetMessage(AHost, AMessage: String);
public
procedure ShowMessages;
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.FormDestroy(Sender: TObject);
begin
if FShowThread <> nil then
begin
FShowThread.Terminate;
FShowThread.WaitFor;
end;
FMessages.Free;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
FMessages := TStringList.Create();
Application.ShowMainForm := False;
if ParamCount > 1 then
begin
SendNetMessage(ParamStr(1), ParamStr(2));
Application.Terminate;
end
else
begin
IdTCPServer.Active := True;
FShowThread := TShowDlgThread.Create(False);
end;
end;
procedure TMainForm.IdTCPServerExecute(AThread: TIdPeerThread);
var
FromString: string;
MesssageString: string;
begin
MesssageString := AThread.Connection.ReadLnWait();
FMessages.Add(MesssageString);
AThread.Connection.Disconnect;
end;
procedure TMainForm.SendNetMessage(AHost, AMessage: String);
begin
try
IdTCPClient.Host := AHost;
IdTCPClient.Connect(5000);
except
end;
if IdTCPClient.Connected then
begin
IdTCPClient.WriteLn(AMessage);
IdTCPClient.Disconnect;
end;
end;
procedure TMainForm.ShowMessages;
begin
while FMessages.Count > 0 do
begin
MessageDlg(FMessages[0], mtInformation, [mbOK], 0);
FMessages.Delete(0);
end;
end;
end.
|
unit nsAppConfig;
(*-----------------------------------------------------------------------------
Название: nsAppConfig
Автор: М. Морозов.
Назначение: Отображение и редактирование настроек проекта.
История:
$Id: nsAppConfig.pas,v 1.343 2016/10/17 14:23:25 kostitsin Exp $
$Log: nsAppConfig.pas,v $
Revision 1.343 2016/10/17 14:23:25 kostitsin
{requestlink: 632194223 }
Revision 1.342 2016/09/26 13:39:57 kostitsin
{requestlink: 630589826 }
Revision 1.341 2016/09/13 18:32:10 kostitsin
{requestlink: 630194905 }
Revision 1.340 2016/08/05 12:05:11 lukyanets
Редактируем отложенные данные
Revision 1.339 2016/08/04 17:10:30 lulin
- перегенерация.
Revision 1.338 2016/08/04 11:35:51 lulin
- перегенерация.
Revision 1.337 2016/08/04 10:01:45 lulin
- перегенерация.
Revision 1.336 2016/08/02 10:14:39 lukyanets
Cleanup
Revision 1.335 2016/08/01 16:20:47 lulin
- перегенерация.
Revision 1.334 2016/07/15 11:30:59 lulin
- выпрямляем зависимости.
Revision 1.333 2016/05/30 13:49:34 kostitsin
{requestlink: 623926944 }
Revision 1.332 2016/04/05 15:38:32 kostitsin
{requestlink: 620672440 } - По умолчанию - старое основное меню
Revision 1.331 2016/04/05 11:06:42 kostitsin
{requestlink: 620672440 } - Переосмыслили позицию настройки в диалоге
Revision 1.330 2016/03/29 11:02:00 kostitsin
{requestlink: 620672440 } - Настройки
Revision 1.329 2016/01/19 11:22:33 kostitsin
{requestlink: 615698409 }
Revision 1.328 2016/01/11 13:15:59 kostitsin
{requestlink: 615114318 }
Revision 1.327 2015/04/23 10:21:49 lulin
http://mdp.garant.ru/pages/viewpage.action?pageId=596627087&focusedCommentId=597929314#comment-597929314
Revision 1.326 2014/12/08 13:06:22 kostitsin
{requestlink: 580689608 }
Revision 1.325 2014/10/21 11:15:52 morozov
{RequestLink: 565841996}
Revision 1.324 2014/10/13 09:01:04 morozov
{RequestLink: 565841996}
Revision 1.323 2014/07/30 08:39:12 morozov
Вернул настройки подтверждений для "моих документов"
Revision 1.322 2014/07/24 10:26:24 morozov
{RequestLink: 340174500}
Revision 1.321 2014/06/24 06:12:28 morozov
{RequestLink: 340174500}
Revision 1.320 2014/06/18 11:22:11 kostitsin
{requestlink: 513615258 }
Revision 1.319 2014/05/23 09:36:23 morozov
{RequestLink: 518765917}
Revision 1.318 2014/01/14 18:02:07 kostitsin
{requestlink:507441274}
Revision 1.317 2013/11/29 12:50:32 kostitsin
[$372643503]
Revision 1.316 2013/10/25 13:29:00 morozov
{RequestLink: 423620375}
Revision 1.315 2013/10/04 12:12:19 morozov
{RequestLink: 488606734}
Revision 1.314 2013/10/04 10:20:03 morozov
{RequestLink: 488606734}
Revision 1.313 2013/09/25 17:13:06 lulin
- рефакторим подписку к настройкам.
Revision 1.312 2013/09/18 13:47:41 lulin
{RequestLink:414849897}
Revision 1.311 2013/09/18 11:46:52 morozov
{RequestLink: 481440254}
Revision 1.310 2013/09/17 14:04:50 lulin
- синхронизируем отображение со значением настройки.
Revision 1.309 2013/09/12 12:15:02 kostitsin
[$476838236] - nsConfigurationProperties
Revision 1.308 2013/09/10 14:22:00 lulin
- выносим настройку печати из модуля "Документ".
Revision 1.307 2013/09/10 04:42:55 lulin
- генерируем ключи для вложенных настроек.
Revision 1.306 2013/09/09 13:05:11 kostitsin
[$476838236]
Revision 1.305 2013/09/05 09:24:03 kostitsin
[$476838236] - закончил c ddAppConfigTypes
Revision 1.304 2013/09/03 09:35:30 kostitsin
[$476838236]
Revision 1.303 2013/08/28 08:01:24 lulin
- реорганизуем модель.
Revision 1.302 2013/08/27 15:28:47 kostitsin
[$476838236]
Revision 1.301 2013/08/23 12:58:46 lulin
{RequestLink:414849897}
Revision 1.300 2013/08/22 15:35:24 lulin
{RequestLink:414849897}
- делаем возможность вкладывать в значения настроек другие настройки.
- автоматом проставляем связь реализации вложенным настройкам.
Revision 1.299 2013/08/22 12:15:34 kostitsin
[$476838236]
Revision 1.298 2013/08/20 14:44:28 kostitsin
[$414849897] - перенес "мапу" на модель
Revision 1.297 2013/08/20 10:33:58 kostitsin
[$414849897] - настройку шрифта для печати и экспорта необходимо удалить.
Revision 1.296 2013/08/20 10:07:54 kostitsin
[$414849897] - новые контролы на форме настройки
Revision 1.295 2013/07/04 07:41:39 dinishev
{Requestlink:462555887}
Revision 1.294 2013/07/02 14:21:32 morozov
{RequestLink:434744658}
Revision 1.293 2013/05/24 08:38:30 morozov
{RequestLink:372641792}
Revision 1.292 2013/05/23 06:55:39 morozov
{RequestLink:372641792}
Revision 1.291 2013/05/13 17:23:47 lulin
- разборки с упавшими тестами.
Revision 1.290 2013/04/24 09:35:57 lulin
- портируем.
Revision 1.289 2012/09/18 11:19:28 kostitsin
[$393644295]
Revision 1.288 2012/05/22 03:52:38 kostitsin
[$278844315]
Revision 1.287 2012/05/22 03:08:56 kostitsin
[$365835680]
Revision 1.286 2012/05/21 17:09:52 kostitsin
[$276541294]
Revision 1.285 2012/05/21 16:51:07 kostitsin
[$365825806]
Revision 1.284 2012/05/21 15:06:55 kostitsin
[$365833331]
Revision 1.283 2012/04/28 13:10:31 lulin
{RequestLink:361404275}
Revision 1.282 2012/04/28 09:52:01 lulin
{RequestLink:294599518}
Revision 1.281 2012/04/27 16:00:59 lulin
{RequestLink:361404275}
Revision 1.280 2012/04/18 12:42:18 lulin
{RequestLink:356847447}
Revision 1.279 2012/04/09 08:41:25 lulin
{RequestLink:237994598}
- думаем о VGScene.
Revision 1.278 2012/04/06 12:41:37 lulin
{RequestLink:237994598}
Revision 1.277 2012/04/04 09:03:18 lulin
{RequestLink:237994598}
Revision 1.276 2012/03/23 13:04:11 lulin
- отпиливаем настройки.
Revision 1.275 2011/12/20 13:48:13 kostitsin
http://mdp.garant.ru/pages/viewpage.action?pageId=300516302
Revision 1.274 2011/11/02 15:19:40 lulin
{RequestLink:265395473}
Revision 1.273 2011/10/19 08:49:32 lulin
{RequestLink:278832944}.
[$294591153].
Revision 1.272 2011/10/17 10:49:31 lulin
{RequestLink:268341330}.
Revision 1.271 2011/09/23 16:38:28 lulin
{RequestLink:217681331}.
Revision 1.270 2011/07/28 13:12:24 lulin
{RequestLink:209585097}.
Revision 1.269 2011/07/28 08:39:47 lulin
{RequestLink:275780337}.
Revision 1.268 2011/07/27 18:18:40 lulin
{RequestLink:275780337}.
Revision 1.267 2011/06/28 19:19:59 lulin
{RequestLink:254944102}.
Revision 1.266 2011/06/28 17:55:00 lulin
{RequestLink:254944102}.
Revision 1.265 2011/06/23 15:32:16 lulin
{RequestLink:254944102}.
Revision 1.264 2011/06/17 12:31:51 lulin
{RequestLink:228688486}.
Revision 1.263 2011/06/08 16:06:29 lulin
{RequestLink:267326476}.
Revision 1.262 2011/06/06 13:10:42 lulin
{RequestLink:268345098}.
[$268347311].
Revision 1.261 2011/05/19 12:19:31 lulin
{RequestLink:266409354}.
Revision 1.260 2011/04/04 16:04:20 lulin
{RequestLink:259175088}.
Revision 1.259 2011/02/24 18:14:26 vkuprovich
{RequestLink:254345841}
Повторный commit, т.к. в прошлый раз пропали изменения
Revision 1.258 2011/02/24 17:41:32 vkuprovich
{RequestLink:254345841}
Для сообщений с .DefaultChoice в настройках выводятся не все варианты выбора
Revision 1.257 2011/02/15 13:25:25 lulin
{RequestLink:231670346}.
Revision 1.256 2011/02/04 15:30:39 lulin
{RequestLink:252523791}.
Revision 1.255 2011/01/27 12:16:51 lulin
{RequestLink:248195582}.
- избавляемся от развесистых макарон.
Revision 1.254 2010/12/21 13:27:18 migel
- add: для настройки "Включить интеграцию с MS Office" пишем и проверяем значение в реестре.
Revision 1.253 2010/12/21 11:34:05 migel
- add: настройка "Включить интеграцию с MS Office".
Revision 1.252 2010/10/11 08:42:38 oman
- new: {RequestLink:235871729}
Revision 1.251 2010/09/13 16:00:41 lulin
{RequestLink:235047275}.
Revision 1.250 2010/07/15 12:28:41 oman
- new: Заготовки {RequestLink:226002365}
Revision 1.249 2010/04/13 10:18:29 oman
- new: {RequestLink:185205058}
Revision 1.248 2010/03/10 19:42:14 lulin
{RequestLink:196445017}.
Revision 1.247 2010/03/10 17:50:51 lulin
{RequestLink:196445017}.
Revision 1.246 2010/03/10 16:46:43 lulin
{RequestLink:196445017}.
Revision 1.245 2010/02/26 13:42:48 oman
- new: Заготовки {RequestLink:190251273}
Revision 1.244 2009/12/15 09:16:13 oman
- new: Заготовка {RequestLink:173933321}
Revision 1.243 2009/11/09 11:21:14 lulin
- промежуточный коммит избавления от внутренних операций без параметров.
Revision 1.242 2009/10/15 06:42:48 oman
- new: Реализация перманентых настроек {RequestLink:122652464}
Revision 1.241 2009/10/14 08:06:33 oman
- new: {RequestLink:166855015}
Revision 1.240 2009/09/24 09:25:36 lulin
[$164594698].
Revision 1.239 2009/09/23 13:32:45 lulin
- начинаем перенос модуля Настройки на модель.
Revision 1.238 2009/09/15 16:33:10 lulin
- основной модуль мониторингов полностью перенесён на модель.
Revision 1.237 2009/09/15 12:50:29 lulin
- сделана фабрика для формы настроек принтера.
Revision 1.236 2009/07/29 13:09:02 oman
- new: Настройка конфигурации - {RequestLink:152408792}
Revision 1.235 2009/07/29 12:27:57 oman
- new: Настройка конфигурации - {RequestLink:152408792}
Revision 1.234 2009/06/10 08:48:56 oman
- new: Показываем в настройках - [$151585826]
Revision 1.233 2009/06/08 08:18:27 oman
- new: Показываем настройку - [$140286494]
Revision 1.232 2009/04/20 15:06:07 oman
- new: Форма групп в первом приближении - [$127762671]
Revision 1.231 2009/03/25 16:01:53 lulin
[$136937722]. Добавляем кнопки, настройки, иконки.
Revision 1.230 2009/02/19 19:05:04 lulin
- переносим идентификаторы сообщений.
Revision 1.229 2009/02/10 19:03:57 lulin
- <K>: 133891247. Вычищаем морально устаревший модуль.
Revision 1.228 2009/02/10 15:43:36 lulin
- <K>: 133891247. Выделяем интерфейсы локализации.
Revision 1.227 2009/02/10 12:53:46 lulin
- <K>: 133891247. Выделяем интерфейсы настройки.
Revision 1.226 2009/01/20 17:03:14 lulin
- bug fix: <K> 135600354.
Revision 1.225 2008/12/25 12:20:13 lulin
- <K>: 121153186.
Revision 1.224 2008/12/24 19:49:46 lulin
- <K>: 121153186.
Revision 1.223 2008/11/07 14:47:44 lulin
- <K>: 121167570.
Revision 1.222 2008/10/29 17:14:02 lulin
- <K>: 121159661.
Revision 1.221 2008/10/03 11:38:40 lulin
- bug fix: не собиралось.
Revision 1.220 2008/09/25 12:26:55 oman
- fix: Текст сообщения (К-109087200)
Revision 1.219 2008/07/31 07:01:16 oman
- new: Разрешаем кнопку ок (K-96481354)
Revision 1.218 2008/07/31 05:20:17 oman
K-96481266
Revision 1.217 2008/07/29 06:17:40 dolgop
- не собирался проект.
Revision 1.216 2008/07/22 10:10:20 oman
- new: Отключение пищалки - настроки (К-103940886)
Revision 1.215 2008/07/22 09:47:32 oman
-fix: Переименовали настройки взад (К-103940652)
Revision 1.214 2008/07/17 12:00:25 oman
- new: Поддержка сообщений с радиокнопками в настройках (К-103449075)
Revision 1.213 2008/07/15 14:38:00 lulin
- <K>: 98828459.
Revision 1.212 2008/07/15 08:18:23 oman
- new: Переименовывание выборов (К-96482449)
Revision 1.211 2008/07/15 08:00:03 oman
- new: Готовимся к переименовыванию выборов (К-96482449)
Revision 1.210 2008/06/20 08:39:55 oman
- fix: Убрали подтверждение (cq29304)
Revision 1.209 2008/05/15 20:15:33 lulin
- тотальная чистка.
Revision 1.208 2008/04/17 05:53:54 mmorozov
- new: "Экспортировать и печатать списки без вхождений" настраивается для документов и препаратов.
Revision 1.207 2008/04/10 07:45:34 oman
- new: запрещаем вкладки (cq28755)
Revision 1.206 2008/03/26 17:40:22 lulin
- <K>: 88080899.
Revision 1.205 2008/03/26 11:37:12 lulin
- зачистка в рамках <K>: 88080898.
Revision 1.204 2008/03/26 11:12:48 lulin
- зачистка в рамках <K>: 88080898.
Revision 1.203 2008/02/15 12:10:09 oman
- fix: детерминируем порядок в списках подписчиков
Revision 1.202 2008/02/13 11:24:02 oman
Опечатка
Revision 1.201 2008/02/13 11:15:19 oman
- new: Настройки для советов дня (cq28223, 16723)
Revision 1.200 2008/02/04 13:02:45 oman
- fix: Подтверждения не на той странице (cq28344)
Revision 1.199 2008/01/31 11:58:40 oman
- new: Заготовки сообщений (cq28344, 28328)
Revision 1.198 2008/01/31 11:37:24 oman
- new: Спрашиваем перед пересылкой выеделния по почте (cq28346)
Revision 1.197 2008/01/21 07:18:45 mmorozov
- new: работа с пользовательскими ссылками на докумени и из документа перенесене на sdsDocInfo, чтобы быть доступной для списка и документа + сопутствующий рефакторинг (в рамках работы над CQ: OIT5-17587);
Revision 1.196 2008/01/10 07:23:32 oman
Переход на новый адаптер
Revision 1.195 2007/12/18 08:51:54 mmorozov
- bugfix: шаблон был включен дважды (в рамках CQ: OIT5-27823);
Revision 1.194 2007/12/17 12:42:58 mmorozov
- rename method (в рамках CQ: OIT5-27823);
Revision 1.193 2007/12/17 12:22:44 mmorozov
- уведомления о начале редактирования, а также изменения пользовательских настроек + избавляемся от операции enSystem.opConfigUpdated (в рамках CQ: OIT5-27823);
Revision 1.192 2007/12/11 07:01:34 mmorozov
- вызываем родительские обработчики (в рамках CQ: OIT5-27823);
Revision 1.191 2007/12/10 12:50:58 mmorozov
- new: реализуем шаблон publisher\subscriber при редактировании настроек, замены настроек (переключения конфигураций), настройке панелей инструментов (в рамках CQ: OIT5-27823);
Revision 1.190 2007/12/07 16:26:07 lulin
- переименовываем файл, чтобы не путать с другой библиотекой.
Revision 1.189 2007/11/15 12:33:42 oman
- new: Групповые операции для привилегированных пользователей (cq27255)
Revision 1.188 2007/10/22 07:45:22 oman
- new: Настройки для панели задач (cq27155)
Revision 1.187 2007/09/20 08:24:45 oman
- fix: Переместили подверждения (cq26746)
Revision 1.186 2007/09/10 12:00:15 oman
- fix: Настройки администратора показываем только
администратору (cq26639)
Revision 1.185 2007/08/14 19:31:52 lulin
- оптимизируем очистку памяти.
Revision 1.184 2007/08/10 13:27:37 oman
- fix: "Нелогичный диалог" (с) (cq26327)
Revision 1.183 2007/06/14 14:08:59 oman
- new: При попытке открыть пустую папку выводим таки
всплывающее окошко (cq25673)
Revision 1.182 2007/06/01 12:03:15 oman
- fix: Запрещаем опцию Ситуации для преемственной ППС (cq25510)
Revision 1.181 2007/06/01 11:06:47 oman
- fix: Запрещаем опцию Ситуации для преемственной ППС (cq25510)
Revision 1.180 2007/05/28 07:58:59 oman
- fix: Параметры контекстного поиска подравниваем по левому
краю (cq25414)
Revision 1.179 2007/05/24 14:13:37 oman
- new: Мультиоперации в администраторе (удалить, права на консалтинг
и отключить) (cq25336)
Revision 1.178 2007/05/17 14:23:24 oman
- new: При посылке проверки статуса подключения правовой
поддержки выводим всплывающее окно (cq25300)
Revision 1.177 2007/04/20 13:47:16 oman
- new: Вычищаем старую ППР и старые фильтры - пока из
редактирования настроек конфигурации (cq25125)
Revision 1.176 2007/04/13 08:08:08 oman
- new: Новый реквизит - e-mail и новый гиперлинк - проверка
подключения к ПП (cq24926, 24416)
Revision 1.175 2007/04/12 13:30:32 oman
- new: более наглядная индикация полученного ответа по
линии Правового консалтинга (cq24493)
Revision 1.174 2007/04/11 13:00:25 oman
- fix: Не был реализован абстракный метод (cq25003)
Revision 1.173 2007/04/10 14:52:09 oman
cleanup (cq23401)
Revision 1.172 2007/04/10 13:33:43 oman
- new: Назойливо предлагаем пользователю оценить консультацию (cq24524)
Revision 1.171 2007/04/10 09:22:44 oman
- fix: Подтверждение с галкой не попадало в редактирование
настроек (cq23405)
Revision 1.170 2007/04/05 10:22:38 lulin
- избавляемся от лишних преобразований строк.
Revision 1.169 2007/04/05 07:58:25 lulin
- избавляемся от лишних преобразований строк при записи в настройки.
Revision 1.168 2007/03/28 19:43:06 lulin
- ЭлПаковский редактор переводим на строки с кодировкой.
Revision 1.167 2007/03/21 11:54:55 oman
- выделил фабричную функцию для производства параметров
контекстной фильтрации
Revision 1.166 2007/03/21 11:30:38 oman
- new: добавил нотификацию о переключении конфигураций и возможной смене
всех настроек
Revision 1.165 2007/03/21 10:30:52 oman
- new: Выделил хранителя параметров контекстной фильтрации
Revision 1.164 2007/03/20 11:57:37 lulin
- cleanup.
Revision 1.163 2007/03/20 11:38:20 lulin
- не теряем кодировку при присваивании заголовков форм и контролов.
Revision 1.162 2007/03/20 10:52:52 oman
- fix: Параметры контекстнйо фильтрации определяем без
nscContextParams
Revision 1.161 2007/03/19 14:42:23 lulin
- используем "родной редактор".
Revision 1.160 2007/03/19 14:34:01 lulin
- избавляемся от преобразования строк.
Revision 1.159 2007/03/19 11:35:28 lulin
- разделяем приведение к строке для форматирования и для исключения.
Revision 1.158 2007/03/16 12:20:29 lulin
- переводим на строки с кодировкой.
Revision 1.157 2007/03/13 13:28:37 oman
- new: Настроки для _SubPanel редактора (cq24618)
Revision 1.156 2007/02/28 14:17:46 lulin
- переводим на строки с кодировкой.
Revision 1.155 2007/02/13 15:41:44 mmorozov
- change: настройка форма зоны синхронного просмотра по умолчанию приобрела другой вид и другие формулировки (CQ: OIT5-24379);
Revision 1.154 2007/02/13 14:33:28 lulin
- cleanup.
Revision 1.153 2007/02/13 09:37:50 lulin
- cleanup.
Revision 1.152 2007/02/13 09:33:48 lulin
- переводим на строки с кодировкой.
Revision 1.151 2007/02/12 16:39:11 lulin
- переводим на строки с кодировкой.
Revision 1.150 2007/02/12 09:58:49 lulin
- bug fix: искажались входные строковые параметры адаптера.
Revision 1.149 2007/02/10 13:25:59 lulin
- переводим на строки с кодировкой.
Revision 1.148 2007/02/09 12:58:27 lulin
- выделена функция преобразования к входной строке адаптера.
Revision 1.147 2007/02/08 09:20:40 mmorozov
- new: показ аннотации в зоне синхронного просмотра (CQ: OIT5-24105);
Revision 1.146 2007/02/07 19:13:35 lulin
- переводим мапы на строки с кодировкой.
Revision 1.145 2007/02/07 17:48:48 lulin
- избавляемся от копирования строк при чтении из настроек.
Revision 1.144 2007/02/06 15:20:54 lulin
- переводим на строки с кодировкой.
Revision 1.143 2007/01/19 14:36:06 oman
- new: Локализация библиотек - dd (cq24078)
Revision 1.142 2007/01/19 09:50:12 oman
- new: Локализация библиотек - dd (cq24078)
Revision 1.141 2007/01/18 12:57:24 mmorozov
- new: Простое основное меню (CQ: OIT5-23939);
Revision 1.140 2006/12/12 11:57:35 oman
- fix: Поскольку настройка тулбаров работает только с активной
конфигурацией - запрещаем при редактировании неактивных
(cq23863)
Revision 1.139 2006/12/11 15:53:38 mmorozov
MERGE WITH B_NEMESIS_6_4;
Revision 1.135.2.6.2.1 2006/12/11 13:01:22 mmorozov
- new: вкладка с переводом у прецедента документ (CQ: OIT5-23834);
Revision 1.138 2006/12/11 09:57:16 oman
- new: Убраны неактуальные настройки (cq12564)
Revision 1.137 2006/12/06 08:00:40 lulin
- везде используем одни и те же метки.
Revision 1.136 2006/11/03 09:46:03 oman
Merge with B_NEMESIS_6_4_0
Revision 1.135.2.6 2006/10/31 16:19:06 oman
- fix: СКР переведены со строк на типы (cq23213)
Revision 1.135.2.5 2006/10/26 13:43:38 mmorozov
- new: локализация (CQ: OIT5-23236);
Revision 1.135.2.4 2006/10/25 07:54:46 oman
Готовимся к завершению локализации настроек СКР
Revision 1.135.2.3 2006/10/25 07:29:56 oman
Продолжаем избавлятся от StdStr
Revision 1.135.2.2 2006/10/18 08:36:14 lulin
- выливаем подсказки для сообщений.
Revision 1.135.2.1 2006/10/18 08:00:56 lulin
- заголовок для настроек приобрел общее название.
Revision 1.135 2006/10/10 13:18:42 oman
- fix: Мапа для типов СКР. Пока полуживая - не выделено понятие
"Все документы" и нет четкой типизации, потом надо будет докрутить
(cq22964)
Revision 1.134 2006/09/22 09:46:20 oman
- new: Новые сообщения про оплату консультации + их вынос
в настройки (cq22681)
Revision 1.133 2006/09/06 09:45:40 oman
- fix: Для сообщений с кнопкой OK не сохранялся признак "не
спрашивать"
- fix: Не сохранялась конфигурация по умолчанию (cq22457)
Revision 1.132 2006/07/18 09:08:00 mmorozov
new: настраиваемая возможность "Экспортировать и печатать списки без вхождений" (CQ: OIT50010826);
Revision 1.131 2006/06/29 11:56:11 mmorozov
- change: изменения в связи с поялением типа GblAdapter.TDateTime;
Revision 1.130 2006/06/20 11:46:23 oman
- fix: При ошибочных значениях диалог настройки конфигурации
закрывался, а не должен был (cq21402)
Revision 1.129 2006/06/09 08:49:19 oman
- new beh: Галка для уведомления об отправке консультации вынесена
в настройки конфигурации (cq21285)
Revision 1.128 2006/06/09 08:28:23 oman
- fix: Запросы на сохранение/восстановление значений по умолчанию
для таблицы стилей (cq18958)
Revision 1.127 2006/05/31 08:25:52 oman
- fix: При переключении конфигурации не обновлялись шорткаты (cq17830)
Revision 1.126 2006/05/18 13:45:17 oman
cleanup
Revision 1.125 2006/05/04 07:57:26 oman
- new beh: для комбобоксов при редактирования настроек пользуем мапы значений
Revision 1.124 2006/05/03 14:25:42 oman
- change: сведение редактирования настроек к одним воротам
- new beh: операция "восстановить все" для списка конфигураций (cq20377)
Revision 1.123 2006/04/25 13:52:28 oman
- change: Собирание интерфейсов по редактированию настроек в одно место
- new beh: Интерфейсы по работе с настройками конфигурации и
списком конфигураций (cq20377)
Revision 1.122 2006/04/19 11:45:17 oman
- fix: Были перепутаны мапы для параметров контекстного поиска (cq20545)
Revision 1.121 2006/04/12 13:15:01 oman
- change: перевод механизма локализации строк на использование фабрик
- new beh: Локализация nsc
Revision 1.120 2006/04/06 11:24:17 oman
- new beh: Перевод на механизм мап "строка для отображения в UI"-<нечто>.
Revision 1.119 2006/04/06 06:05:45 oman
- new beh: В мессагах уделен Key, переименован ShortCaption => _ControlCaption,
добавлен _ControlHint
Revision 1.118 2006/04/05 14:52:21 oman
- new beh: Перевод на механизм мап "строка для отображения в UI"-<нечто>.
Revision 1.117 2006/04/05 08:51:34 oman
- new beh: Перевод на механизм мап "строка для отображения в UI"-<нечто>.
Revision 1.116 2006/04/04 14:03:43 oman
- new beh: Перевод на механизм мап "строка для отображения в UI"-<нечто>.
Revision 1.115 2006/04/04 09:23:52 oman
- new beh: Перевод на механизм мап "строка для отображения в UI"-<нечто>.
- fix: в масштаб картинки можно было вписать билеберду (cq20204)
Revision 1.114 2006/04/04 06:33:27 oman
cleanup
Revision 1.113 2006/04/03 15:01:27 oman
- new beh: Перевод на механизм мап "строка для отображения в UI"-<нечто>.
Revision 1.112 2006/04/03 12:00:17 oman
- new beh: Реализация механизм мап "строка для отображения в UI"-<нечто>.
Revision 1.111 2006/03/17 14:15:01 oman
- cleanup: Устаревшее сообщение из настроек конфигурации
Revision 1.110 2006/03/17 13:52:11 oman
- change: Избавляемся от %s в сообщениях, которые приездают не с адаптера
Revision 1.109 2006/03/16 12:12:53 oman
- new beh: Перекладываем все текстовые константы в три места (StdStr, DebugStr и SystemStr)
Revision 1.108 2006/03/16 11:36:00 oman
- new beh: Перекладываем все текстовые константы в три места (StdStr, DebugStr и SystemStr)
Revision 1.107 2006/03/10 06:41:35 mmorozov
- bugfix: не освобождался IConfiguration;
Revision 1.106 2006/01/18 09:37:46 oman
- cleanup (убраны не использовавшиеся методы)
Revision 1.105 2005/12/08 13:33:07 oman
- fix: возможно текла ссылка IvcmSettings
Revision 1.104 2005/12/02 08:58:31 oman
- fix: При переименовании конфигурации не синхронизировалось меню
Revision 1.103 2005/12/01 12:15:39 oman
- fix: Название конфигурации не сохранялось при сохранении по умолчнию
Revision 1.102 2005/11/11 19:40:39 mmorozov
- _format code;
Revision 1.101 2005/09/21 08:34:52 dolgop
- change: изменения, связанные с появлением IString в Settings
Revision 1.100 2005/06/30 07:48:19 cyberz
READY FOR TIE-TEMPLATE GENERATION
Revision 1.99 2005/04/12 12:56:59 demon
- fix: орфографическая ошибка.
Revision 1.98 2005/04/12 12:45:37 demon
- fix: поправлен хинт к настройке Показ вкладки Информация о документе.
Revision 1.97 2005/04/12 10:18:47 demon
- new behavior: Вкладка атрибуты и все связанные с ней операции переименованы. Новое имя - Информация о документе.
Revision 1.96 2005/04/06 12:44:01 am
change: убрал настройку-подтверждение qr_ListWasSaved
Revision 1.95 2005/04/06 10:34:00 am
bugfix: орфография
Revision 1.94 2005/03/29 07:22:42 am
change: переместил настройку про вкладку атрибутов
Revision 1.93 2005/03/25 11:39:36 am
pi_Document_Sheets_Attributes - настройка "открывать ли атрибуты при открытии документа"
Revision 1.92 2005/03/24 08:21:15 mmorozov
new: настройки для выдачи предупреждения при построении автореферата;
Revision 1.91 2005/03/10 11:42:48 mmorozov
new: property TnsManagerConfig.IsShowDialog;
Revision 1.90 2005/03/09 13:47:20 am
change: в случае равенства настроек пользовательских вкладок тип. корр\респ. не только выкидываем сообщение, но и переключаемся на нужную страницу с настройками
Revision 1.89 2005/03/09 12:46:49 am
change: при выборе настройки типа показываемой пользовательской вкладки корр\респ как "не показывать", дизейблим выбор тип. корр\респ.
Revision 1.88 2005/03/04 12:10:53 am
change: запрещаем выбирать одинаковые настройки для пользовательских вкладок корр\респ.
Revision 1.87 2005/03/01 10:38:36 am
change: настройки для новых вкладок типизированых корр\респ.
Revision 1.86 2005/02/25 14:46:55 mmorozov
new: property TnsManagerConfig.ShowDialog;
Revision 1.85 2005/02/14 12:06:40 mmorozov
bugfix: орфографическая ошибка;
Revision 1.84 2005/01/31 06:54:23 mmorozov
new: настройки для определения плавного скрытия навигатора;
Revision 1.83 2005/01/30 16:37:00 mmorozov
change: вместо самостоятельного перебора настроек для определения состояния "изменено" используем ddAppConfig.Changed, которое учитывает все типы элементов;
Revision 1.82 2005/01/30 14:44:46 mmorozov
change: управление видимость и положение вкладки "Фильтры" перенесено в раздел "Поведение системы";
Revision 1.81 2005/01/28 15:33:41 am
new: подтверждение при перезаписи объекта
Revision 1.80 2005/01/26 13:01:51 mmorozov
new: настройки для основного меню выделены в группу;
Revision 1.79 2005/01/25 08:23:23 mmorozov
change: captions;
Revision 1.78 2005/01/21 15:06:11 mmorozov
new: расшифровки (hint) для параметров контекстной фильтрации;
Revision 1.77 2005/01/20 14:18:52 mmorozov
change: _caption;
Revision 1.76 2005/01/20 12:47:43 mmorozov
new: выводим сообщение об ошибки при сохранении;
Revision 1.75 2005/01/17 11:01:01 mmorozov
- change _caption;
Revision 1.74 2005/01/17 09:17:36 lulin
- убраны Warning'и.
Revision 1.73 2005/01/14 17:22:11 mmorozov
new: использование для параметров контекстной фильтрации MasterSlaveItem;
Revision 1.72 2005/01/11 16:22:41 am
change: Комментарий пользователя - Мой комментарий
Revision 1.71 2005/01/08 13:46:32 mmorozov
- _format code;
Revision 1.70 2005/01/08 11:26:17 mmorozov
- cleanup code;
Revision 1.69 2005/01/08 11:24:33 mmorozov
remove: старая реализация контекстной фильтрации;
Revision 1.68 2005/01/08 10:35:06 mmorozov
new: используем cContextParamsTrees для формирования параметров контекстной фильтрации;
Revision 1.67 2005/01/08 09:29:20 mmorozov
new: Новый раздел "Контекстная фильтрация";
Revision 1.66 2004/12/28 12:20:52 mmorozov
change: settings _caption;
Revision 1.65 2004/12/28 12:17:07 mmorozov
change: FreeAndNil -> vcmFree;
Revision 1.64 2004/12/28 10:31:17 mmorozov
new: настройки для списков журнала, последних открытых документов и запросов;
Revision 1.63 2004/12/25 09:35:55 mmorozov
change: Закладки -> Вкладки;
change: определения положения вкладки фильтры из поиска и списка документов перенесено в поведение системы;
Revision 1.62 2004/12/23 08:41:39 lulin
- вычищен ненужный модуль.
Revision 1.61 2004/12/17 09:06:53 am
new: в секции "настройки интерфейса" появилась кнопка "Панели инструментов"
Revision 1.60 2004/11/24 12:38:00 mmorozov
change: изменен hint и название настройки qr_StyleTableChanged;
Revision 1.59 2004/11/15 15:50:54 mmorozov
add: qr_DropChangeStatusAllObjects (подтверждение сброса статуса изменен со всех объектов);
Revision 1.58 2004/11/09 13:19:14 mmorozov
change: идентификатор cFrmIDDictionaryTerm;
Revision 1.57 2004/10/27 16:21:53 mmorozov
- изменения в связи с возможностью восстанавливать, записывать по умолчанию "Настройки страницы";
Revision 1.56 2004/10/26 17:15:37 mmorozov
new: возможность восстанавливать "Настройки страницы";
Revision 1.55 2004/10/26 09:36:26 mmorozov
- синтаксис;
Revision 1.54 2004/10/25 15:25:02 mmorozov
new: type TnsHistoryItemsProperty;
new: определение значения для g_vcmHistoryLimit (элементов в истории);
Revision 1.53 2004/10/12 12:54:59 demon
- new behavior: подтверждение выхода из системы добавлено в конфигурацию.
Revision 1.52 2004/10/07 15:06:07 mmorozov
new: method Reload;
Revision 1.51 2004/10/01 14:44:59 am
change: запрет ввода отрицательных значений в "Поиск/Подтверждения/Спрашивать подтверждение на построение списка после поиска при количестве документов от"
Revision 1.50 2004/09/30 10:59:22 mmorozov
change: Оглавление -> Структура документа;
Revision 1.49 2004/09/30 08:17:20 mmorozov
change: Положение -> Показывать;
Revision 1.48 2004/09/27 14:09:58 mmorozov
new: управление закладками "На контроле", "Термины словаря";
Revision 1.47 2004/09/17 12:59:06 lulin
- все что было возможно перевел с _TStrings на IvcmStrings.
Revision 1.46 2004/09/15 15:16:41 am
change: убрал настройку рубрикатора
Revision 1.45 2004/09/15 14:11:39 lulin
- заменил _TStringList на _TvcmStringList.
Revision 1.44 2004/09/10 13:58:16 demon
- fix: удалены избыточные сообщения
Revision 1.43 2004/09/10 12:34:43 mmorozov
change: сигнатура _AddComboBoxItem;
Revision 1.42 2004/09/07 16:22:18 law
- перевел Nemesis на кешированные обьекты.
Revision 1.41 2004/08/27 11:21:56 mmorozov
change: li_Search_ContextFilterType0 -> li_Search_cftAtBegining;
change: li_Search_ContextFilterType1 -> li_Search_cftAnyPosition;
Revision 1.40 2004/08/25 09:02:17 mmorozov
new: реализация в соответствии с новым ТЗ;
Revision 1.39 2004/08/25 06:41:02 mmorozov
bugfix: при мапинге подтверждений использовался mrOk вместо mrYes;
Revision 1.38 2004/08/24 14:32:20 mmorozov
change: реализация настроек системы в соответствии с ТЗ от УМ;
Revision 1.37 2004/08/24 12:42:23 mmorozov
new: работа по новому ТЗ над настройками;
Revision 1.36 2004/08/24 09:11:41 mmorozov
new: не доступен выбор языка системы;
----------------------------------------------------------------------------*)
interface
{$Include nsDefine.inc}
{$If not defined(Admin) AND not defined(Monitorings)}
uses
Classes,
Forms,
ExtCtrls,
StdCtrls,
Controls,
SysUtils,
l3Interfaces,
l3MessageID,
l3VCLStrings,
afwInterfaces,
vcmBase,
vcmInterfaces,
vcmExternalInterfaces,
vcmMessagesCollectionItem,
Dialogs,
ddConfigStorages,
ddAppConfigConst,
ddAppConfig,
ddAppConfigTypes,
nscComboBox,
nsConfiguration,
SettingsUnit,
InsConfigNotifyRecipientPtrList,
bsInterfaces,
ConfigInterfaces,
vcmGUI
;
type
EDuplicateConfName = class(Exception)
{* - генерируется при дублировании имени конфигурации. }
private
// property fields
f_ConfName: AnsiString;
private
// property methods
procedure SetConfName(const Value: AnsiString);
{-}
public
// public properties
property ConfName : AnsiString
read f_ConfName
write SetConfName;
{-}
end;//EDuplicateConfName
ECRSettingsAreEqual = class(Exception);
EConfigNotSaved = class(Exception);
TnsHistoryItemsProperty = class(TddIntegerConfigItem)
{* - количество элементов в истории. }
public
// public methods
procedure SaveValue(const aStorage : IddConfigStorage);
override;
{* - помимо сохранения настройки установим значене g_vcmHistoryLimit. }
end;//TnsHistoryItemsProperty
TnsConfInfoNode = class(TddCustomConfigNode)
{* - панель информации конфигурации. }
private
// internal fields
f_Frame : TFrame;
f_ConfName : TnscComboBox;
f_ConfHint : TnscComboBox;
f_Changed : Boolean;
f_Config : Pointer;
private
// internal methods
procedure OnResize(Sender : TObject);
{* - подгоняем размеры полей ввода. }
procedure SetEditsWidth;
{-}
procedure OnChangeName(Sender : TObject);
{-}
procedure OnChangeHint(Sender : TObject);
{-}
protected
// protected
function pm_GetValue: TddConfigValue;
override;
{-}
procedure Cleanup;
override;
{-}
procedure pm_SetValue(const Value: TddConfigValue);
override;
{-}
public
constructor Create(const aAlias : AnsiString;
const aCaption : AnsiString;
const aConfig : InsConfigSettingsInfo = nil);
reintroduce;
{-}
function DoCreateFrame(aOwner: TComponent; aTag: Integer): TCustomFrame;
override;
{-}
procedure DoFrameSize(aParent : TWinControl;
out aHeight : Integer;
out aWidth : Integer);
override;
{-}
procedure DoGetControlValues;
override;
{-}
procedure DoLoad(const aStorage: IddConfigStorage);
override;
{-}
procedure DoSave(const aStorage: IddConfigStorage);
override;
{-}
procedure DoSetControlValues(aDefault: Boolean);
override;
{-}
function pm_GetChanged : Boolean;
override;
{-}
procedure pm_SetChanged(Value : Boolean);
override;
{-}
function DoIsItem(aItem : TObject) : Boolean;
override;
{-}
end;//TnsConfInfoNode
TnsAppConfig = class(TddAppConfiguration)
{-}
private
// properties methods
function GetIsNeedReinsertForms: Boolean;
{-}
public
function IsSettingsChanged: Boolean;
public
// public properties
property IsNeedReinsertForms : Boolean
read GetIsNeedReinsertForms;
{-}
end;
InsConfigStorage = interface(IddConfigStorage)
['{8247036B-85B8-41D8-A922-12A5883D8197}']
// private
function GetDefaultValuesOperation: Boolean;
{-}
procedure SetDefaultValuesOperation(const aValue: Boolean);
{-}
// public
property DefaultValuesOperation: Boolean
read GetDefaultValuesOperation
write SetDefaultValuesOperation;
{ Все операции делаются со значениями по умолчанию:
Load - восстановить значения по умолчанию и загрузить
Save - сохранить и сделать значениями по умолчанию}
end;//InsConfigStorage
TnsConfigStorage = class(TvcmCacheableBase, InsConfigStorage)
{* - производит запись, чтение настроек. }
private
// property fields
f_DefaultValuesOperation: Boolean;
f_Settings: IvcmSettings;
private
// properties methods
function GetDefaultValuesOperation: Boolean;
procedure SetDefaultValuesOperation(const aValue: Boolean);
protected
procedure Cleanup;
override;
public
// public methods
constructor Create(const aSettings : IvcmSettings = nil{;
anOwner : TObject = nil});
reintroduce;
{-}
function Get_Section: AnsiString;
{-}
function ReadBool(const Alias: AnsiString; Default: Boolean): Boolean;
{-}
function ReadDateTime(const Alias: AnsiString; Default: System.TDateTime): System.TDateTime;
{-}
function ReadInteger(const Alias: AnsiString; Default: Integer): Integer;
{-}
function ReadString(const Alias: AnsiString; const Default: AnsiString): Il3CString;
{-}
procedure Set_Section(const Value: AnsiString);
{-}
procedure WriteBool(const Alias: AnsiString; B: Boolean);
{-}
procedure WriteDateTime(const Alias: AnsiString; DT: System.TDateTime);
{-}
procedure WriteInteger(const Alias: AnsiString; I: Integer);
{-}
procedure WriteString(const Alias: AnsiString; const S: AnsiString);
{-}
end;//TnsConfigStorage
const
{ navigator form position - "nfp" }
cnfpLeftNavigator = 'LeftNavigator';
cnfpRightNavigator = 'RightNavigator';
cnfpNavigator = 'vcm_ztNavigator/';
cnfpZone = cnfpNavigator + 'Zone';
cnfpFloating = cnfpNavigator + 'Floating';
type
TstgTextSelection = class(TddComboBoxConfigItem)
{-}
public
// public methods
constructor Create(aMasterItem : TddBaseConfigItem = nil);
reintroduce;
{-}
end;//TstgTextSelection
TstgShowVersionComments = class(TddComboBoxConfigItem)
{-}
public
// public methods
constructor Create(aMasterItem : TddBaseConfigItem = nil);
reintroduce;
{-}
end;//TstgShowVersionComments
TstgShortList = class(TddComboBoxConfigItem)
{-}
public
// public methods
constructor Create(aMasterItem : TddBaseConfigItem = nil);
reintroduce;
{-}
end;//TstgShortList
TstgConfirmationItem = class(TddBooleanConfigItem)
{* - для работы с подтверждениями. "Всегда спрашивать", "Да" перемапируется
в значения mrNone, mrOk. }
private
f_DefaultResult: TModalResult;
public
// public methods
constructor Create(const aAlias, aCaption: AnsiString; aDefaultResult: TModalResult;
aDefaultValue: TddConfigValue; aMasterItem: TddBaseConfigItem = nil);
reintroduce;
procedure LoadValue(const aStorage : IddConfigStorage);
override;
{-}
procedure SaveValue(const aStorage : IddConfigStorage);
override;
{-}
end;//TstgConfirmationItem
TstgNavigatorFormPosition = class(TddComboBoxConfigItem)
{* - класс для сохранения позиции форм встраиваемых в область навиагатора. }
private
// property fields
fFloatingValue : Boolean;
fZoneValue : Il3CString;
private
// property methods
function GetFloatingSetting: AnsiString;
{-}
function GetZoneSetting: AnsiString;
{-}
procedure SetFloatingValue(const Value: Boolean);
{-}
procedure SetZoneValue(const Value: Il3CString);
{-}
protected
// protected methods
function GetAliasName : AnsiString;
virtual;
{-}
public
// public methods
constructor Create(const aFormSetting : AnsiString;
const aCaption : AnsiString;
aMasterItem : TddBaseConfigItem = nil);
reintroduce;
{* - инициализируем значениями. }
procedure LoadValue(const aStorage : IddConfigStorage);
override;
{* - читаем положение формы. }
procedure SaveValue(const aStorage : IddConfigStorage);
override;
{* - пишем положение формы. }
procedure Cleanup;
override;
{-}
public
// public properties
property ZoneSetting : AnsiString
read GetZoneSetting;
{-}
property FloatingSetting : AnsiString
read GetFloatingSetting;
{-}
property FloatingValue : Boolean
read fFloatingValue
write SetFloatingValue;
{-}
property ZoneValue : Il3CString
read fZoneValue
write SetZoneValue;
{-}
end;//TstgNavigatorFormPosition
TstgScalePicture = class(TddComboBoxConfigItem)
{* - масштаб картинки. }
private
f_SavedValue: TddConfigValue;
// internal methods
function CheckValue: boolean;
{ Были ли исправлены ошибки: true - ошибки были }
protected
// protected methods
procedure DoExit;
override;
{-}
public
procedure GetValueFromControl;
override;
{-}
procedure SaveValue(const aStorage: IddConfigStorage);
override;
{-}
public
constructor Create(aMasterItem : TddBaseConfigItem = nil);
reintroduce;
{-}
procedure LoadValue(const aStorage: IddConfigStorage);
override;
{-}
end;//TstgScalePicture
TstgFilterFormPosition = class(TstgNavigatorFormPosition)
protected
// protected methods
function GetAliasName : AnsiString;
override;
{-}
end;//TstgFilterFormPosition
TstgTabbedInterfaceBehaviour = class(TddMapRadioGroupConfigItem)
protected
function pm_GetFullControlHeight(aParent: TWinControl): Integer; override;
public
constructor Create(const aTabUseCaseSettingsID: AnsiString;
const aCaption: AnsiString); reintroduce;
end;
TnsButtonCaptionArray = array[TMsgDlgBtn] of PvcmStringID;
PnsButtonCaptionArray = ^TnsButtonCaptionArray;
_afwSettingChanged_Parent_ = TnsEditSettingsInfo;
{$Include afwSettingChanged.imp.pas}
TnsConfigSettingsInfo = class(_afwSettingChanged_,
InsConfigSettingsInfo,
InsConfigNotificationSource)
protected
// IafwSettingListener
function DoSettingChanged(const aSettingId : TafwSettingId): Boolean;
override;
{* - настройки изменились. }
protected
// IafwSettingsReplaceListener
procedure SettingsReplaceFinish;
override;
{* - после замены настроек. }
private
function pm_GetIsOverallModified: Boolean;
{-}
function pm_GetConfigName: Il3CString;
{-}
function pm_GetConfigHint: Il3CString;
{-}
function pm_GetID: LongInt;
{-}
function pm_GetConfiguration: IConfiguration;
{-}
public
procedure RenameConfig(const aName, aHint: Tl3WString);
{-}
procedure RestoreAllSettings;
{-}
procedure FillDialog(const aForm: IvcmEntityForm;
aButtonsPanelHeight: Integer);
{* - заполнить форму редактирования и подключить обработчики. }
procedure DoneEditing;
override;
{* - отключить обработчики. }
procedure Subscribe(const aSubscriber: InsConfigNotifyRecipient);
{-}
procedure Unsubscribe(const aSubscriber: InsConfigNotifyRecipient);
{-}
private
// internal fields
f_AppConfig: TnsAppConfig;
f_Storage: InsConfigStorage;
f_ConfInfo: TnsConfInfoNode;
f_UserCR1SheetType: TddBaseConfigItem;
f_UserCR2SheetType: TddBaseConfigItem;
f_UserCR1Type: TddBaseConfigItem;
f_UserCR2Type: TddBaseConfigItem;
f_EnableMSOIntegration: TddBaseConfigItem;
f_DocumentNode: TddCustomConfigNode;
f_SubsriberList: TInsConfigNotifyRecipientPtrList;
f_ConfigName: Il3CString;
f_ConfigHint: Il3CString;
f_DuplicateCheckes: Pointer;
f_InRestoreAll: Boolean;
// Блокирует лишний вызов Reinsert при восстановлении всего
f_NeedReinsertFormsAfterSave: Boolean;
// После сохранения/восстановления надо перевставить формы
f_MakeSettings: Boolean;
// Блокирует загрузку настроек при создании списка имен параметров
f_Filled: Boolean;
// Признак того, что подключились к диалогу
f_InProcess: Boolean;
// В процессе сохранения/восстановления
f_DefaultValuesOperation: Boolean;
// Операции проходять со значениями по умолчанию
f_DialogsCalled: Boolean;
private
// internal methods
{$IfDef nsExportSettings}
procedure ExportSettings;
{-}
{$EndIf nsExportSettings}
procedure LoadMessage(const aMsg : Tl3Message;
const aNode : TddCustomConfigNode = nil;
const aNames: PnsButtonCaptionArray = nil);
overload;
{* - загружает предупреждение. }
(* procedure LoadMessage(aMsg : TvcmMessagesCollectionItem;
const aNode : TddCustomConfigNode = nil;
const aNames: PnsButtonCaptionArray = nil);
overload;
{* - загружает предупреждение. }*)
procedure LoadMessage(aMsg : TvcmMessageID;
const aNode : TddCustomConfigNode = nil;
const aNames: PnsButtonCaptionArray = nil);
overload;
{-}
procedure ErrorShow(aSender : TObject;
const aMessage : AnsiString);
{* - показывает сообщение об ошибке. }
procedure ToolbarNotify(aSender: TObject);
procedure PageSetupNotify(aSender: TObject);
procedure StyleEditorNotify(aSender: TObject);
{ нотификаторы для кнопок редактирующих тулбар, стили и пр.}
function AppConfig: TnsAppConfig;
{ получить и инициализировать хранилище-наследник от ddAppConfig }
procedure CreateStruct;
{ создать структуру описания AppConfig }
function GetModalResult(aBtn: TMsgDlgBtn): longint;
{-}
procedure NotifySettingsChanged;
{-}
protected
// protected methods
function DoGetModified: Boolean;
override;
function MakeEditingSettings: IvcmStrings;
override;
procedure DoLoad(aRestoreDefault: Boolean = False);
override;
{ Реальная загрузка }
procedure DoSave(aSaveAsDefault: Boolean = False);
override;
{ Реальное сохранение }
procedure DoAfterLoad(aRestoreDefault: Boolean = False);
override;
procedure DoAfterSave(aSaveAsDefault: Boolean = False);
override;
procedure Cleanup;
override;
function MakeNotUserSettingList: IvcmStrings;
override;
public
constructor Create(const aConfig : IConfiguration = nil;
aDuplicateNameChecker: InsDuplicateConfigNameChecker = nil);
reintroduce;
class function Make(const aConfig : IConfiguration = nil;
aDuplicateNameChecker: InsDuplicateConfigNameChecker = nil): InsConfigSettingsInfo;
reintroduce;
end;//TnsConfigSettingsInfo
TstgVersionCommentLinkBehaviour = class(TddComboBoxConfigItem)
{* [requestlink:513615258] }
public
// public methods
constructor Create(aMasterItem: TddBaseConfigItem = nil); reintroduce;
end;//TstgVersionCommentLinkBehaviour
{$IfEnd} //not Admin AND not Monitorings
implementation
{$If not defined(Admin) AND not defined(Monitorings)}
uses
Graphics,
Registry,
StrUtils,
Windows,
afwFacade,
l3Types,
l3ValueMap,
l3String,
l3Base,
vtLabel,
vcmForm,
vcmStringList,
vcmBaseMenuManager,
vcmBaseCollection,
vcmHistory,
vcmSettings,
vcmDispatcher,
CustomizeTools_Form,
ctTypes,
evStyleInterface,
nscInterfaces,
StdRes,
SystemStr,
DataAdapter,
DynamicTreeUnit,
IOUnit,
nscConst,
nsMainMenuNew,
nsTypes,
nsSettingsUtils,
nsNodes,
nsConst,
nsValueMapsIDs,
nsValueMaps,
nsIntegerValueMap,
nsSimpleIntegerValueMap,
nsListSortTypeMap,
nsPageSetup,
nsStyleEditor,
nsContextFilterParamsConst,
nsContextFilterParams,
nsConfigurationProperties,
L10nInterfaces,
nscComboBoxWithReadOnly,
nsAppConfigRes,
nsTextWithCommentsRes,
vcmTabbedContainerRes,
vtDialogsResEx,
vcmMessagesSupport,
//stDocumentShowChangesInfoItem,
//stDocumentUseFixedFontForPrintAndExportItem,
ControlStatusUtils,
PrimMain_Form,
nsSettingsConst,
nsQuestions,
nsQuestionsWithChoices,
Pl3StringIDExList,
vtComboBoxQS,
stevStylesPrintAndExportFontSizeItem,
evStylesPrintAndExportSettingRes,
evStyles_SH,
afwSettingsChangePublisher,
Base_Operations_F1Services_Contracts
, Search_Services
;
{$Include afwSettingChanged.imp.pas}
{ TnsConfigStorage }
constructor TnsConfigStorage.Create(const aSettings : IvcmSettings{;
anOwner : TObject});
begin
inherited Create{(anOwner)};
f_Settings := aSettings;
end;
procedure TnsConfigStorage.Cleanup;
begin
f_Settings := nil;
inherited;
end;
function TnsConfigStorage.Get_Section: AnsiString;
begin
end;
function TnsConfigStorage.ReadBool(const Alias : AnsiString;
Default : Boolean) : Boolean;
begin
Result := f_Settings.LoadBoolean(Alias,Default,f_DefaultValuesOperation)
end;
function TnsConfigStorage.ReadDateTime(const Alias : AnsiString;
Default : System.TDateTime) : System.TDateTime;
begin
Result := f_Settings.LoadInteger(Alias, Trunc(Default), f_DefaultValuesOperation)
end;
function TnsConfigStorage.ReadInteger(const Alias : AnsiString;
Default : Integer): Integer;
begin
Result := f_Settings.LoadInteger(Alias, Default, f_DefaultValuesOperation)
end;
function TnsConfigStorage.ReadString(const Alias, Default: AnsiString): Il3CString;
begin
Result := f_Settings.LoadString(Alias, Default, f_DefaultValuesOperation)
end;
procedure TnsConfigStorage.Set_Section(const Value: AnsiString);
begin
end;
procedure TnsConfigStorage.WriteBool(const Alias: AnsiString; B: Boolean);
begin
f_Settings.SaveBoolean(Alias, B, B, f_DefaultValuesOperation);
end;
procedure TnsConfigStorage.WriteDateTime(const Alias: AnsiString; DT: System.TDateTime);
var
lLong : Integer;
begin
lLong := Trunc(DT);
f_Settings.SaveInteger(Alias, lLong, lLong, f_DefaultValuesOperation);
end;
procedure TnsConfigStorage.WriteInteger(const Alias: AnsiString; I: Integer);
begin
f_Settings.SaveInteger(Alias, I, I, f_DefaultValuesOperation);
end;
procedure TnsConfigStorage.WriteString(const Alias, S: AnsiString);
begin
f_Settings.SaveString(Alias, nsCStr(S), S, f_DefaultValuesOperation);
end;
function TnsConfigStorage.GetDefaultValuesOperation: Boolean;
begin
Result := f_DefaultValuesOperation;
end;
procedure TnsConfigStorage.SetDefaultValuesOperation(
const aValue: Boolean);
begin
f_DefaultValuesOperation := aValue;
end;
{ TnsHistoryItemsProperty }
procedure TnsHistoryItemsProperty.SaveValue(const aStorage : IddConfigStorage);
//override;
{* - помимо сохранения настройки установим значене g_vcmHistoryLimit. }
begin
inherited SaveValue(aStorage);
g_vcmHistoryLimit := Value.AsInteger;
end;
{ TnsConfInfoNode }
constructor TnsConfInfoNode.Create(const aAlias : AnsiString;
const aCaption : AnsiString;
const aConfig : InsConfigSettingsInfo = nil);
begin
inherited Create(aAlias, aCaption);
f_Config := Pointer(aConfig);
end;
function TnsConfInfoNode.DoCreateFrame(aOwner : TComponent;
aTag : Integer) : TCustomFrame;
var
lTop : Integer;
function CreateLabel(const aCaption : Il3CString) : TvtLabel;
begin
Result := TvtLabel.Create(f_Frame);
Result.Parent := f_Frame;
Result.Left := c_ConfigItemLeft;
Result.Top := lTop;
lTop := lTop + Result.Height + c_ConfigItemTop;
Result.CCaption := l3Cat(aCaption, ':');
end;
function CreateEdit(aOnChange : TNotifyEvent = nil) : TnscComboBoxWithReadOnly;
begin
Result := TnscComboBoxWithReadOnly.Create(f_Frame);
Result.Parent := f_Frame;
Result.Left := c_ConfigItemLeft;
Result.Top := lTop;
Result.OnChange := aOnChange;
if InsConfigSettingsInfo(f_config).IsPredefined then
begin
Result.Enabled := false;
(* Result.ReadOnly := True;
Result.Color := $00F9F8FA;*)
end;
lTop := lTop + Result.Height + c_ConfigItemTop;
end;
begin
Assert(not Assigned(f_Frame));
lTop := c_ConfigItemTop;
f_Frame := TFrame.Create(aOwner);
f_Frame.Parent := TWinControl(aOwner);
f_Frame.Tag := aTag;
f_Frame.OnResize := OnResize;
// Название конфигурации
CreateLabel(vcmCStr(str_cnConfigurationName));
// поле ввода
f_ConfName := CreateEdit(OnChangeName);
f_ConfName.Modified := Changed;
// Описание конфигурации
CreateLabel(vcmCStr(str_cnConfigurationDescription));
// поле ввода
f_ConfHint := CreateEdit(OnChangeHint);
f_ConfHint.Modified := Changed;
// расположем в клиентской области
f_Frame.Align := alClient;
Result := f_Frame;
end;
procedure TnsConfInfoNode.DoFrameSize(aParent: TWinControl;
out aHeight, aWidth: Integer);
begin
aHeight := 100;
aWidth := 100;
end;
procedure TnsConfInfoNode.DoGetControlValues;
begin
//http://mdp.garant.ru/pages/viewpage.action?pageId=481440254
try
if Assigned(f_ConfName) and Assigned(f_ConfHint) then
if (f_ConfName.Modified and not l3IsNil(f_ConfName.Text)) or
(f_ConfHint.Modified and not l3IsNil(f_ConfHint.Text)) then
InsConfigSettingsInfo(f_Config).RenameConfig(nsWStr(f_ConfName.Text), nsWStr(f_ConfHint.Text));
inherited;
except
on e: EDuplicateConfName do
vcmSay(err_DublicateConfName, [e.ConfName])
else
raise;
end;
end;
function TnsConfInfoNode.pm_GetValue : TddConfigValue;
begin
end;
procedure TnsConfInfoNode.DoLoad(const aStorage: IddConfigStorage);
begin
end;
procedure TnsConfInfoNode.SetEditsWidth;
begin
if Assigned(f_ConfName) then
f_ConfName.Width := f_Frame.Width - c_ConfigItemRight - f_ConfName.Left;
if Assigned(f_ConfHint) then
f_ConfHint.Width := f_Frame.Width - c_ConfigItemRight - f_ConfHint.Left;
end;
procedure TnsConfInfoNode.OnResize(Sender: TObject);
begin
SetEditsWidth;
end;
procedure TnsConfInfoNode.Cleanup;
begin
f_Config := nil;
inherited;
end;
procedure TnsConfInfoNode.DoSave(const aStorage: IddConfigStorage);
begin
//http://mdp.garant.ru/pages/viewpage.action?pageId=481440254
(*
try
if Assigned(f_ConfName) and Assigned(f_ConfHint) then
if (f_ConfName.Modified and not l3IsNil(f_ConfName.Text)) or
(f_ConfHint.Modified and not l3IsNil(f_ConfHint.Text)) then
InsConfigSettingsInfo(f_Config).RenameConfig(nsWStr(f_ConfName.Text), nsWStr(f_ConfHint.Text))
except
on e: EDuplicateConfName do
vcmSay(err_DublicateConfName, [e.ConfName])
else
raise;
end;
*)
end;
procedure TnsConfInfoNode.DoSetControlValues(aDefault: Boolean);
begin
// значение
with InsConfigSettingsInfo(f_Config) do
begin
f_ConfName.Text := ConfigName;
f_ConfHint.Text := ConfigHint;
end;//with InsConfigSettingsInfo(f_Config)
inherited;
Changed := False;
end;
procedure TnsConfInfoNode.pm_SetValue(const Value: TddConfigValue);
begin
end;
procedure TnsConfInfoNode.OnChangeHint(Sender: TObject);
begin
f_Changed := True;
end;
procedure TnsConfInfoNode.OnChangeName(Sender: TObject);
begin
f_Changed := True;
end;
function TnsConfInfoNode.pm_GetChanged: Boolean;
begin
Result := f_Changed;
end;
procedure TnsConfInfoNode.pm_SetChanged(Value: Boolean);
begin
if Value <> f_Changed then
begin
f_Changed := Value;
if Assigned(f_ConfHint) then
f_ConfHint.Modified := Value;
if Assigned(f_ConfName) then
f_ConfName.Modified := Value;
end;
end;
function TnsConfInfoNode.DoIsItem(aItem: TObject): Boolean;
begin
Result := Assigned(aItem) and ((aItem = f_ConfName) or (aItem = f_ConfHint));
end;
{ EDuplicateConfName }
procedure EDuplicateConfName.SetConfName(const Value: AnsiString);
begin
f_ConfName := Value;
end;
{ TstgNavigatorFormPosition }
constructor TstgNavigatorFormPosition.Create(const aFormSetting : AnsiString;
const aCaption : AnsiString;
aMasterItem : TddBaseConfigItem = nil);
var
lDefaultValue : TddConfigValue;
begin
// значение по умолчанию
l3FillChar(lDefaultValue, SizeOf(lDefaultValue), 0);
with lDefaultValue do
begin
Kind := dd_vkInteger;
AsInteger := Byte(nfpLeftNavigator);
end;
// создадим
inherited Create(aFormSetting, aCaption, lDefaultValue,
nsIntegerMapManager.Map[imap_NavigatorSheetPosition], aMasterItem);
end;
procedure TstgNavigatorFormPosition.Cleanup;
//override;
{-}
begin
fZoneValue := nil;
inherited;
end;
function TstgNavigatorFormPosition.GetAliasName: AnsiString;
begin
Result := Alias;
end;
function TstgNavigatorFormPosition.GetFloatingSetting: AnsiString;
begin
Result := GetAliasName + cnfpFloating;
end;
function TstgNavigatorFormPosition.GetZoneSetting: AnsiString;
begin
Result := GetAliasName + cnfpZone;
end;
procedure TstgNavigatorFormPosition.LoadValue(const aStorage: IddConfigStorage);
begin
fFloatingValue := aStorage.ReadBool(FloatingSetting, False);
if fFloatingValue then
IntegerValue := Integer(nfpFloating)
else
begin
fZoneValue := aStorage.ReadString(ZoneSetting, cnfpLeftNavigator);
if l3Same(fZoneValue, cnfpLeftNavigator) then
IntegerValue := Integer(nfpLeftNavigator)
else
if l3Same(fZoneValue, cnfpRightNavigator) then
IntegerValue := Integer(nfpRightNavigator);
end;//fFloatingValue
end;
procedure TstgNavigatorFormPosition.SaveValue(const aStorage: IddConfigStorage);
begin
aStorage.WriteBool(FloatingSetting, False);
case TnsNavigatorFormPositionType(IntegerValue) of
nfpFloating:
aStorage.WriteBool(FloatingSetting, True);
nfpLeftNavigator:
aStorage.WriteString(ZoneSetting, cnfpLeftNavigator);
nfpRightNavigator:
aStorage.WriteString(ZoneSetting, cnfpRightNavigator);
end;
end;
procedure TstgNavigatorFormPosition.SetFloatingValue(const Value: Boolean);
begin
fFloatingValue := Value;
end;
procedure TstgNavigatorFormPosition.SetZoneValue(const Value: Il3CString);
begin
fZoneValue := Value;
end;
{ TnsAppConfig }
function TnsAppConfig.GetIsNeedReinsertForms: Boolean;
var
lIndex : Integer;
begin
Result := False;
for lIndex := 0 to Pred(Items.Count) do
if Assigned(Items.Objects[lIndex]) and
(TObject(Items.Objects[lIndex]) is TstgNavigatorFormPosition) and
(TstgNavigatorFormPosition(Items.Objects[lIndex]).Changed) then
begin
Result := True;
Break;
end;
end;
function TnsAppConfig.IsSettingsChanged: Boolean;
var
I: Integer;
l_Obj: TObject;
begin
Result := False;
for i:= 0 to Pred(Items.Count) do
begin
l_Obj:= Items.Objects[i];
if not (l_Obj is TnsConfInfoNode) then
begin
if l_Obj is TddBaseConfigItem then
begin
if TddBaseConfigItem(l_Obj).Changed then
begin
Result:= True;
Break;
end
end
else
if TddCustomConfigNode(l_Obj).Changed then
begin
Result := True;
Break;
end;
end;
end;
end;
{ TstgFilterFormPosition }
function TstgFilterFormPosition.GetAliasName: AnsiString;
begin
Result := cFrmIDFilter;
end;
{ TstgTabbedInterfaceBehaviour }
function TstgTabbedInterfaceBehaviour.pm_GetFullControlHeight(aParent: TWinControl): Integer;
begin
Result := ControlHeight(aParent);
end;
constructor TstgTabbedInterfaceBehaviour.Create(const aTabUseCaseSettingsID: AnsiString;
const aCaption: AnsiString);
var
l_DefaultValue : TddConfigValue;
begin
// значение по умолчанию
l3FillChar(l_DefaultValue, SizeOf(l_DefaultValue), 0);
with l_DefaultValue do
begin
Kind := dd_vkInteger;
AsInteger := Byte(vcm_okInCurrentTab);
end;
// создадим
inherited Create(aTabUseCaseSettingsID, aCaption, l_DefaultValue,
nsIntegerMapManager.Map[imap_DocumentAndLinkOpenKind], nil);
Labeled := False;
LabelTop := False;
// - http://mdp.garant.ru/pages/viewpage.action?pageId=565841996
end;
{ TstgScalePicture }
constructor TstgScalePicture.Create(aMasterItem : TddBaseConfigItem = nil);
var
lValue : TddConfigValue;
begin
lValue.Kind := dd_vkString;
lValue.AsString := dvDocumentPictureScale;
inherited Create(piDocumentPictureScale, l3Str(nsStringMapManager.Map[smap_Settings].ValueToDisplayName(nsCStr(piDocumentPictureScale))),
lValue, nsStringMapManager.Map[smap_piDocumentPictureScale], aMasterItem);
ComboBoxStyle := csDropDown;
DropDownCount := ValueMap.MapSize;
end;
function TstgScalePicture.CheckValue: Boolean;
begin
Result := False;
try
if Control <> nil then
begin
Assert(Control Is TvtComboBoxQS, Control.ClassName);
TvtComboBoxQS(Control).Text := nsCStr(CalcDisplayName(CalcValue(TvtComboBoxQS(Control).Text)));
end;
except
on El3ValueMapValueNotFound do
begin
TvtComboBoxQS(Control).Text := nsCStr(CalcDisplayName(f_SavedValue));
Result := True;
end;
end;
end;
procedure TstgScalePicture.DoExit;
begin
CheckValue;
end;
procedure TstgScalePicture.LoadValue(const aStorage: IddConfigStorage);
begin
inherited LoadValue(aStorage);
f_SavedValue := Value;
end;
procedure TstgScalePicture.SaveValue(const aStorage: IddConfigStorage);
begin
if not CheckValue and Assigned(Control) then
GetValueFromControl;
inherited SaveValue(aStorage);
f_SavedValue := Value;
end;
procedure TstgScalePicture.GetValueFromControl;
begin
try
inherited GetValueFromControl;
except
on El3ValueMapValueNotFound do
Value := f_SavedValue;
end;
end;
{ TstgTextSelection }
constructor TstgTextSelection.Create(aMasterItem: TddBaseConfigItem = nil);
var
lValue : TddConfigValue;
begin
l3FillChar(lValue, SizeOf(lValue), 0);
lValue.Kind := dd_vkBoolean;
lValue.AsBoolean := dv_Document_PermanentSelection;
inherited Create(pi_Document_PermanentSelection,
l3Str(nsStringMapManager.Map[smap_Settings].ValueToDisplayName(nsCStr(pi_Document_PermanentSelection))),
lValue, nsIntegerMapManager.Map[imap_pi_Document_PermanentSelection], aMasterItem);
end;
// start class TstgShowVersionComments
constructor TstgShowVersionComments.Create(aMasterItem: TddBaseConfigItem = nil);
var
lValue : TddConfigValue;
begin
l3FillChar(lValue, SizeOf(lValue), 0);
lValue.Kind := dd_vkBoolean;
lValue.AsBoolean := dv_Document_ShowVersionsComment;
inherited Create(pi_Document_ShowVersionsComment,
str_pi_Document_ShowVersionsComment.AsStr,
lValue, TShowVersionCommentsMapImpl.Make, aMasterItem);
end;
{ TstgConfirmationItem }
constructor TstgConfirmationItem.Create(const aAlias, aCaption: AnsiString;
aDefaultResult: TModalResult; aDefaultValue: TddConfigValue;
aMasterItem: TddBaseConfigItem);
begin
inherited Create(aAlias, aCaption, aDefaultValue, aMasterItem);
f_DefaultResult := aDefaultResult;
Assert(f_DefaultResult <> mrNone);
end;
procedure TstgConfirmationItem.LoadValue(const aStorage : IddConfigStorage);
var
lResult : TModalResult;
begin
lResult := aStorage.ReadInteger(Alias, mrNone);
(* Не показывать подтверждение *)
if lResult <> mrNone then
BooleanValue := False
else
BooleanValue := True;
end;
procedure TstgConfirmationItem.SaveValue(const aStorage : IddConfigStorage);
begin
(* Не показывать подтверждение *)
if not BooleanValue then
aStorage.WriteInteger(Alias, f_DefaultResult)
else
aStorage.WriteInteger(Alias, mrNone);
end;
{ TnsConfigSettingsInfo }
function TnsConfigSettingsInfo.AppConfig: TnsAppConfig;
var
lStorage : TnsConfigStorage;
begin
if f_AppConfig = nil then
begin
lStorage := TnsConfigStorage.Create(Settings);
try
if Supports(lStorage, InsConfigStorage, f_Storage) then
begin
f_Storage.DefaultValuesOperation := f_DefaultValuesOperation;
f_AppConfig := TnsAppConfig.Create(f_Storage);
f_AppConfig.OnErrorShow := ErrorShow;
CreateStruct;
end;
finally
vcmFree(lStorage);
end;
end;
Result := f_AppConfig;
end;
procedure TnsConfigSettingsInfo.Cleanup;
begin
DoneEditing;
vcmFree(f_SubsriberList);
f_DuplicateCheckes := nil;
f_ConfigName := nil;
f_ConfigHint := nil;
f_DialogsCalled := False;
inherited Cleanup;
end;
function TnsConfigSettingsInfo.MakeNotUserSettingList: IvcmStrings;
var
l_Strings: IvcmStrings;
begin
l_Strings := inherited MakeNotUserSettingList;
l_Strings.Add('Настройки форм/utMainWindow/utConfigurationList/vcm_ztNavigator/Zone');
l_Strings.Add('Настройки форм/utMainWindow/utFolders/vcm_ztNavigator/Zone');
l_Strings.Add('Настройки форм/utMainWindow/utNavigator/vcm_ztNavigator/Zone');
Result := l_Strings;
end;
constructor TnsConfigSettingsInfo.Create(const aConfig: IConfiguration;
aDuplicateNameChecker: InsDuplicateConfigNameChecker);
var
lString : IString;
begin
inherited Create(aConfig);
f_SubsriberList := TInsConfigNotifyRecipientPtrList.Make;
f_DuplicateCheckes := Pointer(aDuplicateNameChecker);
Configuration.GetName(lString);
try
f_ConfigName := nsCStr(lString);
finally
lString := nil;
end;
Configuration.GetHint(lString);
try
f_ConfigHint := nsCStr(lString);
finally
lString := nil;
end;
{$IfDef nsExportSettings}
AppConfig;
DoneEditing;
{$EndIf nsExportSettings}
end;
procedure TnsConfigSettingsInfo.DoLoad(aRestoreDefault: Boolean);
begin
f_InProcess := true;
try
f_DefaultValuesOperation := aRestoreDefault;
If Assigned(f_Storage) then
f_Storage.DefaultValuesOperation := aRestoreDefault;
try
AppConfig.Load;
if f_Filled and aRestoreDefault then
AppConfig.ReadValuesFromDialog(False);
finally
f_DefaultValuesOperation := False;
If Assigned(f_Storage) then
f_Storage.DefaultValuesOperation := False;
end;
finally
f_InProcess := False;
end;
end;
procedure TnsConfigSettingsInfo.DoneEditing;
begin
inherited DoneEditing;
f_Storage := nil;
vcmFree(f_AppConfig);
f_ConfInfo := nil;
f_UserCR1SheetType := nil;
f_UserCR2SheetType := nil;
f_UserCR1Type := nil;
f_UserCR2Type := nil;
f_EnableMSOIntegration := nil;
f_DocumentNode := nil;
f_Filled := false;
end;
procedure TnsConfigSettingsInfo.DoSave(aSaveAsDefault: Boolean);
procedure StoreMSOIValueToRegistry(const a_Value: Boolean);
begin
try
with TRegistry.Create(KEY_WRITE) do
try
RootKey := HKEY_CURRENT_USER;
//
if OpenKey('Software\Garant.F1-Launcher', True) then
try
WriteString('MSOIntegrationEnabled', BoolToStr(a_Value, True));
finally
CloseKey;
end;
finally
Free;
end;
except
on ERegistryException do; // ignore
end;
end;
function lp_CheckUserCRTypes: Boolean;
var
l_UserCR1Type: TddComboBoxConfigItem;
l_UserCR2Type: TddComboBoxConfigItem;
begin
// Может случиться, что доступен только один тип СКР для вкладок -
// "Все документы", в результате и в 1-й и во 2-й вкладке оказались
// одинаковые типы СКР.
// http://mdp.garant.ru/pages/viewpage.action?pageId=488606734
Result := False;
Assert(f_UserCR1Type is TddComboBoxConfigItem, f_UserCR1Type.ClassName);
Assert(f_UserCR2Type is TddComboBoxConfigItem, f_UserCR2Type.ClassName);
l_UserCR1Type := TddComboBoxConfigItem(f_UserCR1Type);
l_UserCR2Type := TddComboBoxConfigItem(f_UserCR2Type);
Result := ((TvtComboBoxQS( l_UserCR1Type.Control).Items.Count = 1) and
(TvtComboBoxQS(l_UserCR2Type.Control).Items.Count = 1)) OR
((f_UserCR1SheetType.IntegerValue <> f_UserCR2SheetType.IntegerValue) or
(f_UserCR1Type.StringValue <> f_UserCR2Type.StringValue));
end;//lp_CheckUserCRTypes
begin
f_InProcess := True;
try
f_DefaultValuesOperation := aSaveAsDefault;
If Assigned(f_Storage) then
f_Storage.DefaultValuesOperation := aSaveAsDefault;
try
if f_Filled then
begin
f_NeedReinsertFormsAfterSave := IsActive and AppConfig.IsNeedReinsertForms;
TddVisualConfigItem(f_UserCR1SheetType).GetValueFromControl;
TddVisualConfigItem(f_UserCR2SheetType).GetValueFromControl;
TddVisualConfigItem(f_UserCR1Type).GetValueFromControl;
TddVisualConfigItem(f_UserCR2Type).GetValueFromControl;
if Assigned(f_EnableMSOIntegration) then
begin
TddVisualConfigItem(f_EnableMSOIntegration).GetValueFromControl;
StoreMSOIValueToRegistry(f_EnableMSOIntegration.BooleanValue);
end;
//http://mdp.garant.ru/pages/viewpage.action?pageId=488606734
if (not lp_CheckUserCRTypes) then
begin
AppConfig.MakeNodeVisible(f_DocumentNode);
raise ECRSettingsAreEqual.Create(vcmConstString(str_CRSettingsAreEqual))
end;
if not AppConfig.ReadValuesFromDialog then
raise EConfigNotSaved.Create('');
end;
if aSaveAsDefault then
AppConfig.Changed := True;
AppConfig.Save;
finally
f_DefaultValuesOperation := False;
If Assigned(f_Storage) then
f_Storage.DefaultValuesOperation := False;
end;
finally
f_InProcess := False;
end;
end;
procedure TnsConfigSettingsInfo.ErrorShow(aSender: TObject;
const aMessage: AnsiString);
begin
vcmShowMessageDlg(Tl3Message_C(nsCStr(aMessage),
'TnsConfigSettingsInfo.ErrorShow',
mtError));
end;
{$IfDef nsExportSettings}
procedure TnsConfigSettingsInfo.ExportSettings;
function ExportSetting(const aValue : AnsiString;
const aDefaultValue : AnsiString;
const aSetting : AnsiString;
const aCaption : AnsiString = '';
const aType : AnsiString = '') : AnsiString;
begin
Result := Format('%s; %s; %s; %s; %s;', [aValue,
aDefaultValue,
aType,
aSetting,
aCaption]);
end;
var
lSettings : TStrings;
lIndex : Integer;
begin
lSettings := TvcmStringList.Make;
try
lSettings.Add(casExportTitle);
for lIndex := 0 to Pred(AppConfig.Items.Count) do
if AppConfig.Items.Objects[lIndex] is TstgNavigatorFormPosition then
with TstgNavigatorFormPosition(AppConfig.Items.Objects[lIndex]) do
begin
lSettings.Add(ExportSetting(IntToStr(Integer(FloatingValue)),
'0',
FloatingSetting,
'',
'Boolean'));
lSettings.Add(ExportSetting(ZoneValue,
cnfpLeftNavigator,
ZoneSetting,
'',
'AnsiString'));
end
else
if AppConfig.Items.Objects[lIndex] is TstgTextSelection then
with TstgTextSelection(AppConfig.Items.Objects[lIndex]) do
lSettings.Add(ExportSetting(IntToStr(Integer(BooleanValue)),
IntToStr(Integer(DefaultBooleanValue)),
Alias,
Caption,
'Boolean'))
else
if AppConfig.Items.Objects[lIndex] is TstgShortList then
with TstgShortList(AppConfig.Items.Objects[lIndex]) do
lSettings.Add(ExportSetting(IntToStr(Integer(BooleanValue)),
IntToStr(Integer(DefaultBooleanValue)),
Alias,
Caption,
'Boolean'))
else
if AppConfig.Items.Objects[lIndex] is TstgScalePicture then
with TstgScalePicture(AppConfig.Items.Objects[lIndex]) do
lSettings.Add(ExportSetting(StringValue,
DefaultStringValue,
Alias,
Caption,
'AnsiString'))
else
with TddBaseConfigItem(AppConfig.Items.Objects[lIndex]) do
case DefaultValue.Kind of
dd_vkInteger:
lSettings.Add(ExportSetting(IntToStr(IntegerValue),
IntToStr(DefaultIntegerValue),
Alias,
Caption,
'Integer'));
dd_vkString:
if DefaultValue.AsString <> '' then
lSettings.Add(ExportSetting(StringValue,
DefaultStringValue,
Alias,
Caption,
'AnsiString'));
dd_vkBoolean :
lSettings.Add(ExportSetting(IntToStr(Integer(BooleanValue)),
IntToStr(Integer(DefaultBooleanValue)),
Alias,
Caption,
'Boolean'));
dd_vkDateTime:
lSettings.Add(ExportSetting(DateToStr(DateTimeValue),
DateToStr(DefaultDateTimeValue),
Alias,
Caption,
'DateTime'));
end;
finally
lSettings.SaveToFile(Format('C:\nsExportSettings (%s).csv',
[COnfigName]));
FreeAndNil(lSettings);
end;
end;
{$EndIf nsExportSettings}
procedure TnsConfigSettingsInfo.FillDialog(const aForm: IvcmEntityForm;
aButtonsPanelHeight: Integer);
begin
AppConfig.ButtonsPanelHeight := aButtonsPanelHeight;
AppConfig.FillDialog(aForm.VCLWinControl As TCustomForm, [dd_doNoButtons],
[cptNormalBevel]);
AppConfig.Changed := False;
f_Filled := true;
end;
procedure TnsConfigSettingsInfo.LoadMessage(aMsg: TvcmMessageID;
const aNode: TddCustomConfigNode;
const aNames: PnsButtonCaptionArray);
var
lMsg : TvcmMessagesCollectionItem;
begin
lMsg := TvcmMessagesCollectionItem(g_MenuManager.Messages.Items[aMsg.rM]);
Assert(Assigned(lMsg));
(* LoadMessage(lMsg, aNode, aNames);*)
LoadMessage(vcmMessageIDToMessage(aMsg, vcmCStr(lMsg.Caption)), aNode, aNames);
end;
procedure TnsConfigSettingsInfo.LoadMessage(const aMsg : Tl3Message;
const aNode : TddCustomConfigNode = nil;
const aNames: PnsButtonCaptionArray = nil);
//overload;
{* - загружает предупреждение. }
const
imap_Dummy: TnsValueMapID = (rName: 'MessageButtons'; rID: -1);
lc_ButtonMaps: TnsButtonCaptionArray = (
@str_pui_ask_Yes, @str_pui_ask_No, @str_pui_ask_OK, @str_pui_ask_Cancel,
@str_pui_ask_Abort, @str_pui_ask_Retry, @str_pui_ask_Ignore, @str_pui_ask_All,
@str_pui_ask_NoToAll, @str_pui_ask_YesToAll, @str_pui_ask_Help {$IfDef XE}, nil{$EndIf});
var
lForbiddenBtns : Set of TMsgDlgBtn;
lIndex : TMsgDlgBtn;
lValue : TddConfigValue;
lItemCount : Integer;
lConf : TstgConfirmationItem;
l_ButtonsArray : array of TnsIntegerValueMapRecord;
l_DefaultResult: TModalResult;
l_Names: PnsButtonCaptionArray;
l_Choices: TPl3StringIDExList;
l_IDX: Integer;
l_ChoicesArray : array of TnsSimpleIntegerValueMapRecord;
l_Value: Integer;
begin
l_Choices := aMsg.rData.rChoices.Use;
try
//if (l_Choices <> nil) then
//(l_Choices As Il3StringsEx).Items.Text := aMsg.rData.rChoices;
if (l_Choices = nil) or (l_Choices.Count = 0) then
begin
if Assigned(aNames) then
l_Names := aNames
else
l_Names := @lc_ButtonMaps;
l3FillChar(lValue, SizeOf(lValue), 0);
// Если в диалоге присутствует кнопка Cancel - не включаем её в список
// Если Cancel нет - не включаем кнопку No
lForbiddenBtns := [mbCancel];
if not (mbCancel in aMsg.rData.rButtons) then
lForbiddenBtns := lForbiddenBtns + [mbNo];
// определим будем использовать checkboxitem или comboboxitem
lItemCount := 0;
l_DefaultResult := mrNone;
for lIndex := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do
begin
if (lIndex in lForbiddenBtns) then
Continue;
if (lIndex in aMsg.rData.rButtons) then
begin
l_DefaultResult := vtGetDlgBtnResult(lIndex);
Inc(lItemCount);
end;//lIndex in aMsg.Buttons
end;//for lIndex
(* CheckBoxItem *)
if lItemCount = 1 then
begin
Assert(Assigned(aNode));
lConf := TstgConfirmationItem.Create(aMsg.rName, aMsg.SettingsCaption, l_DefaultResult, lValue);
with AppConfig do
begin
AddItem(aNode, lConf);
Hint := aMsg.LongHint;
end;
end//if lItemCount = 1
(* ComboBoxItem *)
else
begin
// создадим выпадающий список
with AppConfig do
begin
SetLength(l_ButtonsArray,1);
l_ButtonsArray[0] := nsIntegerValueMapRecord(str_pui_AskConfirmation, mrNone);
for lIndex := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do
begin
// запрещено
if (lIndex in lForbiddenBtns) then
Continue;
// добавим значение
if lIndex in aMsg.rData.rButtons then
begin
SetLength(l_ButtonsArray,Length(l_ButtonsArray)+1);
l_ButtonsArray[High(l_ButtonsArray)] := nsIntegerValueMapRecord(l_Names^[lIndex]^, GetModalResult(lIndex));
end;
end;
AddComboBoxItem(nsCStr(aMsg.rName), nsCStr(aMsg.SettingsCaption + ':'), mrNone,
TnsIntegerValueMap.Make(imap_Dummy, l_ButtonsArray));
Hint := aMsg.LongHint;
end;
end;//if lItemCount = 1
end//if l_Choices.Count = 0
else
begin
// Проверка и корректировка для совместимости
l_Value := f_Storage.ReadInteger(aMsg.rName, mrNone);
if (l_Value > 0) then
begin
Assert(aMsg.rData.rButtons = [mbOk, mbCancel]);
Assert((l_Choices.Count = 2) and (l_Value in [mrOk, mrYes, mrNo]));
case l_Value of
mrOk, mrYes: l_Value := -1;
mrNo: l_Value := -2;
end;
f_Storage.WriteInteger(aMsg.rName, l_Value);
end;//l_Value > 0
// Собственно наборка мапы
//if (aMsg.rData.rDefaultChoice=0) or (Abs(aMsg.rData.rDefaultChoice)>l_Choices.Count) then
if l3IsNil(aMsg.CheckCaption) then
begin
SetLength(l_ChoicesArray, l_Choices.Count+1);
l_ChoicesArray[0] := nsSimpleIntegerValueMapRecord(vcmCStr(str_pui_AskConfirmation), mrNone);
for l_IDX := 0 to l_Choices.Count - 1 do
l_ChoicesArray[l_IDX + 1] := nsSimpleIntegerValueMapRecord(l_Choices.Items[l_IDX].AsCStr, -(l_IDX + 1));
//l_ChoicesArray[High(l_ChoicesArray)] := nsSimpleIntegerValueMapRecord(l_Choices.ItemC[l_IDX], -(l_IDX + 1));
end//aMsg.rData.rDefaultChoice=0..
else
begin
SetLength(l_ChoicesArray, 2);
l_ChoicesArray[0] := nsSimpleIntegerValueMapRecord(vcmCStr(str_pui_AskConfirmation), mrNone);
l_ChoicesArray[1] := nsSimpleIntegerValueMapRecord(l3CStr(aMsg.CheckCaption), aMsg.rData.rDefaultChoice);
end;//aMsg.rData.rDefaultChoice=0
with AppConfig do
begin
AddComboBoxItem(nsCStr(aMsg.rName), nsCStr(aMsg.SettingsCaption + ':'), mrNone,
TnsSimpleIntegerValueMap.Make(imap_Dummy, l_ChoicesArray));
Hint := aMsg.LongHint;
end;//with AppConfig
end;//if l_Choices.Count = 0
finally
FreeAndNil(l_Choices);
end;//try..finally
end;
(*procedure TnsConfigSettingsInfo.LoadMessage(
aMsg: TvcmMessagesCollectionItem;
const aNode: TddCustomConfigNode;
const aNames: PnsButtonCaptionArray);
const
imap_Dummy: TnsValueMapID = (rName: 'MessageButtons'; rID: -1);
lc_ButtonMaps: TnsButtonCaptionArray = (
@str_pui_ask_Yes, @str_pui_ask_No, @str_pui_ask_OK, @str_pui_ask_Cancel,
@str_pui_ask_Abort, @str_pui_ask_Retry, @str_pui_ask_Ignore, @str_pui_ask_All,
@str_pui_ask_NoToAll, @str_pui_ask_YesToAll, @str_pui_ask_Help);
var
lForbiddenBtns : Set of TMsgDlgBtn;
lIndex : TMsgDlgBtn;
lValue : TddConfigValue;
lItemCount : Integer;
lConf : TstgConfirmationItem;
l_ButtonsArray : array of TnsIntegerValueMapRecord;
l_DefaultResult: TModalResult;
l_Names: PnsButtonCaptionArray;
l_Choices: Tl3Strings;
l_IDX: Integer;
l_ChoicesArray : array of TnsSimpleIntegerValueMapRecord;
l_Value: Integer;
begin
if (aMsg.Choices = '') then
l_Choices := nil
else
l_Choices := Tl3Strings.Create;
try
if (l_Choices <> nil) then
(l_Choices As Il3StringsEx).Items.Text := aMsg.Choices;
if (l_Choices = nil) or (l_Choices.Count = 0) then
begin
if Assigned(aNames) then
l_Names := aNames
else
l_Names := @lc_ButtonMaps;
l3FillChar(lValue, SizeOf(lValue), 0);
// Если в диалоге присутствует кнопка Cancel - не включаем её в список
// Если Cancel нет - не включаем кнопку No
lForbiddenBtns := [mbCancel];
if not (mbCancel in aMsg.Buttons) then
lForbiddenBtns := lForbiddenBtns + [mbNo];
// определим будем использовать checkboxitem или comboboxitem
lItemCount := 0;
l_DefaultResult := mrNone;
for lIndex := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do
begin
if (lIndex in lForbiddenBtns) then
Continue;
if (lIndex in aMsg.Buttons) then
begin
l_DefaultResult := vtGetDlgBtnResult(lIndex);
Inc(lItemCount);
end;//lIndex in aMsg.Buttons
end;//for lIndex
{ CheckBoxItem }
if lItemCount = 1 then
begin
Assert(Assigned(aNode));
lConf := TstgConfirmationItem.Create(aMsg.Name, aMsg.SettingsCaption, l_DefaultResult, lValue);
with AppConfig do
begin
AddItem(aNode, lConf);
Hint := aMsg.LongHint;
end;
end//if lItemCount = 1
{ ComboBoxItem }
else
begin
// создадим выпадающий список
with AppConfig do
begin
SetLength(l_ButtonsArray,1);
l_ButtonsArray[0] := nsIntegerValueMapRecord(str_pui_AskConfirmation, mrNone);
for lIndex := Low(TMsgDlgBtn) to High(TMsgDlgBtn) do
begin
// запрещено
if (lIndex in lForbiddenBtns) then
Continue;
// добавим значение
if lIndex in aMsg.Buttons then
begin
SetLength(l_ButtonsArray,Length(l_ButtonsArray)+1);
l_ButtonsArray[High(l_ButtonsArray)] := nsIntegerValueMapRecord(l_Names^[lIndex]^, GetModalResult(lIndex));
end;
end;
AddComboBoxItem(nsCStr(aMsg.Name), nsCStr(aMsg.SettingsCaption + ':'), mrNone,
TnsIntegerValueMap.Make(imap_Dummy, l_ButtonsArray));
Hint := aMsg.LongHint;
end;
end;//if lItemCount = 1
end//if l_Choices.Count = 0
else
begin
// Проверка и корректировка для совместимости
l_Value := f_Storage.ReadInteger(aMsg.Name, mrNone);
if l_Value > 0 then
begin
Assert(aMsg.Buttons = [mbOk, mbCancel]);
Assert((l_Choices.Count = 2) and (l_Value in [mrOk, mrYes, mrNo]));
case l_Value of
mrOk, mrYes: l_Value := -1;
mrNo: l_Value := -2;
end;
f_Storage.WriteInteger(aMsg.Name, l_Value);
end;
// Собственно наборка мапы
if (aMsg.DefaultChoice=0) or (Abs(aMsg.DefaultChoice)>l_Choices.Count) then
begin
SetLength(l_ChoicesArray, l_Choices.Count+1);
l_ChoicesArray[0] := nsSimpleIntegerValueMapRecord(vcmCStr(str_pui_AskConfirmation), mrNone);
for l_IDX := 0 to l_Choices.Count - 1 do
l_ChoicesArray[High(l_ChoicesArray)] := nsSimpleIntegerValueMapRecord(l_Choices.ItemC[l_IDX], -(l_IDX + 1));
end
else
begin
SetLength(l_ChoicesArray, 2);
l_ChoicesArray[0] := nsSimpleIntegerValueMapRecord(vcmCStr(str_pui_AskConfirmation), mrNone);
l_ChoicesArray[1] := nsSimpleIntegerValueMapRecord(vcmCStr(aMsg.CheckCaption), aMsg.DefaultChoice);
end;
with AppConfig do
begin
AddComboBoxItem(nsCStr(aMsg.Name), nsCStr(aMsg.SettingsCaption + ':'), mrNone,
TnsSimpleIntegerValueMap.Make(imap_Dummy, l_ChoicesArray));
Hint := aMsg.LongHint;
end;
end;//if l_Choices.Count = 0
finally
FreeAndNil(l_Choices);
end;
end;*)
class function TnsConfigSettingsInfo.Make(const aConfig: IConfiguration;
aDuplicateNameChecker: InsDuplicateConfigNameChecker): InsConfigSettingsInfo;
var
l_Config: TnsConfigSettingsInfo;
begin
l_Config := TnsConfigSettingsInfo.Create(aConfig, aDuplicateNameChecker);
try
Result := l_Config;
finally
vcmFree(l_Config);
end;
end;
function TnsConfigSettingsInfo.MakeEditingSettings: IvcmStrings;
var
l_NeedClear: Boolean;
l_Idx: Integer;
begin
if not TnsConfigurationProperties.HasInstance then
begin
f_MakeSettings := true;
try
l_NeedClear := not Assigned(f_AppConfig);
with AppConfig do
for l_Idx := 0 to Pred(Items.Count) do
if Assigned(Items.Objects[l_Idx]) then
if Items.Objects[l_Idx] is TstgNavigatorFormPosition then
with TstgNavigatorFormPosition(Items.Objects[l_Idx]) do
begin
TnsConfigurationProperties.Instance.Add(FloatingSetting);
TnsConfigurationProperties.Instance.Add(ZoneSetting);
end
else
TnsConfigurationProperties.Instance.Add(Items[l_Idx]);
if l_NeedClear then
DoneEditing;
finally
f_MakeSettings := false;
end;
end;
Result := TnsConfigurationProperties.Instance;
end;
procedure TnsConfigSettingsInfo.PageSetupNotify(aSender: TObject);
begin
{$IfNDef Admin}
if TPrintingService.Instance.MakePageSetup(TnsPageSetup.Make(Configuration)) = mrOk then
f_DialogsCalled := True;
{$EndIf Admin}
end;
function TnsConfigSettingsInfo.pm_GetConfiguration: IConfiguration;
begin
Result := Configuration;
end;
function TnsConfigSettingsInfo.pm_GetConfigHint: Il3CString;
begin
Result := f_ConfigHint;
end;
function TnsConfigSettingsInfo.pm_GetID: LongInt;
begin
Result := Configuration.GetId;
end;
function TnsConfigSettingsInfo.pm_GetIsOverallModified: Boolean;
begin
Result := Modified or f_DialogsCalled;
if Assigned(f_ConfInfo) then
Result := Result or f_ConfInfo.Changed;
end;
function TnsConfigSettingsInfo.pm_GetConfigName: Il3CString;
begin
Result := f_ConfigName;
end;
procedure TnsConfigSettingsInfo.RenameConfig(const aName, aHint: Tl3WString);
var
l_Idx : Integer;
l_Error : EDuplicateConfName;
l_Modified : Boolean;
begin
if l3IsNil(aName) and l3IsNil(aHint) then
exit;
l_Modified := False;
If Assigned(f_DuplicateCheckes) and
InsDuplicateConfigNameChecker(f_DuplicateCheckes).DuplicateName(aName, pm_GetID) then
begin
l_Error := EDuplicateConfName.CreateFmt(vcmConstString(str_DuplicateConfigName), [nsEStr(aName)]);
l_Error.ConfName := l3Str(aName);
// генерируем исключение о дублировании имени
raise l_Error;
end;
if (not l3IsNil(aName)) and (not l3Same(f_ConfigName, aName)) then
begin
f_ConfigName := nsCStr(aName);
Configuration.SetName(nsIStr(f_ConfigName));
l_Modified := True;
end;
if (not l3IsNil(aHint)) and (not l3Same(f_ConfigHint, aHint)) then
begin
f_ConfigHint := nsCStr(aHint);
Configuration.SetHint(nsIStr(f_ConfigHint));
l_Modified := True;
end;
if l_Modified then
for l_Idx := f_SubsriberList.Count-1 downto 0 do
f_SubsriberList[l_idx].InfoChanged;
end;
procedure TnsConfigSettingsInfo.NotifySettingsChanged;
var
l_Settings: InsSettings;
begin
if IsActive and
Supports(afw.Application.Settings, InsSettings, l_Settings) then
try
l_Settings.UserSettingsChanged;
finally
l_Settings := nil;
end;//try..finally
end;//NotifySettingsChanged
procedure TnsConfigSettingsInfo.RestoreAllSettings;
var
l_SettingsInfo: InsEditSettingsInfo;
begin
vcmBase.vcmDispatcher.BeginRestoreAllSettings;
try
// Чтобы приложение получило нотификацию об изменении свойств, использовать
// f_ManagerConf.Configuration.RestoreDefaultValues (IConfiguration) - нельзя.
// Т.к. Записываем по умолчанию мы значения только по оговренным спискам
// (ConfigurationProperties, PageSetupProperties, StyleTableProperties) - двойные
// стандарты однако.
// С определенными тормозами надо делать так.
// по хорошему для f_ManagerConf должен быть свой InsEditSettingsInfo, который
// будет знать про редакторы таблицы стилей и параметров страницы и уметь делать
// RestoreAll (в т.ч. и им)
l_SettingsInfo := TnsStyleTableSettingsInfo.Make(Configuration);
try
with TevStyleInterface.Make do
try
Changing;
try
l_SettingsInfo.Load(True);
if not l_SettingsInfo.IsActive then
LoadStyleTableFromSettings;
finally
ChangedEx(not l_SettingsInfo.IsActive);
end;
finally
Free;
end;
finally
l_SettingsInfo := nil;
end;
l_SettingsInfo := TnsPageSetup.Make(Configuration);
try
l_SettingsInfo.Load(True);
finally
l_SettingsInfo := nil;
end;
f_InRestoreAll := True;
try
Load(True);
finally
f_InRestoreAll := False;
end;
// Для тех настроек которые пишутся в обход всего напрямую в адаптер.
// Именно эта строчка приводит к cq18536, 18709.
Configuration.RestoreDefaultValues;
// И по идее это тоже должно быть излишне...
(* Перечитываем визуальные компоненты только для активной конфигурации *)
if IsActive then
begin
(* Перечитаем toolbar-ы *)
g_MenuManager.ReloadAllToolbars;
g_MenuManager.LoadShortcuts;
(* Определим положение форм (вставим плавающие навигаторы) *)
vcmBase.vcmDispatcher.ReinsertForms;
vcmBase.vcmDispatcher.RestoreFormSize;
NotifySettingsChanged;
end;
finally
vcmBase.vcmDispatcher.EndRestoreAllSettings;
end;
end;
procedure TnsConfigSettingsInfo.StyleEditorNotify(aSender: TObject);
begin
{$If not Defined(Admin) AND not Defined(Monitorings)}
if (TSettingsService.Instance.OpenStyleEditorAsModal(TnsStyleTableSettingsInfo.Make(Configuration)) = mrOk) then
f_DialogsCalled := True;
{$Else}
Assert(false);
{$IfEnd}
end;
procedure TnsConfigSettingsInfo.Subscribe(
const aSubscriber: InsConfigNotifyRecipient);
begin
if f_SubsriberList.IndexOf(aSubscriber) = -1 then
f_SubsriberList.Add(aSubscriber);
end;
procedure TnsConfigSettingsInfo.ToolbarNotify(aSender: TObject);
begin
if TCustomizeToolsForm.Execute(g_MenuManager, nil) then
f_DialogsCalled := True;
end;
procedure TnsConfigSettingsInfo.Unsubscribe(
const aSubscriber: InsConfigNotifyRecipient);
begin
f_SubsriberList.Remove(aSubscriber);
end;
procedure TnsConfigSettingsInfo.CreateStruct;
var
l_Node : TddCustomConfigNode;
l_Item : TddBaseConfigItem;
l_GroupIndex : Integer;
l_Map : InsStringValueMap;
l_IsEnglish : Boolean;
function GetAliasName : AnsiString;
begin
Inc(l_GroupIndex);
Result := Format('AliasName%d', [l_GroupIndex]);
end;
procedure AddGUISettings;
var
l_Node : TddCustomConfigNode;
begin
with AppConfig do
begin
l_Node := AddNode('UIOptions', vcmConstString(str_UISettingsCaption));
//
AddGroupItem(GetAliasName, vcmConstString(str_pui_Language));
//
AddComboBoxItem(nsCStr(pi_IfaceLanguage), l_Map.ValueToDisplayName(nsCStr(pi_IfaceLanguage)),
nsCStr(dv_IfaceLanguage), nsStringMapManager.Map[smap_pi_IfaceLanguage]);
Enabled := False;
//
AddBooleanItem(nsCStr(pi_ActivateDefaultLanguage), l_Map.ValueToDisplayName(nsCStr(pi_ActivateDefaultLanguage)),
dv_ActivateDefaultLanguage);
CloseGroup;
//
AddGroupItem(GetAliasName, vcmConstString(str_pui_Navigator));
AddGroupItem(GetAliasName, vcmConstString(str_pui_LeftNavigator));
// Положение
AddComboBoxItem(nsCStr(pi_LeftNavigator), vcmCStr(str_pui_LeftNavigatorPosition),
Ord(dv_LeftNavigator), nsIntegerMapManager.Map[imap_NavigatorPosition]);
// Режим автоскрытия
AddBooleanItem(nsCStr(pi_lnAutoHideFloat), l_Map.ValueToDisplayName(nsCStr(pi_lnAutoHideFloat)), dv_lnAutoHideFloat);
CloseGroup;
AddGroupItem(GetAliasName, vcmConstString(str_pui_RightNavigator));
// Положение
AddComboBoxItem(nsCStr(pi_RightNavigator), vcmCStr(str_pui_RightNavigatorPosition),
Ord(dv_RightNavigator), nsIntegerMapManager.Map[imap_NavigatorPosition]);
// Режим автоскрытия
AddBooleanItem(nsCStr(pi_rnAutoHideFloat), l_Map.ValueToDisplayName(nsCStr(pi_rnAutoHideFloat)), dv_rnAutoHideFloat);
CloseGroup;
CloseGroup;
// Вкладки основного окна
AddGroupItem(GetAliasName, vcmConstString(str_pui_MainWindowTabs));
l_Item := TstgTabbedInterfaceBehaviour.Create(pi_OpenDocumentsFromList, vcmConstString(str_pi_OpenDocumentsFromList));
AddItem(l_Node, l_Item);
l_Item := TstgTabbedInterfaceBehaviour.Create(pi_OpenLinksFromDocument, vcmConstString(str_pi_OpenLinksFromDocument));
AddItem(l_Node, l_Item);
CloseGroup;
AddGroupItem(GetAliasName, vcmConstString(str_pui_MainManu));
// Вид основного меню
AddComboBoxItem(nsCStr(pi_MainMenuKind), vcmCat(str_pui_MainMenuKind.AsCStr, ':'),
dv_MainMenuKind, nsIntegerMapManager.Map[imap_MainMenuKind]);
// Последние открытые документы
AddIntegerItem(nsCStr(pi_RecentlyOpenDocumentsCount), l_Map.ValueToDisplayName(nsCStr(pi_RecentlyOpenDocumentsCount)),
dv_RecentlyOpenDocumentsCount);
MinValue := 1;
MaxValue := max_RecentlyOpenDocumentsCount;
CloseGroup;
// Количество элементов истории
l_Item := TnsHistoryItemsProperty.CreateItem(piHistoryItems, l3Str(l_Map.ValueToDisplayName(nsCStr(piHistoryItems))), dvHistoryItems);
AddItem(l_Node, l_Item);
MinValue := cvHistoryItemsMin;
MaxValue := cvHistoryItemsMax;
// Журнал работы
AddIntegerItem(nsCStr(pi_WorkJournalSize), l_Map.ValueToDisplayName(nsCStr(pi_WorkJournalSize)),
dv_WorkJournalSize);
MinValue := 1;
MaxValue := max_WorkJournalSize;
//
AddButtonItem(vcmConstString(str_pui_PageSetupButton), PageSetupNotify, nil);
ButtonPlace := dd_bpBottomRight;
//
AddButtonItem(vcmConstString(str_pui_StyleTableButton), StyleEditorNotify, nil);
ButtonPlace := dd_bpBottomRight;
//
AddButtonItem(vcmConstString(str_pui_ToolbarButton), ToolbarNotify, nil);
ButtonPlace := dd_bpBottomRight;
// Поскольку настройка тулбаров заточена на прямую работу с MenuManager...
Enabled := IsActive;
// Положение
// Преемственный вид основного меню решили изжить
// http://mdp.garant.ru/pages/viewpage.action?pageId=434744658
(* // Вид основного меню:
AddComboBoxItem(nsCStr(pi_MainMenuType), vcmCStr(str_pui_MainMenuType),
dv_MainMenuType, nsIntegerMapManager.Map[imap_pi_MainMenuType]);
*)
end;
end;
procedure AddSystemBehaviour;
begin
with AppConfig do
begin
l_Node := AddNode('BehaviourSystem', vcmConstString(str_pui_SystemBehavior));
// Начало работы
AddComboBoxItem(nsCStr(pi_OpenOnStart), l_Map.ValueToDisplayName(nsCStr(pi_OpenOnStart)),
nsCStr(dv_OpenOnStart), nsStringMapManager.Map[smap_pi_OpenOnStart]);
Hint := vcmConstString(str_pi_OpenOnStartHint);
// Вкладки
AddGroupItem(GetAliasName, vcmConstString(str_pui_NavigatorSheets));
// Основное меню (показывать\не показывать)
l_Item := AddBooleanItem(nsCStr(pi_Sheets_MainMenu),
l_Map.ValueToDisplayName(nsCStr(pi_Sheets_MainMenu)),
dv_Sheets_MainMenu);
Hint := vcmConstString(str_pi_Sheets_MainMenu_Hint);
// Основное меню (положение формы)
l_Item := TstgNavigatorFormPosition.Create(cFrmIDMainMenu, vcmConstString(str_pui_cFrmIDMainMenu), l_Item);
AddItem(l_Node, l_Item);
LabelTop := False;
// "Мои документы" (показывать\не показывать)
l_Item := AddBooleanItem(nsCStr(pi_Sheets_MyDocuments),
l_Map.ValueToDisplayName(nsCStr(pi_Sheets_MyDocuments)),
dv_Sheets_MyDocuments);
Hint := vcmConstString(str_pi_Sheets_MyDocuments_Hint);
// "Мои документы" (положение формы)
l_Item := TstgNavigatorFormPosition.Create(cFrmIDMyDoc, vcmConstString(str_pui_cFrmIDMyDoc),
l_Item);
AddItem(l_Node, l_Item);
LabelTop := False;
// Конфигурации (показывать\не показывать)
l_Item := AddBooleanItem(nsCStr(pi_Sheets_Config),
l_Map.ValueToDisplayName(nsCStr(pi_Sheets_Config)),
dv_Sheets_Config);
Hint := vcmConstString(str_pi_Sheets_Config_Hint);
// Конфигурации (положение формы)
l_Item := TstgNavigatorFormPosition.Create(cFrmIDConfList, vcmConstString(str_pui_cFrmIDConfList),
l_Item);
AddItem(l_Node, l_Item);
LabelTop := False;
// Документы на контроле (показывать\не показывать)
l_Item := AddBooleanItem(nsCStr(piSheetsDocUnderControl),
l_Map.ValueToDisplayName(nsCStr(piSheetsDocUnderControl)),
dvSheetsDocUnderControl);
Hint := vcmConstString(str_piSheetsDocUnderControl_Hint);
// Документы на контроле (положение формы)
l_Item := TstgNavigatorFormPosition.Create(cFrmIDDocUnderControl,
vcmConstString(str_pui_cFrmIDDocUnderControl),
l_Item);
AddItem(l_Node, l_Item);
LabelTop := False;
// Панель задач (показывать\не показывать)
l_Item := AddBooleanItem(nsCStr(piSheetsTaskPanel),
l_Map.ValueToDisplayName(nsCStr(piSheetsTaskPanel)),
dvSheetsTaskPanel);
Hint := vcmConstString(str_piSheetsTaskPanel_Hint);
// Панель задач (положение формы)
l_Item := TstgNavigatorFormPosition.Create(cFrmIDTaskPanel,
vcmConstString(str_pui_cFrmIDTaskPanel),
l_Item);
AddItem(l_Node, l_Item);
LabelTop := False;
// Термины словаря (положение формы)
l_Item := TstgNavigatorFormPosition.Create(cFrmIDDictionaryTerm,
vcmConstString(str_pui_cFrmIDDictionaryTerm));
AddItem(l_Node, l_Item);
CloseGroup;
AddGroupItem(GetAliasName, vcmConstString(str_pui_Filters)); // Фильтры
// Карточки поиска
AddBooleanItem(nsCStr(pi_Search_Sheets_Filters),
l_Map.ValueToDisplayName(nsCStr(pi_Search_Sheets_Filters)),
dv_Search_Sheets_Filters);
Hint := vcmConstString(str_pi_Search_Sheets_Filters_Hint);
// Список
AddBooleanItem(nsCStr(pi_List_Sheets_Filters),
l_Map.ValueToDisplayName(nsCStr(pi_List_Sheets_Filters)),
dv_List_Sheets_Filters);
Hint := vcmConstString(str_pi_List_Sheets_Filters_Hint);
// Показывать
l_Item := TstgFilterFormPosition.Create(GetAliasName, vcmConstString(str_pui_SheetPosition));
AddItem(l_Node, l_Item);
CloseGroup;
// Печать и экспорт
AddGroupItem(pi_evStyles_PrintAndExport, str_PrintAndExport.AsStr);
// Использовать для экспорта и печати размер шрифта, отображаемого на экране
l_Item := TddRadioConfigItem.CreateItem(pi_evStyles_PrintAndExport_Default, str_PrintAndExport_Default.AsStr, SHevStyles.PrintAndExportDefaultSetting{False});
AddItem(l_Node, l_Item);
LabelTop := False;
// Использовать для экспорта и печати следующий размер шрифта
l_Item := TddRadioConfigItem.CreateItem(pi_evStyles_PrintAndExport_Custom, str_PrintAndExport_Custom.AsStr, SHevStyles.PrintAndExportCustomSetting{True});
AddItem(l_Node, l_Item);
LabelTop := False;
AddItem(l_Node, TstevStylesPrintAndExportFontSizeItem.Create(l_Item));
(* AddComboBoxItem(nsCStr(GetAliasName), vcmCStr(str_EmptyStr),
Ord(pef12), TPrintAndExportFontSizeMapImpl.Make, l_Item);*)
LabelTop := False;
CloseGroup;
AddBooleanItem(nsCStr(pi_DayTips_DontShowAtStart),
l_Map.ValueToDisplayName(nsCStr(pi_DayTips_DontShowAtStart)),
dv_DayTips_DontShowAtStart);
Hint := vcmConstString(str_pi_DayTips_DontShowAtStart_Hint);
AddBooleanItem(nsCStr(pi_PlayBeepOnMistake),
l_Map.ValueToDisplayName(nsCStr(pi_PlayBeepOnMistake)),
dv_PlayBeepOnMistake);
Hint := vcmConstString(str_pi_PlayBeepOnMistake_Hint);
AddBooleanItem(nsCStr(pi_NotifyNewChatMesages),
l_Map.ValueToDisplayName(nsCStr(pi_NotifyNewChatMesages)),
dv_PlayBeepOnMistake);
Hint := vcmConstString(str_pi_NotifyNewChatMesages_Hint);
if (afw.Application.LocaleInfo.Language <> afw_lngEnglish) then
begin
f_EnableMSOIntegration := AddBooleanItem(nsCStr(pi_EnableMSOfficeIntegration),
l_Map.ValueToDisplayName(nsCStr(pi_EnableMSOfficeIntegration)),
dv_EnableMSOfficeIntegration);
Hint := vcmConstString(str_pi_EnableMSOfficeIntegration_Hint);
end;
{l_Item := TstDocumentUseFixedFontForPrintAndExportItem.Create;
AddItem(l_Node, l_Item);}
// Подтверждения
l_Node := AddChild(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(str_MayExit.AsMessage, l_Node);
LoadMessage(qr_ConfigurationDelete, l_Node);
LoadMessage(qr_SaveAsDefaultValuesConf, l_Node);
LoadMessage(qr_StyleTableChanged, l_Node);
LoadMessage(qr_RestoreDefaultValuesPageSetup, l_Node);
LoadMessage(qr_SaveAsDefaultValuesPageSetup, l_Node);
LoadMessage(qr_RestoreDefaultValuesStyleTable, l_Node);
LoadMessage(qr_SaveAsDefaultValuesStyleTable, l_Node);
CloseChild;
end;
end;
procedure AddSearch;
begin
with AppConfig do
begin
l_Node := AddNode('Search', vcmConstString(str_pui_Search));
AddGroupItem(GetAliasName, vcmConstString(str_pui_QueryCards));
//
l_Item := AddComboBoxItem(nsCStr(pi_Search_SituationType), l_Map.ValueToDisplayName(nsCStr(pi_Search_SituationType)),
nsCStr(dv_Search_SituationType), nsStringMapManager.Map[smap_pi_Search_SituationType], nil, li_Search_SituationType_Disable);
Hint := vcmConstString(str_pi_Search_SituationType_Hint);
//
CloseGroup;
//
// Укороченные списки в БП
l_Item := TstgShortList.Create;
AddItem(l_Node, l_Item);
Hint := vcmConstString(str_pi_BaseSearch_BuildShortList_Hint);
l_Node := AddChild(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
// Построение списка
AddGroupItem(GetAliasName, vcmConstString(str_pui_FIlter_BuildList));
l_Item := AddBooleanItem(nsCStr(pi_Search_List_IsBuild),
l_Map.ValueToDisplayName(nsCStr(pi_Search_List_IsBuild)),
dv_Search_List_IsBuild);
Hint := vcmConstString(str_pi_Search_List_IsBuild_Hint);
AddIntegerItem(nsCStr(pi_Search_List_BuildCount),
l_Map.ValueToDisplayName(nsCStr(pi_Search_List_BuildCount)),
dv_Search_List_BuildCount, l_Item);
MinValue := 0;
CloseGroup;
// Построение автореферата
AddGroupItem(GetAliasName, vcmConstString(str_pui_Filter_BuildReview));
l_Item := AddBooleanItem(nsCStr(piSearchListIsBuildReview),
l_Map.ValueToDisplayName(nsCStr(piSearchListIsBuildReview)),
dvSearchListIsBuildReview);
Hint := vcmConstString(str_piSearchListIsBuildReview_Hint);
AddIntegerItem(nsCStr(piSearchListBuildCountReview),
l_Map.ValueToDisplayName(nsCStr(piSearchListBuildCountReview)),
dvSearchListBuildCountReview, l_Item);
MinValue := 0;
CloseGroup;
//
CloseChild;
end;
end;
procedure AddList;
begin
with AppConfig do
begin
l_Node := AddNode('List', vcmConstString(str_pui_List));
AddGroupItem(GetAliasName, vcmConstString(str_pui_DefaultSort));
// Тип сортировки
AddComboBoxItem(nsCStr(pi_List_SortType),
l_Map.ValueToDisplayName(nsCStr(pi_List_SortType)),
dv_List_SortType,
nsIntegerMapManager.Map[imap_pi_List_SortType]);
// Порядок
AddComboBoxItem(nsCStr(pi_List_OrderType),
l_Map.ValueToDisplayName(nsCStr(pi_List_OrderType)),
dv_List_OrderType,
nsIntegerMapManager.Map[imap_pi_List_OrderType]);
CloseGroup;
// Открывать в новом окне
(* AddBooleanItem(nsCStr(pi_List_OpenInNewWindow),
l_Map.ValueToDisplayName(nsCStr(pi_List_OpenInNewWindow)),
dv_List_OpenInNewWindow);
Hint := vcmConstString(str_pi_List_OpenInNewWindow_Hint);*)
// Автоматический переход
AddBooleanItem(nsCStr(pi_List_AutoTransfer),
l_Map.ValueToDisplayName(nsCStr(pi_List_AutoTransfer)),
dv_List_AutoTransfer);
Hint := vcmConstString(str_pi_List_AutoTransfer_Hint);
AddGroupItem(GetAliasName, vcmConstString(str_pi_List_PrintOnlyFirstLevel));
// Печатать только первый уровень
AddBooleanItem(nsCStr(pi_DocumentList_PrintOnlyFirstLevel),
l_Map.ValueToDisplayName(nsCStr(pi_DocumentList_PrintOnlyFirstLevel)),
dv_DocumentList_PrintOnlyFirstLevel);
if (afw.Application.LocaleInfo.Language <> afw_lngEnglish) then
AddBooleanItem(nsCStr(pi_DrugList_PrintOnlyFirstLevel),
l_Map.ValueToDisplayName(nsCStr(pi_DrugList_PrintOnlyFirstLevel)),
dv_DrugList_PrintOnlyFirstLevel);
CloseGroup;
// Форма зоны синхронного просмотра:
AddBooleanItem(nsCStr(pi_List_ShowAnnotationByDefault),
l_Map.ValueToDisplayName(nsCStr(pi_List_ShowAnnotationByDefault)),
dv_List_ShowAnnotationByDefault);
Hint := vcmConstString(str_pi_List_ShowAnnotationByDefault_Hint);
// Ограничения при эксопрте
if afw.Application.IsInternal then
AddBooleanItem(nsCStr(pi_List_ExportWORestrictions),
l_Map.ValueToDisplayName(nsCStr(pi_List_ExportWORestrictions)),
dv_List_ExportWORestrictions);
// Подтверждения
l_Node := AddChild(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(qr_DeleteListSelected, l_Node);
AddGroupItem(GetAliasName, vcmConstString(str_pui_ListSelectionsAsk));
LoadMessage(str_ListExportSelectionToWord.AsMessage, l_Node);
LoadMessage(str_ListEMailSelection.AsMessage, l_Node);
LoadMessage(str_ListPrintSelectedConfirmation.AsMessage, l_Node);
CloseGroup;
CloseChild;
end;
end;
procedure AddDocument;
begin
with AppConfig do
begin
l_Node := AddNode('Document', vcmConstString(str_pui_DOcument));
f_DocumentNode := l_Node;
// Открывать ссылки в новом окне
(* AddBooleanItem(nsCStr(pi_Document_OpenInNewWindow),
l_Map.ValueToDisplayName(nsCStr(pi_Document_OpenInNewWindow)),
dv_Document_OpenInNewWindow); *)
Hint := vcmConstString(str_pi_Document_OpenInNewWindow_Hint);
// Показывать предупреждение
AddBooleanItem(nsCStr(pi_Document_Warning),
l_Map.ValueToDisplayName(nsCStr(pi_Document_Warning)),
dv_Document_Warning);
Hint := vcmConstString(str_pi_Document_Warning_Hint);
// Показывать информацию о документе:
l_Item := AddBooleanItem(nsCStr(pi_Document_Sheets_Attributes),
l_Map.ValueToDisplayName(nsCStr(pi_Document_Sheets_Attributes)),
dv_Document_Sheets_Attributes);
Hint := vcmConstString(str_pi_Document_Sheets_Attributes_Hint);
// Показывать перевод текста:
l_Item := AddBooleanItem(nsCStr(pi_Document_Sheets_Translation),
l_Map.ValueToDisplayName(nsCStr(pi_Document_Sheets_Translation)),
dv_Document_Sheets_Translation);
Hint := vcmConstString(str_pi_Document_Sheets_Translation_Hint);
// Эксопртировать с заголовками:
l_Item := AddBooleanItem(nsCStr(pi_Document_ExportWithBlockNames),
l_Map.ValueToDisplayName(nsCStr(pi_Document_ExportWithBlockNames)),
dv_Document_ExportWithBlockNames);
Hint := vcmConstString(str_pi_Document_ExportWithBlockNames_Hint);
// Версионные комментарии:
l_Item := TstgShowVersionComments.Create;
AddItem(l_Node, l_Item);
// По ссылке в информации об изменениях в тексте документа открывать
//if (afw.Application.LocaleInfo.Language <> afw_lngEnglish) then
begin
l_Item := TstgVersionCommentLinkBehaviour.Create;
AddItem(l_Node, l_Item);
(* l_Item := AddBooleanItem(nsCStr(pi_Document_ShowVersionsComment),
l_Map.ValueToDisplayName(nsCStr(pi_Document_ShowVersionsComment)),
dv_Document_ShowVersionsComment);*)
Hint := str_pi_Document_ShowVersionsComment_Hint.AsStr;
end;
l_Item := TstTDocumentServiceShowChangesInfoItem.Create;
AddItem(l_Node, l_Item);
// Масштаб картинки
l_Item := TstgScalePicture.Create;
AddItem(l_Node, l_Item);
Hint := vcmConstString(str_piDocumentPictureScale_Hint);
// Выделение текста
l_Item := TstgTextSelection.Create;
AddItem(l_Node, l_Item);
Hint := vcmConstString(str_pi_Document_PermanentSelection_Hint);
// Показ корреспондентов\респондентов
AddGroupItem(GetAliasName, vcmConstString(str_pui_Correst_Rest_ShowMethod));
f_UserCR1SheetType := AddComboBoxItem(nsCStr(pi_Document_CRSheet0), l_Map.ValueToDisplayName(nsCStr(pi_Document_CRSheet0)),
dv_Document_CRSheet0, nsIntegerMapManager.Map[imap_lstCRType], nil, li_Document_CRSheet0_Disable);
f_UserCR1Type := AddComboBoxItem(nsCStr(pi_Document_CRType0), l_Map.ValueToDisplayName(nsCStr(pi_Document_CRType0)),
nsCStr(dv_Document_CRType0), nsStringMapManager.Map[smap_SettingsCRType], f_UserCR1SheetType);
LabelTop := False;
f_UserCR2SheetType := AddComboBoxItem(nsCStr(pi_Document_CRSheet1), l_Map.ValueToDisplayName(nsCStr(pi_Document_CRSheet1)),
dv_Document_CRSheet1, nsIntegerMapManager.Map[imap_lstCRType], nil, li_Document_CRSheet1_Disable);
f_UserCR2Type := AddComboBoxItem(nsCStr(pi_Document_CRType1), l_Map.ValueToDisplayName(nsCStr(pi_Document_CRType1)),
nsCStr(dv_Document_CRType1), nsStringMapManager.Map[smap_SettingsCRType], f_UserCR2SheetType);
LabelTop := False;
CloseGroup;
// Вкладки
AddGroupItem(GetAliasName, vcmConstString(str_pui_Document_Sheets));
l_Item := AddBooleanItem(nsCStr(pi_Document_Sheets_Redactions),
l_Map.ValueToDisplayName(nsCStr(pi_Document_Sheets_Redactions)),
dv_Document_Sheets_Redactions);
Hint := vcmConstString(str_pi_Document_Sheets_Redactions_Hint);
l_Item := TstgNavigatorFormPosition.Create(cFrmIDRedations, vcmConstString(str_pui_cFrmIDRedations),
l_Item);
AddItem(l_Node, l_Item);
CloseGroup;
// Поля
AddChild(GetAliasName, vcmConstString(str_piu_Document_SubPanel));
AddBooleanItem(nsCStr(pi_Document_SubPanel_ShowBlocks),
l_Map.ValueToDisplayName(nsCStr(pi_Document_SubPanel_ShowBlocks)),
dv_Document_SubPanel_ShowBlocks);
AddBooleanItem(nsCStr(pi_Document_SubPanel_ShowBookmarks),
l_Map.ValueToDisplayName(nsCStr(pi_Document_SubPanel_ShowBookmarks)),
dv_Document_SubPanel_ShowBookmarks);
AddBooleanItem(nsCStr(pi_Document_SubPanel_ShowJurorComments),
l_Map.ValueToDisplayName(nsCStr(pi_Document_SubPanel_ShowJurorComments)),
dv_Document_SubPanel_ShowJurorComments);
AddBooleanItem(nsCStr(pi_Document_SubPanel_ShowUserComments),
l_Map.ValueToDisplayName(nsCStr(pi_Document_SubPanel_ShowUserComments)),
dv_Document_SubPanel_ShowUserComments);
AddBooleanItem(nsCStr(pi_Document_SubPanel_ShowVersionComments),
l_Map.ValueToDisplayName(nsCStr(pi_Document_SubPanel_ShowVersionComments)),
dv_Document_SubPanel_ShowVersionComments);
CloseChild;
// Подтверждения
l_Node := AddChild(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(qr_OpenExternalQuery, l_Node);
AddGroupItem(GetAliasName, vcmConstString(str_pui_SelectionsAsk));
LoadMessage(str_ExportSelectionToWord.AsMessage, l_Node);
LoadMessage(str_DocumentEMailSelection.AsMessage, l_Node);
LoadMessage(str_PrintSelectedConfirmation.AsMessage, l_Node);
CloseGroup;
LoadMessage(qr_DropChangeStatusToDoc, l_Node);
if defDataAdapter.RevisionCheckEnabled then
AddBooleanItem(nsCStr(pi_Document_ForceAskForIntranet),
l_Map.ValueToDisplayName(nsCStr(pi_Document_ForceAskForIntranet)),
dv_Document_ForceAskForIntranet);
//LoadMessage(str_InActualDocumentAction.AsMessage, l_Node);
// http://mdp.garant.ru/pages/viewpage.action?pageId=278832944&focusedCommentId=294591153#comment-294591153
LoadMessage(inf_HyperlinkToDocumentProducerLinkMade, l_Node);
CloseChild;
end;
end;
procedure AddMyDoc;
begin
with AppConfig do
begin
AddNode('MyDocument', vcmConstString(str_pui_MyDocument));
// AddBooleanItem(nsCStr(pi_OpenInNewWindow), l_Map.ValueToDisplayName(nsCStr(pi_OpenInNewWindow)),
// dv_OpenInNewWindow);
// Hint := vcmConstString(str_pi_OpenInNewWindow_Hint);
// Подтверждения
l_Node := AddChild(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(qr_FolderEmptyQuery, l_Node);
LoadMessage(qr_ObjectDelete, l_Node);
LoadMessage(qr_SaveItemQuery, l_Node);
LoadMessage(qr_FolderSave, l_Node);
LoadMessage(qr_QueryWasSavedEx, l_Node);
LoadMessage(qr_QueryIsEmpty, l_Node);
LoadMessage(qr_FilterWasSaved, l_Node);
LoadMessage(qr_DeleteFilter, l_Node);
CloseChild;
end;
end;
procedure AddDocInControl;
begin
with AppConfig do
begin
AddNode('DocOnControl', vcmConstString(str_pui_ControlledDocuments));
AddComboBoxItem(nsCStr(pi_DropChangeStatus), l_Map.ValueToDisplayName(nsCStr(pi_DropChangeStatus)),
nsCStr(dv_DropChangeStatus), nsStringMapManager.Map[smap_pi_DropChangeStatus]);
Hint := vcmConstString(str_pi_DropChangeStatus_Hint);
// Подтверждения
l_Node := AddChild(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(qr_RemoveControlStatus, l_Node);
LoadMessage(qr_SetControlStatus, l_Node);
LoadMessage(qr_DelControlStatus, l_Node);
LoadMessage(inf_SetDocToControl, l_Node);
LoadMessage(qr_RemoveDocumentFromControl, l_Node);
LoadMessage(qr_DropChangeStatusToSelected, l_Node);
LoadMessage(qr_DropChangeStatusToOpened, l_Node);
LoadMessage(qr_DropChangeStatusAllObjects, l_Node);
LoadMessage(str_ChangedDocumentOnControl.AsMessage, l_Node);
CloseChild;
end;
end;
procedure AddConsultations;
const
lc_ButtonMaps: TnsButtonCaptionArray = (
@str_pui_ask_ShowDialog, @str_pui_ask_DoNotShowDialog, @str_pui_ask_OK, @str_pui_ask_Cancel,
@str_pui_ask_Abort, @str_pui_ask_Retry, @str_pui_ask_Ignore, @str_pui_ask_All,
@str_pui_ask_NoToAll, @str_pui_ask_YesToAll, @str_pui_ask_Help {$IfDef XE}, nil{$EndIf});
begin
with AppConfig do
begin
l_Node := AddNode('Consultations', vcmConstString(str_pui_ConsultationsAsknoweladgemets));
AddGroupItem(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(inf_ConsultationSuccessSend, l_Node);
// http://mdp.garant.ru/pages/viewpage.action?pageId=423620375
if (not l_IsEnglish) then
begin
LoadMessage(inf_PaymentConfirmed, l_Node);
LoadMessage(inf_PaymentRejected, l_Node);
end;
LoadMessage(qr_CloseUnmarkedConsultation, l_Node, @lc_ButtonMaps);
LoadMessage(qr_TryOpenConsultationAnswer, l_Node);
LoadMessage(qr_CheckLegalAdviseAvailable, l_Node);
LoadMessage(inf_ConsultationSuccessCheck, l_Node);
CloseGroup;
end;
end;
procedure AddContextFilterParams;
procedure lpAddSettings;
var
lIndex : Integer;
lCaptionMap: InsStringValueMap;
l_FilterParamsInfo: InsContextFilterParamsInfo;
begin
lCaptionMap := nsStringMapManager.Map[smap_ContextParamsCaptions];
with AppConfig do
for lIndex := Low(SupportedContextsFilterRoots) to High(SupportedContextsFilterRoots) do
begin
if (afw.Application.LocaleInfo.Language = afw_lngEnglish) and
((SupportedContextsFilterRoots[lIndex] = AT_CLASS_REVIEW) or
(SupportedContextsFilterRoots[lIndex] = AT_SOURCE_REVIEW)) then
Continue;
if Supports(TnsContextFilterParams.Make(SupportedContextsFilterRoots[lIndex]),
InsContextFilterParamsInfo, l_FilterParamsInfo) then
with l_FilterParamsInfo do
try
AddCaptionElement(l3Str(lCaptionMap.ValueToDisplayName(nsCStr(BaseSettingID))));
// Идентификаторы настроек
AddAlias(WordPositionSettingID);
AddAlias(WordOrderSettingID);
AddAlias(TreeLevelDistSettingID);
finally
l_FilterParamsInfo := nil;
end;
end;
end;
begin
with AppConfig do
begin
AddNode('ContextParamsNode', vcmConstString(str_pui_ContextFilter));
// MasterSlaveItem
AddMasterSlaveItem(GetAliasName, vcmConstString(str_pui_ContextFilterParams));
try
// Положение контекста
AddComboBoxItem(nsCStr(GetAliasName), vcmCStr(str_pui_COntextWordPosition),
Ord(Low(Tl3WordPosition)), TWordPositionNamesMapImpl.Make);
Hint := str_nsc_cpmWordPositionHint.AsStr;
// Порядок слов
AddComboBoxItem(nsCStr(GetAliasName), vcmCStr(str_pui_ContextWordOrder),
Ord(Low(Tl3WordOrder)), TWordOrderNamesMapImpl.Make);
Hint := str_nsc_cpmWordOrderHint.AsStr;
// Область поиска
AddComboBoxItem(nsCStr(GetAliasName), vcmCStr(str_pui_COntextSearchArea),
Ord(Low(Tl3TreeLevelDist)), TTreeLevelDistNamesMapImpl.Make);
Hint := str_nsc_cpmTreeLevelDistHint.AsStr;
// Добавим список настроек
lpAddSettings;
finally
CloseMasterSlaveItem;
end;
end;
end;
procedure AddAdmin;
begin
with AppConfig do
begin
l_Node := AddNode('Admin', vcmConstString(str_pui_AdminAsknoweladgemets));
AddGroupItem(GetAliasName, vcmConstString(str_pui_Asknoweladgemets));
LoadMessage(qr_DeleteUser, l_Node);
LoadMessage(qr_DeleteUsers, l_Node);
LoadMessage(qr_LogoutUsers, l_Node);
LoadMessage(inf_UsersDeleted, l_Node);
LoadMessage(inf_MultiplyChangeConsulting, l_Node);
LoadMessage(inf_LogoutUsersNotify, l_Node);
LoadMessage(inf_LogoutUserNotify, l_Node);
LoadMessage(inf_MultiplyChangePrivilegedUsers, l_Node);
LoadMessage(qr_DeleteGroup, l_Node);
CloseGroup;
end;
end;
begin
l_IsEnglish := afw.Application.LocaleInfo.Language = afw_lngEnglish;
l_Map := nsStringMapManager.Map[smap_Settings];
l_GroupIndex := -1;
AppConfig.AutoSize := True;
// Информация о конфигурации
f_ConfInfo := TnsConfInfoNode.Create('ConfInfo', vcmConstString(str_cnCaption),
Self);
AppConfig.AddUserNode(f_ConfInfo);
// Настройки интерфейса
AddGUISettings;
// Поведение системы
AddSystemBehaviour;
// Работа с рубрикатором
// AddRubricator;
// Работа с поиском
AddSearch;
// Работа со списком
AddList;
// Работа с документом
AddDocument;
// Работа с ''Моими документами''
AddMyDoc;
// Документы на контроле
AddDocInControl;
// Консультации подтверждения
if DefDataAdapter.HasConsultations then
AddConsultations;
// Параметры контекстной фильтрации
AddContextFilterParams;
// Параметры контекстной фильтрации
if defDataAdapter.AdministratorLogin then
AddAdmin;
// Загрузим данные
if Assigned(f_Storage) and not f_MakeSettings and not f_InProcess then
begin
Load(False);
// Экспорт настроек
{$IfDef nsExportSettings}
ExportSettings;
{$EndIf nsExportSettings}
end;
end;
function TnsConfigSettingsInfo.GetModalResult(aBtn: TMsgDlgBtn): longint;
begin
Result := 65535;
case aBtn of
mbYes: Result := mrYes;
mbNo: Result := mrNo;
mbOk: Result := mrOk;
mbCancel: Result := mrCancel;
mbAbort: Result := mrAbort;
mbRetry: Result := mrRetry;
mbIgnore: Result := mrIgnore;
mbAll: Result := mrAll;
mbNoToAll: Result := mrNoToAll;
mbYesToAll: Result := mrYesToAll;
end;
end;
procedure TnsConfigSettingsInfo.DoAfterLoad(aRestoreDefault: Boolean);
begin
inherited DoAfterLoad(aRestoreDefault);
if aRestoreDefault and not f_InRestoreAll then
begin
if IsActive then
vcmBase.vcmDispatcher.ReinsertForms;
NotifySettingsChanged;
end;//if aRestoreDefault and not f_InRestoreAll then
if Assigned(f_AppConfig) then
f_AppConfig.Changed := False;
end;//DoAfterLoad
procedure TnsConfigSettingsInfo.DoAfterSave(aSaveAsDefault: Boolean);
begin
try
inherited DoAfterSave(aSaveAsDefault);
if f_NeedReinsertFormsAfterSave then
TvcmDispatcher.Instance.As_IvcmDispatcher.ReinsertForms;
if f_AppConfig.Changed then
NotifySettingsChanged;
if Assigned(f_AppConfig) then
f_AppConfig.Changed := False;
finally
f_NeedReinsertFormsAfterSave := False;
end;
end;
function TnsConfigSettingsInfo.DoGetModified: Boolean;
begin
Result := Inherited DoGetModified;
if Assigned(f_AppCOnfig) then
Result := Result or f_AppConfig.IsSettingsChanged;
end;
function TnsConfigSettingsInfo.DoSettingChanged(
const aSettingId: TvcmSettingId): Boolean;
begin
Result := not f_InProcess and (EditingSettings.IndexOf(aSettingId)<>-1);
if Result then
CheckDifferFromDefault
end;
procedure TnsConfigSettingsInfo.SettingsReplaceFinish;
begin
inherited;
CheckDifferFromDefault;
end;//SettingsReplaceFinish
constructor TstgVersionCommentLinkBehaviour.Create(aMasterItem: TddBaseConfigItem = nil);
var
lValue : TddConfigValue;
begin
l3FillChar(lValue, SizeOf(lValue), 0);
lValue.Kind := dd_vkBoolean;
lValue.AsBoolean := dv_Document_ShowVersionCommentsLinkBehaviour;
inherited Create(pi_Document_ShowVersionCommentsLinkBehaviour,
str_pi_Document_ShowVersionCommentsLinkBehaviour.AsStr,
lValue, TVersionCommentsLinkBegaviourMapImpl.Make, aMasterItem);
end;//TstgVersionCommentLinkBehaviour.Create
{ TstgShortList }
constructor TstgShortList.Create(aMasterItem: TddBaseConfigItem);
var
lValue : TddConfigValue;
begin
l3FillChar(lValue, SizeOf(lValue), 0);
lValue.Kind := dd_vkBoolean;
lValue.AsBoolean := dv_BaseSearch_BuildShortList;
inherited Create(pi_BaseSearch_BuildShortList,
l3Str(nsStringMapManager.Map[smap_Settings].ValueToDisplayName(nsCStr(pi_BaseSearch_BuildShortList))),
lValue, nsIntegerMapManager.Map[imap_pi_BaseSearch_BuildShortList], aMasterItem);
end;
{$IfEnd} //not Admin AND not Monitorings
end.
|
unit UBuckets;
interface
type
// Die Klasse hat eine Anzahl von Zählern (Buckets)
// die Prozedure Increment erhöht einen best. Zähler
TBucketCounter = class(TObject)
private
FBuckets : array of Integer;
FTotalSum : Integer;
FAverage : Double;
function GetCount(idx: Integer): Integer;
public
UpperLimit, LowerLimit : Integer;
constructor Create(size:Integer=256);
procedure Clear;
procedure FinishUpdate;
function GetNumberOfCount(count:Integer):Integer;
procedure Increment(index:Integer);
function Variance:Double; // Abweichung
function VariancePos:Double;
function VarianceWithLimit(limit:double):Double; // Abweichung
property Count[idx:Integer]:Integer read GetCount;
property TotalSum:Integer read FTotalSum;
property Average:Double read FAverage; // Durchschnitt
end;
implementation
{ TBucketCounter }
procedure TBucketCounter.Increment(index: Integer);
begin
Inc(FBuckets[index]);
end;
procedure TBucketCounter.Clear;
var
i : Integer;
begin
for i := low(FBuckets) to High(FBuckets) do
FBuckets[i] := 0;
end;
constructor TBucketCounter.Create(size: Integer);
begin
inherited Create;
SetLength(FBuckets, size);
end;
function TBucketCounter.Variance: Double;
var
i : Integer;
diff : Double;
begin
Result := 0;
for i := low(FBuckets) to High(FBuckets) do
begin
diff := FBuckets[i] - Average;
Result := Result + diff * diff;
end;
end;
function TBucketCounter.VariancePos: Double;
var
i : Integer;
diff : Double;
begin
Result := 0;
for i := low(FBuckets) to High(FBuckets) do
begin
diff := FBuckets[i] - Average;
if diff > 0.0 then
Result := Result + diff * diff * diff * diff;
end;
end;
function TBucketCounter.VarianceWithLimit(limit: double): Double;
var
i : Integer;
mw, diff : Double;
begin
mw := Average;
Result := 0;
for i := low(FBuckets) to High(FBuckets) do
begin
diff := FBuckets[i] - mw;
if Abs(diff) > limit then
Result := Result + diff * diff * diff * diff;
end;
end;
function TBucketCounter.GetNumberOfCount(count: Integer): Integer;
var
i : Integer;
begin
Result := 0;
for i := low(FBuckets) to High(FBuckets) do
begin
if FBuckets[i] = count then
Inc(Result);
end;
end;
function TBucketCounter.GetCount(idx: Integer): Integer;
begin
Result := FBuckets[idx];
end;
procedure TBucketCounter.FinishUpdate;
var
i : Integer;
begin
FTotalSum := 0;
UpperLimit := FBuckets[0];
LowerLimit := FBuckets[0];
for i := low(FBuckets) to High(FBuckets) do
begin
Inc(FTotalSum, FBuckets[i]);
if FBuckets[i] > UpperLimit then
UpperLimit := FBuckets[i]
else if FBuckets[i] < LowerLimit then
LowerLimit := FBuckets[i]
end;
FAverage := TotalSum / length(FBuckets);
end;
end.
|
unit Register_Obj;
interface
uses
Registry, Windows, Main_CV;
type
TMainReg = class
private
reg: TRegistry;
public
constructor Create;
destructor Destroy; override;
function GetMain(aKey: String; default: String=''): String;
procedure SetMain(aKey, aVal: String);
function GetVal(aKey: String): String; virtual; abstract;
procedure SetVal(aKey, aVal: String); virtual; abstract;
end;
TSrcReg = class(TMainReg)
public
function GetVal(aKey: String): String; override;
procedure SetVal(aKey, aVal: String); override;
function GetFilePathName: String;
function GetGeo1X: String;
function GetGeo1Y: String;
function GetGeo2X: String;
function GetGeo2Y: String;
function GetLastSLPath: String;
procedure SetFilePathName(aVal: String);
procedure SetGeo1X(aVal: String);
procedure SetGeo1Y(aVal: String);
procedure SetGeo2X(aVal: String);
procedure SetGeo2Y(aVal: String);
procedure SetLastSLPath(aVal: String);
end;
implementation
{ TSrcReg }
constructor TMainReg.Create;
begin
reg := TRegistry.Create; //zwalniane w TMainReg.Destroy
reg.rootKey := HKEY_CURRENT_USER;
end;
destructor TMainReg.Destroy;
begin
inherited;
reg.Free;
end;
function TMainReg.GetMain(aKey: String; default: String=''): String;
begin
if reg.OpenKey(PROGRAM_REG_PATH, true) then
begin
try
result := GetVal(aKey);
finally
if (result = '') and (default <> '') then
begin
SetMain(aKey, default);
result := default;
end;
reg.CloseKey;
end;
end else
begin
//if not reg.OpenKey(PROGRAM_REG_PATH, true) then
Assert(false, 'Nie można utworzyć wpisu w rejestrze dla "' + PROGRAM_REG_PATH + '"');
//reg.CloseKey;
end;
end;
procedure TMainReg.SetMain(aKey, aVal: String);
begin
if reg.OpenKey(PROGRAM_REG_PATH, true) then
begin
try
SetVal(aKey, aVal);
finally
reg.CloseKey;
end;
end else
begin
//if not reg.OpenKey(PROGRAM_REG_PATH, true) then
Assert(false, 'Nie można utworzyć wpisu w rejestrze dla "' + PROGRAM_REG_PATH + '"');
//reg.CloseKey;
end;
end;
procedure TSrcReg.SetFilePathName(aVal: String);
begin
SetMain(FILE_PATH_NAME, aVal);
end;
procedure TSrcReg.SetGeo1X(aVal: String);
begin
SetMain(GEO_1_X, aVal);
end;
procedure TSrcReg.SetGeo1Y(aVal: String);
begin
SetMain(GEO_1_Y, aVal);
end;
procedure TSrcReg.SetGeo2X(aVal: String);
begin
SetMain(GEO_2_X, aVal);
end;
procedure TSrcReg.SetGeo2Y(aVal: String);
begin
SetMain(GEO_2_Y, aVal);
end;
procedure TSrcReg.SetLastSLPath(aVal: String);
begin
SetMain(LAST_SL_PATH, aVal);
end;
procedure TSrcReg.SetVal(aKey, aVal: String);
begin
if not reg.KeyExists(aKey) then
try
reg.WriteString(aKey, aVal);
except
Assert(false, 'Nie można utworzyć wartości w rejestrze dla "' + aKey + '"');
end;
end;
{ TSrcReg }
function TSrcReg.GetFilePathName: String;
begin
result := GetMain(FILE_PATH_NAME);
end;
function TSrcReg.GetGeo1X: String;
begin
result := GetMain(GEO_1_X);
end;
function TSrcReg.GetGeo1Y: String;
begin
result := GetMain(GEO_1_Y);
end;
function TSrcReg.GetGeo2X: String;
begin
result := GetMain(GEO_2_X);
end;
function TSrcReg.GetGeo2Y: String;
begin
result := GetMain(GEO_2_Y);
end;
function TSrcReg.GetLastSLPath: String;
begin
result := GetMain(LAST_SL_PATH, 'C:/');
end;
function TSrcReg.GetVal(aKey: String): String;
begin
if not reg.KeyExists(aKey) then
try
reg.ReadString(aKey);
except
Assert(false, 'Nie można utworzyć wartości w rejestrze dla "' + aKey + '"');
end;
result := reg.ReadString(aKey);
end;
end.
|
unit uConsts;
{
Copyright 2020 Dmitriy Sosnovich, dmitriy@sosnovich.com
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.}
interface
const
cPythonInstalledDir = 'D:\Python39\';
cPythonDll = 'python39.dll';
cPythonDllFullPath = cPythonInstalledDir + cPythonDll;
cRowId = 'rowid';
cOutFolder = './out/';
cOutFull = cOutFolder+'wmda_xml_full.csv';
cDropped = cOutFolder+'wmda_xml_%s%s.csv';
cPandasLib = 'pandas';
cElementTreeLib = 'xml.etree.ElementTree';
cOsLib = 'os';
cDateTimeLib = 'datetime';
cXPathStart = './';
cPythonNewStringExpression = 'str(''\n'')';
cCSVDelimiter = ';';
cBANK_MANUF_ID = 'BANK_MANUF_ID';
cBANK_DISTRIB_ID = 'BANK_DISTRIB_ID' ;
cBANK_ATTRIB_WMDA = 'WMDA';
cBANK_ATTRIB_EMDIS = 'EMDIS';
implementation
end.
|
unit xButton;
interface
uses
SysUtils, Classes, Controls, Graphics, xGradient, Messages, xStyleContainer;
type
TxButton = class;
TxButtonState = (xbsDown, xbsUp);
TxButtonActionLink = class(TControlActionLink)
protected
FClient: TxButton;
procedure AssignClient(AClient: TObject); override;
end;
TxButton = class(TCustomControl)
private
FColor: TColor;
FColorInner: TColor;
FColorOuter: TColor;
FDrawFrame: Boolean;
FGradient: TxGradient;
FState: TxButtonState;
FHotTrack: Boolean;
FDisabledShadowColor: TColor;
FDisabledColor: TColor;
FDrawFocusRect: Boolean;
FFocusRectColor: TColor;
FHotTrackShadowColor: TColor;
Painting: Boolean;
FStyleContainer: TxStyleContainer;
FDefault: Boolean;
procedure SetColor(const Value: TColor);
procedure SetDrawFrame(const Value: Boolean);
procedure SetColorInner(const Value: TColor);
procedure SetColorOuter(const Value: TColor);
procedure SetGradient(const Value: TxGradient);
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure SetHotTrack(const Value: Boolean);
procedure SetDisabledColor(const Value: TColor);
procedure SetDisabledShadowColor(const Value: TColor);
procedure SetDrawFocusRect(const Value: Boolean);
procedure SetFocusRectColor(const Value: TColor);
procedure SetHotTrackShadowColor(const Value: TColor);
procedure SetStyleContainer(const Value: TxStyleContainer);
procedure SetDefault(const Value: Boolean);
protected
procedure WMSetFocus(var Message: TWMSetFocus); message WM_SETFOCUS;
procedure WMKillFocus(var Message: TWMSetFocus); message WM_KILLFOCUS;
procedure CMTextChanged(var M: TMessage); message CM_TEXTCHANGED;
procedure CMDialogKey(var Message: TCMDialogKey); message CM_DIALOGKEY;
procedure WMChar(var M: TWMChar); message WM_CHAR;
procedure WMKeyDown(var M: TMessage); message WM_KEYDOWN;
procedure WMKeyUp(var M: TMessage); message WM_KEYUP;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure Paint; override;
procedure PaintFrame; virtual;
procedure SetEnabled(Value: Boolean); override;
procedure WndProc(var Message: TMessage); override;
public
FOver: Boolean;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ContainerDeleted;
published
property Action;
property Align;
property Anchors;
property Caption;
property Color: TColor read FColor write SetColor default clBtnFace;
property ColorInner: TColor read FColorInner write SetColorInner default
clBtnHighlight;
property ColorOuter: TColor read FColorOuter write SetColorOuter default
clBtnShadow;
property Default: Boolean read FDefault write SetDefault default False;
property DisabledColor: TColor read FDisabledColor write SetDisabledColor
default clBtnShadow;
property DisabledShadowColor: TColor read FDisabledShadowColor write
SetDisabledShadowColor default clBtnHighlight;
property DrawFocusRect: Boolean read FDrawFocusRect write SetDrawFocusRect
default True;
property DrawFrame: Boolean read FDrawFrame write SetDrawFrame default True;
property Enabled;
property FocusRectColor: TColor read FFocusRectColor write SetFocusRectColor
default clBlack;
property Font;
property Gradient: TxGradient read FGradient write SetGradient;
property HotTrack: Boolean read FHotTrack write SetHotTrack default True;
property HotTrackShadowColor: TColor read FHotTrackShadowColor
write SetHotTrackShadowColor default clBtnShadow;
property OnClick;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyUp;
property OnKeyPress;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property ParentFont;
property StyleContainer: TxStyleContainer read FStyleContainer
write SetStyleContainer;
property TabOrder;
property TabStop default True;
property Visible;
end;
implementation
uses Types, ExtCtrls, StdCtrls, Windows, Forms;
constructor TxButton.Create(AOwner: TComponent);
begin
inherited;
Width := 80;
Height := 25;
FColor := clBtnFace;
FColorInner := clBtnHighlight;
FColorOuter := clBtnShadow;
FDisabledColor := clBtnShadow;
FDisabledShadowColor := clBtnHighlight;
FDrawFrame := True;
FDrawFocusRect := True;
FState := xbsUp;
FHotTrack := True;
FHotTrackShadowColor := clBtnShadow;
TabStop := True;
FGradient := TxGradient.Create(Self);
end;
destructor TxButton.Destroy;
begin
Gradient.Free;
inherited;
end;
procedure TxButton.PaintFrame;
var
R: TRect;
begin
R := ClientRect;
Canvas.Brush.Color := FColor;
if (Focused and FDrawFocusRect) or (FDefault and Enabled) then begin
Canvas.Brush.Color := FFocusRectColor;
// Canvas.RoundRect(R.Left, R.Top, R.Right, R.Bottom, 2, 2);
Canvas.FrameRect(R);
InflateRect(R, -1, -1);
end;
if not (csDesigning in ComponentState) and FOver and FHotTrack then begin
Frame3D(Canvas, R, $206B2408, $206B2408, 1)
end
else
if FState = xbsUp then Frame3D(Canvas, R, FColorInner, FColorOuter, 1)
else Frame3D(Canvas, R, FColorOuter, FColorInner, 1);
Canvas.Brush.Color := FColor;
end;
procedure TxButton.Paint;
var
R: TRect;
TH, TW, X, Y: Word;
FOldStyle: TFontStyles;
grSCOld: TColor;
begin
if not Painting then begin
Painting := True;
try
R := ClientRect;
Canvas.Font := Font;
FOldStyle := Font.Style;
// if FOver and not (csDesigning in ComponentState) and FHotTrack
// then Canvas.Font.Style := Canvas.Font.Style + [fsBold];
if Gradient.Enabled then begin
grSCOld := Gradient.ColorBegin;
if not (csDesigning in ComponentState) and FHotTrack and FOver then begin
Canvas.Brush.Color := $20D6BEB5;
Canvas.FillRect(R);
end
else Gradient.GradientFill;
end
else with Canvas do begin
Brush.Color := FColor;
FillRect(R);
end;
if DrawFrame then PaintFrame;
InflateRect(R, -3, -3);
TW := Canvas.TextWidth(Caption);
TH := Canvas.TextHeight('W');
Canvas.Brush.Style := bsClear;
X := (Width - TW) div 2;
Y := (Height - TH) div 2;
if not Enabled then begin
Canvas.Font.Color := FDisabledShadowColor;
Canvas.TextOut(X + 1, Y + 1, Caption);
Canvas.Font.Color := FDisabledColor;
Canvas.TextOut(X, Y, Caption);
end
else begin
if FOver and not (csDesigning in ComponentState) and FHotTrack and
(FState = xbsUp) then begin
Canvas.Font.Color := FHotTrackShadowColor;
// Canvas.TextOut(X + 1, Y + 1, Caption);
Canvas.Font.Color := Font.Color;
end
else if FState = xbsDown then begin
// Inc(X);
// Inc(Y);
end;
Canvas.TextOut(X, Y, Caption);
end;
Canvas.Font.Style := FOldStyle;
finally
Painting := False;
end;
end;
end;
procedure TxButton.SetColor(const Value: TColor);
begin
FColor := Value;
Invalidate;
end;
procedure TxButton.SetColorInner(const Value: TColor);
begin
FColorInner := Value;
Invalidate;
end;
procedure TxButton.SetColorOuter(const Value: TColor);
begin
FColorOuter := Value;
Invalidate;
end;
procedure TxButton.SetDrawFrame(const Value: Boolean);
begin
FDrawFrame := Value;
Invalidate;
end;
procedure TxButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited MouseDown(Button, Shift, X, Y);
if (Button = mbLeft) then begin
FState := xbsDown;
end;
Invalidate;
end;
procedure TxButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
begin
inherited MouseUp(Button, Shift, X, Y);
if (Button = mbLeft) then begin
FState := xbsUp;
end;
Invalidate;
end;
procedure TxButton.WndProc(var Message: TMessage);
begin
case Message.Msg of
WM_LBUTTONDOWN, WM_LBUTTONDBLCLK:
if not (csDesigning in ComponentState) and not Focused then begin
Windows.SetFocus(Handle);
if not Focused then Exit;
end;
end;
inherited WndProc(Message);
end;
procedure TxButton.WMKillFocus(var Message: TWMSetFocus);
begin
inherited;
Invalidate;
end;
procedure TxButton.WMSetFocus(var Message: TWMSetFocus);
begin
inherited;
Invalidate;
end;
procedure TxButton.SetGradient(const Value: TxGradient);
begin
FGradient.Assign(Value);
end;
procedure TxButton.CMMouseEnter(var Message: TMessage);
begin
inherited;
FOver := True;
Invalidate;
end;
procedure TxButton.CMMouseLeave(var Message: TMessage);
begin
inherited;
FOver := False;
Invalidate;
end;
procedure TxButton.SetHotTrack(const Value: Boolean);
begin
FHotTrack := Value;
Invalidate;
end;
procedure TxButton.SetEnabled(Value: Boolean);
begin
inherited;
Invalidate;
end;
procedure TxButton.SetDisabledColor(const Value: TColor);
begin
FDisabledColor := Value;
Invalidate;
end;
procedure TxButton.SetDisabledShadowColor(const Value: TColor);
begin
FDisabledShadowColor := Value;
Invalidate;
end;
procedure TxButton.SetDrawFocusRect(const Value: Boolean);
begin
FDrawFocusRect := Value;
Invalidate;
end;
procedure TxButton.SetFocusRectColor(const Value: TColor);
begin
FFocusRectColor := Value;
Invalidate;
end;
procedure TxButton.CMTextChanged(var M: TMessage);
begin
inherited;
Invalidate;
end;
procedure TxButton.SetHotTrackShadowColor(const Value: TColor);
begin
FHotTrackShadowColor := Value;
Invalidate;
end;
{ TxButtonActionLink }
procedure TxButtonActionLink.AssignClient(AClient: TObject);
begin
inherited AssignClient(AClient);
FClient := AClient as TxButton;
end;
procedure TxButton.WMChar(var M: TWMChar);
begin
if M.CharCode = 13 then
if Assigned(OnClick) then OnClick(Self);
end;
procedure TxButton.WMKeyDown(var M: TMessage);
var
KS: TKeyboardState;
SS: TShiftState;
Key: Word;
begin
if M.WParam = 13 then begin
FState := xbsDown;
Invalidate;
end;
if Assigned(OnKeyDown) then begin
GetKeyboardState(KS);
Key := M.WParam;
SS := KeyboardStateToShiftState(KS);
OnKeyDown(Self, Key, SS);
end;
end;
procedure TxButton.WMKeyUp(var M: TMessage);
var
KS: TKeyboardState;
SS: TShiftState;
Key: Word;
begin
if M.WParam = 13 then begin
FState := xbsUp;
Invalidate;
end;
if Assigned(OnKeyUp) then begin
Key := M.WParam;
GetKeyboardState(KS);
SS := KeyboardStateToShiftState(KS);
OnKeyUp(Self, Key, SS);
end;
end;
procedure TxButton.SetStyleContainer(const Value: TxStyleContainer);
begin
if Value = FStyleContainer then Exit;
if Value = nil then FStyleContainer.UnregControl(Self)
else Value.RegControl(Self);
if Value <> nil then begin
Self.Gradient.Assign(Value.Gradient);
end;
FStyleContainer := Value;
end;
procedure TxButton.ContainerDeleted;
begin
FStyleContainer := nil;
end;
procedure TxButton.CMDialogKey(var Message: TCMDialogKey);
begin
with Message do
if ((CharCode = VK_RETURN) and FDefault) and
(KeyDataToShiftState(Message.KeyData) = []) and CanFocus then
begin
Click;
Result := 1;
end else
inherited;
end;
procedure TxButton.SetDefault(const Value: Boolean);
begin
FDefault := Value;
Invalidate;
end;
end.
|
unit m4DocumentAddress;
{* Адрес слова и список адресов. }
{ Библиотека "M4" }
{ Автор: Люлин А.В. © }
{ Модуль: m4DocumentAddress - }
{ Начат: 19.04.2002 12:49 }
{ $Id: m4DocumentAddress.pas,v 1.25 2015/09/21 12:31:06 lulin Exp $ }
// $Log: m4DocumentAddress.pas,v $
// Revision 1.25 2015/09/21 12:31:06 lulin
// {RequestLink:600945332}
//
// Revision 1.24 2015/09/21 12:25:13 lulin
// {RequestLink:600945332}
//
// Revision 1.23 2014/02/17 08:31:56 lulin
// - избавляемся от ошибок молодости.
//
// Revision 1.22 2014/02/14 16:59:34 lulin
// - избавляемся от ошибок молодости.
//
// Revision 1.21 2012/11/01 09:43:34 lulin
// - забыл точку с запятой.
//
// Revision 1.20 2012/11/01 07:46:03 lulin
// - делаем возможность логирования процесса загрузки модулей.
//
// Revision 1.19 2012/11/01 07:09:37 lulin
// - вычищаем мусор.
//
// Revision 1.18 2009/07/20 11:22:26 lulin
// - заставляем работать F1 после - {RequestLink:141264340}. №7, 32, 33.
//
// Revision 1.17 2009/03/19 16:28:32 lulin
// [$139443095].
//
// Revision 1.16 2008/03/21 14:09:35 lulin
// - cleanup.
//
// Revision 1.15 2008/02/21 18:37:25 lulin
// - вычищен ненужный параметр.
//
// Revision 1.14 2008/02/21 18:13:31 lulin
// - избавляемся от ненужных типов.
//
// Revision 1.13 2008/02/20 18:25:27 lulin
// - удалён ненужный тип.
//
// Revision 1.12 2008/02/19 14:59:01 lulin
// - переводим сортировку списков на новые, менее виртуальные, рельсы.
//
// Revision 1.11 2008/02/18 16:47:38 lulin
// - подчистил логику списков, связанную с сортированностью и добавлением элемента.
//
// Revision 1.10 2008/02/18 07:32:19 lulin
// - bug fix: не собирался архивариус.
//
// Revision 1.9 2008/02/05 09:58:17 lulin
// - выделяем базовые объекты в отдельные файлы и переносим их на модель.
//
// Revision 1.8 2007/09/05 15:05:16 lulin
// - bug fix: не собирался Архивариус.
//
// Revision 1.7 2007/08/27 16:28:22 lulin
// - убрано использование ненужных модулей.
//
// Revision 1.6 2006/04/25 08:50:10 lulin
// - bug fix: не компилировался Архивариус.
//
// Revision 1.5 2005/03/02 16:51:26 lulin
// - bug fix: не работал контекстный поиск в Архивариусе, т.к. неправильно освобождались объекты Tm4Address.
//
// Revision 1.4 2005/02/03 11:50:10 lulin
// - bug fix: Архивариус не компилировался.
//
// Revision 1.3 2005/01/24 11:43:29 lulin
// - new behavior: при освобождении заглушки очищаем указатель на нее.
//
// Revision 1.2 2004/12/23 08:40:46 lulin
// - вычищен ненужный модуль.
//
// Revision 1.1 2004/09/02 07:15:22 law
// - cleanup.
//
// Revision 1.12 2004/06/02 08:45:51 law
// - удален конструктор Tl3VList.MakePersistentSorted - пользуйтесь _Tl3ObjectRefList.MakeSorted.
//
// Revision 1.11 2004/05/27 14:32:21 law
// - new methods: _Tl3_CBase.IsCacheable, _NeedStoreInPool.
//
// Revision 1.10 2003/02/20 11:51:41 law
// - optimization: оптимизация выделения Tm4Address изменением стратегии кеша и менеджера памяти.
//
// Revision 1.9 2003/02/19 13:08:26 law
// - cleanup.
//
// Revision 1.8 2002/09/10 08:46:58 law
// - new behavior: подсветка всех слов входящих в выражение.
//
// Revision 1.7 2002/09/10 08:26:08 law
// - change: вместо Tm3DocumentAddress используем Im4Address.
//
// Revision 1.6 2002/09/10 07:07:16 law
// - new interface: Im4Address.
//
{$I m4Define.inc}
interface
uses
l3Types,
l3CacheableBase,
l3SimpleMM,
l3ObjectRefList,
l3Base,
m3DocumentAddress
;
type
Tm4Address = class;
Im4Address = interface(IUnknown)
// property methods
function pm_GetAddress: Tm3DocumentAddress;
procedure pm_SetAddress(aValue: Tm3DocumentAddress);
{-}
// public methods
function EQ(anAddress: Tm3DocumentAddress): Bool;
{-}
function CaseCompare(const anAddress: Im4Address): Long;
{-}
function LowCompare(const anAddress: Im4Address): Long;
{-}
function CaseHighCompare(const anAddress: Im4Address): Long;
{-}
function CaseLowCompare(const anAddress: Im4Address): Long;
{-}
procedure LinkAddress(const anAddress: Im4Address);
{-}
function GetLinked: Im4Address;
{-}
// public properties
property Address: Tm3DocumentAddress
read pm_GetAddress
{write pm_SetAddress};
{-}
end;//Im4Address
Tm4Address = class(Tl3Base, Im4Address)
{* Адрес слова. }
private
// internal fields
f_Address : Tm3DocumentAddress;
f_Linked : Im4Address;
protected
// property methods
function pm_GetAddress: Tm3DocumentAddress;
procedure pm_SetAddress(aValue: Tm3DocumentAddress);
{-}
protected
// internal methods
{$If not defined(DesignTimeLibrary)}
class function IsCacheable: Boolean; override;
{* функция класса, определяющая могут ли объекты данного класса попадать в кэш повторного использования. }
{$IfEnd} //not DesignTimeLibrary
procedure Cleanup;
override;
{-}
public
// public methods
constructor Create(const anAddress: Tm3DocumentAddress);
reintroduce;
{* - создает адрес. }
class function Make(const anAddress: Tm3DocumentAddress): Im4Address;
overload;
{-}
class function Make(const anAddress: Im4Address = nil): Im4Address;
overload;
{-}
function OCompare(anObject: Tl3Base): Long;
override;
{-}
function EQ(anAddress: Tm3DocumentAddress): Bool;
{-}
function CaseCompare(const anAddress: Im4Address): Long;
{-}
function LowCompare(const anAddress: Im4Address): Long;
{-}
function CaseHighCompare(const anAddress: Im4Address): Long;
{-}
function CaseLowCompare(const anAddress: Im4Address): Long;
{-}
procedure LinkAddress(const anAddress: Im4Address);
{-}
function GetLinked: Im4Address;
{-}
end;//Tm4Address
Tm4AddressAction = function(const anAddress: Tm3DocumentAddress): Bool;
Tm4Addresses = class(Tl3ObjectRefList)
{* Список адресов. }
protected
// property methods
function pm_GetAddress(anIndex: Long): Tm3DocumentAddress;
procedure pm_SetAddress(anIndex: Long; const aValue: Tm3DocumentAddress);
{-}
public
// public methods
constructor Create;
reintroduce;
{* - создает список адресов. }
function CreateDocumentAddresses(aDocID: Long): Tm4Addresses;
{* - создает список адресов для данного документа. }
procedure Add(const anAddress: Tm3DocumentAddress);
reintroduce;
overload;
{* - добавляет адрес в список. }
procedure Add(const anAddress: Im4Address);
overload;
{* - добавляет адрес в список. }
procedure IterateDocumentAddresses(aDocID: Long; anAction: Tm4AddressAction);
{* - перебирает все адреса. }
procedure IterateDocumentAddressesF(aDocID: Long; anAction: Tm4AddressAction);
{* - перебирает все адреса и освобождает заглушку. }
public
// public properties
property Address[anIndex: Long]: Tm3DocumentAddress
read pm_GetAddress
write pm_SetAddress;
default;
{* - адреса. }
end;//Tm4Addresses
Pm4Addresses = ^Tm4Addresses;
function m4L2AA(Action: Pointer): Tm4AddressAction;
{* - делает заглушку для локальной процедуры. }
procedure m4FreeAA(var Stub: Tm4AddressAction);
{* - освобождает заглушку для локальной процедуры. }
var
m4NullDocumentAddress : Im4Address = nil;
implementation
// start class Tm4Address
{$If not defined(DesignTimeLibrary)}
class function Tm4Address.IsCacheable: Boolean; //override;
{* функция класса, определяющая могут ли объекты данного класса попадать в кэш повторного использования. }
begin
Result := true;
end;
{$IfEnd} //not DesignTimeLibrary
constructor Tm4Address.Create(const anAddress: Tm3DocumentAddress);
//reintroduce;
{-}
begin
inherited Create;
f_Address := anAddress;
end;
class function Tm4Address.Make(const anAddress: Tm3DocumentAddress): Im4Address;
//overload;
{-}
var
l_Address : Tm4Address;
begin
l_Address := Tm4Address.Create(anAddress);
try
Result := l_Address;
finally
l3Free(l_Address);
end;//try..finally
end;
class function Tm4Address.Make(const anAddress: Im4Address = nil): Im4Address;
//overload;
{-}
begin
if (anAddress = nil) then
Result := Make(m3NullDocumentAddress)
else
Result := Make(anAddress.Address);
end;
procedure Tm4Address.Cleanup;
//override;
{-}
begin
inherited;
f_Linked := nil;
end;
function Tm4Address.pm_GetAddress: Tm3DocumentAddress;
{-}
begin
Result := f_Address;
end;
procedure Tm4Address.pm_SetAddress(aValue: Tm3DocumentAddress);
{-}
begin
f_Address := aValue;
end;
function Tm4Address.OCompare(anObject: Tl3Base): Long;
//override;
{-}
begin
if (anObject Is Tm4Address) then
Result := f_Address.Compare(Tm4Address(anObject).f_Address)
else
Result := inherited OCompare(anObject);
end;
function Tm4Address.EQ(anAddress: Tm3DocumentAddress): Bool;
{-}
begin
Result := f_Address.EQ(anAddress);
end;
function Tm4Address.CaseCompare(const anAddress: Im4Address): Long;
{-}
begin
if (anAddress = nil) then
Result := 1
else
Result := f_Address.CaseCompare(anAddress.Address);
end;
function Tm4Address.LowCompare(const anAddress: Im4Address): Long;
{-}
begin
if (anAddress = nil) then
Result := 1
else
Result := f_Address.LowCompare(anAddress.Address);
end;
function Tm4Address.CaseHighCompare(const anAddress: Im4Address): Long;
{-}
begin
if (anAddress = nil) then
Result := 1
else
Result := f_Address.CaseHighCompare(anAddress.Address);
end;
function Tm4Address.CaseLowCompare(const anAddress: Im4Address): Long;
{-}
begin
if (anAddress = nil) then
Result := 1
else
Result := f_Address.CaseLowCompare(anAddress.Address);
end;
procedure Tm4Address.LinkAddress(const anAddress: Im4Address);
{-}
var
l_Linked : Im4Address;
l_Next : Im4Address;
begin
if (anAddress <> nil) then
begin
if (Im4Address(Self) = anAddress) then
// - http://mdp.garant.ru/pages/viewpage.action?pageId=600945332
Exit;
Assert(Im4Address(Self) <> anAddress);
if (f_Linked = nil) then
f_Linked := anAddress
else
begin
l_Linked := Self;
while true do
begin
l_Next := l_Linked.GetLinked;
if (l_Next = nil) then
break
else
l_Linked := l_Next;
end;//while true
l_Linked.LinkAddress(anAddress);
end;//f_Linked = nil
end;//anAddress <> nil
end;
function Tm4Address.GetLinked: Im4Address;
{-}
begin
Result := f_Linked;
end;
// start class Tm4Addresses
constructor Tm4Addresses.Create;
//reintroduce;
{-}
begin
MakeSorted;
end;
function Tm4Addresses.CreateDocumentAddresses(aDocID: Long): Tm4Addresses;
{-}
var
l_DocumentAddresses : Tm4Addresses absolute Result;
function DoAddress(const anAddress: Tm3DocumentAddress): Bool;
begin
Result := true;
l_DocumentAddresses.Add(anAddress);
end;
begin
if (Self = nil) then
Result := nil
else begin
Result := Tm4Addresses.Create;
try
IterateDocumentAddressesF(aDocID, m4L2AA(@DoAddress))
except
l3Free(Result);
raise;
end;//try..except
end;//Self = nil
end;
procedure Tm4Addresses.Add(const anAddress: Tm3DocumentAddress);
//reintroduce;
{-}
var
l_Address : Tm4Address;
begin
l_Address := Tm4Address.Create(anAddress);
try
inherited Add(l_Address);
finally
l3Free(l_Address);
end;//try..finally
end;
procedure Tm4Addresses.Add(const anAddress: Im4Address);
//overload;
{* - добавляет адрес в список. }
var
l_Linked : Im4Address;
begin
l_Linked := anAddress;
while (l_Linked <> nil) do begin
Add(l_Linked.Address);
l_Linked := l_Linked.GetLinked;
end;//while (l_Linked <> nil)
end;
procedure Tm4Addresses.IterateDocumentAddresses(aDocID: Long; anAction: Tm4AddressAction);
{-}
function DoAddress(anAddress: PObject; anIndex: Long): Bool;
begin//DoAddress
with Tm4Address(anAddress^) do
if (aDocID = f_Address.rDocument) then
Result := anAction(f_Address)
else
Result := true;
end;//DoAddress
begin
IterateAllF(l3L2IA(@DoAddress));
end;
procedure Tm4Addresses.IterateDocumentAddressesF(aDocID: Long; anAction: Tm4AddressAction);
{-}
begin
try
IterateDocumentAddresses(aDocId, anAction);
finally
m4FreeAA(anAction);
end;//try..finally
end;
function Tm4Addresses.pm_GetAddress(anIndex: Long): Tm3DocumentAddress;
{-}
begin
Result := Tm4Address(inherited Items[anIndex]).f_Address;
end;
procedure Tm4Addresses.pm_SetAddress(anIndex: Long; const aValue: Tm3DocumentAddress);
{-}
begin
Tm4Address(inherited Items[anIndex]).f_Address := aValue
end;
function m4L2AA(Action: Pointer): Tm4AddressAction;
{* - делает заглушку для локальной процедуры. }
asm
jmp l3LocalStub
end;{asm}
procedure m4FreeAA(var Stub: Tm4AddressAction);
{* - освобождает заглушку для локальной процедуры. }
asm
jmp l3FreeLocalStub
end;{asm}
initialization
{!touched!}{$IfDef LogInit} WriteLn('W:\common\components\rtl\Garant\m4\m4DocumentAddress.pas initialization enter'); {$EndIf}
m4NullDocumentAddress := Tm4Address.Make;
{!touched!}{$IfDef LogInit} WriteLn('W:\common\components\rtl\Garant\m4\m4DocumentAddress.pas initialization leave'); {$EndIf}
finalization
m4NullDocumentAddress := nil;
end.
|
unit Classes;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.Controls.Presentation, FMX.StdCtrls, FMX.ScrollBox, FMX.Memo;
type
TConfig = record
Host : String;
Path : String;
Usuario : String;
Senha : String;
end;
TCaneca = class
end;
TGarrafa = class
Cor: String;
Modelo: String;
Tampa: String;
Caneca: TCaneca;
constructor Create;
destructor Destroy; override;
procedure ArmazenaLiquido(Liquido: String);
end;
TRoda = class
Tamanho: Integer;
Material: String;
end;
TMotor = class
Potencia : Integer;
Combustivel : String;
end;
TCarro = class
Cor: String;
Marca: String;
Modelo : String;
Roda : TRoda;
Motor : TMotor;
constructor Create;
destructor Destroy; override;
end;
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
//procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure ExibeMemo(Config: TConfig);
{ Private declarations }
public
{ Public declarations }
end;
TLivro = class
public
Titulo: String;
Autor: String;
function Paginacao(Pagina: Integer): String;
end;
TAutor = class
public
Livro: Classes.TLivro;
end;
TGibi = class(TLivro)
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
function TLivro.Paginacao(Pagina: Integer): String;
begin
end;
procedure TGarrafa.ArmazenaLiquido(Liquido: string);
begin
//teste;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MinhaGarrafa: TGarrafa;
begin
MinhaGarrafa := nil;
if Assigned(MinhaGarrafa) then
ShowMessage('Estou estanciado')
else
MinhaGarrafa := TGarrafa.Create;
ShowMessage('Não Estou estanciado');
try
MinhaGarrafa.Modelo := 'Vidro';
MinhaGarrafa.Cor := 'Vermelha';
finally
// MinhaGarrafa.Free;
FreeAndNil(MinhaGarrafa);// Atribuindo valor nulo a memoria
end;
end;
// Exemplo de Record
procedure TForm1.Button2Click(Sender: TObject);
var
Config : TConfig;
begin
Config.Host := 'localhost';
Config.Path := '3306';
Config.Usuario := 'root';
Config.Senha := 'drogaria';
ExibeMemo(Config);
end;
procedure TForm1.ExibeMemo(Config: TConfig);
begin
Memo1.Lines.Add(Config.Host);
Memo1.Lines.Add(Config.Path);
Memo1.Lines.Add(Config.Usuario);
Memo1.Lines.Add(Config.Senha);
end;
constructor TCarro.Create;
begin
Roda := TRoda.Create;
Motor := TMotor.Create;
end;
destructor TCarro.Destroy;
begin
Motor.Free;
Roda.Free;
inherited;
end;
end.
|
unit DecoderPacketForma;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, FIBDataSet, pFIBDataSet, StdCtrls, DBCtrls, Mask,
DBCtrlsEh, DBLookupEh, Buttons, ExtCtrls, DBGridEh;
type
TDecoderPacketForm = class(TForm)
cbbPaket: TDBLookupComboboxEh;
dbmmoNotice: TDBMemoEh;
lbl1: TLabel;
lbl2: TLabel;
srcDecPacket: TDataSource;
srcPacket: TDataSource;
dsPacket: TpFIBDataSet;
dsDecPacket: TpFIBDataSet;
btnCancel: TBitBtn;
btnOk: TBitBtn;
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure btnOkClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function AddPaket(const DECODER: string): boolean;
implementation
uses
DM;
{$R *.dfm}
function AddPaket(const DECODER: string): boolean;
var
df: TDecoderPacketForm;
begin
Result := False;
df := TDecoderPacketForm.Create(application);
try
df.dsPacket.ParamByName('decoder_n').AsString := DECODER;
df.dsPacket.Open;
df.dsDecPacket.ParamByName('decoder_n').AsString := DECODER;
df.dsDecPacket.Open;
df.dsDecPacket.Insert;
if df.ShowModal = mrOk then
begin
df.dsDecPacket['DECODER_N'] := DECODER;
df.dsDecPacket.Post;
Result := true;
end
else
df.dsDecPacket.Cancel;
df.dsPacket.Close;
df.dsDecPacket.Close;
finally
df.Free;
end;
end;
procedure TDecoderPacketForm.btnOkClick(Sender: TObject);
begin
if (not VarIsClear(cbbPaket.KeyValue)) and (cbbPaket.Text <> '') then
ModalResult := mrOk
else
ModalResult := mrCancel;
end;
procedure TDecoderPacketForm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (Shift = [ssCtrl]) and (Ord(Key) = VK_RETURN) then
btnOkClick(Sender);
end;
end.
|
unit Uweatherdemo;
interface
uses
FMX.Forms, FMX.TMSCloudWeather, FMX.Objects, FMX.TMSCloudImage,
FMX.ListBox, FMX.StdCtrls, FMX.Layouts, FMX.Edit, FMX.Controls,
System.Classes, FMX.Types, FMX.TMSCloudBase, FMX.Dialogs, SysUtils;
type
TForm1 = class(TForm)
TMSFMXCloudWeather1: TTMSFMXCloudWeather;
TMSFMXCloudWeatherLocationLookupProvider1: TTMSFMXCloudWeatherLocationLookupProvider;
GroupBox1: TGroupBox;
Edit1: TEdit;
SpeedButton1: TSpeedButton;
ListBox1: TListBox;
GroupBox2: TGroupBox;
TMSFMXCloudCloudImage1: TTMSFMXCloudImage;
TMSFMXCloudCloudImage2: TTMSFMXCloudImage;
TMSFMXCloudCloudImage3: TTMSFMXCloudImage;
TMSFMXCloudCloudImage4: TTMSFMXCloudImage;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Fore1: TLabel;
Fore2: TLabel;
Fore3: TLabel;
Fore4: TLabel;
Image1: TImage;
Label3: TLabel;
ComboBox1: TComboBox;
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure ComboBox1Select(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.FMX}
// PLEASE USE A VALID INCLUDE FILE THAT CONTAINS THE APPLICATION KEY & SECRET
// FOR THE CLOUD STORAGE SERVICES YOU WANT TO USE
// STRUCTURE OF THIS .INC FILE SHOULD BE
//
// const
// Appkey = 'xxxxxxxxx';
//
{$I APPIDS.INC}
procedure TForm1.Button2Click(Sender: TObject);
var
s, country, city: string;
vp: integer;
function ItemToString(fi: TWeatherForeCastItem): string;
begin
Result := DateToStr(fi.Date);
Result := Result + #13 + fi.Conditions;
Result := Result + #13 + 'Temp: ' + FloatTostr(fi.TempLowC)+'°C to '+FloatToStr(fi.TempHighC)+'°C';
Result := Result + #13 + 'Wind: ' + FloatTostr(fi.MaxWindKmh)+ 'Kmh ' + fi.MaxWindDir;
Result := Result + #13 + 'Humdity: ' + IntToStr(fi.AveHumidity) + '%';
end;
begin
if TMSFMXCloudWeather1.App.Key = '' then
begin
ShowMessage('Please request a Wundergroup key and set this to TMSFMXCloudWeather.App.Key');
Exit;
end;
Fore1.Text := '';
Fore2.Text := '';
Fore3.Text := '';
Fore4.Text := '';
TMSFMXCloudCloudImage1.URL := '';
TMSFMXCloudCloudImage2.URL := '';
TMSFMXCloudCloudImage3.URL := '';
TMSFMXCloudCloudImage4.URL := '';
if Label1.Text = '' then
begin
ShowMessage('No location specified.');
Exit;
end;
s := Label1.Text;
vp := pos(',',s);
if vp > 0 then
begin
city := copy(s,1,vp - 1);
country := copy(s,vp + 1,length(s));
end
else
begin
country := '';
city := Label1.Text;
end;
TMSFMXCloudWeather1.GetForecast(country, city);
if TMSFMXCloudWeather1.ForeCast.Count = 4 then
begin
TMSFMXCloudCloudImage1.URL := TMSFMXCloudWeather1.ForeCast.Items[0].IconURL;
TMSFMXCloudCloudImage2.URL := TMSFMXCloudWeather1.ForeCast.Items[1].IconURL;
TMSFMXCloudCloudImage3.URL := TMSFMXCloudWeather1.ForeCast.Items[2].IconURL;
TMSFMXCloudCloudImage4.URL := TMSFMXCloudWeather1.ForeCast.Items[3].IconURL;
Fore1.Text := ItemToString(TMSFMXCloudWeather1.ForeCast.Items[0]);
Fore2.Text := ItemToString(TMSFMXCloudWeather1.ForeCast.Items[1]);
Fore3.Text := ItemToString(TMSFMXCloudWeather1.ForeCast.Items[2]);
Fore4.Text := ItemToString(TMSFMXCloudWeather1.ForeCast.Items[3]);
end
else
ShowMessage('Weather forecast could not be retrieved');
end;
procedure TForm1.ComboBox1Select(Sender: TObject);
begin
case ComboBox1.ItemIndex of
0: TMSFMXCloudWeather1.Language := wlEnglish;
1: TMSFMXCloudWeather1.Language := wlSpanish;
2: TMSFMXCloudWeather1.Language := wlPortuguese;
3: TMSFMXCloudWeather1.Language := wlFrench;
4: TMSFMXCloudWeather1.Language := wlGerman;
5: TMSFMXCloudWeather1.Language := wlDutch;
6: TMSFMXCloudWeather1.Language := wlItalian;
7: TMSFMXCloudWeather1.Language := wlPolish;
end;
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
label1.Text := Edit1.Text;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TMSFMXCloudWeather1.App.Key := AppKey;
end;
procedure TForm1.ListBox1Click(Sender: TObject);
begin
if ListBox1.ItemIndex >= 0 then
Label1.Text := ListBox1.Items[ListBox1.ItemIndex];
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if Edit1.Text <> '' then
begin
ListBox1.Items.Clear;
TMSFMXCloudWeatherLocationLookupProvider1.Lookup(Edit1.Text, ListBox1.Items);
end;
end;
end.
|
unit command_list_lib;
interface
uses classes,abstract_command_lib;
type
TCommandList=class(TAbstractCommandContainer) //список для undo/redo и даже для сохранения данных в файл
private
fRoot: TComponent;
fcount: Integer;
fcurrent: Integer; //наше данное положение - куда добавлять команду. Т.е по умолчанию - 0
procedure ReadCount(reader: TReader); //основательная инкапсуляция- держим сведения
procedure WriteCount(writer: TWriter); //недоступными для изм. из программы,
procedure ReadCurrent(reader: TReader); //но из файла считать можем
procedure WriteCurrent(writer: TWriter);
protected
procedure DefineProperties(filer: TFiler); override;
public
constructor Create(Aowner: TComponent); override;
procedure Add(command: TAbstractCommand); override;
procedure Undo; override;
procedure Redo; override;
function UndoEnabled: Boolean; override;
function RedoEnabled: Boolean; override;
destructor Destroy; override;
procedure Clear; override;
property count: Integer read fcount;
property current: Integer read fcurrent;
end;
implementation
(*
TCommandList
*)
constructor TCommandList.Create(AOwner: TComponent);
var tmp: TComponent;
begin
inherited Create(AOwner);
FRoot:=FindOwner;
end;
procedure TCommandList.Add(command: TAbstractCommand);
var i:Integer;
begin
for i:=fcount-1 downto fcurrent do components[i].Free;
insertComponent(command);
inc(fcurrent);
fcount:=fcurrent;
end;
procedure TCommandList.Undo;
var res: Boolean;
begin
if UndoEnabled then begin
dec(fcurrent);
res:=(components[fcurrent] as TAbstractCommand).Undo;
Assert(res,'undo command failed');
end;
end;
procedure TCommandList.Redo;
var res: Boolean;
begin
if RedoEnabled then begin
res:=(components[fcurrent] as TAbstractCommand).Execute;
Assert(res,'redo command failed');
inc(fcurrent);
end;
end;
function TCommandList.UndoEnabled: boolean;
begin
Result:=(fcurrent>0);
end;
function TCommandList.RedoEnabled: boolean;
begin
Result:=(fcurrent<fcount);
end;
destructor TCommandList.Destroy;
begin
Clear;
inherited Destroy;
end;
procedure TCommandList.Clear;
begin
self.DestroyComponents;
fcurrent:=0;
fcount:=0;
end;
procedure TCommandList.DefineProperties(filer: TFiler);
begin
inherited;
Filer.DefineProperty('count',ReadCount,WriteCount,(fcount>0));
Filer.DefineProperty('current',ReadCurrent,WriteCurrent,(fcurrent>0));
end;
procedure TCommandList.ReadCount(reader: TReader);
begin
fcount:=reader.ReadInteger;
end;
procedure TCommandList.WriteCount(writer: TWriter);
begin
writer.writeInteger(fcount);
end;
procedure TCommandList.ReadCurrent(reader: TReader);
begin
fcurrent:=reader.ReadInteger;
end;
procedure TCommandList.WriteCurrent(writer: TWriter);
begin
writer.writeInteger(fcurrent);
end;
initialization
RegisterClasses([TCommandList]);
end.
|
unit FmtUtils;
{
Copyright (c) 2008, Shinya Okano<xxshss@yahoo.co.jp>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the authors nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
license: New BSD License
web: http://www.bitbucket.org/tokibito/lib_delphi/overview/
}
interface
uses
SysUtils;
const
UNIT_BYTES = 1024;
MAX_UNITS = 6;
UNITS_STRING: array[0..MAX_UNITS] of string = ('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB');
DEFAULT_BYTES_FORMAT = '%f %s';
function Int64Power(Base: UInt64; Exponent: Integer): UInt64;
function DetectUnit(Value: UInt64): Integer;
function DetectUnitStr(Value: UInt64): string;
function DetectUnitValue(Value: UInt64): Extended;
function FormatByte(Value: UInt64; Fmt: string = '%f %s'): string;
function CalcBytes(Value: UInt64; UnitValue: Integer): UInt64;
implementation
function Int64Power(Base: UInt64; Exponent: Integer): UInt64;
var
i: Integer;
begin
Result := 1;
for i := 0 to Exponent - 1 do
Result := Result * Base;
end;
function DetectUnit(Value: UInt64): Integer;
begin
for Result := 0 to MAX_UNITS do
begin
if Value < UNIT_BYTES then Break;
Value := Value div UNIT_BYTES;
end;
end;
function DetectUnitStr(Value: UInt64): string;
begin
Result := UNITS_STRING[DetectUnit(Value)];
end;
function DetectUnitValue(Value: UInt64): Extended;
begin
Result := Value / Int64Power(UNIT_BYTES, DetectUnit(Value));
end;
function FormatByte(Value: UInt64; Fmt: string = DEFAULT_BYTES_FORMAT): string;
begin
Result := Format(Fmt, [DetectUnitValue(Value), DetectUnitStr(Value)]);
end;
function CalcBytes(Value: UInt64; UnitValue: Integer): UInt64;
begin
Result := Value * Int64Power(UNIT_BYTES, UnitValue);
end;
end.
|
// defines TPascalToken and descendants which are the intermediate format after parsing
// Original Author: Egbert van Nes (http://www.dow.wau.nl/aew/People/Egbert_van_Nes.html)
// Contributors: Thomas Mueller (http://www.dummzeuch.de)
// Jens Borrisholt (Jens@borrisholt.dk) - Cleaning up the code, and making it aware of several language features
unit GX_CodeFormatterTokens;
{$I GX_CondDefine.inc}
interface
uses
SysUtils,
StrUtils,
TypInfo,
GX_GenericUtils,
GX_CodeFormatterTypes;
type
{: TPascalToken is never instantiated }
TPascalToken = class
public
function GetWordType: TWordType; virtual; abstract;
procedure GetLength(var _Length: Integer); virtual; abstract;
function Space(_Space: TSpace): Boolean; virtual;
function GetReservedType: TReservedType; virtual; abstract;
procedure SetReservedType(_rType: TReservedType); virtual;
procedure SetSpace(_Space: TSpaceSet; _State: Boolean); virtual;
{: @returns the object's content }
function GetContent: TGXUnicodeString; virtual; abstract;
(*: changes " // <comment>" to "{//<comment>}" used for preventing a
begin
moved from the next line to become commented out
@param ACommChar is one of '{', '(' or '/' specifying the new comment type
@returs True if token is a comment, False otherwise *)
function ChangeComment(_CommChar: char): Boolean;
function GetExpression(out _Expression: TGXUnicodeString): Boolean; virtual;
procedure SetExpression(const _Expression: TGXUnicodeString); virtual;
procedure SetExpressionCase(_Case: TCase); virtual;
function GetExpressionCase: TCase; virtual;
procedure SetOptions(_Options: TTokenOptions); virtual;
function GetOptions: TTokenOptions; virtual;
procedure AddOption(_Option: TTokenOption);
function HasOption(_Option: TTokenOption): Boolean;
function GetForDebug: TGXUnicodeString; virtual;
property ExpressionCase: TCase read GetExpressionCase write SetExpressionCase;
property ReservedType: TReservedType read GetReservedType write SetReservedType;
property WordType: TWordType read GetWordType;
property Content: TGXUnicodeString read GetContent;
property Options: TTokenOptions read GetOptions write SetOptions;
end;
TLineFeed = class(TPascalToken)
private
FSpacePerIndent: Integer;
FNoOfSpaces: Integer;
FOldNoOfSpaces: Integer;
FWrapped: Boolean;
public
constructor Create(_OldnSpaces: Integer; _SpacePerIndent: Integer);
function GetWordType: TWordType; override;
procedure SetIndent(_Value: Integer);
procedure IncIndent(_Value: Integer);
procedure GetLength(var _Length: Integer); override;
function GetReservedType: TReservedType; override;
function GetForDebug: TGXUnicodeString; override;
{: @returns a TGXUnicodeString with FNoOfSpaces spaces }
function GetContent: TGXUnicodeString; override;
property NoOfSpaces: Integer read FNoOfSpaces write FNoOfSpaces;
property OldNoOfSpaces: Integer read FOldNoOfSpaces write FOldNoOfSpaces;
property Wrapped: Boolean read FWrapped write FWrapped;
end;
TExpression = class(TPascalToken)
private
FExpression: TGXUnicodeString;
FWordType: TWordType;
FSpaceType: TSpaceSet;
FCaseType: TCase;
FReservedType: TReservedType;
FOptions: TTokenOptions;
public
constructor Create(_Type: TWordType; const _Expression: TGXUnicodeString);
procedure CheckReserved;
procedure SetSpace(_Space: TSpaceSet; _State: Boolean); override;
procedure SetReservedType(_ReservedType: TReservedType); override;
function Space(_Space: TSpace): Boolean; override;
{: @returns <spaces><the expression><spaces> }
function GetContent: TGXUnicodeString; override;
procedure GetLength(var _Length: Integer); override;
function GetWordType: TWordType; override;
function GetReservedType: TReservedType; override;
function GetExpression(out _Expression: TGXUnicodeString): Boolean; override;
procedure SetExpression(const _Value: TGXUnicodeString); override;
procedure SetExpressionCase(_Value: TCase); override;
function GetExpressionCase: TCase; override;
procedure SetOptions(_Value: TTokenOptions); override;
function GetOptions: TTokenOptions; override;
function GetForDebug: TGXUnicodeString; override;
end;
TAlignExpression = class(TExpression)
private
FAlignPos: Byte;
FNoOfSpaces: Byte;
public
constructor Create(_Like: TExpression; _AlignPos: Byte);
// Note: As a side effect, this adjusts FNoOfspaces
procedure GetLength(var _Length: Integer); override;
{: @returns <spaces><the expression><spaces> }
function GetContent: TGXUnicodeString; override;
property NoOfSpaces: byte read FNoOfSpaces write FNoOfSpaces;
end;
implementation
{ TPascalToken }
function TPascalToken.GetExpression(out _Expression: TGXUnicodeString): Boolean;
begin
Result := False;
end;
function TPascalToken.GetForDebug: TGXUnicodeString;
begin
Result := ClassName;
end;
function TPascalToken.GetOptions: TTokenOptions;
begin
Result := [];
end;
function TPascalToken.HasOption(_Option: TTokenOption): Boolean;
begin
Result := _Option in Options;
end;
function TPascalToken.Space(_Space: TSpace): Boolean;
begin
Result := False;
end;
procedure TPascalToken.SetExpression(const _Expression: TGXUnicodeString);
begin
end;
procedure TPascalToken.SetOptions(_Options: TTokenOptions);
begin
end;
procedure TPascalToken.SetExpressionCase(_Case: TCase);
begin
end;
function TPascalToken.GetExpressionCase: TCase;
begin
Result := rfUnchanged;
end;
procedure TPascalToken.SetReservedType(_rType: TReservedType);
begin
end;
procedure TPascalToken.AddOption(_Option: TTokenOption);
begin
Options := Options + [_Option];
end;
function TPascalToken.ChangeComment(_CommChar: char): Boolean;
var
s: TGXUnicodeString;
begin
Result := (Reservedtype = rtComment);
if not Result then
Exit;
GetExpression(s);
if Pos(_CommChar, s) <> 0 then
Exit;
case _CommChar of
'{':
if Pos('}', s) = 0 then
s := '{' + s + '}';
'(':
if Pos('*)', s) = 0 then
s := '(*' + s + '*)';
'/':
if Pos('//', s) <> 1 then
s := '//' + s;
end; // case
SetExpression(s);
end;
procedure TPascalToken.SetSpace(_Space: TSpaceSet; _State: Boolean);
begin
// do nothing
end;
{ TExpression }
constructor TExpression.Create(_Type: TWordType; const _Expression: TGXUnicodeString);
begin
inherited Create;
FWordType := _Type;
FSpaceType := [];
FCaseType := rfUnchanged;
FReservedType := rtNothing;
FExpression := _Expression;
CheckReserved;
end;
procedure TExpression.CheckReserved;
var
Expr: TGXUnicodeString;
Directive: TGXUnicodeString;
ResvdType: TReservedType;
begin
SetReservedType(rtNothing);
case WordType of
wtCompDirective: begin
GetExpression(Expr);
if Copy(Expr, 1, 1) = '{' then
Directive := Copy(Expr, 3, 999999)
else if Copy(Expr, 1, 2) = '(*' then
Directive := Copy(Expr, 4, 999999);
Directive := LowerCase(Directive);
if AnsiStartsStr('endif', Directive) then
SetReservedType(rtCompEndif)
else if AnsiStartsStr('else', Directive) then
SetReservedType(rtCompElse)
else if AnsiStartsStr('ifdef', Directive) then
SetReservedType(rtCompIf)
else if AnsiStartsStr('ifopt', Directive) then
SetReservedType(rtCompIf)
else if AnsiStartsStr('if ', Directive) then
SetReservedType(rtCompIf)
else if AnsiStartsStr('ifndef', Directive) then
SetReservedType(rtCompIf);
end;
wtFullComment, wtFullOutComment, wtHalfStarComment,
wtHalfOutComment, wtHalfComment:
SetReservedType(rtComment);
wtWord: begin
GetExpression(Expr);
Expr := LowerCase(Expr);
if ReservedWordList.FindWord(Expr, ResvdType) then begin
SetReservedType(ResvdType);
Exit;
end;
end;
wtOperator: begin
if GetExpression(Expr) then begin
if Length(Expr) = 1 then begin
case Expr[1] of
':':
SetReservedType(rtColon);
'.':
SetReservedType(rtDot);
';':
SetReservedType(rtSemiColon);
',':
SetReservedType(rtComma);
')':
SetReservedType(rtRightBr);
'(':
SetReservedType(rtLeftBr);
']':
SetReservedType(rtRightHook);
'[':
SetReservedType(rtLeftHook);
'-':
SetReservedType(rtMinus);
'+':
SetReservedType(rtPlus);
'=':
SetReservedType(rtEquals);
'/', '*':
SetReservedType(rtMathOper);
'<', '>':
SetReservedType(rtLogOper);
end;
end else if Length(Expr) = 2 then begin
if Expr = '.)' then
SetReservedType(rtRightHook)
else if Expr = '(.' then
SetReservedType(rtLeftHook)
else if Expr = '..' then
SetReservedType(rtDotDot)
else if Expr = ':=' then
SetReservedType(rtAssignOper)
else if (Expr[1] = '<') or (Expr[1] = '>') then
{ if p in > < <> >= <= = }
SetReservedType(rtLogOper);
end;
end;
end;
end;
end;
procedure TExpression.SetExpression(const _Value: TGXUnicodeString);
begin
FExpression := _Value
end;
procedure TExpression.SetOptions(_Value: TTokenOptions);
begin
FOptions := _Value;
end;
function TExpression.GetWordType: TWordType;
begin
Result := FWordType;
end;
function TExpression.GetExpression(out _Expression: TGXUnicodeString): Boolean;
begin
_Expression := FExpression;
Result := True;
end;
function TExpression.GetForDebug: TGXUnicodeString;
function SpaceTypeToStr(_SpaceType: TSpaceSet): TGXUnicodeString;
begin
if (spBefore in _SpaceType) then
Result := 'spBefore'
else
Result := '';
if spAfter in _SpaceType then begin
if Result <> '' then
Result := Result + ',';
Result := Result + 'spAfter';
end;
end;
var
s: TGXUnicodeString;
begin
s := 'Expression: ''' + FExpression + '''';
s := s + ', WordType: ' + GetEnumName(TypeInfo(TWordType), Integer(FWordType));
s := s + ', SpaceType: [' + SpaceTypeToStr(FSpaceType) + ']';
s := s + ', CaseType: ' + GetEnumName(TypeInfo(TCase), Integer(FCaseType));
s := s + ', ReservedType: ' + GetEnumName(TypeInfo(TReservedType), Integer(FReservedType));
s := s + ', Options: [' + IfThen(FOptions = [], '', 'toFeedNewLine') + ']';
Result := inherited GetForDebug + '(' + s + ')';
end;
function TExpression.Space(_Space: TSpace): Boolean;
begin
Result := (_Space in FSpaceType);
end;
function TExpression.GetReservedType: TReservedType;
begin
Result := FReservedType;
end;
procedure TExpression.SetSpace(_Space: TSpaceSet; _State: Boolean);
begin
if _State then
FSpaceType := FSpaceType + _Space
else
FSpaceType := FSpaceType - _Space
end;
procedure TExpression.SetExpressionCase(_Value: TCase);
begin
FCaseType := _Value;
end;
function TExpression.GetExpressionCase: TCase;
begin
Result := FCaseType;
end;
procedure TExpression.SetReservedType(_ReservedType: TReservedType);
begin
FReservedType := _ReservedType;
end;
function TExpression.GetContent: TGXUnicodeString;
begin
if Space(spBefore) then
Result := GX_CodeFormatterTypes.Space
else
Result := '';
Result := Result + FExpression;
Result := AdjustCase(Result, ExpressionCase);
if Space(spAfter) then
Result := Result + GX_CodeFormatterTypes.Space;
end;
procedure TExpression.GetLength(var _Length: Integer);
begin
_Length := _Length + Length(FExpression);
if Space(spBefore) then
inc(_Length);
if Space(spAfter) then
inc(_Length);
end;
function TExpression.GetOptions: TTokenOptions;
begin
Result := FOptions;
end;
{ TLineFeed }
function TLineFeed.GetContent: TGXUnicodeString;
var
Len: Integer;
begin
if FWrapped then
Len := FNoOfSpaces + FSpacePerIndent
else
Len := FNoOfSpaces;
if (Len > 0) then
Result := StringOfChar(GX_CodeFormatterTypes.Space, Len)
else
Result := '';
end;
function TLineFeed.GetForDebug: TGXUnicodeString;
var
s: TGXUnicodeString;
begin
s := 'SpacePerIndent: ' + IntTostr(FSpacePerIndent);
s := s + ', NoOfSpaces: ' + IntToStr(FNoOfSpaces);
s := s + ', OldNoOfSpaces: ' + IntToStr(FOldNoOfSpaces);
s := s + ', Wrapped: ' + IfThen(FWrapped, 'true', 'false');
Result := inherited GetForDebug + '(' + s + ')';
end;
procedure TLineFeed.GetLength(var _Length: Integer);
begin
if FNoOfSpaces > 0 then
_Length := FNoOfSpaces
else
_Length := 0;
end;
function TLineFeed.GetWordType: TWordType;
begin
Result := wtLineFeed;
end;
function TLineFeed.GetReservedType: TReservedType;
begin
Result := rtLineFeed;
end;
constructor TLineFeed.Create(_OldnSpaces: Integer; _SpacePerIndent: Integer);
begin
inherited Create;
FOldNoOfSpaces := _OldnSpaces;
FSpacePerIndent := _SpacePerIndent;
FWrapped := False;
FNoOfSpaces := _OldnSpaces; { default not changed indent }
end;
procedure TLineFeed.IncIndent(_Value: Integer);
begin
inc(FNoOfSpaces, _Value * FSpacePerIndent);
end;
procedure TLineFeed.SetIndent(_Value: Integer);
begin
FNoOfSpaces := _Value * FSpacePerIndent;
end;
{ TAlignExpression }
constructor TAlignExpression.Create(_Like: TExpression; _AlignPos: Byte);
var
s: TGXUnicodeString;
begin
_Like.GetExpression(s);
inherited Create(_Like.FWordType, s);
FAlignPos := _AlignPos;
FNoOfSpaces := 0;
FSpaceType := _Like.FSpaceType;
FCaseType := _Like.FCaseType;
FReservedType := _Like.FReservedType;
end;
procedure TAlignExpression.GetLength(var _Length: Integer);
begin
if _Length < FAlignPos then begin
FNoOfSpaces := FAlignPos - _Length;
_Length := FAlignPos;
SetSpace([spBefore], False);
end else
FNoOfSpaces := 0;
inherited GetLength(_Length);
end;
function TAlignExpression.GetContent: TGXUnicodeString;
begin
if (FNoOfSpaces > 0) then
Result := StringOfChar(GX_CodeFormatterTypes.Space, FNoOfSpaces)
else
Result := '';
Result := Result + inherited GetContent;
end;
end.
|
{
Exercicio 33: Dados três valores X, Y, Z, verificar se eles podem ser os comprimentos dos lados de um triângulo.
Se forem, verificar e exibir se é um triângulo eqüilátero, isósceles ou escaleno. Se eles não formarem um triângulo,
escrever uma mensagem. Antes da elaboração do algoritmo, torna-se necessária a revisão de algumas propriedades e definições.
Propriedades:O comprimento de um lado de um triângulo não pode ser maior do que a soma dos comprimentos dos outros dois lados.
Definições: a) Chama-se triângulo eqüilátero o que tem os comprimentos dos três lados iguais;
b) Chama-se triângulo isósceles ao triângulo que têm os comprimentos de dois lados iguais e um lado diferente;
c) Triângulo escaleno é o triângulo que tem os comprimentos dos três lados diferentes.
}
{ Solução em Portugol
Algoritmo Exercicio 33;
Var
X,Y,Z: real;
Inicio
exiba("Programa que diz se 3 medidas formam um triângulo e, caso positivo, qual o tipo de triângulo.");
exiba("Digite o valor de X: ");
leia(X);
exiba("Digite o valor de Y: ");
leia(Y);
exiba("Digite o valor de Z: ");
leia(Z);
se((X > Y + Z) ou (Y > X + Z) ou (Z > X + Y))
então exiba("Essas medidas não formam um triângulo.")
senão se((X = Y) e (X = Z))
então exiba("O triângulo é equilátero.")
senão se((X <> Y) e (Y <> Z)) e (X <> Z))
então exiba("O triângulo é escaleno.")
senão exiba("O triângulo é isósceles.");
fimse;
fimse;
fimse;
Fim.
}
// Solução em Pascal
Program Exercicio33;
uses crt;;
var
X,Y,Z: real;
begin
clrscr;
writeln('Programa que diz se 3 medidas formam um triângulo e, caso positivo, qual o tipo de triângulo.');
writeln('Digite o valor de X: ');
readln(X);
writeln('Digite o valor de Y: ');
readln(Y);
writeln('Digite o valor de Z: ');
readln(Z);
if((X > Y + Z) or (Y > X + Z) or (Z > X + Y))
then writeln('Essas medidas não formam um triângulo.')
else if((X = Y) and (X = Z))
then writeln('O triângulo é equilátero.')
else if((X <> Y) and (Y <> Z) and (Z <> X))
then writeln('O triângulo é escaleno.')
else writeln('O triângulo é isósceles.');
repeat until keypressed;
end. |
unit HGM.Controls.Edit;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Generics.Collections,
Vcl.ExtCtrls, System.UITypes, Vcl.Buttons, Vcl.Mask, HGM.Controls.VirtualTable, HGM.Common;
type
TCentredEdit = class(TMaskEdit)
procedure CreateParams (var Params: TCreateParams); override;
procedure ValidateError; override;
end;
TEditExState = (exsNormal, exsError, exsNotEmpty);
TOnPressEnter = procedure(Sender:TObject; Handled:Boolean) of object;
TEditMode = (emText, emDate, emTime, emNumber, emMask);
TEditEx = class(TCustomPanel)
private
FRightButton:TSpeedButton;
FLeftButton:TSpeedButton;
FEdit:TCentredEdit;
FColor:TColor;
FState:TEditExState;
FOnChange:TNotifyEvent;
FOnEditButtonClick:TNotifyEvent;
FOnClearButtonClick:TNotifyEvent;
FOnPressEnter:TOnPressEnter;
FOnEditKeyPress: TKeyPressEvent;
FEditMode: TEditMode;
FMask: string;
FText: string;
procedure OnEditChange(Sender:TObject);
procedure OnButtonClick(Sender:TObject);
procedure OnEditEnter(Sender:TObject);
procedure OnEditKeyPress(Sender: TObject; var Key: Char);
procedure OnLeftButtonClick(Sender:TObject);
function GetText: string;
procedure SetText(const Value: string);
function GetShowClearButton: Boolean;
procedure SetShowClearButton(const Value: Boolean);
function GetTextHint: string;
procedure SetTextHint(const Value: string);
function GetNumberOnly: Boolean;
procedure SetNumberOnly(const Value: Boolean);
function GetValue: Integer;
procedure SetValue(const Value: Integer);
function GetColor: TColor;
procedure SetColor(const Value: TColor);
function GetShowEditButton: Boolean;
procedure SetShowEditButton(const Value: Boolean);
function GetReadOnly: Boolean;
procedure SetReadOnly(const Value: Boolean);
procedure EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure GoToControl(Prev:Boolean);
procedure SetEditMode(const Value: TEditMode);
procedure SetMask(const Value: string);
function GetDate: TDate;
procedure SetDate(const Value: TDate);
function GetAutoSelect: Boolean;
procedure SetAutoSelect(const Value: Boolean);
function GetFont: TFont;
procedure SetFont(const Value: TFont);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetNumber(Value:Integer);
property State:TEditExState read FState;
function Flash:Boolean;
procedure Reset;
procedure SetFocus; override;
property Date:TDate read GetDate write SetDate;
property Value:Integer read GetValue write SetValue;
published
property Align;
property OnExit;
property OnEnter;
property Font:TFont read GetFont write SetFont;
property AutoSelect:Boolean read GetAutoSelect write SetAutoSelect;
property TabOrder;
property ReadOnly:Boolean read GetReadOnly write SetReadOnly;
property Color:TColor read GetColor write SetColor;
property OnChange:TNotifyEvent read FOnChange write FOnChange;
property OnEditButtonClick:TNotifyEvent read FOnEditButtonClick write FOnEditButtonClick;
property OnClearButtonClick:TNotifyEvent read FOnClearButtonClick write FOnClearButtonClick;
property Text:string read GetText write SetText;
property Mode:TEditMode read FEditMode write SetEditMode;
property Mask:string read FMask write SetMask;
property TextHint:string read GetTextHint write SetTextHint;
property OnPressEnter:TOnPressEnter read FOnPressEnter write FOnPressEnter;
property ShowClearButton:Boolean read GetShowClearButton write SetShowClearButton;
property ShowEditButton:Boolean read GetShowEditButton write SetShowEditButton;
property NumberOnly:Boolean read GetNumberOnly write SetNumberOnly;
property OnKeyPress:TKeyPressEvent read FOnEditKeyPress write FOnEditKeyPress;
property Visible;
property Enabled;
end;
TOnGetItemText = procedure(Sender:TObject; Index:Integer; var Value:string) of object;
TlkComboBox = class(TCustomPanel)
private
FItemIndex:Integer;
FListData:TTableEx;
FListButton:TSpeedButton;
FRightButton:TSpeedButton;
FEdit:TCentredEdit;
FOnChange:TNotifyEvent;
FOnGetItemText:TOnGetItemText;
FGetDataProc: TGetTableDataProc;
FViewListSize: Integer;
FViewListWidth:Integer;
//FListWindow:TFormList;
procedure OnEditChange(Sender:TObject);
procedure OnButtonClick(Sender:TObject);
function GetText: string;
procedure SetText(const Value: string);
function GetShowClearButton: Boolean;
procedure SetShowClearButton(const Value: Boolean);
function GetTextHint: string;
procedure SetTextHint(const Value: string);
procedure OnListButtonClick(Sender:TObject);
procedure OnListExit(Sender:TObject);
procedure OnListItemClick(Sender:TObject; MouseButton:TMouseButton; const Index:Integer);
function GetColor: TColor;
procedure SetColor(const Value: TColor);
function GetItemCount: Integer;
procedure SetItemCount(const Value: Integer);
procedure SetGetDataProc(const Value: TGetTableDataProc);
function GetColumnCount: Integer;
function GetColumns: TTableColumns;
procedure SetItemIndex(const Value: Integer);
function GetAutoSelect: Boolean;
procedure SetAutoSelect(const Value: Boolean);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function AddColumn:Integer;
procedure DeleteColumn(Index:Integer);
property ColumnCount:Integer read GetColumnCount;
property Columns:TTableColumns read GetColumns;
published
property Align;
property AutoSelect:Boolean read GetAutoSelect write SetAutoSelect;
property ViewListSize:Integer read FViewListSize write FViewListSize;
property ViewListWidth:Integer read FViewListWidth write FViewListWidth default 0;
property ItemCount:Integer read GetItemCount write SetItemCount;
property GetData:TGetTableDataProc read FGetDataProc write SetGetDataProc;
property Color:TColor read GetColor write SetColor;
property OnChange:TNotifyEvent read FOnChange write FOnChange;
property Text:string read GetText write SetText;
property ItemIndex:Integer read FItemIndex write SetItemIndex;
property TextHint:string read GetTextHint write SetTextHint;
property ShowClearButton:Boolean read GetShowClearButton write SetShowClearButton;
property OnGetItemText:TOnGetItemText read FOnGetItemText write FOnGetItemText;
property Visible;
property Enabled;
end;
procedure Register;
implementation
uses Math;
procedure Register;
begin
RegisterComponents(PackageName, [TEditEx]);
RegisterComponents(PackageName, [TlkComboBox]);
end;
{ TEditEx }
constructor TEditEx.Create(AOwner: TComponent);
begin
inherited;
Width:=200;
Height:=24;
BorderStyle:=bsNone;
BevelOuter:=bvNone;
Color:=$00854F18;
ParentBackground:=False;
ParentColor:=False;
FEdit:=TCentredEdit.Create(Self);
with FEdit do
begin
Align:=alClient;
Margins.Left:=1;
Margins.Right:=0;
Margins.Top:=1;
Margins.Bottom:=1;
Font.Size:=10;
BorderStyle:=bsNone;
BevelInner:=bvRaised;
BevelKind:=bkFlat;
BevelWidth:=3;
BevelOuter:=bvNone;
AutoSize:=False;
AlignWithMargins:=True;
OnChange:=OnEditChange;
OnKeyPress:=OnEditKeyPress;
OnKeyDown:=EditKeyDown;
OnEnter:=OnEditEnter;
Name:='Edit';
Parent:=Self;
end;
FLeftButton:=TSpeedButton.Create(Self);
with FLeftButton do
begin
Caption:='▼';
Font.Name:='Arial';
Font.Size:=10;
Font.Style:=[fsBold];
Font.Color:=clWhite;
Align:=alRight;
Width:=24;
Flat:=True;
Name:='LeftButton';
OnClick:=OnLeftButtonClick;
Parent:=Self;
end;
FRightButton:=TSpeedButton.Create(Self);
with FRightButton do
begin
Caption:='×';
Font.Name:='Arial';
Font.Size:=14;
Font.Style:=[fsBold];
Font.Color:=clWhite;
Align:=alRight;
Width:=24;
Flat:=True;
Name:='RightButton';
OnClick:=OnButtonClick;
Parent:=Self;
end;
ShowClearButton:=True;
ShowEditButton:=False;
Mode:=emText;
FEdit.Text:=FText;
end;
destructor TEditEx.Destroy;
begin
inherited;
end;
function TEditEx.Flash:Boolean;
begin
Result:=True;
FState:=exsError;
inherited Color:=clRed;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clWhite;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clRed;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clWhite;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clMaroon;
Application.ProcessMessages;
Sleep(60);
inherited Color:=clRed;
Application.ProcessMessages;
Sleep(60);
end;
function TEditEx.GetAutoSelect: Boolean;
begin
Result:=FEdit.AutoSelect;
end;
function TEditEx.GetColor: TColor;
begin
Result:=FColor;
end;
function TEditEx.GetDate: TDate;
var DT:TDateTime;
begin
if TryStrToDate(FEdit.Text, DT) then Result:=DT else Result:=-1;
end;
function TEditEx.GetFont: TFont;
begin
Result:=FEdit.Font;
end;
function TEditEx.GetNumberOnly: Boolean;
begin
Result:=FEdit.NumbersOnly;
end;
function TEditEx.GetReadOnly: Boolean;
begin
Result:=FEdit.ReadOnly;
end;
function TEditEx.GetShowClearButton: Boolean;
begin
Result:=FRightButton.Visible;
end;
function TEditEx.GetShowEditButton: Boolean;
begin
Result:=FLeftButton.Visible;
end;
function TEditEx.GetText: string;
begin
Result:=FEdit.Text;
end;
function TEditEx.GetTextHint: string;
begin
Result:=FEdit.TextHint;
end;
function TEditEx.GetValue: Integer;
begin
if not TryStrToInt(FEdit.Text, Result) then Result:=-1;
end;
procedure TEditEx.GoToControl(Prev: Boolean);
var Frm: TCustomForm;
begin
Frm:=GetParentForm(TCustomForm(Self));
if Frm = nil then Exit;
if Prev then SendMessage(Frm.Handle, WM_NEXTDLGCTL, 1, 0)
else SendMessage(Frm.Handle, WM_NEXTDLGCTL, 0, 0);
end;
procedure TEditEx.OnButtonClick(Sender: TObject);
begin
if Assigned(FOnClearButtonClick) then
begin
FOnClearButtonClick(Self);
Exit;
end;
if FEdit.Modified then
begin
FEdit.Reset;
Exit;
end;
FEdit.Clear;
end;
procedure TEditEx.OnEditChange(Sender: TObject);
begin
Reset;
if Assigned(FOnChange) then FOnChange(Self);
end;
procedure TEditEx.OnEditEnter(Sender: TObject);
begin
FEdit.SelectFirst;
end;
procedure TEditEx.OnEditKeyPress(Sender: TObject; var Key: Char);
var Handled:Boolean;
begin
if (Key = #13) then
begin
Key:=#0;
Handled:=False;
if Assigned(FOnPressEnter) then
begin
FOnPressEnter(Sender, Handled);
if Handled then Exit;
end;
GoToControl(False);
end;
if Assigned(FOnEditKeyPress) then FOnEditKeyPress(Sender, Key);
end;
procedure TEditEx.EditKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key in [VK_UP, VK_LEFT] then
begin
Key:=0;
GoToControl(True);
end
else
if Key in [VK_DOWN, VK_RIGHT] then
begin
Key:=0;
GoToControl(False);
end;
end;
procedure TEditEx.OnLeftButtonClick(Sender: TObject);
begin
if Assigned(FOnEditButtonClick) then FOnEditButtonClick(Self);
end;
procedure TEditEx.Reset;
begin
FState:=exsNormal;
inherited Color:=FColor;
end;
procedure TEditEx.SetAutoSelect(const Value: Boolean);
begin
FEdit.AutoSelect:=Value;
end;
procedure TEditEx.SetColor(const Value: TColor);
begin
FColor:=Value;
Reset;
end;
procedure TEditEx.SetDate(const Value: TDate);
begin
if Mode <> emDate then Exit;
FEdit.Text:=FormatDateTime('DD.MM.YYYY', Value)
end;
procedure TEditEx.SetEditMode(const Value: TEditMode);
begin
FEditMode:= Value;
FEdit.EditMask:='';
FEdit.Reset;
FEdit.Clear;
case FEditMode of
emText:
begin
NumberOnly:=False;
FEdit.EditMask:='';
end;
emDate:
begin
NumberOnly:=False;
FEdit.EditMask:='90\.90\.9000;1;_';
end;
emTime:
begin
NumberOnly:=False;
FEdit.EditMask:='!90:00;1;_';
end;
emNumber:
begin
NumberOnly:=True;
FEdit.EditMask:='';
end;
emMask:
begin
NumberOnly:=False;
SetMask(FMask);
end;
end;
end;
procedure TEditEx.SetFocus;
begin
inherited;
FEdit.SetFocus;
end;
procedure TEditEx.SetFont(const Value: TFont);
begin
FEdit.Font:=Value;
end;
procedure TEditEx.SetMask(const Value: string);
begin
FMask:= Value;
if FEditMode = emMask then FEdit.EditMask:=FMask;
end;
procedure TEditEx.SetNumber(Value: Integer);
begin
FEdit.Text:=IntToStr(Value);
end;
procedure TEditEx.SetNumberOnly(const Value: Boolean);
begin
FEdit.NumbersOnly:=Value;
end;
procedure TEditEx.SetReadOnly(const Value: Boolean);
begin
FEdit.ReadOnly:=Value;
end;
procedure TEditEx.SetShowClearButton(const Value: Boolean);
begin
FRightButton.Visible:=Value;
if not FLeftButton.Visible then
if Value then FEdit.Margins.Right:=0 else FEdit.Margins.Right:=1;
Repaint;
end;
procedure TEditEx.SetShowEditButton(const Value: Boolean);
begin
FLeftButton.Visible:=Value;
if not FRightButton.Visible then
if Value then FEdit.Margins.Right:=0 else FEdit.Margins.Right:=1;
Repaint;
end;
procedure TEditEx.SetText(const Value: string);
begin
FText:=Value;
FEdit.Text:=FText;
end;
procedure TEditEx.SetTextHint(const Value: string);
begin
FEdit.TextHint:=Value;
end;
procedure TEditEx.SetValue(const Value: Integer);
begin
if NumberOnly then SetNumber(Value);
end;
{ TCentredEdit }
procedure TCentredEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
end;
{ TComboBoxEx }
function TlkComboBox.GetAutoSelect: Boolean;
begin
Result:=FEdit.AutoSelect;
end;
function TlkComboBox.GetColor: TColor;
begin
Result:=inherited Color;
end;
function TlkComboBox.GetColumnCount: Integer;
begin
Result:=FListData.ColumnCount;
end;
function TlkComboBox.GetColumns: TTableColumns;
begin
Result:=FListData.Columns;
end;
function TlkComboBox.GetItemCount: Integer;
begin
Result:=FListData.ItemCount;
end;
function TlkComboBox.GetShowClearButton: Boolean;
begin
Result:=FRightButton.Visible;
end;
function TlkComboBox.GetText: string;
begin
Result:=FEdit.Text;
end;
function TlkComboBox.GetTextHint: string;
begin
Result:=FEdit.TextHint;
end;
procedure TlkComboBox.OnButtonClick(Sender: TObject);
begin
FEdit.Clear;
ItemIndex:=-1;
end;
procedure TlkComboBox.OnEditChange(Sender: TObject);
begin
ItemIndex:=-1;
if Assigned(FOnChange) then FOnChange(Self);
end;
procedure TlkComboBox.OnListButtonClick(Sender: TObject);
begin
{
if FListWindow.Visible then
begin
//OnListExit(nil);
end
else
begin
//FListData.Parent:=Self.Parent;
FListWindow.Width:=Self.Width;
FListWindow.Left:=Self.ClientToScreen(Point(0, 0)).X;
FListWindow.Top:=Self.ClientToScreen(Point(0, 0)).Y+Self.Height-1;
FListData.DefaultRowHeight:=Self.Height;
FListData.Height:=Min(FListData.ItemCount, FViewListSize)*FListData.DefaultRowHeight+2;
//FListData.ShowColumns:=False;
FListWindow.Show;
FListWindow.SetFocus;
end; }
if FListData.Visible then
begin
OnListExit(nil);
end
else
begin
FListData.Parent:=Self.Parent;
if FViewListWidth <= 0 then
FListData.Width:=Self.Width
else FListData.Width:=FViewListWidth;
FListData.Left:=Self.Left;
FListData.Top:=Self.Top+Self.Height-1;
FListData.DefaultRowHeight:=Self.Height;
FListData.Height:=Min(FListData.ItemCount, FViewListSize)*FListData.DefaultRowHeight+2;
FListData.ShowColumns:=False;
FListData.Show;
FListData.BringToFront;
FListData.SetFocus;
end;
end;
procedure TlkComboBox.OnListExit(Sender: TObject);
begin
FListData.Visible:=False;
end;
procedure TlkComboBox.SetAutoSelect(const Value: Boolean);
begin
FEdit.AutoSelect:=Value;
end;
procedure TlkComboBox.SetColor(const Value: TColor);
begin
inherited Color:=Value;
FListData.LineColor:=clWhite;
FListData.LineColorXor:=clWhite;
FListData.LineSelColor:=Value;
end;
procedure TlkComboBox.SetGetDataProc(const Value: TGetTableDataProc);
begin
FGetDataProc:= Value;
FListData.GetData:=FGetDataProc;
end;
procedure TlkComboBox.SetItemCount(const Value: Integer);
begin
FListData.ItemCount:=Value;
end;
procedure TlkComboBox.SetItemIndex(const Value: Integer);
begin
FItemIndex:= Value;
if Assigned(FListData) then FListData.ItemIndex:=Value;
end;
procedure TlkComboBox.SetShowClearButton(const Value: Boolean);
begin
FRightButton.Visible:=Value;
if Value then FEdit.Margins.Right:=0 else FEdit.Margins.Right:=1;
Repaint;
end;
procedure TlkComboBox.SetText(const Value: string);
begin
FEdit.Text:=Value;
end;
procedure TlkComboBox.SetTextHint(const Value: string);
begin
FEdit.TextHint:=Value;
end;
function TlkComboBox.AddColumn: Integer;
begin
Result:=FListData.AddColumn;
end;
constructor TlkComboBox.Create(AOwner: TComponent);
begin
inherited;
Width:=200;
Height:=24;
BorderStyle:=bsNone;
BevelOuter:=bvNone;
FViewListSize:=10;
FViewListWidth:=0;
ParentBackground:=False;
ParentColor:=False;
FEdit:=TCentredEdit.Create(Self);
with FEdit do
begin
Parent:=Self;
Align:=alClient;
Margins.Left:=1;
Margins.Right:=0;
Margins.Top:=1;
Margins.Bottom:=1;
Font.Size:=10;
BorderStyle:=bsNone;
BevelInner:=bvRaised;
BevelKind:=bkFlat;
BevelWidth:=3;
BevelOuter:=bvNone;
AlignWithMargins:=True;
OnChange:=OnEditChange;
Name:='Edit';
Text:='';
end;
FListButton:=TSpeedButton.Create(Self);
with FListButton do
begin
Parent:=Self;
Caption:='▼';
Font.Name:='Arial';
Font.Size:=10;
Font.Style:=[fsBold];
Font.Color:=clWhite;
Align:=alRight;
Width:=24;
Flat:=True;
Name:='ListButton';
OnClick:=OnListButtonClick;
end;
FRightButton:=TSpeedButton.Create(Self);
with FRightButton do
begin
Caption:='×';
Font.Name:='Arial';
Font.Size:=14;
Font.Style:=[fsBold];
Font.Color:=clWhite;
Align:=alRight;
Width:=24;
Flat:=True;
Name:='Button';
OnClick:=OnButtonClick;
Parent:=Self;
end;
{FListWindow:=TFormList.Create(nil);
with FListWindow do
begin
Parent:=nil;
Visible:=False;
OnDeactivate:=OnListExit;
end; }
FListData:=TTableEx.Create(Self);
//FListData:=FListWindow.TableEx1;
with FListData do
begin
Name:='FListData';
Parent:=Self;
Align:=alClient;
ItemCount:=0;
Visible:=False;
//ShowColumns:=False;
DefaultRowHeight:=20;
OnExit:=OnListExit;
BevelInner:=bvNone;
BevelKind:=bkFlat;
BorderStyle:=bsNone;
OnMouseLeave:=OnListExit;
OnItemClick:=OnListItemClick;
end;
FListData.Parent:=nil;
Color:=$00854F18;
ShowClearButton:=True;
end;
procedure TlkComboBox.DeleteColumn(Index: Integer);
begin
FListData.DeleteColumn(Index);
end;
destructor TlkComboBox.Destroy;
begin
inherited;
end;
procedure TlkComboBox.OnListItemClick(Sender: TObject; MouseButton: TMouseButton; const Index: Integer);
var Str:string;
begin
Str:='Укажите OnGetItemText';
if Assigned(FOnGetItemText) then FOnGetItemText(Self, Index, Str);
Text:=Str;
ItemIndex:=Index;
OnListExit(nil);
end;
procedure TCentredEdit.ValidateError;
begin
//inherited;
end;
end.
|
{*******************************************************************************
作者: dmzn@163.com 2011-11-30
描述: 商品订单确认
*******************************************************************************}
unit UFormBillConfirm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, USkinFormBase, ExtCtrls, cxGraphics, cxControls, cxLookAndFeels,
cxLookAndFeelPainters, cxContainer, cxEdit, cxTextEdit, StdCtrls,
UImageButton, Grids, UGridPainter, cxCheckBox, cxMaskEdit,
cxDropDownEdit, UGridExPainter, Menus, cxButtons;
type
TfFormBillConfirm = class(TSkinFormBase)
LabelHint: TLabel;
GridList: TDrawGridEx;
Panel1: TPanel;
Panel2: TPanel;
BtnOK: TImageButton;
BtnCancel: TImageButton;
Label1: TLabel;
EditID: TcxTextEdit;
Label2: TLabel;
EditMan: TcxTextEdit;
Label3: TLabel;
EditTime: TcxTextEdit;
procedure FormCreate(Sender: TObject);
procedure BtnExitClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Panel1Resize(Sender: TObject);
procedure BtnOKClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
private
{ Private declarations }
FBillID,FBillMan,FBillTime: string;
//订单信息
FPainter: TGridPainter;
//绘制对象
procedure LoadBillInfo(const nBill: string);
//订单信息
public
{ Public declarations }
class function FormSkinID: string; override;
end;
function ShowBillConfirmForm(const nBill: string): Boolean;
//订单确认
implementation
{$R *.dfm}
uses
ULibFun, DB, UFormCtrl, USysDB, USysConst, USysFun, UDataModule, FZSale_Intf;
function ShowBillConfirmForm(const nBill: string): Boolean;
begin
with TfFormBillConfirm.Create(Application) do
begin
LoadBillInfo(nBill);
Result := ShowModal = mrOk;
Free;
end;
end;
class function TfFormBillConfirm.FormSkinID: string;
begin
Result := 'FormDialog';
end;
procedure TfFormBillConfirm.FormCreate(Sender: TObject);
var nIdx: Integer;
begin
for nIdx:=ComponentCount-1 downto 0 do
if Components[nIdx] is TImageButton then
LoadFixImageButton(TImageButton(Components[nIdx]));
//xxxxx
FPainter := TGridPainter.Create(GridList);
with FPainter do
begin
HeaderFont.Style := HeaderFont.Style + [fsBold];
//粗体
AddHeader('序号', 50);
AddHeader('商品名称', 50);
AddHeader('当前进货价', 50);
AddHeader('订货人', 50);
AddHeader('订货量', 50);
AddHeader('订货时间', 50);
AddHeader('预计到货', 50);
end;
LoadFormConfig(Self);
LoadDrawGridConfig(Name, GridList);
end;
procedure TfFormBillConfirm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
SaveFormConfig(Self);
SaveDrawGridConfig(Name, GridList);
FPainter.Free;
end;
procedure TfFormBillConfirm.BtnExitClick(Sender: TObject);
begin
Close;
end;
//Desc: 调整按钮位置
procedure TfFormBillConfirm.Panel1Resize(Sender: TObject);
var nW,nL: Integer;
begin
nW := BtnOK.Width + 65 + BtnCancel.Width;
nL := Trunc((Panel1.Width - nW) / 2);
BtnOk.Left := nL;
BtnCancel.Left := nL + BtnOK.Width + 65;
end;
//------------------------------------------------------------------------------
//Desc: 载入订单信息
procedure TfFormBillConfirm.LoadBillInfo(const nBill: string);
var nStr,nHint: string;
nDS: TDataSet;
nIdx: Integer;
nData: TGridDataArray;
begin
if nBill = '' then
begin
nStr := 'Select Top 1 * From %s Where O_Status=''%s'' And ' +
'O_TerminalId=''%s'' Order By R_ID DESC';
nStr := Format(nStr, [sTable_Order, sFlag_BillLock, gSysParam.FTerminalID]);
end else
begin
nStr := 'Select * From %s Where O_ID=''%s'' And ' +
'(O_Status=''%s'' or O_Status=''%s'') ';
nStr := Format(nStr, [sTable_Order, nBill, sFlag_BillLock, sFlag_BillNew]);
end;
nDS := FDM.LockDataSet(nStr, nHint);
try
if not Assigned(nDS) then
begin
ShowDlg(nHint, sWarn); Exit;
end;
if nDS.RecordCount > 0 then
begin
FBillID := nDS.FieldByName('O_ID').AsString;
FBillMan := nDS.FieldByName('O_Man').AsString;
FBillTime := DateTime2Str(nDS.FieldByName('O_Date').AsDateTime);
end;
finally
FDM.ReleaseDataSet(nDS);
end;
if FBillID = '' then
begin
ShowMsg('没有待确认的订单', sHint);
Exit;
end;
EditID.Text := FBillID;
EditMan.Text := FBillMan;
EditTime.Text := FBillTime;
nStr := 'Select * From $OD od ' +
' Left Join (Select ProductID,pt.StyleID,pt.ColorID,pt.SizeID,' +
' StyleName,SizeName,ColorName From $PT pt' +
' Left Join $SZ sz On sz.SizeID=pt.SizeID' +
' Left Join $CR cr On cr.ColorID=pt.ColorID' +
' Left Join $ST st On st.StyleID=pt.StyleID' +
' ) pt On pt.ProductID=D_Product ' +
'Where D_Order=''$ID'' Order by R_ID';
//xxxxx
nStr := MacroValue(nStr, [MI('$OD', sTable_OrderDtl), MI('$PT', sTable_DL_Product),
MI('$SZ', sTable_DL_Size), MI('$CR', sTable_DL_Color),
MI('$ST', sTable_DL_Style), MI('$ID', FBillID)]);
//xxxxx
nDS := FDM.LockDataSet(nStr, nHint);
try
if not Assigned(nDS) then
begin
ShowDlg(nHint, sWarn); Exit;
end;
FPainter.ClearData;
if nDS.RecordCount < 1 then Exit;
with nDS do
begin
First;
nStr := FieldByName('StyleName').AsString;
LabelHint.Caption := Format('%s款式订货单确认', [nStr]);
while not Eof do
begin
SetLength(nData, 11);
for nIdx:=Low(nData) to High(nData) do
begin
nData[nIdx].FCtrls := nil;
nData[nIdx].FAlign := taCenter;
end;
nStr := Format('%s_%s_%s', [FieldByName('StyleName').AsString,
FieldByName('ColorName').AsString,
FieldByName('SizeName').AsString]);
//xxxxx
nData[0].FText := FieldByName('R_ID').AsString;
nData[1].FText := nStr;
nData[2].FText := Format('%.2f', [FieldByName('D_Price').AsFloat]);
nData[3].FText := FBillMan;
nData[4].FText := FieldByName('D_Number').AsString;
nData[5].FText := FBillTime;
nData[6].FText := FBillTime;
nData[7].FText := FieldByName('D_Product').AsString;
nData[8].FText := FieldByName('StyleID').AsString;
nData[9].FText := FieldByName('ColorID').AsString;
nData[10].FText := FieldByName('SizeID').AsString;
FPainter.AddData(nData);
Next;
end;
end;
finally
FDM.ReleaseDataSet(nDS);
end;
end;
//Desc: 确定
procedure TfFormBillConfirm.BtnOKClick(Sender: TObject);
var nStr,nHint: string;
nIdx: Integer;
nSQLList: SQLItems;
begin
nStr := '要确认编号为[ %s ]的订单吗?' + #32#32#13#10#13#10 +
'只有通过确认的订单,代理商才会发货.';
nStr := Format(nStr, [FBillID]);
if not QueryDlg(nStr, sAsk, Handle) then Exit;
nSQLList := SQLItems.Create;
try
nStr := 'Update %s Set O_Status=''%s'',O_ActDate=%s Where O_ID=''%s''';
nStr := Format(nStr, [sTable_Order, sFlag_BillNew, sField_SQLServer_Now, FBillID]);
with nSQLList.Add do
begin
SQL := nStr;
IfRun := '';
IfType := 0;
end;
nStr := MakeSQLByStr([SF('TerminalId', gSysParam.FTerminalID),
SF('Lid', FBillID), SF('OrderState', '0', sfVal),
SF('CreateTime', sField_SQLServer_Now, sfVal),
SF('ActualCount', '0', sfVal), SF('SpId', '0', sfVal)
], sTable_DL_Order, '', True);
//xxxxx
with nSQLList.Add do
begin
SQL := nStr;
IfRun := '';
IfType := 0;
end;
for nIdx:=0 to FPainter.DataCount - 1 do
begin
nStr := MakeSQLByStr([SF('ProId', FPainter.Data[nIdx][7].FText),
SF('StyleId', FPainter.Data[nIdx][8].FText, sfVal),
SF('ProCount', FPainter.Data[nIdx][4].FText, sfVal),
SF('OutCount', FPainter.Data[nIdx][4].FText, sfVal),
SF('Lid', FBillID), SF('SpId', '0', sfVal)
], sTable_DL_OrderDtl, '', True);
//xxxxx
with nSQLList.Add do
begin
SQL := nStr;
IfRun := '';
IfType := 0;
end; //代理订单
nStr := MakeSQLByStr([SF('P_ID', FPainter.Data[nIdx][7].FText),
SF('P_Color', FPainter.Data[nIdx][9].FText, sfVal),
SF('P_Size', FPainter.Data[nIdx][10].FText, sfVal),
SF('P_Number', '0', sfVal),
SF('P_Price', '0', sfVal),
SF('P_InPrice', '0', sfVal),
SF('P_TerminalId', gSysParam.FTerminalID),
SF('P_LastIn', sField_SQLServer_Now, sfVal)
], sTable_Product, '', True);
//xxxxx
nHint := 'Select P_ID From %s ' +
'Where P_TerminalId=''%s'' And P_ID=''%s''';
nHint := Format(nHint, [sTable_Product, gSysParam.FTerminalID,
FPainter.Data[nIdx][7].FText]);
//where
with nSQLList.Add do
begin
SQL := nStr;
IfRun := nHint;
IfType := 1;
end; //新品订货时,更新终端产品表
end;
if FDM.SQLUpdates(nSQLList, True, nHint) > 0 then
begin
ShowMsg('订单确认成功', sHint);
ModalResult := mrOk;
end else ShowDlg(nHint, sWarn, Handle);
finally
//nSQLList.Free;
end;
end;
//Desc: 取消订单
procedure TfFormBillConfirm.BtnCancelClick(Sender: TObject);
var nStr,nHint: string;
begin
nStr := '要取消编号为[ %s ]的订单吗?' + #32#32#13#10#13#10 +
'取消后订单将作废.';
nStr := Format(nStr, [FBillID]);
if not QueryDlg(nStr, sAsk, Handle) then Exit;
nStr := 'Update %s Set O_Status=''%s'',O_ActDate=%s Where O_ID=''%s''';
nStr := Format(nStr, [sTable_Order, sFlag_BillCancel, sField_SQLServer_Now, FBillID]);
if FDM.SQLExecute(nStr, nHint) > 0 then
begin
ShowMsg('订单已经取消', sHint);
ModalResult := mrOk;
end else ShowDlg(nHint, sWarn, Handle);
end;
end.
|
unit MarshalUnMarshalUnit;
interface
uses
GenericParametersUnit, System.Rtti, Classes, SysUtils,
REST.JsonReflect, System.JSON, REST.Json.Types, System.Generics.Collections;
type
TMarshalUnMarshal = class
private
class var ctx: TRttiContext;
class procedure InitIntermediateObject(TypeInfo: Pointer; JsonObject: TJSONObject);
class function MakeJsonObject(JsonValue: TJsonValue; out IsMakedObject: boolean): TJSONObject;
public
class function ToJson(GenericParameters: TGenericParameters): String;
class function ToJsonValue(GenericParameters: TGenericParameters): TJSONValue;
class function FromJson(AClass: TClass; JsonValue: TJsonValue): TObject;
end;
implementation
{ TMarshalUnMarshal }
uses JSONNullableMarshalConverterUnit, JSONNullableAttributeUnit,
NullableInterceptorUnit;
class function TMarshalUnMarshal.FromJson(AClass: TClass;
JsonValue: TJsonValue): TObject;
var
Marshal: TJSONMarshal;
Unmarshal: TJSONUnMarshal;
JsonObject: TJSONObject;
IsMakedObject: boolean;
begin
Unmarshal := TJSONUnMarshal.Create();
try
JsonObject := MakeJsonObject(JsonValue, IsMakedObject);
if (JsonObject = nil) then
Exit(nil);
ctx := TRttiContext.Create;
Marshal := TJSONMarshal.Create;
try
InitIntermediateObject(AClass.ClassInfo, JsonObject);
finally
FreeAndNil(Marshal);
ctx.Free;
end;
Result := Unmarshal.CreateObject(AClass, JsonObject);
if IsMakedObject then
FreeAndNil(JsonObject);
finally
FreeAndNil(Unmarshal);
end;
end;
class procedure TMarshalUnMarshal.InitIntermediateObject(
TypeInfo: Pointer; JsonObject: TJSONObject);
var
RttiType: TRttiType;
function IsNullabledAttribute(Name: String; out Field: TRttiField): boolean;
var
RttiField: TRttiField;
Attr, Attr1: TCustomAttribute;
begin
Field := nil;
Result := False;
for RttiField in RttiType.GetFields do
for Attr in RttiField.GetAttributes do
if (Attr is JSONNameAttribute) and (JSONNameAttribute(Attr).Name = Name) then
begin
Field := RttiField;
for Attr1 in RttiField.GetAttributes do
if (Attr1 is BaseJSONNullableAttribute) then
begin
Exit(True);
end;
end;
end;
function IsNullabledArrayAttribute(Name: String): boolean;
var
RttiField: TRttiField;
Attr, Attr1: TCustomAttribute;
begin
Result := False;
for RttiField in RttiType.GetFields do
for Attr in RttiField.GetAttributes do
if (Attr is JSONNameAttribute) and (JSONNameAttribute(Attr).Name = Name) then
for Attr1 in RttiField.GetAttributes do
if (Attr1 is NullableArrayAttribute) then
Exit(True);
end;
var
i, j, k: integer;
Name: String;
Value: TJSONValue;
RttiField: TRttiField;
ObjectAsString: String;
JSONValue: TJSONValue;
ArrayItemObject: TJSONObject;
ItemTypeInfo: Pointer;
elementType: TRttiType;
ArraysItems: TArray<TJSONString>;
JSONArray: TJSONArray;
IsNullabledArrayAttr: boolean;
begin
RttiType := ctx.GetType(TypeInfo);
for i := JsonObject.Count - 1 downto 0 do
begin
Name := JsonObject.Pairs[i].JsonString.Value;
try
if IsNullabledAttribute(Name, RttiField) then
begin
if (not RttiField.FieldType.IsRecord) then
raise Exception.Create('The field marked attribute "JSONNullable" must be a record.');
Value := JsonObject.Pairs[i].JsonValue;
if (Value is TJSONTrue) then
begin
JsonObject.RemovePair(Name);
JsonObject.AddPair(Name, 'true');
Continue;
end;
if (Value is TJSONFalse) then
begin
JsonObject.RemovePair(Name);
JsonObject.AddPair(Name, 'false');
Continue;
end;
if (Value is TJSONObject) then
begin
ObjectAsString := TJSONObject(Value).ToString;
JsonObject.RemovePair(Name);
JsonObject.AddPair(Name, ObjectAsString);
Continue;
end;
end;
if (RttiField = nil) then
begin
if (Name = 'listHelper') then
for j := 0 to JsonObject.Count - 1 do
if (JsonObject.Pairs[j].JsonString.Value = 'items') then
begin
elementType := nil;
for RttiField in RttiType.GetFields do
if (RttiField.Name = 'FItems') then
begin
elementType := (RttiField.FieldType as TRttiDynamicArrayType).ElementType;
Break;
end;
if (elementType = nil) then
raise Exception.Create('Invalid collection initialization');
ItemTypeInfo := elementType.Handle;
JSONArray := JsonObject.Pairs[j].JsonValue as TJSONArray;
for k := 0 to JSONArray.Count - 1 do
InitIntermediateObject(ItemTypeInfo, JSONArray.Items[k] as TJSONObject);
Break;
end;
Continue;
end;
JSONValue := JsonObject.Pairs[i].JsonValue;
if (JSONValue is TJSONArray) then
begin
JSONArray := TJSONArray(JSONValue);
if RttiField.FieldType is TRttiArrayType then
elementType := TRttiArrayType(RttiField.FieldType).elementType
else
elementType := TRttiDynamicArrayType(RttiField.FieldType).elementType;
if (elementType <> nil) then
begin
ItemTypeInfo := elementType.Handle;
SetLength(ArraysItems, 0);
IsNullabledArrayAttr := IsNullabledArrayAttribute(Name);
for j := JSONArray.Count - 1 downto 0 do
if JSONArray.Items[j] is TJSONObject then
begin
ArrayItemObject := TJSONObject(JSONArray.Items[j]);
if IsNullabledArrayAttr then
begin
ObjectAsString := ArrayItemObject.ToString;
JSONArray.Remove(j);
SetLength(ArraysItems, Length(ArraysItems) + 1);
ArraysItems[High(ArraysItems)] := TJSONString.Create(ObjectAsString);
end
else
InitIntermediateObject(ItemTypeInfo, ArrayItemObject);
end;
if IsNullabledArrayAttr then
for j := Length(ArraysItems) - 1 downto 0 do
JSONArray.AddElement(ArraysItems[j]);
end
else
begin
JsonObject.RemovePair(Name);
Continue;
end;
end;
if (JSONValue is TJSONObject) then
begin
ItemTypeInfo := RttiField.FieldType.Handle;
InitIntermediateObject(ItemTypeInfo, TJSONObject(JSONValue));
end;
except
on e: Exception do
raise Exception.Create('Error of "' + Name + '" field name');
end;
end;
end;
class function TMarshalUnMarshal.MakeJsonObject(
JsonValue: TJsonValue; out IsMakedObject: boolean): TJSONObject;
var
i: integer;
Arr: TJSONArray;
ListHelperJSONValue: TJSONArray;
ItemsJSONValue: TJSONArray;
begin
Result := nil;
IsMakedObject := False;
if JsonValue is TJsonObject then
Exit(TJSONObject(JsonValue));
if JsonValue is TJSONArray then
begin
IsMakedObject := True;
Arr := TJSONArray(JsonValue);
Result := TJSONObject.Create();
ListHelperJSONValue := TJSONArray.Create;
ListHelperJSONValue.AddElement(TJSONNumber.Create(Arr.Count));
Result.AddPair('listHelper', ListHelperJSONValue);
ItemsJSONValue := TJSONArray.Create;
for i := 0 to Arr.Count - 1 do
ItemsJSONValue.AddElement(Arr.Items[i].Clone as TJSONValue);
Result.AddPair('items', ItemsJSONValue);
end;
end;
class function TMarshalUnMarshal.ToJson(
GenericParameters: TGenericParameters): String;
var
Marshal: TJSONMarshal;
Value: TJSONValue;
begin
Marshal := TJSONMarshal.Create(TJSONNullableConverter.Create);
try
Value := Marshal.Marshal(GenericParameters);
try
Result := Value.ToString;
finally
FreeAndNil(Value);
end;
finally
FreeAndNil(Marshal);
end;
end;
class function TMarshalUnMarshal.ToJsonValue(
GenericParameters: TGenericParameters): TJSONValue;
var
Marshal: TJSONMarshal;
begin
Marshal := TJSONMarshal.Create(TJSONNullableConverter.Create);
try
Result := Marshal.Marshal(GenericParameters);
finally
FreeAndNil(Marshal);
end;
end;
end.
|
unit RemoteAdmin_TLB;
{ This file contains pascal declarations imported from a type library.
This file will be written during each import or refresh of the type
library editor. Changes to this file will be discarded during the
refresh process. }
{ RemoteAdmin Library }
{ Version 1.0 }
interface
uses Windows, ActiveX, Classes, Graphics, OleCtrls, StdVCL;
const
LIBID_RemoteAdmin: TGUID = '{B00DDE31-2732-11D3-8F76-00A0CC2C4AEF}';
const
{ Component class GUIDs }
Class_TaskManager: TGUID = '{B00DDE33-2732-11D3-8F76-00A0CC2C4AEF}';
type
{ Forward declarations: Interfaces }
ITaskManager = interface;
ITaskManagerDisp = dispinterface;
{ Forward declarations: CoClasses }
TaskManager = ITaskManager;
{ Dispatch interface for TaskManager Object }
ITaskManager = interface(IDispatch)
['{B00DDE32-2732-11D3-8F76-00A0CC2C4AEF}']
procedure EnumTasks; safecall;
function Get_TaskCount: Integer; safecall;
procedure Set_TaskCount(Value: Integer); safecall;
function GetTaskName(idx: Integer): OleVariant; safecall;
procedure StopTask(id: Integer); safecall;
procedure KillTask(id: Integer); safecall;
function Reboot: WordBool; safecall;
function GetTaskId(idx: Integer): OleVariant; safecall;
function LaunchTask(const filename: WideString): WordBool; safecall;
property TaskCount: Integer read Get_TaskCount write Set_TaskCount;
end;
{ DispInterface declaration for Dual Interface ITaskManager }
ITaskManagerDisp = dispinterface
['{B00DDE32-2732-11D3-8F76-00A0CC2C4AEF}']
procedure EnumTasks; dispid 1;
property TaskCount: Integer dispid 2;
function GetTaskName(idx: Integer): OleVariant; dispid 3;
procedure StopTask(id: Integer); dispid 4;
procedure KillTask(id: Integer); dispid 5;
function Reboot: WordBool; dispid 6;
function GetTaskId(idx: Integer): OleVariant; dispid 7;
function LaunchTask(const filename: WideString): WordBool; dispid 8;
end;
{ TaskManagerObject }
CoTaskManager = class
class function Create: ITaskManager;
class function CreateRemote(const MachineName: string): ITaskManager;
end;
implementation
uses ComObj;
class function CoTaskManager.Create: ITaskManager;
begin
Result := CreateComObject(Class_TaskManager) as ITaskManager;
end;
class function CoTaskManager.CreateRemote(const MachineName: string): ITaskManager;
begin
Result := CreateRemoteComObject(MachineName, Class_TaskManager) as ITaskManager;
end;
end.
|
unit UWinTools;
interface
uses
Classes, Forms, Windows, Graphics, ShellApi, SysUtils, Controls, StdCtrls,
Registry, Messages,
UMisc;
type
EShellExecuteError = class(Exception);
TOperationParam = (opNone, opOpen, opPrint, opExplore);
procedure SelectBackwards(Edit: TEdit; SelStart, SelLength: Integer);
procedure SetTransparentForm(AHandle: THandle; AValue: byte = 0);
{ maakt een form transparant }
procedure SetDisplayDragImage(Parent: TControl);
{ zorgt ervoor dat image altijd op alle controls en subcontrols weergegeven wordt }
function GetBestPopupPosition(const aCenterRect: TRect; aWidth, aHeight: integer): TPoint;
{ berekent de beste popup positie }
function DoShellExecute(const FileName: string; const Parameters: string = '';
const Directory: string = ''; Operation: TOperationParam = opOpen; ShowCmd: Integer = SW_SHOWNORMAL): HINST;
{ wrapper rond ShellExecute }
function MailTo(const Address: string): HINST;
{ shellexecute wrapper url mailto }
function ForceForegroundWindow(hwnd: THandle): Boolean;
{ forceert een app op de voorgrond, gebruik Application.Handle }
procedure AssociateFileExtension(const IconPath, ProgramName, Path, Extension: string);
implementation
const
WS_EX_LAYERED = $80000;
LWA_COLORKEY = 1;
LWA_ALPHA = 2;
type
TSetLayeredWindowAttributes = function (
hwnd : HWND; // handle to the layered window
crKey : TColor; // specifies the color key
bAlpha : byte; // value for the blend function
dwFlags : DWORD // action
): BOOL; stdcall;
var
SetLayeredWindowAttributes: TSetLayeredWindowAttributes;
procedure SelectBackwards(Edit: TEdit; SelStart, SelLength: Integer);
var KS: TKeyboardState;
OrgShift: Byte;
I: Integer;
begin
Edit.SelStart := SelStart;
GetKeyboardState(KS);
OrgShift := KS[VK_SHIFT];
KS[VK_SHIFT] := $80;
SetKeyboardState(KS);
for I := SelStart downto SelStart - SelLength + 1 do
Edit.Perform(WM_KEYDOWN, VK_LEFT, 0);
Edit.Perform(WM_KEYUP, VK_LEFT, 0);
KS[VK_SHIFT] := OrgShift;
SetKeyboardState(KS);
end;
procedure SetTransparentForm(AHandle : THandle; AValue : byte = 0);
begin
if Assigned(SetLayeredWindowAttributes) then
begin
SetWindowLong(AHandle, GWL_EXSTYLE, GetWindowLong(AHandle, GWL_EXSTYLE) or WS_EX_LAYERED);
//Make form transparent
SetLayeredWindowAttributes(AHandle, 0, AValue, LWA_ALPHA);
end;
end;
procedure SetDisplayDragImage(Parent: TControl);
var
I: Integer;
begin
Parent.ControlStyle := Parent.ControlStyle + [csDisplayDragImage];
if Parent is TWinControl then
with TWinControl(Parent) do
for I := 0 to ControlCount - 1 do
SetDisplayDragImage(Controls[I]);
end;
function GetBestPopupPosition(const aCenterRect: TRect; aWidth, aHeight: integer): TPoint;
var
C: TRect;
P: TPoint;
MaxRight, MaxBottom: integer;
AppBar: TAppBarData;
AppBarHeight: integer;
// res:integer;
begin
{ haal hoogte taskbar op }
FillChar(AppBar, SizeOf(AppBar), 0);
SHAppBarMessage(ABM_GETTASKBARPOS, AppBar);
begin
AppBarHeight := AppBar.Rc.Bottom - AppBar.Rc.Top;
if AppBarHeight > 300 then AppBarHeight := 0;
end;
if CompareMem(@aCenterRect, @EmptyRect, SizeOf(TRect)) then
begin
Result.X := Screen.Width div 2 - aWidth div 2;
Result.Y := (Screen.Height - 1 - AppBarHeight) div 2 - aHeight div 2;
Exit;
end;
MaxRight := Screen.Width - 1;
MaxBottom := Screen.Height - 1 - AppBarHeight;
// Log([appbarheight]);
C := aCenterRect;
{ 1e keus: rechts-onder }
P.X := C.Right + 1;
P.Y := C.Bottom + 1;
{ als niet OK dan ergens rechts }
if P.Y + aHeight > MaxBottom then P.Y := MaxBottom - aHeight;
if P.Y < 0 then P.Y := 0;
Result := P;
if (P.X + aWidth < MaxRight) and (P.X >= 0) then Exit;
{ 2e keus: links-onder }
P.Y := C.Bottom + 1;
P.X := C.Right - aWidth;
{ als niet OK dan ergens links }
if P.Y + aHeight > MaxBottom then P.Y := MaxBottom - aHeight;
if P.Y < 0 then P.Y := 0;
if P.X + aWidth > MaxRight then P.X := MaxRight - aWidth;
if P.X < 0 then P.X := 0;
Result := P;
end;
procedure InitUnit;
var
Info: TOSVersionInfo;
begin
//Check Windows version
Info.dwOSVersionInfoSize := SizeOf(Info);
GetVersionEx(Info);
if (Info.dwPlatformId = VER_PLATFORM_WIN32_NT) and (Info.dwMajorVersion >= 5) then
SetLayeredWindowAttributes := GetProcAddress(GetModulehandle(user32), 'SetLayeredWindowAttributes');
end;
function DoShellExecute(const FileName: string;
const Parameters: string = '';
const Directory: string = '';
Operation: TOperationParam = opOpen;
ShowCmd: Integer = SW_SHOWNORMAL): HINST;
//function DoShellExecute(const Operation, FileName, Parameters, Directory: string; ShowCmd: Integer): HINST;
const
Op: array[TOperationParam] of string = ('', 'open', 'print', 'explore');
begin
Result := 0;
if FileName = '' then
Exit;
if not Between(ShowCmd, 0, 10) then
ShowCmd := SW_SHOWNORMAL;
Result := ShellExecute(HINSTANCE,
PChar(Op[Operation]),
PChar(FileName),
PChar(Parameters),
PChar(Directory),
ShowCmd);
if Result <= 32 then
raise EShellExecuteError.CreateFmt('ShellExcecute fout %d', [Result]);
end;
function MailTo(const Address: string): HINST;
begin
Result := DoShellExecute(Pchar('mailto:' + Address))
end;
(*
function ExecuteWaitFile( ExeFile, Parameters: string): Boolean;
procedure WaitFor(processHandle: THandle);
var
AMessage : TMsg;
Result : DWORD;
begin
repeat
Result := MsgWaitForMultipleObjects(1,
processHandle,
False,
INFINITE,
QS_PAINT or
QS_SENDMESSAGE);
if Result = WAIT_FAILED then
Exit;
if Result = ( WAIT_OBJECT_0 + 1 ) then
begin
while PeekMessage(AMessage, 0, WM_PAINT, WM_PAINT, PM_REMOVE) do
DispatchMessage(AMessage);
end;
until result = WAIT_OBJECT_0;
end;
var
ExecuteCommand: array[0 .. 512] of Char;
StartUpInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
begin
StrPCopy(ExecuteCommand , ExeFile + ' ' + Parameters);
FillChar(StartUpInfo, SizeOf(StartUpInfo), #0);
StartUpInfo.cb := SizeOf(StartUpInfo);
StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow := SW_MINIMIZE;
if CreateProcess(nil,
ExecuteCommand,
nil,
nil,
False,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,
nil,
PChar(ExtractFileDir(ExeFile)),
StartUpInfo,
ProcessInfo) then
begin
WaitFor(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
result := true;
end
else
result := false;
end;
*)
{ Windows 98/2000 doesn't want to foreground a window when
some other window has the keyboard focus.
ForceForegroundWindow is an enhanced SetForeGroundWindow/bringtofront
function to bring a window to the front.
}
{
Manchmal funktioniert die SetForeGroundWindow Funktion
nicht so, wie sie sollte; besonders unter Windows 98/2000,
wenn ein anderes Fenster den Fokus hat.
ForceForegroundWindow ist eine "verbesserte" Version von
der SetForeGroundWindow API-Funktion, um ein Fenster in
den Vordergrund zu bringen.
}
function ForceForegroundWindow(hwnd: THandle): Boolean;
const
SPI_GETFOREGROUNDLOCKTIMEOUT = $2000;
SPI_SETFOREGROUNDLOCKTIMEOUT = $2001;
var
ForegroundThreadID: DWORD;
ThisThreadID: DWORD;
timeout: DWORD;
begin
if IsIconic(hwnd) then ShowWindow(hwnd, SW_RESTORE);
if GetForegroundWindow = hwnd then Result := True
else
begin
// Windows 98/2000 doesn't want to foreground a window when some other
// window has keyboard focus
if ((Win32Platform = VER_PLATFORM_WIN32_NT) and (Win32MajorVersion > 4)) or
((Win32Platform = VER_PLATFORM_WIN32_WINDOWS) and
((Win32MajorVersion > 4) or ((Win32MajorVersion = 4) and
(Win32MinorVersion > 0)))) then
begin
// Code from Karl E. Peterson, www.mvps.org/vb/sample.htm
// Converted to Delphi by Ray Lischner
// Published in The Delphi Magazine 55, page 16
Result := False;
ForegroundThreadID := GetWindowThreadProcessID(GetForegroundWindow, nil);
ThisThreadID := GetWindowThreadPRocessId(hwnd, nil);
if AttachThreadInput(ThisThreadID, ForegroundThreadID, True) then
begin
BringWindowToTop(hwnd); // IE 5.5 related hack
SetForegroundWindow(hwnd);
AttachThreadInput(ThisThreadID, ForegroundThreadID, False);
Result := (GetForegroundWindow = hwnd);
end;
if not Result then
begin
// Code by Daniel P. Stasinski
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, @timeout, 0);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(0),
SPIF_SENDCHANGE);
BringWindowToTop(hwnd); // IE 5.5 related hack
SetForegroundWindow(hWnd);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, TObject(timeout), SPIF_SENDCHANGE);
end;
end
else
begin
BringWindowToTop(hwnd); // IE 5.5 related hack
SetForegroundWindow(hwnd);
end;
Result := (GetForegroundWindow = hwnd);
end;
end; { ForceForegroundWindow }
(*
// 2. Way:
//**********************************************
procedure ForceForegroundWindow(hwnd: THandle);
// (W) 2001 Daniel Rolf
// http://www.finecode.de
// rolf@finecode.de
var
hlp: TForm;
begin
hlp := TForm.Create(nil);
try
hlp.BorderStyle := bsNone;
hlp.SetBounds(0, 0, 1, 1);
hlp.FormStyle := fsStayOnTop;
hlp.Show;
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
SetForegroundWindow(hwnd);
finally
hlp.Free;
end;
end;
// 3. Way:
//**********************************************
// by Thomas Stutz
{
As far as you know the SetForegroundWindow function on Windows 98/2000 can
not force a window to the foreground while the user is working with another window.
Instead, SetForegroundWindow will activate the window and call the FlashWindowEx
function to notify the user. However in some kind of applications it is necessary
to make another window active and put the thread that created this window into the
foreground and of course, you can do it using one more undocumented function from
the USER32.DLL.
void SwitchToThisWindow (HWND hWnd, // Handle to the window that should be activated
BOOL bRestore // Restore the window if it is minimized
);
}
procedure SwitchToThisWindow(h1: hWnd; x: bool); stdcall;
external user32 Name 'SwitchToThisWindow';
{x = false: Size unchanged, x = true: normal size}
procedure TForm1.Button2Click(Sender: TObject);
begin
SwitchToThisWindow(FindWindow('notepad', nil), True);
end;
*)
procedure RebuildIconCache;
var
Dummy: DWORD;
begin
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETNONCLIENTMETRICS,
Longint(PChar('WindowMetrics')), SMTO_NORMAL or SMTO_ABORTIFHUNG, 10000, Dummy);
end;
procedure AssociateFileExtension(const IconPath, ProgramName, Path, Extension: string);
const
RC_DefaultIcon = 'DefaultIcon';
begin
with TRegistry.Create do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey(ProgramName, True);
WriteString('', ProgramName);
if IconPath <> '' then
begin
OpenKey(RC_DefaultIcon, True);
WriteString('', IconPath);
end;
CloseKey;
OpenKey(ProgramName, True);
OpenKey('shell', True);
OpenKey('open', True);
OpenKey('command', True);
WriteString('', '"' + Path + '" "%1"');
Free;
end;
with TRegistry.Create do
begin
RootKey := HKEY_CLASSES_ROOT;
OpenKey('.' + extension, True);
WriteString('', ProgramName);
Free;
end;
RebuildIconCache;
end;
initialization
InitUnit;
(* als <= 32
procedure CheckExecError;
var
Msg: string;
begin
Msg := '';
case ExecError of
0 : Msg := 'Het besturingssysteem heeft te weinig geheugen of resources';
ERROR_FILE_NOT_FOUND : Msg := 'Het opgegeven bestand is niet gevonden';
ERROR_PATH_NOT_FOUND : Msg := 'Het opgegeven pad is niet gevonden';
ERROR_BAD_FORMAT : Msg := 'Het .EXE bestand is ongeldig (niet-Win32 .EXE of fout in .EXE image)';
SE_ERR_ACCESSDENIED : Msg := 'Het besturingssysteem geeft geen toegang tot het opgegeven bestand';
SE_ERR_ASSOCINCOMPLETE : Msg := 'De bestandsnaam associatie is niet compleet of ongeldig';
SE_ERR_DDEBUSY : Msg := 'DDE transactie kon niet worden voltooid omdat andere DDE transacties bezig waren';
SE_ERR_DDEFAIL : Msg := 'DDE transactie mislukt';
SE_ERR_DDETIMEOUT : Msg := 'DDE transactie kom niet worden voltooid wegens een timeout';
SE_ERR_DLLNOTFOUND : Msg := 'De opgegeven dynamic-link library werd niet gevonden';
SE_ERR_NOASSOC : Msg := 'Er is geen applicatie geassocieerd met de opgegeven bestandsextensie';
SE_ERR_OOM : Msg := 'Er is niet genoeg geheugen om de operatie te voltooien';
SE_ERR_SHARE : Msg := 'Er trad een sharing violation op';
end;
if Msg <> '' then
raise EShellExecuteError.Create(Msg);
end;
*)
{ ShellExecute(HINSTANCE, nil, PChar(S), nil, nil, SW_SHOWNORMAL);
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,
Directory: PChar; ShowCmd: Integer): HINST; stdcall; }
//function DoShellExecute(const Operation, Parameters, Directory): HINST;
(*
SW_HIDE Hides the window and activates another window.
SW_MAXIMIZE Maximizes the specified window.
SW_MINIMIZE Minimizes the specified window and activates the next top-level window in the Z order.
SW_RESTORE Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
SW_SHOW Activates the window and displays it in its current size and position.
SW_SHOWDEFAULT Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.
SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
SW_SHOWMINIMIZED Activates the window and displays it as a minimized window.
SW_SHOWMINNOACTIVE Displays the window as a minimized window. The active window remains active.
SW_SHOWNA Displays the window in its current state. The active window remains active.
SW_SHOWNOACTIVATE Displays a window in its most recent size and position. The active window remains active.
SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
SW_HIDE = 0;
SW_SHOWNORMAL = 1;
SW_NORMAL = 1;
SW_SHOWMINIMIZED = 2;
SW_SHOWMAXIMIZED = 3;
SW_MAXIMIZE = 3;
SW_SHOWNOACTIVATE = 4;
SW_SHOW = 5;
SW_MINIMIZE = 6;
SW_SHOWMINNOACTIVE = 7;
SW_SHOWNA = 8;
SW_RESTORE = 9;
SW_SHOWDEFAULT = 10;
SW_MAX = 10;
"open" The function opens the file specified by lpFile. The file can be an executable file or a document file. The file can be a folder to open.
"print" The function prints the file specified by lpFile. The file should be a document file. If the file is an executable file, the function opens the file, as if "open" had been specified.
"explore" The function explores the folder specified by lpFile.
*)
{ ShellExecute(HINSTANCE, nil, PChar(S), nil, nil, SW_SHOWNORMAL);
function ShellExecute(hWnd: HWND; Operation, FileName, Parameters,
Directory: PChar; ShowCmd: Integer): HINST; stdcall; }
end.
|
unit hcQueryBuilder;
// Библиотека : Тестовый слой;
// Автор : Морозов М.А.
// Описание : Реализации построителей запросов к серверу консультаций;
// Версия : $Id: hcQueryBuilder.pas,v 1.2 2008/03/03 06:56:32 mmorozov Exp $
{-------------------------------------------------------------------------------
$Log: hcQueryBuilder.pas,v $
Revision 1.2 2008/03/03 06:56:32 mmorozov
- new: открывать форму запросов к серверу консультаций можно даже если в журнале не выбрано ни одной консультации, переименованы органы управления, область редактора запросов можно изменять;
Revision 1.1 2008/02/27 06:10:49 mmorozov
- new: и всё таки выделены построители запросов к серверу консультаций (CQ: OIT5-28426);
-------------------------------------------------------------------------------}
interface
uses
Classes,
l3Base,
hcInterfaces
;
type
ThcQueryBuilder = class(Tl3Base, IhcQueryBuilder)
private
// fields
f_QueryXML : String;
f_AnswerXML : String;
f_Manager : IhcManager;
protected
// methods
function pm_GetQueryXML: String;
{* - запрос к серверу консультаций. }
function pm_GetAnswerXML: String;
{* - ответ от сервера консультаций. }
procedure Build(const aQueryId: IhcQueryIdList);
virtual;
{* - выполнить запрос к серверу консультаций. }
procedure AddQueryIdToXML(const aQueryId : IhcQueryIdList;
const aList : TStrings);
{-}
protected
// properties
property QueryXML: String
read f_QueryXML
write f_QueryXML;
{-}
property AnswerXML: String
read f_AnswerXML
write f_AnswerXML;
{-}
property Manager: IhcManager
read f_Manager;
{-}
public
// methods
constructor Create(const aManager : IhcManager;
const aQueryId : IhcQueryIdList);
reintroduce;
{-}
class function Make(const aManager : IhcManager;
const aQueryId : IhcQueryIdList): IhcQueryBuilder;
{-}
end;
ThcStatusQueryBuilder = class(ThcQueryBuilder)
{* Запрос для получения статусов консультаций. }
protected
// methods
procedure Build(const aQueryId: IhcQueryIdList);
override;
{* - выполнить запрос к серверу консультаций. }
end;
ThcDeleteQueryBuilder = class(ThcQueryBuilder)
{* Запрос для удаления консультаций. }
protected
// methods
procedure Build(const aQueryId: IhcQueryIdList);
override;
{* - выполнить запрос к серверу консультаций. }
end;
implementation
uses
SysUtils,
Controls,
hcDeleteQueryOptionsForm
;
procedure ThcQueryBuilder.AddQueryIdToXML(const aQueryId : IhcQueryIdList;
const aList : TStrings);
const
c_QueryIdFrm = '<query id="%s" version="%s"/>';
var
l_Index: Integer;
begin
for l_Index := 0 to Pred(aQueryId.Count) do
if aQueryId.Items[l_Index] <> nil then
with PhcConsultationId(aQueryId.Items[l_Index])^ do
aList.Add(Format(c_QueryIdFrm, [rQueryId, rVersion]));
end;
{ ThcQueryBuilder }
procedure ThcQueryBuilder.Build(const aQueryId: IhcQueryIdList);
{* - выполнить запрос к серверу консультаций. }
begin
AnswerXML := '';
QueryXML := '';
end;
constructor ThcQueryBuilder.Create(const aManager : IhcManager;
const aQueryId : IhcQueryIdList);
begin
inherited Create;
f_Manager := aManager;
Build(aQueryId);
end;
class function ThcQueryBuilder.Make(const aManager : IhcManager;
const aQueryId : IhcQueryIdList): IhcQueryBuilder;
var
l_Class: ThcQueryBuilder;
begin
l_Class := Create(aManager, aQueryId);
try
Result := l_Class;
finally
FreeAndNil(l_Class)
end;
end;
function ThcQueryBuilder.pm_GetAnswerXML: String;
begin
Result := AnswerXML;
end;
function ThcQueryBuilder.pm_GetQueryXML: String;
begin
Result := QueryXML;
end;
{ ThcStatusQueryBuilder }
procedure ThcStatusQueryBuilder.Build(const aQueryId: IhcQueryIdList);
{* - выполнить запрос к серверу консультаций. }
const
c_QueryIdFrm = '<query id="%s" version="%s"/>';
var
l_XML : TStrings;
l_FileName : String;
begin
inherited;
if (aQueryId <> nil) and (aQueryId.Count <> 0) then
begin
l_XML := TStringList.Create;
try
l_XML.Add('<?xml version="1.0" encoding="UTF-8" standalone="no" ?>');
l_XML.Add('<status_list>');
AddQueryIdToXML(aQueryId, l_XML);
l_XML.Add('</status_list>');
l_FileName := ExtractFileDir(ParamStr(0)) + '\' + 'temp.xml';
l_XML.SaveToFile(l_FileName);
QueryXML := l_XML.Text;
AnswerXML := Manager.PrintQueryStatus(l_FileName);
finally
FreeAndNil(l_XML);
end;{try..finally}
end;//if aQueryId.Count <> 0 then
end;
{ ThcDeleteQueryBuilder }
procedure ThcDeleteQueryBuilder.Build(const aQueryId: IhcQueryIdList);
{* - выполнить запрос к серверу консультаций. }
function lp_MakeDeleteOptions(var aValue: Boolean): Boolean;
var
l_Options: TfrmDeleteQueryOptions;
begin
l_Options := TfrmDeleteQueryOptions.Create(nil);
try
if l_Options.ShowModal = mrOk then
begin
Result := True;
aValue := l_Options.ForceDelete;
end
else
Result := False;
finally
FreeAndNil(l_Options);
end;//try..finally
end;//lp_MakeDeleteOptions
var
l_XML : TStrings;
l_FileName : String;
l_ForceDelete : Boolean;
begin
inherited;
if (aQueryId <> nil) and
(aQueryId.Count <> 0) and
lp_MakeDeleteOptions(l_ForceDelete) then
begin
l_XML := TStringList.Create;
try
l_XML.Add('<?xml version="1.0" encoding="UTF-8" standalone="no" ?>');
if l_ForceDelete then
l_XML.Add('<erase force="yes">')
else
l_XML.Add('<erase force="no">');
AddQueryIdToXML(aQueryId, l_XML);
l_XML.Add('</erase>');
l_FileName := ExtractFileDir(ParamStr(0)) + '\' + 'temp.xml';
l_XML.SaveToFile(l_FileName);
QueryXML := l_XML.Text;
AnswerXML := Manager.DeleteQuery(l_FileName);
finally
FreeAndNil(l_XML);
end;{try..finally}
end;//if aQueryId.Count <> 0 then
end;
end.
|
program TM1638_buttons;
{$mode objfpc}{$H+}
{ Raspberry Pi Application }
{ Add your program code below, add additional units to the "uses" section if }
{ required and create new units by selecting File, New Unit from the menu. }
{ To compile your program select Run, Compile (or Run, Build) from the menu. }
uses
RaspberryPi,
GlobalConfig,
GlobalConst,
GlobalTypes,
Platform,
Threads,
SysUtils,
Classes,
Ultibo,
Console,
TM1638;
var
TM1630Ac: TTM1630;
Handle: TWindowHandle;
procedure Setup();
begin
{Let's create a console window again but this time on the left side of the screen}
Handle := ConsoleWindowCreate(ConsoleDeviceGetDefault, CONSOLE_POSITION_FULL, True);
{To prove that worked let's output some text on the console window}
ConsoleWindowWriteLn(Handle, 'TM1638 buttons test');
try
TM1630Ac := TTM1630.Create;
except
on E: Exception do
begin
TM1630Ac := nil;
ConsoleWindowWriteLn(Handle, 'Setup() error: ' + E.Message);
end;
end;
end;
procedure Loop();
var
Buttons, position, mask: byte;
begin
try
Buttons := TM1630Ac.ReadButtons();
for position := 0 to 7 do
begin
mask := 1 shl position;
if Buttons and mask = 0 then
TM1630Ac.SetLed(0, position)
else
TM1630Ac.SetLed(1, position);
end;
except
on E: Exception do
begin
TM1630Ac.Free;
TM1630Ac := nil;
ConsoleWindowWriteLn(Handle, 'Loop() error: ' + E.Message);
end;
end;
end;
begin
Setup();
while Assigned(TM1630Ac) do
Loop();
ConsoleWindowWriteLn(Handle, '');
ConsoleWindowWriteLn(Handle, 'Bye');
{Halt the main thread if we ever get to here}
ThreadHalt(0);
end.
|
unit RoB.ExtratoExpressas;
interface
uses Control.Parametros, Common.ENum, Common.Utils, Control.Sistema, Control.Entregas, FireDAC.Comp.Client, System.SysUtils,
System.DateUtils, FireDAC.Comp.Dataset, Control.ExtraviosMultas, Control.Lancamentos, Control.FechamentoExpressas, Forms,
Winapi.Windows, Control.ExtratosExpressas, Control.Bases, Control.EntregadoresExpressas;
type
TRoBExtratoExpressas = class
public
function StartFechamento(iAno, iMes, iQuinzena, iCliente: Integer; bFlag, bData: Boolean): Boolean;
function ProcessaFechamento(iAno, iMes, iQuinzena, iCliente: Integer; bFlag, bData: Boolean): Boolean;
function ProcessaExtrato(iAno, iMes, iQuinzena, iCliente: Integer; bFlag, bData: Boolean): Boolean;
procedure PopulaFechamento(fdQuery: TFDQuery);
private
sNumeroExtrato : String;
procedure MontaPeriodo(iAno, iMes, iQuinzena: Integer);
end;
var
dtDataInicial: TDate;
dtDataFinal: TDate;
dtDataPagamento: TDate;
implementation
uses Data.SisGeF, Global.Parametros, View.FechamentoExpressas;
{ TRoBExtratoExpressas }
function TRoBExtratoExpressas.StartFechamento(iAno, iMes, iQuinzena, iCliente: Integer; bFlag, bData: Boolean): Boolean;
var
fechamento : TFechamentoExpressasControl;
aParam: Array of variant;
fdQuery: TFDQuery;
bResult: Boolean;
begin
try
Result := False;
bResult := False;
MontaPeriodo(iAno,iMes,iQuinzena);
fdQuery := TSistemaControl.GetInstance.Conexao.ReturnQuery;
fechamento := TFechamentoExpressasControl.Create;
SetLength(aParam,3);
aParam[0] := dtDataInicial;
aParam[1] := dtDataFinal;
aParam[2] := 0;
fdQuery := fechamento.RetornaFechamento(aParam);
Finalize(aParam);
if not fdQuery.IsEmpty then
begin
if Application.MessageBox('Fechamento já encerrado. Deseja visualizar?', 'Atenção', MB_YESNO + MB_ICONQUESTION) = IDYES then
begin
PopulaFechamento(fdQuery);
bResult := True;
end
else
begin
bResult := False;
Exit;
end;
end
else
begin
fdQuery.Close;
SetLength(aParam,3);
aParam[0] := dtDataInicial;
aParam[1] := dtDataFinal;
aParam[2] := iCliente;
fdQuery := fechamento.RetornaFechamento(aParam);
Finalize(aParam);
if not fdQuery.IsEmpty then
begin
if Application.MessageBox('Fechamento já encerrado. Deseja visualizar?', 'Atenção', MB_YESNO + MB_ICONQUESTION) = IDYES then
begin
PopulaFechamento(fdQuery);
bResult := True;
end
else
begin
bResult := False;
Exit;
end;
end
else
begin
bResult := ProcessaFechamento(iAno, iMes, iQuinzena, iCliente, bFlag, bData);
end;
end;
Result := bResult;
finally
fdQuery.Free;
fechamento.Free;
end;
end;
procedure TRoBExtratoExpressas.PopulaFechamento(fdQuery: TFDQuery);
begin
if Data_Sisgef.mtbFechamentoExpressas.Active then Data_Sisgef.mtbFechamentoExpressas.Close;
Data_Sisgef.mtbFechamentoExpressas.Open;
Data_Sisgef.mtbFechamentoExpressas.CopyDataSet(fdQuery,[coRestart,coAppend]);
fdQuery.Close;
if not Data_Sisgef.mtbFechamentoExpressa.IsEmpty then
begin
view_FechamentoExpressas.actExtrato.Enabled := True;
end;
view_FechamentoExpressas.cxLabel2.Caption := 'Período de ' + FormatDateTime('dd/mm/yyyy', dtDataInicial) + ' até ' +
FormatDateTime('dd/mm/yyyy', dtDataFinal) + ' - FECHADO';
view_FechamentoExpressas.cxLabel2.Refresh;
end;
function TRoBExtratoExpressas.ProcessaExtrato(iAno, iMes, iQuinzena, iCliente: Integer; bFlag, bData: Boolean): Boolean;
var
fdQuery : TFDQuery;
fdQuery1: TFDQuery;
entregas : TEntregasControl;
extrato : TExtratosExpressasControl;
extravios : TExtraviosMultasControl;
lancamentos : TLancamentosControl;
agentes: TBasesControl;
entregadores: TEntregadoresExpressasControl;
iAgente: Integer;
iEntregador: Integer;
sAgente: String;
sEntregador: String;
sLocate: String;
aParam: Array of variant;
begin
try
Result := False;
MontaPeriodo(iAno,iMes,iQuinzena);
fdQuery := TSistemaControl.GetInstance.Conexao.ReturnQuery;
entregas := TEntregasControl.Create;
extrato := TExtratosExpressasControl.Create;
extravios := TExtraviosMultasControl.Create;
lancamentos := TLancamentosControl.Create;
agentes := TBasesControl.Create;
entregadores := TEntregadoresExpressasControl.Create;
if iCliente <> 0 then
begin
SetLength(aParam,4);
aParam[0] := 'CLIENTE';
aParam[1] := dtDataInicial;
aParam[2] := dtDataFinal;
aParam[3] := iCliente;
end
else
begin
SetLength(aParam,3);
aParam[0] := 'DATA';
aParam[1] := dtDataInicial;
aParam[2] := dtDataFinal;
end;
fdQuery := extrato.Localizar(aParam);
Finalize(aParam);
if NOT fdQuery.IsEmpty then
begin
Application.MessageBox('Extrato já fechado!', 'Atenção', MB_OK + MB_ICONHAND);
Exit;
end;
if fdQuery.Active then fdQuery.Close;
SetLength(aParam,5);
aParam[0] := dtDataInicial;
aParam[1] := dtDataFinal;
aParam[2] := iCliente;
aParam[3] := bFlag;
aParam[4] := bData;
fdQuery := entregas.EntregasExtratoNew(aParam);
Finalize(aParam);
if Data_Sisgef.mtbExtratoExpressas.Active then Data_Sisgef.mtbExtratoExpressas.Close;
Data_Sisgef.mtbExtratoExpressas.Open;
if fdQuery.IsEmpty then
begin
Application.MessageBox('Período / Cliente não encontrado no banco de dados!', 'Atenção', MB_OK + MB_ICONHAND);
Data_Sisgef.mtbExtratoExpressas.Close;
Exit;
end;
fdQuery.First;
while not fdQuery.Eof do
begin
Data_Sisgef.mtbExtratoExpressas.Insert;
Data_Sisgef.mtbExtratoExpressasID_EXTRATO.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasCOD_AGENTE.AsInteger := fdQuery.FieldByName('cod_agente').AsInteger;
Data_Sisgef.mtbExtratoExpressasNOM_AGENTE.AsString := fdQuery.FieldByName('nom_agente').AsString;
Data_Sisgef.mtbExtratoExpressasCOD_ENTREGADOR.AsInteger := fdQuery.FieldByName('cod_entregador').AsInteger;
Data_Sisgef.mtbExtratoExpressasNOM_ENTREGADOR.AsString := fdQuery.FieldByName('nom_entregador').AsString;
Data_Sisgef.mtbExtratoExpressasDAT_INICIO.AsDateTime := dtDataInicial;
Data_Sisgef.mtbExtratoExpressasDAT_FINAL.AsDateTime := dtDataFinal;
Data_Sisgef.mtbExtratoExpressasVAL_PERCENTUAL_SLA.AsFloat := fdQuery.FieldByName('val_percentual_sla').AsFloat;
Data_Sisgef.mtbExtratoExpressasDAT_PAGAMENTO.AsDateTime := dtDataPagamento;
Data_Sisgef.mtbExtratoExpressasQTD_VOLUMES.AsInteger := fdQuery.FieldByName('qtd_volumes').AsInteger;
Data_Sisgef.mtbExtratoExpressasQTD_ENTREGAS.AsInteger := fdQuery.FieldByName('qtd_entregas').AsInteger;
Data_Sisgef.mtbExtratoExpressasQTD_ITENS_ATRASO.AsInteger := fdQuery.FieldByName('qtd_itens_atraso').AsInteger;
Data_Sisgef.mtbExtratoExpressasQTD_VOLUMES_EXTRA.AsFloat := fdQuery.FieldByName('qtd_volumes_extra').AsFloat;
Data_Sisgef.mtbExtratoExpressasVAL_VERBA.AsFloat := fdQuery.FieldByName('val_verba').AsFloat;
Data_Sisgef.mtbExtratoExpressas.Post;
fdQuery.Next;
end;
fdQuery.Close;
//popula os extravios dos entregadores
SetLength(aParam,1);
aParam[0] := 2;
fdQuery := extravios.ExtraviosExtrato(aParam);
Finalize(aParam);
if not fdQuery.IsEmpty then
begin
fdQuery.First;
while not fdQuery.Eof do
begin
sLocate := 'cod_entregador = ' + fdQuery.FieldByName('cod_entregador').AsString;
if Data_Sisgef.mtbFechamentoExpressas.LocateEx(sLocate,[]) then
begin
Data_Sisgef.mtbExtratoExpressas.Edit;
Data_Sisgef.mtbExtratoExpressasVAL_EXTRAVIOS.AsFloat := (0 - fdQuery.FieldByName('val_total').AsFloat);
Data_Sisgef.mtbExtratoExpressas.Post
end
else
begin
Data_Sisgef.mtbExtratoExpressas.Insert;
Data_Sisgef.mtbExtratoExpressasID_EXTRATO.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasCOD_AGENTE.AsInteger := fdQuery.FieldByName('cod_agente').AsInteger;
Data_Sisgef.mtbExtratoExpressasNOM_AGENTE.AsString := fdQuery.FieldByName('nom_agente').AsString;
Data_Sisgef.mtbExtratoExpressasCOD_ENTREGADOR.AsInteger := fdQuery.FieldByName('cod_entregador').AsInteger;
Data_Sisgef.mtbExtratoExpressasNOM_ENTREGADOR.AsString := fdQuery.FieldByName('nom_fantasia').AsString;
Data_Sisgef.mtbExtratoExpressasDAT_INICIO.AsDateTime := dtDataInicial;
Data_Sisgef.mtbExtratoExpressasDAT_FINAL.AsDateTime := dtDataFinal;
Data_Sisgef.mtbExtratoExpressasDAT_PAGAMENTO.AsDateTime := dtDataPagamento;
Data_Sisgef.mtbExtratoExpressasQTD_VOLUMES.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasQTD_ENTREGAS.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasQTD_ITENS_ATRASO.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasQTD_VOLUMES_EXTRA.AsFloat := 0;
Data_Sisgef.mtbExtratoExpressasVAL_VERBA.AsFloat := 0;
Data_Sisgef.mtbExtratoExpressasVAL_EXTRAVIOS.AsFloat := (0 - fdQuery.FieldByName('val_total').AsFloat);
Data_Sisgef.mtbExtratoExpressas.Post;
end;
fdQuery.Next;
end;
fdQuery.Close;
end;
// popula créditos e débitos de entregadores
lancamentos := TLancamentosControl.Create;
agentes := TBasesControl.Create;
entregadores := TEntregadoresExpressasControl.Create;
SetLength(aParam,2);
aParam[0] := 2;
aParam[1] := dtDataFinal;
fdQuery := lancamentos.ExtratoLancamentos(aParam);
fdQuery1 := TSistemaControl.GetInstance.Conexao.ReturnQuery;
Finalize(aParam);
if not fdQuery.IsEmpty then
begin
fdQuery.First;
while not fdQuery.Eof do
begin
iAgente := 0;
iEntregador := 0;
SetLength(aParam,2);
aParam[0] := 'CADASTRO';
aParam[1] := fdquery.FieldByName('cod_entregador').AsInteger;
fdQuery1 := entregadores.Localizar(aParam);
Finalize(aParam);
if not fdQuery1.IsEmpty then
begin
iAgente := fdQuery1.FieldByName('cod_agente').AsInteger;
iEntregador := fdQuery1.FieldByName('cod_entregador').AsInteger;
sEntregador := fdQuery1.FieldByName('nom_fantasia').AsString;
end;
fdQuery1.Close;
SetLength(aParam,2);
aParam[0] := 'CODIGO';
aParam[1] := iAgente;
fdQuery1 := agentes.Localizar(aParam);
Finalize(aParam);
if not fdQuery1.IsEmpty then
begin
sAgente := fdQuery1.FieldByName('nom_fantasia').AsString;
end;
fdQuery1.Close;
sLocate := 'cod_entregador = ' + iEntregador.ToString;
if Data_Sisgef.mtbExtratoExpressas.LocateEx(sLocate,[]) then
begin
Data_Sisgef.mtbExtratoExpressas.Edit;
if fdquery.FieldByName('des_tipo').AsString = 'CREDITO' then
begin
Data_Sisgef.mtbExtratoExpressasval_creditos.AsFloat := fdQuery.FieldByName('val_total').AsFloat;
end
else if fdquery.FieldByName('des_tipo').AsString = 'DEBITO' then
begin
Data_Sisgef.mtbExtratoExpressasval_debitos.AsFloat := (0 - fdQuery.FieldByName('val_total').AsFloat);
end;
Data_Sisgef.mtbExtratoExpressas.Post
end
else
begin
Data_Sisgef.mtbExtratoExpressas.Insert;
Data_Sisgef.mtbExtratoExpressasID_EXTRATO.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasCOD_AGENTE.AsInteger := iAgente;
Data_Sisgef.mtbExtratoExpressasNOM_AGENTE.AsString := sAgente;
Data_Sisgef.mtbExtratoExpressasCOD_ENTREGADOR.AsInteger := iEntregador;
Data_Sisgef.mtbExtratoExpressasNOM_ENTREGADOR.AsString := sEntregador;
Data_Sisgef.mtbExtratoExpressasDAT_INICIO.AsDateTime := dtDataInicial;
Data_Sisgef.mtbExtratoExpressasDAT_FINAL.AsDateTime := dtDataFinal;
Data_Sisgef.mtbExtratoExpressasDAT_PAGAMENTO.AsDateTime := dtDataPagamento;
Data_Sisgef.mtbExtratoExpressasQTD_VOLUMES.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasQTD_ENTREGAS.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasQTD_ITENS_ATRASO.AsInteger := 0;
Data_Sisgef.mtbExtratoExpressasQTD_VOLUMES_EXTRA.AsFloat := 0;
Data_Sisgef.mtbExtratoExpressasVAL_VERBA.AsFloat := 0;
end;
fdQuery.Next;
end;
fdQuery.Close;
end;
Result := True;
finally
fdQuery.Free;
fdQuery1.Free;
extrato.Free;
extravios.Free;
lancamentos.Free;
agentes.Free;
entregadores.Free;
end;
end;
//processa o fechamento quando não existir
function TRoBExtratoExpressas.ProcessaFechamento(iAno, iMes, iQuinzena, iCliente: Integer; bFlag, bData: Boolean): Boolean;
var
agentes: TBasesControl;
entregadores: TEntregadoresExpressasControl;
fdQuery: TFDQuery;
sLocate: String;
iAgente: Integer;
iEntregador: Integer;
iCodigo: Integer;
iTipo: Integer;
sTipo: String;
aParam: Array of variant;
sBanco: String;
sAgencia: String;
sConta: String;
sCPF: String;
sFavorecido: String;
begin
try
Result := False;
fdQuery := TSistemaControl.GetInstance.Conexao.ReturnQuery;
agentes := TBasesControl.Create;
entregadores := TEntregadoresExpressasControl.Create;
if not Data_Sisgef.mtbExtratoExpressas.Active then Exit;
if Data_Sisgef.mtbExtratoExpressas.IsEmpty then Exit;
if Data_Sisgef.mtbFechamentoExpressas.Active then Data_Sisgef.mtbFechamentoExpressas.Close;
Data_Sisgef.mtbFechamentoExpressas.Open;
iTipo := 0;
sTipo := '';
iCodigo := 0;
Data_Sisgef.mtbExtratoExpressas.First;
while Data_Sisgef.mtbExtratoExpressas.Eof do
begin
iAgente := Data_Sisgef.mtbExtratoExpressasCOD_AGENTE.AsInteger;
iEntregador := Data_Sisgef.mtbExtratoExpressasCOD_ENTREGADOR.AsInteger;
sBanco :='';
sAgencia :='';
sConta :='';
sCPF :='';
sFavorecido := '';
SetLength(aParam,2);
aParam[0] := 'CODIGO';
aParam[1] := iAgente;
fdQuery := agentes.Localizar(aParam);
Finalize(aParam);
if not fdQuery.IsEmpty then
begin
sTipo := fdQuery.FieldByName('DES_FORMA_PAGAMENTO').AsString;
sBanco := fdQuery.FieldByName('cod_banco').AsString;
sAgencia := fdQuery.FieldByName('cod_agencia').AsString;
sConta := fdQuery.FieldByName('num_conta').AsString;
sFavorecido := fdQuery.FieldByName('nom_favorecido').AsString;
sCPF := fdQuery.FieldByName('num_cpf_cnpj_favorecido').AsString;
end
else
begin
sTipo := 'NENHUMA';
end;
fdQuery.Close;
if sTipo <> 'NENHUMA' then
begin
iTipo := 1;
iCodigo := iAgente;
end
else
begin
iTipo := 2;
iCodigo := iEntregador;
end;
sLocate := 'cod_expressa;cod_tipo_expressa';
if Data_Sisgef.mtbFechamentoExpressas.LocateEx(sLocate,[iCodigo,iTipo],[], nil) then
begin
Data_Sisgef.mtbFechamentoExpressas.Edit;
Data_Sisgef.mtbFechamentoExpressascod_expressa.AsInteger := iCodigo;
Data_Sisgef.mtbFechamentoExpressascod_tipo_expressa.AsInteger := iTipo;
Data_Sisgef.mtbFechamentoExpressasval_performance.AsFloat := 0;
Data_Sisgef.mtbFechamentoExpressasqtd_volumes.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_volumes.AsInteger +
fdQuery.FieldByName('qtd_volumes').AsInteger;
Data_Sisgef.mtbFechamentoExpressasqtd_entregas.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_entregas.AsInteger +
fdQuery.FieldByName('qtd_entregas').AsInteger;
Data_Sisgef.mtbFechamentoExpressasqtd_atraso.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_atraso.AsInteger +
fdQuery.FieldByName('qtd_itens_atraso').AsInteger;
Data_Sisgef.mtbFechamentoExpressasqtd_volumes_extra.AsFloat := Data_Sisgef.mtbFechamentoExpressasqtd_volumes_extra.AsFloat +
fdQuery.FieldByName('qtd_volumes_extra').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_volume_extra.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_volume_extra.AsFloat +
fdQuery.FieldByName('val_volumes_extra').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_producao.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_producao.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
if iTipo = 1 then
begin
Data_Sisgef.mtbFechamentoExpressasnom_expressa.AsString := fdQuery.FieldByName('nom_agente').AsString;
end
else
begin
Data_Sisgef.mtbFechamentoExpressasnom_expressa.AsString := fdQuery.FieldByName('nom_entregador').AsString;
end;
Data_Sisgef.mtbFechamentoExpressasnom_banco.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasdes_tipo_conta.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnum_agencia.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnum_conta.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnom_favorecido.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnum_cpf_cnpj.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasqtd_pfp.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_pfp.AsInteger +
fdQuery.FieldByName('qtd_atraso').AsInteger;
Data_Sisgef.mtbFechamentoExpressasval_ticket_medio.AsFloat := fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_total_ticket.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_total_ticket.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_extravios.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_extravios.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_debitos.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_debitos.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_creditos.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_creditos.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_total.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_total.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressas.Post;
end
else
begin
Data_Sisgef.mtbFechamentoExpressas.Edit;
Data_Sisgef.mtbFechamentoExpressascod_expressa.AsInteger := fdQuery.FieldByName('cod_tipo_expressa').AsInteger;
Data_Sisgef.mtbFechamentoExpressascod_tipo_expressa.AsInteger := fdQuery.FieldByName('cod_tipo_expressa').AsInteger;
Data_Sisgef.mtbFechamentoExpressasval_performance.AsFloat := fdQuery.FieldByName('val_percentual_sla').AsFloat;
Data_Sisgef.mtbFechamentoExpressasqtd_volumes.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_volumes.AsInteger +
fdQuery.FieldByName('qtd_volumes').AsInteger;
Data_Sisgef.mtbFechamentoExpressasqtd_entregas.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_entregas.AsInteger +
fdQuery.FieldByName('qtd_entregas').AsInteger;
Data_Sisgef.mtbFechamentoExpressasqtd_atraso.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_atraso.AsInteger +
fdQuery.FieldByName('qtd_atraso').AsInteger;
Data_Sisgef.mtbFechamentoExpressasqtd_volumes_extra.AsFloat := Data_Sisgef.mtbFechamentoExpressasqtd_volumes_extra.AsFloat +
fdQuery.FieldByName('qtd_extra').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_volume_extra.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_volume_extra.AsFloat +
fdQuery.FieldByName('val_volumes_extra').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_producao.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_producao.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_producao.AsFloat := fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasnom_expressa.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnom_banco.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasdes_tipo_conta.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnum_agencia.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnum_conta.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnom_favorecido.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasnum_cpf_cnpj.AsFloat := fdQuery.FieldByName('val_producao').AsString;
Data_Sisgef.mtbFechamentoExpressasqtd_pfp.AsInteger := Data_Sisgef.mtbFechamentoExpressasqtd_pfp.AsInteger +
fdQuery.FieldByName('qtd_atraso').AsInteger;
Data_Sisgef.mtbFechamentoExpressasval_ticket_medio.AsFloat := fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_total_ticket.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_total_ticket.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_extravios.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_extravios.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_debitos.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_debitos.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_creditos.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_creditos.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressasval_total.AsFloat := Data_Sisgef.mtbFechamentoExpressasval_total.AsFloat +
fdQuery.FieldByName('val_producao').AsFloat;
Data_Sisgef.mtbFechamentoExpressas.Post;
end;
end;
finally
fdQuery.Free;
agentes.Free;
entregadores.Free;
end;
end;
procedure TRoBExtratoExpressas.MontaPeriodo(iAno, iMes, iQuinzena: Integer);
var
parametros : TParametrosControl;
FDQuery: TFDQuery;
pParam: Array of variant;
iDiaInicio, iDiaFinal, iMesData, iAnoData: Integer;
sData: String;
datData, datBase: TDate;
begin
try
FDquery := TSistemaControl.GetInstance().Conexao.ReturnQuery;
parametros := TParametrosControl.Create();
SetLength(pParam,2);
iAnoData := iAno;
pParam[0] := 'QUINZENA';
pParam[1] := iQuinzena;
FDQuery := parametros.Localizar(pParam);
Finalize(pParam);
if not FDQuery.IsEmpty then
begin
iDiaInicio := FDQuery.FieldByName('dia_inicio_quinzena').AsInteger;
iDiaFinal := FDQuery.FieldByName('dia_final_quinzena').AsInteger;
end
else
begin
if iQuinzena = 1 then
begin
iDiaInicio := 1;
iDiaFinal := 15;
end
else
begin
iDiaInicio := 16;
sData := '01/' + FormatFloat('00', iMes) + '/' + IntToStr(iAnoData);
iDiaFinal := DaysInMonth(StrToDate(sData));
end;
end;
if iDiaInicio > iDiaFinal then
begin
if iMes = 1 then
begin
iMesData := 12;
iAnoData := iAnoData - 1;
sData := FormatFloat('00', iDiaInicio) + '/' + FormatFloat('00', iMesData) + '/' + FormatFloat('0000', iAnoData);
end
else
begin
iMesData := iMes - 1;
iAnoData := iAno;
sData := FormatFloat('00', iDiaInicio) + '/' + FormatFloat('00', iMesData) + '/' + FormatFloat('0000', iAnoData);
end;
dtDataInicial := StrToDate(sData);
iMesData := iMes;
iAnoData := iAno;
sData := FormatFloat('00', iDiaFinal) + '/' + FormatFloat('00', iMesData) + '/' + FormatFloat('0000', iAnoData);
dtDataFinal := StrToDate(sData);
end
else
begin
iMesData := iMes;
iAnoData := iAno;
sData := FormatFloat('00', iDiaInicio) + '/' + FormatFloat('00', iMesData) + '/' + FormatFloat('0000', iAnoData);
dtDataInicial := StrToDate(sData);
iMesData := iMes;
iAnoData := iAno;
sData := FormatFloat('00', iDiaFinal) + '/' + FormatFloat('00', iMesData) + '/' + FormatFloat('0000', iAnoData);
dtDataFinal := StrToDate(sData);
end;
FDQuery.Close;
finally
FDQuery.Free;
parametros.Free;
end;
end;
end.
|
unit l3ChangeNotifier;
{ $Id: l3ChangeNotifier.pas,v 1.14 2014/02/13 10:12:59 lulin Exp $ }
// $Log: l3ChangeNotifier.pas,v $
// Revision 1.14 2014/02/13 10:12:59 lulin
// - рефакторим безликие списки.
//
// Revision 1.13 2012/01/25 16:43:07 lulin
// {RequestLink:326773370}
//
// Revision 1.12 2009/12/11 15:56:11 lulin
// {RequestLink:172984520}.
//
// Revision 1.11 2009/12/11 14:14:53 lulin
// {RequestLink:172984520}.
//
// Revision 1.10 2008/03/20 09:48:40 lulin
// - cleanup.
//
// Revision 1.9 2008/02/07 14:44:45 lulin
// - класс _Tl3LongintList переехал в собственный модуль.
//
// Revision 1.8 2005/11/24 17:14:46 demon
// - fix: после переноса функциональности на l3Control отъехала
// реализация возможности вызова Changing/Changed из DoChanged циклически
//
// Revision 1.7 2005/09/08 12:47:34 lulin
// - добавлен шаблон _LockedNotifier_.
//
// Revision 1.6 2005/07/28 15:09:50 voba
// - improve : l3ItemStorages_TLB перетащили в l3Interfaces
// - improve : AddNotifiedObj/DelNotifiedObj переименовли в Subscribe/Unsubscribe для поддержки интерфейса Il3ChangeNotifier
// - improve : Il3ItemNotifyRecipient.Notify добавили параметр aNotifier : Il3ChangeNotifier
//
// Revision 1.5 2005/07/25 13:07:28 lulin
// - bug fix: не компилировался Архивариус.
//
// Revision 1.4 2005/02/08 09:51:06 step
// изменен тип f_Subscribers (_TInterfaceList --> _Tl3LongintList)
//
// Revision 1.3 2005/01/12 17:50:29 step
// учтен подсчет ссылок
//
// Revision 1.2 2005/01/11 10:58:06 step
// вставлены директивы Log.
//
interface
uses
Classes,
l3Types,
l3Interfaces,
l3Base,
l3InternalInterfaces,
l3NotifyPtrList,
l3ProtoObject
;
type
// реализация "подписки-извещений"
_l3Changing_Parent_ = Tl3ProtoObject;
{$Include ..\L3\l3Changing.imp.pas}
_l3ChangingChangedNotifier_Parent_ = _l3Changing_;
{$Include l3ChangingChangedNotifier.imp.pas}
Tl3ChangeNotifier = class(_l3ChangingChangedNotifier_)
end;//Tl3ChangeNotifier
implementation
uses
SysUtils
;
{$Include ..\L3\l3Changing.imp.pas}
{$Include l3ChangingChangedNotifier.imp.pas}
end.
|
{*_* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Author: François PIETTE
Description: TSnmpCli class encapsulate the SNMP client paradigm
Creation: March 2011
Version: 1.00
EMail: francois.piette@overbyte.be http://www.overbyte.be
Support: Use the mailing list twsocket@elists.org
Follow "support" link at http://www.overbyte.be for subscription.
Legal issues: Copyright (C) 2011 by François PIETTE
Rue de Grady 24, 4053 Embourg, Belgium. Fax: +32-4-365.74.56
<francois.piette@overbyte.be>
This software is provided 'as-is', without any express or
implied warranty. In no event will the author be held liable
for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it
and redistribute it freely, subject to the following
restrictions:
1. The origin of this software must not be misrepresented,
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
4. You must register this software by sending a picture postcard
to the author. Use a nice stamp and mention your name, street
address, EMail address and any comment you like to say.
History:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
unit OverbyteIcsSnmpCli;
interface
uses
Windows, Messages, SysUtils, Classes, ExtCtrls,
OverbyteIcsWndControl,
OverbyteIcsWinsock,
OverbyteIcsWSocket,
OverbyteIcsAsn1Utils,
OverbyteIcsSnmpMsgs;
const
SnmpClientVersion = 100;
CopyRight : String = ' TSnmpClient (c) 2011 Francois Piette V1.00 ';
type
TSnmpCliReq = (srqGet, srqGetNext);
TSnmpCliAct = (sacNone, sacContinue, sacBreak);
TRequestDoneEvent = procedure (Sender : TObject;
ReqType : TSnmpCliReq;
var Action : TSnmpCliAct;
ErrCode : Word) of object;
TDebugWSocket = class(TWSocket)
protected
function TriggerDataAvailable(Error : Word) : Boolean; override;
end;
TSnmpCli = class(TIcsWndControl)
protected
FWSocket : TDebugWSocket;
FReqType : TSnmpCliReq;
FVersion : Integer;
FCommunity : AnsiString;
FQuery : TSNMPRec;
FReply : TSNMPRec;
FBusy : Boolean;
FOID : String;
FHostIP : String;
FPort : String;
FAddr : String;
FTimeout : Integer;
FResponseValue : String;
FResponseValueType : Integer;
FResponseOID : String;
FDestAddr : TSockAddr;
FMsg_WM_LISTENING : UINT;
FMsg_WM_GETNEXT : UINT;
FBaseOID : String;
FCurrentID : Integer; // Incremented by InternalSendTo
FOnRequestDone : TRequestDoneEvent;
{$IFNDEF SNMP_BUILTIN_TIMEOUT}
FTimeoutTimer : TTimer;
{$ENDIF}
procedure WSocketDataAvailable(Sender: TObject; ErrCode: Word);
{$IFDEF SNMP_BUILTIN_TIMEOUT}
procedure WSocketTimeout(Sender: TObject; Reason: TTimeoutReason);
{$ELSE}
procedure TimeoutTimerTimer(Sender: TObject);
{$ENDIF}
procedure TriggerRequestDone(ReqType : TSnmpCliReq;
var Action : TSnmpCliAct;
ErrCode : Word); virtual;
function MsgHandlersCount: Integer; override;
procedure AllocateMsgHandlers; override;
procedure FreeMsgHandlers; override;
procedure WndProc(var MsgRec: TMessage); override;
procedure WMListening(var Msg: TMessage);
procedure WMGetNext(var Msg: TMessage);
function InternalSendTo : Boolean;
function InternalGetNext(const OID: String): Boolean;
procedure Display(const Msg : String);
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
function SendTo : Boolean;
function Get : Boolean;
function GetNext : Boolean;
procedure Abort;
property Query : TSNMPRec read FQuery;
property Reply : TSNMPRec read FReply;
property Busy : Boolean read FBusy;
property ResponseValue : String read FResponseValue;
property ResponseValueType : Integer read FResponseValueType;
property ResponseOID : String read FResponseOID;
// CurrentID is incremented just before sending the request
property CurrentID : Integer read FCurrentID;
published
property Version : Integer read FVersion
write FVersion;
property Community : AnsiString read FCommunity
write FCommunity;
property Port : String read FPort
write FPort;
property Addr : String read FAddr
write FAddr;
property HostIP : String read FHostIP
write FHostIP;
property Timeout : Integer read FTimeout
write FTimeout;
property OID : String read FOID
write FOID;
property OnRequestDone : TRequestDoneEvent read FOnRequestDone
write FOnRequestDone;
end;
function UnicodeIntoAnsiToString(const S : AnsiString) : String;
var
GDisplayProc : procedure (Sender : TObject;
const Msg : String) of object = nil;
const
SNMP_TIMEOUT = 20300;
implementation
{ TSnmpCli }
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
constructor TSnmpCli.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
AllocateHWnd;
FWSocket := TDebugWSocket.Create(Self);
FPort := '4000';
FAddr := '0.0.0.0';
FQuery := TSNMPRec.Create;
FReply := TSNMPRec.Create;
FTimeoutTimer := TTimer.Create(Self);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
destructor TSnmpCli.Destroy;
begin
FreeAndNil(FWSocket);
FreeAndNil(FQuery);
FreeAndNil(FReply);
FreeAndNil(FTimeoutTimer);
inherited Destroy;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.Display(const Msg: String);
begin
if Assigned(GDisplayProc) then
GDisplayProc(Self, Msg);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.AllocateMsgHandlers;
begin
inherited AllocateMsgHandlers;
FMsg_WM_LISTENING := FWndHandler.AllocateMsgHandler(Self);
FMsg_WM_GETNEXT := FWndHandler.AllocateMsgHandler(Self);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.FreeMsgHandlers;
begin
if Assigned(FWndHandler) then begin
FWndHandler.UnregisterMessage(FMsg_WM_LISTENING);
FWndHandler.UnregisterMessage(FMsg_WM_GETNEXT);
end;
inherited FreeMsgHandlers;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TSnmpCli.MsgHandlersCount: Integer;
begin
Result := 2 + inherited MsgHandlersCount;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.WndProc(var MsgRec: TMessage);
begin
try
with MsgRec do begin
if Msg = FMsg_WM_LISTENING then
WMListening(MsgRec)
else if Msg = FMsg_WM_GETNEXT then
WMGetNext(MsgRec)
else
inherited WndProc(MsgRec);
end;
except
on E:Exception do
HandleBackGroundException(E);
end;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.WMListening(var Msg: TMessage);
var
Buffer : AnsiString;
begin
Buffer := FQuery.EncodeBuf;
ZeroMemory(@FDestAddr, SizeOf(FDestAddr));
FDestAddr.sin_family := AF_INET;
FDestAddr.sin_addr.S_addr := WSocket_inet_addr(AnsiString(Trim(FHostIP)));
FDestAddr.sin_port := WSocket_htons(StrToInt(cSnmpProtocol));
{$IFDEF SNMP_BUILTIN_TIMEOUT}
FWSocket.TimeoutIdle := FTimeout;
FWSocket.TimeoutSampling := 1000;
FWSocket.TimeoutStartSampling;
{$ELSE}
FTimeoutTimer.Interval := FTimeout;
FTimeoutTimer.Enabled := TRUE;
{$ENDIF}
FWSocket.SendTo(FDestAddr, SizeOf(FDestAddr),
PAnsiChar(Buffer), Length(Buffer));
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.TriggerRequestDone(
ReqType : TSnmpCliReq;
var Action : TSnmpCliAct;
ErrCode : Word);
begin
if Assigned(FOnRequestDone) then
FOnRequestDone(Self, ReqType, Action, ErrCode);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TSnmpCli.SendTo : Boolean;
begin
if FBusy then
raise Exception.Create('SNMP component is busy');
FReqType := srqGet;
Result := InternalSendTo;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TSnmpCli.InternalSendTo : Boolean;
begin
Result := FALSE;
FBusy := TRUE;
try
Inc(FCurrentID);
if FCurrentID = MAXINT then // Wrap around to avoid overflow !
FCurrentID := 1;
Query.ID := FCurrentID;
Query.Version := Version;
Query.Community := Community;
FResponseValue := '';
if FWSocket.State in [wsConnected, wsListening] then
FWSocket.Close;
FReply.Clear;
FWSocket.OnDataAvailable := WSocketDataAvailable;
{$IFDEF SNMP_BUILTIN_TIMEOUT}
FWSocket.OnTimeout := WSocketTimeout;
{$ELSE}
FTimeoutTimer.OnTimer := TimeoutTimerTimer;
{$ENDIF}
FWSocket.Proto := 'udp';
FWSocket.Port := FPort;
FWSocket.Addr := FAddr;
FWSocket.Listen;
Sleep(0);
PostMessage(Handle, FMsg_WM_LISTENING, 0, 0);
Result := TRUE;
except
FWSocket.Abort;
FBusy := FALSE;
end;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{$IFDEF SNMP_BUILTIN_TIMEOUT}
procedure TSnmpCli.WSocketTimeout(Sender : TObject; Reason : TTimeoutReason);
begin
FWSocket.Abort;
FBusy := FALSE;
TriggerRequestDone(SNMP_TIMEOUT);
end;
{$ELSE}
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.TimeoutTimerTimer(Sender: TObject);
var
Action : TSnmpCliAct;
begin
FTimeoutTimer.Enabled := FALSE;
FWSocket.Abort;
FBusy := FALSE;
Action := sacNone; // Here it is not used
TriggerRequestDone(FReqType, Action, SNMP_TIMEOUT);
end;
{$ENDIF}
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.WSocketDataAvailable(Sender : TObject; ErrCode : Word);
var
Src : TSockAddrIn;
SrcLen : Integer;
Buffer : AnsiString;
Len : Integer;
Action : TSnmpCliAct;
begin
Action := sacNone;
if ErrCode <> 0 then begin
FWSocket.Abort;
FResponseValue := 'Error #' + IntToStr(ErrCode);
end
else begin
SetLength(Buffer, 1024 * 16);
SrcLen := SizeOf(Src);
ZeroMemory(@Src, SrcLen);
Len := FWSocket.ReceiveFrom(PAnsiChar(Buffer), Length(Buffer),
Src, SrcLen);
if Len <= 0 then begin
Display('DataAvailable Len=-1');
Exit;
end;
// Reply must come from SNMP port
if WSocket_ntohs(Src.sin_port) <> StrToInt(cSnmpProtocol) then
Exit;
// Reply must come from our destination
if Src.sin_addr.S_addr <> FDestAddr.sin_addr.S_addr then
Exit;
// Answer is from our destination on SNMP port, process it
SetLength(Buffer, Len);
if not FReply.DecodeBuf(Buffer) then
raise Exception.Create('Error decoding reply');
// Reply ID must match query ID
if FReply.ID <> FQuery.ID then begin
Display('SNMP reply ID (' + IntToStr(FReply.ID) +
' do not match query ID (' + IntToStr(FQuery.ID) +
', ignoring');
Exit;
end;
if FReply.PDUType <> PDUGetResponse then begin
Display('Unexpected reply PDU type ' +
IntToStr(Freply.PDUType));
Exit;
end;
FTimeoutTimer.Enabled := FALSE;
if FReqType = srqGet then begin
FResponseOID := FOID;
FResponseValue := UnicodeIntoAnsiToString(
FReply.MIBGet(AnsiString(Trim(FOID))));
FResponseValueType := TSNMPMib(Reply.SNMPMibList[0]).ValueType;
end
else if FReqType = srqGetNext then begin
if Reply.SNMPMibList.Count > 0 then begin
FResponseOID := String(TSNMPMib(Reply.SNMPMibList[0]).OID);
if Pos(FBaseOID, FResponseOID) = 1 then begin
FResponseValue := UnicodeIntoAnsiToString(TSNMPMib(Reply.SNMPMibList[0]).Value);
FResponseValueType := TSNMPMib(Reply.SNMPMibList[0]).ValueType;
Action := sacContinue;
TriggerRequestDone(FReqType, Action, ErrCode);
if Action <> sacContinue then
FBusy := FALSE
else
PostMessage(Handle, FMsg_WM_GETNEXT, 0, 0);
Exit;
end;
end
else begin
FResponseOID := '';
FResponseValue := '';
FResponseValueType := ASN1_NULL;
end;
end
else
raise Exception.Create('Unexcepted ReqType');
end;
{$IFDEF SNMP_BUILTIN_TIMEOUT}
FWSocket.TimeoutStopSampling;
{$ELSE}
FTimeoutTimer.Enabled := FALSE;
{$ENDIF}
FBusy := FALSE;
TriggerRequestDone(FReqType, Action, ErrCode);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.Abort;
begin
FWSocket.Abort;
FBusy := FALSE;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
{ TDebugWSocket }
function TDebugWSocket.TriggerDataAvailable(Error: Word): Boolean;
begin
// if Assigned(GDisplayProc) then
// GDisplayProc('TriggerDataAvailable');
Result := inherited TriggerDataAvailable(Error);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
// This function tries to discover we have unicode characters into an
// ansistring and convert to string
function UnicodeIntoAnsiToString(const S : AnsiString) : String;
var
Len, I, J : Integer;
begin
// If the length is not even, then it can't be a unicode (UTF-16) string
Len := Length(S);
if (Len and 1) <> 0 then begin
Result := String(S);
Exit;
end;
I := 2;
J := Len div 4;
while (I <= Len) and (J >= 0) do begin
if S[I] = #0 then
Dec(J);
Inc(I, 2);
end;
if J < 0 then begin
// Enough #à, consider it is already unicode
SetLength(Result, Len div 2);
Move(PAnsiChar(S)^, PChar(Result)^, Len);
end
else
Result := String(S); // Consider it is AnsiString
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TSnmpCli.Get: Boolean;
begin
if FBusy then
raise Exception.Create('SNMP component is busy');
Query.Clear;
Query.PDUType := PDUGetRequest;
Query.MIBAdd(AnsiString(OID), '', ASN1_NULL);
FReqType := srqGet;
Result := InternalSendTo;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TSnmpCli.GetNext: Boolean;
begin
if FBusy then
raise Exception.Create('SNMP component is busy');
FBaseOID := OID;
FResponseOID := FBaseOID;
Result := InternalGetNext(FResponseOID);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
function TSnmpCli.InternalGetNext(const OID : String) : Boolean;
begin
Query.Clear;
Query.PDUType := PDUGetNextRequest;
// remove all MIBs already insert, we will insert our own
while Query.MIBCount > 0 do
Query.MIBDelete(0);
Query.MIBAdd(AnsiString(OID), '', ASN1_NULL);
FReqType := srqGetNext;
Result := InternalSendTo;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSnmpCli.WMGetNext(var Msg: TMessage);
begin
InternalGetNext(FResponseOID);
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
end.
|
unit BaiduMapAPI.LocationService.iOS;
//author:Xubzhlin
//Email:371889755@qq.com
//百度地图API 定位服务 单元
//官方链接:http://lbsyun.baidu.com/
//TiOSBaiduMapLocationService 百度地图 iOS定位服务
interface
uses
System.Classes, FMX.Maps, Macapi.ObjectiveC, Macapi.ObjCRuntime, iOSapi.CoreLocation,
iOSapi.Foundation, iOSapi.BaiduMapAPI_Base, iOSapi.BaiduMapAPI_Location, BaiduMapAPI.LocationService;
type
TiOSBaiduMapLocationService = class;
TBMKLocationServiceDelegate = class(TOCLocal, BMKLocationServiceDelegate)
private
[Weak] FLocationService: TiOSBaiduMapLocationService;
public
constructor Create(const LocationService: TiOSBaiduMapLocationService);
procedure willStartLocatingUser; cdecl;
procedure didStopLocatingUser; cdecl;
procedure didUpdateUserHeading(userLocation: BMKUserLocation); cdecl;
procedure didUpdateBMKUserLocation(userLocation: BMKUserLocation); cdecl;
procedure didFailToLocateUserWithError(error: NSError); cdecl;
end;
TiOSBaiduMapLocationService = class(TBaiduMapLocationService)
private
FLocationService:BMKLocationService;
FLocationDelegate:TBMKLocationServiceDelegate;
protected
procedure DoInitLocation; override;
procedure DoStarLocation; override;
procedure DoStopLocation; override;
public
constructor Create; override;
destructor Destroy; override;
end;
implementation
{ TiOSBaiduMapLocationService }
constructor TiOSBaiduMapLocationService.Create;
begin
inherited;
FLocationService:=TBMKLocationService.Wrap(TBMKLocationService.Alloc.init);
FLocationService.retain;
FLocationDelegate:=TBMKLocationServiceDelegate.Create(Self);
FLocationService.setDelegate(FLocationDelegate.GetObjectID);
end;
destructor TiOSBaiduMapLocationService.Destroy;
begin
inherited;
end;
procedure TiOSBaiduMapLocationService.DoInitLocation;
begin
// inherited;
//
//
// LocationParam:=TBMKLocationViewDisplayParam.Wrap(TBMKLocationViewDisplayParam.Alloc.init);
// if (LocationParam<>nil) then
// begin
// LocationParam.setIsRotateAngleValid(IsRotateAngleValid);
// LocationParam.setLocationViewImgName(StrToNSStr(LocationViewImgName));
// //TiOSBaiduMapView(Control.BaiduMapView).FMapView.updateLocationViewWithParam(LocationParam);
// end;
end;
procedure TiOSBaiduMapLocationService.DoStarLocation;
begin
FLocationService.startUserLocationService;
end;
procedure TiOSBaiduMapLocationService.DoStopLocation;
begin
FLocationService.stopUserLocationService;
end;
{ TBMKLocationServiceDelegate }
constructor TBMKLocationServiceDelegate.Create(
const LocationService: TiOSBaiduMapLocationService);
begin
inherited Create;
FLocationService:=LocationService;
end;
procedure TBMKLocationServiceDelegate.didFailToLocateUserWithError(
error: NSError);
begin
end;
procedure TBMKLocationServiceDelegate.didStopLocatingUser;
begin
end;
procedure TBMKLocationServiceDelegate.didUpdateBMKUserLocation(
userLocation: BMKUserLocation);
var
Coordinate:TMapCoordinate;
begin
//位置更新
if FLocationService<>nil then
begin
Coordinate:= TMapCoordinate(userLocation.location.coordinate);
FLocationService.UserLocationWillChanged(Coordinate);
end;
end;
procedure TBMKLocationServiceDelegate.didUpdateUserHeading(
userLocation: BMKUserLocation);
var
Coordinate:TMapCoordinate;
begin
//位置更新
if FLocationService<>nil then
begin
Coordinate:= TMapCoordinate(userLocation.location.coordinate);
FLocationService.UserLocationWillChanged(Coordinate);
end;
end;
procedure TBMKLocationServiceDelegate.willStartLocatingUser;
begin
end;
end.
|
unit exec_external;
interface
Uses Classes;
Function ExecApplication(CommandLine,Dir:String;Lines:TStrings):Boolean;
implementation
uses Windows, SysUtils,Forms;
Function ExecApplication;
const
ReadBuffer = 2000;
Var
Security : TSecurityAttributes;
StartUpInfo:TStartupInfo;
ProcInfo:TProcessInformation;
ErrNo,I,NumRead:Integer;
Msg:PChar;
E: Exception;
Buffer : Pchar;
ReadPipe,WritePipe:THandle;
BytesRead,Apprunning:DWord;
BufDone,CharCollect:String;
ClearFlag:Boolean;
Return:Cardinal;
begin
Result:=False;
FillChar(StartUpInfo, SizeOf(StartUpInfo), 0);
StartUpInfo.cb := SizeOf(StartUpInfo);
FillChar(Security,SizeOf(Security),0);
With Security do begin
nlength := SizeOf(TSecurityAttributes) ;
binherithandle := true;
end;
if not Createpipe (ReadPipe, WritePipe, @Security, 0) then
RaiseLastOSError;
try
Buffer := AllocMem(ReadBuffer + 1) ;
StartUpInfo.hStdOutput := WritePipe;
StartUpInfo.hStdError := WritePipe;
StartUpInfo.hStdInput := ReadPipe;
StartUpInfo.dwFlags := STARTF_USESTDHANDLES +
STARTF_USESHOWWINDOW;
StartUpInfo.wShowWindow := SW_HIDE;
ClearFlag:=False;
if CreateProcess(Nil,PChar(CommandLine),@Security,@Security,True,CREATE_NEW_CONSOLE ,Nil,PChar(Dir),StartUpInfo,ProcInfo) then
begin
try
repeat
Apprunning := WaitForSingleObject
(ProcInfo.hProcess,Infinite) ;
Application.ProcessMessages;
if Lines<>Nil then
Repeat
PeekNamedPipe(ReadPipe, nil, 0, nil,
@NumRead, nil);
if NumRead > 0 then
Begin
BytesRead := 0;
ReadFile(ReadPipe,Buffer[0], ReadBuffer,BytesRead,nil) ;
Buffer[BytesRead]:= #0;
OemToAnsi(Buffer,Buffer);
BufDone:=String(Buffer);
OemToChar(PChar(BufDone),PChar(BufDone));
I:=1;
While I< Length(BufDone) do
Begin
if BufDone[I]=#13 then
ClearFlag:=true
else if BufDone[I]=#10 then
Lines.Add('')
else
Begin
if ClearFlag then Lines[Lines.Count-1]:='';
ClearFlag:=False;
CharCollect:=BufDone[I];
While (I< Length(BufDone)) and not (BufDone[I+1] in [#10,#13]) do
Begin
CharCollect:=CharCollect+BufDone[I+1];
Inc(I);
end;
Lines[Lines.Count-1]:=Lines[Lines.Count-1] + CharCollect;
end;
Inc(I);
end;
end;
until (BytesRead < ReadBuffer);
until (Apprunning <> WAIT_TIMEOUT) ;
// WaitForSingleObject(ProcInfo.hProcess,
// INFINITE);
GetExitCodeProcess(procInfo.hProcess, return);
Result := (return = 0);
finally
CloseHandle(ProcInfo.hThread);
CloseHandle(ProcInfo.hProcess);
end;
end
else
begin
ErrNo := GetLastError;
Msg := AllocMem(4096);
try
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
nil,
ErrNo,
0,
Msg,
4096,
nil);
E := Exception.Create('Create Process Error #'
+ IntToStr(ErrNo)
+ ': '
+ string(Msg));
finally
FreeMem(Msg);
end;
raise E;
end;
finally
CloseHandle(ReadPipe);
CloseHandle(WritePipe);
end;
end;
end.
|
unit ModCalcLex;
interface
type
symbol = (numberSy,
plusSy, minusSy,
mulSy, divSy,
leftParSy, rightParSy,
eofSy, noSy);
var
curSy : symbol;
numVal : integer; (* number value for semantic analysis *)
procedure newSy;
procedure initCalcLex(inFileName : string);
implementation
const EOF_CH = chr(26);
TAB_CH = chr(9);
var
inFile : text;
line : string;
curChPos : integer;
curCh : char;
procedure newCh; forward;
procedure initCalcLex(inFileName : string);
begin
assign(inFile, inFileName);
reset(inFile);
readLn(inFile, line);
curChPos := 0;
NewCh;
end;
procedure newSy;
begin
(* skip whitespace *)
while (curCh = ' ') or (curCh = TAB_CH) do newCh;
case curCh of
'+': begin curSy := plusSy; newCh; end;
'-': begin curSy := minusSy; newCh; end;
'*': begin curSy := mulSy; newCh; end;
'/': begin curSy := divSy; newCh; end;
'(': begin curSy := leftParSy; newCh; end;
')': begin curSy := rightParSy; newCh; end;
EOF_CH: begin curSy := eofSy; newCh; end;
'0'..'9': begin
(* read a number *)
numVal := Ord(curCh) - Ord('0'); (* value of digit*)
newCh;
while (curCh > '0') and (curCh <= '9') do begin
numVal := numVal * 10 + Ord(curCh) - Ord('0');
newCh;
end;
curSy := numberSy;
end;
else begin curSy := noSy; newCh; end; (* default case *)
end; (* case *)
end;
procedure newCh;
begin
if curChPos < length(line) then begin
inc(curChPos);
curCh := line[curChPos]
end else
curCh := EOF_CH;
end;
begin
end.
|
unit GenericExampleShortcutUnit;
interface
uses SysUtils, BaseExampleUnit, IConnectionUnit;
type
TGenericExampleShortcut = class(TBaseExample)
public
procedure Execute(Connection: IConnection);
end;
implementation
uses Route4MeManagerUnit, DataObjectUnit, RouteParametersQueryUnit;
procedure TGenericExampleShortcut.Execute(Connection: IConnection);
var
ErrorMessage: String;
Routes: TDataObjectRouteList;
Route: TDataObjectRoute;
Route4Me: TRoute4MeManager;
Limit, Offset: integer;
begin
Route4Me := TRoute4MeManager.Create(Connection);
try
Limit := 10;
Offset := 5;
Routes := Route4Me.Route.GetList(Limit, Offset, ErrorMessage);
try
if (Routes <> nil) and (Routes.Count > 0) then
begin
WriteLn(Format(
'GenericExampleShortcut executed successfully, %d routes returned',
[Routes.Count]));
WriteLn('');
for Route in Routes do
WriteLn(Format('RouteID: %s', [Route.RouteId]));
end
else
WriteLn(Format('GenericExampleShortcut error "%s"', [ErrorMessage]));
finally
FreeAndNil(Routes);
end;
finally
FreeAndNil(Route4Me);
end;
end;
end.
|
unit uLogon;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Variants,
Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, JvExStdCtrls, JvCombobox, DB,
ZAbstractRODataset, ZDataset, JvExControls, JvNavigationPane, frxpngimage,
JvExExtCtrls, JvImage, JvBevel, JvXPCore, JvXPButtons, cxGraphics, cxControls,
cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit, cxTextEdit, cxMaskEdit,
cxDropDownEdit, cxImageComboBox, JvBaseDlg, JvDesktopAlert, dxGDIPlusClasses,
Menus, cxButtons, jpeg, JvEdit, JvComponentBase, JvFormPlacement,
cxCheckBox;
type
TfrmLogon = class(TForm)
Panel1: TPanel;
lbl2: TLabel;
Label5: TLabel;
Label6: TLabel;
lbVersao: TLabel;
cbEmpresa: TcxImageComboBox;
JvDesktopAlert1: TJvDesktopAlert;
Bevel1: TBevel;
JvImage3: TJvImage;
JvImage1: TJvImage;
edUsu: TJvEdit;
edSenha: TJvEdit;
btOk: TBitBtn;
JvImage2: TJvImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
JvFormStorage1: TJvFormStorage;
ckUsuario: TcxCheckBox;
procedure edUsuChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure edSenhaChange(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure Label5Click(Sender: TObject);
procedure CapsLock;
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormActivate(Sender: TObject);
procedure cbEmpresaEnter(Sender: TObject);
procedure JvImage1Click(Sender: TObject);
procedure edSenhaKeyPress(Sender: TObject; var Key: Char);
procedure edUsuKeyPress(Sender: TObject; var Key: Char);
procedure FormShow(Sender: TObject);
procedure btOk2Click(Sender: TObject);
private
{ Private declarations }
tries: integer;
ok: Boolean;
procedure VeEmpresa;
public
{ Public declarations }
cod_usuario: Integer;
usuario: string;
admin: Boolean;
end;
var
frmLogon: TfrmLogon;
const
UserAdm = 'ADMINISTRADOR';
PwdAdm = 'ADM#RWA9';
UserSuporte = 'SUPORTE';
PwdSuporte = 'SUP@RWA5';
implementation
uses udmPrincipal, funcoes;
{$R *.DFM}
procedure TfrmLogon.edUsuChange(Sender: TObject);
begin
edSenha.Enabled := edUsu.Text <> EmptyStr;
cbEmpresa.Enabled := edUsu.Text <> EmptyStr;
end;
procedure TfrmLogon.FormCreate(Sender: TObject);
begin
tries := 0;
ok := False;
Label6.Caption := '';
JvDesktopAlert1.HeaderText := 'Bem vindo ao RWA Sistema';
JvDesktopAlert1.MessageText := 'Versão do Sistema: ' + VersaoExe(Application.ExeName);
JvDesktopAlert1.Execute;
end;
procedure TfrmLogon.edSenhaChange(Sender: TObject);
begin
btOk.Enabled := (edSenha.Text <> EmptyStr) and (cbEmpresa.ItemIndex >= 0);
end;
procedure TfrmLogon.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
procedure TfrmLogon.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
CanClose := ok;
end;
procedure TfrmLogon.VeEmpresa;
var
qrTemp: TZReadOnlyQuery;
begin
qrTemp := TZReadOnlyQuery.Create(nil);
try
qrTemp.Connection := dmPrincipal.Database;
qrTemp.Close;
qrTemp.SQL.Clear;
qrTemp.SQL.Add('select codigo from usuarios where login=:pLogin');
if ((edUsu.Text = UserAdm) and (AnsiLowerCase(edSenha.Text) = AnsiLowerCase(PwdAdm))) or
((edUsu.Text = UserSuporte) and (AnsiLowerCase(edSenha.Text) = AnsiLowerCase(PwdSuporte))) then
qrTemp.SQL.Add('or 1=1');
qrTemp.ParamByName('pLogin').Value := edUsu.Text;
qrTemp.Open;
if not qrTemp.IsEmpty then
begin
CarregaCombo(cbEmpresa, 'select codigo,fantasia from empresas_usuarios a left join empresas b on a.emp_codigo=b.codigo where not isnull(b.codigo) and usu_codigo=' + qrTemp.Fields[0].AsString + ' order by fantasia');
cbEmpresa.ItemIndex := 0;
if cbEmpresa.Properties.Items.Count > 1 then
keybd_event(VK_F4, 0, 0, 0);
end;
finally
qrTemp.Free;
end;
end;
procedure TfrmLogon.Label5Click(Sender: TObject);
begin
LinkTo('www.rwa.com.br');
end;
procedure TfrmLogon.CapsLock;
begin
if getkeystate(VK_CAPITAL) = 1 then
Label6.Caption := 'A tecla Caps Lock está ativada'
else
Label6.Caption := '';
end;
procedure TfrmLogon.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_CAPITAL then
CapsLock;
end;
procedure TfrmLogon.FormActivate(Sender: TObject);
begin
CapsLock;
lbVersao.Caption := VersaoExe(Application.ExeName);
end;
procedure TfrmLogon.cbEmpresaEnter(Sender: TObject);
begin
VeEmpresa;
edSenhaChange(Sender);
end;
procedure TfrmLogon.JvImage1Click(Sender: TObject);
begin
if MessageBox(Handle, PChar('Você realmente deseja sair do RWA Sistema?'), 'Atenção', MB_ICONINFORMATION + MB_YESNO + MB_DEFBUTTON2) = IDYES then
Application.Terminate;
end;
procedure TfrmLogon.edSenhaKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
key := #0;
if cbEmpresa.CanFocus then
cbEmpresa.SetFocus;
end;
end;
procedure TfrmLogon.edUsuKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
key := #0;
if edSenha.CanFocus then
edSenha.SetFocus;
end;
end;
procedure TfrmLogon.FormShow(Sender: TObject);
begin
if ckUsuario.Checked then
begin
if StringEmBranco(edUsu.Text) then
begin
if edUsu.CanFocus then
edUsu.SetFocus;
end
else
begin
if edSenha.CanFocus then
edSenha.SetFocus;
end;
end
else
begin
edUsu.Text := '';
if edUsu.CanFocus then
edUsu.SetFocus;
end;
end;
procedure TfrmLogon.btOk2Click(Sender: TObject);
begin
if (edUsu.Text = UserAdm) and (AnsiLowerCase(edSenha.Text) = AnsiLowerCase(PwdAdm)) then
begin
cod_usuario := 9999;
usuario := 'ADMINISTRADOR DO SISTEMA';
admin := True;
ok := True;
Self.Tag := 1;
if cbEmpresa.ItemIndex = -1 then
begin
MessageBox(handle, 'Nenhuma Empresa Selecionada!', 'Inconsistência', mb_ok + mb_IconError);
if cbEmpresa.CanFocus then
cbEmpresa.SetFocus;
ok := False;
Exit;
end;
dmPrincipal.VeDadosEmpresa(cbEmpresa.Properties.Items.Items[cbEmpresa.ItemIndex].Value);
dmPrincipal.usuario := UserAdm;
dmPrincipal.NomeUsuario := usuario;
Exit;
end;
if (edUsu.Text = UserSuporte) and (AnsiLowerCase(edSenha.Text) = AnsiLowerCase(PwdSuporte)) then
begin
cod_usuario := 9990;
usuario := 'SUPORTE RWA';
admin := True;
ok := True;
Self.Tag := 1;
if cbEmpresa.ItemIndex = -1 then
begin
MessageBox(handle, 'Nenhuma Empresa Selecionada!', 'Inconsistência', mb_ok + mb_IconError);
if cbEmpresa.CanFocus then
cbEmpresa.SetFocus;
ok := False;
Exit;
end;
dmPrincipal.VeDadosEmpresa(cbEmpresa.Properties.Items.Items[cbEmpresa.ItemIndex].Value);
dmPrincipal.usuario := UserSuporte;
dmPrincipal.NomeUsuario := usuario;
Exit;
end;
with dmPrincipal.datasetAux do
begin
Close;
sql.Clear;
SQL.Add('select * from usuarios where login=:pLogin and senha=sha1(:pSenha)');
ParamByName('pLogin').AsString := edUsu.Text;
ParamByName('pSenha').AsString := edSenha.Text;
try
Open;
if RecordCount > 0 then
begin
cod_usuario := fieldbyname('codigo').AsInteger;
usuario := fieldbyname('nome_completo').AsString;
admin := fieldbyname('admin').AsString = 'S';
ok := True;
Self.Tag := 1;
dmPrincipal.usuario := edUsu.Text;
dmPrincipal.NomeUsuario := usuario;
if cbEmpresa.ItemIndex = -1 then
begin
MessageBox(handle, 'Nenhuma Empresa Selecionada!', 'Inconsistência', mb_ok + mb_IconError);
if cbEmpresa.CanFocus then
cbEmpresa.SetFocus;
ok := False;
Exit;
end;
dmPrincipal.VeDadosEmpresa(cbEmpresa.Properties.Items.Items[cbEmpresa.ItemIndex].Value);
end
else
begin
tries := tries + 1;
if tries > 3 then
begin
MessageBox(Handle, 'Você atigiu o número máximo de tentativas', 'Controle de Acesso', 16);
ok := True;
Exit;
end;
MessageBox(Handle, 'Falha na autenticação. Verifique sua senha.', 'Controle de Acesso', MB_ICONERROR);
edSenha.Clear;
edSenha.SetFocus;
end;
finally
Close;
end;
end;
end;
end.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.