[Scopeapp-cvs]scopeapp/src ScopeController.m,1.8,1.9 ScopeView.h,1.8,1.9 ScopeView.m,1.11,1.12 Trace
Status: Alpha
Brought to you by:
narge
From: <sco...@li...> - 2002-10-29 05:50:14
|
Update of /cvsroot/scopeapp/scopeapp/src In directory usw-pr-cvs1:/tmp/cvs-serv26901 Modified Files: ScopeController.m ScopeView.h ScopeView.m TraceView.m XYPlotView.h XYPlotView.m Log Message: Remove gnustep-specific code (will be merged back in when gnustep version works properly) Index: ScopeController.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/ScopeController.m,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ScopeController.m 19 Oct 2002 06:39:31 -0000 1.8 --- ScopeController.m 29 Oct 2002 05:50:11 -0000 1.9 *************** *** 29,43 **** #import "ScopeController.h" ! @interface ScopeController (ScopeControllerInternal) ! ! // create the trace window which is managed by this ScopeController, ! // with the appropriate subviews ! -(id) createTraceWindow; ! ! // create the NSPanel containing all the controls for this ! // ScopeController's trace views ! -(id) createControlPanel; ! ! @end @implementation ScopeController --- 29,37 ---- #import "ScopeController.h" ! enum { ! eOscilloscopeTab = 0, ! eXYPlotTab, ! eSpectrumTab ! }; @implementation ScopeController *************** *** 45,49 **** -(id) initWithSampler: (id <InputSampler, NSObject>) sampler { ! self = [super initWithWindow: nil]; if(self != nil) --- 39,43 ---- -(id) initWithSampler: (id <InputSampler, NSObject>) sampler { ! self = [super initWithWindowNibName: @"ScopeWindow"]; if(self != nil) *************** *** 52,63 **** mySampler = sampler; ! if(mySampler != nil) ! { ! [mySampler retain]; ! } ! ! [self createTraceWindow]; ! [self createControlPanel]; ! [self windowDidLoad]; // would be called when loading from nib nCenter = [NSNotificationCenter defaultCenter]; --- 46,50 ---- mySampler = sampler; ! [mySampler retain]; nCenter = [NSNotificationCenter defaultCenter]; *************** *** 66,70 **** [nCenter addObserver: self selector: @selector(windowResignedMain:) name: @"NSWindowDidResignMain" object: [self window]]; - } --- 53,56 ---- *************** *** 88,93 **** // selectTabViewItemAtIndex: will ever call // tabView:didSelectTabViewItem: ! [myModeTabs selectTabViewItem: myScopeTab]; ! [self tabView: myModeTabs didSelectTabViewItem: myScopeTab]; [myModeTabs setDelegate: self]; } --- 74,80 ---- // selectTabViewItemAtIndex: will ever call // tabView:didSelectTabViewItem: ! [myModeTabs selectTabViewItemAtIndex: eOscilloscopeTab]; ! [self tabView: myModeTabs didSelectTabViewItem: ! [myModeTabs tabViewItemAtIndex: eOscilloscopeTab]]; [myModeTabs setDelegate: self]; } *************** *** 116,122 **** --- 103,113 ---- } + -(void) tabViewDidChangeNumberOfTabViewItems: (NSTabView*) tabView { } + -(void) tabView: (NSTabView *) tabView didSelectTabViewItem: (NSTabViewItem *) tabViewItem; { + int newTab = [tabView indexOfTabViewItem: tabViewItem]; + // assert that the tab view that has been switched is the mode tabs if(tabView != myModeTabs) { return; } *************** *** 131,230 **** // show and start drawing in the new active view ! if(tabViewItem == myScopeTab) { [[[self window] contentView] addSubview: myScopeView]; [myScopeView startDrawingWithSampler: mySampler]; ! } ! else if(tabViewItem == myXYPlotTab) ! { [[[self window] contentView] addSubview: myXYPlotView]; [myXYPlotView startDrawingWithSampler: mySampler]; ! } ! else if(tabViewItem == myXYPlotTab) ! { } } - @end - - @implementation ScopeController (ScopeControllerInternal) ! - createTraceWindow ! { ! NSWindow* window; ! NSRect rect = NSMakeRect(0, 0, 400, 400); ! unsigned int flags; ! ! // create the window ! flags = (NSTitledWindowMask | NSClosableWindowMask | ! NSMiniaturizableWindowMask | NSResizableWindowMask); ! window = [[NSWindow alloc] initWithContentRect: rect ! styleMask: flags ! backing: NSBackingStoreBuffered ! defer: YES]; ! [window setTitle: _(@"MacCRO X")]; ! // FIXME move the window to an appropriate position ! // [window setFrameTopLeftPoint: NSMakePoint(20, 63)]; ! [window setMinSize: NSMakeSize(400, 422)]; ! [window setFrameAutosaveName: @"TraceWindow"]; ! [window setFrameUsingName: @"TraceWindow"]; ! ! // create the trace views ! // these are not placed in the window yet; that will be ! // done when a tab is selected in the control panel ! myScopeView = [[ScopeView alloc] initWithFrame: rect]; ! [myScopeView awakeFromNib]; ! [myScopeView autorelease]; ! ! myXYPlotView = [[XYPlotView alloc] initWithFrame: rect]; ! [myXYPlotView awakeFromNib]; ! [myXYPlotView autorelease]; ! ! // now claim control of the window ! [self setWindow: window]; ! [window release]; ! ! return self; ! } ! ! - createControlPanel { ! // the layout-related magic numbers in this code ! // were determined by running nibtool -a on the ! // original nib file. If you change them, be sure ! // that the interface still looks right. ! NSRect rect; ! unsigned int flags; ! ! // Create the panel ! rect = NSMakeRect(82, 158, 713, 375); ! flags = (NSTitledWindowMask | NSMiniaturizableWindowMask | ! NSUtilityWindowMask); ! myControlPanel = [[NSPanel alloc] initWithContentRect: rect ! styleMask: flags ! backing: NSBackingStoreBuffered ! defer: YES]; ! [myControlPanel setTitle: _(@"Display Controls")]; ! [myControlPanel setFrameAutosaveName: @"ControlPanel"]; ! [myControlPanel setFrameUsingName: @"ControlPanel"]; ! ! // Create the mode tab view ! rect = NSMakeRect(-11, -7, 735, 372); ! myModeTabs = [[NSTabView alloc] initWithFrame: rect]; ! [[myControlPanel contentView] addSubview: myModeTabs]; ! ! // add and populate the tabs ! myScopeTab = [[NSTabViewItem alloc] init]; ! [myScopeTab setLabel: _(@"Oscilloscope")]; ! [myScopeView createControls: [myScopeTab view]]; ! [myModeTabs addTabViewItem: myScopeTab]; ! ! myXYPlotTab = [[NSTabViewItem alloc] init]; ! [myXYPlotTab setLabel: _(@"X/Y Plot")]; ! [myXYPlotView createControls: [myXYPlotTab view]]; ! [myModeTabs addTabViewItem: myXYPlotTab]; ! ! return self; } @end --- 122,149 ---- // show and start drawing in the new active view ! switch(newTab) { + case eOscilloscopeTab: [[[self window] contentView] addSubview: myScopeView]; [myScopeView startDrawingWithSampler: mySampler]; ! break; ! case eXYPlotTab: [[[self window] contentView] addSubview: myXYPlotView]; [myXYPlotView startDrawingWithSampler: mySampler]; ! break; ! case eSpectrumTab: ! break; } } ! -(BOOL) tabView: (NSTabView*) tabView ! shouldSelectTabViewItem: (NSTabViewItem*) tabViewItem { ! return YES; } + + -(void) tabView: (NSTabView*) tabView + willSelectTabViewItem: (NSTabViewItem*) tabViewItem { } @end Index: ScopeView.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/ScopeView.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ScopeView.h 19 Oct 2002 06:39:31 -0000 1.8 --- ScopeView.h 29 Oct 2002 05:50:11 -0000 1.9 *************** *** 80,85 **** -(id) updateControls; - -(id) createControls: (NSView*) parentView; - - (id)doTriggerOnData: (Sample*[2]) inData frameCount: (unsigned long) inFrameCount --- 80,83 ---- Index: ScopeView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/ScopeView.m,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ScopeView.m 19 Oct 2002 06:39:31 -0000 1.11 --- ScopeView.m 29 Oct 2002 05:50:11 -0000 1.12 *************** *** 26,29 **** --- 26,35 ---- #import "ScopeView.h" + #import "ScopeAppGlobals.h" + + #ifdef __APPLE__ + #import "GSVbox.h" + #import "GSHbox.h" + #endif static double gTimeScales[10] = {0.001,0.002,0.005,0.01,0.02,0.05,0.1}; *************** *** 349,357 **** return self; - } - - -(id) createControls: (NSView*) parentView - { - #warning } --- 355,358 ---- Index: TraceView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/TraceView.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TraceView.m 19 Oct 2002 06:39:31 -0000 1.5 --- TraceView.m 29 Oct 2002 05:50:11 -0000 1.6 *************** *** 328,338 **** [self updateDisplay: 0]; [self updateDisplay: 1]; ! ! // Override for what seems to be a bug in gnustep ! #ifdef __APPLE__ [self display]; ! #else ! [self setNeedsDisplay: YES]; ! #endif [myDrawThreadState unlock]; } --- 328,334 ---- [self updateDisplay: 0]; [self updateDisplay: 1]; ! [self display]; ! [myDrawThreadState unlock]; } Index: XYPlotView.h =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/XYPlotView.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XYPlotView.h 19 Oct 2002 06:39:31 -0000 1.3 --- XYPlotView.h 29 Oct 2002 05:50:11 -0000 1.4 *************** *** 56,61 **** -(id) updateControls; - -(id) createControls: (NSView*) parentView; - @end --- 56,59 ---- Index: XYPlotView.m =================================================================== RCS file: /cvsroot/scopeapp/scopeapp/src/XYPlotView.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XYPlotView.m 19 Oct 2002 06:39:31 -0000 1.6 --- XYPlotView.m 29 Oct 2002 05:50:11 -0000 1.7 *************** *** 85,93 **** -(id) updateControls { return self; } - -(id) createControls: (NSView*) parentView - { - #warning - } - - (id)updateDisplay: (int) inTrace { --- 85,88 ---- |