Thread overview
Cassowary.d
Jul 27, 2014
ketmar
Jul 27, 2014
Yuriy
Jul 27, 2014
ketmar
Jul 27, 2014
ketmar
Jul 28, 2014
Yuriy
Jul 28, 2014
Kagamin
Aug 07, 2014
ketmar
July 27, 2014
preliminary, but working port of Cassowary Solver — GUI-oriented constraint solver, toolkit-agnostic layout engine. it's not D-spirited yet, but it works. todo list includes templated classes and bindings for gtk.d. feel free to fork and improve.

url: http://repo.or.cz/w/cassowary.d.git
July 27, 2014
On Sunday, 27 July 2014 at 11:44:35 UTC, ketmar wrote:
> preliminary, but working port of Cassowary Solver — GUI-oriented constraint solver, toolkit-agnostic layout engine. it's not D-spirited yet, but it works. todo list includes templated classes and bindings for gtk.d. feel free to fork and improve.
>
> url: http://repo.or.cz/w/cassowary.d.git
+1
http://code.dlang.org/packages/cassowary-d
July 27, 2014
On Sun, 27 Jul 2014 12:01:45 +0000
Yuriy via Digitalmars-d-announce <digitalmars-d-announce@puremagic.com>
wrote:

> +1
> http://code.dlang.org/packages/cassowary-d
damn it! my google-fu sux again. i did search and found nothing, so made a port. feel so stupid now...


July 27, 2014
On Sun, 27 Jul 2014 15:16:07 +0300
ketmar via Digitalmars-d-announce
<digitalmars-d-announce@puremagic.com> wrote:

heh. but i have a nice text parser! so it's not a completely trashcan work. ;-)


July 28, 2014
On Sunday, 27 July 2014 at 12:01:47 UTC, Yuriy wrote:
> On Sunday, 27 July 2014 at 11:44:35 UTC, ketmar wrote:
>> preliminary, but working port of Cassowary Solver — GUI-oriented constraint solver, toolkit-agnostic layout engine. it's not D-spirited yet, but it works. todo list includes templated classes and bindings for gtk.d. feel free to fork and improve.
>>
>> url: http://repo.or.cz/w/cassowary.d.git
> +1
> http://code.dlang.org/packages/cassowary-d

http://code.dlang.org/?sort=updated&category=library.scientific.linalg categorization can be better though.
July 28, 2014
> so it's not a completely trashcan work. ;-)

No way it could be! We don't like monopoly here, right? =)
I just ported the library for my own fun, and added a couple of D-ish features, like operator overloads, etc. It's not claimed to be the best one in the world =). Please feel free to continue with your own, or contributing to my lib, whatever you prefer =).

Best regards,
Yuriy Glukhov.
August 07, 2014
a small update for parser: it is now possible to parse so-called "scripts" (only from 'string' type for now). sample script can look like this one, which centers two buttons inside the panel, keepeng equal button sizes:

===[cutline]===
var(stay)
  panel.left = 0,
  panel.top = 0,
  panel.width = 80,
  panel.height = 20;


// this is just a simple constants,
// use 'define' to avoid introducing new vars
define
  button.hpadding = 4,
  button.defheight = 10+6; // simple math


var
  bt0.left, // default is 0
  bt0.top,
  <stay> bt0.width = 30,
  <stay> bt0.height = button.defheight;
    // oh, yeah, this will be calculated in-place


var
  bt1.left,
  bt1.top,
  bt1.width,
  bt1.height;


// some useful macros
define
  panel.right = (panel.left+panel.width),
  panel.bottom = (panel.top+panel.height),

  bt0.right = (bt0.left+bt0.width),
  bt0.bottom = (bt0.top+bt0.height),

  bt1.right = (bt1.left+bt1.width),
  bt1.bottom = (bt1.top+bt1.height);


// button-button placement and sizes
// default strength is <required>
bt1.left >= bt0.right+button.hpadding; // buttons padding
bt1.height == bt0.height; // same height
bt1.width == bt0.width; // same width
bt1.top == bt0.top; // same vertical position


// button-panel placement (this should center buttons)
// horizontal
bt0.left-panel.left == panel.right-bt1.right;
// vertical
bt0.top-panel.top == panel.bottom-bt0.bottom;


// print values (for debug mode)
print panel.left;
print panel.top;
print panel.width;
print panel.height;

print bt0.left;
print bt0.top;
print bt0.width;
print bt0.height;

print bt1.left;
print bt1.top;
print bt1.width;
print bt1.height;
===[cutline]===

there is no support for any kind of 'autobinding' variables to class/struct properties yet, and parser code is awful. but the whole thing is slowly growing…

anyway, it's really fun to play with various layout scripts. try it yourself!