Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-28 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 27 September 2019 at 12:42:56 UTC, Jacob Carlborg 
wrote:


For macOS you should distribute a GUI application for end users 
as an application bundle [1]. That's basically a directory 
containing a specific structure. Any dependencies and resources 
like libraries (GTK), images and so on should be bundled inside 
the application bundle. Then package the application bundle 
inside an archive, ideally a Disk Image (DMG) [2]. The 
application would be completely self contained and the user can 
install it by dragging it to the Application directory.


There might be some specific documentation how to bundle a GTK 
application on macOS. I found this [3], don't know if it's good 
or not.


Ideally the application should be distributed on the Mac App 
Store. But that requires a developer account that costs money. 
It also has some restrictions that distribution outside of the 
Mac App Store doesn't have. If you cannot distribute using the 
Mac App Store the next best thing is to notarize the 
application (also requires a paid developer account, as far as 
I can see) before distributing it. Otherwise the user will get 
a dialog complaining that the application is from an unknown 
developer and the user need to explicitly go into System 
Preferences to allow it.


[1] 
https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/1123i-CH101-SW1


[2] https://en.wikipedia.org/wiki/Apple_Disk_Image
[3] https://gitlab.gnome.org/GNOME/gtk-mac-bundler

--
/Jacob Carlborg


Excellent, Jacob. Thanks for all that.


Blog Post #74: Cairo IX - Doodle a Noodle

2019-09-27 Thread Ron Tarrant via Digitalmars-d-learn
Because at this point we've covered almost every widget GtkD has 
to offer, today we're taking a departure from that to do 
something non-standard.


Nodes-n-noodles are becoming more popular as UI elements, so this 
is the beginnings of how we can get this paradigm working in GtkD.


You can find part one here: 
https://gtkdcoding.com/2019/09/27/0074-cairo-doodle-a-noodle.html




Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-26 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 26 September 2019 at 10:10:20 UTC, bioinfornatics 
wrote:


I prefer to use meson a builder tool (same category tool as 
Make, CMake ...)

doc: https://mesonbuild.com/Dlang-module.html

Is better as it ease the packaging for fedora, debian, ubuntu 
and so on ...


This is good to know. Thank you, bioinfornatics.


Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-26 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 26 September 2019 at 16:30:39 UTC, Andre Pany wrote:

Dub is a tool for developers, I understand your requirements 
that you want target end customers of your applications. 
Therefore dub is the wrong tool for this job.


To be more precise, gtkd is a wrapper for GTK. Gtkd is not 
interesting in this context, but the dependency on gtk. On 
windows you have the possibility to either publish your 
application with GTK dlls or to run gtk setup routine as part 
of your application setup routine or just say in your readme 
that the customer needs to run GTK setup on there own.


On posix (linus, macos) of course you can also say in your 
readme that the customer should run apt-get ... to install gtk 
(here I do not have much knowledge on packaging).


Kind regards
Andre


Excellent. That's exactly what I needed to know, Andre. Thanks 
very much.


Re: Looking for a Simple Doubly Linked List Implementation

2019-09-25 Thread Ron Tarrant via Digitalmars-d-learn

On Monday, 23 September 2019 at 22:40:41 UTC, Ali Çehreli wrote:

So, what was it then? Append to an array, sort it, and be 
happy? :)


Ali


Hi, Ali,

It turns out that the GTK Notebook has its own built-in mechanism 
for tracking tabs. Two things got me going down the wrong road on 
this:


1) the fact that Notebook.appendPage() returns an ever-increasing 
index each time a page is added, and

2) trying to quit caffeine.

I chased my tail for a full week (seriously: a full week!) trying 
to come up with a way to track tabs. Then I got tired of doing 
face-plants on my desk, took up coffee again, and solved it in 
three hours.


The moral of the story is: don't quit coffee until you have 
nothing left to contribute to this world. :)


Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-25 Thread Ron Tarrant via Digitalmars-d-learn
On Wednesday, 25 September 2019 at 13:52:48 UTC, bioinfornatics 
wrote:


I think I misunderstood your need but are lo looking for dub 
tool with its repository https://code.dlang.org/


I don't think so, but I could be wrong. I tried reading up on 
dub, but got lost in the docs, so I really don't understand what 
all it can do.




Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-25 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 25 September 2019 at 12:32:58 UTC, a11e99z wrote:


so u need installers/installation program
https://en.wikipedia.org/wiki/List_of_installation_software

well, a long-long time ago I used InstallShield & Wix Toolset 
for Windows only.


I'll check those out. Thanks.


Re: Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-25 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 25 September 2019 at 11:50:58 UTC, a11e99z wrote:
On Wednesday, 25 September 2019 at 11:46:04 UTC, Ron Tarrant 
wrote:

Hi y'all,

I've been Googling how to do this, but coming up with nothing 
definitive. Are there any articles for how to do this for:


Windows?
Linux?
other UNIX-alike OSs?


UPX?
https://en.wikipedia.org/wiki/UPX
https://linux.die.net/man/1/upx


Thanks for the reply, alle99z. Sorry for my badly-phrased 
question, I think I need to clarify...


What I'm looking for is a system for bundling dlang apps and 
their dependencies for distribution to end users. Hopefully, this 
bundler will:


