void ICP::DcDS(void) const { // Display status NoParameters(); ShowBoard(); ShowMoves(); ShowLimits(); ShowOptions(); ShowFEN(); ShowPosHash(); }
static void Usage( void ) { //============================= char buff[LIST_BUFF_SIZE+1]; PrtBanner(); puts( "" ); MsgBuffer( CL_USAGE_LINE, buff, _NAME_ ); puts( buff ); puts( "" ); ShowOptions( buff ); }
void ShowUsage( void ) { //=================== char buff[LIST_BUFF_SIZE+1]; TOutBanner(); TOutNL( "" ); MsgBuffer( MS_USAGE_LINE, buff, _NAME_ ); TOutNL( buff ); TOutNL( "" ); ShowOptions( buff ); }
void Main_OnCommand(HWND hwnd, int id, HWND /* hwndCtl */, UINT /* codeNotify */) { switch (id) { case ID_FILE_EXIT: // The user wants to exit, so send our window a close message SendMessage(hwnd, WM_CLOSE, 0, 0L); break; case ID_HELP_ABOUT: // Display the "About" dialog DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_ABOUT), hwnd, AboutDlgProc); break; case ID_PROPERTIES: ShowOptions(hwnd); break; case ID_APPBAR_REGISTER: AppBar_Register(hwnd); break; case ID_APPBAR_UNREGISTER: AppBar_UnRegister(hwnd); break; case ID_APPBAR_AUTOHIDE: AppBar_SetAutoHide(hwnd, TRUE); break; case ID_APPBAR_NOAUTOHIDE: AppBar_SetAutoHide(hwnd, FALSE); break; case ID_APPBAR_TOP: AppBar_SetSide(hwnd, ABE_TOP); break; case ID_APPBAR_BOTTOM: AppBar_SetSide(hwnd, ABE_BOTTOM); break; case ID_APPBAR_LEFT: AppBar_SetSide(hwnd, ABE_LEFT); break; case ID_APPBAR_RIGHT: AppBar_SetSide(hwnd, ABE_RIGHT); break; } }
void ShowUsage( void ) { //=================== char buff[LIST_BUFF_SIZE+1]; GetBanner( buff ); TOutNL( buff ); GetCopyright( buff ); TOutNL( buff ); GetTrademark( buff ); TOutNL( buff ); GetMoreInfo( buff ); TOutNL( buff ); TOutNL( "" ); MsgBuffer( MS_USAGE_LINE, buff, _CmpName ); TOutNL( buff ); TOutNL( "" ); ShowOptions( buff ); }
int main(int argc, char **argv) { TextStartup(); ShowTitle(); // skip program name itself argv++, argc--; if (argc <= 0) { ShowInfo(); TextShutdown(); exit(1); } if (strcmp(argv[0], "/?") == 0 || strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "-help") == 0 || strcmp(argv[0], "--help") == 0 || strcmp(argv[0], "-HELP") == 0 || strcmp(argv[0], "--HELP") == 0) { ShowOptions(); TextShutdown(); exit(1); } BuildArgumentList(argc, argv); info = default_buildinfo; comms = default_buildcomms; if (GLBSP_E_OK != GlbspParseArgs(&info, &comms, resp_argv, resp_argc)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when parsing args)"); } #if 0 if (! FileExists(info.filename)) TextFatalError("Error: Cannot find WAD file: %s\n", info.filename); #endif /* process file */ if (GLBSP_E_OK != GlbspCheckInfo(&info, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when checking args)"); } if (info.no_progress) TextDisableProgress(); if (GLBSP_E_OK != GlbspBuildNodes(&info, &cmdline_funcs, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error during build)"); } TextShutdown(); FreeArgumentList(); return 0; }
//--------------------------------------------------------------------------- void __fastcall TMainForm::Button4Click(TObject *Sender) { ShowOptions(); }
void CMainFrame::OnToolsOptions() { ShowOptions (0); }
LRESULT CMainFrame::OnRibbonCustomize (WPARAM wp, LPARAM /*lp*/) { ShowOptions (wp == 0 ? 1 : 0); return 1; }
// `Main program' equivalent, creating windows and returning main app frame bool MyApp::OnInit() { // Use default list of macros defined in tex2any.cc DefineDefaultMacros(); AddMacroDef(ltHARDY, _T("hardy"), 0); FileRoot = new wxChar[300]; ContentsName = new wxChar[300]; TmpContentsName = new wxChar[300]; TmpFrameContentsName = new wxChar[300]; WinHelpContentsFileName = new wxChar[300]; RefFileName = new wxChar[300]; WX_CLEAR_LIST(wxList,ColourTable); int n = 1; // Read input/output files if (argc > 1) { if (argv[1][0] != _T('-')) { InputFile = argv[1]; n ++; if (argc > 2) { if (argv[2][0] != _T('-')) { OutputFile = argv[2]; n ++; } } } } #ifdef NO_GUI if (InputFile.empty() || OutputFile.empty()) { wxSTD cout << "Tex2RTF: input or output file is missing.\n"; ShowOptions(); exit(1); } #endif if (!InputFile.empty()) { TexPathList.EnsureFileAccessible(InputFile); } if (InputFile.empty() || OutputFile.empty()) isInteractive = true; int i; for (i = n; i < argc;) { if (wxStrcmp(argv[i], _T("-winhelp")) == 0) { i ++; convertMode = TEX_RTF; winHelp = true; } #ifndef NO_GUI else if (wxStrcmp(argv[i], _T("-interactive")) == 0) { i ++; isInteractive = true; } #endif else if (wxStrcmp(argv[i], _T("-sync")) == 0) // Don't yield { i ++; isSync = true; } else if (wxStrcmp(argv[i], _T("-rtf")) == 0) { i ++; convertMode = TEX_RTF; } else if (wxStrcmp(argv[i], _T("-html")) == 0) { i ++; convertMode = TEX_HTML; } else if (wxStrcmp(argv[i], _T("-xlp")) == 0) { i ++; convertMode = TEX_XLP; } else if (wxStrcmp(argv[i], _T("-twice")) == 0) { i ++; runTwice = true; } else if (wxStrcmp(argv[i], _T("-macros")) == 0) { i ++; if (i < argc) { MacroFile = copystring(argv[i]); i ++; } } else if (wxStrcmp(argv[i], _T("-bufsize")) == 0) { i ++; if (i < argc) { BufSize = wxAtoi(argv[i]); i ++; } } else if (wxStrcmp(argv[i], _T("-charset")) == 0) { i ++; if (i < argc) { wxChar *s = argv[i]; i ++; if (wxStrcmp(s, _T("ansi")) == 0 || wxStrcmp(s, _T("pc")) == 0 || wxStrcmp(s, _T("mac")) == 0 || wxStrcmp(s, _T("pca")) == 0) RTFCharset = copystring(s); else { OnError(_T("Incorrect argument for -charset")); return false; } } } else if (wxStrcmp(argv[i], _T("-checkcurlybraces")) == 0) { i ++; checkCurlyBraces = true; } else if (wxStrcmp(argv[i], _T("-checkcurleybraces")) == 0) { // Support the old, incorrectly spelled version of -checkcurlybraces // so that old scripts which run tex2rtf -checkcurleybraces still work. i ++; checkCurlyBraces = true; } else if (wxStrcmp(argv[i], _T("-checksyntax")) == 0) { i ++; checkSyntax = true; } else { wxString buf; buf.Printf(_T("Invalid switch %s.\n"), argv[i]); OnError((wxChar *)buf.c_str()); #ifdef NO_GUI ShowOptions(); exit(1); #else return false; #endif } } #if defined(__WXMSW__) && !defined(NO_GUI) wxDDEInitialize(); Tex2RTFLastStatus[0] = 0; // DDE connection return value TheTex2RTFServer = new Tex2RTFServer; TheTex2RTFServer->Create(_T("TEX2RTF")); #endif TexInitialize(BufSize); ResetContentsLevels(0); #ifndef NO_GUI if (isInteractive) { // Create the main frame window frame = new MyFrame(NULL, wxID_ANY, _T("Tex2RTF"), wxDefaultPosition, wxSize(400, 300)); #if wxUSE_STATUSBAR frame->CreateStatusBar(2); #endif // wxUSE_STATUSBAR // Give it an icon // TODO: uncomment this when we have tex2rtf.xpm frame->SetIcon(wxICON(tex2rtf)); if (!InputFile.empty()) { wxString title; title.Printf( _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile).c_str()); frame->SetTitle(title); } // Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(TEX_GO, _T("&Go"), _T("Run converter")); file_menu->Append(TEX_SET_INPUT, _T("Set &Input File"), _T("Set the LaTeX input file")); file_menu->Append(TEX_SET_OUTPUT, _T("Set &Output File"), _T("Set the output file")); file_menu->AppendSeparator(); file_menu->Append(TEX_VIEW_LATEX, _T("View &LaTeX File"), _T("View the LaTeX input file")); file_menu->Append(TEX_VIEW_OUTPUT, _T("View Output &File"), _T("View output file")); file_menu->Append(TEX_SAVE_FILE, _T("&Save log file"), _T("Save displayed text into file")); file_menu->AppendSeparator(); file_menu->Append(TEX_QUIT, _T("E&xit"), _T("Exit Tex2RTF")); wxMenu *macro_menu = new wxMenu; macro_menu->Append(TEX_LOAD_CUSTOM_MACROS, _T("&Load Custom Macros"), _T("Load custom LaTeX macro file")); macro_menu->Append(TEX_VIEW_CUSTOM_MACROS, _T("View &Custom Macros"), _T("View custom LaTeX macros")); wxMenu *mode_menu = new wxMenu; mode_menu->Append(TEX_MODE_RTF, _T("Output linear &RTF"), _T("Wordprocessor-compatible RTF")); mode_menu->Append(TEX_MODE_WINHELP, _T("Output &WinHelp RTF"), _T("WinHelp-compatible RTF")); mode_menu->Append(TEX_MODE_HTML, _T("Output &HTML"), _T("HTML World Wide Web hypertext file")); mode_menu->Append(TEX_MODE_XLP, _T("Output &XLP"), _T("wxHelp hypertext help file")); wxMenu *options_menu = new wxMenu; options_menu->Append(TEX_OPTIONS_CURLY_BRACE, _T("Curly brace matching"), _T("Checks for mismatched curly braces"),true); options_menu->Append(TEX_OPTIONS_SYNTAX_CHECKING, _T("Syntax checking"), _T("Syntax checking for common errors"),true); options_menu->Check(TEX_OPTIONS_CURLY_BRACE, checkCurlyBraces); options_menu->Check(TEX_OPTIONS_SYNTAX_CHECKING, checkSyntax); wxMenu *help_menu = new wxMenu; help_menu->Append(TEX_HELP, _T("&Help"), _T("Tex2RTF Contents Page")); help_menu->Append(TEX_ABOUT, _T("&About Tex2RTF"), _T("About Tex2RTF")); menuBar = new wxMenuBar; menuBar->Append(file_menu, _T("&File")); menuBar->Append(macro_menu, _T("&Macros")); menuBar->Append(mode_menu, _T("&Conversion Mode")); menuBar->Append(options_menu, _T("&Options")); menuBar->Append(help_menu, _T("&Help")); frame->SetMenuBar(menuBar); frame->textWindow = new wxTextCtrl(frame, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE); (*frame->textWindow) << _T("Welcome to Tex2RTF.\n"); // ShowOptions(); #if wxUSE_HELP #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__) HelpInstance = new wxCHMHelpController; #else HelpInstance = new wxHelpController; #endif HelpInstance->Initialize(_T("tex2rtf")); #endif // wxUSE_HELP /* * Read macro/initialisation file * */ wxString path = TexPathList.FindValidPath(MacroFile); if (!path.empty()) ReadCustomMacros(path); #if wxUSE_STATUSBAR wxString inStr(_T("In ")); switch (convertMode) { case TEX_RTF: if(winHelp) inStr += _T("WinHelp RTF"); else inStr += _T("linear RTF"); break; case TEX_HTML: inStr += _T("HTML"); break; case TEX_XLP: inStr += _T("XLP"); break; default: inStr += _T("unknown"); break; } inStr += _T(" mode."); frame->SetStatusText(inStr, 1); #endif // wxUSE_STATUSBAR frame->Show(true); return true; } else #endif // NO_GUI { /* * Read macro/initialisation file * */ wxString path = TexPathList.FindValidPath(MacroFile); if (!path.empty()) ReadCustomMacros(path); Go(); if (runTwice) { Go(); } #ifdef NO_GUI return true; #else OnExit(); // Do cleanup since OnExit won't be called now return false; #endif } }
int main(int argc, char **argv) { int extra_idx = 0; TextStartup(); ShowTitle(); // skip program name itself argv++, argc--; if (argc <= 0) { ShowInfo(); TextShutdown(); exit(1); } if (strcmp(argv[0], "/?") == 0 || strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "-help") == 0 || strcmp(argv[0], "--help") == 0 || strcmp(argv[0], "-HELP") == 0 || strcmp(argv[0], "--HELP") == 0) { ShowOptions(); TextShutdown(); exit(1); } BuildArgumentList(argc, argv); info = default_buildinfo; comms = default_buildcomms; if (GLBSP_E_OK != GlbspParseArgs(&info, &comms, resp_argv, resp_argc)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when parsing args)"); } if (info.extra_files) { int ext_j; /* catch this mistake: glbsp in.wad out.wad (forget the -o) */ if (info.input_file && info.extra_files[0] && ! info.extra_files[1] && FileExists(info.input_file) && ! FileExists(info.extra_files[0])) { TextFatalError("Error: Cannot find WAD file: %s (" "Maybe you forgot -o)\n", info.extra_files[0]); } /* balk NOW if any of the input files doesn't exist */ if (! FileExists(info.input_file)) TextFatalError("Error: Cannot find WAD file: %s\n", info.input_file); for (ext_j = 0; info.extra_files[ext_j]; ext_j++) { if (FileExists(info.extra_files[ext_j])) continue; TextFatalError("Error: Cannot find WAD file: %s\n", info.extra_files[ext_j]); } } /* process each input file */ for (;;) { if (GLBSP_E_OK != GlbspCheckInfo(&info, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error when checking args)"); } if (info.no_progress) TextDisableProgress(); if (GLBSP_E_OK != GlbspBuildNodes(&info, &cmdline_funcs, &comms)) { TextFatalError("Error: %s\n", comms.message ? comms.message : "(Unknown error during build)"); } /* when there are extra input files, process them too */ if (! info.extra_files || ! info.extra_files[extra_idx]) break; ShowDivider(); GlbspFree(info.input_file); GlbspFree(info.output_file); info.input_file = GlbspStrDup(info.extra_files[extra_idx]); info.output_file = NULL; extra_idx++; } TextShutdown(); FreeArgumentList(); return 0; }
// // WM_COMMAND message handler for main window // UINT CommandHandler(HWND hwnd, UINT nCtrlId, UINT nCtrlCode, HWND hwndFrom) { RECT rect; switch(nCtrlId) { case IDM_FILE_NEW: // reset to an empty file SetWindowFileName(hwnd, _T("Untitled"), FALSE); TextView_Clear(g_hwndTextView); g_szFileTitle[0] = '\0'; g_fFileChanged = FALSE; return 0; case IDM_FILE_OPEN: // get a filename to open if(ShowOpenFileDlg(hwnd, g_szFileName, g_szFileTitle)) { DoOpenFile(hwnd, g_szFileName, g_szFileTitle); } return 0; case IDM_FILE_SAVE: MessageBox(hwnd, _T("Not implemented"), APP_TITLE, MB_ICONINFORMATION); return 0; case IDM_FILE_SAVEAS: // does nothing yet if(ShowSaveFileDlg(hwnd, g_szFileName, g_szFileTitle)) { MessageBox(hwnd, _T("Not implemented"), APP_TITLE, MB_ICONINFORMATION); } return 0; case IDM_FILE_PRINT: DeleteDC( ShowPrintDlg(hwnd) ); return 0; case IDM_FILE_EXIT: PostMessage(hwnd, WM_CLOSE, 0, 0); return 0; case IDM_EDIT_UNDO: case WM_UNDO: SendMessage(g_hwndTextView, WM_UNDO, 0, 0); return 0; case IDM_EDIT_REDO: SendMessage(g_hwndTextView, TXM_REDO, 0, 0); return 0; case IDM_EDIT_COPY: case WM_COPY: SendMessage(g_hwndTextView, WM_COPY, 0, 0); return 0; case IDM_EDIT_CUT: case WM_CUT: SendMessage(g_hwndTextView, WM_CUT, 0, 0); return 0; case IDM_EDIT_PASTE: case WM_PASTE: SendMessage(g_hwndTextView, WM_PASTE, 0, 0); return 0; case IDM_EDIT_DELETE: case WM_CLEAR: SendMessage(g_hwndTextView, WM_CLEAR, 0, 0); return 0; case IDM_EDIT_FIND: ShowFindDlg(hwnd, FIND_PAGE); return 0; case IDM_EDIT_REPLACE: ShowFindDlg(hwnd, REPLACE_PAGE); return 0; case IDM_EDIT_GOTO: ShowFindDlg(hwnd, GOTO_PAGE); return 0; case IDM_EDIT_SELECTALL: TextView_SelectAll(g_hwndTextView); return 0; case IDM_VIEW_OPTIONS: ShowOptions(hwnd); return 0; case IDM_VIEW_LINENUMBERS: g_fLineNumbers = !g_fLineNumbers; TextView_SetStyleBool(g_hwndTextView, TXS_LINENUMBERS, g_fLineNumbers); return 0; case IDM_VIEW_LONGLINES: g_fLongLines = !g_fLongLines; TextView_SetStyleBool(g_hwndTextView, TXS_LONGLINES, g_fLongLines); return 0; case IDM_VIEW_STATUSBAR: g_fShowStatusbar = !g_fShowStatusbar; ShowWindow(g_hwndStatusbar, SW_HIDE); GetClientRect(hwnd, &rect); PostMessage(hwnd, WM_SIZE, 0, MAKEWPARAM(rect.right, rect.bottom)); return 0; case IDM_VIEW_SAVEEXIT: g_fSaveOnExit = !g_fSaveOnExit; return 0; case IDM_VIEW_SAVENOW: SaveRegSettings(); return 0; case IDM_HELP_ABOUT: ShowAboutDlg(hwnd); return 0; default: return 0; } }
void ICP::DcDO(void) const { // Display options NoParameters(); ShowOptions(); }
LRESULT CMainFrame::OnRibbonCustomize (WPARAM /*wp*/, LPARAM /*lp*/) { ShowOptions (0); return 1; }