Re: arsd-minigui - couple of questions

2022-04-11 Thread sai via Digitalmars-d-learn

On Monday, 11 April 2022 at 13:14:16 UTC, Adam D Ruppe wrote:

On Monday, 11 April 2022 at 12:40:29 UTC, sai wrote:
One more request, is it possible for you to do to ImageBox 
what you did to Button to show the transparent images (png)? 
Because Imagebox is showing black color for transparent pixels.


oh yeah this one is different because the imagebox custom draws 
it, so it is really as simple as passing `true` to the opacity 
there too when it converts.


Try this diff:

https://github.com/adamdruppe/arsd/commit/912047ccdda7e7775f64431a631519e6024d2494

i think it fixes it, let me know.


Done, it works. Awesome thanks.



Re: arsd-minigui - couple of questions

2022-04-11 Thread sai via Digitalmars-d-learn
One more request, is it possible for you to do to ImageBox what 
you did to Button to show the transparent images (png)? Because 
Imagebox is showing black color for transparent pixels.


I tried to see the git history to see if I can make that change 
to Imagebox and submit a pull request, but I am lost and don't 
think I understand the code well enough.


Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn

Thanks Adam for all the help :)




Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn

Found this: https://bugs.llvm.org/show_bug.cgi?id=38797

Seems like a linker bug? So we have to wait for the fix to show 
up in dmd package.




Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
Interestingly I get the same error if I change the pragma test to 
"BLAH"



lld-link: error: BLAH is not allowed in .drectve


I suspect something is going wrong when passing the linker 
options from pragma to the linker itself.


However, if I uncomment the pragma and explicitly place the 
manifest file it works (as you mentioned before). I will use it 
this way for now. But fixing the pragma will be awesome if we can 
get rid of the manifest file.





Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn
Actually as you mentioned, I did find the changes in minigui.d 
file. I will try tweaking the  pragma there see if anything works.




Re: arsd-minigui - couple of questions

2022-03-29 Thread sai via Digitalmars-d-learn

On Monday, 28 March 2022 at 23:03:01 UTC, Adam Ruppe wrote:
In fact, using a pragma now, I think I got it so you don't even 
need the manifest now (the pragma includes a default one now).


Only works when doing dmd -m32mscoff or dmd -m64 builds (which 
are also what dub uses fyi), will NOT work with a default dmd 
no-switch build.


I just cloned the latest arsd lib from github today and compiled 
the example. Got an error. Switched on verbose flag for dub and 
here is the output:


(Lines below until the error is just one giant line, I split them 
here for clarity)


```
C:\dlang\dmd2\windows\bin64\dmd.exe 
-of.dub\build\application-debug-windows-x86_64-dmd_v2.099.0-dirty-9C73C615E47957E2F0196C61BFACFF7A\app.exe


.dub\build\application-debug-windows-x86_64-dmd_v2.099.0-dirty-9C73C615E47957E2F0196C61BFACFF7A\app.obj

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-5128CD87C77EA53A12BDD90A8B37E0E4\arsd-official_image_files.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-66D647CCA1055F2F9BD2C4AAD0551124\arsd-official_bmp.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-8F6807A564A94A3E26A5FDE91B0A798F\arsd-official_imageresize.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-24F06AB33E1AC529F9B3C0A9DEA4B137\arsd-official_jpeg.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-ABDB0882B5E2D9CDE956E9E845377256\arsd-official_png.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-1DE97EFE0E43837E141C233C0AA5C31F\arsd-official_svg.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-0128B44A475FA39689E2D238F5500D0D\arsd-official_minigui.lib

C:\dlang\arsd\.dub\build\normal-debug-windows-x86_64-dmd_v2.099.0-dirty-CD2FC136BEDCF32714DEA23BE867AC78\arsd-official_simpledisplay.lib

C:\dlang\arsd\.dub\build\library-debug-windows-x86_64-dmd_v2.099.0-dirty-1A0BC8A3D79617FC811AC1F1422195CC\arsd-official_color_base.lib
 gdi32.lib ole32.lib -m64 -g

lld-link: error: /manifestdependency: is not allowed in .drectve
Error: linker exited with status 1
FAIL 
.dub\build\application-debug-windows-x86_64-dmd_v2.099.0-dirty-9C73C615E47957E2F0196C61BFACFF7A\ app executable

C:\dlang\dmd2\windows\bin64\dmd.exe failed with exit code 1.
```

I searched for "manifestdependency" and "drectve" (w/o quotes) in 
arsd lib and couldn't find them so not sure how to debug this 
further. I also removed the explicit manifest file from the 
directory of the exe file (its presence didn't make any 
difference anyway, as exe file is not created as link failed).








Re: arsd-minigui - couple of questions

2022-03-28 Thread Sai via Digitalmars-d-learn

On Monday, 28 March 2022 at 18:03:32 UTC, Adam Ruppe wrote:

On Monday, 28 March 2022 at 17:00:42 UTC, sai wrote:
1. I assume arsd-minigui library does not support transparent 
images by itself, does it? I am trying to show a png image 
with transparent areas on a button, but those transparent 
areas shows as black color.


Well, I tried forwarding the flag, I can custom draw it this 
way but the standard Windows button's normal draw doesn't 
appear to care...


There might be a trick I just don't know, but the problem is I 
don't know it lol.



Thanks for the reply and the help.

FWIW, DWT which uses native controls on windows can show 
transparent pngs and also both image & text at the same time. 
However I had to add the following app.exe.manifest file in the 
same folder as the app.exe file. Otherwise it only shows text or 
image but not both. Not sure if this helps, but just want to let 
you know. Honestly I have no idea how this works under the hood.


```

manifestVersion="1.0">

  
  
  

  

  

```



Re: arsd-minigui - couple of questions

2022-03-28 Thread sai via Digitalmars-d-learn

On Monday, 28 March 2022 at 17:00:42 UTC, sai wrote:
1. I assume arsd-minigui library does not support transparent 
images by itself, does it? I am trying to show a png image with 
transparent areas on a button, but those transparent areas 
shows as black color.



2. I want to show both image and text on a button, but looks 
like it shows image or text, but not both at the same time. Or 
am I missing some weird windows manifest stuff?


I am using latest arsd library on windows 10.

Thanks


BTW, the code is very simple:

```d
import arsd.minigui;

void main() {
auto window = new Window();
	auto headBut = new Button(ImageLabel("Button name", 
MemoryImage.fromImage("file.png")), window);

window.loop();
}
```


arsd-minigui - couple of questions

2022-03-28 Thread sai via Digitalmars-d-learn
1. I assume arsd-minigui library does not support transparent 
images by itself, does it? I am trying to show a png image with 
transparent areas on a button, but those transparent areas shows 
as black color.



2. I want to show both image and text on a button, but looks like 
it shows image or text, but not both at the same time. Or am I 
missing some weird windows manifest stuff?


I am using latest arsd library on windows 10.

Thanks






Re: D Language Foundation Monthly Meeting Summary

2021-06-07 Thread sai via Digitalmars-d-announce
On Saturday, 5 June 2021 at 09:58:23 UTC, Ola Fosheim Grøstad 
wrote:
You mean the wait-for-everything-to-stop-scan-everything 
approach will remain?


What is the area that D is trying to cover though?

Somebody should write a memo on that.



My use case of writing GUI apps for desktop - presence of GC does 
not matter for me at all. In fact its great for me. Hopefully D 
will not stop covering these use cases.


I know all the web-apps folks who wants to serve 100 
requests per second will not like GC, I guess.






GtkD global font size

2018-01-14 Thread Sai via Digitalmars-d-dwt
I am writing a small GUI application using GtkD3 Builder and 
Glade. On a HD monitor the default font size is too small. The 
adwaita theme is not great but I can live with it.


Is there any way to globally increase the font size in the GtkD?

I tried the settings.ini file, but that did not help with my 
GtkD3 app. On the other hand, it did increase the global font 
size of the Glade tool, just not my application. Is some how GtkD 
different from pure Gtk application?


Thanks in advance.
-Sai



Re: Gui in D: I miss this project

2017-01-11 Thread Sai via Digitalmars-d

On Wednesday, 11 January 2017 at 09:17:45 UTC, aberba wrote:

On Wednesday, 11 January 2017 at 07:21:22 UTC, thedeemon wrote:

On Monday, 9 January 2017 at 21:41:37 UTC, aberba wrote:

[...]


No drag, DLangUI is quite fine and usable (and already being 
used in industry).
Or are you talking about including it into Phobos? That's not 
the best idea, it would make Phobos unnecessary fat and 
involve some dependencies complicating things, besides there 
is never a consensus regarding a GUI library, trying to 
include any GUI library is a recipe for eternal flamewar about 
all the different aspects of what GUI library should be and do.

If you need some GUI, DLangUI is just a "dub build" away.


I'm worried about it not becoming abandoned.


I guess this is a risk with any free SW, the risk of it getting 
abandoned. Unless someone is willing to pay money for support 
contracts, which is not possible for hobbyists like me. Nor can I 
support it myself as I am not an expert in that field.


After suffering from this couple of times, I now tend to prefer 
SW from big corporations which hopefully will be supported for 
few years or SW from communities which are large enough to pick 
things up when things are abandoned.


Didn't mean to offend anyone, just thinking out loud.







Popular embedded language for scripting in D

2016-11-19 Thread Sai via Digitalmars-d-learn
I have seen luad and Walters own JavaScript VM that can be used 
in D for embedded scripting purpose in an application.


I was wondering which is more popular among D applications? Any 
suggestions?


Thanks, sai




Re: Overloading relational operators separately; thoughts?

2016-09-30 Thread Sai via Digitalmars-d

   a.isLessThan(b)



I understand the concern of possible mess due to unrestricted use 
of operator overloading (like C++). Java has clearly driven the 
point home by banning the operator overloading altogether.


Genuine question: In the post Java languages, how many languages 
allowed unrestricted operator overloading and did that cause any 
similar mess?


Thanks in advance for any answers.




Re: Overloading relational operators separately; thoughts?

2016-09-29 Thread Sai via Digitalmars-d
I.e. you can overload '+' to do bad things. Yes, you can, and 
as I replied upthread that can be done because there's no way 
to prevent that while having operator overloading at all.


But that is not justification for allowing such disasters for 
the comparison operators. I.e. one weakness is not 
justification for opening the door to all weakness.


If I understand the issue correctly, one will not be able to 
overload <=, >, etc for symbolic math, like CAS (mimicking 
mathematica for example), how can I do it now?


Wouldn't the current rules discourage someone from implementing 
CAS like library in D?





Re: Argumnentation against external function operator overloading is unconvincing

2016-09-23 Thread Sai via Digitalmars-d
The greatest offender I've found is how in phobos, arrays do 
not behave as ranges without importing the module defining 
their range operations.


Could you please tell me what module is it? is it std.array?



Re: Replace/Rename DWT forum with GUIs forum?

2016-09-20 Thread Sai via Digitalmars-d

On Sunday, 18 September 2016 at 23:21:26 UTC, Gerald wrote:
I would like to suggest that the existing DWT forum be renamed 
or replaced with a more generic GUIs forum. As far as I can 
tell, the DWT forum doesn't get much traffic these days and I 
don't believe any of the current GUI options for D are 
sufficiently popular to warrant their own specific forum.


While I primarily work with and have an interest in GtkD, I'm 
interested in posts with regards to all of the available GUI 
options (GtkD, DLangUI, etc) for D since I have general 
interest in desktop applications. I think grouping everything 
in one forum, similar to what is done for IDEs and Debuggers, 
would bring together posts and people that share a common 
interest.


Indeed, now that there are few good quality gui libs, we must 
rename the forum to GUIs, DWT is too specific and I wonder how 
many people even know what DWT is.







Re: What is the most stable D compiler

2016-09-15 Thread Sai via Digitalmars-d


If stability is more important, I recommend to only update to 
x.y.2 or higher releases, just don't update to x.y.0 releases.


yes, reliability is more important, could you, please, point 
out the link where i can read about versions?


Here is the changelog page:

https://dlang.org/changelog/2.071.1.html





Re: What is the most stable D compiler

2016-09-15 Thread Sai via Digitalmars-d

On Thursday, 15 September 2016 at 13:02:29 UTC, eugene wrote:
On Thursday, 15 September 2016 at 06:26:40 UTC, Jacob Carlborg 
wrote:

On 2016-09-14 13:42, rikki cattermole wrote:

GDC is the slowest to update currently so that can be ignored 
for now.
LDC has fairly fast updates in terms of the frontend and can 
target more

platforms.


I would say 42 minutes for LDC is good enough :) [1]

[1] 
http://forum.dlang.org/post/b328372d-686e-9931-03ba-c2db13e0b...@yahoo.com


so, ldc is also not stable as dmd?



If stability is more important, I recommend to only update to 
x.y.2 or higher releases, just don't update to x.y.0 releases.





Re: Promotion rules ... why no float?

2016-09-07 Thread Sai via Digitalmars-d
On Wednesday, 7 September 2016 at 16:04:05 UTC, Nick Treleaven 
wrote:
On Wednesday, 7 September 2016 at 15:15:03 UTC, John Colvin 
wrote:
python3 uses / for floating point division and // for integer. 
I really like the distinction, although I would prefer if / 
was disallowed on integer operands entirely, i.e. 3/2.0 is ok 
but 3/2 is not, that would be an error and you'd have to do 3 
// 2


Personally I agree. A more nuanced solution is filed here:
https://issues.dlang.org/show_bug.cgi?id=12452

At the end of the description, Don is quoted:


It is indeed a common floating-point bug.
...


WOW, I didn't know python 3 fixed this issue, and I just found 
out that python 2 can also do it by importing from future.


I have been using python 2.7 at my work for several years without 
knowing this and ran into this issue so many times, stupid me. 
Thanks for the info, I will update my python code asap. (In my 
defense, I am not a full time programmer).


In D though, all solutions seem to add noise at the usage site, 
template solution with alias this might be the cleanest to 
retrofit all integers with floating point division.


- Sai



Re: Promotion rules ... why no float?

2016-09-07 Thread Sai via Digitalmars-d
I suspected the same, most of the CPUs support fast floating 
point operations anyway (with FPUs), shouldn't take a lot more 
time than doing integer arithmetic. Unless we are targeting 8bit 
avr or something similar.


And precision argument doesn't seem strong either, since, which 
is more precise 3/7 = 0 or 0.4285 ?


I am not suggesting we change the promotion rules now, most 
likely never going to happen. But I am trying to find a good 
rationale for the existing rules and unable to find a good one.






On Wednesday, 7 September 2016 at 05:31:08 UTC, Daniel Kozak 
wrote:

Dne 6.9.2016 v 22:51 deadalnix via Digitalmars-d napsal(a):

On Tuesday, 6 September 2016 at 07:52:47 UTC, Daniel Kozak 
wrote:
No, it is really important rule. If there will be automatic 
promotion to float for auto it will hurt performance

in cases when you want int and it will break things.



The performance have nothing to do with it. In fact float 
division is way faster than integer division, try it. It is 
all about correctness. Integer and floating point division 
have different semantic.




You are right, on my pc speed is same, but I am remember that 
there has been some performance problems last time i checked 
(something about only one FPU on my bulldozer cpu)





Re: Usability of D for Visually Impaired Users

2016-09-06 Thread Sai via Digitalmars-d
I have few suggestions, especially for people like me with 
migraine, it could be a bit easy eyes and overall less stressful.


1. The "Jump to" section at the top lists all the items available 
in that module nicely, but the layout could be improved if it 
were listed as a bunch of columns instead of one giant list with 
flow layout.


Even better if they are listed as the "cheat sheet" available in 
algorithm module (which is lovely BTW). Can this cheat sheet be 
automated for all modules?



2. I know red is the color of Mars, is there any way to change 
the theme to blue or something soft? Since we can download the 
documentation, is there an easy way to do it myself maybe?



