Re: Building is slow!

2018-04-16 Thread Ivan Trombley via Digitalmars-d

I want to revisit this issue.

Building 64 bit on Linux, release or debug, is fast. However, 
building 64 bit release on Windows 10 is super slow. I have a 
cross platform app that uses gtk-d. Today, I updated DMD to 
2.079.1 and the gtk-d lib to 3.8.0. When I performed a debug 
build on Windows 10, it only took a few seconds to build gtk-d. I 
attempted to build release but canceled the build after a couple 
of hours. I tried building 32 bit release on Windows and while it 
took a lot longer than debug, it still completed in a reasonable 
amount of time (it wouldn't link, though, probably because I'm 
missing some 32 libraries).


Does anyone have any idea why 64 bit release builds on Windows 
would take so long?




Re: Vulkan

2018-02-16 Thread Ivan Trombley via Digitalmars-d
On Wednesday, 14 February 2018 at 00:22:25 UTC, flamencofantasy 
wrote:

Maybe these work, not sure;

https://github.com/Rikarin/VulkanizeD


Thanks, I'll check this out.


Re: Vulkan

2018-02-16 Thread Ivan Trombley via Digitalmars-d

On Wednesday, 14 February 2018 at 02:40:18 UTC, Mike Parker wrote:
What [does] it mean to say they don't work? Have you reported 
any issues? I don't see any in the DerelictVulkan repo. If 
something's broken, please report it so it can  be fixed.


Derelict-vulkan is Windows only ATM.


Vulkan

2018-02-13 Thread Ivan Trombley via Digitalmars-d
I wanted to do some experimentation with Vulkan using D. None of 
the projects that I found (derelict-vulkan, d-vulkan and erupted) 
work.


Are there D bindings to Vulkan that actually work?


Re: [RFC] IDE starter kit

2018-02-02 Thread Ivan Trombley via Digitalmars-d

Here's how I get started:
- Install DMD.
- Install Visual Studio Code.
- Add Jan Jurzitza's (webfreak) serve-d and Native Debug plugins 
to VSC.

- Get busy.




Re: Dscanner: intentionally unused variable

2018-01-07 Thread Ivan Trombley via Digitalmars-d

On Sunday, 7 January 2018 at 17:02:02 UTC, visitor wrote:
It seems a simple underscore "_" as a variable name tells 
Dscanner exactly that.


Any number of underscores but underscores only apparently.


That works too. Thanks.


Re: Dscanner: intentionally unused variable

2018-01-07 Thread Ivan Trombley via Digitalmars-d

On Sunday, 7 January 2018 at 03:41:18 UTC, SimonN wrote:
Another way would be to have the RAII wrapper in a with 
statement, but it produces extra indentation, which you might 
not like:


with (MyStruct(100, 200)) {
// code that uses the new clip rectangle
}

-- Simon


This works good enough. Thanks.


Re: Dscanner: intentionally unused variable

2018-01-07 Thread Ivan Trombley via Digitalmars-d

On Sunday, 7 January 2018 at 08:46:40 UTC, Basile B. wrote:
More simple is to understand D-Scanner limitations and accept 
that warnings are only warnings and that a message doesn't 
necessarily mean that there's something to do.


If the output is clogged with warnings then it's more difficult 
to see the actual issues,  limiting the value of dscanner. It 
makes sense to try to find a reasonable solution.


Dscanner: intentionally unused variable

2018-01-06 Thread Ivan Trombley via Digitalmars-d
While working with SDL, I found that I kept using the same 
pattern over and over:

- Get the current clip rectangle.
- Set a new clip rectangle.
- restore the old clip rectangle on scope (exit).

Instead of writing that code again and again, I wrote a simple 
function that returns a struct which restores the old clip 
rectangle in it's destructor. This works great but now dscanner 
complains about the variable being unused.


Is there a way tell dscanner that a variable is intentionally 
unused?


Re: Super Simple GUI Library

