⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmenu.cc

📁 功能较全面的反汇编器:反汇编器ht-2.0.15.tar.gz
💻 CC
📖 第 1 页 / 共 2 页
字号:
			((ht_app*)app)->queuemsg(app, m);			return true;		} else if (e->type == CME_SUBMENU) {			if (handle_key_context_menu(e->submenu, k)) return true;		}		e = a->enum_entry_next();	}	return false;}int ht_menu::count(){	ht_context_menu *q = (ht_context_menu*)(*menu)[localmenu];	if (context_menu_hack) return menu->count() + !!(localmenu != -1 && !q);	return menu->count();}void ht_menu::delete_local_menu(){	if (localmenu != -1) {/*		if (last_context_menu_hack) {			last_context_menu_hack = false;			if (last_context_menu) {				last_context_menu->done();				delete last_context_menu;				last_context_menu = NULL;			}			return;*//*			ht_context_menu *q = (ht_context_menu*)menu->get(localmenu);			if (q && (q == last_context_menu)) menu->remove(localmenu);			return;*///		}		if (context_menu_hack2 && last_context_menu_hack) {			last_context_menu_hack->done();			delete last_context_menu_hack;			last_context_menu_hack = NULL;		}		menu->del(menu->findByIdx(localmenu));	}		}void ht_menu::insert_local_menu(){	localmenu = menu->count();}void ht_menu::insert_menu(ht_context_menu *m){	int namelen = strlen(m->get_name());	m->xpos = lastmenux;	menu->insert(m);	lastmenux += namelen+1;}bool ht_menu::set_local_menu(ht_context_menu *m){	if (localmenu == -1) return false;	if (context_menu_hack2) {		if (last_context_menu_hack) {			last_context_menu_hack->done();			delete last_context_menu_hack;			last_context_menu_hack = NULL;		}		last_context_menu_hack = m;	} else {		ht_context_menu *p = (ht_context_menu*)(*menu)[localmenu-1];		if (p) {			lastmenux = p->xpos + strlen(p->get_name()) + 1; 		} else {			lastmenux = 1;		}		m->xpos = lastmenux;		menu->forceSetByIdx(localmenu, m);		lastmenux += strlen(m->get_name()) + 1;	}	return true;}/* *	CLASS ht_menu_frame */void ht_menu_frame::init(Bounds *b, const char *desc, uint style, uint number){	ht_frame::init(b, desc, style, number);	VIEW_DEBUG_NAME("ht_menu_frame");}void ht_menu_frame::done(){	ht_frame::done();}const char *ht_menu_frame::defaultpalette(){	return palkey_generic_menu_default;}const char *ht_menu_frame::defaultpaletteclass(){	return palclasskey_generic;}int ht_menu_frame::getcurcol_normal(){	return ht_frame::getcurcol_normal();}int ht_menu_frame::getcurcol_killer(){	return 0;}/* *	CLASS ht_context_menu_window_body */void ht_context_menu_window_body::init(Bounds *b, ht_context_menu *Menu){	ht_view::init(b, VO_OWNBUFFER | VO_SELECTABLE, 0);	VIEW_DEBUG_NAME("ht_context_menu_window_body");	context_menu = Menu;	selected = next_selectable(-1);}void ht_context_menu_window_body::done(){	ht_view::done();}const char *ht_context_menu_window_body::defaultpalette(){	return palkey_generic_menu_default;}const char *ht_context_menu_window_body::defaultpaletteclass(){	return palclasskey_generic;}void ht_context_menu_window_body::draw(){	clear(getcolor(palidx_generic_body));	int c=context_menu->count();	if (c>size.h) c=size.h;	ht_context_menu_entry *e=context_menu->enum_entry_first();	for (int i=0; i<c; i++) {		switch (e->type) {			case CME_ENTRY: if (i==selected) {				if (e->entry.active) {					vcp c = getcolor(palidx_generic_text_selected);					fill(0, i, size.w, 1, c, ' ');					buf->nprint(1, i, c, e->entry.name, size.w);					if (e->entry.comment) buf->nprint(size.w-1-strlen(e->entry.comment), i, c, e->entry.comment, size.w);					if (e->entry.shortcut) buf->printChar(e->entry.shortcut-e->entry.name+1, i, getcolor(palidx_generic_text_shortcut_selected), *e->entry.shortcut);				} else {					vcp c = getcolor(palidx_generic_text_disabled);					fill(0, i, size.w, 1, c, ' ');					buf->nprint(1, i, c, e->entry.name, size.w);					if (e->entry.comment) buf->nprint(size.w-1-strlen(e->entry.comment), i, c, e->entry.comment, size.w);				}			} else {				if (e->entry.active) {					vcp c = getcolor(palidx_generic_text_focused);					buf->nprint(1, i, c, e->entry.name, size.w);					if (e->entry.comment) buf->nprint(size.w-1-strlen(e->entry.comment), i, c, e->entry.comment, size.w);					if (e->entry.shortcut) buf->printChar(e->entry.shortcut-e->entry.name+1, i, getcolor(palidx_generic_text_shortcut), *e->entry.shortcut);				} else {					vcp c = getcolor(palidx_generic_text_disabled);					buf->nprint(1, i, c, e->entry.name, size.w);					if (e->entry.comment) buf->nprint(size.w-1-strlen(e->entry.comment), i, c, e->entry.comment, size.w);				}			}			break;			case CME_SEPARATOR:				fill(0, i, size.w, 1, getcolor(palidx_generic_text_focused), GC_1HLINE, CP_GRAPHICAL);				break;			case CME_SUBMENU: {				const char *n = e->submenu->get_name();				const char *s = e->submenu->get_shortcut();				vcp c;				if (i == selected) {					c = getcolor(palidx_generic_text_selected);				} else {					c = getcolor(palidx_generic_text_focused);				}				fill(0, i, size.w, 1, c, ' ');				buf->nprint(1, i, c, n, size.w);				if (s) buf->printChar(n-s+1, i, getcolor(palidx_generic_text_shortcut), *s);				buf->printChar(size.w-2, i, c, GC_ARROW_RIGHT, CP_GRAPHICAL);				break;			}		}		e = context_menu->enum_entry_next();	}}void ht_context_menu_window_body::handlemsg(htmsg *msg){	if (msg->msg == msg_keypressed) {		switch (msg->data1.integer) {			case K_Up:				selected = prev_selectable(selected);				dirtyview();				clearmsg(msg);				return;			case K_Down:				selected = next_selectable(selected);				dirtyview();				clearmsg(msg);				return;			case K_Control_PageUp:			case K_PageUp:			case K_Home:				selected = next_selectable(-1);				dirtyview();				clearmsg(msg);				return;			case K_Control_PageDown:			case K_PageDown:			case K_End:				selected = prev_selectable(0);				dirtyview();				clearmsg(msg);				return;		}		/* shortcuts */		int k = msg->data1.integer;//		int k = htalt2key(msg->data_int);//		if (k != -1) {			int c=context_menu->count();			ht_context_menu_entry *e = context_menu->enum_entry_first();			for (int i=0; i < c; i++) {				const char *shortcut = NULL;				if (e->type == CME_ENTRY && e->entry.shortcut) {					shortcut = e->entry.shortcut;				} else if (e->type == CME_SUBMENU && e->submenu->get_shortcut()) {					shortcut = e->submenu->get_shortcut();				}				if (shortcut) {					int s = *shortcut;					if (s >= 'A' && s <= 'Z') s += 'a'-'A';					if (s==k) {						selected=i;						((ht_dialog*)group->group)->sendmsg(msg_button_pressed, button_ok);						dirtyview();						clearmsg(msg);						return;					}				}									e = context_menu->enum_entry_next();			}//		}	}	ht_view::handlemsg(msg);}int ht_context_menu_window_body::next_selectable(int to){	int s=to+1;	int c=context_menu->count();	if (s>c-1) s=0;	while (s!=to) {		ht_context_menu_entry *e=context_menu->get_entry(s);		if (e->type == CME_ENTRY || e->type == CME_SUBMENU) return s;		s++;		if (s > c-1) s=0;	}	return to;}int ht_context_menu_window_body::prev_selectable(int to){	int s = to-1;	int c = context_menu->count();	if (s < 0) s = c-1;	while (s != to) {		ht_context_menu_entry *e=context_menu->get_entry(s);		if (e->type == CME_ENTRY || e->type == CME_SUBMENU) return s;		s--;		if (s < 0) s = c-1;	}	return to;}void ht_context_menu_window_body::getdata(ObjectStream &s){	PUT_INT32D(s, selected);}void ht_context_menu_window_body::setdata(ObjectStream &s){	GET_INT32D(s, selected);}/* *	CLASS ht_menu_window */void ht_menu_window::init(Bounds *b, ht_context_menu *m){	ht_dialog::init(b, 0, 0);	VIEW_DEBUG_NAME("ht_menu_window");	Bounds c=*b;	c.x=0;	c.y=0;	c.w-=2;	c.h-=2;	menu = m;	body=new ht_menu_window_body();	body->init(&c, menu);	insert(body);}void ht_menu_window::done(){	ht_dialog::done();}void ht_menu_window::getdata(ObjectStream &s){	body->getdata(s);}void ht_menu_window::handlemsg(htmsg *msg){	if (msg->msg == msg_button_pressed) {		switch (msg->data1.integer) {			case button_ok: {				ht_menu_window_data a;				ViewDataBuf vdb(this, &a, sizeof a);				int curentry = a.selected;				ht_context_menu_entry *e = menu->get_entry(a.selected);				if (e->type == CME_ENTRY && e->entry.active) {					dirtyview();					htmsg m;					m.msg = e->entry.command;					m.type = mt_empty;					((ht_app*)app)->queuemsg(app, m);//					app->sendmsg(e->entry.command);				} else if (e->type == CME_SUBMENU) {					if (execute_submenu(menu->xpos+2, 3+curentry, e->submenu)) {						sendmsg(msg_button_pressed, button_cancel);					}					clearmsg(msg);				}				break;			}		}	}	ht_dialog::handlemsg(msg);}void ht_menu_window::setdata(ObjectStream &s){	body->setdata(s);}/* *	CLASS ht_menu_window_body */void ht_menu_window_body::init(Bounds *b, ht_context_menu *menu){	ht_context_menu_window_body::init(b, menu);	VIEW_DEBUG_NAME("ht_menu_window_body");}void ht_menu_window_body::done(){	ht_context_menu_window_body::done();}void ht_menu_window_body::handlemsg(htmsg *msg){	if (msg->msg == msg_keypressed) {		switch (msg->data1.integer) {			case K_Left:				((ht_dialog*)baseview)->setstate(ds_term_ok, button_left);				dirtyview();				clearmsg(msg);				return;			case K_Right:				((ht_dialog*)baseview)->setstate(ds_term_ok, button_right);				dirtyview();				clearmsg(msg);				return;		}	}	ht_context_menu_window_body::handlemsg(msg);}/* *	INIT */bool init_menu(){	return true;}/* *	DONE */void done_menu(){}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -