Subversion Repositories Kolibri OS

Rev

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

  1. SYS_COL  = 0xe6e6e6
  2. BT_COL   = 0xcccccc
  3. STR_COL  = 0x595959 ;0x000000
  4.  
  5. WIN_X = 320
  6. WIN_Y = 300
  7. WIN_W = 390
  8. WIN_H = 230
  9.  
  10. pad = 28 ; padding between editboxes
  11.  
  12. ;;================================================================================================;;
  13. login_gui: ;//////////////////////////////////////////////////////////////////////////////////////;;
  14. ;;------------------------------------------------------------------------------------------------;;
  15. ;? Login GUI-specific functions                                                                   ;;
  16. ;;------------------------------------------------------------------------------------------------;;
  17. ;> none                                                                                           ;;
  18. ;;------------------------------------------------------------------------------------------------;;
  19. ;< none                                                                                           ;;
  20. ;;================================================================================================;;
  21.  
  22.     ; TODO: print error strings (wrong user, pass, etc.)
  23.  
  24.   .server_addr:
  25.         mov     [initial_login], 1
  26.  
  27.   .get_username:
  28.         ; in case of error when either login_gui.server_addr or
  29.         ; login_gui.get_username is called, should resize window
  30.         mcall   67, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
  31.  
  32.   .redraw:
  33.         call    .draw
  34.         jmp     .still
  35.  
  36.  
  37.   align 4
  38.   .draw:
  39.         mcall   12, 1
  40.         mcall   0, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, 0x34000000+SYS_COL, 0x805080DD, str_title
  41.  
  42.         stdcall [edit_box_draw], edit_usr
  43.         stdcall [edit_box_draw], edit_pass
  44.         stdcall [edit_box_draw], edit_server
  45.         stdcall [edit_box_draw], edit_port
  46.         stdcall [edit_box_draw], edit_path
  47.  
  48.         ; draw "connect" button
  49.         mcall   8, <162,65>, <150,25>, 2, BT_COL
  50.  
  51.         ; draw strings
  52.         mcall   4, <3,      8>, 0xb0000000, gui_str_usr
  53.         mcall    , <3,pad*1+8>,           , gui_str_pass
  54.         mcall    , <3,pad*2+8>,           , gui_str_server
  55.         mcall    , <3,pad*3+8>,           , gui_str_port
  56.         mcall    , <3,pad*4+8>,           , gui_str_path
  57.         mcall    , <167,155>, 0xb0000000+STR_COL, gui_str_connect
  58.         mcall    , <3,115>, 0xb0ff0000, [str_error_addr]
  59.         mov     [str_error_addr], gui_str_null ; reset error string address
  60.  
  61.         mcall   12, 2
  62.         ret
  63.  
  64.   align 4
  65.   .still:
  66.         mcall    10     ; wait for event
  67.         dec      eax
  68.         jz       .redraw
  69.         dec      eax
  70.         jz       .key
  71.         dec      eax
  72.         jz       .button
  73.  
  74.         stdcall [edit_box_mouse], edit_usr
  75.         stdcall [edit_box_mouse], edit_pass
  76.         stdcall [edit_box_mouse], edit_server
  77.         stdcall [edit_box_mouse], edit_port
  78.         stdcall [edit_box_mouse], edit_path
  79.  
  80.         jmp     .still
  81.  
  82.   .button:
  83.         mcall   17
  84.  
  85.         dec     ah
  86.         jz      .exit
  87.  
  88.         dec     ah   ; 'Connect' button clicked
  89.         jz      gui.main
  90.  
  91.         jmp     .still
  92.  
  93.   .key:
  94.         mcall   2
  95.  
  96.         cmp     ah,13
  97.         je      gui.main
  98.  
  99.         cmp     ah,9
  100.         je      .tab
  101.  
  102.         stdcall [edit_box_key], edit_usr
  103.         stdcall [edit_box_key], edit_pass
  104.         stdcall [edit_box_key], edit_server
  105.         stdcall [edit_box_key], edit_port
  106.         stdcall [edit_box_key], edit_path
  107.  
  108.         jmp     .still
  109.  
  110.   .error:
  111.         mov     [str_error_addr], gui_str_error
  112.         jmp     .server_addr
  113.    
  114.   .exit:
  115.         jmp     gui.exit
  116.  
  117.   .tab:
  118.         ;TODO
  119.         jmp     .still
  120.  
  121.  
  122. gui_str_connect db 'Connect',0
  123. gui_str_usr     db 'Username:',0
  124. gui_str_pass    db 'Password:',0
  125. gui_str_server  db 'Server:',0
  126. gui_str_port    db 'Port:',0
  127. gui_str_path    db 'Path:',0
  128. gui_str_error   db 'ERROR! Check log file for details',0
  129. gui_str_null    db ' ',0
  130.  
  131. str_error_addr  dd gui_str_null
  132.  
  133. ; login window components
  134. edit_usr    edit_box 300,75,5,      0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_user,mouse_dd,ed_focus
  135. edit_pass   edit_box 300,75,pad+5,  0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_password,mouse_dd,ed_pass
  136. edit_server edit_box 300,75,pad*2+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_server_addr,mouse_dd,0
  137. edit_port   edit_box 50, 75,pad*3+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_port,mouse_dd,ed_figure_only
  138. edit_path   edit_box 300,75,pad*4+5,0xffffff,0x94AECE,0,0xAABBCC,0x10000000,99,param_path,mouse_dd,0
  139.  
  140. mouse_dd rd 1