2018-01-02 Thread Ivan Trombley via Digitalmars-d-announce

On Tuesday, 2 January 2018 at 02:12:24 UTC, Martin Nowak wrote:

On Tuesday, 2 January 2018 at 02:06:00 UTC, Ivan Trombley wrote:
For now, app.d has an example in the doc comments. I'll be 
adding more examples to the doc comments.


Generating documentation is as simple as `dub build -b ddox` 
btw.
See https://github.com/MartinNowak/bloom for an example on how 
to publish them to gh-pages during CI.


Note that the default ddox filter arguments exclude 
undocumented modules.
So you either need to add ddoc comments on the module 
declarations


```d
/// app module
module ssgl.app;
```

or change `"-ddoxFilterArgs"` to sth. non-default 
https://github.com/dlang/dub/blob/bf095d8018d34ec0bf3d7459f722b67d7ddb804f/source/dub/dub.d#L1142.


Excellent. Thanks for the info.


Re: Super Simple GUI Library

2018-01-01 Thread Ivan Trombley via Digitalmars-d-announce

On Monday, 1 January 2018 at 23:38:45 UTC, Anton Pastukhov wrote:
Hi, it would be nice to see some more info. Screenshots, docs 
etc. Right now there is just another github repo without single 
example.


For now, app.d has an example in the doc comments. I'll be adding 
more examples to the doc comments.





Super Simple GUI Library

2017-12-31 Thread Ivan Trombley via Digitalmars-d-announce
I started a new GUI library project (for various reasons) base on 
SDL2. It's pretty basic at the moment but I created a github 
repository so that I can hopefully get some feedback on it. What 
is currently present:


- App: an application struct housing the main loop.
- Handle: a RAII struct for conveneint handling of SDL pointers.
- Area: an abstract rectangular base class for UI items.
- BlankArea: a non-visible area that can have children.
- RenderArea: an area with children and a render delegate for 
custom drawing.

- VisibleArea: a basic visible area.
- TextArea: an area for displaying a single line of text.

The github repository is here:
https://github.com/Barugon/ssgl

Please let me know what you think.



Re: Slices and Dynamic Arrays

2017-12-30 Thread Ivan Trombley via Digitalmars-d-learn

double[] D = [3.14159];

Can you guess what D is?  :D



SDL_Quit after GC shutdown?

2017-12-27 Thread Ivan Trombley via Digitalmars-d
I believe that I should call SDL_Quit before my program 
terminates. However, some objects may be holding on to SDL 
resources and freeing these resources (particularly truetype 
resources) causes crashiness if SDL_Quit is called before. Is 
there a way to have SDL_Quit (and TTF_Quit) called after the GC 
has completed shutting down on program exit?


If not then it could make things very complex and messy to keep 
track of these resources.


Re: Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Ivan Trombley via Digitalmars-d-learn

On Sunday, 17 December 2017 at 02:42:44 UTC, Venkat wrote:

dub build --vverbose

That is the command I used. Would it be right to assume that -g 
is being added because --vverbose ? The reason I ask is the 
file size is about the same when I run the below command.


dub build


You need to add "--build=release", otherwise dub will build debug 
by default.


Re: High-resolution thread sleep

2017-12-14 Thread Ivan Trombley via Digitalmars-d-learn
On Friday, 15 December 2017 at 00:39:13 UTC, Rene Zwanenburg 
wrote:
On Thursday, 14 December 2017 at 23:45:18 UTC, Ivan Trombley 
wrote:

Something along the lines of this:

while (render)
{
  immutable auto startTime = MonoTime.currTime;

  // Render the frame...

  immutable auto remain = m_frameDuration - (startTime - 
MonoTime.currTime);

  if (remain > Duration.zero)
Thread.sleep(remain);
}


In that case, the best thing you can do is use vsync as the 
waiting mechanism ;)


You know, you're right. I'm over-thinking this. Keep it simple.  
:)


Re: High-resolution thread sleep

2017-12-14 Thread Ivan Trombley via Digitalmars-d-learn
On Thursday, 14 December 2017 at 21:47:05 UTC, Rene Zwanenburg 
wrote:
On Thursday, 14 December 2017 at 21:11:34 UTC, Ivan Trombley 
wrote:
I need to be able to put a thread to sleep for some amount of 
time. I was looking at using Thread.sleep but it appears that 
on Windows, it's limited to millisecond resolution. Is there a 
way to do this in a cross-platform way that is higher 
resolution?


Sleeping for very short periods is usually a bad idea for 
various reasons. What do you need it for?


If you really need this, go for a loop with a high resolution 
timer.


Something along the lines of this:

while (render)
{
  immutable auto startTime = MonoTime.currTime;

  // Render the frame...

  immutable auto remain = m_frameDuration - (startTime - 
MonoTime.currTime);

  if (remain > Duration.zero)
Thread.sleep(remain);
}



High-resolution thread sleep

2017-12-14 Thread Ivan Trombley via Digitalmars-d-learn
I need to be able to put a thread to sleep for some amount of 
time. I was looking at using Thread.sleep but it appears that on 
Windows, it's limited to millisecond resolution. Is there a way 
to do this in a cross-platform way that is higher resolution?


Re: SDL2 texture blend help

2017-12-13 Thread Ivan Trombley via Digitalmars-d
On Wednesday, 13 December 2017 at 13:54:28 UTC, Martin DraĊĦar 
wrote:

Dne 13.12.2017 v 4:03 Ivan Trombley via Digitalmars-d napsal(a):

On Wednesday, 13 December 2017 at 01:44:33 UTC, Dmitry wrote:
On Tuesday, 12 December 2017 at 23:28:23 UTC, Ivan Trombley 
wrote:
Here's the code that produces the correct results (exactly 
the same

as GIMP):

Share images you used, please.


Background image: 
http://a4.pbase.com/o10/09/605909/1/166706859.XKZZCnSO.background.png


Foreground image: 
http://a4.pbase.com/o10/09/605909/1/166706860.c1yD4VWp.image.png


Composited through SDL: 
http://a4.pbase.com/o10/09/605909/1/166706869.wLt9RofY.sdl.png


Composited in GIMP 2.9: 
http://a4.pbase.com/o10/09/605909/1/166706870.S01BIhVG.gimp.png


When composited using the code I posted looks exactly like the 
GIMP 2.9 image.


I am not sure, about the tool you use to view the images, but 
on my side (Firefox browser) the sdl and gimp output are very 
different. Maybe some gamma shenanigans going on? Maybe related 
to PNG Gamma correction...


Gamma is exactly the problem. A page back I posted some code that 
will overlay the image onto the background by converting the 
source and destination pixels to linear RGB, compositing them and 
then converting the final pixel back to sRGB for display. That 
code produces the same results as GIMP. Now I just need to figure 
out how to make GL_FRAMEBUFFER_SRGB (which is supposed to do the 
right thing in the GPU) work with SDL.


Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d

Here's a page that describes the issue:
http://ssp.impulsetrain.com/gamma-premult.html


Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d

On Wednesday, 13 December 2017 at 01:44:33 UTC, Dmitry wrote:
On Tuesday, 12 December 2017 at 23:28:23 UTC, Ivan Trombley 
wrote:
Here's the code that produces the correct results (exactly the 
same as GIMP):

Share images you used, please.


Background image:
http://a4.pbase.com/o10/09/605909/1/166706859.XKZZCnSO.background.png

Foreground image:
http://a4.pbase.com/o10/09/605909/1/166706860.c1yD4VWp.image.png

Composited through SDL:
http://a4.pbase.com/o10/09/605909/1/166706869.wLt9RofY.sdl.png

Composited in GIMP 2.9:
http://a4.pbase.com/o10/09/605909/1/166706870.S01BIhVG.gimp.png

When composited using the code I posted looks exactly like the 
GIMP 2.9 image.


Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d

