Skip to content

Commit 801868e

Browse files
authored
Merge pull request #2 from mcode10/c-debug
This build adds the ability to convert between C° and F°. * A logic error was discovered when I added the abilty to convert between degrees Celcius and Fahrenheit. It's fixed now.
2 parents 3fe5ff3 + 1dd7798 commit 801868e

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

macOS Calculator/macOS Calculator/Base.lproj/Main.storyboard

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
</menuItem>
2525
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
2626
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
27-
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
28-
<menuItem title="Services" id="NMo-om-nkz">
29-
<modifierMask key="keyEquivalentModifierMask"/>
30-
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
31-
</menuItem>
3227
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
3328
<menuItem title="Hide macOS Calculator" keyEquivalent="h" id="Olw-nP-bQN">
3429
<connections>
@@ -515,6 +510,28 @@
515510
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
516511
</textFieldCell>
517512
</textField>
513+
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rkh-F0-gVp">
514+
<rect key="frame" x="26" y="112" width="88" height="32"/>
515+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
516+
<buttonCell key="cell" type="push" title="F° to C°" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7Gz-Qc-MxW">
517+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
518+
<font key="font" metaFont="system"/>
519+
</buttonCell>
520+
<connections>
521+
<action selector="fc:" target="XfG-lQ-9wD" id="zEG-WA-RR6"/>
522+
</connections>
523+
</button>
524+
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QsV-9A-zoD">
525+
<rect key="frame" x="26" y="79" width="88" height="32"/>
526+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
527+
<buttonCell key="cell" type="push" title="C° to F°" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="mGo-UY-JNY">
528+
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
529+
<font key="font" metaFont="system"/>
530+
</buttonCell>
531+
<connections>
532+
<action selector="cf:" target="XfG-lQ-9wD" id="o6R-AX-bYt"/>
533+
</connections>
534+
</button>
518535
</subviews>
519536
</view>
520537
<connections>

macOS Calculator/macOS Calculator/ViewController.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ var operation:operatorCases = .add
3838
display_Panel.stringValue = String(calcEngine.positiveNegative(original: Double(display_Panel.stringValue)!))
3939
}
4040

41+
@IBAction func fc(_ sender: NSButton) {
42+
display_Panel.stringValue = calcEngine.fc(original: Double(display_Panel.stringValue)!)
43+
answer = display_Panel.stringValue
44+
}
45+
46+
@IBAction func cf(_ sender: NSButton) {
47+
display_Panel.stringValue = calcEngine.cf(original: Double(display_Panel.stringValue)!)
48+
}
49+
4150
@IBAction func operators(_ sender: NSButtonCell) {
4251
//TODO Make a library full of code linked to CalcEngine and
4352
// CalcEngineProtocol

0 commit comments

Comments
 (0)