Beispiel #1
0
static void templates_cb(
	Widget		w,
	XtPointer	cbd,
	XtPointer	cbs)
{
	TemplateCallbackData *cbdata = cbd;
	XmTextPosition start, end, after;

	if(!text_w) {
		char m[80];
		sprintf(m, "unexpected argument %p", cbdata);
		msg("template handler", m);
		return;
	}

	if(get_map_state(text_w) != IsViewable) {
		beep();
		return;
	}

	if(	XmTextGetSelectionPosition(text_w, &start, &end)
	&&	start < end) {
		XmTextReplace(text_w, start, end, *cbdata);
		XmTextClearSelection(text_w, CurrentTime);
	} else {
		start = XmTextGetInsertionPosition(text_w);
		XmTextInsert(text_w, start, *cbdata);
	}

	after = start + strlen (*cbdata);
	XmTextSetInsertionPosition(text_w, after);
	XmTextShowPosition(text_w, after);
	set_input_focus(text_w);
}
Beispiel #2
0
void add_templates_tool(Widget w)
{
	if(paned != NULL) {
		XtManageChild(top_form);
		XtManageChild(bottom_form);
		XtManageChild(paned);
		XtPopup(shell, XtGrabNone);
		fix_pane_height(bottom_form, bottom_form);
		set_input_focus(paned);
	}
}
Beispiel #3
0
void update_input_focus(void)
{
	set_input_focus(mon->desk->focus);
}