예제 #1
0
파일: text.c 프로젝트: Distrotech/cmucl
void RXmTextCut(message_t message)
{
  Widget w;
  Time t;

  toolkit_read_value(message,&w,XtRWidget);
  t = XtLastTimestampProcessed(display);
  reply_with_boolean(message,XmTextCut(w,t));
}
예제 #2
0
static int motTextSetClipboardAttrib(Ihandle *ih, const char *value)
{
  if (iupStrEqualNoCase(value, "COPY"))
  {
    char *str = XmTextGetSelection(ih->handle);
    if (!str) return 0;

    XmTextCopy(ih->handle, CurrentTime);

    /* do it also for the X clipboard */
    XStoreBytes(iupmot_display, str, strlen(str)+1);
    XtFree(str);
  }
  else if (iupStrEqualNoCase(value, "CUT"))
  {
    char *str = XmTextGetSelection(ih->handle);
    if (!str) return 0;

    /* disable callbacks */
    iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");

    XmTextCut(ih->handle, CurrentTime);

    /* do it also for the X clipboard */
    XStoreBytes(iupmot_display, str, strlen(str)+1);
    XtFree(str);
    XmTextRemove(ih->handle);

    iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
  }
  else if (iupStrEqualNoCase(value, "PASTE"))
  {
    int size;
    char* str = XFetchBytes(iupmot_display, &size);
    if (!str) return 0;

    /* disable callbacks */
    iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");

    XmTextPaste(ih->handle); /* TODO: this could force 2 pastes, check in CDE */

    /* do it also for the X clipboard */
    XmTextRemove(ih->handle);
    XmTextInsert(ih->handle, XmTextGetInsertionPosition(ih->handle), str);
    XFree(str);

    iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
  }
  else if (iupStrEqualNoCase(value, "CLEAR"))
  {
    /* disable callbacks */
    iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");
    XmTextRemove(ih->handle);
    iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", NULL);
  }
  return 0;
}
예제 #3
0
파일: CEdit.C 프로젝트: dhaley/dcp
void CEdit::Cut(void)
{

    // Deletes the currently selected text and copies it to
    // the clipboard
    if (_xd_textwidget != NULL)
    {
	if (XmIsText(_xd_textwidget))
	    XmTextCut(_xd_textwidget, XtLastTimestampProcessed(XtDisplay(_xd_textwidget)));
	else if (XmIsTextField(_xd_textwidget))
	    XmTextFieldCut(_xd_textwidget, XtLastTimestampProcessed(XtDisplay(_xd_textwidget)));
    }
    return;
}
예제 #4
0
파일: callbacks.c 프로젝트: idunham/opencde
void
editCB( Widget w, XtPointer client_data, 
 		XtPointer call_data)
{
	int i;
	char *s;
	long action;
	Time time;
	Widget widget;
	XButtonEvent *event;
	XmPushButtonCallbackStruct *acs;
	XmTextPosition left, right;
	
	action = (long) client_data;
	acs = (XmPushButtonCallbackStruct *) call_data; 
	event = (XButtonEvent *) acs->event;
	time = event->time;
	widget = get_document_text(w, "editCB");
	
	switch (action) {
		case EDIT_CUT:
			XmTextCut(widget, time);
			break;
		case EDIT_COPY:
			XmTextCopy(widget, time);
			break;
		case EDIT_PASTE:
			XmTextPaste(widget);
			break;
		case EDIT_DELETE:
			XmTextRemove(widget);
			break;
		case EDIT_CLEAR:
			if (False == XmTextGetSelectionPosition(widget, 
			    &left, &right)) 
				break; 
			s = calloc(1 + right - left, sizeof(char));
			if (NULL == s) {
				perror("Dtpad (calloc)");
				exit(1);
			}
			for (i = 0; i < right - left; i++) s[i] = ' ';
			s[right - left] = '\0';
			XmTextReplace(widget, left, right, s);
			XtFree(s);
			break;
		default:
			break;
	}
}
예제 #5
0
파일: snd-xlistener.c 프로젝트: huangjs/cl
static void Kill_line(Widget w, XEvent *ev, char **str, Cardinal *num) 
{
  /* C-k with storage of killed text */
  XmTextPosition curpos, loc;
  Boolean found;
  curpos = XmTextGetCursorPosition(w);
  found = XmTextFindString(w, curpos, "\n", XmTEXT_FORWARD, &loc);
  if (!found) loc = XmTextGetLastPosition(w);
  if (loc > curpos)
    {
      if (listener_selection) {XtFree(listener_selection); listener_selection = NULL;}
      XmTextSetSelection(w, curpos, loc, CurrentTime);
      listener_selection = XmTextGetSelection(w); /* xm manual p329 sez storage is allocated here */
      XmTextCut(w, CurrentTime);
    }
}
예제 #6
0
void
editCB( Widget w, XtPointer client_data, 
 		XtPointer call_data)
{
	long action;
	Time time;
	Widget widget;
	XButtonEvent *event;
	XmPushButtonCallbackStruct *acs;
	
	action = (long) client_data;
	acs = (XmPushButtonCallbackStruct *) call_data; 
	event = (XButtonEvent *) acs->event;
	time = event->time;
	widget = get_document_text(w, "editCB");
	
	switch (action) {
		case EDIT_CUT:
			XmTextCut(widget, time);
			break;
		case EDIT_COPY:
			XmTextCopy(widget, time);
			break;
		case EDIT_PASTE:
			XmTextPaste(widget);
			break;
		case EDIT_DELETE:
			XmTextRemove(widget);
			break;
		case EDIT_CLEAR:
			edit_clear(widget);
			break;
		default:
			break;
	}
}
예제 #7
0
파일: snd-xlistener.c 프로젝트: huangjs/cl
static void Delete_region(Widget w, XEvent *ev, char **str, Cardinal *num) 
{
  XmTextCut(w, CurrentTime);
}
예제 #8
0
void wxTextEntry::Cut()
{
    XmTextCut(GetText(), CurrentTime);
}