Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added license, dmg and About panel. Minor changes to code.

  • Loading branch information...
commit 020607b79edece898d854ec992c15ccce972fe8b 1 parent e4ebd12
Juan Germán Castañeda Echevarría authored
BIN  English.lproj/InfoPlist.strings
View
Binary file not shown
50 English.lproj/MainMenu.nib/designable.nib
View
@@ -2,14 +2,15 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data>
<int key="IBDocument.SystemTarget">1030</int>
- <string key="IBDocument.SystemVersion">9E17</string>
+ <string key="IBDocument.SystemVersion">9F33</string>
<string key="IBDocument.InterfaceBuilderVersion">670</string>
- <string key="IBDocument.AppKitVersion">949.33</string>
+ <string key="IBDocument.AppKitVersion">949.34</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="390"/>
+ <integer value="468"/>
<integer value="426"/>
- <integer value="413"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -45,7 +46,7 @@
<string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSCustomView" id="65137964">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -113,6 +114,7 @@
</object>
</object>
<string key="NSFrameSize">{30, 151}</string>
+ <reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="537978617">
@@ -200,7 +202,7 @@
<string key="NSContents"/>
<reference key="NSSupport" ref="390979741"/>
<reference key="NSControlView" ref="420450900"/>
- <double key="NSMaxValue">1.500000e+02</double>
+ <double key="NSMaxValue">1.000000e+02</double>
<double key="NSMinValue">3.000000e+01</double>
<double key="NSValue">5.000000e+01</double>
<double key="NSAltIncValue">0.000000e+00</double>
@@ -222,7 +224,7 @@
<string key="NSContents"/>
<reference key="NSSupport" ref="390979741"/>
<reference key="NSControlView" ref="1048789579"/>
- <double key="NSMaxValue">8.000000e+01</double>
+ <double key="NSMaxValue">5.000000e+01</double>
<double key="NSMinValue">0.000000e+00</double>
<double key="NSValue">2.000000e+01</double>
<double key="NSAltIncValue">0.000000e+00</double>
@@ -316,6 +318,14 @@
<reference key="NSOnImage" ref="485555236"/>
<reference key="NSMixedImage" ref="721643191"/>
</object>
+ <object class="NSMenuItem" id="183290389">
+ <reference key="NSMenu" ref="502787190"/>
+ <string key="NSTitle">About</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="485555236"/>
+ <reference key="NSMixedImage" ref="721643191"/>
+ </object>
<object class="NSMenuItem" id="898607414">
<reference key="NSMenu" ref="502787190"/>
<string key="NSTitle">Quit</string>
@@ -466,6 +476,14 @@
</object>
<int key="connectionID">467</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">orderFrontStandardAboutPanel:</string>
+ <reference key="source" ref="1021"/>
+ <reference key="destination" ref="183290389"/>
+ </object>
+ <int key="connectionID">501</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -567,6 +585,7 @@
<reference ref="728466373"/>
<reference ref="999936562"/>
<reference ref="815683929"/>
+ <reference ref="183290389"/>
</object>
<reference key="parent" ref="1049"/>
</object>
@@ -730,6 +749,11 @@
<reference key="object" ref="557351386"/>
<reference key="parent" ref="1048789579"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">468</int>
+ <reference key="object" ref="183290389"/>
+ <reference key="parent" ref="502787190"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -780,6 +804,7 @@
<string>459.IBPluginDependency</string>
<string>460.IBPluginDependency</string>
<string>461.IBPluginDependency</string>
+ <string>468.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -793,26 +818,27 @@
<string>{{517, 575}, {480, 270}}</string>
<string>LuzView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{654, 421}, {30, 151}}</string>
+ <string>{{533, 194}, {30, 151}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{691, 210}, {120, 113}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{593, 334}, {120, 93}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{310, 396}, {75, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{713, 384}, {75, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{310, 376}, {75, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{713, 384}, {75, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{213, 190}, {276, 55}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{548, 186}, {276, 55}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -849,7 +875,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">467</int>
+ <int key="maxID">501</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
BIN  English.lproj/MainMenu.nib/keyedobjects.nib
View
Binary file not shown
4 Info.plist
View
@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0</string>
+ <string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.0</string>
+ <string>2.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
58 LICENSE
View
@@ -0,0 +1,58 @@
+Lucecita is copyrighted free software by Juan Germán Castañeda <juanger@ciencias.unam.mx>.
+You can redistribute it and/or modify it under either the terms of the GPL2,
+or the conditions below:
+
+ 1. You may make and give away verbatim copies of the source form of the
+ software without restriction, provided that you duplicate all of the
+ original copyright notices and associated disclaimers.
+
+ 2. You may modify your copy of the software in any way, provided that
+ you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise
+ make them Freely Available, such as by posting said
+ modifications to Usenet or an equivalent medium, or by allowing
+ the author to include your modifications in the software.
+
+ b) use the modified software only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided.
+
+ d) make other distribution arrangements with the author.
+
+ 3. You may distribute the software in object code or executable
+ form, provided that you do at least ONE of the following:
+
+ a) distribute the executables and library files of the software,
+ together with instructions (in the manual page or equivalent)
+ on where to get the original distribution.
+
+ b) accompany the distribution with the machine-readable source of
+ the software.
+
+ c) give non-standard executables non-standard names, with
+ instructions on where to get the original software distribution.
+
+ d) make other distribution arrangements with the author.
+
+ 4. You may modify and include the part of the software into any other
+ software (possibly commercial). But some files in the distribution
+ are not written by the author, so that they are not under this terms.
+
+ They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
+ files under the ./missing directory. See each file for the copying
+ condition.
+
+ 5. The scripts and library files supplied as input to or produced as
+ output from the software do not automatically fall under the
+ copyright of the software, but belong to whomever generated them,
+ and may be sold commercially, and may be aggregated with this
+ software.
+
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
+
BIN  Lucecita.dmg
View
Binary file not shown
88 Lucecita.xcodeproj/project.pbxproj
View
@@ -6,6 +6,21 @@
objectVersion = 44;
objects = {
+/* Begin PBXAggregateTarget section */
+ 217D7BE50EB4DEAD00DE46E8 /* Package */ = {
+ isa = PBXAggregateTarget;
+ buildConfigurationList = 217D7BEB0EB4DF0E00DE46E8 /* Build configuration list for PBXAggregateTarget "Package" */;
+ buildPhases = (
+ 217D7BE40EB4DEAD00DE46E8 /* ShellScript */,
+ );
+ dependencies = (
+ 217D7BE90EB4DEBC00DE46E8 /* PBXTargetDependency */,
+ );
+ name = Package;
+ productName = Package;
+ };
+/* End PBXAggregateTarget section */
+
/* Begin PBXBuildFile section */
21AE3DF50E3489F700634CF8 /* LuzController.rb in Resources */ = {isa = PBXBuildFile; fileRef = 21AE3DF40E3489F700634CF8 /* LuzController.rb */; };
21C0132E0E355B7700CBCD88 /* Lucecita.png in Resources */ = {isa = PBXBuildFile; fileRef = 21C0132D0E355B7700CBCD88 /* Lucecita.png */; };
@@ -19,6 +34,16 @@
4DDCA70D0ACC9A6100E082CE /* RubyCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F5E24E03AEB6EC03A81C6F /* RubyCocoa.framework */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 217D7BE80EB4DEBC00DE46E8 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 4DDCA7030ACC9A6100E082CE /* Lucecita */;
+ remoteInfo = Lucecita;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
@@ -52,6 +77,9 @@
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
+ 21DBA4760E329AA100A213A3 /* LuzView.rb */,
+ 21AE3DF40E3489F700634CF8 /* LuzController.rb */,
+ 21DBA4970E32A2EF00A213A3 /* DarkWindow.rb */,
);
name = Classes;
sourceTree = "<group>";
@@ -108,11 +136,8 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
- 21AE3DF40E3489F700634CF8 /* LuzController.rb */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
- 21DBA4760E329AA100A213A3 /* LuzView.rb */,
- 21DBA4970E32A2EF00A213A3 /* DarkWindow.rb */,
);
name = Resources;
sourceTree = "<group>";
@@ -171,6 +196,7 @@
projectRoot = "";
targets = (
4DDCA7030ACC9A6100E082CE /* Lucecita */,
+ 217D7BE50EB4DEAD00DE46E8 /* Package */,
);
};
/* End PBXProject section */
@@ -192,6 +218,24 @@
};
/* End PBXResourcesBuildPhase section */
+/* Begin PBXShellScriptBuildPhase section */
+ 217D7BE40EB4DEAD00DE46E8 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "$(CONFIGURATION_BUILD_DIR)/$(WRAPPER_NAME)",
+ );
+ outputPaths = (
+ "$(SRCROOT)/$(PROJECT_NAME).dmg",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /usr/bin/ruby;
+ shellScript = "image_name = \"#{ENV['PROJECT_NAME']}.dmg\"\nif File.exists? image_name\n\tsystem(\"rm \\\"#{image_name}\\\"\")\nend\nsystem(\"hdiutil create -srcfolder \\'#{ENV['CONFIGURATION_BUILD_DIR']}/Lucecita.app\\' -volname #{ENV['PROJECT_NAME']} \\'#{image_name}\\'\")\nsystem(\"say build done\")";
+ };
+/* End PBXShellScriptBuildPhase section */
+
/* Begin PBXSourcesBuildPhase section */
4DDCA7090ACC9A6100E082CE /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -203,6 +247,14 @@
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ 217D7BE90EB4DEBC00DE46E8 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 4DDCA7030ACC9A6100E082CE /* Lucecita */;
+ targetProxy = 217D7BE80EB4DEBC00DE46E8 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -223,6 +275,27 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
+ 217D7BE60EB4DEAD00DE46E8 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ PRODUCT_NAME = Package;
+ };
+ name = Debug;
+ };
+ 217D7BE70EB4DEAD00DE46E8 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ PRODUCT_NAME = Package;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
4D7A7B580ABF745500C2D4C0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -282,6 +355,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 217D7BEB0EB4DF0E00DE46E8 /* Build configuration list for PBXAggregateTarget "Package" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 217D7BE60EB4DEAD00DE46E8 /* Debug */,
+ 217D7BE70EB4DEAD00DE46E8 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
4D7A7B570ABF745500C2D4C0 /* Build configuration list for PBXProject "Lucecita" */ = {
isa = XCConfigurationList;
buildConfigurations = (
11 LuzController.rb
View
@@ -17,13 +17,18 @@ class LuzController < OSX::NSObject
def awakeFromNib
activateStatusMenu()
@callback = lambda { |p,t,e,r|
+ # Activate it on Control-MouseButon3
if (t == KCGEventOtherMouseDown &&
CGEventGetFlags(e) & KCGEventFlagMaskControl == KCGEventFlagMaskControl)
toggle(self)
return
end
if @light_view.enabled
+ # Only redraw the light with a little margin, not all the screen
+ # because it is very slow
@light_view.setNeedsDisplayInRect @light_view.light_bounds
+ # all the screen would be done with:
+ # @light_view.setNeedsDisplay true
end
e
}
@@ -43,7 +48,11 @@ def awakeFromNib
end
ib_action :change_blur do |sender|
- @light_view.blur = @blur.floatValue
+ if @size.floatValue < 50
+ @light_view.blur = @blur.floatValue
+ else
+ @light_view.blur = @blur.floatValue/2
+ end
@blur_lbl.setStringValue "#{(@blur.intValue)} %"
@light_view.setNeedsDisplay true
end
38 LuzView.rb
View
@@ -8,13 +8,13 @@
require 'osx/cocoa'
include OSX
-#require_framework 'CoreGraphics'
class LuzView < OSX::NSView
attr_accessor :center, :rect, :radius, :blur
attr_accessor :transparency, :enabled
- OFFSET = 35
+ OFFSET = 25.0
+
def initialize
@radius = 70
@@ -25,16 +25,15 @@ def initialize
def drawRect(rect)
if @enabled
-
- NSGraphicsContext.currentContext.setCompositingOperation NSCompositeSourceOut
- context = NSGraphicsContext.currentContext.graphicsPort
- #CGContextSetBlendMode(context, KCGBlendModeColorDodge)
- CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, @transparency)
- CGContextFillRect(context, rect)
-
- @center = NSEvent.mouseLocation
- @rect = NSRect.new(@center.x - @radius, @center.y - @radius, @radius*2, @radius*2)
- drawLight
+ context = NSGraphicsContext.currentContext.graphicsPort
+ CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, @transparency)
+ CGContextFillRect(context, rect)
+ CGContextSetBlendMode(context, KCGBlendModeSourceOut)
+
+ @center = NSEvent.mouseLocation
+ # Get the area where the light will be drawn
+ @rect = NSRect.new(@center.x - @radius, @center.y - @radius, @radius*2, @radius*2)
+ drawLight
end
end
@@ -44,25 +43,26 @@ def drawLight
CGContextSetLineWidth(context, 0)
CGContextSaveGState(context)
+ # For the blur effect, the trick is draw a shadow far from the circle
+ # Show shadow below the circle and in the @rect
+ CGContextSetShadow(context, CGSizeMake(0, - @radius*2 - OFFSET*4), @blur)
- CGContextSetShadow(context, CGSizeMake(0, -@radius*2 - OFFSET), @blur)
-
- CGContextSetRGBFillColor(context, 1, 1, 1, 1)
- CGContextClipToRect(context, light_bounds)
+ # Only draw the area of the shadow plus a margin
+ CGContextClipToRect(context, light_bounds)
+ # Draw the ellipse in the hidden rect
CGContextAddEllipseInRect(context, fake_rect())
CGContextDrawPath(context, KCGPathFill)
-
CGContextRestoreGState(context)
end
def fake_rect
rect = @rect.clone
- rect.y += @radius*2 + OFFSET
+ rect.y += @radius*2 + OFFSET*4
rect
end
def light_bounds
- NSInsetRect(@rect, -OFFSET, -OFFSET)
+ NSInsetRect(@rect, -OFFSET*2, -OFFSET*2)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.