=================================================================== RCS file: /home/cvs/OpenXM_contrib2/windows/asir32gui/asir32guiview.cpp,v retrieving revision 1.27 retrieving revision 1.32 diff -u -p -r1.27 -r1.32 --- OpenXM_contrib2/windows/asir32gui/asir32guiview.cpp 2013/08/07 01:55:08 1.27 +++ OpenXM_contrib2/windows/asir32gui/asir32guiview.cpp 2019/03/28 14:34:35 1.32 @@ -34,6 +34,8 @@ void put_line(char *); void send_intr(void); void insert_to_theView(char *); BOOL get_rootdir(char *,int,char *); +const char *get_locale_lang_iso639(); +const char *get_helpdir(); extern int bigfloat, prtime, prresult; extern char *asir_libdir; extern int asirgui_kind; @@ -501,14 +503,14 @@ void CAsir32guiView::OnFileOpen() } } } + void CAsir32guiView::viewHtmlHelp(char *help) { char *helpfile; - char fmt[] = "%s\\help\\%shelp.chm"; - char root[BUFSIZ],errmsg[BUFSIZ]; - get_rootdir(root,sizeof(root),errmsg); - helpfile = (char *)malloc(sizeof(fmt) + strlen(root) + strlen(help)); - sprintf(helpfile,fmt,root,help); + char fmt[] = "%s\\%shelp.chm"; + const char *dir = get_helpdir(); + helpfile = (char *)malloc(sizeof(fmt) + strlen(dir) + strlen(help)); + sprintf(helpfile,fmt,dir,help); #if _MSC_VER < 1300 /* Visual C++ 6.0 */ ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0); @@ -523,10 +525,25 @@ void CAsir32guiView::viewHtmlHelp(char *help) #endif } +void CAsir32guiView::viewWebHelp(char *key) +{ + char *base="http://www.math.kobe-u.ac.jp/OpenXM/Current/doc/"; + char *url = (char *)malloc(strlen(base)+strlen(key)+1); + sprintf(url,"%s%s",base,key); + ShellExecute(NULL,"open",url,NULL,NULL,SW_SHOWNORMAL); + free(url); +} + void CAsir32guiView::OnAsirhelp() { + const char *lang = get_locale_lang_iso639(); + if(strcmp(lang,"ja")==0) { + viewWebHelp("index-doc-ja.html"); + }else { + viewWebHelp("index-doc.html"); + } // TODO: この位置にコマンド ハンドラ用のコードを追加してください - viewHtmlHelp("asir"); +// viewHtmlHelp("asir"); } void CAsir32guiView::OnFileLog() @@ -733,25 +750,16 @@ BOOL CAsir32guiView::Create(LPCTSTR lpszClassName, LPC BOOL ret = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext); FILE *fp = NULL; char *temp; - char rootdir[BUFSIZ], errmsg[BUFSIZ], hndname[_MAX_PATH]; + char hndname[_MAX_PATH]; - if (get_rootdir(rootdir, BUFSIZ, errmsg)) { - sprintf(hndname, "%s\\bin\\asirgui.hnd", rootdir); - fp = fopen(hndname,"w"); - } - if ( fp ) { - fprintf(fp,"%d",(unsigned int)theView->m_hWnd); - fclose(fp); + if ( asirgui_kind == ASIRGUI_MAIN ) { if ( temp = getenv("TEMP") ) { - size_t len; - char *name; - - len = strlen(temp); - name = (char *)malloc(len+BUFSIZ); - sprintf(name,"%s\\asirgui.hnd",temp); - fopen(name,"w"); - fprintf(fp,"%d",(unsigned int)theView->m_hWnd); - fclose(fp); + sprintf(hndname,"%s\\asirgui.hnd", temp); + fp = fopen(hndname,"w"); + if ( fp ) { + fprintf(fp,"%d",(unsigned int)theView->m_hWnd); + fclose(fp); + } } } return ret;