/* Copyright 1996 Acorn Computers Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Title: txtscrap.c * Purpose: centralised management of the concept of a scrap or selection * Author: AFP * Status: system-independent * Requires: * h.txt * History: * 16 July 87 -- started * 14 December 87: AFP: converted into C. */ #define BOOL int #define TRUE 1 #define FALSE 0 #include <stdio.h> #include <string.h> #include <stdlib.h> #include "txt.h" #include "txtscrap.h" static txt owner = 0; #if FALSE /* removed IDJ 2-11-89 */ char *txtscrap_name(void) { return "<Wimp$Scrap>"; } #endif void txtscrap_setselect(txt t, txt_index from, txt_index to) { if (owner != (txt) NULL && !txt_selectset(owner)) owner = (txt) NULL; if (from == to || t == (txt) NULL) if (owner == (txt) NULL) owner = owner; else { txt_setselect(owner, 0, 0); owner = (txt) NULL; } else { if (owner != (txt) NULL && owner != t) txt_setselect(owner, 0, 0); txt_setselect(t, from, to); owner = t; } } txt txtscrap_selectowner(void) { if (owner != (txt) NULL && !txt_selectset(owner)) owner = (txt) NULL; return(owner); } /* end */