|
3-28-03
Cropping Graphics with REALbasic (Part 4) by
Erick Tejkowsi
Today we'll look at last part of this tutorial (Part 4).
These tutorials cover the basics of how to implement click-and-drag graphics selection and cropping, like you'll find
in many popular applications (e.g.Photoshop, iPhoto, and the Finder). This week we'll add a lasso selection and offer
live feedback.
The tutorial emulates a Cocoa project available from Apple.
Go check out the original code and come back here
ready for some REALbasic coding. NOTE: This demo is made with OS X in mind.
Augment the Interface
Launch REALbasic and open a copy of the last project.
To the Window1 interface, add a checkbox labeled . Then, add another entry to PopupMenu2 property: Lasso.
The result will look something like this (when tested with Debug-Run):
If you're following along from the last tutorial, you may have to resize the window a bit to accommodate the new checkbox.
Now, let's move on to the code.
Add the Code
Double-click the Window Editor of Window1 to open the Code Editor. Choose Edit-New Property to add a property to the window:
polyPoints(0) as integer. This array will store a list of points that will make up the outline of the lasso selection.
Next, change the code in the MouseDrag event of Canvas1 to read:
Then, navigate to the MouseUp event of Canvas1. Remove the code that you have there in favor
of the new code. The code in the MouseDrag and MouseUp events closely matches
earlier code with the addition of the lasso selection.
Finally, create a new method named AutoDraw by choosing Edit-New Method. Navigate to this new AutoDraw method
and add the following code. This method takes care of continuously updating the display when the new checkbox is selected.
Select Debug-Run to test your work. Click and drag in the image on the left side of the window to view a cropped version
on the right side. Select the new Lasso selection feature to see it in action.
Conclusion
You can
download the completed project for this week here.
That's it for this multi-part tutorial. Hopefully you learned a trick or two along the way.
Next time we'll move on to a new topic. See you then!
3-19-03
REALbasic News
by Erick Tejkowsi
zegsRuler 2.0
fracturedSoftware has posted zegsRuler 2.0, a set of REALbasic classes that
make it easy to add graphic type rulers and scales to REALbasic
projects. zegsRuler supports scaling (zooming), scrolling and changing
of the origin as well as lots of control over line length and width,
color, background, text etc. In addition, all rulers can be either
plain or 3D. Mouse tracking is also supported.
Release 2.0 of zegsRuler brings about a few changes in the way
zegsRuler works. In particular, rulers are now classes that can be
easily drawn into any graphics port. zegsRuler 2.0 also now includes a
set of rulerStyle classes that encapsulate various ruler types. The
provided rulerStyles include inch (10,12,16 divisions) and cm (10) that
scale from 3% to 3200% and can be easily extended or modified if
required. Other rulerStyle subclasses show how zegsRuler can be easily
set up to create several different types of scales, slider control
markers, map grids etc.
This release also includes a number of new examples such as how
zegsRuler can be used to show the current selection in a graphic type
project, double buffering the ruler into a canvas and there is even a
fully functional example where the ruler is shown and hidden with a
nice sliding action when the user presses a button.
Pulp 1.1
The La Jolla Underground has released Pulp version 1.1.
Pulp is a profiling tool for use with the REALbasic development environment.
It can add timing code to every method and event in your REALbasic project,
which can then be saved as either a tab delimited file or as a Metrowerks Profiler document,
which allows viewing of the results using the MW Profiler application.
Complete stack information is preserved for every call, so you can view performance of functions
that are called from a particular parent. You can also monitor the number of times a function was called,
how long you spent in only that function (total and average), how long you spent in that function
with it's sub-calls (total and average) and the minimum and maximum times spent in the call.
Since timing code is inserted everywhere, you can easily search for bottlenecks in even the largest projects
with almost no effort. Adding and removing profiling code is as easy as saving your project as xml and dropping
it on the Pulp application. Timing code will be added or removed as appropriate.
This version adds the following features/fixes:
- AppleScript commands to add and remove code to/from the currently open project in the Rb IDE
- Fixed a bug that caused Pulp to fail removal or addition of code to the current project
Valentina
Valentina is a popular (and highly regarded) database system. It works with a variety of environments, including REALbasic.
valentina has been updated to version 1.9.8b2.
Logical Vue
LogicalVue Software Inc. has
announced the release of SQLVue 1.0.0 for Macintosh OS X, Classic Mac OS and Windows.
SQLVue is an interactive SQL editor that makes it easy to view and develop REALbasic databases.
Available in two Editions, the free Starter Edition and the $30 (USD) Professional Edition.
Features
- Displays data in any table in a sortable grid
- Exports table data as HTML for display in web pages
- Displays Data Dictionary of all tables and columns in the database
- Processes any compatible SQL command
- Connects to multiple databases at once
- Fast!
SQLVue is available now from the LogicalVue Software web site
at http://www.logicalvue.com/Products/SQLVue.htm.
System Compatibility: Mac OS X 10.1 or higher; Mac OS 8-9; Windows NT, 2000, XP
Toolbar Buttons
Will Cosgrove has posted a new version of his popular Toolbar Buttons Pro classes.
These classes simulate the
Mac OS X toolbar found in numerous Cocoa applications and are simple to implement. Unlike REALbasic 5.0's toolbar,
these classes support Mac OS X, Mac OS 8.5 or higher and Windows.
They support icon and text, icon and text only views and are completely theme savvy running under any OS.
This update primarily fixes problems with running them under REALbasic 5.0.
NOTE: Previous users will have to update the property name of index to itemIndex and update their canvas'
to use the new ES naming scheme. Other changes include:
- Added support for REALbasic 5.0.
- Renamed every class to start with ES for Everyday Software to avoid naming collision with
RB toolbar classes (even though mine were here first).
- Changed the index property to itemIndex.
- Changed the GetSWidth event to GetSubWidth.
Screenshots, more information and a demo application can be found here.
CodeSpacer
Domain Softworx announced the release of the 0.3 update to CodeSpacer, a utility that makes REALbasic code look nicer.
Version 0.3 is built as an IDE Extra. Place it in the IDE Extras folder of your REALbasic folder.
It has been tested with versions 4.5.2 and 5.0, both on Mac OS X.
This version also has a couple of bug fixes.
3-19-03
REALbasic News
by Erick Tejkowsi
DoubleSlider plugin 1.1
Alfred Van Hoek has announced the availability of DoubleSlider plugin 1.1,
a REALbasic-5.0 OSX-composite plugin.
DoubleSlider is a slider with two thumbs and can be used with REALbasic 5.0
and higher on a composite window. You can switch a thumb up or down, and
left or right, depending on the orientation of the double slider. It is a
control/class that only can live in a composite window on OSX. In future
versions of REALbasic 5, it may be possible to instantiate this control as a
class. For this a couple of constructors are implemented.
AutoCompleteField
Tom McGrath has posted AutoCompleteField, which is a class which adds auto-complete functionality to single-line editfields.
It also sports a Lookup menu option and a simple, more user friendly "guess panel" rather than the little menu.
The developer only needs to maintain a string array as the auto-complete list, and the class does everything else on it's own.
Traveler
Traveler is a MWRB news/information fetching program by Eric Richards.
The only catch is that web sites have to support it. Which
is very easy. Just a plain text file. Posted on the site where
it has public access. That's it.
If your just wanting to the news/information and go,
are in a hurry or have slow internet connection you might
like Traveler.
Pulp v1.0
The La Jolla Underground announced the immediate availability of Pulp version 1.0.
Pulp is a profiling tool for use with the REALbasic development environment. It can add timing code to every method and event in your REALbasic project, which can then be saved as either a tab delimited file or as a Metrowerks Profiler document, which allows viewing of the results using the MW Profiler application. Complete stack information is preserved for every call, so you can view performance of functions that are called from a particular parent. You can also monitor the number of times a function was called, how long you spent in only that function (total and average), how long you spent in that function with it's sub-calls (total and average) and the minimum and maximum times spent in the call. Since timing code is inserted everywhere, you can easily search for bottlenecks in even the largest projects with almost no effort. Adding and removing profiling code is as easy as saving your project as xml and dropping it on the Pulp application. Timing code will be added or removed as appropriate.
This version adds the following features/fixes:
- Easily add or remove profiling code to/from the current project in the IDE
- Incorporate external code items into the main project so profiling code can be added to them
- Identify which control an event belongs to in the profiling output
- Now correctly profiles menu handlers
xExpandingCanvas and xInternationalSettings
Alan Gall announced the release of two new REALbasic class packages: xExpandingCanvas and xInternationalSettings.
xExpanding canvas lets you create windows with expanding areas (like the Mac OS X Finder's Get Info window) for any target platform.
The xInternationalSettings package enables your applications to easily access the international date, time, number and location settings currently in use. 26 different settings are available.
SlidePuzzle
NPC Unlimited is pleased to announce the release of Slide Puzzle 1.0.
"15 square" puzzle with pictures.
This is NOT your father's "15 square" puzzle! With ease of use, speed, and flexible configuration, the only hard part is SOLVING it.
Progressive challenge keeps it fresh time after time.
ScreenRecord 1.3, MediaEdit 1.5, and Paintfx 1.2
Lo Saeteurn has released updates to three of his REALbasic apps:
- MediaEdit 1.5, a cheap full featured movie editor.
- ScreenRecord 1.3, a fluid and powerful screen recording tool that captures the screen as a movie.
- Paintfx 1.2, an inexpensive image editing program with many filters and tools.
3-12-03
REALbasic News
by Erick Tejkowsi
Lyrictracker REALbasic SDK
Lyrictracker REALbasic SDK is a set of classes from Bastian Bense that
allows a developer to use the Lyrictracker database to find song texts or
their meta information. Its classes are heavily based on Navdeep Bains'
BasicHTTP socket and the XML Toolkit.
You can download the SDK here
and visit the Lyrictracker website here.
ResForkStream 1.0
Thomas Reed has finished a module that contains routines for copying the resource fork of a file
into the data fork of another, and vice versa, under Carbon using only pure RB code and
Carbon declares. If you're interested,
you can find it at his REALbasic site.
It should properly handle long file names, special characters in file names, etc.
Note that the code requires RB 5.0, though it could be converted to RB 4.5
(mainly by converting some of the text encoding calls to routines that exist in RB 4.5).
RB Plugin Plunger
RB Plugin Plunger (everyone's favorite REALbasic tool) has been upgraded to 3.0a20.
This version has a nifty new feature: the visualization of the class
hierarchy in plugins and REALbasic.
RB Plugin Plunger retrieves information from the classes, controls, methods,
events and eventInstances from a plugin, while additional information from
the resource fork of the plugin is being retrieved as well. RB Plugin
Plunger is also useful for plugin developers. They can add help files
directly into the plugin resources. In addition a nifty HTML generator
allows the production of hundreds of HTML files you can use to publish help
on the web. In addition, one can generate a single document HTML help for
easy reading and printing. The binaries were compiled with RB 4.5.2.
Binaries are available in
Classic
and Carbon.
iListBox
iListBox is a subclass of the standard ListBox control provided by REALbasic.
Its main purpose is to provide a quick-to-use and Aqua compliant listbox with the
appearance of the NSTableView as used in all Apple iApps (hence the name of this class).
The latest version fixes a bug with multiple selections.
Doing Things as Root
Frederik Seiffert put together a small example on
how to use the Mac OS X Authorization Services
with REALbasic. With this info you can do privileged operations that require root access.
While you're at it, you should also stop by and read the Authorization Services introduction
and reference from Apple before programming any real-world applications
using this technique.
FAQtor 1.2
Fabian Rueger announced that FAQtor 1.2 is now available for download.
FAQtor is a program to create, maintain and edit FAQ documents;
it stores the FAQ in its native format, and exports the FAQ data to XML,
HTML (with or without externally referred style sheet) and plain text.
FAQtor is entirely made with RB, and available in Carbon
and Classic binaries.
|