Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ;FigureInit, (Object.FigData)
  3.  
  4. ;add_object_in_list, (¢à¥¬. áâà.), (Object.FigData)
  5. ;       mov [Object.FigData], (tl_node_add(¢à¥¬. áâà.),tl_node_get_data)
  6.  
  7. ;draw_fig2d_litl, ___, pobj, (Object.FigData), fign, ___, ___, ___
  8.  
  9. struct Object
  10.         OType dd ?
  11.         FigCount dd ?
  12.         FigData dd ? ;array pointers to Figures
  13.         MinX dq ?
  14.         MinY dq ?
  15.         SizeX dq ?
  16.         SizeY dq ?
  17.         WScale dq ? ;prewiew window scale
  18.         MScale dq ? ;mouse scale (show partition figure)
  19.         MCentrX dd ? ;mouse centr X
  20.         MCentrY dd ? ;mouse centr Y
  21.         Caption rb 32
  22. ends
  23.  
  24. struct Figure
  25.         OType dd ?
  26.         PoiCount dd ?
  27.         PoiData dd ?
  28.         MinX dq ?
  29.         MinY dq ?
  30.         SizeX dq ?
  31.         SizeY dq ?
  32.         WScale dq ? ;prewiew window scale (show all figure)
  33.         MScale dq ? ;mouse scale (show partition figure)
  34.         MCentrX dd ? ;mouse centr X
  35.         MCentrY dd ? ;mouse centr Y
  36.         Caption rb 32
  37. ends
  38.  
  39. struct Point
  40.         Prop dd ? ;prorerties
  41.         CoordX dq ? ;coord X
  42.         CoordY dq ? ;coord Y
  43. ends
  44.  
  45. txt_err_1 db 'Žè¨¡ª  ¯à¨ áç¨â뢠­¨¨ ®¡ê¥ªâ ',0
  46. txt_err_2 db 'Žè¨¡ª  ¯à¨ áç¨â뢠­¨¨ 䨣ãàë',0
  47. txt_err_3 db '¥ ­ ©¤¥­  â®çª  ¢ 䨣ãà¥',0
  48. txt_err_no_figure_select db '¥ ¢ë¡à ­  ª®¬ ­¤  ¤«ï ¯¥à¥¬¥é¥­¨ï',0
  49. txt_err_figure_is_0 db 'Š®¬ ­¤  ­¥ ¬®¦¥â ¡ëâì ᤢ¨­ãâ  ¢¢¥àå,',13,10,'®­  ¢ ­ ç «¥ ᯨ᪠.',0
  50. txt_err_figure_is_last db 'Š®¬ ­¤  ­¥ ¬®¦¥â ¡ëâì ᤢ¨­ãâ  ¢­¨§,',13,10,'®­  ¢ ª®­æ¥ ᯨ᪠.',0
  51. txt_err_no_point_del db '¥ ¬®¦­  㤠«¨âì ¢á¥ â®çª¨ ¨§ 䨣ãàë.',0
  52. txt_err_poi_is_0 db '¥ ¬®¦­  ¯¥à¥¬¥áâ¨âì â®çªã ¢¢¥àå,',13,10,'®­  ¢ ­ ç «¥ ᯨ᪠.',0
  53. txt_err_poi_is_last db '¥ ¬®¦­  ¯¥à¥¬¥áâ¨âì â®çªã ¢­¨§,',13,10,'®­  ¢ ª®­æ¥ ᯨ᪠.',0
  54. txt_err_no_1_point_sel db '‚ë¡¥à¨â¥ ­¥ ¡®«ìè¥ ®¤­®© â®çª¨.',0
  55.  
  56. txt_min_x db 'min x: ',0
  57. txt_min_y db 'min y: ',0
  58.  
  59. if lang eq ru
  60. ;
  61. ; rus
  62. ;
  63. txt_preview db 'à¥¤¯à®á¬®âà १ã«ìâ â :',0
  64. txt_port db '®àâ:',0
  65. txt_but_cancel db 'Žâ¬¥­ ',0
  66. txt_but_run db '‚믮«­¨âì',0
  67. txt_size_x db 'à §¬¥à x: ',0
  68. txt_size_y db 'à §¬¥à y: ',0
  69. txt_command:
  70.   db 'Š®¬ ­¤ :', 0
  71.   .end:
  72. txt_filename:
  73.   db '” ©« (¯®«­ë© ¯ãâì):', 0
  74.   .end:
  75. else
  76. ;
  77. ; eng
  78. ;
  79. txt_preview db 'Preview:',0
  80. txt_port db 'Port:',0
  81. txt_but_cancel db 'Cancel',0
  82. txt_but_run db 'Run',0
  83. txt_size_x db 'size x: ',0
  84. txt_size_y db 'size y: ',0
  85. txt_command:
  86.   db 'Command:', 0
  87.   .end:
  88. txt_filename:
  89.   db 'Full file name (path):', 0
  90.   .end:
  91. end if
  92.  
  93. align 4
  94. txt_s_poi db 'X',0
  95. txt_s_poi_Y db ' Y',0
  96. txt_s_poi_Z db ' Z',0
  97. txt_n db 13,0
  98.  
  99. align 4
  100. zoom_plus dq 1.25992105
  101. mouse_prop_x dd 0 ;ªãàá®à ¬ëè¨ ®â­®á¨â¥«ì­® 業âà  ®ª­  buf_0 (¤«ï ¨§¬¥­. ¬ áèâ ¡ )
  102. mouse_prop_y dd 0
  103. mouse_down_x dd 0 ;ªãàá®à ¬ëè¨ ®â­®á¨â¥«ì­® «¥¢®£® ¢¥àå­¥£® 㣫  ®ª­  buf_0 (¤«ï ᤢ¨£  䨣ãàë)
  104. mouse_down_y dd 0
  105. opt_draw  dd 1
  106. graf_margin_left   dd 3 ;margin in pixels
  107. graf_margin_right  dd 3+6 ;margin in pixels
  108. graf_margin_top    dd 3+9 ;margin in pixels
  109. graf_margin_bot    dd 3+9 ;margin in pixels
  110. data_printed dd ? ;ç¨á«® ¢ë¯®«­¥­­ëå ª®¬ ­¤
  111. data_all     dd ? ;ç¨á«® ¢á¥å ª®¬ ­¤
  112.  
  113. ;global variables:
  114. ObjData Object
  115. FigData Figure ;¢à¥¬¥­­ ï áâàãªâãà  ¤«ï § ¯®«­¥­¨ï tree1
  116. PoiData Point
  117.  
  118. size_one_list equ sizeof.Figure ;max (sizeof.Figure, sizeof.Object)
  119.  
  120. if sizeof.Object > sizeof.Figure
  121.    ... need fix size_one_list
  122. end if
  123.  
  124. if (Object.FigCount <> Figure.PoiCount) | (Object.FigData <> Figure.PoiData) | (Object.MScale <> Figure.MScale) | (Object.MCentrX <> Figure.MCentrX) | (Object.MCentrY <> Figure.MCentrY)
  125.    ... need fix offsets
  126. end if
  127.        
  128. txt_buf rb 80 ;???
  129. txt_sp db ' ',0
  130.  
  131. ;input:
  132. ; esi - text pointer
  133. align 4
  134. proc txt_next_line uses eax ecx edi, mlen:dword
  135.         mov al,13
  136.         mov ecx,[mlen]
  137.         mov edi,esi
  138.         repne scasb
  139.         cmp byte[edi],10
  140.         jne @f
  141.                 inc edi
  142.         @@:
  143.         mov esi,edi
  144.         ret
  145. endp
  146.  
  147. ;input:
  148. ; edi - destination buffer
  149. ; esi - source text string: '...\nl
  150. ; mlen - maximum len destination buffer
  151. align 4
  152. proc txt_load_line uses eax ebx ecx esi, mlen:dword
  153.         mov byte[edi],0
  154.         mov al,13
  155.         cmp byte[esi],al
  156.         je .end_f
  157.                 mov ecx,[mlen]
  158.                 mov ebx,edi
  159.                 mov edi,esi
  160.                 repne scasb ;found end of string
  161.                 mov ecx,edi
  162.                 sub ecx,esi
  163.                 dec ecx ;ecx = string len
  164.                 mov edi,ebx
  165.                 rep movsb ;copy caption string
  166.                 cmp byte[esi],13
  167.                 je @f
  168.                 .cycle0:
  169.                         inc esi
  170.                         cmp byte[esi],13
  171.                         jne .cycle0
  172.                 @@:
  173.                 mov byte[edi],0
  174.                 inc esi
  175.         .end_f:
  176.         ret
  177. endp
  178.  
  179. ;input:
  180. ; itxt - input description text
  181. ; msize - max size
  182. align 4
  183. proc FileInit uses eax ebx ecx edi esi, itxt:dword, msize:dword
  184.         cmp dword[ObjData.FigData],0
  185.         je @f
  186.         cmp dword[ObjData.FigCount],0 ;or Figure.PoiCount
  187.         je @f
  188.                 stdcall mem.Free,[ObjData.FigData] ;or Figure.PoiData
  189.         @@:
  190.         mov dword[offs_last_timer],0
  191.  
  192.         mov esi,[itxt]
  193.         mov ebx,esi
  194.         add ebx,[msize]
  195.         stdcall ObjectInit,ObjData,ebx
  196.         ret
  197. endp
  198.  
  199. ;input:
  200. ; esi - input description text
  201. ; pobj - pointer to object struct
  202. ; etxt - pointer to end of input text
  203. align 4
  204. proc ObjectInit uses eax ebx ecx edi, pobj:dword, etxt:dword
  205.                 mov ebx,[pobj]
  206.                 mov [ebx+Object.OType],'Obj'
  207.                 mov edi,ebx
  208.                 add edi,Object.Caption
  209.                 mov dword[edi],'CNC'
  210.  
  211.                 stdcall get_max_lines
  212.                 test eax,eax
  213.                 jz .err_init
  214.                 mov [ebx+Object.FigCount],eax
  215.                 mov ecx,eax
  216.  
  217.                 shl eax,2
  218.                 stdcall mem.Alloc,eax
  219.                 mov [ebx+Object.FigData],eax
  220.                 push ecx
  221.                         mov edi,eax
  222.                         xor eax,eax
  223.                         mov [data_all],eax ;å¨â஥ ­ ç «ì­®¥ ®¡­ã«¥­¨¥ áç¥â稪 
  224.                         mov [data_printed],eax
  225.                         rep stosd ;clear memory
  226.                 pop ecx
  227.  
  228.                 mov edi,[ebx+Object.FigData]
  229. align 4
  230.                 .cycle0:
  231.                         stdcall FigureInit,edi
  232.                         mov eax,[edi]
  233.                         mov eax,[eax+Figure.PoiCount]
  234.                         or eax,eax
  235.                         jnz @f
  236.                                 inc eax ;¬¨­¨¬ã¬ 1-­  ª®¬ ­¤ 
  237.                         @@:
  238.                         add [data_all],eax
  239.                         cmp esi,[etxt]
  240.                         jge .cycle0end
  241.                         add edi,4
  242.                 loop .cycle0
  243.                 .cycle0end:
  244.                 inc dword[ebx+Object.FigCount]
  245.                 or ecx,ecx
  246.                 jz @f
  247.                         ;㬥­ìè ¥¬ ®¡ê¥¬ ¯ ¬ï⨠¢ë¤¥«¥­­ë© ¤«ï ª®¬ ­¤
  248.                         sub [ebx+Object.FigCount],ecx
  249.                         mov eax,[ebx+Object.FigCount]
  250.                         shl eax,2
  251.                         stdcall mem.ReAlloc,[ebx+Object.FigData],eax
  252.                         mov [ebx+Object.FigData],eax
  253.                 @@:
  254.                 ;ãáâ ­®¢ª  áç¥â稪  ¨ ¯à®£à¥á¡ à  ­  25 %
  255.                 mov eax,[data_all]
  256.                 mov [pb.max],eax
  257.                 shr eax,2
  258.                 mov [data_printed],eax
  259.                 mov [pb.value],eax
  260.  
  261.                 stdcall ObjCalculateScale,ebx
  262.  
  263.                 jmp .end_f
  264.         .err_init:
  265.                 notify_window_run txt_err_1
  266.         .end_f:
  267.         ret
  268. endp
  269.  
  270. align 4
  271. proc ObjCalculateScale uses eax ebx ecx edi, pobj:dword
  272.         mov ebx,[pobj]
  273.  
  274.         ;*** Calculate scale for object ***
  275.         finit
  276.  
  277.         ;found min coord X
  278.         mov ecx,[ebx+Object.FigCount]
  279.         jecxz .cycle2end
  280.         mov edi,[ebx+Object.FigData]
  281.         @@:
  282.                 mov eax,[edi]
  283.                 dec ecx
  284.                 jecxz .cycle2end
  285.                 add edi,4
  286.                 or eax,eax
  287.                 jz @b
  288.                 cmp [eax+Figure.PoiCount],0
  289.                 je @b
  290.         push edi esi ;copy first min X
  291.                 lea esi,[eax+Figure.MinX]
  292.                 lea edi,[ebx+Object.MinX]
  293.                 movsd
  294.                 movsd
  295.         pop esi edi
  296. align 4
  297.         .cycle2:
  298.                 mov eax,[edi]
  299.                 or eax,eax
  300.                 jz @f
  301.                 cmp [eax+Figure.PoiCount],0
  302.                 je @f
  303.                 fld qword[eax+Figure.MinX]
  304.                 fcomp qword[ebx+Object.MinX]
  305.                 fstsw ax
  306.                 sahf
  307.                 jae @f
  308.                         push edi esi
  309.                         mov eax,[edi]
  310.                         lea esi,[eax+Figure.MinX]
  311.                         lea edi,[ebx+Object.MinX]
  312.                         movsd
  313.                         movsd
  314.                         pop esi edi
  315.                 @@:
  316.                 add edi,4
  317.         loop .cycle2
  318.         .cycle2end:
  319.  
  320.         ;found min coord Y
  321.         mov ecx,[ebx+Object.FigCount]
  322.         jecxz .cycle3end
  323.         mov edi,[ebx+Object.FigData]
  324.         @@:
  325.                 mov eax,[edi]
  326.                 dec ecx
  327.                 jecxz .cycle3end
  328.                 add edi,4
  329.                 or eax,eax
  330.                 jz @b
  331.                 cmp [eax+Figure.PoiCount],0
  332.                 je @b
  333.         push edi esi ;copy first min Y
  334.                 lea esi,[eax+Figure.MinY]
  335.                 lea edi,[ebx+Object.MinY]
  336.                 movsd
  337.                 movsd
  338.         pop esi edi
  339. align 4
  340.         .cycle3:
  341.                 mov eax,[edi]
  342.                 or eax,eax
  343.                 jz @f
  344.                 cmp [eax+Figure.PoiCount],0
  345.                 je @f
  346.                 fld qword[eax+Figure.MinY]
  347.                 fcomp qword[ebx+Object.MinY]
  348.                 fstsw ax
  349.                 sahf
  350.                 jae @f
  351.                         push edi esi
  352.                         mov eax,[edi]
  353.                         lea esi,[eax+Figure.MinY]
  354.                         lea edi,[ebx+Object.MinY]
  355.                         movsd
  356.                         movsd
  357.                         pop esi edi
  358.                 @@:
  359.                 add edi,4
  360.         loop .cycle3
  361.         .cycle3end:
  362.  
  363.         ;found max coord X
  364.         mov ecx,[ebx+Object.FigCount]
  365.         jecxz .cycle4end
  366.         mov edi,[ebx+Object.FigData]
  367.         ;copy first min X
  368.         mov eax,[edi]
  369.         fld qword[eax+Figure.MinX]
  370.         fadd qword[eax+Figure.SizeX]
  371.         fstp qword[ebx+Object.SizeX]
  372.         dec ecx
  373.         jecxz .cycle4end
  374. align 4
  375.         .cycle4:
  376.                 add edi,4
  377.                 mov eax,[edi]
  378.                 or eax,eax
  379.                 jz @f
  380.                 cmp [eax+Figure.PoiCount],0
  381.                 je @f
  382.                 fld qword[eax+Figure.MinX]
  383.                 fadd qword[eax+Figure.SizeX]
  384.                 fcomp qword[ebx+Object.SizeX]
  385.                 fstsw ax
  386.                 sahf
  387.                 jbe @f
  388.                         mov eax,[edi]
  389.                         fld qword[eax+Figure.MinX]
  390.                         fadd qword[eax+Figure.SizeX]
  391.                         fstp qword[ebx+Object.SizeX]
  392.                 @@:
  393.         loop .cycle4
  394.         .cycle4end:
  395.  
  396.         ;found max coord Y
  397.         mov ecx,[ebx+Object.FigCount]
  398.         jecxz .cycle5end
  399.         mov edi,[ebx+Object.FigData]
  400.         ;copy first min Y
  401.         mov eax,[edi]
  402.         fld qword[eax+Figure.MinY]
  403.         fadd qword[eax+Figure.SizeY]
  404.         fstp qword[ebx+Object.SizeY]
  405.         dec ecx
  406.         jecxz .cycle5end
  407. align 4
  408.         .cycle5:
  409.                 add edi,4
  410.                 mov eax,[edi]
  411.                 or eax,eax
  412.                 jz @f
  413.                 cmp [eax+Figure.PoiCount],0
  414.                 je @f
  415.                 fld qword[eax+Figure.MinY]
  416.                 fadd qword[eax+Figure.SizeY]
  417.                 fcomp qword[ebx+Object.SizeY]
  418.                 fstsw ax
  419.                 sahf
  420.                 jbe @f
  421.                         mov eax,[edi]
  422.                         fld qword[eax+Figure.MinY]
  423.                         fadd qword[eax+Figure.SizeY]
  424.                         fstp qword[ebx+Object.SizeY]
  425.                 @@:
  426.         loop .cycle5
  427.         .cycle5end:
  428.  
  429.         ;found size X
  430.         fld qword[ebx+Object.SizeX]
  431.         fsub qword[ebx+Object.MinX]
  432.         fstp qword[ebx+Object.SizeX]
  433.         ;found size Y
  434.         fld qword[ebx+Object.SizeY]
  435.         fsub qword[ebx+Object.MinY]
  436.         fstp qword[ebx+Object.SizeY]
  437.  
  438.         ;*** Calculate scale ***
  439.                 fld1
  440.                 fstp qword[ebx+Object.WScale] ;set default scale
  441.  
  442.                 fld qword[ebx+Object.SizeX]
  443.                 ftst
  444.                 fstsw ax
  445.                 sahf
  446.                 jne .els_0 ;if (SizeX == 0.0)
  447.                         ffree st0
  448.                         fincstp
  449.                         jmp .els_1
  450.                 .els_0: ;else if (SizeX != 0.0)
  451.                         fild dword[buf_0.w]
  452.                         fisub dword[graf_margin_left]
  453.                         fisub dword[graf_margin_right]
  454.                         fxch st1
  455.                         fdivp
  456.                         fstp qword[ebx+Object.WScale]
  457.                 .els_1:
  458.  
  459.                 fld qword[ebx+Object.SizeY]
  460.                 ftst
  461.                 fstsw ax
  462.                 sahf
  463.                 jne .els_2 ;if (SizeY == 0.0)
  464.                         ffree st0
  465.                         fincstp
  466.                         jmp .els_3
  467.                 .els_2: ;else if (SizeY != 0.0)
  468.                         fild dword[buf_0.h]
  469.                         fisub dword[graf_margin_top]
  470.                         fisub dword[graf_margin_bot]
  471.                         fxch st1
  472.                         fdivp
  473.                         fcom qword[ebx+Object.WScale]
  474.                         fstsw ax
  475.                         sahf
  476.                         jbe @f
  477.                                 ffree st0
  478.                                 fincstp
  479.                                 jmp .els_3
  480.                         @@:
  481.                         fstp qword[ebx+Object.WScale]
  482.                 .els_3:
  483.  
  484.                 fld1
  485.                 fstp qword[ebx+Figure.MScale]
  486.                 mov dword[ebx+Figure.MCentrX],0
  487.                 mov dword[ebx+Figure.MCentrY],0
  488.         ret
  489. endp
  490.  
  491. ;input:
  492. ; esi - input description text
  493. ; pfig - pointer to figure struct
  494. ;output:
  495. ; esi - output description text
  496. align 4
  497. proc FigureInit uses eax ebx ecx edx edi, pfig:dword
  498.         mov ebx,FigData ; temp struct
  499.         mov [ebx+Figure.OType],'Fig'
  500.         mov edi,ebx
  501.         add edi,Figure.Caption
  502.         stdcall txt_load_line,32
  503.                
  504.         xor eax,eax
  505.         mov [ebx+Figure.PoiCount],eax
  506.         mov [ebx+Figure.PoiData],eax
  507.         cmp byte[esi],'X'
  508.         jne .end0
  509.                 stdcall get_max_points
  510.                 mov [ebx+Figure.PoiCount],eax
  511.                 or eax,eax
  512.                 jz .end0
  513.                 mov ecx,eax
  514.                 imul eax,sizeof.Point
  515.                 stdcall mem.Alloc,eax
  516.                 mov [ebx+Figure.PoiData],eax
  517.                 or eax,eax
  518.                 jz .err_init
  519.                 mov edi,eax
  520. align 4
  521.                 .cycle0:
  522.                         stdcall PointInit,edi
  523.                         or eax,eax
  524.                         jz .cycle0end
  525.                         add edi,sizeof.Point
  526.                         loop .cycle0
  527.                 .cycle0end:
  528.                 or ecx,ecx
  529.                 jz .end1
  530.                         ;㬥­ìè ¥¬ ®¡ê¥¬ ¯ ¬ï⨠¢ë¤¥«¥­­ë© ¤«ï â®ç¥ª
  531.                         sub [ebx+Figure.PoiCount],ecx
  532.                         mov eax,[ebx+Figure.PoiCount]
  533.                         imul eax,sizeof.Point
  534.                         stdcall mem.ReAlloc,[ebx+Figure.PoiData],eax
  535.                         mov [ebx+Figure.PoiData],eax
  536.                 jmp .end1
  537.         .err_init:
  538.                 notify_window_run txt_err_2
  539.         .end0:
  540.                 ;command
  541.                 stdcall txt_next_line, 80
  542.                 cmp byte[esi],13
  543.                 jne @f
  544.                         ;if null line
  545.                         inc esi
  546.                         cmp byte[esi],10
  547.                         jne .end2
  548.                                 inc esi
  549.                         .end2:
  550.                         mov dword[edi],(10 shl 8)+13 ;new line
  551.                 @@:
  552.                 stdcall add_object_in_list,ebx,[pfig]
  553.                 jmp .end_f
  554.         .end1:
  555.                 ;coords
  556.                 stdcall add_object_in_list,ebx,[pfig]
  557.                 or eax,eax
  558.                 jz .end_f
  559.                 stdcall FigCalculateSizes,eax,1
  560.         .end_f:
  561.         ret
  562. endp
  563.  
  564. ;input:
  565. ; esi - pointer to file
  566. ;output:
  567. ; eax - max lines in file
  568. align 4
  569. proc get_max_lines uses esi
  570.         xor eax,eax
  571.         .cycle0:
  572.                 cmp byte[esi],13
  573.                 jne @f
  574.                         inc eax
  575.                 @@:
  576.                 inc esi
  577.                 cmp byte[esi],0
  578.                 jne .cycle0
  579.         ret
  580. endp
  581.  
  582. ;input:
  583. ; esi - pointer to file
  584. ;output:
  585. ; eax - max point coords in file
  586. align 4
  587. proc get_max_points uses esi
  588.         xor eax,eax
  589.         .cycle0:
  590.                 cmp word[esi],' Y'
  591.                 jne @f
  592.                         inc eax
  593.                 @@:
  594.                 inc esi
  595.                 cmp byte[esi+1],0
  596.                 jne .cycle0
  597.         ret
  598. endp
  599.  
  600. ;input:
  601. ; opt_calc - ¥á«¨ 0 - ¯¥à¥áç¨â âì ¬ áèâ ¡ 䨣ãàë,
  602. ;                 1 - ¯¥à¥áç¨â âì à §¬¥àë ¨ ¬ áèâ ¡ 䨣ãàë
  603. align 4
  604. proc FigCalculateSizes uses eax ebx ecx edi esi, pfig:dword, opt_calc:dword
  605.         mov ebx,[pfig]
  606.         or ebx,ebx
  607.         jz .end_f
  608.  
  609.         finit
  610.         bt dword[opt_calc],0
  611.         jnc .calc_scale
  612.  
  613.         ;*** Calculate sizes ***
  614.         mov esi,[ebx+Figure.PoiData]
  615.         or esi,esi
  616.         jz .end_f
  617.  
  618.         lea esi,[esi+Point.CoordX]
  619.         lea edi,[ebx+Figure.MinX]
  620.         movsd
  621.         movsd ;Figure.MinX = Point[0].CoordX
  622.         sub esi,8
  623.         lea edi,[ebx+Figure.SizeX]
  624.         movsd
  625.         movsd ;Figure.SizeX = Point[0].CoordX
  626.         mov esi,[ebx+Figure.PoiData]
  627.         lea esi,[esi+Point.CoordY]
  628.         lea edi,[ebx+Figure.MinY]
  629.         movsd
  630.         movsd ;Figure.MinY = Point[0].CoordY
  631.         sub esi,8
  632.         lea edi,[ebx+Figure.SizeY]
  633.         movsd
  634.         movsd ;Figure.SizeY = Point[0].CoordY
  635.  
  636.         ;found min coord X
  637.         mov ecx,[ebx+Figure.PoiCount]
  638.         jecxz .cycle2end
  639.         mov edi,[ebx+Figure.PoiData]
  640. align 4
  641.         .cycle2:
  642.                 fld qword[edi+Point.CoordX]
  643.                 fcomp qword[ebx+Figure.MinX]
  644.                 fstsw ax
  645.                 sahf
  646.                 ja @f
  647.                         push edi esi
  648.                         lea esi,[edi+Point.CoordX]
  649.                         lea edi,[ebx+Figure.MinX]
  650.                         movsd
  651.                         movsd
  652.                         pop esi edi
  653.                 @@:
  654.                 add edi,sizeof.Point
  655.         loop .cycle2
  656.         .cycle2end:
  657.  
  658.         ;found min coord Y
  659.         mov ecx,[ebx+Figure.PoiCount]
  660.         jecxz .cycle3end
  661.         mov edi,[ebx+Figure.PoiData]
  662. align 4
  663.         .cycle3:
  664.                 fld qword[edi+Point.CoordY]
  665.                 fcomp qword[ebx+Figure.MinY]
  666.                 fstsw ax
  667.                 sahf
  668.                 ja @f
  669.                         push edi esi
  670.                         lea esi,[edi+Point.CoordY]
  671.                         lea edi,[ebx+Figure.MinY]
  672.                         movsd
  673.                         movsd
  674.                         pop esi edi
  675.                 @@:
  676.                 add edi,sizeof.Point
  677.         loop .cycle3
  678.         .cycle3end:
  679.  
  680.         ;found max coord X
  681.         mov ecx,[ebx+Figure.PoiCount]
  682.         jecxz .cycle4end
  683.         mov edi,[ebx+Figure.PoiData]
  684. align 4
  685.         .cycle4:
  686.                 fld qword[edi+Point.CoordX]
  687.                 fcomp qword[ebx+Figure.SizeX]
  688.                 fstsw ax
  689.                 sahf
  690.                 jbe @f
  691.                         push edi esi
  692.                         lea esi,[edi+Point.CoordX]
  693.                         lea edi,[ebx+Figure.SizeX]
  694.                         movsd
  695.                         movsd
  696.                         pop esi edi
  697.                 @@:
  698.                 add edi,sizeof.Point
  699.         loop .cycle4
  700.         .cycle4end:
  701.  
  702.         ;found max coord Y
  703.         mov ecx,[ebx+Figure.PoiCount]
  704.         jecxz .cycle5end
  705.         mov edi,[ebx+Figure.PoiData]
  706. align 4
  707.         .cycle5:
  708.                 fld qword[edi+Point.CoordY]
  709.                 fcomp qword[ebx+Figure.SizeY]
  710.                 fstsw ax
  711.                 sahf
  712.                 jbe @f
  713.                         push edi esi
  714.                         lea esi,[edi+Point.CoordY]
  715.                         lea edi,[ebx+Figure.SizeY]
  716.                         movsd
  717.                         movsd
  718.                         pop esi edi
  719.                 @@:
  720.                 add edi,sizeof.Point
  721.         loop .cycle5
  722.         .cycle5end:
  723.  
  724.         ;found size X
  725.         fld qword[ebx+Figure.SizeX]
  726.         fsub qword[ebx+Figure.MinX]
  727.         fstp qword[ebx+Figure.SizeX]
  728.         ;found size Y
  729.         fld qword[ebx+Figure.SizeY]
  730.         fsub qword[ebx+Figure.MinY]
  731.         fstp qword[ebx+Figure.SizeY]
  732.                
  733.         ;*** Calculate scale ***
  734. align 4
  735.         .calc_scale:
  736.         mov dword[ebx+Figure.MCentrX],0
  737.         mov dword[ebx+Figure.MCentrY],0
  738.         fld1
  739.         fst qword[ebx+Figure.MScale] ;???
  740.         fstp qword[ebx+Figure.WScale] ;set default scale
  741.  
  742.         fld qword[ebx+Figure.SizeX]
  743.         ftst
  744.         fstsw ax
  745.         sahf
  746.         jne .els_0 ;if (SizeX == 0.0)
  747.                 ffree st0
  748.                 fincstp
  749.                 jmp .els_1
  750.         .els_0: ;else if (SizeX != 0.0)
  751.                 fild dword[buf_0.w]
  752.                 fisub dword[graf_margin_left]
  753.                 fisub dword[graf_margin_right]
  754.                 fxch st1
  755.                 fdivp
  756.                 fstp qword[ebx+Figure.WScale]
  757.         .els_1:
  758.  
  759.         fld qword[ebx+Figure.SizeY]
  760.         ftst
  761.         fstsw ax
  762.         sahf
  763.         jne .els_2 ;if (SizeY == 0.0)
  764.                 ffree st0
  765.                 fincstp
  766.                 jmp .els_3
  767.         .els_2: ;else if (SizeY != 0.0)
  768.                 fild dword[buf_0.h]
  769.                 fisub dword[graf_margin_top]
  770.                 fisub dword[graf_margin_bot]
  771.                 fxch st1
  772.                 fdivp
  773.                 fcom qword[ebx+Figure.WScale]
  774.                 fstsw ax
  775.                 sahf
  776.                 jbe @f
  777.                         ffree st0
  778.                         fincstp
  779.                         jmp .els_3
  780.                 @@:
  781.                 fstp qword[ebx+Figure.WScale]
  782.         .els_3:
  783.  
  784.         .end_f:
  785.         ret
  786. endp
  787.  
  788. ;input:
  789. ; esi - input description text
  790. ; ppoi - pointer to point struct
  791. ;output:
  792. ; eax - 0 (if error init) or 1
  793. ; esi - output description text
  794. align 4
  795. proc PointInit uses ebx ecx edi, ppoi:dword
  796.         mov     ecx,64 ;§ é¨â  ®â § æ¨ª«¨¢ ­¨ï
  797.         @@:
  798.                 lodsb
  799.                 cmp     al,' '
  800.                 jne     @f
  801.                 loop @b
  802.         @@:
  803.         dec esi
  804.         cmp byte[esi],'X'
  805.         jne .err_init
  806.                 inc esi
  807.                 stdcall conv_str_to_int, esi
  808.                 mov ebx,[ppoi]
  809.  
  810.                 ;Data_String <- esi
  811.                 push esi
  812.                         mov ecx,32
  813.                         mov edi,esi
  814.                         @@:
  815.                                 lodsb
  816.                                 or al,al
  817.                                 jz @f
  818.                                 cmp al,' '
  819.                                 je @f
  820.                                 cmp al,13
  821.                                 je @f
  822.                                 loop @b
  823.                         @@:
  824.                         mov esi,edi
  825.                         sub ecx,32
  826.                         neg ecx
  827.                         mov edi,Data_String
  828.                         rep movsb
  829.                         mov byte[edi],0
  830.                 pop esi
  831.                 stdcall String_to_DoubleFloat
  832.                 ;Data_Double -> Point.CoordX
  833.                 push esi
  834.                         mov esi,Data_Double
  835.                         lea edi,[ebx+Point.CoordX]
  836.                         movsd
  837.                         movsd
  838.                 pop esi
  839.  
  840.                 push edi
  841.                 mov al,'Y'
  842.                 mov ecx,80
  843.                 mov edi,esi
  844.                 repne scasb
  845.                 mov esi,edi
  846.                 pop edi
  847.                 ;Data_String <- esi
  848.                 push esi
  849.                         mov ecx,32
  850.                         mov edi,esi
  851.                         @@:
  852.                                 lodsb
  853.                                 or al,al
  854.                                 jz @f
  855.                                 cmp al,' '
  856.                                 je @f
  857.                                 cmp al,13
  858.                                 je @f
  859.                                 loop @b
  860.                         @@:
  861.                         mov esi,edi
  862.                         sub ecx,32
  863.                         neg ecx
  864.                         mov edi,Data_String
  865.                         rep movsb
  866.                         mov byte[edi],0
  867.                 pop esi
  868.                 stdcall String_to_DoubleFloat
  869.                 ;Data_Double -> Point.CoordY
  870.                 push esi
  871.                         mov esi,Data_Double
  872.                         lea edi,[ebx+Point.CoordY]
  873.                         movsd
  874.                         movsd
  875.                 pop esi
  876.  
  877.                 stdcall txt_next_line, 80
  878.                 jmp @f
  879.         .err_init:
  880.                 xor eax,eax
  881.                 jmp .end_f
  882.         @@:
  883.                 xor eax,eax
  884.                 inc eax
  885.         .end_f:
  886.         ret
  887. endp
  888.  
  889. ;input:
  890. ; buffer - ¤®¡ ¢«ï¥¬ë¥ ¤ ­­ë¥
  891. ; pfig - 㪠§ â¥«ì ­  ¤®¡ ¢«¥­­ãî 䨣ãàã (¤«ï ª®­â஫ï á® áâ®à®­ë த¨â¥«ì᪮£® ®¡ê¥ªâ )
  892. ;output:
  893. ; eax - object data pointer
  894. align 4
  895. proc add_object_in_list uses ebx ecx edi esi, buffer:dword, pfig:dword
  896.         mov ebx,[pfig]
  897.         or ebx,ebx
  898.         jz @f
  899.                 stdcall mem.Alloc,sizeof.Figure
  900.                 mov [ebx],eax
  901.                 mov ecx,sizeof.Figure
  902.                 mov edi,eax
  903.                 mov esi,[buffer]
  904.                 rep movsb
  905.         @@:
  906.         ret
  907. endp
  908.  
  909. ;description:
  910. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¢ë¡à ­­®£® ®¡ê¥ªâ 
  911. align 4
  912. proc draw_obj2d, pobj:dword
  913. locals
  914.         data_draw dd ?
  915.         CentrX dd ?
  916.         CentrY dd ?
  917. endl
  918. pushad
  919.         mov ebx,[pobj]
  920.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  921.         mov ecx,[ebx+Object.FigCount]
  922.         or ecx,ecx
  923.         jz .end_f
  924.         ;;jecxz .end_f
  925.                 mov edi,[ebx+Object.FigData]
  926.                 finit
  927.                 fld qword[ebx+Object.SizeY]
  928.                 fmul qword[ebx+Object.WScale]
  929.                 fmul qword[ebx+Object.MScale]
  930.                 fchs
  931.                 fistp dword[CentrY]
  932.                 mov eax,[CentrY]
  933.                 sub eax,[graf_margin_top]
  934.                 sub eax,[graf_margin_bot]
  935.                 add eax,[buf_0.h]
  936.                 sar eax,1
  937.                 add eax,[graf_margin_bot] ;_bot   ­¥ _top - ¢ á¢ï§¨ á ⥬ çâ® ª®®à¤. Y ¯¥à¥¢¥à­ãâ 
  938.                 add eax,[ebx+Object.MCentrY]
  939.                 mov [CentrY],eax
  940.                 fld qword[ebx+Object.SizeX]
  941.                 fmul qword[ebx+Object.WScale]
  942.                 fmul qword[ebx+Object.MScale]
  943.                 fchs
  944.                 fistp dword[CentrX]
  945.                 mov edx,[CentrX]
  946.                 sub edx,[graf_margin_left]
  947.                 sub edx,[graf_margin_right]
  948.                 add edx,[buf_0.w]
  949.                 sar edx,1
  950.                 add edx,[graf_margin_left]
  951.                 add edx,[ebx+Object.MCentrX]
  952.                 mov [CentrX],edx
  953.                 mov dword[data_draw],0
  954. align 4
  955.                 .cycle0:
  956.                         stdcall draw_fig2d_litl, buf_0,ebx,[edi],[data_draw],0,edx,eax
  957.                         mov esi,[edi]
  958.                         mov esi,[esi+Figure.PoiCount]
  959.                         or esi,esi
  960.                         jnz @f
  961.                         inc esi
  962.                         @@:
  963.                         add [data_draw],esi
  964.                         add edi,4
  965.                         loop .cycle0
  966.                 stdcall [buf2d_flip_v], buf_0
  967.  
  968.         bt dword[opt_draw],0
  969.         jnc .end_f
  970.                 ; draw min & sizes
  971.                 mov word[NumberSymbolsAD],8
  972.                 stdcall mem_copy, txt_buf,txt_size_x,20
  973.                 fld qword[ebx+Object.SizeX]
  974.                 fstp qword[Data_Double]
  975.                 call DoubleFloat_to_String
  976.                 call String_crop_0
  977.                 stdcall str_cat,txt_buf,Data_String
  978.                 stdcall str_cat,txt_buf,txt_n
  979.                 stdcall str_cat,txt_buf,txt_size_y
  980.                 fld qword[ebx+Object.SizeY]
  981.                 fstp qword[Data_Double]
  982.                 call DoubleFloat_to_String
  983.                 call String_crop_0
  984.                 stdcall str_cat,txt_buf,Data_String
  985.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0
  986.  
  987.                 fld qword[ebx+Object.MinX]
  988.                 fstp qword[Data_Double]
  989.                 stdcall mem_copy, txt_buf,txt_min_x,20
  990.                 call DoubleFloat_to_String
  991.                 call String_crop_0
  992.                 stdcall str_cat,txt_buf,Data_String
  993.                 stdcall str_cat,txt_buf,txt_n
  994.                 stdcall str_cat,txt_buf,txt_min_y
  995.                 fld qword[ebx+Object.MinY]
  996.                 fstp qword[Data_Double]
  997.                 call DoubleFloat_to_String
  998.                 call String_crop_0
  999.                 stdcall str_cat,txt_buf,Data_String
  1000.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  1001.         .end_f:
  1002. popad
  1003.         ret
  1004. endp
  1005.  
  1006. ;input:
  1007. ; pbuf - pointer to buffer 2d
  1008. ; pobj - 㪠§ â¥«ì ­  ®¡ê¥ªâ
  1009. ; pfig - 㪠§ â¥«ì ­  䨣ãàã
  1010. ; fign - ­®¬¥à 䨣ãàë
  1011. ;description:
  1012. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ®¡ê¥ªâ  ¯® ç áâï¬
  1013. align 4
  1014. proc draw_fig2d_litl, pbuf:dword, pobj:dword, pfig:dword, fign:dword,\
  1015.         Scale:dword, CentrX:dword, CentrY:dword
  1016. locals
  1017.         line_col dd ? ;figure color
  1018.                 PervX dd 0 ;pervios point coord X
  1019.         PervY dd 0 ;pervios point coord Y
  1020.         GrafX dd ? ;active point coord X
  1021.         GrafY dd ? ;active point coord Y
  1022. endl
  1023. pushad
  1024.         mov ebx,[pfig]
  1025.         test ebx,ebx
  1026.         jz .end_f
  1027.         mov ecx,[ebx+Figure.PoiCount]
  1028.         ;;jecxz .end_f
  1029.         test ecx,ecx
  1030.         jz .end_f
  1031.         mov edi,[ebx+Figure.PoiData]
  1032.         mov edx,[pobj]
  1033.  
  1034.         fld1
  1035.         mov eax,[Scale]
  1036.         or eax,eax
  1037.         jnz @f
  1038.                 lea eax,[edx+Object.MScale]
  1039.                 fmul qword[eax]
  1040.                 lea eax,[edx+Object.WScale]
  1041.         @@:
  1042.         fmul qword[eax]
  1043.         mov esi,[fign]
  1044. align 4
  1045.         .cycle0:
  1046.                 fld qword[edi+Point.CoordX]
  1047.                 fsub qword[edx+Object.MinX]
  1048.                 fmul st0,st1
  1049.                 fiadd dword[CentrX]
  1050.                 fistp dword[ebp-8]
  1051.                 fld qword[edi+Point.CoordY]
  1052.                 fsub qword[edx+Object.MinY]
  1053.                 fmul st0,st1
  1054.                 fiadd dword[CentrY]
  1055.                 fistp dword[ebp-4]
  1056.                 stdcall [buf2d_set_pixel], [pbuf], [GrafX],[GrafY], 0xff0000
  1057.                 cmp ecx,[ebx+Figure.PoiCount]
  1058.                 je .end0
  1059.                         ;®¯à¥¤¥«¥­¨¥ 梥â 
  1060.                         cmp esi,[data_printed]
  1061.                         jl @f
  1062.                         mov [line_col],0x80 ;if not printed
  1063.                         jmp .end1
  1064.                         @@:
  1065.                         mov [line_col],0xff0000 ;if was printed
  1066.                         .end1:
  1067.                         stdcall [buf2d_line_sm], [pbuf], [PervX],[PervY], [GrafX],[GrafY], [line_col]
  1068.                         stdcall [buf2d_line], [pbuf], [PervX],[PervY], [GrafX],[GrafY], [line_col]
  1069.                 .end0:
  1070.                 mov eax,[GrafX]
  1071.                 mov [PervX],eax
  1072.                 mov eax,[GrafY]
  1073.                 mov [PervY],eax
  1074.                 add edi,sizeof.Point
  1075.                 inc esi
  1076.         ;;loop .cycle0
  1077.                 dec ecx
  1078.         jnz .cycle0
  1079.         ffree st0
  1080.         fincstp
  1081.  
  1082.         .end_f:
  1083. popad
  1084.         ret
  1085. endp
  1086.  
  1087. ;description:
  1088. ; äã­ªæ¨ï ¤«ï à¨á®¢ ­¨ï ¢ë¡à ­­®© 䨣ãàë
  1089. align 4
  1090. proc draw_fig2d, pfig:dword
  1091. locals
  1092.         n dd 0
  1093.         col_lin dd 0 ;梥⠫¨­¨© 䨣ãàë
  1094.         CentrX dd ?
  1095.         CentrY dd ?
  1096.         PervX dd 0 ;pervios point coord X
  1097.         PervY dd 0 ;pervios point coord Y
  1098.         GrafX dd ? ;active point coord X
  1099.         GrafY dd ? ;active point coord Y
  1100.         old_tl dd 0 ;old text coord X0
  1101.         old_tt dd 0 ;old text coord Y0
  1102.         old_tw dd 0 ;old text coord X1
  1103.         old_th dd 0 ;old text coord Y1
  1104.         new_tl dd 0 ;new text coord X0
  1105.         ;new_tt dd 0 ;new text coord Y0
  1106.         new_tw dd 0 ;new text coord X1
  1107.         ;new_th dd 0 ;new text coord Y1
  1108. endl
  1109. pushad
  1110.         stdcall [buf2d_clear], buf_0, [buf_0.color]
  1111.         mov ebx,[pfig]
  1112.         test ebx,ebx
  1113.         jz .end_f
  1114.         mov ecx,[ebx+Figure.PoiCount]
  1115.         ;;jecxz .end_f
  1116.         test ecx,ecx
  1117.         jz .end_f
  1118.         mov edi,[ebx+Figure.PoiData]
  1119.         finit
  1120.         fld qword[ebx+Figure.SizeY]
  1121.         fmul qword[ebx+Figure.WScale]
  1122.         fmul qword[ebx+Figure.MScale]
  1123.         fchs
  1124.         fistp dword[CentrY]
  1125.         mov eax,[CentrY]
  1126.         sub eax,[graf_margin_top]
  1127.         sub eax,[graf_margin_bot]
  1128.         add eax,[buf_0.h]
  1129.         sar eax,1
  1130.         add eax,[graf_margin_bot]
  1131.         add eax,[ebx+Figure.MCentrY]
  1132.         mov [CentrY],eax
  1133.         ;CentrY = (-(Figure.SizeY * Figure.WScale) - graf_margin_top - graf_margin_bot + buf_0.h) / 2 + graf_margin_bot
  1134.         fld qword[ebx+Figure.SizeX]
  1135.         fmul qword[ebx+Figure.WScale]
  1136.         fmul qword[ebx+Figure.MScale]
  1137.         fchs
  1138.         fistp dword[CentrX]
  1139.         mov eax,[CentrX]
  1140.         sub eax,[graf_margin_left]
  1141.         sub eax,[graf_margin_right]
  1142.         add eax,[buf_0.w]
  1143.         sar eax,1
  1144.         add eax,[graf_margin_left]
  1145.         add eax,[ebx+Figure.MCentrX]
  1146.         mov [CentrX],eax        
  1147.         ;CentrX = (-(Figure.SizeX * Figure.WScale) - graf_margin_left - graf_margin_right + buf_0.w) / 2 + graf_margin_left
  1148.  
  1149. align 4
  1150.         .cycle0:
  1151.                 fld qword[edi+Point.CoordX]
  1152.                 fsub qword[ebx+Figure.MinX]
  1153.                 fmul qword[ebx+Figure.WScale]
  1154.                 fmul qword[ebx+Figure.MScale]
  1155.                 fiadd dword[CentrX]
  1156.                 fistp dword[GrafX]
  1157.                 ;GrafX = (Point.CoordX - Figure.MinX) * Figure.WScale + CentrX
  1158.                 fld qword[edi+Point.CoordY]
  1159.                 fsub qword[ebx+Figure.MinY]
  1160.                 fmul qword[ebx+Figure.WScale]
  1161.                 fmul qword[ebx+Figure.MScale]
  1162.                 fiadd dword[CentrY]
  1163.                 fisub dword[buf_0.h] ;invert coord Y
  1164.                 fchs
  1165.                 fistp dword[GrafY]
  1166.                 ;GrafY = -((Point.CoordY - Figure.MinY) * Figure.WScale + CentrY - buf_0.h)
  1167.  
  1168.                 stdcall [buf2d_set_pixel], buf_0, [GrafX],[GrafY], 0xff0000
  1169.                 mov dword[col_lin],0x80
  1170.                 cmp ecx,[ebx+Figure.PoiCount]
  1171.                 je @f
  1172.                         stdcall [buf2d_line_sm], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin]
  1173.                         stdcall [buf2d_line], buf_0, [PervX],[PervY], [GrafX],[GrafY], [col_lin]
  1174.                 @@:
  1175.                 mov eax,[GrafX]
  1176.                 mov [PervX],eax
  1177.                 mov edx,[GrafY]
  1178.                 mov [PervY],edx
  1179.                 add edi,sizeof.Point
  1180.  
  1181.                 bt dword[opt_draw],0
  1182.                 jnc .end0
  1183.                 ; draw number points
  1184.                 ;mov eax,[GrafX]
  1185.                 ;mov edx,[GrafY]
  1186.                 add eax,2
  1187.                 add edx,2
  1188.                 push eax edi
  1189.                         mov eax,[n]
  1190.                         mov edi,txt_buf
  1191.                         stdcall convert_int_to_str,20
  1192.                 pop edi eax
  1193.  
  1194.                 inc dword[n]
  1195.                 ;calculate new text coords
  1196.                 mov [new_tl],eax
  1197.                 mov esi,eax
  1198.                 stdcall str_len,txt_buf
  1199.                 imul eax,[buf_1.w]
  1200.                 add eax,esi
  1201.                 mov [new_tw],eax
  1202.                 ;rect compare coords
  1203.                 cmp [old_tl],eax
  1204.                 jg .no_comp
  1205.                 cmp [old_tw],esi
  1206.                 jl .no_comp
  1207.                         ;calculate new text coord Y1
  1208.                         mov esi,edx
  1209.                         add esi,[font_h]
  1210.                 cmp [old_tt],esi
  1211.                 jg .no_comp
  1212.                 cmp [old_th],edx
  1213.                 ;jl .no_comp
  1214.                         ;jmp .end0
  1215.                 jge .end0
  1216.                 .no_comp:
  1217.                         mov eax,[new_tl]
  1218.                         mov [old_tl],eax
  1219.                         mov eax,[new_tw]
  1220.                         mov [old_tw],eax
  1221.                         mov [old_tt],edx
  1222.                         add edx,[font_h]
  1223.                         mov [old_th],edx
  1224.                         stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,[old_tl],[old_tt],0x000000
  1225.                 .end0:
  1226.                 dec ecx
  1227.         jnz .cycle0
  1228.  
  1229.         bt dword[opt_draw],0
  1230.         jnc .end_f
  1231.                 ; draw min & sizes
  1232.                 mov word[NumberSymbolsAD],8
  1233.                 stdcall mem_copy, txt_buf,txt_size_x,20
  1234.                 fld qword[ebx+Figure.SizeX]
  1235.                 fstp qword[Data_Double]
  1236.                 call DoubleFloat_to_String
  1237.                 call String_crop_0
  1238.                 stdcall str_cat,txt_buf,Data_String
  1239.                 stdcall str_cat,txt_buf,txt_n
  1240.                 stdcall str_cat,txt_buf,txt_size_y
  1241.                 fld qword[ebx+Figure.SizeY]
  1242.                 fstp qword[Data_Double]
  1243.                 call DoubleFloat_to_String
  1244.                 call String_crop_0
  1245.                 stdcall str_cat,txt_buf,Data_String
  1246.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,23,0
  1247.  
  1248.                 fld qword[ebx+Figure.MinX]
  1249.                 fstp qword[Data_Double]
  1250.                 stdcall mem_copy, txt_buf,txt_min_x,20
  1251.                 call DoubleFloat_to_String
  1252.                 call String_crop_0
  1253.                 stdcall str_cat,txt_buf,Data_String
  1254.                 stdcall str_cat,txt_buf,txt_n
  1255.                 stdcall str_cat,txt_buf,txt_min_y
  1256.                 fld qword[ebx+Figure.MinY]
  1257.                 fstp qword[Data_Double]
  1258.                 call DoubleFloat_to_String
  1259.                 call String_crop_0
  1260.                 stdcall str_cat,txt_buf,Data_String
  1261.                 stdcall [buf2d_draw_text], buf_0, buf_1,txt_buf,3,3,0
  1262.         .end_f:
  1263. popad
  1264.         ret
  1265. endp
  1266.  
  1267. align 4
  1268. proc mouse_left_d uses eax ebx
  1269.         call buf_get_mouse_coord
  1270.         cmp eax,-1
  1271.         je .end_f
  1272.                 mov [mouse_down_x],eax
  1273.                 mov [mouse_down_y],ebx
  1274.         .end_f:
  1275.         ret
  1276. endp
  1277.  
  1278. align 4
  1279. proc mouse_left_u uses eax ebx ecx
  1280.         call buf_get_mouse_coord
  1281.         cmp eax,-1
  1282.         je .end_f
  1283.                 sub eax,[mouse_down_x]
  1284.                 sub ebx,[mouse_down_y]
  1285.                 mov ecx,ObjData
  1286.                 add [ecx+Figure.MCentrX],eax
  1287.                 sub [ecx+Figure.MCentrY],ebx
  1288.                 mov dword[offs_last_timer],0
  1289.         .end_f:
  1290.         ret
  1291. endp
  1292.