Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:03
    didierkorthoudt commented #2970
  • 08:03
    didierkorthoudt commented #2969
  • Jan 26 17:05
    cappbot commented #2969
  • Jan 26 17:05
    cappbot commented #2970
  • Jan 26 16:42
    cappbot labeled #2969
  • Jan 26 16:42
    cappbot milestoned #2969
  • Jan 26 16:42
    cappbot milestoned #2970
  • Jan 26 16:42
    cappbot labeled #2970
  • Jan 26 16:36
    cacaodev opened #2970
  • Jan 26 16:31
    cacaodev opened #2969
  • Jan 23 02:03
    yaymakeup starred cappuccino/cappuccino
  • Jan 21 07:26
    felipemeamaral starred cappuccino/cappuccino
  • Jan 21 04:00
    fanyufan starred cappuccino/cappuccino
  • Jan 19 08:03
    mrcarlberg commented #2968
  • Jan 19 08:03

    mrcarlberg on master

    Fixed: sharedApplication was in… (compare)

  • Jan 19 08:03
    mrcarlberg closed #2968
  • Jan 17 19:41
    cappbot commented #2968
  • Jan 17 19:35
    cappbot labeled #2968
  • Jan 17 19:35
    cappbot milestoned #2968
  • Jan 17 19:23
    daboe01 opened #2968
David Richardson
@enquora
It is a shame so much good work from a decade ago has been displaced by fashion
David Richardson
@enquora
It appears nib2cib doesn’t handle menuItem images - can anyone confirm?
Martin Carlberg
@mrcarlberg
Does it work from code? It might be easy to add if most of the infrastructure is present?
enquora
@enquora:matrix.org
[m]
It works from code - that was the work-around in this case
Setting in code was a perfect example of how much code IB can eliminate!
Martin Carlberg
@mrcarlberg
I was referring to add the functionality to nib2cib if it works with code
It might be just some additional attributes that nib2cib needs to take care of?
enquora
@enquora:matrix.org
[m]
Yes, of course. And it would save 50 or so lines of code in this case :-)
Martin Carlberg
@mrcarlberg
@enquora I did a quick check in the source code and it looks like nib2cib will work with Image but not On image, Off image or Mixed image.
The code is there but it is marked as a comment so it might be easy to fix if it does work for Image.
David Richardson
@enquora
@mrcarlberg Not working here still with just Image property set, gif images. Loading and setting in code works fine. I’ll create a reduction over the weekend and attempt to see what’s happening.
Martin Carlberg
@mrcarlberg
@enquora It works for me!
Skärmavbild 2021-01-15 kl. 13.19.27.png
Skärmavbild 2021-01-15 kl. 13.20.15.png
Skärmavbild 2021-01-15 kl. 13.21.02.png
Should be easy to get to work with On Image / Off Image and Mixed Image
Martin Carlberg
@mrcarlberg
The code in CPMenuItem has support for an alternate image. I can't find anything about that in the Cocoa documentation. Anyone knows why this is there?
Martin Carlberg
@mrcarlberg
I'm not going to change behaviour for the alternate image....
Currently the default behaviour is to use the OnState, OffState and Mixedstate image from the theme. I will alter this so it will first take it from the item's OnState, OffState or Mixedstate image. If it does not have one it will take it from the Theme.
David Richardson
@enquora

Questions about the responder chain, general and specific. I generally manually insert CPViewController instances in the responder chain during init or awakeFromCib using:

[self setNextResponder:[self view]]; var subviews = [[self view] subviews]; for (var i = 0; i < [subviews count]; i++) { var subview = subviews[i]; [subview setNextResponder:self]; }
I have an open issue about missing automatic responder chain support and intend something like this be added, but have been uncertain if there are configurations in which this isn’t sufficient. The following appears to be one…

David Richardson
@enquora

We have a the following view hierarchy:
CPWindow
CPSplitView
CPDetailView (the right side of the split view)
ENQLayoutView (a CPBox subclass)
ENQWidgetView (another CPBox subclass, multiple instances)

Each has their own controller.
The widgets are moveable and resizeable.
Everything but the widget view is created statically in IB.
The canvas and widget views have CPMenus associated with their menu properties.

Tracking areas inside the widget views are used to change cursors when the mouse is over them, and to allow dragging and resizing to alter their positions on the canvas.

Some instances of the widgets will contain CPTextViews which have their own cursor management needs, obviously. It is necessary to toggle move/resize mode on and off using a modifier key as a signal. The proper way to do this is overriding flagsChanged: in the view controller, ideally that for the widget, or perhaps the canvas.

In this instance, nothing below the splitView controller appears to be in the responder chain - flagsChanged: is called for the splitView controller, but nothing below it in the hierachy. Furthermore, when the canvas or widget controllers are inserted into the responder chain, the context menu’s for them are no longer available.

Is anyone able to explain the responder chain in this context?

David Richardson
@enquora
@mrcarlberg Do you have a reduction for CPMenuItems displaying CPImages when set using IB? I do not see this happening, even in the simplest possible reduction.
wrt the responder chain problem, my current approach is to catch flagsChanged: in the splitView controller, then post a notification which the canvas controller listens for and sets/unsets a property indicating the modifier key state. It works, and may even be the best approach, but I need to understand what’s happening in the splitView responder chain. I’m reluctant to issue a PR that closes the responder chain issue until I have a better understanding
David Richardson
@enquora
A further curiosity: The event for cursorChange: tracking contains a modifierFlags: property. It is a bit mask (it seems) but the value seems to bear no relationship to the modifier key ones for flagsChanged:. Is anyone familiar with this?
daboe01
@daboe01
@enquora i can confirm that the modifierFlags property does not work reliably, unless it is a key related event.
David Richardson
@enquora
Is anyone using a statechart/statemachine to manage all or portions of a Cappuccino app? If so, what are you using?
David Richardson
@enquora
I don’t see an implementation of removeFontTrait: in CPFontManager. It isn’t obvious how one removes boldface and italic traits without that, at least entirely within IB. Am I looking at this the wrong way?
David Richardson
@enquora
I presume this isn’t implemented (yet) because of the complexity involved in (potentially) overlapping ranges for multiple attributes? (If so, refer to previous question about state machines/statecharts.)
daboe01
@daboe01
@enquora - (CPFont)convertFont:(CPFont)aFont toNotHaveTrait:(CPFontTraitMask)fontTrait may be what you want.
David Richardson
@enquora

@daboe01 That definitely goes into the code snippet vault for future use.

In this case, the Apple-recommended approach is
[textStorage setAttributes:@{} range:selectedRange]; [textStorage processEditing];

This in a method in the textView’s controller, wired to the menuItem.

I was hoping to keeping everything for the menu in the IB domain, but not possible given the missing firstResponder implementation for CPTextView. Not the end of the world, and another little thing to fix once the immediate project has stabilized.

David Richardson
@enquora

Has anyone tried using Cappuccino in fullscreen mode?
[viewInstance enterFullScreenMode] and
the browser FullScreen API both seem to either make essential parts of the DOM we construct inaccessible (resulting in random functionality being disabled) or otherwise prevent our runtime from working properly.

It’s not yet clear to me if this is a difficult problem to resolve or not.

Michael Bach
@michaelbach
@enquora Check it out here
https://michaelbach.de/ot/FrACT10/capp/
there's a Fullscreen button and it works well for me.
David Richardson
@enquora

@michaelbach Are you using the browser FullScreen API alone or in conjunction with CPView’s enterFullScreenMode:withOptions:?

I wonder if having a subsidier CPWindow is the difference here?

Michael Bach
@michaelbach

I was not aware that Cappuccino offers fullscreen help, a mixed blessing in hindsight :), so I'm using (how do I paste multiline code?):

  • (void) fullScreenOn: (BOOL) onOff {
    var element = document.documentElement;
    if (onOff) {

      if(element.requestFullscreen)
          element.requestFullscreen();
      else if(element.mozRequestFullScreen)
          element.mozRequestFullScreen();
      else if(element.webkitRequestFullscreen)
          element.webkitRequestFullscreen();
      else if(element.msRequestFullscreen)
          element.msRequestFullscreen();

    } else {

      if(document.exitFullscreen)
          document.exitFullscreen();
      else if(document.mozCancelFullScreen)
          document.mozCancelFullScreen();
      else if(document.webkitExitFullscreen)
          document.webkitExitFullscreen();
      else if(document.msExitFullscreen)
          document.msExitFullscreen();

    }
    }

  • (BOOL) isFullScreen {
    var full_screen_element = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement || null;
    if(full_screen_element === null)// If no element is in full-screen

      return false;

    else

      return true;

    }

