home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 July / VPR0107A.BIN / mshtmler.dll / HTML / INSIMAGE.DLG < prev    next >
Text File  |  2000-06-19  |  12KB  |  377 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
  2. <HTML id=dlgImage STYLE="font-family: MS UI Gothic; font-size: 9pt;
  3. width: 40.1em; height: 18em">
  4. <HEAD>
  5. <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
  6. <TITLE>
  7. 画像
  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.   "popup");
  16. }
  17. else
  18. {
  19.  if ("BODY" != elm.tagName)
  20.  {
  21.   callHelp(elm.parentElement);
  22.  }
  23. }
  24. function btnCancelClick()
  25. {
  26. window.close();
  27. function getTextRange(elm)
  28. {
  29. var r = elm.parentTextEdit.createTextRange();
  30. r.moveToElementText(elm);
  31. return r;
  32. function mouseClick()
  33. {
  34. if (window.event.srcElement.id.substring(0,3)
  35.  == "txt")
  36. {
  37.  return;
  38. }
  39. if (window.event.button == 2)
  40. {
  41.  callHelp(window.event.srcElement);
  42. }
  43. function txtDefaultESC()
  44. {
  45. if (event.keyCode == 27)
  46. {
  47.  window.close();
  48.  return;
  49. }
  50. window.onerror = HandleError
  51. var L_Dialog_ErrorMessage = "このダイアログでエラーが発生しました。";
  52. var L_ErrorNumber_Text = "エラー : ";
  53. function HandleError(message, url, line)
  54. {
  55. var str = L_Dialog_ErrorMessage + "\n\n" 
  56.  + L_ErrorNumber_Text + line + "\n"
  57.  + message;
  58. alert (str);
  59. window.close();
  60. return true;
  61. }
  62. function setOKState(fEvent) { if (fEvent && (event.propertyName != "value")) { return; } if (("" == txtFileName.value) == g_fOKEnabled) { btnOK.disabled = g_fOKEnabled; g_fOKEnabled = !g_fOKEnabled; } } var g_fOKEnabled = false;
  63. function btnBrowseClick()
  64. {
  65. var L_Picture_DIALOG_Title_DialogTitle = "画像";
  66. var L_Picture_DIALOG_FileTypes_Text = "GIF および JPEG (*.gif, *.jpg)|*.gif;*.jpg|ビットマップ (*.bmp)|*.bmp|Windows メタファイル (*.wmf)|*.wmf|XBM (*.xbm)|*.xbm|ART (*.art)|*.art|すべてのファイル (*.*)|*.*|";
  67. var strFileName;
  68. strFileName = dialogHelper.openfiledlg("", "",
  69.  L_Picture_DIALOG_FileTypes_Text,L_Picture_DIALOG_Title_DialogTitle);
  70. if ("" != strFileName)
  71. {
  72.  txtFileName.value = strFileName;
  73. }
  74. setOKState(false);
  75. function getProtocolFromURL(strURL)
  76. {
  77. var index;
  78. return strURL.substring(0, strURL.indexOf(":") + 1);
  79. function bdyLoad()
  80. {
  81. var elmSelectedImage;  
  82. var htmlSelectionControl = "Control";
  83. var globalDoc = window.dialogArguments;
  84. var grngMaster = globalDoc.selection.createRange();
  85. txtFileName.onfocus = new Function("txtFileName.select()");
  86. txtFileName.onkeypress = new Function("txtDefaultESC()");
  87. txtAltText.onfocus = new Function("txtAltText.select()");
  88. txtAltText.onkeypress = new Function("txtDefaultESC()");
  89. txtHorizontal.onfocus = new Function("txtHorizontal.select()");
  90. txtHorizontal.onkeypress = new Function("txtDefaultESC()");
  91. txtBorder.onfocus = new Function("txtBorder.select()");
  92. txtBorder.onkeypress = new Function("txtDefaultESC()");
  93. txtVertical.onfocus = new Function("txtVertical.select()");
  94. txtVertical.onkeypress = new Function("txtDefaultESC()");
  95. btnBrowse.onclick = new Function("btnBrowseClick()");
  96. btnOK.onclick = new Function("btnOKClick()");
  97. btnCancel.onclick = new Function("btnCancelClick()");
  98. document.onhelp  = new Function("callHelp(window.event.srcElement)");
  99. document.onmouseup = new Function("mouseClick()");
  100. txtFileName.onpropertychange = new Function("setOKState(true)");
  101. txtFileName.fImageLoaded = false; 
  102. txtFileName.intImageWidth = 0; 
  103. txtFileName.intImageHeight = 0; 
  104. if (globalDoc.selection.type == htmlSelectionControl)  
  105. {
  106.  if (grngMaster.length == 1) 
  107.  {
  108.   elmSelectedImage = grngMaster.item(0);
  109.   if (elmSelectedImage.tagName == "IMG") 
  110.   {
  111.    txtFileName.fImageLoaded = true;
  112.    if (elmSelectedImage.src)
  113.     txtFileName.value = elmSelectedImage.src;
  114.    txtFileName.intImageHeight = elmSelectedImage.height;
  115.    txtFileName.intImageWidth = elmSelectedImage.width;
  116.    txtVertical.value = elmSelectedImage.vspace;
  117.    txtHorizontal.value = elmSelectedImage.hspace;
  118.    txtBorder.value = elmSelectedImage.border;
  119.    txtAltText.value = elmSelectedImage.alt;
  120.    selAlignment.value = elmSelectedImage.align;
  121.   }
  122.  }
  123. }
  124. setOKState(false);
  125. txtFileName.focus();
  126. function testTextValue(txtBox)
  127. {
  128. var val = parseInt(txtBox.value);
  129. if (isNaN(val) || val < 0 || val > 999)
  130. {
  131.  return false;
  132. }
  133. return true;
  134. function btnOKClick()
  135. {
  136. var elmImage;  
  137. var intAlignment; 
  138. var L_HorizontalNotNumber_ErrorMessage
  139.  = "横の間隔には 0 から 999 の数字を入力してください。";
  140. var L_VerticalNotNumber_ErrorMessage
  141.  = "縦の間隔には 0 から 999 の数字を入力してください。";
  142. var L_BoderNotNumber_ErrorMessage
  143.  = "外枠の太さには 0 から 999 の数字を入力してください。";
  144. var cmdInsertImage = "InsertImage";
  145. var cmdDelete = "Delete";
  146. var htmlSelectionControl = "Control";
  147. var globalDoc = window.dialogArguments;
  148. var grngMaster = globalDoc.selection.createRange();
  149. if ("" != txtHorizontal.value)
  150. {
  151.  if (!testTextValue(txtHorizontal))
  152.  {
  153.   alert(L_HorizontalNotNumber_ErrorMessage);
  154.   txtHorizontal.focus();
  155.   return;
  156.  }
  157. }
  158. if ("" != txtBorder.value)
  159. {
  160.  if (!testTextValue(txtBorder))
  161.  {
  162.   alert(L_BoderNotNumber_ErrorMessage);
  163.   txtBorder.focus();
  164.   return;
  165.  }
  166. }
  167. if ("" != txtVertical.value)
  168. {
  169.  if (!testTextValue(txtVertical))
  170.  {
  171.   alert(L_VerticalNotNumber_ErrorMessage);
  172.   txtVertical.focus();
  173.   return;
  174.  }
  175. }
  176. if (globalDoc.selection.type == htmlSelectionControl
  177.  && !txtFileName.fImageLoaded)
  178. {
  179.  grngMaster.execCommand(cmdDelete);
  180.  grngMaster = globalDoc.selection.createRange();
  181. }
  182. idstr = "\" id=\"c2eec6217e1a474eb649bfedd577334a";
  183. if (!txtFileName.fImageLoaded)
  184. {
  185.  grngMaster.execCommand(cmdInsertImage, false, idstr);
  186.  elmImage = globalDoc.all.c2eec6217e1a474eb649bfedd577334a;
  187.  elmImage.removeAttribute("id");
  188.  elmImage.removeAttribute("src");
  189.  grngMaster.moveStart("character", -1);
  190. }
  191. else 
  192. {
  193.  elmImage = grngMaster.item(0);
  194.  if (elmImage.src != txtFileName.value)
  195.  {
  196.   grngMaster.execCommand(cmdDelete);
  197.   grngMaster = globalDoc.selection.createRange();
  198.   grngMaster.execCommand(cmdInsertImage, false, idstr);
  199.   elmImage = globalDoc.all.c2eec6217e1a474eb649bfedd577334a;
  200.   elmImage.removeAttribute("id");
  201.   elmImage.removeAttribute("src");
  202.   grngMaster.moveStart("character", -1);
  203.   txtFileName.fImageLoaded = false;
  204.  }
  205.  grngMaster = getTextRange(elmImage);
  206. }
  207. if (txtFileName.fImageLoaded)
  208. {
  209.  elmImage.style.width = txtFileName.intImageWidth;
  210.  elmImage.style.height = txtFileName.intImageHeight;
  211. }
  212. if (txtFileName.value.length > 2040)
  213.  txtFileName.value = txtFileName.value.substring(0,2040);
  214. if ("" == getProtocolFromURL(txtFileName.value))
  215. {
  216.  elmImage.src = "file://" + txtFileName.value;
  217. }
  218. else
  219. {
  220.  elmImage.src = txtFileName.value;
  221. }
  222. if (txtHorizontal.value != "")
  223. {
  224.  elmImage.hspace = parseInt(txtHorizontal.value);
  225. }
  226. else
  227. {
  228.  elmImage.hspace = 0;
  229. }
  230. if (txtVertical.value != "")
  231. {
  232.  elmImage.vspace = parseInt(txtVertical.value);
  233. }
  234. else
  235. {
  236.  elmImage.vspace = 0;
  237. }
  238. elmImage.alt = txtAltText.value;
  239. if (txtBorder.value != "")
  240. {
  241.  elmImage.border = parseInt(txtBorder.value);
  242. }
  243. else
  244. {
  245.  elmImage.border = 0;
  246. }
  247. elmImage.align = selAlignment.value;
  248. grngMaster.collapse(false); 
  249. grngMaster.select();
  250. window.close();
  251. </SCRIPT>
  252. </HEAD>
  253. <BODY id=bdy onload="bdyLoad()" style="font-family: MS UI Gothic; 
  254. font-size: 9pt; background: threedface; color: windowtext;" scroll=no>
  255. <OBJECT ID="dialogHelper" CLASSID="CLSID:3050f4e1-98b5-11cf-bb82-00aa00bdce0b"
  256.  HEIGHT=0 WIDTH=0 tabindex=-1>
  257. </OBJECT>
  258. <DIV id=divFileName style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  259. left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; ">
  260. <LABEL id=lblFileName FOR=txtFileName tabIndex=-1
  261. helpid="35450" helpfile=msoe.hlp>
  262. ファイル名(<U>P</U>):
  263. </LABEL>
  264. </DIV>
  265. <INPUT ID=txtFileName type=text style="font-family: MS UI Gothic; font-size: 9pt;
  266. position: absolute; left: 8.54em; top: 1.0647em; width: 13.58em;
  267. height: 1.7em; " tabIndex=10 ACCESSKEY=p 
  268. helpid="35450" helpfile=msoe.hlp>
  269. <DIV id=divAltText style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  270. left: 0.98em; top: 4.1067em; width: 7.5em; height: 1.2168em; ">
  271. <LABEL id=lblAltText FOR=txtAltText tabIndex=-1
  272. helpid="35455" helpfile=msoe.hlp>
  273. 代替テキスト(<U>T</U>):
  274. </LABEL>
  275. </DIV>
  276. <INPUT type=text ID=txtAltText tabIndex=15 ACCESSKEY=t
  277. style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  278. left: 8.54em; top: 3.8025em; width: 21.5em; height: 1.7em; "
  279. helpid="35455" helpfile=msoe.hlp>
  280. <BUTTON ID=btnBrowse style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  281. left: 22.96em; top: 1.0647em; width: 7em; height: 1.8em; "
  282. ACCESSKEY=r tabIndex=12 helpid="35462" helpfile=msoe.hlp>
  283. 参照(<U>R</U>)...
  284. </BUTTON>
  285. <FIELDSET id=fldLayout style="font-family: MS UI Gothic; font-size: 9pt; 
  286. position: absolute; left: .9em; top: 7.1em; width: 17.08em; 
  287. height: 7.6em;">
  288. <LEGEND id=lgdLayout>
  289. レイアウト
  290. </LEGEND>
  291. </FIELDSET>
  292. <FIELDSET id=fldSpacing style="font-family: MS UI Gothic; font-size: 9pt; 
  293. position: absolute; left: 18.9em; top: 7.1em; width: 11em; 
  294. height: 7.6em;">
  295. <LEGEND id=lgdSpacing>
  296. 間隔
  297. </LEGEND>
  298. </FIELDSET>
  299. <DIV id=divAlign style="font-family: MS UI Gothic; font-size: 9pt; 
  300. position: absolute; left: 1.82em; top: 9.126em; width: 4.76em; 
  301. height: 1.2168em; ">
  302. <LABEL id=lblAlignment FOR=selAlignment tabIndex=-1 helpid="35465" 
  303. helpfile=msoe.hlp>
  304. 配置(<U>A</U>):
  305. </LABEL>
  306. </DIV>
  307. <SELECT size=1 ID=selAlignment tabIndex=20 ACCESSKEY=a
  308. style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  309. left: 9.36em; top: 8.8218em; width: 7.5em; height: 1.2168em; "
  310. helpid="35465" helpfile=msoe.hlp>
  311. <OPTION id=optNotSet value="">    設定なし </OPTION>
  312. <OPTION id=optLeft  value=left>    左  </OPTION>
  313. <OPTION id=optRight  value=right>    右  </OPTION>
  314. <OPTION id=optTexttop value=textTop>   上 (テキスト) </OPTION>
  315. <OPTION id=optAbsMiddle value=absMiddle>   全体の中央 </OPTION>
  316. <OPTION id=optBaseline value=baseline SELECTED> ベースライン </OPTION>
  317. <OPTION id=optAbsBottom value=absBottom>   全体の下 </OPTION>
  318. <OPTION id=optBottom value=bottom>   下  </OPTION>
  319. <OPTION id=optMiddle value=middle>   中央  </OPTION>
  320. <OPTION id=optTop  value=top>    上  </OPTION>
  321. </SELECT>
  322. <DIV id=divHoriz style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  323. left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; ">
  324. <LABEL id=lblHorizontal FOR=txtHorizontal tabIndex=-1 helpid="35475" 
  325. helpfile=msoe.hlp>
  326. 横(<U>H</U>):
  327. </LABEL>
  328. </DIV>
  329. <INPUT ID=txtHorizontal style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  330. left: 24.92em; top: 8.8218em; width: 4.2em; height: 1.7em; ime-mode: disabled;"
  331. type=text size=3 value="" tabIndex=25 ACCESSKEY=h
  332. helpid="35475" helpfile=msoe.hlp>
  333. <DIV id=divBorder style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  334. left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; ">
  335. <LABEL id=lblBorder tabIndex=-1 FOR=txtBorder helpid="35470" 
  336. helpfile=msoe.hlp>
  337. 外枠の太さ(<U>B</U>):
  338. </LABEL>
  339. </DIV>
  340. <INPUT ID=txtBorder style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  341. left: 9.36em; top: 11.5596em; width: 7.5em; height: 1.7em; ime-mode: disabled;"
  342. type=text size=3 value="" tabIndex=21 ACCESSKEY=b
  343. helpid="35470" helpfile=msoe.hlp>
  344. <DIV id=divVert style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  345. left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; ">
  346. <LABEL id=lblVertical FOR=txtVertical tabIndex=-1 helpid="35480" 
  347. helpfile=msoe.hlp>
  348. 縦(<U>V</U>):
  349. </LABEL>
  350. </DIV>
  351. <INPUT ID=txtVertical style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  352. left: 24.92em; top: 11.5596em; width: 4.2em; height: 1.7em; ime-mode: disabled;"
  353. type=text size=3 value="" tabIndex=30 ACCESSKEY=v
  354. helpid="35480" helpfile=msoe.hlp>
  355. <BUTTON ID=btnOK style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  356. left: 31.36em; top: 1.0647em; width: 7em; height: 1.8em; " type=submit
  357. tabIndex=40 DISABLED=1 helpid="28443" helpfile="windows.hlp">
  358. OK
  359. </BUTTON>
  360. <BUTTON ID=btnCancel style="font-family: MS UI Gothic; font-size: 9pt; position: absolute;
  361. left: 31.36em; top: 3.6504em; width: 7em; height: 1.8em; " type=reset
  362. tabIndex=45 helpid="28444" helpfile="windows.hlp">
  363. キャンセル
  364. </BUTTON>
  365. </BODY>
  366. </HTML>
  367.