Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ;SayErr  int num_strings, const char* strings[],
  3. ;                      int num_buttons, const char* buttons[]);
  4.  
  5. proc SayErr num_strings:dword, strings:dword,num_buttons:dword, buttons:dword
  6.         pushad
  7.         cmp     [num_strings],1
  8.         je      @f
  9.         m2m     [errmess0], strErrorExc
  10.         jmp     .l1
  11.        @@:
  12.         mov     ebx,[strings]
  13.         m2m     [errmess0], dword [ebx]
  14.        .l1:
  15.         mcall   51,1,threadSayErr,stackDlg
  16.         popad
  17.         mov     eax,1
  18.         ret
  19. endp
  20.  
  21. proc SimpleSayErr str:dword
  22.         pushad
  23.         m2m     [errmess0],[str]
  24.         mcall   51,1,threadSayErr,stackDlg
  25.         popad
  26.         ret
  27. endp
  28.  
  29.  
  30. proc threadSayErr
  31.         mcall   40, 000111b+0C000000h
  32.  
  33. .wm_redraw:
  34.         mcall   12, 1
  35.         mcall   48, 3, sc, sizeof.system_colors
  36.         mov     edx, [sc.work]
  37.  
  38.         or      edx, 0x33000000
  39.         mcall 0, <220,420>, <220,110>, , , title
  40.  
  41.         mov     ecx,[sc.work_text]
  42.         or      ecx,90000000h
  43.         mov     edx,[errmess0]
  44.         mcall 4, <15,11>
  45.  
  46.         mcall 8, <105,100>,<45,25>,1,[sc.work_button]
  47.         mov     ecx,[sc.work_button_text]
  48.         or      ecx,90000000h
  49.         mcall 4, <147,51>, , strOk
  50.  
  51.         mcall 12, 2
  52.  
  53. .still:
  54.         mcall   10
  55.         cmp     eax, 1
  56.         je      .wm_redraw
  57.         cmp     eax, 2
  58.         je      .wm_key
  59.         cmp     eax, 3
  60.         je      .wm_button
  61.         jmp     .still
  62.  
  63. .wm_button:
  64.         mcall   17
  65.  
  66.         cmp     ah, 1
  67.         je      .exit
  68.         jmp     .still
  69.  
  70. .wm_key:
  71.         mcall   2
  72.         jmp     .still
  73. .exit:
  74.         mcall   -1
  75. endp
  76.  
  77. ;-------------------------------------------------------------------------------
  78. ;-------------------------------------------------------------------------------
  79. ;-------------------------------------------------------------------------------
  80.     ; "enter password" dialog for KFar
  81. ;password_dlg:
  82. ;        dd      1       ; use standard dialog colors
  83. ;        dd      -1      ; center window by x
  84. ;        dd      -1      ; center window by y
  85. ;.width  dd      ?       ; width (will be filled according to current console width)
  86. ;        dd      2       ; height
  87. ;        dd      4, 2    ; border size
  88. ;        dd      aEnterPasswordTitle     ; title
  89. ;        dd      ?       ; colors (will be set by KFar)
  90. ;        dd      0       ; used internally by dialog manager, ignored
  91. ;        dd      0, 0    ; reserved for DlgProc
  92. ;        dd      2       ; 2 controls
  93. ;; the string "enter password"
  94. ;        dd      1       ; type: static
  95. ;        dd      1,0     ; upper-left position
  96. ;.width1 dd      ?,0     ; bottom-right position
  97. ;        dd      aEnterPassword  ; data
  98. ;        dd      0       ; flags
  99. ;; editbox for password
  100. ;        dd      3       ; type: edit
  101. ;        dd      1,1     ; upper-left position
  102. ;.width2 dd      ?,0     ; bottom-right position
  103. ;        dd      password_data   ; data
  104. ;        dd      2Ch     ; flags
  105.  
  106.  
  107.  
  108. proc DialogBox dlgInfo:dword
  109.         pushad
  110.         mov     ebx,[dlgInfo]
  111.         mov     eax,[ebx+19*4]
  112.         mov     [forpassword],eax
  113.         mov     byte[eax], 0
  114.         mov     [stateDlg], 0
  115.         mcall   51,1,threadDialogBox,stackDlg
  116.  
  117.         ;wait thread...
  118.     @@: cmp     [stateDlg],0
  119.         jne     @f
  120.         mcall   5,1
  121.         jmp     @b
  122.      @@:
  123.         popad
  124.         cmp     [stateDlg], 1
  125.         jne     @f
  126.         xor     eax, eax
  127.         ret
  128.     @@:
  129.         or      eax, -1
  130.         ret
  131. endp
  132.  
  133. proc threadDialogBox
  134.  
  135.         mcall   40, 100111b+0C000000h
  136.         mov     eax,[forpassword]
  137.         mov     [edtPassword+4*9],eax
  138.         xor     eax,eax
  139.         mov     dword[edtPassword.size], eax
  140.         mov     dword[edtPassword.pos], eax
  141.  
  142. .wm_redraw:
  143.         mcall   12, 1
  144.         mcall   48, 3, sc, sizeof.system_colors
  145.         mov     edx, [sc.work]
  146.         or      edx, 0x33000000
  147.         mcall   0, <200,320>, <200,140>, , , title
  148.  
  149.         edit_boxes_set_sys_color edtPack,endEdits,sc
  150.         stdcall [edit_box_draw],edtPassword
  151.  
  152.  
  153.         mov     ecx,[sc.work_text]
  154.         or      ecx,90000000h
  155.         mcall 4, <56,12>, , strGetPass
  156.  
  157.         mcall 8, <70,80>,<74,22>,2,[sc.work_button]
  158.         mov     ecx,[sc.work_button_text]
  159.         or      ecx,90000000h
  160.         mcall 4, <103,79>, , strOk
  161.  
  162.         mcall 8, <165,80>,<74,22>,1,[sc.work_button]
  163.         mov     ecx,[sc.work_button_text]
  164.         or      ecx,90000000h
  165.         mcall 4, <182,79>, , strCancel
  166.  
  167.  
  168.         mcall 12, 2
  169.  
  170. .still:
  171.         mcall   10
  172.         cmp     eax, 1
  173.         je      .wm_redraw
  174.         cmp     eax, 2
  175.         je      .wm_key
  176.         cmp     eax, 3
  177.         je      .wm_button
  178.         cmp     eax, 6
  179.         je      .wm_mouse
  180.  
  181.         jmp     .still
  182.  
  183. .wm_key:
  184.         mcall   2
  185.         stdcall [edit_box_key],edtPassword
  186.         jmp     .still
  187.  
  188.  
  189. .wm_button:
  190.         mcall   17
  191.  
  192.         cmp     ah, 2           ;OK
  193.         jne     @f
  194.         mov     [stateDlg],1
  195.         jmp     .exit
  196.     @@:
  197.  
  198.         cmp     ah, 1           ;Close window or Cancel
  199.         jne      .still
  200.         mov     [stateDlg],2
  201.         jmp     .exit
  202.  
  203. .wm_mouse:
  204.         stdcall [edit_box_mouse],edtPassword
  205.  
  206.  
  207.         jmp     .still
  208.  
  209. .exit:
  210.         mcall   -1
  211. endp
  212.