plot additions
This commit is contained in:
parent
d4186faa09
commit
4a53631c7f
|
@ -15,6 +15,7 @@ nsfb
|
|||
nsmonkey
|
||||
nsdebug
|
||||
Makefile.config
|
||||
NetSurf.core
|
||||
NetSurf.exe
|
||||
netsurf-installer.exe
|
||||
NetSurf.app
|
||||
|
|
|
@ -15,4 +15,9 @@ struct browser_window;
|
|||
-(id)initWithBrowser: (struct browser_window*)aBrowser;
|
||||
-(id)back: (id)sender;
|
||||
-(id)forward: (id)sender;
|
||||
|
||||
// Browser control
|
||||
-(NSSize)getBrowserSize;
|
||||
-(void)invalidateBrowser;
|
||||
-(void)invalidateBrowser: (NSRect)rect;
|
||||
@end
|
||||
|
|
|
@ -41,4 +41,14 @@
|
|||
NSLog(@"Browser forward");
|
||||
}
|
||||
|
||||
-(NSSize)getBrowserSize {
|
||||
return [plotView frame].size;
|
||||
}
|
||||
-(void)invalidateBrowser {
|
||||
[plotView setNeedsDisplay: YES];
|
||||
}
|
||||
-(void)invalidateBrowser: (NSRect)rect {
|
||||
[plotView setNeedsDisplayInRect: rect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
/**
|
||||
* Large chunks from the cocoa port
|
||||
*/
|
||||
/*
|
||||
* Copyright 2011 Sven Weidauer <sven.weidauer@gmail.com>
|
||||
* Copyright 2020 Anthony Cohn-Richardby <anthonyc@gmx.co.uk>
|
||||
*
|
||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||
*
|
||||
* NetSurf is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* NetSurf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "PlotView.h"
|
||||
|
@ -78,7 +93,8 @@ void cocoa_plot_render_path(NSBezierPath *path, const plot_style_t *pstyle)
|
|||
|
||||
static nserror plot_clip(const struct redraw_context *ctx, const struct rect *clip) {
|
||||
NSLog(@"plot_clip");
|
||||
[NSBezierPath clipRect: NSMakeRect(clip->x0, clip->y0, clip->x1, clip->y1)];
|
||||
cocoa_plot_clip_rect = NSMakeRect(clip->x0, clip->y0, clip->x1, clip->y1);
|
||||
//[NSBezierPath clipRect: ];
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -101,7 +117,8 @@ static nserror plot_rectangle(const struct redraw_context *ctx, const plot_style
|
|||
NSLog(@"plot_rectangle");
|
||||
NSRect nsrect = NSMakeRect(rectangle->x0, rectangle->y0, rectangle->x1,
|
||||
rectangle->y1);
|
||||
//cocoa_plot_render_path(path, pstyle);
|
||||
NSBezierPath *path = [NSBezierPath bezierPathWithRect: nsrect];
|
||||
cocoa_plot_render_path(path, pstyle);
|
||||
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import <string.h>
|
||||
|
||||
#import "netsurf/netsurf.h"
|
||||
#import "netsurf/layout.h"
|
||||
|
||||
|
||||
|
||||
/********************/
|
||||
/****** Layout ******/
|
||||
/********************/
|
||||
|
||||
// Put the measured width of the string into width
|
||||
static nserror gnustep_layout_width(const struct plot_font_style *fstyle, const char *string, size_t length, int *width) {
|
||||
*width = 0;
|
||||
NSLog(@"gnustep_layout_width");
|
||||
NSLog(@"gnustep_layout_width of %s, len %d", string, length);
|
||||
if (string == NULL || length == 0) {
|
||||
*width = 0;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
// TODO: = impl properly.
|
||||
*width = 5 * length;
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
// Put the character offset and actual x coordinate of the character for which the x
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#import "BrowserWindowController.h"
|
||||
#import "netsurf/netsurf.h"
|
||||
#import "netsurf/window.h"
|
||||
#import "netsurf/types.h"
|
||||
|
||||
/********************/
|
||||
/****** Window ******/
|
||||
|
@ -29,6 +30,12 @@ static void gnustep_window_destroy(struct gui_window *gw) {
|
|||
// Trigger a redraw of the specified area, or the entire window if null
|
||||
static nserror gnustep_window_invalidate(struct gui_window *gw, const struct rect *rect) {
|
||||
NSLog(@"gnustep_window_invalidate");
|
||||
if (rect == NULL) {
|
||||
[(id)gw invalidateBrowser];
|
||||
} else {
|
||||
[(id)gw invalidateBrowser: NSMakeRect(rect->x0, rect->y0,
|
||||
rect->x1, rect->y1)];
|
||||
}
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
@ -46,7 +53,10 @@ static nserror gnustep_window_set_scroll(struct gui_window *gw, const struct rec
|
|||
|
||||
// Put the dimensions of the specified window into width, height
|
||||
static nserror gnustep_window_get_dimensions(struct gui_window *gw, int *width, int *height) {
|
||||
NSLog(@"gnustep_window_get_dimensions");
|
||||
NSSize size = [(id)gw getBrowserSize];
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
NSLog(@"gnustep_window_get_dimensions (%d, %d)", *width, *height);
|
||||
return NSERROR_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue