Esempio n. 1
0
//===========================================================================
void MessageManager_Register(HWND hwnd, const UINT* messages, bool add)
{
    UINT msg;
    while (0 != (msg = *messages++))
    {
        struct MsgMap *mm = (struct MsgMap *)assoc(msgs, (void*)msg);
        if (mm) {
            if (remove_assoc(&mm->winmap, hwnd))
                --mm->count;

        } else if (add) {
            mm = c_new(struct MsgMap);
            mm->msg = msg;
            append_node (&msgs, mm);
            // these are the messages that expect return values and
            // are handled differently in 'MessageManager_Send()'
            mm->send_mode = BB_DRAGTODESKTOP == msg || BB_GETBOOL == msg;
        }

        if (add) {
            struct winmap *w = c_new(struct winmap);
            w->hwnd = hwnd;
            cons_node(&mm->winmap, w);
            ++mm->count;
            dbg_msg("add", hwnd, msg);

        } else if (mm) {
            if (NULL == mm->winmap)
                remove_item(&msgs, mm);
            dbg_msg("del", hwnd, msg);
        }
    }
Esempio n. 2
0
static void load_nls(void)
{
	const char *lang_file =
		ReadString(extensionsrcPath(), "blackbox.options.language:", NULL);
	if (NULL == lang_file) return;

	char full_path[MAX_PATH];
	FILE *fp = fopen (make_bb_path(full_path, lang_file), "rb");
	if (NULL == fp) return;

	char line[4000], key[200], new_text[4000], *np;
	int nl;
	key[0] = 0;

	new_text[0] = 0;
	np = new_text;
	nl = 0;
	for (;;)
	{
		bool eof = false == read_next_line(fp, line, sizeof line);
		char *s = line, c = *s;
		if ('$' == c || eof)
		{
			if (key[0] && new_text[0])
			{
				struct nls *t = (struct nls *)c_alloc(sizeof *t + strlen(key));
				t->hash = calc_hash(t->key, key, &t->k);
				t->translation = new_str(new_text);
				cons_node(&pNLS, t);
			}
			if (eof) break;
			if (' ' == s[1]) s += 2;
			decode_escape(key, s);
			new_text[0] = 0;
			np = new_text;
			nl = 0;
			continue;
		}

		if ('#' == c || '!' == c) continue;

		if ('\0' != c)
		{
			while (nl--) *np++ = '\n';
			np += decode_escape(np, s);
			nl = 0;
		}

		nl ++;
	}
	fclose(fp);
	reverse_list(&pNLS);
}
Esempio n. 3
0
ST void hidewnd (HWND hwnd, int f)
{
    //dbg_printf("hw = %08x", hw);
    if (hwnd && (ShowWindow(hwnd, SW_HIDE) || f))
        cons_node(&basebarlist, new_node(hwnd));
}
Esempio n. 4
0
ST void hidewnd (HWND hwnd)
{
    if (hwnd && ShowWindow(hwnd, SW_HIDE))
        cons_node(&basebarlist, new_node(hwnd));
}