forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Beta release of ClearWin+
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Sun Feb 08, 2015 10:39 pm    Post subject: Reply with quote

Unfortunately that suggestion did not work and I have absolutely no time to any experiments right now, fixing this thing is not urgent. But hopefully someone has some free time. By the way the program i uploaded could be useful for everyone many times in your lives. Disclaimer is usual - you can modify it at your convenience and use at your discretion, with of course my zero liability.

The zip file has no exe, only source and bat file for your compilation convenience, so nothing to worry about viruses.

This program digitizes graphs. You have always use Ctrl+LeftClick to change or set anything

1) drop the image,
2) Ctrl+LeftClick on the point on the graph X or Y axis at any initial and end points, then right click, set physical coordinates for the four (X0,X1) and (Y0,Y1) points from the graph better for accuracy of digitizing taking a minimum and maximum on the graph (the pixel coordinates x,y will be set automatically). For example it will be (-315,45) and (-1,1) as in the picture below
3) select/highlight the area which contains the graphs (without other things which might interfere, like graph axis, texts etc if they have the same color as digitized curve). For that again use Ctrl and left mouse button moving mouse fom one desired corner to another
4) chose the color of the digitized curve by stepping on the curve and again CTRL+LeftClicking
5) push Digitize button.

The digitized points will appear on the graph with the color and thickness you can additionally set. You can see if any points are correctly digitized.
You can reload the graph if needed

The directory will contain digitized data and settings file for this specific graph with the same name so that next time you just drop the same graph and only click Digitize button

Try it on this curve



But first please find the bug with PNG, GIF etc files Smile. BMP works fine if you set istate=0 in parameters. Turn this GIF file to BMP initially to see how things work, then change istate=1 and use GIF or PNG to see that the code stops working


Last edited by DanRRight on Mon Feb 09, 2015 8:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 303
Location: Düsseldorf, Germany

PostPosted: Mon Feb 09, 2015 1:12 pm    Post subject: Reply with quote

Dan,

I made a few modifications in your code. In „Program Digitizer“ I added

Code:
        C_EXTERNAL USE_GDIPLUS_IMAGE_FILES@ '__use_gdiPlusForImageFiles'  (VAL):INTEGER*4

        istate=1   
        istate0= USE_GDIPLUS_IMAGE_FILES@(istate)


These lines I deleted in the function ReadDragAndDropFiles, but there I added

Code:
    character*256  string


A bit more down, I de-activated

Code:
!        call get_dib_block@(filenameImageToRead,ImageArr,hres, vres,0,0,hres, vres,0,0,ier)
!        if(ier.ne.0) goto 993


After your winio@ calls, just before “goto 10000”, I added

Code:

      string = ' '
      string = '{'//trim(filenameImageToRead)//'}'//char(0)
      j = import_image@(string,0,0)


… and it runs.

It seems to me that get_dib_block@ doesn’t work together with the GDI+ enhancements, but the import_image@ function do the job.

Wilfried
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Mon Feb 09, 2015 8:26 pm    Post subject: Reply with quote

Thanks Wilfried,
That was good workaround to display the bitmap. Now do you have similar workaround to read the bitmap into data array ImageArr(3,ixsize,iysize) what the get_dib_block@ was doing ?

But the big question still remains why does the small code I posted above works fine with get_dib_block@ and the enhancement on? That is impossible, isn't it? Here Paul may shed the light, probably, as this is him who speaks to the devil directly.
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 303
Location: Düsseldorf, Germany

PostPosted: Tue Feb 10, 2015 9:51 am    Post subject: Reply with quote

Dan,

yes, the big question remains Wink

A workaround to get the array from the data loaded into a %gr area may probably look like this (but I'm sure there could exist a better way):

Code:
do j = 1,ImageWidth
  do i = 1,ImageHeight
    call get_rgb_value@(j,i,k)
    l = loword(k)
    ImageArr(1,j,i) = char(lobyte(l))
    ImageArr(2,j,i) = char(hibyte(l))
    ImageArr(3,j,i) = char(hiword(k))
  end do
end do

Wilfried
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Wed Feb 11, 2015 7:47 am    Post subject: Reply with quote

Yes, this works too, thanks.

(I extensively use this function after the mouse
call get_mouse_info@ (ixmoubut, iymoubut, iflags)
call GET_RGB_VALUE@( ixmoubut, iymoubut, iRGBvalue )
and by inertia though that it only shows mouse cursor rgb Smile )

Will try to make small example so Paul will see the reason for other method troubles and then will post the whole code again


Last edited by DanRRight on Thu Feb 12, 2015 12:53 am; edited 1 time in total
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Wed Feb 11, 2015 8:10 am    Post subject: Reply with quote

Paul,

I modified the code a bit and though i could not find the reason i found two signs or clear irregularities.

1) The code which i said worked OK in fact crashed on second time you drop the file

2) Adding SAVE statement allowed it not to crash at least with two drops

Code:

INTEGER , EXTERNAL :: DropFiles
       i=winio@('%ww[no_border]&')
       i=winio@('%bg[#cc9999]&')
       i=winio@('%si! Drag-n-drop BMP,PNG,GIF etc file here   %ff %ff&')
       i=winio@('%dr&', DropFiles)

       i=winio@('%ac[Alt+X]&','exit')
       i=winio@(' %ff %cn%tt[OK]')

 END PROGRAM         

    integer function  DropFiles()
    use clrwin
    character*128 filename1
    integer*1, dimension(:,:,:), allocatable :: ImageArr
    integer hres, vres, colours, ier
    C_EXTERNAL USE_GDIPLUS_IMAGE_FILES@ '__use_gdiPlusForImageFiles'  (VAL):INTEGER*4
    SAVE

    istate=1   
    istate0= USE_GDIPLUS_IMAGE_FILES@(istate)

    filename1 = clearwin_string@ ('DROPPED_FILE')
    call get_dib_size@(filename1, hres, vres, nb_colours, ier)
    print*,' hres,vres,nb_colours=',hres, vres, nb_colours

    kAllocOK=0
    allocate ( ImageArr(3,hres, vres),  stat = kAllocOK)
    if (kAllocOK /= 0) write (*,*) 'Allocation problem #', kAllocOK, hres, vres

    call get_dib_block@(filename1,ImageArr,hres, vres,0,0,hres, vres,0,0,ier)
    if(ier.ne.0) Print*, 'get Err=',ier

    i=winio@('%ww&')
    i=winio@('%gr[full_mouse_input,rgb_colours,popup]&',hres,vres)
    i=winio@('%ac[Alt+X]&','exit')
    i=winio@('%ac[esc]&','set', LWwindow_control,0) ! 'exit')
    i=winio@('%lw', LWwindow_control)

    call display_dib_block@(0,0,ImageArr,hres,vres,0,0,hres,vres,0,0,ier)
    if(ier.ne.0) Print*, 'Display Err=',ier

 !   deallocate(ImageArr, stat = ios)
 !   if (ios /= 0) then
 !     print *, "Was nothing to deallocate"
 !   end if

     DropFiles=2
    end function



That fix is not urgent, since Wilfried's workaround solves the problem
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4915
Location: Salford, UK

PostPosted: Wed Feb 11, 2015 9:38 am    Post subject: Reply with quote

Your program works fine for me. I have modified it slightly but not in a significant way that I know of.

Code:
    winapp
    program main
    implicit none
    integer,external::DropFiles
    c_external use_gdiplus_image_files@ '__use_gdiPlusForImageFiles'(VAL):integer
    integer i,winio@
    i=use_gdiplus_image_files@(1)
    i=winio@('%ww[no_border]&')
    i=winio@('%bg[#cc9999]&')
    i=winio@('%si! Drag-n-drop BMP,PNG,GIF etc file here   %ff %ff&')
    i=winio@('%dr&', DropFiles)
    i=winio@('%ac[Alt+X]&','exit')
    i=winio@(' %ff %cn%tt[OK]%nl.')
    end program         

    integer function DropFiles()
    use clrwin
    implicit none
    character*256 filename1
    integer*1, dimension(:,:,:), allocatable :: ImageArr
    integer hres, vres, colours, ier, LWwindow_control, i, kAllocOK, nb_colours
    filename1 = clearwin_string@('DROPPED_FILE')
    call get_dib_size@(filename1, hres, vres, nb_colours, ier)
    Print*,' hres,vres,nb_colours=',hres, vres, nb_colours
    allocate(ImageArr(3,hres, vres), stat = kAllocOK)
    if(kAllocOK /= 0) Print*, 'Allocation problem #', kAllocOK, hres, vres
    call get_dib_block@(filename1,ImageArr,hres, vres,0,0,hres, vres,0,0,ier)
    if(ier /= 0) Print*, 'Get Err=',ier
    i=winio@('%ww&')
    i=winio@('%gr&',hres,vres)
    i=winio@('%ac[Alt+X]&','exit')
    i=winio@('%ac[esc]&','set', LWwindow_control,0)
    i=winio@('%lw', LWwindow_control)
    call display_dib_block@(0,0,ImageArr,hres,vres,0,0,hres,vres,0,0,ier)
    if(ier /= 0) Print*, 'Display Err=',ier
    DropFiles=2
    end function
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Thu Feb 12, 2015 12:01 am    Post subject: Reply with quote

