gbCodeDropper

gbCodeDropper is an easy-to-use application whose main purpose is to allow a user to quickly select source code from its built-in library and place that code onto the clipboard, into a target application (such as the PBWin IDE), or into a file to be opened by the user's default source code editor. Once the code action is completed, gbCodeDropper can be configured to take an additional action, such as closing, minimizing, or dropping to the system tray.

Download (v1.0, 49K)

While the primary role of gbCodeDropper is to "grab-and-close" with code, it also provides a variety of ways to view, edit, search and otherwise manage it's built-in source code library. In particular, a procedure source code preview pane, with syntax highlighting, is provided.

Additionally, a library of frequently used PowerBASIC procedures is included in the gbCodeDropper installation. Updates to the library will be made periodically and may be downloaded separately from online updates of the gbCodeDropper application.

Feature List

Here's a summary of the key features offered by gbCodeDropper.

These, and other gbCodeDropper features are discussed in the following sections.



User Interface

Depending on how a user chooses to work with gbCodeDropper, there are several display modes from which to operate, as shown in the following images. In general, the user double-clicks on a procedure title to take a specified action (copy, paste, open), then gbCodeLib takes an additional action (close, system tray, rollup, minimize).

Even though gbCodeDropper defaults to the simplest possible interface options, the images above shows that gbCodeDropper can be configured to display as few, or as many, features as desiried, including a toolbar and procedure preview pane.

The multiple display options are provided to enable the user to work with gbCodeDropper in the most efficient manner. For example, if the main use of gbCodeDropper is to copy code into an IDE, the simple List interface may be most useful. But if the user prefers browsing the code library by category and likes the ready-at-hand toolbar, then the TreeView with toolbar options might be enabled.

The point is that gbCodeDropper allows users to arrange the display to suit their own viewing preferences.



Overview

gbCodeDropper was written to provide a particularly fast way of accessing frequently used library code. The term procedure is used in this help file to describe the code in each gbCodeDropper source code library entry. That code can be a simple code fragment, a compilable code example, or just simple text of any kind.

gbCodeDropper's big brother, gbSnippets , is a full-fledged code librarian with a large number of editing, searching, formatting, exporting and compilation features, along with a large library of over 1200+ source code snippets. It's extremely useful, but getting in and out of the application, finding specific code, and then using that code can take more time than someone in a hurry might wish. Hence, gbCodeDropper - a faster way to get to your most important code!

gbCodeDropper GUI
The default GUI of gbCodeDropper reflects the quick and easy theme - it's just a single ListBox on a dialog. Nothing else. No menu, no toolbar, no statusbar, no other control of any kind. Open gbCodeDropper and double-click the code of choice to put the code on the clipboard and gbCodeDropper will automatically close. That's all you do. Then you're free to use the code that was placed on the clipboard in any way you choose.

As you have seen, however, the GUI content can be significantly enhanced with optional elements to fit the user's specific work environment needs.

Using a Procedure
By default, double-clicking on a procedure title will place the procedure on the clipboard. In addition, gbCodeDropper can be configured instead to save the procedure to a temporary *.bas file, and then open that file in the default *.bas editor (such as the PowerBASIC IDE).

gbCodeDropper may also be configured to paste a procedure in any open application of choice. By default, the paste action is directed to the PB/Win IDE.

Procedure Preview Pane
The title of each procedure is intended to clarify what code will be placed on the clipboard. But for closer review, the complete procedure may be viewed and edited in a Preview Pane. Syntax highlighting may optionally be applied to the procedure source code.

More information on adding/deleting/editing procedures is provided further down this page.

Multiple Selections
In both List views multiple items may be selected. The Copy to Clipboard, Paste in Target and Open in IDE actions will act on all selected procedures. The Delete action, however, will act only on the first selected item.

In TreeView mode, only one procedure may be selected at a time.



Simple List Display Mode (Procedure Title Only)

The default gbCodeDropper interface is about as simple as it gets - a floating list of the titles for the procedures found in the library. Double-clicking on a procedure in the list performs one of three actions, as set by the user: When opening a procedure in the default IDE, gbCodeDropper first creates a temp file containing nothing but the procedure, then sends that file to the default *.bas editor.

The three actions can also be called by pressing the corresponding actions on the (optional) toolbar or by selecting an action from the list context menu.



Category List Display Mode (Category and Procedure Title)

Each library procedure may be assigned a category. In Simple List mode, the category is not displayed but in the Category List display modes, the procedure categories are displayed. Column 1 shows the category and column 2 shows the procedure title.

Only one level of category is supported. Sub-categories of a category are not supported.

As with the Simple List mode, double-clicking on a procedure in the list performs one of three actions, as set by the user:

When opening a procedure in the default IDE, gbCodeDropper first creates a temp file containing nothing but the procedure, then sends that file to the default *.bas editor.

The three actions can also be called by pressing the corresponding actions on the (optional) toolbar or by selecting an action from the list context menu.



TreeView Display Mode (Category and Procedure Title)

The selected source code library can also be displayed in a TreeView mode, where the parent nodes are categories and the child nodes are procedure titles. As noted before, only one level of categories is supported.

When TreeView mode is displayed, it automatically detects all available categories and creates the parent nodes in the tree. Empty parent nodes are not allowed. The user can create a new category only by adding a new procedure with a new category.

When TreeView display mode is first displayed, category nodes (not procedure nodes) are displayed in sorted order. New procedures may be added which are out of sort order, but will be sorted when the TreeView mode is next displayed. Or, the user can sort the Tree at any time using the Sort menu option.

As with the Simple/Category List modes, double-clicking on a procedure in the list performs one of three actions, as set by the user:

When opening a procedure in the default IDE, gbCodeDropper first creates a temp file containing nothing but the procedure, then sends that file to the default *.bas editor.

The three actions can also be called by pressing the corresponding actions on the (optional) toolbar or by selecting an action from the list context menu.



Preview Pane

gbCodeDropper can be configured to display a Preview Pane for the selected item in the procedure list. The Preview Pane may be used to view and edit procedure content

By default, double-clicking on the gbCodeDropper caption toggles display of the preview pane. The Preview Pane can also be dislayed by clicking on the appropriate toolbar button or by making the appropriate setting in the Settings dialog.

The Preview Pane provides syntax highlighting to make it easier to view the code. Procedure code may also be formatted using the Indent/UnIndent menu options to provide consistent indentation of coding structures.



Editing Title And Category

The user can edit both the category and title of a procedure. A toolbar button and menu option are available which will pop up the following edit dialog:

The gbCodeDropper Edit dialog allows the user to edit both the procedure category and title in the same operation. Simply enter the category followed by ":::" and then the procedure title.

Categories are optional, but if not provided then "" is automatically assigned by gbCodeDropper.

In Simple List mode, the edited category is saved but not displayed.

In Category List mode, the edited category is saved and displayed in the same position as the procedure being edited.

In TreeView mode, if the category is changed gbCodeDropper will rebuild the display to include the new category, positioned in alphabetical order.

In any display mode, the user can, at any time, sort the library to reorder the procedures. Sorting is done by category then title.



Procedure Display Order

In both List modes (Simple and Category) the procedures are simply listed in the order in which they are found in the library. The user may sort the list via menu commands, but as new procedures are added the list is not automatically sorted.

When switching to TreeView mode, however, procedure categories are always displayed in sorted order. Procedures themselves are presented within a category in the same order as they are found in the library. This means that whereever a user places a new procedure, it remains in that same location unless the user uses the menu Sort option to rearrange the procedures.

Even though the TreeView mode displays categories in sorted order, the procedures in the library are not sorted.

In all display modes, when a new procedure is added it is always placed immediately following the currently selected procedure.



Toolbar (Optional)

gbCodeDropper does provide an optional toolbar for access to frequently used settings and actions. But by default, the toolbar is not displayed.

Here are descriptions of the functions provided by each of the toolbar buttons:

New
Creates a new procedure. The new procedure is given the same category as the currently selected procedure and is placed immediately beneath the currently selected procedure.

Delete
The currently selected procedure is deleted. Confirmation is requested. If multiple selections are made (List views only), only the first selection will be deleted.

Once selections are made, the filechanges flag is set and the user will be asked to save the changes when gbCodeDropper is closed.

Title
Edits the category and title of the selected procedure. See the section above for additional information on editing the title and category of a procedure.

Copy
Immediately copies the entire selected procedure(s) to the clipboard.

Target
Immediately pastes the entire procedure to the edit window of the target application (PB/Win by default).

IDE
Immediately saves the procedure to a temporary file and then opens that file in the default *.bas editor.

Search
Opens the Search dialog.

Preview
Toggles the display of the preview pane. By default, you can also toggle display of the preview pane by double-clicking on the gbCodeDropper caption.

Display
Toggles between the three displays modes: Simple List, Category List, and Treeview.

UserLib
gbCodeLib supports two separate source code libraries, the default library and a user library. The default library is distributed with gbCodeDropper. Updates are available online.

Using the User Library is not required, but does provide the user flexibility in building/using an additional library for whatever purpose they choose. One use would be to contain the user's personal procedures, while leaving the default library intact. That would allow the user to download online updates to the default library without having to worry about overwriting procedures of their own which they might have added to the default library.

Font
Opens the font selection dialog.

Settings
Opens the settings dialog.

Help
Opens this online Help page.



Context Menu (Procedure List)

Right-clicking on the procedure list will display the following context menu: The following context menu options are provided:

Copy
Immediately copies the entire procedure to the clipboard. This does not change the setting for an action to take when a procedure title is double-clicked.

Paste in Target
Immediately pastes the entire procedure to the edit window of the target application (PB/Win by default). This does not change the setting for an action to take when a procedure title is double-clicked. The menu always reflects the chosen application caption.

Open in IDE
This menu option tells gbCodeDropper to immediately place the procedure in a temporary file and then open that file in the default *.bas editor. This does not change the setting for an action to take when a procedure title is double-clicked.

Search
Opens the Search dialog.

When a search finds procedures containing the search string, the procedure list is replaced with the list of matching procedures. Display of search results puts gbCodeDropper in a read-only mode, where menu editing options are disabled.

A Search always includes the full library of procedures. Additional searches do not search within the results of a previous search.

Procedures
Opens a sub-menu with the following actions which may be taken with respect to procedures:

