ftp.nice.ch/NiCE/emacs-19-for-NeXTstep/Emacs_for_NeXTstep_4.1.src.NIHS.s.tar.gz#/emacs-19/src/nsterm.h

This is nsterm.h in view mode; [Download] [Up]

/* Definitions and headers for communication with NeXTstep
   Copyright (C) 1989, 1993 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#include "config.h"

#ifdef HAVE_NS

#ifdef __OBJC__
#import <appkit/appkit.h>

@interface Menu (UndocumentedMenu)
- (void)_restoreInitialMenuPos;
- (void)_saveInitialMenuPos;
@end

@interface SavePanel (UndocumentedSavePanel)
- (BOOL)_validateNames:(char *)name checkBrowser:(BOOL)check;
@end

/* These two interfaces were ruthlessly stolen from John C. Randolph */
@interface View (windowButtons)
- _setMask:(unsigned int) mask;
@end

@interface Window (windowButtons)
- toggleClose:sender;
- toggleMiniaturize:sender;
- setCloseButton:sender to:(BOOL)bool;
- setMiniaturizeButton:sender to:(BOOL)bool;
- showCloseButton:sender;
- showMiniaturizeButton:sender;
- hideCloseButton:sender;
- hideMiniaturizeButton:sender;
- updateBorder;
@end

@protocol GdbUser
-(oneway int)openFile: (char *)fileName onHost: (char *)hostName atTrueLine: (int)line;
-(oneway int)openFile: (char *)fileName onHost: (char *)hostName fromTrueLine: (int)startLine to: (int)endLine;
-(oneway void)setGdbName: (char *)name;
-(oneway void)setInterruptHandler: handler;
-(oneway void)disconnect;
-(void)frameChanged;
-(oneway void)programIsRunning;
-(void)programStopped;
-(void)programIsDead;
@end

@protocol PBUser
-(oneway int)openFile: (char *)fileName onHost: (char *)hostName atTrueLine: (int)line;
-(oneway int)openFile: (char *)fileName onHost: (char *)hostName fromTrueLine: (int)startLine to: (int)endLine;
@end

@protocol GdbControl
-(oneway void)breakInFile: (in char *)filename atLine: (int)line;
-(oneway void)untilInFile: (in char *)filename atLine: (int)line;
-(oneway void)step;
-(oneway void)next;
-(oneway void)continue;
-(oneway void)up;
-(oneway void)frame;
-(oneway void)down;
-(oneway void)finish;
-(oneway id)run;
-(oneway void)quit;
-(oneway void)printExpression: (in char *)selection;
-(oneway void)printExpressionIndirect: (in char *)selection;
-(oneway void)selectFrame: (int)frame;
-(oneway void)interrupt;
-(oneway void)setClient: (in id<GdbUser>)client;
-(int)getFramesUpTo: (int)maxFrames selFrame: (out int *)sel;
-(id)frameAt: (int)frameIndex functionName: (out char **)pFunctionName from: (out unsigned int *)pFrom;
-(id)frameAt: (int)frameIndex from: (out unsigned int *)pFrom;
-(char *)functionNameAt: (int)frameIndex;
-(char *)functionNameAt: (int)frameIndex hasSymbols: (int *)hasSymbols;
-(oneway void)errorOpeningFile: (char *)filename fromLine: (int)start to: (int)end;
@end

@interface EmacsListener:Listener <GdbUser, PBUser>
   {
   }

-(void)connectTo:(port_t)port;
-(int)openFile: (char *)fileName onHost: (char *)hostName atTrueLine: (int)line;
-(int)openFile: (char *)fileName onHost: (char *)hostName fromTrueLine: (int)startLine to: (int)endLine;
-(void)setGdbName: (char *)name;
-(void)setInterruptHandler: handler;
-(void)disconnect;
-(void)frameChanged;
-(void)programIsRunning;
-(void)programStopped;
-(void)programIsDead;
@end

@interface EmacsApp : Application
   {
   id emacsListener;
   }

-(int)openFile: (char *)fileName onHost: (char *)hostName atTrueLine: (int)line;
-(int)openFile: (char *)fileName onHost: (char *)hostName fromTrueLine: (int)startLine to: (int)endLine;

-(int)app: sender openFile: (const char *) filename type: (const char *) aType;
-(int)app: sender openTempFile: (const char *) filename type: (const char *) aType;
-(BOOL)appAcceptsAnotherFile: sender;

-appWillInit:sender;
-appDidInit: sender;
-applicationDefined: (NXEvent *) e;

-menuDown:sender;

#if 0
-pasteboardChangedOwner:sender;
-pasteboard:sender provideData:(NXAtom)type;
#endif
@end

@interface EmacsView : View
   {
   struct frame *emacsframe;
   char *old_title;
   }

- changeFont:sender;
- (BOOL) acceptsFirstResponder;
- becomeFirstResponder;
- resignFirstResponder;

- keyDown:(NXEvent *)theEvent;
- mouseDown:(NXEvent *)theEvent;
- mouseUp:(NXEvent *)theEvent;
- rightMouseDown:(NXEvent *)theEvent;
- rightMouseUp:(NXEvent *)theEvent;
- mouseEntered:(NXEvent *)theEvent;
- mouseExited:(NXEvent *)theEvent;
- menuDown:sender;

- windowDidResize:sender;
- windowWillResize:sender toSize:(NXSize *)frameSize;
- windowWillClose:sender;
- windowWillMiniaturize:sender toMiniwindow:miniwindow;

- windowDidMove:sender;
- windowDidDeminiaturize:sender;
- windowDidExpose:sender;
- windowDidMiniaturize:sender;
- windowDidBecomeKey:sender;
- windowDidResignKey:sender;

- drawSelf:(const NXRect *)rects :(int)rectCount;
- initFrameFromEmacs:(struct frame *)f;

- validRequestorForSendType:(NXAtom)typeSent andReturnType:(NXAtom)typeReturned;

/* Implemented NXDraggingDestination protocol methods.  */
-(NXDragOperation) draggingEntered: (id <NXDraggingInfo>) sender;
-(BOOL)performDragOperation: (id <NXDraggingInfo>) sender;
@end

@interface EmacsMenu : Menu
   {
   int minmarked;
   id supercell;
   BOOL wasVisible;
   }

- initTitle:(const char *)aTitle;
- addItem:(Lisp_Object)val string:(Lisp_Object)aString bind:(Lisp_Object)bind;

- adjustMap:(Lisp_Object)keymap;
- adjustKey:(Lisp_Object)key binding:(Lisp_Object)bind;
- adjustKey:(Lisp_Object)key binding:(Lisp_Object)bind string:(Lisp_Object)string;
- findCell:(Lisp_Object)value;
- (int)findCellNumber:(Lisp_Object)value;
- transferCell:(int) row to:newmenu;

- addCell:cell;
- removeCell:cell;

- supercell;
- setSupercell:(id) nsupercell;

- mark;
- freeMarked;

- swapin;
- swapout;
@end

@interface EmacsMenuCell: MenuCell
   {
   Lisp_Object value;
   id supercell;
   }

- initTextCell:(const char *)aString;
- free;

- (Lisp_Object)value;
- setValue:(Lisp_Object)nvalue;
- supercell;
- setSupercell:(id) nsupercell;
@end

@interface EmacsMenuCard : Button
   {
   PopUpList *popup;
   }
-init;
-addTitle: (char *)name;
-addItem:  (char *)name value:(Lisp_Object)val enabled:(BOOL)enabled;
@end

@interface EmacsMenuPanel: Panel
   {
   id list;
   int maxwidth;
   }
- initFromMenu:(Lisp_Object)menu;
- addItem:(char *)str value:(Lisp_Object)val enabled:(BOOL)enabled at:(int)pane;
- addTitle:(char *)str to:(int)pane;
- (int)cards;
- (Lisp_Object)runMenuAt:(NXCoord)x:(NXCoord)y;
@end

@interface EmacsDialogPanel: Panel
   {
   id command;
   id title;
   id matrix;
   int rows,cols;
   }
- initFromContents:(Lisp_Object)menu;
- addButton:(char *)str value:(Lisp_Object)val row:(int)row;
- addString:(char *)str row:(int)row;
- addSplit;
- (Lisp_Object)runDialogAt:(NXCoord)x:(NXCoord)y;
@end

@interface EmacsFilePanel:SavePanel
  {
  BOOL allowCreate,allowOld,allowDir;
  }
- setAllowCreate:(BOOL)ifAllowCreate;
- setAllowOld:(BOOL)ifAllowOld;
- setAllowDir:(BOOL)ifAllowDir;
@end

@interface EmacsScroller:Scroller
   {
   Lisp_Object win;
   BOOL condemned;
   }
- initFrame:(const NXRect *)r window:(Lisp_Object)win;
- setFrame:(const NXRect *)r;
- free;

- scrollerMoved:sender;
- setPosition:(int) position portion:(int) portion whole:(int) whole;

- condemn;
- reprieve;
- judge;
@end

extern id ns_current_display;
extern id ns_emacscolors;
extern id ns_gdb_controller,ns_gdb_interrupt_controller;
extern int ns_use_open_panel;
extern int ns_use_yes_no_panel;
extern Lisp_Object ns_alternate_is_meta,ns_iso_latin,ns_cursor_blink_rate;
extern Lisp_Object ns_shrink_space;
extern Lisp_Object ns_gdb_name,ns_gdb_status;
extern Lisp_Object ns_menu_path;
extern unsigned char *ns2isomap;
extern unsigned char *iso2nsmap;
extern NXAtom *ns_send_types,*ns_return_types;
extern struct frame *ns_highlight_frame;
extern struct frame *ns_focus_frame;
extern struct frame *ns_focus_event_frame;
#endif

enum ns_highlight_kinds
   {
   no_highlight=0,
   filled_box,
   hollow_box,
   bar,
   line
   };

struct ns_display
   {
#ifdef __OBJC__
   id view;
   id miniimage;
   NXColor current_cursor_color;
   NXColor desired_cursor_color;
#else
   void *view;
   void *miniimage;
   char current_cursor_color[16];
   char desired_cursor_color[16];
#endif
   struct ns_face *face;
   float top;
   float left;
   int line_height;
   float internal_border_width;
   float border_width, border_height;
   enum ns_highlight_kinds current_cursor, desired_cursor;

   /* Table of parameter faces for this frame.  Any NS resources (pixel
      values, fonts) referred to here have been allocated explicitly
      for this face, and should be freed if we change the face.  */
   struct ns_face **param_faces;
   int n_param_faces;

   /* Table of computed faces for this frame.  These are the faces
      whose indexes go into the upper bits of a glyph, computed by
      combining the parameter faces specified by overlays, text
      properties, and what have you.  The NS resources mentioned here
      are all shared with parameter faces.  */
   struct ns_face **computed_faces;
   int n_computed_faces;		/* How many are valid */
   int size_computed_faces;	/* How many are allocated */
   };

struct ns_face
   {
   float width;
   float height;
   float descender;
   float underpos;
   float underwidth;
   float size;
   char underline;
#ifdef __OBJC__
   NXAtom name;
   id font;
   NXColor foreground_color;
   NXColor background_color;
#else
   const char *name;
   void *font;
   char foreground_color[16];
   char background_color[16];
#endif
   };

extern int ns_new_font(), ns_load_font();
extern void check_ns(void);
extern void ns_set_frame_parameters();
extern void ns_display_menu_bar();
extern Lisp_Object ns_string_from_pasteboard();
extern void ns_string_to_pasteboard();
extern int ns_lisp_to_cursor_type();
extern struct frame *ns_focus_frame;

/* Create the first two computed faces for a frame -- the ones that
   have GC's.  */
extern void ns_init_frame_faces (/* FRAME_PTR */);

/* Free the resources for the faces associated with a frame.  */
extern void ns_free_frame_faces (/* FRAME_PTR */);

/* Given a frame and a face name, return the face's ID number, or
   zero if it isn't a recognized face name.  */
extern int ns_face_name_id_number (/* FRAME_PTR, Lisp_Object */);

/* Return non-zero if FONT1 and FONT2 have the same size bounding box.
   We assume that they're both character-cell fonts.  */
extern int same_size_fonts (/* XFontStruct *, XFontStruct * */);

/* Recompute the GC's for the default and modeline faces.
   We call this after changing frame parameters on which those GC's
   depend.  */
extern void ns_recompute_basic_faces (/* FRAME_PTR */);

/* Return the face ID associated with a buffer position POS.  Store
   into *ENDPTR the next position at which a different face is
   needed.  This does not take account of glyphs that specify their
   own face codes.  F is the frame in use for display, and W is a
   window displaying the current buffer.

   REGION_BEG, REGION_END delimit the region, so it can be highlighted.  */
extern int ns_compute_char_face (/* FRAME_PTR frame,
                                    struct window *w,
                                    int pos,
                                    int region_beg, int region_end,
                                    int *endptr */);
/* Return the face ID to use to display a special glyph which selects
   FACE_CODE as the face ID, assuming that ordinarily the face would
   be BASIC_FACE.  F is the frame.  */
extern int ns_compute_glyph_face (/* FRAME_PTR, int */);

#define BEANS 0xfabacaea
#define MINWIDTH 10
#define MINHEIGHT 10

#ifdef __OBJC__
#define XNS_SCROLL_BAR(vec) ((id) LISP_TO_VOID (vec))
#else
#define XNS_SCROLL_BAR(vec) LISP_TO_VOID (vec)
#endif

#endif

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.