Esempio n. 1
0
void gui_filterbar_c::get_link_prolog(ts::wstr_c &r, int linknum) const
{
    bool is_active = false;
    if (linknum < BIT_count)
    {
        is_active = 0 != (bitags & (1 << linknum));
    } else
    {
        is_active = contacts().is_tag_enabled(linknum - BIT_count);
    }

    bool all = (0 != (bitags & (1 << BIT_ALL))) && linknum != BIT_ALL;

    ts::TSCOLOR c;
    if (linknum == overlink)
    {
        r.set(CONSTWSTR("<u>"));
        c = get_default_text_color(is_active ? ( all ? COL_ACTIVE_MUTED_HOVER : COL_ACTIVE_HOVER) : COL_INACTIVE_HOVER);
    } else
    {
        c = get_default_text_color(is_active ? (all ? COL_ACTIVE_MUTED : COL_ACTIVE) : COL_INACTIVE);
    }
    r.append(CONSTWSTR("<color=#")).append_as_hex(ts::RED(c))
        .append_as_hex(ts::GREEN(c))
        .append_as_hex(ts::BLUE(c))
        .append_as_hex(ts::ALPHA(c))
        .append_char('>');

}
Esempio n. 2
0
void gui_filterbar_c::get_link_epilog(ts::wstr_c &r, int linknum) const
{
    if (linknum == overlink)
        r.set(CONSTWSTR("</color></u>"));
    else
        r.set(CONSTWSTR("</color>"));

}
Esempio n. 3
0
/*virtual*/ void mainrect_c::created()
{
    defaultthrdraw = DTHRO_BORDER | /*DTHRO_CENTER_HOLE |*/ DTHRO_CAPTION | DTHRO_CAPTION_TEXT;
    set_theme_rect(CONSTASTR("mainrect"), false);
    __super::created();
    gui->make_app_buttons( m_rid );

    auto uiroot = [](RID p)->RID
    {
        gui_hgroup_c &g = MAKE_VISIBLE_CHILD<gui_hgroup_c>(p);
        g.allow_move_splitter(true);
        g.leech(TSNEW(leech_fill_parent_s));
        g.leech(TSNEW(leech_save_proportions_s, CONSTASTR("main_splitter"), CONSTASTR("7060,12940")));
        return g.getrid();
    };

    RID hg = uiroot(m_rid);
    RID cl = MAKE_CHILD<gui_contactlist_c>( hg );
    RID chat = MAKE_CHILD<gui_conversation_c>( hg );
    hg.call_restore_signal();
    
    gmsg<ISOGM_SELECT_CONTACT>(&contacts().get_self(), 0).send(); // 1st selected item, yo

    g_app->F_ALLOW_AUTOUPDATE = !g_app->F_READONLY_MODE;


    if (const theme_rect_s *tr = themerect())
    {
        if (tr->captextadd.x >= 18)
        {
            int sz = tr->captextadd.x - 2;
            ts::bitmap_c icon, rsz;
            if (icon.load_from_file(CONSTWSTR("icon.png")))
            {
                rsz.create_ARGB(ts::ivec2(sz));
                icon.resize_to( rsz.extbody(), ts::FILTER_BOX_LANCZOS3 );
                rsz.premultiply();
                icons[0] = rsz;
            }

            if (icon.load_from_file(CONSTWSTR("icon-offline.png")))
            {
                rsz.create_ARGB(ts::ivec2(sz));
                icon.resize_to(rsz.extbody(), ts::FILTER_BOX_LANCZOS3);
                rsz.premultiply();
                icons[1] = rsz;
            }
        }
    }
}
Esempio n. 4
0
void gui_filterbar_c::fill_tags()
{
    int lnki = 0;
    auto make_ht = [&]( const ts::wsptr &htt ) -> ts::wstr_c
    {
        ts::wstr_c x( CONSTWSTR("<cstm=a\1>"), htt );
        x.append( CONSTWSTR("<cstm=b\1>, ") );
        x.replace_all( CONSTWSTR("\1"), ts::wmake<int>( lnki++ ) );
        return x;
    };

    ts::wstr_c t;
    for (int i = 0; i < BIT_count; ++i)
        t.append( make_ht(tagname(i)) );

    for(const ts::str_c &ht : contacts().get_all_tags())
        t.append(make_ht(from_utf8(ht)));
    
    t.trunc_length(2);
    set_text(t);
}
Esempio n. 5
0
void gui_filterbar_c::ctx_rename_tag(const ts::str_c &tis)
{
    int ti = tis.as_int();

    ts::wstr_c hint = TTT("Rename tag $", 218) / ts::wstr_c(CONSTWSTR("<b>")).append(tagname(ti)).append(CONSTWSTR("</b>"));
    if (ti < BIT_count)
        hint.append(CONSTWSTR("<br>")).append( TTT("Empty - set default",249) );


    SUMMON_DIALOG<dialog_entertext_c>(UD_RENTAG, dialog_entertext_c::params(
        UD_RENTAG,
        gui_isodialog_c::title(title_rentag),
        hint,
        tagname(ti),
        tis,
        DELEGATE(this, renamed),
        nullptr,
        ti < BIT_count ? check_always_ok : check_always_ok_except_empty,
        getrid()));

}
Esempio n. 6
0
bool _cdecl app_preinit( const wchar_t *cmdl )
{
#if defined _DEBUG || defined _CRASH_HANDLER
    ts::exception_operator_c::set_unhandled_exception_filter();
#endif

    sodium_init();

    if (!parsecmdl(cmdl))
        return false;

    if (!check_autoupdate())
        return false;

#ifdef _FINAL
    if (g_commandline.checkinstance)
        if (!check_instance()) return false;
#endif // _FINAL


#if defined _DEBUG || defined _CRASH_HANDLER
    ts::exception_operator_c::dump_filename = ts::fn_change_name_ext(ts::get_exe_full_name(), ts::wstr_c(CONSTWSTR(APPNAME)).append_char('.').append(ts::to_wstr(application_c::appver())).as_sptr(), CONSTWSTR("dmp"));
#endif

	ts::tsfileop_c::setup<fileop_c>();

	ts::CHARz_copy( g_sysconf.name, CONSTWSTR(APPNAME) .s );
    
#ifndef _FINAL
    debug_name();
    dotests0();
#endif

	TSNEW(application_c, cmdl); // not a memory leak! see SEV_EXIT handler

	return true;
}
Esempio n. 7
0
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID /*lpReserved*/
					 )
{
    g_module = hModule;

    switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:

#if defined _DEBUG || defined _CRASH_HANDLER
#include "appver.inl"
        exception_operator_c::set_unhandled_exception_filter();
        exception_operator_c::dump_filename = fn_change_name_ext(get_exe_full_name(), wstr_c(CONSTWSTR("proto.lan.")).appendcvt(SS(PLUGINVER)).as_sptr(), CONSTWSTR("dmp"));
#endif

    case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
Esempio n. 8
0
static bool parsecmdl(const wchar_t *cmdl)
{
    ts::wstr_c wd;
    ts::set_work_dir(wd);

    ts::token<wchar_t> cmds(cmdl, ' ');
    bool wait_cmd = false;
    bool installto = false;
    bool conf = false;
    uint processwait = 0;
    for (; cmds; ++cmds)
    {
        if (wait_cmd)
        {
            processwait = cmds->as_uint();
            wait_cmd = false;
            continue;
        }

        if (installto)
        {
            if (ts::is_admin_mode())
            {
                ts::wstr_c installto_path(*cmds);
                installto_path.replace_all('*', ' ');
                install_to(installto_path, false);
            }
            return false;
        }

        if (conf)
        {
            if (!g_commandline.alternative_config_path.is_empty()) g_commandline.alternative_config_path.append_char(' ');
            g_commandline.alternative_config_path.append(*cmds);
            if ( g_commandline.alternative_config_path.get_char(0) != '\"' || g_commandline.alternative_config_path.get_last_char() == '\"' )
            {
                conf = false;
                g_commandline.alternative_config_path.trunc_char('\"');
                if (g_commandline.alternative_config_path.get_char(0) == '\"')
                    g_commandline.alternative_config_path.cut(0);
            }
            continue;
        }

        if (cmds->equals(CONSTWSTR("wait")))
        {
            wait_cmd = true;
            continue;
        }

        if (cmds->equals(CONSTWSTR("multi")))
        {
            g_commandline.checkinstance = false;
            continue;
        }

        if (cmds->equals(CONSTWSTR("minimize")))
        {
            g_commandline.minimize = true;
            continue;
        }

        if (cmds->equals(CONSTWSTR("readonly")))
        {
            g_commandline.readonlymode = true;
            continue;
        }

        if (cmds->equals(CONSTWSTR("installto")))
        {
            installto = true;
            continue;
        }

        if (cmds->equals(CONSTWSTR("config")))
        {
            conf = true;
            continue;
        }

    }

    if (processwait)
    {
        HANDLE h = OpenProcess(SYNCHRONIZE,FALSE,processwait);
        if (h)
        {
            DWORD r = WaitForSingleObject(h, 10000);
            CloseHandle(h);
            if (r == WAIT_TIMEOUT ) return false;
        }
    }

    return true;
}
Esempio n. 9
0
/*virtual*/ ts::wstr_c mainrect_c::get_name() const
{
    if (name.is_empty())
        const_cast<ts::wstr_c &>(name).set(ts::wsptr(g_sysconf.name)).replace_all(CONSTWSTR(APPNAME), APPNAME_CAPTION);
    return name;
}