diff --git a/2Term.xcodeproj/kelvin.pbxuser b/2Term.xcodeproj/kelvin.pbxuser
index 49baf20..f7178fc 100644
--- a/2Term.xcodeproj/kelvin.pbxuser
+++ b/2Term.xcodeproj/kelvin.pbxuser
@@ -34,7 +34,7 @@
B676069511DEC97D00D6B66C /* TermWindowController.m:97 */,
B67606B011DECD4E00D6B66C /* TermWindowController.m:97 */,
B676070811DF8F4100D6B66C /* TermWindowController.m:97 */,
- B65FA27911E29E8D00EB447E /* EmulatorView.mm:66 */,
+ B65FA27911E29E8D00EB447E /* EmulatorView.mm:67 */,
B649E13D11E2BC7A0061921F /* VT52View.mm:460 */,
B649E15211E2BF130061921F /* VT52View.mm:107 */,
B649E17111E2C3C50061921F /* VT52View.mm:598 */,
@@ -125,6 +125,11 @@
PBXWorkspaceStateSaveDate = 300409198;
};
perUserProjectItems = {
+ B60EBCED11E7F6BE00C1974F /* PBXTextBookmark */ = B60EBCED11E7F6BE00C1974F /* PBXTextBookmark */;
+ B60EBCEE11E7F6BE00C1974F /* PBXTextBookmark */ = B60EBCEE11E7F6BE00C1974F /* PBXTextBookmark */;
+ B60EBCEF11E7F6BE00C1974F /* PBXTextBookmark */ = B60EBCEF11E7F6BE00C1974F /* PBXTextBookmark */;
+ B60EBCF011E7F6BE00C1974F /* PBXTextBookmark */ = B60EBCF011E7F6BE00C1974F /* PBXTextBookmark */;
+ B60EBCFF11E7F73B00C1974F /* PBXTextBookmark */ = B60EBCFF11E7F73B00C1974F /* PBXTextBookmark */;
B649E0B511E2A88D0061921F = B649E0B511E2A88D0061921F /* PBXTextBookmark */;
B65FA28111E29EDE00EB447E = B65FA28111E29EDE00EB447E /* PBXTextBookmark */;
B65FA2FE11E2A5D200EB447E = B65FA2FE11E2A5D200EB447E /* PBXTextBookmark */;
@@ -174,6 +179,56 @@
B676053511DADB8100D6B66C /* 2Term */,
);
};
+ B60EBCED11E7F6BE00C1974F /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B699A02E11E528BC00F54CC8 /* Screen.h */;
+ name = "Screen.h: 22";
+ rLen = 0;
+ rLoc = 304;
+ rType = 0;
+ vrLen = 946;
+ vrLoc = 454;
+ };
+ B60EBCEE11E7F6BE00C1974F /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B67606D911DF6DAB00D6B66C /* EmulatorView.mm */;
+ name = "EmulatorView.mm: 30";
+ rLen = 0;
+ rLoc = 399;
+ rType = 0;
+ vrLen = 542;
+ vrLoc = 217;
+ };
+ B60EBCEF11E7F6BE00C1974F /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B67606D811DF6DAB00D6B66C /* EmulatorView.h */;
+ name = "EmulatorView.h: 47";
+ rLen = 0;
+ rLoc = 745;
+ rType = 0;
+ vrLen = 538;
+ vrLoc = 391;
+ };
+ B60EBCF011E7F6BE00C1974F /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B67606D811DF6DAB00D6B66C /* EmulatorView.h */;
+ name = "EmulatorView.h: 48";
+ rLen = 0;
+ rLoc = 745;
+ rType = 0;
+ vrLen = 558;
+ vrLoc = 391;
+ };
+ B60EBCFF11E7F73B00C1974F /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B67606D811DF6DAB00D6B66C /* EmulatorView.h */;
+ name = "EmulatorView.h: 48";
+ rLen = 0;
+ rLoc = 745;
+ rType = 0;
+ vrLen = 558;
+ vrLoc = 391;
+ };
B649E0B511E2A88D0061921F /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = B6EBE2B411E0EA9100EA0458 /* CharacterGenerator.m */;
@@ -292,7 +347,7 @@
originalNumberOfMultipleMatches = 1;
state = 2;
};
- B65FA27911E29E8D00EB447E /* EmulatorView.mm:66 */ = {
+ B65FA27911E29E8D00EB447E /* EmulatorView.mm:67 */ = {
isa = PBXFileBreakpoint;
actions = (
);
@@ -304,7 +359,7 @@
functionName = "-drawRect:";
hitCount = 0;
ignoreCount = 0;
- lineNumber = 66;
+ lineNumber = 67;
location = 2Term;
modificationTime = 300336184.692614;
originalNumberOfMultipleMatches = 1;
@@ -895,16 +950,16 @@
};
B67606D811DF6DAB00D6B66C /* EmulatorView.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {1249, 955}}";
- sepNavSelRange = "{720, 0}";
- sepNavVisRange = "{0, 929}";
+ sepNavIntBoundsRect = "{{0, 0}, {653, 832}}";
+ sepNavSelRange = "{745, 0}";
+ sepNavVisRange = "{391, 558}";
};
};
B67606D911DF6DAB00D6B66C /* EmulatorView.mm */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {1249, 3666}}";
- sepNavSelRange = "{438, 0}";
- sepNavVisRange = "{0, 1201}";
+ sepNavIntBoundsRect = "{{0, 0}, {653, 3744}}";
+ sepNavSelRange = "{399, 0}";
+ sepNavVisRange = "{217, 542}";
};
};
B676070811DF8F4100D6B66C /* TermWindowController.m:97 */ = {
@@ -927,9 +982,9 @@
};
B699A02E11E528BC00F54CC8 /* Screen.h */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {653, 2197}}";
+ sepNavIntBoundsRect = "{{0, 0}, {653, 2119}}";
sepNavSelRange = "{304, 0}";
- sepNavVisRange = "{454, 952}";
+ sepNavVisRange = "{454, 946}";
};
};
B699A02F11E528BC00F54CC8 /* Screen.cpp */ = {
diff --git a/2Term.xcodeproj/kelvin.perspectivev3 b/2Term.xcodeproj/kelvin.perspectivev3
index 6ee44ae..6bf746d 100644
--- a/2Term.xcodeproj/kelvin.perspectivev3
+++ b/2Term.xcodeproj/kelvin.perspectivev3
@@ -284,8 +284,8 @@
PBXSmartGroupTreeModuleOutlineStateSelectionKey
- 4
- 1
+ 21
+ 16
0
@@ -307,7 +307,7 @@
324
RubberWindowFrame
- 494 147 1060 902 0 0 1920 1178
+ 347 111 1060 902 0 0 1920 1178
Module
PBXSmartGroupTreeModule
@@ -323,7 +323,7 @@
PBXProjectModuleGUID
B676054211DADB9000D6B66C
PBXProjectModuleLabel
- Screen.h
+ EmulatorView.h
PBXSplitModuleInNavigatorKey
Split0
@@ -331,11 +331,11 @@
PBXProjectModuleGUID
B676054311DADB9000D6B66C
PBXProjectModuleLabel
- Screen.h
+ EmulatorView.h
_historyCapacity
0
bookmark
- B6697A6311E7E0F3002ED475
+ B60EBCFF11E7F73B00C1974F
history
B676058811DAE21100D6B66C
@@ -355,7 +355,6 @@
B669796311E6A606002ED475
B669797711E6A6CE002ED475
B66979BD11E6ACB9002ED475
- B66979FE11E6BEC3002ED475
B6697A1A11E6C28A002ED475
B6697A1B11E6C28A002ED475
B6697A5211E7E072002ED475
@@ -367,7 +366,9 @@
B6697A5811E7E072002ED475
B6697A5911E7E072002ED475
B6697A5A11E7E072002ED475
- B6697A5B11E7E072002ED475
+ B60EBCED11E7F6BE00C1974F
+ B60EBCEE11E7F6BE00C1974F
+ B60EBCEF11E7F6BE00C1974F
SplitCount
@@ -381,18 +382,18 @@
GeometryConfiguration
Frame
- {{0, 0}, {714, 454}}
+ {{0, 0}, {714, 444}}
RubberWindowFrame
- 494 147 1060 902 0 0 1920 1178
+ 347 111 1060 902 0 0 1920 1178
Module
PBXNavigatorGroup
Proportion
- 454pt
+ 444pt
Proportion
- 402pt
+ 412pt
Tabs
@@ -406,7 +407,9 @@
GeometryConfiguration
Frame
- {{10, 27}, {714, 375}}
+ {{10, 27}, {714, 385}}
+ RubberWindowFrame
+ 347 111 1060 902 0 0 1920 1178
Module
XCDetailModule
@@ -437,11 +440,11 @@
PBXCVSModuleTreeModuleColumnWidthsKey
200
- 56.66162109375
+ 56
63
60
63
- 139.556640625
+ 139
PBXCVSModuleTreeModuleColumnsKey
@@ -482,8 +485,6 @@
Frame
{{10, 27}, {714, 375}}
- RubberWindowFrame
- 494 147 1060 902 0 0 1920 1178
Module
PBXBuildResultsModule
@@ -511,11 +512,11 @@
TableOfContents
- B669791311E68B9C002ED475
+ B60EBCF111E7F6BE00C1974F
1CA23ED40692098700951B8B
- B669791411E68B9C002ED475
+ B60EBCF211E7F6BE00C1974F
B676054211DADB9000D6B66C
- B669791511E68B9C002ED475
+ B60EBCF311E7F6BE00C1974F
1CA23EDF0692099D00951B8B
1CA23EE00692099D00951B8B
1CA23EE10692099D00951B8B
@@ -664,14 +665,14 @@
TableOfContents
- B669791611E68B9C002ED475
+ B60EBCF411E7F6BE00C1974F
1CCC7628064C1048000F2A68
1CCC7629064C1048000F2A68
- B669791711E68B9C002ED475
- B669791811E68B9C002ED475
- B669791911E68B9C002ED475
- B669791A11E68B9C002ED475
- B669791B11E68B9C002ED475
+ B60EBCF511E7F6BE00C1974F
+ B60EBCF611E7F6BE00C1974F
+ B60EBCF711E7F6BE00C1974F
+ B60EBCF811E7F6BE00C1974F
+ B60EBCF911E7F6BE00C1974F
ToolbarConfigUserDefaultsMinorVersion
2
@@ -705,14 +706,13 @@
5
WindowOrderList
- B669796711E6A606002ED475
- B669796811E6A606002ED475
+ B60EBCFB11E7F6BE00C1974F
+ B60EBCFC11E7F6BE00C1974F
/Users/kelvin/Projects/2Term/2Term.xcodeproj
- B6697A5E11E7E072002ED475
- B6697A5D11E7E072002ED475
+ B60EBCFA11E7F6BE00C1974F
WindowString
- 494 147 1060 902 0 0 1920 1178
+ 347 111 1060 902 0 0 1920 1178
WindowToolsV3
diff --git a/EmulatorView.h b/EmulatorView.h
index 1f6389d..392c655 100644
--- a/EmulatorView.h
+++ b/EmulatorView.h
@@ -34,6 +34,7 @@
NSColor *_backgroundColor;
NSColor *_foregroundColor;
+ NSColor *_boldColor;
CGFloat _charHeight;
CGFloat _charWidth;
diff --git a/EmulatorView.mm b/EmulatorView.mm
index 104b993..7f36890 100644
--- a/EmulatorView.mm
+++ b/EmulatorView.mm
@@ -33,7 +33,8 @@
_foregroundColor = [[NSColor greenColor] retain];
_backgroundColor = [[NSColor blackColor] retain];
-
+ _boldColor = [[NSColor redColor] retain];
+
_charGen = [[CharacterGenerator generator] retain];
_emulator = [VT52 new];
@@ -67,6 +68,12 @@
NSRect screenRect = dirtyRect;
unsigned x, y;
+ unsigned lastFlag = 0;
+
+
+ NSColor *currentFront;
+ NSColor *currentBack;
+ unsigned currentFlag;
screenRect.origin.x -= _paddingLeft;
screenRect.origin.y -= _paddingTop;
@@ -98,6 +105,10 @@
[_foregroundColor setFill];
+ currentFront = _foregroundColor;
+ currentBack = _backgroundColor;
+ currentFlag = Screen::FlagNormal;
+
_screen.lock();
@@ -105,14 +116,39 @@
{
for (y = minY; y <= maxY; ++y)
{
+ NSRect charRect = NSMakeRect(_paddingLeft + x * _charWidth, _paddingTop + y *_charHeight, _charWidth, _charHeight);
NSImage *img;
CharInfo ci = _screen.getc(x, y);
// todo -- check flags to determine fg/bg color, etc.
-
+ // need to draw background individually....
+ if (currentFlag != ci.flag)
+ {
+ currentFlag = ci.flag;
+
+ currentBack = _backgroundColor;
+ currentFront = _foregroundColor;
+ if (lastFlag & Screen::FlagBold)
+ currentFront = _boldColor;
+
+ if (lastFlag & Screen::FlagInverse)
+ {
+ std::swap(currentFront, currentBack);
+ }
+
+ if (currentFront != _foregroundColor)
+ [currentFront setFill];
+ }
img = [_charGen imageForCharacter: ci.c];
+ if (currentBack != _backgroundColor)
+ {
+ [currentBack setFill];
+ NSRectFill(charRect);
+ [currentFront setFill];
+ }
+
/*
[img drawAtPoint: NSMakePoint(x * _charWidth, y * _charHeight)
fromRect: NSZeroRect
@@ -121,7 +157,7 @@
*/
if (img)
{
- [img drawInRect: NSMakeRect(_paddingLeft + x * _charWidth, _paddingTop + y *_charHeight, _charWidth, _charHeight)
+ [img drawInRect: charRect
fromRect: NSZeroRect operation: NSCompositeCopy
fraction: 1.0
respectFlipped: YES