// Initialize using code only
bool ofxOpenNIContext::setup() {
	if (initContext()) {
		addLicense("PrimeSense", "0KOIk2JeIBYClPWVnMoRKn5cdY4=");
		enableLogging();
		return true;
	} else return false;
}
MainWindow::MainWindow(HINSTANCE instance)
:	m_inDialog(false),
	m_parent(nullptr),
	m_instance(instance),
	m_emptyLink(nullptr)
{
	enableLogging(settings::settings()[L"general"][L"log"].asNumber() != 0);

	LOG(L"creating MainWindow");

	registerWindowClass(instance, loadString(instance, IDC_LAUNCHGRID).c_str());

	m_wnd = createMainWindow();

	createFonts();

	LOG(L"creating static controls");
	m_titleLabel = CreateWindow(L"STATIC", loadString(instance, IDS_APP_TITLE).c_str(), WS_CHILD | WS_VISIBLE, 8, 4, 120, 30, m_wnd, nullptr, instance, nullptr);
	SendMessage(m_titleLabel, WM_SETFONT, (WPARAM)m_titleFont, 0);

	m_menu = CreateWindow(L"BUTTON", L"Menu", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, 240 - 8 - 24, 4, 24, 24, m_wnd, nullptr, instance, nullptr);
	SetWindowLong(m_menu, GWL_ID, IDC_MENU);

	createControls();

	LOG(L"showing window");
	ShowWindow(m_wnd, settings::settings()[L"general"][L"bottomWindow"].asNumber() ? SW_SHOWNOACTIVATE : SW_SHOW);
	if (settings::settings()[L"general"][L"bottomWindow"].asNumber())
	{
		LOG(L"moving window to background");
		SetWindowPos(m_wnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
	}
	UpdateWindow(m_wnd);
}
/*!
    Constructor.
 */
QxtBasicSTDLoggerEngine::QxtBasicSTDLoggerEngine()
{
    QXT_INIT_PRIVATE(QxtBasicSTDLoggerEngine);
#ifndef QT_NO_DEBUG
    setLogLevelsEnabled(QXT_REQUIRED_LEVELS);
#else
    setLogLevelsEnabled(QXT_REQUIRED_LEVELS | QxtLogger::DebugLevel);
#endif
    enableLogging();
}
void MainWindow::applySettings()
{
	enableLogging(settings::settings()[L"general"][L"log"].asNumber() != 0);
	for (auto tab : m_tabs)
	{
		DestroyWindow(tab);
	}
	m_tabs.clear();
	for (auto table : m_tables)
	{
		delete table;
	}
	m_tables.clear();

	if (settings::settings()[L"general"][L"bottomWindow"].asNumber())
	{
		if (!m_parent)
		{
			auto newWnd = createMainWindow();
			SetParent(m_titleLabel, newWnd);
			SetParent(m_menu, newWnd);
			DestroyWindow(m_wnd);
			m_wnd = newWnd;
			ShowWindow(m_wnd, SW_SHOW);
		}
		if (settings::settings()[L"general"][L"autoStart"])
		{
			registerAutorun();
		}
		else
		{
			unregisterAutorun();
		}
	}
	else
	{
		if (m_parent)
		{
			auto parent = m_parent;
			
			auto newWnd = createMainWindow();
			SetParent(m_titleLabel, newWnd);
			SetParent(m_menu, newWnd);
			DestroyWindow(m_wnd);
			m_wnd = newWnd;
			ShowWindow(m_wnd, SW_SHOW);

			DestroyWindow(parent);
		}
		unregisterAutorun();
	}

	createControls();
	InvalidateRect(m_wnd, nullptr, TRUE);
}
void ResourceManager::add(const std::string& name, const std::shared_ptr<storage::AbstractResource>& resource) const {
  auto lock = lock_guard(_resource_mutex);
  if (exists(name)) {
    throw ResourceAlreadyExistsException("ResourceManager: Resource '" + name + "' already exists");
  }

  auto store = std::dynamic_pointer_cast<storage::Store>(resource);
  if (store) {
    store->enableLogging();
  }
  _resources.insert(make_pair(name, resource));
}
ApiCase::IterateResult ApiCase::iterate (void)
{
	// Initialize result to pass.
	m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");

	// Enable call logging.
	enableLogging(true);

	// Run test.
	test();

	return STOP;
}
void
FACPreconditioner::getFromInput(
    tbox::Pointer<tbox::Database> db)
{
    if (db.isNull()) return;

    MGCycleType cycle_type = string_to_enum<MGCycleType>(db->getStringWithDefault("cycle_type", enum_to_string<MGCycleType>(d_cycle_type)));
    setMGCycleType(cycle_type);

    int num_pre_sweeps = db->getIntegerWithDefault("num_pre_sweeps", d_num_pre_sweeps);
    setNumPreSmoothingSweeps(num_pre_sweeps);

    int num_post_sweeps = db->getIntegerWithDefault("num_post_sweeps", d_num_post_sweeps);
    setNumPostSmoothingSweeps(num_post_sweeps);

    bool logging = db->getBoolWithDefault("enable_logging", d_do_log);
    enableLogging(logging);
    return;
}// getFromInput
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
ChopperMain::~ChopperMain()
{
    enableRanger(0);
    enableLogging(0);
}
Exemple #9
0
nemo_status_t
nemo_log_stdout(nemo_configuration_t conf)
{
	CATCH_(conf, enableLogging());
}
Exemple #10
0
bool MGMap::runConsoleCommand(const char *c, MGFramework *w, MGSymbolTable *s)
{
	char cmd[MGF_SCRIPTLINE_MAXLENGTH];
	strcpy(cmd, c);
	std::vector<std::string> cmdvec = MGFramework::split(cmd, " ");

	switch(detectMGComponentConsoleCommand(cmdvec))
	{
		case MGComponent_UNDEFINED:
			MGFLOG_ERROR("MGMap::runConsoleCommand received MGComponent_UNDEFINED from MGMap::detectMGComponentConsoleCommand"); 
			break;

		case MGComponent_MAP_HELP:
		{
			std::cout << "-----------------------------------------------------------------------------" << std::endl << std::endl;
			std::cout << "map help - Displays help information for console commands implemented in the" << std::endl;
			std::cout << "           map object." << std::endl;
			return true;
		}

		case MGComponent_MAP_PATH_INT_INT_INT_INT:
		{
			int x1 = w->toInt(cmdvec[2], s);
			int y1 = w->toInt(cmdvec[3], s);
			int x2 = w->toInt(cmdvec[4], s);
			int y2 = w->toInt(cmdvec[5], s);
			MGFLOG_INFO("Calculating closest path from (" << x1 << "," << y1 << ") to (" << x2 << "," << y2 << ").");
			calculatePath(MGFBASICPATH1, x1, y1, x2, y2);
			return true;
		}

		case MGComponent_MAP_SETSIZE_INT_INT_INT_INT:
		{
			int x = w->toInt(cmdvec[2], s);
			int y = w->toInt(cmdvec[3], s);
			int tx = w->toInt(cmdvec[4], s);
			int ty = w->toInt(cmdvec[5], s);
			reInit(x, y, tx, ty);
			return true;
		}

		case MGComponent_MAP_LOGGING_ON:
		{
			enableLogging();
			MGFLOG_INFO("Logging enabled.");
			return true;
		}

		case MGComponent_MAP_LOGGING_OFF:
		{
			disableLogging();
			MGFLOG_INFO("Logging disabled.");
			return true;
		}

		default:
			MGFLOG_ERROR("MGMap::detectComponentConsoleCommand returned a bad value"); 
			return true;
	}

	std::cout << "Unknown command" << std::endl;
	return true;
}
Exemple #11
0
GraphicsContext3DInternal::GraphicsContext3DInternal(HTMLCanvasElement* canvas,
                                                     GraphicsContext3D::Attributes attrs,
                                                     HostWindow* hostWindow)
    : m_proxy(adoptRef(new GraphicsContext3DProxy()))
    , m_compositingLayer(new WebGLLayer(m_proxy))
    , m_canvas(canvas)
    , m_attrs(attrs)
    , m_layerComposited(false)
    , m_canvasDirty(false)
    , m_width(1)
    , m_height(1)
    , m_maxwidth(CANVAS_MAX_WIDTH)
    , m_maxheight(CANVAS_MAX_HEIGHT)
    , m_dpy(EGL_NO_DISPLAY)
    , m_config(0)
    , m_surface(EGL_NO_SURFACE)
    , m_context(EGL_NO_CONTEXT)
    , m_syncThread(0)
    , m_threadState(THREAD_STATE_STOPPED)
    , m_syncTimer(this, &GraphicsContext3DInternal::syncTimerFired)
    , m_syncRequested(false)
    , m_webGLFPSTimer(0)
    , m_extensions(0)
    , m_contextId(0)
    //[CAPPFIX_WEB_WEBGL] - Handle FBO creation failure
    , m_nfbo(0)
    //[CAPPFIX_WEB_WEBGL_END]
    //[CAPPFIX_WEB_WEBGL] - Improve UI Response Begin
    , m_needImproveUIResponseMode(false)
    //[CAPPFIX_WEB_WEBGL_END]
{
    enableLogging();

    LOGWEBGL("GraphicsContext3DInternal() = %p, m_compositingLayer = %p", this, m_compositingLayer);
    m_proxy->setGraphicsContext(this);

    if (!m_canvas || !m_canvas->document() || !m_canvas->document()->view())
        return;
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    WebViewCore* core = WebViewCore::getWebViewCore(m_canvas->document()->view());
    if (!core)
        return;
    jobject tmp = core->getWebViewJavaObject();
    m_webView = env->NewGlobalRef(tmp);
    if (!m_webView)
        return;
    jclass webViewClass = env->GetObjectClass(m_webView);
    m_postInvalidate = env->GetMethodID(webViewClass, "postInvalidate", "()V");
    env->DeleteLocalRef(webViewClass);
    if (!m_postInvalidate)
        return;

    if (!initEGL())
        return;
    //[CAPPFIX_WEB_WEBGL] - for WebGL Conformance Test
    if (contextCounter > 10)
    {
        LOGWEBGL("call m_canvas->document()->frame()->script()->lowMemoryNotification()");
        m_canvas->document()->frame()->script()->lowMemoryNotification();
    }
    // [CAPPFIX_WEB_WEBGL_END] - end
    if (!createContext(true)) {
        LOGWEBGL("Create context failed. Perform JS garbage collection and try again.");
        // Probably too many contexts. Force a JS garbage collection, and then try again.
        // This typically only happens in Khronos Conformance tests.
        m_canvas->document()->frame()->script()->lowMemoryNotification();
        if (!createContext(true)) {
            LOGWEBGL("Create context still failed: aborting.");
            return;
        }
    }

    m_webGLFPSTimer.set(new WebGLFPSTimer());

    const char *ext = (const char *)glGetString(GL_EXTENSIONS);
    LOGWEBGL("GL_EXTENSIONS = %s", ext);
    // Want to keep control of which extensions are used
    String extensions = "";
    if (strstr(ext, "GL_OES_texture_npot"))
        extensions.append("GL_OES_texture_npot");
    //[CAPPFIX_WEB_WEBGL] - Do not support extension at this time.
#if 0
    if (strstr(ext, "GL_OES_packed_depth_stencil"))
        extensions.append(" GL_OES_packed_depth_stencil");
    if (strstr(ext, "GL_OES_texture_float"))
        extensions.append(" GL_OES_texture_float");
#endif
    m_extensions.set(new Extensions3DAndroid(extensions));
    //[CAPPFIX_WEB_WEBGL_END]
    // ANGLE initialization.
    ShBuiltInResources resources;
    ShInitBuiltInResources(&resources);

    glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &resources.MaxVertexAttribs);
    glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &resources.MaxVertexUniformVectors);
    glGetIntegerv(GL_MAX_VARYING_VECTORS, &resources.MaxVaryingVectors);
    glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &resources.MaxVertexTextureImageUnits);
    glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &resources.MaxCombinedTextureImageUnits);
    glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &resources.MaxTextureImageUnits);
    glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &resources.MaxFragmentUniformVectors);

    resources.MaxDrawBuffers = 1;
    m_compiler.setResources(resources);

    m_savedViewport.x = 0;
    m_savedViewport.y = 0;
    m_savedViewport.width = m_width;
    m_savedViewport.height = m_height;

    glClearColor(0, 0, 0, 0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    startSyncThread();
    //[CAPPFIX_WEB_WEBGL] - for WebGL Conformance Test
    //static int contextCounter = 1;
    m_contextId = contextCounter++;
}
 ResourceManager() {
     enableLogging();
 }