Ejemplo n.º 1
0
void
newDocCB( Widget w, XtPointer client_data, 
 		XtPointer call_data)
{
	Widget widget;
	
	widget = get_document_text(w, "newDocCB");
	XmTextSetString(widget, "");
	
	widget = get_widget_by_name(w, "newDocCB", "lineTextField");
	XmTextFieldSetString(widget, "");
	
	update_message(w, "newDocCB", "Created new empty file.");
	set_save_path(NULL);
	set_been_saved(False);
	
	update_document_linecount(w, "newDocCB");
	update_window_title(w, "newDocCB");
}
Ejemplo n.º 2
0
void
includeFileCB( Widget w, XtPointer client_data, 
 		XtPointer call_data)
{
	char *file_data, *c_path;
	Widget widget;
	XmFileSelectionBoxCallbackStruct *res;
	XmTextPosition pos;
	
	res = (XmFileSelectionBoxCallbackStruct *) call_data; 
	c_path = XmStringUnparse(res->value, 
	    NULL, XmCHARSET_TEXT, XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL); 
	file_data = get_file_contents(w, "fileOpenCB", c_path);
	widget = get_document_text(w, "fileOpenCB");
	pos = XmTextGetInsertionPosition(widget);
	XmTextInsert(widget, pos, file_data);
	
	update_document_linecount(w, "includeFileCB");
	update_message(w, "fileOpenCB", "Included file.");
	
	XtFree(c_path);
	XtFree(file_data);
	XtUnmanageChild(w);
}