home *** CD-ROM | disk | FTP | other *** search
/ Di Gi Charat Mail / disc2.iso / disc1 / digiroom.iso / ie5 / IE_S4.CAB / IE_4.CAB / MSHTMLER.DLL / HTML / FORCHAR.DLG < prev    next >
Text File  |  1999-04-01  |  21KB  |  761 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
  2. <HTML id=dlgFont STYLE="font-family: MS UI Gothic; font-size: 9pt;
  3. width: 35.4em; height: 26.9em">
  4. <HEAD>
  5. <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
  6. <TITLE id=dialogTitle>
  7. âtâHâôâg
  8. </TITLE>
  9. </HEAD>
  10. <SCRIPT defer>
  11. function callHelp(elm)
  12. {
  13. if (null != elm.helpid)
  14. {
  15.  window.showHelp(elm.helpfile, "" + parseInt(elm.helpid),
  16.   "popup");
  17. }
  18. else
  19. {
  20.  if ("BODY" != elm.tagName)
  21.  {
  22.   callHelp(elm.parentElement);
  23.  }
  24. }
  25. function btnCancelClick()
  26. {
  27. window.close();
  28. function getTextRange(elm)
  29. {
  30. var r = elm.parentTextEdit.createTextRange();
  31. r.moveToElementText(elm);
  32. return r;
  33. function mouseClick()
  34. {
  35. if (window.event.srcElement.id.substring(0,3)
  36.  == "txt")
  37. {
  38.  return;
  39. }
  40. if (window.event.button == 2)
  41. {
  42.  callHelp(window.event.srcElement);
  43. }
  44. function txtDefaultESC()
  45. {
  46. if (event.keyCode == 27)
  47. {
  48.  window.close();
  49.  return;
  50. }
  51. window.onerror = HandleError
  52. var L_Dialog_ErrorMessage = "é▒é╠â_âCâAâìâOé┼âGâëü[é¬ö¡É╢é╡é▄é╡é╜üB";
  53. var L_ErrorNumber_Text = "âGâëü[: ";
  54. function HandleError(message, url, line)
  55. {
  56. var str = L_Dialog_ErrorMessage + "\n\n" 
  57.  + L_ErrorNumber_Text + line + "\n"
  58.  + message;
  59. alert (str);
  60. window.close();
  61. return true;
  62. }
  63. var g_bSearchList = false; 
  64. var g_nTimeoutID;   
  65. var g_szLastFound = "";  
  66. var g_nLastFoundIndex = 0; 
  67. var g_nMatchLength = 0;  
  68. function GetSampleString()
  69. {
  70. var strReturn = "AaBbYyZz";
  71. if (txtFontName.value != "")
  72. {
  73.  switch (dialogHelper.getCharset(txtFontName.value))
  74.  {
  75.  case 2:
  76.   {
  77.    strReturn = "Symbol";
  78.    break;
  79.   }
  80.  case 128:
  81.   {
  82.    strReturn = "Aa\u3042\u3041\u30a2\u30a1\u4e9c\u5b87";
  83.    break;
  84.   }
  85.  case 129:
  86.  case 130:
  87.   {
  88.    strReturn = "\uac00\ub098\ub2e4\u0041\u0061\u0042\u0062\u0059\u0079\u005a\u007a";
  89.    break;
  90.   }
  91.  case 136:
  92.   {
  93.    strReturn = "\u4e2d\u6587\u5b57\u578b\u7bc4\u4f8b";
  94.    break;
  95.   }
  96.  case 161:
  97.   {
  98.    strReturn = "AaBb\u0391\u03b1\u0392\u03b2";
  99.    break;
  100.   }
  101.  case 162:
  102.   {
  103.    strReturn = "AaBb\u011e\u011f\u015e\u015f";
  104.    break;
  105.   }
  106.  case 177:
  107.   {
  108.    strReturn = "AaBb\u05e0\u05e1\u05e9\u05ea";
  109.    break;
  110.   }
  111.  case 178:
  112.  case 179:
  113.   {
  114.    strReturn = "AaBb\u0639\u0645\u0646\u062e\u0631\u0648\u0643\u0645";
  115.    break;
  116.   }
  117.  case 204:
  118.   {
  119.    strReturn = "AaBb\u0411\u0431\u0424\u0444";
  120.    break;
  121.   }
  122.  case 238:
  123.   {
  124.    strReturn = "AaBb\u00c1\u00e1\u00d4\u00f4";
  125.    break;
  126.   }
  127.  case 255:
  128.   {
  129.    strReturn = "Aa\u00f8\u00f1\u00fd"; 
  130.    break;
  131.   }
  132.  }
  133. }
  134. return strReturn;
  135. function getCheckStateCmd(checkbox, range)
  136. {
  137. checkbox.checked = (true == range.queryCommandState(checkbox.value));
  138. function getSelectStateCmd(select, range)
  139. {
  140. var index;
  141. if (null != range.queryCommandValue(select.id.substring(3)))
  142. {
  143.  for (index = 0; index < select.options.length; index++)
  144.  {
  145.   if (select.options[index].value ==
  146.    range.queryCommandValue(select.id.substring(3)))
  147.   {
  148.    select.selectedIndex = index;
  149.    break;
  150.   }
  151.  }
  152. }
  153. else
  154. {
  155.  select.selectedIndex = -1;
  156. }
  157. function setCheckStateCmd(checkbox, range)
  158. {
  159. if (checkbox.checked !=
  160.  (true == range.queryCommandState(checkbox.value)))
  161. {
  162.  range.execCommand(checkbox.value, false);
  163. }
  164. function setSelectStateCmd(select, range)
  165. {
  166. if (-1 != select.selectedIndex)
  167. {
  168.  range.execCommand(select.id.substring(3), false,
  169.   select.options[select.selectedIndex].value);
  170. }
  171. function NoCaseCompare(str1, str2)
  172. {
  173. var ideo1 = 1 != escape(str1.charAt(0)).length;
  174. var ideo2 = 1 != escape(str2.charAt(0)).length;
  175. if (ideo1 != ideo2)
  176.  return ideo1 ? -1 : 1;
  177. if (str1.toLowerCase() < str2.toLowerCase())
  178.  return -1;
  179. if (str1.toLowerCase() > str2.toLowerCase())
  180.  return 1;
  181. return 0;  
  182. function fillFontSelect(select)
  183. {
  184. var index;
  185. var fontList = new Array();
  186. var optFontName;
  187. var len = dialogHelper.fonts.length;
  188. for (index = 0; index < len; index++)
  189. {
  190.  fontList[index] =
  191.   dialogHelper.fonts.item(index);
  192. }
  193. fontList.sort(NoCaseCompare);
  194. for (index = 0; index < fontList.length; index++)
  195. {
  196.  optFontName = new Option();
  197.  optFontName.value = fontList[index];
  198.  optFontName.text = fontList[index];
  199.  select.options[index] = optFontName;
  200. }
  201. function setFont(range)
  202. {
  203. var FontNameCommand = "FontName";
  204. if (window.event.srcElement == txtFontName ||
  205.  window.event.srcElement == cmdFontName)
  206. {
  207.  range.text = GetSampleString();
  208.  range = getTextRange(elmSample);
  209. }
  210. if (-1 != cmdFontName.selectedIndex)
  211. {
  212.  range.execCommand(FontNameCommand, false, txtFontName.value);
  213. }
  214. }
  215. function getFontStyle()
  216. {
  217. var cmdBold = "Bold";
  218. var cmdItalic = "Italic";
  219. var globalDoc = window.dialogArguments;
  220. var range = globalDoc;
  221. with (range)
  222. {
  223.  if (queryCommandState(cmdBold) && queryCommandState(cmdItalic))
  224.  {
  225.   selFontStyle.value = "Bold-Italic";
  226.  }
  227.  else if (queryCommandState(cmdBold))
  228.  {
  229.   selFontStyle.value = "Bold";
  230.  }
  231.  else if (queryCommandState(cmdItalic))
  232.  {
  233.   selFontStyle.value = "Italic";
  234.  }
  235.  else
  236.  {
  237.   selFontStyle.value = "Regular";
  238.  }
  239. }
  240. function setFontStyle(range)
  241. {
  242. var cmdBold = "Bold";
  243. var cmdItalic = "Italic";
  244. with (range)
  245. {
  246.  if ("Bold-Italic" == selFontStyle.value)
  247.  {
  248.   if (true != queryCommandState(cmdBold))
  249.   {
  250.    execCommand(cmdBold, false);
  251.   }
  252.   if (true != queryCommandState(cmdItalic))
  253.   {
  254.    execCommand(cmdItalic, false);
  255.   }
  256.  }
  257.  else if ("Bold" == selFontStyle.value)
  258.  {
  259.   if (true != queryCommandState(cmdBold))
  260.   {
  261.    execCommand(cmdBold, false);
  262.   }
  263.   if (true == queryCommandState(cmdItalic))
  264.   {
  265.    execCommand(cmdItalic, false);
  266.   }
  267.  }
  268.  else if ("Italic" == selFontStyle.value)
  269.  {
  270.   if (true == queryCommandState(cmdBold))
  271.   {
  272.    execCommand(cmdBold, false);
  273.   }
  274.   if (true != queryCommandState(cmdItalic))
  275.   {
  276.    execCommand(cmdItalic, false);
  277.   }
  278.  }
  279.  else
  280.  {
  281.   if (true == queryCommandState(cmdBold))
  282.   {
  283.    execCommand(cmdBold, false);
  284.   }
  285.   if (true == queryCommandState(cmdItalic))
  286.   {
  287.    execCommand(cmdItalic, false);
  288.   }
  289.  }
  290. }
  291. function getFontColor()
  292. {
  293. var cmdForeColor = "ForeColor";
  294. var globalDoc = window.dialogArguments;
  295. var range = globalDoc;
  296. var intColor = range.queryCommandValue(cmdForeColor);
  297. if (null != intColor)
  298. {
  299.  selColor.value = intColor;
  300.  if (parseInt(selColor.value) != parseInt(intColor))
  301.  {
  302.   selColor.customColor = intColor;
  303.   selColor.value = "custom";
  304.  }
  305. }
  306. else
  307. {
  308.  selColor.selectedIndex = -1;
  309. }
  310. function setFontColor(range)
  311. {
  312. var cmdForeColor = "ForeColor";
  313. var intDefaultColor = 0;
  314. if (-1 != selColor.selectedIndex)
  315. {
  316.  if ("custom" == selColor.value)
  317.  {
  318.   range.execCommand(cmdForeColor, false,
  319.    parseInt(selColor.customColor));
  320.   return;
  321.  }
  322.  else
  323.  {
  324.   range.execCommand(cmdForeColor, false,
  325.    parseInt(selColor.value));
  326.  }
  327. }
  328. function syncSelect(ctlSelect, ctlText)
  329. {
  330. if (-1 != ctlSelect.selectedIndex)
  331. {
  332.  if (ctlText.value.toLowerCase()
  333.   == ctlSelect.options[ctlSelect.selectedIndex]
  334.   .text.toLowerCase())
  335.  {
  336.   ctlText.value = ctlSelect.options[ctlSelect.selectedIndex].text;
  337.  }
  338. }
  339. function syncSelect2(ctlSelect, ctlText)
  340. {
  341. if (-1 != ctlSelect.selectedIndex)
  342. {
  343.  ctlText.value = ctlSelect.options[ctlSelect.selectedIndex].text;
  344. }
  345. function findMatch (strMatch, optionsList)
  346. {
  347. var index;
  348. var index2;
  349. var bestChar = 0;
  350. var bestMatch = 0;
  351. var strOptText;
  352. for (index = 0; index < optionsList.length; index++)
  353. {
  354.  strOptText = optionsList.options[index].text;
  355.  for (index2 = bestChar; index2 < strMatch.length; index2++)
  356.  {
  357.   if (strMatch.substring(0, index2 + 1).toLowerCase() ==
  358.    strOptText.substring(0, index2 + 1)
  359.     .toLowerCase())
  360.   {
  361.    bestChar = index2 + 1;
  362.    bestMatch = index;
  363.   }
  364.   else
  365.   {
  366.    break;
  367.   }
  368.  }
  369. }
  370. return bestMatch;
  371. function updateSample()
  372. {
  373. var rngSample = getTextRange(elmSample);
  374. setCheckStateCmd(chkUnderline, rngSample);
  375. rngSample.text = GetSampleString();
  376. rngSample = getTextRange(elmSample);
  377. setFont(rngSample);
  378. setSelectStateCmd(cmdFontSize, rngSample); 
  379. setFontStyle(rngSample);
  380. setFontColor(rngSample);
  381. function searchText()
  382. {
  383. var index;
  384. var index2;
  385. var bestChar = g_nMatchLength;
  386. var bestMatch = g_nLastFo