Few words about drawing:
When you choose, eg. Line or Circle, then press the mouse button on starting point, drag cursor to the ending point and release button.
But there are two exceptions:
1. Text - press and release the button on starting point; this point will become the bottom-left beginning of the text.
Then choose a font (avoid fonts with digits in their names, they won't work [EDIT: they work since v1.1]), style and size and in the next window enter some text.
2. Arc - press the mouse button on starting point, drag cursor to the ending point and release button, then move cursor to another point and press space [EDIT: since v1.3 - press right mouse button].
(Then you can move cursor to another place and press space again, and so on.)

The drawing area is fixed to 512x512, but it doesn't matter IMHO, since it's vector graphic. As I wrote above you can adjust final resolution while exporting to PNG.

Hint: since you're drawing within a button, it blinks on hover and clicking. To avoid this, just draw filled rectangle that fills all space. This will also remove default transparency of the background.

Edit:
Version 1.1 uploaded, see this post for changelog.
Version 1.2 uploaded, see this post for changelog.
Version 1.3 uploaded, see this post for changelog.
Version 1.4 uploaded, see this post for changelog.
Version 1.5 uploaded, see this post for changelog.
Version 1.5 replaced with v1.5.1, see this post for details.
Version 1.6 uploaded, see this post for changelog.
Version 1.6.1 uploaded, see this post for changelog.
Version 1.7 uploaded, see this post for changelog

Version 1.8:
- removed 'vercmp' dependency and used 'busybox dc' for compatibility with Fatdog

Unpack, make executable & click to launch.MD5: 2a73ea728b2e3e61c81a94802d22c117 bdraw-1.6.shWARNING - this version may not work due to <spinbutton> failure in some cases.Reason: comma as decimal separator.

Hello,
Amazing.. Simply amazing..
Who would have thought... Well, you of course..
Ohh, the possibilities....
Been playing with gtk lately..
I believe we yet just touching on what it can do..
All the parts are there, its just figuring out creative ways to use them..
Like this...

I wonder whether I shouldn't try to port your code to BaCon. It is brilliant (yours), but we would get a real speed increase and, if UPX'd, it would be about 7-10k and be a very responsive little draw program. What do you think?

I wonder whether I shouldn't try to port your code to BaCon. It is brilliant (yours), but we would get a real speed increase and, if UPX'd, it would be about 7-10k and be a very responsive little draw program. What do you think?

With kind regards,
vovchik

I think it's great idea, thank you! But if you could wait a while - I'm working on some little improvements (unfortunately they require Gtkdialog >= 0.8.0 now, but on the other hand every modern Puppy has it) and I did overlook 2-3 things, must fix them now.

The drawing area is fixed to 512x512, but it doesn't matter IMHO, since it's vector graphic. As I wrote above you can adjust final resolution while exporting to PNG.

Well, it matters really if we consider ratio...

Fortunately it's been solved (in a bit ugly, but somehow working way).
Franky, since the beginning I wanted to add the choice of size of drawing area, but the problem was that if the area was too narrow, the bottom widgets made the whole window stretched, including the "Main Button".
Even if I used <hbox></hbox>, the button was aligned to the right, which was completely opposite of what I wanted.
And even the great trick with <hbox><text> unveiled by Zigbert in his Gtkdialog thread didn't work, because although Main Button was aligned to the left, still was stretched too much.
The idea was to add another, invisible button next the Main One, which equalize the whole size and align Main Button to the left...but how to determine the overall size of a window before it's displayed..?
(Note - I had to consider that each user has different font size what causes different size of bottom buttons).

At first there's created an empty picture with 1x1 resolution and put into that invisible "Fix Button".
Then, when the window is being displayed, appropriate function is called and send to the background, waits 0.2s to make sure that the window is "really" displayed and visible for xwininfo, calculates the proper width of that picture and overwrites it.

The unsolved thing is to automatically refresh/resize "Fix Button" - now it's done when user hover the Main Button area for the first time.
Another thing I'm not happy with: even if drawing area is wide enough and Fix Button's width is set to 1px, there's still thin, vertical bar of empty space next to drawing area, on the right.

The maximum allowed picture resolution is calculated like this:
Max_X = Screen_Width - 64
Max_Y = Screen_Height - 256
Limiting the height is important because:
if
1). Picture height is greater than screen height
and
2). Picture is narrower than bottom widgets
then
when Fix Button is being resized, the whole window is cropped at bottom and adjusted to screen height.
I don't know why this happens and can't fix it, sorry. I hope the resolution limit won't be a big problem to anyone..?
On the other hand you can edit even 1x1 picture (if you have ultra-sensitive mouse and sharp eye).

Well, after all I believe it's fair trade, since BDraw is much more functional now.
And all in all it's just a playful toy.

"Load" button has been removed from the main window and now when app is launched there's a little initial window with "New", "Open" and "Quit" buttons.

Another fixes/additions:
- Oversight in Text tool: if there's more than one space in a row, they'll be displayed as one space; fixed now.
- Fonts with digits in their names - fixed!
- Added "Redo" button. I didn't mention it before, but Undo is multi-level, as well as Redo.
But to avoid some ambiguous mess, after drawing any shape, Redo buffer is cleared.
- Added cursor position view (updated every 1s) and current picture resolution.
@Vovchik - Is it possible to increase the update interval in BaCon, so it'd be close to realtime..?
- few minor code improvements

PS. Only two widgets seem to require Gtkdialog-0.8.0, so if someone would like to backport it to 0.7.21, it's just a matter of replacing <statusbar> with <text> and <timer> with <progressbar> (see Zigbert's thread for details).

I do not know how to tell you that you have uncovered something like quantum mechanics within the GTK button widget. Lovely And I worked for decades at the IAEA and did their first TCP/IP. You captured something essential. Nice

SFR
The tips-thread is a bit old - it was written in those days before Thunor stepped up. Gtkdialog was not that powerful, and we needed more workarounds.

Some thoughts:
- I usual align widgets to the left by including a text widget. <text space-expand="true" space-fill="true"><label>""</label></text>
- You can make the drawing size larger than screen-size by setting the <button> widget inside a <vbox scrollable="true">
- I think it would be possible to use a <pixmap> widget instead of the <button> for the drawing. gtkdialog supports <eventbox> which can add <actions> to nonactive widgets like the <pixmap>.
- The <timer> can be updated more frequently than each sec. <timer visible="false" milliseconds="true" interval="100">

- I usual align widgets to the left by including a text widget. <text space-expand="true" space-fill="true"><label>""</label></text>

Yes, this is the trick I tried - the problem is that the Left Button becomes stretched anyway and covers ~half of the window (horizontally).
Couldn't find out any way to get its real size.

Quote:

- You can make the drawing size larger than screen-size by setting the <button> widget inside a <vbox scrollable="true">

Good thinking, but I'll lose the ability to calculate mouse position properly...hmm, maybe in one of future Gtkdialog version will be something like "read-vbox/hbox-scrollbar-shift".

Quote:

- I think it would be possible to use a <pixmap> widget instead of the <button> for the drawing. gtkdialog supports <eventbox> which can add <actions> to nonactive widgets like the <pixmap>.

I didn't play with Gtkdialog >= 0.8.1 yet, but I'll try it one of these days, thanks!

Quote:

- The <timer> can be updated more frequently than each sec. <timer visible="false" milliseconds="true" interval="100">

Just tried and it works and looks nice...but unfortunately, it slows down response time and if user presses button and starts to drag the cursor too sudden, the initial X & Y coordiantes are incorrectly calculated.
Well, it happens even now with interval="1" (sec.), but to a lesser extent.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum