Beispiel #1
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	ShowConsole();



	ChangeWindowMode(true);

	SetGraphMode(288, 512, 32);


	SetDrawScreen(DX_SCREEN_BACK);
	if (DxLib_Init() == -1)
	{
		printf("DxLib起動失敗!!");
		return -1;
	}

	m_pSceneManager = new SceneManager(key);

	m_pSceneManager->load();
	m_pSceneManager->init();

	while (ScreenFlip() == 0 && ProcessMessage() == 0 && getupKey() == 0)
	{
		ClearDrawScreen();

		m_pSceneManager->updata();

		if (key[KEY_INPUT_ESCAPE] == 1)break;
	}

	delete m_pSceneManager;
	return DxLib_End();
}
Beispiel #2
0
static INT_PTR ShowHideConsole(WPARAM wParam, LPARAM lParam)
{
	if (hwndConsole)
		ShowConsole(!IsWindowVisible(hwndConsole));

	return 0;
}
Beispiel #3
0
void clConsole::Event_ERROR( LEvent Event, const LEventArgs& Args )
{
	// display error message
	DisplayError( *( LString* )Args.FPtrArg );

	ShowConsole();
}
Beispiel #4
0
static void Help (vlc_object_t *p_this, char const *psz_help_name)
{
    ShowConsole();

    if( psz_help_name && !strcmp( psz_help_name, "help" ) )
    {
        printf(_(vlc_usage), "vlc");
        Usage( p_this, "=core" );
        print_help_on_full_help();
    }
    else if( psz_help_name && !strcmp( psz_help_name, "longhelp" ) )
    {
        printf(_(vlc_usage), "vlc");
        Usage( p_this, NULL );
        print_help_on_full_help();
    }
    else if( psz_help_name && !strcmp( psz_help_name, "full-help" ) )
    {
        printf(_(vlc_usage), "vlc");
        Usage( p_this, NULL );
    }
    else if( psz_help_name )
    {
        Usage( p_this, psz_help_name );
    }

    PauseConsole();
}
Beispiel #5
0
void CScriptMgr::ConfigurePath()
{
#ifndef TOOLWORKDIR
	_chdir("../../programmer/trunk/");
#endif
	ShowConsole(true);
}
Beispiel #6
0
void Ide::UscFile(const String& file)
{
	try {
		ParseUscFile(file);
	}
	catch(CParser::Error& e) {
		ShowConsole();
		console << e << "\n";
	}
}
Beispiel #7
0
/*****************************************************************************
 * Version: print complete program version
 *****************************************************************************
 * Print complete program version and build number.
 *****************************************************************************/
static void Version( void )
{
    ShowConsole();
    printf(_("VLC version %s (%s)\n"), VERSION_MESSAGE, psz_vlc_changeset);
    printf(_("Compiled by %s on %s (%s)\n"), VLC_CompileBy(),
           VLC_CompileHost(), __DATE__" "__TIME__ );
    printf(_("Compiler: %s\n"), VLC_Compiler());
    fputs(LICENSE_MSG, stdout);
    PauseConsole();
}
Beispiel #8
0
void clConsole::ToggleConsoleC( const LString& Param )
{
	if ( FHUDVisible )
	{
		SendCommand( "CloseConsole" );
	}
	else
	{
		ShowConsole();
	}
}
			void EditorPage::checkInterpreters (QString language)
			{
				Entity e = Util::MakeEntity (QUrl::fromLocalFile (Filename_),
						QString (),
						FromUserInitiated,
						"x-leechcraft/script-wrap-request");
				QObject *object = 0;
				e.Additional_ ["Object"] = QVariant::fromValue<QObject**> (&object);
				e.Additional_ ["Language"] = FixLanguage (language);

				bool ch = false;
				emit couldHandle (e, &ch);
				ShowConsole (ch);
			}
Beispiel #10
0
void Ide::EndBuilding(bool ok)
{
    console.EndGroup();
    console.Wait();
    Vector<String> errors = console.PickErrors();
    CreateHost(false)->DeleteFile(errors);
    if(!errors.IsEmpty())
        ok = false;
    PutConsole("");
    PutConsole((ok ? "OK. " : "There were errors. ") + GetPrintTime(build_time));
    SetIdeState(EDITING);
    if(GetTopWindow()->IsOpen()) {
        if(ok)
            BeepMuteInformation();
        else
            BeepMuteExclamation();
    }
    ShowConsole();
}
Beispiel #11
0
void Ide::BuildAndExecute()
{
	if(Build()) {
		int time = msecs();
		One<Host> h = CreateHostRunDir();
		h->ChDir(Nvl(rundir, GetFileFolder(target)));
		String cmdline;
		if(!runexternal)
			cmdline << '\"' << h->GetHostPath(target) << "\" ";
		cmdline << ToSystemCharset(runarg);
		int exitcode;
		switch(runmode) {
		case RUN_WINDOW:
			HideBottom();
			h->Launch(cmdline, FindIndex(SplitFlags(mainconfigparam, true), "GUI") < 0);
			break;
		case RUN_CONSOLE:
			ShowConsole();
			PutConsole(String().Cat() << "Executing: " << cmdline);
			console.Sync();
			exitcode = h->ExecuteWithInput(cmdline);
			PutConsole("Finished in " + GetPrintTime(time) + ", exit code: " + AsString(exitcode));
			break;
		case RUN_FILE: {
				HideBottom();
				String fn;
				if(IsNull(stdout_file))
					fn = ForceExt(target, ".ol");
				else
					fn = stdout_file;
				FileOut out(fn);
				if(!out) {
					PromptOK("Unable to open output file [* " + DeQtf(stdout_file) + "] !");
					return;
				}
				if(h->Execute(cmdline, out) >= 0) {
					out.Close();
					EditFile(fn);
				}
			}
		}
	}
}
Beispiel #12
0
/*****************************************************************************
 * ListModules: list the available modules with their description
 *****************************************************************************
 * Print a list of all available modules (builtins and plugins) and a short
 * description for each one.
 *****************************************************************************/
