gbForumCode

gbForumCode is a freeware tool for posting syntax highlighted source code into the PowerBASIC forums. It's built-in syntax highlighting source code editor and compilation options ensure that what you see is what you get when the encoded source code is transferred to the PowerBASIC forums and that users can compile your code!

Simplicity, ease of use, and support of key features were the design goal for gbForumCode - minimizing the interface and the actions required to use the application, but with enough capability to give users the features they need.

To install, simply unzip the installation file (gbForumCode.zip) in a folder of your choice. In addition to the EXE, the installation provides gbForumCode source code, resource file, and image files.

By default the gbForumCode main screen looks like this, with all options visible on the toolbar.
     

gbForumCode also offers a "mini-mode", for a reduced footprint as shown in this next image.

Key Features
gbForumCode provides a wide range of features, all focused on making it easier to place syntax highlighted code into the PowerBASIC forums. The included syntax highlighting editor in gbForumCode ensures that what you see is what you post. The compilation feature ensures that what you post can be compiled by forum users.
  • Built-in source code editor with syntax highlighting
  • Compile/run code from within editor
  • Converts source code into vBulletin code (sends clipboard or open in Notepad)
  • Open code in default *.bas editor
  • Find & Replace dialog
  • Open existing *.bas and *.inc source code files
  • Drag & Drop (recognizes *.lnk files)
  • Does not write over existing *.bas/*.inc files

Other available features/options include:

  • Color of code elements can be set
  • Upper/Lower/Mixed code display
  • Highlight user procedure names
  • Font name/size/attributes may be set
  • Display font can be restricted to fixed-width fonts
  • Reduced footprint GUI option
  • Autoload source code from clipboard
  • Restrict vBulletin code to forum default
  • Turn off syntax highlighting
  • Set As TopMost
  • Code editor content summary
  • Display Ascii Table
  • Capture image of dialog to clipboard

OverView

Using gbForumCode couldn't be simpler:
  1. Paste your code into the editor
  2. Press the "CopyV" toolbar icon to place the vBulletin code onto the clipboard
  3. Paste the clipboard content into a thread edit box on the PowerBASIC forum.
That's it!

gbForumCode saves it's last used size/location, and will restore it when the application is restarted.

Existing source files (*.bas and *.inc) files can be opened, but to ensure protection of user source code no Save option is provided.

However, any code in the editor is saved (to a temporary file) when gbForumCode closes, and restored when it is restarted. You can optionally have gbForumCode load (at startup) whatever is on the clipboard.

Code may be compiled (using the PowerBASIC compiler) from directly within gbForumCode. This will ensure that your posts contain valid code. You can also open the code within your default *.bas editor, or run the EXE that results from compilation.

Two text data files are used to stored a list of recognized PowerBASIC keywords and Windows API functions - gbforumcode_key.txt and gbforumcode_api.txt. Users may edit these files as desired. You can optionally highlight the procedures (Sub, Function, ...) found within the code.

There are no "Are you sure?" prompts. If you press the clear or other toolbar buttons which modify the editor content or color/font settings, action is taken without the user being prompted for approval.

Toolbar

gbForumCode's features are primarily accessed via the toolbar (no menu), although the built-in source code editor also has a short context menu as well.

   

In mini-mode, the toolbar is reduced to this:

Here are the toolbar options:

Dialog Context Menu

Right-mouse click on the dialog (outside the editor) to see the following dialog context menu:

When TopMost on Startup is enabled, gbForumCode will be set as TopMost when it starts, regardless of whether Set As TopMost is enabled. The Set As TopMost option is used to turn the topmost setting on/off at any time during a session.

Editor Context Menu

Right-mouse click on the editor to see the following editor context menu:

Compile Source Code

gbForumCode provides several features to help you test the source code before posting it onto the forums. The toolbar Compile button will compile the source code by saving the editor content to a temporary file and sending that file to the PowerBASIC compiler.

Other features are available by pressing the down arrow on the toolbar Test button:

The default compiler and include paths are:
    c:\pbwin90\bin\pbwin.exe
    c:\pbwin90\api

Font Handling

gbForumCode will correctly handle encoding the font name, as well as bold/italic font attributes. However vBulletin does not use the typical font point system for code size. Instead, it uses a system similar to how HTML is coded.

So, for point sizes of 10 or less, gbForumCode uses size=0 encoding (normal size). For points sizes of 11-14, gbForumCode uses size=1 encoding. All larger point sizes are encoded as size=2.

Optionally, gbForumCode can be set to provide no font information, allowing the post to take on the default font values of the forums.

Other Comments

gbForumCode saves all of it's options in an INI file, which is placed in the same folder as the EXE.

Comments and suggestions are welcome!