- install the app in an appropriate place (like C:\Program 
Files\,
- install libraries/dependencies (such as GtkD) also in an 
appropriate place,
- make any modifications to the system PATH that may be necessary 
for the app to run, and
- handle any other roadblocks that will keep the user from using 
the app.


Whether this is an actual pre-existing application bundler or 
just a list of instructions I can follow so I can end up with a 
distributable one-click-does-it-all (on Windows, at least) 
package.


Similarly, on Linux or other UNIX-alikes, a breakdown of how to 
use apt or something similar to do the same so the user can (for 
instance) just do:


apt-get  

to install.


Packaging and Distributing Dlang Applications with GtkD Dependency?

2019-09-25 Thread Ron Tarrant via Digitalmars-d-learn

Hi y'all,

I've been Googling how to do this, but coming up with nothing 
definitive. Are there any articles for how to do this for:


Windows?
Linux?
other UNIX-alike OSs?



Blog Post #73: The Frame, Part II

2019-09-24 Thread Ron Tarrant via Digitalmars-d-learn
Today we cover how to decorate the Frame... or UN-decorate it. 
Frames can be turned off or dressed up with CSS. To find out 
more, follow this link: 
https://gtkdcoding.com/2019/09/24/0073-frame-part-ii.html


Re: Looking for a Simple Doubly Linked List Implementation

2019-09-23 Thread Ron Tarrant via Digitalmars-d-learn
Well, it turns out, I didn't need a linked list, doubly or 
otherwise. That's what happens when a person quits coffee for a 
week: complete brain chaos.


For a full week, I banged on this, trying to work out a scheme 
whereby I could track GTK Notebook tabs with a doubly-linked 
list, an array, and any other mechanism that came to mind. That 
was my caffeine-free week of getting absolutely nothing done. 
(Twice, I actually forgot my name.)


This morning, I had a coffee, realized I was not just on the 
wrong track, but in the wrong train station and within 45 
minutes, I had eight Notebook demos working perfectly.


Let this serve as a warning, no matter how much you may think you 
need to go off the caffeine, it's just not worth it.


Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn

Sorry. I posted the wrong file. This is the one that works:

```
import std.stdio;
import std.conv;

class TabList
{
private:
Tab _head;
int _lastUniqueID = 0;
string labelText;

this()
{
append();
}


void append()
{
string labelText = "Tab " ~ _lastUniqueID.to!string();
Tab current;

if(_head is null)
{
_head = new Tab(_lastUniqueID, labelText);
_head.setPrev(null);
_head.setNext(null);
}
else
{
current = _head;
//writeln("before the while loop");
//current.showThings();

while(current.getNext() !is null)
{
//  writeln("in the while loop...");
//  current.showThings();

//  if(current.getPrev() !is null)
//  {
//  writeln("prev = ", 
current.getPrev().getTabID());
//  }
//  else
//  {
//  writeln("prev = null");
//  }
current = current.getNext();
}
//writeln("out of the while loop\n");
Tab tab = new Tab(_lastUniqueID, labelText);
current.setNext(tab);
tab.setPrev(current);
}

_lastUniqueID++;

} // append()


Tab getHead()
{
return(_head);

} // getHead()


void removeTab(int uniqueID)
{
// get the head
Tab current = _head;

// walk the list to find the Tab with the uniqueID
while(current.getNext() !is null)
{
// if the uniqueID matches the head's ID
if(current.getTabID() is uniqueID)
{
// destroy the Tab object
current.destroy(uniqueID);
break;
}

// go to the next Tab
current = current.getNext();
}


} // removeTab()

} // class TabList


class Tab
{
private:
int _tabID;
string _label;
Tab _prev = null, _next = null;

public:
this(int uniqueID, string labelText)
{
_tabID = uniqueID;
_label = labelText;

} // this()


void showThings()
{
writeln("Tab = ", getTabID());

if(getPrev() !is null)
{
writeln("Tab.prev = ", getPrev().getTabID());
}
else
{
writeln("Tab.prev is null");
}

if(getNext() !is null)
{
writeln("Tab.next = ", getNext().getTabID());
}
else
{
writeln("Tab.next = null");
}

} // showThings()


void destroy(int id)
{
if(_tabID is id)
{
// destroy the TextView
// destroy the Label
_prev.setNext(_next);
_next.setPrev(_prev);
}

} // destroy()


Tab getNext()
{
return(_next);

} // getNext()


Tab getPrev()
{
return(_prev);

} // getPrev()


int getTabID()
{
return(_tabID);

} // getTabID()


void setNext(Tab tab)
{
_next = tab;

} // setNext()


void setPrev(Tab tab)
{
_prev = tab;

} // setPrev()  

} // class Tab


void main(string[] args)
{
TabList tabList;

tabList = new TabList();

for(int i = 0; i < 7; i++)
{
//  writeln("building Tab #", i);
tabList.append();
//  writeln("--");
}


Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn

On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote:
On Saturday, 21 September 2019 at 08:34:09 UTC, Ron Tarrant 
wrote:
Thanks, Dennis. Not performant... It doesn't work? I was 
hoping for a complete, working example, but maybe this'll help.


Bad word choice (it appears it's debatable whether 'performant' 
even is a word), I meant it was a simple implementation not 
optimized for speed / memory efficiency.
Making it 'complete' is a bit hard since I can think of tens of 
methods and operator overloads you could use, but if I include 
them all it's no longer minimal and it just becomes 
std.container.dlist.


Does a doubly-linked list always have to be done with structs? 
Can it be classes instead?


My example originally included classes actually. It was mostly 
the same, except that Node!T* was just Node!T. The only problem 
was with const:


```
size_t length() const {
size_t result = 0;
for(auto a = head; a !is null; a = a.next) result++;
return result;
}

```

Since I marked the method as const, `auto a = head` got the 
type const(Node!T) and `a = a.next` no longer compiled. With 
structs you can declare a const(Node!T)* (mutable pointer to 
const node), but I don't know if I can declare a mutable 
reference to a const class, so I switched to structs.


I have no idea, either.

But I did come up with something that works, so for anyone else 
looking for a full, working version (nothing fancy, mind you) 
here's my code with lots of 'proofs' dumped to the command line:


```
import std.stdio;
import std.conv;

class TabList
{
private:
Tab _head;
int _lastUniqueID = 0;
string labelText;

this()
{
append();
}


void append()
{
string labelText = "Tab " ~ _lastUniqueID.to!string();
Tab current;

if(_head is null)
{
_head = new Tab(_lastUniqueID, labelText);
_head.setPrev(null);
_head.setNext(null);
}
else
{
current = _head;
writeln("before the while loop");
current.showThings();

while(current.getNext() !is null)
{
writeln("in the while loop...");
current.showThings();

if(current.getPrev() !is null)
{
writeln("prev = ", 
current.getPrev().getTabID());
}
else
{
writeln("prev = null");
}
current = current.getNext();
}
writeln("out of the while loop\n");
Tab tab = new Tab(_lastUniqueID, labelText);
current.setNext(tab);
tab.setPrev(current);
}

_lastUniqueID++;

} // append()


Tab getHead()
{
return(_head);

} // getHead()


void removeTab(int uniqueID)
{
// get the head
Tab current = _head, prev, next;

// walk the list to find the Tab with the uniqueID
while(current.getNext() !is null)
{
// if the uniqueID matches the head's ID
if(current.getTabID() is uniqueID)
{
// destroy the Tab object
current.destroy(uniqueID);
}
// else
else
{
// go to the next Tab
current = current.getNext();
}
}

} // removeTab()

} // class TabList


class Tab
{
private:
int _tabID;
string _label;
Tab _prev = null, _next = null;

public:
this(int uniqueID, string labelText)
{
_tabID = uniqueID;
_label = labelText;

} // this()


void showThings()
{
writeln("Tab = ", getTabID());

if(getPrev() !is null)
{
writeln("Tab.prev = ", getPrev().getTabID());
}
else
{
writeln("Tab.prev is null");
}

  

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn

Thanks for all the responses, y'all.

I got it figured out thanks to ag0aep6g pointing out something I 
forgot about the nature of class objects in D (Damn my failing 
memory). The results will show up on the gtkDcoding blog sometime 
in (I'm guessing) November as part of the the Notebook discussion 
series.




Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn

On Saturday, 21 September 2019 at 08:49:48 UTC, ag0aep6g wrote:

On 21.09.19 10:34, Ron Tarrant wrote:

Here's a question for the room:

Does a doubly-linked list always have to be done with structs? 
Can it be classes instead? (Maybe that's why I can't get it to 
work, because I've been trying to make an OOP version?)


It can be done with classes.

When I run the following code, it gets through creating the 
list head and the first node, then seems to get stuck in an 
infinite loop. Here's the code:

[...]

class Tab
{

[...]

 Tab* _prev = null, _next = null;

[...]

 Tab* getNext()

[...]

 Tab* getPrev()

[...]

 void setNext(Tab* tab)

[...]

 void setPrev(Tab* tab)

[...]

} // class Tab


Your mistake is that you're using pointers. `Tab` is a class. 
That means values of the type are already references. There is 
no need for `Tab*`. Just use `Tab` wherever you have `Tab*` 
now, and get rid of any addr-ofs (``) and dereferendces 
(`*bar`) you have.


Ah! Thanks, ag0aep6g. I was wondering about that when I was 
writing the code. (If I already knew this, I'd forgotten.) I did 
as you suggested, took out all '*' and '&' and it works perfectly.


Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 20 September 2019 at 20:35:41 UTC, H. S. Teoh wrote:

Not a minimal example by any means, but Phobos *does* come with 
a doubly-linked list implementation: std.container.dlist.


Thanks, H.S. I did come across that in my search. Trouble is, 
with all the extra stuff in there, I'm having trouble separating 
what I need from what I don't.


On Friday, 20 September 2019 at 21:34:08 UTC, Dennis wrote:
Below is a simple doubly linked list with Garbage Collected 
memory.
It's not performant or complete by any means, just a minimal 
example in D like you wanted.


Thanks, Dennis. Not performant... It doesn't work? I was hoping 
for a complete, working example, but maybe this'll help.


You probably also want methods for removing nodes or inserting 
in the middle (else why don't you use an array?)


Yup. That's where I'm running into trouble.

I think you can think of an implementation for those yourself 
(or look them up, there should be plenty examples online).


I thought I could, too. And I thought there'd be lots of examples 
online, too. (Otherwise, I wouldn't have embarrassed myself in 
public like this.) But if there are, I can't find them... not in 
D. And it seems that D is just different enough from the other 
examples I'm finding so that I can't use them as a guide.


Here's a question for the room:

Does a doubly-linked list always have to be done with structs? 
Can it be classes instead? (Maybe that's why I can't get it to 
work, because I've been trying to make an OOP version?)


When I run the following code, it gets through creating the list 
head and the first node, then seems to get stuck in an infinite 
loop. Here's the code:


import std.stdio;
import std.conv;

class TabList
{
Tab _head;
int lastUniqueID = 0;
string labelText;

this()
{
append();
}


void append()
{
string labelText = "Tab " ~ lastUniqueID.to!string();
Tab* current;

if(_head is null)
{
_head = new Tab(lastUniqueID, labelText);
}
else
{
current = &_head;

while(current.getNext())
{
current = current.getNext();
}

Tab tab = new Tab(lastUniqueID, labelText);
current.setNext();
current.setPrev(current);
}

lastUniqueID++;

} // append()


Tab* getHead()
{
return(&_head);

} // getHead()

} // class TabList


class Tab
{
private:
int _tabID;
string _label;
Tab* _prev = null, _next = null;

public:
this(int uniqueID, string labelText)
{
_tabID = uniqueID;
_label = labelText;

} // this()


void destroy(int id)
{
if(_tabID is id)
{
_prev.setNext(_next);
_next.setPrev(_prev);
}

} // destroy()


Tab* getNext()
{
return(_next);

} // getNext()


Tab* getPrev()
{
return(_prev);

} // getPrev()


int getTabID()
{
return(_tabID);

} // getTabID()


void setNext(Tab* tab)
{
_next = tab;

} // setNext()


void setPrev(Tab* tab)
{
_prev = tab;

} // setPrev()  

} // class Tab


void main(string[] args)
{
TabList tabList;

tabList = new TabList();

for(int i = 0; i < 7; i++)
{
tabList.append();
}

writeln();
writeln();

Tab* tab = tabList.getHead();

} // main()



Looking for a Simple Doubly Linked List Implementation

2019-09-20 Thread Ron Tarrant via Digitalmars-d-learn

Hi guys,

I've been banging my head on the screen with this one for the 
last week or so. For whatever reason, I'm having major problems 
understanding how to implement a doubly-linked list in D. I don't 
know if it's because I'm losing my ability to sort these things 
or if it's just that different from C.


If someone could please post a minimal example (if there's extra 
stuff in there, I'll get confused; I'm getting that old, dammit) 
I'd be ever so grateful.




Blog Post #72: The Frame, Part I

2019-09-20 Thread Ron Tarrant via Digitalmars-d-learn
Today starts a two-part series in which we explore the gotchas 
and workarounds of the GTK Frame. You can find it here: 
https://gtkdcoding.com/2019/09/20/0072-frame-part-i.html


Blog Post #71: Expanding on the Statusbar

2019-09-17 Thread Ron Tarrant via Digitalmars-d-learn
Here's the second instalment on the lowly Statusbar wherein we 
look at multiple status reports as well as the Statusbar's 
signal: 
https://gtkdcoding.com/2019/09/17/0071-expanding-on-the-statusbar.html




Re: Using CSS Data from Within My Code

2019-09-13 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 12 September 2019 at 19:14:26 UTC, Ali Çehreli wrote:

On 09/12/2019 02:54 AM, Ron Tarrant wrote:

> I thought it was odd having 'q' in front of the opening curly
brace...

I think my index can be useful in such searches. Both q"" and 
q{} are there:


  http://ddili.org/ders/d.en/ix.html

Ali


Thanks, Ali. I suppose I should be looking in your book first 
when I have a question... as I so often do.


Blog Post #70: Statusbar Basics

2019-09-13 Thread Ron Tarrant via Digitalmars-d-learn
Time to get down to basics with the Statusbar. Although most 
contemporary applications don't bother with proper status bars, 
these widgets can still be useful. Here's how to get started with 
them: https://gtkdcoding.com/2019/09/13/0070-statusbar.html




Re: Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 12 September 2019 at 13:09:16 UTC, Mike Parker wrote:
On Thursday, 12 September 2019 at 11:40:33 UTC, Ron Tarrant 
wrote:



string myCSS = "tab { background-color: #f2f2f2; }";




enum will work just as well here and without the need for the 
variable:


enum myCSS = "tab { background-color: #f2f2f2; }";

The original error was because q strings have to be valid D, 
not because of the enum.


Ah! Thanks for clearing that up, Mike. My D knowledge is still 
rather sparse, so this fills in another blank for me.


Re: Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 12 September 2019 at 11:35:04 UTC, Ron Tarrant wrote:
On Thursday, 12 September 2019 at 10:09:06 UTC, Andrea Fontana 
wrote:
On Thursday, 12 September 2019 at 09:54:35 UTC, Ron Tarrant 
wrote:

I found this presented as a solution in a 2016 post:

On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote:


enum myCSS = q{
GtkNotebook {
background-color: #e9e9e9;
}
GtkNotebook tab {
background-color: #d6d6d6;
}
};


But when I try to use it, I get the following errors:

Warning: C preprocessor directive #e9e9e9 is not supported
Warning: C preprocessor directive #d6d6d6 is not supported

I thought it was odd having 'q' in front of the opening curly 
brace... is this a typo? Shorthand for "string quote"? 
Something like that?


Or do I need to escape these somehow?


They are named "token string" and contained code must be a 
valid d code. See https://dlang.org/spec/lex.html#token_strings


Thanks, Andrea and Max.

Turns out there's a simpler way to inject CSS into D code. In 
case anyone else comes looking, I found that instead of an 
enum, a string will do. Here's the solution I came up with to 
make visible tabs in a Notebook:




That should have been:

class CSS // GTK4 compliant
{
CssProvider provider;
string myCSS = "tab { background-color: #f2f2f2; }";

this(StyleContext styleContext)
{
provider = new CssProvider();
provider.loadFromData(myCSS);
		styleContext.addProvider(provider, 
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


} // this() 

} // class CSS

The CSS path/file name isn't needed.



Re: Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn
On Thursday, 12 September 2019 at 10:09:06 UTC, Andrea Fontana 
wrote:
On Thursday, 12 September 2019 at 09:54:35 UTC, Ron Tarrant 
wrote:

I found this presented as a solution in a 2016 post:

On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote:


enum myCSS = q{
GtkNotebook {
background-color: #e9e9e9;
}
GtkNotebook tab {
background-color: #d6d6d6;
}
};


But when I try to use it, I get the following errors:

Warning: C preprocessor directive #e9e9e9 is not supported
Warning: C preprocessor directive #d6d6d6 is not supported

I thought it was odd having 'q' in front of the opening curly 
brace... is this a typo? Shorthand for "string quote"? 
Something like that?


Or do I need to escape these somehow?


They are named "token string" and contained code must be a 
valid d code. See https://dlang.org/spec/lex.html#token_strings


Thanks, Andrea and Max.

Turns out there's a simpler way to inject CSS into D code. In 
case anyone else comes looking, I found that instead of an enum, 
a string will do. Here's the solution I came up with to make 
visible tabs in a Notebook:


class CSS // GTK4 compliant
{
CssProvider provider;
string cssPath = "./css/visible_tabs.css";

string myCSS = "tab { background-color: #f2f2f2; }";

this(StyleContext styleContext)
{
provider = new CssProvider();
provider.loadFromData(myCSS);
		styleContext.addProvider(provider, 
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


} // this() 

} // class CSS

And in the class that will use it, this line does it:

css = new CSS(getStyleContext());




Using CSS Data from Within My Code

2019-09-12 Thread Ron Tarrant via Digitalmars-d-learn

I found this presented as a solution in a 2016 post:

On Wednesday, 15 June 2016 at 22:05:37 UTC, captaindet wrote:


enum myCSS = q{
GtkNotebook {
background-color: #e9e9e9;
}
GtkNotebook tab {
background-color: #d6d6d6;
}
};


But when I try to use it, I get the following errors:

Warning: C preprocessor directive #e9e9e9 is not supported
Warning: C preprocessor directive #d6d6d6 is not supported

I thought it was odd having 'q' in front of the opening curly 
brace... is this a typo? Shorthand for "string quote"? Something 
like that?


Or do I need to escape these somehow?




Re: Blog Post #69: TextView and TextBuffer Basics

2019-09-11 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 11 September 2019 at 03:45:23 UTC, Zekereth wrote:

Yes, thank you very much. Your tutorials are a great help! Keep 
it up! Thanks again.


Oakey dokey.


Re: Blog Post #69: TextView and TextBuffer Basics

2019-09-10 Thread Ron Tarrant via Digitalmars-d-learn

On Tuesday, 10 September 2019 at 09:14:13 UTC, Mike Parker wrote:

Seriously impressed that you're able to keep this up so 
consistently. Keep on trucking!


Thanks, Mike.



Blog Post #69: TextView and TextBuffer Basics

2019-09-10 Thread Ron Tarrant via Digitalmars-d-learn
This morning's discussion covers the basic workings and 
relationship between the TextView and TextBuffer widgets. Here's 
the link: 
https://gtkdcoding.com/2019/09/10/0069-textview-and-textbuffer.html




Blog Post #68: MVC - Multi-level TreeView

2019-09-06 Thread Ron Tarrant via Digitalmars-d-learn
Today we dig back into the MVC series to look at the multi-level 
TreeStore and maybe learn a little geography. You can read all 
about it right here: 
https://gtkdcoding.com/2019/09/06/0068-multi-level-treestore.html


Blog Post #67 - Expander

2019-09-03 Thread Ron Tarrant via Digitalmars-d-learn
Today's post covers the Expander, a widget that... well... 
expands to reveal things hidden within. It's not quite a 
TreeView, but it's also a lot easier to use. You can read all 
about it here: 
https://gtkdcoding.com/2019/09/03/0067-mvc-xii-expander.html


Blog Post #66 - Toolbar Basics

2019-08-30 Thread Ron Tarrant via Digitalmars-d-learn
Today we cover one of the basic widgets, namely, the Toolbar 
which isn't as straightforward to use since the deprecation of so 
many of GTK's StockIDs. You can find out what's changed and how 
to get around it right here: 
https://gtkdcoding.com/2019/08/30/0066-toolbar-basics.html




Re: Pro programmer

2019-08-27 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 25 August 2019 at 21:30:10 UTC, GreatSam4sure wrote:
If I want to be a pro programmer what language must I start 
with?


If it's deep understanding you want, start with assembly 
language. Knowing how things are done down at that level—before 
all the layers of abstraction are added—will give you an edge 
over 99% of current coders.


It's the same with basic computer use. Wanna be a true expert 
user? Get any version of Linux or one of the BSDs and restrict 
yourself to using just the terminal for about a month. You'll be 
amazed at how much you'll learn. It'll also give you a great 
foundation for understanding coding.


And your typing skills will go through the roof.


Blog Post #65 - TreeStore Basics

2019-08-27 Thread Ron Tarrant via Digitalmars-d-learn
Today we go back to finish off an earlier series on MVC and 
stores, this time looking at the TreeStore and how to populate a 
hierarchy of rows. You can find it here: 
https://gtkdcoding.com/2019/08/27/0065-mvc-x-treestore-basics.html


Re: Blog Post #64 - Animating with Cairo

2019-08-23 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 23 August 2019 at 09:37:56 UTC, Ron Tarrant wrote:
Today, and for the next few posts, we'll be looking at Cairo 
animation. This time, we'll do a simple frame counter at 24fps. 
The post is here: 
https://gtkdcoding.com/2019/08/23/0064-cairo-vii-drawingarea-animation.html


CORRECTION:

Today's post covers three different examples of animation:
- a text counter,
- drawing a circle, and
- a flipbook animating a series of images.


Blog Post #64 - Animating with Cairo

2019-08-23 Thread Ron Tarrant via Digitalmars-d-learn
Today, and for the next few posts, we'll be looking at Cairo 
animation. This time, we'll do a simple frame counter at 24fps. 
The post is here: 
https://gtkdcoding.com/2019/08/23/0064-cairo-vii-drawingarea-animation.html


Blog Post #63 - Saving Images with Cairo

2019-08-20 Thread Ron Tarrant via Digitalmars-d-learn
Today we look at how to save images using Cairo with examples for 
JPeg, PNG, BMP, and TIFF.


https://gtkdcoding.com/2019/08/20/0063-cairo-vii-draw-save-images.html


Re: Blog Post #0062: Cairo Load & Display Images

2019-08-18 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 18 August 2019 at 17:10:38 UTC, Andre Pany wrote:


It looks now very nice, thanks a lot.


Excellent. Glad to do it.

Wheter you chose 2, 3 or 4 is up to you. 4 is mentioned in 
Phobos style guide, but it is up to you, what you prefer.


I've always been partial to three, but I'm also more of a tab 
person. Less work, if you see what I'm saying.




Re: Blog Post #0062: Cairo Load & Display Images

2019-08-18 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 18 August 2019 at 14:44:29 UTC, Andre Pany wrote:

the indentation level are 8 spaces.


Turns out it's settable in CSS. Tab size for quoted code blocks 
in the blog posts is now set to three. If you could check a few 
out and let me know if it's any better. If not, I'll take it down 
to two... now that I know how easy it is.





Re: Blog Post #0062: Cairo Load & Display Images

2019-08-18 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 18 August 2019 at 14:44:29 UTC, Andre Pany wrote:
Hm I am not sure, i just tried lynx (on raspberry pi) and here 
also the indentation level are 8 spaces.


For testing purposes, I replaced each tab with three spaces in 
this post: 
http://gtkdcoding.com/2019/05/31/0040-messagedialog.html


If this works better for you, let me know and I can do a quick 
s-n-r on all blog posts and add this as the final prep step as 
the posts go up.


Re: Blog Post #0062: Cairo Load & Display Images

2019-08-18 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 18 August 2019 at 14:44:29 UTC, Andre Pany wrote:

Hm I am not sure, i just tried lynx (on raspberry pi) and here 
also the indentation level are 8 spaces.


Turns out, it's GitHub inserting 8 spaces per tab. No idea why 
anyone would think this appropriate, but there it is.


A workaround you can try for now is to click through to an 
example code (this won't work on the blog pages, just the code 
pages) and, at the end of the URL, type: ?ts=3 to get tabs that 
are three spaces. Any number between 1 and 12 will work, 
apparently.


Hope this helps for now. I'm still looking into this to find a 
more permanent solution. This 8 spaces per tab bugs me, too.




Re: Blog Post #0062: Cairo Load & Display Images

2019-08-18 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 18 August 2019 at 14:44:29 UTC, Andre Pany wrote:

Hm I am not sure, i just tried lynx (on raspberry pi) and here 
also the indentation level are 8 spaces.


Perhaps if I switched from using tabs to spaces... I'll try it 
with one of the posts and get back to you so you can test it... 
if that's okay with you.


Re: Blog Post #0062: Cairo Load & Display Images

2019-08-18 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 18 August 2019 at 09:28:30 UTC, Andre Pany wrote:

II noticed you use an indentation level of 8 spaces. Is this by 
purpose? As far as I know, 4 spaces is recommended.


I only use three in PS Pad, so the extra spaces are being 
inserted by either Perl, Jekyll, Liquid, or some part of the 
GitHub Pages site.


Is it possible it's an interpretation layered on by the web 
browser on your phone?
I don't know enough about how browsers work to determine whether 
or not this is a valid question.


Re: Blog Post #0062: Cairo Load & Display Images

2019-08-17 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 16 August 2019 at 12:58:23 UTC, Andre Pany wrote:

This causes some distruction on mobile phone as you have scroll 
horizontally although it would fit the screen if the source 
code would start at column 0.


That didn't take as long as I thought it would. I removed all 
excess indentation, so let me know if it's any better now.




Re: Blog Post #0062: Cairo Load & Display Images

2019-08-17 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 16 August 2019 at 12:58:23 UTC, Andre Pany wrote:


Thanks a lot Ron, your page is really helpful.


You're welcome, Andre. And thanks for saying so.

Is there a reason why the source code starts after a lot of 
whitespaces on every line?
This causes some distruction on mobile phone as you have scroll 
horizontally although it would fit the screen if the source 
code would start at column 0.


Thanks for bringing this to my attention. I've recently switched 
from basic MD for displaying source and the way I was doing it 
demanded that everything be indented one tab. I've since switched 
to Jekyll/Liquid's {% highlight d %} system which doesn't have 
this limitation.


Now that I know this is an issue, give me a some time and I'll 
get all those extra indents removed.





Re: Blog Post #0062: Cairo Load & Display Images

2019-08-17 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 16 August 2019 at 12:44:15 UTC, bauss wrote:

Amazing! You might be able to answer me something, whether you 
could use gtkd solely for image manipulation using ex. Pixbuf? 
or would it only work with the internals of gtkd? Like can you 
manipulate the image and save it to disk etc.


Those are very good questions, bauss. I haven't dug in that deep 
yet, but I see no reason why Cairo couldn't be used to build a 
full-featured paint, manipulation, or structured drawing 
application. But it won't only be about Pixbufs. The Cairo 
Context seems to be where all the action is as far as drawing 
routines go.


Over the next few months, off and on, I'll be exploring stuff 
like that. I'm still working on getting through all the unsexy 
stuff first (the basic widgets) but every once in a while, I just 
have to let my hair down and do something that's a bit more 
complex.


After the basic image and drawing stuff is covered, I'll be 
digging into simple animation and how to tame the Timeout. Then, 
after a short side-trip to finish off MVC and do some more 
base-level widgets such as the Toolbar, Statusbar, and Expander, 
there's another Cairo miniseries coming up that covers nodes and 
noodles, something I've wanted to dig into for several years.


Thanks for reading and thanks for the kind words.



Blog Post #0062: Cairo Load & Display Images

2019-08-16 Thread Ron Tarrant via Digitalmars-d-learn
Continuing on with Cairo, this post covers loading and displaying 
three types of image (including a structured drawing) using two 
different load-n-display methods.


As an extra bonus, you'll see a photo of my cat, Bob, and three 
of the seven guitars I've found in my building's recycle room 
over the last year.


https://gtkdcoding.com/2019/08/16/0062-cairo-vi-load-display-images.html



Blog Post #0061: Cairo Toy Text

2019-08-13 Thread Ron Tarrant via Digitalmars-d-learn
When all you want is quick-n-dirty text in a GTK DrawingArea and 
Pango seems like more than you wanna deal with, Cairo's Toy Text 
will do the job nicely. Here's how: 
https://gtkdcoding.com/2019/08/13/0061-cairo-v-toy-text-image-formats.html


Blog Post #0060: Cairo Filled Arcs, Precision Arcs, and Curves

2019-08-09 Thread Ron Tarrant via Digitalmars-d-learn
Today's post covers a lot of ground and answers a few of those 
burning questions you may have about taming Cairo arcs and 
curves. Still, it's a quick read because... well, tons of 
diagrams and screenshots. So, come on over and take a look: 
https://gtkdcoding.com/2019/08/09/0060-cairo-iv-fill-arc-cartoon-mouth.html


Blog Post #0059: Cairo Circles and Arcs

2019-08-06 Thread Ron Tarrant via Digitalmars-d-learn
Today's post covers the basics of drawing circles and arcs in a 
DrawingArea using Cairo functions. You can find it here: 
https://gtkdcoding.com/2019/08/06/0059-cairo-iii-circles-and-arcs.html


Also, in case it got missed, there's a second index of blog posts 
where everything is sorted by subject and that's right here: 
https://gtkdcoding.com/topics/


Blog Post #0058: Cairo Rectangles

2019-08-02 Thread Ron Tarrant via Digitalmars-d-learn
Continuing on with Cairo, this is a look at the variations and 
permutations of drawing rectangles and you'll find it here: 
https://gtkdcoding.com/2019/08/02/0058-cairo-ii-rectangles.html




Re: Meaning of Scoped! ??

2019-07-30 Thread Ron Tarrant via Digitalmars-d-learn

On Tuesday, 30 July 2019 at 09:46:07 UTC, Andrea Fontana wrote:

Looking at its source code, it seems it's a way to force the 
call of "destroy" method of wrapped object (Context in your 
case) when the struct goes out of its scope (and d-tor is 
called)


Andrea


Thanks, Andrea (and rikki). I actually learned this a while back 
(even wrote about it in a blog post) but I've noticed my memory 
is playing tricks on me lately.


In fact, don't be surprised if I ask this same question (or a 
close variation of it) next month. (sigh)


Blog Post #0057: The Basics of Drawing with Cairo

2019-07-30 Thread Ron Tarrant via Digitalmars-d-learn
Several months ago, someone asked if I'd be covering drawing 
routines and after much preparation, today's post is the first in 
a series on drawing with Cairo.


You can find it here: 
http://gtkdcoding.com/2019/07/30/0057-cairo-i-the-basics.html


Meaning of Scoped! ??

2019-07-30 Thread Ron Tarrant via Digitalmars-d-learn
Some things are almost impossible to research. For instance, in 
the GtkD wrapper code—specifically the Widget.d file—the 
following function definition appears:



	gulong addOnDraw(bool delegate(Scoped!Context, Widget) dlg, 
ConnectFlags connectFlags=cast(ConnectFlags)0)

{
		return Signals.connect(this, "draw", dlg, connectFlags ^ 
ConnectFlags.SWAPPED);

}


With contemporary search engines, it's impossible to search for 
'!' and get meaningful results. And searching for 'Scoped!' 
results in every variation of the word 'scope' and ignores the 
'!' altogether, even with Google's Verbatim tool turned on. 
Worse, Google ignores case as well.


I also searched all three D-language books and found nothing.

Here are my questions:

1) What exactly does the '!' mean? For instance, '=' means "is 
equal to," but I don't know what words to 'think' while looking 
at a '!'


2) What does 'Scoped' mean?

3) In the specific instance above, what does 'Scoped!Context' 
mean as opposed to just 'Context'? In other words, what are the 
differences between 'Scoped!Context' and 'Context'?


The last question needs more explanation...

In Widget.d, there are two overloads of addOnDraw(), the one 
cited above and this one:



	deprecated gulong addOnDraw(bool delegate(Context, Widget) dlg, 
ConnectFlags connectFlags=cast(ConnectFlags)0)

{
		return Signals.connect(this, "draw", dlg, connectFlags ^ 
ConnectFlags.SWAPPED);

}


The former works, but the latter spits out a 'deprecated' error 
(naturally).




Blog Post #0056: MVC IX - A ComboBox with Flair

2019-07-26 Thread Ron Tarrant via Digitalmars-d-learn
Today we get to do something unusual. Drawing on and combining a 
bunch of things we've done in past instalments, we'll build a 
two-column ComboBox with different images, custom fonts, and 
background colors for each item in the list. Here's the post: 
http://gtkdcoding.com/2019/07/26/0056-mvc-ix-a-combobox-with-flair.html




Blog Post #0055: MVC VIII - Dynamically Loading a TreeView

2019-07-23 Thread Ron Tarrant via Digitalmars-d-learn

Hi y'all,

This week's first post is entry #8 in the MVC series and covers 
loading up a TreeView with a decorated list of system fonts. 
Decorations include varying the size, weight, and style as well 
as the font face. You can view it here: 
https://gtkdcoding.com/2019/07/23/0055-mvc-viii-dynamically-loading-a-treeview.html




Blog Post #0054: MVC VII - TreeView Basics

2019-07-19 Thread Ron Tarrant via Digitalmars-d-learn
If you've been anticipating the TreeView examples, today's post 
is where the rubber hits the road with a look at the differences 
and similarities between populating a ComboBox and a TreeView. 
You can find it here: 
https://gtkdcoding.com/2019/07/19/0054-mvc-vii-treeview-basics.html




Blog Post #0053: MVC VI - ComboBox with Pixbufs

2019-07-16 Thread Ron Tarrant via Digitalmars-d-learn
Carrying on with installment #6 of the MVC series, we see how to 
use images in a ComboBox. This is the last bit of peripheral 
stuff we'll need to know before tackling the TreeView and (later) 
the TreeStore.


Here it is: 
https://gtkdcoding.com/2019/07/16/0053-mvc-vi-image-combobox.html




Re: Substitutions with writef() or format()?

2019-07-14 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 14 July 2019 at 13:45:38 UTC, Ron Tarrant wrote:

'Morning, all.

If these lines:

   string currency = format("$%,.02f", 11_234_456.99);
   writeln(currency);

Will result in:

   $11,234,456.99

Why don't these lines:

   string notCurrency = format("%,", 11_234_456);
   writeln(notCurrency);

result in:

   11,234,456

???

Instead of a range violation?


Never mind. This works:

   string notCurrency = format("%,?d", ',', 11_234_456);
   writeln(notCurrency);



Substitutions with writef() or format()?

2019-07-14 Thread Ron Tarrant via Digitalmars-d-learn

'Morning, all.

If these lines:

   string currency = format("$%,.02f", 11_234_456.99);
   writeln(currency);

Will result in:

   $11,234,456.99

Why don't these lines:

   string notCurrency = format("%,", 11_234_456);
   writeln(notCurrency);

result in:

   11,234,456

???

Instead of a range violation?




Re: Blog Post #0052: MVC V - ComboBox with Integers

2019-07-12 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 12 July 2019 at 11:29:39 UTC, BoQsc wrote:

Gnome project should just rewrite everything in D language, 
especially the Gnome Shell. At least that would be a right 
direction.


LOL! It would likely take a planet-wide referendum, but I imagine 
you'll get strong support on this forum. :)


Thanks for the texts Ron, it is so nice to see images - 
visuals, showing the result and they fit so nicely with your 
article. The more visuals and working examples - the easier for 
some of us to understand. :)


Thanks for the kind words.


Blog Post #0052: MVC V - ComboBox with Integers

2019-07-12 Thread Ron Tarrant via Digitalmars-d-learn
Today's post deals with integers in a ComboBox. It's not exactly 
tricky, but a little clarification never hurts, right?


Here's where you'll find it: 
https://gtkdcoding.com/2019/07/12/0052-mvc-v-int-combobox.html


Re: Blog Post #0051: MVC IV - ComboBox with Text

2019-07-11 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 10 July 2019 at 20:31:36 UTC, Greatsam4sure wrote:

Is it possible to get all the tutorials in a pdf file for 
offline work? Thanks in advance


Just found out about this on FB. Packt is having a sale right 
now, 3 ebooks for $30 and they have three books about D.


https://www.packtpub.com/catalogsearch/result/?q=d+programming=IwAR3pAZYU8uLmLJIdxrOiptVrBbikGbsDGBFvAPFyiYqW08pI0EMP3mjnc7k


Re: Blog Post #0051: MVC IV - ComboBox with Text

2019-07-11 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 10 July 2019 at 20:31:36 UTC, Greatsam4sure wrote:

On Tuesday, 9 July 2019 at 12:08:04 UTC, Ron Tarrant wrote:
Today's post starts a mini series-within-a-series on dressing 
up the ComboBox using a ListStore. Essentially, it's ListStore 
basics leading up to how this type of model is used with a 
TreeView.


You can find it here: 
https://gtkdcoding.com/2019/07/09/0051-mvc-iv-combobox-text.html


Great work! I see this series of tutorial becoming a book for 
gtkd. Is it possible to get all the tutorials in a pdf file for 
offline work? Thanks in advance


I do have this planned, but I want to get through the basic stuff 
first. So, there may be a bit of a wait.





Blog Post #0051: MVC IV - ComboBox with Text

2019-07-09 Thread Ron Tarrant via Digitalmars-d-learn
Today's post starts a mini series-within-a-series on dressing up 
the ComboBox using a ListStore. Essentially, it's ListStore 
basics leading up to how this type of model is used with a 
TreeView.


You can find it here: 
https://gtkdcoding.com/2019/07/09/0051-mvc-iv-combobox-text.html


Re: Blog Post #0050: MVC III - ComboBoxText, Add & Remove

2019-07-05 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 5 July 2019 at 13:52:40 UTC, matheus wrote:

On Friday, 5 July 2019 at 09:34:08 UTC, Ron Tarrant wrote:
Today is a bit of a milestone for the blog as the 50th regular 
post goes up. Also, the facelift is coming along nicely, the 
next phase of which should be ready to push by July 9th.



Maybe you should post this on the Announce group?

And on Reddit too.

Matheus.


Point taken, but I was going to wait until the next phase of the 
face lift is ready to go.


Blog Post #0050: MVC III - ComboBoxText, Add & Remove

2019-07-05 Thread Ron Tarrant via Digitalmars-d-learn
Today is a bit of a milestone for the blog as the 50th regular 
post goes up. Also, the facelift is coming along nicely, the next 
phase of which should be ready to push by July 9th.


And today's topic continues with the MVC series by demonstrating 
how to add and remove items from a ComboBoxText widget. You can 
read it here:


https://gtkdcoding.com/2019/07/05/0050-mvc-iii-comboboxtext-add-remove.html



Re: Blog Post #0048: Model, View, Controller

2019-07-04 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 3 July 2019 at 17:12:04 UTC, lpcvoid wrote:


Thanks for the time you invest in this.


You're welcome. Tell your friends. :)


Blog Post #0049: MVC - The ComboBoxText

2019-07-02 Thread Ron Tarrant via Digitalmars-d-learn

Continuing the series on Model, View, Controller...

This time around, we look at the ComboBoxText, the simplest of 
the MVC offerings.

https://gtkdcoding.com/2019/07/02/0049-mvc-ii-comboboxtext.html



Blog Post #0048: Model, View, Controller

2019-06-28 Thread Ron Tarrant via Digitalmars-d-learn
Today's post on gtkdcoding.com is the first in a 9-part series 
covering GTK's model/view/controller mechanism and how it's used 
in various widgets including the TreeView. Today is mostly 
theory, a reference (if you will) for the rest of the series.


You can read it here: 
https://gtkdcoding.com/2019/06/28/0048-mvc-i-introduction.html


Blog Post #0047: ScaleButton and VolumeButton

2019-06-25 Thread Ron Tarrant via Digitalmars-d-learn
There are a couple of things to watch out for with the 
ScaleButton and its offspring, the VolumeButton. Read all about 
it here:

https://gtkdcoding.com/2019/06/25/0047-scalebutton-and-volumebutton.html


gtkDcoding Facelift

2019-06-23 Thread Ron Tarrant via Digitalmars-d-learn
Stage 1 is now complete. Blog entries are color-associated in an 
effort to make things more visual. Each topic also has its own 
avatar. Points to anyone who can figure out why each avatar is 
associated with its topic.


https://gtkdcoding.com/



Blog Post #0046 - SpinButton

2019-06-21 Thread Ron Tarrant via Digitalmars-d-learn
Friday's post covers the SpinButton and its all-important 
Adjustment object companion. You can find it here: 
https://gtkdcoding.com/2019/06/21/0046-the-spinbutton.html


Facelift Update

Things are moving along nicely and I expect the fully-realized 
site to be unveiled within the next week.




Re: Blog Post #0045 - Split a Window into Panes

2019-06-19 Thread Ron Tarrant via Digitalmars-d-learn

On Tuesday, 18 June 2019 at 13:19:48 UTC, Ron Tarrant wrote:

And just a quick tip of the hat


Forgot to thank Russell Winder for suggesting Previous/Next 
buttons which have also been implemented on all pages. Should 
make navigation easier for those multi-part posts.


Blog Post #0045 - Split a Window into Panes

2019-06-18 Thread Ron Tarrant via Digitalmars-d-learn

Two announcements today...

First, today's post covers splitting a window into panes. You can 
find it here: 
https://gtkdcoding.com/2019/06/18/0045-split-a-window-into-panes.html


Second, you'll notice some changes in the site. At the prompting 
of a bunch of people here and elsewhere, I've starting making the 
site more visual.


- The first step was to color-code the blog entries by topic.
- You'll also notice that the first three posts from back in 
January now have screenshots. And just a quick tip of the hat to 
Michelle Long, Greatsam4sure, and sanyayss for suggesting it. It 
just took me a while to get organized enough to do it.


Future Facelist Plans

- get screenshots and any other appropriate graphics into each 
blog post. If there are any posts you think need something 
special, image wise, please let me know at: gtkdcoding over on 
gmail. (please suffix a dot and a com and shove an 'at' in the 
middle there)


- icons for each topic will eventually appear alongside each link 
on the main page so as to make the topics even easier to pick out.


And if anyone has any other suggestions, please let me know those 
too. Due to time constraints, I won't promise to implement all of 
them, but I'll do my best.


Also, if anyone knows how to implement a non-paid commenting 
system on GitHub Pages, I'd appreciate some advice on how to go 
about it. I always have a hard time with systems involving three 
or more languages (like in this case: Jekyll, Liquid, HTML, 
markdown, CSS and Ruby.




Blog Post #0044 - File Dialog X - Custom Dialogs (3 of 3)

2019-06-14 Thread Ron Tarrant via Digitalmars-d-learn
Today sees the last of the mini-series on custom Dialog windows 
wherein we combine everything from the first two articles 
together into one final *Dialog*.


You can find it here: 
http://gtkdcoding.com/2019/06/14/0044-custom-dialog-iii.html


Blog Post #0043 - File Dialog IX - Custom Dialogs (2 of 3)

2019-06-11 Thread Ron Tarrant via Digitalmars-d-learn
This is the second in a series (Custom Dialogs) within a series 
(Dialogs) and deals with the action area. It's available here: 
http://gtkdcoding.com/2019/06/11/0043-custom-dialog-ii.html


Blog Post #0042 - File Dialog VIII - Custom Dialogs (1 of 3)

2019-06-07 Thread Ron Tarrant via Digitalmars-d-learn
Today starts a mini-series within a series about rolling yer own 
Dialogs. And because aesthetics is such a big part of doing 
layout, we start with a mini crash course in design. Here's the 
link: http://gtkdcoding.com/2019/06/07/0042-custom-dialog-i.html


Blog Post #0041 - File Dialog VII - The ColorChooser Dialog

2019-06-04 Thread Ron Tarrant via Digitalmars-d-learn
For the first blog instalment this week, we look at the 
ColorChooserDialog and discuss the differences between it and the 
ColorChooserButton as well as how to by-pass white as a default 
color.


You can find it here: 
http://gtkdcoding.com/2019/06/04/0041-colorchooserdialog.html


Re: What is difference between struct and class?

2019-06-03 Thread Ron Tarrant via Digitalmars-d-learn

On Monday, 3 June 2019 at 09:43:25 UTC, Rnd wrote:

These similarities and differences should be highlighted in 
documentation etc since many new users have at least some 
knowledge of C/C++ and understanding will be easier.


Perhaps this will help: https://dlang.org/articles/ctod.html


Re: How to create GTK+ apps with Glade and D on windows

2019-05-31 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 31 May 2019 at 18:47:06 UTC, Obsidian Jackal wrote:
I'm new to D and want to create GTK+ apps. I have Visual 
Studio, Glade, the Gtk+ runtime, DMD, and DUB installed. What 
steps, guides, or advice should I follow to be able to be able 
to use these tools together to make a sane app?.


If you aren't opposed to reading about hand-coding techniques: 
http://GtkDcoding.com


Blog Post #0040 - File Dialog VI - The Simple Message Dialog

2019-05-31 Thread Ron Tarrant via Digitalmars-d-learn
Today's blog post covers a topic that was requested back in 
mid-April, the message dialog. Some of the extra info you may 
glean from today's post is:


- tracing widget inheritance to find a complete list of available 
functions, and

- where to find the DialogFlags enum.

You can find it here: 
http://gtkdcoding.com/2019/05/31/0040-messagedialog.html


Have a great weekend, everyone.



Blog Post Rewrite - Callback Signal Chains

2019-05-29 Thread Ron Tarrant via Digitalmars-d-learn
While doing screenshots for the gtkDcoding blog (See? I'm working 
on it.) I discovered something cool about signal callback chains 
in GtkD. So, I ended up rewriting the code and the blog post to 
include this coolness.


You can read it here: 
http://gtkdcoding.com/2019/02/19/0011-callback-chains.html


Re: Blog Post #0039 - File Dialog V - Adding SaveAs and Titlebar Filename Reflection

2019-05-28 Thread Ron Tarrant via Digitalmars-d-learn
Hi WebFreak. I'm glad you're getting something out of it. I 
started this because it's the kind of thing I wished was out 
there. It's good to know I'm not the only one.


On Tuesday, 28 May 2019 at 12:58:12 UTC, WebFreak001 wrote:


Could you maybe add screenshots to each blog post?


I've had a ton (Well, four... Five? Six?) requests to do them and 
I have started down that road, but it's going to take a bit of 
time what with everything else I've got going on ATM.


They could be shown for example right at the top of each post 
and maybe a thumbnail in the post list and that way greatly 
simplify searching a tutorial of interest and also massively 
help with sharing links to your posts online where OpenGraph or 
Twitter images are embedded. (see https://gethead.info/ for 
good examples how to add these meta tags)


I'll see if I can sort this out.


Is the source code of your site available somewhere?


I'm not sure what you mean by this... the HTML? the Jekyll code? 
Or are you asking about the example files? Because the examples 
are all there with links in the blog posts, if that's what you're 
asking about.


But if you're asking about the HTML/Jekyll/whatever, I have to 
ask: why do you want access?


Also it would be nice if it supported HTTPS. (LetsEncrypt 
certificates are free and easy to setup for this)


Why would I need secure pages?



Blog Post #0039 - File Dialog V - Adding SaveAs and Titlebar Filename Reflection

2019-05-28 Thread Ron Tarrant via Digitalmars-d-learn

Good day to you all.

'Tis another Tuesday and time for a new blog post. This is a 
continuation of the series on Dialogs and further, a continuation 
of the mini-series-within-a-series on file Dialogs. The subject 
is in the title as is fitting for a blog post about putting 
things in the titlebar.


You can find it here: 
http://gtkdcoding.com/2019/05/28/0039-file-save-as-dialog.html




Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 24 May 2019 at 11:19:14 UTC, Radu wrote:

But there is also the marketing effect, these posts will be 
more inviting for newcomers, especially ones coming from no D 
experience. Might worth considering even for this reason as 
your posts could be a powerful marketing tool for D.


Yup, that's what the research says *in favour of* images.

However, other research indicates that images slow down learning 
because the learner gets complacent. Rather than engaging in deep 
learning, they glance at the image, copy-n-paste the code, and 
never truly understand what they're working with. At some point 
down the road, they get into trouble because they don't have that 
deep understanding and they abandon any further efforts.


So, that's the dilemma. Both arguments seem sound to me, so 
that's why I'm still on the fence.




Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 24 May 2019 at 10:09:06 UTC, Radu wrote:


Interesting posts you have.

Thanks.

I might not be the first one to ask for this, but including 
some screen shots when talking about UI is usually a good idea.

You're right; you're not. :)

I'm still debating this idea, but I won't say I'm adamantly 
opposed to it. Research into how people learn seems to support 
both sides of the argument: should imagery be included or not?


And I suppose if I ever pull all this stuff together into a book, 
it'll be expected.


Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn
Today's blog post over on gtkDcoding.com is about using a GTK 
dialog for saving a file. You can find it here: 
http://gtkdcoding.com/2019/05/24/0038-file-save-dialog.html


Re: Blog Post #0038 - Dialogs IV - Saving a File

2019-05-24 Thread Ron Tarrant via Digitalmars-d-learn

Almost forgot...

I also redid the titles for all posts to clarify and group them 
under various themes.


Blog Post #0037 - File Dialog II - Open Multiple Files

2019-05-21 Thread Ron Tarrant via Digitalmars-d-learn
Tuesday creeps up on us again and it's time for another blog 
post. Today's instalment continues from last time with a 
multi-select file dialog. You can find it here: 
http://gtkdcoding.com/2019/05/21/0037-file-open-multiple.html


Re: GTKD - overrideBackgroundColor of Button doesn't work

2019-05-19 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 22 June 2016 at 07:57:01 UTC, TheDGuy wrote:
I am wondering if it is possible to get the name of the current 
CSS-class the button is asigned to?


Very late to this party, but:

getName() does the job.


Re: Blog Post #0036 - File Dialog - Open a Single File

2019-05-17 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 17 May 2019 at 12:14:51 UTC, drug wrote:
TreeView widget needs to be implemented. So still I have no a 
solution that satisfy me completely.


Yeah, they're confusing, for sure. If you don't need anything 
elaborate, you might have a look at this: 
https://github.com/rontarrant/gtkDcoding/blob/master/017_list_tree/list_tree_017_08_columns.d


Maybe it'll help.


Re: Blog Post #0036 - File Dialog - Open a Single File

2019-05-17 Thread Ron Tarrant via Digitalmars-d-learn

On Friday, 17 May 2019 at 11:12:41 UTC, Alex wrote:


movable icons that can be interacted with using the icon by 
dragging them around in a DrawingArea.


So if you need ideas to for another tutorial...



Yup, this type of thing is on my todo list, but my lead time is 
around six weeks ATM, so it may take a while before it shows up 
on the blog.


Some of the ideas I have for DrawingArea tutorials:
- drag-n-drop (as you describe),
- nodes-n-noodles (as seen here: 
https://codepen.io/osublake/pen/4c3752574267b3a986cb8eee7ccb8c81), and (of course)

- drawing with the mouse.

My plan is to be as thorough as possible with coverage of each 
widget and to do them in more-or-less easiest to hardest order. 
Once the series on Dialog windows is finished, there's a whole 
raft of stuff on ListStore and TreeStore and how they interact 
with TreeView and ComboBox via TreeIter, TreeSelection, etc., 
etc. That's taking most of my time ATM.


Thanks for the comment, Alex. Have a great day.


Blog Post #0036 - File Dialog - Open a Single File

2019-05-17 Thread Ron Tarrant via Digitalmars-d-learn
The second post this week continues the series on Dialogs. This 
one is about opening files and can be found here: 
http://gtkdcoding.com/2019/05/17/0036-file-open-dialogs.html


Blog Post #0035 - AboutDialog Howto

2019-05-14 Thread Ron Tarrant via Digitalmars-d-learn
Today starts a new series on gtkDcoding, this one covers a large 
wad of Dialogs starting with (perhaps) the simplest of them all: 
the AboutDialog.


The post can be found here: 
http://gtkdcoding.com/2019/05/14/0035-help-about-dialog.html


Re: dub / debug build / missing symbols

2019-05-12 Thread Ron Tarrant via Digitalmars-d-learn

On Saturday, 11 May 2019 at 16:12:34 UTC, Robert M. Münch wrote:
I somehow managed to get debug symbols into my dub project in 
the past.


Now I'm trying to extend my dub configuration to use different 
libs for debug and release versions.


 "buildTypes"  : {
   "debug" : {
 "libs-windows-x86_64"   : ["user32", "gdi32", 
"mylib1_d_x64", "mylib2_d_x64"],

   },

   "release" : {
 "libs-windows-x86_64"   : ["user32", "gdi32", 
"mylib1_x64", "mylib2_x64"],

   }
 },

And now, the debug build doesn't contain any symbols anymore... 
what am I missing?


Not really familiar with this, but at a guess...

Have you tried it without the 32-bit references?


Blog Post #0034 - A Singleton AccelGroup

2019-05-10 Thread Ron Tarrant via Digitalmars-d-learn
In today's blog post is an example of how to use a singleton for 
the AccelGroup, so you don't have to pass a reference down 
through a gazillion levels to get it to the MenuItems.


It's right here: 
http://gtkdcoding.com/2019/05/10/0034-accelgroup_singleton.html




Re: Framework design, initialization and framework usage

2019-05-09 Thread Ron Tarrant via Digitalmars-d-learn

On Thursday, 9 May 2019 at 11:48:59 UTC, Robert M. Münch wrote:

The application won't know/see a difference on which platform 
it runs. I expect some differences in how GUI actions are 
handled or communicated to the framework, however these should 
be rare and can be handled with conditional compilation.


This is sounding more and more interesting.


Re: Blog Post #0032 - Menu Accelerator Keys

2019-05-09 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 8 May 2019 at 15:06:23 UTC, number wrote:

I do feel a bit pedantic about it too :)


That's like OCD, right? :)



Re: Framework design, initialization and framework usage

2019-05-08 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 8 May 2019 at 10:21:34 UTC, Robert M. Münch wrote:

However, I'm happy to post some updates/screenrecordings to 
show our progress.


Works for me.

What are you interested in or what would you do with such a 
framework?


You sparked my interest because it sounds like you're working on 
something similar to what I cover in a blog I've been writing 
since January (http://gtkdcoding.com).


Rather than write something from scratch like you guys (I'm not 
that brave) I take an OOP approach to GtkD, modularizing so it's 
as close to using Lego as possible.


This blog is a revamp of another I started back in 2006 for 
PHP-GTK, but using D rather than PHP and updated to GTK 3.x. The 
original also included an application framework (which I haven't 
yet reproduced in D) with a pluggable do/undo/redo system.


So you can see why I perked up when I read your thread.

And I assume your framework is written with D as a base language? 
And you said it's cross-platform, too? Windows, Mac, Linux? Are 
any of the BSDs supported?


Assuming all that, we're very much of the same mind: 
cross-platform GUI applications made fast-n-easy using a single 
language and toolkit.


Re: Framework design, initialization and framework usage

2019-05-08 Thread Ron Tarrant via Digitalmars-d-learn

On Wednesday, 8 May 2019 at 06:30:56 UTC, Robert M. Münch wrote:

The goal is to have a generic framework for desktop apps where 
you can directly start to work on the app and don't have to 
care about getting all the necessary environment and 
building-blocks up & running.



* High speed 2D graphics (working)
* GUI widget set, self-drawn via 2D graphics. Not using any OS 
widgets. Portable. (only simple tests so far)

* Flex-Box like layouting of GUI elements (working)
* Framework and App logic linked/using Reactive pattern. 
Message passing everywhere. (working)

* Selfcontained executables, no external dependencies (working)
* SQLite3 included (working)
* LuaJIT as embedded scripting layer for declarative GUIs (not 
yet decided)


This sounds like a complete replacement for either QT, MFC, or 
GTK as well as Glade/QT Designer all rolled into one.



Our focus is executable size (I'm an old school guy) and speed.


Right with you there.

For some simple real-time grid example see: 
https://www.dropbox.com/s/eyya0brc5sbcs09/Bildschirmaufnahme%202019-05-02%20um%2022.09.54.mov?dl=0


Very impressive. Is there somewhere I can follow along with what 
you guys are doing? Do you have a GitHub presence?





<    1   2   3   4   >