home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
games
/
volume16
/
nethack31
/
patch1j
/
patches01s
next >
Wrap
Text File
|
1993-03-05
|
54KB
|
1,983 lines
*** /tmp/da09374 Thu Feb 25 10:29:06 1993
--- sys/mac/maccurs.c Sun Feb 21 16:06:06 1993
***************
*** 91,96 ****
--- 91,99 ----
}
+ #if 0
+ /* Now we use click_to_cmd() instead. */
+
int
clickSector ( int x , int y , int toX , int toY )
{
***************
*** 155,161 ****
}
}
!
Boolean
--- 158,164 ----
}
}
! #endif
Boolean
*** /tmp/da09398 Thu Feb 25 10:29:12 1993
--- sys/mac/macmain.c Thu Feb 11 12:12:23 1993
***************
*** 114,120 ****
boolean remember_wiz_mode = wizard;
#endif
#ifdef NEWS
! if(flags.news) display_file(NEWS, FALSE);
#endif
pline("Restoring save file...");
mark_synch(); /* flush output */
--- 114,123 ----
boolean remember_wiz_mode = wizard;
#endif
#ifdef NEWS
! if(flags.news) {
! display_file(NEWS, FALSE);
! flags.news = FALSE; /* in case dorecover() fails */
! }
#endif
pline("Restoring save file...");
mark_synch(); /* flush output */
***************
*** 174,185 ****
attemptingto("proceed");
#if defined(MAC_MPW32) && !defined(MODEL_FAR)
UnloadAllSegments(); /* Do this before naming residents */
! IsResident( (Ptr) display_nhwindow ); /* Sample resident segments */
IsResident( (Ptr) rhack );
IsResident( (Ptr) engr_at );
IsResident( (Ptr) movemon );
IsResident( (Ptr) attacktype ) ;
IsResident( (Ptr) mac_get_nh_event ) ;
#endif
moveloop();
/*NOTREACHED*/
--- 177,197 ----
attemptingto("proceed");
#if defined(MAC_MPW32) && !defined(MODEL_FAR)
UnloadAllSegments(); /* Do this before naming residents */
! IsResident( (Ptr) um_dist ); /* Sample resident segments */
! IsResident( (Ptr) flush_screen );
IsResident( (Ptr) rhack );
+ IsResident( (Ptr) remove_cadavers );
+ IsResident( (Ptr) dog_move );
+ IsResident( (Ptr) gethungry );
IsResident( (Ptr) engr_at );
+ IsResident( (Ptr) domove );
+ IsResident( (Ptr) carried );
IsResident( (Ptr) movemon );
IsResident( (Ptr) attacktype ) ;
IsResident( (Ptr) mac_get_nh_event ) ;
+ IsResident( (Ptr) dosounds ) ;
+ IsResident( (Ptr) t_at ) ;
+ IsResident( (Ptr) nh_timeout ) ;
#endif
moveloop();
/*NOTREACHED*/
***************
*** 434,441 ****
#define kUnLoaded 0x3F3C /* if unloaded then a LoadSeg trap */
/* Note: probably incorrect for -model far! */
! /* #define TRACKSEGS /* Utility to print a trace of segment load frequencies. Add
! a call to ListGUnloads into terminate() in end.c to use it */
#ifdef TRACKSEGS
--- 446,452 ----
#define kUnLoaded 0x3F3C /* if unloaded then a LoadSeg trap */
/* Note: probably incorrect for -model far! */
! /* #define TRACKSEGS /* Utility to print a trace of segment load frequencies. */
#ifdef TRACKSEGS
***************
*** 447,453 ****
int i;
FILE *f;
! f = fopen("unloads","r+");
fprintf(f,"%d calls to UnloadAllSegments\n\n",gUnloads[0]);
for (i=1; i<=pMaxSegNum; i++) {
fprintf(f,"Unloaded %10s, segment %2d, %6d times\n",gSegNames[i],i,gUnloads[i]);
--- 458,464 ----
int i;
FILE *f;
! f = fopen("unloads","w");
fprintf(f,"%d calls to UnloadAllSegments\n\n",gUnloads[0]);
for (i=1; i<=pMaxSegNum; i++) {
fprintf(f,"Unloaded %10s, segment %2d, %6d times\n",gSegNames[i],i,gUnloads[i]);
***************
*** 504,509 ****
--- 515,521 ----
SetResLoad(false);
#ifdef TRACKSEGS
+ atexit(&ListGUnloads);
gUnloads[0]=0;
#endif
for (i=1; i<=pMaxSegNum; i++) {
*** /tmp/da09414 Thu Feb 25 10:29:17 1993
--- sys/mac/mactopl.c Thu Feb 18 17:37:56 1993
***************
*** 7,13 ****
#include <OSUtils.h>
#include <Packages.h>
- // int NDECL(mac_doprev_message);
// char FDECL(yn_function,(const char *, const char *, CHAR_P));
int FDECL ( try_key_queue , ( char * ) ) ;
--- 7,12 ----
***************
*** 25,59 ****
extern winid inSelect ;
extern short frame_corner ;
- int
- mac_doprev_message(void)
- {
- NhWindow * aWin = & theWindows [ WIN_MESSAGE ] ;
- char * start , * stop ;
- if ( ! WIN_MESSAGE )
- return 0 ;
-
- stop = * aWin -> windowText ;
- start = * aWin -> windowText + aWin -> textBase - 2 ;
-
- while ( start > stop && * start != 10 && * start != 13 )
- start -- ;
-
- if ( start <= stop )
- aWin -> textBase = 0L ;
- else
- aWin -> textBase = start - stop + 1 ;
- if ( aWin -> textBase > aWin -> windowTextLen )
- aWin -> textBase = aWin -> windowTextLen ;
-
- display_nhwindow ( WIN_MESSAGE , FALSE ) ;
- InvalRect ( & ( aWin -> theWindow -> portRect ) ) ;
-
- return 0 ;
- }
-
-
char
queued_resp(char *resp)
{
--- 24,30 ----
***************
*** 414,420 ****
topl_set_resp(resp, def);
do {
! c = nhgetch();
if (c && resp && !strchr(resp, c)) {
nhbell();
c = '\0';
--- 385,391 ----
topl_set_resp(resp, def);
do {
! c = readchar();
if (c && resp && !strchr(resp, c)) {
nhbell();
c = '\0';
*** /tmp/da09430 Thu Feb 25 18:16:50 1993
--- sys/mac/macwin.c Thu Feb 25 18:07:54 1993
***************
*** 79,85 ****
--- 79,100 ----
Boolean gClickedToMove = 0 ; /* For ObscureCursor */
+ static unsigned long gNextClickRepeat = 0xffffffff ;
+ static Point clicked_pos ; /* For nh_poskey */
+ static int clicked_mod ;
+
+ static Boolean cursor_locked = false ;
+
+ void
+ lock_mouse_cursor(Boolean new_cursor_locked)
+ {
+ cursor_locked = new_cursor_locked;
+ if (new_cursor_locked)
+ PostEvent(osEvt, mouseMovedMessage<<24);
+ }
+
+
/*
* Add key to input queue, force means replace last if full
*/
***************
*** 115,120 ****
--- 130,140 ----
MacFlags macFlags ;
/*
+ * The screen layouts on the small 512x342 screen need special cares.
+ */
+ Boolean small_screen;
+
+ /*
* Async flag for keeping track of scrollbars...
* Used by InvalScrollBar ( )
*/
***************
*** 121,129 ****
static NhWindow * asyDSC = (NhWindow *) NULL ;
/*
! * The font to be used in the text window
*/
! short text_wind_font = geneva;
/*
* Whether to adjust the height of a text window according to its contents
--- 141,150 ----
static NhWindow * asyDSC = (NhWindow *) NULL ;
/*
! * The font to be used in the text window, will be set to geneva after
! * we create the base window
*/
! short text_wind_font = monaco;
/*
* Whether to adjust the height of a text window according to its contents
***************
*** 136,146 ****
MenuHandle appleMenu ;
MenuHandle fileMenu ;
MenuHandle editMenu ;
! MenuHandle extendMenu ;
! MenuHandle miscMenu ;
! MenuHandle helpMenu ;
! MenuHandle commandsMenu ;
MenuHandle thingsMenu ;
#define NHW_BASE 0
winid BASE_WINDOW ; // Was: , WIN_MAP , WIN_MESSAGE , WIN_INVEN , WIN_STATUS ;
--- 157,168 ----
MenuHandle appleMenu ;
MenuHandle fileMenu ;
MenuHandle editMenu ;
! MenuHandle actionMenu ;
! MenuHandle inventoryMenu ;
MenuHandle thingsMenu ;
+ MenuHandle extendedMenu ;
+ MenuHandle infoMenu ;
+ MenuHandle helpMenu ;
#define NHW_BASE 0
winid BASE_WINDOW ; // Was: , WIN_MAP , WIN_MESSAGE , WIN_INVEN , WIN_STATUS ;
***************
*** 271,277 ****
InitSegMgmt( itworked ); /* itworked is always in the main segment */
attemptingto("start up");
!
if ( Gestalt ( gestaltOSAttr , & l ) ) {
macFlags . processes = 0 ;
macFlags . tempMem = 0 ;
--- 293,299 ----
InitSegMgmt( itworked ); /* itworked is always in the main segment */
attemptingto("start up");
!
if ( Gestalt ( gestaltOSAttr , & l ) ) {
macFlags . processes = 0 ;
macFlags . tempMem = 0 ;
***************
*** 324,330 ****
}
! #define MAX_HEIGHT 200
#define MIN_HEIGHT 50
#define MIN_WIDTH 300
--- 346,352 ----
}
! #define MAX_HEIGHT 100
#define MIN_HEIGHT 50
#define MIN_WIDTH 300
***************
*** 355,361 ****
width = nhWin -> charWidth * NUM_COLS ;
if ( ! RetrievePosition ( kMapWindow , & top , & left ) ) {
! top = GetMBarHeight ( ) * 2 ;
left = ( screenArea . right - width ) / 2 ;
}
--- 377,383 ----
width = nhWin -> charWidth * NUM_COLS ;
if ( ! RetrievePosition ( kMapWindow , & top , & left ) ) {
! top = GetMBarHeight ( ) + ( small_screen ? 2 : 20 ) ;
left = ( screenArea . right - width ) / 2 ;
}
***************
*** 389,400 ****
theWindow = nhWin -> theWindow ;
if ( ! RetrievePosition ( kMessageWindow , & top , & left ) ) {
! top = statTop + statHeight + 20 ;
left = statLeft ;
}
if ( ! RetrieveSize ( kMessageWindow , top , left , & height , & width ) ) {
! height = screenArea . bottom - top - 2 ;
if ( height > MAX_HEIGHT ) {
height = MAX_HEIGHT ;
} else if ( height < MIN_HEIGHT ) {
--- 411,424 ----
theWindow = nhWin -> theWindow ;
if ( ! RetrievePosition ( kMessageWindow , & top , & left ) ) {
! top = statTop + statHeight ;
! if ( ! small_screen )
! top += 20 ;
left = statLeft ;
}
if ( ! RetrieveSize ( kMessageWindow , top , left , & height , & width ) ) {
! height = screenArea . bottom - top - ( small_screen ? 2-SBARHEIGHT : 2 ) ;
if ( height > MAX_HEIGHT ) {
height = MAX_HEIGHT ;
} else if ( height < MIN_HEIGHT ) {
***************
*** 410,419 ****
mesgWidth = width ;
/* Move these windows */
- MoveWindow ( theWindows [ WIN_STATUS ] . theWindow , statLeft , statTop , 1 ) ;
- SizeWindow ( theWindows [ WIN_STATUS ] . theWindow , statWidth , statHeight , 1 ) ;
MoveWindow ( theWindows [ WIN_MESSAGE ] . theWindow , mesgLeft , mesgTop , 1 ) ;
SizeWindow ( theWindows [ WIN_MESSAGE ] . theWindow , mesgWidth , mesgHeight , 1 ) ;
MoveWindow ( theWindows [ WIN_MAP ] . theWindow , mainLeft , mainTop , 1 ) ;
SizeWindow ( theWindows [ WIN_MAP ] . theWindow , mainWidth , mainHeight , 1 ) ;
--- 434,443 ----
mesgWidth = width ;
/* Move these windows */
MoveWindow ( theWindows [ WIN_MESSAGE ] . theWindow , mesgLeft , mesgTop , 1 ) ;
SizeWindow ( theWindows [ WIN_MESSAGE ] . theWindow , mesgWidth , mesgHeight , 1 ) ;
+ MoveWindow ( theWindows [ WIN_STATUS ] . theWindow , statLeft , statTop , 1 ) ;
+ SizeWindow ( theWindows [ WIN_STATUS ] . theWindow , statWidth , statHeight , 1 ) ;
MoveWindow ( theWindows [ WIN_MAP ] . theWindow , mainLeft , mainTop , 1 ) ;
SizeWindow ( theWindows [ WIN_MAP ] . theWindow , mainWidth , mainHeight , 1 ) ;
***************
*** 437,443 ****
} else {
if ( ! RetrievePosition ( kTextWindow , & top , & left ) ) {
top = GetMBarHeight ( ) * 2 ;
! left = screenArea . right - 3 ;
}
top += ( numText * GetMBarHeight ( ) ) ;
while ( top > screenArea . bottom - MIN_HEIGHT ) {
--- 461,468 ----
} else {
if ( ! RetrievePosition ( kTextWindow , & top , & left ) ) {
top = GetMBarHeight ( ) * 2 ;
! left = screenArea . right - 3 - ( theWindow -> portRect . right -
! theWindow -> portRect . left ) ;
}
top += ( numText * GetMBarHeight ( ) ) ;
while ( top > screenArea . bottom - MIN_HEIGHT ) {
***************
*** 445,452 ****
left -= 20 ;
}
numText ++ ;
! MoveWindow ( theWindow , left - ( theWindow -> portRect . right -
! theWindow -> portRect . left ) , top , 1 ) ;
}
}
}
--- 470,476 ----
left -= 20 ;
}
numText ++ ;
! MoveWindow ( theWindow , left , top , 1 ) ;
}
}
}
***************
*** 498,504 ****
( ( WindowPeek ) aWin -> theWindow ) -> windowKind = WIN_BASE_KIND
+ type ;
aWin -> windowTextLen = 0L ;
- aWin -> textBase = 0L ;
aWin -> clear = 0 ; /* Yes, we need to inval the area on a clear */
aWin -> scrollBar = (ControlHandle) NULL ;
switch ( type ) {
--- 522,527 ----
***************
*** 530,535 ****
--- 553,560 ----
aWin -> theWindow = (WindowPtr) NULL ;
return WIN_ERR ;
}
+ aWin -> windowTextLen = 0L ;
+ aWin -> lin = 0 ;
break ;
}
***************
*** 600,606 ****
siz . bottom - siz . top , FALSE ) ;
MoveWindow ( aWin -> theWindow , siz . left , siz . top , FALSE ) ;
! if ( type == NHW_MENU || type == NHW_TEXT ) {
Rect r = siz ;
Boolean bool ;
OffsetRect ( & r , - r . left , - r . top ) ;
--- 625,631 ----
siz . bottom - siz . top , FALSE ) ;
MoveWindow ( aWin -> theWindow , siz . left , siz . top , FALSE ) ;
! if ( type == NHW_MENU || type == NHW_TEXT || type == NHW_MESSAGE ) {
Rect r = siz ;
Boolean bool ;
OffsetRect ( & r , - r . left , - r . top ) ;
***************
*** 619,624 ****
--- 644,660 ----
}
+ static MenuHandle
+ mustGetMHandle(int menu_id)
+ {
+ MenuHandle menu = GetMHandle(menu_id);
+ if (menu == nil) {
+ comment("Cannot find the menu.", menu_id);
+ ExitToShell();
+ }
+ return menu;
+ }
+
void
InitRes ( void )
{
***************
*** 628,650 ****
mustwork(ResError());
SetMenuBar ( mBar ) ;
! appleMenu = GetMHandle ( 128 ) ;
! mustwork(ResError());
AppendMenu ( appleMenu , ( ConstStr255Param ) "\002(-" ) ;
AddResMenu ( appleMenu , 'DRVR' ) ;
! fileMenu = GetMHandle ( 129 ) ;
! mustwork(ResError());
! editMenu = GetMHandle ( 130 ) ;
! mustwork(ResError());
! extendMenu = GetMHandle ( 131 ) ;
! mustwork(ResError());
! miscMenu = GetMHandle ( 132 ) ;
! mustwork(ResError());
! commandsMenu = GetMHandle ( 133 ) ;
! mustwork ( ResError ( ) ) ;
! thingsMenu = GetMHandle ( 134 ) ;
! mustwork ( ResError ( ) ) ;
if ( macFlags . help ) {
if ( HMGetHelpMenuHandle ( & helpMenu ) ) {
--- 664,680 ----
mustwork(ResError());
SetMenuBar ( mBar ) ;
! appleMenu = mustGetMHandle ( 128 ) ;
AppendMenu ( appleMenu , ( ConstStr255Param ) "\002(-" ) ;
AddResMenu ( appleMenu , 'DRVR' ) ;
! fileMenu = mustGetMHandle ( 129 ) ;
! editMenu = mustGetMHandle ( 130 ) ;
! actionMenu = mustGetMHandle ( 131 ) ;
! inventoryMenu = mustGetMHandle ( 132 ) ;
! thingsMenu = mustGetMHandle ( 133 ) ;
! extendedMenu = mustGetMHandle ( 134 ) ;
! infoMenu = mustGetMHandle ( 135 ) ;
if ( macFlags . help ) {
if ( HMGetHelpMenuHandle ( & helpMenu ) ) {
***************
*** 667,672 ****
--- 697,706 ----
{
int i ;
+ Rect scr = (*GetGrayRgn())->rgnBBox;
+ small_screen = scr.bottom - scr.top <= 9*40 ||
+ scr.bottom - scr.top <= 12*40 && flags.large_font;
+
InitRes ( ) ;
theWindows = ( NhWindow * ) NewPtr ( NUM_MACWINDOWS *
***************
*** 688,698 ****
putstr(BASE_WINDOW, 0,
" By Stichting Mathematisch Centrum and M. Stephenson.");
putstr(BASE_WINDOW, 0, " See license for details.");
! putstr(BASE_WINDOW, 0, " ");
display_nhwindow(BASE_WINDOW, FALSE);
flags . window_inited = 1 ;
DimMenuBar ( ) ;
}
--- 722,733 ----
putstr(BASE_WINDOW, 0,
" By Stichting Mathematisch Centrum and M. Stephenson.");
putstr(BASE_WINDOW, 0, " See license for details.");
! putstr(BASE_WINDOW, 0, "");
display_nhwindow(BASE_WINDOW, FALSE);
flags . window_inited = 1 ;
DimMenuBar ( ) ;
+ normal_font ( ) ;
}
***************
*** 720,726 ****
Rect r2 = theWindow -> portRect ;
Rect r = r2 ;
Boolean vis ;
! short val ;
if ( ! aWin -> scrollBar ) {
return ;
--- 755,761 ----
Rect r2 = theWindow -> portRect ;
Rect r = r2 ;
Boolean vis ;
! short val , lin ;
if ( ! aWin -> scrollBar ) {
return ;
***************
*** 730,738 ****
r2 . bottom -= SBARHEIGHT ;
r2 . right += 1 ;
r2 . top -= 1 ;
! MoveControl ( aWin -> scrollBar , r2 . left , r2 . top ) ;
! SizeControl ( aWin -> scrollBar , r2 . right - r2 . left ,
! r2 . bottom - r2 . top ) ;
vis = ( r2 . bottom > r2 . top + 50 ) ;
if ( vis && ! ( * aWin -> scrollBar ) -> contrlVis ) {
ShowControl ( aWin -> scrollBar ) ;
--- 765,777 ----
r2 . bottom -= SBARHEIGHT ;
r2 . right += 1 ;
r2 . top -= 1 ;
! if ( ( * aWin -> scrollBar ) -> contrlRect . top != r2 . top ||
! ( * aWin -> scrollBar ) -> contrlRect . left != r2 . left )
! MoveControl ( aWin -> scrollBar , r2 . left , r2 . top ) ;
! if ( ( * aWin -> scrollBar ) -> contrlRect . bottom != r2 . bottom ||
! ( * aWin -> scrollBar ) -> contrlRect . right != r2 . right )
! SizeControl ( aWin -> scrollBar , r2 . right - r2 . left ,
! r2 . bottom - r2 . top ) ;
vis = ( r2 . bottom > r2 . top + 50 ) ;
if ( vis && ! ( * aWin -> scrollBar ) -> contrlVis ) {
ShowControl ( aWin -> scrollBar ) ;
***************
*** 739,747 ****
} else if ( ! vis && ( * aWin -> scrollBar ) -> contrlVis ) {
HideControl ( aWin -> scrollBar ) ;
}
! if ( aWin -> lin ) {
! short max = aWin -> lin - ( r . bottom - r . top ) / aWin ->
charHeight ;
if ( max < 0 ) max = 0 ;
SetCtlMax ( aWin -> scrollBar , max ) ;
if ( max ) HiliteControl ( aWin -> scrollBar , 0 ) ;
--- 778,794 ----
} else if ( ! vis && ( * aWin -> scrollBar ) -> contrlVis ) {
HideControl ( aWin -> scrollBar ) ;
}
! lin = aWin -> lin;
! if ( aWin == theWindows + WIN_MESSAGE ) {
! short min ;
! r . bottom -= SBARHEIGHT + 1 ;
! min = aWin -> save_lin + ( r . bottom - r . top ) / aWin ->
charHeight ;
+ if ( lin < min )
+ lin = min ;
+ }
+ if ( lin ) {
+ short max = lin - ( r . bottom - r . top ) / aWin -> charHeight ;
if ( max < 0 ) max = 0 ;
SetCtlMax ( aWin -> scrollBar , max ) ;
if ( max ) HiliteControl ( aWin -> scrollBar , 0 ) ;
***************
*** 775,780 ****
--- 822,828 ----
mac_clear_nhwindow ( winid win )
{
long l ;
+ Rect r ;
register char * start , * stop ;
WindowPtr theWindow ;
NhWindow * aWin = & theWindows [ win ] ;
***************
*** 791,797 ****
return ;
}
SetPort ( theWindow ) ;
! InvalRect ( & ( theWindow -> portRect ) ) ;
switch ( ( ( WindowPeek ) theWindow ) -> windowKind - WIN_BASE_KIND ) {
case NHW_MAP :
stop = ( char * ) ( ( MapData * ) ( * aWin -> windowText ) )
--- 839,850 ----
return ;
}
SetPort ( theWindow ) ;
! r = theWindow -> portRect ;
! if ( aWin -> scrollBar )
! r . right -= SBARWIDTH + 1 ;
! if ( aWin == theWindows + WIN_MESSAGE )
! r . bottom -= SBARHEIGHT + 1 ;
! InvalRect ( & r ) ;
switch ( ( ( WindowPeek ) theWindow ) -> windowKind - WIN_BASE_KIND ) {
case NHW_MAP :
stop = ( char * ) ( ( MapData * ) ( * aWin -> windowText ) )
***************
*** 806,836 ****
while ( start > stop ) * -- start = CHAR_BLANK ;
break ;
case NHW_MESSAGE :
! l = GetHandleSize ( aWin -> windowText ) ;
! if ( l > TEXT_BLOCK * 2 ) {
! BlockMove ( * aWin -> windowText + TEXT_BLOCK ,
! * aWin -> windowText , l - TEXT_BLOCK ) ;
! SetHandleSize ( aWin -> windowText , l - TEXT_BLOCK ) ;
! aWin -> windowTextLen -= TEXT_BLOCK ;
! if ( aWin -> windowTextLen < 0 ) {
! aWin -> windowTextLen = 0 ;
! }
}
! #if 1
! aWin->textBase = aWin->windowTextLen;
! #else
! stop = * aWin -> windowText ;
! start = stop + aWin -> windowTextLen - 1 ;
! while ( -- start > stop ) {
! if ( * start == CHAR_CR || * start == CHAR_LF )
! break ;
}
! if ( start > stop ) {
! aWin -> textBase = start - stop + 1 ;
! } else {
! aWin -> textBase = 0L ;
}
- #endif
break ;
default :
SetHandleSize ( aWin -> windowText , TEXT_BLOCK ) ;
--- 859,882 ----
while ( start > stop ) * -- start = CHAR_BLANK ;
break ;
case NHW_MESSAGE :
! l = 0;
! while (aWin->lin > flags.msg_history) {
! const char cr = CHAR_CR;
! l = Munger(aWin->windowText, l, &cr, 1, nil, 0) + 1;
! --aWin->lin;
}
! if (l) {
! aWin->windowTextLen -= l;
! BlockMove(*aWin->windowText + l, *aWin->windowText, aWin->windowTextLen);
}
! aWin->last_more_lin = aWin->lin;
! aWin->save_lin = aWin->lin;
! aWin->scrollPos = aWin->lin ? aWin->lin - 1 : 0;
! if (aWin->scrollBar) {
! SetCtlMax (aWin->scrollBar, aWin->lin);
! SetCtlValue(aWin->scrollBar, aWin->scrollPos);
! InvalScrollBar(aWin);
}
break ;
default :
SetHandleSize ( aWin -> windowText , TEXT_BLOCK ) ;
***************
*** 838,844 ****
aWin -> lin = 0 ;
aWin -> wid = 0 ;
aWin -> scrollPos = 0 ;
- aWin -> textBase = 0L ;
if ( aWin -> scrollBar ) {
SetCtlMax ( aWin -> scrollBar , 0 ) ;
InvalScrollBar ( aWin ) ;
--- 884,889 ----
***************
*** 853,859 ****
Boolean
ClosingWindowChar(const int c) {
! return c == CHAR_ESC || c == CHAR_BLANK || c == CHAR_LF || c == CHAR_CR ;
}
--- 898,905 ----
Boolean
ClosingWindowChar(const int c) {
! return c == CHAR_ESC || c == CHAR_BLANK || c == CHAR_LF || c == CHAR_CR ||
! c == 'q' ;
}
***************
*** 884,889 ****
--- 930,938 ----
{
if (!top_line || in_topl_mode())
Debugger();
+
+ putstr(WIN_MESSAGE, ATR_BOLD, query);
+
(*top_line)->viewRect.left = 0;
topl_query_len = strlen(query);
***************
*** 893,899 ****
TECalText(top_line);
display_nhwindow(WIN_MESSAGE, FALSE);
- putstr(WIN_MESSAGE, ATR_BOLD, query);
}
--- 942,947 ----
***************
*** 902,912 ****
{
int ans_len = (*top_line)->teLength - topl_query_len;
NhWindow *aWin = theWindows + WIN_MESSAGE;
- char tmp[3] = " ";
if (!in_topl_mode())
Debugger();
- (*top_line)->viewRect.left += 10000;
BlockMove(*(*top_line)->hText + topl_query_len, answer, ans_len);
answer[ans_len] = '\0';
--- 950,958 ----
***************
*** 916,926 ****
-- aWin -> windowTextLen ;
-- aWin -> lin ;
}
! if (strlen(answer) <= 1) {
! if (answer[0]) tmp[0] = answer[0];
! putstr(WIN_MESSAGE, ATR_BOLD, tmp);
! } else
! putstr(WIN_MESSAGE, ATR_BOLD, answer);
}
/*
--- 962,970 ----
-- aWin -> windowTextLen ;
-- aWin -> lin ;
}
! putstr(WIN_MESSAGE, ATR_BOLD, answer);
!
! (*top_line)->viewRect.left += 10000;
}
/*
***************
*** 1044,1054 ****
int r_len, r_len1;
if (!resp) {
! static char any_str[2] = { CHAR_ANY, '\0' };
resp = any_str;
def = CHAR_ANY;
}
r_len1 = strlen(resp);
r_len = strlen(topl_resp);
if (r_len < r_len1)
--- 1088,1099 ----
int r_len, r_len1;
if (!resp) {
! const char any_str[2] = { CHAR_ANY, '\0' };
resp = any_str;
def = CHAR_ANY;
}
+ SetPort(theWindows[WIN_MESSAGE].theWindow);
r_len1 = strlen(resp);
r_len = strlen(topl_resp);
if (r_len < r_len1)
***************
*** 1123,1128 ****
--- 1168,1206 ----
}
+ void
+ adjust_window_pos(NhWindow *aWin, WindowPtr theWindow, short w)
+ {
+ const Rect scr_r = (*GetGrayRgn())->rgnBBox,
+ win_ind = { 20, 2, 3, 3 };
+ const short min_w = theWindow->portRect.right - theWindow->portRect.left,
+ max_w = scr_r.right - scr_r.left - win_ind.left - win_ind.right;
+ Point pos;
+ short h = aWin->lin * aWin->charHeight, max_h;
+
+ SetPort(theWindow);
+ if (!RetrieveWinPos(theWindow, &pos.v, &pos.h)) {
+ pos.v = theWindow->portRect.top;
+ pos.h = theWindow->portRect.left;
+ LocalToGlobal(&pos);
+ }
+
+ max_h = full_screen ? scr_r.bottom - win_ind.bottom - scr_r.top - win_ind.top
+ : scr_r.bottom - win_ind.bottom - pos.v;
+ if (h > max_h ) h = max_h;
+ if (h < MIN_HEIGHT) h = MIN_HEIGHT;
+ if (w < min_w ) w = min_w;
+ if (w > max_w ) w = max_w;
+ SizeWindow(theWindow, w, h, true);
+
+ if (pos.v + h + win_ind.bottom > scr_r.bottom)
+ pos.v = scr_r.bottom - h - win_ind.bottom;
+ if (pos.h + w + win_ind.right > scr_r.right)
+ pos.h = scr_r.right - w - win_ind.right;
+ MoveWindow(theWindow, pos.h, pos.v, false);
+ }
+
+
/*
* display/select/update the window.
* If f is true, this window should be "modal" - don't return
***************
*** 1145,1213 ****
}
if ( f && inSelect == WIN_ERR && ( win == BASE_WINDOW || win == WIN_MESSAGE ) ) {
! if ( win == WIN_MESSAGE )
topl_set_resp ( NULL , 0 ) ;
! /* The following piece of code prevents the "-- More --" prompt to be on a new
! line by itself. I comment it out because the result looks ugly to me. */
! #ifdef 0
! if ( aWin -> windowTextLen > 0 &&
! ( * aWin -> windowText ) [ aWin -> windowTextLen - 1 ] == CHAR_CR ) {
! -- aWin -> windowTextLen ;
! -- aWin -> lin ;
}
! #endif
! putstr ( win , ATR_INVERSE , "-- More --" ) ;
}
! if ( ! ( ( WindowPeek ) theWindow ) -> visible ) {
! const Rect scr_r = (*GetGrayRgn())->rgnBBox,
! win_ind = { 20, 2, 3, 3 };
! const Point scr_sz = { scr_r.bottom - scr_r.top, scr_r.right - scr_r.left },
! wp_sz = { theWindow->portRect.bottom - theWindow->portRect.top,
! theWindow->portRect.right - theWindow->portRect.left };
! const short max_h = scr_sz.v - win_ind.top - win_ind.bottom,
! max_w = scr_sz.h - win_ind.left - win_ind.right;
! const char cr = CHAR_CR;
! long line_start = 0, line_end;
! short w = wp_sz.h,
! h = full_screen ? aWin->lin * aWin->charHeight : wp_sz.v;
! Point pos = { theWindow->portRect.top, theWindow->portRect.left };
! SetPort(theWindow);
! LocalToGlobal(&pos);
! HLock(aWin->windowText);
! while (line_start < aWin->windowTextLen) {
! short line_w;
! line_end = Munger(aWin->windowText, line_start, &cr, 1, nil, 0);
! if (line_end < 0)
! line_end = aWin->windowTextLen;
! line_w = TextWidth(*aWin->windowText, line_start, line_end - line_start) +
! (SBARWIDTH + 2);
! if (w < line_w)
! w = line_w;
! line_start = line_end + 1;
! }
! HUnlock(aWin->windowText);
!
! if (h > max_h) h = max_h;
! if (w > max_w) w = max_w;
! SizeWindow(theWindow, w, h, FALSE);
!
! if ( ! ( ( WindowPeek ) theWindow ) -> visible ) {
! short top , left ;
! if ( ! RetrieveWinPos ( theWindow , & top , & left ) ) {
! if (pos.v + h + win_ind.bottom > scr_r.bottom)
! pos.v = scr_r.bottom - h - win_ind.bottom;
! if (pos.h + w + win_ind.right > scr_r.right)
! pos.h = scr_r.right - w - win_ind.right;
! top = pos . v ;
! left = pos . h ;
}
! MoveWindow(theWindow, left, top, FALSE);
}
! SelectWindow ( theWindow ) ;
ShowWindow ( theWindow ) ;
}
--- 1223,1266 ----
}
if ( f && inSelect == WIN_ERR && ( win == BASE_WINDOW || win == WIN_MESSAGE ) ) {
! if ( win == WIN_MESSAGE ) {
topl_set_resp ( NULL , 0 ) ;
! if ( aWin -> windowTextLen > 0 &&
! ( * aWin -> windowText ) [ aWin -> windowTextLen - 1 ] == CHAR_CR ) {
! -- aWin -> windowTextLen ;
! -- aWin -> lin ;
! }
}
! putstr ( win , flags . standout ? ATR_INVERSE : ATR_NONE , " --More--" ) ;
}
! if ( ! ( ( WindowPeek ) theWindow ) -> visible || full_screen ) {
! int kind = ((WindowPeek)theWindow)->windowKind - WIN_BASE_KIND;
! if (kind == NHW_TEXT || kind == NHW_MENU) {
! const char cr = CHAR_CR;
! short w = 0;
! long line_start = 0;
! HLock(aWin->windowText);
! while (line_start < aWin->windowTextLen) {
! long line_end;
! short line_w;
! line_end = Munger(aWin->windowText, line_start, &cr, 1, nil, 0);
! if (line_end < 0)
! line_end = aWin->windowTextLen;
! line_w = TextWidth(*aWin->windowText, line_start, line_end - line_start);
! if (w < line_w)
! w = line_w;
! line_start = line_end + 1;
}
! HUnlock(aWin->windowText);
!
! adjust_window_pos(aWin, theWindow, w + (SBARWIDTH+2));
}
! if ( ! small_screen || win != WIN_MESSAGE || f )
! SelectWindow ( theWindow ) ;
ShowWindow ( theWindow ) ;
}
***************
*** 1227,1233 ****
if ( win == WIN_MESSAGE )
topl_set_resp ( "" , '\0' ) ;
! else
HideWindow ( theWindow ) ;
} else {
--- 1280,1286 ----
if ( win == WIN_MESSAGE )
topl_set_resp ( "" , '\0' ) ;
! else if ( win != WIN_MAP && win != WIN_STATUS )
HideWindow ( theWindow ) ;
} else {
***************
*** 1325,1334 ****
void
GeneralKey ( EventRecord * theEvent , WindowPtr theWindow )
{
- int i ;
-
trans_num_keys ( theEvent ) ;
-
addToKeyQueue ( topl_resp_key ( theEvent -> message & 0xff ) , 1 ) ;
}
--- 1378,1384 ----
***************
*** 1426,1431 ****
--- 1476,1483 ----
}
++r_idx;
}
+
+ macClickText(theEvent, theWindow);
}
***************
*** 1441,1472 ****
static void
macClickMap ( EventRecord * theEvent , WindowPtr theWindow )
{
! if ( ! theEvent || ! theWindow ) {
! Debugger ( ) ;
! }
! {
! NhWindow * nhw = ( NhWindow * ) GetWRefCon ( theWindow ) ;
! Point where ;
! short posX , posY ;
! short sector ;
! char theDirectionChar [ 18 ] = {
! ' ' , 'k' , 'u' , 'l' , 'n' , 'j' , 'b' , 'h' , 'y' ,
! 'o' , 'K' , 'U' , 'L' , 'N' , 'J' , 'B' , 'H' , 'Y' ,
! } ;
! where = theEvent -> where ;
! GlobalToLocal ( & where ) ;
! posX = where . h / nhw -> charWidth ;
! posY = where . v / nhw -> charHeight ;
!
! /* 0 is ON, 1 is top, then clockwise */
! sector = clickSector ( u . ux , u . uy , posX , posY ) ;
! if ( theEvent -> modifiers & shiftKey ) {
! sector += 9 ;
! }
! addToKeyQueue ( theDirectionChar [ sector ] , 0 ) ;
!
! gClickedToMove = 1 ;
}
}
--- 1493,1516 ----
static void
macClickMap ( EventRecord * theEvent , WindowPtr theWindow )
{
! int shift_down = theEvent->modifiers & shiftKey;
! NhWindow *nhw = (NhWindow *)GetWRefCon(theWindow);
! Point where = theEvent->where;
! GlobalToLocal(&where);
! where.h /= nhw->charWidth;
! where.v /= nhw->charHeight;
! clicked_mod = shift_down ? CLICK_2 : CLICK_1;
! if (strchr(topl_resp, click_to_cmd(where.h, where.v, clicked_mod)))
! nhbell();
! else {
! if (cursor_locked)
! while (WaitMouseUp())
! SystemTask();
! else if (!shift_down)
! gNextClickRepeat = TickCount() + *(short *)KeyThresh;
! gClickedToMove = TRUE;
! clicked_pos = where;
}
}
***************
*** 1495,1508 ****
SetCtlValue ( theBar , now - amtToScroll ) ;
winToScroll -> scrollPos = now - amtToScroll ;
r = winToScroll -> theWindow -> portRect ;
! r . right -= 15 ;
ScrollRect ( & r , 0 , amtToScroll * winToScroll -> charHeight , rgn ) ;
if ( rgn ) {
InvalRgn ( rgn ) ;
- r . top = r . bottom - 16 ;
- r . left = r . right ;
- r . right += 15 ;
- InvalRect ( & r ) ;
BeginUpdate ( winToScroll -> theWindow ) ;
}
winToScroll -> updateFunc ( & fake , winToScroll -> theWindow ) ;
--- 1539,1550 ----
SetCtlValue ( theBar , now - amtToScroll ) ;
winToScroll -> scrollPos = now - amtToScroll ;
r = winToScroll -> theWindow -> portRect ;
! r . right -= SBARWIDTH ;
! if ( winToScroll == theWindows + WIN_MESSAGE )
! r . bottom -= SBARHEIGHT + 1 ;
ScrollRect ( & r , 0 , amtToScroll * winToScroll -> charHeight , rgn ) ;
if ( rgn ) {
InvalRgn ( rgn ) ;
BeginUpdate ( winToScroll -> theWindow ) ;
}
winToScroll -> updateFunc ( & fake , winToScroll -> theWindow ) ;
***************
*** 1535,1548 ****
SetCtlValue ( theBar , now + amtToScroll ) ;
winToScroll -> scrollPos = now + amtToScroll ;
r = winToScroll -> theWindow -> portRect ;
! r . right -= 15 ;
ScrollRect ( & r , 0 , - amtToScroll * winToScroll -> charHeight , rgn ) ;
if ( rgn ) {
InvalRgn ( rgn ) ;
- r . top = r . bottom - 16 ;
- r . left = r . right ;
- r . right += 15 ;
- InvalRect ( & r ) ;
BeginUpdate ( winToScroll -> theWindow ) ;
}
winToScroll -> updateFunc ( & fake , winToScroll -> theWindow ) ;
--- 1577,1588 ----
SetCtlValue ( theBar , now + amtToScroll ) ;
winToScroll -> scrollPos = now + amtToScroll ;
r = winToScroll -> theWindow -> portRect ;
! r . right -= SBARWIDTH ;
! if ( winToScroll == theWindows + WIN_MESSAGE )
! r . bottom -= SBARHEIGHT + 1 ;
ScrollRect ( & r , 0 , - amtToScroll * winToScroll -> charHeight , rgn ) ;
if ( rgn ) {
InvalRgn ( rgn ) ;
BeginUpdate ( winToScroll -> theWindow ) ;
}
winToScroll -> updateFunc ( & fake , winToScroll -> theWindow ) ;
***************
*** 1615,1620 ****
--- 1655,1674 ----
}
+ int
+ mac_doprev_message(void)
+ {
+ if (WIN_MESSAGE) {
+ display_nhwindow(WIN_MESSAGE, FALSE);
+ amtToScroll = 1;
+ winToScroll = &theWindows[WIN_MESSAGE];
+ SetPort(winToScroll->theWindow);
+ Up(winToScroll->scrollBar, inUpButton);
+ }
+ return 0 ;
+ }
+
+
static void
macClickMenu ( EventRecord * theEvent , WindowPtr theWindow )
{
***************
*** 1742,1747 ****
--- 1796,1802 ----
GetClip(org_clip);
+ DrawControls(theWindow);
DrawGrowIcon(theWindow);
l = 0;
***************
*** 1794,1808 ****
/* Clip to the portrect - scrollbar/growicon *before* adjusting the rect
to be larger than the size of the window (!) */
RectRgn(clip, &r);
if ( r . right < MIN_RIGHT )
r . right = MIN_RIGHT ;
if (in_topl_mode()) {
RgnHandle topl_rgn = NewRgn();
Rect topl_r = r;
! for (l = aWin->windowTextLen - 1; --l >= aWin->textBase; )
! if ((*aWin->windowText)[l] == CHAR_CR)
! topl_r.top += aWin->charHeight;
l = (*top_line)->destRect.right - (*top_line)->destRect.left;
(*top_line)->viewRect = topl_r;
(*top_line)->destRect = topl_r;
--- 1849,1880 ----
/* Clip to the portrect - scrollbar/growicon *before* adjusting the rect
to be larger than the size of the window (!) */
RectRgn(clip, &r);
+ SectRgn(clip, org_clip, clip);
if ( r . right < MIN_RIGHT )
r . right = MIN_RIGHT ;
+ r . top -= aWin -> scrollPos * aWin -> charHeight ;
+ #if 0
+ /* If you enable this band of code (and disable the next band), you will get
+ fewer flickers but a slower performance while drawing the dot line. */
+ { RgnHandle dotl_rgn = NewRgn();
+ Rect dotl;
+ dotl.left = r.left;
+ dotl.right = r.right;
+ dotl.bottom = r.top + aWin->save_lin * aWin->charHeight;
+ dotl.top = dotl.bottom - 1;
+ FillRect(&dotl, &qd.gray);
+ RectRgn(dotl_rgn, &dotl);
+ DiffRgn(clip, dotl_rgn, clip);
+ DisposeRgn(dotl_rgn);
+ SetClip(clip);
+ }
+ #endif
+
if (in_topl_mode()) {
RgnHandle topl_rgn = NewRgn();
Rect topl_r = r;
! topl_r.top += (aWin->lin - 1) * aWin->charHeight;
l = (*top_line)->destRect.right - (*top_line)->destRect.left;
(*top_line)->viewRect = topl_r;
(*top_line)->destRect = topl_r;
***************
*** 1812,1830 ****
RectRgn(topl_rgn, &topl_r);
DiffRgn(clip, topl_rgn, clip);
DisposeRgn(topl_rgn);
}
- SectRgn(clip, org_clip, clip);
- SetClip(clip);
DisposeRgn(clip);
TextFont ( aWin -> fontNum ) ;
TextSize ( aWin -> fontSize ) ;
HLock ( aWin -> windowText ) ;
! TextBox ( * ( aWin -> windowText ) + aWin -> textBase , aWin ->
! windowTextLen - aWin -> textBase , & r , teJustLeft ) ;
HUnlock ( aWin -> windowText ) ;
SetClip(org_clip);
DisposeRgn(org_clip);
}
--- 1884,1906 ----
RectRgn(topl_rgn, &topl_r);
DiffRgn(clip, topl_rgn, clip);
DisposeRgn(topl_rgn);
+ SetClip(clip);
}
DisposeRgn(clip);
TextFont ( aWin -> fontNum ) ;
TextSize ( aWin -> fontSize ) ;
HLock ( aWin -> windowText ) ;
! TextBox ( * aWin -> windowText , aWin -> windowTextLen , & r , teJustLeft ) ;
HUnlock ( aWin -> windowText ) ;
+ #if 1
+ r.bottom = r.top + aWin->save_lin * aWin->charHeight;
+ r.top = r.bottom - 1;
+ FillRect(&r, &qd.gray);
+ #endif
+
SetClip(org_clip);
DisposeRgn(org_clip);
}
***************
*** 1941,1948 ****
r . right = MIN_RIGHT ;
r . top -= aWin -> scrollPos * aWin -> charHeight ;
HLock ( aWin -> windowText ) ;
! TextBox ( * ( aWin -> windowText ) + aWin -> textBase , aWin ->
! windowTextLen - aWin -> textBase , & r , teJustLeft ) ;
HUnlock ( aWin -> windowText ) ;
if ( h ) {
SetClip ( h ) ;
--- 2017,2023 ----
r . right = MIN_RIGHT ;
r . top -= aWin -> scrollPos * aWin -> charHeight ;
HLock ( aWin -> windowText ) ;
! TextBox ( * aWin -> windowText , aWin -> windowTextLen , & r , teJustLeft ) ;
HUnlock ( aWin -> windowText ) ;
if ( h ) {
SetClip ( h ) ;
***************
*** 1989,1996 ****
r . top -= aWin -> scrollPos * aWin -> charHeight ;
r . right -= SBARWIDTH;
HLock ( aWin -> windowText ) ;
! TextBox ( * ( aWin -> windowText ) + aWin -> textBase , aWin ->
! windowTextLen - aWin -> textBase , & r , teJustLeft ) ;
HUnlock ( aWin -> windowText ) ;
draw_growicon_vert_only(theWindow);
if ( h ) {
--- 2064,2070 ----
r . top -= aWin -> scrollPos * aWin -> charHeight ;
r . right -= SBARWIDTH;
HLock ( aWin -> windowText ) ;
! TextBox ( * aWin -> windowText , aWin -> windowTextLen , & r , teJustLeft ) ;
HUnlock ( aWin -> windowText ) ;
draw_growicon_vert_only(theWindow);
if ( h ) {
***************
*** 2037,2042 ****
--- 2111,2117 ----
macCursorMap ( EventRecord * theEvent , WindowPtr theWindow , RgnHandle mouseRgn )
{
Point where ;
+ char * dir_bas , * dir ;
CursHandle ch ;
GrafPtr gp ;
NhWindow * nhw = ( NhWindow * ) GetWRefCon ( theWindow ) ;
***************
*** 2047,2059 ****
where = theEvent -> where ;
GlobalToLocal ( & where ) ;
! ch = GetCursor ( 512 + clickSector ( u . ux , u . uy , where . h / nhw -> charWidth ,
! where . v / nhw -> charHeight ) ) ;
if ( ch ) {
HLock ( ( Handle ) ch ) ;
SetCursor ( * ch ) ;
! ReleaseResource ( ( Handle ) ch ) ;
} else {
--- 2122,2142 ----
where = theEvent -> where ;
GlobalToLocal ( & where ) ;
!
! if ( cursor_locked )
! dir = NULL ;
! else {
! dir_bas = flags . num_pad ? ndir : sdir ;
! dir = strchr ( dir_bas , click_to_cmd ( where . h / nhw -> charWidth ,
! where . v / nhw -> charHeight ,
! CLICK_1 ) ) ;
! }
! ch = GetCursor ( dir ? dir - dir_bas + 513 : 512 ) ;
if ( ch ) {
HLock ( ( Handle ) ch ) ;
SetCursor ( * ch ) ;
! HUnlock ( ( Handle ) ch ) ;
} else {
***************
*** 2226,2231 ****
--- 2309,2316 ----
InitCursor ( ) ;
SetRect ( & r , 80 , 2 * aWin -> charHeight + 1 , r . right ,
r . bottom ) ;
+ if ( aWin == theWindows + WIN_MESSAGE )
+ r . top += SBARHEIGHT + 1 ;
l = GrowWindow ( theWindow , theEvent -> where , & r ) ;
SizeWindow ( theWindow , l & 0xffff , l >> 16 , FALSE ) ;
SaveWindowSize ( theWindow ) ;
***************
*** 2347,2372 ****
}
FlushEvents ( keyDownMask , 0 ) ;
}
- /*
- * This somewhat elaborate hack is needed to make the menu
- * commands work right. They're also needed for fast typists.
- */
- if ( keyQueue [ 0 ] && in_topl_mode() ) {
- int i ;
-
- theEvent -> what = keyDown ;
- theEvent -> modifiers = 0 ;
- theEvent -> message = keyQueue [ 0 ] ;
-
- /* extract from key queue */
- for ( i = 0 ; i < QUEUE_LEN - 1 ; i ++ ) {
- keyQueue [ i ] = keyQueue [ i + 1 ] ;
- }
- keyQueue [ i ] = 0 ;
- SetPort ( theWindows [ WIN_MESSAGE ] . theWindow ) ;
- theWindows [ WIN_MESSAGE ] . keyFunc ( theEvent ,
- theWindows [ WIN_MESSAGE ] . theWindow ) ;
- }
break ;
}
}
--- 2432,2437 ----
***************
*** 2380,2389 ****
DisableItem ( appleMenu , 0 ) ;
DisableItem ( fileMenu , 0 ) ;
DisableItem ( editMenu , 0 ) ;
! DisableItem ( extendMenu , 0 ) ;
! DisableItem ( miscMenu , 0 ) ;
! DisableItem ( commandsMenu , 0 ) ;
DisableItem ( thingsMenu , 0 ) ;
DrawMenuBar ( ) ;
}
--- 2445,2455 ----
DisableItem ( appleMenu , 0 ) ;
DisableItem ( fileMenu , 0 ) ;
DisableItem ( editMenu , 0 ) ;
! DisableItem ( actionMenu , 0 ) ;
! DisableItem ( inventoryMenu , 0 ) ;
DisableItem ( thingsMenu , 0 ) ;
+ DisableItem ( extendedMenu , 0 ) ;
+ DisableItem ( infoMenu , 0 ) ;
DrawMenuBar ( ) ;
}
***************
*** 2394,2403 ****
EnableItem ( appleMenu , 0 ) ;
EnableItem ( fileMenu , 0 ) ;
EnableItem ( editMenu , 0 ) ;
! EnableItem ( extendMenu , 0 ) ;
! EnableItem ( miscMenu , 0 ) ;
! EnableItem ( commandsMenu , 0 ) ;
EnableItem ( thingsMenu , 0 ) ;
DrawMenuBar ( ) ;
}
--- 2460,2470 ----
EnableItem ( appleMenu , 0 ) ;
EnableItem ( fileMenu , 0 ) ;
EnableItem ( editMenu , 0 ) ;
! EnableItem ( actionMenu , 0 ) ;
! EnableItem ( inventoryMenu , 0 ) ;
EnableItem ( thingsMenu , 0 ) ;
+ EnableItem ( extendedMenu , 0 ) ;
+ EnableItem ( infoMenu , 0 ) ;
DrawMenuBar ( ) ;
}
***************
*** 2408,2422 ****
{
EventRecord anEvent ;
! if ( ( inSelect != WIN_ERR || ! flags . window_inited || in_topl_mode() ) &&
! ! mBarDimmed ) {
! DimMenuBar ( ) ;
! mBarDimmed = 1 ;
! } else if ( inSelect == WIN_ERR && flags . window_inited && mBarDimmed &&
! ! in_topl_mode() ) {
! UndimMenuBar ( ) ;
! mBarDimmed = 0 ;
! }
/*
* We want to take care of keys in the buffer as fast as
* possible
--- 2475,2489 ----
{
EventRecord anEvent ;
! if ( ( inSelect == WIN_ERR && flags . window_inited && ! in_topl_mode ( ) )
! == mBarDimmed )
! if ( mBarDimmed ) {
! UndimMenuBar ( ) ;
! mBarDimmed = 0 ;
! } else {
! DimMenuBar ( ) ;
! mBarDimmed = 1 ;
! }
/*
* We want to take care of keys in the buffer as fast as
* possible
***************
*** 2447,2459 ****
{
int ch ;
register int i ;
wait_synch ( ) ;
! if ( flags . window_inited && ! theWindows [ WIN_MAP ] . cursorDrawn &&
! theWindows [ WIN_MAP ] . theWindow ) {
! SetPort ( theWindows [ WIN_MAP ] . theWindow ) ;
! DrawMapCursor ( & theWindows [ WIN_MAP ] ) ;
}
if ( ! keyQueue [ 0 ] ) {
--- 2514,2532 ----
{
int ch ;
register int i ;
+ NhWindow * nhw = flags . window_inited ? theWindows + WIN_MAP : nil ;
+ if ( theWindows ) {
+ NhWindow * aWin = theWindows + WIN_MESSAGE ;
+ if ( aWin )
+ aWin -> last_more_lin = aWin -> lin ;
+ }
+
wait_synch ( ) ;
! if ( nhw && ! nhw -> cursorDrawn && nhw -> theWindow ) {
! SetPort ( nhw -> theWindow ) ;
! DrawMapCursor ( nhw ) ;
}
if ( ! keyQueue [ 0 ] ) {
***************
*** 2461,2469 ****
static char warn = 0 ;
PurgeSpace ( & total , & contig ) ;
! if ( contig < 64000L || total < 256000L ) {
if ( ! warn ) {
! DebugStr ( ( ConstStr255Param ) "\014Low Memory !" ) ;
warn = 1 ;
}
} else {
--- 2534,2542 ----
static char warn = 0 ;
PurgeSpace ( & total , & contig ) ;
! if ( contig < 25000L || total < 50000L ) {
if ( ! warn ) {
! pline ( "Low Memory!" ) ;
warn = 1 ;
}
} else {
***************
*** 2473,2481 ****
do {
doDawdle = ( in_topl_mode() ? GetCaretTime ( ) : 120L ) ;
get_nh_event ( ) ;
ch = keyQueue [ 0 ] ;
! } while ( ! ch ) ;
if ( ! gClickedToMove ) {
ObscureCursor ( ) ;
--- 2546,2573 ----
do {
doDawdle = ( in_topl_mode() ? GetCaretTime ( ) : 120L ) ;
+
+ if ( nhw ) {
+ SetPort ( nhw -> theWindow ) ;
+ if ( WaitMouseUp ( ) ) {
+ unsigned long tick = TickCount ( ) ;
+ if ( tick >= gNextClickRepeat ) {
+ Point where ;
+ GetMouse ( & where ) ;
+ SetPt ( & clicked_pos , where . h / nhw -> charWidth ,
+ where . v / nhw -> charHeight ) ;
+ gClickedToMove = TRUE ;
+ gNextClickRepeat = tick + * ( short * ) KeyRepThresh ;
+ }
+ if ( doDawdle > * ( short * ) KeyRepThresh )
+ doDawdle = * ( short * ) KeyRepThresh ;
+ } else
+ gNextClickRepeat = 0xffffffff ;
+ }
+
get_nh_event ( ) ;
ch = keyQueue [ 0 ] ;
! } while ( ! ch && ! gClickedToMove ) ;
if ( ! gClickedToMove ) {
ObscureCursor ( ) ;
***************
*** 2536,2548 ****
/* Here and in mac_raw_print_bold I assume that once theWindows got
allocated by mac_init_nhwindows we can safely do putstr on BASE_WINDOW,
even after mac_exit_nhwindows is called or flags.window_inited is reset
! to zero. Is this assumption correct? */
if ( theWindows ) {
ShowWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
SelectWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
! putstr ( BASE_WINDOW , 0 , str ) ;
} else
showerror ( str , NULL ) ;
--- 2628,2644 ----
/* Here and in mac_raw_print_bold I assume that once theWindows got
allocated by mac_init_nhwindows we can safely do putstr on BASE_WINDOW,
even after mac_exit_nhwindows is called or flags.window_inited is reset
! to zero. Is this assumption correct?
! Also add a space or a bullet before each line to indicate the bold face
! before we really implement the text attributes */
if ( theWindows ) {
+ char lstr [ 200 ] = " " ;
+ strcat ( lstr , str ) ;
ShowWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
SelectWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
! putstr ( BASE_WINDOW , 0 , lstr ) ;
} else
showerror ( str , NULL ) ;
***************
*** 2553,2563 ****
mac_raw_print_bold ( const char * str )
{
if ( theWindows ) {
ShowWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
SelectWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
! putstr ( BASE_WINDOW , ATR_BOLD , str ) ;
} else {
nhbell ( ) ;
--- 2649,2661 ----
mac_raw_print_bold ( const char * str )
{
if ( theWindows ) {
+ char lstr [ 200 ] = "\xA5"/*bullet*/ ;
+ strcat ( lstr , str ) ;
ShowWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
SelectWindow ( theWindows [ BASE_WINDOW ] . theWindow ) ;
! putstr ( BASE_WINDOW , ATR_BOLD , lstr ) ;
} else {
nhbell ( ) ;
***************
*** 2596,2602 ****
Rect r ;
if ( in_putstr > 3 ) {
! DebugStr ( ( ConstStr255Param ) "\012Recursion!" ) ;
return ;
}
if ( win < 0 || win >= NUM_MACWINDOWS ) {
--- 2694,2700 ----
Rect r ;
if ( in_putstr > 3 ) {
! DebugStr ( ( ConstStr255Param ) "\pRecursion!" ) ;
return ;
}
if ( win < 0 || win >= NUM_MACWINDOWS ) {
***************
*** 2612,2642 ****
in_putstr ++ ;
kind = ( ( WindowPeek ) ( aWin -> theWindow ) ) -> windowKind -
WIN_BASE_KIND ;
if ( kind == NHW_MAP || kind == NHW_STATUS ) {
! short h = ( NUM_COLS - aWin->cursor.h - strlen(str) );
! /*
! * The "dungeon" window
! * putsym will call curs, so no updates necessary.
! */
! while ( * str ) {
! putsym ( win , aWin -> cursor . h , aWin -> cursor . v , * str ) ;
! curs ( win , aWin -> cursor . h + 1 , aWin -> cursor . v ) ;
! str ++ ;
! }
! h = (h < 0) ? 0 : h;
! while( h-- ) {
! putsym ( win , aWin -> cursor . h , aWin -> cursor . v , CHAR_BLANK ) ;
! curs ( win , aWin -> cursor . h + 1 , aWin -> cursor . v ) ;
! }
} else {
char * sr , * ds ;
/*
* A "default" text window - uses TextBox
* We just add the text, without attributes for now
*/
len = GetHandleSize ( aWin -> windowText ) ;
- slen = strlen ( str ) ;
while ( aWin -> windowTextLen + slen + 1 > len ) {
len = ( len > 2048 ) ? ( len + 2048 ) : ( len * 2 ) ;
SetHandleSize ( aWin -> windowText , len ) ;
--- 2710,2753 ----
in_putstr ++ ;
kind = ( ( WindowPeek ) ( aWin -> theWindow ) ) -> windowKind -
WIN_BASE_KIND ;
+ slen = strlen ( str ) ;
if ( kind == NHW_MAP || kind == NHW_STATUS ) {
! char *row;
! r.right = aWin->theWindow->portRect.right;
! r.left = aWin->charWidth * aWin->cursor.h;
! r.bottom = aWin->charHeight *(aWin->cursor.v + 1);
! r.top = r.bottom - aWin->charHeight;
! EraseRect(&r);
! MoveTo(r.left, r.bottom - aWin->leading);
! DrawText(str, 0, slen);
!
! if (slen > NUM_COLS - aWin->cursor.h)
! slen = NUM_COLS - aWin->cursor.h;
! row = &((MapData *)*aWin->windowText)->map[aWin->cursor.v][aWin->cursor.h];
! strncpy(row, str, slen);
! memset(row + slen, CHAR_BLANK, NUM_COLS - slen - aWin->cursor.h);
! curs(win, NUM_COLS, aWin->cursor.v);
!
} else {
char * sr , * ds ;
+
+ r = aWin->theWindow->portRect;
+ if (win && win == WIN_MESSAGE) {
+ r.right -= SBARWIDTH + 1;
+ r.bottom -= SBARHEIGHT + 1;
+ if ( aWin->last_more_lin < aWin->scrollPos )
+ aWin->last_more_lin = aWin->scrollPos;
+ if ( flags.page_wait && aWin->last_more_lin <=
+ aWin->lin - (r.bottom - r.top) / aWin->charHeight )
+ display_nhwindow(win, TRUE);
+ }
+
/*
* A "default" text window - uses TextBox
* We just add the text, without attributes for now
*/
len = GetHandleSize ( aWin -> windowText ) ;
while ( aWin -> windowTextLen + slen + 1 > len ) {
len = ( len > 2048 ) ? ( len + 2048 ) : ( len * 2 ) ;
SetHandleSize ( aWin -> windowText , len ) ;
***************
*** 2643,2649 ****
if ( MemError ( ) ) {
error ( "SetHandleSize (putstr)" ) ;
aWin -> windowTextLen = 0L ;
! aWin -> textBase = 0 ;
aWin -> lin = 0 ;
}
}
--- 2754,2760 ----
if ( MemError ( ) ) {
error ( "SetHandleSize (putstr)" ) ;
aWin -> windowTextLen = 0L ;
! aWin -> save_lin = 0 ;
aWin -> lin = 0 ;
}
}
***************
*** 2662,2701 ****
sr ++ ;
ds ++ ;
}
! if ( slen > 1 ) {
! ( * ( aWin -> windowText ) ) [ len + slen ] = CHAR_CR ;
! aWin -> windowTextLen += slen + 1 ;
! aWin -> lin ++ ;
! } else {
! aWin -> windowTextLen += slen ;
! }
SetPort ( aWin -> theWindow ) ;
- r = aWin -> theWindow -> portRect ;
- if ( win && win == WIN_MESSAGE ) {
- r . bottom -= SBARHEIGHT + 1 ;
- }
InvalRect ( & r ) ;
aWin -> clear = 0 ;
if ( kind == NHW_MESSAGE ) {
! char * ptr , * stop ;
! long oldBase = aWin -> textBase ;
! short lines = ( r . bottom - r . top ) / aWin -> charHeight - 1 ;
!
! stop = * aWin -> windowText ;
! ptr = stop + aWin -> windowTextLen - 1 ;
! while ( lines >= 0 && -- ptr > stop ) {
! if ( * ptr == CHAR_CR || * ptr == CHAR_LF )
! lines -- ;
}
- if ( ptr <= stop ) {
- aWin -> textBase = 0L ;
- } else {
- aWin -> textBase = ptr - stop + 1 ;
- }
- if ( oldBase > aWin -> textBase ) {
- aWin -> textBase = oldBase ;
- }
}
if ( aWin -> scrollBar ) {
InvalScrollBar ( aWin ) ;
--- 2773,2793 ----
sr ++ ;
ds ++ ;
}
!
! ( * ( aWin -> windowText ) ) [ len + slen ] = CHAR_CR ;
! aWin -> windowTextLen += slen + 1 ;
! aWin -> lin ++ ;
SetPort ( aWin -> theWindow ) ;
InvalRect ( & r ) ;
aWin -> clear = 0 ;
if ( kind == NHW_MESSAGE ) {
! short min = aWin->lin - (r.bottom - r.top) / aWin->charHeight;
! if (aWin->scrollPos < min) {
! aWin->scrollPos = min;
! SetCtlMax (aWin->scrollBar, aWin->lin);
! SetCtlValue(aWin->scrollBar, min);
}
}
if ( aWin -> scrollBar ) {
InvalScrollBar ( aWin ) ;
***************
*** 2751,2760 ****
--- 2843,2856 ----
break ;
}
} else {
+ #if 1
+ Debugger ( ) ;
+ #else
char ss [ 2 ] ;
ss [ 0 ] = sym ;
ss [ 1 ] = 0 ;
putstr ( win , 0 , ss ) ;
+ #endif
}
}
***************
*** 2881,2890 ****
int
mac_nh_poskey ( int * a , int * b , int * c )
{
! if ( ! a || ! b || ! c ) {
! Debugger ( ) ;
! }
! return nhgetch ( ) ;
}
--- 2977,2987 ----
int
mac_nh_poskey ( int * a , int * b , int * c )
{
! int ch = nhgetch();
! *a = clicked_pos.h;
! *b = clicked_pos.v;
! *c = clicked_mod;
! return ch;
}
***************
*** 2891,2902 ****
void
mac_start_menu ( winid win )
{
! NhWindow * aWin = & theWindows [ win ] ;
!
! HideWindow ( aWin -> theWindow ) ;
! SetHandleSize ( aWin -> windowText , TEXT_BLOCK ) ;
! aWin -> wid = 0 ;
! aWin -> lin = 0 ;
clear_nhwindow ( win ) ;
}
--- 2988,2994 ----
void
mac_start_menu ( winid win )
{
! HideWindow ( theWindows [ win ] . theWindow ) ;
clear_nhwindow ( win ) ;
}
***************
*** 2956,2982 ****
char
mac_select_menu ( winid win )
{
- short w , h ;
int c , l ;
- WindowPtr theWin = theWindows [ win ] . theWindow ;
NhWindow * aWin = & theWindows [ win ] ;
inSelect = win ;
SetPort ( theWin ) ;
! if ( aWin -> wid && aWin -> lin ) {
! w = aWin -> wid + 16 ;
! h = aWin -> lin * aWin -> charHeight ;
! if ( w > 450 ) {
! w = 450 ;
! }
! if ( h > 300 ) {
! h = 300 ;
! }
! SizeWindow ( theWin , w , h , TRUE ) ;
! if ( aWin -> scrollBar ) {
! InvalScrollBar ( aWin ) ;
! }
}
SelectWindow ( theWin ) ;
ShowWindow ( theWin ) ;
--- 3048,3063 ----
char
mac_select_menu ( winid win )
{
int c , l ;
NhWindow * aWin = & theWindows [ win ] ;
+ WindowPtr theWin = aWin -> theWindow ;
inSelect = win ;
+ adjust_window_pos ( aWin , theWin , aWin -> wid + ( SBARWIDTH + 2 ) ) ;
SetPort ( theWin ) ;
! if ( aWin -> scrollBar ) {
! InvalScrollBar ( aWin ) ;
}
SelectWindow ( theWin ) ;
ShowWindow ( theWin ) ;
***************
*** 2983,2989 ****
InvalRect ( & ( theWin -> portRect ) ) ;
do {
! while ( ! ( c = nhgetch ( ) ) ) ;
for ( l = 0 ; l < aWin -> lin ; l ++ ) {
if ( aWin -> itemChars [ l ] == c )
goto done ;
--- 3064,3070 ----
InvalRect ( & ( theWin -> portRect ) ) ;
do {
! c = nhgetch ( ) ;
for ( l = 0 ; l < aWin -> lin ; l ++ ) {
if ( aWin -> itemChars [ l ] == c )
goto done ;
***************
*** 3185,3191 ****
DialogPtr characterDialog;
short itemHit, lastItemSelected, type;
Rect box;
!
characterDialog = GetNewDialog(132, (Ptr) NULL, (WindowPtr) -1);
/*
--- 3266,3287 ----
DialogPtr characterDialog;
short itemHit, lastItemSelected, type;
Rect box;
!
! char pc;
! if ((pc = highc(pl_character[0])) != 0) {
! char pbuf[QBUFSZ];
! EventRecord update_evt;
! if(index(pl_classes, pc) != (char*) 0) {
! pl_character[0] = pc;
! return;
! }
! putstr(WIN_MESSAGE, 0, "");
! Sprintf(pbuf, "Unknown role: %c", pc);
! putstr(WIN_MESSAGE, 0, pbuf);
! while (CheckUpdate(&update_evt))
! HandleUpdate(&update_evt);
! }
!
characterDialog = GetNewDialog(132, (Ptr) NULL, (WindowPtr) -1);
/*