PageRenderTime 22ms CodeModel.GetById 28ms app.highlight 313ms RepoModel.GetById 7ms app.codeStats 2ms

/amaya/windialogapi.c

https://github.com/pffy/Amaya-Editor
C | 4236 lines | 3601 code | 324 blank | 311 comment | 428 complexity | 251235d4c40f6a6f9ebb0a3f1a298df0 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*
   2 *
   3 *  (c) COPYRIGHT INRIA, 1996-2005
   4 *  Please first read the full copyright statement in file COPYRIGHT.
   5 *
   6 */
   7
   8/*
   9 * Windows Dialogue API routines for Amaya
  10 *
  11 * Authors:  I. Vatton (W3C/INRIA),
  12 *           R. Guetari (W3C/INRIA),
  13 *           J. Kahan (W3C/INRIA)
  14 *
  15 */
  16#ifdef _WINGUI
  17#include <windows.h>
  18#include "resource.h"
  19#include "constmedia.h"
  20#include "corrmsg.h"
  21
  22#define THOT_EXPORT extern
  23#include "amaya.h"
  24#include "constmenu.h"
  25#include "wininclude.h"
  26
  27extern ThotWindow  FrRef[MAX_FRAME + 2];
  28extern int         ActiveFrame;
  29
  30#ifndef MAX_PROPOSAL_CHKR
  31#define MAX_PROPOSAL_CHKR 10
  32#endif /* MAX_PROPOSAL_CHKR */
  33
  34#ifndef MAX_WORD_LEN
  35#define MAX_WORD_LEN 30
  36#endif /* MAX_WORD_LEN */
  37
  38
  39#define MAX_BUFF 4096
  40/* JK: I think that some of these widgets, which are general, should
  41   go into the thotlib, such as IDC_LANGEDIT. We have a dupblication of
  42   IDC refs between thotlib and Amaya */
  43#define IDC_EDITRULE      20001
  44#define IDC_LANGEDIT      20002
  45#define IDC_CSSEDIT       20004
  46
  47#define OPT1               1110
  48#define OPT2               1111
  49#define OPT3               1112
  50#define OPT4               1113
  51#define OPT5               1114
  52#define OPT6               1115
  53#define OPT7               1116
  54#define OPT8               1117
  55#define OPT9               1118
  56
  57#define REPEAT_XY             0
  58#define REPEAT_X              1
  59#define REPEAT_Y              2
  60#define NO_REPEAT             3
  61
  62int                WIN_IndentValue;
  63int                WIN_OldLineSp;
  64int                WIN_NormalLineSpacing;
  65
  66extern HINSTANCE    hInstance;
  67extern HDC          TtPrinterDC;
  68extern char         DocToOpen[MAX_LENGTH];
  69extern ThotBool     TtIsPrinterTrueColor;
  70extern ThotBool     bUserAbort;
  71extern ThotBool     WithToC;
  72extern ThotBool     NumberLinks;
  73extern ThotBool     PrintURL;
  74extern ThotBool     IgnoreCSS;
  75extern HFONT        DialogFont;
  76
  77ThotWindow          ghwndAbort;
  78ThotWindow          ghwndMain;
  79ThotWindow          MakeIDHwnd;
  80ThotBool            gbAbort;
  81Document            TmpDoc; /* used to pass the Document id to the
  82			       callback when setting up a menu */
  83
  84static HDC          hDC;
  85static HDC          hMemDC;
  86static char         UrlToOpen[MAX_LENGTH];
  87static char         HrefUrl[MAX_LENGTH];
  88static char         TmpDocName[MAX_LENGTH];
  89static char         AltText[MAX_LENGTH];
  90static char         Message[300];
  91static char         Message2[300];
  92static char         Message3[300];
  93static char         WndTitle[100];
  94static char         CurrentPathName[100];
  95static char         WinCurLang[100];
  96static char         WinCurXML[100];
  97static char         CurFileToPrint[MAX_PATH];
  98static char         AttDlgTitle[100];
  99static char         MathEntName[MAX_TXT_LEN];
 100static char         SzBuffer[MAX_BUFF];
 101static char        *ClassList;
 102static char        *ItemList;
 103static char        *SavList;
 104static char        *cssList;
 105static char        *mimeType;
 106static char        *charSet;
 107static char        *string_par1;
 108static char        *string_par2;
 109static char         text[1024];
 110static int          repeatMode;
 111static int          fontNum;
 112static int          fontStyle;
 113static int          fontWeight;
 114static int          fontUnderline;
 115static int          fontSize;
 116static int          docSelect;
 117static int          dirSelect;
 118static int          currAttrVal;
 119static int          Num_zoneRecess;
 120static int          Num_zoneLineSpacing;
 121static int          Num_lang;
 122static int          XMLnum;
 123static int          Align_num;
 124static int          Indent_value;
 125static int          Indent_num;
 126static int          Old_lineSp;
 127static int          Line_spacingNum;
 128static int          attDlgNbItems;
 129static int          numCols;
 130static int          numRows;
 131static int          tBorder;
 132static int          formAlt;
 133static int          iLocation;
 134static int          iMode;
 135static int          indexImgFilter = 1;
 136static int          indexLinkFilter = 1;
 137static int          indexFilter = 1;
 138static UINT         itemIndex;
 139static UINT         nbClass;
 140static UINT         NbItem;
 141
 142static ThotBool	    saveBeforeClose;
 143static ThotBool     closeDontSave;
 144static ThotBool     isHref;
 145static ThotBool     WithEdit;
 146static ThotBool     WithCancel;
 147static ThotBool     WithBorder;
 148static ThotBool     HTMLFormat;
 149static ThotBool     ReleaseFocus;
 150static ThotBool     RequiredAttr;
 151
 152static OPENFILENAME OpenFileName;
 153static char        *SzFilter;
 154static ThotWindow   wndCSSList;
 155static ThotWindow   wndXMLList;
 156static ThotWindow   wndLangList;
 157static ThotWindow   wndListRule;
 158static ThotWindow   wndEditRule;
 159static ThotWindow   WndClose = NULL;
 160static ThotWindow   transURLWnd;
 161static ThotWindow   copyImgWnd;
 162static ThotWindow   WndSearchEdit;
 163static ThotWindow   GraphPal = NULL;
 164static ThotWindow   MathPal = NULL;
 165static ThotWindow   GreekPal = NULL;
 166static ThotWindow   CharacterForm = NULL;
 167static ThotWindow   FormatForm = NULL;
 168static ThotWindow   PrintForm = NULL;
 169static ThotWindow   LangForm = NULL;
 170static ThotWindow   XMLForm = NULL;
 171static ThotWindow   AttrForm = NULL;
 172static ThotWindow   SaveAsForm = NULL;
 173static ThotWindow   MimeTypeDlg = NULL;
 174static ThotWindow   InitConfirmForm = NULL;
 175static ThotWindow   DocInfo[DocumentTableLength];
 176
 177#include "init_f.h"
 178
 179/*----------------------------------------------------------------------
 180  DisplayStyleValue: update the property in Style dialog
 181  ----------------------------------------------------------------------*/
 182void  DisplayStyleValue (char *property, char *start_value, char *end_value)
 183{
 184}
 185
 186/*----------------------------------------------------------------------
 187   ReusePrinterDC()
 188   Call the Windows print dialogue or reuse the previous context.
 189  ----------------------------------------------------------------------*/
 190void ReusePrinterDC ()
 191{
 192  int        orientation, paper;
 193
 194  if (TtaGetPrinterDC (TRUE, &orientation, &paper))
 195    {
 196      ThotCallback (BasePrint + PPrinterName, STRING_DATA, CurFileToPrint);
 197      ThotCallback (BasePrint + FormPrint, INTEGER_DATA, (char *)1);
 198    }
 199}
 200
 201
 202        /*********************************************************
 203         *                                                       *
 204         *                   C A L L B A C K S                   *
 205         *                                                       *
 206         *********************************************************/
 207
 208
 209/*-----------------------------------------------------------------------
 210 AltDlgProc
 211 ------------------------------------------------------------------------*/
 212LRESULT CALLBACK AltDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 213			     LPARAM lParam)
 214{
 215  switch (msg)
 216    {
 217    case WM_INITDIALOG:
 218      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_ALT));
 219      SetWindowText (GetDlgItem (hwnDlg, IDC_ALTTEXT),
 220		     TtaGetMessage (AMAYA, AM_ALT));
 221      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
 222		     TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
 223      SetWindowText (GetDlgItem (hwnDlg, ID_DONE),
 224		     TtaGetMessage (LIB, TMSG_DONE));
 225      SetDlgItemText (hwnDlg, IDC_GETALT, "");
 226      break;
 227      
 228    case WM_COMMAND:
 229      switch (LOWORD (wParam))
 230	{
 231	case ID_CONFIRM:
 232	case ID_DONE:
 233	  GetDlgItemText (hwnDlg, IDC_GETALT, AltText, sizeof (AltText) - 1);
 234	  ThotCallback (BaseImage + ImageAlt, STRING_DATA, AltText);
 235	  if (!AltText || AltText[0] == 0)
 236	    MessageBox (hwnDlg, TtaGetMessage (AMAYA, AM_ALT_MISSING),
 237			TtaGetMessage (AMAYA, AM_ALT), MB_OK | MB_ICONERROR);
 238	  else 
 239	    EndDialog (hwnDlg, ID_CONFIRM);
 240	  ThotCallback (BaseImage + FormAlt, STRING_DATA, (char *)1);
 241	  break;
 242	}
 243      break;
 244    default:
 245      return FALSE;
 246    }
 247  return TRUE;
 248}
 249
 250/*-----------------------------------------------------------------------
 251 XMLDlgProc
 252 ------------------------------------------------------------------------*/
 253LRESULT CALLBACK XMLDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 254							 LPARAM lParam)
 255{
 256  int             index = 0;
 257  UINT            i = 0;
 258
 259  switch (msg)
 260    {
 261    case WM_INITDIALOG:
 262      /* get the default GUI font */
 263      /* destroy the focus of the previous open dialog */
 264      XMLForm = hwnDlg;
 265      SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_EL_TYPE));
 266	  SetWindowText (GetDlgItem (hwnDlg, ID_APPLY), TtaGetMessage (LIB, TMSG_INSERT));
 267	  SetWindowText (GetDlgItem (hwnDlg, ID_DONE), TtaGetMessage (LIB, TMSG_DONE));
 268	  SetWindowText (GetDlgItem (hwnDlg, IDC_XMLELEM),
 269			 TtaGetMessage (LIB, TMSG_EL_TYPE));
 270      wndXMLList = GetDlgItem (hwnDlg, IDC_XMLLIST);
 271      /* set the font of the window */
 272      WIN_SetDialogfont (wndXMLList);
 273      SendMessage (wndXMLList, LB_RESETCONTENT, 0, 0);
 274    while (i < NbItem && ItemList[index] != EOS)
 275      {
 276	SendMessage (wndXMLList, LB_INSERTSTRING, i, (LPARAM) &ItemList[index]); 
 277	index += strlen (&ItemList[index]) + 1;/* Longueur de l'intitule */
 278	i++;
 279      }
 280    SetWindowText (GetDlgItem (hwnDlg, IDC_XMLEDIT), "");
 281	XMLnum = -1;
 282    break;
 283
 284    case WM_CLOSE:
 285    case WM_DESTROY:
 286      XMLForm = NULL;
 287      EndDialog (hwnDlg, ID_DONE);
 288      break;
 289
 290    case WM_COMMAND:
 291      if (LOWORD (wParam) == 1 || HIWORD (wParam) == LBN_SELCHANGE ||
 292	  HIWORD (wParam) == LBN_DBLCLK)
 293	{
 294	  if (HIWORD (wParam) == LBN_SELCHANGE)
 295	    {
 296	      XMLnum = SendMessage (wndXMLList, LB_GETCURSEL, 0, 0);
 297	      XMLnum = SendMessage (wndXMLList, LB_GETTEXT, XMLnum,
 298				      (LPARAM) WinCurXML);
 299	      SetWindowText (GetDlgItem (hwnDlg, IDC_XMLEDIT), WinCurXML);
 300	    }
 301	  else if (HIWORD (wParam) == LBN_DBLCLK)
 302	    {
 303	      if (LB_ERR == (XMLnum = SendMessage (wndLangList, LB_GETCURSEL, 0, 0L)))
 304		break;
 305	      XMLnum = SendMessage (wndLangList, LB_GETTEXT, XMLnum,
 306				      (LPARAM) WinCurLang);
 307	    }
 308	  SetDlgItemText (hwnDlg, IDC_XMLEDIT, WinCurXML);
 309	  ThotCallback (NumSelectElemToBeCreated, STRING_DATA, WinCurXML);
 310	  if (HIWORD (wParam) == LBN_DBLCLK)
 311	    {
 312		  /* confirm the selection */
 313	      ThotCallback (NumFormElemToBeCreated, INTEGER_DATA, (char*) 1);
 314	      XMLForm = NULL;
 315	      EndDialog (hwnDlg, ID_DONE);
 316	      return FALSE;
 317	    }
 318	}
 319      
 320      switch (LOWORD (wParam))
 321	{
 322	case ID_APPLY:
 323	  GetDlgItemText (hwnDlg, IDC_XMLEDIT, WinCurXML, sizeof (WinCurXML) - 1);
 324	  if (WinCurXML[0] != EOS)
 325	    ThotCallback (NumSelectElemToBeCreated, STRING_DATA, WinCurXML);
 326	  ThotCallback (NumFormElemToBeCreated, INTEGER_DATA, (char*) 1);
 327	  if (WinCurXML[0] != EOS)
 328	  {
 329	  /* reinitialize the list */
 330      wndXMLList = GetDlgItem (hwnDlg, IDC_XMLLIST);
 331    while (i < NbItem && ItemList[index] != EOS)
 332      {
 333		if (i == NbItem - 1)
 334	SendMessage (wndXMLList, LB_INSERTSTRING, i, (LPARAM) &ItemList[index]); 
 335	index += strlen (&ItemList[index]) + 1;
 336	i++;
 337      }
 338    SetWindowText (GetDlgItem (hwnDlg, IDC_XMLEDIT), "");
 339	XMLnum = -1;
 340	  }
 341 	  break;
 342	case ID_DONE:
 343	  ThotCallback (NumFormElemToBeCreated, INTEGER_DATA, (char*) 0);
 344	  XMLForm = NULL;
 345	  EndDialog (hwnDlg, ID_DONE);
 346	  break;	  
 347	case WM_CLOSE:
 348	case WM_DESTROY:
 349	  XMLForm = NULL;
 350	  EndDialog (hwnDlg, ID_DONE);
 351	  break;
 352	}
 353      break;
 354    default: return FALSE;
 355    }
 356  return TRUE;
 357}
 358
 359/*-----------------------------------------------------------------------
 360 CSSDlgProc
 361 ------------------------------------------------------------------------*/
 362LRESULT CALLBACK CSSDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 363			     LPARAM lParam)
 364{
 365  int             index = 0;
 366  UINT            i = 0;
 367
 368  switch (msg)
 369    {
 370    case WM_INITDIALOG:
 371      SetWindowText (hwnDlg, WndTitle);
 372      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
 373		  TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
 374      SetWindowText (GetDlgItem (hwnDlg, ID_DONE),
 375		  TtaGetMessage (LIB, TMSG_DONE));
 376      SetWindowText (GetDlgItem (hwnDlg, IDC_CSSFILES),
 377		  TtaGetMessage (AMAYA, AM_CSS_FILE));
 378      wndCSSList = GetDlgItem (hwnDlg, IDC_CSSLIST);
 379      /* set the font of the window */
 380      WIN_SetDialogfont (wndCSSList);
 381      SendMessage (wndCSSList, LB_RESETCONTENT, 0, 0);
 382      while (i < NbItem && cssList[index] != EOS)
 383	{
 384	  SendMessage (wndCSSList, LB_INSERTSTRING, i, (LPARAM) &cssList[index]); 
 385	  index += strlen (&cssList[index]) + 1;	/* entry length */
 386	  i++;
 387	}
 388
 389      itemIndex = SendMessage (wndCSSList, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
 390      SetDlgItemText (hwnDlg, IDC_CSSEDIT, SzBuffer);
 391      break;
 392
 393    case WM_CLOSE:
 394    case WM_DESTROY:
 395      EndDialog (hwnDlg, ID_DONE);
 396      break;
 397
 398    case WM_COMMAND:
 399      if (LOWORD (wParam) == IDC_CSSLIST && HIWORD (wParam) == LBN_SELCHANGE)
 400	{
 401	itemIndex = SendMessage (wndCSSList, LB_GETCURSEL, 0, 0);
 402	itemIndex = SendMessage (wndCSSList, LB_GETTEXT, itemIndex, (LPARAM) SzBuffer);
 403	SetDlgItemText (hwnDlg, IDC_CSSEDIT, SzBuffer);
 404	ThotCallback (BaseCSS + CSSSelect, STRING_DATA, SzBuffer);
 405	}
 406
 407      switch (LOWORD (wParam))
 408	{
 409	case ID_CONFIRM:
 410	  ThotCallback (BaseCSS + CSSForm, INTEGER_DATA, (char*) 1);
 411	  EndDialog (hwnDlg, ID_CONFIRM);
 412	  break;
 413
 414	case IDCANCEL:
 415	case ID_DONE:
 416	  ThotCallback (BaseCSS + CSSForm, INTEGER_DATA, (char*) 0);
 417	  EndDialog (hwnDlg, ID_DONE);
 418	  break;
 419	}
 420      break;
 421    default:
 422      return FALSE;
 423    }
 424  return TRUE;
 425}
 426
 427/*-----------------------------------------------------------------------
 428 TextDlgProc
 429 ------------------------------------------------------------------------*/
 430LRESULT CALLBACK TextDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 431							  LPARAM lParam)
 432{
 433  switch (msg)
 434    {
 435    case WM_INITDIALOG:
 436      if (isHref)
 437	{
 438	  SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_ATTRIBUTE));
 439	  SetWindowText (GetDlgItem (hwnDlg, IDC_URL_TEXT),
 440		  TtaGetMessage (AMAYA, AM_HREF_VALUE));
 441	}
 442      else
 443	{
 444	  SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_CHANGE_TITLE));
 445	  SetWindowText (GetDlgItem (hwnDlg, IDC_URL_TEXT),
 446		  TtaGetMessage (AMAYA, AM_TITLE));
 447	}
 448      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM), 
 449		  TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
 450      SetWindowText (GetDlgItem (hwnDlg, ID_DONE), TtaGetMessage (LIB, TMSG_CANCEL));
 451      SetDlgItemText (hwnDlg, IDC_URLEDIT, UrlToOpen);      
 452      SetFocus (GetDlgItem (hwnDlg, IDC_URLEDIT));
 453      break;
 454      
 455    case WM_CLOSE:
 456    case WM_DESTROY:
 457      EndDialog (hwnDlg, ID_DONE);
 458      break;
 459      
 460    case WM_COMMAND:
 461      switch (LOWORD (wParam))
 462	{
 463	case ID_CONFIRM:
 464	  GetDlgItemText (hwnDlg, IDC_URLEDIT, UrlToOpen, sizeof (UrlToOpen) - 1);
 465	  if (isHref)
 466	    {
 467	      AttrHREFvalue = TtaGetMemory (strlen (UrlToOpen) + 1);
 468	      strcpy (AttrHREFvalue, UrlToOpen);
 469	      ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 1);
 470	    }
 471	  else
 472	    {
 473	      ThotCallback (BaseDialog + TitleText, STRING_DATA, UrlToOpen);
 474	      ThotCallback (BaseDialog + TitleForm, INTEGER_DATA, (char*) 1);
 475	    }
 476	  EndDialog (hwnDlg, ID_CONFIRM);
 477	  break;
 478      
 479	case ID_DONE:
 480	  if (isHref)
 481	    ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 0);
 482	  else
 483	    ThotCallback (BaseDialog + TitleForm, INTEGER_DATA, (char*) 0);
 484	  EndDialog (hwnDlg, ID_DONE);
 485	  break;
 486	}
 487      break;
 488      
 489    default:
 490      break;
 491    }
 492  return FALSE;
 493}
 494
 495/*-----------------------------------------------------------------------
 496 HRefDlgProc
 497 ------------------------------------------------------------------------*/
 498LRESULT CALLBACK HRefDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 499							  LPARAM lParam)
 500{
 501  switch (msg)
 502    {
 503    case WM_INITDIALOG:
 504      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_ATTRIBUTE));
 505      SetWindowText (GetDlgItem (hwnDlg, IDC_URLMESSAGE),
 506		  TtaGetMessage (AMAYA, AM_LOCATION));
 507      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
 508		  TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
 509      SetWindowText (GetDlgItem (hwnDlg, IDC_BROWSE), TtaGetMessage (AMAYA, AM_BROWSE));
 510      SetWindowText (GetDlgItem (hwnDlg, IDC_CLICK), TtaGetMessage (AMAYA, AM_CLICK));
 511      SetWindowText (GetDlgItem (hwnDlg, IDC_CLEAR), TtaGetMessage (AMAYA, AM_CLEAR));
 512      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
 513      
 514	  if (TmpDocName[0] != EOS)
 515		  SetDlgItemText (hwnDlg, IDC_GETURL, TmpDocName);
 516	  else
 517		  SetDlgItemText (hwnDlg, IDC_GETURL, "");
 518      HrefUrl[0] = 0;
 519
 520	  /* set the default focus and return FALSE to validate it */
 521	  SetFocus (GetDlgItem (hwnDlg, IDC_GETURL));
 522	  return FALSE;
 523
 524      break;
 525      
 526    case WM_COMMAND:
 527      if (HIWORD (wParam) == EN_UPDATE)
 528	{
 529	  if (LOWORD (wParam) == IDC_GETURL)
 530	    {
 531	      GetDlgItemText (hwnDlg, IDC_GETURL, HrefUrl, sizeof (HrefUrl) - 1);
 532	      if (HrefUrl[0] != 0)
 533		ThotCallback (BaseDialog + AttrHREFText, STRING_DATA, HrefUrl);
 534	    }
 535	}
 536      
 537      switch (LOWORD (wParam))
 538	{
 539	case ID_CONFIRM:
 540	  ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*)1);
 541	  EndDialog (hwnDlg, ID_CONFIRM);
 542	  break;
 543	case IDC_BROWSE:
 544	  OpenFileName.lStructSize       = sizeof (OPENFILENAME);
 545	  OpenFileName.hwndOwner         = hwnDlg;
 546	  OpenFileName.hInstance         = hInstance;
 547	  OpenFileName.lpstrFilter       = (LPTSTR) SzFilter;
 548	  OpenFileName.lpstrCustomFilter = (LPTSTR) NULL;
 549	  OpenFileName.nMaxCustFilter    = 0L;
 550	  OpenFileName.nFilterIndex      = indexLinkFilter;
 551	  OpenFileName.lpstrFile         = (LPTSTR) TmpDocName;
 552	  OpenFileName.nMaxFile          = MAX_LENGTH;
 553	  OpenFileName.lpstrInitialDir   = (LPTSTR) DirectoryName;
 554	  OpenFileName.lpstrTitle        = TtaGetMessage (AMAYA, AM_BROWSE);
 555	  OpenFileName.nFileOffset       = 0;
 556	  OpenFileName.nFileExtension    = 0;
 557	  OpenFileName.lpstrDefExt       = "html";
 558	  OpenFileName.lCustData         = 0;
 559	  OpenFileName.Flags             = OFN_SHOWHELP | OFN_HIDEREADONLY;
 560	  
 561	  if (GetOpenFileName (&OpenFileName))
 562	  {
 563	    strcpy (HrefUrl, OpenFileName.lpstrFile);
 564		indexLinkFilter = OpenFileName.nFilterIndex;
 565	  }
 566	  
 567	  SetDlgItemText (hwnDlg, IDC_GETURL, HrefUrl);
 568	  if (HrefUrl[0] != EOS)
 569	    {
 570	      ThotCallback (BaseDialog + AttrHREFText, STRING_DATA, HrefUrl);
 571	      EndDialog (hwnDlg, ID_CONFIRM);
 572	      ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 1);
 573	    }
 574	  break;
 575	  
 576	case IDC_CLICK:
 577	  EndDialog (hwnDlg, IDCANCEL);
 578	  ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 3);
 579	  break;
 580	  
 581	case IDC_CLEAR:
 582	  ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 4);
 583	  TmpDocName[0] = EOS;
 584	  SetDlgItemText (hwnDlg, IDC_GETURL, "");
 585	  break;
 586	  
 587	case IDCANCEL:
 588	  ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 0);
 589	  HrefUrl[0] = EOS;
 590	  EndDialog (hwnDlg, IDCANCEL);
 591	  break;      
 592	}
 593      break;
 594    default:
 595      return FALSE;
 596    } 
 597  return TRUE;
 598}
 599		
 600/*-----------------------------------------------------------------------
 601 HelpDlgProc
 602 ------------------------------------------------------------------------*/
 603LRESULT CALLBACK HelpDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 604							  LPARAM lParam)
 605{
 606  switch (msg)
 607    {
 608    case WM_INITDIALOG:
 609      SetWindowText (GetDlgItem (hwnDlg, IDC_VERSION), CurrentPathName);
 610      SetWindowText (GetDlgItem (hwnDlg, IDC_ABOUT1), Message);
 611      SetWindowText (GetDlgItem (hwnDlg, IDC_ABOUT2), Message2);
 612      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
 613		  TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
 614      break;
 615
 616    case WM_CLOSE:
 617    case WM_DESTROY:
 618      EndDialog (hwnDlg, ID_CONFIRM);
 619      break;
 620      
 621    case WM_COMMAND:
 622      switch (LOWORD (wParam))
 623	{
 624	case ID_CONFIRM:
 625	  EndDialog (hwnDlg, ID_CONFIRM);
 626	  break;
 627	}
 628      break;
 629
 630    default:
 631      return (FALSE);
 632    }
 633  return TRUE;
 634}
 635	
 636/*-----------------------------------------------------------------------
 637 MathDlgProc
 638 ------------------------------------------------------------------------*/
 639LRESULT CALLBACK MathDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 640							  LPARAM lParam)
 641{
 642  switch (msg)
 643    {
 644    case WM_INITDIALOG:
 645      MathPal = hwnDlg;
 646      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_BUTTON_MATH));
 647      SetWindowText (GetDlgItem (hwnDlg, ID_DONE), TtaGetMessage (LIB, TMSG_DONE));
 648      break;
 649
 650    case WM_CLOSE:
 651    case WM_DESTROY:
 652      MathPal = NULL;
 653      EndDialog (hwnDlg, ID_DONE);
 654      break;
 655
 656    case WM_COMMAND:
 657      switch (LOWORD (wParam))
 658	{
 659	case ID_DONE:
 660	  MathPal = NULL;
 661	  EndDialog (hwnDlg, ID_DONE);
 662	  break;
 663	case IDC_MATH:
 664	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)0);
 665	  break;
 666	case IDC_ROOT:
 667	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)1);
 668	  break;
 669	case IDC_SROOT:
 670	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)2);
 671	  break;
 672	case IDC_DIV:
 673	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)3);
 674	  break;
 675	case IDC_POWIND:
 676	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)4);
 677	  break;
 678	case IDC_IND:
 679	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)5);
 680	  break;
 681	case IDC_POW:
 682	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)6);
 683	  break;
 684	case IDC_UPDN:
 685	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)7);
 686	  break;
 687	case IDC_DOWN:
 688	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)8);
 689	  break;
 690	case IDC_UP:
 691	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)9);
 692	  break;
 693	case IDC_PAREXP:
 694	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)10);
 695	  break;
 696	case IDC_UDLR:
 697	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)11);
 698	  break;
 699	case IDC_MATRIX:
 700	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)12);
 701	  break;
 702	case IDC_SYM:
 703	  ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)13);
 704	  break;
 705	}
 706      SetFocus (FrRef[ActiveFrame]);
 707      break;
 708      
 709    default:
 710      return (FALSE);
 711    }
 712  return TRUE;
 713}
 714	
 715/*-----------------------------------------------------------------------
 716 PrintDlgProc
 717 ------------------------------------------------------------------------*/
 718LRESULT CALLBACK PrintDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 719			       LPARAM lParam)
 720{
 721  int      orientation, paper;
 722
 723  switch (msg)
 724    {
 725    case WM_INITDIALOG:
 726	  PrintForm = hwnDlg;
 727      SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_LIB_PRINT));
 728      SetWindowText (GetDlgItem (hwnDlg, ID_PRINT),
 729		     TtaGetMessage (LIB, TMSG_BUTTON_PRINT));
 730      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL),
 731		     TtaGetMessage (LIB, TMSG_CANCEL));
 732      SetWindowText (GetDlgItem (hwnDlg, IDC_OPTIONS),
 733		     TtaGetMessage (LIB, TMSG_OPTIONS));
 734      SetWindowText (GetDlgItem (hwnDlg, IDC_TABOFCONTENTS),
 735		     TtaGetMessage (AMAYA, AM_PRINT_TOC));
 736      SetWindowText (GetDlgItem (hwnDlg, IDC_LINKS),
 737		     TtaGetMessage (AMAYA, AM_NUMBERED_LINKS));
 738      SetWindowText (GetDlgItem (hwnDlg, IDC_PRINTURL),
 739		     TtaGetMessage (AMAYA, AM_PRINT_URL));
 740      SetWindowText (GetDlgItem (hwnDlg, IDC_IGNORE_CSS),
 741		     TtaGetMessage (AMAYA, AM_WITH_CSS));
 742      CheckDlgButton (hwnDlg, IDC_PRINTURL, PrintURL);
 743      CheckDlgButton (hwnDlg, IDC_IGNORE_CSS, IgnoreCSS);
 744      CheckDlgButton (hwnDlg, IDC_TABOFCONTENTS, WithToC);
 745      CheckDlgButton (hwnDlg, IDC_LINKS, NumberLinks);
 746      break;
 747    
 748    case WM_COMMAND:
 749      switch (LOWORD (wParam))
 750	{
 751	case IDC_TABOFCONTENTS:
 752	  ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 1);
 753	  break;
 754	case IDC_LINKS:
 755	  ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 2);
 756	  break;
 757	case IDC_PRINTURL:
 758	  ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 3);
 759	  break;
 760	case IDC_IGNORE_CSS:
 761	  ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 4);
 762	  break;
 763	case ID_PRINT:
 764	  ThotCallback (BasePrint + PrintSupport, INTEGER_DATA, (char*) 0);
 765	  PrintForm = NULL;
 766	  EndDialog (hwnDlg, ID_PRINT);
 767	  if (TtaGetPrinterDC (FALSE, &orientation, &paper))
 768	    {
 769	      EnableWindow (ghwndMain, FALSE);
 770	      ThotCallback (BasePrint + PaperOrientation, INTEGER_DATA, (char*) orientation);
 771	      ThotCallback (BasePrint + PaperFormat, INTEGER_DATA, (char*) paper);
 772	      ThotCallback (BasePrint + PPrinterName, STRING_DATA,
 773			    CurFileToPrint);
 774	      ThotCallback (BasePrint + FormPrint, INTEGER_DATA, (char*)1);
 775	    }
 776	  break;
 777	case IDCANCEL:
 778	  ThotCallback (BasePrint + FormPrint, INTEGER_DATA, (char*)0);
 779	  PrintForm = NULL;
 780	  EndDialog (hwnDlg, IDCANCEL);
 781	  break;
 782	}
 783      break;
 784    default:
 785      return FALSE;
 786    } 
 787  return TRUE;
 788}
 789
 790/*-----------------------------------------------------------------------
 791 TableDlgProc
 792 ------------------------------------------------------------------------*/
 793LRESULT CALLBACK TableDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
 794			       LPARAM lParam)
 795{
 796  ThotBool ok;
 797  int      val;
 798
 799  switch (msg)
 800  {
 801    case WM_INITDIALOG:
 802      SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_BUTTON_TABLE));
 803      SetWindowText (GetDlgItem (hwnDlg, IDC_NUMCOL),
 804		     TtaGetMessage (AMAYA, AM_COLS));
 805      SetWindowText (GetDlgItem (hwnDlg, IDC_NUMROWS),
 806		     TtaGetMessage (AMAYA, AM_ROWS));
 807      if (WithBorder)
 808	SetWindowText (GetDlgItem (hwnDlg, IDC_BORDER),
 809		       TtaGetMessage (AMAYA, AM_BORDER));
 810      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
 811		     TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
 812      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL),
 813		     TtaGetMessage (LIB, TMSG_CANCEL));
 814	
 815      SetDlgItemInt (hwnDlg, IDC_NUMCOLEDIT, numCols, FALSE);
 816      SetDlgItemInt (hwnDlg, IDC_NUMROWSEDIT, numRows, FALSE);
 817      if (WithBorder)
 818	SetDlgItemInt (hwnDlg, IDC_BORDEREDIT, tBorder, FALSE);
 819      break;
 820
 821
 822    case WM_COMMAND:
 823      if (HIWORD (wParam) == EN_UPDATE)
 824	{
 825	  if (LOWORD (wParam) == IDC_NUMCOLEDIT)
 826	    {
 827	      val = GetDlgItemInt (hwnDlg, IDC_NUMCOLEDIT, &ok, TRUE);
 828	      if (ok)
 829		ThotCallback (BaseDialog + TableCols, INTEGER_DATA, (char*) val);
 830	    }
 831	  else if (LOWORD (wParam) == IDC_NUMROWSEDIT)
 832	    {
 833	      val = GetDlgItemInt (hwnDlg, IDC_NUMROWSEDIT, &ok, TRUE);
 834	      if (ok)
 835		ThotCallback (BaseDialog + TableRows, INTEGER_DATA, (char*) val);
 836	    }
 837	  else if (LOWORD (wParam) == IDC_BORDEREDIT)
 838	    {
 839	      val = GetDlgItemInt (hwnDlg, IDC_BORDEREDIT, &ok, TRUE);
 840	      if (ok)
 841		ThotCallback (BaseDialog + TableBorder, INTEGER_DATA, (char*) val);
 842	    }
 843	}
 844      
 845      switch (LOWORD (wParam))
 846	{
 847	case ID_CONFIRM:
 848	  UserAnswer = 1;
 849	  ThotCallback (BaseDialog + TableForm, INTEGER_DATA, (char*) 1);
 850	  EndDialog (hwnDlg, ID_CONFIRM);
 851	  break;
 852	case IDCANCEL:
 853	  UserAnswer = 0;
 854	  ThotCallback (BaseDialog + TableForm, INTEGER_DATA, (char*) 0);
 855      EndDialog (hwnDlg, IDCANCEL);
 856	  break;
 857	}
 858      break;
 859    default:
 860      return FALSE;
 861    }
 862  return TRUE;
 863}
 864
 865/*-----------------------------------------------------------------------
 866  AttrItemsDlgProc
 867 ------------------------------------------------------------------------*/
 868LRESULT CALLBACK AttrItemsDlgProc (ThotWindow hwnDlg, UINT msg,
 869				   WPARAM wParam, LPARAM lParam)
 870{
 871  int        ndx = 0;
 872  int        i   = 0;
 873  int        cxChar;
 874  int        cyChar;
 875  HDC        hDC;
 876  RECT       rect;
 877  ThotWindow radio1;
 878  ThotWindow radio2;
 879  ThotWindow radio3;
 880  ThotWindow radio4;
 881  ThotWindow radio5;
 882  ThotWindow radio6;
 883  ThotWindow radio7;
 884  ThotWindow radio8;
 885  ThotWindow radio9;
 886  ThotWindow groupBx;
 887  TEXTMETRIC tm;
 888
 889  switch (msg)
 890    {
 891    case WM_INITDIALOG:
 892      /* store the window ID to be able to destroy it from elsewhere */
 893      AttrForm = hwnDlg;
 894      GetClientRect (hwnDlg, &rect);
 895      hDC = GetDC (hwnDlg);
 896      SelectObject (hDC, DialogFont);
 897      GetTextMetrics (hDC, &tm);
 898      cxChar = tm.tmAveCharWidth;
 899      cyChar = tm.tmHeight + tm.tmExternalLeading;
 900      ReleaseDC (hwnDlg, hDC);
 901      
 902      SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_ATTR));
 903      SetWindowText (GetDlgItem (hwnDlg, ID_APPLY),
 904		     TtaGetMessage (LIB, TMSG_APPLY));
 905      if (RequiredAttr)
 906	DestroyWindow (GetDlgItem (hwnDlg, ID_DELETE));
 907      else
 908        SetWindowText (GetDlgItem (hwnDlg, ID_DELETE),
 909		       TtaGetMessage (LIB, TMSG_DEL_ATTR));
 910      SetWindowText (GetDlgItem (hwnDlg, ID_DONE),
 911		     TtaGetMessage (LIB, TMSG_DONE));
 912      radio1 = CreateWindow ("BUTTON", &ItemList[ndx],
 913			     WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 914			     cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 915			     (HMENU) OPT1, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 916      /* set the font of the window */
 917      WIN_SetDialogfont (radio1);
 918      ndx += strlen (&ItemList[ndx]) + 1;
 919      i++;
 920      radio2 = CreateWindow ("BUTTON", &ItemList[ndx],
 921			     WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 922			     cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 923			     (HMENU) OPT2, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 924      /* set the font of the window */
 925      WIN_SetDialogfont (radio2);
 926      ndx += strlen (&ItemList[ndx]) + 1;
 927      i++;
 928      if (attDlgNbItems > 2)
 929	{
 930	  radio3 = CreateWindow ("BUTTON", &ItemList[ndx],
 931				 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 932				 cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 933				 (HMENU) OPT3, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 934	  /* set the font of the window */
 935	  WIN_SetDialogfont (radio3);
 936	  ndx += strlen (&ItemList[ndx]) + 1;
 937	  i++;
 938	  if (attDlgNbItems > 3)
 939	    {	  
 940	      radio4 = CreateWindow ("BUTTON", &ItemList[ndx],
 941				     WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 942				     cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 943				     (HMENU) OPT4, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 944	      /* set the font of the window */
 945	      WIN_SetDialogfont (radio4);
 946	      ndx += strlen (&ItemList[ndx]) + 1;
 947	      i++;
 948	      if (attDlgNbItems > 4)
 949		{
 950		  radio5 = CreateWindow ("BUTTON", &ItemList[ndx],
 951					 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 952					 cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 953					 (HMENU) OPT5, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 954		  /* set the font of the window */
 955		  WIN_SetDialogfont (radio5);
 956		  ndx += strlen (&ItemList[ndx]) + 1;
 957		  i++;
 958		  if (attDlgNbItems > 5)
 959		    {
 960		      radio6 = CreateWindow ("BUTTON", &ItemList[ndx],
 961					     WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 962					     cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 963					     (HMENU) OPT6, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 964		      /* set the font of the window */
 965		      WIN_SetDialogfont (radio6);
 966		      ndx += strlen (&ItemList[ndx]) + 1;
 967		      i++;
 968		      if (attDlgNbItems > 6)
 969			{	  
 970			  radio7 = CreateWindow ("BUTTON", &ItemList[ndx],
 971						 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 972						 cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 973						 (HMENU) OPT7, (HINSTANCE) GetWindowLong (hwnDlg,
 974											  GWL_HINSTANCE), NULL);
 975			  /* set the font of the window */
 976			  WIN_SetDialogfont (radio7);
 977			  ndx += strlen (&ItemList[ndx]) + 1;
 978			  i++;
 979			  if (attDlgNbItems > 7)
 980			    {
 981			      radio8 = CreateWindow ("BUTTON", &ItemList[ndx],
 982						     WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 983						     cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 984						     (HMENU) OPT8, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 985			      /* set the font of the window */
 986			      WIN_SetDialogfont (radio8);
 987			      ndx += strlen (&ItemList[ndx]) + 1;
 988			      i++;
 989			      if (attDlgNbItems > 8)
 990				{
 991				  radio9 = CreateWindow ("BUTTON", &ItemList[ndx],
 992							 WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
 993							 cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
 994							 (HMENU) OPT9, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
 995				  /* set the font of the window */
 996				  WIN_SetDialogfont (radio9);
 997				  ndx += strlen (&ItemList[ndx]) + 1;
 998				  i++;
 999				}
1000			    }
1001			}
1002		    }
1003		}
1004	    }
1005	}
1006      groupBx = CreateWindow ("BUTTON", AttDlgTitle,
1007			      WS_CHILD | WS_VISIBLE | BS_GROUPBOX, cxChar, 0,
1008			      rect.right - (2 * cxChar), i * (2 * cyChar) + cyChar, hwnDlg,
1009			      (HMENU) 1, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
1010      /* set the font of the window */
1011      WIN_SetDialogfont (groupBx);
1012      switch (currAttrVal)
1013	{
1014	case 1: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT1);
1015	  break;
1016	case 2: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT2);
1017	  break;
1018	case 3: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT3);
1019	  break;
1020	case 4: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT4);
1021	  break;
1022	case 5: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT5);
1023	  break;
1024	case 6: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT6);
1025	  break;
1026	case 7: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT7);
1027	  break;
1028	case 8: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT8);
1029	  break;
1030	case 9: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT9);
1031	  break;	  
1032	default:
1033	  break;
1034	}
1035      break;
1036	      
1037    case WM_CLOSE:
1038    case WM_DESTROY:
1039      AttrForm = NULL;
1040      if (RequiredAttr)
1041	  ThotCallback (NumMenuAttrRequired, INTEGER_DATA, (char*) 0);
1042     else
1043	ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 0);
1044      EndDialog (hwnDlg, IDCANCEL);
1045      break;
1046
1047    case WM_COMMAND:
1048      if (RequiredAttr)
1049	i = NumMenuAttrEnumNeeded;
1050      else
1051	i = NumMenuAttrEnum;
1052      switch (LOWORD (wParam))
1053	{
1054	case OPT1:
1055	  iLocation = 0;
1056	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1057	  break;
1058	case OPT2:
1059	  iLocation = 1;
1060	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1061	  break;
1062	case OPT3:
1063	  iLocation = 2;
1064	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1065	  break;
1066	case OPT4:
1067	  iLocation = 3;
1068	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1069	  break;
1070	case OPT5:
1071	  iLocation = 4;
1072	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1073	  break;
1074	case OPT6:
1075	  iLocation = 5;
1076	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1077	  break;
1078	case OPT7:
1079	  iLocation = 6;
1080	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1081	  break;
1082	case OPT8:
1083	  iLocation = 7;
1084	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1085	  break;
1086	case OPT9:
1087	  iLocation = 8;
1088	  ThotCallback (i, INTEGER_DATA, (char*) iLocation);
1089	  break;
1090	case ID_APPLY:
1091	  if (RequiredAttr)
1092	  {
1093	    ThotCallback (NumMenuAttrRequired, INTEGER_DATA, (char*) 1);
1094        EndDialog (hwnDlg, IDCANCEL);
1095	  }
1096	  else
1097	    ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 1);
1098	  break;
1099	case ID_DELETE:
1100	  ThotCallback (NumMenuAttrEnum, INTEGER_DATA, (char*) -1);
1101	  ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 2);
1102	  AttrForm = NULL;
1103	  break;
1104      
1105	case ID_DONE:
1106	  AttrForm = NULL;
1107	  if (RequiredAttr)
1108	      ThotCallback (NumMenuAttrRequired, INTEGER_DATA, (char*) 0);
1109	  else
1110	    ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 0);
1111      EndDialog (hwnDlg, IDCANCEL);
1112      break;
1113	}
1114      break;
1115    default:
1116      return FALSE;
1117    }
1118  return TRUE;
1119}
1120
1121/*-----------------------------------------------------------------------
1122 CharsetDlgProc
1123 ------------------------------------------------------------------------*/
1124LRESULT CALLBACK CharsetDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
1125					 		     LPARAM lParam)
1126{
1127  int             index = 0;
1128  UINT            i = 0; 
1129  static ThotWindow   wndMTlist;
1130  
1131  switch (msg)
1132    {
1133    case WM_INITDIALOG:
1134      /* get the default GUI font */
1135      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_SELECT_CHARSET));
1136      SetWindowText (GetDlgItem (hwnDlg, ID_APPLY), TtaGetMessage (LIB, TMSG_APPLY));
1137      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
1138	  if (!strcmp (UserCharset, "us-ascii"))
1139        CheckRadioButton (hwnDlg, IDC_USASCII, IDC_ISOL1, IDC_USASCII);
1140	  if (!strcmp (UserCharset, "iso-8859-1"))
1141        CheckRadioButton (hwnDlg, IDC_USASCII, IDC_ISOL1, IDC_ISOL1);
1142	  else
1143        CheckRadioButton (hwnDlg, IDC_USASCII, IDC_ISOL1, IDC_UTF8);
1144      SetFocus (GetDlgItem (hwnDlg, IDC_USASCII));
1145      return FALSE;
1146      break;
1147      
1148    case WM_CLOSE:
1149    case WM_DESTROY:
1150      EndDialog (hwnDlg, ID_DONE);
1151      break;
1152      
1153    case WM_COMMAND:      
1154      switch (LOWORD (wParam))
1155	{		  
1156	case IDC_USASCII:
1157	  strcpy (SaveFormTmp, "us-ascii");
1158	  break;
1159	case IDC_UTF8:
1160	  strcpy (SaveFormTmp, "UTF-8");
1161	  break;
1162	case IDC_ISOL1:
1163	  strcpy (SaveFormTmp, "iso-8859-1");
1164	  break;
1165
1166	case ID_APPLY:
1167	  EndDialog (hwnDlg, ID_DONE);
1168	  break;
1169	  
1170	case IDCANCEL:
1171	case WM_CLOSE:
1172	  SaveFormTmp[0] = EOS;
1173	  EndDialog (hwnDlg, ID_DONE);
1174	  break;
1175	}
1176      break;
1177    default: return FALSE;
1178    }
1179  return TRUE;
1180}
1181
1182/*-----------------------------------------------------------------------
1183 MimeTypeDlgStatus
1184 Updates the status bar of the MimeType dialog
1185 ------------------------------------------------------------------------*/
1186void MimeTypeDlgStatus (char *msg)
1187{
1188  if (MimeTypeDlg && msg)
1189    SetWindowText (GetDlgItem (MimeTypeDlg, IDC_STATUS), msg);
1190}
1191
1192/*-----------------------------------------------------------------------
1193 MimeTypeDlgProc
1194 ------------------------------------------------------------------------*/
1195LRESULT CALLBACK MimeTypeDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
1196				  LPARAM lParam)
1197{
1198  int             index = 0;
1199  UINT            i = 0; 
1200  static ThotWindow   wndMTlist;
1201
1202  switch (msg)
1203    {
1204    case WM_INITDIALOG:
1205      /* get the default GUI font */
1206      MimeTypeDlg = hwnDlg;
1207      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_SELECT_MIMETYPE));
1208      SetWindowText (GetDlgItem (hwnDlg, ID_APPLY), TtaGetMessage (LIB, TMSG_APPLY));
1209      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
1210      
1211      wndMTlist = CreateWindow ("listbox", NULL,
1212				WS_CHILD | WS_VISIBLE | LBS_STANDARD | WS_VSCROLL | WS_TABSTOP,
1213				5, 5, 310, 100, hwnDlg, (HMENU) 1, 
1214				(HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
1215      /* set the font of the window */
1216      WIN_SetDialogfont (wndMTlist);
1217      SendMessage (wndMTlist, LB_RESETCONTENT, 0, 0);
1218      while (i < NbItem && mimeType[index] != '\0')
1219	{
1220	  SendMessage (wndMTlist, LB_INSERTSTRING, i, (LPARAM) &mimeType[index]); 
1221	  index += strlen (&mimeType[index]) + 1;/* Longueur de l'intitule */
1222	  i++;
1223	}
1224      /* select the first list item */
1225      /* SendMessage (wndMTlist, LB_SETCURSEL, 0, 0); */
1226      /* put the focus on the first list item */
1227	  SetDlgItemText (hwnDlg, IDC_MTEDIT, UserMimeType);
1228      SetFocus (GetDlgItem (hwnDlg, IDC_MTEDIT));
1229      return FALSE;
1230      break;
1231      
1232    case WM_CLOSE:
1233    case WM_DESTROY:
1234      /* ThotCallback (BaseDialog + MimeTypeForm, INTEGER_DATA, (char *) 0); */
1235      MimeTypeDlg = NULL;
1236      EndDialog (hwnDlg, ID_DONE);
1237      break;
1238      
1239    case WM_COMMAND:
1240      if (LOWORD (wParam) == 1)
1241	{
1242	  if (HIWORD (wParam) == LBN_SELCHANGE)
1243	    {
1244	      itemIndex = SendMessage (wndMTlist, LB_GETCURSEL, 0, 0);
1245	      itemIndex = SendMessage (wndMTlist, LB_GETTEXT, itemIndex,
1246				       (LPARAM) SzBuffer);
1247	    }
1248	  else if (HIWORD (wParam) == LBN_DBLCLK)
1249	    {
1250	      if (LB_ERR == (itemIndex = SendMessage (wndMTlist, LB_GETCURSEL, 0, 0L)))
1251		break;
1252	      itemIndex = SendMessage (wndMTlist, LB_GETTEXT, itemIndex,
1253				       (LPARAM) SzBuffer);
1254	    }
1255	  SetDlgItemText (hwnDlg, IDC_MTEDIT, SzBuffer);
1256	  if (HIWORD (wParam) == LBN_DBLCLK)
1257	    {
1258	      GetDlgItemText (hwnDlg, IDC_MTEDIT, SaveFormTmp, sizeof (SaveFormTmp) - 1);
1259	      if (SaveFormTmp[0] != EOS)
1260		{
1261		  MimeTypeDlg = NULL;
1262		  EndDialog (hwnDlg, ID_DONE);
1263		}
1264	      break;
1265	    }
1266	}
1267      
1268      switch (LOWORD (wParam))
1269	{	  	  
1270	case ID_APPLY:
1271	  GetDlgItemText (hwnDlg, IDC_MTEDIT, SaveFormTmp, sizeof (SaveFormTmp) - 1);
1272   	  ThotCallback (BaseDialog + MimeTypeForm, INTEGER_DATA, (char *) 1);
1273	  if (SaveFormTmp[0] != EOS)
1274	    {
1275	      MimeTypeDlg = NULL;
1276	      EndDialog (hwnDlg, ID_DONE);
1277	    }
1278	  break;
1279	  
1280	case IDCANCEL:
1281	case WM_CLOSE:
1282 	  ThotCallback (BaseDialog + MimeTypeForm, INTEGER_DATA, (char *) 0);
1283 	  MimeTypeDlg = NULL;
1284	  EndDialog (hwnDlg, ID_DONE);
1285	  break;
1286	}
1287      break;
1288    default: return FALSE;
1289    }
1290  return TRUE;
1291}
1292
1293/*-----------------------------------------------------------------------
1294 SaveAsDlgStatus
1295 Updates the status bar of the SaveAs dialog
1296 ------------------------------------------------------------------------*/
1297void SaveAsDlgStatus (char *msg)
1298{
1299  if (SaveAsForm && msg)
1300    SetWindowText (GetDlgItem (SaveAsForm, IDC_STATUS), msg);
1301}
1302
1303
1304/*----------------------------------------------------------------------
1305  WIN_ListSaveDirectory
1306  ----------------------------------------------------------------------*/
1307void WIN_ListSaveDirectory (ThotWindow hwnDlg, char *title, char *fileName)
1308{
1309  char               *szFilter;
1310  char                szFileTitle[256];
1311
1312  szFilter = APPFILENAMEFILTER;
1313  TtaExtractName (fileName, SavePath, DocumentName);
1314  OpenFileName.lStructSize = sizeof (OPENFILENAME); 
1315  OpenFileName.hwndOwner = hwnDlg; 
1316  OpenFileName.lpstrFilter = szFilter;
1317  OpenFileName.lpstrFile = DocumentName; 
1318  OpenFileName.nMaxFile = MAX_LENGTH; 
1319  OpenFileName.lpstrFileTitle = szFileTitle; 
1320  OpenFileName.lpstrTitle = title; 
1321  OpenFileName.nMaxFileTitle = sizeof (szFileTitle); 
1322  OpenFileName.lpstrInitialDir = SavePath; 
1323  OpenFileName.Flags = OFN_SHOWHELP | OFN_HIDEREADONLY;
1324  if (GetSaveFileName (&OpenFileName))
1325    strcpy (fileName, OpenFileName.lpstrFile);
1326}
1327
1328/*-----------------------------------------------------------------------
1329 SaveAsDlgProc
1330 ------------------------------------------------------------------------*/
1331LRESULT CALLBACK SaveAsDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
1332				LPARAM lParam)
1333{
1334  char buff[500];
1335
1336  switch (msg)
1337    {
1338    case WM_INITDIALOG:
1339      SaveAsForm = hwnDlg;
1340      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_SAVE_AS));
1341      SetWindowText (GetDlgItem (hwnDlg, IDC_DOCLOCATION), 
1342		     TtaGetMessage (AMAYA, AM_DOC_LOCATION));
1343      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
1344		     TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
1345      SetWindowText (GetDlgItem (hwnDlg, ID_CLEAR), TtaGetMessage (AMAYA, AM_CLEAR));
1346      SetWindowText (GetDlgItem (hwnDlg, IDC_BROWSE), TtaGetMessage (AMAYA, AM_BROWSE));
1347      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
1348      SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, CurrentPathName);
1349      
1350	  if (HTMLFormat ||
1351		  DocumentTypes[SavingDocument] == docMath ||
1352	      DocumentTypes[SavingDocument] == docSVG ||
1353          DocumentTypes[SavingDocument] == docXml)
1354	  {
1355	    SetWindowText (GetDlgItem (hwnDlg, IDC_COPYIMG),
1356			 TtaGetMessage (AMAYA, AM_BCOPY_IMAGES));
1357	    SetWindowText (GetDlgItem (hwnDlg, IDC_TRANSFORMURL),
1358			 TtaGetMessage (AMAYA, AM_BTRANSFORM_URL));
1359	    SetWindowText (GetDlgItem (hwnDlg, IDC_IMGLOCATION),
1360			 TtaGetMessage (AMAYA, AM_IMAGES_LOCATION));
1361	    copyImgWnd = GetDlgItem (hwnDlg, IDC_COPYIMG);
1362	    transURLWnd = GetDlgItem (hwnDlg, IDC_TRANSFORMURL);
1363	  }
1364
1365      if (HTMLFormat)
1366	  {
1367	    SetWindowText (GetDlgItem (hwnDlg, IDC_OUTPUTGROUP),
1368			 TtaGetMessage (LIB, TMSG_DOCUMENT_FORMAT));
1369	    SetWindowText (GetDlgItem (hwnDlg, IDC_HTML), "HTML");
1370	    SetWindowText (GetDlgItem (hwnDlg, IDC_XML), "XML");
1371	    SetWindowText (GetDlgItem (hwnDlg, IDC_TEXT),
1372			   TtaGetMessage (AMAYA, AM_TEXT));
1373	    if (SaveAsHTML)
1374		{
1375          CheckRadioButton (hwnDlg, IDC_HTML, IDC_XML, IDC_HTML);
1376	      EnableWindow (transURLWnd, TRUE);
1377	      EnableWindow (copyImgWnd, TRUE);
1378	    }
1379	    else if (SaveAsXML)
1380	    {
1381          CheckRadioButton (hwnDlg, IDC_HTML, IDC_XML, IDC_XML);
1382	      EnableWindow (transURLWnd, TRUE);
1383	      EnableWindow (copyImgWnd, TRUE);
1384	    }
1385	    else if (SaveAsText)
1386	    {
1387          CheckRadioButton (hwnDlg, IDC_HTML, IDC_XML, IDC_TEXT);
1388	      EnableWindow (transURLWnd, FALSE);
1389	      EnableWindow (copyImgWnd, FALSE);
1390	    }
1391	    if (!SaveAsText && CopyImages)
1392	      CheckRadioButton (hwnDlg, IDC_COPYIMG, IDC_COPYIMG, IDC_COPYIMG);
1393	  }
1394	  else if (DocumentTypes[SavingDocument] == docMath ||
1395               DocumentTypes[SavingDocument] == docXml)
1396	      EnableWindow (copyImgWnd, FALSE);
1397
1398	  if (UpdateURLs)
1399	      CheckRadioButton (hwnDlg, IDC_TRANSFORMURL, IDC_TRANSFORMURL, IDC_TRANSFORMURL);
1400
1401      /* mime type */
1402      _snprintf (buff, 500, "MIME type: %s", 
1403		 UserMimeType[0] != EOS ? UserMimeType : TtaGetMessage (AMAYA, AM_UNKNOWN));
1404      SetDlgItemText (hwnDlg, IDC_MIMETYPE, buff);
1405      SetDlgItemText (hwnDlg, ID_CHANGEMIMETYPE,  TtaGetMessage (AMAYA, AM_CHANGE));
1406      /* charset */
1407      _snprintf (buff, 500, "Charset: %s", 
1408		 UserCharset[0] != EOS ? UserCharset : TtaGetMessage (AMAYA, AM_UNKNOWN));
1409      SetDlgItemText (hwnDlg, IDC_CHARSET, buff);
1410      SetDlgItemText (hwnDlg, ID_CHANGECHARSET, TtaGetMessage (AMAYA, AM_CHANGE));
1411
1412      /* set the default focus and return FALSE to validate it */
1413      SetFocus (GetDlgItem (hwnDlg, IDC_EDITDOCSAVE));
1414      return FALSE;
1415      break;
1416    
1417    case WM_COMMAND:
1418      if (HIWORD (wParam) == EN_UPDATE)
1419	{
1420	  if (LOWORD (wParam) == IDC_EDITDOCSAVE)
1421	    {
1422	      GetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, UrlToOpen, sizeof (UrlToOpen) - 1);
1423	      ThotCallback (BaseDialog + NameSave, STRING_DATA, UrlToOpen);
1424	    }
1425	  else if (LOWORD (wParam) == IDC_EDITIMGSAVE)
1426	    {
1427	      GetDlgItemText (hwnDlg, IDC_EDITIMGSAVE, UrlToOpen, sizeof (UrlToOpen) - 1);
1428	      ThotCallback (BaseDialog + ImgDirSave, STRING_DATA, UrlToOpen);
1429	    }
1430	}
1431
1432      switch (LOWORD (wParam))
1433	{
1434	case IDC_HTML:
1435	  EnableWindow (transURLWnd, TRUE);
1436	  EnableWindow (copyImgWnd, TRUE);
1437	  ThotCallback (BaseDialog + RadioSave, INTEGER_DATA, (char*) 0);
1438	  SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, DocToOpen);
1439	  return 0;
1440	  
1441	case IDC_XML:
1442	  EnableWindow (transURLWnd, TRUE);
1443	  EnableWindow (copyImgWnd, TRUE);
1444	  ThotCallback (BaseDialog + RadioSave, INTEGER_DATA, (char*) 1);
1445	  SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, DocToOpen);
1446	  return 0;
1447	  
1448	case IDC_TEXT:
1449	  EnableWindow (transURLWnd, FALSE);
1450	  EnableWindow (copyImgWnd, FALSE);
1451	  
1452	  ThotCallback (BaseDialog + RadioSave, INTEGER_DATA, (char*) 2);
1453	  SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, DocToOpen);
1454	  return 0;
1455	  
1456	case IDC_COPYIMG:
1457	  ThotCallback (BaseDialog + ToggleSave, INTEGER_DATA, (char*) 0);
1458	  break;
1459	  
1460	case IDC_TRANSFORMURL:
1461	  ThotCallback (BaseDialog + ToggleSave, INTEGER_DATA, (char*) 1);
1462	  break;
1463
1464  	case ID_CHANGECHARSET:
1465	  ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 4);
1466	  if (SaveFormTmp[0] != EOS)
1467	  {
1468	    _snprintf (buff, 500, "Charset: %s", UserCharset);
1469	    SetDlgItemText (hwnDlg, IDC_CHARSET, buff);	
1470	  }
1471	  break;
1472
1473	case ID_CHANGEMIMETYPE:
1474	  ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 5);
1475	  if (SaveFormTmp[0] != EOS)
1476	  {
1477	    _snprintf (buff, 500, "MIME type: %s", UserMimeType);	  
1478	    SetDlgItemText (hwnDlg, IDC_MIMETYPE, buff);
1479	  }
1480	  break;
1481	  
1482	case ID_CLEAR:
1483	  SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, "");
1484	  SetDlgItemText (hwnDlg, IDC_EDITIMGSAVE, "");
1485	  ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 3);
1486	  break;
1487	  
1488	case IDC_BROWSE:
1489      /* by default keep the same document name */
1490	  WIN_ListSaveDirectory (hwnDlg, TtaGetMessage (AMAYA, AM_SAVE_AS), UrlToOpen);
1491	  SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, UrlToOpen);
1492	  ThotCallback (BaseDialog + NameSave, STRING_DATA, UrlToOpen);
1493	  break;
1494	  
1495	case IDCANCEL:
1496	  EndDialog (hwnDlg, IDCANCEL);
1497	  ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 0);
1498	  SaveAsForm = NULL;
1499	  break;
1500	  
1501	case ID_CONFIRM:
1502	  EndDialog (hwnDlg, ID_CONFIRM);
1503	  ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 1);
1504	  SaveAsForm = NULL;
1505	  break;
1506	}
1507      break;
1508      
1509    default:
1510      return FALSE;
1511    }
1512  return TRUE;
1513}
1514
1515/*-----------------------------------------------------------------------
1516 OpenDocDlgProc
1517 ------------------------------------------------------------------------*/
1518LRESULT CALLBACK OpenDocDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
1519								 LPARAM lParam)
1520{
1521  switch (msg)
1522    {
1523    case WM_INITDIALOG:
1524      SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_OPEN_URL));
1525      SetWindowText (GetDlgItem (hwnDlg, IDC_URLMESSAGE),
1526		     TtaGetMessage (AMAYA, AM_LOCATION));
1527      SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
1528		     TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
1529      SetWindowText (GetDlgItem (hwnDlg, IDC_BROWSE), TtaGetMessage (AMAYA, AM_BROWSE));
1530      SetWindowText (GetDlgItem (hwnDlg, IDC_CLEAR), TtaGetMessage (AMAYA, AM_CLEAR));
1531      SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
1532
1533      SetWindowText (hwnDlg, WndTitle);
1534      SetDlgItemText (hwnDlg, IDC_GETURL, UrlToOpen);
1535	  /* put the focus on the first dialog item */
1536	  SetFocus (GetDlgItem (hwnDlg, IDC_GETURL));
1537	  return FALSE;
1538      break;
1539
1540    case WM_COMMAND:
1541      if (HIWORD (wParam) == EN_UPDATE)
1542	{
1543	  if (LOWORD (wParam) == IDC_GETURL)
1544	    {
1545	      GetDlgItemText (hwnDlg, IDC_GETURL, UrlToOpen, sizeof (UrlToOpen) - 1);
1546	      if (UrlToOpen[0] != EOS)
1547		ThotCallback (BaseDialog + URLName, STRING_DATA, UrlToOpen);
1548	    }
1549	}
1550
1551    switch (LOWORD (wParam))
1552      {
1553      case ID_CONFIRM:
1554	ThotCallback (BaseDialog + OpenForm, INTEGER_DATA, (char*)1);
1555	EndDialog (hwnDlg, ID_CONFIRM);
1556	break;
1557
1558      case IDC_BROWSE:
1559	OpenFileName.lStructSize       = sizeof (OPENFILENAME);
1560	OpenFileName.hwndOwner         = hwnDlg;
1561	OpenFileName.hInstance         = hInstance;
1562	OpenFileName.lpstrFilter       = (LPTSTR) SzFilter;
1563	OpenFileName.lpstrCustomFilter = (LPTSTR) NULL;
1564	OpenFileName.nMaxCustFilter    = 0L;
1565	OpenFileName.nFilterIndex      = indexFilter;
1566	OpenFileName.lpstrFile         = (LPTSTR) TmpDocName;
1567	OpenFileName.nMaxFile          = MAX_LENGTH;
1568	OpenFileName.lpstrInitialDir   = (LPTSTR) DirectoryName;
1569	OpenFileName.lpstrTitle        = TtaGetMessage (AMAYA, AM_OPEN_URL);
1570	OpenFileName.nFileOffset       = 0;
1571	OpenFileName.nFileExtension    = 0;
1572	OpenFileName.lpstrDefExt       = "html";
1573	OpenFileName.lCustData         = 0;
1574	OpenFileName.Flags             = OFN_SHOWHELP | OFN_HIDEREADONLY;
1575	
1576	if (GetOpenFileName (&OpenFileName))
1577	{
1578	  strcpy (UrlToOpen, OpenFileName.lpstrFile);
1579      indexFilter = OpenFileName.nFilterIndex;
1580      strc

Large files files are truncated, but you can click here to view the full file