slow progress in getting things to work

This commit is contained in:
Bill Currie 2010-09-20 03:06:35 +09:00
parent a229f20525
commit 7f5a68023b
7 changed files with 80 additions and 70 deletions

View file

@ -32,7 +32,8 @@ tile
Adjust the size for the pop up scale menu
=================
*/ -tile
*/
-tile
{
NSRect scrollerframe;
NSRect buttonframe, buttonframe2;
@ -44,7 +45,7 @@ Adjust the size for the pop up scale menu
scrollerframe =[_horizScroller frame];
newframe.origin.y = scrollerframe.origin.y;
newframe.origin.x = scrollerframe.size.width - buttonframe.size.width;
newframe.origin.x = scrollerframe.origin.x + scrollerframe.size.width - buttonframe.size.width;
newframe.size.width = buttonframe.size.width;
newframe.size.height = scrollerframe.size.height;
scrollerframe.size.width -= newframe.size.width;

View file

@ -55,10 +55,10 @@ void XYlineto (vec3_t pt);
-setDrawMode:(drawmode_t) mode;
-newSuperBounds;
-newRealBounds:(NSRect *) nb;
-newRealBounds:(NSRect) nb;
-addToScrollRange: (float) x:(float) y;
-setOrigin:(NSPoint *) pt scale:(float) sc;
-setOrigin:(NSPoint) pt scale:(float) sc;
-centerOn:(vec3_t) org;

View file

@ -49,6 +49,7 @@ initWithFrame:
[scalebutton_i addItemWithTitle:@"100%"];
[scalebutton_i addItemWithTitle:@"200%"];
[scalebutton_i addItemWithTitle:@"300%"];
[scalebutton_i sizeToFit];
[scalebutton_i selectItemAtIndex:4];
@ -63,15 +64,16 @@ initWithFrame:
[gridbutton_i addItemWithTitle:@"grid 16"];
[gridbutton_i addItemWithTitle:@"grid 32"];
[gridbutton_i addItemWithTitle:@"grid 64"];
[gridbutton_i sizeToFit];
[gridbutton_i selectItemAtIndex:4];
// initialize the scroll view
scrollview_i =[[PopScrollView alloc]
initWithFrame: frameRect button1: scalebutton_i button2:gridbutton_i];
scrollview_i = [[PopScrollView alloc] initWithFrame: frameRect
button1: scalebutton_i
button2: gridbutton_i];
[scrollview_i setLineScroll:64];
[scrollview_i setAutoresizingMask:(NSViewWidthSizable |
NSViewHeightSizable)];
NSViewHeightSizable)];
// link objects together
[scrollview_i setDocumentView:self];
@ -85,10 +87,9 @@ initWithFrame:
}
-setModeRadio:m
{ // this should be set from IB, but
// because I toss myself in a
// popscrollview
// the connection gets lost
{
// this should be set from IB, but because I toss myself in a
// popscrollview the connection gets lost
mode_radio_i = m;
[mode_radio_i setTarget:self];
[mode_radio_i setAction: @selector (drawMode:)];
@ -119,20 +120,20 @@ initWithFrame:
/*
v
*/
-setOrigin:(NSPoint *)
pt scale:(float) sc
-setOrigin:(NSPoint)pt scale:(float) sc
{
NSRect sframe;
NSRect newbounds;
NSClipView *cv = (NSClipView *) _super_view;
//
// calculate the area visible in the cliprect
//
scale = sc;
sframe =[[self superview] frame];
newbounds =[[self superview] frame];
newbounds.origin = *pt;
sframe = [_super_view frame];
newbounds = [_super_view frame];
newbounds.origin = pt;
newbounds.size.width /= scale;
newbounds.size.height /= scale;
sframe.size.width /= scale;
@ -151,18 +152,19 @@ pt scale:(float) sc
//
// size this view
//
[self setBoundsSize:newbounds.size];
[self setBoundsOrigin:newbounds.origin];
[self setFrameSize:newbounds.size];
[self setFrameOrigin:newbounds.origin];
// XXX[self moveTo: newbounds.origin.x : newbounds.origin.y];
//
// scroll and scale the clip view
//
[[self superview] setBoundsSize:sframe.size];
[[self superview] setBoundsOrigin:*pt];
[cv setBoundsSize:sframe.size];
[cv scrollToPoint:pt];
// XXX[quakeed_i reenableDisplay];
[scrollview_i display];
[[_super_view superview] reflectScrolledClipView: cv];
return self;
}
@ -183,7 +185,7 @@ pt scale:(float) sc
sbounds.origin.x += delta.x;
sbounds.origin.y += delta.y;
[self setOrigin: &sbounds.origin scale:scale];
[self setOrigin: sbounds.origin scale:scale];
return self;
}
@ -199,7 +201,7 @@ When superview is resized
NSRect r;
r =[[self superview] bounds];
[self newRealBounds:&r];
[self newRealBounds:r];
return self;
}
@ -213,17 +215,23 @@ Should only change the scroll bars, not cause any redraws.
If realbounds has shrunk, nothing will change.
===================
*/
-newRealBounds:(NSRect *) nb
-newRealBounds:(NSRect) nb
{
NSRect sbounds;
realbounds = *nb;
realbounds = nb;
Sys_Printf ("realbounds: %g %g %g %g\n",
realbounds.origin.x, realbounds.origin.y,
realbounds.size.width, realbounds.size.height);
//
// calculate the area visible in the cliprect
//
sbounds =[[self superview] bounds];
sbounds = NSUnionRect (*nb, sbounds);
sbounds = [[self superview] bounds];
Sys_Printf ("sbounds: %g %g %g %g\n",
sbounds.origin.x, sbounds.origin.y,
sbounds.size.width, sbounds.size.height);
sbounds = NSUnionRect (nb, sbounds);
//
// size this view
@ -231,16 +239,16 @@ If realbounds has shrunk, nothing will change.
// XXX[quakeed_i disableDisplay];
[self setPostsBoundsChangedNotifications:NO];
[self setBoundsSize:sbounds.size];
[self setBoundsOrigin:sbounds.origin];
[self setFrameSize:sbounds.size];
[self setFrameOrigin:sbounds.origin];
// XXX[self moveTo: sbounds.origin.x : sbounds.origin.y];
[self setPostsBoundsChangedNotifications:YES];
[scrollview_i reflectScrolledClipView:[scrollview_i contentView]];
// XXX[quakeed_i reenableDisplay];
[[scrollview_i horizontalScroller] display];
[[scrollview_i verticalScroller] display];
//[[scrollview_i horizontalScroller] display];
//[[scrollview_i verticalScroller] display];
return self;
}
@ -276,7 +284,7 @@ Called when the scaler popup on the window is used
visrect.origin.x -= sframe.size.width / 2 / nscale;
visrect.origin.y -= sframe.size.height / 2 / nscale;
[self setOrigin: &visrect.origin scale:nscale];
[self setOrigin: visrect.origin scale:nscale];
return self;
}
@ -317,7 +325,7 @@ zoomIn
new.x = constant->x - ofs.x / 2;
new.y = constant->y - ofs.y / 2;
[self setOrigin: &new scale:scale * 2];
[self setOrigin: new scale:scale * 2];
return self;
}
@ -358,7 +366,7 @@ zoomOut
new.x = constant->x - ofs.x * 2;
new.y = constant->y - ofs.y * 2;
[self setOrigin: &new scale:scale / 2];
[self setOrigin: new scale:scale / 2];
return self;
}
@ -444,7 +452,7 @@ superviewChanged
*/
-superviewChanged
{
[self newRealBounds:&realbounds];
[self newRealBounds:realbounds];
return self;
}
@ -705,7 +713,7 @@ drawWire
newrect.size.width += 2 * gridsize;
newrect.size.height += 2 * gridsize;
if (!NSEqualRects (newrect, realbounds))
[self newRealBounds:&newrect];
[self newRealBounds:newrect];
return self;
}
@ -788,7 +796,7 @@ NSRect xy_draw_rect;
-drawRect: (NSRect) rects
{
static float drawtime; // static to shut up compiler warning
float drawtime = 0;
if (timedrawing)
drawtime = Sys_DoubleTime ();
@ -932,7 +940,7 @@ ScrollCallback (float dx, float dy)
oldreletive.x -= dx;
oldreletive.y -= dy;
[xyview_i setOrigin: &neworg scale:scale];
[xyview_i setOrigin: neworg scale:scale];
}
-scrollDragFrom:(NSEvent *) theEvent

