home *** CD-ROM | disk | FTP | other *** search
/ Chip: Shareware for Win 95 / Chip-Shareware-Win95.bin / komunik / ie40 / ie4nt_s2.cab / IE4NT_2.CAB / MSHTML.DLL / 2110 / INSIMAGE.DLG < prev    next >
Encoding:
Text File  |  1997-07-12  |  10.7 KB  |  341 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
  2. <HTML id=dlgImage STYLE="font-family: ms sans serif; font-size: 8pt;
  3. width: 40.1em; height: 18em">
  4. <HEAD>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <TITLE>
  7. Picture
  8. </TITLE>
  9. <SCRIPT defer>
  10. function callHelp(elm)
  11. {
  12. if (null != elm.helpid)
  13. {
  14.  window.showHelp(elm.helpfile, "" + parseInt(elm.helpid));
  15. }
  16. else
  17. {
  18.  if ("BODY" != elm.tagName)
  19.  {
  20.   callHelp(elm.parentElement);
  21.  }
  22. }
  23. function btnCancelClick()
  24. {
  25. window.close();
  26. function getTextRange(elm)
  27. {
  28. var r = elm.parentTextEdit.createTextRange();
  29. r.moveToElementText(elm);
  30. return r;
  31. function mouseClick()
  32. {
  33. if (window.event.srcElement.id.substring(0,3)
  34.  == "txt")
  35. {
  36.  return;
  37. }
  38. if (window.event.button == 2)
  39. {
  40.  callHelp(window.event.srcElement);
  41. }
  42. function txtDefaultESC()
  43. {
  44. if (event.keyCode == 27)
  45. {
  46.  window.close();
  47.  return;
  48. }
  49. function setOKState(fKeyPress) { var htmlKeyAlt = 18; if (!fKeyPress || htmlKeyAlt != event.keyCode) { if (("" == txtFileName.value) == g_fOKEnabled) { btnOK.disabled = g_fOKEnabled; g_fOKEnabled = !g_fOKEnabled; } } else { window.setTimeout("set" + "OK" + "State(false)", 50); } }
  50. var g_fOKEnabled = false; 
  51. function btnBrowseClick()
  52. {
  53. var L_Picture_DIALOG_Title_DialogTitle = "Picture";
  54. var L_Picture_DIALOG_FileTypes_Text = "GIF and JPEG (*.gif, *.jpg)|*.gif;*.jpg|Bitmap (*.bmp)|*.bmp|Windows Metafile (*.wmf)|*.wmf|XBM (*.xbm)|*.xbm|ART (*.art)|*.art|All files (*.*)|*.*|";
  55. var strFileName;
  56. strFileName = window.dialogArguments.openfiledlg("","",
  57.  L_Picture_DIALOG_FileTypes_Text,L_Picture_DIALOG_Title_DialogTitle);
  58. if ("" != strFileName)
  59. {
  60.  txtFileName.value = strFileName;
  61. }
  62. setOKState(false);
  63. function getProtocolFromURL(strURL)
  64. {
  65. var index;
  66. return strURL.substring(0, strURL.indexOf(":") + 1);
  67. function bdyLoad()
  68. {
  69. var elmSelectedImage;  
  70. var htmlSelectionControl = "Control";
  71. var globalDoc = window.dialogArguments.document;
  72. var grngMaster = globalDoc.selection.createRange();
  73. txtFileName.onfocus = new Function("txtFileName.select()");
  74. txtFileName.onkeypress = new Function("txtDefaultESC()");
  75. txtAltText.onfocus = new Function("txtAltText.select()");
  76. txtAltText.onkeypress = new Function("txtDefaultESC()");
  77. txtHorizontal.onfocus = new Function("txtHorizontal.select()");
  78. txtHorizontal.onkeypress = new Function("txtDefaultESC()");
  79. txtBorder.onfocus = new Function("txtBorder.select()");
  80. txtBorder.onkeypress = new Function("txtDefaultESC()");
  81. txtVertical.onfocus = new Function("txtVertical.select()");
  82. txtVertical.onkeypress = new Function("txtDefaultESC()");
  83. btnBrowse.onclick = new Function("btnBrowseClick()");
  84. btnOK.onclick = new Function("btnOKClick()");
  85. btnCancel.onclick = new Function("btnCancelClick()");
  86. document.onhelp  = new Function("callHelp(window.event.srcElement)");
  87. document.onmouseup = new Function("mouseClick()");
  88. txtFileName.onkeyup = new Function("setOKState(true)");
  89. txtFileName.fImageLoaded = false; 
  90. txtFileName.intImageWidth = 0; 
  91. txtFileName.intImageHeight = 0; 
  92. if (globalDoc.selection.type == htmlSelectionControl)  
  93. {
  94.  if (grngMaster.length == 1) 
  95.  {
  96.   elmSelectedImage = grngMaster.item(0);
  97.   if (elmSelectedImage.tagName == "IMG") 
  98.   {
  99.    txtFileName.fImageLoaded = true;
  100.    txtFileName.value = elmSelectedImage.src;
  101.    txtFileName.intImageHeight = elmSelectedImage.height;
  102.    txtFileName.intImageWidth = elmSelectedImage.width;
  103.    txtVertical.value = elmSelectedImage.vspace;
  104.    txtHorizontal.value = elmSelectedImage.hspace;
  105.    txtBorder.value = elmSelectedImage.border;
  106.    txtAltText.value = elmSelectedImage.alt;
  107.    selAlignment.value = elmSelectedImage.align;
  108.   }
  109.  }
  110. }
  111. setOKState(false);
  112. function testTextValue(txtBox)
  113. {
  114. var val = parseInt(txtBox.value);
  115. if (isNaN(val) || val < 0 || val > 999)
  116. {
  117.  return false;
  118. }
  119. return true;
  120. function btnOKClick()
  121. {
  122. var elmImage;  
  123. var intAlignment; 
  124. var L_HorizontalNotNumber_ErrorMessage
  125.  = "Horizontal spacing must be a number between 0 and 999.";
  126. var L_VerticalNotNumber_ErrorMessage
  127.  = "Vertical spacing must be a number between 0 and 999.";
  128. var L_BoderNotNumber_ErrorMessage
  129.  = "Border thickness must be a number between 0 and 999.";
  130. var cmdInsertImage = "InsertImage";
  131. var cmdDelete = "Cut";
  132. var htmlSelectionControl = "Control";
  133. var globalDoc = window.dialogArguments.document;
  134. var grngMaster = globalDoc.selection.createRange();
  135. if ("" != txtHorizontal.value)
  136. {
  137.  if (!testTextValue(txtHorizontal))
  138.   {
  139.    alert(L_HorizontalNotNumber_ErrorMessage);
  140.    txtHorizontal.focus();
  141.    return;
  142.   }
  143. }
  144. if ("" != txtBorder.value)
  145. {
  146.  if (!testTextValue(txtBorder))
  147.   {
  148.    alert(L_BoderNotNumber_ErrorMessage);
  149.    txtBorder.focus();
  150.    return;
  151.   }
  152. }
  153. if ("" != txtVertical.value)
  154. {
  155.  if (!testTextValue(txtVertical))
  156.   {
  157.    alert(L_VerticalNotNumber_ErrorMessage);
  158.    txtVertical.focus();
  159.    return;
  160.   }
  161. }
  162. if (globalDoc.selection.type == htmlSelectionControl
  163.  && !txtFileName.fImageLoaded)
  164. {
  165.  grngMaster.execCommand(cmdDelete);
  166.  grngMaster = globalDoc.selection.createRange();
  167. }
  168. if (!txtFileName.fImageLoaded)
  169. {
  170.  grngMaster.execCommand(cmdInsertImage);
  171.  grngMaster.moveStart("character", -1);
  172.  elmImage = grngMaster.parentElement();
  173. }
  174. else 
  175. {
  176.  elmImage = grngMaster.item(0);
  177.  grngMaster = getTextRange(elmImage);
  178. }
  179. if ("" == getProtocolFromURL(txtFileName.value))
  180. {
  181.  elmImage.src = "file://" + txtFileName.value;
  182. }
  183. else
  184. {
  185.  elmImage.src = txtFileName.value;
  186. }
  187. if (txtHorizontal.value != "")
  188. {
  189.  elmImage.hspace = parseInt(txtHorizontal.value);
  190. }
  191. else
  192. {
  193.  elmImage.hspace = 0;
  194. }
  195. if (txtVertical.value != "")
  196. {
  197.  elmImage.vspace = parseInt(txtVertical.value);
  198. }
  199. else
  200. {
  201.  elmImage.vspace = 0;
  202. }
  203. elmImage.alt = txtAltText.value;
  204. if (txtBorder.value != "")
  205. {
  206.  elmImage.border = parseInt(txtBorder.value);
  207. }
  208. else
  209. {
  210.  elmImage.border = 0;
  211. }
  212. if (txtFileName.fImageLoaded)
  213. {
  214.  elmImage.style.width = txtFileName.intImageWidth;
  215.  elmImage.style.height = txtFileName.intImageHeight;
  216. }
  217. elmImage.align = selAlignment.value;
  218. grngMaster.collapse(false); 
  219. grngMaster.select();
  220. window.close();
  221. </SCRIPT>
  222. </HEAD>
  223. <BODY onload="bdyLoad()" style="font-family: ms sans serif; font-size: 8pt;
  224. background: threedface;">
  225. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  226. left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; "
  227. id=divFileName>
  228. <LABEL FOR=txtFileName tabIndex=-1
  229. helpid="35450" helpfile="msimn.hlp">
  230. <U>P</U>icture Source:
  231. </LABEL>
  232. </DIV>
  233. <INPUT type=text style="font-family: ms sans serif; font-size: 8pt;
  234. position: absolute; left: 8.54em; top: 1.0647em; width: 13.58em;
  235. height: 2.1294em; " helpid="35450" helpfile="msimn.hlp"
  236. ID=txtFileName tabIndex=10 ACCESSKEY=p>
  237. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  238. left: 0.98em; top: 4.1067em; width: 6.58em; height: 1.2168em; "\
  239. id=divAltText>
  240. <LABEL FOR=txtAltText tabIndex=-1
  241. helpid="35455" helpfile="msimn.hlp">
  242. Alternate <u>T</u>ext:
  243. </LABEL>
  244. </DIV>
  245. <INPUT type=text ID=txtAltText tabIndex=15 ACCESSKEY=t
  246. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  247. left: 8.54em; top: 3.8025em; width: 21.5em; height: 2.1294em; "
  248. helpid="35455" helpfile="msimn.hlp">
  249. <BUTTON style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  250. left: 22.96em; top: 1.0647em; width: 7em; height: 2.1294em; "
  251. ID=btnBrowse ACCESSKEY=r tabIndex=12 helpid="35462" helpfile="msimn.hlp">
  252. B<U>r</U>owse...
  253. </BUTTON>
  254. <FIELDSET id=fldLayout style="font-family: ms sans serif; font-size: 8pt; 
  255. position: absolute; left: .9em; top: 7.1em; width: 17.08em; 
  256. height: 7.6em;">
  257. <LEGEND>
  258. Layout
  259. </LEGEND>
  260. </FIELDSET>
  261. <FIELDSET style="font-family: ms sans serif; font-size: 8pt; 
  262. position: absolute; left: 18.9em; top: 7.1em; width: 11em; 
  263. height: 7.6em;" id=fldSpacing>
  264. <LEGEND>
  265. Spacing
  266. </LEGEND>
  267. </FIELDSET>
  268. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  269. left: 1.82em; top: 9.126em; width: 4.76em; height: 1.2168em; " id=divAlign>
  270. <LABEL FOR=selAlignment tabIndex=-1 helpid="35465" helpfile="msimn.hlp">
  271. <U>A</U>lignment:
  272. </LABEL>
  273. </DIV>
  274. <SELECT size=1 ID=selAlignment tabIndex=20 ACCESSKEY=a
  275. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  276. left: 10.36em; top: 8.8218em; width: 6.72em; height: 1.2168em; "
  277. helpid="35465" helpfile="msimn.hlp">
  278. <OPTION value="">    Not set </OPTION>
  279. <OPTION value=left>    Left  </OPTION>
  280. <OPTION value=right>    Right  </OPTION>
  281. <OPTION value=textTop>   Texttop </OPTION>
  282. <OPTION value=absMiddle>   Absmiddle </OPTION>
  283. <OPTION value=baseline SELECTED> Baseline </OPTION>
  284. <OPTION value=absBottom>   Absbottom </OPTION>
  285. <OPTION value=bottom>   Bottom  </OPTION>
  286. <OPTION value=middle>   Middle  </OPTION>
  287. <OPTION value=top>    Top  </OPTION>
  288. </SELECT>
  289. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  290. left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; " id=divHoriz>
  291. <LABEL FOR=txtHorizontal tabIndex=-1 helpid="35475" helpfile="msimn.hlp">
  292. <U>H</U>orizontal:
  293. </LABEL>
  294. </DIV>
  295. <INPUT style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  296. left: 24.92em; top: 8.8218em; width: 4.2em; height: 2.1294em; "
  297. type=text size=3 value="" ID=txtHorizontal tabIndex=25 ACCESSKEY=h
  298. helpid="35475" helpfile="msimn.hlp">
  299. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  300. left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; " id=divBorder>
  301. <LABEL tabIndex=-1 FOR=txtBorder helpid="35470" helpfile="msimn.hlp">
  302. <u>B</u>order Thickness:
  303. </LABEL>
  304. </DIV>
  305. <INPUT style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  306. left: 10.36em; top: 11.5596em; width: 6.72em; height: 2.1294em; "
  307. type=text size=3 value="" ID=txtBorder tabIndex=21 ACCESSKEY=b
  308. helpid="35470" helpfile="msimn.hlp">
  309. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  310. left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; " id=divVert>
  311. <LABEL FOR=txtVertical tabIndex=-1 helpid="35480" helpfile="msimn.hlp">
  312. <U>V</U>ertical:
  313. </LABEL>
  314. </DIV>
  315. <INPUT style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  316. left: 24.92em; top: 11.5596em; width: 4.2em; height: 2.1294em; "
  317. type=text size=3 value="" ID=txtVertical tabIndex=30 ACCESSKEY=v
  318. helpid="35480" helpfile="msimn.hlp">
  319. <BUTTON style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  320. left: 31.36em; top: 1.0647em; width: 7em; height: 2.1294em; " type=submit
  321. ID=btnOK tabIndex=40 DISABLED=1 helpid="28443" helpfile="windows.hlp">
  322. OK
  323. </BUTTON>
  324. <BUTTON style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  325. left: 31.36em; top: 3.6504em; width: 7em; height: 2.1294em; " type=reset
  326. ID=btnCancel tabIndex=45 helpid="28444" helpfile="windows.hlp">
  327. Cancel
  328. </BUTTON>
  329. </BODY>
  330. </HTML>
  331.