void gui_filterbar_c::show_options(bool show) { if (show && option1 != nullptr) return; if (!show && option1 == nullptr) return; if (show) { int tag = gui->get_free_tag(); gui_button_c &o1 = MAKE_VISIBLE_CHILD<gui_button_c>(getrid()); o1.set_check(tag); o1.set_handler(DELEGATE(this, option_handler), as_param(1)); o1.set_face_getter(BUTTON_FACE(check)); o1.set_text(TTT("Search in messages",337)); if (search_in_messages) o1.mark(); option1 = &o1; } else { TSDEL( option1 ); } HOLD( getparent() ).as<gui_contactlist_c>().update_filter_pos(); }
/*virtual*/ void gui_filterbar_c::created() { set_theme_rect(CONSTASTR("filter"), false); filtereditheight = gui->theme().conf().get_int(CONSTASTR("filtereditheight"), 25); if (prf().get_options().is(UIOPT_SHOW_SEARCH_BAR)) { gui_textfield_c &e = (MAKE_CHILD<gui_textfield_c>(getrid(), L"", MAX_PATH, 0, false) << (gui_textedit_c::TEXTCHECKFUNC)DELEGATE(this, update_filter)); edit = &e; e.set_placeholder(TOOLTIP(TTT("Search", 277)), get_default_text_color(COL_PLACEHOLDER)); e.register_kbd_callback(DELEGATE(this, cancel_filter), SSK_ESC, false); } if (prf().get_options().is(UIOPT_TAGFILETR_BAR)) { fill_tags(); } search_in_messages = prf().is_loaded() && prf().get_options().is(MSGOP_FULL_SEARCH); if (!is_all()) refresh_list(); __super::created(); }
int main(int argc, char *argv[]) { camera::Loc.moveTo(0, 200, 0); NewWorld.loadWorld(NULL); //³õʼ»¯äÖȾÏß³Ì if (!initThread(argc, argv)) { return -1; } //¼ÓÔØBlock initBlock(); renderGroup Test; renderGroup VAO; location TTT(0, 0, 0); unsigned int i = -1; while (IsRenderThreadStart) { //äÖȾ NewWorld.refreshVAO(); Sleep(1); } #ifdef _DEBUG _CrtDumpMemoryLeaks(); #endif }
ts::wstr_c gui_filterbar_c::tagname( int index ) const { if (index < BIT_count) { if ( const ts::wstr_c * n = binames.find( ts::wmake(index) ) ) return *n; ts::wsptr bit[BIT_count] = { TTT("All", 83), TTT("Online", 86), TTT("Untagged",263), }; return bit[index]; } return from_utf8( contacts().get_all_tags().get(index - BIT_count) ); }
int main(void) { struct sigaction sigsegv; char c; // This fails due to a bad fd (at one point I was not handling failing // mmap() calls, and would have got a seg fault). char* res1 = mmap(0, 0, PROT_READ, MAP_PRIVATE, -1, 0 ); // This succeeds but is meaningless. Important thing is that the size is // zero, so Annelid should not subtract one from the size when doing any // range calculations. (It did at one point, giving 0xffffffff, which // screwed everything up.) char* res2 = mmap(0, 0, PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 ); // This succeeds and is useful. char* res3 = mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); assert(MAP_FAILED == res1); assert(NULL == res2); assert(MAP_FAILED != res3 && NULL != res3); // Intall SEGV handler sigsegv.sa_handler = SEGV_handler; sigsegv.sa_flags = 0; assert( 0 == sigemptyset( &sigsegv.sa_mask ) ); assert( 0 == sigaction(SIGSEGV, &sigsegv, NULL) ); #define TTT(i) \ if (__builtin_setjmp(TTT_jmpbuf) == 0) { c = res3[i]; } TTT(0); TTT(-1); mywrite(res3, 5); mywrite(res3-1, 5); assert( 0 == munmap(res3, getpagesize()) ); TTT(0); TTT(-1); mywrite(res3, 5); mywrite(res3-1, 5); return 0; }
void gui_filterbar_c::do_tag_rclick(int lnk) { menu_c mnu; mnu.add(TTT("Rename tag",224), 0, DELEGATE(this, ctx_rename_tag), ts::amake(lnk)); popupmenu = &gui_popup_menu_c::show(menu_anchor_s(true), mnu); popupmenu->leech(this); textrect.make_dirty(); getengine().redraw(); }
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())); }