static void ListModules (vlc_object_t *p_this, bool b_verbose)
{
    bool color = false;

    ShowConsole();
#ifndef _WIN32
    if (isatty(STDOUT_FILENO))
        color = var_InheritBool(p_this, "color");
#else
    (void) p_this;
#endif

    /* List all modules */
    size_t count;
    module_t **list = module_list_get (&count);

    /* Enumerate each module */
    for (size_t j = 0; j < count; j++)
    {
        module_t *p_parser = list[j];
        const char *objname = module_get_object (p_parser);
        printf(color ? GREEN"  %-22s "WHITE"%s\n"GRAY : "  %-22s %s\n",
               objname, module_gettext(p_parser, p_parser->psz_longname));

        if( b_verbose )
        {
            char *const *pp_shortcuts = p_parser->pp_shortcuts;
            for( unsigned i = 0; i < p_parser->i_shortcuts; i++ )
                if( strcmp( pp_shortcuts[i], objname ) )
                    printf(color ? CYAN"   s %s\n"GRAY : "   s %s\n",
                           pp_shortcuts[i]);
            if (p_parser->psz_capability != NULL)
                printf(color ? MAGENTA"   c %s (%d)\n"GRAY : "   c %s (%d)\n",
                       p_parser->psz_capability, p_parser->i_score);
        }
    }
    module_list_free (list);
    PauseConsole();
}
Beispiel #13
0
void Ide::BeginBuilding(bool sync_files, bool clear_console)
{
    SetupDefaultMethod();
    HdependTimeDirty();
    Renumber();
    StopDebug();
    ShowConsole();
    SaveFile();
    SaveWorkspace();
    SetIdeState(BUILDING);
    console.Kill();
    console.ClearError();
    error_cache.Clear();
    error.Clear();
    SyncErrorsMessage();
    error_count = 0;
    warning_count = 0;
    if(clear_console)
        console.Clear();
    build_time = GetTickCount();
    CreateHost(sync_files);
    cmdout.Clear();
}
Beispiel #14
0
void Csio::contextMenuEvent ( QContextMenuEvent * event )
{
    QMenu *menu= new QMenu(this);

    BuildContextMenu(menu);

    menu->addSeparator();

    QMenu * menuConnectorType = menu->addMenu(tr("Connector Type"));
        menuConnectorType->addAction(tr("Sharp 11 pins"));
        menuConnectorType->addAction(tr("Sharp 15 pins"));
        menuConnectorType->addAction(tr("Canon 9 pins"));
        menuConnectorType->addAction(tr("DB25 Serial Connector"));
        menuConnectorType->addAction(tr("DIN 8 pins"));
        menuConnectorType->addAction(tr("Jack"));

        connect(menuConnectorType, SIGNAL(triggered(QAction*)), this, SLOT(slotConnType(QAction*)));

    menu->addAction(tr("Show console"),this,SLOT(ShowConsole()));
    menu->addAction(tr("Hide console"),this,SLOT(HideConsole()));

    menu->popup(event->globalPos () );
    event->accept();
}
Beispiel #15
0
void Ide::ConsoleShow()
{
    ShowConsole();
    console.Sync();
}
Beispiel #16
0
static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam)
{
	switch(message) {
	case WM_INITDIALOG:
	{
		TCHAR title[MAX_PATH];
		TCHAR name[MAX_PATH] = {0};
		TCHAR path[MAX_PATH] = {0};

		hTabs = GetDlgItem(hwndDlg, IDC_TABS);

		//TabCtrl_SetMinTabWidth(hTabs, 100);

		// restore position
		Utils_RestoreWindowPositionEx(hwndDlg,RWPF_HIDDEN,NULL,"Console","Console");

		CallService(MS_DB_GETPROFILENAMET,(WPARAM)SIZEOF(name),(LPARAM)name);

		CallService(MS_DB_GETPROFILEPATHT,(WPARAM)SIZEOF(path),(LPARAM)path);

		mir_sntprintf(title, SIZEOF(title), _T("%s - %s\\%s"), TranslateT("Miranda Console"), path, name);

		SetWindowText(hwndDlg, title);
		SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)hIcons[0]);

		hwndConsole = hwndDlg;
		SendMessage(hwndDlg, HM_ADD, 0, 0);
		PostMessage(hwndDlg, WM_SIZE, 0, 0);
		break;
	}
	case HM_DUMP:
	{
		// lParam = DUMPMSG
		int idx;
		LOGWIN *lw;
		LOGWIN lw2;
		DUMPMSG *dumpMsg = (DUMPMSG*)lParam;

		if (!pActive) {
			mir_free(dumpMsg);
			break;
		}

		if (!gSingleMode)
		{
			lw2.Module = dumpMsg->szModule;
			if (!List_GetIndex(&lModules, &lw2, &idx))
				SendMessage(hwndDlg, HM_ADD, (WPARAM)idx, (LPARAM)dumpMsg->szModule);

			lw = (LOGWIN*)lModules.items[idx];
		}
		else
			lw = pActive;

		if (lw->hwnd)
			SendMessage(lw->hwnd, HM_DUMP, wParam, lParam);
		else
			PostMessage(hwndDlg, HM_DUMP, wParam, lParam); // loop msg until window will be ready

		return TRUE;
	}
	case HM_ADD:
	{
		// wParam = index, lParam = module name
		LOGWIN *lw;
		COLORREF col;
		TCITEM tci = {0};
		int idx = (int)wParam;
		char *str = (char*)lParam;

		if (!str) str = ""; // startup window

		lw = (LOGWIN*)mir_calloc( sizeof(LOGWIN));
		lw->Module = (char*)mir_strdup(str);
		List_Insert(&lModules, lw, idx);

		if (!gSingleMode && lParam)
		{
			tci.mask = TCIF_PARAM | TCIF_TEXT;
			tci.lParam = (LPARAM)lw;

			tci.pszText = mir_a2u(lw->Module);
			idx = TabCtrl_InsertItem(hTabs, tabCount, &tci);
			mir_free(tci.pszText);

			tabCount++;
		}

		GetClientRect(hTabs, &rcTabs);
		TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs);

		CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_LOG), hwndDlg, LogDlgProc, (LPARAM)lw);
		ShowWindow(lw->hwnd, (tabCount > 1)?SW_HIDE:SW_SHOWNOACTIVATE);

		if (pActive)
		{
			col = ListView_GetBkColor(pActive->hList);
			ListView_SetBkColor(lw->hList, col);
			ListView_SetTextBkColor(lw->hList, col);

			col = ListView_GetTextColor(pActive->hList);
			ListView_SetTextColor(lw->hList, col);

			if (hfLogFont)
				SendMessage(lw->hList, WM_SETFONT, (WPARAM)hfLogFont, TRUE);
		}

		// hide startup window
		if (tabCount == 1)
		{
			ShowWindow(pActive->hwnd, SW_HIDE);
			PostMessage(pActive->hwnd, WM_CLOSE, 0, 0);
			pActive = lw;
		}

		if (!pActive)
			pActive = lw;

		return TRUE;
	}
	case HM_REMOVE:
	{
		// lParam = LOGWIN
		LOGWIN *lw = (LOGWIN*)lParam;

		if (!lw) break;

		if (lw == pActive)
		{
			int tab = TabCtrl_GetCurSel(hTabs);
			if (tab >= 0)
			{
				TCITEM tci={0};

				TabCtrl_DeleteItem(hTabs, tab);
				tabCount--;
				if (tabCount)
				{
					tab--;
					if (tab < 0 ) tab = 0;
					TabCtrl_SetCurSel(hTabs, tab);

					tci.mask = TCIF_PARAM;
					TabCtrl_GetItem(hTabs, tab, &tci);
					pActive = (LOGWIN*)tci.lParam;
					SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
					ScrollDown(pActive);
					ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE);
					SetFocus(pActive->hList);
				}
				else
					pActive = NULL;
			}
		}

		List_RemovePtr(&lModules, lw);
		mir_free(lw->Module);
		mir_free(lw);
		return TRUE;
	}
	case HM_SETFONT:
	{
		// wParam = font, lParam = font color
		int i;
		LOGWIN *lw;
		for ( i = 0; i < lModules.realCount; i++ )
		{
			lw = (LOGWIN*)lModules.items[i];
			ListView_SetTextColor(lw->hList, (COLORREF)lParam);
			if (wParam)
				SendMessage(lw->hList, WM_SETFONT, wParam, TRUE);
		}
		return TRUE;
	}
	case HM_SETCOLOR:
	{
		// wParam = font, lParam = background color
		int i;
		LOGWIN *lw;
		for ( i = 0; i < lModules.realCount; i++ )
		{
			lw = (LOGWIN*)lModules.items[i];
			ListView_SetBkColor(lw->hList, (COLORREF)lParam);
			ListView_SetTextBkColor(lw->hList, (COLORREF)lParam);
			if (wParam)
				SendMessage(lw->hList, WM_SETFONT, wParam, TRUE);
		}
		return TRUE;
	}
	case HM_PAUSEALL:
	{
		// lParam = 1 to pause, 0 to start
		int i;
		LOGWIN *lw;
		for ( i = 0; i < lModules.realCount; i++ )
		{
			lw = (LOGWIN*)lModules.items[i];
			if (lw->Paused != (int)lParam)
				SendMessage(lw->hwnd, WM_COMMAND, IDC_PAUSE, 0);
		}
		return TRUE;
	}
	case HM_RESTART:
	{
		if (pActive)
		{
			pActive = NULL;
			PostMessage(hwndDlg, HM_RESTART, 0, 0);
			return TRUE;
		}
		// close all tabs
		if (!lParam)
		{
			LOGWIN *lw;
			TabCtrl_DeleteAllItems(hTabs);
			while ( lModules.realCount )
			{
				lw = (LOGWIN*)lModules.items[0];
				SendMessage(lw->hwnd, WM_CLOSE, 0, 0);
			}
			tabCount = 0;
			PostMessage(hwndDlg, HM_RESTART, 0, 1);
			return TRUE;
		}

		LoadSettings();
		SendMessage(hwndDlg, HM_ADD, 0, 0);
		PostMessage(hwndDlg, WM_SIZE, 0, 0);
		return TRUE;
	}
 	case WM_SETFOCUS:
		if (pActive) {
			SetFocus(pActive->hList);
		}
		return TRUE;
	case WM_NOTIFY:
		switch(wParam) {
		case IDC_TABS:
			{
				LPNMHDR lpnmhdr = (LPNMHDR)lParam;
				if (lpnmhdr->code == TCN_SELCHANGE)
				{
					int newTab = TabCtrl_GetCurSel(hTabs);
					if (newTab >= 0 )
					{
						TCITEM tci={0};
						HWND hOld = pActive->hwnd;

						tci.mask = TCIF_PARAM;

						if (!TabCtrl_GetItem(hTabs, newTab, &tci)) break;

						pActive = (LOGWIN*)tci.lParam;

						SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
						ScrollDown(pActive);
						ShowWindow(hOld, SW_HIDE);
						ShowWindow(pActive->hwnd, SW_SHOWNOACTIVATE);
						SetFocus(pActive->hList);
					} else
						SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
				}
				break;
			}
		}
		break;
	case WM_SIZE:
	{
		UTILRESIZEDIALOG urd={0};
		urd.cbSize=sizeof(urd);
		urd.hInstance=hInst;
		urd.hwndDlg=hwndDlg;
		urd.lpTemplate=MAKEINTRESOURCEA(IDD_CONSOLE);
		urd.pfnResizer=ConsoleResize;
		CallService(MS_UTILS_RESIZEDIALOG,0,(LPARAM)&urd);

		GetClientRect(hTabs, &rcTabs);
		TabCtrl_AdjustRect(hTabs, FALSE, &rcTabs);

		if ( pActive )
			SendMessage(pActive->hwnd, WM_SIZE, 0, 0);
		break;
	}
	case WM_GETMINMAXINFO:
	{
		MINMAXINFO *mmi=(MINMAXINFO*)lParam;
		mmi->ptMinTrackSize.x=400;
		mmi->ptMinTrackSize.y=200;
		break;
	}
	case WM_CLOSE:
		if ( lParam != 1 ) {
			Utils_SaveWindowPosition(hwndDlg,NULL,"Console","Console");
			ShowConsole(0);
			return TRUE;
		} else
			DestroyWindow(hwndDlg);
		break;
	case WM_DESTROY:
		pActive = NULL;
		if (hfLogFont) DeleteObject(hfLogFont);
		PostQuitMessage(0);
		break;
	}

	return FALSE;
}
Beispiel #17
0
    void PythonScriptModule::PostInitialize()
    {
        // An error has occurred on startup.
        if (!pythonQtStarted_)
            return;

        // Get python main module.
        PythonQtObjectPtr mainModule = PythonQt::self()->getMainModule();
        if (mainModule.isNull())
        {
            LogError("PythonScriptModule::StartPythonQt(): Failed to get main module from PythonQt after init!");
            return;
        }

        // Add PythonScriptModule as '_pythonscriptmodule' 
        // and Framework as '_tundra' to python.
        mainModule.addObject("_pythonscriptmodule", this);
        mainModule.addObject("_tundra", GetFramework());

        QDir pythonPlugins(Application::InstallationDirectory() + "pyplugins");
        QDir pythonLibrary(pythonPlugins.absoluteFilePath("python/"));

        // Add Tundra python plugins source location.
        AddSystemPath(pythonPlugins.absolutePath());
        AddSystemPath(pythonPlugins.absoluteFilePath("lib"));

        // Add Python Library DLL and on windows pass whole python as a archive file.
        /// \todo Is the 'DLLs' really needed also outside windows?
        AddSystemPath(pythonLibrary.absoluteFilePath("DLLs"));
#ifdef _WIN32            
        AddSystemPath(pythonLibrary.absoluteFilePath("Python26.zip"));
#endif

        // Connect to SceneAPI
        QObject::connect(GetFramework()->Scene(), SIGNAL(SceneAdded(const QString&)), this, SLOT(OnSceneAdded(const QString&)));

        // Console commands to ConsoleAPI
        GetFramework()->Console()->RegisterCommand("PyExec", "Execute given code in the embedded Python interpreter. Usage: PyExec(mycodestring)", 
                                                   this, SLOT(ConsoleRunString(const QStringList&)));
        GetFramework()->Console()->RegisterCommand("PyLoad", "Execute a python file. Usage: PyLoad(mypymodule)", 
                                                   this, SLOT(ConsoleRunFile(const QStringList&)));
        GetFramework()->Console()->RegisterCommand("PyRestart", "Restarts the Tundra Python ModuleManager", 
                                                   this, SLOT(ConsoleRestartPython(const QStringList&)));
        GetFramework()->Console()->RegisterCommand("PyConsole", "Creates a new Python console window.", 
                                                   this, SLOT(ShowConsole()));

        // Done in PostInitialize() so all modules/APIs are loaded and initialized.
        //StartPythonModuleManager();
        
        // --p --python --pythonapitests are special command line options that on purpose not put
        // to the Framework program options parsing. So lets do a special parse here for there hidden variables.
        /// \todo See if we should return --p --python as official cmd line options back to Framework. Probably best to have modules give own params somehow, 
        /// we should not mess python specific things to core SDK params in Framework.cpp :I
        namespace po = boost::program_options;

        po::variables_map commandLineVariables;
        po::options_description commandLineDescriptions;

        commandLineDescriptions.add_options()
            ("p", po::value<std::string>(), "Run a python script on startup")
            ("python", po::value<std::string>(), "Run a python script on startup")
            ("pythonapitests", "Run a python api test script on startup");

        try
        {
            /// \note QApplication::argc() and QApplication::argv() are deprecated.
            po::store(po::command_line_parser(QApplication::argc(), QApplication::argv()).options(commandLineDescriptions).allow_unregistered().run(), commandLineVariables);
        }
        catch(std::exception &e)
        {
            LogWarning(Name() + ": " + + e.what());
        }
        po::notify(commandLineVariables);

        if (commandLineVariables.count("python"))
            RunScript(commandLineVariables["python"].as<std::string>().c_str());
        if (commandLineVariables.count("p"))
            RunScript(commandLineVariables["p"].as<std::string>().c_str());

        LoadStartupScripts();
    }