Thanks. Indeed it is interesting that you have found a stable configuration but the main point is that my text should also work as it is completely legitimate and it works without these new features fine. If not find the reason and leave it as is the devilry will still live in the compiler

I tried different things, even rebooted computer which took me two days to save and close 1000 open for months windows, and after that i thought i found the reason (it was in character*128 filename1 versus yours character*256 filename1 - which is strange) but things changed after reboot. That is exactly what i call *devilry*

Will experiment more when have time since this devilry usually kicks exactly the day before the important talk or meeting when there is absolutely no time Smile
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4915
Location: Salford, UK

PostPosted: Thu Feb 12, 2015 8:20 am    Post subject: Reply with quote

It might be something to do with the %gr options. If you find thing that makes the difference then please let me know.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Fri Feb 13, 2015 5:17 pm    Post subject: Reply with quote

Seems %gr options above are ok. Crashing in this small code is caused by the declaration inside callback function. If move it as you initially suggested to main program (why? it should work both ways) this code does not crash. Still in my bigger program DIB function fails with error variable ier>0.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Mon Mar 02, 2015 6:50 am    Post subject: Reply with quote

I think i made an error above. One thing which was muddying transparent over graphics backgrounds texts was indeed fixed but now texts lost the transparency. Basically everything is returned back to older state where transparency of texts did not exist.

/* The reason why i made an error is because i made "titanic" work for most controls i use and handpainted the white background under the texts to have approximately the same color as graphics bitmaps under it and when checked latest beta did not notice small discrepancy.

/** Since not many people really use this new feature yet, plus it is just a cosmetic problem, it is not urgent issue to fix. What was fixed is more important. And of course getting 64bit compiler out is way more important too.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 4915
Location: Salford, UK

PostPosted: Mon Mar 02, 2015 8:09 am    Post subject: Reply with quote

Are you using the beta salflibc.dll and %~wp?

If you are then please supply a short working sample that illustrates the failure.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 1544
Location: South Pole, Antarctica

PostPosted: Mon Mar 02, 2015 10:42 pm    Post subject: Reply with quote

Salflibc 01.28.2015

Code:
i=winio@('%wp[bitm]&')
i=winio@('Text text text %rb[Radiobutton] Number %4rd', irb, ii )
end

resources
bitm   BITMAP bitm.bmp


Did i miss some new option for that?

UPDATE: Yes, all works, may be just the radiobutton don't but that's OK. Found that the new option you have mentioned, a tilda, is doing the trick with text transparency. Great!
Back to top
View user's profile Send private message
dgurok



Joined: 26 May 2011
Posts: 37

PostPosted: Wed Oct 07, 2015 2:21 pm    Post subject: Reply with quote

Is there a possibility to change the visual experience of clearwin+?
I would like to create ribbon ui with clearwin+ ...
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1651
Location: Yateley, Hants, UK

PostPosted: Wed Oct 07, 2015 5:28 pm    Post subject: Reply with quote

Dgurok,

I've often wondered the same, and I suspect that the answer to 'can I get a ribbon that looks and works exactly like an MS Office app with Clearwin+?' is probably 'No'. But, I've no doubt that you could fix up something.

My suggestions come because I had to make pop-up menus from a graphics area when that facility didn't work. The trick was to start the popup window - which would be your ribbon - with ...

Code:
         IA=WINIO@('%ww[no_maxminbox,volatile]&')
         IA=WINIO@('%ww[casts_shadow]&')
         IA=WINIO@('%ww[no_frame]&')
         IA=WINIO@('%ww[no_caption]&')
         IA=WINIO@('%sy[toolwindow]&')
         IA=WINIO@('%bg[btnface]&')
         IA=WINIO@('%sp&', JXP, JYP)


You would want to omit casts_shadow and volatile, and the coordinates JXP & JYP would be the top left of the client area. You would need a set of routines for drawing each type of ribbon, and close / redraw every time there was a change. Plus, you would need to handle what happened to your ribbon if the main window was moved or resized - not a small job. Your ribbon would in effect be a separate window

Alternately, as the main menu items turn into 'tabs' with a ribbon design, then maybe you could create your ribbons from a set of property sheets and do without a conventional menu bar made with %mn.

My final suggestion is that you have a set of main windows each with a different ribbon, and that you close the old one and draw the new on each time the user changes ribbon. You won't notice the delay if your computer is fast, but destroy the old window after you create the new one each time.

I'd be interested in hearing what transpired if you tried.

Eddie
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group