GIMP 2.9, that is.


Re: SDL2 texture blend help

2017-12-12 Thread Ivan Trombley via Digitalmars-d

On Tuesday, 12 December 2017 at 07:12:07 UTC, Dmitry wrote:
On Tuesday, 12 December 2017 at 06:27:30 UTC, Ivan Trombley 
wrote:

This isn't a scaling problem (which is totally solved by

Scaling is not a prerequisite for this problem.


pre-multiplying the alpha with the colors BTW). This is a gamma
How did you this? Using editor or using shader? If shder, show 
the code.

Can you share both images? I want to check.

correction problem which is solved only by converting the 
color values to linear color space before compositing and then 
converting the final pixel back to sRGB.


Are you sure in that? Because what I see is typical alpha 
blending problem.


Here's the code that produces the correct results (exactly the 
same as GIMP):



auto bk =IMG_Load(toStringz(folder ~ "/background.png"));
auto fg =IMG_Load(toStringz(folder ~ "/image.png"));
enum c = (1.0f / 255.0f);
enum g = 2.2f;
enum ig = (1.0f / 2.2f);
immutable int x = (bk.w - fg.w) / 2;
immutable int y = (bk.h - fg.h) / 2;
auto dst = cast(ubyte*) bk.pixels + y * bk.pitch + x * 3;
immutable size_t add = bk.pitch - fg.w * 3;
auto src = cast(ubyte*) fg.pixels;
const auto max = src + fg.h * fg.pitch;
while (src < max)
{
  const auto line = dst + fg.w * 3;
  while (dst < line)
  {
immutable float a = c * src[3];
dst[0] = cast(ubyte)(((1 - a) * (dst[0] * c) ^^ g + a * 
(src[0] * c) ^^ g) ^^ ig * 255);
dst[1] = cast(ubyte)(((1 - a) * (dst[1] * c) ^^ g + a * 
(src[1] * c) ^^ g) ^^ ig * 255);
dst[2] = cast(ubyte)(((1 - a) * (dst[2] * c) ^^ g + a * 
(src[2] * c) ^^ g) ^^ ig * 255);

src += 4;
dst += 3;
  }
  dst += add;
}



Re: Static array as immutable

2017-12-12 Thread Ivan Trombley via Digitalmars-d-learn

On Tuesday, 12 December 2017 at 15:30:01 UTC, Nathan S. wrote:
While what you're saying is true, exponentiation not being 
runnable at compile-time is a defect and I would assume a 
regression. I'll file a bug report. FWIW when trying to run the 
following with DMD v2.077.1 I get:


```
void main(string[] args)
{
import std.stdio;
enum e = (1.0 / 255.0f) ^^ (1 / 2.2f);
writeln("e = ", e);
}
```

=>

[...]/dmd/std/math.d(440): Error: y.vu[4] is used before 
initialized

[...]/dmd/std/math.d(413):originally uninitialized here
[...]/dmd/std/math.d(4107):called from here: 
floorImpl(x)
[...]/dmd/std/math.d(2373):called from here: floor(x + 
0.5L)

[...]/dmd/std/math.d(2110):called from here: exp2Impl(x)
[...]/dmd/std/math.d(6743):called from here: 
exp2(yl2x(x, y))
[...]/dmd/std/math.d(6756):called from here: 
impl(cast(real)x, cast(real)y)


FWIW, if the exponent is an integer, I don't get an error.


Re: Static array as immutable

2017-12-12 Thread Ivan Trombley via Digitalmars-d-learn
On Tuesday, 12 December 2017 at 09:48:09 UTC, Jonathan M Davis 
wrote:
On Tuesday, December 12, 2017 07:33:47 Ivan Trombley via 
Digitalmars-d-learn wrote:

Is there some way that I can make this array immutable?

   static float[256] ga = void;
   static foreach (i; 0 .. 256)
   ga[i] = (i / 255.0f) ^^ (1 / 2.2f);


If you want anything to be immutable, you either have to 
initialize it directly or give it a value in a static 
constructor (and the static constructor solution won't work for 
local variables). So, you'd need to do something like


static immutable float[256] ga = someFuncThatGeneratesGA();

If the function is pure, and there's no way that the return 
value was passed to the function, then its return value can be 
assigned to something of any mutability, since the compiler 
knows that there are no other references to it, and it can 
implicitly cast it, or if the type is a value type (as in this 
case), then you just get a copy, and mutability isn't an issue. 
Alternatively to using a pure function, you can use 
std.exception.assumeUnique to cast to immutable, but that 
relies on you being sure that there are no other references to 
the data, and it may not work at compile-time, since casting is 
a lot more restrictive during CTFE. So, in general, using a 
pure function is preferable to assumeUnique.


- Jonathan M Davis


Ah, it doesn't work. I get this error using the ^^ operator:

/usr/include/dmd/phobos/std/math.d(5724,27): Error: cannot 
convert  to ubyte* at compile time
/usr/include/dmd/phobos/std/math.d(6629,24):called from 
here: signbit(x)
/usr/include/dmd/phobos/std/math.d(6756,16):called from 
here: impl(cast(real)x, cast(real)y)


:(


Re: Static array as immutable

2017-12-12 Thread Ivan Trombley via Digitalmars-d-learn

On Tuesday, 12 December 2017 at 07:44:55 UTC, Radu wrote:
On Tuesday, 12 December 2017 at 07:33:47 UTC, Ivan Trombley 
wrote:

Is there some way that I can make this array immutable?

  static float[256] ga = void;
  static foreach (i; 0 .. 256)
  ga[i] = (i / 255.0f) ^^ (1 / 2.2f);


Check
https://dlang.org/phobos/std_exception.html#assumeUnique


Thanks.


Static array as immutable

2017-12-11 Thread Ivan Trombley via Digitalmars-d-learn

Is there some way that I can make this array immutable?

  static float[256] ga = void;
  static foreach (i; 0 .. 256)
  ga[i] = (i / 255.0f) ^^ (1 / 2.2f);



Re: SDL2 texture blend help

2017-12-11 Thread Ivan Trombley via Digitalmars-d

On Tuesday, 12 December 2017 at 03:34:51 UTC, Dmitry wrote:
On Tuesday, 12 December 2017 at 03:32:05 UTC, Ivan Trombley 
wrote:
It turns out that it's an issue with the color channels being 
in sRGB color space and the alpha channel being linear. I 
verified this by doing a software blend of the images and then 
doing another software blend using gamma corrected values.


There's a setting in opengl to correct for it, 
glEnable(GL_FRAMEBUFFER_SRGB), but I haven't tried this yet.


BTW, also you could use bleeding (for example, 
https://github.com/dmi7ry/alpha-bleeding-d )


This isn't a scaling problem (which is totally solved by 
pre-multiplying the alpha with the colors BTW). This is a gamma 
correction problem which is solved only by converting the color 
values to linear color space before compositing and then 
converting the final pixel back to sRGB.




Re: SDL2 texture blend help

2017-12-11 Thread Ivan Trombley via Digitalmars-d
It turns out that it's an issue with the color channels being in 
sRGB color space and the alpha channel being linear. I verified 
this by doing a software blend of the images and then doing 
another software blend using gamma corrected values.


There's a setting in opengl to correct for it, 
glEnable(GL_FRAMEBUFFER_SRGB), but I haven't tried this yet.


Re: SDL2 texture blend help

2017-12-11 Thread Ivan Trombley via Digitalmars-d

On Monday, 11 December 2017 at 07:04:19 UTC, Mike Parker wrote:
On Monday, 11 December 2017 at 04:57:44 UTC, Ivan Trombley 
wrote:



Any SDL experts out there that can give me a clue?


I've used SDL quite a bit, but can't help with your specific 
problem. However, I suggest you try the new(ish) SDL forums for 
stuff like this. It's particularly off topic here.


https://discourse.libsdl.org


Thanks for the link.


SDL2 texture blend help

2017-12-10 Thread Ivan Trombley via Digitalmars-d
Experimenting with compositing images in SDL2, I get a dark edge 
around my textures. In the image below, you can see the top 
example where I composite the cyan image on top of the 
blue/magenta image looks correct but the bottom example, which is 
done using SDL_RenderCopy is not correct.


http://a4.pbase.com/o10/09/605909/1/166698494.lCoVTgcI.example.png

I tried premultiplying the the colors in the cyan image and 
setting the blend function as such...


  SDL_SetTextureBlendMode(texture, SDL_ComposeCustomBlendMode(
  SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
  SDL_BlendFactor.SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
  SDL_BlendOperation.SDL_BLENDOPERATION_ADD,
  SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
  SDL_BlendFactor.SDL_BLENDFACTOR_ONE,
  SDL_BlendOperation.SDL_BLENDOPERATION_ADD));

...but that produces the exact same thing.


Any SDL experts out there that can give me a clue?



Re: GUI app brings up console

2017-12-06 Thread Ivan Trombley via Digitalmars-d-learn

On Wednesday, 6 December 2017 at 21:35:43 UTC, MrSmith wrote:
On Wednesday, 6 December 2017 at 21:25:27 UTC, Ivan Trombley 
wrote:
I created a cross-platform app using gtk-d. Everything works 
fine but when I run it from Windows, a console window is 
opened. How can I tell Windows that it's a GUI application so 
that a console is not opened (keeping in mind that this app 
also needs to be compiled on Linux and Mac)?


Assuming that you use dub, add this to your dub.json

"lflags-windows" : ["/SUBSYSTEM:windows,6.00", 
"/ENTRY:mainCRTStartup"]


Awesome! TYVM.



GUI app brings up console

2017-12-06 Thread Ivan Trombley via Digitalmars-d-learn
I created a cross-platform app using gtk-d. Everything works fine 
but when I run it from Windows, a console window is opened. How 
can I tell Windows that it's a GUI application so that a console 
is not opened (keeping in mind that this app also needs to be 
compiled on Linux and Mac)?


Re: Building is slow!

2017-12-05 Thread Ivan Trombley via Digitalmars-d
There are issues with using "--build-mode=singleFile --parallel". 
On Windows I get errors saying that it can't write out some 
intermediate files (it looks like the file names may be too long 
for Windows) and on Linux, it makes the executable at least 3 MB 
larger in release mode. Also, it doesn't always seem to make 
building faster. On a 2 core i7 machine, it actually takes nearly 
twice as long to build.


Re: Building is slow!

2017-12-02 Thread Ivan Trombley via Digitalmars-d

On Saturday, 2 December 2017 at 23:26:20 UTC, Ivan Trombley wrote:

On Saturday, 2 December 2017 at 14:34:58 UTC, Arek wrote:
You can try `dub build --build-mode=single-file --parallel`. 
It will execute separate instance of compiler for each source 
file. If --parallel is given, dub will launch several 
instances of dmd in parallel.


I get the error:
  Error processing arguments: BuildMode does not have a member 
named 'single-file'


--build-mode=singleFile seems to work. This shaved off 1/3 of the 
time to compile gtk-d in release mode on Linux, so I'm going to 
give this a try on Windows.


Re: Building is slow!

2017-12-02 Thread Ivan Trombley via Digitalmars-d

On Saturday, 2 December 2017 at 14:34:58 UTC, Arek wrote:
You can try `dub build --build-mode=single-file --parallel`. It 
will execute separate instance of compiler for each source 
file. If --parallel is given, dub will launch several instances 
of dmd in parallel.


I get the error:
  Error processing arguments: BuildMode does not have a member 
named 'single-file'



On Saturday, 2 December 2017 at 22:54:56 UTC, Indigo wrote:
I haven't tried gtkd in a while but when I did it built in 
seconds... I was not using dub though but the build script that 
comes with it.


My project has
  "dependencies": {
"gtk-d": "3.7.2"
  }

To build release, it takes more than three minutes to build gtk-d 
on Linux (Ryzen 7 1700 processor).




Re: Building is slow!

2017-12-02 Thread Ivan Trombley via Digitalmars-d

On Saturday, 2 December 2017 at 03:08:10 UTC, rjframe wrote:

There is a --parallel flag: `dub build --parallel`.

The help string says it "Runs multiple compiler instances in 
parallel, if possible."


Thanks, I'll give that a try. After an hour, I pressed CTRL+C, 
shut it down and went home.


Building is slow!

2017-12-01 Thread Ivan Trombley via Digitalmars-d
When DUB bulds the gtk-d library, it takes a long time. This is 
mostly because it's only using one processor. It hasn't been such 
a big deal on Linux but I'm building my app on Windows right now 
and it been building gtk-d for the last half hour! Is there any 
way to make DUB use more processors?


Re: Localization (i18n) Options

2017-11-30 Thread Ivan Trombley via Digitalmars-d
Figured it out. I was initializing some member strings where they 
were declared in a class. I just needed to move that 
initialization to the constructor.


Re: Localization (i18n) Options

2017-11-30 Thread Ivan Trombley via Digitalmars-d

On Thursday, 30 November 2017 at 00:50:35 UTC, Gerald wrote:
On Tuesday, 28 November 2017 at 07:39:19 UTC, Ivan Trombley 
wrote:

On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote:

On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
Please, write a HowTo some where. GtkD lack of documentation 
it's very anoying.


I've gotten this going with Terminix and posted some 
information what it took to get it going here:


http://gexperts.com/wp/gtkd-and-localization/


I tried this out but I get this compile error:
  "Error: static variable c_g_dgettext cannot be read at 
compile time"


Did you have any issues like this?


Nope, you can see how Tilix is doing localization in it's repo 
below. I haven't looked at the localization code in awhile so I 
can't remember how well it still aligns with that blog post.


https://gitHub.com/gnunn1/tilux


Page not found, 404.


BTW, this is what I tried:

import glib.Internationalization;

string t(string text)
{
  return Internationalization.dgettext([], text);
}

That generates these errors:

~/.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/glib/Internationalization.d(103,23):
 Error: static variable c_g_dgettext cannot be read at compile time
~/.dub/packages/gtk-d-3.7.2/gtk-d/generated/gtkd/glib/Internationalization.d(103,22):
called from here: toString((*c_g_dgettext)(toStringz(domain), 
toStringz(msgid)), 0LU)


Re: Localization (i18n) Options

2017-11-27 Thread Ivan Trombley via Digitalmars-d

On Sunday, 24 January 2016 at 19:18:28 UTC, Gerald wrote:

On Monday, 18 January 2016 at 09:04:48 UTC, Luis wrote:
Please, write a HowTo some where. GtkD lack of documentation 
it's very anoying.


I've gotten this going with Terminix and posted some 
information what it took to get it going here:


http://gexperts.com/wp/gtkd-and-localization/


I tried this out but I get this compile error:
  "Error: static variable c_g_dgettext cannot be read at compile 
time"


Did you have any issues like this?



Re: GtkD help

2017-11-20 Thread Ivan Trombley via Digitalmars-d-learn

On Monday, 20 November 2017 at 08:01:28 UTC, Ivan Trombley wrote:

I solved the TreeView text cooler l color issue by using markup.


Phoned.


Re: GtkD help

2017-11-20 Thread Ivan Trombley via Digitalmars-d-learn
Since I wanted people to just be able to run the executable and 
not have to go through some install process, glib.Settings turned 
out to be a no-go since it requires a schema file to be installed 
in a specific place. Instead, I just create a json sidecar file 
next to the app in order to store settings.


I solved the TreeView text cooler l color issue by using markup.

The application code is in this repository of anyone is 
interested: https://github.com/Barugon/CotA


Re: GtkD help

2017-11-19 Thread Ivan Trombley via Digitalmars-d-learn

On Sunday, 19 November 2017 at 13:59:10 UTC, Mike Wey wrote:

On 18-11-17 22:57, Ivan Trombley wrote:

[...]


To change how a cell is rendered you will need to add a 
CellRenderer to the column, a CellRendererText would be used 
for rendering text and it has a foreground property to change 
the text color.


A small example on using CellRenderers can be found here: 
https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/DemoMultiCellRenderer/DemoMultiCellRenderer.d


If the color needs to differ between the different rows you can 
use TreeViewColumn.addAttribute to map a property of an 
renderer to a value on the TreeModel.


If the color depends on the value of the cell 
TreeViewColumn.setCellDataFunc() is also an option.


Thanks. It looks like setCellDataFunc is what I need.


Re: GtkD help

2017-11-19 Thread Ivan Trombley via Digitalmars-d-learn

On Sunday, 19 November 2017 at 09:54:06 UTC, Antonio Corbi wrote:
On Saturday, 18 November 2017 at 22:31:15 UTC, Ivan Trombley 
wrote:
Any information about using gio.Settings would be really 
appreciated too.


Hi Ivan,

I would recommend you to search for information about Gtk under 
valadoc pages [1]. You'll get Vala syntax but doing the 
mental-mapping to D+GtkD is automatic, i.e TreeView [2] and 
Glib Settings [3].


A. Corbi

[1] https://valadoc.org/index.htm
[2] https://valadoc.org/gtk+-3.0/Gtk.TreeView.html
[3] https://valadoc.org/gio-2.0/GLib.Settings.html



Thanks. I'll give it a look.


Re: GtkD help

2017-11-18 Thread Ivan Trombley via Digitalmars-d-learn
Any information about using gio.Settings would be really 
appreciated too.


GtkD help

2017-11-18 Thread Ivan Trombley via Digitalmars-d-learn
I have this small application for viewing select log data from a 
certain game that I originally wrote in C++/Qt. For various 
reasons, I decided to rewrite this app in D using gtk-d. First, I 
have to say that the documentation for gtk-d is atrocious! 
However, I managed to cobble together enough information to get 
80% of it done.


I would like to be able to controll how the cells in a TreeView 
are rendered (ie the text color used) but I'm not able to find 
any information about how to do this. Does any one have 
experience here? If so, can you please give me a clue?


DUB: "Invalid source/import path"

2017-05-14 Thread Ivan Trombley via Digitalmars-d-dwt
If I use DWT 3.0.0 as a dependency in my dub.json then DUB 
reports "Invalid source/import path" for 
~/.dub/packages/dwtlib-3.0.0/dwtlib/dwt/src and 
~/.dub/packages/dwtlib-3.0.0/dwtlib/dwt/views.


Any ideas?



Re: DUB: Multiprocess?

2017-05-14 Thread Ivan Trombley via Digitalmars-d

On Sunday, 14 May 2017 at 21:01:37 UTC, Basile B. wrote:

On Sunday, 14 May 2017 at 20:23:17 UTC, Ivan Trombley wrote:
When I build C++ projects using make, I can specify how many 
processes I want to use (-j). This keeps the processors full 
and happy and greatly reduces the overall build time. Does DUB 
have a similar way of compiling each file in it's own process 
or thread?


There's the "--parallel" switch for that. Example


dub build --build=release --parallel


It's in the documentation.


I tried that and only one processor is used. The rest are idle.


DUB: Multiprocess?

2017-05-14 Thread Ivan Trombley via Digitalmars-d
When I build C++ projects using make, I can specify how many 
processes I want to use (-j). This keeps the processors full and 
happy and greatly reduces the overall build time. Does DUB have a 
similar way of compiling each file in it's own process or thread?