• Welcome to PlanetSquires Forums.
 

WinFBE using CWindow

Started by Paul Squires, May 28, 2016, 02:44:45 PM

Previous topic - Next topic

Paul Squires

Attached is the very first code for WinFBE that now uses Jose's CWindow class and associated functions. It is basically the main form of the editor. You can view this as a proof of concept.

To compile, you can edit the batch files and replace my path to the compilers with your own specific path. If you use JellyFB or another FB editor then remember to add WinFBE.rc to the compile.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

@Paul,

One common problem is that I can't work with many programs unless I maximize them. Without doing it, the bottom of the editor goes outside my monitor.

What I do in my editor is to dimension the main widow according to the working area. Later, I save the window placement if the user has resized it. But how can resize it if the bottom is outside of the monitor?

This is what I use:


   '  Create the main window and child controls
   Dim pWindow As CWindow
   ' // Retrieve the size of the working area
   DIM rc AS RECT = pWindow.GetWorkArea
   pWindow.Create(Null, "WinFBE - FreeBASIC Programmer's Editor", @frmMain_WndProc, _
      0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top)
   pWindow.Center


I will have to do something with the icons, if I can manage to display them. For some reason they aren't displayed in my system.

José Roca

BTW you can use your own class name, e.g.


   Dim pWindow As CWindow = "WinFBE"


José Roca

Well, if we fill the working area, then pWindow.Center isn't needed.


   '  Create the main window and child controls
   Dim pWindow As CWindow
   ' // Retrieve the size of the working area
   DIM rc AS RECT = pWindow.GetWorkArea
   pWindow.Create(Null, "WinFBE - FreeBASIC Programmer's Editor", @frmMain_WndProc, _
      0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top)


Paul Squires

Thanks Jose, I have made both changes.

So, you are not able to see the toolbar icons on your computer? I have attached a screenshot to this post to show what the application should look like. I am running Windows 10.

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

ImageList_AddMasked was failing in my computer (I'm using 192 DPI) because you have calculated the correct size for creating the image list, but then you are using a fixed size of 24 in ImageList_AddMasked.


i = ImageList_AddMasked( hImageListNormal, LoadImage( hInst, "IMAGE_N_NEW_FILE", IMAGE_BITMAP, 24, 24, nFlags ), cClr )


instead of


i = ImageList_AddMasked( hImageListNormal, LoadImage( hInst, "IMAGE_N_NEW_FILE", IMAGE_BITMAP, cx, cx, nFlags ), cClr )


Paul Squires

Oh my, sometimes I can be so stupid! I should have seen that  :)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Once you made the changes, how do the toolbar images look for you at 192 DPI ? Are they acceptable looking?
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

This happens in the best families. I also had forget to check for the validty of the pointer in  the resize class. Normally, a good GPF reminds me that I have to do it, but not GPF in Windows 7.

José Roca

Quote from: TechSupport on May 28, 2016, 07:08:56 PM
Once you made the changes, how do the toolbar images look for you at 192 DPI ? Are they acceptable looking?

Yes. They are simple images, without alpha channel, so no problem.

However, I'm going to convert the normal ones to PNGs and use my GDI+ functions to build the three image lists with just this icon set.

José Roca

#10
I have converted the icons to PNGs. They are included in images.rar. Put them in the Images/Toolbar folder.

In the WinFBE2.rar archive you will find WinFEB2.bas and WinFBE2.rc.

Even with these small icons, we save 62 Kb.

I also have added some icons to the File menu to demonstrate how to do it.

Bitmaps with pink background are a thing of the past.

If tomorrow you want to use alphablended icons, with this change you only have to get a set of new icons and recompile.

Paul Squires

Awesome! The exe is indeed smaller. You must have made changes to the frmMain.inc file as well to use your new ImageList code for normal and dithered images?
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Oh, the menu icons do not look very sharp on my system. I have attached a screenshot to show you.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

Sorry, I have forgot to add that file. Of course it is the one that has most of the modifications.

José Roca

> Oh, the menu icons do not look very sharp on my system. I have attached a screenshot to show you.

Strange. They look fine in mine.

Using Windows 7 or Windows 10?