• Welcome to PlanetSquires Forums.
 

WinFBE 1.4.1 on GitHub (August 3, 2017)

Started by Paul Squires, August 02, 2017, 04:43:54 PM

Previous topic - Next topic

Paul Squires

Quote from: Jose Roca on August 06, 2017, 02:38:44 PM
...I have a checkbox labeled "Display this item in the editor menu". When the editor stats, it reads the database and displays the checked items in a Tools menu and, if the extension is .chm, it does it in the Guides menu.

Great idea - I will do the same.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#46
Some code extracted from CSED.


' GUIDES MENU
ENUM FBSED_GUIDES_MENU_ENUM SINGULAR
   IDM_GUIDESMENUHEADER = 4200   ' // Guides menu
END ENUM

' TOOLS MENU
ENUM FBSED_TOOLS_MENU_ENUM SINGULAR
   IDM_TOOLSMENUHEADER = 4500   ' // Tools menu
END ENUM

' When building the menu, read the tools database and add menu items

   pSed.MenuGuidesCount = 1
   pSed.MenuToolsCount = 1
   strDbPath = EXE.Path$ & "FBSED_TOOLS\FBSED_TOOLS.TRM"
   IF ISFILE(strDbPath) THEN
      hToolsFile = trm_Open(BYCOPY strDbPath, %TRUE)
      IF hToolsFile > 0 THEN
         RecordStr = trm_GetFirst(hToolsFile, 1)
         WHILE LEN(RecordStr)
            AfxDoEvents pWindow.hwnd
            LSET tTools = RecordStr
            strName = TRIM$(tTools.strName)
            strPath = TRIM$(tTools.strPath)
            IF VAL(tTools.strMenu) = 1 THEN
               IF UCASE$(RIGHT$(strPath, 4)) = ".CHM" OR UCASE$(RIGHT$(strPath, 4)) = ".PDF" THEN
                  AppendMenu pSed.hMenuGuides, %MF_ENABLED, %IDM_GUIDESMENUHEADER + pSed.MenuGuidesCount, BYCOPY strName
                  pSed.MenuGuidesCount = pSed.MenuGuidesCount + 1
               ELSE
                  AppendMenu pSed.hMenuTools, %MF_ENABLED, %IDM_TOOLSMENUHEADER + pSed.MenuToolsCount, BYCOPY strName
                  pSed.MenuToolsCount = pSed.MenuToolsCount + 1
               END IF
            END IF
            RecordStr = trm_GetNext(hToolsFile)
         WEND
         trm_Close(hToolsFile)
      END IF
   END IF

   ' // Right justify some menus
   AfxRightJustifyMenuItem(hMenu, 7)
   AfxRightJustifyMenuItem(hMenu, 8)
   AfxRightJustifyMenuItem(hMenu, 9)
   ' // Bold the text of the Help menu
   AfxSetMenuItemBold(hMenu, 9)
   ' // Bold the text of Exit
   AfxSetMenuItemBold(pSed.hMenuFile, 18)

   ' // Attach the menu to the main window
   SetMenu pWindow.hwnd, hMenu

' In the main dialog callback, get the path of the tool or help file and launch it


            ' // Guides
            CASE %IDM_GUIDESMENUHEADER + 1 TO %IDM_GUIDESMENUHEADER + pSed.MenuGuidesCount
               strText = AfxGetMenuItemText(pSed.hMenuGuides, LO(WORD, wParam))
               ' // Retrieve the path of the help file
               hToolsFile = trm_Open(EXE.Path$ & "FBSED_TOOLS\FBSED_TOOLS.TRM", %TRUE)
               IF hToolsFile THEN
                  RecordStr = trm_GetEqual(hToolsFile, 1, BYCOPY strText)
                  LSET tTools = RecordStr
                  strPath = TRIM$(tTools.strPath)
                  IF LEN(strPath) THEN
                     IF UCASE$(RIGHT$(TRIM$(tTools.strPath), 4)) = ".CHM" THEN
                        HtmlHelp( 0, BYCOPY strPath, 0, 0)
                     ELSEIF UCASE$(RIGHT$(TRIM$(tTools.strPath), 4)) = ".PDF" THEN
                        ShellExecute(%NULL, "open", BYCOPY TRIM$(tTools.strPath), BYCOPY TRIM$(tTools.strParams), "", %SW_SHOWNORMAL)
                     END IF
                  END IF
                  ' // Close the file
                  trm_Close hToolsFile
               END IF
               EXIT FUNCTION

            ' // Tools
            CASE %IDM_TOOLSMENUHEADER + 1 TO %IDM_TOOLSMENUHEADER + pSed.MenuToolsCount
               strText = AfxGetMenuItemText(pSed.hMenuTools, LO(WORD, wParam))
               ' // Retrieve the path of the help file
               hToolsFile = trm_Open(EXE.Path$ & "FBSED_TOOLS\FBSED_TOOLS.TRM", %TRUE)
               IF hToolsFile THEN
                  RecordStr = trm_GetEqual(hToolsFile, 1, BYCOPY strText)
                  LSET tTools = RecordStr
                  strPath = TRIM$(tTools.strPath)
                  IF LEN(strPath) THEN
                     IF UCASE$(RIGHT$(TRIM$(tTools.strPath), 4)) <> ".CHM" THEN
                        PID = SHELL(strPath & " " & TRIM$(tTools.strParams), 1)
                     END IF
                  END IF
                  ' // Close the file
                  trm_Close hToolsFile
               END IF
               EXIT FUNCTION


