diff src/glyphs-msw.c @ 563:183866b06e0b

[xemacs-hg @ 2001-05-24 07:50:48 by ben] Makefile.in.in, abbrev.c, alloc.c, buffer.c, bytecode.c, callint.c, callproc.c, casetab.c, chartab.c, cmdloop.c, cmds.c, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console.c, data.c, database.c, debug.c, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, dired.c, doc.c, doprnt.c, dragdrop.c, editfns.c, eldap.c, eldap.h, elhash.c, emacs-widget-accessors.c, emacs.c, emodules.c, esd.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, filelock.c, floatfns.c, fns.c, font-lock.c, frame-gtk.c, frame-x.c, frame.c, general-slots.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-gtk.c, gui-x.c, gui.c, gutter.c, hpplay.c, indent.c, input-method-xlib.c, insdel.c, intl.c, keymap.c, libsst.c, libsst.h, linuxplay.c, lisp.h, lread.c, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, miscplay.c, miscplay.h, mule-ccl.c, mule-charset.c, mule-wnnfns.c, mule.c, nas.c, ntplay.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, ralloc.c, rangetab.c, redisplay.c, scrollbar.c, search.c, select-gtk.c, select-x.c, select.c, sgiplay.c, sheap.c, sound.c, specifier.c, sunplay.c, symbols.c, symeval.h, symsinit.h, syntax.c, sysdep.c, toolbar-msw.c, toolbar.c, tooltalk.c, ui-byhand.c, ui-gtk.c, undo.c, unexaix.c, unexapollo.c, unexconvex.c, unexec.c, widget.c, win32.c, window.c: -- defsymbol -> DEFSYMBOL. -- add an error type to all errors. -- eliminate the error functions in eval.c that let you just use Qerror as the type. -- redo the error API to be more consistent, sensibly named, and easier to use. -- redo the error hierarchy somewhat. create new errors: structure-formation-error, gui-error, invalid-constant, stack-overflow, out-of-memory, process-error, network-error, sound-error, printing-unreadable-object, base64-conversion- error; coding-system-error renamed to text-conversion error; some others. -- fix Mule problems in error strings in emodules.c, tooltalk.c. -- fix error handling in mswin open-network-stream. -- Mule-ize all sound files and clean up the headers. -- nativesound.h -> sound.h and used for all sound files. -- move some shared stuff into glyphs-shared.c: first attempt at eliminating some of the massive GTK code duplication. xemacs.mak: add glyphs-shared.c. xemacs-faq.texi: document how to debug X errors subr.el: fix doc string to reflect reality
author ben
date Thu, 24 May 2001 07:51:33 +0000
parents ed498ef2108b
children 5fd7ba8b56e7
line wrap: on
line diff
--- a/src/glyphs-msw.c	Thu May 24 06:30:21 2001 +0000
+++ b/src/glyphs-msw.c	Thu May 24 07:51:33 2001 +0000
@@ -94,7 +94,6 @@
 static	COLORREF transparent_color = RGB (1,1,1);
 
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (mswindows_resource);
-Lisp_Object Q_resource_type, Q_resource_id;
 Lisp_Object Qmswindows_resource;
 
 static void
@@ -367,7 +366,7 @@
 			     0, 0);
 
   if (!bitmap || !bmp_buf)
-    signal_simple_error ("Unable to create bitmap", instantiator);
+    signal_image_error ("Unable to create bitmap", instantiator);
 
   /* copy in the actual bitmap */
   memcpy (bmp_buf, bmp_data, bmp_bits);
@@ -419,7 +418,7 @@
 				     0,0);
 
   if (!bitmap || !bmp_buf)
-    signal_simple_error ("Unable to create bitmap", instantiator);
+    signal_image_error ("Unable to create bitmap", instantiator);
 
   /* copy in the actual bitmap */
   memcpy (bmp_buf, bmp_data, bmp_bits);
@@ -456,8 +455,8 @@
 						 eimage + (width * height * 3 * slice),
 						 &bmp_bits, &bmp_data)))
 	{
-	  signal_simple_error ("EImage to DIBitmap conversion failed",
-			       instantiator);
+	  signal_image_error ("EImage to DIBitmap conversion failed",
+			      instantiator);
 	}
 
       /* Now create the pixmap and set up the image instance */
@@ -816,18 +815,18 @@
       break;
     case XpmFileInvalid:
       {
-	signal_simple_error ("Invalid XPM data", image);
+	signal_image_error ("Invalid XPM data", image);
       }
     case XpmNoMemory:
       {
-	signal_double_file_error ("Parsing pixmap data",
-				  "out of memory", image);
+	signal_double_image_error ("Parsing pixmap data",
+				   "out of memory", image);
       }
     default:
       {
-	signal_double_file_error_2 ("Parsing pixmap data",
-				    "unknown error",
-				    make_int (result), image);
+	signal_double_image_error_2 ("Parsing pixmap data",
+				     "unknown error",
+				     make_int (result), image);
       }
     }
 
@@ -972,8 +971,8 @@
   if (!xpm_to_eimage (image_instance, bytes, &eimage, &width, &height,
 		      &x_hot, &y_hot, &transp, color_symbols, nsymbols))
     {
-      signal_simple_error ("XPM to EImage conversion failed",
-			   image_instance);
+      signal_image_error ("XPM to EImage conversion failed",
+			  image_instance);
     }
 
   if (color_symbols)
@@ -989,8 +988,8 @@
   if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, eimage,
 					     &bmp_bits, &bmp_data)))
     {
-      signal_simple_error ("XPM to EImage conversion failed",
-			   image_instance);
+      signal_image_error ("XPM to EImage conversion failed",
+			  image_instance);
     }
   xfree (eimage);
 
@@ -1073,49 +1072,15 @@
 static void
 mswindows_resource_validate (Lisp_Object instantiator)
 {
-  if ((NILP (find_keyword_in_vector (instantiator, Q_file))
-       &&
-       NILP (find_keyword_in_vector (instantiator, Q_resource_id)))
-      ||
-      NILP (find_keyword_in_vector (instantiator, Q_resource_type)))
-    signal_simple_error ("Must supply :file, :resource-id and :resource-type",
-			 instantiator);
+  shared_resource_validate (instantiator);
 }
 
 static Lisp_Object
 mswindows_resource_normalize (Lisp_Object inst, Lisp_Object console_type,
 			      Lisp_Object dest_mask)
 {
-  /* This function can call lisp */
-  Lisp_Object file = Qnil;
-  struct gcpro gcpro1, gcpro2;
-  Lisp_Object alist = Qnil;
-
-  GCPRO2 (file, alist);
-
-  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
-					     console_type);
-
-  if (CONSP (file)) /* failure locating filename */
-    signal_double_file_error ("Opening pixmap file",
-			      "no such file or directory",
-			      Fcar (file));
-
-  if (NILP (file)) /* no conversion necessary */
-    RETURN_UNGCPRO (inst);
-
-  alist = tagged_vector_to_alist (inst);
-
-  {
-    alist = remassq_no_quit (Q_file, alist);
-    alist = Fcons (Fcons (Q_file, file), alist);
-  }
-
-  {
-    Lisp_Object result = alist_to_tagged_vector (Qmswindows_resource, alist);
-    free_alist (alist);
-    RETURN_UNGCPRO (result);
-  }
+  return shared_resource_normalize (inst, console_type, dest_mask,
+				    Qmswindows_resource);
 }
 
 static int
@@ -1218,7 +1183,7 @@
     }
   else if (!STRINGP (name))
     {
-      signal_simple_error ("invalid resource identifier", name);
+      invalid_argument ("invalid resource identifier", name);
     }
 
   do {
@@ -1311,7 +1276,7 @@
     }
   else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id,
 							       type))))
-    signal_simple_error ("Invalid resource identifier", resource_id);
+    invalid_argument ("Invalid resource identifier", resource_id);
 
   /* load the image */
   if (xLoadImageA) /* not in NT 3.5 */
@@ -1320,7 +1285,7 @@
 				  LR_CREATEDIBSECTION | LR_DEFAULTSIZE |
 				  LR_SHARED |
 				  (!NILP (file) ? LR_LOADFROMFILE : 0))))
-	signal_simple_error ("Cannot load image", instantiator);
+	signal_image_error ("Cannot load image", instantiator);
     }
   else
     {
@@ -1339,7 +1304,7 @@
 	}
 
       if (!himage)
-	signal_simple_error ("Cannot load image", instantiator);
+	signal_image_error ("Cannot load image", instantiator);
     }
 
   if (hinst)
@@ -1381,7 +1346,7 @@
 {
   CHECK_SYMBOL (data);
   if (!resource_symbol_to_type (data))
-    signal_simple_error ("invalid resource type", data);
+    invalid_constant ("invalid resource type", data);
 }
 
 static void
@@ -1392,7 +1357,7 @@
       !resource_name_to_resource (data, IMAGE_ICON)
       &&
       !resource_name_to_resource (data, IMAGE_BITMAP))
-    signal_simple_error ("invalid resource identifier", data);
+    invalid_constant ("invalid resource identifier", data);
 }
 
 /**********************************************************************
@@ -2028,7 +1993,7 @@
     }
 
   if (emsg)
-    signal_simple_error_2 (emsg, data, Qimage);
+    signal_image_error_2 (emsg, data, Qimage);
 
   bp = bits = (char *) alloca (PIXELS / 8);
 
@@ -2408,8 +2373,8 @@
 			NULL,       /* No menu */
 			NULL, /* must be null for this class */
 			NULL)) == NULL)
-    signal_simple_error ("window creation failed with code",
-			 make_int (GetLastError()));
+    gui_error ("window creation failed with code",
+	       make_int (GetLastError()));
 
   wnd = CreateWindow( "STATIC",
 		      "",
@@ -2547,8 +2512,8 @@
 			(HMENU)id,       /* No menu */
 			NULL, /* must be null for this class */
 			NULL)) == NULL)
-    signal_simple_error ("window creation failed with code",
-			 make_int (GetLastError()));
+    gui_error ("window creation failed with code",
+	       make_int (GetLastError()));
 
   if ((wnd = CreateWindowEx(
 			    exflags /* | WS_EX_NOPARENTNOTIFY*/,
@@ -2567,8 +2532,8 @@
 			    (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)),
 			     GWL_HINSTANCE),
 			    NULL)) == NULL)
-    signal_simple_error ("window creation failed with code",
-			 make_int (GetLastError()));
+    gui_error ("window creation failed with code",
+	       make_int (GetLastError()));
 
   IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd;
   SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance));
@@ -2779,7 +2744,7 @@
 
   if ((ret = (HTREEITEM)SendMessage (wnd, TVM_INSERTITEM,
 				     0, (LPARAM)&tvitem)) == 0)
-    signal_simple_error ("error adding tree view entry", item);
+    gui_error ("error adding tree view entry", item);
 
   return ret;
 }
@@ -2902,7 +2867,7 @@
 
   if ((ret = SendMessage (wnd, TCM_INSERTITEM,
 			  i, (LPARAM)&tvitem)) < 0)
-    signal_simple_error ("error adding tab entry", item);
+    gui_error ("error adding tab entry", item);
 
   return ret;
 }
@@ -3103,7 +3068,7 @@
 			  C_STRING_ALLOCA, lparam,
 			  Qnative);
       if (SendMessage (wnd, CB_ADDSTRING, 0, (LPARAM)lparam) == CB_ERR)
-	signal_simple_error ("error adding combo entries", instantiator);
+	gui_error ("error adding combo entries", instantiator);
     }
 }
 
@@ -3214,8 +3179,6 @@
 void
 syms_of_glyphs_mswindows (void)
 {
-  defkeyword (&Q_resource_id, ":resource-id");
-  defkeyword (&Q_resource_type, ":resource-type");
 }
 
 void