Esempio n. 1
0
static void MidiTakePreviewTimer ()
{
	if (g_itemPreviewPlaying)
	{
		#ifdef _WIN32
			EnterCriticalSection(&g_ItemPreview.cs);
		#else
			pthread_mutex_lock(&g_ItemPreview.mutex);
		#endif

		// Have we reached the end?
		if (g_ItemPreview.curpos >= g_ItemPreview.src->GetLength())
		{
			#ifdef _WIN32
				LeaveCriticalSection(&g_ItemPreview.cs);
			#else
				pthread_mutex_unlock(&g_ItemPreview.mutex);
			#endif
			MidiTakePreview(0, NULL, NULL, 0, 0, 0, false);
			plugin_register("-timer",(void*)MidiTakePreviewTimer);
		}
		else
		{
			#ifdef _WIN32
				LeaveCriticalSection(&g_ItemPreview.cs);
			#else
				pthread_mutex_unlock(&g_ItemPreview.mutex);
			#endif
		}
	}
	else
	{
		plugin_register("-timer",(void*)MidiTakePreviewTimer);
	}
}
Esempio n. 2
0
File: Color.cpp Progetto: wolqws/sws
void RecRedRuler(COMMAND_T*)
{
	g_bRecRedRuler = !g_bRecRedRuler;
	if (g_bRecRedRuler) plugin_register("timer", (void*)ColorTimer);
	else                plugin_register("-timer",(void*)ColorTimer);  
	WritePrivateProfileString(SWS_INI, RECREDRULER_KEY, g_bRecRedRuler ? "1" : "0", get_ini_file());
}
Esempio n. 3
0
void MarkerActionsToggle(COMMAND_T* = NULL)
{
	g_bMAEnabled = !g_bMAEnabled;
	if (g_bMAEnabled) plugin_register("timer", (void*)MarkerActionTimer);
	else              plugin_register("-timer",(void*)MarkerActionTimer);
	WritePrivateProfileString("SWS", "MarkerActionsEnabled", g_bMAEnabled ? "1" : "0", get_ini_file());
	RefreshMAToolbar();
}
// Returns the COMMAND_T entry (so it can be freed if necessary)
COMMAND_T* SWSUnregisterCmd(int id)
{
	if (COMMAND_T* ct = g_commands.Get(id, NULL))
	{
		plugin_register("-gaccel", &ct->accel);
		plugin_register("-command_id", &id);
		g_commands.Delete(id);
#ifdef ACTION_DEBUG
		g_cmdFiles.Delete(id);
#endif
		return ct;
	}
	return NULL;
}
gboolean
add_contextual_data_module_init(GlobalConfig *cfg, CfgArgs *args)
{
  plugin_register(cfg, add_contextual_data_plugins,
                  G_N_ELEMENTS(add_contextual_data_plugins));
  return TRUE;
}
Esempio n. 6
0
gboolean
dbparser_module_init(GlobalConfig *cfg, CfgArgs *args)
{
  pattern_db_global_init();
  plugin_register(cfg, dbparser_plugins, G_N_ELEMENTS(dbparser_plugins));
  return TRUE;
}
Esempio n. 7
0
int ProjectMgrInit()
{
	SWSRegisterCommands(g_projMgrCmdTable);

	// Save the index of OpenRelatedProject() for later
	g_iORPCmdIndex = -1;
	while (g_projMgrCmdTable[++g_iORPCmdIndex].doCommand != OpenRelatedProject);

	if (!plugin_register("projectconfig",&g_projectconfig))
		return 0;

	if (!plugin_register("hookcustommenu", (void*)menuhook))
		return 0;

	return 1;
}
gboolean
basicfuncs_plus_module_init(GlobalConfig *cfg, CfgArgs *args)
{
  plugin_register(cfg, basicfuncs_plus_plugins,
                  G_N_ELEMENTS(basicfuncs_plus_plugins));
  return TRUE;
}
Esempio n. 9
0
gboolean
syslogformat_module_init(GlobalConfig *cfg, CfgArgs *args)
{
  syslog_format_init();
  plugin_register(cfg, syslog_format_plugins, G_N_ELEMENTS(syslog_format_plugins));
  return TRUE;
}
Esempio n. 10
0
int VersionCheckInitExit (bool init)
{
	if (init)
	{
		bool official, beta; unsigned int lastTime;
		GetStartupSearchOptions (&official, &beta, &lastTime);

		if (official || beta)
		{
			// Make sure at least 24 hours have passed since the last search
			unsigned int currentTime = (unsigned int)time(NULL);
			if (currentTime - lastTime >= 86400 || currentTime - lastTime < 0)
			{
				SetStartupSearchOptions(official, beta, currentTime);

				g_searchObject = new (nothrow) BR_SearchObject(true);
				return plugin_register("timer",(void*)StartupSearch); // timer starts only after project gets loaded
			}
		}
	}
	else
	{
		if (g_searchObject)
			delete g_searchObject;
		g_searchObject = NULL;
		StartupSearch();
	}

	return 1;
}
Esempio n. 11
0
int SNM_ProjectInit()
{
  char buf[SNM_MAX_ACTION_CUSTID_LEN]="";
  GetPrivateProfileString("Misc", "GlobalStartupAction", "", buf, sizeof(buf), g_SNM_IniFn.Get());
  g_globalAction.Set(buf);
  return plugin_register("projectconfig", &s_projectconfig);
}
Esempio n. 12
0
gboolean
tfgeoip_module_init(GlobalConfig *cfg, CfgArgs *args)
{
  tf_geoip_init();
  plugin_register(cfg, tfgeoip_plugins, G_N_ELEMENTS(tfgeoip_plugins));
  return TRUE;
}
Esempio n. 13
0
gboolean
redis_module_init(GlobalConfig *cfg, CfgArgs *args)
{
  plugin_register(cfg, &redis_plugin, 1);

  return TRUE;
}
Esempio n. 14
0
int xmsg_plugin_init(int prio)
{
	PLUGIN_CHECK_VER("xmsg");
#ifdef HAVE_INOTIFY
	if ((in_fd = inotify_init()) == -1)
		xerrn("unable to init inotify");
#endif /*HAVE_INOTIFY*/
	
	xdebug("inotify fd = %d", in_fd);
	
	xmsg_plugin.params	= xmsg_plugin_vars;
	xmsg_plugin.priv	= &xmsg_priv;
	plugin_register(&xmsg_plugin, prio);

	query_connect_id(&xmsg_plugin, PROTOCOL_VALIDATE_UID, xmsg_validate_uid, NULL);
	query_connect_id(&xmsg_plugin, EKG_SIGUSR1, xmsg_handle_sigusr, NULL);

#define XMSG_CMDFLAGS SESSION_MUSTBELONG
#define XMSG_CMDFLAGS_TARGET SESSION_MUSTBELONG|COMMAND_ENABLEREQPARAMS|COMMAND_PARAMASTARGET|SESSION_MUSTBECONNECTED
	command_add(&xmsg_plugin, "xmsg:", "?", xmsg_inline_msg, XMSG_CMDFLAGS, NULL);
	command_add(&xmsg_plugin, "xmsg:chat", "!uU !", xmsg_msg, XMSG_CMDFLAGS_TARGET, NULL);
	command_add(&xmsg_plugin, "xmsg:connect", NULL, xmsg_connect, XMSG_CMDFLAGS, NULL);
	command_add(&xmsg_plugin, "xmsg:disconnect", NULL, xmsg_disconnect, XMSG_CMDFLAGS, NULL);
	command_add(&xmsg_plugin, "xmsg:msg", "!uU !", xmsg_msg, XMSG_CMDFLAGS_TARGET, NULL);
	command_add(&xmsg_plugin, "xmsg:reconnect", NULL, xmsg_reconnect, XMSG_CMDFLAGS, NULL);
#undef XMSG_CMDFLAGS_TARGET
#undef XMSG_CMDFLAGS

#ifdef HAVE_INOTIFY
	variable_add(&xmsg_plugin, "max_inotifycount", VAR_INT, 1, &config_maxinotifycount, NULL, NULL, NULL);
	watch_add(&xmsg_plugin, in_fd, WATCH_READ, xmsg_handle_data, NULL);
#endif /*HAVE_INOTIFY*/
	
	return 0;
}
Esempio n. 15
0
int EditCursorInit()
{
	SWSRegisterCommands(g_commandTable);
	if (!plugin_register("projectconfig",&g_projectconfig))
		return 0;
	return 1;
}
Esempio n. 16
0
int MarkerActionsInit()
{
	SWSRegisterCommands(g_commandTable);

	g_bMAEnabled = GetPrivateProfileInt("SWS", "MarkerActionsEnabled", 1, get_ini_file()) ? true : false;
	if (g_bMAEnabled) plugin_register("timer", (void*)MarkerActionTimer);
	return 1;
}
Esempio n. 17
0
int pi_configlock_init ()
{
    plugin_configlock = plugin_register ("configlock");

    plugin_request (plugin_configlock, PLUGIN_EVENT_CONFIG, (void *) &pi_configlock_event_config);
    plugin_request (plugin_configlock, PLUGIN_EVENT_LOAD, (void *) &pi_configlock_event_load);

    return 0;
}
Esempio n. 18
0
// unregister exported functions
void UnregisterExportedFuncs()
{
	char tmp[512];
	int i=-1;
	while (g_apidefs[++i].func)
	{
		_snprintf(tmp, sizeof(tmp), "-%s", g_apidefs[i].regkey_func);
		plugin_register(tmp, g_apidefs[i].func);
	}
}
Esempio n. 19
0
int TrackListInit()
{
	if (!plugin_register("projectconfig",&g_projectconfig))
		return 0;

	SWSRegisterCommands(g_commandTable);

	g_pList = new SWS_TrackListWnd;

	return 1;
}
Esempio n. 20
0
static bool_t scan_plugin_func(const char * path, const char * basename, gpointer data)
{
    if (!str_has_suffix_nocase(basename, SHARED_SUFFIX))
        return FALSE;

    if (!g_file_test(path, G_FILE_TEST_IS_REGULAR))
        return FALSE;

    plugin_register (path);

    return FALSE;
}
// 1) Get command ID from Reaper
// 2) Add keyboard accelerator (with localized action name) and add to the "action" list
int SWSRegisterCmd(COMMAND_T* pCommand, const char* cFile, int cmdId, bool localize)
{
	if (pCommand->doCommand)
	{
		// SWS - Unfortunately can't check for duplicate actions here because when commands are used in the mouse editor
		//   they have a command ID (53000+) assigned before SWS is even loaded.
		// char pId[128];
		// if (_snprintf(pId, 128, "_%s", pCommand->id)<=0 || NamedCommandLookup(pId))
		//	return 0; // duplicated action

		if (!cmdId && !(cmdId = plugin_register("command_id", (void*)pCommand->id)))
			return 0;

		pCommand->accel.accel.cmd = cmdId;

		// localized action name, if needed
		const char* defaultName = pCommand->accel.desc;
		if (localize)
			pCommand->accel.desc = GetLocalizedActionName(pCommand->accel.desc); // no alloc + no-op when no LangPack file is defined
		
		if (!plugin_register("gaccel", &pCommand->accel))
			return 0;

		// now that it is registered, restore the default action name
		if (pCommand->accel.desc != defaultName)
			pCommand->accel.desc = defaultName;

		if (!g_iFirstCommand || g_iFirstCommand > cmdId)
			g_iFirstCommand = cmdId;
		if (cmdId > g_iLastCommand)
			g_iLastCommand = cmdId;

		g_commands.Insert(cmdId, pCommand);
#ifdef ACTION_DEBUG
		g_cmdFiles.Insert(cmdId, new WDL_String(cFile));
#endif
	}
	return pCommand->accel.accel.cmd;
}
Esempio n. 22
0
void
cfg_lexer_register_generator_plugin(PluginContext *context, CfgBlockGenerator *gen)
{
  GeneratorPlugin *plugin = g_new0(GeneratorPlugin, 1);

  plugin->super.type = gen->context | LL_CONTEXT_FLAG_GENERATOR;
  plugin->super.name = g_strdup(gen->name);
  plugin->super.free_fn = _generator_plugin_free;
  plugin->super.construct = _generator_plugin_construct;
  plugin->gen = gen;

  plugin_register(context, &plugin->super, 1);
}
Esempio n. 23
0
// per-project action timer armed via ProcessExtensionLine()
void ProjectStartupActionTimer()
{
	plugin_register("-timer",(void*)ProjectStartupActionTimer);
	if (int cmdId = NamedCommandLookup(g_prjActions.Get()->Get()))
	{
		Main_OnCommand(cmdId, 0);
#ifdef _SNM_DEBUG
		OutputDebugString("ProjectStartupActionTimer() - Performed project startup action '");
		OutputDebugString(g_prjActions.Get()->Get());
		OutputDebugString("'\n");
#endif
	}
}
Esempio n. 24
0
File: Color.cpp Progetto: wolqws/sws
int ColorInit()
{
	SWSRegisterCommands(g_commandTable);
	srand((UINT)time(NULL));

	if (!plugin_register("hookcustommenu", (void*)menuhook))
		return 0;

	// Load color gradients from the INI file
	// Restore state
	char str[256];
	GetPrivateProfileString(SWS_INI, GRADIENT_COLOR_KEY, "0 16777215", str, 256, get_ini_file());
	LineParser lp(false);
	if (!lp.parse(str))
	{
		g_crGradStart = lp.gettoken_int(0);
		g_crGradEnd = lp.gettoken_int(1);
	}
	g_bRecRedRuler = GetPrivateProfileInt(SWS_INI, RECREDRULER_KEY, g_bRecRedRuler, get_ini_file()) ? true : false;
	if (g_bRecRedRuler) plugin_register("timer", (void*)ColorTimer);

	return 1;
}
Esempio n. 25
0
/******************************************************************************
* Startup functionality                                                       *
******************************************************************************/
static void StartupSearch ()
{
	if (g_searchObject)
	{
		int status = g_searchObject->GetStatus(NULL, NULL);
		if (status != SEARCH_INITIATED)
		{
			if (status == OFFICIAL_AVAILABLE || status == BETA_AVAILABLE || status == BOTH_AVAILABLE)
				DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_BR_VERSION), g_hwndParent, DialogProc, (LPARAM)g_searchObject);
			delete g_searchObject;
			g_searchObject = NULL;
		}
	}
	else
		plugin_register("-timer",(void*)StartupSearch);
}
Esempio n. 26
0
static bool ProcessExtensionLine(const char *line, ProjectStateContext *ctx, bool isUndo, struct project_config_extension_t *reg)
{
	LineParser lp(false);
	if (lp.parse(line) || lp.getnumtokens() < 1)
		return false;

	if (!strcmp(lp.gettoken_str(0), "S&M_PROJACTION"))
	{
		g_prjActions.Get()->Set(lp.gettoken_str(1));

		if (!isUndo && g_prjActions.Get()->GetLength() && IsActiveProjectInLoadSave())
			plugin_register("timer",(void*)ProjectStartupActionTimer);
		return true;
	}
	return false;
}
Esempio n. 27
0
void TieFileToProject(const char* _fn, ReaProject* _prj, bool _tie)
{
	if (_fn && *_fn)
	{
		if (ReaProject* prj = _prj ? _prj : EnumProjects(-1, NULL, 0))
		{
			void *p[2] = { (void*)_fn, (void*)prj };
			plugin_register(_tie ? "file_in_project_ex" : "-file_in_project_ex", p);
#ifdef _SNM_DEBUG
			char dbg[256]="";
			_snprintfSafe(dbg, sizeof(dbg), "TieFileToProject() - ReaProject: %p, %s %s\n", prj, _tie ? "Added" : "Removed", _fn);
			OutputDebugString(dbg);
#endif
		}
	}
}
Esempio n. 28
0
static bool_t scan_plugin_func(const char * path, const char * basename, void * data)
{
    if (!str_has_suffix_nocase(basename, PLUGIN_SUFFIX))
        return FALSE;

    struct stat st;
    if (stat (path, & st))
    {
        fprintf (stderr, "Unable to stat %s: %s\n", path, strerror (errno));
        return FALSE;
    }

    if (S_ISREG (st.st_mode))
        plugin_register (path, st.st_mtime);

    return FALSE;
}
Esempio n. 29
0
static bool ProcessExtensionLine(const char *line, ProjectStateContext *ctx, bool isUndo, struct project_config_extension_t *reg)
{
	LineParser lp(false);
	if (lp.parse(line) || lp.getnumtokens() < 1)
		return false;

	if (!strcmp(lp.gettoken_str(0), "S&M_PROJACTION"))
	{
		g_prjActions.Get()->Set(lp.gettoken_str(1));

		// by default, a registered timer is not armed when 
		// loading projects, only when launching REAPER, so...
		if (!isUndo && g_prjActions.Get()->GetLength() && IsActiveProjectInLoadSave())
			plugin_register("timer",(void*)OnTriggerActionTimer);
		return true;
	}
	return false;
}
Esempio n. 30
0
EXPORT int sniff_plugin_init(int prio) {
	PLUGIN_CHECK_VER("sniff");

	sniff_plugin.params = sniff_plugin_vars;
	plugin_register(&sniff_plugin, prio);

	ekg_recode_cp_inc();
	ekg_recode_utf8_inc();

	query_connect(&sniff_plugin, "protocol-validate-uid",	sniff_validate_uid, NULL);
	query_connect(&sniff_plugin, "status-show",		sniff_status_show, NULL);
	query_connect(&sniff_plugin, "plugin-print-version",	sniff_print_version, NULL);
	query_connect(&sniff_plugin, "session-removed",	sniff_session_deinit, NULL);

	command_add(&sniff_plugin, "sniff:connect", NULL, sniff_command_connect,    SESSION_MUSTBELONG, NULL);
	command_add(&sniff_plugin, "sniff:connections", NULL, sniff_command_connections, SESSION_MUSTBELONG | SESSION_MUSTBECONNECTED, NULL);
	command_add(&sniff_plugin, "sniff:disconnect", NULL,sniff_command_disconnect, SESSION_MUSTBELONG, NULL);

	return 0;
}