Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;
  2. ; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ­ã¦­ë¥ ¤«ï ᮧ¤ ­¨ï ¨
  3. ; à ¡®âë ®ª­  á ª®®à¤¨­ â ¬¨ ¢¥à設
  4. ;
  5.  
  6. wnd_prop_width  equ 320 ;è¨à¨­  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
  7. wnd_prop_height equ 150 ;¢ëá®â  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
  8.  
  9. align 4
  10. wnd_run_prop db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ᮠ᢮©á⢠¬¨ ®¤­®¢à¥¬¥­­®
  11. txt_p db '.',0
  12.  
  13. align 4
  14. wnd_pObj dd 0 ;obj
  15. wnd_pFig dd 0 ;䨣ãà 
  16. wnd_FigN dd 0 ;fig number
  17. wnd_pPoi dd 0 ;select point
  18. wnd_PoiN dd 0 ;select point number
  19.  
  20.  
  21. ;¤ ­®¥ ®ª­® (¯à®æ¥áá) ¢ë§ë¢ ¥âìáï ä㭪樥© but_wnd_coords
  22. align 4
  23. start_prop:
  24. pushad
  25.         mcall SF_SET_EVENTS_MASK,0x27 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩
  26.         inc byte[wnd_run_prop]
  27.  
  28.         ;¨¬ï ®¡ê¥ªâ 
  29.         stdcall mem_copy,capt_p,txt_obj,1+txt_obj.end-txt_obj
  30.         mov edi,capt_p+txt_obj.end-txt_obj
  31.         mov eax,[wnd_pObj]
  32.         or eax,eax
  33.         jz @f
  34.                 add eax,Object.Caption
  35.                 stdcall str_cat,edi,eax
  36.         @@:
  37.         stdcall str_cat,edi,txt_39
  38.         ;¨¬ï 䨣ãàë
  39.         mov edi,capt_fig.name
  40.         mov byte[edi],0 ;clear pervios name
  41.         mov eax,[wnd_pFig]
  42.         or eax,eax
  43.         jz @f
  44.                 add eax,Figure.Caption
  45.                 stdcall str_cat,edi,eax
  46.         @@:
  47.         stdcall str_cat,edi,txt_39
  48.         ;­®¬¥à â®çª¨
  49.         mov edi,capt_poi.numb
  50.         mov byte[edi],0
  51.         mov eax,[wnd_PoiN]
  52.         stdcall convert_int_to_str, 20
  53.  
  54.         edit_boxes_set_sys_color edit1,editboxes_end,sc ;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
  55.         init_checkboxes2 check_boxes,check_boxes_end
  56.         check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc
  57.         call get_point_coords
  58. popad
  59.         call red_win_prop
  60.  
  61. ;­¥ ®âà뢠âì íâã äã­ªæ¨î ®â ¯à¥¤ë¤ã饩
  62. align 4
  63. still_prop:
  64.         pushad
  65.  
  66.         mcall SF_WAIT_EVENT_TIMEOUT,10
  67.         or eax,eax
  68.         jnz @f
  69.                 call timer_funct_prop
  70.                 jmp .end
  71.         @@:
  72.  
  73.         cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
  74.         jne @f
  75.                 call red_win_prop
  76.                 jmp .end
  77.         @@:
  78.         cmp al,2
  79.         jne @f
  80.                 call key_prop
  81.                 jmp .end
  82.         @@:
  83.         cmp al,3
  84.         jz button_prop
  85.         cmp al,6
  86.         jne @f
  87.                 call mouse_prop
  88.         @@:
  89. .end:
  90.         popad
  91.         jmp still_prop
  92.  
  93. align 4
  94. red_win_prop:
  95. pushad
  96.         mcall SF_REDRAW,SSF_BEGIN_DRAW
  97.  
  98.         mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
  99.         mov edi,capt_p ;children window caption
  100.         mov bx,word[procinfo.box.left]
  101.         add bx,word[buf_0.l]
  102.         add bx,5 ;è¨à¨­  ¡®ª®¢®© à ¬ª¨
  103.         shl ebx,16
  104.         mov bx,wnd_prop_width
  105.         mov cx,word[procinfo.box.top]
  106.         add cx,ax ;add skin height
  107.         add cx,word[buf_0.t]
  108.         shl ecx,16
  109.         mov cx,wnd_prop_height
  110.         mov edx,[sc.work]
  111.         or  edx,0x33000000
  112.         xor eax,eax
  113.         int 0x40
  114.  
  115.         mov esi,[sc.work_button]
  116.         ;ebx = (l<:)+w, ecx = (t<:)+h
  117.         mcall SF_DEFINE_BUTTON, (5 shl 16)+59, (95 shl 16)+20, 3
  118.         mcall , (75 shl 16)+59, (95 shl 16)+20, 4
  119.  
  120.         mov ecx,[sc.work_text]
  121.         bts ecx,31 ;à¨á㥬 ï áâப  § ª ­ç¨¢ ¥âáï ­ã«ñ¬
  122.         mcall SF_DRAW_TEXT, (5 shl 16)+5,, capt_fig
  123.         mcall , (5 shl 16)+15,, capt_poi
  124.  
  125.         mcall , (5 shl 16)+32,, capt_coord_x
  126.         mcall , (5 shl 16)+50,, capt_coord_y
  127.  
  128.         mov ecx,[sc.work_button_text]
  129.         bts ecx,31
  130.         mcall , (9 shl 16)+101,, txt_but_cancel
  131.         mov edx,txt_but_apply
  132.         cmp dword[wnd_pPoi],0
  133.         jne @f
  134.                 mov edx,txt_but_create
  135.         @@:
  136.         mcall ,(79 shl 16)+101
  137.  
  138.         stdcall [edit_box_draw], edit1
  139.         stdcall [edit_box_draw], edit2
  140.         checkboxes_draw2 check_boxes,check_boxes_end
  141.  
  142.         mcall SF_REDRAW,SSF_END_DRAW
  143. popad
  144.         ret
  145.  
  146. align 4
  147. proc key_prop uses eax ebx
  148.         mcall SF_GET_KEY
  149.  
  150.         test word [edit1.flags],10b ;ed_focus
  151.         je @f
  152.                 stdcall [edit_box_key], edit1
  153.                 jmp .end
  154.         @@:
  155.         test word [edit2.flags],10b
  156.         je @f
  157.                 stdcall [edit_box_key], edit2
  158.                 ;jmp .end
  159.         @@:
  160.  
  161.         .end:
  162.         ret
  163. endp
  164.  
  165. align 4
  166. mouse_prop:
  167.         stdcall [edit_box_mouse], edit1
  168.         stdcall [edit_box_mouse], edit2
  169.         checkboxes_mouse2 check_boxes,check_boxes_end
  170.         ret
  171.  
  172. align 4
  173. button_prop:
  174.         mcall SF_GET_BUTTON
  175.  
  176.         cmp ah,3
  177.         je .exit
  178.         cmp ah,4
  179.         jne .end_save
  180.                 push eax ebx ecx edi esi
  181.                 mov ebx,[wnd_pPoi]
  182.                 or ebx,ebx
  183.                 jnz .select_1
  184.                         ; *** create new point ***
  185.                         mov ebx,[wnd_pFig]
  186.                         mov eax,[ebx+Figure.PoiCount]
  187.                         inc eax
  188.                         imul eax,sizeof.Point
  189.                         stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax
  190.                         mov [ebx+Figure.PoiData],eax
  191.                         inc dword[ebx+Figure.PoiCount]
  192.                         mov ebx,[ebx+Figure.PoiCount]
  193.                         dec ebx
  194.                         imul ebx,sizeof.Point
  195.                         add ebx,eax
  196.                 .select_1:
  197.                         finit
  198.  
  199.                         mov esi,string1
  200.                         mov edi,Data_String
  201.                         cld
  202.                         mov ecx,8
  203.                         rep movsd
  204.                         call String_to_DoubleFloat
  205.                         fld  qword[Data_Double] ;áç¨â뢠¥¬ ª ª double
  206.                         fstp qword[ebx+Point.CoordX] ;á®å࠭塞 ª ª double
  207.  
  208.                         mov esi,string2
  209.                         mov edi,Data_String
  210.                         cld
  211.                         mov ecx,8
  212.                         rep movsd
  213.                         call String_to_DoubleFloat
  214.                         fld  qword[Data_Double]
  215.                         fstp qword[ebx+Point.CoordY]
  216.  
  217.                         stdcall figure_update_coords,[wnd_pObj],[wnd_FigN]
  218.                         ;¢ëáâ ¢«ï¥¬ ᢮©á⢠
  219.                         and dword[ebx+Point.Prop], not 7 ;7 = 2^PROP_BIT_START +2^PROP_BIT_LINE +2^PROP_BIT_LINE_CLOSE)
  220.                         mov dword[offs_last_timer],0 ;¤«ï ®¡­®¢«¥­¨ï ¡«®ª  ¢ â ©¬¥à¥
  221.                 pop esi edi ecx ebx eax
  222.                 jmp .exit
  223.         .end_save:
  224.  
  225.         cmp ah,1
  226.         jne still_prop.end
  227. .exit:
  228.         mov byte[wnd_run_prop],0 ;®¡­ã«ï¥¬ áç¥â稪 ®ª®­
  229.         mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë
  230.  
  231. align 4
  232. proc get_point_coords uses eax ebx
  233.         ;§ £à㧪  ª®®à¤¨­ â ¢ editbox-ë
  234.         mov ebx,[wnd_pPoi]
  235.         btr dword[ch1.flags],1
  236.         btr dword[ch2.flags],1
  237.         btr dword[ch3.flags],1
  238.         or ebx,ebx
  239.         jz .end0
  240.                 mov word[NumberSymbolsAD],8
  241.                 finit
  242.                 fld qword[ebx+Point.CoordX]
  243.                 fstp qword[Data_Double]
  244.                 call DoubleFloat_to_String
  245.                 call String_crop_0
  246.                 stdcall [edit_box_set_text], edit1, Data_String
  247.                 fld qword[ebx+Point.CoordY]
  248.                 fstp qword[Data_Double]
  249.                 call DoubleFloat_to_String
  250.                 call String_crop_0
  251.                 stdcall [edit_box_set_text], edit2, Data_String
  252.                 ;
  253.                 jmp .end1
  254.         .end0:
  255.                 stdcall [edit_box_set_text], edit1, txt_p
  256.                 stdcall [edit_box_set_text], edit2, txt_p
  257.         .end1:
  258.                 ;stdcall [edit_box_draw], edit1
  259.                 ;stdcall [edit_box_draw], edit2
  260.         ret
  261. endp
  262.  
  263. align 4
  264. proc timer_funct_prop
  265.         ;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ãî ª®®à¤¨­ âã
  266.         ret
  267. endp
  268.  
  269. align 4
  270. capt_p rb 64
  271. if lang eq ru
  272. capt_fig: db 'Š®¬ ­¤ : ',39
  273. .name: rb 55
  274. capt_poi: db '’®çª : '
  275. .numb: rb 25
  276. else
  277. capt_fig: db 'Command: ',39
  278. .name: rb 55
  279. capt_poi: db 'Point: '
  280. .numb: rb 25
  281. end if
  282.  
  283. capt_coord_x db 'X:',0
  284. capt_coord_y db 'Y:',0
  285.  
  286. edit1 edit_box 80, 18, 28, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0
  287. edit2 edit_box 80, 18, 46, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0
  288. editboxes_end:
  289.  
  290. string1 rb 34
  291. string2 rb 34
  292.  
  293. check_boxes:
  294. ch1 check_box2 (115 shl 16+15),(28 shl 16 +11),5,0xffffff,0,0x80000000,ch_text.1,ch_flag_en+ch_flag_middle
  295. ch2 check_box2 (115 shl 16+15),(43 shl 16 +11),5,0xffffff,0,0x80000000,ch_text.2,ch_flag_en+ch_flag_middle
  296. ch3 check_box2 (115 shl 16+15),(58 shl 16 +11),5,0xffffff,0,0x80000000,ch_text.3,ch_flag_en+ch_flag_middle
  297. check_boxes_end:
  298.  
  299. ch_text:
  300. .1 db 'X',0
  301. .2 db 'Y',0
  302. .3 db 'Z',0
  303.