Пример #1
0
//===========================================================================
DLL_EXPORT int beginPlugin(HINSTANCE hPluginInstance)
//DLL_EXPORT int beginPluginEx(HINSTANCE hPluginInstance, HWND hSlit)
{

    const char *bbv;
    int a,b,c;
    bbv = GetBBVersion();
    c = 0;
    bblean_version = sscanf(bbv, "bbLean %d.%d.%d", &a, &b, &c)
        >= 2 ? a*1000+b*10+c : 0;

    // dbg_printf("bblean_version %d", bblean_version);

    struct plugin_info *p;
    int n_inst;

    for (p = g_PI, n_inst = 0; p; p = p->next, ++n_inst);

    struct slit_info *PI = new slit_info();
    PI->n_inst = n_inst;
    sprintf(PI->m_szInstName, n_inst ? "%s.%d":"%s", szAppName, 1+n_inst);

    //PI->hSlit       = hSlit;
    PI->hInstance   = hPluginInstance;
    PI->class_name  = n_inst ? "BBSlit.X" : szAppName;
    PI->rc_key      = PI->m_szInstName;
    PI->broam_key   = PI->m_szInstName;

    PI->getRCSettings();

    if (false == BBP_Init_Plugin(PI))
    {
        delete PI;
        return BEGINPLUGIN_FAILED;
    }

    if (0 == n_inst)
    {
        getStyleSettings();
#if 0
        FILE *fp = FileOpen(plugrcPath());
        if (fp)
        {
            PI->loadPlugins(fp);
            FileClose(fp);
        }
#endif
    }
    else
    {

        PI->loadPlugins(NULL);
        PI->calculate_frame();
    }
    return BEGINPLUGIN_OK;
}
Пример #2
0
bool IsInString(const char inputString[], const char searchString[]) {
	std::string input(inputString);
	std::string search(searchString);

	// xoblite-flavour plugins bad version test workaround
	if (search == "bb" && input == GetBBVersion()) {
		return false;
	}

	std::transform(input.begin(), input.end(), input.begin(), (int(*)(int))std::tolower);
	std::transform(search.begin(), search.end(), search.begin(), (int(*)(int))std::tolower);

	return input.find(search, 0) != std::string::npos;
}
Пример #3
0
//===========================================================================
int BBP_bbversion(void)
{
    const char *bbv;
    static int BBVersion = -1;
    if (-1 == BBVersion) {
        BBVersion = 0;
        bbv = GetBBVersion();
        if (0 == memcmp(bbv, "bbLean", 6)) {
            int a, b, c = 0;
            if (sscanf(bbv+7, "%d.%d.%d", &a, &b, &c) >= 2)
                BBVersion = a*1000+b*10+c;
            else
                BBVersion = 2;
        }
        else if (0 == memcmp(bbv, "bb", 2)) {
            BBVersion = 1;
        }
    }
    return BBVersion;
}
Пример #4
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//beginPlugin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int beginPlugin(HINSTANCE hMainInstance)
{
	if (plugin_hwnd_blackbox)
	{
		MessageBox(plugin_hwnd_blackbox, "Dont load me twice!", szAppName, MB_OK|MB_SETFOREGROUND);
		return 1;
	}

	//Deal with instances
	plugin_instance_plugin = hMainInstance;
	plugin_hwnd_blackbox = GetBBWnd();

	const char *bbv = GetBBVersion();
	if (0 == _memicmp(bbv, "bblean", 6)) BBVersion = BBVERSION_LEAN;
	else
	if (0 == _memicmp(bbv, "bb", 2)) BBVersion = BBVERSION_XOB;
	else BBVersion = BBVERSION_09X;

	//Deal with os info
	plugin_getosinfo();

#ifdef BBINTERFACE_ALPHA_SOFTWARE
	int result = BBMessageBox(plugin_hwnd_blackbox,
		"WARNING!\n\n"
		"This is ALPHA software! Use at your own risk!\n\n"
		"The authors are not responsible in the event that:\n - your configuration is lost,\n - your computer blows up,\n - you are hit by a truck, or\n - anything else at all.\n\n"
		"Do you wish to continue loading this ALPHA software?",
		"BBInterface ALPHA Warning",
		MB_ICONWARNING|MB_DEFBUTTON2|MB_YESNO);
	if (result != IDYES) return 0;
#endif

	//Startup
	plugin_load = true;
	plugin_startup();

	return 0;
}
Пример #5
0
int beginPlugin(HINSTANCE hPluginInstance)
{
    if (BBhwnd)
    {
        MessageBox(NULL, "Dont load me twice!", szAppName, MB_OK|MB_TOPMOST|MB_SETFOREGROUND);
        return 1;
    }

    BBhwnd = GetBBWnd();

    if (0 == memicmp(GetBBVersion(), "bblean", 6))
    {
        MessageBox(NULL, "This plugin is not required with bblean", szAppName, MB_OK|MB_TOPMOST|MB_SETFOREGROUND);
        return 1;
    }


    WNDCLASS wc;
    ZeroMemory(&wc, sizeof(wc));
    wc.lpfnWndProc = BBNoteProc;            // our window procedure
    wc.hInstance = hPluginInstance;
    wc.lpszClassName = szAppName;           // our window class name
    RegisterClass(&wc);
    
    hNoteWnd = CreateWindowEx(
        WS_EX_TOOLWINDOW,                   // exstyles
        wc.lpszClassName,                   // our window class name
        NULL,                               // use description for a window title
        WS_POPUP,
        0, 0,                               // position
        0, 0,                               // width & height of window
        NULL,                               // parent window
        NULL,                               // no menu
        (HINSTANCE)wc.hInstance,            // hInstance of DLL
        NULL);

    return 0;
}
Пример #6
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//beginPlugin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int beginPlugin(HINSTANCE hMainInstance)
{
	if (plugin_hwnd_blackbox)
	{
		MessageBox(plugin_hwnd_blackbox, "Dont load me twice!", szAppName, MB_OK|MB_SETFOREGROUND);
		return 1;
	}

	//Deal with instances
	plugin_instance_plugin = hMainInstance;
	plugin_hwnd_blackbox = GetBBWnd();

	const char *bbv = GetBBVersion();
	
	if (NULL != strstr(bbv, "Clean")) BBVersion = BBVERSION_CLEAN;
	else
	if (0 == memicmp(bbv, "bblean", 6)) BBVersion = BBVERSION_LEAN;
	else
	if (0 == memicmp(bbv, "bb", 2)) BBVersion = BBVERSION_XOB;
	else BBVersion = BBVERSION_09X;

	//Deal with os info
	plugin_getosinfo();

#ifdef BBINTERFACE_ALPHA_SOFTWARE
	int result = MessageBox(plugin_hwnd_blackbox,
		"WARNING!\n\n"
		"This is ALPHA software! Use at your own risk!\n\n"
		"The authors are not responsible in the event that:\n - your configuration is lost,\n - your computer blows up,\n - you are hit by a truck, or\n - anything else at all.\n\n"
		"Do you wish to continue loading this ALPHA software?",
		"BBInterface ALPHA Warning",
		MB_ICONWARNING|MB_DEFBUTTON2|MB_YESNO);
	if (result != IDYES) return 0;
#endif
	if(!com_initialized){
		if(SUCCEEDED(::CoInitialize(NULL)) ){
			_Module.Init(NULL, ::GetModuleHandle(NULL),NULL);
			com_initialized = true;
		}else{
			MessageBox(0, "Error initializing COM", szAppName, MB_OK | MB_ICONERROR | MB_TOPMOST);
			return 1;
		}
	}

	//get font list 
	if(!flist_initialized){
		flist_initialized = true;
		HDC hdc;
		LOGFONT lf;
		lf.lfCharSet = DEFAULT_CHARSET;
		lf.lfPitchAndFamily = 0;
		lf.lfFaceName[0]=0;
		hdc = GetDC(plugin_hwnd_blackbox);
		EnumFontFamiliesEx(hdc,&lf,(FONTENUMPROC)EnumFontFamExProc,NULL,0);
		ReleaseDC(plugin_hwnd_blackbox,hdc);
		fontList.sort();
	}

	
	
	//Startup
	plugin_load = true;

	
	plugin_startup();

	return 0;
}
Пример #7
0
/* slit interface */
int beginPluginEx(HINSTANCE hPluginInstance, HWND hSlit)
{
    WNDCLASS wc;

    /* --------------------------------------------------- */
    /* This plugin can run in one instance only. If BBhwnd
       is set it means we are already loaded. */

    if (BBhwnd)
    {
        MessageBox(BBhwnd, "Do not load me twice!", szVersion,
                MB_OK | MB_ICONERROR | MB_TOPMOST);
        return 1; /* 1 = failure */
    }

    /* --------------------------------------------------- */
    /* grab some global information */

    BBhwnd = GetBBWnd();
    g_hInstance = hPluginInstance;
    g_hSlit = hSlit;

    if (0 == memicmp(GetBBVersion(), "bbLean", 6))
        under_bblean = true;
    else if (0 == memicmp(GetBBVersion(), "bb", 2))
        under_xoblite = true;

    /* --------------------------------------------------- */
    /* register the window class */

    memset(&wc, 0, sizeof wc);
    wc.lpfnWndProc  = WndProc;      /* window procedure */
    wc.hInstance    = g_hInstance;  /* hInstance of .dll */
    wc.lpszClassName = szAppName;    /* window class name */
    wc.hCursor      = LoadCursor(NULL, IDC_ARROW);
    wc.style        = CS_DBLCLKS;

    if (!RegisterClass(&wc))
    {
        MessageBox(BBhwnd,
            "Error registering window class", szVersion,
                MB_OK | MB_ICONERROR | MB_TOPMOST);
        return 1; /* 1 = failure */
    }

    /* --------------------------------------------------- */
    /* Zero out variables, read configuration and style */

    memset(&my, 0, sizeof my);
    ReadRCSettings();
    GetStyleSettings();

    /* --------------------------------------------------- */
    /* create the window */

    my.hwnd = CreateWindowEx(
        WS_EX_TOOLWINDOW,   /* window ex-style */
        szAppName,          /* window class name */
        NULL,               /* window caption text */
        WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, /* window style */
        0,                  /* x position */
        0,                  /* y position */
        0,                  /* window width */
        0,                  /* window height */
        NULL,               /* parent window */
        NULL,               /* window menu */
        g_hInstance,        /* hInstance of .dll */
        NULL                /* creation data */
        );

    /* set window location and properties */
    set_window_modes();

    /* show window (without stealing focus) */
    ShowWindow(my.hwnd, SW_SHOWNA);
    return 0; /* 0 = success */
}
Пример #8
0
// recursive parsing of menu file
static Menu* ParseMenu(struct menu_src *src, const char *title, const char *IDString)
{
    char line[4000];
    char data[4000];
    char buffer[4000];
    char command[40];
    char label[MAX_PATH];

    Menu *pMenu, *pSub;
    MenuItem *pItem;
    int f, e_cmd;
    const char *p_label, *p_data, *cp, *p_cmd;

    pMenu = NULL;
    for(;;)
    {
        p_label = NULL;
        p_data = data;

        if (0 == src->level) {
            // read default menu from string
            NextToken(line, &src->default_menu, "\n");
        } else {
            f = ReadNextCommand(src->fp[src->level-1], line, sizeof(line));
            if (!f) {
                if (src->level > 1) {
                    dec_inc_level(src);
                    continue; // continue from included file
                }
                e_cmd = e_no_end;
                goto skip;
            }
        }

        cp = replace_environment_strings(line, sizeof line);

        //dbg_printf("Menu %08x line:%s", pMenu, line);

        // get the command
        if (false == get_string_within(command, sizeof command, &cp, "[]"))
            continue;
        // search the command
        e_cmd = get_string_index(command, menu_cmds);

        if (get_string_within(label, sizeof label, &cp, "()"))
            p_label = label;

        if (false == get_string_within(data, sizeof data, &cp, "{}"))
            p_data = label;

skip:
        if (NULL == pMenu)
        {
            if (e_begin == e_cmd) {
                // If the line contains [begin] we create the menu
                // If no menu title has been defined, display Blackbox version...
#ifdef BBXMENU
                if (src->default_menu)
                    strcpy(label, "bbXMenu");
                else
#endif
                if (0 == label[0] && src->default_menu)
                    p_label = GetBBVersion();
                pMenu = MakeNamedMenu(p_label, IDString, src->popup);
                continue;
            }

            if (NULL == title)
                title = NLS0("missing [begin]");

            pMenu = MakeNamedMenu(title, IDString, src->popup);
        }

        pItem = NULL;

        switch (e_cmd) {

        //====================
        // [begin] is like [submenu] when within the menu
        case e_begin:
        case e_submenu:
            sprintf(buffer, "%s_%s", IDString, label);
            strlwr(buffer + strlen(IDString));
            pSub = ParseMenu(src, p_data, buffer);
            if (pSub)
                pItem = MakeSubmenu(pMenu, pSub, label);
            else
                pItem = MakeMenuNOP(pMenu, label);
            break;

        //====================
        case e_no_end:
            MakeMenuNOP(pMenu, NLS0("missing [end]"));
        case e_end:
            MenuOption(pMenu, BBMENU_ISDROPTARGET);
            return pMenu;

        //====================
        case e_include:
        {
            char dir[MAX_PATH];
            file_directory(dir, src->path[src->level-1]);
            replace_shellfolders_from_base(buffer, p_data, false, dir);
            if (false == add_inc_level(src, buffer)) {
                replace_shellfolders(buffer, p_data, false);
                if (false == add_inc_level(src, buffer))
                    MakeMenuNOP(pMenu, NLS0("[include] failed"));
            }
            continue;
        }

        //====================
        // a [nop] item will insert an inactive item with optional text
        case e_nop:
            pItem = MakeMenuNOP(pMenu, label);
            break;

        // a insert separator, we treat [sep] like [nop] with no label
        case e_sep1:
        case e_sep2:
            pItem = MakeMenuNOP(pMenu, NULL);
            break;

        //====================
        // a [path] item is pointing to a dynamic folder...
        case e_path:
            p_cmd = get_special_command(&p_data, buffer, sizeof buffer);
            pItem = MakeMenuItemPath(pMenu, label, p_data, p_cmd);
            break;

        // a [insertpath] item will insert items from a folder...
        case e_insertpath:
            p_cmd = get_special_command(&p_data, buffer, sizeof buffer);
            pItem = MakeMenuItemPath(pMenu, NULL, p_data, p_cmd);
            break;

        // a [stylemenu] item is pointing to a dynamic style folder...
        case e_stylesmenu:
            pItem = MakeMenuItemPath(pMenu, label, p_data, MM_STYLE_BROAM);
            break;

        // a [styledir] item will insert styles from a folder...
        case e_stylesdir:
            pItem = MakeMenuItemPath(pMenu, NULL, p_data, MM_STYLE_BROAM);
            break;

        // a [rcmenu] item is pointing to a dynamic rc files folder...
        case e_rcmenu:
            pItem = MakeMenuItemPath(pMenu, label, p_data, MM_EDIT_BROAM);
            break;

        case e_themesmenu:
            pItem = MakeMenuItemPath(pMenu, label, p_data, MM_THEME_BROAM);
            break;

        //====================
        // special items...
        case e_workspaces:
            pItem = MakeSubmenu(pMenu, MakeDesktopMenu(0, src->popup), p_label);
            break;
        case e_icons:
            pItem = MakeSubmenu(pMenu, MakeDesktopMenu(1, src->popup), p_label);
            break;
        case e_tasks:
            pItem = MakeSubmenu(pMenu, MakeDesktopMenu(2, src->popup), p_label);
            break;
        case e_config:
            pItem = MakeSubmenu(pMenu, MakeConfigMenu(src->popup), p_label);
            break;

        //====================
        case e_exec:
            if ('@' == data[0]) {
                pItem = MakeMenuItem(pMenu, label, data, false);
                MenuItemOption(pItem, BBMENUITEM_UPDCHECK);
            } else {
                goto core_broam;
            }
            break;

        //====================
        case e_other:
            f = get_workspace_number(command); // check for 'workspace1..'
            if (-1 != f) {
                pItem = MakeSubmenu(pMenu, MakeTaskFolder(f, src->popup), p_label);
            } else {
                p_data = data;
                goto core_broam;
            }
            break;

        //====================
        // everything else is converted to a '@BBCore.xxx' broam
        core_broam:
            f = sprintf(buffer, "@bbCore.%s", command);
            strlwr(buffer+8);
            if (p_data[0])
                sprintf(buffer + f, " %s", p_data);
            pItem = MakeMenuItem(pMenu, label[0]?label:command, buffer, false);
            break;
        }

//#ifdef BBOPT_MENUICONS
		if ( Settings_menu.iconSize ) {
			if (pItem && get_string_within(label,  sizeof label, &cp, "<>"))
				MenuItemOption(pItem, BBMENUITEM_SETICON, label);
		}
//#endif
    }
}
const char *GetApi() {
    return GetBBVersion();
}
bool Init(char* workingDir) {
    sprintf(name, "Core Pluginloader %s", GetBBVersion());
    return true;
}
Пример #11
0
extern "C" BOOL WINAPI DllMain(HINSTANCE hi, DWORD reason, LPVOID reserved)
{
	if (reason==DLL_PROCESS_ATTACH)
	{
		hInstance = hi;
		WNDCLASS wc;
		RECT dt;

		if (BBhwnd)
		{
			MessageBox(BBhwnd, "Dont load me twice!", szAppName, MB_OK|MB_SETFOREGROUND);
			return FALSE;
		}

		const char *bbv = GetBBVersion();
		if (0 == memicmp(bbv, "bblean", 6)) BBVersion = 2;
		else
			if (0 == memicmp(bbv, "bb", 2)) BBVersion = 1;
			else BBVersion = 0;

		BBhwnd = GetBBWnd();
		set_my_path(rcpath, "bbLeanSkin.rc");

		ZeroMemory(&wc, sizeof(wc));
		wc.lpszClassName = szAppName;
		wc.hInstance = hInstance;
		wc.lpfnWndProc = WndProc;

		// ##### COMMENTED OUT DUE TO COMPATIBILITY REASONS #####
		// ###### -> WAS THIS CHECK USED TO DETECT BBLEAN? ######
		// if (NULL == GetSettingPtr(SN_WINUNFOCUS_TITLE))
		//	return FALSE;
		// ######################################################

		if (FindWindow(wc.lpszClassName, NULL) || FALSE == RegisterClass(&wc))
			return FALSE;

		// center the window
		SystemParametersInfo(SPI_GETWORKAREA, 0, &dt, 0);
		int width = 480;
		int height = 300;
		int xleft = (dt.left+dt.right-width)/2;
		int ytop = (dt.top+dt.bottom-height)/2;

		CreateWindow(
			wc.lpszClassName,
			"bbLeanSkin Log",
			//WS_OVERLAPPEDWINDOW,
			WS_POPUP|WS_CAPTION|WS_SIZEBOX|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX,
			xleft, ytop, width, height,
			NULL,
			NULL,
			wc.hInstance,
			NULL
		);
	}
	else
		if (reason==DLL_PROCESS_DETACH)
		{
			stopEngine();
			DestroyWindow(m_hwnd);
			UnregisterClass(szAppName, hInstance);
		}
	return TRUE;
}
Пример #12
0
// no-slit interface
int beginPlugin(HINSTANCE hInstance)
{
    // Console.CreateConsole(OUTPUT_CONS);
    // ---------------------------------------------------
    // grab some global information

    BBhwnd          = GetBBWnd();
    //hInstance       = hPluginInstance;
    //hSlit_present   = hSlit;
    is_bblean       = 0 == my_substr_icmp(GetBBVersion(), "bblean");

    // ---------------------------------------------------
    // register the window class

    WNDCLASS wc;
    ZeroMemory(&wc, sizeof wc);

    wc.lpfnWndProc      = WndProc;      // window procedure
    wc.hInstance        = hInstance;    // hInstance of .dll
    wc.lpszClassName    = szAppName;    // window class name
    wc.hCursor          = LoadCursor(NULL, IDC_ARROW);
    wc.style            = CS_DBLCLKS;

    if (!RegisterClass(&wc))
    {
        MessageBox(BBhwnd,
                   "Error registering window class", szVersion,
                   MB_OK | MB_ICONERROR | MB_TOPMOST);
        return 1;
    }

    // ---------------------------------------------------
    // Zero out variables, read configuration and style

    ZeroMemory(&my, sizeof my);

    // ReadRCSettings();

    // ---------------------------------------------------
    // create the window

    my.hwnd = CreateWindowEx(
                  WS_EX_TOOLWINDOW,   // window ex-style
                  szAppName,          // window class name
                  NULL,               // window caption text
                  WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, // window style
                  my.xpos,            // x position
                  my.ypos,            // y position
                  my.width,           // window width
                  my.height,          // window height
                  NULL,               // parent window
                  NULL,               // window menu
                  hInstance,          // hInstance of .dll
                  NULL                // creation data
              );

    bbLuaInstance.init();
    bbLuaInstance.loadFile("bblua.lua");

    return 0;
}