void Profile::Save() { if( strPath == "") { char pszPath[ MAX_PATH] ; GetModuleFileName( NULL, pszPath, MAX_PATH) ; strPath = pszPath ; strPath.replace( strPath.rfind( "."), 4, ".ini", 5) ; } const char* pszFile = strPath.c_str() ; // リスト WritePrivateProfileString( "list", "FullPath", blnFullPath ? "yes" : "no", pszFile) ; WritePrivateProfileString( "list", "OnlyMp3", blnOnlyMp3 ? "yes" : "no", pszFile) ; // 場所 WriteProfile( pszFile, "pos", "x", intX) ; WriteProfile( pszFile, "pos", "y", intY) ; // 設定 WriteProfile( pszFile, "DefaultPath", "folder", intFolder) ; WriteProfile( pszFile, "DefaultPath", "file", intFile) ; WritePrivateProfileString( "DefaultPath", "Extension", strExtension.c_str(), pszFile) ; WritePrivateProfileString( "DefaultPath", "FilePath", strFile.c_str(), pszFile) ; WritePrivateProfileString( "DefaultPath", "FolderPath", strFolder.c_str(), pszFile) ; WritePrivateProfileString( "Dialog", "DisplayLog", blnDisplayLog ? "yes" : "no", pszFile) ; WritePrivateProfileString( "Dialog", "FailLogOnly", blnFailLogOnly ? "yes" : "no", pszFile) ; WritePrivateProfileString( "Dialog", "ConfirmOverwrite", blnConfirmOverwrite ? "yes" : "no", pszFile) ; WritePrivateProfileString( "other", "ClearOnSuccess", blnClearOnSuccess ? "yes" : "no", pszFile) ; }
BOOL CLinkBarPropertyPage::OnApply() { if ( DoDataExchange(DDX_SAVE) ) { WriteProfile(); m_rLinkBarCtrl.Refresh(); return TRUE; } else return FALSE; }
void CMainPropertyPage::_GetData() { // Update main style CMainOption::s_dwMainExtendedStyle = 0; if (m_nNewWindow /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_NEWWINDOW; if (m_nNoActivate /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_NOACTIVATE; if (m_nNoActivateNewWin /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_NOACTIVATE_NEWWIN; if (m_nOneInstance /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_ONEINSTANCE; if (m_nLimit /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_WINDOWLIMIT; if (m_nNoCloseDFG /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_NOCLOSEDFG; if (m_nNoMDI /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_NOMDI; if (m_nBackUp /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_BACKUP; if (m_nAddFavoriteOldShell /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_ADDFAVORITEOLDSHELL; if (m_nOrgFavoriteOldShell /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_ORGFAVORITEOLDSHELL; if (m_nRegisterAsBrowser /*== 1*/) { CMainOption::s_dwMainExtendedStyle |= MAIN_EX_REGISTER_AS_BROWSER; MtlSendOnCommand(m_wnd, ID_REGISTER_AS_BROWSER); } else { MtlSendOffCommand(m_wnd, ID_REGISTER_AS_BROWSER); } if (m_nLoadGlobalOffline /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_LOADGLOBALOFFLINE; if (m_nKillDialog /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_KILLDIALOG; if (m_nInheritOptions /*== 1*/) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_INHERIT_OPTIONS; //+++ if (m_nNoCloseNL ) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_NOCLOSE_NAVILOCK; //+++ 追加 #if 0 //* あとで ie_coInternetSetFeatureEnabled(FEATURE_SECURITYBAND , SET_FEATURE_ON_PROCESS, m_nKillDialog); //+++ #endif if (s_bIgnore_blank) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_IGNORE_BLANK; if (s_bUseCustomFindBar) CMainOption::s_dwMainExtendedStyle |= MAIN_EX_USECUSTOMFINDBER; if (s_bExternalNewTab) { CMainOption::s_dwMainExtendedStyle |= MAIN_EX_EXTERNALNEWTAB; if (s_bExternalNewTabActive) { CMainOption::s_dwMainExtendedStyle |= MAIN_EX_EXTERNALNEWTABACTIVE; } } // update max window count CMainOption::s_dwMaxWindowCount = m_nMaxWindowCount; CMainOption::s_dwBackUpTime = m_nBackUpTime; // UDT DGSTR ( dai m_nAutoRefreshTime = m_nAutoRefTimeMin * 60 + m_nAutoRefTimeSec; CMainOption::s_dwAutoRefreshTime = m_nAutoRefreshTime; // ENDE m_wnd.PostMessage(WM_COMMAND, ID_BACKUPOPTION_CHANGED); CIniFileO pr( g_szIniFileName, _T("Main") ); m_lf.WriteProfile(pr); WriteProfile(); }
void CMainPropertyPage2::_GetData() { CIniFileO pr( g_szIniFileName, _T("StatusBar") ); pr.SetValue( MAKELONG(m_nSzPain1, m_nSzPain2), _T("SizePain") ); pr.SetValue( m_nChkSwapPain , _T("SwapPain") ); //x pr.Close(); //+++ //x CIniFileO pr( g_szIniFileName, _T("FullScreen") ); pr.ChangeSectionName( _T("FullScreen") ); pr.SetValue( m_nShowMenu , _T("ShowMenu") ); pr.SetValue( m_nShowToolBar , _T("ShowToolBar") ); pr.SetValue( m_nShowAdress , _T("ShowAdress") ); pr.SetValue( m_nShowTab , _T("ShowTab") ); pr.SetValue( m_nShowLink , _T("ShowLink") ); pr.SetValue( m_nShowSearch , _T("ShowSearch") ); pr.SetValue( m_nShowStatus , _T("ShowStatus") ); //pr.Close(); CMainOption::s_bTravelLogGroup = m_nTravelLogGroup != 0; //+++ ? true : false; CMainOption::s_bTravelLogClose = m_nTravelLogClose != 0; //+++ ? true : false; m_rRecentClosedTabList.ResetMenu(); m_rRecentClosedTabList.SetMaxEntries(s_nMaxRecentClosedTabCount); m_rRecentClosedTabList.SetMenuType(s_RecentClosedTabMenuType); m_rRecentClosedTabList.UpdateMenu(); #if 0 //+++ 失敗 if (m_nTitleBarStrSwap) CMainOption::s_dwMainExtendedStyle2 |= MAIN_EX2_TITLEBAR_STR_SWAP; //+++ 追加. else CMainOption::s_dwMainExtendedStyle2 &= ~MAIN_EX2_TITLEBAR_STR_SWAP; //+++ 追加. #endif #if 1 //+++ 別のオプションが管理している変数を間借りして追加...やめ.. やっぱり復活 CMainOption::s_dwMainExtendedStyle2 &= ~(MAIN_EX2_CLOSEBTN2TRAY|MAIN_EX2_MINBTN2TRAY); if (m_nMinBtn2Tray == 2) CMainOption::s_dwMainExtendedStyle2 |= MAIN_EX2_CLOSEBTN2TRAY; else if (m_nMinBtn2Tray == 1) CMainOption::s_dwMainExtendedStyle2 |= MAIN_EX2_MINBTN2TRAY; #endif WriteProfile(); }
static void OnSaveExistingClicked(WindowControl * Sender) { (void)Sender; int file_index; TCHAR file_name[MAX_PATH]; WndProperty* wp; DataFieldFileReader *dfe; if ( CheckClubVersion() ) { ClubForbiddenMsg(); return; } wp = (WndProperty*)wf->FindByName(TEXT("prpFile")); if (!wp) return; HWND hwnd = wp->GetHandle(); SendMessage(hwnd,WM_LBUTTONDOWN,0,0); dfe = (DataFieldFileReader*) wp->GetDataField(); file_index = dfe->GetAsInteger(); if (file_index>0) { _tcscpy(file_name,dfe->GetAsString()); if(MessageBoxX(hWndMapWindow, file_name, // LKTOKEN _@M509_ = "Overwrite profile?" gettext(TEXT("_@M509_")), MB_YESNO|MB_ICONQUESTION) == IDYES) { WriteProfile(dfe->GetPathFile()); // LKTOKEN _@M535_ = "Profile saved!" MessageBoxX(hWndMapWindow, gettext(TEXT("_@M535_")),_T(""), MB_OK|MB_ICONEXCLAMATION); return; } dfe->Set(0); } }
///////////////////////////////////////////////////////////////////////////// // 分析单个行 // 语法规则: // 1.可以有若干个设置项,用";"隔开 // 2.添加列: ADDCOLUMN name,width,format // 3.删除列: DELCOLUMN nCol|all // 4.删除行: DELITEM nItem|all // 5.设置分割符: SEPARATOR=??? // 6.设置所有行的颜色: SETROWCOLORS cText cTextBk // 7.设置颜色表的某个颜色: SETCOLORTABLE index color // 8.修改控件风格: MODIFYSTYLE ADD|REMOVE style // 9.从注册表读取列信息: READPROFILE Section, Entry // 10.向注册表写入列信息: WRITEPROFILE Section, Entry // 11.设置窗口关闭时执行的脚本: SETCLOSESCRIPT script // 12.设置字体: SETFONT font size ///////////////////////////////////////////////////////////////////////////// void CTreeOutCtrl::ParseALine(CString strLine) { CString strSet = strLine; strSet.MakeUpper(); int pos; if((pos = strSet.Find("ADDCOLUMN ")) == 0) // 添加列 { CString strColName; CString strFormat = _T("LEFT"); strSet = strLine.Right(strLine.GetLength()-10); int nPos = strSet.Find(","); strColName = strSet.Left(nPos); strSet = strSet.Right(strSet.GetLength()-nPos-1); // 解析列宽度 nPos = strSet.Find(","); if(nPos != -1) { strFormat = strSet.Right(strSet.GetLength()-nPos-1); strFormat.MakeUpper(); strSet = strSet.Left(nPos); } int nWidth = atoi(strSet); RVSUBITEM rvs; rvs.nFormat = RVCF_TEXT|RVCF_EX_TOOLTIP|RVCF_EX_PERSISTENT; if(strFormat == _T("CENTER")) { rvs.nFormat |= RVCF_CENTER; } else if(strFormat == _T("RIGHT")) { rvs.nFormat |= RVCF_RIGHT; } rvs.lpszText = strColName.GetBuffer(strColName.GetLength()+1); rvs.iWidth = nWidth; int nSubItem = GetActiveSubItemCount(); DefineSubItem(nSubItem, &rvs, TRUE); ActivateSubItem(nSubItem, nSubItem); strColName.ReleaseBuffer(); } else if((pos = strSet.Find("DELCOLUMN ")) == 0) // 删除列 { strSet = strSet.Right(strSet.GetLength()-10); if(strSet == _T("ALL")) { UndefineAllSubItems(); m_asItemScript.RemoveAll(); } else { int nCol = atoi(strSet); UndefineSubItem(nCol); if(GetActiveSubItemCount() == 0) { m_asItemScript.RemoveAll(); } } } else if((pos = strSet.Find("DELITEM ")) == 0) // 删除行 { strSet = strSet.Right(strSet.GetLength()-8); if(strSet == _T("ALL")) { DeleteAllItems(); m_asItemScript.RemoveAll(); } else { int nItem = atoi(strSet); HTREEITEM hItem = GetItemHandle(nItem); DeleteItem(hItem); if(GetItemCount() == 0) { m_asItemScript.RemoveAll(); } } } else if((pos = strSet.Find("SEPARATOR=")) == 0) // 设置分割符 { m_strSeparator = strLine.Right(strLine.GetLength()-10); } else if((pos = strSet.Find("SETROWCOLORS ")) == 0) // 设置所有行颜色 { strSet = strSet.Right(strSet.GetLength()-13); CString strBkColor = _T(""); int nPos = strSet.Find(" "); if(nPos != -1) { strBkColor = strSet.Right(strSet.GetLength()-nPos-1); strSet = strSet.Left(nPos); } COLORREF cText = RGB(0,0,0); COLORREF cTextBk = RGB(255,255,255); int nPos1; if((nPos1 = strSet.Find("RGB(")) == 0) { strSet = strSet.Right(strSet.GetLength()-pos-4); strSet.Delete(strSet.GetLength()-1, 1); nPos1 = strSet.Find(","); CString strTmp = strSet.Left(nPos1); int nr = atoi(strTmp); strSet = strSet.Mid(nPos1 + 1, strSet.GetLength() - nPos1 -1); nPos1 = strSet.Find(","); strTmp = strSet.Left(nPos1); int ng = atoi(strTmp); strTmp = strSet.Mid(nPos1 + 1, strSet.GetLength() - nPos1 -1); int nb = atoi(strTmp); cText = RGB(nr, ng, nb); } strSet = strBkColor; if((nPos1 = strSet.Find("RGB(")) == 0) { strSet = strSet.Right(strSet.GetLength()-pos-4); strSet.Delete(strSet.GetLength()-1, 1); nPos1 = strSet.Find(","); CString strTmp = strSet.Left(nPos1); int nr = atoi(strTmp); strSet = strSet.Mid(nPos1 + 1, strSet.GetLength() - nPos1 -1); nPos1 = strSet.Find(","); strTmp = strSet.Left(nPos1); int ng = atoi(strTmp); strTmp = strSet.Mid(nPos1 + 1, strSet.GetLength() - nPos1 -1); int nb = atoi(strTmp); cTextBk = RGB(nr, ng, nb); } SetRowColors(cText, cTextBk); } else if((pos = strSet.Find("SETCOLORTABLE ")) == 0) // 设置颜色表的某个颜色 { strSet = strSet.Right(strSet.GetLength()-14); int nIndex = 0; int nPos = strSet.Find(" "); if(nPos != -1) { CString strIndex = strSet.Left(nPos); nIndex = atoi(strIndex); if(nIndex<0 || nIndex>9) return; strSet.Delete(0, nPos+1); } if(strSet.Find("RGB(") == 0) { strSet = strSet.Right(strSet.GetLength()-pos-4); strSet.Delete(strSet.GetLength()-1, 1); int nPos1 = strSet.Find(","); CString strTmp = strSet.Left(nPos1); int nr = atoi(strTmp); strSet = strSet.Mid(nPos1 + 1, strSet.GetLength() - nPos1 -1); nPos1 = strSet.Find(","); strTmp = strSet.Left(nPos1); int ng = atoi(strTmp); strTmp = strSet.Mid(nPos1 + 1, strSet.GetLength() - nPos1 -1); int nb = atoi(strTmp); COLORREF cColor = RGB(nr, ng, nb); SetColor(nIndex, cColor); } } else if((pos = strSet.Find("MODIFYSTYLE ")) == 0) // 修改控件风格 { strSet = strSet.Right(strSet.GetLength()-12); BOOL bAdd = TRUE; if(strSet.Find("REMOVE(") == 0) { bAdd = FALSE; strSet.Delete(0, 7); } else { strSet.Delete(0, 4); } int nPos = strSet.Find(")"); if(nPos != -1) { strSet = strSet.Left(nPos); } int nStyle = 0; while((nPos=strSet.Find("|")) != -1) { CString strStyle = strSet.Left(nPos); nStyle |= ParseStyle(strStyle); strSet.Delete(0, nPos+1); } nStyle |= ParseStyle(strSet); ModifyStyle(bAdd ? 0 : nStyle, bAdd ? nStyle : 0); } else if(strSet.Find("READPROFILE ") == 0) // 从注册表读取列信息 { strLine = strLine.Right(strLine.GetLength()-12); int nPos = strLine.Find(","); if(nPos != -1) { CString strSection = strLine.Left(nPos); CString strEntry = strLine.Right(strLine.GetLength()-nPos-1); GetProfile(strSection, strEntry); } } else if(strSet.Find("WRITEPROFILE ") == 0) // 向注册表写入列信息 { strLine = strLine.Right(strLine.GetLength()-13); int nPos = strLine.Find(","); if(nPos != -1) { CString strSection = strLine.Left(nPos); CString strEntry = strLine.Right(strLine.GetLength()-nPos-1); WriteProfile(strSection, strEntry); } } else if(strSet.Find("SETCLOSESCRIPT ") == 0) // 设置窗口关闭时执行的脚本 { m_strScriptClose = strLine.Right(strLine.GetLength()-15); } else if(strSet.Find("SETFONT ") == 0) // 设置字体 { strLine = strLine.Right(strLine.GetLength()-8); CString strFont = strLine; int nSize = 0; int nPos = strLine.Find(","); if(nPos != -1) { strFont = strLine.Left(nPos); CString strSize = strLine.Right(strLine.GetLength()-nPos-1); nSize = atoi(strSize); } SetSelfFont(strFont, nSize); } }
MRESULT EXPENTRY WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) { // static POINTS DragStartPtrPos; POINTL ptl; static char Row, Col; static BOOL HasMoved = FALSE; static BOOL IntroSoundPlayed = FALSE; static BOOL RealPaint = TRUE; // indicates whether the board // has to be repainted or just copied INT aktscan; CHAR msgtext[256]; ULONG ulResponse; // ERRORID errId; switch( msg ){ case WM_CREATE: if( !InfoData.LoadHigh() ){ // get previously saved highscores InfoData.ResetHigh(); WinMessageBox( HWND_DESKTOP, hwndMain, "The file scores.dat " \ "(which is in the current directory) was somehow corrupted." \ " All Highscores will be reset to Zero.", "Error when loading Highscores", 0, MB_OK | MB_INFORMATION ); } // allocate memory for global variables; see GLOBALS struct in tgraph.h pg = new GLOBALS; // initialize globals to zero memset( pg, 0, sizeof( GLOBALS )); // store globals pointer into client window words; see WinRegisterClass // WinSetWindowULong( hwnd, QWL_USER, (ULONG) pg ); wcprintf("1: %x", WinGetLastError( hab ) ); DosCreateEventSem( NULL, &hevWaitAfterScan, 0, FALSE ); // Sem is created in reset state DosCreateEventSem( NULL, &hevHiScoreWin, 0, FALSE ); DosCreateEventSem( NULL, &hevWaitAfterSound, 0, FALSE ); DosCreateEventSem( NULL, &hevWaitSoundReady, 0, TRUE ); // Sem is created in posted state // hevWaitAfterScan and hewWaitAfterSound are used to indicate // when the respective WM_CREATE routines are done. // after that they are in posted state, as desired // initialize globals with important data pg->hab = hab; pg->hwndClient = hwnd; pg->hwndFrame = WinQueryWindow( hwnd, QW_PARENT ); pg->hwndTitlebar = WinWindowFromID( pg->hwndFrame, FID_TITLEBAR ); pg->hwndMenubar = WinWindowFromID( pg->hwndFrame, FID_MENU ); // create graphics and sound threads pg->tidTSound = _beginthread( &threadsound, NULL, LEN_STACK, NULL ); pg->tidTGraph = _beginthread( &threadgraph, NULL, LEN_STACK, NULL ); DosWaitEventSem( hevWaitAfterSound, SEM_INDEFINITE_WAIT ); WinPostMsg( pg->hwndTSound, WM_SOUND_INTRO, MPFROMHWND(hwnd), 0 ); // wait for the sound's WM_CREATE DosWaitEventSem( hevWaitAfterScan, SEM_INDEFINITE_WAIT ); // wait for the graphics' WM_CREATE InfoData.ShipsNotFound = GBoard.GetShipNumber(); wcprintf("create: %x", WinGetLastError( hab ) ); return (MRESULT)0; case WM_CONTROL: break; case WM_QUIT: break; case WM_CLOSE: // this message is sent before WM_QUIT InfoData.SaveHigh( WinGetCurrentTime(hab) ); // save the highscores and provide a random seed // get pointer to globals from window words // pg = (PGLOBALS) WinQueryWindowULong( hwnd, QWL_USER ); // tell object windows to quit, then exit their threads // WinSendMsg( pg->hwndTGraph, WM_DESTROY, mp1, mp2 ); WinPostMsg( pg->hwndTGraph, WM_QUIT, mp1, mp2 ); // WinSendMsg( pg->hwndTSound, WM_DESTROY, mp1, mp2 ); WinPostMsg( pg->hwndTSound, WM_QUIT, mp1, mp2 ); DosCloseEventSem( hevWaitAfterScan ); DosCloseEventSem( hevHiScoreWin ); DosCloseEventSem( hevWaitAfterSound ); DosCloseEventSem( hevWaitSoundReady ); WriteProfile( hab ); delete pg; return (MRESULT) 0; case WM_ERASEBACKGROUND: wcprintf("erasebackground"); // return (MRESULT) FALSE; return (MRESULT) TRUE; case WM_PAINT: /////////////////////////////////// { RECTL rectl; WinQueryWindowRect( pg->hwndClient, &rectl ); wcprintf("Linienrechteck: Breite: %d H”he: %d", rectl.xRight, rectl.yTop ); // test size: GpiSetColor( hpsGlob, CLR_RED ); ptl.x = rectl.xLeft; ptl.y = rectl.yBottom; GpiMove( hpsGlob, &ptl ); ptl.x = rectl.xRight; ptl.y = rectl.yTop; GpiLine( hpsGlob, &ptl ); } /////////////////////////// break; case WM_SIZE: wcprintf("main wnd function wm-size"); RealPaint = TRUE; GBoard.SetPMBoardValues( SHORT1FROMMP( mp2 ), SHORT2FROMMP( mp2 ) ); WndResize( hwnd ); wcprintf("size: %x", WinGetLastError( hab ) ); break; case WM_BEGINDRAG: WinSetCapture( HWND_DESKTOP, hwnd ); // capture the mouse pointer GBoard.SetfDrag( TRUE ); // indicate that mouse is being dragged GBoard.ResetFirstDraw(); // for initialization of drag op. fHideSquare = TRUE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), MPFROM2SHORT( 0, 0 ) ); // GBoard.ShowPointerPos( hwnd, 0, 0 ); // removes the square ptl.x = SHORT1FROMMP(mp1); ptl.y = SHORT2FROMMP(mp1); Row = GBoard.GetBoardRow( ptl.y ); // starting point of drag Col = GBoard.GetBoardCol( ptl.x ); // operation; static! return (MRESULT)TRUE; case WM_MOUSEMOVE: if( GBoard.GetfDrag() ){ // if mouse is being dragged WinSendMsg( pg->hwndTGraph, WM_DRAWDRAGLINE, mp1, MPFROM2SHORT( Row, Col ) ); HasMoved = TRUE; } else { // mouse is moved normally if( !fHideSquare ) WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), mp1 ); // GBoard.ShowPointerPos( hwnd, SHORT1FROMMP(mp1), // SHORT2FROMMP(mp1)); } break; case WM_ENDDRAG: WinSetCapture( HWND_DESKTOP, NULLHANDLE ); // release the captured // mouse pointer if( HasMoved ){ // mousemove has actually been moved WinSendMsg( pg->hwndTGraph, WM_MARKDRAGLINE, MPFROM2SHORT( Row, Col ), 0 ); HasMoved = FALSE; } GBoard.SetfDrag( FALSE ); GBoard.ClearDrawPoint(); // because no square is drawn right now fHideSquare = FALSE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), mp1 ); // GBoard.ShowPointerPos( hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1)); // draws square at the current ptr pos break; case WM_CHAR: // key was pressed if( SHORT2FROMMP( mp2 ) != VK_SPACE ) break; // only space is interesting if( GBoard.GetfDrag() ) break; // do nothing while dragging if( !GBoard.GetfShowLines() ){ // lines not visible yet GBoard.SetfShowLines( TRUE ); WinSendMsg( pg->hwndTGraph, WM_DISPLAYLINES, 0, 0 ); } break; case WM_BUTTON1CLICK: if( !InfoData.ShipsNotFound ) break; // game is finished ptl.x = (LONG)SHORT1FROMMP( mp1 ); ptl.y = (LONG)SHORT2FROMMP( mp1 ); Row = GBoard.GetBoardRow( ptl.y ); Col = GBoard.GetBoardCol( ptl.x ); if( !Row || !Col ) break; fHideSquare = TRUE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), MPFROM2SHORT( 0, 0 ) ); // GBoard.ShowPointerPos( hwnd, 0, 0 ); // hides pointer square if(( aktscan = GBoard.GetDiscovered( Row, Col )) != -1 ){ WinSendMsg( pg->hwndTGraph, WM_DRAWPMPLACE, MPFROMHWND(hwnd), MPFROMSH2CH( MAKESHORT(Row, Col), (CHAR)aktscan,(CHAR)TRUE)); // umstricken auf WinPostMsg // toggle Place display } else { // scan Place DosResetEventSem( hevWaitAfterScan, &ulResponse ); // DosBeep(500, 150 ); WinPostMsg( pg->hwndTGraph, WM_GRAPH_SCAN, MPFROMHWND(hwnd), MPFROM2SHORT( Row, Col ) ); // DosBeep( 800, 150 ); WinWaitEventSem( hevWaitAfterScan, SEM_INDEFINITE_WAIT ); // DosBeep( 1000, 150 ); // first the scanning sounds must be played (and finished) aktscan = GBoard.Scan( Row, Col ); if( aktscan == GBoard.GetShipNumber() + 10 ){ InfoData.ShipsNotFound--; WinPostMsg( pg->hwndTSound, WM_SOUND_FOUNDSHIP, MPFROMHWND(hwnd), 0 ); } else { if( aktscan ) WinPostMsg( pg->hwndTSound, WM_SOUND_FOUND, MPFROMHWND(hwnd), MPFROMLONG( aktscan ) ); else WinPostMsg( pg->hwndTSound, WM_SOUND_FOUND0, MPFROMHWND(hwnd), 0 ); } WinWaitEventSem( hevWaitAfterScan, SEM_INDEFINITE_WAIT ); // waits until scanning is done, and only then displays the // field icon // hps = WinGetPS( hwnd ); WinSendMsg( pg->hwndTGraph, WM_DRAWPMPLACE, MPFROMHWND(hwnd), MPFROMSH2CH( MAKESHORT(Row, Col), (CHAR)aktscan,(CHAR)TRUE)); // umstricken auf WinPostMsg WinPostMsg( pg->hwndTGraph, WM_SHOWSTATUSLINE, 0, 0 ); // ShowStatusLine( hps, GBoard.MovesNeeded(), InfoData.ShipsNotFound, // GBoard.GetWinWidth(), GBoard.GetWinHeight() ); // WinReleasePS( hps ); if( !InfoData.ShipsNotFound ){ // game is finished, all ships found Score = GBoard.MovesNeeded(); if ( !InfoData.ReturnLastHigh() // still space in the hiscore table || Score < InfoData.ReturnLastHigh() ){ // player kicks last one out // player enters highscore table WinPostMsg( pg->hwndTSound, WM_SOUND_NEWHISCORE, MPFROMHWND(hwnd), 0 ); WinWaitEventSem( hevHiScoreWin, SEM_INDEFINITE_WAIT ); // waits until the NEWHISCORE sound is actually played WinDlgBox( HWND_DESKTOP, hwnd, HighScoreDlgProc, (HMODULE)0, IDR_HIGHSCOREDLG, NULL ); WinPostMsg( hwnd, WM_COMMAND, MPFROMSHORT(IDM_GAMEHIGH), (MPARAM)0 ); // show highscore-table DosResetEventSem( hevHiScoreWin, &ulResponse ); // resets the sem again } else { WinPostMsg( pg->hwndTSound, WM_SOUND_LOST, MPFROMHWND(hwnd), 0 ); WinWaitEventSem( hevHiScoreWin, SEM_INDEFINITE_WAIT ); // waits until the NEWHISCORE sound is actually played sprintf( msgtext, "You needed %d moves to find the lost ships. " \ "To enter the highscore list you need %d moves." \ " So try again!", Score, InfoData.ReturnLastHigh() - 1 ); WinMessageBox( HWND_DESKTOP, hwnd, msgtext, "Oh, Shit!", 0, MB_OK | MB_INFORMATION | MB_HELP ); } } } fHideSquare = FALSE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), MPFROM2SHORT( ptl.x, ptl.y ) ); // GBoard.ShowPointerPos( hwnd, ptl.x, ptl.y ); // redisplay ptr square break; case WM_BUTTON2CLICK: fHideSquare = TRUE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), MPFROM2SHORT( 0, 0 ) ); ptl.x = (LONG)SHORT1FROMMP( mp1 ); ptl.y = (LONG)SHORT2FROMMP( mp1 ); Row = GBoard.GetBoardRow( ptl.y ); Col = GBoard.GetBoardCol( ptl.x ); WinSendMsg( pg->hwndTGraph, WM_DRAWPMMARK, MPFROMHWND(hwnd), MPFROM2SHORT( Row, Col ) ); fHideSquare = FALSE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), MPFROM2SHORT( ptl.x, ptl.y ) ); break; case WM_COMMAND: switch( SHORT1FROMMP( mp1 ) ){ case IDM_GAMENEW: GBoard.NewGame(); InfoData.ShipsNotFound = GBoard.GetShipNumber(); RealPaint = TRUE; WinInvalidateRect( hwnd, NULL, TRUE ); break; case IDM_GAMESETTINGS: if( WinDlgBox( HWND_DESKTOP, hwndFrame, GameSettingsDlgProc, (HMODULE)0, IDR_GAMESETTINGSDLG, NULL ) ){ // screen must be repainted RealPaint = TRUE; WinInvalidateRect( hwnd, NULL, TRUE ); } break; case IDM_GAMEHIGH: if( !WinDlgBox( HWND_DESKTOP, hwndFrame, ShowHighDlgProc, (HMODULE)0, IDR_SHOWHIGHDLG, NULL ) ){ // user requested "Clear" if( WinMessageBox( HWND_DESKTOP, hwndMain, "Do you really want to eradicate all those " \ "arduously achieved highscores?", "Clear Highscores", 0, MB_OKCANCEL | MB_WARNING ) == MBID_OK ) InfoData.ResetHigh(); } break; case IDM_HELPINDEX: // help index WinSendMsg( hwndHelp, HM_HELP_INDEX, 0, 0 ); break; case IDM_HELPGENERAL: // general help WinSendMsg( hwndHelp, HM_EXT_HELP, 0, 0 ); break; case IDM_HELPEXTENDED: // help on help (system page) WinSendMsg( hwndHelp, HM_DISPLAY_HELP, 0, 0 ); break; case IDM_HELPKEYS: // keys help WinSendMsg( hwndHelp, HM_KEYS_HELP, 0, 0 ); break; case IDM_HELPPRODUCTINFO: ulResponse = WinDlgBox( HWND_DESKTOP, hwndFrame, ProdInfoDlgProc, (HMODULE)0, IDR_PRODINFODLG, NULL ); break; } break; case HM_QUERY_KEYS_HELP: // system asks which page to display return MRFROMSHORT( PANEL_HELPKEYS ); case HM_HELPSUBITEM_NOT_FOUND: return (MRESULT)FALSE; case WM_USER_ACK: // graphics task finished its work // DosBeep( 1000, 150 ); switch( (ULONG)mp1 ){ case WM_USER_PAINT: WinQueryPointerPos( HWND_DESKTOP, &ptl ); WinMapWindowPoints( HWND_DESKTOP, hwnd, &ptl, 1); fHideSquare = FALSE; WinSendMsg( pg->hwndTGraph, WM_SHOWPOINTERPOS, MPFROMHWND(hwnd), MPFROM2SHORT( ptl.x, ptl.y ) ); // GBoard.ShowPointerPos( hwnd, ptl.x, ptl.y ); // painting has finished, square can be displayed now break; } break; case WM_SOUND_ACK: switch( (ULONG)mp1 ){ case WM_SOUND_INTRO: break; } break; default: return (MRESULT)WinDefWindowProc( hwnd, msg, mp1, mp2 ); } // end switch( msg ) return (MRESULT)WinDefWindowProc( hwnd, msg, mp1, mp2 ); } // end MRESULT EXPENTRY WndProc()
/* * ExitEditor - do just that */ void ExitEditor( int rc ) { #ifdef __WIN__ WriteProfile(); #endif #ifdef __IDE__ IDEFini(); #endif #ifdef __WIN__ DDEFini(); #endif SaveHistory(); RestoreInterrupts(); SwapFileClose(); WindowSwapFileClose(); SwapBlockFini(); ExtendedMemoryFini(); SelRgnFini(); LangFiniAll(); FiniMouse(); FiniMenu(); FiniSavebufs(); FindCmdFini(); DirFini(); CurrentWindow = NO_WINDOW; FinishWindows(); ScreenFini(); #ifdef __WIN__ FiniClrPick(); FiniFtPick(); CursorOp( COP_FINI ); SubclassGenericFini(); FiniProfile(); #endif FiniFileStack(); DeleteResidentScripts(); MatchFini(); FiniKeyMaps(); ErrorFini(); FiniCommandLine(); SSFini(); HistFini(); BoundDataFini(); FTSFini(); StaticFini(); VarFini(); AutoSaveFini(); FiniConfigFileName(); miscGlobalsFini(); ChangeDirectory( HomeDirectory ); #if defined( __NT__ ) && !defined( __WIN__ ) { SetConsoleActiveScreenBuffer( GetStdHandle( STD_OUTPUT_HANDLE ) ); } #endif MemFree( HomeDirectory ); MemFree( CurrentDirectory ); #if defined( VI_RCS ) ViRCSFini(); #endif FiniMem(); exit( rc ); } /* ExitEditor */
/* * RunCommandLine - run a command line command */ vi_rc RunCommandLine( const char *cmdl ) { int i, x, y, x2, y2; bool n1f, n2f; int tkn, flag; bool test1; linenum n1, n2; char st[FILENAME_MAX]; info *cinfo; long val; jmp_buf jmpaddr; vi_rc rc; const char *data; /* * parse command string */ tkn = TOK_INVALID; rc = ParseCommandLine( cmdl, &n1, &n1f, &n2, &n2f, &tkn, &data ); if( rc != ERR_NO_ERR ) { return( rc ); } if( !n2f ) { if( !n1f ) { n1 = n2 = CurrentPos.line; } else { n2 = n1; } } /* * process tokens */ rc = ERR_INVALID_COMMAND; test1 = n1f || n2f; switch( tkn ) { case PCL_T_ABOUT: rc = DoAboutBox(); break; case PCL_T_PUSH: rc = PushFileStackAndMsg(); break; case PCL_T_POP: rc = PopFileStack(); break; case PCL_T_EXECUTE: data = SkipLeadingSpaces( data ); if( *data != '\0' ) { key_map scr; rc = AddKeyMap( &scr, data ); if( rc != ERR_NO_ERR ) { break; } rc = RunKeyMap( &scr, 1L ); MemFree( scr.data ); } break; case PCL_T_DELETEMENU: rc = DoMenuDelete( data ); break; case PCL_T_DELETEMENUITEM: rc = DoItemDelete( data ); break; case PCL_T_ADDMENUITEM: rc = AddMenuItem( data ); break; case PCL_T_MAXIMIZE: rc = MaximizeCurrentWindow(); break; case PCL_T_MINIMIZE: rc = MinimizeCurrentWindow(); break; case PCL_T_EXITFILESONLY: if( !ExitWithPrompt( false, false ) ) { rc = ERR_EXIT_ABORTED; } else { rc = ERR_NO_ERR; } break; case PCL_T_EXITALL: if( !ExitWithPrompt( true, false ) ) { rc = ERR_EXIT_ABORTED; } else { rc = ERR_NO_ERR; } break; case PCL_T_QUITALL: ExitWithVerify(); rc = ERR_NO_ERR; break; case PCL_T_KEYADD: data = SkipLeadingSpaces( data ); KeyAddString( data ); rc = ERR_NO_ERR; break; case PCL_T_UNALIAS: rc = UnAlias( data ); break; case PCL_T_UNABBREV: rc = UnAbbrev( data ); break; case PCL_T_UNMAP: case PCL_T_UNMAP_DMT: flag = MAPFLAG_MESSAGE + MAPFLAG_UNMAP; if( tkn == PCL_T_UNMAP_DMT ) { flag |= MAPFLAG_DAMMIT; } rc = MapKey( flag, data ); break; case PCL_T_EVAL: data = Expand( dataBuff, data, NULL ); i = setjmp( jmpaddr ); if( i != 0 ) { rc = (vi_rc)i; } else { StartExprParse( data, jmpaddr ); val = GetConstExpr(); ltoa( val, st, EditVars.Radix ); Message1( "%s", st ); rc = ERR_NO_ERR; } break; case PCL_T_COMPILE: case PCL_T_SOURCE: case PCL_T_LOAD: { char *tstr; srcline sline; data = GetNextWord1( data, st ); if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; break; } if( tkn == PCL_T_COMPILE ) { EditFlags.CompileScript = true; if( st[0] == '-' ) { if( st[1] == 'a' || st[1] == 'A' ) { EditFlags.CompileAssignments = true; if( st[1] == 'A' ) { EditFlags.CompileAssignmentsDammit = true; } data = GetNextWord1( data, st); if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; break; } } } } if( tkn == PCL_T_LOAD ) { EditFlags.LoadResidentScript = true; } sline = 0; rc = Source( st, data, &sline ); EditFlags.LoadResidentScript = false; EditFlags.CompileScript = false; EditFlags.CompileAssignments = false; EditFlags.CompileAssignmentsDammit = false; if( EditFlags.SourceScriptActive ) { LastError = rc; } if( rc > ERR_NO_ERR ) { Error( "%s on line %u of \"%s\"", GetErrorMsg( rc ), sline, st ); } else { if( rc != DO_NOT_CLEAR_MESSAGE_WINDOW ) { if( tkn != PCL_T_SOURCE ) { if( tkn == PCL_T_LOAD ) { tstr = strLoad; } else { tstr = strCompile; } Message1( "Script \"%s\" %s, %u lines generated, %d errors", st, tstr, sline, SourceErrCount ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } } } break; } case PCL_T_GENCONFIG: #ifndef __WIN__ data = GetNextWord1( data,st ); if( *st != '\0' ) { rc = GenerateConfiguration( st, true ); } else { rc = GenerateConfiguration( NULL, true ); } #else { bool temp = EditFlags.SaveConfig; EditFlags.SaveConfig = true; WriteProfile(); EditFlags.SaveConfig = temp; rc = ERR_NO_ERR; } #endif break; case PCL_T_COMPRESS: rc = CompressWhiteSpace(); break; case PCL_T_EXPAND: rc = ExpandWhiteSpace(); break; case PCL_T_SHOVE: rc = Shift( n1, n2, '>', true ); break; case PCL_T_SUCK: rc = Shift( n1, n2, '<', true ); break; case PCL_T_FILES: if( EditFlags.LineDisplay ) { rc = DisplayFileStatus(); } else { rc = EditFileFromList(); } break; case PCL_T_NEXT: rc = RotateFileForward(); break; case PCL_T_PREV: rc = RotateFileBackwards(); break; case PCL_T_HELP: rc = DoHelp( data ); break; case PCL_T_VIEW: case PCL_T_VIEW_DMT: EditFlags.ViewOnly = true; case PCL_T_EDIT: case PCL_T_EDIT_DMT: rc = EditFile( data, ( tkn == PCL_T_VIEW_DMT || tkn == PCL_T_EDIT_DMT ) ); EditFlags.ViewOnly = false; break; case PCL_T_OPEN: rc = OpenWindowOnFile( data ); break; case PCL_T_HIDE: case PCL_T_HIDE_DMT: rc = HideLineRange( n1, n2, ( tkn == PCL_T_HIDE_DMT ) ); break; case PCL_T_DELETE: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } if( SelRgn.selected && !EditFlags.LineBased ) { AddSelRgnToSavebufAndDelete(); rc = ERR_NO_ERR; // @ may have turned this on - it is now definitely off SelRgn.selected = false; } else { rc = DeleteLineRange( n1, n2, SAVEBUF_FLAG ); } if( rc == ERR_NO_ERR ) { DCDisplayAllLines(); LineDeleteMessage( n1, n2 ); } break; case PCL_T_SAVEANDEXIT: data = GetNextWord1( data, st ); if( *st == '\0' ) { rc = SaveAndExit( st ); } else { rc = SaveAndExit( NULL ); } break; case PCL_T_PUT: case PCL_T_PUT_DMT: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } rc = SaveAndResetFilePos( n1 ); if( rc == ERR_NO_ERR ) { if( tkn == PCL_T_PUT ) { rc = InsertSavebufAfter(); } else { rc = InsertSavebufBefore(); } RestoreCurrentFilePos(); } break; case PCL_T_YANK: rc = SetSavebufNumber( data ); if( rc != ERR_NO_ERR ) { break; } if( SelRgn.selected && !EditFlags.LineBased ) { rc = YankSelectedRegion(); // @ may have turned this on - it is now definitely off SelRgn.selected = false; } else { rc = YankLineRange( n1, n2 ); } break; case PCL_T_SUBSTITUTE: rc = Substitute( n1, n2, data ); break; case PCL_T_GLOBAL: case PCL_T_GLOBAL_DMT: if( !test1 ) { n1 = 1; rc = CFindLastLine( &n2 ); if( rc != ERR_NO_ERR ) { break; } } rc = Global( n1,n2, data, ( tkn == PCL_T_GLOBAL_DMT ) ); break; case PCL_T_WRITEQUIT: if( CurrentFile == NULL ) { rc = NextFile(); } else { CurrentFile->modified = true; data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = SaveAndExit( st ); } else { rc = SaveAndExit( NULL ); } } break; case PCL_T_WRITE: case PCL_T_WRITE_DMT: data = GetNextWord1( data, st ); if( test1 ) { if( *st == '\0' ) { rc = ERR_NO_FILE_SPECIFIED; } else { rc = SaveFile( st, n1, n2, ( tkn == PCL_T_WRITE_DMT ) ); } } else { if( st[0] != '\0' ) { #ifdef __WIN__ if( st[0] == '?' && st[1] == '\0' ) { rc = SaveFileAs(); break; } else { rc = SaveFile( st, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); } #else rc = SaveFile( st, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); #endif } else { rc = SaveFile( NULL, -1, -1, ( tkn == PCL_T_WRITE_DMT ) ); if( rc == ERR_NO_ERR ) { Modified( false ); } } } break; case PCL_T_READ: rc = ReadAFile( n1, data ); break; case PCL_T_QUIT: #ifdef __WIN__ rc = CurFileExitOptionSaveChanges(); #else rc = NextFile(); #endif break; case PCL_T_QUIT_DMT: rc = NextFileDammit(); break; case PCL_T_DATE: GetDateTimeString( st ); Message1( st ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; break; case PCL_T_CD: data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = SetCWD( st ); } else { rc = ERR_NO_ERR; } if( rc == ERR_NO_ERR ) { Message1( "Current directory is %s",CurrentDirectory ); } break; case PCL_T_SHELL: EVIL_SHELL: { #if defined( __NT__ ) && !defined( __WIN__ ) ExecCmd( NULL, NULL, NULL ); #else char foo[FILENAME_MAX]; strcpy( foo, Comspec ); ExecCmd( NULL, NULL, foo ); #endif DoVersion(); rc = ERR_NO_ERR; } break; case PCL_T_SYSTEM: if( n1f && n2f ) { rc = DoGenericFilter( n1, n2, data ); } else { data = SkipLeadingSpaces( data ); if( *data == '\0' ) { goto EVIL_SHELL; } ExecCmd( NULL, NULL, data ); rc = ERR_NO_ERR; } break; case PCL_T_RESIZE: rc = ResizeCurrentWindowWithKeys(); break; case PCL_T_TILE: data = GetNextWord1( data, st ); if( st[0] != '\0' ) { if( st[0] == 'v' ) { y = 1; for( x = 0, cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { x++; } } else if( st[0] == 'h' ) { x = 1; for( y = 0, cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { y++; } } else { x = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } else { y = atoi( st ); } } } else { x = EditVars.MaxWindowTileX; y = EditVars.MaxWindowTileY; } if( x > 0 && y > 0) { rc = WindowTile( x, y ); } break; case PCL_T_CASCADE: rc = WindowCascade(); break; case PCL_T_MOVEWIN: rc = MoveCurrentWindowWithKeys(); break; case PCL_T_TAG: data = GetNextWord1( data, st ); if( *st != '\0' ) { rc = TagHunt( st ); } break; case PCL_T_FGREP: { bool ci; data = SkipLeadingSpaces( data ); ci = EditFlags.CaseIgnore; if( data[0] == '-' ) { if( data[1] == 'c' ) { ci = false; data += 2; data = SkipLeadingSpaces( data ); rc = GetStringWithPossibleQuote( &data, st ); } else if( data[1] == 'i' ) { ci = true; data += 2; data = SkipLeadingSpaces( data ); rc = GetStringWithPossibleQuote( &data, st ); } else if( data[1] == 'f' ) { data += 2; data = SkipLeadingSpaces( data ); #ifdef __WIN__ // call fancy grep window { fancy_find *ff; /* ff will be set to point at a static fancy find struct * in the snoop module */ char snoopbuf[FILENAME_MAX]; if( !GetSnoopStringDialog( &ff ) ) { return( ERR_NO_ERR ); } strcpy( snoopbuf, ff->path ); /* assume no string means current directory */ if( strlen( snoopbuf ) && snoopbuf[strlen( snoopbuf ) - 1] != '\\' ){ strcat( snoopbuf, "\\" ); } MySprintf( st, "%s", ff->find ); strcat( snoopbuf, ff->ext ); ci = ff->case_ignore; if( !ff->use_regexp ) { //MakeExpressionNonRegular( st ); rc = DoFGREP( snoopbuf, st, ci ); } else { rc = DoEGREP( snoopbuf, st ); } break; } #endif } } else { rc = GetStringWithPossibleQuote( &data, st ); } if( rc != ERR_NO_STRING ) { rc = DoFGREP( data, st, ci ); } } break; case PCL_T_EGREP: rc = GetStringWithPossibleQuote( &data, st ); if( rc != ERR_NO_STRING ) { rc = DoEGREP( data, st ); } break; case PCL_T_SIZE: data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } x = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } y = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } x2 = atoi( st ); data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } y2 = atoi( st ); rc = CurrentWindowResize( x, y, x2, y2 ); break; case PCL_T_ECHO: data = GetNextWord1( data, st ); if( *st == '\0' ) { break; } rc = ERR_NO_ERR; if( !stricmp( st, "on" ) ) { EditFlags.EchoOn = true; break; } else if( !stricmp( st, "off" ) ) { EditFlags.EchoOn = false; break; } x = atoi( st ); data = SkipLeadingSpaces( data ); /* * FIXME: This is not good - I will definately have to * fix this code up. But right now I have to get the * editor ready for tomorrow. Brad. */ if( data[0] == '"' || data[0] == '/' ) { GetStringWithPossibleQuote( &data, st ); if( x > 2 ) { /* this is obviously a sick individual */ Error( "Invalid Echo" ); } else if( x == 1 ) { Message1( st ); } else if( x == 2 ) { Message2( st ); } // DisplayLineInWindow( MessageWindow, x, st ); } else { if( x > 2 ) { /* this is obviously a sick individual */ Error( "Invalid Echo" ); } else if( x == 1 ) { Message1( data ); } else if( x == 2 ) { Message2( data ); } // DisplayLineInWindow( MessageWindow, x, data ); } break; #ifdef VI_RCS case PCL_T_CHECKOUT: rc = ERR_NO_ERR; #ifdef __WINDOWS__ if( isOS2() ) break; // OS/2 shell returns before checkout finishes #endif if( CurrentFile != NULL ) { rc = ViRCSCheckout( rc ); } break; case PCL_T_CHECKIN: if( CurrentFile != NULL ) { rc = ViRCSCheckin( rc ); } break; #endif default: if( tkn >= 1000 ) { rc = ProcessEx( n1, n2, n2f, tkn - 1000, data ); break; } rc = TryCompileableToken( tkn, data, true ); if( rc != NOT_COMPILEABLE_TOKEN ) { break; } rc = ProcessWindow( tkn, data ); if( rc >= ERR_NO_ERR ) { break; } case TOK_INVALID: if( n1f && !n2f ) { if( !n1 ) { n1 = 1; } MemorizeCurrentContext(); rc = GoToLineNoRelCurs( n1 ); if( rc == ERR_NO_ERR ) { GoToColumnOnCurrentLine( 1 ); if( EditFlags.LineDisplay ) { MyPrintf( "%s\n", CurrentLine->data ); } } return( rc ); } rc = ERR_INVALID_COMMAND; break; } if( rc == ERR_NO_ERR ) { rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } return( rc ); } /* RunCommandLine */
static void OnSaveNewClicked(WindowControl * Sender) { (void)Sender; int file_index; TCHAR file_name[MAX_PATH]; TCHAR profile_name[MAX_PATH]; TCHAR tmptext[MAX_PATH]; WndProperty* wp; DataFieldFileReader *dfe; wp = (WndProperty*)wf->FindByName(TEXT("prpFile")); if (!wp) return; dfe = (DataFieldFileReader*) wp->GetDataField(); _tcscpy(profile_name,_T("")); dlgTextEntryShowModal(profile_name, 13); // max length including termination 0 if (_tcslen(profile_name)<=0) return; _tcscat(profile_name, TEXT(LKS_PRF)); LocalPath(file_name,TEXT(LKD_CONF)); _tcscat(file_name,TEXT("\\")); _tcscat(file_name,profile_name); dfe->Lookup(file_name); file_index = dfe->GetAsInteger(); if (file_index==0) { _stprintf(tmptext, TEXT("%s: %s"), // LKTOKEN _@M458_ = "New profile" gettext(TEXT("_@M458_")), profile_name); if(MessageBoxX(hWndMapWindow, tmptext, // LKTOKEN _@M579_ = "Save ?" gettext(TEXT("_@M579_")), MB_YESNO|MB_ICONQUESTION) == IDYES) { WriteProfile(file_name); dfe->addFile(profile_name, file_name); MessageBoxX(hWndMapWindow, // LKTOKEN _@M535_ = "Profile saved!" gettext(TEXT("_@M535_")), _T(""), MB_OK|MB_ICONEXCLAMATION); dfe->Set(0); return; } } if (file_index>0) { _stprintf(tmptext, TEXT("%s: %s"), // LKTOKEN _@M533_ = "Profile already exists" gettext(TEXT("_@M533_")), profile_name); if (CheckClubVersion() ) { MessageBoxX(hWndMapWindow, tmptext, // LKTOKEN _@M162_ = "Cannot overwrite!" gettext(TEXT("_@M162_")), MB_OK|MB_ICONEXCLAMATION); } else { if(MessageBoxX(hWndMapWindow, tmptext, // LKTOKEN _@M510_ = "Overwrite?" gettext(TEXT("_@M510_")), MB_YESNO|MB_ICONQUESTION) == IDYES) { WriteProfile(file_name); MessageBoxX(hWndMapWindow, // LKTOKEN _@M535_ = "Profile saved!" gettext(TEXT("_@M535_")), _T(""), MB_OK|MB_ICONEXCLAMATION); return; } } dfe->Set(0); } }