View file

@ -8,8 +8,8 @@ initWithFrame: button:
Initizes a scroll view with a button at it's lower right corner
====================
*/
- initWithFrame:(NSRect)
frameRect button1:b1 {
- initWithFrame:(NSRect) frameRect button1:b1
{
[super initWithFrame:frameRect];
[self addSubview:b1];
@ -29,7 +29,8 @@ tile
Adjust the size for the pop up scale menu
=================
*/ -tile
*/
-tile
{
NSRect scrollerframe;
@ -39,6 +40,7 @@ Adjust the size for the pop up scale menu
scrollerframe.size.width = 0;
[_horizScroller setFrame:scrollerframe];
[_horizScroller setHidden:YES];
return self;
}

View file

@ -41,8 +41,7 @@ extern float zplanedir;
-setXYOrigin:(NSPoint *) pt;
-setOrigin:(NSPoint *)
pt scale:(float) sc;
-setOrigin:(NSPoint) pt scale:(float) sc;
@end
#endif // ZView_h

View file

@ -52,16 +52,15 @@ initWithFrame:
[zscalebutton_i addItemWithTitle:@"300%"];
[zscalebutton_i selectItemAtIndex:4];
// initialize the scroll view
zscrollview_i =[[ZScrollView alloc]
initWithFrame: frameRect button1:zscalebutton_i];
zscrollview_i =[[ZScrollView alloc] initWithFrame: frameRect
button1: zscalebutton_i];
[zscrollview_i setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
NSViewHeightSizable];
[zscrollview_i setDocumentView:self];
// [_super_view setDrawOrigin: 0 : 0];
//[_super_view setBoundsOrigin: NSMakePoint (0, 0)];
minheight = 0;
maxheight = 64;
@ -71,7 +70,7 @@ initWithFrame:
[self newRealBounds];
[self setOrigin: &pt scale:1];
[self setOrigin: pt scale:1];
return zscrollview_i;
}
@ -93,8 +92,7 @@ initWithFrame:
setOrigin:scale:
===================
*/
-setOrigin:(NSPoint *)
pt scale:(float) sc
-setOrigin:(NSPoint) pt scale:(float) sc
{
NSRect sframe;
NSRect newbounds;
@ -104,9 +102,9 @@ pt scale:(float) sc
//
scale = sc;
sframe =[_super_view frame];
newbounds =[_super_view frame];
newbounds.origin = *pt;
sframe =[self frame];
newbounds =[self frame];
newbounds.origin = pt;
newbounds.size.width /= scale;
newbounds.size.height /= scale;
@ -130,7 +128,8 @@ pt scale:(float) sc
// size this view
//
[self setBoundsSize:newbounds.size];
// XXX[self setDrawOrigin: -newbounds.size.width/2 : newbounds.origin.y];
[self setBoundsOrigin: NSMakePoint (-newbounds.size.width/2,
newbounds.origin.y)];
// XXX[self moveTo: -newbounds.size.width/2 : newbounds.origin.y];
//
@ -169,15 +168,15 @@ Called when the scaler popup on the window is used
return NULL;
// keep the center of the view constant
visrect =[_super_view bounds];
sframe =[_super_view frame];
visrect =[self bounds];
sframe =[self frame];
visrect.origin.x += visrect.size.width / 2;
visrect.origin.y += visrect.size.height / 2;
visrect.origin.x -= sframe.size.width / 2 / nscale;
visrect.origin.y -= sframe.size.height / 2 / nscale;
[self setOrigin: &visrect.origin scale:nscale];
[self setOrigin: visrect.origin scale:nscale];
return self;
}
@ -242,6 +241,7 @@ If realbounds has shrunk, nothing will change.
{
NSRect sbounds;
float vistop, visbottom;
NSClipView *cv = (NSClipView *) _super_view;
if (minheight == oldminheight && maxheight == oldmaxheight)
return self;
@ -274,18 +274,18 @@ If realbounds has shrunk, nothing will change.
// size this view
//
// XXX[quakeed_i disableDisplay];
//Sys_Printf ("sbounds: %g %g %g %g\n", -sbounds.size.width / 2, sbounds.origin.y, sbounds.size.width, sbounds.size.height);
// XXX[self suspendNotifyAncestorWhenFrameChanged:YES];
[self setBoundsSize:sbounds.size];
[self setBoundsOrigin: NSMakePoint (-sbounds.size.width / 2,
[self setFrameSize:sbounds.size];
[self setFrameOrigin: NSMakePoint (-sbounds.size.width / 2,
sbounds.origin.y)];
// XXX[self moveTo: -sbounds.size.width/2 : sbounds.origin.y];
[cv scrollToPoint: NSMakePoint (-sbounds.size.width/2, sbounds.origin.y)];
// XXX[self suspendNotifyAncestorWhenFrameChanged:NO];
// XXX[[_super_view _super_view] reflectScroll: _super_view];
[[_super_view superview] reflectScrolledClipView: cv];
// XXX[quakeed_i reenableDisplay];
// XXX[[[[self _super_view] _super_view] vertScroller] display];
[[zscrollview_i verticalScroller] display];
return self;
}
@ -320,7 +320,7 @@ Rect is in global world (unscaled) coordinates
left = _bounds.origin.x;
right = 24;
//Sys_Printf ("gridsize: %d left: %d right: %d\n", gridsize, left, right);
bottom = rect.origin.y - 1;
top = rect.origin.y + rect.size.height + 2;
@ -441,14 +441,14 @@ drawSelf
-drawRect: (NSRect) rects
{
NSRect visRect;
//NSRect visRect;
//Sys_Printf("ZView:drawRect\n");
minheight = 999999;
maxheight = -999999;
// allways draw the entire bar
visRect =[self visibleRect];
rects = visRect;
//visRect =[self visibleRect];
rects = [self bounds];
// erase window
NSEraseRect (rects);
@ -612,7 +612,7 @@ ZScrollCallback (float dy)
scale =[zview_i currentScale];
oldreletive.y -= dy;
[zview_i setOrigin: &neworg scale:scale];
[zview_i setOrigin: neworg scale:scale];
}
-scrollDragFrom:(NSEvent *) theEvent