Sorry for the horrible result.

David Richardson
@enquora
That’s the FullScreen API, exactly what I am using - curious. I’m increasingly suspecting our child window being the problem.
Michael Bach
@michaelbach
@enquora It always helps to know where not to look :).
I also note now that I could do without the return true/false… :)
David Richardson
@enquora

Xcode still supports third-party language plugins. Work-in-progress support for Objective-J is available at: https://github.com/enquora/xcode-cappuccino

Selector highlighting is still miminal, but shouldn’t be terribly difficult to polish.

The installer uses xcode-select to determine the active version of Xcode and install language support for it. Because the language support assets must(?) be within the Xcode bundle, they must be re-installed when Xcode is updated, and when the active version is changed.

Xcode has moved to the Language Server Protocol for almost everything except syntax highlighting. The editor portion of Xcode is now quite stable and effective (providing one doesn’t demand vim key-bindings). Objective-J support should make using Xcode as one’s principal editor more comfortable for those who are already using Interface Builder for significant portions of their projects. One particular benefit is using pragma marks for code navigation within files.
David Richardson
@enquora
A copy of the Objective-C xclangspec is included for reference in the project, for anyone wanting to improve the syntax highlighting. One important distinction is that, while Objective-C support uses a language-specific parser written by Apple, Objective-J uses the generic language parser.
@mrcarlberg I noticed that .h support was included in the original xclangspec files this used as a starting point. You mentioned last year this might be a supported feature of our compiler.
Michael Bach
@michaelbach
If it's only for syntax highlighting: Does this language plugin do more than what happens when you do this:
In Xcode, in the file inspector, set "Type" to "Objective-C Source" rather than than "Default – Plain text".
Alternatively, use Xcode>Editor>Syntax Coloring>Objective-C.
The former method has the advantage that it can be applied to all Objective-J files at once if you select them in the Navigator.
enquora
@enquora:matrix.org
[m]
It provides syntax highlighting for files with the extension .j, no more or less. At the moment, forcing the language to Objective-C does cover more of the syntax - we do, however, have a few syntax differences between J and C variants. It remains to be tested how well using the objective-c parser rather than the generic one works.
Nearly all other language functionally has moved or is being moved to sourcekit-lsp. The big opportunity for us is in writing an LSP server for Objective-J. This would allow taking advantage of Xcode’s formatting, auto-completion and refactoring commands.
enquora
@enquora:matrix.org
[m]
Out projects contain many hundreds of Objective-J files and I prefer to have Xcode auto-detect the language and apply the correct syntax. This requires a language-specific xclangspec. Such a thing was created a decade ago, but security problems prior to release of Xcode 8 led to Apple changing and locking the plug-in architecture which Xcode is built on. Language syntax highlighting is the only aspect of the plug-in architecture which doesn’t now require Apple-signed code.
*Our projects contain
LSP doesn’t currently support syntax highlighting. I expect that to change. When it does, language support will be editor-independent, supported by out-of-process language-specific servers.
Michael Bach
@michaelbach

It provides syntax highlighting for files with the extension .j, no more or less. …

Ok, I understand. Thank you.

David Richardson
@enquora

@michaelbach It appears the Xcode editor is also using the lexing/parsing instructions in xcclangspec to create auto-complete suggestions. I’m guessing this is a default, and the presence of sourcekit-lsp (for C, C++ and Objective equivalents) is a trigger to use the LSP.

Further experience needed with this. An xclangspec will be needed for Jakefiles too. This doesn’t look nearly as daunting as for Objective-J itself.

Auto-completion, even if less-than-perfect, is a useful convenience with Cocoa