[BACK]Return to asir32guiview.cpp CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / windows / asir32gui

Annotation of OpenXM_contrib2/windows/asir32gui/asir32guiview.cpp, Revision 1.14

1.1       noro        1: // asir32guiView.cpp : CAsir32guiView クラスの動作の定義を行います。
                      2: //
                      3:
                      4: #include "stdafx.h"
                      5:
                      6: #include "asir32gui.h"
                      7: #include "asir32guiDoc.h"
                      8: #include "asir32guiView.h"
                      9: #include "FatalDialog.h"
1.3       noro       10: #include <direct.h>
1.6       noro       11: #include <io.h>
1.1       noro       12:
                     13: #ifdef _DEBUG
                     14: #define new DEBUG_NEW
                     15: #undef THIS_FILE
                     16: static char THIS_FILE[] = __FILE__;
                     17: #endif
                     18:
1.5       noro       19: // const TextBufferSize     = 32768;
                     20: const TextBufferSize     = 16384;
1.1       noro       21:
                     22: CAsir32guiView *theView;
                     23:
                     24: extern "C"
                     25: {
                     26: char *prev_hist(void), *next_hist(void), *search_hist(char *p);
                     27: void read_input_history(),write_input_history();
                     28: void init_input_history();
                     29: void add_hist(char *p), reset_traverse(void);
                     30: void asir_terminate(void);
                     31: void Main(int,char*[]);
                     32: void loadfile(char *);
                     33: void put_line(char *);
                     34: void send_intr(void);
                     35: void insert_to_theView(char *);
                     36: void get_rootdir(char *,int,char *);
                     37: extern int bigfloat, prtime, prresult;
                     38: extern char *asir_libdir;
1.2       noro       39: extern int asirgui_kind;
1.1       noro       40:
                     41: void insert_to_theView(char *str)
                     42: {
                     43:        (void)theView->Insert(str);
                     44: }
                     45: void flush_log()
                     46: {
                     47:        if ( theView->Logging )
                     48:                theView->OnFileLog();
                     49: }
                     50: }
                     51:
                     52: /////////////////////////////////////////////////////////////////////////////
                     53: // CAsir32guiView
                     54:
                     55: IMPLEMENT_DYNCREATE(CAsir32guiView, CEditView)
                     56:
                     57: BEGIN_MESSAGE_MAP(CAsir32guiView, CEditView)
                     58:        //{{AFX_MSG_MAP(CAsir32guiView)
                     59:        ON_WM_KEYDOWN()
                     60:        ON_WM_CHAR()
                     61:        ON_WM_LBUTTONUP()
                     62:        ON_WM_RBUTTONDOWN()
                     63:        ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
                     64:        ON_COMMAND(ID_FILE_LOG, OnFileLog)
                     65:        ON_COMMAND(ID_ASIRHELP, OnAsirhelp)
                     66:        ON_UPDATE_COMMAND_UI(ID_FILE_LOG, OnUpdateFileLog)
                     67:        ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
1.3       noro       68:        ON_COMMAND(IDR_FONT, OnFont)
                     69:        ON_WM_CREATE()
1.6       noro       70:        ON_COMMAND(ID_CONTRIBHELP, OnContribhelp)
1.9       noro       71:        ON_WM_SIZE()
1.11      noro       72:        ON_COMMAND(ID_DSOLV, OnDsolv)
                     73:        ON_COMMAND(ID_GNUPLOT, OnGnuplot)
                     74:        ON_COMMAND(ID_OKDIFF, OnOkdiff)
                     75:        ON_COMMAND(ID_OKDMODULE, OnOkdmodule)
                     76:        ON_COMMAND(ID_OM, OnOm)
                     77:        ON_COMMAND(ID_PFPCOH, OnPfpcoh)
                     78:        ON_COMMAND(ID_PLUCKER, OnPlucker)
                     79:        ON_COMMAND(ID_SM1, OnSm1)
                     80:        ON_COMMAND(ID_TIGERS, OnTigers)
                     81:        ON_COMMAND(ID_TODOPARAMETRIZE, OnTodoparametrize)
1.1       noro       82:        //}}AFX_MSG_MAP
                     83:        // 標準印刷コマンド
                     84: //     ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
                     85: //     ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
                     86: //     ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
                     87: END_MESSAGE_MAP()
                     88:
                     89: /////////////////////////////////////////////////////////////////////////////
                     90: // CAsir32guiView クラスの構築/消滅
                     91:
                     92: CAsir32guiView::CAsir32guiView()
                     93: {
                     94:        // TODO: この場所に構築用のコードを追加してください。
                     95:        static int tmpView_created = 0;
                     96:        char errmsg[BUFSIZ];
                     97:
                     98:        init_input_history();
                     99:        read_input_history();
                    100:        DebugMode = 0;
                    101:        DebugInMain = 0;
1.9       noro      102: //     MaxLineLength = 80;
1.1       noro      103:        LogStart = 0;
                    104:        Logging = 0;
                    105:        Logfp = NULL;
                    106:        ResetIndex();
                    107:        theView = this;
                    108: }
                    109:
                    110: CAsir32guiView::~CAsir32guiView()
                    111: {
                    112:        write_input_history();
                    113: }
                    114:
                    115: BOOL CAsir32guiView::PreCreateWindow(CREATESTRUCT& cs)
                    116: {
                    117:        // TODO: この位置で CREATESTRUCT cs を修正して Window クラスまたはスタイルを
                    118:        //       修正してください。
                    119:
                    120:        m_dwDefaultStyle = dwStyleDefault & ~ES_AUTOHSCROLL ;
                    121:        m_dwDefaultStyle &= ~WS_HSCROLL;
                    122:        return CCtrlView::PreCreateWindow(cs);
                    123: }
                    124:
                    125: /////////////////////////////////////////////////////////////////////////////
                    126: // CAsir32guiView クラスの描画
                    127:
                    128: void CAsir32guiView::OnDraw(CDC* pDC)
                    129: {
                    130:        CAsir32guiDoc* pDoc = GetDocument();
                    131:        ASSERT_VALID(pDoc);
                    132:
                    133:        // TODO: この場所にネイティブ データ用の描画コードを追加します。
                    134: }
                    135:
                    136: /////////////////////////////////////////////////////////////////////////////
                    137: // CAsir32guiView クラスの印刷
                    138:
                    139: BOOL CAsir32guiView::OnPreparePrinting(CPrintInfo* pInfo)
                    140: {
                    141:        // デフォルトの印刷準備
                    142:        return DoPreparePrinting(pInfo);
                    143: }
                    144:
                    145: void CAsir32guiView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
                    146: {
                    147:        // TODO: 印刷前の特別な初期化処理を追加してください。
                    148: }
                    149:
                    150: void CAsir32guiView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
                    151: {
                    152:        // TODO: 印刷後の後処理を追加してください。
                    153: }
                    154:
                    155: /////////////////////////////////////////////////////////////////////////////
                    156: // CAsir32guiView クラスの診断
                    157:
                    158: #ifdef _DEBUG
                    159: void CAsir32guiView::AssertValid() const
                    160: {
                    161:        CEditView::AssertValid();
                    162: }
                    163:
                    164: void CAsir32guiView::Dump(CDumpContext& dc) const
                    165: {
                    166:        CEditView::Dump(dc);
                    167: }
                    168:
                    169: CAsir32guiDoc* CAsir32guiView::GetDocument() // 非デバッグ バージョンはインラインです。
                    170: {
                    171:        ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAsir32guiDoc)));
                    172:        return (CAsir32guiDoc*)m_pDocument;
                    173: }
                    174: #endif //_DEBUG
                    175:
                    176: /////////////////////////////////////////////////////////////////////////////
                    177: // CAsir32guiView クラスのメッセージ ハンドラ
                    178:
                    179: void CAsir32guiView::PutChar(int c)
                    180: {
1.8       noro      181:   int i,len;
1.1       noro      182:   char buf[2];
                    183:
1.8       noro      184:   if ( EndPos >= sizeof(Buffer)-1 ) {
                    185:       Beep(); return;
                    186:   }
1.1       noro      187:   for ( i = EndPos-1; i >= CurrentPos; i-- )
1.8       noro      188:       Buffer[i+1] = Buffer[i];
1.1       noro      189:   Buffer[CurrentPos] = (char)c;
1.8       noro      190: //  buf[0] = (char)c; buf[1] = 0;
                    191: //  Insert(buf,FALSE);
                    192:   len = GetWindowTextLength();
                    193:   if ( len+1 >= TextBufferSize )
                    194:       DeleteTop();
                    195:   CEditView::OnChar(c, 1, 0);
1.1       noro      196:   CurrentPos++;
                    197:   EndPos++;
                    198: }
                    199:
                    200: void CAsir32guiView::DeleteChar(int count) {
                    201:   int i,s,e;
                    202:   char null = 0;
                    203:
                    204:   if ( count > (EndPos-CurrentPos) )
                    205:     count = EndPos - CurrentPos;
                    206:   if ( count == 0 )
                    207:     Beep();
                    208:   else {
                    209:     EndPos -= count;
                    210:     for ( i = CurrentPos; i < EndPos; i++ )
                    211:       Buffer[i] = Buffer[i+count];
                    212:     GetEditCtrl().GetSel(s,e);
                    213:     GetEditCtrl().SetSel(s,s+count);
                    214:     GetEditCtrl().ReplaceSel(&null);
                    215:   }
                    216: }
                    217:
                    218: void CAsir32guiView::Insert(char *buf,BOOL wrap)
                    219: {
                    220:        char t[BUFSIZ*4];
                    221:        char *p,*q,c;
                    222:        int len;
                    223:        int i;
                    224:
                    225:        if ( wrap ) {
                    226:                i = GetEditCtrl().LineLength(-1);
                    227:                for ( p = t, q = buf; (c = *p++ = *q++) != 0; )
                    228:                        if ( c == '\r' ) {
                    229:                                *p++ = *q++; i = 0;
                    230:                        } else if ( (*q != '\r') && (++i == MaxLineLength) ) {
                    231:                                *p++ = '\r'; *p++ = '\r'; *p++ = '\n'; i = 0;
                    232:                        }
                    233:                p = t;
                    234:        } else
                    235:                p = buf;
                    236:        len = GetWindowTextLength();
                    237:        if ( strlen(p) + len >= TextBufferSize )
                    238:                DeleteTop();
                    239:        GetEditCtrl().ReplaceSel(p);
                    240: }
                    241:
                    242: void CAsir32guiView::DeleteTop()
                    243: {
                    244:   const char *p,*q;
                    245:   const char *buf;
                    246:   char null = 0;
                    247:   int len,len0,len1;
                    248:
                    249:   buf = LockBuffer();
                    250:   len0 = len = strlen(buf);
                    251:   for ( p = buf; len >= TextBufferSize/2; ) {
                    252:     q = strchr(p,'\n');
                    253:     if ( !q ) {
                    254:        len = 0; break;
                    255:     } else {
                    256:       q++; len -= (q-p); p = q;
                    257:     }
                    258:   }
                    259:   if ( Logging ) {
1.4       noro      260:     if ( len < LogStart )
                    261:        LogStart -= len;
                    262:     else {
                    263:        fwrite(buf+LogStart,1,len-LogStart,Logfp);
                    264:        LogStart = 0;
                    265:     }
1.1       noro      266:   }
                    267:   UnlockBuffer();
                    268:   if ( q ) {
                    269:        GetEditCtrl().SetSel(0,len);
                    270:        GetEditCtrl().ReplaceSel(&null);
                    271:   }
                    272:   UpdateCursor(EndPos);
                    273: }
                    274:
                    275: void CAsir32guiView::UpdateCursor(int pos)
                    276: {
                    277:   int s;
                    278:   int len;
                    279:
                    280:   if ( pos < 0 || pos > EndPos )
                    281:     Beep();
                    282:   else {
                    283:     len = GetWindowTextLength();
                    284:     CurrentPos = pos;
                    285:     s = len-EndPos+CurrentPos;
                    286:     GetEditCtrl().SetSel(s,s);
                    287:   }
                    288: }
                    289:
                    290: void CAsir32guiView::ReplaceString(char *str)
                    291: {
                    292:   UpdateCursor(0); DeleteChar(EndPos);
                    293:   Insert(str,FALSE);
                    294:   strcpy(Buffer,str);
                    295:   EndPos = CurrentPos = strlen(str);
                    296: }
                    297:
                    298: void CAsir32guiView::Beep(void) {
                    299:   ::MessageBeep(0xffffffff);
                    300: }
                    301:
                    302: void CAsir32guiView::Paste(void) {
1.8       noro      303:     char buf[2*BUFSIZ];
                    304:     const char *src;
                    305:     char c;
                    306:     int i,j,l;
                    307:     HGLOBAL hClip;
                    308:
                    309:     if ( asirgui_kind == ASIRGUI_MESSAGE ) {
                    310:         Beep(); return;
                    311:     }
1.2       noro      312:
1.8       noro      313:     if ( OpenClipboard() == FALSE ) {
                    314:         Beep(); return;
1.1       noro      315:     }
                    316:     hClip = GetClipboardData(CF_TEXT);
                    317:     src = (const char *)::GlobalLock(hClip);
1.10      noro      318:     if ( !src || (l=strlen(src)) >= sizeof(Buffer)-EndPos ) {
1.1       noro      319:        ::CloseClipboard();
                    320:        Beep(); return;
                    321:     }
1.8       noro      322:     for ( i = j = 0; i < l; i++ )
                    323:         if ( (c = src[i]) != '\n' && c != '\r' )
                    324:              buf[j++] = c;
                    325:     buf[j] = 0;
1.1       noro      326:     ::GlobalUnlock(hClip);
                    327:     ::CloseClipboard();
                    328:     GetEditCtrl().ReplaceSel(buf);
1.10      noro      329:     l = strlen(buf);
                    330:     for ( i = EndPos-1; i >= CurrentPos; i-- )
                    331:        Buffer[i+l] = Buffer[i];
                    332:     for ( j = 0, i = CurrentPos; j < l; j++, i++ )
                    333:        Buffer[i] = buf[j];
                    334:     EndPos += l; CurrentPos += l;
1.1       noro      335: }
                    336:
                    337: #define CTRL(c) (c)&0x1f
                    338:
                    339: void CAsir32guiView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
                    340: {
                    341:        // TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
                    342:        char *exp_result;
                    343:
                    344:        switch ( nChar ) {
                    345:                case VK_LEFT:
                    346:                        UpdateCursor(CurrentPos-1); return;
                    347:                case VK_RIGHT:
                    348:                        UpdateCursor(CurrentPos+1); return;
                    349:                case VK_DELETE:
                    350:                        DeleteChar(1); return;
                    351:                case VK_UP:
                    352:                        if ( (exp_result = prev_hist()) != 0 )
                    353:                                ReplaceString(exp_result);
                    354:                        else
                    355:                                Beep();
                    356:                        return;
                    357:                case VK_DOWN:
                    358:                        if ( (exp_result = next_hist()) != 0 )
                    359:                                ReplaceString(exp_result);
                    360:                        else
                    361:                                Beep();
                    362:                        return;
                    363:                default:
                    364:                        break;
                    365:        }
                    366:        CEditView::OnKeyDown(nChar, nRepCnt, nFlags);
                    367: }
                    368:
                    369: void CAsir32guiView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
                    370: {
                    371:        // TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
                    372:        char *exp_result;
1.13      noro      373:        char tmp[BUFSIZ];
1.1       noro      374:
1.2       noro      375:        if ( asirgui_kind == ASIRGUI_MESSAGE ) {
                    376:                Beep(); return;
                    377:        }
                    378:
1.1       noro      379:        switch ( nChar ) {
                    380:        case CTRL('M'): case CTRL('J'):
                    381:                UpdateCursor(EndPos);
                    382:                Buffer[EndPos] = 0;
                    383:                reset_traverse();
                    384:                if ( Buffer[0] == '!' ) {
                    385:                exp_result = search_hist(Buffer+1);
                    386:                if ( exp_result )
                    387:                        ReplaceString(exp_result);
                    388:                else {
                    389:                        UpdateCursor(0); DeleteChar(EndPos); Beep();
                    390:                }
                    391:                return;
                    392:                } else {
                    393:                        add_hist(Buffer);
                    394:                        put_line(Buffer);
                    395:                        ResetIndex();
                    396:                        nChar = CTRL('M');
                    397:                }
                    398:                break;
                    399:        case CTRL('N'):
                    400:                if ( (exp_result = next_hist()) != 0 )
                    401:                ReplaceString(exp_result);
                    402:                else
                    403:                Beep();
                    404:                return;
                    405:        case CTRL('P'):
                    406:                if ( (exp_result = prev_hist()) != 0 )
                    407:                ReplaceString(exp_result);
                    408:                else
                    409:                Beep();
                    410:                return;
                    411:        case CTRL('A'):
                    412:                UpdateCursor(0); return;
                    413:        case CTRL('E'):
                    414:                UpdateCursor(EndPos); return;
                    415:        case CTRL('F'):
                    416:                UpdateCursor(CurrentPos+1); return;
                    417:        case CTRL('B'):
                    418:                UpdateCursor(CurrentPos-1); return;
                    419:        case CTRL('K'):
                    420:                DeleteChar(EndPos-CurrentPos); return;
                    421:        case CTRL('U'):
                    422:                UpdateCursor(0); DeleteChar(EndPos); return;
                    423:        case CTRL('D'):
                    424:                DeleteChar(1); return;
                    425:        case CTRL('H'):
                    426:                if ( CurrentPos > 0 ) {
                    427:                UpdateCursor(CurrentPos-1); DeleteChar(1);
                    428:                } else
                    429:                Beep();
                    430:                return;
                    431:        case CTRL('C'):
                    432:                send_intr();
                    433:                /* wake up the engine */
1.13      noro      434:                tmp[0] = 0;
                    435:                put_line(tmp);
1.1       noro      436:                return;
                    437:        default :
                    438:                if ( nChar >= 0x20 && nChar < 0x7f )
                    439:                        PutChar(nChar);
                    440:                else
                    441:                        Beep();
                    442:                return;
                    443:        }
                    444:        CEditView::OnChar(nChar, nRepCnt, nFlags);
                    445: }
                    446:
                    447: void CAsir32guiView::OnLButtonUp(UINT nFlags, CPoint point)
                    448: {
                    449:        // TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
                    450:     GetEditCtrl().Copy(); UpdateCursor(EndPos);
                    451:        CEditView::OnLButtonUp(nFlags, point);
                    452: }
                    453:
                    454: void CAsir32guiView::OnRButtonDown(UINT nFlags, CPoint point)
                    455: {
                    456:        // TODO: この位置にメッセージ ハンドラ用のコードを追加するかまたはデフォルトの処理を呼び出してください
                    457:     Paste();
                    458:
                    459: //     CEditView::OnRButtonDown(nFlags, point);
                    460: }
                    461:
                    462: void CAsir32guiView::OnFileOpen()
                    463: {
                    464:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    465:        char cmd[BUFSIZ*2]; // XXX
                    466:        char *p;
1.3       noro      467:        static char errmsg[BUFSIZ];
                    468:        static char prevdir[BUFSIZ];
1.1       noro      469:
1.3       noro      470:        if ( !prevdir[0] ) {
                    471:                get_rootdir(prevdir,sizeof(prevdir),errmsg);
                    472:                strcat(prevdir,"\\lib");
                    473:        }
                    474:
                    475:        _chdir(prevdir);
1.1       noro      476:        CFileDialog     fileDialog(TRUE);
1.14    ! noro      477:        fileDialog.m_ofn.lpstrInitialDir = prevdir;
1.1       noro      478:        if ( fileDialog.DoModal() == IDOK ) {
                    479:                CString pathName = fileDialog.GetPathName();
                    480:                sprintf(cmd,"load(\"%s\");",pathName);
                    481:                for ( p = cmd; *p; p++ )
                    482:                        if ( *p == '\\' )
                    483:                                *p = '/';
                    484:                put_line(cmd);
1.3       noro      485:                p = strrchr(pathName,'\\');
                    486:                if ( p ) {
                    487:                        *p = 0;
                    488:                        strcpy(prevdir,pathName);
                    489:                }
1.1       noro      490:        }
                    491: }
                    492:
                    493: void CAsir32guiView::OnAsirhelp()
                    494: {
                    495:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    496:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    497:
                    498:        get_rootdir(root,sizeof(root),errmsg);
1.11      noro      499:        sprintf(helpfile,"%s\\help\\asirhelp.chm",root);
1.12      noro      500:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.1       noro      501: }
                    502:
                    503: void CAsir32guiView::OnFileLog()
                    504: {
                    505:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    506:        if ( !Logging ) {
                    507:                CFileDialog     fileDialog(TRUE);
                    508:                if ( fileDialog.DoModal() == IDOK ) {
                    509:                        CString logfile = fileDialog.GetPathName();
                    510:                        Logfp = fopen(logfile,"ab");
                    511:                        if ( Logfp ) {
                    512:                                LogStart = GetWindowTextLength();
                    513:                                Logging = 1;
                    514:                        }
                    515:                }
                    516:        } else {
                    517:                const char *buf;
                    518:                buf = LockBuffer();
                    519:                fwrite(buf+LogStart,1,strlen(buf)-LogStart,Logfp);
                    520:                UnlockBuffer();
                    521:                fclose(Logfp);
                    522:                Logging = 0;
                    523:        }
                    524: }
                    525:
                    526: void CAsir32guiView::OnUpdateFileLog(CCmdUI* pCmdUI)
                    527: {
                    528:        // TODO: この位置に command update UI ハンドラ用のコードを追加してください
                    529:        if ( Logging )
                    530:                pCmdUI->SetCheck(1);
                    531:        else
                    532:                pCmdUI->SetCheck(0);
                    533: }
                    534:
                    535: void CAsir32guiView::OnEditPaste()
                    536: {
                    537:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    538:     Paste();
1.3       noro      539: }
                    540:
