Конференция "Журнал" » Сколько осталось клиенто писателей?
 
  • Anatoly Podgoretsky © (18.10.06 23:53) [0]
    По моим подсчетам трое.
  • Gero_ (19.10.06 00:18) [1]
    Как минимум шесть, это:

    Gero (DMClient — http://dmclient.org.ru ). Особенность — максимальное сходство с web-версией сайта.
    Anatoly Podgoretsky (AP Client http://podgoretsky.com ). Особенность — NNTP-сервер.
    Ketmar (Console DM client http://avalon-group.ho.com.ua/cdm ). Особенность — консольный интерфейс.
    VirEx (JDMClient http://jdmc.kladovka.net.ru ). Особенность — wap-клиент на Java.
    Ломброзо (DMJS Client http://dmjsclient.narod.ru ). Особенность — hta-приложение на xml.

    Если не ошибаюсь, Максим говорил, что запросы приходят и от других клиентов, но о них ничего не известно.
  • Gero_ (19.10.06 00:20) [2]
    Ошибся, клиент Ломброзо теперь называется Delphi Look.
  • Gero_ (19.10.06 00:21) [3]
    Точнее, DelphiLook.
  • Ketmar © (19.10.06 01:08) [4]
    кстати, а ведётся статистика запросов? я, например, честно отправляю строку-id клиента (как и просили в klient.txt). кто ещё, и как они выглядят? может, стоит установить стандарт?

    CDM, например, отправлял как минимум три строки, различающихся в последней цифре -- версии модуля протокола. но никак не сказано о стиле оформления таких строк. %-(
  • Ketmar © (19.10.06 01:10) [5]
    зыж нечестно! я бел перед Анатолием! %-)

    ещё забыл Magic Forum -- его до сих пор юзают.
  • Anatoly Podgoretsky © (19.10.06 01:24) [6]

    > Точнее, DelphiLook.

    А не DelphiLoox
  • Anatoly Podgoretsky © (19.10.06 01:24) [7]
    Gero_   (19.10.06 00:18) [1]
    Вот и перепись провели
  • Anatoly Podgoretsky © (19.10.06 01:25) [8]
    Ketmar ©   (19.10.06 01:10) [5]
    Про умершиъ или хорошо, или ничего.
  • Gero_ (19.10.06 01:25) [9]
    > [6] Anatoly Podgoretsky ©   (19.10.06 01:24)

    Нет, именно Look, там написано в about.
  • Anatoly Podgoretsky © (19.10.06 01:28) [10]
    Я подумал, что это известный КПК Loox
  • Gero_ (19.10.06 01:30) [11]
    > [5] Ketmar ©   (19.10.06 01:10)


    > зыж нечестно! я бел перед Анатолием! %-)

    На самом деле я писал по алфавиту, просто себя решил первым поставить :)

    > ещё забыл Magic Forum -- его до сих пор юзают.

    Не забыл, просто в этом списке только те клиенты, что развиваются и поддерживаются.
    > [4] Ketmar ©   (19.10.06 01:08)

    Максим одно время отключал эту статистику для повышения производительности, не знаю, работает ли она сейчас.
  • Ketmar © (19.10.06 01:34) [12]
    >[8] Anatoly Podgoretsky(c) 19-Oct-2006, 01:25
    >Про умершиъ или хорошо, или ничего.
    нифига. MF вполне жив, хоть и не развивается. как минимум NailMan и Трояновкий, судя по моим наблюдениям, юзают именно его.
  • Gero_ (19.10.06 01:34) [13]
    > [4] Ketmar ©   (19.10.06 01:08)


    > может, стоит установить стандарт?

    Вроде стандарт уже есть:

    8. Для ведения логов использования клиентов чтения форумов подставляйте во
    _все_ запросы к серверу UserAgent=Название.Версия
    Например:
    http://www.delphimaster.ru/cgi-bin/client.pl?getnew=lastmod&n=0&UserAgent=Название.Версия
    или, можете указывать агента в заголовке запроса, в стандартном поле HTTP_USER_AGENT


    Но в дмклиент разделение идет пробелом )
  • Ketmar © (19.10.06 01:35) [14]
    >[11] Gero_ 19-Oct-2006, 01:30
    >Максим одно время отключал эту статистику для повышения
    >производительности, не знаю, работает ли она сейчас.
    однако о стандартизации в klient.txt сказано очень мало. предлагаю выработать стандарт и потом предоставить на утверждение Максиму.
  • Ketmar © (19.10.06 01:36) [15]
    >[13] Gero_ 19-Oct-2006, 01:34
    >Вроде стандарт уже есть:
    типа того. я старался сделать по нему. CDM рекомендуется как "CDM_by_Ketmar.X", где X -- версия. но, имо, этого мало. имо.
  • Anatoly Podgoretsky © (19.10.06 01:45) [16]

    > Но в дмклиент разделение идет пробелом )

    Если использовать HTTP_USER_AGENT то проблемы нет, оно передается в запросе как "любой текст"
  • Anatoly Podgoretsky © (19.10.06 01:46) [17]

    > ещё забыл Magic Forum -- его до сих пор юзают.

    Я вообще то про писателей, а не про продукты.
  • Anatoly Podgoretsky © (19.10.06 01:47) [18]
    Ну все спать пора, всем спокойной ночи.
  • Gero_ (19.10.06 01:49) [19]
    > [16] Anatoly Podgoretsky ©   (19.10.06 01:45)

    Я его и использую, просто в klient.txt рекомендация разделять через точку, но это неважно.
  • Ketmar © (19.10.06 01:52) [20]
    >[17] Anatoly Podgoretsky(c) 19-Oct-2006, 01:46
    >Я вообще то про писателей, а не про продукты.
    даже если не пишут, но используют -- значит, продукт жив, имо.

    >[19] Gero_ 19-Oct-2006, 01:49
    >Я его и использую, просто в klient.txt рекомендация
    >разделять через точку, но это неважно.
    может, это важно для скриптов статистики у Максима? я из этих соображений вопрос задавал.
  • Gero © (19.10.06 01:56) [21]
    Если называть все клиенты, то есть еще DMFC и Dolphin.
  • Ketmar © (19.10.06 02:07) [22]
    >[21] Gero(c) 19-Oct-2006, 01:56
    >Если называть все клиенты, то есть еще DMFC и Dolphin.
    из них постов не видел...

    да и CDM бы не появился, если б у тебя не IE, и если б DMClient умел все обновлённые темы в одном табе показывать %-)
  • Ketmar © (19.10.06 03:22) [23]
    а?
  • Ketmar © (19.10.06 03:23) [24]
    сранно. пост в 9 кил отправить уже не может. кстати: а какое ограничение на размеры тут?
  • Ketmar © (19.10.06 06:41) [25]
    а вот 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.
  • Ketmar © (19.10.06 06:43) [26]
    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.
  • Ketmar © (19.10.06 06:45) [27]
    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.
  • Ketmar © (19.10.06 06:46) [28]
    ага. опытным путём выяснено, что ~7 кил -- максимум. надо сделать авторазюиение поста.

    зыж есть подозрение, что лимиты для "трепологии" побольше. интересно, я прав?
  • VirEx © (19.10.06 07:36) [29]
    Gero_  ( 19.10.06 00:18)  
    VirEx (JDMClient http://jdmc.kladovka.net.ru ). Особенность wap-клиент на Java.  

    ----
    не вап!
  • Ketmar © (19.10.06 08:16) [30]
    >[29] VirEx(c) 19-Oct-2006, 07:36
    всё равно жаба мастдай! %-)
  • VirEx © (19.10.06 08:32) [31]
    Ketmar   ( 19.10.06 08:16)  [29] VirEx(c) 19-Oct-2006, 07:36  
    все равно жаба мастдай! %-)

    ----
    скажи это изену
  • Ketmar © (19.10.06 08:39) [32]
    >[31] VirEx(c) 19-Oct-2006, 08:32
    >скажи это изену
    баян. он непробиваем.
  • Anatoly Podgoretsky © (19.10.06 18:23) [33]

    > Ketmar ©   (19.10.06 03:23) [24]
    > сранно. пост в 9 кил отправить уже не может. кстати: а какое
    > ограничение на размеры тут?

    По последней официальной информации 5000 символов.
 
Конференция "Журнал" » Сколько осталось клиенто писателей?
Есть новые Нет новых   [118476   +37][b:0][p:0.001]