After making changes to a procedure, the user may save those changes. If there are any unsaved changes when a user attempts to leave gbCodeDropper, the user will be prompted to save those changes (unless the AutoSave feature is enabled, in which case changes will be automatically saved without confirmation by the user.

Library
Opens a sub-menu with the following actions which may be taken on the procedure library:

Preview Pane
Toggles the display of the preview pane. By default, you can also toggle display of the preview pane by double-clicking on the gbCodeDropper caption.

User Library
Toggles the display between the user and default libraries.

Toolbar
Toggles display of the tooblar.

Cycl Display Modes
Cycles through the Simple List, Category List, and TreeView modes.

Expand All Nodesr
In TreeView mode, expands all parent nodes.

Settings
Presents a dialog for changing other gbCodeDropper settings. See the Settings section below for more details.

Online Updates
This menu option provides to submenus - one to check for a new version of the gbCodeDropper EXE and one to check for a new version of the default library. If new versions are available, gbCodeDropper can download the updated files. If a EXE is downloaded, gbCodeDropper must restart.

Online Help
Opens this web page in the user's default browser.



Context Menu (Preview Pane)

Right-clicking on the Preview Pane will display the following context menu: The following context menu options are provided:

Cut
Removes the selected text and places the text on the clipboard

Copy
Copies selected text to the clipboard

Copy All
Copies all text from the Preview Pane to the clipboard (does not selected the text)

Paste
Pastes text into the Preview Pane as the caret. This does not change the procedure library text.

Delete
Deletes the selected text from the Preview Pane, but does not delete the text from the procedure library.

Print
Prints the currently selected procedure(s), including the title(s)

Save As (To File)
Saves the content of the Preview Pane to a file designated by the user.

Indent Code
Applies smart indentation to the code in the Preview Pane

UnIndent Code
Restores the procedure code to the pre-indented content.



Settings

Most settings are accessed through the Settings Dialog, shown here:

Procedure Action
This determines what action is taken when the user double-clicks on an item in the procedure list:

The default target application is the PB/Win IDE. The default target application may be changed using the Ctrl-T accelerator key combination. A target is identified by the application's caption.

App Action
Once a procedure action has been taken, the application itself can respond with any of five different actions: item in the procedure list:

Enable Hotkey (Ctrl-D)
A system level HotKey (Ctrl-D) may be assigned to gbCodeDropper. When gbCodeDropper is in the system tray or minimized on the Windows Taskbar, the Hotkey restores gbCodeDropper to its previous position.

Preview via Caption
When this option is selected, double-clicking on the gbCodeDropper caption will toggle display of the preview pane. Otherwise, double-clicking on the caption will rollup the gbCodeDropper window (set client area to zero height).

Double-clicking on the caption never results in maximizing the gbCodeDropper screen.

System Tray
Select this option to have gbCodeDropper operate out of the system tray. When gbCodeDropper is in the system tray, just double-click on its icon to restore it for use.

Right-mouse clicking on the gbCodeDropper icon will popup a context menu, with a menu selection for exiting gbCodeDropper.

Font
The font dialog used by gbCodeDropper is a modified version of the default Font Dialog provided by the PowerBASIC Display Font statements.

The customized font dialog is smaller and removes some items normally found on the default font dialog.

Syntax Highlighting
When text is displayed in the preview pane, syntax highlighting may optionally be applied to the text.

In the Files subfolder, where gbCodeDropper is installed, is a text file called powerbasic.syn. It is used to store the keywords that are highlighted (colored blue) when syntax highlighting is turned on. The words in the list are capitalized according to the Mixed case option (see below).

Code Case
Syntax highlighting capitalizes key words in one of three ways:

Colors
Syntax highlighting colors sections of code as one of three colors:

These colors are shown as the three label colors. Click on a colored label to change the corresponding syntax highlighting color.

Formatting
When the menu "Indent" action is take, three values are used to determine formatting of the indented code:

Saving Settings Changes
Press the OK button (or use X to exit the settings dialog) to save any setting changes. Press the Cancel button to ignore any setting changes.



Ascii Table

Here's an image of the popup Ascii table that appears when the "Ascii Table" option is chosen from the Procedure List context menu. The table is provided simply for convenience, as Ascii values are often used in writing source code.



Popup Summary

At this time, the popup summary contains only two items - gbCodeDropper version number and the library procedure count. The content of this popup is likely to grow in future revisions.



Edit in IDE

When configured to do so, gbCodeDropper will open a procedure in the default *.bas editor, such as the PowerBASIC IDE shown in this image. The procedure is first saved to a temporary file and that file is opened in the default *.bas editor.



Procedure File Format

The gbCodeDropper procedure library uses an extremely simple, text format. Any line beginning with :::start is considered the start of a new library procedure, as well as the end of any preceding procedure. if one exists.

The line after :::start contains the procedure title and is the text shown in the procedure list

    :::start
    .IDE Template
    'Compilable Example:
    #Compile Exe
    #Dim All
    #Include "Win32API.inc"

All lines following the procedure title, until the next :::start or end of file is reach, are part of the library procedure. There is no limit to the number of lines a procedure may have.



Accelerator Keys

These accelerator keys are supported:



Support Files

The following files are found in the Files subfolder where gbCodeDropper is installed.

procedures.bas
This file contains the procedures displayed by gbCodeDropper

powerbasic.syn
This file contains the keywords highlighted when syntax highlighting is enabled. Words in this file should we capitalized as Mixed case.

gbsynaxhighlight.inc
This include file is compiled within the gbCodeDropper application. It provides the syntax highlighting feature.

gbcodeindent.inc
This include file is compiled within the gbCodeDropper application. It provides the code indentation feature.



Temporary File/Folders

gbCodeDropper requires a subfolder "tempfiles". If that folder does not exist, gbCodeDropper will create it. If created by gbCodeDropper, the following two temporary files are placed in the tempfiles folder:

gbcodedropper_temp.bas
This files contains the procedure chosen to be opened in the default *.bas editor. The file is overwritten each time a new procedure is selected - double-clicked - and when gbCodeDropper is not configured to place the selected procedure on the clipboard.

ptitles.txt
List of procedure titles. Created on demand and opened in Notepad.



Procedure Library

You can download the procedure file (procedures.bas) separately from updating the gbCodeDropper EXE. Download the file here. the

Here are the titles of the procedures currently in the gbCodeDropper procedure library. The latest version is v1.0.



Comments

Comments and suggestions are welcome!