[147870] trunk/dports/graphics/ipe

devans at macports.org devans at macports.org
Tue Apr 19 11:16:54 PDT 2016


Revision: 147870
          https://trac.macports.org/changeset/147870
Author:   devans at macports.org
Date:     2016-04-19 11:16:54 -0700 (Tue, 19 Apr 2016)
Log Message:
-----------
ipe: apply numerous maintainer fixes for build on 10.9, 10.10.

Modified Paths:
--------------
    trunk/dports/graphics/ipe/Portfile

Added Paths:
-----------
    trunk/dports/graphics/ipe/files/patch-ipe-older-osx-versions.diff

Removed Paths:
-------------
    trunk/dports/graphics/ipe/files/patch-src-ipecanvas-ipeselector_cocoa.cpp.diff

Modified: trunk/dports/graphics/ipe/Portfile
===================================================================
--- trunk/dports/graphics/ipe/Portfile	2016-04-19 17:49:26 UTC (rev 147869)
+++ trunk/dports/graphics/ipe/Portfile	2016-04-19 18:16:54 UTC (rev 147870)
@@ -35,7 +35,7 @@
                         port:zlib
 
 patchfiles              patch-ipe-mainmenu.xib.diff \
-                        patch-src-ipecanvas-ipeselector_cocoa.cpp.diff
+                        patch-ipe-older-osx-versions.diff
 
 use_configure           no
 universal_variant       no

Added: trunk/dports/graphics/ipe/files/patch-ipe-older-osx-versions.diff
===================================================================
--- trunk/dports/graphics/ipe/files/patch-ipe-older-osx-versions.diff	                        (rev 0)
+++ trunk/dports/graphics/ipe/files/patch-ipe-older-osx-versions.diff	2016-04-19 18:16:54 UTC (rev 147870)
@@ -0,0 +1,384 @@
+diff --git ipe/Makefile ipe/Makefile
+index 06e07ed..6ab7658 100644
+--- ipe/Makefile
++++ ipe/Makefile
+@@ -51,6 +51,7 @@ ifdef IPEUI_COCOA
+ nib = $(RESOURCEDIR)/mainmenu.nib
+ 
+ $(nib): mainmenu.xib
++	$(INSTALL_DIR) $(RESOURCEDIR)
+ 	ibtool --compile $(nib) mainmenu.xib
+ 
+ else
+diff --git ipe/appui_cocoa.cpp ipe/appui_cocoa.cpp
+index a26f7b8..6f7ecad 100644
+--- ipe/appui_cocoa.cpp
++++ ipe/appui_cocoa.cpp
+@@ -339,7 +339,7 @@ static NSImage *loadIcon(String action)
+   return t;
+ }
+ 
+-- (NSArray<NSString *> *) toolbarAllowedItemIdentifiers:(NSToolbar *) toolbar
++- (NSArray *) toolbarAllowedItemIdentifiers:(NSToolbar *) toolbar
+ {
+   return @[ @"copy", @"cut", @"paste", @"delete", @"undo", @"redo",
+ 	    @"zoom_in", @"zoom_out", @"fit_objects", @"fit_page",
+@@ -357,7 +357,7 @@ static NSImage *loadIcon(String action)
+ 	   ];
+ }
+ 
+-- (NSArray<NSString *> *) toolbarDefaultItemIdentifiers:(NSToolbar *) toolbar
++- (NSArray *) toolbarDefaultItemIdentifiers:(NSToolbar *) toolbar
+ {
+   return @[ @"mode_select", @"mode_translate", @"mode_rotate",
+ 	    @"mode_stretch", @"mode_pan", @"mode_shredder",
+@@ -585,7 +585,7 @@ AppUi::AppUi(lua_State *L0, int model)
+   iLayerBox = [[NSBox alloc] initWithFrame:subRect];
+   iLayerBox.title = @"Layers";
+ 
+-  NSRect layerFrame = iLayerBox.contentView.frame;
++  NSRect layerFrame = [iLayerBox.contentView frame];
+   iLayerView = [[IpeLayerView alloc] initWithFrame:layerFrame];
+   iLayerView.delegate = iDelegate;
+   iLayerView.toolTip = @"Layers of this page";
+@@ -921,9 +921,9 @@ void AppUi::setCheckMark(String name, String value)
+   NSString *prefix = I2N(name);
+   for (NSString *action in iActions) {
+     if ([action hasPrefix:prefix])
+-      iActions[action].state = NO;
++      ((IpeAction *)iActions[action]).state = NO;
+   }
+-  iActions[I2N(name + value)].state = YES;
++  ((IpeAction *)iActions[I2N(name + value)]).state = YES;
+ }
+ 
+ void AppUi::setLayers(const Page *page, int view)
+@@ -955,16 +955,16 @@ void AppUi::setNumbers(String vno, bool vm, String pno, bool pm)
+ BOOL AppUi::validateMenuItem(NSMenuItem *item, NSString *name)
+ {
+   if ([name isEqualToString:@"snapbar"]) {
+-    item.title = iSnapBar.hidden ? @"Show Snap Toolbar" :
++    item.title = [iSnapBar isHidden] ? @"Show Snap Toolbar" :
+       @"Hide Snap Toolbar";
+     return YES;
+   }
+   IpeAction *s = findAction(name);
+   if (s) {
+     if ([name isEqualToString:@"toggle_notes"])
+-      s.state = (iNotesPanel && iNotesPanel.visible);
++      s.state = (iNotesPanel && [iNotesPanel isVisible]);
+     else if ([name isEqualToString:@"toggle_bookmarks"])
+-      s.state = (iBookmarksPanel && iBookmarksPanel.visible);
++      s.state = (iBookmarksPanel && [iBookmarksPanel isVisible]);
+     [item setState:(s.state ? NSOnState : NSOffState)];
+     return actionsEnabled() || s.alwaysOn;
+   }
+@@ -1024,8 +1024,8 @@ void AppUi::fillDynamicSubmenu(NSMenuItem *item)
+ 
+ void AppUi::toggleSnapbarShown()
+ {
+-  iSnapBar.hidden = !iSnapBar.hidden;
+-  if (iSnapBar.hidden) {
++  iSnapBar.hidden = ![iSnapBar isHidden];
++  if ([iSnapBar isHidden]) {
+     activateConstraint(iViewToSnapBar, NO);
+     activateConstraint(iViewToTop, YES);
+   } else {
+diff --git ipe/appui_cocoa.h ipe/appui_cocoa.h
+index 4305b86..fa25320 100644
+--- ipe/appui_cocoa.h
++++ ipe/appui_cocoa.h
+@@ -112,7 +112,7 @@ private:
+   virtual void setButtonColor(int sel, Color color) override;
+ 
+ private:
+-  NSMutableDictionary <NSString *, IpeAction *> *iActions;
++  NSMutableDictionary *iActions; // <NSString *, IpeAction *>
+   bool iActionsEnabled;
+   bool iInUiUpdate;
+   NSWindow *iWindow;
+diff --git ipe/controls_cocoa.cpp ipe/controls_cocoa.cpp
+index d6d079c..1d1c582 100644
+--- ipe/controls_cocoa.cpp
++++ ipe/controls_cocoa.cpp
+@@ -229,7 +229,7 @@ extern CGContextRef ipeGetCGContext();
+ 
+ @implementation IpeLayerView {
+   NSTableView *iTV;
+-  NSMutableArray <IpeLayerItem *> *iLayers;
++  NSMutableArray *iLayers; // <IpeLayerItem *>
+ }
+ 
+ - (instancetype) initWithFrame:(NSRect) rect
+@@ -283,20 +283,20 @@ extern CGContextRef ipeGetCGContext();
+ - (void) ipeLayerToggled:(id) sender
+ {
+   int row = [sender tag];
+-  if (iLayers[row].checked)
+-    [self.delegate layerAction:@"selectoff" forLayer:iLayers[row].name];
++  if (((IpeLayerItem *)iLayers[row]).checked)
++    [self.delegate layerAction:@"selectoff" forLayer:((IpeLayerItem *)iLayers[row]).name];
+   else
+-    [self.delegate layerAction:@"selecton" forLayer:iLayers[row].name];
++    [self.delegate layerAction:@"selecton" forLayer:((IpeLayerItem *)iLayers[row]).name];
+ }
+ 
+ - (void) ipeLayerClicked:(int) row
+ {
+-  [self.delegate layerAction:@"active" forLayer:iLayers[row].name];
++  [self.delegate layerAction:@"active" forLayer:((IpeLayerItem *)iLayers[row]).name];
+ }
+ 
+ - (void) ipeLayerMenuAt:(NSPoint) p forRow:(int) row
+ {
+-  [self.delegate layerMenuAt:p forLayer:iLayers[row].name];
++  [self.delegate layerMenuAt:p forLayer:((IpeLayerItem *)iLayers[row]).name];
+ }
+ 
+ - (NSInteger) numberOfRowsInTableView:(NSTableView *) tv
+@@ -309,9 +309,9 @@ objectValueForTableColumn:(NSTableColumn *) col
+ 	     row:(NSInteger)row
+ {
+   if ([[col identifier] isEqualToString:@"checks"])
+-    return [NSNumber numberWithBool:iLayers[row].checked];
++    return [NSNumber numberWithBool:((IpeLayerItem *)iLayers[row]).checked];
+   else
+-    return iLayers[row].name;
++    return ((IpeLayerItem *)iLayers[row]).name;
+ }
+ 
+ - (NSView *) tableView:(NSTableView *) tv
+@@ -328,7 +328,7 @@ objectValueForTableColumn:(NSTableColumn *) col
+     [result setAction:@selector(ipeLayerToggled:)];
+     [result setTarget:self];
+     [result setTag:row];
+-    [result setState:iLayers[row].checked];
++    [result setState:((IpeLayerItem *)iLayers[row]).checked];
+     return result;
+   } else {
+     IpeLayerField *result = [tv makeViewWithIdentifier:@"LayerName" owner:self];
+@@ -349,7 +349,7 @@ objectValueForTableColumn:(NSTableColumn *) col
+ 
+ @implementation IpeBookmarksView {
+   NSTableView *iTV;
+-  NSMutableArray <NSString *> *iBookmarks;
++  NSMutableArray *iBookmarks; // <NSString *>
+ }
+ 
+ - (instancetype) initWithFrame:(NSRect) rect
+diff --git ipe/main_cocoa.cpp ipe/main_cocoa.cpp
+index 132eaaa..4e00495 100644
+--- ipe/main_cocoa.cpp
++++ ipe/main_cocoa.cpp
+@@ -72,7 +72,7 @@ static void setup_globals(lua_State *L)
+ 		  IPELIB_VERSION % 100);
+   lua_setfield(L, -2, "version");
+ 
+-  NSArray <NSString *> *args = [[NSProcessInfo processInfo] arguments];
++  NSArray *args = [[NSProcessInfo processInfo] arguments];
+   int argc = [args count];
+   lua_createtable(L, 0, argc - 1);
+   for (int i = 1; i < argc; ++i) {
+diff --git ipe/pagesorter_cocoa.cpp ipe/pagesorter_cocoa.cpp
+index 3cb7500..4cbe980 100644
+--- ipe/pagesorter_cocoa.cpp
++++ ipe/pagesorter_cocoa.cpp
+@@ -131,7 +131,7 @@ extern NSSize thumbnail_size; // in ipeselector_cocoa.cpp
+ @interface IpePageSorterDelegate : NSObject <NSWindowDelegate,
+ 					       NSCollectionViewDelegate>
+ 
+- at property NSMutableArray <IpeSelectorItem *> *pages;
++ at property NSMutableArray *pages; // <IpeSelectorItem *>
+ @property (assign) NSCollectionView *cv;
+ 
+ - (void) ipeAccept;
+@@ -249,7 +249,7 @@ int AppUi::pageSorter(lua_State *L, Document *doc,
+   }
+ 
+   NSScrollView *scroll =
+-    [[NSScrollView alloc] initWithFrame:panel.contentView.frame];
++    [[NSScrollView alloc] initWithFrame:[panel.contentView frame]];
+   scroll.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable;
+   scroll.hasVerticalScroller = YES;
+ 
+@@ -326,7 +326,7 @@ int AppUi::pageSorter(lua_State *L, Document *doc,
+     int n = [delegate.pages count];
+     lua_createtable(L, n, 0);
+     for (int i = 1; i <= n; ++i) {
+-      lua_pushinteger(L, delegate.pages[i-1].index + 1);
++      lua_pushinteger(L, ((IpeSelectorItem *)delegate.pages[i-1]).index + 1);
+       lua_rawseti(L, -2, i);
+     }
+     return 1;
+diff --git ipecanvas/ipecanvas_cocoa.cpp ipecanvas/ipecanvas_cocoa.cpp
+index 2af4ca7..966a12b 100644
+--- ipecanvas/ipecanvas_cocoa.cpp
++++ ipecanvas/ipecanvas_cocoa.cpp
+@@ -45,15 +45,20 @@ static CGContextRef gc_graphics_port()
+ 
+ static CGContextRef gc_cgcontext()
+ {
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+   return [[NSGraphicsContext currentContext] CGContext];
++  #else
++  return nil;
++  #endif
+ }
+ 
+ CGContextRef ipeGetCGContext()
+ {
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+   if ([NSGraphicsContext instancesRespondToSelector:@selector(CGContext)])
+-    return gc_cgcontext();
+-  else
+-    return gc_graphics_port();
++    return [[NSGraphicsContext currentContext] CGContext];
++  #endif
++  return (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
+ }
+ 
+ // --------------------------------------------------------------------
+@@ -63,10 +68,11 @@ Canvas::Canvas(IpeCanvasView *view)
+   iView = view;
+   iLayer = NULL;
+ 
++  iGCGetter = gc_graphics_port;
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+   if ([NSGraphicsContext instancesRespondToSelector:@selector(CGContext)])
+     iGCGetter = gc_cgcontext;
+-  else
+-    iGCGetter = gc_graphics_port;
++  #endif
+ }
+ 
+ Canvas::~Canvas()
+diff --git ipecanvas/ipeselector_cocoa.cpp ipecanvas/ipeselector_cocoa.cpp
+index 9a5129b..7b2891d 100644
+--- ipecanvas/ipeselector_cocoa.cpp
++++ ipecanvas/ipeselector_cocoa.cpp
+@@ -241,7 +241,7 @@ int CanvasBase::selectPageOrView(Document *doc, int page, int startIndex,
+   }
+ 
+   NSScrollView *scroll =
+-    [[NSScrollView alloc] initWithFrame:panel.contentView.frame];
++    [[NSScrollView alloc] initWithFrame:[panel.contentView frame]];
+   scroll.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable;
+   scroll.hasVerticalScroller = YES;
+   panel.contentView = scroll;
+diff --git ipeui/ipeui_cocoa.cpp ipeui/ipeui_cocoa.cpp
+index 4ac1035..7918ca6 100644
+--- ipeui/ipeui_cocoa.cpp
++++ ipeui/ipeui_cocoa.cpp
+@@ -52,10 +52,11 @@ inline NSString *C2N(const char *s) {return [NSString stringWithUTF8String:s];}
+ 
+ CGContextRef ipeGetCGContext()
+ {
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+   if ([NSGraphicsContext instancesRespondToSelector:@selector(CGContext)])
+     return [[NSGraphicsContext currentContext] CGContext];
+-  else
+-    return (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
++  #endif
++  return (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
+ }
+ 
+ // --------------------------------------------------------------------
+@@ -83,6 +84,7 @@ void addToLayout(NSView *view, NSView *subview)
+ 
+ id layoutGuide(NSView *owner)
+ {
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
+   if ([owner respondsToSelector:@selector(addLayoutGuide:)]) {
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+@@ -90,11 +92,11 @@ id layoutGuide(NSView *owner)
+     [owner addLayoutGuide:g];
+ #pragma clang diagnostic pop
+     return g;
+-  } else {
+-    NSView *g = [[NSView alloc] initWithFrame:NSZeroRect];
+-    addToLayout(owner, g);
+-    return g;
+   }
++  #endif
++  NSView *g = [[NSView alloc] initWithFrame:NSZeroRect];
++  addToLayout(owner, g);
++  return g;
+ }
+ 
+ static NSLayoutAttribute layoutAttribute(char ch)
+@@ -138,40 +140,44 @@ static NSView *owner(id a)
+ {
+   if ([a respondsToSelector:@selector(superview)])
+     return [a superview];
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
+   if ([a respondsToSelector:@selector(owningView)])
+     return [a owningView];  // is a layout guide
++  #endif
+   return nil;
+ }
+ 
+ void activateConstraint(NSLayoutConstraint *c, BOOL active)
+ {
++  #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
+   if ([c respondsToSelector:@selector(setActive:)]) {
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+     c.active = active;
++    return;
+ #pragma clang diagnostic pop
+-  } else {
+-    // need to figure out lowest common ancestor
+-    id a = c.firstItem;
+-    id b = c.secondItem;
+-    NSView *lca = nil;
+-    NSView *ao = owner(a);
+-    NSView *bo = owner(b);
+-    if (b == nil)
+-      lca = a;
+-    else if (ao == b)
+-      lca = b;
+-    else if (bo == a)
+-      lca = a;
+-    else {
+-      assert(ao == bo);
+-      lca = ao;
+-    }
+-    if (active)
+-      [lca addConstraint:c];
+-    else
+-      [lca removeConstraint:c];
+   }
++  #endif
++  // need to figure out lowest common ancestor
++  id a = c.firstItem;
++  id b = c.secondItem;
++  NSView *lca = nil;
++  NSView *ao = owner(a);
++  NSView *bo = owner(b);
++  if (b == nil)
++    lca = a;
++  else if (ao == b)
++    lca = b;
++  else if (bo == a)
++    lca = a;
++  else {
++    assert(ao == bo);
++    lca = ao;
++  }
++  if (active)
++    [lca addConstraint:c];
++  else
++    [lca removeConstraint:c];
+ }
+ 
+ NSLayoutConstraint *layout(id a, id b, const char *rel, double gap,
+@@ -253,7 +259,7 @@ private:
+ private:
+   NSPanel *iPanel;
+   IpeDialogDelegate *iDelegate;
+-  NSMutableArray <NSView *> *iViews;
++  NSMutableArray *iViews; // <NSView *>
+ };
+ 
+ // --------------------------------------------------------------------

Deleted: trunk/dports/graphics/ipe/files/patch-src-ipecanvas-ipeselector_cocoa.cpp.diff
===================================================================
--- trunk/dports/graphics/ipe/files/patch-src-ipecanvas-ipeselector_cocoa.cpp.diff	2016-04-19 17:49:26 UTC (rev 147869)
+++ trunk/dports/graphics/ipe/files/patch-src-ipecanvas-ipeselector_cocoa.cpp.diff	2016-04-19 18:16:54 UTC (rev 147870)
@@ -1,11 +0,0 @@
---- ipecanvas/ipeselector_cocoa.cpp.orig	2016-04-11 09:52:33.000000000 -0700
-+++ ipecanvas/ipeselector_cocoa.cpp	2016-04-11 09:54:10.000000000 -0700
-@@ -241,7 +241,7 @@
-   }
- 
-   NSScrollView *scroll =
--    [[NSScrollView alloc] initWithFrame:panel.contentView.frame];
-+    [[NSScrollView alloc] initWithFrame:[panel.contentView frame]];
-   scroll.autoresizingMask = NSViewWidthSizable|NSViewHeightSizable;
-   scroll.hasVerticalScroller = YES;
-   panel.contentView = scroll;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160419/871be4e6/attachment.html>


More information about the macports-changes mailing list