Subversion Repositories Kolibri OS

Rev

Rev 8227 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;*******************************************************
  2. ;**************GRAPHICS EDITOR ANIMAGE *****************
  3. ;*******************************************************
  4. ; version: 1.52
  5. ; last update:  23.11.2016
  6. ; changes:      Can save *.png files
  7. ; autors:       IgorA
  8. ;--------------------------------------------------------
  9. ; version: 1.51
  10. ; last update:  23.03.2016
  11. ; changes:      Use library 'kmenu.obj', update GUI
  12. ; autors:       IgorA, Veliant, Leency
  13. ;--------------------------------------------------------
  14. ; version: 1.4
  15. ; last update:  12.03.2016
  16. ; changes:      Use library 'libimg.obj'
  17. ; autors:       IgorA
  18. ;--------------------------------------------------------
  19. ; version: 1.3
  20. ; last update:  05.10.2010
  21. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  22. ; changes:      Fixed window flicker when redrawing,
  23. ;               Fixed memory leak for stack
  24. ;--------------------------------------------------------
  25. ; version: 1.2
  26. ; last update:  30.09.2010
  27. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  28. ; changes:      Program used function 68 instead 64 is now,
  29. ;               select path with OpenDialog
  30. ;--------------------------------------------------------
  31. ; version: 1.1
  32. ; last update:  09.12.2006
  33. ; autors:
  34. ; programming by andrew_programmer
  35. ; design by golus
  36.  
  37. use32
  38. org     0
  39.         db 'MENUET01'
  40.         dd 1, START, IM_END, I_END
  41.         dd stacktop, file_path, cur_dir_path
  42.  
  43. include '../../../config.inc' ;for nightbuild
  44. include '../../../macros.inc'
  45. include '../../../proc32.inc'
  46. include '../../../KOSfuncs.inc'
  47. include '../../../load_lib.mac'
  48. include '../../../dll.inc'
  49. include '../../../develop/libraries/libs-dev/libio/libio.inc'
  50. include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
  51. ;include '../../../debug.inc'
  52.  
  53. @use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  54.  
  55. ;---------------------------------------------------------
  56. ; *** ª®­áâ ­âë ¤«ï ¨­â¥àä¥©á  ***
  57. ; *** constants for interface  ***
  58.  
  59. ; ª®à४â¨à®¢ª¨ ­  ᪨­
  60. ci_offs_skin_w equ  5 ;ª®à४â¨à®¢ª  ­  è¨à¨­ã à ¬ª¨ ᪨­ 
  61. ci_offs_skin_h equ 24 ;ª®à४â¨à®¢ª  ­  ¢ëá®âã ᪨­ 
  62.  
  63. ; £« ¢­®¥ ®ª­®
  64. ci_wnd_min_siz_x equ 585 ;minimum size x
  65. ci_wnd_min_siz_y equ 400 ;minimum size y
  66.  
  67. ; ¯ ­¥«ì ¨­áâà㬥­â®¢
  68. ci_panel_x_pos equ  0 ;ª®®à¤. x ¤«ï ¯ ­¥«¨
  69. ci_panel_y_pos equ 20 ;ª®®à¤. y ¤«ï ¯ ­¥«¨
  70. ci_panel_but_y1 equ ci_panel_y_pos +5 ;ª®®à¤. y ¤«ï 1-£® à鸞 ª­®¯®ª
  71. ci_panel_but_y2 equ ci_panel_y_pos+30 ;ª®®à¤. y ¤«ï 2-£® à鸞 ª­®¯®ª
  72. ci_palete_y_pos equ ci_panel_y_pos+51 ;ª®®à¤. y ¤«ï ¯ «¨âàë 梥⮢
  73. ci_panel_zoom_x equ 178 ;ª®®à¤. x ¤«ï ª­®¯®ª ¯ ­¥«¨ ¬ áèâ ¡ 
  74.  
  75. ; ®ª­® । ªâ®à 
  76. ci_edit_wnd_x_pos  equ  0 ;ª®®à¤. x ¤«ï ®ª­  । ªâ®à 
  77. ci_edit_wnd_y_pos  equ 71 ;ª®®à¤. y ¤«ï ®ª­  । ªâ®à 
  78. ci_edit_wnd_border equ  3 ;à ¬ª  ¢®ªà㣠®ª­  । ªâ®à 
  79.  
  80. ; áªà®««¨­£¨
  81. ci_scroll_dim equ 22 ;à §¬¥àë áªà®««¨­£®¢
  82. ci_scrollh_coord_x_min equ (ci_edit_wnd_x_pos+3) ;¬¨­¨¬ «ì­ ï ¯®§¨æ¨ï ¯®«§ã­ª 
  83.         ;£®à¨§®­â «ì­®£® áªà®««¨­£ 
  84. ci_scrollv_coord_y_min equ (ci_edit_wnd_y_pos+3) ;¬¨­¨¬ «ì­ ï ¯®§¨æ¨ï ¯®«§ã­ª 
  85.         ;¢¥à⨪ «ì­®£® áªà®««¨­£ 
  86. ;---------------------------------------------------------
  87.  
  88. include 'bmplib.inc'
  89. include 'dialog2.inc'
  90. include 'design.inc'
  91. include 'graphlib.inc'
  92.  
  93. include 'cursors.inc'
  94. include 'memory.inc'
  95. include 'load_from_parameters.inc'
  96.  
  97. START:
  98.         mcall SF_SYS_MISC,SSF_HEAP_INIT
  99.         mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, syscolors, syscolors_end-syscolors
  100.        
  101. load_libraries l_libs_start,end_l_libs
  102.  
  103.         cmp     eax,-1
  104.         jz      close
  105.  
  106.         mcall SF_SET_EVENTS_MASK,0x80000067 ; 1100111b
  107. ;---------------------------------------------------------
  108. ;-----------------------init data-------------------------
  109. ;---------------------------------------------------------
  110. include 'init_data.inc'
  111.  
  112. ;----------------------------------------------------------
  113. ;--------get memory and draw window of program-------------
  114. ;----------------------------------------------------------
  115.         call GetMemory
  116.         mov     [Current_instrument],10 ;pencil
  117.         call TakeButtonInstruments  ;set startup instrument
  118.         call cleare_work_arrea
  119.         call load_icons
  120.         call init_main_menu
  121.  
  122. ;load cursors
  123.         mov     eax,CursorsID
  124.         call load_cursors
  125.  
  126. ;---------------------------------------------------------
  127. ;---------check loading of file from parameters-----------
  128. ;---------------------------------------------------------
  129.         mov     eax,file_path
  130.         cmp [eax],byte 0
  131.         jz @f
  132.         call load_picture
  133.         call MovePictureToWorkScreen
  134. @@:
  135.  
  136. ;---------------------------------------------------------------------
  137.         mov     edi,filename_area
  138.         mov     esi,path4+5
  139.         call    copy_str_1
  140.  
  141.         mov     edi,file_path
  142.         cmp     [edi],byte 0
  143.         jne     @f
  144.         mov     esi,path4
  145.         call    copy_str_1
  146. @@:
  147. ;OpenDialog     initialisation
  148.         stdcall [OpenDialog_Init], OpenDialog_data
  149.         stdcall [ColorDialog_Init], ColorDialog_data
  150. ;---------------------------------------------------------------------
  151.  
  152. align 4
  153. red:
  154.         call drawwin
  155. ;----------------------------------------------------------
  156. ;---------------------main loop----------------------------
  157. ;----------------------------------------------------------
  158. align 4
  159. still:
  160.         mcall SF_WAIT_EVENT
  161.  
  162.         cmp     eax,1
  163.         je      red
  164.  
  165.         cmp     eax,2
  166.         je      keys
  167.  
  168.         cmp     eax,3
  169.         je      buttons
  170.  
  171.         cmp     eax,6
  172.         je      mouse
  173.  
  174.         jmp     still
  175.        
  176. ;---------------------------------------------------------------------
  177. copy_str_1:
  178.         xor     eax,eax
  179.         cld
  180. @@:
  181.         lodsb
  182.         stosb
  183.         test    eax,eax
  184.         jnz     @b
  185.         ret
  186. ;---------------------------------------------------------------------
  187. include 'events.inc'
  188. include 'events_of_window.inc'
  189. include 'events_of_keys.inc'
  190. include 'events_of_buttons.inc'
  191. include 'events_of_mouse.inc'
  192. include 'panel_engen.inc'
  193. include 'screen.inc'
  194. include 'menu_instruments.inc'
  195. include 'icons_instruments.inc'
  196. include 'icons.inc'
  197. include 'sprites.inc'
  198. include 'string.inc'
  199. include 'palette.inc'
  200. include 'files.inc'
  201. include 'time.inc'
  202. include 'menu.inc'
  203. ;-----------------------------------------------------------
  204. ;------------variables and data of program------------------
  205. ;-----------------------------------------------------------
  206. ;sound_havent_memory db 150,64,0
  207.  
  208. include 'lib_data.inc'
  209. include 'panel_data.inc'
  210. include 'brushes.inc'
  211. include 'spray.inc'
  212. include 'width_lines.inc'
  213. ;----------------------------------------------------------
  214. ;-------------------icon's picture-------------------------
  215. ;----------------------------------------------------------
  216. align 4
  217. panel_picture:
  218. file 'panel_buttons.png'
  219. .end:
  220. align 4
  221. panel_zoom:
  222. file 'panel_zoom.png'
  223. .end:
  224. ;****************cursors******************
  225. brush_cursor:
  226. file 'cursors/brush.cur'
  227. flood_fill_cursor:
  228. file 'cursors/flood_fill.cur'
  229. lastik_cursor:
  230. file 'cursors/lastik.cur'
  231. other_cursor:
  232. file 'cursors/other.cur'
  233. pencil_cursor:
  234. file 'cursors/pencil.cur'
  235. pipette_cursor:
  236. file 'cursors/pipette.cur'
  237. spray_cursor:
  238. file 'cursors/spray.cur'
  239. zoom_cursor:
  240. file 'cursors/zoom.cur'
  241. ;----------------------------------------------------------
  242. align 4
  243. IM_END:
  244. ;-----------------------------------------------------------
  245. ;------------variables and data of program------------------
  246. ;-----------------------------------------------------------
  247. time                    rd 1
  248. PosX                    rd 1 ;scroll x file position
  249. PosY                    rd 1 ;scroll y file position
  250. PointerToIcons          rd 1
  251. ScreenPointer           rd 1
  252. PointerToPicture        rd 1
  253. PointerToCopyPicture    rd 1
  254. PointerToCopyPicture2   rd 1
  255. PointerToEditBufer      rd 1
  256. PointerToSpriteBufer    rd 1
  257. PointerToPalette        rd 1 ;㪠§ â¥«ì ­  ¯¨«¨âàã (­ã¦¥­ ¤«ï á®åà ­¥­¨ï ¢ *.bmp)
  258. Color                   rd 1
  259. SColor                  rd 1
  260. Number_Brush            rd 1
  261. Brush_SizeX             rd 1
  262. Brush_SizeY             rd 1
  263. Current_instrument      rd 1
  264. Last_instrument         rd 1
  265. OldX                    rd 1
  266. OldY                    rd 1
  267.  
  268. MouseX                  rd 1
  269. MouseY                  rd 1
  270. MouseBut                        rd 1 ;ᮡëâ¨ï ®â ª­®¯®ª ¬ëè¨
  271. Window_SizeX            rd 1
  272. Window_SizeY            rd 1
  273. Window_CordinatX        rd 1
  274. Window_CordinatY        rd 1
  275. Picture_SizeX           rd 1
  276. Picture_SizeY           rd 1
  277. ScreenX                 rd 1 ;ª®®à¤¨­ â  x ªãàá®à  á ãç¥â®¬ ¬ áèâ ¡ 
  278. ScreenY                 rd 1 ;ª®®à¤¨­ â  y ªãàá®à  á ãç¥â®¬ ¬ áèâ ¡ 
  279. WorkScreen_SizeX        rd 1 ;è¨à¨­  à ¡®ç¥£® íªà ­ 
  280. WorkScreen_SizeY        rd 1 ;¢ëá®â  à ¡®ç¥£® íªà ­ 
  281. MaxWorkScreen_SizeX     rd 1
  282. MaxWorkScreen_SizeY     rd 1
  283. k                       rd 1 ;¬ áèâ ¡
  284.  
  285. ReserveArray            rd 1 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¨á¯®«ì§ã¥¬ãî ¯à¨ à¨á®¢ ­¨¨ 䨣ãà
  286.         ;¤«ï á®åà ­¥­¨ï ãç á⪮¢ ä®­  ¯®¤ 䨣ãà ¬¨,   â ª¦¥ ¤«ï § «¨¢ª¨
  287. CounterX                rd 1 ;ç¨á«® ¯¨ªá¥«¥© ¨§®¡à ¦¥­¨ï ¯® è¨à¨­¥, ª®â®àë¥ ¯®¯ ¤ îâ
  288.         ;¢ íªà ­ à ¡®ç¥© ®¡« áâ¨, á ãç¥â®¬ ⥪ã饣® ¬ áèâ ¡ 
  289. CounterY                rd 1
  290. OffsetYPicture          rd 1 ;ᤢ¨£ ¯® ®á¨ y ¢ ¡ãä¥à¥ ¨§®¡à ¦¥­¨ï ¯à¨ à¨á®¢ ­¨¨
  291.         ;á«¥¤ãî饩 «¨­¨¨ ¨§®¡à ¦¥­¨ï
  292. OffsetYWorkScreen       rd 1 ;ᤢ¨£ ¯® ®á¨ y ¢ ¡ãä¥à¥ à ¡®ç¥© ®¡« á⨠¯à¨
  293.         ;à¨á®¢ ­¨¨ á«¥¤ãî饩 «¨­¨¨ ¯¨ªá¥«¥©. —¥¬ ¡®«ìè¥ ¬ áèâ ¡, ⥬ ­¨¦¥
  294.         ;­ã¦­® ®¯ã᪠âìáï ¯® à ¡®ç¥© ®¡« áâ¨.
  295. OffsetYBigPixel         rd 1 ;ᤢ¨£ ¯® ®á¨ y ¤«ï à¨á®¢ ­¨ï ¯¨ªá¥«¥© ­  ¡®«ì讬
  296.         ;¬ áèâ ¡¥. ¨áã¥âáï 1-ï ¯®«®á  ¯¨ªá¥«ï,   ¯®â®¬ ­ã¦­® ¯¥à¥©â¨ ¢­¨§ ¨
  297.         ;¢«¥¢® ¤«ï à¨á®¢ ­¨ï á«¥¤ãî饩 ¯®«®áë.
  298.  
  299. Icon_X                  rd 1
  300. Icon_Y                  rd 1
  301. counter                 rd 1
  302. counter2                rd 1
  303. number_panel            rd 1
  304. number_menu             rd 1
  305.  
  306. Scroll1CoordinatX       rd 1 ;scroll x screen position
  307. Scroll1CoordinatY       rd 1 ;scroll y screen position
  308. Scroll1MaxSizeX         rd 1
  309. Scroll1MaxSizeY         rd 1
  310. Scroll1SizeX            rd 1 ;scroll polzunok size
  311. Scroll1FreeX            rd 1
  312.  
  313. Scroll2CoordinatX       rd 1
  314. Scroll2CoordinatY       rd 1
  315. Scroll2MaxSizeX         rd 1
  316. Scroll2MaxSizeY         rd 1
  317. Scroll2SizeY            rd 1
  318. Scroll2FreeY            rd 1
  319.  
  320. x                       rd 1
  321. y                       rd 1
  322.  
  323. Radius                  rd 1
  324. Dx_                     rd 1
  325. Dy_                     rd 1
  326. line_width              rd 1
  327. a_ellips                rd 1
  328. b_ellips                rd 1
  329.  
  330. used_OldX               rd 1 ;for draw hard contour
  331. used_OldY               rd 1
  332. paste_img_w rd 1 ;è¨à¨­  ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥­¨ï
  333. paste_img_h rd 1 ;¢ëá®â  ¢áâ ¢«ï¥¬®£® ¨§®¡à ¦¥­¨ï
  334. crossing_old_x          rd 1 ;­ ç «ì­ ï ª®®à¤. x ®¡« á⨠ª®¯¨à®¢ ­¨ï
  335. crossing_old_y          rd 1 ;­ ç «ì­ ï ª®®à¤. y ®¡« á⨠ª®¯¨à®¢ ­¨ï
  336. rectangular_shade_x     rd 1 ;ª®­¥ç­ ï ª®®à¤. x ®¡« á⨠ª®¯¨à®¢ ­¨ï
  337. rectangular_shade_y     rd 1 ;ª®­¥ç­ ï ª®®à¤. y ®¡« á⨠ª®¯¨à®¢ ­¨ï
  338. crossing                rd 1 ;0 - ¢ë¤¥«¥­¨ï ­¥â, 1 - ¨¤¥â ¯à®æ¥á ¢ë¤¥«¥­¨ï,
  339.         ;2 - ¢ë¤¥«¥­¨¥ § ¢¥à襭®, 3 - ®¡« áâì ¢ë¤¥«¥­¨ï ¯¥à¥¬¥é ¥âáï
  340. number_undo             rd 1
  341. SpriteSizeX             rd 1 ;???
  342. SpriteSizeY             rd 1 ;???
  343. SpriteCoordinatX        rd 1
  344. SpriteCoordinatY        rd 1
  345. SpriteOldCoordinatX     rd 1
  346. SpriteOldCoordinatY     rd 1
  347.  
  348. CursorsID       rd 10
  349.  
  350. Activate_instrument     rb 1 ;¥á«¨ à ¢­® 0 - â® ª®¯¨à®¢ ­¨¥ ⥪ã饣® ¡ãä¥à 
  351.         ;¤«ï ¥£® । ªâ¨à®¢ ­¨ï, ¥á«¨ 1 - ⥪ã騩 ¡ãä¥à ­¥ ª®¯¨àã¥âáï
  352. save_flag               rb 1
  353. exit_from_work_arrea    rb 1
  354. lastik_is_active        rb 1
  355. instrument_used         rb 1
  356. DrawSprite_flag         rb 1
  357. Paste_flag              rb 1
  358. ;---------------------------------------------------------------------
  359. IncludeUGlobals
  360. ;---------------------------------------------------------------------
  361. align 4
  362. file_path rb 4096
  363. filename_area rb 256
  364. temp_dir_pach rb 4096
  365. library_path rb 4096
  366. cur_dir_path rb 4096
  367. procinfo: rb 1024
  368. align 4
  369. syscolors rb 192
  370. syscolors_end:
  371. ;---------------------------------------------------------------------
  372. align 4
  373.         rb 4096
  374. stacktop:
  375. ;---------------------------------------------------------------------
  376. I_END: