(calc-set-mode-line): Add square matrix option.
[bpt/emacs.git] / src / sunfns.c
index 7319fca..8de639b 100644 (file)
@@ -1,5 +1,6 @@
 /* Functions for Sun Windows menus and selection buffer.
-   Copyright (C) 1987, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1999, 2001, 2002, 2003, 2004,
+                 2005 Free Software Foundation, Inc.
 
 This file is probably totally obsolete.  In any case, the FSF is
 unwilling to support it.  We agreed to include it in our distribution
@@ -25,8 +26,8 @@ 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, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* Author: Jeff Peck, Sun Microsystems, Inc. <peck@sun.com>
 Original ideas by David Kastan and Eric Negaard, SRI International
@@ -158,7 +159,7 @@ Redisplay does not happen if input is available before it starts.  */)
 {
   struct timeval Timeout;
   int waitmask = 1;
-  
+
   CHECK_NUMBER (n);
   Timeout.tv_sec = XINT(n) / 1000;
   Timeout.tv_usec = (XINT(n) - (Timeout.tv_sec * 1000)) * 1000;
@@ -178,7 +179,7 @@ Redisplay does not happen if input is available before it starts.  */)
 /*
  *   Sun sleep-for (allows a shorter interval than the regular sleep-for)
  */
-DEFUN ("sleep-for-millisecs", 
+DEFUN ("sleep-for-millisecs",
        Fsleep_for_millisecs,
        Ssleep_for_millisecs, 1, 1, 0,
        doc: /* Pause, without updating display, for ARG milliseconds.  */)
@@ -208,7 +209,8 @@ DEFUN ("update-display", Fupdate_display, Supdate_display, 0, 0, 0,
 DEFUN ("sun-change-cursor-icon",
        Fsun_change_cursor_icon,
        Ssun_change_cursor_icon, 1, 1, 0,
-       doc: /* Change the Sun mouse cursor icon.  ICON is a lisp vector whose 1st element
+       doc: /* Change the Sun mouse cursor icon.
+ICON is a lisp vector whose 1st element
 is the X offset of the cursor hot-point, whose 2nd element is the Y offset
 of the cursor hot-point and whose 3rd element is the cursor pixel data
 expressed as a string.  If ICON is nil then the original arrow cursor is used.  */)
@@ -219,12 +221,12 @@ expressed as a string.  If ICON is nil then the original arrow cursor is used.
   register short *p;
   register int i;
   Lisp_Object X_Hot, Y_Hot, Data;
-  
+
   CHECK_GFX (Qnil);
   /*
    *   If the icon is null, we just restore the DefaultCursor
    */
-  if (NILP(Icon)) 
+  if (NILP(Icon))
     CurrentCursor = DefaultCursor;
   else {
     /*
@@ -235,17 +237,17 @@ expressed as a string.  If ICON is nil then the original arrow cursor is used.
     X_Hot = XVECTOR(Icon)->contents[0];
     Y_Hot = XVECTOR(Icon)->contents[1];
     Data = XVECTOR(Icon)->contents[2];
-    
+
     CHECK_NUMBER (X_Hot);
     CHECK_NUMBER (Y_Hot);
     CHECK_STRING (Data);
-    if (XSTRING(Data)->size != 32) return(Qnil);
+    if (SCHARS (Data) != 32) return(Qnil);
     /*
      * Setup the new cursor
      */
     NewCursor.cur_xhot = X_Hot;
     NewCursor.cur_yhot = Y_Hot;
-    cp = XSTRING(Data)->data;
+    cp = SDATA (Data);
     p = CursorData;
     i = 16;
     while(--i >= 0)
@@ -266,7 +268,7 @@ sel_write (sel, file)
      struct selection *sel;
      FILE *file;
 {
-  fwrite (XSTRING (Current_Selection)->data, sizeof (char), 
+  fwrite (SDATA (Current_Selection), sizeof (char),
          sel->sel_items, file);
 }
 
@@ -284,7 +286,7 @@ sel_read (sel, file)
 {
   register int i, n;
   register char *cp;
-  
+
   Current_Selection = make_string ("", 0);
   if (sel->sel_items <= 0)
     return (0);
@@ -298,14 +300,14 @@ sel_read (sel, file)
     error("fread botch in sel_read");
     return(-1);
   } else if (n < 0) {
-    error("Error reading selection.");
+    error("Error reading selection");
     return(-1);
   }
   /*
    * The shelltool select saves newlines as carriage returns,
    * but emacs wants newlines.
    */
-  for (i = 0; i < n; i++) 
+  for (i = 0; i < n; i++)
     if (cp[i] == '\r') cp[i] = '\n';
 
   Current_Selection = make_string (cp, n);
@@ -329,7 +331,7 @@ DEFUN ("sun-set-selection", Fsun_set_selection, Ssun_set_selection, 1, 1,
 
   CHECK_GFX (Qnil);
   selection.sel_type = SELTYPE_CHAR;
-  selection.sel_items = XSTRING (str)->size;
+  selection.sel_items = SCHARS (str);
   selection.sel_itembytes = 1;
   selection.sel_pubflags = 1;
   selection_set(&selection, sel_write, sel_clear, win_fd);
@@ -370,24 +372,24 @@ sun_item_create (Pair)
   if (VECTORP (Value)) {
     submenu = sun_menu_create (Value);
     menu_item = menu_create_item
-      (MENU_RELEASE, MENU_PULLRIGHT_ITEM, XSTRING(String)->data, submenu, 0);
+      (MENU_RELEASE, MENU_PULLRIGHT_ITEM, SDATA (String), submenu, 0);
   } else {
     menu_item = menu_create_item
-      (MENU_RELEASE, MENU_STRING_ITEM, XSTRING(String)->data, Value, 0);
+      (MENU_RELEASE, MENU_STRING_ITEM, SDATA (String), Value, 0);
   }
   return menu_item;
 }
 
-Menu 
+Menu
 sun_menu_create (Vector)
      Lisp_Object Vector;
 {
   Menu menu;
   int i;
   CHECK_VECTOR(Vector);
-  menu=menu_create(0); 
+  menu=menu_create(0);
   for(i = 0; i < XVECTOR(Vector)->size; i++) {
-    menu_set (menu, MENU_APPEND_ITEM, 
+    menu_set (menu, MENU_APPEND_ITEM,
              sun_item_create(XVECTOR(Vector)->contents[i]), 0);
   }
   return menu;
@@ -444,7 +446,7 @@ as a menu label.  */)
   Event event0;
   Event *event = &event0;
   Lisp_Object Value, Pair;
-  
+
   CHECK_NUMBER(X_Position);
   CHECK_NUMBER(Y_Position);
   CHECK_LIVE_WINDOW(window);
@@ -453,8 +455,10 @@ as a menu label.  */)
 
   CHECK_GFX (Qnil);
 
-  xpos = CtoSX (WINDOW_LEFT_MARGIN (XWINDOW (window)) + XINT(X_Position));
-  ypos = CtoSY (XWINDOW(window)->top  + XINT(Y_Position));
+  xpos = CtoSX (WINDOW_LEFT_EDGE_COL (XWINDOW (window))
+               + WINDOW_LEFT_SCROLL_BAR_COLS (XWINDOW (window))
+               + XINT(X_Position));
+  ypos = CtoSY (WINDOW_TOP_EDGE_LINE (XWINDOW(window)) + XINT(Y_Position));
 #ifdef  Menu_Base_Kludge
   {static Lisp_Object symbol[2];
    symbol[0] = Fintern (sm_kludge_string, Qnil);
@@ -510,3 +514,6 @@ syms_of_sunfns()
   defsubr(&Ssun_get_selection);
   defsubr(&Ssun_menu_internal);
 }
+
+/* arch-tag: 2d7decb7-58f6-41aa-b45b-077ccfab7158
+   (do not change this comment) */