aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Robert2008-08-01 11:48:29 +0000
committerAdrian Robert2008-08-01 11:48:29 +0000
commit7ded3383490c55c98d56b86eae1a3ce78b82aa6a (patch)
tree875c8c0d6bf19047cc9e286a652b5ffd1fa11ebe /src
parentbfe162634bea9e1216347a920fa5885366e427af (diff)
downloademacs-7ded3383490c55c98d56b86eae1a3ce78b82aa6a.tar.gz
emacs-7ded3383490c55c98d56b86eae1a3ce78b82aa6a.zip
NS port now uses etc/rgb.txt instead of etc/Emacs.clr (now removed); function Fw32_load_color_file moved to xfaces x_load_color_file
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/nsterm.m66
-rw-r--r--src/w32fns.c50
-rw-r--r--src/xfaces.c53
4 files changed, 98 insertions, 81 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1196458857e..9c4f4676940 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12008-08-01 Adrian Robert <Adrian.B.Robert@gmail.com>
2
3 * w32fns.c (w32-load-color-file): Remove.
4 (x-open-connection): Use renamed Fx_load_color_file.
5 * xfaces.c (x-load-color-file): Add.
6 * nsterm.m (ns_initialize): Load colors from etc/rgb.txt instead of
7 Emacs.clr.
8 (ns_draw_window_cursor): Change PENDING to TODO or FIXME.
9 (hide_hourglass): BLOCK_INPUT before UNBLOCK.
10
12008-07-31 Michael Albinus <michael.albinus@gmx.de> 112008-07-31 Michael Albinus <michael.albinus@gmx.de>
2 12
3 * dbusbind.c (Fdbus_call_method_asynchronously) 13 * dbusbind.c (Fdbus_call_method_asynchronously)
diff --git a/src/nsterm.m b/src/nsterm.m
index 2f8348a9b0f..0e6c1f33cfd 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2313,7 +2313,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2313 r.size.height = h; 2313 r.size.height = h;
2314 r.size.width = w->phys_cursor_width; 2314 r.size.width = w->phys_cursor_width;
2315 2315
2316 /* PENDING: if we overwrite the internal border area, it does not get erased; 2316 /* FIXME: if we overwrite the internal border area, it does not get erased;
2317 fix by truncating cursor, but better would be to erase properly */ 2317 fix by truncating cursor, but better would be to erase properly */
2318 overspill = r.origin.x + r.size.width - 2318 overspill = r.origin.x + r.size.width -
2319 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, WINDOW_BOX_RIGHT_EDGE_X (w) 2319 WINDOW_TEXT_TO_FRAME_PIXEL_X (w, WINDOW_BOX_RIGHT_EDGE_X (w)
@@ -2321,13 +2321,13 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2321 if (overspill > 0) 2321 if (overspill > 0)
2322 r.size.width -= overspill; 2322 r.size.width -= overspill;
2323 2323
2324 /* PENDING: 23: use emacs stored f->cursor_type instead of ns-specific */ 2324 /* TODO: 23: use emacs stored f->cursor_type instead of ns-specific */
2325 oldCursorType = FRAME_CURSOR (f); 2325 oldCursorType = FRAME_CURSOR (f);
2326 cursorType = FRAME_CURSOR (f) = FRAME_NEW_CURSOR (f); 2326 cursorType = FRAME_CURSOR (f) = FRAME_NEW_CURSOR (f);
2327 f->output_data.ns->current_cursor_color 2327 f->output_data.ns->current_cursor_color
2328 = f->output_data.ns->desired_cursor_color; 2328 = f->output_data.ns->desired_cursor_color;
2329 2329
2330 /* PENDING: only needed in rare cases with last-resort font in HELLO.. 2330 /* TODO: only needed in rare cases with last-resort font in HELLO..
2331 should we do this more efficiently? */ 2331 should we do this more efficiently? */
2332 ns_clip_to_row (w, glyph_row, -1, NULL); 2332 ns_clip_to_row (w, glyph_row, -1, NULL);
2333/* ns_focus (f, &r, 1); */ 2333/* ns_focus (f, &r, 1); */
@@ -2434,6 +2434,8 @@ hide_hourglass ()
2434 if (!hourglass_shown_p) 2434 if (!hourglass_shown_p)
2435 return; 2435 return;
2436 2436
2437 BLOCK_INPUT;
2438
2437 /* TODO: remove NSProgressIndicator from all frames */ 2439 /* TODO: remove NSProgressIndicator from all frames */
2438 2440
2439 hourglass_shown_p = 0; 2441 hourglass_shown_p = 0;
@@ -3822,37 +3824,37 @@ ns_term_init (Lisp_Object display_name)
3822 ns_selection_color = NS_SELECTION_COLOR_DEFAULT; 3824 ns_selection_color = NS_SELECTION_COLOR_DEFAULT;
3823 3825
3824 { 3826 {
3825 id cl; 3827 NSColorList *cl = [NSColorList colorListNamed: @"Emacs"];
3826 Lisp_Object tem, tem1;
3827 extern Lisp_Object Vsource_directory;
3828
3829 cl = [NSColorList colorListNamed: @"Emacs"];
3830 3828
3831 if ( cl == nil ) 3829 if ( cl == nil )
3832 { 3830 {
3833 /* first try data_dir, then invocation-dir 3831 Lisp_Object color_file, color_map, color;
3834 and finally source-directory/etc */ 3832 int r,g,b;
3835 tem1 = tem 3833 unsigned long c;
3836 = Fexpand_file_name (build_string ("Emacs.clr"), Vdata_directory); 3834 char *name;
3837 if (NILP (Ffile_exists_p (tem))) 3835
3836 color_file = Fexpand_file_name (build_string ("rgb.txt"),
3837 Fsymbol_value (intern ("data-directory")));
3838 if (NILP (Ffile_readable_p (color_file)))
3839 fatal ("Could not find %s.\n", SDATA (color_file));
3840
3841 color_map = Fx_load_color_file (color_file);
3842 if (NILP (color_map))
3843 fatal ("Could not read %s.\n", SDATA (color_file));
3844
3845 cl = [[NSColorList alloc] initWithName: @"Emacs"];
3846 for ( ; CONSP (color_map); color_map = XCDR (color_map))
3838 { 3847 {
3839 tem = Fexpand_file_name (build_string ("Emacs.clr"), 3848 color = XCAR (color_map);
3840 Vinvocation_directory); 3849 name = SDATA (XCAR (color));
3841 if (NILP (Ffile_exists_p (tem))) 3850 c = XINT (XCDR (color));
3842 { 3851 [cl setColor:
3843 Lisp_Object newdir 3852 [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
3844 = Fexpand_file_name (build_string ("etc/"), 3853 green: GREEN_FROM_ULONG (c) / 255.0
3845 Vsource_directory); 3854 blue: BLUE_FROM_ULONG (c) / 255.0
3846 tem = Fexpand_file_name (build_string ("Emacs.clr"), 3855 alpha: 1.0]
3847 newdir); 3856 forKey: [NSString stringWithUTF8String: name]];
3848 }
3849 } 3857 }
3850
3851 cl = [[NSColorList alloc]
3852 initWithName: @"Emacs"
3853 fromFile: [NSString stringWithCString: SDATA (tem)]];
3854 if (cl ==nil)
3855 fatal ("Could not find %s.\n", SDATA (tem1));
3856 [cl writeToFile: nil]; 3858 [cl writeToFile: nil];
3857 } 3859 }
3858 } 3860 }
@@ -6553,7 +6555,7 @@ or shrunk (negative). Zero (the default) means standard line height.\n\
6553 Qcontrol = intern ("control"); 6555 Qcontrol = intern ("control");
6554 Fput (Qcontrol, Qmodifier_value, make_number (ctrl_modifier)); 6556 Fput (Qcontrol, Qmodifier_value, make_number (ctrl_modifier));
6555 6557
6556 /*PENDING: move to common code */ 6558 /* TODO: move to common code */
6557 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 6559 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
6558 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 6560 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
6559#ifdef USE_TOOLKIT_SCROLL_BARS 6561#ifdef USE_TOOLKIT_SCROLL_BARS
@@ -6586,8 +6588,8 @@ baseline level. The default value is nil. */);
6586 6588
6587 /* Tell emacs about this window system. */ 6589 /* Tell emacs about this window system. */
6588 Fprovide (intern ("ns"), Qnil); 6590 Fprovide (intern ("ns"), Qnil);
6589 /* PENDING: try to move this back into lisp, ns-win.el loaded too late 6591 /* TODO: try to move this back into lisp, ns-win.el loaded too late
6590 right now */ 6592 right now */
6591 { 6593 {
6592 Lisp_Object args[3] = { intern ("ns-version-string"), build_string ("9.0"), 6594 Lisp_Object args[3] = { intern ("ns-version-string"), build_string ("9.0"),
6593 build_string ("NS Window system port version number.") }; 6595 build_string ("NS Window system port version number.") };
diff --git a/src/w32fns.c b/src/w32fns.c
index 2fb03114007..74cacf34521 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -502,53 +502,6 @@ if the entry is new. */)
502 return (oldrgb); 502 return (oldrgb);
503} 503}
504 504
505DEFUN ("w32-load-color-file", Fw32_load_color_file,
506 Sw32_load_color_file, 1, 1, 0,
507 doc: /* Create an alist of color entries from an external file.
508Assign this value to `w32-color-map' to replace the existing color map.
509
510The file should define one named RGB color per line like so:
511 R G B name
512where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
513 (filename)
514 Lisp_Object filename;
515{
516 FILE *fp;
517 Lisp_Object cmap = Qnil;
518 Lisp_Object abspath;
519
520 CHECK_STRING (filename);
521 abspath = Fexpand_file_name (filename, Qnil);
522
523 fp = fopen (SDATA (filename), "rt");
524 if (fp)
525 {
526 char buf[512];
527 int red, green, blue;
528 int num;
529
530 BLOCK_INPUT;
531
532 while (fgets (buf, sizeof (buf), fp) != NULL) {
533 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3)
534 {
535 char *name = buf + num;
536 num = strlen (name) - 1;
537 if (name[num] == '\n')
538 name[num] = 0;
539 cmap = Fcons (Fcons (build_string (name),
540 make_number (RGB (red, green, blue))),
541 cmap);
542 }
543 }
544 fclose (fp);
545
546 UNBLOCK_INPUT;
547 }
548
549 return cmap;
550}
551
552/* The default colors for the w32 color map */ 505/* The default colors for the w32 color map */
553typedef struct colormap_t 506typedef struct colormap_t
554{ 507{
@@ -4995,7 +4948,7 @@ terminate Emacs if we can't open the connection. */)
4995 Fexpand_file_name (build_string ("rgb.txt"), 4948 Fexpand_file_name (build_string ("rgb.txt"),
4996 Fsymbol_value (intern ("data-directory"))); 4949 Fsymbol_value (intern ("data-directory")));
4997 4950
4998 Vw32_color_map = Fw32_load_color_file (color_file); 4951 Vw32_color_map = Fx_load_color_file (color_file);
4999 4952
5000 UNGCPRO; 4953 UNGCPRO;
5001 } 4954 }
@@ -7226,7 +7179,6 @@ only be necessary if the default setting causes problems. */);
7226 7179
7227 defsubr (&Sw32_define_rgb_color); 7180 defsubr (&Sw32_define_rgb_color);
7228 defsubr (&Sw32_default_color_map); 7181 defsubr (&Sw32_default_color_map);
7229 defsubr (&Sw32_load_color_file);
7230 defsubr (&Sw32_send_sys_command); 7182 defsubr (&Sw32_send_sys_command);
7231 defsubr (&Sw32_shell_execute); 7183 defsubr (&Sw32_shell_execute);
7232 defsubr (&Sw32_register_hot_key); 7184 defsubr (&Sw32_register_hot_key);
diff --git a/src/xfaces.c b/src/xfaces.c
index ff5a636ee2d..6180b899dbb 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6574,6 +6574,56 @@ merge_faces (f, face_name, face_id, base_face_id)
6574} 6574}
6575 6575
6576 6576
6577
6578#ifndef HAVE_X_WINDOWS
6579DEFUN ("x-load-color-file", Fx_load_color_file,
6580 Sx_load_color_file, 1, 1, 0,
6581 doc: /* Create an alist of color entries from an external file.
6582
6583The file should define one named RGB color per line like so:
6584 R G B name
6585where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
6586 (filename)
6587 Lisp_Object filename;
6588{
6589 FILE *fp;
6590 Lisp_Object cmap = Qnil;
6591 Lisp_Object abspath;
6592
6593 CHECK_STRING (filename);
6594 abspath = Fexpand_file_name (filename, Qnil);
6595
6596 fp = fopen (SDATA (filename), "rt");
6597 if (fp)
6598 {
6599 char buf[512];
6600 int red, green, blue;
6601 int num;
6602
6603 BLOCK_INPUT;
6604
6605 while (fgets (buf, sizeof (buf), fp) != NULL) {
6606 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3)
6607 {
6608 char *name = buf + num;
6609 num = strlen (name) - 1;
6610 if (name[num] == '\n')
6611 name[num] = 0;
6612 cmap = Fcons (Fcons (build_string (name),
6613 make_number ((red << 16) | (green << 8) | blue)),
6614 cmap);
6615 }
6616 }
6617 fclose (fp);
6618
6619 UNBLOCK_INPUT;
6620 }
6621
6622 return cmap;
6623}
6624#endif
6625
6626
6577/*********************************************************************** 6627/***********************************************************************
6578 Tests 6628 Tests
6579 ***********************************************************************/ 6629 ***********************************************************************/
@@ -6829,6 +6879,9 @@ syms_of_xfaces ()
6829#endif 6879#endif
6830 defsubr (&Scolor_gray_p); 6880 defsubr (&Scolor_gray_p);
6831 defsubr (&Scolor_supported_p); 6881 defsubr (&Scolor_supported_p);
6882#ifndef HAVE_X_WINDOWS
6883 defsubr (&Sx_load_color_file);
6884#endif
6832 defsubr (&Sface_attribute_relative_p); 6885 defsubr (&Sface_attribute_relative_p);
6833 defsubr (&Smerge_face_attribute); 6886 defsubr (&Smerge_face_attribute);
6834 defsubr (&Sinternal_get_lisp_face_attribute); 6887 defsubr (&Sinternal_get_lisp_face_attribute);