1.9       noro      541: void CAsir32guiView::UpdateMetrics()
                    542: {
                    543:    TEXTMETRIC tm;
                    544:    RECT r;
                    545:
                    546:    GetEditCtrl().GetRect(&r);
                    547:    CDC *pDC = GetDC();
                    548:    pDC->SelectObject(GetFont());
                    549:    pDC->GetTextMetrics(&tm);
                    550:    MaxLineLength = (r.right-r.left)/tm.tmAveCharWidth-1;
                    551: }
                    552:
1.3       noro      553: void CAsir32guiView::OnFont()
                    554: {
                    555:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    556:        int ret;
1.9       noro      557:        LOGFONT lf;
                    558:
                    559:        GetFont()->GetLogFont(&lf);
                    560:        CFontDialog fd(&lf,CF_EFFECTS | CF_SCREENFONTS | CF_FIXEDPITCHONLY);
1.3       noro      561:        static CFont *f = 0;
                    562:
                    563:        ret = fd.DoModal();
                    564:        if ( ret == IDOK ) {
                    565:                fd.GetCurrentFont(&lf);
                    566:                if ( f )
                    567:                        delete f;
                    568:                f = new CFont;
                    569:                f->CreateFontIndirect(&lf);
                    570:                SetFont(f);
1.9       noro      571:                UpdateMetrics();
1.3       noro      572:        }
                    573: }
                    574:
                    575: int CAsir32guiView::OnCreate(LPCREATESTRUCT lpCreateStruct)
                    576: {
                    577:        if (CEditView::OnCreate(lpCreateStruct) == -1)
                    578:                return -1;
                    579:
                    580:        // TODO: この位置に固有の作成用コードを追加してください
1.9       noro      581:
1.3       noro      582:        LOGFONT logFont; memset(&logFont, 0, sizeof(LOGFONT));
                    583:        logFont.lfHeight = 20;
                    584:        logFont.lfCharSet = DEFAULT_CHARSET;
                    585:        strcpy(logFont.lfFaceName, "Terminal");
                    586:        CFont *f = new CFont;
                    587:        f->CreateFontIndirect(&logFont);
                    588:        SetFont(f);
1.9       noro      589:        UpdateMetrics();
1.3       noro      590:        GetEditCtrl().LimitText(nMaxSize);
1.9       noro      591:        GetEditCtrl().SetTabStops(m_nTabStops);
1.3       noro      592:
                    593:        return 0;
1.6       noro      594: }
                    595:
                    596: void CAsir32guiView::OnContribhelp()
                    597: {
                    598:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    599:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    600:
                    601:        get_rootdir(root,sizeof(root),errmsg);
1.11      noro      602:        sprintf(helpfile,"%s\\help\\cmanhelp.chm",root);
1.12      noro      603:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.6       noro      604: }
                    605:
