PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: WinFBE 1.4.1 on GitHub (August 3, 2017)  (Read 1296 times)

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #45 on: August 06, 2017, 03:08:21 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.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • Josť Roca Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #46 on: August 06, 2017, 03:30:14 PM »

Some code extracted from CSED.

Code: [Select]
' 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.
« Last Edit: August 06, 2017, 03:33:51 PM by Josť Roca »
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #47 on: August 06, 2017, 03:37:20 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  :)
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • Josť Roca Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #48 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

Code: [Select]
//=============================================================================
// Manifest
//=============================================================================

1 24 ".\Resources\Manifest.xml"

And a manifest:

Manifest.xml

Code: [Select]
<?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.
« Last Edit: August 08, 2017, 11:34:39 PM by Josť Roca »
Logged

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #49 on: August 09, 2017, 08:17:43 AM »

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

Paul Squires

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #50 on: August 12, 2017, 12:20:39 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

Code: [Select]
//=============================================================================
// Manifest
//=============================================================================

1 24 ".\Resources\Manifest.xml"

And a manifest:

Manifest.xml

Code: [Select]
<?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.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • FireFly3 Registered User
  • Master FireFly Member
  • *
  • Posts: 2785
    • Josť Roca Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #51 on: August 12, 2017, 04:30:12 PM »

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

  • Administrator
  • Master FireFly Member
  • *****
  • Posts: 8104
  • Windows 10
    • PlanetSquires Software
Re: WinFBE 1.4.1 on GitHub (August 3, 2017)
« Reply #52 on: August 12, 2017, 06:09:19 PM »

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.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor
Pages: 1 2 3 [4]