/* 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. */ /* ->c.txtwin * Purpose: control of multiple windows on Text objects. * Author: W. Stoye. * Status: * system-independent * experimental * History: * 03-Nov-87: started * 11-Jan-88: AFP: converted to C. * 02-Mar-88: WRS: use of BOOL */ #define BOOL int #define TRUE 1 #define FALSE 0 #include "h.trace" #include "h.os" #include "h.wimp" #include "h.wimpt" #include "h.win" #include "h.txt" #include "h.EditIntern.txtundo" #include "h.EditIntern.txt1" #include "h.EditIntern.txt3" #include "h.EditIntern.txtar" #include "h.txtwin" void txtwin_new(txt t) { txtar_clone_current_window(t); } int txtwin_number(txt t) { return t->nwindows; } void txtwin_dispose(txt t) { if (t->nwindows > 1) { txt3_disposewindow(t, 1); }; } void txtwin_setcurrentwindow(txt t) /* This is not nice. Menu events are passed to txtedit without txtar getting a look-in, so we have no chance to ensure that the correct window is current. What is more, the data (which window was hit) has been lost by the time all of this matters. Only c.win knows the mapping from windows to objects. Thus the following kludge. */ { wimp_eventstr *e = wimpt_last_event(); t=t; tracef0("set current window.\n"); /* Called to ensure that a menu'd window is indeed the current one. */ if (e->e == wimp_EBUT) { wimp_wstate s; wimp_eventstr oe; tracef0("we have to fake an open event!\n"); wimp_get_wind_state(e->data.but.m.w, &s); oe.e = wimp_EOPEN; oe.data.o = s.o; win_processevent(&oe); /* This will cause the text to make that window the primary one for this text object. */ }; } /* end */