git-svn-id: svn://qnap.local/TwoTerm/trunk@1654 5590a31f-7b70-45f8-8c82-aa3a8e5f4507

This commit is contained in:
Kelvin Sherlock 2010-07-10 16:15:09 +00:00
parent 2249c8af33
commit c9d5afde27
4 changed files with 137 additions and 45 deletions

View File

@ -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 */ = {

View File

@ -284,8 +284,8 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>4</integer>
<integer>1</integer>
<integer>21</integer>
<integer>16</integer>
<integer>0</integer>
</array>
</array>
@ -307,7 +307,7 @@
<real>324</real>
</array>
<key>RubberWindowFrame</key>
<string>494 147 1060 902 0 0 1920 1178 </string>
<string>347 111 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
@ -323,7 +323,7 @@
<key>PBXProjectModuleGUID</key>
<string>B676054211DADB9000D6B66C</string>
<key>PBXProjectModuleLabel</key>
<string>Screen.h</string>
<string>EmulatorView.h</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -331,11 +331,11 @@
<key>PBXProjectModuleGUID</key>
<string>B676054311DADB9000D6B66C</string>
<key>PBXProjectModuleLabel</key>
<string>Screen.h</string>
<string>EmulatorView.h</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>B6697A6311E7E0F3002ED475</string>
<string>B60EBCFF11E7F73B00C1974F</string>
<key>history</key>
<array>
<string>B676058811DAE21100D6B66C</string>
@ -355,7 +355,6 @@
<string>B669796311E6A606002ED475</string>
<string>B669797711E6A6CE002ED475</string>
<string>B66979BD11E6ACB9002ED475</string>
<string>B66979FE11E6BEC3002ED475</string>
<string>B6697A1A11E6C28A002ED475</string>
<string>B6697A1B11E6C28A002ED475</string>
<string>B6697A5211E7E072002ED475</string>
@ -367,7 +366,9 @@
<string>B6697A5811E7E072002ED475</string>
<string>B6697A5911E7E072002ED475</string>
<string>B6697A5A11E7E072002ED475</string>
<string>B6697A5B11E7E072002ED475</string>
<string>B60EBCED11E7F6BE00C1974F</string>
<string>B60EBCEE11E7F6BE00C1974F</string>
<string>B60EBCEF11E7F6BE00C1974F</string>
</array>
</dict>
<key>SplitCount</key>
@ -381,18 +382,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {714, 454}}</string>
<string>{{0, 0}, {714, 444}}</string>
<key>RubberWindowFrame</key>
<string>494 147 1060 902 0 0 1920 1178 </string>
<string>347 111 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>454pt</string>
<string>444pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>402pt</string>
<string>412pt</string>
<key>Tabs</key>
<array>
<dict>
@ -406,7 +407,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {714, 375}}</string>
<string>{{10, 27}, {714, 385}}</string>
<key>RubberWindowFrame</key>
<string>347 111 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>XCDetailModule</string>
@ -437,11 +440,11 @@
<key>PBXCVSModuleTreeModuleColumnWidthsKey</key>
<array>
<real>200</real>
<real>56.66162109375</real>
<real>56</real>
<real>63</real>
<real>60</real>
<real>63</real>
<real>139.556640625</real>
<real>139</real>
</array>
<key>PBXCVSModuleTreeModuleColumnsKey</key>
<array>
@ -482,8 +485,6 @@
<dict>
<key>Frame</key>
<string>{{10, 27}, {714, 375}}</string>
<key>RubberWindowFrame</key>
<string>494 147 1060 902 0 0 1920 1178 </string>
</dict>
<key>Module</key>
<string>PBXBuildResultsModule</string>
@ -511,11 +512,11 @@
</array>
<key>TableOfContents</key>
<array>
<string>B669791311E68B9C002ED475</string>
<string>B60EBCF111E7F6BE00C1974F</string>
<string>1CA23ED40692098700951B8B</string>
<string>B669791411E68B9C002ED475</string>
<string>B60EBCF211E7F6BE00C1974F</string>
<string>B676054211DADB9000D6B66C</string>
<string>B669791511E68B9C002ED475</string>
<string>B60EBCF311E7F6BE00C1974F</string>
<string>1CA23EDF0692099D00951B8B</string>
<string>1CA23EE00692099D00951B8B</string>
<string>1CA23EE10692099D00951B8B</string>
@ -664,14 +665,14 @@
</array>
<key>TableOfContents</key>
<array>
<string>B669791611E68B9C002ED475</string>
<string>B60EBCF411E7F6BE00C1974F</string>
<string>1CCC7628064C1048000F2A68</string>
<string>1CCC7629064C1048000F2A68</string>
<string>B669791711E68B9C002ED475</string>
<string>B669791811E68B9C002ED475</string>
<string>B669791911E68B9C002ED475</string>
<string>B669791A11E68B9C002ED475</string>
<string>B669791B11E68B9C002ED475</string>
<string>B60EBCF511E7F6BE00C1974F</string>
<string>B60EBCF611E7F6BE00C1974F</string>
<string>B60EBCF711E7F6BE00C1974F</string>
<string>B60EBCF811E7F6BE00C1974F</string>
<string>B60EBCF911E7F6BE00C1974F</string>
</array>
<key>ToolbarConfigUserDefaultsMinorVersion</key>
<string>2</string>
@ -705,14 +706,13 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>B669796711E6A606002ED475</string>
<string>B669796811E6A606002ED475</string>
<string>B60EBCFB11E7F6BE00C1974F</string>
<string>B60EBCFC11E7F6BE00C1974F</string>
<string>/Users/kelvin/Projects/2Term/2Term.xcodeproj</string>
<string>B6697A5E11E7E072002ED475</string>
<string>B6697A5D11E7E072002ED475</string>
<string>B60EBCFA11E7F6BE00C1974F</string>
</array>
<key>WindowString</key>
<string>494 147 1060 902 0 0 1920 1178 </string>
<string>347 111 1060 902 0 0 1920 1178 </string>
<key>WindowToolsV3</key>
<array>
<dict>

View File

@ -34,6 +34,7 @@
NSColor *_backgroundColor;
NSColor *_foregroundColor;
NSColor *_boldColor;
CGFloat _charHeight;
CGFloat _charWidth;

View File

@ -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