[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.31

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

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