From: Bruce Momjian Copyright (c) 1994-7 Regents of the University of California
+
+ Permission to use, copy, modify, and distribute this software and
+its
+ IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
+PARTY FOR
+ THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ That's why PgAccess 0.98 has been internally restructured, every main
+module of PgAccess has became a namespace (see Tcl namespaces) in order
+to hide the variables and internal procedures to the user. Also, all the
+global variables that have been used before were grouped under a single
+big associative array called PgAcVar (PgAccess variables) so they
+should not interfere with user defined global variables.
+ Global variables available
+ Window naming convention
+ Every toplevel window defined by PgAccess has the following naming convention.
+Every window name starts with .pgaw (PgAccess window) followed
+by a colon and a name. Example:
+ For every tab from the main database window there is a namespace defined
+(Tables, Queries, Views, Functions, Sequences, Reports, Forms, Scripts,
+Users, Schema). Every namespace has by default the following procedures:
+ There is also a special namespace called Database. Here are some
+procedures and functions defined for this namespace available to the user:
+ Global functions available
+ Other links
+ Copyright (c) 1994-7 Regents of the University of California
+
+ Permission to use, copy, modify, and distribute this software and
+its
+ IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
+PARTY FOR
+ THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ Still need to be written. Some information can be found in the help
+included in the main program.
+ Jim Lemon <Jim.Lemon@uts.EDU.AU> has started writing a tutorial.
+Thought it is based on earlier versions than 0.98 it is a beginning after
+all, isn't it ?
+
+
diff --git a/src/bin/pgaccess/doc/html/download.html b/src/bin/pgaccess/doc/html/download.html
new file mode 100644
index 00000000000..efbe7bf50aa
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/download.html
@@ -0,0 +1,42 @@
+
+
+ Another one (just with a little bit faster, try this one first) would
+be :
+ PgAccess API for developing small applications
+ This version (0.97) of PgAccess has changed the form API : variable
+handling, query results interface and control bindings naming convention.
+Please read it carefully, download the database demo and practice a while
+before trying to design your own forms.
+ For the moment, it has only some basic widgets : labels, entries, buttons
+, listboxes , checkboxes and radiobuttons.
+ Also there is a pseudo data control widget that allows you yo have access
+to a query results.
+ How do you generate widgets :
+ Renaming, resizing items are possible (for the moment) only by modifying
+appropriate parameters in attribute window. You must press Enter
+in the edit field after changing a value in order to be accepted.
+ You can also move items by dragging them or delete them by pressing
+Del key after selecting them.
+ In attribute window, there are some fields named Command
+and
+Variable.
+ The field Command have meaning
+only for Button widgets and holds the command that will be invoked when
+the button is pressed.
+ The field Variable have
+meaning only for EditField , Label widgets , checkboxes and radiobuttons
+and it is the name of the global variable that will hold the value for
+that widget. For checkboxes the values are t and f (from
+true and false) in order to simplify binding to logical data fields (PgAccess
+0.82 used 0 and 1).
+ For radiobuttons, it is usual to assign the same
+variable to the same radiobuttons within the same group. That variable
+will contain the name of the widget of the radiobutton that has been pressed.
+Let's presume that you have entered 3 radiobuttons named red, green and
+blue, all of them having the same variable named color. If you will press
+them, they will assign their names to global variable.
+ In order to make a simple test, put an entry field
+and set it's variable to v1 and a button who's command is "set v1
+whisky". Press the button "Test form" and click on the button. In that
+entry should appear whisky.
+ Also, any widget created inside this window (form) will have the name
+prefixed by .mf ,so we will have .mf.button1
+or .mf.listbox1 .
+ We can name the data control widget dc for example.
+The fully qualified name for that "virtual widget" will be .mf.dc
+then. A new namespace called DataControl(.mf.dc) will be
+automatically defined.
+ open - opens the connection and execute the query (returns
+nothing)
+ These procedures and functions should be called in the normal Tcl namespace
+mode as in the following example:
+ DataControl(.mf.dc)::setSQL "select * from phonebook"
+ If you complaint about writting to many DataControl(...) you can include
+many commands into a single namespace eval as in the following example
+:
+ namespace eval DataControl(.mf.dc) {
+ It's no need to close a query-result set if you want to assign it a
+new SQL command and open it again. That will be done automatically releasing
+the memory used for the last result set.
+ Example:
+ If you want to bound some controls to the fields of the recordset, you
+will have to name their associate variable like that :
+ DataSet(.mf.dc,salary) to get the "salary" field , or
+DataSet(.mf.dc,name) to get the "name" field. Using the
+data control procedures DataControl(.mf.dc)::moveNext or
+movePrevious will automatically update the DataSet(.mf.dc,...)
+array so the database information from entries in the form will be refreshed.
+ Here it is a dumped sample database
+that contains a demo database. What should you do ?
+ You should find a single table called "phonebook" a form called "Phone
+book" and another "A simple demo form".
+ First of all enter and view the phonebook table in table view. Note
+the fields and their values.
+ In order to add a new record, press the "New" button in order to get
+new, clean entries. Fill them with your data and press "Add new" button.
+A new phonebook record will be added. Also, if you want to update a record,
+change it's values in the displayed fields after finding it and press "Update"
+button. The values will be updated in the database BUT NOT IN THE CURRENT
+QUERY RESULT . If you want to see them modified, make a new query trying
+to find it again.
+ Before using the results from a query you should
+know that the information that has been retrieved could be found only in
+your computer client memory. It has no live connection to the data
+from the database. That's why it isn't possible to develop a simple update
+function as interface to that query-result widget. More than that : a query
+result could be obtained from a SQL command that return a non-updatable
+data set !!! For example fields gathered from multiple tables or summary
+fields. It isn't just simple to make an automatic update procedure. The
+programmer must know how to make the update or the append procedure, sometimes
+using key fields to point to the desired record or an OID. There are examples
+in the demo database in "Phone book" form. It may be possible that in the
+future, I will develop another pseudo-widget describing a table. It would
+be more simple than to implement an update or append or even a delete procedure.
+ There is in the demo database also another simple form called "A simple
+demo form". It will show you how to handle variables from checkboxes, radiobuttons,
+how to use listboxes, open another forms and so on. I think they will help
+you.
+ In order to avoid naming user defined forms with a particular
+name of another PgAccess form, I would recommend naming them as udf0, udf1
+(user defined form 0 , 1 )
+
+ Please feel free to send me your opinion at teo@flex.ro on forms
+designing and usage.
+ KEEP IN MIND !
+THE FORM API MAY CHANGE IN ORDER TO BE MORE SIMPLE AND BETTER!
+ This HOWO-TO make PgAccess working under Irix
+is written by Stuart Rison These are the steps that I had to follow to get pgaccess to run on an
+INDIGO2 running postgreSQL 6.3.2 under IRIX 5.3. I make no guarantee whatsoever
+that the same step will work for others but at least it should point you
+in the right direction. Also, I am a biologist by training so I only got
+pgaccess working by fudging (that is, trial and error) this means that
+some of the steps may be unnecessary (e.g. compiling $postgreSQL_source/src/interfaces/libpgtcl
+as both a shared and static library) and they certainly haven't been optimised
+(I know nothing about compiler switches etc.). 1) Requirements: You will need: 2) Installation: a) tcl/tk: You must first install tcl and then tk (in that order). I just used
+./configure, no switches and gmake. Their installation should be trouble
+free. Then you must move headers and libraries to the right places so: Header files: both tcl and tk have a header file (tcl.h and tk.h). The
+tcl.h file is in $tcl_source_dir/generic and the tk.h file is in $tk_source_dir/generic;
+both should be copied to /usr/local/include. Libraries: compilation (with cc) of tcl and tk yield libraries libtcl8.0.a
+and libtk8.0.a in $source_dir/unix. Both should be copied to /usr/local/lib. b) postgreSQL: Make sure you have a fully patched postgreSQL source. If your ./configure
+says it can't load 'IRIX' settings then you most probably will need to
+patch ./configure. Configure using ./configure with the following switches: ./configure
+--with-includes=/usr/local/include --with-libraries=/usr/local/lib --with-tcl [this and previous line as
+one] Then make, make install as usual c) Compiling libpgtcl: The source for libpgtcl is in $postgreSQL_directory/src/interfaces/libpgsql. I do this twice. Once with just gmake. This produces a static library
+libpgtcl.a which I leave where it is (I don't know what to do with it but
+it may just come in handy). The I modify Makefile manually with a text
+editor. Essentially I modify two line: before: # Shared library stuff install-shlib-dep := shlib := after: # Shared library stuff install-shlib-dep := install-shlib shlib := libpgtcl.so.1 Then gmake -f Makefile_modified. This creates two shared (.so) libraries:
+libpgtcl.so and libpgtcl.so.1. I can't tell the difference between them
+so I copied them both to /usr/lib/. d) running pgaccess: Uncompress pgaccess (usually with gunzip and tar). So long as 'wish'
+(a binary produced when compiling tk8.0) is somewhere in your path, you
+should be able to run pgaccess with: wish -f $pgaccess_dir/pgaccess.tcl [postgreSQL_database_name] e) et voila! 3) Concluding remarks: As I stated at the start of this document, following the procedure indicated
+above worked for me. I am sure, however, that a few of the steps are unnecessary/non-optimised/stupid
+etc. If any Unix (IRIX) boffin is reading this and you spot anything you
+would like to comment/correct etc. please e-mail me (stuart@ludwig.ucl.ac.uk).
+Also, if you just have questions and think I might help, please contact
+me at the same e-mail. Finally, I can accept no responsibility if these steps don't work for
+you or if it all goes horribly wrong and you 'damage' your computer trying
+them. Let common sense prevail! Good luck Stuart Rison LICR University College London London W1P 8BT The mailing list for PgAccess is : pgsql-interfaces@postgresql.org If you have some questions regarding PgAccess you should mail to this
+address. I will also answer to messages addresed directly to me but it
+would be better to post your messages here because it might be possible
+to get an answer quickly from another user of PgAccess.
+ To subscribe please send a mail message to : pgsql-interfaces-request@postgresql.org
+ having a single line in the body message : subscribe In a couple of minutes , if everything is ok, you must receive something
+like that :
+
+
+
+
documentation for any purpose, without fee, and without a written
+agreement
+
is hereby granted, provided that the above copyright notice and
+this
+
paragraph and the following two paragraphs appear in all copies.
+
+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+INCLUDING
+
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
+OF THE
+
POSSIBILITY OF SUCH DAMAGE.
+
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER
+IS
+
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
+TO
+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
diff --git a/src/bin/pgaccess/doc/html/a_right.gif b/src/bin/pgaccess/doc/html/a_right.gif
new file mode 100644
index 00000000000..386e27c304f
Binary files /dev/null and b/src/bin/pgaccess/doc/html/a_right.gif differ
diff --git a/src/bin/pgaccess/doc/html/addindex.gif b/src/bin/pgaccess/doc/html/addindex.gif
new file mode 100644
index 00000000000..2ff0aa2084e
Binary files /dev/null and b/src/bin/pgaccess/doc/html/addindex.gif differ
diff --git a/src/bin/pgaccess/doc/html/api.html b/src/bin/pgaccess/doc/html/api.html
new file mode 100644
index 00000000000..7630fd2054d
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/api.html
@@ -0,0 +1,232 @@
+
+
+
+PgAccess developer API
+
+
+
Starting with PgAccess 0.98 I am planning to make available a complete
+API for the PgAccess developers. I plan to make PgAccess not just an administrative
+tool, but also a tool for easy build of small applications.
+
+
+
+
+
+
+
+PgAcVar
+
+The main global associative array that hold together various information
+needed by PgAccess. User should NOT
+alter it under any circumstances.
+
+
+
+CurrentDB
+
+The handler of the current opened database. Can be used for database
+operations as selects or command execution.
+
+
+
+Messages
+
+The associative array that holds the translation for the current
+language. Loaded from the appropriate language file from lib/languages
+directory
+
+
+PGACCESS_HOME
+
+Keep the system directory of PgAccess root installation
+
+.pgaw:User , .pgaw:About , .pgaw:ImportExport
+Namespaces available
+
+
+You can use these procedures if you want to produce the same efects as
+clicking on the desired tab and then on the "New", "Open" or "Design" buttons
+from the main database window.
+
Example:
+Tables::open "customers"
+
+The Tables::open procedure accepts two optional parameters, filter
+and order.
+
Queries::open "Invoices received"
+
Forms::open "Add new invoice"
Example:
+Tables::open "phonebook" "name ~* 'joe'" "age desc"
+will open a table view window with predefined filter "name ~* 'joe'" and
+ordered by descending age.
+
+
+
+
+
+
+
+Name
+
+Parameters
+
+Type
+
+Returns
+
+Description
+
+
+
+vacuum
+
+none
+
+procedure
+
+nothing
+
+vacuums the current database
+
+
+
+getTablesList
+
+none
+
+function
+
+list
+
+returns the list of tables from the current database
+
+
+executeUpdate
+
+sqlcmd
+
+function
+
+integer
+
+execute the sqlcmd command on the current database returning
+1 if no errors ocurred or 0 if the command failed
+
+
+
+
+
+
diff --git a/src/bin/pgaccess/doc/html/ball.gif b/src/bin/pgaccess/doc/html/ball.gif
new file mode 100644
index 00000000000..02d203471ed
Binary files /dev/null and b/src/bin/pgaccess/doc/html/ball.gif differ
diff --git a/src/bin/pgaccess/doc/html/contents.html b/src/bin/pgaccess/doc/html/contents.html
new file mode 100644
index 00000000000..971f3f43dce
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/contents.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+Name
+
+Parameters
+
+Description
+
+
+
+setCursor
+
+type
+
+Set the cursor for all PgAccess windows, type of cursor can
+be WAIT or CLOCK or WATCH for the hourglass , anything else (or none) to
+return to the normal cursor shape
+
+
+
+parameter
+
+msg
+
+Shows a modal input dialog with the msg message, wait for user
+to enter the data and returns it as a string
+
+
+
+showError
+
+msg
+
+Shows a modal dialog window with an error message
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ What is PgAccess?
+
What's new?
+
Features
+
Screenshots
+
FAQ
+
Documentation
+
To-Do list
+
Download
+
+
+PostgreSQL
+
Visual Tcl
+
Tcl/Tk
+
Linux
+
vTcLava
+
+
diff --git a/src/bin/pgaccess/doc/html/copyright.html b/src/bin/pgaccess/doc/html/copyright.html
new file mode 100644
index 00000000000..d67654b88e7
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/copyright.html
@@ -0,0 +1,39 @@
+
+
+
+
+
documentation for any purpose, without fee, and without a written
+agreement
+
is hereby granted, provided that the above copyright notice and
+this
+
paragraph and the following two paragraphs appear in all copies.
+
+
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
+INCLUDING
+
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
+OF THE
+
POSSIBILITY OF SUCH DAMAGE.
+
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER
+IS
+
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
+TO
+
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
diff --git a/src/bin/pgaccess/doc/html/documentation.html b/src/bin/pgaccess/doc/html/documentation.html
new file mode 100644
index 00000000000..48d3fa5ec14
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/documentation.html
@@ -0,0 +1,19 @@
+
+
+
+Documentation
+
+
+
+Download
+
+
+
The primary site for PgAccess downloads is:
+
+
+
+
+
diff --git a/src/bin/pgaccess/doc/html/faq.html b/src/bin/pgaccess/doc/html/faq.html
new file mode 100644
index 00000000000..f66dd8321ac
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/faq.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+PgAccess - FAQ
+
+
+
1. When I run PgAccess I got a message complaining about the crypt
+library! What should I do?
+Versions of PostgreSQL prior to 6.5.1 couldn't reliably detect
+the presence of the crypt library on RedHat 5.x systems. That's why the
+libpgtcl library does not include reference to crypt. You will need to
+get a proper copy of libpgtcl.so library or to compile one. Go to the postgresql
+source directory into src/interfaces/libpgtcl and edit Makefile adding
+-lcrypt to the end of the line SHLIB_LINKS. Make clean and make again.
+Your libpgtcl.so is now prepare to run PgAccess. I strongly recommend you
+to upgrade to PostgreSQL 6.5.1 where this problem has been solved.
+2. I cannot connect to a database from another machine
+There may be two problems here. First of all, PgAccess running
+on the localhost is using two PostgreSQL dependent libraries, libpq and
+libpgtcl. Each of them are compiled for a specific PostgreSQL version.
+If the PostgreSQL version running on your server is different you might
+experience problems. The other problem is related to access rights. On
+the PostgreSQL server, in data directory there is a file pg_hba.conf that
+will grant access rights to users based on host authentication. Ask your
+database administrator to check if your workstation is listed there with
+the appropriate access rights. Try for the beginning the 'trust' mode,
+allowing full access to the databases.
+3. I am experiencing core dumps when trying to run PgAccess. Is PgAccess
+broken?
+No. There were NEVER reported crashes because of PgAccess.
+All of them were related to bad libraries usage. The most frequent was
+the installing of a new PostgreSQL on a RedHat 5.x server where the postgresql-clients
+rpm still exists. So, PgAccess was trying to use the old libpgtcl.so library
+suitable for an older version of PostgreSQL. Before installing a new PostgreSQL
+(either by compiling it ot by rpm packages) remove ANY TRACE of old PostgreSQL.
+PgAccess is fully relying on libpgtcl library in order to get access to
+the database so when you are experiencing that kind of problems, double-check
+libpq and libpgtcl libraries.
+4. When I try to run PgAccess I get the following error : Application
+initialization failed: couldn't connect to display ""
+That kind of error was reported on some Linux RedHat 5.x systems
+when user has su - to root and tried to run PgAccess. Some unknown errors
+in login scripts are not defining the DISPLAY environment and the wish
+application cannot connect to the X display. Try typing export DISPLAY=localhost:0.0
+and run PgAccess again.
+5. Cannot run PgAccess on a Windows machine.
+In order to use PgAccess on Windows you must have installed
+two libraries libpq.dll and libpgtcl.dll suitable for your Tcl/Tk package
+and your PostgreSQL server. Note that libraries that work with Tcl/Tk 8.0.x
+won't work with Tcl/Tk 8.1.x and libraries that work with 6.4.2 backend
+won't work with 6.5.x. So, you must properly identify your Tcl/Tk package
+version and your PostgreSQL version and download from the Downloads section
+(or pick from the win32/dll directory of PgAccess distribution) the right
+files. Copy them into your Windows/System directory and try again. Also,
+you should be able to access over the network the machine running the PostgreSQL
+server (try ping-ing it) and have the proper access rights to the database.
+6. How much costs PgAccess?
+PgAccess is a free tool. You won't have to pay anything in
+order to use it. It is protected by the following copyright
+as PostgreSQL is. I cannot guarantee technical support but I will try to
+answer to your questions as much as I can.
+7. I want to translate PgAccess messages for xxx language. What should
+I do?
+In the PgAccess distribution in lib/languages directory there
+are files with messages translated for different languages. Copy one of
+them and name it after your native language and then start editing it translating
+all the messages. Save it into the same directory and that's all. Don't
+forget to send me a copy in order to include it into the standard distribution.
+
+
8. I am receiving the following error: message invalid command
+name "namespace" while executing "namespace eval Mainlib ..."
+That means 100% that you have an older version of Tcl/Tk that
+don't recognize namespaces command. Please upgrade to Tcl/Tk 8.0.x minimum
+
+
+
+
+
+
diff --git a/src/bin/pgaccess/doc/html/features.html b/src/bin/pgaccess/doc/html/features.html
new file mode 100644
index 00000000000..4531663be38
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/features.html
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+Tables
+
- opening multiple tables for viewing, max. n records (changed by preferences
+menu)
+
- column resizing, dragging the vertical grid line (better in table
+space rather than in the table header)
+
- text wrap in cells - layout saved for every table
+
- import/export to external files (SDF,CSV)
+
- filter capabilities (enter filter like (price>3.14)
+
- sort order capabilities (enter manually the sort field(s))
+
- editing in place
+
- improved table generator assistant
+
- improved field editing
+
Queries
+
- define , edit and stores "user defined queries"
+
- store queries as views
+
- execution of queries with optional user input parameters ( select
+* from invoices where year=[parameter "Year of selection"] )
+
- viewing of select type queries result
+
- query deleting and renaming
+
- visual query builder with drag & drop capabilities. For any of
+you who had installed the Tcl/Tk plugin for Netscape Navigator, you can
+see it at work clicking here
+
Sequences
+
- defines sequences, delete them and inspect them
+
Functions
+
- define, inspect and delete functions in SQL, plpgsql and pgtcl languages
+
Reports
+
- design and display simple reports from tables
+
- fields and labels, font changing, style and size
+
- saves and loads report description from database
+
- show report previews, sample postscript output file
+
Forms
+
- open user defined forms
+
- form design module available
+
- query widget available, controls bound to query results
+
- click here for a description of forms and
+how they can be used
+
Scripts
+
- define, modify and call user defined scripts
+
Users
+
- define and modify user information
+
+
+
diff --git a/src/bin/pgaccess/doc/html/formdemo.sql b/src/bin/pgaccess/doc/html/formdemo.sql
new file mode 100644
index 00000000000..73bf1c5027f
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/formdemo.sql
@@ -0,0 +1,216 @@
+\connect - teo
+CREATE SEQUENCE "cities_id_seq" start 7 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
+SELECT nextval ('cities_id_seq');
+CREATE TABLE "pga_queries" (
+ "queryname" character varying(64),
+ "querytype" character,
+ "querycommand" text,
+ "querytables" text,
+ "querylinks" text,
+ "queryresults" text,
+ "querycomments" text);
+CREATE TABLE "pga_forms" (
+ "formname" character varying(64),
+ "formsource" text);
+CREATE TABLE "pga_scripts" (
+ "scriptname" character varying(64),
+ "scriptsource" text);
+CREATE TABLE "pga_reports" (
+ "reportname" character varying(64),
+ "reportsource" text,
+ "reportbody" text,
+ "reportprocs" text,
+ "reportoptions" text);
+CREATE TABLE "phonebook" (
+ "name" character varying(32),
+ "phone_nr" character varying(16),
+ "city" character varying(32),
+ "company" bool,
+ "continent" character varying(16));
+CREATE TABLE "pga_layout" (
+ "tablename" character varying(64),
+ "nrcols" int2,
+ "colnames" text,
+ "colwidth" text);
+CREATE TABLE "pga_schema" (
+ "schemaname" character varying(64),
+ "schematables" text,
+ "schemalinks" text);
+REVOKE ALL on "pga_schema" from PUBLIC;
+GRANT ALL on "pga_schema" to PUBLIC;
+CREATE TABLE "cities" (
+ "id" int4 DEFAULT nextval('"cities_id_seq"') NOT NULL,
+ "name" character varying(32) NOT NULL,
+ "prefix" character varying(16) NOT NULL);
+CREATE FUNCTION "getcityprefix" (int4 ) RETURNS varchar AS 'select prefix from cities where id = $1 ' LANGUAGE 'SQL';
+COPY "pga_queries" FROM stdin;
+Query that can be saved as view S select * from phonebook where continent='usa' \N \N \N \N
+\.
+COPY "pga_forms" FROM stdin;
+Working with Tables namespace f3 13 {3 4 5 6 7 9 10 11 12 13} 377x263+59+127 {radio usa {36 24 138 36} {} USA selcont} {radio europe {36 45 141 60} {} Europe selcont} {radio africa {36 66 147 81} {} Africa selcont} {label label6 {9 99 339 114} {} {Select one of the above continents and press} {}} {button button7 {270 93 354 117} {Tables::open phonebook "continent='$selcont'" $selorder} {Show them} {}} {button button9 {66 189 312 213} {Tables::design phonebook} {Show me the phonebook table structure} {}} {button button10 {141 228 240 252} {destroy .f3} {Close the form} {}} {button button11 {93 141 282 165} {Tables::open phonebook "company=true"} {Show me only the companies} {}} {radio name {183 24 261 36} {} {Order by name} selorder} {radio phone_nr {183 45 267 57} {} {Order by phone number} selorder}
+A simple demo form asdf 14 {FS {set color none}} 370x310+50+75 {label label1 {15 36 99 57} {} {Selected color} {} label1 flat #000000 #d9d9d9 1} {entry entry2 {111 36 225 54} {} entry2 color entry2 sunken #000000 #fefefe 1} {radio red {249 21 342 36} {} {Red as cherry} color red flat #900000 #d9d9d9 1} {radio green {249 45 342 60} {} {Green as a melon} color green flat #008800 #d9d9d9 1} {radio blue {249 69 342 84} {} {Blue as the sky} color blue flat #00008c #d9d9d9 1} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {} button6 ridge #0000b0 #dfbcdf 2} {label label7 {24 129 149 145} {} {The checkbox's value} {} label7 flat #000000 #d9d9d9 1} {entry entry8 {162 127 172 145} {} entry8 cbvalue entry8 sunken #000000 #fefefe 1} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue checkbox9 flat #000000 #d9d9d9 1} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {} button10 raised #000000 #d9d9d9 1} {button button11 {219 237 366 267} {Forms::open "Phone book"} {Open my phone book} {} button11 raised #000000 #d9d9d9 1} {listbox lb {12 192 162 267} {} listbox12 {} lb sunken #000000 #fefefe 1} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {} button13 raised #000000 #d9d9d9 1} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {} button14 raised #000000 #d9d9d9 1}
+Working with listboxes f2 5 {FS {set thestudent ""}} 257x263+139+147 {listbox lb {6 6 246 186} {} listbox1 {} lb sunken #000000 #ffffd4 1} {button button2 {9 234 124 258} {# Populate the listbox with some data\
+#\
+\
+foreach student {John Bill Doe Gigi} {\
+\ .f2.lb insert end $student\
+}\
+\
+\
+\
+# Binding the event left button release to the\
+# list box\
+\
+bind .f2.lb
+FORMS
+
+
+
+
+In the rectangle that you have designed it will appear the selected object.
+
Move now to the attribute window to change some of its properties.
+
Another test is defining in Script module a script called "My first
+script" having the following commands:
+
tk_messageBox -title Warning -message "This is my
+first message!"
+
and then define a button who's command is execute_script
+"My first script".
+
+
+Database manipulation
+Let's presume that our form have the internal name mf (my
+form). Don't forget that the Tk window names could not start with
+an uppercase letter.
+
The window will be referred inside the Tcl/Tk source as .mf
+
If you want to close the form in run-time you have to issue the command
+destroy
+.mf
+
The Command property of the data control widget must
+contain the SQL command that will be executed.
+
When the form will be in run-time, automatically you will have access
+to the following procedures and functions from the namespace:
+
setSQL newsql - set the command query that will be
+executed at the next open
+
getRowCount - returns the number of records of the
+result set
+
getRowIndex - returns the current record number inside
+the result set
+
getFieldList - returns a Tcl list containing the fields
+names from the current result set
+
moveFirst - move the cursor to the first record in
+the recordset
+
moveLast , moveNext , movePrevious-
+moves the cursor there
+
moveTo newrecno - move the cursor to that new record
+number (first is 0)
+
updateDataSet - update the variables inside the designed
+form that have a particular name (I'll explain later)
+
clearDataSet - clear the associated DataSet variables
+
fill listbox field - fill the named listbox (whole
+widget name as .mf.listbox1) with the all the values of
+that field from the current result set
+
close - close the result set (if
+you don't close it, you will loose some memory)
+
DataControl(.mf.dc)::open
+
set nrecs [DataControl(.mf.dc)::getRowCount]
+
setSQL "select * from phonebook"
+
open
+
set nrecs [getRowCount]
+
moveLast
+
updateDataSet
+
}
+
Opening a new DataControl will automatically position the current
+row index of the result set on the first row (index 0) and will define
+a new global associative array named DataSet that will hold data
+from the current row. The key into that array will be the fully qualified
+name of the data control widget followed by a comma and the name of every
+field in the selected rows.
+
DataSet(.mf.dc,name)
+
DataSet(.mf.dc,city)
+
+
Shift-click the above URL in order to download that tiny file (4 Kb).
+Create a empty database and psql yourdatabase <formdemo.sql
+
Open the "Phone book" form and enter a letter (a, e or i) in the field
+to the left of "Find" button then press Find. It's fine to enter one letter
+in order to get more records in query result. You will get information
+about the number of records selected, in the listbox you will see all the
+values of field "name" from the current data set. Use buttons to move to
+first, next, previous or last record within the record set.
+
+
SEND ME YOUR WISHES, YOUR IDEAS, YOUR OPINIONS !
+
ALSO ... DON'T BLAME ME IF YOU WILL HAVE TO RE-DESIGN
+YOUR OLD FORMS DUE TO SOME INCOMPATIBILITIES WITH NEWER PGACCESS VERSIONS.
+
+
diff --git a/src/bin/pgaccess/doc/html/function.gif b/src/bin/pgaccess/doc/html/function.gif
new file mode 100644
index 00000000000..51634e5df9d
Binary files /dev/null and b/src/bin/pgaccess/doc/html/function.gif differ
diff --git a/src/bin/pgaccess/doc/html/help.gif b/src/bin/pgaccess/doc/html/help.gif
new file mode 100644
index 00000000000..f08fee8fd38
Binary files /dev/null and b/src/bin/pgaccess/doc/html/help.gif differ
diff --git a/src/bin/pgaccess/doc/html/index.html b/src/bin/pgaccess/doc/html/index.html
new file mode 100644
index 00000000000..7ccda192907
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/index.html
@@ -0,0 +1,11 @@
+
+INSTALLING PgAccess UNDER IRIX 5.3.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+stuart@ludwig.ucl.ac.uk
Welcome to the pgsql-interfaces mailing list!
+ +Please save this message for future reference. Thank you.
+ +If you ever want to remove yourself from this mailing list, you +can send mail to <Majordomo@hub.org> with the following command in +the body of your email message:
+ +unsubscribe pgsql-interfaces yourname@yourdomain
+ + + diff --git a/src/bin/pgaccess/doc/html/main.html b/src/bin/pgaccess/doc/html/main.html new file mode 100644 index 00000000000..2bddfd61d4a --- /dev/null +++ b/src/bin/pgaccess/doc/html/main.html @@ -0,0 +1,34 @@ + + + + + + + + +Last version
+
Last stable version is 0.98 , released on 29 August 1999. Read what's
+new in 0.98.
+
Portability issues
+
PgAccess is available for every platform where PostgreSQL was ported
+and where a Tcl/Tk package is available. PgAccess has been reported running
+on :
+
- Linux
+
- FreeBSD
+
- Solaris
+
- HPUX
+
- Irix
+
- Windows 95,98,NT
+
PgAccess needs Tcl/Tk versions 8.0.x and higher thought PgAccess. For +win32 platforms there are some special DLL's that have to be downloaded +and installed, more information here. +
PgAccess is protected by the following copyright. + + diff --git a/src/bin/pgaccess/doc/html/mainwindow.gif b/src/bin/pgaccess/doc/html/mainwindow.gif new file mode 100644 index 00000000000..6a48792d194 Binary files /dev/null and b/src/bin/pgaccess/doc/html/mainwindow.gif differ diff --git a/src/bin/pgaccess/doc/html/newtable.gif b/src/bin/pgaccess/doc/html/newtable.gif new file mode 100644 index 00000000000..891d05698f9 Binary files /dev/null and b/src/bin/pgaccess/doc/html/newtable.gif differ diff --git a/src/bin/pgaccess/doc/html/newuser.gif b/src/bin/pgaccess/doc/html/newuser.gif new file mode 100644 index 00000000000..5c56c9ad299 Binary files /dev/null and b/src/bin/pgaccess/doc/html/newuser.gif differ diff --git a/src/bin/pgaccess/doc/html/old_index.html b/src/bin/pgaccess/doc/html/old_index.html new file mode 100644 index 00000000000..4bbf11fcf07 --- /dev/null +++ b/src/bin/pgaccess/doc/html/old_index.html @@ -0,0 +1,143 @@ + + +
+ + +
Latest stable version of PgAccess is 0.97 , released 16 August 1999
+!
+
PgAccess 0.93 and higher will not work from the beginning
+with PostgreSQL 6.3.x !!
+
Read here how to apply a
+simple patch in order to make it work !
NEW | + +International version +(english, french, italian, romanian) | +
NEW | + +Context sensitive Help | +
Precompiled libpgtcl and libpq binaries and dll's for i386 are here +!!!
Tables
+
- opening multiple tables for viewing, max. n records (changed by preferences
+menu)
+
- column resizing, dragging the vertical grid line (better in table
+space rather than in the table header)
+
- text wrap in cells - layout saved for every table
+
- import/export to external files (SDF,CSV)
+
- filter capabilities (enter filter like (price>3.14)
+
- sort order capabilities (enter manually the sort field(s))
+
- editing in place
+
- improved table generator assistant
+
- improved field editing
+
Queries
+
- define , edit and stores "user defined queries"
+
- store queries as views
+
- execution of queries with optional user input parameters ( select
+* from invoices where year=[parameter "Year of selection"] )
+
- viewing of select type queries result
+
- query deleting and renaming
+
- visual query builder with drag & drop capabilities. For any of
+you who had installed the Tcl/Tk plugin for Netscape Navigator, you can
+see it at work clicking here
+
Sequences
+
- defines sequences, delete them and inspect them
+
Functions
+
- define, inspect and delete functions in SQL, plpgsql and pgtcl languages
+
Reports
+
- design and display simple reports from tables
+
- fields and labels, font changing, style and size
+
- saves and loads report description from database
+
- show report previews, sample postscript output file
+
Forms
+
- open user defined forms
+
- form design module available
+
- query widget available, controls bound to query results
+
- click here for a description of forms and
+how they can be used
+
Scripts
+
- define, modify and call user defined scripts
+
Users
+
- define and modify user information
+
Here is a special section concerning forms and +scripts . +
This program is protected by the following copyright +
If you have any comment, suggestion for improvements, please feel free +to e-mail to : teo@flex.ro +
Mailing list for PgAccess Here +you will find how to subscribe to this mailing list. +
+
One of the solutions is to remove from the +source the line containing load libpgtcl.so and to load pgaccess.tcl +not with wish, but with pgwish (or wishpg) that wish that was linked with +libpgtcl library! I do not recommend this one. +
If you have installed RedHat 5.x, you should +get the last distribution kit of PostgreSQL and compile it from scratch. +RedHat 5.x is using some new versions of libraries and you have to compile +and install again at least libpq and libpgtcl libraries. +
PostgreSQL 6.4 release has a minor bug. I does not
+include by default the crypt lib when compiling libpgtcl. So, you will
+need to manually add a -lcrypt to SHLIB line in Makefile in src/interfaces/libpgtcl
+and then make clean and make again. The new libpgtcl.so library is properly
+configured to run pgaccess.
+
+
+
diff --git a/src/bin/pgaccess/doc/html/permissions.gif b/src/bin/pgaccess/doc/html/permissions.gif
new file mode 100644
index 00000000000..06c43491e07
Binary files /dev/null and b/src/bin/pgaccess/doc/html/permissions.gif differ
diff --git a/src/bin/pgaccess/doc/html/pg93patch.html b/src/bin/pgaccess/doc/html/pg93patch.html
new file mode 100644
index 00000000000..4c77bfac61b
--- /dev/null
+++ b/src/bin/pgaccess/doc/html/pg93patch.html
@@ -0,0 +1,25 @@
+
+
+
PgAccess 0.93 is working fine with PostgreSQL 6.4.x due to some
+changes in libpgtcl !
+
There is a small patch that you have to make in order to make it work +with 6.3.x ! +
Replace in procedure wpg_exec the following line: +
set pgsql(errmsg) [pg_result $pgsql(res) -error] +
with this one : +
set pgsql(errmsg) "NO ERROR INFORMATION SUPPLIED" +
And it will work fine! In some error cases, you will not get the appropriate +error message from libpgtcl. +
Back + + diff --git a/src/bin/pgaccess/doc/html/pga-rad.html b/src/bin/pgaccess/doc/html/pga-rad.html new file mode 100644 index 00000000000..7564cf7b553 --- /dev/null +++ b/src/bin/pgaccess/doc/html/pga-rad.html @@ -0,0 +1,65 @@ + +
+ + + + + + This would give to PgAccess the power of creating application
+directly into PgAccess, defining new modules, procedures, forms and possibly
+making it a rapid development tool for PostgreSQL. The "scripts" and "forms"
+modules are using two new tables called pga_forms and pga_scripts. PgAccess
+take care of creating them if user is opening a new database and grant
+ALL permissions on them to PUBLIC.
+
+
Of course, when Designing a script, a simple text editor
+is opened and text is saved as is in pga_scripts table. When "designing"
+a form, a "form editor" that would be very similar with "Visual Tcl" is
+invoked.
+
+
This mechanism and the extremely versatile scripting mode +of Tcl/Tk would give PgAccess a great power for creating end user application +using PostgreSQL. The most important thing is that the user could call +procedures and functions that I have used for building up PgAccess ! +
+
+
+ +
+ +The problem is related with some special characters used in different +countries because PgAccess did not use fonts with `-ISO8859-1' encoding +--
+ +The sollution was proposed by H.P.Heidinger ( hph@hphbbs.ruhr.de) and +it's very simple.
+ +If you look into PgAccess, you will find fonts declared as follows :
+ +$ grep -e '-font' -i pgaccess.tcl
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
+-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
It should be something like: -adobe-helvetica-medium-r-normal-*-*-120-*-*-*-*-iso8859-1
+ +You can achieve this by running the following script :
+ +#!/bin/sh
+cp pgaccess.tcl pgaccess.tcl-org
+cat pgaccess.tcl |\
+sed -e's/\-\*\-\*\ /\-iso8859\-1\ /g' |\
+sed -e's/\-\*\-\*\}/\-iso8859\-1}/g' |\
+sed -e's/\-\*\-\*\]/\-iso8859\-1]/g' |\
+sed -e's/\-\*\-\*$/\-iso8859\-1/g' |\
+sed -e's/\-Clean\-/\-Fixed\-/g' |\
+sed -e's/clean/fixed/g' >pgaccess.iso
+mv pgaccess.iso pgaccess.tcl
+chmod +x pgaccess.tcl
The final version of PgAccess (1.0) will let the user decide what fonts +will be used through a "preferences" dialog window.
+ + + diff --git a/src/bin/pgaccess/doc/html/todo.html b/src/bin/pgaccess/doc/html/todo.html new file mode 100644 index 00000000000..f19b61ab90c --- /dev/null +++ b/src/bin/pgaccess/doc/html/todo.html @@ -0,0 +1,11 @@ + + +
You should be able to run PgAccess.
+
+
+
diff --git a/src/bin/pgaccess/lib/database.tcl b/src/bin/pgaccess/lib/database.tcl
new file mode 100644
index 00000000000..828baf09920
--- /dev/null
+++ b/src/bin/pgaccess/lib/database.tcl
@@ -0,0 +1,61 @@
+namespace eval Database {
+
+proc {getTablesList} {} {
+global CurrentDB PgAcVar
+ set tlist {}
+ if {[catch {
+ wpg_select $CurrentDB "select c.relname,count(c.relname) from pg_class C, pg_rewrite R where (r.ev_class = C.oid) and (r.ev_type = '1') group by relname" rec {
+ if {$rec(count)!=0} {
+ set itsaview($rec(relname)) 1
+ }
+ }
+ if {! $PgAcVar(pref,systemtables)} {
+ wpg_select $CurrentDB "select relname from pg_class where (relname !~ '^pg_') and (relkind='r') order by relname" rec {
+ if {![regexp "^pga_" $rec(relname)]} then {
+ if {![info exists itsaview($rec(relname))]} {
+ lappend tlist $rec(relname)
+ }
+ }
+ }
+ } else {
+ wpg_select $CurrentDB "select relname from pg_class where (relkind='r') order by relname" rec {
+ if {![info exists itsaview($rec(relname))]} {
+ lappend tlist $rec(relname)
+ }
+ }
+ }
+ } gterrmsg]} {
+ showError $gterrmsg
+ }
+ return $tlist
+}
+
+
+proc {vacuum} {} {
+global PgAcVar CurrentDB
+ if {$CurrentDB==""} return;
+ set PgAcVar(statusline,dbname) [format [intlmsg "vacuuming database %s ..."] $PgAcVar(currentdb,dbname)]
+ setCursor CLOCK
+ set pgres [wpg_exec $CurrentDB "vacuum;"]
+ catch {pg_result $pgres -clear}
+ setCursor DEFAULT
+ set PgAcVar(statusline,dbname) $PgAcVar(currentdb,dbname)
+}
+
+
+proc {getPgType} {oid} {
+global CurrentDB
+ set temp "unknown"
+ wpg_select $CurrentDB "select typname from pg_type where oid=$oid" rec {
+ set temp $rec(typname)
+ }
+ return $temp
+}
+
+
+proc {executeUpdate} {sqlcmd} {
+global CurrentDB
+ return [sql_exec noquiet $sqlcmd]
+}
+
+}
diff --git a/src/bin/pgaccess/lib/forms.tcl b/src/bin/pgaccess/lib/forms.tcl
new file mode 100644
index 00000000000..631c3537c72
--- /dev/null
+++ b/src/bin/pgaccess/lib/forms.tcl
@@ -0,0 +1,1263 @@
+namespace eval Forms {
+
+proc {new} {} {
+global PgAcVar
+ Window show .pgaw:FormDesign:menu
+ tkwait visibility .pgaw:FormDesign:menu
+ Window show .pgaw:FormDesign:toolbar
+ tkwait visibility .pgaw:FormDesign:toolbar
+ Window show .pgaw:FormDesign:attributes
+ tkwait visibility .pgaw:FormDesign:attributes
+ Window show .pgaw:FormDesign:draft
+ design:init
+}
+
+
+proc {open} {formname} {
+ forms:load $formname run
+ design:run
+}
+
+proc {design} {formname} {
+ forms:load $formname design
+}
+
+
+proc {design:change_coords} {} {
+global PgAcVar
+ set PgAcVar(fdvar,dirty) 1
+ set i $PgAcVar(fdvar,attributeFrame)
+ if {$i == 0} {
+ # it's the form
+ set errmsg ""
+ if {[catch {wm geometry .pgaw:FormDesign:draft $PgAcVar(fdvar,c_width)x$PgAcVar(fdvar,c_height)+$PgAcVar(fdvar,c_left)+$PgAcVar(fdvar,c_top)} errmsg] != 0} {
+ showError $errmsg
+ }
+ return
+ }
+ set c [list $PgAcVar(fdvar,c_left) $PgAcVar(fdvar,c_top) [expr $PgAcVar(fdvar,c_left)+$PgAcVar(fdvar,c_width)] [expr $PgAcVar(fdvar,c_top)+$PgAcVar(fdvar,c_height)]]
+ set PgAcVar(fdobj,$i,coord) $c
+ .pgaw:FormDesign:draft.c delete o$i
+ design:draw_object $i
+ design:draw_hookers $i
+}
+
+
+proc {design:delete_object} {} {
+global PgAcVar
+ set i $PgAcVar(fdvar,moveitemobj)
+ .pgaw:FormDesign:draft.c delete o$i
+ .pgaw:FormDesign:draft.c delete hook
+ set j [lsearch $PgAcVar(fdvar,objlist) $i]
+ set PgAcVar(fdvar,objlist) [lreplace $PgAcVar(fdvar,objlist) $j $j]
+ set PgAcVar(fdvar,dirty) 1
+}
+
+
+proc {design:draw_hook} {x y} {
+ .pgaw:FormDesign:draft.c create rectangle [expr $x-2] [expr $y-2] [expr $x+2] [expr $y+2] -fill black -tags hook
+}
+
+
+proc {design:draw_hookers} {i} {
+global PgAcVar
+ foreach {x1 y1 x2 y2} $PgAcVar(fdobj,$i,coord) {}
+ .pgaw:FormDesign:draft.c delete hook
+ design:draw_hook $x1 $y1
+ design:draw_hook $x1 $y2
+ design:draw_hook $x2 $y1
+ design:draw_hook $x2 $y2
+}
+
+
+proc {design:draw_grid} {} {
+ for {set i 0} {$i<100} {incr i} {
+ .pgaw:FormDesign:draft.c create line 0 [expr {$i*6}] 1000 [expr {$i*6}] -fill #afafaf -tags grid
+ .pgaw:FormDesign:draft.c create line [expr {$i*6}] 0 [expr {$i*6}] 1000 -fill #afafaf -tags grid
+ }
+}
+
+
+proc {design:draw_object} {i} {
+global PgAcVar
+set c $PgAcVar(fdobj,$i,coord)
+foreach {x1 y1 x2 y2} $c {}
+.pgaw:FormDesign:draft.c delete o$i
+set wfont $PgAcVar(fdobj,$i,font)
+switch $wfont {
+ {} {set wfont $PgAcVar(pref,font_normal) ; set PgAcVar(fdobj,$i,font) normal}
+ normal {set wfont $PgAcVar(pref,font_normal)}
+ bold {set wfont $PgAcVar(pref,font_bold)}
+ italic {set wfont $PgAcVar(pref,font_italic)}
+ fixed {set wfont $PgAcVar(pref,font_fix)}
+}
+switch $PgAcVar(fdobj,$i,class) {
+ button {
+ design:draw_rectangle $x1 $y1 $x2 $y2 $PgAcVar(fdobj,$i,relief) $PgAcVar(fdobj,$i,bcolor) o$i
+ .pgaw:FormDesign:draft.c create text [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] -fill $PgAcVar(fdobj,$i,fcolor) -text $PgAcVar(fdobj,$i,label) -font $wfont -tags o$i
+ }
+ text {
+ design:draw_rectangle $x1 $y1 $x2 $y2 $PgAcVar(fdobj,$i,relief) $PgAcVar(fdobj,$i,bcolor) o$i
+ }
+ entry {
+ design:draw_rectangle $x1 $y1 $x2 $y2 $PgAcVar(fdobj,$i,relief) $PgAcVar(fdobj,$i,bcolor) o$i
+ }
+ label {
+ set temp $PgAcVar(fdobj,$i,label)
+ if {$temp==""} {set temp "____"}
+ design:draw_rectangle $x1 $y1 $x2 $y2 $PgAcVar(fdobj,$i,relief) $PgAcVar(fdobj,$i,bcolor) o$i
+ .pgaw:FormDesign:draft.c create text [expr {$x1+1}] [expr {$y1+1}] -text $temp -fill $PgAcVar(fdobj,$i,fcolor) -font $wfont -anchor nw -tags o$i
+ }
+ checkbox {
+ design:draw_rectangle [expr $x1+2] [expr $y1+5] [expr $x1+12] [expr $y1+15] raised #a0a0a0 o$i
+ .pgaw:FormDesign:draft.c create text [expr $x1+20] [expr $y1+3] -text $PgAcVar(fdobj,$i,label) -anchor nw \
+ -fill $PgAcVar(fdobj,$i,fcolor) -font $wfont -tags o$i
+ }
+ radio {
+ .pgaw:FormDesign:draft.c create oval [expr $x1+4] [expr $y1+5] [expr $x1+14] [expr $y1+15] -fill white -tags o$i
+ .pgaw:FormDesign:draft.c create text [expr $x1+24] [expr $y1+3] -text $PgAcVar(fdobj,$i,label) -anchor nw \
+ -fill $PgAcVar(fdobj,$i,fcolor) -font $wfont -tags o$i
+ }
+ query {
+ .pgaw:FormDesign:draft.c create oval $x1 $y1 [expr $x1+20] [expr $y1+20] -fill white -tags o$i
+ .pgaw:FormDesign:draft.c create text [expr $x1+5] [expr $y1+4] -text Q -anchor nw -font $PgAcVar(pref,font_normal) -tags o$i
+ }
+ listbox {
+ design:draw_rectangle $x1 $y1 [expr $x2-12] $y2 sunken $PgAcVar(fdobj,$i,bcolor) o$i
+ design:draw_rectangle [expr $x2-11] $y1 $x2 $y2 sunken gray o$i
+ .pgaw:FormDesign:draft.c create line [expr $x2-5] $y1 $x2 [expr $y1+10] -fill #808080 -tags o$i
+ .pgaw:FormDesign:draft.c create line [expr $x2-10] [expr $y1+9] $x2 [expr $y1+9] -fill #808080 -tags o$i
+ .pgaw:FormDesign:draft.c create line [expr $x2-10] [expr $y1+9] [expr $x2-5] $y1 -fill white -tags o$i
+ .pgaw:FormDesign:draft.c create line [expr $x2-5] $y2 $x2 [expr $y2-10] -fill #808080 -tags o$i
+ .pgaw:FormDesign:draft.c create line [expr $x2-10] [expr $y2-9] $x2 [expr $y2-9] -fill white -tags o$i
+ .pgaw:FormDesign:draft.c create line [expr $x2-10] [expr $y2-9] [expr $x2-5] $y2 -fill white -tags o$i
+ }
+}
+.pgaw:FormDesign:draft.c raise hook
+}
+
+proc {design:draw_rectangle} {x1 y1 x2 y2 relief color tag} {
+ if {$relief=="raised"} {
+ set c1 white
+ set c2 #606060
+ }
+ if {$relief=="sunken"} {
+ set c1 #606060
+ set c2 white
+ }
+ if {$relief=="ridge"} {
+ design:draw_rectangle $x1 $y1 $x2 $y2 raised none $tag
+ design:draw_rectangle [expr {$x1+1}] [expr {$y1+1}] [expr {$x2+1}] [expr {$y2+1}] sunken none $tag
+ design:draw_rectangle [expr {$x1+2}] [expr {$y1+2}] $x2 $y2 flat $color $tag
+ return
+ }
+ if {$relief=="groove"} {
+ design:draw_rectangle $x1 $y1 $x2 $y2 sunken none $tag
+ design:draw_rectangle [expr {$x1+1}] [expr {$y1+1}] [expr {$x2+1}] [expr {$y2+1}] raised none $tag
+ design:draw_rectangle [expr {$x1+2}] [expr {$y1+2}] $x2 $y2 flat $color $tag
+ return
+ }
+ if {$color != "none"} {
+ .pgaw:FormDesign:draft.c create rectangle $x1 $y1 $x2 $y2 -outline "" -fill $color -tags $tag
+ }
+ if {$relief=="flat"} {
+ return
+ }
+ .pgaw:FormDesign:draft.c create line $x1 $y1 $x2 $y1 -fill $c1 -tags $tag
+ .pgaw:FormDesign:draft.c create line $x1 $y1 $x1 $y2 -fill $c1 -tags $tag
+ .pgaw:FormDesign:draft.c create line $x1 $y2 $x2 $y2 -fill $c2 -tags $tag
+ .pgaw:FormDesign:draft.c create line $x2 $y1 $x2 [expr 1+$y2] -fill $c2 -tags $tag
+}
+
+
+proc {design:init} {} {
+global PgAcVar
+ PgAcVar:clean fdvar,*
+ PgAcVar:clean fdobj,*
+ catch {.pgaw:FormDesign:draft.c delete all}
+ # design:draw_grid
+ set PgAcVar(fdobj,0,name) {f1}
+ set PgAcVar(fdobj,0,class) form
+ set PgAcVar(fdobj,0,command) {}
+ set PgAcVar(fdvar,formtitle) "New form"
+ set PgAcVar(fdvar,objnum) 0
+ set PgAcVar(fdvar,objlist) {}
+ set PgAcVar(fdvar,oper) none
+ set PgAcVar(fdvar,tool) point
+ set PgAcVar(fdvar,resizable) 1
+ set PgAcVar(fdvar,dirty) 0
+}
+
+
+proc {design:item_click} {x y} {
+global PgAcVar
+ set PgAcVar(fdvar,oper) none
+ set PgAcVar(fdvar,moveitemobj) {}
+ set il [.pgaw:FormDesign:draft.c find overlapping $x $y $x $y]
+ .pgaw:FormDesign:draft.c delete hook
+ if {[llength $il] == 0} {
+ design:show_attributes 0
+ return
+ }
+ set tl [.pgaw:FormDesign:draft.c gettags [lindex $il 0]]
+ set i [lsearch -glob $tl o*]
+ if {$i == -1} return
+ set objnum [string range [lindex $tl $i] 1 end]
+ set PgAcVar(fdvar,moveitemobj) $objnum
+ set PgAcVar(fdvar,moveitemx) $x
+ set PgAcVar(fdvar,moveitemy) $y
+ set PgAcVar(fdvar,oper) move
+ design:show_attributes $objnum
+ design:draw_hookers $objnum
+}
+
+
+proc {forms:load} {name mode} {
+global PgAcVar CurrentDB
+ design:init
+ set PgAcVar(fdvar,formtitle) $name
+ if {$mode=="design"} {
+ Window show .pgaw:FormDesign:draft
+ Window show .pgaw:FormDesign:menu
+ Window show .pgaw:FormDesign:attributes
+ Window show .pgaw:FormDesign:toolbar
+ }
+ set res [wpg_exec $CurrentDB "select * from pga_forms where formname='$PgAcVar(fdvar,formtitle)'"]
+ set info [lindex [pg_result $res -getTuple 0] 1]
+ pg_result $res -clear
+ set PgAcVar(fdobj,0,name) [lindex $info 0]
+ set PgAcVar(fdvar,objnum) [lindex $info 1]
+ # check for old format , prior to 0.97 that
+ # save here the objlist (deprecated)
+ set temp [lindex $info 2]
+ if {[lindex $temp 0] == "FS"} {
+ set PgAcVar(fdobj,0,command) [lindex $temp 1]
+ } else {
+ set PgAcVar(fdobj,0,command) {}
+ }
+ set PgAcVar(fdvar,objlist) {}
+ set PgAcVar(fdvar,geometry) [lindex $info 3]
+ set i 1
+ foreach objinfo [lrange $info 4 end] {
+ lappend PgAcVar(fdvar,objlist) $i
+ set PgAcVar(fdobj,$i,class) [lindex $objinfo 0]
+ set PgAcVar(fdobj,$i,name) [lindex $objinfo 1]
+ set PgAcVar(fdobj,$i,coord) [lindex $objinfo 2]
+ set PgAcVar(fdobj,$i,command) [lindex $objinfo 3]
+ set PgAcVar(fdobj,$i,label) [lindex $objinfo 4]
+ set PgAcVar(fdobj,$i,variable) [lindex $objinfo 5]
+ design:setDefaultReliefAndColor $i
+ set PgAcVar(fdobj,$i,value) $PgAcVar(fdobj,$i,name)
+ if {[llength $objinfo] > 6 } {
+ set PgAcVar(fdobj,$i,value) [lindex $objinfo 6]
+ set PgAcVar(fdobj,$i,relief) [lindex $objinfo 7]
+ set PgAcVar(fdobj,$i,fcolor) [lindex $objinfo 8]
+ set PgAcVar(fdobj,$i,bcolor) [lindex $objinfo 9]
+ set PgAcVar(fdobj,$i,borderwidth) [lindex $objinfo 10]
+ set PgAcVar(fdobj,$i,font) [lindex $objinfo 11]
+ # for space saving purposes we have saved onbly the first letter
+ switch $PgAcVar(fdobj,$i,font) {
+ n {set PgAcVar(fdobj,$i,font) normal}
+ i {set PgAcVar(fdobj,$i,font) italic}
+ b {set PgAcVar(fdobj,$i,font) bold}
+ f {set PgAcVar(fdobj,$i,font) fixed}
+ }
+ }
+ if {$mode=="design"} {design:draw_object $i}
+ incr i
+ }
+ if {$mode=="design"} {wm geometry .pgaw:FormDesign:draft $PgAcVar(fdvar,geometry)}
+}
+
+
+proc {design:mouse_down} {x y} {
+global PgAcVar
+ set x [expr 3*int($x/3)]
+ set y [expr 3*int($y/3)]
+ set PgAcVar(fdvar,xstart) $x
+ set PgAcVar(fdvar,ystart) $y
+ if {$PgAcVar(fdvar,tool)=="point"} {
+ design:item_click $x $y
+ return
+ }
+ set PgAcVar(fdvar,oper) draw
+}
+
+
+proc {design:mouse_move} {x y} {
+global PgAcVar
+ #set PgAcVar(fdvar,msg) "x=$x y=$y"
+ set x [expr 3*int($x/3)]
+ set y [expr 3*int($y/3)]
+ set oper ""
+ catch {set oper $PgAcVar(fdvar,oper)}
+ if {$oper=="draw"} {
+ catch {.pgaw:FormDesign:draft.c delete curdraw}
+ .pgaw:FormDesign:draft.c create rectangle $PgAcVar(fdvar,xstart) $PgAcVar(fdvar,ystart) $x $y -tags curdraw
+ return
+ }
+ if {$oper=="move"} {
+ set dx [expr $x-$PgAcVar(fdvar,moveitemx)]
+ set dy [expr $y-$PgAcVar(fdvar,moveitemy)]
+ .pgaw:FormDesign:draft.c move o$PgAcVar(fdvar,moveitemobj) $dx $dy
+ .pgaw:FormDesign:draft.c move hook $dx $dy
+ set PgAcVar(fdvar,moveitemx) $x
+ set PgAcVar(fdvar,moveitemy) $y
+ set PgAcVar(fdvar,dirty) 1
+ }
+}
+
+proc {design:setDefaultReliefAndColor} {i} {
+global PgAcVar
+ set PgAcVar(fdobj,$i,borderwidth) 1
+ set PgAcVar(fdobj,$i,relief) flat
+ set PgAcVar(fdobj,$i,fcolor) {}
+ set PgAcVar(fdobj,$i,bcolor) {}
+ set PgAcVar(fdobj,$i,font) normal
+ switch $PgAcVar(fdobj,$i,class) {
+ button {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #d9d9d9
+ set PgAcVar(fdobj,$i,relief) raised
+ }
+ text {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #fefefe
+ set PgAcVar(fdobj,$i,relief) sunken
+ }
+ entry {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #fefefe
+ set PgAcVar(fdobj,$i,relief) sunken
+ }
+ label {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #d9d9d9
+ set PgAcVar(fdobj,$i,relief) flat
+ }
+ checkbox {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #d9d9d9
+ set PgAcVar(fdobj,$i,relief) flat
+ }
+ radio {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #d9d9d9
+ set PgAcVar(fdobj,$i,relief) flat
+ }
+ listbox {
+ set PgAcVar(fdobj,$i,fcolor) #000000
+ set PgAcVar(fdobj,$i,bcolor) #fefefe
+ set PgAcVar(fdobj,$i,relief) sunken
+ }
+ }
+}
+
+proc {design:mouse_up} {x y} {
+global PgAcVar
+ set x [expr 3*int($x/3)]
+ set y [expr 3*int($y/3)]
+ if {$PgAcVar(fdvar,oper)=="move"} {
+ set PgAcVar(fdvar,moveitem) {}
+ set PgAcVar(fdvar,oper) none
+ set oc $PgAcVar(fdobj,$PgAcVar(fdvar,moveitemobj),coord)
+ set dx [expr $x - $PgAcVar(fdvar,xstart)]
+ set dy [expr $y - $PgAcVar(fdvar,ystart)]
+ set newcoord [list [expr $dx+[lindex $oc 0]] [expr $dy+[lindex $oc 1]] [expr $dx+[lindex $oc 2]] [expr $dy+[lindex $oc 3]]]
+ set PgAcVar(fdobj,$PgAcVar(fdvar,moveitemobj),coord) $newcoord
+ design:show_attributes $PgAcVar(fdvar,moveitemobj)
+ design:draw_hookers $PgAcVar(fdvar,moveitemobj)
+ return
+ }
+ if {$PgAcVar(fdvar,oper)!="draw"} return
+ set PgAcVar(fdvar,oper) none
+ .pgaw:FormDesign:draft.c delete curdraw
+ # Check for x2