2010-07-08 22:26:58 +00:00
|
|
|
//
|
|
|
|
// EmulatorView.h
|
|
|
|
// 2Term
|
|
|
|
//
|
|
|
|
// Created by Kelvin Sherlock on 7/3/2010.
|
|
|
|
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
2010-07-09 01:18:30 +00:00
|
|
|
#include "Emulator.h"
|
|
|
|
|
|
|
|
#include "iGeometry.h"
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2010-07-09 01:18:30 +00:00
|
|
|
#include "Screen.h"
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2017-01-26 04:47:35 +00:00
|
|
|
#include "ring_buffer.h"
|
|
|
|
|
2010-07-12 02:18:37 +00:00
|
|
|
@class EmulatorView;
|
2010-09-11 20:27:26 +00:00
|
|
|
|
2010-07-12 02:18:37 +00:00
|
|
|
class ViewScreen: public Screen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void setSize(unsigned width, unsigned height);
|
2011-02-05 02:21:34 +00:00
|
|
|
virtual void setCursorType(CursorType cursorType);
|
2010-07-12 02:18:37 +00:00
|
|
|
|
|
|
|
void setSize(unsigned width, unsigned height, bool resizeView);
|
|
|
|
|
|
|
|
void setView(EmulatorView *view) { _view = view; }
|
|
|
|
void setFD(int fd) { _fd = fd; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
EmulatorView *_view;
|
|
|
|
int _fd;
|
|
|
|
};
|
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2010-07-09 01:18:30 +00:00
|
|
|
#endif
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
@class CharacterGenerator;
|
|
|
|
|
|
|
|
@interface EmulatorView : NSView {
|
2010-07-09 01:18:30 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
int _fd;
|
|
|
|
|
2010-07-09 01:18:30 +00:00
|
|
|
NSObject<Emulator> *_emulator;
|
2012-08-04 23:05:10 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
CharacterGenerator *_charGen;
|
|
|
|
|
|
|
|
NSColor *_backgroundColor;
|
|
|
|
NSColor *_foregroundColor;
|
2010-07-10 16:15:09 +00:00
|
|
|
NSColor *_boldColor;
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
CGFloat _charHeight;
|
|
|
|
CGFloat _charWidth;
|
2010-07-09 01:18:30 +00:00
|
|
|
|
|
|
|
CGFloat _paddingTop;
|
|
|
|
CGFloat _paddingBottom;
|
|
|
|
CGFloat _paddingLeft;
|
|
|
|
CGFloat _paddingRight;
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2010-07-12 02:18:37 +00:00
|
|
|
NSImage *_cursorImg;
|
|
|
|
NSTimer *_cursorTimer;
|
|
|
|
BOOL _cursorOn;
|
2010-12-20 23:37:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
BOOL _scanLines;
|
|
|
|
BOOL _inResizeTo;
|
|
|
|
|
2011-02-06 18:29:42 +00:00
|
|
|
unsigned _cursorType;
|
2010-07-11 15:26:53 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2017-02-05 18:15:34 +00:00
|
|
|
ring_buffer<1024> _debug_buffer;
|
2010-07-12 02:18:37 +00:00
|
|
|
ViewScreen _screen;
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-12-20 23:37:02 +00:00
|
|
|
@property (nonatomic, assign) BOOL scanLines;
|
2016-07-06 17:15:13 +00:00
|
|
|
@property (atomic, assign) int fd;
|
2011-02-06 18:29:42 +00:00
|
|
|
@property (nonatomic, assign) unsigned cursorType;
|
2010-12-20 23:37:02 +00:00
|
|
|
|
|
|
|
@property (nonatomic, retain) NSColor *foregroundColor;
|
|
|
|
@property (nonatomic, retain) NSColor *backgroundColor;
|
2010-10-05 18:56:45 +00:00
|
|
|
@property (nonatomic, retain) NSObject<Emulator> *emulator;
|
|
|
|
|
2010-09-11 20:27:26 +00:00
|
|
|
//@property (nonatomic, assign) iPoint cursor;
|
|
|
|
|
2010-07-11 15:26:53 +00:00
|
|
|
-(void)invalidateIRect: (iRect)rect;
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2011-01-11 04:34:57 +00:00
|
|
|
//-(void)resizeTo: (iSize)size;
|
|
|
|
-(void)resizeTo: (iSize)size animated: (BOOL)animated;
|
2010-07-12 02:18:37 +00:00
|
|
|
|
2011-02-05 02:21:34 +00:00
|
|
|
|
2010-09-11 20:27:26 +00:00
|
|
|
|
|
|
|
-(void)autoTypeText: (NSString *)text;
|
|
|
|
|
|
|
|
-(IBAction)paste: (id)sender;
|
|
|
|
-(IBAction)copy: (id)sender;
|
2017-01-26 04:47:35 +00:00
|
|
|
-(IBAction)copyDebugData:(id)sender;
|
|
|
|
-(IBAction)clearDebugData:(id)sender;
|
2010-09-11 20:27:26 +00:00
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2016-07-06 17:15:13 +00:00
|
|
|
-(void)processData: (const uint8_t *)data size: (size_t)size;
|
|
|
|
-(void)childFinished: (int)status;
|
2010-07-08 22:26:58 +00:00
|
|
|
@end
|
2011-01-20 02:33:46 +00:00
|
|
|
|
|
|
|
|
2011-02-06 18:29:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
@interface EmulatorView (Cursor)
|
|
|
|
|
|
|
|
-(void)stopCursorTimer;
|
|
|
|
-(void)cursorTimer: (NSTimer *)timer;
|
|
|
|
-(void)startCursorTimer;
|
|
|
|
|
|
|
|
|
2017-01-26 04:47:35 +00:00
|
|
|
@end
|