Beispiel #18
0
void BiosFlasher_OnSupportedPressed(GUI_Widget *widget) {
	dsystem("bflash -l");
	ShowConsole();
}
/****
 *The command grammar: (options)  (paramters)   
   -i: set the input the barcode files directory.  -i "D:\images"
   -o: set the output result files directory.  -o "D:\output"
   -l: set the barcode reader library(dll) path
*/
int _tmain(int argc, _TCHAR* argv[])
{

	CDbrBarcodeFileReader *barcodeFileReader = new CDbrBarcodeFileReader();

	if (argc >= 3 && argc%2==1)
	{
		for (int i = 1; i < argc-1; i++)
		{
			string str = argv[i];
			if (str == "-i")
			{
				string strBarcodeDir = argv[i + 1];
				barcodeFileReader->LoadBarcodeFiles(strBarcodeDir.c_str());
			}
			if (str == "-o")
			{
				string strOutputBarcodeDir = argv[i + 1];
				barcodeFileReader->SetOutputFileDir(strOutputBarcodeDir.c_str());
			}
			if (str == "-l")
			{
				string strOutputBarcodeDir = argv[i + 1];
#ifdef USE_LOAD_LIBARAY 
				barcodeFileReader->SetDBRLibaryPath(strOutputBarcodeDir.c_str());
#endif
			}
			if (str == "-t")
			{
				string strOutputType = argv[i + 1];
				if (stricmp(strOutputType.c_str(), "console") ==0)
				{
					barcodeFileReader->SetOutputType(CBarcodeFileReader::OUTPUT_CONSOLE);
				}
				else
				{
					barcodeFileReader->SetOutputType(CBarcodeFileReader::OUTPUT_FILE);
				}
			}
		}
		barcodeFileReader->Run();
		std::cout << "Complete!" << std::endl;
		if (barcodeFileReader != NULL)
		{
			delete barcodeFileReader;
		}
		return 0;
	}

#ifdef USE_LOAD_LIBARAY
	barcodeFileReader->SetDBRLibaryPath("DynamsoftBarcodeReaderx86.dll");
#endif
	ShowConsole();
	char szBuffer[256] = { 0 };
	string strGettingMessage = "";
	char ichar=' ', iType=' ';
	while (ichar!='q')
	{
		ichar = _getche();//need press the enter. getchar():need press the enter
		if(ichar=='\0')
			ichar= _getche();
		switch (ichar) 
		{
		case 'i':
		case 'I':
			std::cout << "\n Please input the barcode files directory:";
			memset(szBuffer, 0, sizeof(szBuffer));
			strGettingMessage = gets_s(szBuffer, 256);
			barcodeFileReader->LoadBarcodeFiles(strGettingMessage.c_str());
			break;

		case 'o':
		case 'O':
		{
			barcodeFileReader->SetOutputType(CBarcodeFileReader::OUTPUT_FILE);
			std::cout << "\n Please input the output directory for decoding result:";
			memset(szBuffer, 0, sizeof(szBuffer));
			strGettingMessage = gets_s(szBuffer, 256);
			barcodeFileReader->SetOutputFileDir(strGettingMessage.c_str());			
		}
			break;			
			
		case 'r':
		case 'R':
		{
			std::cout << "\n";
			barcodeFileReader->Run();
			std::cout << "Complete!" << std::endl;
			_getche();
			memset(szBuffer, 0, sizeof(szBuffer));
		}
			break;
		case 'q':
		case 'Q':
			ichar = 'q';
			break;
		case ' ':
			break;
		default:
		{
			std::cout << "\n The input commands invalid!" << std::endl;			
		}

		}
		ShowConsoleCmd();
	}
	if (barcodeFileReader != NULL)
	{
		delete barcodeFileReader;
	}
	return 0;
}
Beispiel #20
0
void doSameSession()
{
 char *arg;
 RESULTCODES rc;
 int i,j;

 if (progtitle)
  SetConsoleTitle(progtitle);

 if (fForegroundConsole)
  SelectConsole();

 if (fConsoleSize)
  SetConsoleSize(Console.W, Console.H, colSAME);

 if (fFontSet)
 {
  RECTL r;
  LockConsoleUpdate();
  SetConsoleFontSize(Font.H, Font.W);
  if (fResizeWindowToMax && !fExplicitSize)
   SetMaxConsoleSize();

  // Workaround: NPS WPS does not redraw window shadow when window grows :-(
  GetPixelConsoleSize((int *)&r.xLeft, (int *)&r.yBottom, (int *)&r.xRight, (int *)&r.yTop);
  r.xRight += r.xLeft + 8; r.yTop += r.yBottom + 8;
  r.xLeft -= 8; r.yBottom -= 8;
  WinInvalidateRect(HWND_DESKTOP, &r, FALSE);

  UnlockConsoleUpdate();
 } else
 if (fResizeWindowToMax && !fExplicitSize)
  SetMaxConsoleSize();

 if (fSetBorder)
  SetConsoleBorderSize(Border.W, Border.H);
 if (fSetFlash)
  FlashConsole(fFlashWindow);

 if (fMinimizeConsole)
  MinimizeConsole();
 else if (fMaximizeConsole)
  MaximizeConsole();

 if (GetWindowHWND())
 {
  if ((fExplicitPos || fExplicitSize))
   SetPixelConsoleSize(ConsolePos.X, ConsolePos.Y, ConsolePos.W, ConsolePos.H,
    (fExplicitPos ? SWP_MOVE : 0) | (fExplicitSize ? SWP_SIZE : 0));
  else if (fMaximizeConsole)
   SetPixelConsoleSize(ConsolePos.X, ConsolePos.Y, 0, 0, SWP_MOVE);
 }

 if (fHideConsole)
  ShowConsole(FALSE);
 else if (fShowConsole)
  ShowConsole(TRUE);

 if (fRestoreConsole)
  RestoreConsole();

 if (!progname) return;
 if (!progname[0]) progname = getenv("COMSPEC");
 if (progname) i = strlen(progname); else i = 0;
 j = i; i++;
 if (progargs) i+= strlen(progargs);
 arg = malloc(i);

 if (progname) strcpy(arg, progname); else arg[0] = 0;
 strcat(arg, "*");
 if (progargs) strcat(arg, progargs);
 arg[j] = 0;

 ReleaseINI();
 if (DosExecPgm(NULL, 0, EXEC_SYNC, arg, NULL, &rc, progname))
 {
  SetColor(colLRED, colSAME);
  printf("Error running command %s\n", progname);
  if (_isterm(1)) getch();
  return;
 }
}
Beispiel #21
0
void ToolsPlus::OnRunTarget(wxCommandEvent& event)
{
    int ID=event.GetId();
    wxString commandstr;
    wxString consolename;
    wxString workingdir;
    bool windowed=false;
    bool console=false;
    if (ID>=ID_ContextMenu_0&&ID<=ID_ContextMenu_49)
    {
        m_interpnum=m_contextvec[ID-ID_ContextMenu_0];
        commandstr=m_ic.interps[m_interpnum].command;
        consolename=m_ic.interps[m_interpnum].name;
        windowed=(m_ic.interps[m_interpnum].mode==_("W"));
        console=(m_ic.interps[m_interpnum].mode==_("C"));
        workingdir=m_ic.interps[m_interpnum].wdir;
    }
    else if (ID>=ID_SubMenu_0&&ID<=ID_SubMenu_49)
    {
        m_interpnum=ID-ID_SubMenu_0;
        commandstr=m_ic.interps[m_interpnum].command;
        consolename=m_ic.interps[m_interpnum].name;
        windowed=(m_ic.interps[m_interpnum].mode==_("W"));
        console=(m_ic.interps[m_interpnum].mode==_("C"));
        workingdir=m_ic.interps[m_interpnum].wdir;
        m_wildcard=m_ic.interps[m_interpnum].wildcards;
        if (m_ic.interps[m_interpnum].command.Find(_("$file"))>0 ||
            m_ic.interps[m_interpnum].command.Find(_("$path"))>0)
        {
            m_RunTarget=wxEmptyString;
            EditorManager* edMan = Manager::Get()->GetEditorManager();
            if (edMan && edMan->GetActiveEditor() && edMan->GetActiveEditor()->GetFilename())
            {
                wxFileName activefile(edMan->GetActiveEditor()->GetFilename());
                wxString filename=activefile.GetFullPath();
                wxString name=activefile.GetFullName();
                if (WildCardListMatch(m_ic.interps[m_interpnum].wildcards,name))
                    m_RunTarget=filename;
            }
            if (m_RunTarget==wxEmptyString)
                OnSetTarget(event);
            if (!wxFileName::FileExists(m_RunTarget))
            {
                LogMessage(_("Tools Plus plugin: ")+m_RunTarget+_(" not found"));
                return;
            }
        }
        if (m_ic.interps[m_interpnum].command.Find(_("$dir"))>0)
        {
            OnSetDirTarget(event);
            if (!wxFileName::DirExists(m_RunTarget))
            {
                LogMessage(_("Tools Plus plugin: ")+m_RunTarget+_(" not found"));
                return;
            }
            if (m_RunTarget==_T(""))
                return;
        }
        if (m_ic.interps[m_interpnum].command.Find(_("$mpaths"))>0)
        {
            OnSetMultiTarget(event);
            if (m_RunTarget==_T(""))
                return;
        }
    }
    else
    {
        LogMessage(wxString::Format(_("WARNING: Unprocessed Tools Plus Menu Message: ID %i, IDbase %i, IDend %i, num items on menu %i"),ID,ID_ContextMenu_0,ID_ContextMenu_49,(int)m_contextvec.size()));
        return;
    }

    m_RunTarget.Replace(_T("*"),_T(" "));

    bool setdir=true;
    commandstr.Replace(_("$file"),wxFileName(m_RunTarget).GetShortPath());
    commandstr.Replace(_("$relfile"),wxFileName(m_RunTarget).GetFullName());
    commandstr.Replace(_("$fname"),wxFileName(m_RunTarget).GetName());
    commandstr.Replace(_("$fext"),wxFileName(m_RunTarget).GetExt());
    commandstr.Replace(_("$dir"),wxFileName(m_RunTarget).GetShortPath());
    commandstr.Replace(_("$reldir"),wxFileName(m_RunTarget).GetFullName());
    commandstr.Replace(_("$path"),wxFileName(m_RunTarget).GetShortPath());
    commandstr.Replace(_("$relpath"),wxFileName(m_RunTarget).GetFullPath());
    if (commandstr.Replace(_("$mpaths"),m_RunTarget)>0)
        setdir=false;

    // substitute user prompted values in the format: $inputstr{Enter your message}
    int promptind=commandstr.Find(_("$inputstr{"));
    wxString substitution;
    while (promptind>=0)
    {
        int promptend=commandstr.Mid(promptind+10).Find(_("}"));
        if (promptend<=0)
        {
            cbMessageBox(_("Malformed $inputstr in command line -- no closing '}' found: ")+commandstr);
            return;
        }
        else
            promptend++;
        wxTextEntryDialog ted(NULL,commandstr.Mid(promptind+10,promptend-1),consolename,_T(""),wxOK|wxCANCEL);
        if (ted.ShowModal()==wxID_OK)
            substitution=ted.GetValue();
        else
            return;
        commandstr=commandstr.Left(promptind)+substitution+commandstr.Mid(promptind+10+promptend);
        int nextind=commandstr.Mid(promptind+substitution.Len()).Find(_("$inputstr"));
        if (nextind>=0)
            promptind+=nextind+substitution.Len();
        else
            promptind=-1;
    }

    commandstr.Replace(_("$interpreter"),wxFileName(m_ic.interps[m_interpnum].command).GetShortPath());
    workingdir.Replace(_("$parentdir"),wxFileName(m_RunTarget).GetPath());
    if (wxFileName::DirExists(m_RunTarget))
        workingdir.Replace(_("$dir"),wxFileName(m_RunTarget).GetFullPath());

    if (Manager::Get()->GetMacrosManager())
    {
        Manager::Get()->GetMacrosManager()->RecalcVars(0, 0, 0); // hack to force-update macros
        Manager::Get()->GetMacrosManager()->ReplaceMacros(commandstr);
        Manager::Get()->GetMacrosManager()->ReplaceMacros(workingdir);
    }
    wxString olddir=wxGetCwd();
    if (setdir && workingdir!=_T(""))
    {
        if (!wxSetWorkingDirectory(workingdir))
        {
            LogMessage(_("Tools Plus Plugin: Can't change to working directory to ")+workingdir);
            return;
        }
    }

    LogMessage(wxString::Format(_("Launching '%s': %s (in %s)"), consolename.c_str(), commandstr.c_str(), workingdir.c_str()));

    if (windowed)
    {
        wxArrayString astr;
        m_shellmgr->LaunchProcess(commandstr,consolename,_("Piped Process Control"),astr);
        ShowConsole();
    } else if (console)
    {
        wxString cmdline;
#ifndef __WXMSW__
        // for non-win platforms, use m_ConsoleTerm to run the console app
        wxString term = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/console_terminal"), DEFAULT_CONSOLE_TERM);
        term.Replace(_T("$TITLE"), _T("'") + consolename + _T("'"));
        cmdline<< term << _T(" ");
        #define CONSOLE_RUNNER "cb_console_runner"
#else
        #define CONSOLE_RUNNER "cb_console_runner.exe"
#endif
        wxString baseDir = ConfigManager::GetExecutableFolder();
        if (wxFileExists(baseDir + wxT("/" CONSOLE_RUNNER)))
            cmdline << baseDir << wxT("/" CONSOLE_RUNNER " ");
        cmdline<<commandstr;

        if (!wxExecute(cmdline))
            cbMessageBox(_("Command Launch Failed: ")+commandstr);
    }
    else
    {
        if (!wxExecute(commandstr))
            cbMessageBox(_("Command Launch Failed: ")+commandstr);
    }
    wxSetWorkingDirectory(olddir);
}
Beispiel #22
0
static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole);

	FontIDT fid = {0};
	fid.cbSize = sizeof(fid);
	_tcscpy(fid.group,_T("Console"));
	_tcscpy(fid.name,TranslateT("Text"));
	strcpy(fid.dbSettingsGroup,"Console");
	strcpy(fid.prefix,"ConsoleFont");
	_tcscpy(fid.backgroundGroup,_T("Console"));
	_tcscpy(fid.backgroundName,_T("Background"));
	fid.flags = FIDF_DEFAULTVALID;
	fid.deffontsettings.charset = DEFAULT_CHARSET;
	fid.deffontsettings.colour = RGB(0, 0, 0);
	fid.deffontsettings.size = 10;
	fid.deffontsettings.style = 0;
	_tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE);
	FontRegisterT(&fid);

	HookEvent(ME_FONT_RELOAD,OnFontChange);

	ColourIDT cid = {0};
	cid.cbSize=sizeof(cid);
	_tcscpy(cid.group,_T("Console"));
	_tcscpy(cid.name,_T("Background"));
	strcpy(cid.dbSettingsGroup,"Console");
	strcpy(cid.setting,"BgColor");
	cid.defcolour = RGB(255,255,255);
	ColourRegisterT(&cid);

	HookEvent(ME_COLOUR_RELOAD, OnColourChange);

	HOTKEYDESC hkd = {0};
	hkd.cbSize = sizeof(hkd);
	hkd.pszName = "Console_Show_Hide";
	hkd.pszDescription = LPGEN("Show/Hide Console");
	hkd.pszSection = "Main";
	hkd.pszService = MS_CONSOLE_SHOW_HIDE;
	hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C');
	Hotkey_Register(&hkd);

	if (hwndConsole && IsWindow(hwndConsole))
	{
		HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded);

		CLISTMENUITEM mi = { sizeof(mi) };
		mi.flags = CMIF_TCHAR;
		mi.hIcon = hIcons[0];
		mi.ptszPopupName = LPGENT("&Help");
		mi.popupPosition = 2000090000;
		mi.position = 1000000000;
		mi.ptszName = (IsWindowVisible(hwndConsole)) ? LPGENT("Hide Console") : LPGENT("Show Console");
		mi.pszService = MS_CONSOLE_SHOW_HIDE;
		hMenu = Menu_AddMainMenuItem(&mi);

		OnFontChange(0,0);
		OnColourChange(0,0);

		if (db_get_b(NULL,"Console","ShowAtStart",0) || db_get_b(NULL,"Console","Show",1))
			ShowConsole(1);
		else
			ShowConsole(0);
	}

	return 0;
}