From a79fa86ed589c3d843baa932230ef08bc7468296 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Fri, 13 Jul 2012 12:05:09 +0000 Subject: partial code beautifier (through Pascal Analizer) git-svn-id: http://svn.miranda-ng.org/main/trunk@947 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HistoryPlusPlus/Checksum.pas | 13 +- plugins/HistoryPlusPlus/CustomizeFiltersForm.dfm | 2 +- plugins/HistoryPlusPlus/CustomizeFiltersForm.pas | 6 +- plugins/HistoryPlusPlus/CustomizeToolbar.dfm | 2 +- plugins/HistoryPlusPlus/CustomizeToolbar.pas | 5 +- plugins/HistoryPlusPlus/EmptyHistoryForm.pas | 9 +- plugins/HistoryPlusPlus/EventDetailForm.dfm | 2 +- plugins/HistoryPlusPlus/EventDetailForm.pas | 10 +- plugins/HistoryPlusPlus/GlobalSearch.pas | 19 +-- plugins/HistoryPlusPlus/HistoryForm.pas | 19 +-- plugins/HistoryPlusPlus/HistoryGrid.pas | 9 +- plugins/HistoryPlusPlus/PassCheckForm.pas | 5 +- plugins/HistoryPlusPlus/PassForm.pas | 17 +-- plugins/HistoryPlusPlus/PassNewForm.pas | 5 +- plugins/HistoryPlusPlus/historypp.dpr | 6 +- plugins/HistoryPlusPlus/hpp_arrays.pas | 4 +- plugins/HistoryPlusPlus/hpp_bookmarks.pas | 16 +-- plugins/HistoryPlusPlus/hpp_contacts.pas | 13 +- plugins/HistoryPlusPlus/hpp_database.pas | 37 +++--- plugins/HistoryPlusPlus/hpp_events.pas | 6 +- plugins/HistoryPlusPlus/hpp_external.pas | 11 +- plugins/HistoryPlusPlus/hpp_externalgrid.pas | 16 +-- plugins/HistoryPlusPlus/hpp_forms.pas | 11 +- plugins/HistoryPlusPlus/hpp_global.pas | 36 +++--- plugins/HistoryPlusPlus/hpp_itemprocess.pas | 29 +++-- plugins/HistoryPlusPlus/hpp_messages.pas | 4 +- plugins/HistoryPlusPlus/hpp_opt_dialog.pas | 31 ++--- plugins/HistoryPlusPlus/hpp_options.pas | 144 ++++++++++++++++------- plugins/HistoryPlusPlus/hpp_richedit.pas | 9 +- plugins/HistoryPlusPlus/hpp_searchthread.pas | 20 ++-- plugins/HistoryPlusPlus/hpp_services.pas | 5 +- 31 files changed, 311 insertions(+), 210 deletions(-) (limited to 'plugins/HistoryPlusPlus') diff --git a/plugins/HistoryPlusPlus/Checksum.pas b/plugins/HistoryPlusPlus/Checksum.pas index dab601641a..47ab3245c9 100644 --- a/plugins/HistoryPlusPlus/Checksum.pas +++ b/plugins/HistoryPlusPlus/Checksum.pas @@ -38,20 +38,20 @@ unit Checksum; interface -uses SysUtils, Windows, Base64; +uses windows; type TDig64 = array[0..1] of DWord; function DigToBase(Digest: TDig64): AnsiString; -function BaseToDig(Str: AnsiString): TDig64; +function BaseToDig(const Str: AnsiString): TDig64; //function StrToDig(Str: AnsiString): TDig64; function DigToStr(Digest: TDig64): AnsiString; function SameDigest(Dig1,Dig2: TDig64): Boolean; procedure CalcCRC32(Data: Pointer; DataSize: DWord; var CRCValue: DWord); //function CRC32(CRC: DWord; Data: Pointer; DataSize: DWord): LongWord; assembler; //function CRC32a(CRC: DWord; Data: Pointer; DataSize: DWord): DWord; -function HashString(Str: AnsiString): TDig64; +function HashString(const Str: AnsiString): TDig64; procedure CalcSampleHash(const Data: Pointer; DataSize: Integer; var Digest: TDig64); var @@ -59,6 +59,9 @@ var implementation +uses + SysUtils, Base64; + const DIGEST_DIV = '-'; const @@ -74,7 +77,7 @@ begin Result := Base64EncodeStr(DigStr); end; -function BaseToDig(Str: AnsiString): TDig64; +function BaseToDig(const Str: AnsiString): TDig64; var DigStr: AnsiString; begin @@ -82,7 +85,7 @@ begin Move(DigStr[1], Result, SizeOf(Result)); end; -function HashString(Str: AnsiString): TDig64; +function HashString(const Str: AnsiString): TDig64; begin Result := ZeroDig; Result[0] := InitCRC; diff --git a/plugins/HistoryPlusPlus/CustomizeFiltersForm.dfm b/plugins/HistoryPlusPlus/CustomizeFiltersForm.dfm index 32a113ef61..b9a3235317 100644 --- a/plugins/HistoryPlusPlus/CustomizeFiltersForm.dfm +++ b/plugins/HistoryPlusPlus/CustomizeFiltersForm.dfm @@ -60,7 +60,7 @@ object fmCustomizeFilters: TfmCustomizeFilters Width = 131 Height = 25 Anchors = [akRight, akBottom] - Caption = 'R&eset to Default' + Caption = '&Reset to Default' TabOrder = 4 OnClick = bnResetClick end diff --git a/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas b/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas index bb49c9db46..fdfda0597a 100644 --- a/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas +++ b/plugins/HistoryPlusPlus/CustomizeFiltersForm.pas @@ -27,7 +27,7 @@ uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,Dialogs, HistoryControls,m_api, StdCtrls, CheckLst, - hpp_global, hpp_events, hpp_eventfilters, ExtCtrls; + hpp_eventfilters, ExtCtrls; type TfmCustomizeFilters = class(TForm) @@ -102,7 +102,9 @@ var implementation -uses hpp_forms, HistoryForm, hpp_options, TypInfo, Math, GlobalSearch; +uses + hpp_forms, hpp_global, hpp_events, HistoryForm, {hpp_options,} + TypInfo, Math, GlobalSearch; const // commented to use all events in system history diff --git a/plugins/HistoryPlusPlus/CustomizeToolbar.dfm b/plugins/HistoryPlusPlus/CustomizeToolbar.dfm index 625a20409e..5b8cda215f 100644 --- a/plugins/HistoryPlusPlus/CustomizeToolbar.dfm +++ b/plugins/HistoryPlusPlus/CustomizeToolbar.dfm @@ -137,7 +137,7 @@ object fmCustomizeToolbar: TfmCustomizeToolbar end object bnReset: TButton Left = 380 - Top = 331 + Top = 330 Width = 130 Height = 25 Anchors = [akRight, akBottom] diff --git a/plugins/HistoryPlusPlus/CustomizeToolbar.pas b/plugins/HistoryPlusPlus/CustomizeToolbar.pas index 9637ac0706..3294a99d32 100644 --- a/plugins/HistoryPlusPlus/CustomizeToolbar.pas +++ b/plugins/HistoryPlusPlus/CustomizeToolbar.pas @@ -26,8 +26,7 @@ interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Dialogs, CommCtrl, Forms, ComCtrls, StdCtrls, ExtCtrls, CheckLst, Buttons, - hpp_global, HistoryControls, - m_api, hpp_forms; + hpp_global, m_api; type TfmCustomizeToolbar = class(TForm) @@ -90,7 +89,7 @@ var implementation -uses HistoryForm, hpp_database, hpp_options; +uses HistoryForm, hpp_database, hpp_options, HistoryControls, hpp_forms; {$R *.dfm} diff --git a/plugins/HistoryPlusPlus/EmptyHistoryForm.pas b/plugins/HistoryPlusPlus/EmptyHistoryForm.pas index 1895cc6bf1..699e88df51 100644 --- a/plugins/HistoryPlusPlus/EmptyHistoryForm.pas +++ b/plugins/HistoryPlusPlus/EmptyHistoryForm.pas @@ -47,9 +47,7 @@ interface uses Windows, Classes, Controls, Graphics, Forms, Buttons, StdCtrls, ExtCtrls, - HistoryControls, - PassForm, PassCheckForm, - hpp_global, hpp_forms, hpp_contacts, hpp_database, hpp_bookmarks, +// HistoryControls, m_api; type @@ -84,7 +82,10 @@ type implementation -uses Math, SysUtils, HistoryForm; +uses + Math, SysUtils, HistoryForm, + PassForm, {PassCheckForm,} + hpp_global, hpp_forms, hpp_contacts, hpp_database, hpp_bookmarks; {$R *.dfm} diff --git a/plugins/HistoryPlusPlus/EventDetailForm.dfm b/plugins/HistoryPlusPlus/EventDetailForm.dfm index 4a19c20cfa..a64ae89bdd 100644 --- a/plugins/HistoryPlusPlus/EventDetailForm.dfm +++ b/plugins/HistoryPlusPlus/EventDetailForm.dfm @@ -269,7 +269,7 @@ object EventDetailsFrm: TEventDetailsFrm Caption = '-' end object CopyText: TMenuItem - Caption = '&Copy' + Caption = 'Co&py' ShortCut = 16451 OnClick = CopyTextClick end diff --git a/plugins/HistoryPlusPlus/EventDetailForm.pas b/plugins/HistoryPlusPlus/EventDetailForm.pas index 9b7a793cec..de49670700 100644 --- a/plugins/HistoryPlusPlus/EventDetailForm.pas +++ b/plugins/HistoryPlusPlus/EventDetailForm.pas @@ -53,9 +53,9 @@ interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, - HistoryGrid, HistoryForm, - m_api, hpp_messages, - hpp_global, hpp_contacts, hpp_events, hpp_forms, hpp_richedit, + HistoryForm, + m_api, + hpp_global, hpp_richedit, ComCtrls, Menus, RichEdit, Buttons, HistoryControls, ShellAPI; @@ -170,7 +170,9 @@ var implementation -uses hpp_database, hpp_options, hpp_services; +uses + HistoryGrid, hpp_messages, hpp_contacts, hpp_events, hpp_forms, + {hpp_database,} hpp_options, hpp_services; {$R *.DFM} { TForm1 } diff --git a/plugins/HistoryPlusPlus/GlobalSearch.pas b/plugins/HistoryPlusPlus/GlobalSearch.pas index 83d878289e..b0018f2d0d 100644 --- a/plugins/HistoryPlusPlus/GlobalSearch.pas +++ b/plugins/HistoryPlusPlus/GlobalSearch.pas @@ -59,10 +59,10 @@ uses StdCtrls, ExtCtrls, ComCtrls, Menus, HistoryGrid, m_api, - hpp_global, hpp_events, hpp_services, hpp_contacts, hpp_database, hpp_searchthread, - hpp_eventfilters, hpp_bookmarks, hpp_richedit, RichEdit, + hpp_global, hpp_searchthread, + RichEdit, ImgList, HistoryControls, Buttons, Math, CommCtrl, - Contnrs, hpp_forms, ToolWin, ShellAPI; + Contnrs, ToolWin, ShellAPI; const HM_SRCH_CONTACTICONCHANGED = HM_SRCH_BASE + 3; @@ -215,7 +215,7 @@ type procedure edSearchChange(Sender: TObject); procedure hgKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure hgState(Sender: TObject; State: TGridState); - procedure hgSearchFinished(Sender: TObject; Text: String; Found: Boolean); + procedure hgSearchFinished(Sender: TObject; const Text: String; Found: Boolean); procedure hgSearchItem(Sender: TObject; Item, ID: Integer; var Found: Boolean); // procedure FormHide(Sender: TObject); procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; @@ -234,7 +234,7 @@ type procedure hgProcessRichText(Sender: TObject; Handle: Cardinal; Item: Integer); procedure FormShow(Sender: TObject); procedure hgKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); - procedure hgUrlClick(Sender: TObject; Item: Integer; URLText: String; Button: TMouseButton); + procedure hgUrlClick(Sender: TObject; Item: Integer; const URLText: String; Button: TMouseButton); procedure edPassKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure hgSelect(Sender: TObject; Item, OldItem: Integer); @@ -394,7 +394,10 @@ var implementation -uses hpp_options, PassForm, hpp_itemprocess, hpp_messages, CustomizeFiltersForm; +uses + hpp_options, PassForm, hpp_itemprocess, hpp_messages, CustomizeFiltersForm, + hpp_database, hpp_eventfilters, hpp_contacts, hpp_events, hpp_richedit, + hpp_forms, hpp_services, hpp_bookmarks; {$R *.DFM} @@ -2049,7 +2052,7 @@ begin // Name := Name + ' [' + BookmarkServer[si.Contact.Handle].BookmarkName[si.hDBEvent] + ']'; end; -procedure TfmGlobalSearch.hgUrlClick(Sender: TObject; Item: Integer; URLText: String; +procedure TfmGlobalSearch.hgUrlClick(Sender: TObject; Item: Integer; const URLText: String; Button: TMouseButton); begin if URLText = '' then @@ -2228,7 +2231,7 @@ begin end; end; -procedure TfmGlobalSearch.hgSearchFinished(Sender: TObject; Text: String; Found: Boolean); +procedure TfmGlobalSearch.hgSearchFinished(Sender: TObject; const Text: String; Found: Boolean); var t: String; begin diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas index 37dce5cd06..34618dd40b 100644 --- a/plugins/HistoryPlusPlus/HistoryForm.pas +++ b/plugins/HistoryPlusPlus/HistoryForm.pas @@ -67,9 +67,8 @@ uses Windows, Messages, SysUtils, Classes, RichEdit, Graphics, Controls, Forms, Dialogs, Buttons, StdCtrls, Menus, ComCtrls, ExtCtrls, m_api, - hpp_global, hpp_database, hpp_messages, hpp_events, hpp_contacts, hpp_itemprocess, - hpp_bookmarks, hpp_forms, hpp_richedit, hpp_sessionsthread, - HistoryGrid, Checksum, DateUtils, + hpp_global, hpp_sessionsthread, + HistoryGrid, DateUtils, ImgList, HistoryControls, CommCtrl, ToolWin, ShellAPI, Themes; type @@ -261,7 +260,7 @@ type procedure hgTranslateTime(Sender: TObject; Time: Cardinal; var Text: String); procedure hgPopup(Sender: TObject); - procedure hgSearchFinished(Sender: TObject; Text: String; Found: Boolean); + procedure hgSearchFinished(Sender: TObject; const Text: String; Found: Boolean); procedure hgDblClick(Sender: TObject); procedure tbSaveClick(Sender: TObject); procedure hgItemDelete(Sender: TObject; Index: Integer); @@ -280,7 +279,7 @@ type procedure edPassKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure edPassKeyPress(Sender: TObject; var Key: Char); procedure CopyText1Click(Sender: TObject); - procedure hgUrlClick(Sender: TObject; Item: Integer; URLText: String; Button: TMouseButton); + procedure hgUrlClick(Sender: TObject; Item: Integer; const URLText: String; Button: TMouseButton); procedure hgProcessRichText(Sender: TObject; Handle: THandle; Item: Integer); procedure hgSearchItem(Sender: TObject; Item, ID: Integer; var Found: Boolean); procedure hgKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); @@ -470,8 +469,10 @@ const implementation -uses EventDetailForm, PassForm, hpp_options, hpp_services, hpp_eventfilters, - CustomizeFiltersForm, CustomizeToolbar; +uses + EventDetailForm, PassForm, hpp_options, hpp_services, hpp_eventfilters, + hpp_database, hpp_contacts, hpp_itemprocess, hpp_events, hpp_forms, hpp_richedit, + hpp_messages, hpp_bookmarks, Checksum, CustomizeFiltersForm, CustomizeToolbar; {$R *.DFM} @@ -1731,7 +1732,7 @@ begin end; end; -procedure THistoryFrm.hgSearchFinished(Sender: TObject; Text: String; Found: Boolean); +procedure THistoryFrm.hgSearchFinished(Sender: TObject; const Text: String; Found: Boolean); var t: String; begin @@ -3068,7 +3069,7 @@ begin end; end; -procedure THistoryFrm.hgUrlClick(Sender: TObject; Item: Integer; URLText: String; Button: TMouseButton); +procedure THistoryFrm.hgUrlClick(Sender: TObject; Item: Integer; const URLText: String; Button: TMouseButton); begin if URLText = '' then Exit; diff --git a/plugins/HistoryPlusPlus/HistoryGrid.pas b/plugins/HistoryPlusPlus/HistoryGrid.pas index 254c65b0aa..b6fd436690 100644 --- a/plugins/HistoryPlusPlus/HistoryGrid.pas +++ b/plugins/HistoryPlusPlus/HistoryGrid.pas @@ -83,8 +83,7 @@ uses Menus, StrUtils, WideStrUtils, StdCtrls, Math, mmsystem, - hpp_global, hpp_contacts, hpp_itemprocess, hpp_events, hpp_eventfilters, - hpp_richedit, hpp_olesmileys, m_api, + hpp_global, hpp_richedit, m_api, Contnrs, VertSB, RichEdit, ShellAPI; @@ -807,6 +806,7 @@ implementation uses hpp_options, hpp_arrays, hpp_strparser, + hpp_contacts, hpp_itemprocess, hpp_events, hpp_eventfilters, hpp_olesmileys, ComObj; type @@ -902,7 +902,7 @@ end; procedure Register; begin - RegisterComponents('History++', [THistoryGrid]); + RegisterComponents(hppName, [THistoryGrid]); end; { THistoryGrid } @@ -3613,7 +3613,7 @@ begin {$ENDIF} MaxSBPos := Count - 1; exit; - + //!!!!! if SumHeight < ClientHeight then begin idx := GetPrev(GetIdx(Count)); @@ -4438,7 +4438,6 @@ begin end; const - BT_BACKSPACE = #8; // #9 -- TAB // #13 -- ENTER // #27 -- ESC diff --git a/plugins/HistoryPlusPlus/PassCheckForm.pas b/plugins/HistoryPlusPlus/PassCheckForm.pas index d90e1054ff..8b9dd8b55c 100644 --- a/plugins/HistoryPlusPlus/PassCheckForm.pas +++ b/plugins/HistoryPlusPlus/PassCheckForm.pas @@ -25,8 +25,7 @@ interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, Checksum, ExtCtrls,m_api, hpp_forms, - HistoryControls; + StdCtrls, ExtCtrls, {Checksum, HistoryControls, }m_api; type TfmPassCheck = class(TForm) @@ -57,7 +56,7 @@ var implementation -uses hpp_options, hpp_services, hpp_global, PassForm; +uses hpp_options, hpp_services, hpp_forms, hpp_global, PassForm; {$R *.DFM} diff --git a/plugins/HistoryPlusPlus/PassForm.pas b/plugins/HistoryPlusPlus/PassForm.pas index 299a5a6959..9de9e6ef63 100644 --- a/plugins/HistoryPlusPlus/PassForm.pas +++ b/plugins/HistoryPlusPlus/PassForm.pas @@ -25,9 +25,8 @@ interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - ComCtrls, Menus, Checksum, ExtCtrls, StdCtrls, - m_api, - hpp_global, hpp_contacts, hpp_database, hpp_forms; + ComCtrls, Menus, ExtCtrls, StdCtrls, + m_api; type TfmPass = class(TForm) @@ -77,15 +76,17 @@ const function ReadPassModeFromDB: Byte; function GetPassMode: Byte; function GetPassword: AnsiString; -function IsPasswordBlank(Password: AnsiString): Boolean; +function IsPasswordBlank(const Password: AnsiString): Boolean; function IsUserProtected(hContact: THandle): Boolean; -function CheckPassword(Pass: AnsiString): Boolean; +function CheckPassword(const Pass: AnsiString): Boolean; procedure RunPassForm; implementation -uses PassNewForm, hpp_options, hpp_services, PassCheckForm; +uses + PassNewForm, hpp_options, hpp_services, PassCheckForm, + Checksum, hpp_global, hpp_contacts, hpp_database, hpp_forms; {$R *.DFM} @@ -116,7 +117,7 @@ begin end; end; -function CheckPassword(Pass: AnsiString): Boolean; +function CheckPassword(const Pass: AnsiString): Boolean; begin Result := (DigToBase(HashString(Pass)) = GetPassword); end; @@ -133,7 +134,7 @@ begin if IsPasswordBlank(GetPassword) then; end; -function IsPasswordBlank(Password: AnsiString): Boolean; +function IsPasswordBlank(const Password: AnsiString): Boolean; begin Result := (Password = DigToBase(HashString(''))); end; diff --git a/plugins/HistoryPlusPlus/PassNewForm.pas b/plugins/HistoryPlusPlus/PassNewForm.pas index 03d08723a6..59cc801cfe 100644 --- a/plugins/HistoryPlusPlus/PassNewForm.pas +++ b/plugins/HistoryPlusPlus/PassNewForm.pas @@ -25,7 +25,7 @@ interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, ExtCtrls,m_api, HistoryControls, hpp_forms; + StdCtrls, ExtCtrls, m_api{, HistoryControls}; type TfmPassNew = class(TForm) @@ -55,7 +55,8 @@ var implementation -uses hpp_global, hpp_options; +uses + {hpp_global, }hpp_forms, hpp_options; {$R *.DFM} diff --git a/plugins/HistoryPlusPlus/historypp.dpr b/plugins/HistoryPlusPlus/historypp.dpr index 105f212769..ecbcd05108 100644 --- a/plugins/HistoryPlusPlus/historypp.dpr +++ b/plugins/HistoryPlusPlus/historypp.dpr @@ -32,6 +32,7 @@ library historypp; uses Windows, SysUtils, + CommCtrl, m_api, Forms, hpp_global in 'hpp_global.pas', @@ -360,12 +361,11 @@ begin begin ZeroMemory(@ttb,SizeOf(ttb)); ttb.cbSize := SizeOf(ttb); - ttb.hIconUp := hppIcons[HPP_ICON_GLOBALSEARCH].handle; - ttb.pszService := MS_HPP_SHOWGLOBALSEARCH; ttb.dwFlags := TTBBF_VISIBLE or TTBBF_SHOWTOOLTIP; - ttb.name := ttb.pszTooltipUp := PAnsiChar(Translate('Global History Search')); + ttb.name := PAnsiChar(Translate('Global History Search')); + ttb.pszTooltipUp := ttb.name; CallService(MS_TTB_ADDBUTTON,WPARAM(@ttb), 0); UnhookEvent(HookTTBLoaded); end; diff --git a/plugins/HistoryPlusPlus/hpp_arrays.pas b/plugins/HistoryPlusPlus/hpp_arrays.pas index f564fa9805..c11060ad04 100644 --- a/plugins/HistoryPlusPlus/hpp_arrays.pas +++ b/plugins/HistoryPlusPlus/hpp_arrays.pas @@ -23,7 +23,7 @@ unit hpp_arrays; interface -uses hpp_jclSysUtils, hpp_global; +uses hpp_global; function IntSortedArray_Add(var A: TIntArray; Value: Integer): Integer; procedure IntSortedArray_Remove(var A: TIntArray; Value: Integer); @@ -36,6 +36,8 @@ procedure IntArrayInsert(var A: TIntArray; Index: Integer; Value: Integer); implementation +uses hpp_jclSysUtils; + procedure IntArrayRemove(var A: TIntArray; Index: Integer); var i: Integer; diff --git a/plugins/HistoryPlusPlus/hpp_bookmarks.pas b/plugins/HistoryPlusPlus/hpp_bookmarks.pas index a98f2a381a..7db2328e91 100644 --- a/plugins/HistoryPlusPlus/hpp_bookmarks.pas +++ b/plugins/HistoryPlusPlus/hpp_bookmarks.pas @@ -49,7 +49,7 @@ unit hpp_bookmarks; interface -uses windows, m_api, hpp_jclSysUtils, SysUtils; +uses windows, m_api; type TEventData = record @@ -125,7 +125,7 @@ type // function GetBookmark(hDBEvent: THandle; var EventData: TEventData): Boolean; function AddItem(hDBEvent: THandle): Boolean; function RemoveItem(hDBEvent: THandle): Boolean; - function AddItemName(hDBEvent: THandle; Value: String): Boolean; + function AddItemName(hDBEvent: THandle; const Value: String): Boolean; function GetItemName(hDBEvent: THandle): String; function RemoveItemName(hDBEvent: THandle): Boolean; function FindEventByTimestampAndCrc(ped: PEventData): Boolean; @@ -162,7 +162,9 @@ procedure hppDeinitBookmarkServer; implementation -uses hpp_events, hpp_contacts, hpp_global, Checksum, hpp_database, hpp_forms; +uses + SysUtils, + hpp_jclSysUtils, hpp_events, hpp_contacts, hpp_global, Checksum, hpp_database, hpp_forms; procedure hppInitBookmarkServer; begin @@ -301,7 +303,7 @@ var mem_org: Pointer; mem_len: Integer; rec_size: Word; - count: Integer; + rec_count: Integer; ed: PEventData; AllOk: Boolean; begin @@ -314,9 +316,9 @@ begin rec_size := PWord(mem_org)^; if rec_size < SizeOf(TEventData) then raise EAbort.Create('Bookmark size is too small'); - Count := (mem_len - SizeOf(Word)) div rec_size; + rec_count := (mem_len - SizeOf(Word)) div rec_size; mem := pointer(uint_ptr(mem_org) + SizeOf(Word)); - for i := 0 to Count - 1 do + for i := 0 to rec_count - 1 do begin ed := PEventData(int_ptr(mem) + i * rec_size); if not Bookmarks.AddEventData(ed^) then @@ -557,7 +559,7 @@ begin Result := AddKey(hDBEvent,ped); end; -function TBookmarksHash.AddItemName(hDBEvent: THandle; Value: String): Boolean; +function TBookmarksHash.AddItemName(hDBEvent: THandle; const Value: String): Boolean; begin Result := (WriteDBWideStr(Contact.hContact,hppDBName,AnsiString('bm'+intToStr(hDBEvent)),Value) = 0); end; diff --git a/plugins/HistoryPlusPlus/hpp_contacts.pas b/plugins/HistoryPlusPlus/hpp_contacts.pas index 32d938224e..6b40943ae1 100644 --- a/plugins/HistoryPlusPlus/hpp_contacts.pas +++ b/plugins/HistoryPlusPlus/hpp_contacts.pas @@ -48,15 +48,14 @@ interface uses Windows, SysUtils, Forms, - hpp_global, - hpp_database; + hpp_global; function GetContactDisplayName(hContact: THandle; Proto: AnsiString = ''; Contact: boolean = false): String; function GetContactProto(hContact: THandle): AnsiString; overload; function GetContactProto(hContact: THandle; var SubContact: THandle; var SubProtocol: AnsiString): AnsiString; overload; function GetContactID(hContact: THandle; Proto: AnsiString = ''; Contact: boolean = false): AnsiString; -function GetContactCodePage(hContact: THandle; Proto: AnsiString = ''): Cardinal; overload; -function GetContactCodePage(hContact: THandle; Proto: AnsiString; var UsedDefault: boolean): Cardinal; overload; +function GetContactCodePage(hContact: THandle; const Proto: AnsiString = ''): Cardinal; overload; +function GetContactCodePage(hContact: THandle; const Proto: AnsiString; var UsedDefault: boolean): Cardinal; overload; function WriteContactCodePage(hContact: THandle; CodePage: Cardinal; Proto: AnsiString = ''): boolean; function GetContactRTLMode(hContact: THandle; Proto: AnsiString = ''): boolean; function GetContactRTLModeTRTL(hContact: THandle; Proto: AnsiString = ''): TRTLMode; @@ -64,7 +63,7 @@ function WriteContactRTLMode(hContact: THandle; RTLMode: TRTLMode; Proto: AnsiSt implementation -uses hpp_options, m_api; +uses hpp_database, hpp_options, m_api; function GetContactProto(hContact: THandle): AnsiString; begin @@ -195,14 +194,14 @@ begin end; end; -function GetContactCodePage(hContact: THandle; Proto: AnsiString = ''): Cardinal; +function GetContactCodePage(hContact: THandle; const Proto: AnsiString = ''): Cardinal; var def: boolean; begin Result := _GetContactCodePage(hContact, Proto, def); end; -function GetContactCodePage(hContact: THandle; Proto: AnsiString; var UsedDefault: boolean): Cardinal; overload; +function GetContactCodePage(hContact: THandle; const Proto: AnsiString; var UsedDefault: boolean): Cardinal; overload; begin Result := _GetContactCodePage(hContact, Proto, UsedDefault); end; diff --git a/plugins/HistoryPlusPlus/hpp_database.pas b/plugins/HistoryPlusPlus/hpp_database.pas index 79c0c456aa..483e5c553d 100644 --- a/plugins/HistoryPlusPlus/hpp_database.pas +++ b/plugins/HistoryPlusPlus/hpp_database.pas @@ -46,7 +46,7 @@ unit hpp_database; interface -uses m_api, windows, hpp_global; +uses m_api, windows; procedure SetSafetyMode(Safe: Boolean); @@ -61,10 +61,10 @@ function DBExists(const hContact: THandle; const Module, Param: AnsiString): Boo function GetDBBlob(const Module,Param: AnsiString; var Value: Pointer; var Size: Integer): Boolean; overload; function GetDBBlob(const hContact: THandle; const Module,Param: AnsiString; var Value: Pointer; var Size: Integer): Boolean; overload; -function GetDBStr(const Module,Param: AnsiString; Default: AnsiString): AnsiString; overload; -function GetDBStr(const hContact: THandle; const Module,Param: AnsiString; Default: AnsiString): AnsiString; overload; -function GetDBWideStr(const Module,Param: AnsiString; Default: WideString): WideString; overload; -function GetDBWideStr(const hContact: THandle; const Module,Param: AnsiString; Default: WideString): WideString; overload; +function GetDBStr(const Module,Param: AnsiString; const Default: AnsiString): AnsiString; overload; +function GetDBStr(const hContact: THandle; const Module,Param: AnsiString; const Default: AnsiString): AnsiString; overload; +function GetDBWideStr(const Module,Param: AnsiString; const Default: WideString): WideString; overload; +function GetDBWideStr(const hContact: THandle; const Module,Param: AnsiString; const Default: WideString): WideString; overload; function GetDBInt(const Module,Param: AnsiString; Default: Integer): Integer; overload; function GetDBInt(const hContact: THandle; const Module,Param: AnsiString; Default: Integer): Integer; overload; function GetDBWord(const Module,Param: AnsiString; Default: Word): Word; overload; @@ -88,10 +88,10 @@ function WriteDBDWord(const Module,Param: AnsiString; Value: DWord): Integer; ov function WriteDBDWord(const hContact: THandle; const Module,Param: AnsiString; Value: DWord): Integer; overload; function WriteDBInt(const Module,Param: AnsiString; Value: Integer): Integer; overload; function WriteDBInt(const hContact: THandle; const Module,Param: AnsiString; Value: Integer): Integer; overload; -function WriteDBStr(const Module,Param: AnsiString; Value: AnsiString): Integer; overload; -function WriteDBStr(const hContact: THandle; const Module,Param: AnsiString; Value: AnsiString): Integer; overload; -function WriteDBWideStr(const Module,Param: AnsiString; Value: WideString): Integer; overload; -function WriteDBWideStr(const hContact: THandle; const Module,Param: AnsiString; Value: WideString): Integer; overload; +function WriteDBStr(const Module,Param: AnsiString; const Value: AnsiString): Integer; overload; +function WriteDBStr(const hContact: THandle; const Module,Param: AnsiString; const Value: AnsiString): Integer; overload; +function WriteDBWideStr(const Module,Param: AnsiString; const Value: WideString): Integer; overload; +function WriteDBWideStr(const hContact: THandle; const Module,Param: AnsiString; const Value: WideString): Integer; overload; function WriteDBBool(const Module,Param: AnsiString; Value: Boolean): Integer; overload; function WriteDBBool(const hContact: THandle; const Module,Param: AnsiString; Value: Boolean): Integer; overload; function WriteDBDateTime(const hContact: THandle; const Module,Param: AnsiString; Value: TDateTime): Integer; overload; @@ -99,6 +99,9 @@ function WriteDBDateTime(const Module,Param: AnsiString; Value: TDateTime): Inte implementation +uses + hpp_global; + procedure SetSafetyMode(Safe: Boolean); begin CallService(MS_DB_SETSAFETYMODE,WPARAM(Safe),0); @@ -188,22 +191,22 @@ begin Result := CallService(MS_DB_CONTACT_WRITESETTING, hContact, lParam(@cws)); end; -function WriteDBStr(const Module,Param: AnsiString; Value: AnsiString): Integer; +function WriteDBStr(const Module,Param: AnsiString; const Value: AnsiString): Integer; begin Result := WriteDBStr(0,Module,Param,Value); end; -function WriteDBStr(const hContact: THandle; const Module,Param: AnsiString; Value: AnsiString): Integer; +function WriteDBStr(const hContact: THandle; const Module,Param: AnsiString; const Value: AnsiString): Integer; begin Result := DBWriteContactSettingString(hContact,PAnsiChar(Module),PAnsiChar(Param),PAnsiChar(Value)); end; -function WriteDBWideStr(const Module,Param: AnsiString; Value: WideString): Integer; +function WriteDBWideStr(const Module,Param: AnsiString; const Value: WideString): Integer; begin Result := WriteDBWideStr(0,Module,Param,Value); end; -function WriteDBWideStr(const hContact: THandle; const Module,Param: AnsiString; Value: WideString): Integer; +function WriteDBWideStr(const hContact: THandle; const Module,Param: AnsiString; const Value: WideString): Integer; begin Result := DBWriteContactSettingWideString(hContact,PAnsiChar(Module),PAnsiChar(Param),PWideChar(Value)); end; @@ -338,12 +341,12 @@ begin Result:=dbv.dval; end; -function GetDBStr(const Module,Param: AnsiString; Default: AnsiString): AnsiString; +function GetDBStr(const Module,Param: AnsiString; const Default: AnsiString): AnsiString; begin Result := GetDBStr(0,Module,Param,Default); end; -function GetDBStr(const hContact: THandle; const Module,Param: AnsiString; Default: AnsiString): AnsiString; +function GetDBStr(const hContact: THandle; const Module,Param: AnsiString; const Default: AnsiString): AnsiString; begin Result := DBGetContactSettingString(hContact,PAnsiChar(Module),PAnsiChar(Param),PAnsiChar(Default)); end; @@ -375,12 +378,12 @@ begin end; end; -function GetDBWideStr(const Module,Param: AnsiString; Default: WideString): WideString; +function GetDBWideStr(const Module,Param: AnsiString; const Default: WideString): WideString; begin Result := GetDBWideStr(0,Module,Param,Default); end; -function GetDBWideStr(const hContact: THandle; const Module,Param: AnsiString; Default: WideString): WideString; +function GetDBWideStr(const hContact: THandle; const Module,Param: AnsiString; const Default: WideString): WideString; begin Result := DBGetContactSettingWideString(hContact,PAnsiChar(Module),PAnsiChar(Param),PWideChar(Default)); end; diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas index c980a78bcc..80eefab2bf 100644 --- a/plugins/HistoryPlusPlus/hpp_events.pas +++ b/plugins/HistoryPlusPlus/hpp_events.pas @@ -54,7 +54,7 @@ interface uses Windows, SysUtils, m_api, - hpp_global, hpp_contacts; + hpp_global; type PEventRecord = ^TEventRecord; @@ -142,7 +142,7 @@ procedure GetEventTextForOther(EventInfo: TDBEventInfo; var Hi: THistoryItem); implementation uses - hpp_options; + hpp_contacts, hpp_options; {$include m_music.inc} @@ -871,7 +871,7 @@ begin end; end; -function GetEventTextForICQSystem(EventInfo: TDBEventInfo; Template: String): String; +function GetEventTextForICQSystem(EventInfo: TDBEventInfo; const Template: String): String; var BytePos: LongWord; Body: AnsiString; diff --git a/plugins/HistoryPlusPlus/hpp_external.pas b/plugins/HistoryPlusPlus/hpp_external.pas index 3f941a30bc..475bd20426 100644 --- a/plugins/HistoryPlusPlus/hpp_external.pas +++ b/plugins/HistoryPlusPlus/hpp_external.pas @@ -26,7 +26,7 @@ interface uses Classes, Windows, m_api, - hpp_global, hpp_database, hpp_externalgrid; + hpp_externalgrid; type TExternalGrids = class(TObject) @@ -52,8 +52,6 @@ const ME_HPP_EG_OPTIONSCHANGED = 'History++/ExtGrid/OptionsChanged'; var - hExtWindowIE, hExtEventIE, hExtNavigateIE, hExtOptChangedIE: THandle; - hExtWindow, hExtEvent, hExtNavigate, hExtOptChanged: THandle; ImitateIEView: boolean; ExternalGrids: TExternalGrids; @@ -62,8 +60,15 @@ procedure UnregisterExtGridServices; implementation +uses + hpp_global, hpp_database; + {$include m_ieview.inc} +var + hExtWindowIE, hExtEventIE, hExtNavigateIE, hExtOptChangedIE: THandle; + hExtWindow, hExtEvent, hExtNavigate, hExtOptChanged: THandle; + function _ExtWindow(wParam:WPARAM; lParam: LPARAM; GridMode: TExGridMode): int_ptr; var par: PIEVIEWWINDOW; diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas index 0694cf0788..eedf8920eb 100644 --- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas +++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas @@ -26,10 +26,7 @@ interface uses Windows, Classes, Controls, Forms, Graphics, Messages, SysUtils, Dialogs, m_api, - hpp_global, hpp_events, hpp_contacts, hpp_services, hpp_forms, hpp_bookmarks, - hpp_richedit, hpp_messages, hpp_eventfilters, hpp_database, hpp_itemprocess, - HistoryGrid, - RichEdit, Menus, ShellAPI; + hpp_global, HistoryGrid, RichEdit, Menus, ShellAPI; type TExGridMode = (gmNative, gmIEView); @@ -148,8 +145,8 @@ type constructor Create(AParentWindow: HWND; ControlID: Cardinal = 0); destructor Destroy; override; procedure AddEvent(hContact, hDBEvent: THandle; Codepage: Integer; RTL: Boolean; DoScroll: Boolean); - procedure AddCustomEvent(hContact: THandle; CustomItem: TExtCustomItem; Codepage: Integer; - RTL: Boolean; DoScroll: Boolean); + procedure AddCustomEvent(hContact: THandle; const CustomItem: TExtCustomItem; + Codepage: Integer; RTL: Boolean; DoScroll: Boolean); procedure SetPosition(x, y, cx, cy: Integer); procedure ScrollToBottom; function GetSelection(NoUnicode: Boolean): PAnsiChar; @@ -176,7 +173,10 @@ type implementation -uses hpp_options, hpp_sessionsthread; +uses + hpp_richedit, hpp_database, hpp_contacts, hpp_eventfilters, hpp_itemprocess, + hpp_events, hpp_services, hpp_forms, hpp_bookmarks, hpp_messages, + hpp_options, hpp_sessionsthread; {$include m_speak.inc} @@ -308,7 +308,7 @@ begin Grid.Allocate(Length(Items), DoScroll and (Grid.State <> gsInline)); end; -procedure TExternalGrid.AddCustomEvent(hContact: THandle; CustomItem: TExtCustomItem; +procedure TExternalGrid.AddCustomEvent(hContact: THandle; const CustomItem: TExtCustomItem; Codepage: Integer; RTL: Boolean; DoScroll: Boolean); var RTLMode: TRTLMode; diff --git a/plugins/HistoryPlusPlus/hpp_forms.pas b/plugins/HistoryPlusPlus/hpp_forms.pas index 12c23c879a..8d4803c984 100644 --- a/plugins/HistoryPlusPlus/hpp_forms.pas +++ b/plugins/HistoryPlusPlus/hpp_forms.pas @@ -51,12 +51,13 @@ procedure TranslateToolbar(const tb: TToolBar); function ShiftStateToKeyData(ShiftState :TShiftState):Longint; function IsFormShortCut(List: Array of TComponent; Key: Word; ShiftState: TShiftState): Boolean; -function Utils_RestoreFormPosition(Form: TForm; hContact: THandle; Module,Prefix: AnsiString): Boolean; -function Utils_SaveFormPosition(Form: TForm; hContact: THandle; Module,Prefix: AnsiString): Boolean; +function Utils_RestoreFormPosition(Form: TForm; hContact: THandle; const Module,Prefix: AnsiString): Boolean; +function Utils_SaveFormPosition(Form: TForm; hContact: THandle; const Module,Prefix: AnsiString): Boolean; implementation -uses hpp_global, hpp_services, hpp_opt_dialog, hpp_database, hpp_mescatcher, +uses + hpp_services, hpp_opt_dialog, hpp_database, hpp_mescatcher, HistoryForm, GlobalSearch, m_api, {$IFNDEF NO_EXTERNALGRID}hpp_external,{$ENDIF} CustomizeFiltersForm, CustomizeToolbar; @@ -138,7 +139,7 @@ begin if ssAlt in ShiftState then Result := Result or AltMask; end; -function Utils_RestoreFormPosition(Form: TForm; hContact: THandle; Module,Prefix: AnsiString): Boolean; +function Utils_RestoreFormPosition(Form: TForm; hContact: THandle; const Module,Prefix: AnsiString): Boolean; var w,h,l,t,mon: Integer; maximized: Boolean; @@ -164,7 +165,7 @@ begin if maximized then Form.WindowState := wsMaximized; end; -function Utils_SaveFormPosition(Form: TForm; hContact: THandle; Module,Prefix: AnsiString): Boolean; +function Utils_SaveFormPosition(Form: TForm; hContact: THandle; const Module,Prefix: AnsiString): Boolean; var w,h,l,t: Integer; wp: TWindowPlacement; diff --git a/plugins/HistoryPlusPlus/hpp_global.pas b/plugins/HistoryPlusPlus/hpp_global.pas index cf6de81b39..2da3ce2e67 100644 --- a/plugins/HistoryPlusPlus/hpp_global.pas +++ b/plugins/HistoryPlusPlus/hpp_global.pas @@ -112,7 +112,7 @@ type end; const - HM_BASE = WM_APP + 10214; // base for all history++ messages + HM_BASE = WM_APP + 10214; // (+$27E6) base for all history++ messages HM_HIST_BASE = HM_BASE + 100; // base for contact's history specific messages HM_SRCH_BASE = HM_BASE + 200; // base for global search specific messages HM_SESS_BASE = HM_BASE + 300; // base for session thread specific messages @@ -120,6 +120,10 @@ const HM_NOTF_BASE = HM_BASE + 500; // base for plugin-wide notification messages HM_MIEV_BASE = HM_BASE + 600; // base for miranda event messages + // HistoryGrid messages: + HM_HG_OPTIONS = HM_BASE + 1; // HistoryGrid options changed. wParam - HGOPT_* flags + HM_HG_CACHEUPDATE = HM_BASE + 2; // Need to update RichItem cache element. lParam - RichItem? + // notification messages: HM_NOTF_ICONSCHANGED = HM_NOTF_BASE + 1; // Skin icons has changed HM_NOTF_ICONS2CHANGED = HM_NOTF_BASE + 2; // IcoLib icons has changed @@ -137,7 +141,13 @@ const HM_MIEV_METADEFCHANGED = HM_MIEV_BASE + 5; // ME_MC_DEFAULTTCHANGED const + // History Grid options flags + HGOPT_TEMPLATES = $0001; // templates, datetime format + HGOPT_FONTSERVICE = $0002; // fonts, colors + HGOPT_ITEMS = $0004; // close to HGOPT_FONTSERVICE + HGOPT_OPTIONS = $0008; // inline,RTL, externals,bbcodes +const hppName = 'History++'; hppShortName = 'History++ (2in1)'; hppShortNameV = hppShortName{$IFDEF ALPHA}+' [alpha '+{$I 'alpha.inc'}+']'{$ENDIF}; @@ -189,7 +199,6 @@ const (cp: 1361; lid: $0412; name: 'Korean (Johab)')); const - HPP_ICON_CONTACTHISTORY = 0; HPP_ICON_GLOBALSEARCH = 1; HPP_ICON_SESS_DIVIDER = 2; @@ -277,25 +286,22 @@ var function AnsiToWideString(const S: AnsiString; CodePage: Cardinal; InLength: Integer = -1): WideString; function WideToAnsiString(const WS: WideString; CodePage: Cardinal; InLength: Integer = -1): AnsiString; function TranslateAnsiW(const S: AnsiString{TRANSLATE-IGNORE}): WideString; -function MakeFileName(FileName: String): String; +function MakeFileName(const FileName: String): String; function GetLCIDfromCodepage(Codepage: Cardinal): LCID; procedure CopyToClip(const WideStr: WideString; Handle: Hwnd; CodePage: Cardinal = CP_ACP; Clear: Boolean = True); -function QuoteURL(const URLText: WideString): AnsiString; -function EncodeURL(const Src: String; var Dst: String): Boolean; -procedure OpenUrl(URLText: String; NewWindow: Boolean); +procedure OpenUrl(const URLText: String; NewWindow: Boolean); function HppMessageBox(Handle: THandle; const Text: String; const Caption: String; Flags: Integer): Integer; -function MakeTextXMLedA(Text: AnsiString): AnsiString; -function MakeTextXMLedW(Text: WideString): WideString; -function FormatCString(Text: WideString): WideString; +function MakeTextXMLedA(const Text: AnsiString): AnsiString; +function MakeTextXMLedW(const Text: WideString): WideString; +function FormatCString(const Text: WideString): WideString; function PassMessage(Handle: THandle; Message: DWord; wParam: WPARAM; lParam: LPARAM; Method: TSendMethod = smSend): Boolean; //----- added from TNT ------ function IsRTF(const Value: WideString): Boolean; -function _WideCharType(WC: WideChar; dwInfoType: Cardinal): Word; function IsWideCharUpper(WC: WideChar): Boolean; function IsWideCharLower(WC: WideChar): Boolean; function IsWideCharDigit(WC: WideChar): Boolean; @@ -431,7 +437,7 @@ begin Result := True; end; -procedure OpenUrl(URLText: String; NewWindow: Boolean); +procedure OpenUrl(const URLText: String; NewWindow: Boolean); var URLTextW: String; URLTextA: AnsiString; @@ -517,7 +523,7 @@ This function gets only name of the file and tries to make it FAT-happy, so we trim out and ":"-s, "\"-s and so on... *) -function MakeFileName(FileName: String): String; +function MakeFileName(const FileName: String): String; begin Result := FileName; Result := @@ -631,7 +637,7 @@ begin Result := MessageBox(Handle,PChar(Text),PChar(Caption),Flags); end; -function MakeTextXMLedA(Text: AnsiString): AnsiString; +function MakeTextXMLedA(const Text: AnsiString): AnsiString; begin; Result := Text; Result := AnsiString( @@ -647,7 +653,7 @@ begin; '&','&',[rfReplaceAll])); end; -function MakeTextXMLedW(Text: WideString): WideString; +function MakeTextXMLedW(const Text: WideString): WideString; begin; Result := Text; Result := StringReplace(Result,'&','&',[rfReplaceAll]); @@ -657,7 +663,7 @@ begin; Result := StringReplace(Result,'‘',''',[rfReplaceAll]); end; -function FormatCString(Text: WideString): WideString; +function FormatCString(const Text: WideString): WideString; var inlen,inpos,outpos: integer; begin diff --git a/plugins/HistoryPlusPlus/hpp_itemprocess.pas b/plugins/HistoryPlusPlus/hpp_itemprocess.pas index 8ddb7968e7..137fdd28b0 100644 --- a/plugins/HistoryPlusPlus/hpp_itemprocess.pas +++ b/plugins/HistoryPlusPlus/hpp_itemprocess.pas @@ -59,9 +59,9 @@ uses var rtf_ctable_text: AnsiString; -function DoSupportBBCodesHTML(S: AnsiString): AnsiString; -function DoSupportBBCodesRTF(S: AnsiString; StartColor: integer; doColorBBCodes: boolean): AnsiString; -function DoStripBBCodes(S: String): String; +function DoSupportBBCodesHTML(const S: AnsiString): AnsiString; +function DoSupportBBCodesRTF(const S: AnsiString; StartColor: integer; doColorBBCodes: boolean): AnsiString; +function DoStripBBCodes(const S: String): String; function DoSupportSmileys(awParam:WPARAM; alParam: LPARAM): Integer; function DoSupportMathModule(awParam:WPARAM; alParam: LPARAM): Integer; @@ -145,10 +145,9 @@ const MAX_FMTBUF = 4095; var - i: integer; TextBuffer: THppBuffer; -function GetColorRTF(code: AnsiString; colcount: integer): integer; +function GetColorRTF(const code: AnsiString; colcount: integer): integer; var i: integer; begin @@ -271,7 +270,7 @@ begin end; *) -function DoSupportBBCodesRTF(S: AnsiString; StartColor: integer; doColorBBCodes: boolean): AnsiString; +function DoSupportBBCodesRTF(const S: AnsiString; StartColor: integer; doColorBBCodes: boolean): AnsiString; var bufPos,bufEnd: PAnsiChar; strStart,strTrail: PAnsiChar; @@ -357,7 +356,7 @@ begin TextBuffer.Unlock; end; -function DoSupportBBCodesHTML(S: AnsiString): AnsiString; +function DoSupportBBCodesHTML(const S: AnsiString): AnsiString; var bufPos,bufEnd: PAnsiChar; strStart,strTrail,strCode: PAnsiChar; @@ -409,7 +408,7 @@ begin TextBuffer.Unlock; end; -function DoStripBBCodes(S: String): String; +function DoStripBBCodes(const S: String): String; var WideStream: String; i,spos,epos,cpos,slen: integer; @@ -537,10 +536,10 @@ begin end; end; - -initialization - rtf_ctable_text := ''; - +procedure Filltables; +var + i: integer; +begin for i := 0 to High(rtf_ctable) do begin rtf_ctable_text := rtf_ctable_text + AnsiString(format('\red%d\green%d\blue%d;', @@ -556,6 +555,12 @@ initialization bbCodes[i, bbEnd ].prefix.wide := String(bbCodes[i, bbEnd ].prefix.ansi); bbCodes[i, bbEnd ].suffix.wide := String(bbCodes[i, bbEnd ].suffix.ansi); end; +end; + +initialization + rtf_ctable_text := ''; + + FillTables; TextBuffer := THppBuffer.Create; diff --git a/plugins/HistoryPlusPlus/hpp_messages.pas b/plugins/HistoryPlusPlus/hpp_messages.pas index 96c061c14b..23f5f6bfdb 100644 --- a/plugins/HistoryPlusPlus/hpp_messages.pas +++ b/plugins/HistoryPlusPlus/hpp_messages.pas @@ -49,12 +49,12 @@ interface uses Windows, m_api; -function SendMessageTo(hContact: THandle; Text: String = ''): Boolean; +function SendMessageTo(hContact: THandle; const Text: String = ''): Boolean; //function ForwardMessage(Text: AnsiString): Boolean; implementation -function SendMessageTo(hContact: THandle; Text: String): Boolean; +function SendMessageTo(hContact: THandle; const Text: String): Boolean; var buff: AnsiString; begin diff --git a/plugins/HistoryPlusPlus/hpp_opt_dialog.pas b/plugins/HistoryPlusPlus/hpp_opt_dialog.pas index 6b3c94dee9..87493b00e2 100644 --- a/plugins/HistoryPlusPlus/hpp_opt_dialog.pas +++ b/plugins/HistoryPlusPlus/hpp_opt_dialog.pas @@ -24,14 +24,26 @@ unit hpp_opt_dialog; interface uses - Windows, Messages, CommCtrl, - m_api, - hpp_global, hpp_options, hpp_services - {$IFNDEF NO_EXTERNALGRID}, hpp_external{$ENDIF}; + Windows; const - IDD_OPT_HISTORYPP = 207; // dialog id + IDD_OPT_HISTORYPP = 207; // dialog id + +function OptDialogProc(hwndDlg: HWND; uMsg: UInt; wParam: WPARAM; lParam: LPARAM): lresult; stdcall; + +var + hDlg: HWND = 0; + +implementation + +uses + Messages, CommCtrl, + m_api, + hpp_global, hpp_options, hpp_services, hpp_database + {$IFNDEF NO_EXTERNALGRID}, hpp_external{$ENDIF}, + HistoryForm, GlobalSearch; +const ID_APPEARANCE_GROUP = 100; // "Appearance options" group IDC_SHOWEVENTICONS = 101; // "Show event icons" checkbox IDC_RTLDEFAULT = 102; // "RTL by default" checkbox @@ -63,15 +75,6 @@ const const URL_NEEDOPTIONS = 'http://code.google.com/p/historypp/wiki/AdditionalOptions'; -function OptDialogProc(hwndDlg: HWND; uMsg: UInt; wParam: WPARAM; lParam: LPARAM): lresult; stdcall; - -var - hDlg: HWND = 0; - -implementation - -uses hpp_database, HistoryForm, GlobalSearch; - { function GetText(idCtrl: Integer): AnsiString; var diff --git a/plugins/HistoryPlusPlus/hpp_options.pas b/plugins/HistoryPlusPlus/hpp_options.pas index 0562463c63..67065c3475 100644 --- a/plugins/HistoryPlusPlus/hpp_options.pas +++ b/plugins/HistoryPlusPlus/hpp_options.pas @@ -51,7 +51,7 @@ uses Graphics, SysUtils, Windows, Dialogs, m_api, HistoryGrid, - hpp_global, hpp_contacts, hpp_events, hpp_mescatcher; + hpp_global; type @@ -136,46 +136,96 @@ const ); hppFontItems: array[0..29] of ThppFontsRec = ( - (_type:[hppFont,hppColor]; name: 'Incoming nick'; nameColor: 'Divider'; Mes: []; style:DBFONTF_BOLD; size: -11; color: $6B3FC8; back: clGray), - (_type:[hppFont,hppColor]; name: 'Outgoing nick'; nameColor: 'Selected text'; Mes: []; style:DBFONTF_BOLD; size: -11; color: $BD6008; back: clHighlightText), - (_type:[hppColor]; nameColor: 'Selected background'; Mes: []; back: clHighlight), - (_type:[hppFont,hppColor]; name: 'Incoming message'; Mes: [mtMessage,mtIncoming]; style:0; size: -11; color: $000000; back: $DBDBDB), - (_type:[hppFont,hppColor]; name: 'Outgoing message'; Mes: [mtMessage,mtOutgoing]; style:0; size: -11; color: $000000; back: $EEEEEE), - (_type:[hppFont,hppColor]; name: 'Incoming file'; Mes: [mtFile,mtIncoming]; style:0; size: -11; color: $000000; back: $9BEEE3), - (_type:[hppFont,hppColor]; name: 'Outgoing file'; Mes: [mtFile,mtOutgoing]; style:0; size: -11; color: $000000; back: $9BEEE3), - (_type:[hppFont,hppColor]; name: 'Incoming url'; Mes: [mtUrl,mtIncoming]; style:0; size: -11; color: $000000; back: $F4D9CC), - (_type:[hppFont,hppColor]; name: 'Outgoing url'; Mes: [mtUrl,mtOutgoing]; style:0; size: -11; color: $000000; back: $F4D9CC), - (_type:[hppFont,hppColor]; name: 'Incoming SMS Message'; Mes: [mtSMS,mtIncoming]; style:0; size: -11; color: $000000; back: $CFF4FE), - (_type:[hppFont,hppColor]; name: 'Outgoing SMS Message'; Mes: [mtSMS,mtOutgoing]; style:0; size: -11; color: $000000; back: $CFF4FE), - (_type:[hppFont,hppColor]; name: 'Incoming contacts'; Mes: [mtContacts,mtIncoming]; style:0; size: -11; color: $000000; back: $FEF4CF), - (_type:[hppFont,hppColor]; name: 'Outgoing contacts'; Mes: [mtContacts,mtOutgoing]; style:0; size: -11; color: $000000; back: $FEF4CF), - (_type:[hppFont,hppColor]; name: 'System message'; Mes: [mtSystem,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $CFFEDC), - (_type:[hppFont,hppColor]; name: 'Status changes'; Mes: [mtStatus,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $F0F0F0), - (_type:[hppFont,hppColor]; name: 'SMTP Simple Email'; Mes: [mtSMTPSimple,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), - (_type:[hppFont,hppColor]; name: 'Other events (unknown)'; Mes: [mtOther,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), - (_type:[hppFont,hppColor]; name: 'Conversation header'; Mes: []; style:0; size: -11; color: $000000; back: $00D7FDFF), - (_type:[hppFont,hppColor]; name: 'Nick changes'; Mes: [mtNickChange,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $00D7FDFF), - (_type:[hppFont,hppColor]; name: 'Avatar changes'; Mes: [mtAvatarChange,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $00D7FDFF), - (_type:[hppFont]; name: 'Incoming timestamp'; Mes: []; style:0; size: -11; color: $000000), - (_type:[hppFont]; name: 'Outgoing timestamp'; Mes: []; style:0; size: -11; color: $000000), - (_type:[hppFont,hppColor]; name: 'Grid messages'; nameColor: 'Grid background'; Mes: []; style:0; size: -11; color: $000000; back: $E9EAEB), - (_type:[hppFont,hppColor]; name: 'Incoming WATrack notify'; Mes: [mtWATrack,mtIncoming]; style:0; size: -11; color: $C08000; back: $C8FFFF), - (_type:[hppFont,hppColor]; name: 'Outgoing WATrack notify'; Mes: [mtWATrack,mtOutgoing]; style:0; size: -11; color: $C08000; back: $C8FFFF), - (_type:[hppFont,hppColor]; name: 'Status message changes'; Mes: [mtStatusMessage,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $F0F0F0), - (_type:[hppFont,hppColor]; name: 'Voice calls'; Mes: [mtVoiceCall,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $E9DFAB), - (_type:[hppFont,hppColor]; name: 'Webpager message'; Mes: [mtWebPager,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), - (_type:[hppFont,hppColor]; name: 'EMail Express message'; Mes: [mtEmailExpress,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), - (_type:[hppColor]; nameColor: 'Link'; Mes: []; back: clBlue) - ); + (_type: [hppFont,hppColor]; name: 'Incoming nick'; nameColor: 'Divider'; + Mes: []; style:DBFONTF_BOLD; size: -11; color: $6B3FC8; back: clGray), - SaveFormatsDef: array[TSaveFormat] of TSaveFilter = ( - (Index: -1; Filter:'All files'; DefaultExt:'*.*'; Owned:[]; OwnedIndex: -1), - (Index: 1; Filter:'HTML file'; DefaultExt:'*.html'; Owned:[]; OwnedIndex: -1), - (Index: 2; Filter:'XML file'; DefaultExt:'*.xml'; Owned:[]; OwnedIndex: -1), - (Index: 3; Filter:'RTF file'; DefaultExt:'*.rtf'; Owned:[]; OwnedIndex: -1), - (Index: 4; Filter:'mContacts files'; DefaultExt:'*.dat'; Owned:[]; OwnedIndex: -1), - (Index: 5; Filter:'Unicode text file'; DefaultExt:'*.txt'; Owned:[sfUnicode,sfText]; OwnedIndex: 1), - (Index: 6; Filter:'Text file'; DefaultExt:'*.txt'; Owned:[sfUnicode,sfText]; OwnedIndex: 2)); + (_type: [hppFont,hppColor]; name: 'Outgoing nick'; nameColor: 'Selected text'; + Mes: []; style:DBFONTF_BOLD; size: -11; color: $BD6008; back: clHighlightText), + + (_type: [hppColor]; nameColor: 'Selected background'; + Mes: []; back: clHighlight), + + (_type: [hppFont,hppColor]; name: 'Incoming message'; + Mes: [mtMessage,mtIncoming]; style:0; size: -11; color: $000000; back: $DBDBDB), + + (_type: [hppFont,hppColor]; name: 'Outgoing message'; + Mes: [mtMessage,mtOutgoing]; style:0; size: -11; color: $000000; back: $EEEEEE), + + (_type: [hppFont,hppColor]; name: 'Incoming file'; + Mes: [mtFile,mtIncoming]; style:0; size: -11; color: $000000; back: $9BEEE3), + + (_type: [hppFont,hppColor]; name: 'Outgoing file'; + Mes: [mtFile,mtOutgoing]; style:0; size: -11; color: $000000; back: $9BEEE3), + + (_type: [hppFont,hppColor]; name: 'Incoming url'; + Mes: [mtUrl,mtIncoming]; style:0; size: -11; color: $000000; back: $F4D9CC), + + (_type: [hppFont,hppColor]; name: 'Outgoing url'; + Mes: [mtUrl,mtOutgoing]; style:0; size: -11; color: $000000; back: $F4D9CC), + + (_type: [hppFont,hppColor]; name: 'Incoming SMS Message'; + Mes: [mtSMS,mtIncoming]; style:0; size: -11; color: $000000; back: $CFF4FE), + + (_type: [hppFont,hppColor]; name: 'Outgoing SMS Message'; + Mes: [mtSMS,mtOutgoing]; style:0; size: -11; color: $000000; back: $CFF4FE), + + (_type: [hppFont,hppColor]; name: 'Incoming contacts'; + Mes: [mtContacts,mtIncoming]; style:0; size: -11; color: $000000; back: $FEF4CF), + + (_type: [hppFont,hppColor]; name: 'Outgoing contacts'; + Mes: [mtContacts,mtOutgoing]; style:0; size: -11; color: $000000; back: $FEF4CF), + + (_type: [hppFont,hppColor]; name: 'System message'; + Mes: [mtSystem,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $CFFEDC), + + (_type: [hppFont,hppColor]; name: 'Status changes'; + Mes: [mtStatus,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $F0F0F0), + + (_type: [hppFont,hppColor]; name: 'SMTP Simple Email'; + Mes: [mtSMTPSimple,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), + + (_type: [hppFont,hppColor]; name: 'Other events (unknown)'; + Mes: [mtOther,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), + + (_type: [hppFont,hppColor]; name: 'Conversation header'; + Mes: []; style:0; size: -11; color: $000000; back: $00D7FDFF), + + (_type: [hppFont,hppColor]; name: 'Nick changes'; + Mes: [mtNickChange,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $00D7FDFF), + + (_type: [hppFont,hppColor]; name: 'Avatar changes'; + Mes: [mtAvatarChange,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $00D7FDFF), + + (_type: [hppFont]; name: 'Incoming timestamp'; + Mes: []; style:0; size: -11; color: $000000), + + (_type: [hppFont]; name: 'Outgoing timestamp'; + Mes: []; style:0; size: -11; color: $000000), + + (_type: [hppFont,hppColor]; name: 'Grid messages'; nameColor: 'Grid background'; + Mes: []; style:0; size: -11; color: $000000; back: $E9EAEB), + + (_type: [hppFont,hppColor]; name: 'Incoming WATrack notify'; + Mes: [mtWATrack,mtIncoming]; style:0; size: -11; color: $C08000; back: $C8FFFF), + + (_type: [hppFont,hppColor]; name: 'Outgoing WATrack notify'; + Mes: [mtWATrack,mtOutgoing]; style:0; size: -11; color: $C08000; back: $C8FFFF), + + (_type: [hppFont,hppColor]; name: 'Status message changes'; + Mes: [mtStatusMessage,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $F0F0F0), + + (_type: [hppFont,hppColor]; name: 'Voice calls'; + Mes: [mtVoiceCall,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $E9DFAB), + + (_type: [hppFont,hppColor]; name: 'Webpager message'; + Mes: [mtWebPager,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), + + (_type: [hppFont,hppColor]; name: 'EMail Express message'; + Mes: [mtEmailExpress,mtIncoming,mtOutgoing]; style:0; size: -11; color: $000000; back: $FFFFFF), + + (_type: [hppColor]; nameColor: 'Link'; + Mes: []; back: clBlue) + ); var hppIntIcons: array[0..0] of ThppIntIconsRec = ( @@ -207,7 +257,19 @@ procedure PrepareSaveDialog(SaveDialog: TSaveDialog; SaveFormat: TSaveFormat; Al implementation -uses hpp_database, ShellAPI; +uses + hpp_database, hpp_contacts, hpp_events, hpp_mescatcher, + ShellAPI; + +const + SaveFormatsDef: array[TSaveFormat] of TSaveFilter = ( + (Index: -1; Filter:'All files'; DefaultExt:'*.*'; Owned:[]; OwnedIndex: -1), + (Index: 1; Filter:'HTML file'; DefaultExt:'*.html'; Owned:[]; OwnedIndex: -1), + (Index: 2; Filter:'XML file'; DefaultExt:'*.xml'; Owned:[]; OwnedIndex: -1), + (Index: 3; Filter:'RTF file'; DefaultExt:'*.rtf'; Owned:[]; OwnedIndex: -1), + (Index: 4; Filter:'mContacts files'; DefaultExt:'*.dat'; Owned:[]; OwnedIndex: -1), + (Index: 5; Filter:'Unicode text file'; DefaultExt:'*.txt'; Owned:[sfUnicode,sfText]; OwnedIndex: 1), + (Index: 6; Filter:'Text file'; DefaultExt:'*.txt'; Owned:[sfUnicode,sfText]; OwnedIndex: 2)); {$include m_mathmodule.inc} {$include m_speak.inc} diff --git a/plugins/HistoryPlusPlus/hpp_richedit.pas b/plugins/HistoryPlusPlus/hpp_richedit.pas index aed3ce1237..ea6f2c1b79 100644 --- a/plugins/HistoryPlusPlus/hpp_richedit.pas +++ b/plugins/HistoryPlusPlus/hpp_richedit.pas @@ -51,8 +51,7 @@ interface uses Windows, Messages, Classes, RichEdit, ActiveX, - Controls, StdCtrls, ComCtrls, Forms, - hpp_global; + Controls, StdCtrls, ComCtrls, Forms; const IID_IOleObject: TGUID = '{00000112-0000-0000-C000-000000000046}'; @@ -1107,7 +1106,9 @@ procedure Register; implementation -uses Types, SysUtils; +uses + Types, SysUtils, + hpp_global; type EOleError = class(Exception); @@ -1128,7 +1129,7 @@ var procedure Register; begin - RegisterComponents('History++', [THppRichedit]); + RegisterComponents(hppName, [THppRichedit]); end; function GetModuleVersionFile(hModule: THandle): Integer; diff --git a/plugins/HistoryPlusPlus/hpp_searchthread.pas b/plugins/HistoryPlusPlus/hpp_searchthread.pas index 6406f67bcd..7d1669a5e4 100644 --- a/plugins/HistoryPlusPlus/hpp_searchthread.pas +++ b/plugins/HistoryPlusPlus/hpp_searchthread.pas @@ -58,9 +58,9 @@ unit hpp_searchthread; interface uses - Windows, SysUtils, Controls, Messages, HistoryGrid, Classes, + Windows, SysUtils, Controls, Messages, {HistoryGrid,} Classes, m_api, - hpp_global, hpp_events, hpp_forms, hpp_bookmarks, hpp_eventfilters; + {hpp_forms, }hpp_global; const ST_FIRST_BATCH = 50; @@ -150,22 +150,24 @@ const // (NEW) items are found (array of hDBEvent, array size) // helper functions -function SearchTextExact (MessageText: String; SearchText: String): Boolean; -function SearchTextAnyWord (MessageText: String; SearchWords: array of String): Boolean; -function SearchTextAllWords(MessageText: String; SearchWords: array of String): Boolean; +function SearchTextExact (const MessageText: String; const SearchText: String): Boolean; +function SearchTextAnyWord (const MessageText: String; SearchWords: array of String): Boolean; +function SearchTextAllWords(const MessageText: String; SearchWords: array of String): Boolean; {$DEFINE SMARTSEARCH} implementation -uses hpp_contacts, PassForm; +uses + hpp_contacts, hpp_events, hpp_bookmarks, hpp_eventfilters, + PassForm; -function SearchTextExact(MessageText: String; SearchText: String): Boolean; +function SearchTextExact(const MessageText: String; const SearchText: String): Boolean; begin Result := Pos(SearchText, MessageText) <> 0; end; -function SearchTextAnyWord(MessageText: String; SearchWords: array of String): Boolean; +function SearchTextAnyWord(const MessageText: String; SearchWords: array of String): Boolean; var i: Integer; begin @@ -178,7 +180,7 @@ begin end; end; -function SearchTextAllWords(MessageText: String; SearchWords: array of String): Boolean; +function SearchTextAllWords(const MessageText: String; SearchWords: array of String): Boolean; var i: Integer; begin diff --git a/plugins/HistoryPlusPlus/hpp_services.pas b/plugins/HistoryPlusPlus/hpp_services.pas index 378f2aa382..be6d56e007 100644 --- a/plugins/HistoryPlusPlus/hpp_services.pas +++ b/plugins/HistoryPlusPlus/hpp_services.pas @@ -51,7 +51,6 @@ interface uses Classes, Windows, Controls, m_api, - hpp_options, HistoryForm, PassForm, PassCheckForm; var @@ -80,8 +79,8 @@ implementation uses SysUtils, GlobalSearch, EmptyHistoryForm, - hpp_global, hpp_database, hpp_itemprocess, hpp_forms, - hpp_mescatcher, hpp_bookmarks; + hpp_global, {hpp_database,} hpp_itemprocess, hpp_forms, + hpp_options{, hpp_mescatcher, hpp_bookmarks}; // our own processing of RichEdit for all history windows function AllHistoryRichEditProcess(wParam { hRichEdit } : WPARAM; lParam { PItemRenderDetails } : LPARAM): Int; cdecl; -- cgit v1.2.3