-
>[17] Anatoly Podgoretsky(c) 19-Oct-2006, 01:46 >Я вообще то про писателей, а не про продукты. даже если не пишут, но используют -- значит, продукт жив, имо.
>[19] Gero_ 19-Oct-2006, 01:49 >Я его и использую, просто в klient.txt рекомендация >разделять через точку, но это неважно. может, это важно для скриптов статистики у Максима? я из этих соображений вопрос задавал.
-
Если называть все клиенты, то есть еще DMFC и Dolphin.
-
>[21] Gero(c) 19-Oct-2006, 01:56 >Если называть все клиенты, то есть еще DMFC и Dolphin. из них постов не видел...
да и CDM бы не появился, если б у тебя не IE, и если б DMClient умел все обновлённые темы в одном табе показывать %-)
-
а?
-
сранно. пост в 9 кил отправить уже не может. кстати: а какое ограничение на размеры тут?
-
а вот 6 кб? unit cdmVideoUtilsU;
interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
implementation
const CDM_PROGRSS_WINDOW = '_cdm_progress_window_';
procedure EmptyInput (); begin FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); CMAPI_ClearQueue(); end;
function CheckForEscape (): Boolean; const DELTA = 16; type TInputRecArr = array[0..Pred(MaxInt div SizeOf(TInputRecord))] of TInputRecord; var console: THandle; inputRec: ^TInputRecArr; inputSize: DWORD; readSuccess: boolean; readCnt, i: DWORD; begin result:= false; console:= GetStdHandle(STD_INPUT_HANDLE); inputSize:= 0; inputRec:= nil; try repeat Inc(inputSize, DELTA); ReallocMem(inputRec, inputSize*SizeOf(TInputRecord)); readSuccess:= PeekConsoleInput(console, inputRec^[0], inputSize, readCnt); until (not readSuccess) or (readCnt < inputSize); if readSuccess and (readCnt > 0) then begin for i:= 0 to Pred(readCnt) do begin if (inputRec^[i].EventType = KEY_EVENT) and (inputRec^[i].Event.KeyEvent.bKeyDown) and (inputRec^[i].Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then begin result:= true; EmptyInput(); break; end; end; end; finally ReallocMem(inputRec, 0); end; end;
function FindProgressWindow (): TCUIFramedWindow; begin result := CUIFindControlByName(CDM_PROGRSS_WINDOW) as TCUIFramedWindow; end;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; var w: TCUIFramedWindow; t: TCUIText; begin loadCancelled := false; w := FindProgressWindow(); if w <> nil then begin w.Caption := aCaption; CUIDesktop().ActivateWindow(w); end else begin w := TCUIFramedWindow.Create(Rect(0, 0, 50, 7), aCaption, [cwfNoClose]); w.Name := CDM_PROGRSS_WINDOW; CUIDesktop().CenterWindow(w); // first line t := TCUIText.Create(w.Client, 0, 0, '', 1); t.AnchorRect := Rect(0, 0, -1, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; // second line t := TCUIText.Create(w.Client, 0, 1, '', 1); t.AnchorRect := Rect(0, 0, -1, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; // third line t := TCUIText.Create(w.Client, 0, 2, '', 1); t.AnchorRect := Rect(1, 0, -2, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; end; result := w; CUIReleaseControls(); CUIRepaintAll(); end;
function CheckDLoadResult (const msg: string): Boolean; var w: TCUIFramedWindow; begin result := (msg = ''); w := FindProgressWindow(); if w <> nil then w.Release(); CUIReleaseControls(); if not result then begin CUIMessageBox(-1, -1, 'NET ERROR', msg, '&close', true, 'red'); CUIReleaseControls(); end; end;
procedure DrawPBar (cur, total: Integer); var w: TCUIFramedWindow; t: TCUIText; wdt, w1: Integer; s: string; begin w := FindProgressWindow(); if w = nil then exit; t := TCUIText(w.Client.Children[2]); wdt := t.Width; if wdt < 1 then exit; SetLength(s, wdt); UniqueString(s); if total < 1 then FillChar(s[1], Length(s), '.') else if cur >= total then FillChar(s[1], Length(s), #8) else begin FillChar(s[1], Length(s), #7); w1 := wdt*cur div total; if w1 > 0 then begin if w1 > Length(s) then w1 := Length(s); FillChar(s[1], w1, #8); end; end; t.Caption := s; end;
function CDMDefaultNotifier (const msg: string; cur, total: Integer): Boolean; var w: TCUIFramedWindow; t: TCUIText; s0, s1, s2: string; pos, p1: Integer; begin result := true; pos := System.Pos(#10, msg); if pos = 0 then begin s1 := '['+IntToStr(cur); if total >= 0 then s1 := s1+'/'+IntToStr(total); s1 := s1+']'; s2 := ''; s0 := msg; end else begin s0 := Copy(msg, 1, pos-1); Inc(pos); p1 := PosEx(#10, msg, pos); if p1 = 0 then p1 := Length(msg); s1 := Copy(msg, pos, p1-pos); Inc(p1); s2 := Copy(msg, p1, Length(msg)); end;
w := FindProgressWindow(); if w = nil then w := OpenProgressWindow('loading'); t := TCUIText(w.Client.Children[0]); t.Caption := s0; t := TCUIText(w.Client.Children[1]); t.Caption := s1; if s2 <> '' then begin t := TCUIText(w.Client.Children[2]); t.Caption := s2; end else DrawPBar(cur, total);
CUIRepaintAll();
if CheckForEscape() then begin result := not CUITanOna(-1, -1, 'WARNING!', 'do you want to cancel operation?', true, false, 'red'); CUIReleaseControls(); CUIRepaintAll(); loadCancelled := not result; end; end;
function FindInfoWindow (): TCUIFramedWindow; begin result := CUIFindControlByName(CDM_PROGRSS_WINDOW) as TCUIFramedWindow; end;
procedure ShowInfoWindow (const aCaption, aText: string); var w: TCUIFramedWindow; t: TCUIMultiText; wdt: Integer; s: string; begin w := FindProgressWindow(); if w <> nil then w.Release();
w := TCUIFramedWindow.Create(Rect(0, 0, 30, 11), aCaption, [cwfNoClose]); w.Name := CDM_PROGRSS_WINDOW;
t := TCUIMultiText.Create(w.Client, 2, 0, aText, 1); t.Align := 0; t.VAlign := -1; t.AnchorRect := Rect(0, 1, -1, -2); t.Anchors := [cuaLeft, cuaRight, cuaTop, cuaBottom];
wdt := t.MaxLineLen; if wdt > CUIDesktop().ClientBounds.Right-10 then begin s := StrWrapToStr(aText, CUIDesktop().ClientBounds.Right-10); t.Caption := s; wdt := t.MaxLineLen; end;
w.ClientWidth := wdt+2; w.ClientHeight := t.LineCount+2; CUIDesktop().CenterWindow(w); w.SchemePrefix := 'white';
CUIReleaseControls(); CUIRepaintAll(); w.Release(); end;
begin cdmNotifier := @CDMDefaultNotifier; end.
-
7?aa interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
unit cdmVideoUtilsU;
interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
unit cdmVideoUtilsU;
interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
implementation
const CDM_PROGRSS_WINDOW = '_cdm_progress_window_';
procedure EmptyInput (); begin FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); CMAPI_ClearQueue(); end;
function CheckForEscape (): Boolean; const DELTA = 16; type TInputRecArr = array[0..Pred(MaxInt div SizeOf(TInputRecord))] of TInputRecord; var console: THandle; inputRec: ^TInputRecArr; inputSize: DWORD; readSuccess: boolean; readCnt, i: DWORD; begin result:= false; console:= GetStdHandle(STD_INPUT_HANDLE); inputSize:= 0; inputRec:= nil; try repeat Inc(inputSize, DELTA); ReallocMem(inputRec, inputSize*SizeOf(TInputRecord)); readSuccess:= PeekConsoleInput(console, inputRec^[0], inputSize, readCnt); until (not readSuccess) or (readCnt < inputSize); if readSuccess and (readCnt > 0) then begin for i:= 0 to Pred(readCnt) do begin if (inputRec^[i].EventType = KEY_EVENT) and (inputRec^[i].Event.KeyEvent.bKeyDown) and (inputRec^[i].Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then begin result:= true; EmptyInput(); break; end; end; end; finally ReallocMem(inputRec, 0); end; end;
function FindProgressWindow (): TCUIFramedWindow; begin result := CUIFindControlByName(CDM_PROGRSS_WINDOW) as TCUIFramedWindow; end;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; var w: TCUIFramedWindow; t: TCUIText; begin loadCancelled := false; w := FindProgressWindow(); if w <> nil then begin w.Caption := aCaption; CUIDesktop().ActivateWindow(w); end else begin w := TCUIFramedWindow.Create(Rect(0, 0, 50, 7), aCaption, [cwfNoClose]); w.Name := CDM_PROGRSS_WINDOW; CUIDesktop().CenterWindow(w); // first line t := TCUIText.Create(w.Client, 0, 0, '', 1); t.AnchorRect := Rect(0, 0, -1, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; // second line t := TCUIText.Create(w.Client, 0, 1, '', 1); t.AnchorRect := Rect(0, 0, -1, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; // third line t := TCUIText.Create(w.Client, 0, 2, '', 1); t.AnchorRect := Rect(1, 0, -2, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; end; result := w; CUIReleaseControls(); CUIRepaintAll(); end;
function CheckDLoadResult (const msg: string): Boolean; var w: TCUIFramedWindow; begin result := (msg = ''); w := FindProgressWindow(); if w <> nil then w.Release(); CUIReleaseControls(); if not result then begin CUIMessageBox(-1, -1, 'NET ERROR', msg, '&close', true, 'red'); CUIReleaseControls(); end; end;
procedure DrawPBar (cur, total: Integer); var w: TCUIFramedWindow; t: TCUIText; wdt, w1: Integer; s: string; begin w := FindProgressWindow(); if w = nil then exit; t := TCUIText(w.Client.Children[2]); wdt := t.Width; if wdt < 1 then exit; SetLength(s, wdt); UniqueString(s); if total < 1 then FillChar(s[1], Length(s), '.') else if cur >= total then FillChar(s[1], Length(s), #8) else begin FillChar(s[1], Length(s), #7); w1 := wdt*cur div total; if w1 > 0 then begin if w1 > Length(s) then w1 := Length(s); FillChar(s[1], w1, #8); end; end; t.Caption := s; end;
function CDMDefaultNotifier (const msg: string; cur, total: Integer): Boolean; var w: TCUIFramedWindow; t: TCUIText; s0, s1, s2: string; pos, p1: Integer; begin result := true; pos := System.Pos(#10, msg); if pos = 0 then begin s1 := '['+IntToStr(cur); if total >= 0 then s1 := s1+'/'+IntToStr(total); s1 := s1+']'; s2 := ''; s0 := msg; end else begin s0 := Copy(msg, 1, pos-1); Inc(pos); p1 := PosEx(#10, msg, pos); if p1 = 0 then p1 := Length(msg); s1 := Copy(msg, pos, p1-pos); Inc(p1); s2 := Copy(msg, p1, Length(msg)); end;
w := FindProgressWindow(); if w = nil then w := OpenProgressWindow('loading'); t := TCUIText(w.Client.Children[0]); t.Caption := s0; t := TCUIText(w.Client.Children[1]); t.Caption := s1; if s2 <> '' then begin t := TCUIText(w.Client.Children[2]); t.Caption := s2; end else DrawPBar(cur, total);
CUIRepaintAll();
if CheckForEscape() then begin result := not CUITanOna(-1, -1, 'WARNING!', 'do you want to cancel operation?', true, false, 'red'); CUIReleaseControls(); CUIRepaintAll(); loadCancelled := not result; end; end;
function FindInfoWindow (): TCUIFramedWindow; begin result := CUIFindControlByName(CDM_PROGRSS_WINDOW) as TCUIFramedWindow; end;
procedure ShowInfoWindow (const aCaption, aText: string); var w: TCUIFramedWindow; t: TCUIMultiText; wdt: Integer; s: string; begin w := FindProgressWindow(); if w <> nil then w.Release();
w := TCUIFramedWindow.Create(Rect(0, 0, 30, 11), aCaption, [cwfNoClose]); w.Name := CDM_PROGRSS_WINDOW;
t := TCUIMultiText.Create(w.Client, 2, 0, aText, 1); t.Align := 0; t.VAlign := -1; t.AnchorRect := Rect(0, 1, -1, -2); t.Anchors := [cuaLeft, cuaRight, cuaTop, cuaBottom];
wdt := t.MaxLineLen; if wdt > CUIDesktop().ClientBounds.Right-10 then begin s := StrWrapToStr(aText, CUIDesktop().ClientBounds.Right-10); t.Caption := s; wdt := t.MaxLineLen; end;
w.ClientWidth := wdt+2; w.ClientHeight := t.LineCount+2; CUIDesktop().CenterWindow(w); w.SchemePrefix := 'white';
CUIReleaseControls(); CUIRepaintAll(); w.Release(); end;
begin cdmNotifier := @CDMDefaultNotifier; end.
-
aaa (const msg: string): Boolean; // and close progress window function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
aa interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
unit cdmVideoUtilsU;
interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
unit cdmVideoUtilsU;
interface
uses Windows, SysUtils, Classes, DateUtils, StrUtils, {$INCLUDE uses_cui.inc}, cdmProtoU;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; function CheckDLoadResult (const msg: string): Boolean; // and close progress window
procedure ShowInfoWindow (const aCaption, aText: string);
procedure EmptyInput (); function CheckForEscape (): Boolean;
var loadCancelled: Boolean;
implementation
const CDM_PROGRSS_WINDOW = '_cdm_progress_window_';
procedure EmptyInput (); begin FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); CMAPI_ClearQueue(); end;
function CheckForEscape (): Boolean; const DELTA = 16; type TInputRecArr = array[0..Pred(MaxInt div SizeOf(TInputRecord))] of TInputRecord; var console: THandle; inputRec: ^TInputRecArr; inputSize: DWORD; readSuccess: boolean; readCnt, i: DWORD; begin result:= false; console:= GetStdHandle(STD_INPUT_HANDLE); inputSize:= 0; inputRec:= nil; try repeat Inc(inputSize, DELTA); ReallocMem(inputRec, inputSize*SizeOf(TInputRecord)); readSuccess:= PeekConsoleInput(console, inputRec^[0], inputSize, readCnt); until (not readSuccess) or (readCnt < inputSize); if readSuccess and (readCnt > 0) then begin for i:= 0 to Pred(readCnt) do begin if (inputRec^[i].EventType = KEY_EVENT) and (inputRec^[i].Event.KeyEvent.bKeyDown) and (inputRec^[i].Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE) then begin result:= true; EmptyInput(); break; end; end; end; finally ReallocMem(inputRec, 0); end; end;
function FindProgressWindow (): TCUIFramedWindow; begin result := CUIFindControlByName(CDM_PROGRSS_WINDOW) as TCUIFramedWindow; end;
function OpenProgressWindow (const aCaption: string): TCUIFramedWindow; var w: TCUIFramedWindow; t: TCUIText; begin loadCancelled := false; w := FindProgressWindow(); if w <> nil then begin w.Caption := aCaption; CUIDesktop().ActivateWindow(w); end else begin w := TCUIFramedWindow.Create(Rect(0, 0, 50, 7), aCaption, [cwfNoClose]); w.Name := CDM_PROGRSS_WINDOW; CUIDesktop().CenterWindow(w); // first line t := TCUIText.Create(w.Client, 0, 0, '', 1); t.AnchorRect := Rect(0, 0, -1, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; // second line t := TCUIText.Create(w.Client, 0, 1, '', 1); t.AnchorRect := Rect(0, 0, -1, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; // third line t := TCUIText.Create(w.Client, 0, 2, '', 1); t.AnchorRect := Rect(1, 0, -2, 0); t.Anchors := [cuaLeft, cuaRight]; t.Align := 0; end; result := w; CUIReleaseControls(); CUIRepaintAll(); end;
function CheckDLoadResult (const msg: string): Boolean; var w: TCUIFramedWindow; begin result := (msg = ''); w := FindProgressWindow(); if w <> nil then w.Release(); CUIReleaseControls(); if not result then begin CUIMessageBox(-1, -1, 'NET ERROR', msg, '&close', true, 'red'); CUIReleaseControls(); end; end;
procedure DrawPBar (cur, total: Integer); var w: TCUIFramedWindow; t: TCUIText; wdt, w1: Integer; s: string; begin w := FindProgressWindow(); if w = nil then exit; t := TCUIText(w.Client.Children[2]); wdt := t.Width; if wdt < 1 then exit; SetLength(s, wdt); UniqueString(s); if total < 1 then FillChar(s[1], Length(s), '.') else if cur >= total then FillChar(s[1], Length(s), #8) else begin FillChar(s[1], Length(s), #7); w1 := wdt*cur div total; if w1 > 0 then begin if w1 > Length(s) then w1 := Length(s); FillChar(s[1], w1, #8); end; end; t.Caption := s; end;
function CDMDefaultNotifier (const msg: string; cur, total: Integer): Boolean; var w: TCUIFramedWindow; t: TCUIText; s0, s1, s2: string; pos, p1: Integer; begin result := true; pos := System.Pos(#10, msg); if pos = 0 then begin s1 := '['+IntToStr(cur); if total >= 0 then s1 := s1+'/'+IntToStr(total); s1 := s1+']'; s2 := ''; s0 := msg; end else begin s0 := Copy(msg, 1, pos-1); Inc(pos); p1 := PosEx(#10, msg, pos); if p1 = 0 then p1 := Length(msg); s1 := Copy(msg, pos, p1-pos); Inc(p1); s2 := Copy(msg, p1, Length(msg)); end;
w := FindProgressWindow(); if w = nil then w := OpenProgressWindow('loading'); t := TCUIText(w.Client.Children[0]); t.Caption := s0; t := TCUIText(w.Client.Children[1]); t.Caption := s1; if s2 <> '' then begin t := TCUIText(w.Client.Children[2]); t.Caption := s2; end else DrawPBar(cur, total);
CUIRepaintAll();
if CheckForEscape() then begin result := not CUITanOna(-1, -1, 'WARNING!', 'do you want to cancel operation?', true, false, 'red'); CUIReleaseControls(); CUIRepaintAll(); loadCancelled := not result; end; end;
function FindInfoWindow (): TCUIFramedWindow; begin result := CUIFindControlByName(CDM_PROGRSS_WINDOW) as TCUIFramedWindow; end;
procedure ShowInfoWindow (const aCaption, aText: string); var w: TCUIFramedWindow; t: TCUIMultiText; wdt: Integer; s: string; begin w := FindProgressWindow(); if w <> nil then w.Release();
w := TCUIFramedWindow.Create(Rect(0, 0, 30, 11), aCaption, [cwfNoClose]); w.Name := CDM_PROGRSS_WINDOW;
t := TCUIMultiText.Create(w.Client, 2, 0, aText, 1); t.Align := 0; t.VAlign := -1; t.AnchorRect := Rect(0, 1, -1, -2); t.Anchors := [cuaLeft, cuaRight, cuaTop, cuaBottom];
wdt := t.MaxLineLen; if wdt > CUIDesktop().ClientBounds.Right-10 then begin s := StrWrapToStr(aText, CUIDesktop().ClientBounds.Right-10); t.Caption := s; wdt := t.MaxLineLen; end;
w.ClientWidth := wdt+2; w.ClientHeight := t.LineCount+2; CUIDesktop().CenterWindow(w); w.SchemePrefix := 'white';
CUIReleaseControls(); CUIRepaintAll(); w.Release(); end;
begin cdmNotifier := @CDMDefaultNotifier; end.
-
ага. опытным путём выяснено, что ~7 кил -- максимум. надо сделать авторазюиение поста.
зыж есть подозрение, что лимиты для "трепологии" побольше. интересно, я прав?
-
-
>[29] VirEx(c) 19-Oct-2006, 07:36 всё равно жаба мастдай! %-)
-
Ketmar ( 19.10.06 08:16) [29] VirEx(c) 19-Oct-2006, 07:36 все равно жаба мастдай! %-) ---- скажи это изену
-
>[31] VirEx(c) 19-Oct-2006, 08:32 >скажи это изену баян. он непробиваем.
-
> Ketmar © (19.10.06 03:23) [24] > сранно. пост в 9 кил отправить уже не может. кстати: а какое > ограничение на размеры тут?
По последней официальной информации 5000 символов.
|