/amaya/windialogapi.c
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
- /*
- *
- * (c) COPYRIGHT INRIA, 1996-2005
- * Please first read the full copyright statement in file COPYRIGHT.
- *
- */
- /*
- * Windows Dialogue API routines for Amaya
- *
- * Authors: I. Vatton (W3C/INRIA),
- * R. Guetari (W3C/INRIA),
- * J. Kahan (W3C/INRIA)
- *
- */
- #ifdef _WINGUI
- #include <windows.h>
- #include "resource.h"
- #include "constmedia.h"
- #include "corrmsg.h"
- #define THOT_EXPORT extern
- #include "amaya.h"
- #include "constmenu.h"
- #include "wininclude.h"
- extern ThotWindow FrRef[MAX_FRAME + 2];
- extern int ActiveFrame;
- #ifndef MAX_PROPOSAL_CHKR
- #define MAX_PROPOSAL_CHKR 10
- #endif /* MAX_PROPOSAL_CHKR */
- #ifndef MAX_WORD_LEN
- #define MAX_WORD_LEN 30
- #endif /* MAX_WORD_LEN */
- #define MAX_BUFF 4096
- /* JK: I think that some of these widgets, which are general, should
- go into the thotlib, such as IDC_LANGEDIT. We have a dupblication of
- IDC refs between thotlib and Amaya */
- #define IDC_EDITRULE 20001
- #define IDC_LANGEDIT 20002
- #define IDC_CSSEDIT 20004
- #define OPT1 1110
- #define OPT2 1111
- #define OPT3 1112
- #define OPT4 1113
- #define OPT5 1114
- #define OPT6 1115
- #define OPT7 1116
- #define OPT8 1117
- #define OPT9 1118
- #define REPEAT_XY 0
- #define REPEAT_X 1
- #define REPEAT_Y 2
- #define NO_REPEAT 3
- int WIN_IndentValue;
- int WIN_OldLineSp;
- int WIN_NormalLineSpacing;
- extern HINSTANCE hInstance;
- extern HDC TtPrinterDC;
- extern char DocToOpen[MAX_LENGTH];
- extern ThotBool TtIsPrinterTrueColor;
- extern ThotBool bUserAbort;
- extern ThotBool WithToC;
- extern ThotBool NumberLinks;
- extern ThotBool PrintURL;
- extern ThotBool IgnoreCSS;
- extern HFONT DialogFont;
- ThotWindow ghwndAbort;
- ThotWindow ghwndMain;
- ThotWindow MakeIDHwnd;
- ThotBool gbAbort;
- Document TmpDoc; /* used to pass the Document id to the
- callback when setting up a menu */
- static HDC hDC;
- static HDC hMemDC;
- static char UrlToOpen[MAX_LENGTH];
- static char HrefUrl[MAX_LENGTH];
- static char TmpDocName[MAX_LENGTH];
- static char AltText[MAX_LENGTH];
- static char Message[300];
- static char Message2[300];
- static char Message3[300];
- static char WndTitle[100];
- static char CurrentPathName[100];
- static char WinCurLang[100];
- static char WinCurXML[100];
- static char CurFileToPrint[MAX_PATH];
- static char AttDlgTitle[100];
- static char MathEntName[MAX_TXT_LEN];
- static char SzBuffer[MAX_BUFF];
- static char *ClassList;
- static char *ItemList;
- static char *SavList;
- static char *cssList;
- static char *mimeType;
- static char *charSet;
- static char *string_par1;
- static char *string_par2;
- static char text[1024];
- static int repeatMode;
- static int fontNum;
- static int fontStyle;
- static int fontWeight;
- static int fontUnderline;
- static int fontSize;
- static int docSelect;
- static int dirSelect;
- static int currAttrVal;
- static int Num_zoneRecess;
- static int Num_zoneLineSpacing;
- static int Num_lang;
- static int XMLnum;
- static int Align_num;
- static int Indent_value;
- static int Indent_num;
- static int Old_lineSp;
- static int Line_spacingNum;
- static int attDlgNbItems;
- static int numCols;
- static int numRows;
- static int tBorder;
- static int formAlt;
- static int iLocation;
- static int iMode;
- static int indexImgFilter = 1;
- static int indexLinkFilter = 1;
- static int indexFilter = 1;
- static UINT itemIndex;
- static UINT nbClass;
- static UINT NbItem;
- static ThotBool saveBeforeClose;
- static ThotBool closeDontSave;
- static ThotBool isHref;
- static ThotBool WithEdit;
- static ThotBool WithCancel;
- static ThotBool WithBorder;
- static ThotBool HTMLFormat;
- static ThotBool ReleaseFocus;
- static ThotBool RequiredAttr;
- static OPENFILENAME OpenFileName;
- static char *SzFilter;
- static ThotWindow wndCSSList;
- static ThotWindow wndXMLList;
- static ThotWindow wndLangList;
- static ThotWindow wndListRule;
- static ThotWindow wndEditRule;
- static ThotWindow WndClose = NULL;
- static ThotWindow transURLWnd;
- static ThotWindow copyImgWnd;
- static ThotWindow WndSearchEdit;
- static ThotWindow GraphPal = NULL;
- static ThotWindow MathPal = NULL;
- static ThotWindow GreekPal = NULL;
- static ThotWindow CharacterForm = NULL;
- static ThotWindow FormatForm = NULL;
- static ThotWindow PrintForm = NULL;
- static ThotWindow LangForm = NULL;
- static ThotWindow XMLForm = NULL;
- static ThotWindow AttrForm = NULL;
- static ThotWindow SaveAsForm = NULL;
- static ThotWindow MimeTypeDlg = NULL;
- static ThotWindow InitConfirmForm = NULL;
- static ThotWindow DocInfo[DocumentTableLength];
- #include "init_f.h"
- /*----------------------------------------------------------------------
- DisplayStyleValue: update the property in Style dialog
- ----------------------------------------------------------------------*/
- void DisplayStyleValue (char *property, char *start_value, char *end_value)
- {
- }
- /*----------------------------------------------------------------------
- ReusePrinterDC()
- Call the Windows print dialogue or reuse the previous context.
- ----------------------------------------------------------------------*/
- void ReusePrinterDC ()
- {
- int orientation, paper;
- if (TtaGetPrinterDC (TRUE, &orientation, &paper))
- {
- ThotCallback (BasePrint + PPrinterName, STRING_DATA, CurFileToPrint);
- ThotCallback (BasePrint + FormPrint, INTEGER_DATA, (char *)1);
- }
- }
- /*********************************************************
- * *
- * C A L L B A C K S *
- * *
- *********************************************************/
- /*-----------------------------------------------------------------------
- AltDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK AltDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- switch (msg)
- {
- case WM_INITDIALOG:
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_ALT));
- SetWindowText (GetDlgItem (hwnDlg, IDC_ALTTEXT),
- TtaGetMessage (AMAYA, AM_ALT));
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, ID_DONE),
- TtaGetMessage (LIB, TMSG_DONE));
- SetDlgItemText (hwnDlg, IDC_GETALT, "");
- break;
-
- case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- case ID_DONE:
- GetDlgItemText (hwnDlg, IDC_GETALT, AltText, sizeof (AltText) - 1);
- ThotCallback (BaseImage + ImageAlt, STRING_DATA, AltText);
- if (!AltText || AltText[0] == 0)
- MessageBox (hwnDlg, TtaGetMessage (AMAYA, AM_ALT_MISSING),
- TtaGetMessage (AMAYA, AM_ALT), MB_OK | MB_ICONERROR);
- else
- EndDialog (hwnDlg, ID_CONFIRM);
- ThotCallback (BaseImage + FormAlt, STRING_DATA, (char *)1);
- break;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- XMLDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK XMLDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- int index = 0;
- UINT i = 0;
- switch (msg)
- {
- case WM_INITDIALOG:
- /* get the default GUI font */
- /* destroy the focus of the previous open dialog */
- XMLForm = hwnDlg;
- SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_EL_TYPE));
- SetWindowText (GetDlgItem (hwnDlg, ID_APPLY), TtaGetMessage (LIB, TMSG_INSERT));
- SetWindowText (GetDlgItem (hwnDlg, ID_DONE), TtaGetMessage (LIB, TMSG_DONE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_XMLELEM),
- TtaGetMessage (LIB, TMSG_EL_TYPE));
- wndXMLList = GetDlgItem (hwnDlg, IDC_XMLLIST);
- /* set the font of the window */
- WIN_SetDialogfont (wndXMLList);
- SendMessage (wndXMLList, LB_RESETCONTENT, 0, 0);
- while (i < NbItem && ItemList[index] != EOS)
- {
- SendMessage (wndXMLList, LB_INSERTSTRING, i, (LPARAM) &ItemList[index]);
- index += strlen (&ItemList[index]) + 1;/* Longueur de l'intitule */
- i++;
- }
- SetWindowText (GetDlgItem (hwnDlg, IDC_XMLEDIT), "");
- XMLnum = -1;
- break;
- case WM_CLOSE:
- case WM_DESTROY:
- XMLForm = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
- case WM_COMMAND:
- if (LOWORD (wParam) == 1 || HIWORD (wParam) == LBN_SELCHANGE ||
- HIWORD (wParam) == LBN_DBLCLK)
- {
- if (HIWORD (wParam) == LBN_SELCHANGE)
- {
- XMLnum = SendMessage (wndXMLList, LB_GETCURSEL, 0, 0);
- XMLnum = SendMessage (wndXMLList, LB_GETTEXT, XMLnum,
- (LPARAM) WinCurXML);
- SetWindowText (GetDlgItem (hwnDlg, IDC_XMLEDIT), WinCurXML);
- }
- else if (HIWORD (wParam) == LBN_DBLCLK)
- {
- if (LB_ERR == (XMLnum = SendMessage (wndLangList, LB_GETCURSEL, 0, 0L)))
- break;
- XMLnum = SendMessage (wndLangList, LB_GETTEXT, XMLnum,
- (LPARAM) WinCurLang);
- }
- SetDlgItemText (hwnDlg, IDC_XMLEDIT, WinCurXML);
- ThotCallback (NumSelectElemToBeCreated, STRING_DATA, WinCurXML);
- if (HIWORD (wParam) == LBN_DBLCLK)
- {
- /* confirm the selection */
- ThotCallback (NumFormElemToBeCreated, INTEGER_DATA, (char*) 1);
- XMLForm = NULL;
- EndDialog (hwnDlg, ID_DONE);
- return FALSE;
- }
- }
-
- switch (LOWORD (wParam))
- {
- case ID_APPLY:
- GetDlgItemText (hwnDlg, IDC_XMLEDIT, WinCurXML, sizeof (WinCurXML) - 1);
- if (WinCurXML[0] != EOS)
- ThotCallback (NumSelectElemToBeCreated, STRING_DATA, WinCurXML);
- ThotCallback (NumFormElemToBeCreated, INTEGER_DATA, (char*) 1);
- if (WinCurXML[0] != EOS)
- {
- /* reinitialize the list */
- wndXMLList = GetDlgItem (hwnDlg, IDC_XMLLIST);
- while (i < NbItem && ItemList[index] != EOS)
- {
- if (i == NbItem - 1)
- SendMessage (wndXMLList, LB_INSERTSTRING, i, (LPARAM) &ItemList[index]);
- index += strlen (&ItemList[index]) + 1;
- i++;
- }
- SetWindowText (GetDlgItem (hwnDlg, IDC_XMLEDIT), "");
- XMLnum = -1;
- }
- break;
- case ID_DONE:
- ThotCallback (NumFormElemToBeCreated, INTEGER_DATA, (char*) 0);
- XMLForm = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
- case WM_CLOSE:
- case WM_DESTROY:
- XMLForm = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
- }
- break;
- default: return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- CSSDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK CSSDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- int index = 0;
- UINT i = 0;
- switch (msg)
- {
- case WM_INITDIALOG:
- SetWindowText (hwnDlg, WndTitle);
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, ID_DONE),
- TtaGetMessage (LIB, TMSG_DONE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_CSSFILES),
- TtaGetMessage (AMAYA, AM_CSS_FILE));
- wndCSSList = GetDlgItem (hwnDlg, IDC_CSSLIST);
- /* set the font of the window */
- WIN_SetDialogfont (wndCSSList);
- SendMessage (wndCSSList, LB_RESETCONTENT, 0, 0);
- while (i < NbItem && cssList[index] != EOS)
- {
- SendMessage (wndCSSList, LB_INSERTSTRING, i, (LPARAM) &cssList[index]);
- index += strlen (&cssList[index]) + 1; /* entry length */
- i++;
- }
- itemIndex = SendMessage (wndCSSList, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
- SetDlgItemText (hwnDlg, IDC_CSSEDIT, SzBuffer);
- break;
- case WM_CLOSE:
- case WM_DESTROY:
- EndDialog (hwnDlg, ID_DONE);
- break;
- case WM_COMMAND:
- if (LOWORD (wParam) == IDC_CSSLIST && HIWORD (wParam) == LBN_SELCHANGE)
- {
- itemIndex = SendMessage (wndCSSList, LB_GETCURSEL, 0, 0);
- itemIndex = SendMessage (wndCSSList, LB_GETTEXT, itemIndex, (LPARAM) SzBuffer);
- SetDlgItemText (hwnDlg, IDC_CSSEDIT, SzBuffer);
- ThotCallback (BaseCSS + CSSSelect, STRING_DATA, SzBuffer);
- }
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- ThotCallback (BaseCSS + CSSForm, INTEGER_DATA, (char*) 1);
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
- case IDCANCEL:
- case ID_DONE:
- ThotCallback (BaseCSS + CSSForm, INTEGER_DATA, (char*) 0);
- EndDialog (hwnDlg, ID_DONE);
- break;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- TextDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK TextDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- switch (msg)
- {
- case WM_INITDIALOG:
- if (isHref)
- {
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_ATTRIBUTE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_URL_TEXT),
- TtaGetMessage (AMAYA, AM_HREF_VALUE));
- }
- else
- {
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_CHANGE_TITLE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_URL_TEXT),
- TtaGetMessage (AMAYA, AM_TITLE));
- }
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, ID_DONE), TtaGetMessage (LIB, TMSG_CANCEL));
- SetDlgItemText (hwnDlg, IDC_URLEDIT, UrlToOpen);
- SetFocus (GetDlgItem (hwnDlg, IDC_URLEDIT));
- break;
-
- case WM_CLOSE:
- case WM_DESTROY:
- EndDialog (hwnDlg, ID_DONE);
- break;
-
- case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- GetDlgItemText (hwnDlg, IDC_URLEDIT, UrlToOpen, sizeof (UrlToOpen) - 1);
- if (isHref)
- {
- AttrHREFvalue = TtaGetMemory (strlen (UrlToOpen) + 1);
- strcpy (AttrHREFvalue, UrlToOpen);
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 1);
- }
- else
- {
- ThotCallback (BaseDialog + TitleText, STRING_DATA, UrlToOpen);
- ThotCallback (BaseDialog + TitleForm, INTEGER_DATA, (char*) 1);
- }
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
-
- case ID_DONE:
- if (isHref)
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 0);
- else
- ThotCallback (BaseDialog + TitleForm, INTEGER_DATA, (char*) 0);
- EndDialog (hwnDlg, ID_DONE);
- break;
- }
- break;
-
- default:
- break;
- }
- return FALSE;
- }
- /*-----------------------------------------------------------------------
- HRefDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK HRefDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- switch (msg)
- {
- case WM_INITDIALOG:
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_ATTRIBUTE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_URLMESSAGE),
- TtaGetMessage (AMAYA, AM_LOCATION));
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, IDC_BROWSE), TtaGetMessage (AMAYA, AM_BROWSE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_CLICK), TtaGetMessage (AMAYA, AM_CLICK));
- SetWindowText (GetDlgItem (hwnDlg, IDC_CLEAR), TtaGetMessage (AMAYA, AM_CLEAR));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
-
- if (TmpDocName[0] != EOS)
- SetDlgItemText (hwnDlg, IDC_GETURL, TmpDocName);
- else
- SetDlgItemText (hwnDlg, IDC_GETURL, "");
- HrefUrl[0] = 0;
- /* set the default focus and return FALSE to validate it */
- SetFocus (GetDlgItem (hwnDlg, IDC_GETURL));
- return FALSE;
- break;
-
- case WM_COMMAND:
- if (HIWORD (wParam) == EN_UPDATE)
- {
- if (LOWORD (wParam) == IDC_GETURL)
- {
- GetDlgItemText (hwnDlg, IDC_GETURL, HrefUrl, sizeof (HrefUrl) - 1);
- if (HrefUrl[0] != 0)
- ThotCallback (BaseDialog + AttrHREFText, STRING_DATA, HrefUrl);
- }
- }
-
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*)1);
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
- case IDC_BROWSE:
- OpenFileName.lStructSize = sizeof (OPENFILENAME);
- OpenFileName.hwndOwner = hwnDlg;
- OpenFileName.hInstance = hInstance;
- OpenFileName.lpstrFilter = (LPTSTR) SzFilter;
- OpenFileName.lpstrCustomFilter = (LPTSTR) NULL;
- OpenFileName.nMaxCustFilter = 0L;
- OpenFileName.nFilterIndex = indexLinkFilter;
- OpenFileName.lpstrFile = (LPTSTR) TmpDocName;
- OpenFileName.nMaxFile = MAX_LENGTH;
- OpenFileName.lpstrInitialDir = (LPTSTR) DirectoryName;
- OpenFileName.lpstrTitle = TtaGetMessage (AMAYA, AM_BROWSE);
- OpenFileName.nFileOffset = 0;
- OpenFileName.nFileExtension = 0;
- OpenFileName.lpstrDefExt = "html";
- OpenFileName.lCustData = 0;
- OpenFileName.Flags = OFN_SHOWHELP | OFN_HIDEREADONLY;
-
- if (GetOpenFileName (&OpenFileName))
- {
- strcpy (HrefUrl, OpenFileName.lpstrFile);
- indexLinkFilter = OpenFileName.nFilterIndex;
- }
-
- SetDlgItemText (hwnDlg, IDC_GETURL, HrefUrl);
- if (HrefUrl[0] != EOS)
- {
- ThotCallback (BaseDialog + AttrHREFText, STRING_DATA, HrefUrl);
- EndDialog (hwnDlg, ID_CONFIRM);
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 1);
- }
- break;
-
- case IDC_CLICK:
- EndDialog (hwnDlg, IDCANCEL);
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 3);
- break;
-
- case IDC_CLEAR:
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 4);
- TmpDocName[0] = EOS;
- SetDlgItemText (hwnDlg, IDC_GETURL, "");
- break;
-
- case IDCANCEL:
- ThotCallback (BaseDialog + AttrHREFForm, INTEGER_DATA, (char*) 0);
- HrefUrl[0] = EOS;
- EndDialog (hwnDlg, IDCANCEL);
- break;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
-
- /*-----------------------------------------------------------------------
- HelpDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK HelpDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- switch (msg)
- {
- case WM_INITDIALOG:
- SetWindowText (GetDlgItem (hwnDlg, IDC_VERSION), CurrentPathName);
- SetWindowText (GetDlgItem (hwnDlg, IDC_ABOUT1), Message);
- SetWindowText (GetDlgItem (hwnDlg, IDC_ABOUT2), Message2);
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- break;
- case WM_CLOSE:
- case WM_DESTROY:
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
-
- case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
- }
- break;
- default:
- return (FALSE);
- }
- return TRUE;
- }
-
- /*-----------------------------------------------------------------------
- MathDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK MathDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- switch (msg)
- {
- case WM_INITDIALOG:
- MathPal = hwnDlg;
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_BUTTON_MATH));
- SetWindowText (GetDlgItem (hwnDlg, ID_DONE), TtaGetMessage (LIB, TMSG_DONE));
- break;
- case WM_CLOSE:
- case WM_DESTROY:
- MathPal = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
- case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case ID_DONE:
- MathPal = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
- case IDC_MATH:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)0);
- break;
- case IDC_ROOT:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)1);
- break;
- case IDC_SROOT:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)2);
- break;
- case IDC_DIV:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)3);
- break;
- case IDC_POWIND:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)4);
- break;
- case IDC_IND:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)5);
- break;
- case IDC_POW:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)6);
- break;
- case IDC_UPDN:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)7);
- break;
- case IDC_DOWN:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)8);
- break;
- case IDC_UP:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)9);
- break;
- case IDC_PAREXP:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)10);
- break;
- case IDC_UDLR:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)11);
- break;
- case IDC_MATRIX:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)12);
- break;
- case IDC_SYM:
- ThotCallback (MathsDialogue + MenuMaths, INTEGER_DATA, (char*)13);
- break;
- }
- SetFocus (FrRef[ActiveFrame]);
- break;
-
- default:
- return (FALSE);
- }
- return TRUE;
- }
-
- /*-----------------------------------------------------------------------
- PrintDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK PrintDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- int orientation, paper;
- switch (msg)
- {
- case WM_INITDIALOG:
- PrintForm = hwnDlg;
- SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_LIB_PRINT));
- SetWindowText (GetDlgItem (hwnDlg, ID_PRINT),
- TtaGetMessage (LIB, TMSG_BUTTON_PRINT));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL),
- TtaGetMessage (LIB, TMSG_CANCEL));
- SetWindowText (GetDlgItem (hwnDlg, IDC_OPTIONS),
- TtaGetMessage (LIB, TMSG_OPTIONS));
- SetWindowText (GetDlgItem (hwnDlg, IDC_TABOFCONTENTS),
- TtaGetMessage (AMAYA, AM_PRINT_TOC));
- SetWindowText (GetDlgItem (hwnDlg, IDC_LINKS),
- TtaGetMessage (AMAYA, AM_NUMBERED_LINKS));
- SetWindowText (GetDlgItem (hwnDlg, IDC_PRINTURL),
- TtaGetMessage (AMAYA, AM_PRINT_URL));
- SetWindowText (GetDlgItem (hwnDlg, IDC_IGNORE_CSS),
- TtaGetMessage (AMAYA, AM_WITH_CSS));
- CheckDlgButton (hwnDlg, IDC_PRINTURL, PrintURL);
- CheckDlgButton (hwnDlg, IDC_IGNORE_CSS, IgnoreCSS);
- CheckDlgButton (hwnDlg, IDC_TABOFCONTENTS, WithToC);
- CheckDlgButton (hwnDlg, IDC_LINKS, NumberLinks);
- break;
-
- case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case IDC_TABOFCONTENTS:
- ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 1);
- break;
- case IDC_LINKS:
- ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 2);
- break;
- case IDC_PRINTURL:
- ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 3);
- break;
- case IDC_IGNORE_CSS:
- ThotCallback (BasePrint + PrintOptions, INTEGER_DATA, (char*) 4);
- break;
- case ID_PRINT:
- ThotCallback (BasePrint + PrintSupport, INTEGER_DATA, (char*) 0);
- PrintForm = NULL;
- EndDialog (hwnDlg, ID_PRINT);
- if (TtaGetPrinterDC (FALSE, &orientation, &paper))
- {
- EnableWindow (ghwndMain, FALSE);
- ThotCallback (BasePrint + PaperOrientation, INTEGER_DATA, (char*) orientation);
- ThotCallback (BasePrint + PaperFormat, INTEGER_DATA, (char*) paper);
- ThotCallback (BasePrint + PPrinterName, STRING_DATA,
- CurFileToPrint);
- ThotCallback (BasePrint + FormPrint, INTEGER_DATA, (char*)1);
- }
- break;
- case IDCANCEL:
- ThotCallback (BasePrint + FormPrint, INTEGER_DATA, (char*)0);
- PrintForm = NULL;
- EndDialog (hwnDlg, IDCANCEL);
- break;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- TableDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK TableDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- ThotBool ok;
- int val;
- switch (msg)
- {
- case WM_INITDIALOG:
- SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_BUTTON_TABLE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_NUMCOL),
- TtaGetMessage (AMAYA, AM_COLS));
- SetWindowText (GetDlgItem (hwnDlg, IDC_NUMROWS),
- TtaGetMessage (AMAYA, AM_ROWS));
- if (WithBorder)
- SetWindowText (GetDlgItem (hwnDlg, IDC_BORDER),
- TtaGetMessage (AMAYA, AM_BORDER));
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL),
- TtaGetMessage (LIB, TMSG_CANCEL));
-
- SetDlgItemInt (hwnDlg, IDC_NUMCOLEDIT, numCols, FALSE);
- SetDlgItemInt (hwnDlg, IDC_NUMROWSEDIT, numRows, FALSE);
- if (WithBorder)
- SetDlgItemInt (hwnDlg, IDC_BORDEREDIT, tBorder, FALSE);
- break;
- case WM_COMMAND:
- if (HIWORD (wParam) == EN_UPDATE)
- {
- if (LOWORD (wParam) == IDC_NUMCOLEDIT)
- {
- val = GetDlgItemInt (hwnDlg, IDC_NUMCOLEDIT, &ok, TRUE);
- if (ok)
- ThotCallback (BaseDialog + TableCols, INTEGER_DATA, (char*) val);
- }
- else if (LOWORD (wParam) == IDC_NUMROWSEDIT)
- {
- val = GetDlgItemInt (hwnDlg, IDC_NUMROWSEDIT, &ok, TRUE);
- if (ok)
- ThotCallback (BaseDialog + TableRows, INTEGER_DATA, (char*) val);
- }
- else if (LOWORD (wParam) == IDC_BORDEREDIT)
- {
- val = GetDlgItemInt (hwnDlg, IDC_BORDEREDIT, &ok, TRUE);
- if (ok)
- ThotCallback (BaseDialog + TableBorder, INTEGER_DATA, (char*) val);
- }
- }
-
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- UserAnswer = 1;
- ThotCallback (BaseDialog + TableForm, INTEGER_DATA, (char*) 1);
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
- case IDCANCEL:
- UserAnswer = 0;
- ThotCallback (BaseDialog + TableForm, INTEGER_DATA, (char*) 0);
- EndDialog (hwnDlg, IDCANCEL);
- break;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- AttrItemsDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK AttrItemsDlgProc (ThotWindow hwnDlg, UINT msg,
- WPARAM wParam, LPARAM lParam)
- {
- int ndx = 0;
- int i = 0;
- int cxChar;
- int cyChar;
- HDC hDC;
- RECT rect;
- ThotWindow radio1;
- ThotWindow radio2;
- ThotWindow radio3;
- ThotWindow radio4;
- ThotWindow radio5;
- ThotWindow radio6;
- ThotWindow radio7;
- ThotWindow radio8;
- ThotWindow radio9;
- ThotWindow groupBx;
- TEXTMETRIC tm;
- switch (msg)
- {
- case WM_INITDIALOG:
- /* store the window ID to be able to destroy it from elsewhere */
- AttrForm = hwnDlg;
- GetClientRect (hwnDlg, &rect);
- hDC = GetDC (hwnDlg);
- SelectObject (hDC, DialogFont);
- GetTextMetrics (hDC, &tm);
- cxChar = tm.tmAveCharWidth;
- cyChar = tm.tmHeight + tm.tmExternalLeading;
- ReleaseDC (hwnDlg, hDC);
-
- SetWindowText (hwnDlg, TtaGetMessage (LIB, TMSG_ATTR));
- SetWindowText (GetDlgItem (hwnDlg, ID_APPLY),
- TtaGetMessage (LIB, TMSG_APPLY));
- if (RequiredAttr)
- DestroyWindow (GetDlgItem (hwnDlg, ID_DELETE));
- else
- SetWindowText (GetDlgItem (hwnDlg, ID_DELETE),
- TtaGetMessage (LIB, TMSG_DEL_ATTR));
- SetWindowText (GetDlgItem (hwnDlg, ID_DONE),
- TtaGetMessage (LIB, TMSG_DONE));
- radio1 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT1, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio1);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- radio2 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT2, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio2);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 2)
- {
- radio3 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT3, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio3);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 3)
- {
- radio4 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT4, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio4);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 4)
- {
- radio5 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT5, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio5);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 5)
- {
- radio6 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT6, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio6);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 6)
- {
- radio7 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT7, (HINSTANCE) GetWindowLong (hwnDlg,
- GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio7);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 7)
- {
- radio8 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT8, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio8);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- if (attDlgNbItems > 8)
- {
- radio9 = CreateWindow ("BUTTON", &ItemList[ndx],
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, 2 * cxChar,
- cyChar * (1+2*i), 20 * cxChar, 7 * cyChar / 4, hwnDlg,
- (HMENU) OPT9, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (radio9);
- ndx += strlen (&ItemList[ndx]) + 1;
- i++;
- }
- }
- }
- }
- }
- }
- }
- groupBx = CreateWindow ("BUTTON", AttDlgTitle,
- WS_CHILD | WS_VISIBLE | BS_GROUPBOX, cxChar, 0,
- rect.right - (2 * cxChar), i * (2 * cyChar) + cyChar, hwnDlg,
- (HMENU) 1, (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (groupBx);
- switch (currAttrVal)
- {
- case 1: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT1);
- break;
- case 2: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT2);
- break;
- case 3: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT3);
- break;
- case 4: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT4);
- break;
- case 5: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT5);
- break;
- case 6: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT6);
- break;
- case 7: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT7);
- break;
- case 8: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT8);
- break;
- case 9: CheckRadioButton (hwnDlg, OPT1, OPT9, OPT9);
- break;
- default:
- break;
- }
- break;
-
- case WM_CLOSE:
- case WM_DESTROY:
- AttrForm = NULL;
- if (RequiredAttr)
- ThotCallback (NumMenuAttrRequired, INTEGER_DATA, (char*) 0);
- else
- ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 0);
- EndDialog (hwnDlg, IDCANCEL);
- break;
- case WM_COMMAND:
- if (RequiredAttr)
- i = NumMenuAttrEnumNeeded;
- else
- i = NumMenuAttrEnum;
- switch (LOWORD (wParam))
- {
- case OPT1:
- iLocation = 0;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT2:
- iLocation = 1;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT3:
- iLocation = 2;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT4:
- iLocation = 3;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT5:
- iLocation = 4;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT6:
- iLocation = 5;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT7:
- iLocation = 6;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT8:
- iLocation = 7;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case OPT9:
- iLocation = 8;
- ThotCallback (i, INTEGER_DATA, (char*) iLocation);
- break;
- case ID_APPLY:
- if (RequiredAttr)
- {
- ThotCallback (NumMenuAttrRequired, INTEGER_DATA, (char*) 1);
- EndDialog (hwnDlg, IDCANCEL);
- }
- else
- ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 1);
- break;
- case ID_DELETE:
- ThotCallback (NumMenuAttrEnum, INTEGER_DATA, (char*) -1);
- ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 2);
- AttrForm = NULL;
- break;
-
- case ID_DONE:
- AttrForm = NULL;
- if (RequiredAttr)
- ThotCallback (NumMenuAttrRequired, INTEGER_DATA, (char*) 0);
- else
- ThotCallback (NumMenuAttr, INTEGER_DATA, (char*) 0);
- EndDialog (hwnDlg, IDCANCEL);
- break;
- }
- break;
- default:
- return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- CharsetDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK CharsetDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- int index = 0;
- UINT i = 0;
- static ThotWindow wndMTlist;
-
- switch (msg)
- {
- case WM_INITDIALOG:
- /* get the default GUI font */
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_SELECT_CHARSET));
- SetWindowText (GetDlgItem (hwnDlg, ID_APPLY), TtaGetMessage (LIB, TMSG_APPLY));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
- if (!strcmp (UserCharset, "us-ascii"))
- CheckRadioButton (hwnDlg, IDC_USASCII, IDC_ISOL1, IDC_USASCII);
- if (!strcmp (UserCharset, "iso-8859-1"))
- CheckRadioButton (hwnDlg, IDC_USASCII, IDC_ISOL1, IDC_ISOL1);
- else
- CheckRadioButton (hwnDlg, IDC_USASCII, IDC_ISOL1, IDC_UTF8);
- SetFocus (GetDlgItem (hwnDlg, IDC_USASCII));
- return FALSE;
- break;
-
- case WM_CLOSE:
- case WM_DESTROY:
- EndDialog (hwnDlg, ID_DONE);
- break;
-
- case WM_COMMAND:
- switch (LOWORD (wParam))
- {
- case IDC_USASCII:
- strcpy (SaveFormTmp, "us-ascii");
- break;
- case IDC_UTF8:
- strcpy (SaveFormTmp, "UTF-8");
- break;
- case IDC_ISOL1:
- strcpy (SaveFormTmp, "iso-8859-1");
- break;
- case ID_APPLY:
- EndDialog (hwnDlg, ID_DONE);
- break;
-
- case IDCANCEL:
- case WM_CLOSE:
- SaveFormTmp[0] = EOS;
- EndDialog (hwnDlg, ID_DONE);
- break;
- }
- break;
- default: return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- MimeTypeDlgStatus
- Updates the status bar of the MimeType dialog
- ------------------------------------------------------------------------*/
- void MimeTypeDlgStatus (char *msg)
- {
- if (MimeTypeDlg && msg)
- SetWindowText (GetDlgItem (MimeTypeDlg, IDC_STATUS), msg);
- }
- /*-----------------------------------------------------------------------
- MimeTypeDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK MimeTypeDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- int index = 0;
- UINT i = 0;
- static ThotWindow wndMTlist;
- switch (msg)
- {
- case WM_INITDIALOG:
- /* get the default GUI font */
- MimeTypeDlg = hwnDlg;
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_SELECT_MIMETYPE));
- SetWindowText (GetDlgItem (hwnDlg, ID_APPLY), TtaGetMessage (LIB, TMSG_APPLY));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
-
- wndMTlist = CreateWindow ("listbox", NULL,
- WS_CHILD | WS_VISIBLE | LBS_STANDARD | WS_VSCROLL | WS_TABSTOP,
- 5, 5, 310, 100, hwnDlg, (HMENU) 1,
- (HINSTANCE) GetWindowLong (hwnDlg, GWL_HINSTANCE), NULL);
- /* set the font of the window */
- WIN_SetDialogfont (wndMTlist);
- SendMessage (wndMTlist, LB_RESETCONTENT, 0, 0);
- while (i < NbItem && mimeType[index] != '\0')
- {
- SendMessage (wndMTlist, LB_INSERTSTRING, i, (LPARAM) &mimeType[index]);
- index += strlen (&mimeType[index]) + 1;/* Longueur de l'intitule */
- i++;
- }
- /* select the first list item */
- /* SendMessage (wndMTlist, LB_SETCURSEL, 0, 0); */
- /* put the focus on the first list item */
- SetDlgItemText (hwnDlg, IDC_MTEDIT, UserMimeType);
- SetFocus (GetDlgItem (hwnDlg, IDC_MTEDIT));
- return FALSE;
- break;
-
- case WM_CLOSE:
- case WM_DESTROY:
- /* ThotCallback (BaseDialog + MimeTypeForm, INTEGER_DATA, (char *) 0); */
- MimeTypeDlg = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
-
- case WM_COMMAND:
- if (LOWORD (wParam) == 1)
- {
- if (HIWORD (wParam) == LBN_SELCHANGE)
- {
- itemIndex = SendMessage (wndMTlist, LB_GETCURSEL, 0, 0);
- itemIndex = SendMessage (wndMTlist, LB_GETTEXT, itemIndex,
- (LPARAM) SzBuffer);
- }
- else if (HIWORD (wParam) == LBN_DBLCLK)
- {
- if (LB_ERR == (itemIndex = SendMessage (wndMTlist, LB_GETCURSEL, 0, 0L)))
- break;
- itemIndex = SendMessage (wndMTlist, LB_GETTEXT, itemIndex,
- (LPARAM) SzBuffer);
- }
- SetDlgItemText (hwnDlg, IDC_MTEDIT, SzBuffer);
- if (HIWORD (wParam) == LBN_DBLCLK)
- {
- GetDlgItemText (hwnDlg, IDC_MTEDIT, SaveFormTmp, sizeof (SaveFormTmp) - 1);
- if (SaveFormTmp[0] != EOS)
- {
- MimeTypeDlg = NULL;
- EndDialog (hwnDlg, ID_DONE);
- }
- break;
- }
- }
-
- switch (LOWORD (wParam))
- {
- case ID_APPLY:
- GetDlgItemText (hwnDlg, IDC_MTEDIT, SaveFormTmp, sizeof (SaveFormTmp) - 1);
- ThotCallback (BaseDialog + MimeTypeForm, INTEGER_DATA, (char *) 1);
- if (SaveFormTmp[0] != EOS)
- {
- MimeTypeDlg = NULL;
- EndDialog (hwnDlg, ID_DONE);
- }
- break;
-
- case IDCANCEL:
- case WM_CLOSE:
- ThotCallback (BaseDialog + MimeTypeForm, INTEGER_DATA, (char *) 0);
- MimeTypeDlg = NULL;
- EndDialog (hwnDlg, ID_DONE);
- break;
- }
- break;
- default: return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- SaveAsDlgStatus
- Updates the status bar of the SaveAs dialog
- ------------------------------------------------------------------------*/
- void SaveAsDlgStatus (char *msg)
- {
- if (SaveAsForm && msg)
- SetWindowText (GetDlgItem (SaveAsForm, IDC_STATUS), msg);
- }
- /*----------------------------------------------------------------------
- WIN_ListSaveDirectory
- ----------------------------------------------------------------------*/
- void WIN_ListSaveDirectory (ThotWindow hwnDlg, char *title, char *fileName)
- {
- char *szFilter;
- char szFileTitle[256];
- szFilter = APPFILENAMEFILTER;
- TtaExtractName (fileName, SavePath, DocumentName);
- OpenFileName.lStructSize = sizeof (OPENFILENAME);
- OpenFileName.hwndOwner = hwnDlg;
- OpenFileName.lpstrFilter = szFilter;
- OpenFileName.lpstrFile = DocumentName;
- OpenFileName.nMaxFile = MAX_LENGTH;
- OpenFileName.lpstrFileTitle = szFileTitle;
- OpenFileName.lpstrTitle = title;
- OpenFileName.nMaxFileTitle = sizeof (szFileTitle);
- OpenFileName.lpstrInitialDir = SavePath;
- OpenFileName.Flags = OFN_SHOWHELP | OFN_HIDEREADONLY;
- if (GetSaveFileName (&OpenFileName))
- strcpy (fileName, OpenFileName.lpstrFile);
- }
- /*-----------------------------------------------------------------------
- SaveAsDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK SaveAsDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- char buff[500];
- switch (msg)
- {
- case WM_INITDIALOG:
- SaveAsForm = hwnDlg;
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_SAVE_AS));
- SetWindowText (GetDlgItem (hwnDlg, IDC_DOCLOCATION),
- TtaGetMessage (AMAYA, AM_DOC_LOCATION));
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, ID_CLEAR), TtaGetMessage (AMAYA, AM_CLEAR));
- SetWindowText (GetDlgItem (hwnDlg, IDC_BROWSE), TtaGetMessage (AMAYA, AM_BROWSE));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
- SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, CurrentPathName);
-
- if (HTMLFormat ||
- DocumentTypes[SavingDocument] == docMath ||
- DocumentTypes[SavingDocument] == docSVG ||
- DocumentTypes[SavingDocument] == docXml)
- {
- SetWindowText (GetDlgItem (hwnDlg, IDC_COPYIMG),
- TtaGetMessage (AMAYA, AM_BCOPY_IMAGES));
- SetWindowText (GetDlgItem (hwnDlg, IDC_TRANSFORMURL),
- TtaGetMessage (AMAYA, AM_BTRANSFORM_URL));
- SetWindowText (GetDlgItem (hwnDlg, IDC_IMGLOCATION),
- TtaGetMessage (AMAYA, AM_IMAGES_LOCATION));
- copyImgWnd = GetDlgItem (hwnDlg, IDC_COPYIMG);
- transURLWnd = GetDlgItem (hwnDlg, IDC_TRANSFORMURL);
- }
- if (HTMLFormat)
- {
- SetWindowText (GetDlgItem (hwnDlg, IDC_OUTPUTGROUP),
- TtaGetMessage (LIB, TMSG_DOCUMENT_FORMAT));
- SetWindowText (GetDlgItem (hwnDlg, IDC_HTML), "HTML");
- SetWindowText (GetDlgItem (hwnDlg, IDC_XML), "XML");
- SetWindowText (GetDlgItem (hwnDlg, IDC_TEXT),
- TtaGetMessage (AMAYA, AM_TEXT));
- if (SaveAsHTML)
- {
- CheckRadioButton (hwnDlg, IDC_HTML, IDC_XML, IDC_HTML);
- EnableWindow (transURLWnd, TRUE);
- EnableWindow (copyImgWnd, TRUE);
- }
- else if (SaveAsXML)
- {
- CheckRadioButton (hwnDlg, IDC_HTML, IDC_XML, IDC_XML);
- EnableWindow (transURLWnd, TRUE);
- EnableWindow (copyImgWnd, TRUE);
- }
- else if (SaveAsText)
- {
- CheckRadioButton (hwnDlg, IDC_HTML, IDC_XML, IDC_TEXT);
- EnableWindow (transURLWnd, FALSE);
- EnableWindow (copyImgWnd, FALSE);
- }
- if (!SaveAsText && CopyImages)
- CheckRadioButton (hwnDlg, IDC_COPYIMG, IDC_COPYIMG, IDC_COPYIMG);
- }
- else if (DocumentTypes[SavingDocument] == docMath ||
- DocumentTypes[SavingDocument] == docXml)
- EnableWindow (copyImgWnd, FALSE);
- if (UpdateURLs)
- CheckRadioButton (hwnDlg, IDC_TRANSFORMURL, IDC_TRANSFORMURL, IDC_TRANSFORMURL);
- /* mime type */
- _snprintf (buff, 500, "MIME type: %s",
- UserMimeType[0] != EOS ? UserMimeType : TtaGetMessage (AMAYA, AM_UNKNOWN));
- SetDlgItemText (hwnDlg, IDC_MIMETYPE, buff);
- SetDlgItemText (hwnDlg, ID_CHANGEMIMETYPE, TtaGetMessage (AMAYA, AM_CHANGE));
- /* charset */
- _snprintf (buff, 500, "Charset: %s",
- UserCharset[0] != EOS ? UserCharset : TtaGetMessage (AMAYA, AM_UNKNOWN));
- SetDlgItemText (hwnDlg, IDC_CHARSET, buff);
- SetDlgItemText (hwnDlg, ID_CHANGECHARSET, TtaGetMessage (AMAYA, AM_CHANGE));
- /* set the default focus and return FALSE to validate it */
- SetFocus (GetDlgItem (hwnDlg, IDC_EDITDOCSAVE));
- return FALSE;
- break;
-
- case WM_COMMAND:
- if (HIWORD (wParam) == EN_UPDATE)
- {
- if (LOWORD (wParam) == IDC_EDITDOCSAVE)
- {
- GetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, UrlToOpen, sizeof (UrlToOpen) - 1);
- ThotCallback (BaseDialog + NameSave, STRING_DATA, UrlToOpen);
- }
- else if (LOWORD (wParam) == IDC_EDITIMGSAVE)
- {
- GetDlgItemText (hwnDlg, IDC_EDITIMGSAVE, UrlToOpen, sizeof (UrlToOpen) - 1);
- ThotCallback (BaseDialog + ImgDirSave, STRING_DATA, UrlToOpen);
- }
- }
- switch (LOWORD (wParam))
- {
- case IDC_HTML:
- EnableWindow (transURLWnd, TRUE);
- EnableWindow (copyImgWnd, TRUE);
- ThotCallback (BaseDialog + RadioSave, INTEGER_DATA, (char*) 0);
- SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, DocToOpen);
- return 0;
-
- case IDC_XML:
- EnableWindow (transURLWnd, TRUE);
- EnableWindow (copyImgWnd, TRUE);
- ThotCallback (BaseDialog + RadioSave, INTEGER_DATA, (char*) 1);
- SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, DocToOpen);
- return 0;
-
- case IDC_TEXT:
- EnableWindow (transURLWnd, FALSE);
- EnableWindow (copyImgWnd, FALSE);
-
- ThotCallback (BaseDialog + RadioSave, INTEGER_DATA, (char*) 2);
- SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, DocToOpen);
- return 0;
-
- case IDC_COPYIMG:
- ThotCallback (BaseDialog + ToggleSave, INTEGER_DATA, (char*) 0);
- break;
-
- case IDC_TRANSFORMURL:
- ThotCallback (BaseDialog + ToggleSave, INTEGER_DATA, (char*) 1);
- break;
- case ID_CHANGECHARSET:
- ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 4);
- if (SaveFormTmp[0] != EOS)
- {
- _snprintf (buff, 500, "Charset: %s", UserCharset);
- SetDlgItemText (hwnDlg, IDC_CHARSET, buff);
- }
- break;
- case ID_CHANGEMIMETYPE:
- ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 5);
- if (SaveFormTmp[0] != EOS)
- {
- _snprintf (buff, 500, "MIME type: %s", UserMimeType);
- SetDlgItemText (hwnDlg, IDC_MIMETYPE, buff);
- }
- break;
-
- case ID_CLEAR:
- SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, "");
- SetDlgItemText (hwnDlg, IDC_EDITIMGSAVE, "");
- ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 3);
- break;
-
- case IDC_BROWSE:
- /* by default keep the same document name */
- WIN_ListSaveDirectory (hwnDlg, TtaGetMessage (AMAYA, AM_SAVE_AS), UrlToOpen);
- SetDlgItemText (hwnDlg, IDC_EDITDOCSAVE, UrlToOpen);
- ThotCallback (BaseDialog + NameSave, STRING_DATA, UrlToOpen);
- break;
-
- case IDCANCEL:
- EndDialog (hwnDlg, IDCANCEL);
- ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 0);
- SaveAsForm = NULL;
- break;
-
- case ID_CONFIRM:
- EndDialog (hwnDlg, ID_CONFIRM);
- ThotCallback (BaseDialog + SaveForm, INTEGER_DATA, (char*) 1);
- SaveAsForm = NULL;
- break;
- }
- break;
-
- default:
- return FALSE;
- }
- return TRUE;
- }
- /*-----------------------------------------------------------------------
- OpenDocDlgProc
- ------------------------------------------------------------------------*/
- LRESULT CALLBACK OpenDocDlgProc (ThotWindow hwnDlg, UINT msg, WPARAM wParam,
- LPARAM lParam)
- {
- switch (msg)
- {
- case WM_INITDIALOG:
- SetWindowText (hwnDlg, TtaGetMessage (AMAYA, AM_OPEN_URL));
- SetWindowText (GetDlgItem (hwnDlg, IDC_URLMESSAGE),
- TtaGetMessage (AMAYA, AM_LOCATION));
- SetWindowText (GetDlgItem (hwnDlg, ID_CONFIRM),
- TtaGetMessage (LIB, TMSG_LIB_CONFIRM));
- SetWindowText (GetDlgItem (hwnDlg, IDC_BROWSE), TtaGetMessage (AMAYA, AM_BROWSE));
- SetWindowText (GetDlgItem (hwnDlg, IDC_CLEAR), TtaGetMessage (AMAYA, AM_CLEAR));
- SetWindowText (GetDlgItem (hwnDlg, IDCANCEL), TtaGetMessage (LIB, TMSG_CANCEL));
- SetWindowText (hwnDlg, WndTitle);
- SetDlgItemText (hwnDlg, IDC_GETURL, UrlToOpen);
- /* put the focus on the first dialog item */
- SetFocus (GetDlgItem (hwnDlg, IDC_GETURL));
- return FALSE;
- break;
- case WM_COMMAND:
- if (HIWORD (wParam) == EN_UPDATE)
- {
- if (LOWORD (wParam) == IDC_GETURL)
- {
- GetDlgItemText (hwnDlg, IDC_GETURL, UrlToOpen, sizeof (UrlToOpen) - 1);
- if (UrlToOpen[0] != EOS)
- ThotCallback (BaseDialog + URLName, STRING_DATA, UrlToOpen);
- }
- }
- switch (LOWORD (wParam))
- {
- case ID_CONFIRM:
- ThotCallback (BaseDialog + OpenForm, INTEGER_DATA, (char*)1);
- EndDialog (hwnDlg, ID_CONFIRM);
- break;
- case IDC_BROWSE:
- OpenFileName.lStructSize = sizeof (OPENFILENAME);
- OpenFileName.hwndOwner = hwnDlg;
- OpenFileName.hInstance = hInstance;
- OpenFileName.lpstrFilter = (LPTSTR) SzFilter;
- OpenFileName.lpstrCustomFilter = (LPTSTR) NULL;
- OpenFileName.nMaxCustFilter = 0L;
- OpenFileName.nFilterIndex = indexFilter;
- OpenFileName.lpstrFile = (LPTSTR) TmpDocName;
- OpenFileName.nMaxFile = MAX_LENGTH;
- OpenFileName.lpstrInitialDir = (LPTSTR) DirectoryName;
- OpenFileName.lpstrTitle = TtaGetMessage (AMAYA, AM_OPEN_URL);
- OpenFileName.nFileOffset = 0;
- OpenFileName.nFileExtension = 0;
- OpenFileName.lpstrDefExt = "html";
- OpenFileName.lCustData = 0;
- OpenFileName.Flags = OFN_SHOWHELP | OFN_HIDEREADONLY;
-
- if (GetOpenFileName (&OpenFileName))
- {
- strcpy (UrlToOpen, OpenFileName.lpstrFile);
- indexFilter = OpenFileName.nFilterIndex;
- strc…
Large files files are truncated, but you can click here to view the full file