Works very well to make the tools and help files directly available from the menu.

I was using the old Tsunami database manager and was thinking to change it to SQLite to work with 64 bit, but I'm no longer in the editor's business.

Paul Squires

Quote from: Jose Roca on August 06, 2017, 03:30:14 PM
Some code extracted from CSED.

Awesome, thanks for the code  :)

Quote
....but I'm no longer in the editor's business.

Luckily for me  :)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#48
A suggestion, if you find it worthwile.

An option in the Projects menu to add a manifest.

In its simplest form, it can create a resource file, e.g.

Resource.rc


//=============================================================================
// Manifest
//=============================================================================

1 24 ".\Resources\Manifest.xml"


And a manifest:

Manifest.xml


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

      <assemblyIdentity version="1.0.0.0"
         processorArchitecture="*"
         name="ApplicationName"
         type="win32"/>
      <description>Optional description of your application</description>

      <asmv3:application>
         <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
         </asmv3:windowsSettings>
      </asmv3:application>

      <!-- Compatibility section -->
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
         <application>
            <!--The ID below indicates application support for Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!--This Id value indicates the application supports Windows 8 functionality-->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!--This Id value indicates the application supports Windows 8.1 functionality-->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!--This Id value indicates the application supports Windows 10 functionality-->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
         </application>
       </compatibility>

      <!-- Trustinfo section -->
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
         <security>
            <requestedPrivileges>
               <requestedExecutionLevel
                  level="asInvoker"
                  uiAccess="false"/>
               </requestedPrivileges>
         </security>
      </trustInfo>

      <dependency>
         <dependentAssembly>
            <assemblyIdentity
               type="win32"
               name="Microsoft.Windows.Common-Controls"
               version="6.0.0.0"
               processorArchitecture="*"
               publicKeyToken="6595b64144ccf1df"
               language="*" />
         </dependentAssembly>
      </dependency>

   </assembly>


As they will become part of the project, they can be easily modified in the editor if needed.

Paul Squires

Sounds like a great idea. I'll add it.  :)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: Jose Roca on August 08, 2017, 11:32:40 PM
A suggestion, if you find it worthwile.

An option in the Projects menu to add a manifest.

In its simplest form, it can create a resource file, e.g.

Resource.rc


//=============================================================================
// Manifest
//=============================================================================

1 24 ".\Resources\Manifest.xml"


And a manifest:

Manifest.xml


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

      <assemblyIdentity version="1.0.0.0"
         processorArchitecture="*"
         name="ApplicationName"
         type="win32"/>
      <description>Optional description of your application</description>

      <asmv3:application>
         <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
         </asmv3:windowsSettings>
      </asmv3:application>

      <!-- Compatibility section -->
      <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
         <application>
            <!--The ID below indicates application support for Windows Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!--The ID below indicates application support for Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!--This Id value indicates the application supports Windows 8 functionality-->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
            <!--This Id value indicates the application supports Windows 8.1 functionality-->
            <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
            <!--This Id value indicates the application supports Windows 10 functionality-->
            <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
         </application>
       </compatibility>

      <!-- Trustinfo section -->
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
         <security>
            <requestedPrivileges>
               <requestedExecutionLevel
                  level="asInvoker"
                  uiAccess="false"/>
               </requestedPrivileges>
         </security>
      </trustInfo>

      <dependency>
         <dependentAssembly>
            <assemblyIdentity
               type="win32"
               name="Microsoft.Windows.Common-Controls"
               version="6.0.0.0"
               processorArchitecture="*"
               publicKeyToken="6595b64144ccf1df"
               language="*" />
         </dependentAssembly>
      </dependency>

   </assembly>


As they will become part of the project, they can be easily modified in the editor if needed.


I implemented this via adding a checkbox to the Project Options dialog. If checked, then when the dialog is closed it will create new resource file and/or manifest in the project folder (for safety, it will not overwrite existing files). The resource is then automatically added to the project.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

Excellent. This should ease the use of projects, having something where to start. Otherwise, we first have to create the project, then search for an .rc file and a manifest file to copy...

Paul Squires

I have pushed all of the changes to GitHub if you want to download the repository zip and preview the package before I create an actual release.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer