Page 1 of 3

Posted: Thu 22 Nov 2012, 16:08
by SFR
Thanks for the info Geoffrey!
__________

I don't know how could I missed the obvious and trudge into complex and unnecessary methods.
If the button is narrower (or not) than the window, it's enough to use <hbox homogeneous="true"> (this will nicely align it to center, horizontally), and calculate X position using:
X = ( Mouse_X_Pos - Window_X_Pos ) - ( ( Window_Width - Picture_Width ) / 2 )
Much more simple and elegant...

So, the height problem is gone and theoretically picture size is no longer limited, but I set the limit to 2048x2048; more causes terrible slow down and/or Gtk crashes.
Also, coordinates were displayed in a range from 0 to Picture_Width/Height what was wrong, it's been corrected: from 0 to (Picture_Width/Height - 1).
And, just for fun, I added simplified support for dashed lines.

Ok, now I'm quite satisfied with this...

Version 1.2 attached to the first post.
___________

@Zigbert:
Just tried <eventbox> and it's really promissing. The one and only problem is handling keystrokes (for "Arc"), because there's no way to catch focus on <evenbox><pixmap> area; it's always glued to (and intercepted by) one of bottom buttons.

If someone would like to play with it, I've attached it to this post, as version 1.2+.

Greetings!

Posted: Fri 23 Nov 2012, 17:48
by SFR
RE: <eventbox><pixmap> and "Arc"

Nothing is unsolvable. :)
I examined Zigbert's Pmusic - I had no idea that there's $BUTTON variable in Gtkdialog that makes possible to read which button is pressed.
So "Arc" is now handled by right mouse button instead of spacebar.

As a really nice side effect, it's possible to draw "rays" and similar stuff now - simply, when you left click on some point, then you can right click many times elsewhere, but the initial X/Y position stays unchanged.

Another thing I _thought_ it's impossible to implement: "Freehand" mode.
It's not perfect - a bit "edgy", but pretty amusing.


Important change:
AFAIK in frugally installed Puppies /tmp folder is kept in RAM, but not in case of full installs (I might be wrong).
Since there's a lot of constantly used (by BDraw) temp files stored in /tmp, I changed the location to /dev/shm (suggested to me by Technosaurus elsewhere), what (I guess) should improve performance in fully installed Puppies.
If I'm wrong about this, please let me know, so I'll roll it back.

BTW, I combined both methods into one script - one can choose at initial window to use <button> or <pixmap>.

First post updated.

PS. Sorry for such frequent updates, but every time I thought "Ok, that's it, done!", then suddenly in the middle of the night something new popped up in my mind.
This time I'm pretty sure - I'll give it a rest...at least for some time. :wink:

Greetings!

Posted: Sun 25 Nov 2012, 09:41
by Geoffrey
SFR wrote:PS. Sorry for such frequent updates, but every time I thought "Ok, that's it, done!", then suddenly in the middle of the night something new popped up in my mind.
This time I'm pretty sure - I'll give it a rest...at least for some time.
Don't apologize, update as much as you like, I like to see things evolve like this, I'm liking it a lot. :)

Posted: Sun 25 Nov 2012, 19:25
by SFR
Thanks Geoffrey :)
Indeed - I forgot about one important feature: bitmap import/export.

"Import Clipart" usage: select with mouse a part of drawing area, then choose an image.
The image will be inserted within previously selected area.
Supported (but not fully tested) formats are: bdr, png, svg, xpm, bmp, gif, jpg, tif, ico, ppm, pnm, pcx, tga.

BTW, the image will be 'base64' encoded and embedded into the picture, not linked.

Another nice side effect - the direction of selecting matters, eg. from upper left to bottom right - image will be inserted normally, but eg. selecting from bottom right to upper left - image will be flipped both horizontally and vertically.

"Export clipart" is used in the same manner as "Import", but the output format is always .png and the trick with "direction of selecting" doesn't work.

First post updated.

Greetings!

Posted: Mon 26 Nov 2012, 06:07
by Puppyt
WOW! Fantastic work, SFR - I guess now we don't have to keep lamenting that Barry's EVE can't be ported into Puppy http://bkhome.org/eve/ :)

Posted: Tue 27 Nov 2012, 17:37
by charlie6
Hi,
would like to get a try ...
:cry: i only got this on dPup-Exprimo an uPup-Precise-5.4.X.4...
BDraw-1.4 and 1.3
here gtkdialog is 0.8.2 (exprimo) and 0.8.3 (precise).
did i miss something..?
thanks for any answer
Charlie

Posted: Tue 27 Nov 2012, 18:42
by SFR
Hey Charlie6

Just tried BDraw-1.4 on the uPup-Precise-5.4.X.4 (fresh live boot as well as after creating pupsave) and everything's fine here...
Your screenshot suggests me that, for some reason, the initial, empty picture wasn't created properly and its resolution was set to contents of /root dir (Choices, Desktop), which is absolutely strange. :shock:

Could you please:

1. Redownload the app and verify its md5. Here are md5 sums of:
- uncompressed script:

Code: Select all

7a8d7473b86b04d1342ab3926a89170a  bdraw-1.4.sh
- as well as gzip'ed file:

Code: Select all

f6028d11539a7f3f64bfb76600ef0468  bdraw-1.4.sh.gz
2. Launch it from the terminal and post the results.

(3. And maybe try it on clean Puppy with pfix=ram ..?)

Greetings!

Posted: Tue 27 Nov 2012, 18:43
by pemasu
Tested it also. :D

