-/* $Id: mac.c,v 1.1.2.10 1999/03/01 22:26:49 ben Exp $ */
+/* $Id: mac.c,v 1.1.2.11 1999/03/03 22:03:54 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
static void mac_eventloop(void);
static void mac_event(EventRecord *);
static void mac_contentclick(WindowPtr, EventRecord *);
+static void mac_growwindow(WindowPtr, EventRecord *);
static void mac_activatewindow(WindowPtr, Boolean);
static void mac_updatewindow(WindowPtr);
static void mac_keypress(EventRecord *);
DragWindow(window, event->where, &qd.screenBits.bounds);
break;
case inGrow:
+ mac_growwindow(window, event);
break;
case inZoomIn:
case inZoomOut:
}
}
+static void mac_growwindow(WindowPtr window, EventRecord *event) {
+
+ switch (mac_windowtype(window)) {
+ case wTerminal:
+ mac_growterm(window, event);
+ }
+}
+
static void mac_activatewindow(WindowPtr window, Boolean active) {
switch (mac_windowtype(window)) {
static void mac_shutdown(void) {
- ExitToShell();
+ exit(0);
}
void fatalbox(const char *fmt, ...) {
-/* $Id: macterm.c,v 1.1.2.13 1999/03/02 23:19:20 ben Exp $ */
+/* $Id: macterm.c,v 1.1.2.14 1999/03/03 22:03:54 ben Exp $ */
/*
* Copyright (c) 1999 Ben Harris
* All rights reserved.
#include <QuickdrawText.h>
#include <Resources.h>
#include <Sound.h>
+#include <ToolUtils.h>
#include <limits.h>
#include <stdlib.h>
static void mac_initfont(struct mac_session *);
static void mac_initpalette(struct mac_session *);
-static void mac_adjustsize(struct mac_session *);
+static void mac_adjustsize(struct mac_session *, int, int);
static pascal void mac_scrolltracker(ControlHandle, short);
static pascal void do_text_for_device(short, short, GDHandle, long);
font_width = fi.widMax;
font_height = fi.ascent + fi.descent + fi.leading;
s->font_ascent = fi.ascent;
- mac_adjustsize(s);
+ mac_adjustsize(s, rows, cols);
}
/*
* To be called whenever the window size changes.
* rows and cols should be desired values.
- * It's assumed the terminal emulator will be or has been informed.
+ * It's assumed the terminal emulator will be informed, and will set rows
+ * and cols for us.
*/
-static void mac_adjustsize(struct mac_session *s) {
+static void mac_adjustsize(struct mac_session *s, int newrows, int newcols) {
int winwidth, winheight;
- winwidth = cols * font_width + 15;
- winheight = rows * font_height;
+ winwidth = newcols * font_width + 15;
+ winheight = newrows * font_height;
SizeWindow(s->window, winwidth, winheight, true);
HideControl(s->scrollbar);
MoveControl(s->scrollbar, winwidth - 15, -1);
}
}
+void mac_growterm(WindowPtr window, EventRecord *event) {
+ Rect limits;
+ long grow_result;
+ int newrows, newcols;
+ struct mac_session *s;
+
+ s = (struct mac_session *)GetWRefCon(window);
+ SetRect(&limits, font_width + 15, font_height, SHRT_MAX, SHRT_MAX);
+ grow_result = GrowWindow(window, event->where, &limits);
+ if (grow_result != 0) {
+ newrows = HiWord(grow_result) / font_height;
+ newcols = (LoWord(grow_result) - 15) / font_width;
+ mac_adjustsize(s, newrows, newcols);
+ term_size(newrows, newcols, cfg.savelines);
+ }
+}
+
void mac_activateterm(WindowPtr window, Boolean active) {
struct mac_session *s;