1.11      noro      606: void CAsir32guiView::OnSize(UINT nType, int cx, int cy)
                    607: {
                    608:        CEditView::OnSize(nType, cx, cy);
                    609:
                    610:        // TODO: この位置にメッセージ ハンドラ用のコードを追加してください
                    611:        UpdateMetrics();
                    612: }
                    613:
                    614: void CAsir32guiView::OnDsolv()
                    615: {
                    616:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    617:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    618:
                    619:        get_rootdir(root,sizeof(root),errmsg);
                    620:        sprintf(helpfile,"%s\\help\\dsolvhelp.chm",root);
1.12      noro      621:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      622: }
                    623:
                    624: void CAsir32guiView::OnGnuplot()
                    625: {
                    626:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    627:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    628:
                    629:        get_rootdir(root,sizeof(root),errmsg);
                    630:        sprintf(helpfile,"%s\\help\\gnuplothelp.chm",root);
1.12      noro      631:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      632:
                    633: }
                    634:
                    635: void CAsir32guiView::OnOkdiff()
                    636: {
                    637:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    638:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    639:
                    640:        get_rootdir(root,sizeof(root),errmsg);
                    641:        sprintf(helpfile,"%s\\help\\ok_diffhelp.chm",root);
1.12      noro      642:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      643:
                    644: }
                    645:
                    646: void CAsir32guiView::OnOkdmodule()
                    647: {
                    648:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    649:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    650:
                    651:        get_rootdir(root,sizeof(root),errmsg);
                    652:        sprintf(helpfile,"%s\\help\\ok_dmodulehelp.chm",root);
1.12      noro      653:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      654:
                    655: }
                    656:
                    657: void CAsir32guiView::OnOm()
                    658: {
                    659:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    660:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    661:
                    662:        get_rootdir(root,sizeof(root),errmsg);
                    663:        sprintf(helpfile,"%s\\help\\omhelp.chm",root);
1.12      noro      664:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      665:
                    666: }
                    667:
                    668: void CAsir32guiView::OnPfpcoh()
                    669: {
                    670:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    671:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    672:
                    673:        get_rootdir(root,sizeof(root),errmsg);
                    674:        sprintf(helpfile,"%s\\help\\pfpcohhelp.chm",root);
1.12      noro      675:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      676:
                    677: }
                    678:
                    679: void CAsir32guiView::OnPlucker()
                    680: {
                    681:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    682:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    683:
                    684:        get_rootdir(root,sizeof(root),errmsg);
                    685:        sprintf(helpfile,"%s\\help\\pluckerhelp.chm",root);
1.12      noro      686:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      687:
                    688: }
                    689:
                    690: void CAsir32guiView::OnSm1()
                    691: {
                    692:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    693:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    694:
                    695:        get_rootdir(root,sizeof(root),errmsg);
                    696:        sprintf(helpfile,"%s\\help\\sm1help.chm",root);
1.12      noro      697:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      698:
                    699: }
                    700:
                    701: void CAsir32guiView::OnTigers()
1.6       noro      702: {
1.11      noro      703:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
1.6       noro      704:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    705:
1.11      noro      706:        get_rootdir(root,sizeof(root),errmsg);
                    707:        sprintf(helpfile,"%s\\help\\tigershelp.chm",root);
1.12      noro      708:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.11      noro      709:
1.9       noro      710: }
                    711:
1.11      noro      712: void CAsir32guiView::OnTodoparametrize()
1.9       noro      713: {
1.11      noro      714:        // TODO: この位置にコマンド ハンドラ用のコードを追加してください
                    715:        char root[BUFSIZ],errmsg[BUFSIZ],helpfile[BUFSIZ];
                    716:
                    717:        get_rootdir(root,sizeof(root),errmsg);
                    718:        sprintf(helpfile,"%s\\help\\todo_parametrizehelp.chm",root);
1.12      noro      719:        ::HtmlHelp(NULL, helpfile, HH_DISPLAY_TOPIC, 0);
1.9       noro      720:
1.1       noro      721: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>