w_fj_fileopen.srw 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. $PBExportHeader$w_fj_fileopen.srw
  2. forward
  3. global type w_fj_fileopen from window
  4. end type
  5. type cbx_originalsize from checkbox within w_fj_fileopen
  6. end type
  7. type cb_1 from uo_imflatbutton within w_fj_fileopen
  8. end type
  9. type cb_4 from uo_imflatbutton within w_fj_fileopen
  10. end type
  11. type ln_bar2 from line within w_fj_fileopen
  12. end type
  13. type ln_bar from line within w_fj_fileopen
  14. end type
  15. type r_bar from rectangle within w_fj_fileopen
  16. end type
  17. end forward
  18. global type w_fj_fileopen from window
  19. integer width = 2107
  20. integer height = 1728
  21. boolean titlebar = true
  22. string title = "文件查看"
  23. boolean controlmenu = true
  24. boolean minbox = true
  25. boolean maxbox = true
  26. windowtype windowtype = popup!
  27. windowstate windowstate = maximized!
  28. long backcolor = 67108864
  29. string icon = "AppIcon!"
  30. boolean center = true
  31. cbx_originalsize cbx_originalsize
  32. cb_1 cb_1
  33. cb_4 cb_4
  34. ln_bar2 ln_bar2
  35. ln_bar ln_bar
  36. r_bar r_bar
  37. end type
  38. global w_fj_fileopen w_fj_fileopen
  39. type variables
  40. long ins_fileID //当前单据类型
  41. string ins_filetype
  42. Transaction Transaction_pic
  43. //
  44. Blob ins_lbimage
  45. string ins_ori_title
  46. uo_fileview obj_fileview
  47. end variables
  48. forward prototypes
  49. public subroutine wf_set_object_size ()
  50. public subroutine wf_resize ()
  51. public function long wf_fileopen (long arg_fileid)
  52. end prototypes
  53. public subroutine wf_set_object_size ();IF IsValid(obj_fileview) THEN
  54. obj_fileview.Y = ln_bar2.endY + 10
  55. obj_fileview.Height = this.Height - obj_fileview.Y - 40
  56. obj_fileview.X = 10
  57. obj_fileview.Width = THIS.Width - obj_fileview.X -40
  58. obj_fileview.of_set_originalsize( cbx_originalsize.checked)
  59. obj_fileview.of_setfilesize( )
  60. END IF
  61. end subroutine
  62. public subroutine wf_resize ();//if not p_1.originalsize then
  63. // p_1.x = dw_file_index.x + dw_file_index.width
  64. // p_1.height = dw_file_index.height
  65. // p_1.y = dw_file_index.y
  66. // p_1.width = THIS.Width - dw_file_index.x - dw_file_index.width
  67. // THIS.HScrollBar = FALSE
  68. // THIS.VScrollBar = FALSE
  69. // return
  70. //end if
  71. //Integer li_SW,li_SH
  72. //Integer li_x = 1,li_y = 1
  73. //
  74. //IF p_1.Width > THIS.Width - dw_file_index.x - dw_file_index.width OR p_1.Height > THIS.Height - dw_file_index.y THEN
  75. // THIS.HScrollBar = TRUE
  76. // THIS.VScrollBar = TRUE
  77. // li_x=dw_file_index.x + dw_file_index.width
  78. // li_y=dw_file_index.y
  79. //ELSE
  80. // THIS.HScrollBar = FALSE
  81. // THIS.VScrollBar = FALSE
  82. //
  83. // //当前的窗口对象无效则返回
  84. //
  85. // //获取屏幕的宽度和高度
  86. // //if GetEnvironment(lenv)=-1 then return -1
  87. // li_SW = THIS.Width - dw_file_index.x - dw_file_index.width
  88. // li_SH = THIS.Height - dw_file_index.y
  89. //
  90. // //得到中心位置的坐标
  91. // //if li_SW>ole.Width then
  92. // li_x = (li_SW - p_1.Width)/2 + dw_file_index.x + dw_file_index.width
  93. // //end if
  94. // //if li_SH>ole.Height then
  95. // li_y = (li_SH - p_1.Height)/2 + dw_file_index.y
  96. // //end if
  97. //
  98. // //移动窗口到屏幕中心
  99. //
  100. // //ole.x = li_x
  101. // //ole.y = li_y
  102. //
  103. //END IF
  104. //
  105. //p_1.Move(li_x,li_y)
  106. //
  107. //
  108. end subroutine
  109. public function long wf_fileopen (long arg_fileid);s_fileinfo s_file
  110. String arg_msg
  111. Blob nulldata
  112. SetNull(nulldata)
  113. String ls_filetype,ls_filename
  114. SELECT filetype,filename
  115. INTO :ls_filetype,:ls_filename
  116. FROM u_file
  117. Where fileid = :arg_fileid USING Transaction_pic;
  118. IF Transaction_pic.SQLCode <> 0 THEN
  119. IF IsValid(obj_fileview) THEN
  120. CloseUserObject(obj_fileview)
  121. END IF
  122. MessageBox('错误','获取文件类型失败'+Transaction_pic.SQLErrText,stopsign!,OK!)
  123. RETURN 0
  124. END IF
  125. THIS.Title = ins_ori_title +' ['+Trim(ls_filetype)+'] '+Trim(ls_filename)
  126. SELECTBLOB filedata
  127. INTO :s_file.filedata
  128. FROM u_file
  129. Where fileid = :arg_fileid USING Transaction_pic;
  130. IF Transaction_pic.SQLCode <> 0 THEN
  131. IF IsValid(obj_fileview) THEN
  132. CloseUserObject(obj_fileview)
  133. END IF
  134. MessageBox('错误','获取图片失败'+Transaction_pic.SQLErrText,stopsign!,OK!)
  135. RETURN 0
  136. END IF
  137. IF NOT IsValid(obj_fileview) THEN
  138. obj_fileview = CREATE uo_fileview_pic
  139. OpenUserObject(obj_fileview)
  140. END IF
  141. obj_fileview.OriginalSize = cbx_originalsize.Checked
  142. IF obj_fileview.of_showfile( s_file.filedata,ls_filename, arg_msg) <> 1 THEN
  143. IF IsValid(obj_fileview) THEN
  144. CloseUserObject(obj_fileview)
  145. END IF
  146. MessageBox('错误',arg_msg,stopsign!,OK!)
  147. RETURN 0
  148. END IF
  149. RETURN 1
  150. end function
  151. on w_fj_fileopen.create
  152. this.cbx_originalsize=create cbx_originalsize
  153. this.cb_1=create cb_1
  154. this.cb_4=create cb_4
  155. this.ln_bar2=create ln_bar2
  156. this.ln_bar=create ln_bar
  157. this.r_bar=create r_bar
  158. this.Control[]={this.cbx_originalsize,&
  159. this.cb_1,&
  160. this.cb_4,&
  161. this.ln_bar2,&
  162. this.ln_bar,&
  163. this.r_bar}
  164. end on
  165. on w_fj_fileopen.destroy
  166. destroy(this.cbx_originalsize)
  167. destroy(this.cb_1)
  168. destroy(this.cb_4)
  169. destroy(this.ln_bar2)
  170. destroy(this.ln_bar)
  171. destroy(this.r_bar)
  172. end on
  173. event resize;ln_bar.EndX = THIS.Width
  174. ln_bar2.EndX = THIS.Width
  175. r_bar.Width = THIS.Width
  176. wf_set_object_size()
  177. end event
  178. event open;s_edit_index_tran s_tran //翻页功能窗口 传递参数使用
  179. s_tran = Message.PowerObjectParm
  180. IF NOT IsNull(s_tran.sqltransaction ) THEN
  181. Transaction_pic = s_tran.sqltransaction
  182. ELSE
  183. MessageBox('提示','没有数据库事务',information!,OK!)
  184. Close(THIS)
  185. RETURN
  186. END IF
  187. IF NOT IsNull(s_tran.f_long) THEN
  188. ins_fileid = s_tran.f_long
  189. ELSE
  190. ins_fileid = 0
  191. MessageBox('提示','不合理文件唯一码',information!,OK!)
  192. Close(THIS)
  193. RETURN
  194. END IF
  195. ins_ori_title= this.title
  196. wf_fileopen(ins_fileid)
  197. //IF NOT IsNull(s_tran.g_long ) THEN
  198. // ins_relid = s_tran.g_long
  199. //ELSE
  200. // ins_relid = 0
  201. //END IF
  202. //IF NOT IsNull(s_tran.f_string ) THEN
  203. // ins_relcode = s_tran.f_string
  204. //ELSE
  205. // ins_relcode = ''
  206. //END IF
  207. //
  208. //ins_ds_fileclass = create datastore
  209. //ins_ds_fileclass.dataobject=dw_fileclass.dataobject
  210. //ins_ds_fileclass.SetTransObject(sqlca)
  211. //
  212. ////dw_fileclass.SetTransObject(sqlca)
  213. //dw_fj.SetTransObject(Transaction_pic)
  214. //
  215. //THIS.TriggerEvent('retrieve_fileclass')
  216. //
  217. //
  218. end event
  219. type cbx_originalsize from checkbox within w_fj_fileopen
  220. integer x = 366
  221. integer y = 56
  222. integer width = 334
  223. integer height = 48
  224. boolean bringtotop = true
  225. integer textsize = -9
  226. integer weight = 400
  227. fontcharset fontcharset = gb2312charset!
  228. fontpitch fontpitch = variable!
  229. string facename = "宋体"
  230. long textcolor = 33554432
  231. long backcolor = 134217738
  232. string text = "原始大小"
  233. boolean checked = true
  234. end type
  235. event clicked;IF IsValid(obj_fileview) THEN
  236. obj_fileview.of_set_originalsize( THIS.Checked)
  237. END IF
  238. IF THIS.Checked THEN
  239. f_SetProfileString (sys_empid, "w_fj_fileopen", "originalsize", '1')
  240. ELSE
  241. f_SetProfileString (sys_empid, "w_fj_fileopen", "originalsize", '0')
  242. END IF
  243. end event
  244. event constructor;THIS.BackColor = 14215660
  245. String OriginalSize
  246. OriginalSize = f_ProfileString (sys_empid, "w_filemanager", "originalsize", "1")
  247. IF OriginalSize = '1' THEN
  248. THIS.Checked = TRUE
  249. ELSE
  250. THIS.Checked = FALSE
  251. END IF
  252. end event
  253. type cb_1 from uo_imflatbutton within w_fj_fileopen
  254. integer x = 151
  255. integer width = 151
  256. integer height = 164
  257. integer taborder = 10
  258. string text = "刷新"
  259. string normalpicname = "refresh.bmp"
  260. integer picsize = 16
  261. toolbaralignment pic_align = alignattop!
  262. boolean border = false
  263. end type
  264. event clicked;call super::clicked;wf_fileopen(ins_fileid)
  265. wf_set_object_size()
  266. end event
  267. type cb_4 from uo_imflatbutton within w_fj_fileopen
  268. integer width = 151
  269. integer height = 164
  270. integer taborder = 60
  271. string text = "退出"
  272. string normalpicname = "exit.bmp"
  273. integer picsize = 16
  274. toolbaralignment pic_align = alignattop!
  275. boolean border = false
  276. end type
  277. event clicked;call super::clicked;close(parent)
  278. end event
  279. type ln_bar2 from line within w_fj_fileopen
  280. long linecolor = 16777215
  281. integer linethickness = 4
  282. integer beginx = -23
  283. integer beginy = 176
  284. integer endx = 2016
  285. integer endy = 176
  286. end type
  287. type ln_bar from line within w_fj_fileopen
  288. long linecolor = 268435456
  289. integer linethickness = 4
  290. integer beginx = -23
  291. integer beginy = 172
  292. integer endx = 1984
  293. integer endy = 172
  294. end type
  295. type r_bar from rectangle within w_fj_fileopen
  296. long linecolor = 16777215
  297. integer linethickness = 4
  298. long fillcolor = 1073741824
  299. integer x = 937
  300. integer y = 12
  301. integer width = 146
  302. integer height = 68
  303. end type
  304. event constructor;this.fillcolor = 14215660
  305. this.linecolor = 14215660
  306. this.x = -1
  307. this.y = -1
  308. this.height = ln_bar.beginy - 5
  309. end event