diff --git a/KOL.pas b/KOL.pas index 3a15a3a..f1b0b92 100644 --- a/KOL.pas +++ b/KOL.pas @@ -557,7 +557,6 @@ uses {$IFDEF WIN}messages, windows {$IFNDEF NOT_USE_RICHEDIT}, RichEdit {$ENDIF} ////type HDC = TGC; // from Xlib (temporary definition?) {$ENDIF LIN} - var AppTheming: Boolean; {$IFDEF DEBUG_GDIOBJECTS} @@ -1073,7 +1072,7 @@ type //[END OF TThread DEFINITION] //[NewThread, NewThreadEx, NewThreadAutoFree DECLARATIONS] -function NewThread: PThread; +function NewThread(const stackize: DWORD = 0): PThread; {* Creates thread object (always suspended). After creating, set event OnExecute and perform Resume operation. } @@ -1507,6 +1506,15 @@ RT_VERSION Version resource type TCompareStrListFun = function( const S1, S2: PAnsiChar ): Integer; +//[Sorting TYPES] + TCompareEvent = function (const Data: Pointer; const e1,e2 : Dword) : Integer; + {* Event type to define comparison function between two elements of an array. + This event handler must return -1 or +1 (correspondently for cases e1e2). Items are enumerated from 0 to uNElem. } + TSwapEvent = procedure (const Data : Pointer; const e1,e2 : Dword); + {* Event type to define swap procedure which is swapping two elements of an + array. } + {++}(*TStrList = class;*){--} PStrList = {-}^{+}TStrList; { --------------------------------------------------------------------- @@ -1614,6 +1622,8 @@ type {* Call it to sort string list. } procedure AnsiSort( CaseSensitive: Boolean ); {* Call it to sort ANSI string list. } + procedure SortEx(const CompareFun: TCompareEvent); + {* Call it to custom sort string list. Dufa } // by Alexander Pravdin: protected @@ -11580,16 +11590,6 @@ function RegKeyGetValueTyp (const Key:HKEY; const ValueName: KOLString) : DWORD; renamed to SortData - which is a regular procedure now). } {$ENDIF WIN_GDI} //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//[Sorting TYPES] -type - TCompareEvent = function (const Data: Pointer; const e1,e2 : Dword) : Integer; - {* Event type to define comparison function between two elements of an array. - This event handler must return -1 or +1 (correspondently for cases e1e2). Items are enumerated from 0 to uNElem. } - TSwapEvent = procedure (const Data : Pointer; const e1,e2 : Dword); - {* Event type to define swap procedure which is swapping two elements of an - array. } - //[SortData FUNCTIONS DECLARATIONS] procedure SortData( const Data: Pointer; const uNElem: Dword; const CompareFun: TCompareEvent; @@ -24912,7 +24912,7 @@ end; {$ELSE not_USE_CONSTRUCTORS} //* //[function NewThread] -function NewThread: PThread; +function NewThread(const stackize: DWORD = 0): PThread; begin {$IFNDEF FPC105ORBELOW} IsMultiThread := True; @@ -24924,8 +24924,8 @@ begin Result.FSuspended := True; {$IFDEF PSEUDO_THREADS} {$ELSE} - Result.FHandle := CreateThread( nil, // no security - 0, // the same stack size + Result.FHandle := CreateThread( nil, // no security + stackize, // the same stack size @ThreadFunc, // thread entry point Result, // parameter to pass to ThreadFunc CREATE_SUSPENDED, // always SUSPENDED @@ -41054,6 +41054,12 @@ begin end; {$ENDIF ASM_VERSION} +//[procedure TStrList.SortEx] +procedure TStrList.SortEx(const CompareFun: TCompareEvent); +begin + SortData(@Self, fCount, CompareFun, {@SwapStrListItems}@TStrList.Swap); +end; + //[procedure TStrList.Swap] procedure TStrList.Swap(Idx1, Idx2: Integer); begin diff --git a/KOLMCK_D2010.dpk b/KOLMCK_D2010.dpk index a3896bc..9cc3943 100644 --- a/KOLMCK_D2010.dpk +++ b/KOLMCK_D2010.dpk @@ -1,7 +1,7 @@ package KOLMCK_D2010; -{$R KOLMCK.res} -{$ALIGN 8} +{$R 'KOLMCK.res'} +{$ALIGN 4} {$ASSERTIONS ON} {$BOOLEVAL OFF} {$DEBUGINFO ON} @@ -21,8 +21,8 @@ package KOLMCK_D2010; {$VARSTRINGCHECKS ON} {$WRITEABLECONST OFF} {$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DESCRIPTION '_KOL_ mirror controls for Delphi 2010'} +{$IMAGEBASE $9400000} +{$DESCRIPTION 'KOLMCK 2010'} {$DESIGNONLY} {$IMPLICITBUILD OFF} {$DEFINE INPACKAGE} diff --git a/KOL_ASM.inc b/KOL_ASM.inc index 5def9dd..1425287 100644 --- a/KOL_ASM.inc +++ b/KOL_ASM.inc @@ -6374,31 +6374,35 @@ end; // by Galkov, Jun-2009 function WndProcNotify( Self_: PControl; var Msg: TMsg; var Rslt: Integer ): Boolean; asm - CMP word ptr [EDX].TMsg.message, WM_NOTIFY - JNE @@ret_false - PUSH ECX - PUSH EDX - MOV ECX, [EDX].TMsg.lParam - {$IFDEF USE_PROP} - PUSH offset[ID_SELF] - PUSH [ECX].TNMHdr.hwndFrom - CALL GetProp - {$ELSE} - PUSH GWL_USERDATA - PUSH [ECX].TNMHdr.hwndFrom - CALL GetWindowLong - {$ENDIF} - POP EDX - TEST EAX, EAX - JZ @@ret_false_ECX - MOV ECX, [EAX].TControl.fHandle - MOV [EDX].TMsg.hwnd, ECX - POP ECX - JMP TControl.EnumDynHandlers + CMP word ptr [EDX].TMsg.message, WM_NOTIFY + JNE @@ret_false + PUSH ECX + PUSH EDX + PUSH EAX + MOV ECX, [EDX].TMsg.lParam + {$IFDEF USE_PROP} + PUSH offset[ID_SELF] + PUSH [ECX].TNMHdr.hwndFrom + CALL GetProp + {$ELSE} + PUSH GWL_USERDATA + PUSH [ECX].TNMHdr.hwndFrom + CALL GetWindowLong + {$ENDIF} + POP ECX + POP EDX + TEST EAX, EAX + JZ @@ret_false_ECX + CMP EAX, ECX + JZ @@ret_false_ECX + MOV ECX, [EAX].TControl.fHandle + MOV [EDX].TMsg.hwnd, ECX + POP ECX + JMP TControl.EnumDynHandlers @@ret_false_ECX: - POP ECX + POP ECX @@ret_false: - XOR EAX, EAX + XOR EAX, EAX end; function WndProcCommonNotify( Self_: PControl; var Msg: TMsg; var Rslt: Integer ): Boolean; diff --git a/MCKAppExpert200x.pas b/MCKAppExpert200x.pas index 83042cd..b6b383d 100644 --- a/MCKAppExpert200x.pas +++ b/MCKAppExpert200x.pas @@ -217,14 +217,12 @@ begin dlg.Options := [ofOverwritePrompt, ofExtensionDifferent, ofPathMustExist]; dlg.Title := 'Save Project'; dlg.Filter := 'DPR files|*.dpr'; - dlg.DefaultExt := 'dpr'; if dlg.Execute then begin prj := dlg.FileName; if (Pos('.', prj) = Length(prj) - 3) then SetLength(prj, Length(prj) - 4); dlg.Title := 'Save Unit'; dlg.Filter := 'PAS files|*.pas'; - dlg.DefaultExt := 'pas'; dlg.FileName := 'unit1'; if dlg.Execute then begin unt := dlg.FileName; @@ -234,18 +232,19 @@ begin lst := TStringList.Create; lst.Text := StringReplace(prj_template, '%prj_name%', ExtractFileName(prj), [rfReplaceAll]); lst.Text := StringReplace(lst.Text, '%unt_name%', ExtractFileName(unt), [rfReplaceAll]); - lst.SaveToFile(prj + '.dpr'); + lst.SaveToFile(ChangeFileExt(prj, '.dpr')); // gen unit lst.Text := StringReplace(unt_template, '%unt_name%', ExtractFileName(unt), [rfReplaceAll]); - lst.SaveToFile(unt + '.pas'); + lst.SaveToFile(ChangeFileExt(unt, '.pas')); // gen dfm lst.Text := StringReplace(dfm_template, '%path%', ExtractFilePath(unt), [rfReplaceAll]); - lst.SaveToFile(unt + '.dfm'); + lst.SaveToFile(ChangeFileExt(unt, '.dfm')); // close all - if (MessageBox(0, 'Close all projects before opening new?', 'MCKAppExpert200x', MB_ICONQUESTION or MB_YESNO) = IDYES) then - (BorlandIDEServices as IOTAModuleServices).CloseAll; + //if (MessageBox(0, 'Close all projects before opening new?', 'MCKAppExpert200x', MB_ICONQUESTION or MB_YESNO) = IDYES) then + // (BorlandIDEServices as IOTAModuleServices).CloseAll; // open new - (BorlandIDEServices as IOTAActionServices).OpenProject(prj + '.dpr', False); +// (BorlandIDEServices as IOTAActionServices).OpenProject(ChangeFileExt(prj, '.dpr'), True); + (BorlandIDEServices as IOTAActionServices).OpenFile(ChangeFileExt(prj, '.dpr')); // free lst.Free; end;