Posted: Thu 29 Nov 2012, 05:35
by charlie6
Hi SFR,
thanks for answering
- checked OK the md5sums;
- runs nice on a fresh upup-54X4 install;
- here is the console comment related to my above pet:
note: there are other pets already installed (see attachment)..maybe the cause would be there..?
# ./bdraw-1.4.sh
sh: line 1: [: Choices: integer expression expected
sh: line 1: [: Desktop: integer expression expected
sh: line 1: [: Choices: integer expression expected
sh: line 1: [: Desktop: integer expression expected
sh: line 4: [: Choices: integer expression expected
sh: line 4: [: Desktop: integer expression expected
sh: line 1: [: Choices: integer expression expected
sh: line 1: [: Desktop: integer expression expected
sh: line 4: [: Choices: integer expression expected
sh: line 4: [: Desktop: integer expression expected
sh: line 1: [: Choices: integer expression expected
sh: line 1: [: Desktop: integer expression expected
sh: line 1: [: Choices: integer expression expected
sh: line 1: [: Desktop: integer expression expected

** (gtkdialog4:21541): WARNING **: The recently launched window "SURE" is missing an equivalently named variable directive <variable>SURE</variable> which is a requirement of the launch action.
sh: line 1: [: Choices: integer expression expected
sh: line 1: [: Desktop: integer expression expected
CUR_DISPLAY=" Start: 92,127 End: 92,127"
DASH_VAR="false"
FILL_VAR=""
M="Freehand"
OPAC="1.0"
PICTURE=""
RES_DISPLAY=" Width: Choices Height: Desktop"
STROKE_VAR=""
SUREWINDOW=""
SW="1"
EXIT="Exit"
#
thanks
Charlie

Posted: Thu 29 Nov 2012, 12:26
by SFR
Hmm, I installed most of these packages (except TiMidity++-2.13.0 (but the newer 2.13.2 - yes), lxtask_NLS-0.1.4, ttf-bitstream-vera_1.10-8 and xorg_high_intel-0.0.1) and still can't reproduce this issue.
But my suspicions goes to Xdialog.

Would you like to do a little bit of debugging? :wink:
About line 709 there's the following piece of code:

Code: Select all

  RESOLUTION="`Xdialog --title "Choose picture resolution" --2spinsbox "" 0 0 1 $MAXX $DEFX "Width" 1 $MAXY $DEFY "Height" 2>&1`"
  [ "$?" -ne 0 ] && exec $MYNAME
  X="`echo $RESOLUTION | cut -f1 -d '/'`"
  Y="`echo $RESOLUTION | cut -f2 -d '/'`"
  echo $X $Y > $PICRES
  make_empty
Change it to:

Code: Select all

  RESOLUTION="`Xdialog --title "Choose picture resolution" --2spinsbox "" 0 0 1 $MAXX $DEFX "Width" 1 $MAXY $DEFY "Height" 2>&1`"
  [ "$?" -ne 0 ] && exec $MYNAME
    echo "$RESOLUTION"  	# DEBUG
  X="`echo $RESOLUTION | cut -f1 -d '/'`"
  Y="`echo $RESOLUTION | cut -f2 -d '/'`"
    echo $X $Y			# DEBUG
  echo $X $Y > $PICRES
    cat $PICRES			# DEBUG
  make_empty
    cat $PIC				# DEBUG
    exit 1   # Exit at this point
Launch it from terminal again and post the results.

Also, if debugging will return "Choices" and "Desktop" again, replace the first line (from above) with this:

Code: Select all

  RESOLUTION="`Xdialog --stdout --title "Choose picture resolution" --2spinsbox "" 0 0 1 $MAXX $DEFX "Width" 1 $MAXY $DEFY "Height" 2>/dev/null`"
(it's single line)
Just a blindshot, but might work...

BTW, at the initial window when you press "New" button, the next window where you can choose resolution shows "512 Width" and "256 Height" or something else?

_______________
Puppyt wrote:WOW! Fantastic work, SFR - I guess now we don't have to keep lamenting that Barry's EVE can't be ported into Puppy http://bkhome.org/eve/ :)
Thanks Puppyt. Eve - yes...I played with it a little bit (as well as with Menuet OS) before I even knew what Puppy Linux is. :)

@Pemasu: I like your drawings! :)

Greetings!

Posted: Thu 29 Nov 2012, 16:21
by charlie6
Hi SFR,
SFR wrote:Hmm, ...Would you like to do a little bit of debugging? :wink: ...About line 709
thanks for your time !
attached: the console comments when doing the line 709 proposed replacements ...in both cases, BDraw-1.04 hangs up when pressing "New" :cry: .

I believe I've just found the cause and reproduced it:
in the attached comments, the first lines report a problem with gtk theme:
# ./bdraw-1.4.sh
** WARNING (recursed) **: Invalid borders specified for theme pixmap:
/usr/share/themes/Mac4Lin_GTK_v0.4-MU/gtk-2.0/Buttons/button-default.png,
borders don't fit within the image
512/256
I compared with another theme running without such problem and which has gtk-2.0/button-default.png (i forgot which name...);
Mac4Lin_GTK_v0.4-MU/gtk-2.0/button-default.png size is 75x23;
whereas the other is 75x25;
I then edited Mac4Lin_GTK_v0.4-MU/gtk-2.0/button-default.png to 75x25 (using mTpaint); saved it and restarted jwm and X;
>>------> no more problem reported;
then ran BDraw >>-----> now runs OK :D :D

Posted: Thu 29 Nov 2012, 17:19
by SFR
At last I was able to reproduce this.
Hmm, theme interference, I would have never thought! :shock:

The debug shows that there is problem with Xdialog in combination with this theme also, and:

Code: Select all

  RESOLUTION="`Xdialog --stdout --title "Choose picture resolution" --2spinsbox "" 0 0 1 $MAXX $DEFX "Width" 1 $MAXY $DEFY "Height" 2>/dev/null`"
was a good guess indeed...
There's a few more lines with faulty Xdialog syntax - I've corrected them in version 1.5, which works ok for me now with that specific theme.

I'm glad we have figured out what's going on, thanks! :D
_____________

Another addition:
After many trials&errors, tricks I'm not proud of, and almost crossing the edge of comprehending my own code complexity :wink: , I added (poor's man) "Preview" ability.
It's synchronized with coordinates updating (1 sec.).
It works with any tool except "Freehand" and "Text"; also, for "Arc" it shows only the final stage of creation (x3,y3).
I added togglebutton (an eye icon) to (de)activate it (default = off), because it can simply act too slow on slower machines.
This is rather experimental addition, so I'd be glad for any info how it works on other machines and if it's really usable or not..?

First post updated.

Greetings!

Posted: Thu 29 Nov 2012, 18:03
by vovchik
Dear SFR,

I have not yet tried a BaCon port, which I will, but since it is really C it would be instantaneous. Sorry for not responding, but I did not read that long thread fully until now.

With kind regards,
vovchik

Posted: Thu 29 Nov 2012, 19:24
by SFR
vovchik wrote:I have not yet tried a BaCon port, which I will, but since it is really C it would be instantaneous.
Can't wait. :)
BTW, I have no another updates in plans in the nearest future (unless some bug will pop up), so v1.5 can be considered as "final".

Thanks & Greetings!

Posted: Fri 30 Nov 2012, 23:15
by SFR
SFR wrote:[...](unless some bug will pop up)[...]
I had a hunch about that...

I discovered that "Import Clipart" option doesn't work in Precise and uPup-Precise.
I don't really know why, my guess is that there is a newer, more strict library responsible for displaying SVG in this pair.

Anyway, I've managed to fix that.

But since I have found that:

1. In those two Puppies only the following formats are supported:
.bdr, .svg, .bmp, .gif, .jpg, .png
2. tif/tiff makes BDraw hangs (sooo "sweet" :roll: )
3. pnm seems to not work at all...

I just reduced allowed formats to those six above; they're most popular anyway (except .bdr of course :wink: ).

Sorry for inconvenience.

Version 1.5 has been replaced with v1.5.1 in the first post.

Greetings!

Posted: Fri 30 Nov 2012, 23:28
by RSH
HI.

I have watched this from time to time and also downloaded. So, I must say: I like this. :D

Last version I've tested was 1.4 - it could not set/paint a single dot.

Suggestion:

Make it able to draw a single dot and insert a function to zoom single dots to (let's say) 8 pixels (for the use of small images).

It could be then a very nice and really useful Icon Editor. :idea: :D :lol:
SFR @ Icon Finder wrote:
RSH wrote:I like this that much, so i have made an icon for it.

Hope you like this.
Sure I do like! Me personally can't draw a straight line, so I always appreciate such a help.
Your icon has been included.
PLEASE!

Posted: Fri 30 Nov 2012, 23:59
by SFR
RSH wrote:Last version I've tested was 1.4 - it could not set/paint a single dot.

Suggestion:

Make it able to draw a single dot and insert a function to zoom single dots to (let's say) 8 pixels (for the use of small images).

It could be then a very nice and really useful Icon Editor. :idea: :D :lol:
Sure you can, just choose "Line", increase stroke-width a bit, and...start making dots.

Just kidding, I know what you mean. :wink:

You can do it this way: choose some bigger drawing area size to get control on details, eg. 480x480, make an icon and then save it as .png with 48x48 resolution.

Zoom option has crossed my mind, but it doesn't make sense really, since it's vector graphic, so even if some part of the picture would be zoomed, you couldn't see its "pixels" anyway.
SFR @ Icon Finder wrote:
RSH wrote:I like this that much, so i have made an icon for it.

Hope you like this.
Sure I do like! Me personally can't draw a straight line, so I always appreciate such a help.
Your icon has been included.
PLEASE!
I'm really hopeless in drawings, isn't that ironic..? :lol:

Thanks & Greetings!

Posted: Mon 03 Dec 2012, 12:33
by SFR
I couldn't stop myself: Version 1.6 uploaded.

Only one purpose: performance optimization in critical functions.
Result: ~15% less resource hungry.

Actually it's efficient enough to add (rough) preview for "Freehand" mode, what I did.
"Arc" preview has been improved too - now all stages of creation are shown.

First post updated.

Greetings!

How do I use this?

Posted: Tue 29 Jan 2013, 15:21
by Dromeno
BDraw looks promising but I have no idea how to use it in Lucid Pup 528005 (icewm as window manager)?

bdraw-1.61 reports "something is missing or doesn't work right" and "Double check requirements"

it is not an installable program so I do not know how to check for dependencies

bdraw-1.51 does work but it does not open existing png files, after I click on open picture the program returns to the Welcome to Bdraw dialog

Posted: Tue 29 Jan 2013, 16:04
by SFR
Hey Dromeno
bdraw-1.51 does work but it does not open existing png files, after I click on open picture the program returns to the Welcome to Bdraw dialog
BDraw won't load directly any other image type than .bdr (which is .svg really, but has "one-shape per one-line" layout).
If you'd like to include a .png image in your drawings, just choose "New" and then "Import Clipart" from Toolbox.
bdraw-1.61 reports "something is missing or doesn't work right" and "Double check requirements"

it is not an installable program so I do not know how to check for dependencies
Ok, just launch the app from command line and post the results...

Deps are listed in the first post, but I don't recall including anything new between 1.5.1 -> 1.6.

And since you're running Lupu always choose '<button>' as drawing area in initial window, unless you have upgraded Gtkdialog to >= 0.8.1

There were some problems with IceWM + specific theme(s?) reported earlier and it's been fixed in 1.5.1, but apparently I broke it again in 1.6.

Greetings!