PS: As many people have already said, documentation has improved 
very very much recently. Thank you for all the people working on 
it.





Re: Promotion rules ... why no float?

2016-09-06 Thread Sai via Digitalmars-d

Thanks for the replies.

I tend to use a lot of float math (robotics and automation) so I 
almost always want float output in case of division. And once in 
a while I bump into this issue.


I am wondering what are the best ways to work around it.

float c = a / b; // a and b could be integers.

Some solutions:

float c = cast!float(a) / b;
float c = 1f * a / b;


Any less verbose ways to do it?

Another solution I am thinking is to write a user defined integer 
type with an overloaded division to return a float instead and 
use it everywhere in place of integers. I am curious how this 
will work out.





Promotion rules ... why no float?

2016-09-06 Thread Sai via Digitalmars-d

Consider this:

import std.stdio;
void main()
{
byte a = 6, b = 7;
auto c = a + b;
auto d = a / b;
writefln("%s, %s", typeof(c).stringof, c);
writefln("%s, %s", typeof(d).stringof, d);
}

Output :
int, 13
int, 0

I really wish d gets promoted to a float. Besides C 
compatibility, any reason why d got promoted only to int even at 
the risk of serious bugs and loss of precision?


I know I could have typed "auto a = 6.0" instead, but still it 
feels like an half-baked promotion rules.





Re: DMD on ARM/Linux (for controlling EV3 Lego Mindstorm)?

2016-08-21 Thread Sai via Digitalmars-d-learn

Thanks all for your replies.

I tried to use GDC first, I couldn't find windows binary 
targeting windows (for initial testing) which I thought was 
weird. https://gdcproject.org/downloads


So I tried to build it in Cygwin env, using these instructions:
http://wiki.dlang.org/GDC/Installation/Generic
(I used gcc-5.2 sources for this).

Unfortunately, it failed with the following error. Any ideas?

I am tempting towards go, looks like their windows binary 
supports compiling to both windows and arm. Unfortunately I don't 
want to use go as it lacks templates (or generics) and operator 
overloading, as I tend to use lot of vector/matrix math in my 
programs.



gcc/d/dfrontend -Id 
../../gcc-5.2.0/gcc/d/dfrontend/filename.c
../../gcc-5.2.0/gcc/d/dfrontend/filename.c: In static 
member function ‘static bool FileName::ensurePathExists(const 
char*)’:
../../gcc-5.2.0/gcc/d/dfrontend/filename.c:602:43: error: 
‘sep’ was not declared in this scope

 if (path[strlen(path) - 1] != sep)
   ^
../../gcc-5.2.0/gcc/d/dfrontend/filename.c:611:21: error: 
‘r’ was not declared in this scope

 if (r)
 ^
../../gcc-5.2.0/gcc/d/dfrontend/filename.c:616:25: error: 
‘errno’ was not declared in this scope

 if (errno != EEXIST)
 ^
../../gcc-5.2.0/gcc/d/dfrontend/filename.c:616:34: error: 
‘EEXIST’ was not declared in this scope

 if (errno != EEXIST)
  ^
make[2]: *** [../../gcc-5.2.0/gcc/d/Make-lang.in:115: 
d/filename.o] Error 1

make[2]: *** Waiting for unfinished jobs
rm gcc.pod gdc.pod
make[2]: Leaving directory '/home/sai/gdc/objdir/gcc'
make[1]: *** [Makefile:4127: all-gcc] Error 2
make[1]: Leaving directory '/home/sai/gdc/objdir'
make: *** [Makefile:867: all] Error 2



DMD on ARM/Linux (for controlling EV3 Lego Mindstorm)?

2016-08-02 Thread Sai via Digitalmars-d-learn
I see that there are ports of go compiler on ev3dev (ARM, debian 
based) for controlling the EV3 lego mindstorm robot. 
(http://www.ev3dev.org/docs/libraries/)


Is there a port of a D compiler for ARM? How about libraries? I 
need a basic file IO and console IO for controlling the robot.


Thanks in advance
Sai