Seiji Zenitani
zenit****@users*****
2005年 11月 1日 (火) 00:48:27 JST
Index: CarbonEmacsPackage/GPL/patch/transparency2/readme-macui diff -u /dev/null CarbonEmacsPackage/GPL/patch/transparency2/readme-macui:1.1 --- /dev/null Tue Nov 1 00:48:27 2005 +++ CarbonEmacsPackage/GPL/patch/transparency2/readme-macui Tue Nov 1 00:48:27 2005 @@ -0,0 +1,30 @@ +**************************************************************************** +transparency2-macui.patch + Author Seiji Zenitani + + contact: macem****@lists***** +**************************************************************************** +Copyright (C) 2005 Seiji Zenitani + + +1. Introduction + +Transparency2-macui is a user-interface extension to the transparency patch +on Mac OSX. By using M-x `mac-set-transparency' function, the user can +dynamically set the window transparency via a sheet dialog. +This code is distributed under the terms of the GPL version 2. + + +2. How to build + +Apply the patch to the emacs CVS code of 2005-10-09 or newer. +Before using this patch, first apply the transparency2 patch. + + cd emacs + patch -p0 < somewhere/else/transparency2.patch + patch -p1 < somewhere/else/transparency2-macui.patch + + +Cheers, + +Seiji Zenitani Index: CarbonEmacsPackage/GPL/patch/transparency2/readme-macui.ja diff -u /dev/null CarbonEmacsPackage/GPL/patch/transparency2/readme-macui.ja:1.1 --- /dev/null Tue Nov 1 00:48:27 2005 +++ CarbonEmacsPackage/GPL/patch/transparency2/readme-macui.ja Tue Nov 1 00:48:27 2005 @@ -0,0 +1,30 @@ +**************************************************************************** +transparency2-macui.patch + Author Seiji Zenitani + + contact: macem****@lists***** +**************************************************************************** +Copyright (C) 2005 Seiji Zenitani + + +1. 概要 + +透明パッチをさらに拡張する Mac OSX 用のパッチです。 +新たに追加された M-x `mac-set-transparency' 関数を呼ぶと、 +設定用のダイアログが現れて、透明度を変更できるようになります。 + +このファイルは GPL バージョン 2 に従って配布して下さい。 + + +2. ビルドの方法 + +2005-10-09 以降の Emacs CVS コードにパッチを適用します。 +このパッチを使う前に、透明パッチを適用して下さい。 + + cd emacs + patch -p0 < somewhere/else/transparency2.patch + patch -p1 < somewhere/else/transparency2-macui.patch + + + +銭谷誠司 Index: CarbonEmacsPackage/GPL/patch/transparency2/transparency2-macui.patch diff -u /dev/null CarbonEmacsPackage/GPL/patch/transparency2/transparency2-macui.patch:1.1 --- /dev/null Tue Nov 1 00:48:27 2005 +++ CarbonEmacsPackage/GPL/patch/transparency2/transparency2-macui.patch Tue Nov 1 00:48:27 2005 @@ -0,0 +1,222 @@ +diff -N -u -r emacs.orig/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/classes.nib emacs/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/classes.nib +--- emacs.orig/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/classes.nib 1970-01-01 09:00:00.000000000 +0900 ++++ emacs/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/classes.nib 2005-10-08 23:05:10.000000000 +0900 +@@ -0,0 +1,4 @@ ++{ ++IBClasses = (); ++IBVersion = 1; ++} +diff -N -u -r emacs.orig/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/info.nib emacs/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/info.nib +--- emacs.orig/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/info.nib 1970-01-01 09:00:00.000000000 +0900 ++++ emacs/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/info.nib 2005-10-08 23:05:10.000000000 +0900 +@@ -0,0 +1,18 @@ ++<?xml version="1.0" encoding="UTF-8"?> ++<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> ++<plist version="1.0"> ++<dict> ++ <key>IBDocumentLocation</key> ++ <string>50 9 356 240 0 0 1024 746 </string> ++ <key>IBFramework Version</key> ++ <string>439.0</string> ++ <key>IBOpenObjects</key> ++ <array> ++ <integer>166</integer> ++ </array> ++ <key>IBSystem Version</key> ++ <string>8C46</string> ++ <key>targetFramework</key> ++ <string>IBCarbonFramework</string> ++</dict> ++</plist> +diff -N -u -r emacs.orig/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/objects.xib emacs/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/objects.xib +--- emacs.orig/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/objects.xib 1970-01-01 09:00:00.000000000 +0900 ++++ emacs/mac/Emacs.app/Contents/Resources/English.lproj/Sheet.nib/objects.xib 2005-10-08 23:05:10.000000000 +0900 +@@ -0,0 +1,77 @@ ++<?xml version="1.0" standalone="yes"?> ++<object class="NSIBObjectData"> ++ <string name="targetFramework">IBCarbonFramework</string> ++ <object name="rootObject" class="NSCustomObject" id="1"> ++ <string name="customClass">NSApplication</string> ++ </object> ++ <array count="7" name="allObjects"> ++ <object class="IBCarbonWindow" id="166"> ++ <string name="windowRect">245 253 449 681 </string> ++ <string name="title">Sheet</string> ++ <object name="rootControl" class="IBCarbonRootControl" id="167"> ++ <string name="bounds">0 0 204 428 </string> ++ <array count="5" name="subviews"> ++ <object class="IBCarbonButton" id="180"> ++ <string name="bounds">164 336 184 408 </string> ++ <ostype name="controlSignature">okok</ostype> ++ <string name="title">OK</string> ++ <ostype name="command">ok </ostype> ++ <int name="buttonType">1</int> ++ </object> ++ <object class="IBCarbonStaticText" id="182"> ++ <string name="bounds">20 34 64 277 </string> ++ <string name="title">Active window</string> ++ </object> ++ <object class="IBCarbonSlider" id="203"> ++ <string name="bounds">47 57 73 341 </string> ++ <ostype name="controlSignature">sldr</ostype> ++ <boolean name="isLive">TRUE</boolean> ++ <int name="numTickMarks">11</int> ++ <int name="initialValue">100</int> ++ </object> ++ <object class="IBCarbonStaticText" id="205"> ++ <string name="bounds">86 34 130 277 </string> ++ <string name="title">Inactive window</string> ++ </object> ++ <object class="IBCarbonSlider" id="204"> ++ <string name="bounds">110 57 136 341 </string> ++ <ostype name="controlSignature">sldr</ostype> ++ <int name="controlID">1</int> ++ <boolean name="isLive">TRUE</boolean> ++ <int name="numTickMarks">11</int> ++ <int name="initialValue">100</int> ++ </object> ++ </array> ++ </object> ++ <boolean name="hasCloseBox">FALSE</boolean> ++ <boolean name="hasCollapseBox">FALSE</boolean> ++ <boolean name="isResizable">FALSE</boolean> ++ <int name="carbonWindowClass">11</int> ++ <boolean name="hideOnFullScreen">TRUE</boolean> ++ <boolean name="hideOnSuspend">TRUE</boolean> ++ <boolean name="doesNotCycle">TRUE</boolean> ++ </object> ++ <reference idRef="167"/> ++ <reference idRef="180"/> ++ <reference idRef="182"/> ++ <reference idRef="203"/> ++ <reference idRef="204"/> ++ <reference idRef="205"/> ++ </array> ++ <array count="7" name="allParents"> ++ <reference idRef="1"/> ++ <reference idRef="166"/> ++ <reference idRef="167"/> ++ <reference idRef="167"/> ++ <reference idRef="167"/> ++ <reference idRef="167"/> ++ <reference idRef="167"/> ++ </array> ++ <dictionary count="2" name="nameTable"> ++ <string>Files Owner</string> ++ <reference idRef="1"/> ++ <string>Sheet</string> ++ <reference idRef="166"/> ++ </dictionary> ++ <unsigned_int name="nextObjectID">211</unsigned_int> ++</object> +diff -N -u -r emacs.orig/src/macfns.c emacs/src/macfns.c +--- emacs.orig/src/macfns.c 2005-10-09 23:55:50.000000000 +0900 ++++ emacs/src/macfns.c 2005-10-10 00:11:26.000000000 +0900 +@@ -2009,6 +2009,94 @@ + + return; + } ++ ++#ifdef MAC_OSX ++#if TARGET_API_MAC_CARBON ++/*********************************************************************** ++ Transparency dialog ++ ***********************************************************************/ ++pascal void ++ActiveAlphaProc( ControlHandle control, SInt16 part ) ++{ ++ struct frame *f = XFRAME (selected_frame); ++ float active_alpha = GetControlValue( control ) / 100.0; ++ ++ if( active_alpha > 1.0 ){ ++ active_alpha = 1.0; ++ } ++ if( active_alpha < 0.0 ){ ++ active_alpha = 0.0; ++ } ++ ++ BLOCK_INPUT; ++ f->active_alpha = active_alpha; ++ x_set_frame_alpha (f, 1); ++ UNBLOCK_INPUT; ++} ++ ++pascal void ++InactiveAlphaProc( ControlHandle control, SInt16 part ) ++{ ++ struct frame *f = XFRAME (selected_frame); ++ float inactive_alpha = GetControlValue( control ) / 100.0; ++ ++ if( inactive_alpha > 1.0 ){ ++ inactive_alpha = 1.0; ++ } ++ if( inactive_alpha < 0.0 ){ ++ inactive_alpha = 0.0; ++ } ++ ++ BLOCK_INPUT; ++ f->inactive_alpha = inactive_alpha; ++ UNBLOCK_INPUT; ++} ++ ++pascal void ++OKButtonProc( ControlHandle control, SInt16 part ) ++{ ++ WindowRef sheet=GetControlOwner(control); ++ QuitAppModalLoopForWindow(sheet); ++ HideSheetWindow(sheet); ++ DisposeWindow(sheet); ++ sleep(1); ++} ++ ++DEFUN ("mac-transparency-dialog", Fmac_transparency_dialog, ++ Smac_transparency_dialog, 0, 0, "", ++ doc: /* (Experimental) Show a dialog to set the window transparency. */) ++ () ++{ ++ struct frame *f = XFRAME (selected_frame); ++ const ControlID kActiveSlider = { 'sldr', 0 }; ++ const ControlID kInactiveSlider = { 'sldr', 1 }; ++ const ControlID kOKButton = { 'okok', 0 }; ++ ++ ControlRef ActiveControl, InactiveControl, OKControl; ++ IBNibRef nibRef; ++ WindowRef sheet=NULL; ++ ++ CreateNibReference(CFSTR("Sheet"), &nibRef); ++ CreateWindowFromNib(nibRef, CFSTR("Sheet"), &sheet); ++ DisposeNibReference(nibRef); ++ ++ GetControlByID( sheet, &kActiveSlider, &ActiveControl ); ++ SetControlValue( ActiveControl, 100 * f->active_alpha ); ++ SetControlAction( ActiveControl, NewEventHandlerUPP(ActiveAlphaProc) ); ++ ++ GetControlByID( sheet, &kInactiveSlider, &InactiveControl ); ++ SetControlValue( InactiveControl, 100 * f->inactive_alpha ); ++ SetControlAction( InactiveControl, NewEventHandlerUPP(InactiveAlphaProc) ); ++ ++ GetControlByID( sheet, &kOKButton, &OKControl ); ++ SetControlAction( OKControl, NewEventHandlerUPP(OKButtonProc) ); ++ ++ ShowSheetWindow(sheet,FRAME_MAC_WINDOW (f)); ++ RunAppModalLoopForWindow(sheet); ++} ++#endif ++#endif /* MAC_OSX */ ++/* --- end (Transparency dialog) --- */ + + /* Subroutines of creating a frame. */ + +@@ -4601,6 +4689,12 @@ + hourglass_atimer = NULL; + hourglass_shown_p = 0; + ++#if MAC_OSX ++#if TARGET_API_MAC_CARBON ++ defsubr (&Smac_transparency_dialog); // Transparency dialog ++#endif ++#endif ++ + defsubr (&Sx_show_tip); + defsubr (&Sx_hide_tip); + tip_timer = Qnil;