*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2130 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-03-29 11:45:07 +00:00
parent 6ecf6af866
commit 05e59ff031
30 changed files with 5026 additions and 2358 deletions

View File

@ -1,3 +1,9 @@
2000-03-29 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/engine/Group.c: added some new transaction traversal code
* src/scm/report/folio.scm: implement the old eperl report
2000-03-28 Robert Graham Merkel <rgmerk@mira.net>
* man/gnc-prices.1: new file. Man page for gnc-prices. Somebody

View File

@ -0,0 +1,97 @@
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" title="normal" type="text/css" href=
"gnucash.css">
<title>Printing Checks</title>
</head>
<body>
<h1>Printing Checks</h1>
<p> You may print a GnuCash transaction as a check by selecting
"Print Check" from the Transaction menu in a register display
window.
<p> In the Print Check dialog, select the style of check form that
you wish to use, the position of the check on the page, and the
format for printing the date on the check. Clicking <tt>OK</tt>
will take you to the <a href="xacc-print.html">GnuCash Printing
</a> dialog, which will allow you to preview the check, select a
printer and paper size, and start the print job.
<h2>Check format</h2>
<p> In order to print a check, it is necessary to know where the
pre-printed lines and boxes are on the check form. There are two
widely-used standard check formats: Quicken/QuickBooks (tm)
compatible, and Microsoft Money (tm) compatible.
<p> By default, the check format is <tt>Quicken/QuickBooks</tt>,
which prints to any Quicken-compatible check forms.
<h2>Custom Check Format</h2>
<p> If you wish to print to a type of check form that is not in
the <tt>Check Format</tt> option menu, select <tt>Custom</tt> in
the format menu and enter the positions of the various check
fields in the entry boxes below.
<p> Positions in the Custom Check Format entry area are specified
with x = 0 at the left edge of the check with x increasing to the
right, and y = 0 at the bottom edge of the check with y increasing
as you travel up. Numbers may be entered as integer or floating
point values. The length units specified in the <tt>Units</tt>
option menu are used to interpret all values entered in the custom
check format area.
<p> If you arrive at a working set of Custom Check Format
parameters for a commercially-available printable check form,
please submit them to <tt>gnucash-devel@gnucash.org</tt> so we can
include them as standard in a future release.
<h2>Check position</h2>
<p> Printable check forms are available in several styles. In
general, each printable sheet is divided into three sections, and
each section can be either a check or a stub. The Check Position
option menu allows you to select which section of the page
contains the check you wish to print to. <tt>Top</tt>,
<tt>Middle</tt>, and <tt>Bottom</tt> should be defined correctly
for check forms using the paper size that you select in the
printing dialog.
<h2>Custom check position</h2>
<p> If the preset check positions do not work correctly for your
check forms, you may choose <tt>Custom</tt> from the Check
Position option menu and enter a position for the check in the
<tt>Check Position</tt> entry. Enter the distance along the left
edge of the paper from the lower left-hand corner of the page to
the lower left-hand corner of the check. The units of this
measurement are those selected in the "Units" option menu.
<h2>Date format</h2>
<p> Select your preferred date format from the picker. The picker
shows a sample date of "December 31, 2000" for all formats, but
your date will be substituted when printing.
<p> The "MM/DD/YY" and "DD/MM/YY" formats are available, but they
are strongly discouraged since they cannot always be
distinguished from each other. Please use a format with a full
or abbreviated month name instead of a number.
<h2>Custom date format</h2>
<p> If you wish to use another date format besides those available
in the picker, select <tt>Custom</tt> and enter a
date-formatting string in the <tt>Date Format</tt> entry in the
custom settings area. If custom date format is selected, this
string is passed to <tt>strftime(3)</tt> as a format specifier.
</body>
</html>

View File

@ -11,10 +11,15 @@
<body>
<h1>Printing</h1>
<p> At present, GnuCash does not support any sort of printer
output. However, you may create a printout of the register
<p> At present, the only type of printing directly supported by
GnuCash is <a href="xacc-print-check.html">check printing</a>.
Other types of printing are expected to be supported soon.
<p> You may create a printout of the register
window contents by opening a register window and selecting <tt>
Print... To File</tt> from the <tt>File</tt> menu. <a href="xacc-reports.html">Reports</a> can also be <a href="xacc-reports.html">exported as HTML</a>.
Print... To File</tt> from the <tt>File</tt> menu.
<a href="xacc-reports.html">Reports</a> can also be
<a href="xacc-reports.html">exported as HTML</a>.
<h1> GnuCash as Web Server</h1>

View File

@ -1,32 +0,0 @@
X-Accountant for SGI Irix
-------------------------
xacc.inst.tar (540 K) contains a binary compiled for SGI Irix systems.
Installing:
-----------
1.download
2.untar into a directory
3.inst -f xacc
4.go
5.quit
Running:
--------
Type /usr/local/bin/xacc at the command line/
Remember to set XACC_HELP to /usr/local/xacc/Docs if you want to be able
to access the online help.
There are sample xacc data files in /usr/local/xacc/data.
I also suggest setting the X resource:
xacc*sgiMode: true
This makes xacc look much more sgi-ish.
For additional notes, consult
http://www-personal.engin.umich.edu/~tkludy/xacc-sgi.html
-- Tom Kludy tkludy@csd.sgi.com December 1997

View File

@ -1,43 +0,0 @@
I have built and tested Xacc on SCO OpenServer 5.0.4 and UnixWare 7.
To build on SCO OpenServer, run the following commands:
# ./Configure-osr5
# make depend
# make
# make install
# cp Xacc /usr/lib/X11/app-defaults/Xacc
Ignore the make depend warnings for now.
The build environment for OpenServer included the GNU C Compiler 2.7.2.1
from SCO Skunkware 97 and the Glib graphics libraries package from
SCO Skunkware 97. The runtime environment for the OpenServer Xacc includes
the Glib graphics libraries package from SCO Skunkware 97.
You can retrieve binary distributions of the GNU C Compiler, Glib, and
Xacc from http://www.sco.com/skunkware/
To build Xacc on UnixWare 7, run the following commands:
# cp configure configure-orig
# cp configure-uw7 configure
# ./Configure-uw7
# make depend
# make
# make install
# cp Xacc /usr/X/lib/X11/app-defaults/Xacc
The build environment for UnixWare 7 included the GNU C Compiler 2.8.0
from SCO Skunkware 7 and the glib graphics libraries package from
SCO Skunkware 7. The runtime environment for the UnixWare 7 Xacc includes
the glib graphics libraries package from SCO Skunkware 7.
You can retrieve binary distributions of the GNU C Compiler, glib, and
Xacc from http://www.sco.com/skunkware/uw7/
Ron Record
rr@sco.com
12-Feb-98

835
po/de.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

832
po/fr.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
_("String Option")
_("Second Option")
_("Cost")
_("Mutual Fund")
_("Status")
_("Date")
@ -10,6 +11,8 @@ _("The default background color for splits in multi-line mode and the auto modes
_("Auto-Raise Lists")
_("Balance")
_("Secondary Sort Order")
_("Stock Portfolio Valuation")
_("Stock Portfolio")
_("The types of accounts for which balances are sign-reversed")
_("The Good")
_("The current time is %s.")
@ -39,6 +42,7 @@ _("Double click expands parent accounts")
_("main_win_height")
_("Boolean Option")
_("Income-Salary-Taxable")
_("_Stock Portfolio")
_("Testing")
_("US-style: mm/dd/yyyy")
_("You have not selected an account.")
@ -50,6 +54,7 @@ _("The default background color for odd rows in double mode")
_("UK-style dd/mm/yyyy")
_("Show all columns")
_("Account")
_("Value")
_("Header background")
_("Sorting")
_("Show icons only")
@ -146,6 +151,7 @@ _("A list option")
_("ISO Standard: yyyy-mm-dd")
_("Default Currency")
_("Do transaction report on this account")
_("Recent Price")
_("Net Inflow")
_("Single mode default even row background")
_("Double mode default even row background")
@ -179,6 +185,7 @@ _("Month")
_("Multi mode active transaction background")
_(". (Period)")
_("Primary Sort Order")
_("Name")
_("Descending")
_("This is a date option")
_("Two Week")
@ -214,6 +221,7 @@ _("_Hello, World")
_("First Option")
_("Double line mode with multi-line cursor")
_("Single line mode with multi-line cursor")
_("Display the Stock Portfolio report.")
_("Show transactions on multiple lines with one line for each split in the transaction")
_("account_add_win_height")
_("Plot Type")
@ -235,11 +243,11 @@ _("Report end date")
_("None")
_("Export data as text (Danger: Unfinished)")
_("Primary Key")
_("Ticker")
_("Time and Date Option")
_("Single mode default odd row background")
_("Double mode default odd row background")
_("The character used to separate fully-qualified account names")
_("__gui")
_("Report start date")
_("To")
_("smallest to largest, earliest to latest")
@ -254,6 +262,8 @@ _("Sort by amount")
_("This is an account list option")
_("Average Balance")
_("Totals")
_("Profit/Loss")
_("Shares")
_("Show All Transactions")
_("Display the Profit and Loss report.")
_("Display the Account Balance Tracker report.")

832
po/sv.po

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
-*-text-*-
Need to centralize shutdown. *everyone* should be calling either
gnc:shutdown or gnc_shutdown, and that function should be smart enough
to DTRT (like gncQuerySave, closing the GUI through a common
gnc_ui_shutdown function, etc.). We also have to decide at what point
the user's hooks should be called...

View File

@ -909,26 +909,82 @@ xaccGroupGetDepth (AccountGroup *grp)
/********************************************************************\
\********************************************************************/
void
xaccSplitsBeginStagedTransactionTraversals (Split **splits)
{
Transaction *trans;
Split *split;
if (splits == NULL) return;
for (split = *splits; split != NULL; split++) {
trans = split->parent;
if (trans != NULL)
trans->marker = 0;
}
}
void
xaccAccountBeginStagedTransactionTraversals (Account *account)
{
if (account == NULL) return;
xaccSplitsBeginStagedTransactionTraversals(account->splits);
}
void
xaccAccountsBeginStagedTransactionTraversals (Account **accounts)
{
Account *account;
if (accounts == NULL) return;
for (account = *accounts; account != NULL; account++)
xaccAccountBeginStagedTransactionTraversals(account);
}
gncBoolean
xaccTransactionTraverse(Transaction *trans, int stage)
{
if (trans == NULL) return GNC_F;
if (trans->marker < stage)
{
trans->marker = stage;
return GNC_T;
}
return GNC_F;
}
gncBoolean
xaccSplitTransactionTraverse(Split *split, int stage)
{
if (split == NULL) return GNC_F;
return xaccTransactionTraverse(split->parent, stage);
}
void
xaccGroupBeginStagedTransactionTraversals (AccountGroup *grp)
{
unsigned int numAcc;
unsigned int i;
if (!grp) return;
numAcc = grp->numAcc;
for(i = 0; i < numAcc; i++) {
unsigned int n = 0;
Account *acc;
Split *s = NULL;
acc = xaccGroupGetAccount(grp, i);
if(!acc) return;
if (!acc) return;
/* recursively do sub-accounts */
xaccGroupBeginStagedTransactionTraversals(acc->children);
s = acc->splits[0];
while (s) {
Transaction *trans = s->parent;
@ -941,15 +997,16 @@ xaccGroupBeginStagedTransactionTraversals (AccountGroup *grp)
int
xaccAccountStagedTransactionTraversal (Account *acc,
unsigned int stage,
int (*callback)(Transaction *t, void *cb_data),
void *cb_data)
unsigned int stage,
int (*callback)(Transaction *t,
void *cb_data),
void *cb_data)
{
unsigned int n = 0;
Split *s = NULL;
if(!acc) return 0;
if (!acc) return 0;
s = acc->splits[0];
if (callback) {
int retval;
@ -973,34 +1030,39 @@ xaccAccountStagedTransactionTraversal (Account *acc,
s = acc->splits[n];
}
}
return 0;
}
int
xaccGroupStagedTransactionTraversal(AccountGroup *grp,
unsigned int stage,
int (*callback)(Transaction *t, void *cb_data),
void *cb_data)
int (*callback)(Transaction *t,
void *cb_data),
void *cb_data)
{
unsigned int numAcc;
unsigned int i;
if (!grp) return 0;
numAcc = grp->numAcc;
for(i = 0; i < numAcc; i++) {
int retval;
Account *acc;
acc = xaccGroupGetAccount(grp, i);
/* recursively do sub-accounts */
retval = xaccGroupStagedTransactionTraversal
(acc->children, stage, callback, cb_data);
retval = xaccGroupStagedTransactionTraversal (acc->children, stage,
callback, cb_data);
if (retval) return retval;
retval = xaccAccountStagedTransactionTraversal (acc, stage, callback, cb_data);
retval = xaccAccountStagedTransactionTraversal (acc, stage,
callback, cb_data);
if (retval) return retval;
}
return 0;
}

View File

@ -217,13 +217,14 @@ void xaccGroupDepthAutoCode (AccountGroup *grp);
/*
* The following functions provide support for "staged traversals"
* over all of the transactions in and account or group. The idea
* over all of the transactions in an account or group. The idea
* is to be able to perform a sequence of traversals ("stages"),
* and perform an operation on each transaction exactly once
* for that stage.
*
* Only transactions whose current "stage" is less than the
* stage of the current traversal will be affected, and they will be
* "brought up" to the current stage when they are processed.
* stage of the current traversal will be affected, and they will
* be "brought up" to the current stage when they are processed.
*
* For example, you could perform a stage 1 traversal of all the
* transactions in an account, and then perform a stage 1 traversal of
@ -237,25 +238,52 @@ void xaccGroupDepthAutoCode (AccountGroup *grp);
* of 2, then all the transactions in the second account would have
* been processed.
*
* Traversal can be aborted by having the callback function return a
* non-zero value. The traversal is aborted immediately, and the
* Traversal can be aborted by having the callback function return
* a non-zero value. The traversal is aborted immediately, and the
* non-zero value is returned. Note that an aborted traversal can
* be restarted; no information is lost due to an abort.
*
* The initial impetus for this particular approach came from
* generalizing a mark/sweep practice that was already being used in
* FileIO.c.
* generalizing a mark/sweep practice that was already being
* used in FileIO.c.
*
* Note that currently, there is a hard limit of 256 stages, which
* can be changed by enlarging "marker" in the transaction struct.
* */
/* xaccGroupBeginStagedTransactionTraversals() resets the traversal
* marker inside each of all the transactions in the group so that a
* new sequence of staged traversals can begin.
* marker inside each of all the transactions in the group so that
* a new sequence of staged traversals can begin.
*
* xaccSplitsBeginStagedTransactionTraversals() resets the traversal
* marker for each transaction which is a parent of one of the
* splits in the list.
*
* xaccAccountBeginStagedTransactionTraversals() resets the traversal
* marker for each transaction which is a parent of one of the
* splits in the account.
*
* xaccAccountsBeginStagedTransactionTraversals() resets the traversal
* marker for each transaction which is a parent of one of the
* splits in any of the accounts in the list.
*/
void xaccGroupBeginStagedTransactionTraversals(AccountGroup *grp);
void xaccSplitsBeginStagedTransactionTraversals(Split **splits);
void xaccAccountBeginStagedTransactionTraversals(Account *account);
void xaccAccountsBeginStagedTransactionTraversals (Account **accounts);
/* xaccTransactionTraverse() checks the stage of the given transaction.
* If the transaction hasn't reached the given stage, the transaction
* is updated to that stage and the function returns GNC_T. Otherwise
* no change is made and the function returns GNC_F.
*
* xaccSplitTransactionTraverse() behaves as above using the parent of
* the given split.
*/
gncBoolean xaccTransactionTraverse(Transaction *trans, int stage);
gncBoolean xaccSplitTransactionTraverse(Split *split, int stage);
/* xaccGroupStagedTransactionTraversal() calls thunk on each
* transaction in the group whose current marker is less than the
@ -265,8 +293,8 @@ void xaccGroupBeginStagedTransactionTraversals(AccountGroup *grp);
* or the non-zero value returned by thunk(). This
* API does not handle handle recursive traversals.
*
* Currently the result of adding or removing transactions during a
* traversal is undefined, so don't do that.
* Currently the result of adding or removing transactions during
* a traversal is undefined, so don't do that.
*/
int
@ -283,13 +311,14 @@ xaccGroupStagedTransactionTraversal(AccountGroup *grp,
* or the non-zero value returned by thunk().
* This API does not handle handle recursive traversals.
*
* Currently the result of adding or removing transactions during a
* traversal is undefined, so don't do that.
* Currently the result of adding or removing transactions during
* a traversal is undefined, so don't do that.
*/
int xaccAccountStagedTransactionTraversal(Account *a,
unsigned int stage,
int (*thunk)(Transaction *t, void *data),
int (*thunk)(Transaction *t,
void *data),
void *data);
#endif

View File

@ -47,7 +47,8 @@ static short module = MOD_ENGINE;
/* ================================================== */
struct _Query {
struct _Query
{
Account ** acc_list;
/* maximum number of splits to return */
@ -147,7 +148,8 @@ xaccQuerySetAccounts (Query *q, Account **list)
/* copy in the account list */
i=0; acc = list[0];
while (acc) {
i++; acc = list[i];
i++;
acc = list[i];
}
q->acc_list = (Account **) _malloc ( (i+1) * sizeof (Account *));
@ -155,7 +157,8 @@ xaccQuerySetAccounts (Query *q, Account **list)
i=0; acc = list[0];
while (acc) {
q->acc_list[i] = acc;
i++; acc = list[i];
i++;
acc = list[i];
}
q->acc_list[i] = NULL;
}
@ -761,7 +764,7 @@ xaccQueryGetSplits (Query *q)
q->latest_found.tv_sec = 0;
q->latest_found.tv_nsec = 0;
slist = q->split_list;
slist = q->split_list;
i=0; s=slist[0];
while (s) {
if (q->earliest_found.tv_sec > s->parent->date_posted.tv_sec) {
@ -772,8 +775,9 @@ xaccQueryGetSplits (Query *q)
}
i++; s=slist[i];
}
LEAVE ("xaccQueryGetSplits(): returning %d splits\n", nret);
return q->split_list;
}

View File

@ -0,0 +1,285 @@
/********************************************************************\
* dialog-print-check.c : dialog to control check printing. *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#define _GNU_SOURCE
#include "config.h"
#include <stdio.h>
#include <gnome.h>
#include <guile/gh.h>
#include "top-level.h"
#include "messages_i18n.h"
#include "dialog-print-check.h"
#include "print-session.h"
#include "ui-callbacks.h"
#define CHECK_PRINT_NUM_FORMATS 2
#define CHECK_PRINT_NUM_POSITIONS 4
#define CHECK_PRINT_NUM_DATEFORMATS 9
#define CHECK_PRINT_NUM_UNITS 4
/********************************************************************\
* gnc_ui_print_check_dialog_create
* make a new print check dialog and wait for it.
\********************************************************************/
PrintCheckDialog *
gnc_ui_print_check_dialog_create(SCM callback) {
PrintCheckDialog * pcd = g_new0(PrintCheckDialog, 1);
GtkWidget * menu;
GtkWidget * active;
int i;
/* call the glade-defined creator */
pcd->dialog = create_Print_Check_Dialog();
pcd->callback = callback;
/* now pick out the relevant child widgets */
pcd->format_picker = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"check_format_picker");
pcd->position_picker = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"check_position_picker");
pcd->dformat_picker = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"date_format_picker");
pcd->payee_x = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"payee_x_entry");
pcd->payee_y = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"payee_y_entry");
pcd->date_x = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"date_x_entry");
pcd->date_y = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"date_y_entry");
pcd->words_x = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"amount_words_x_entry");
pcd->words_y = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"amount_words_y_entry");
pcd->number_x = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"amount_numbers_x_entry");
pcd->number_y = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"amount_numbers_y_entry");
pcd->memo_x = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"memo_x_entry");
pcd->memo_y = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"memo_y_entry");
pcd->check_position = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"check_position_entry");
pcd->format_entry = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"date_format_entry");
pcd->units_picker = gtk_object_get_data(GTK_OBJECT(pcd->dialog),
"units_picker");
/* fix the option menus so we can diagnose which option is
selected */
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->format_picker));
for(i = 0; i < CHECK_PRINT_NUM_FORMATS; i++) {
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->format_picker), i);
active = gtk_menu_get_active(GTK_MENU(menu));
gtk_object_set_data(GTK_OBJECT(active), "option_index",
GINT_TO_POINTER(i));
}
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->format_picker), 0);
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->position_picker));
for(i = 0; i < CHECK_PRINT_NUM_POSITIONS; i++) {
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->position_picker), i);
active = gtk_menu_get_active(GTK_MENU(menu));
gtk_object_set_data(GTK_OBJECT(active), "option_index",
GINT_TO_POINTER(i));
}
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->position_picker), 0);
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->dformat_picker));
for(i = 0; i < CHECK_PRINT_NUM_DATEFORMATS; i++) {
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->dformat_picker), i);
active = gtk_menu_get_active(GTK_MENU(menu));
gtk_object_set_data(GTK_OBJECT(active), "option_index",
GINT_TO_POINTER(i));
}
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->dformat_picker), 0);
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->units_picker));
for(i = 0; i < CHECK_PRINT_NUM_UNITS; i++) {
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->units_picker), i);
active = gtk_menu_get_active(GTK_MENU(menu));
gtk_object_set_data(GTK_OBJECT(active), "option_index",
GINT_TO_POINTER(i));
}
gtk_option_menu_set_history(GTK_OPTION_MENU(pcd->units_picker), 0);
/* set data so we can find the struct in callbacks */
gtk_object_set_data(GTK_OBJECT(pcd->dialog), "print_check_structure",
pcd);
scm_protect_object(pcd->callback);
gtk_widget_show_all(pcd->dialog);
return pcd;
}
/********************************************************************\
* gnc_ui_print_check_dialog_destroy
\********************************************************************/
void
gnc_ui_print_check_dialog_destroy(PrintCheckDialog * pcd) {
gnome_dialog_close(GNOME_DIALOG(pcd->dialog));
scm_unprotect_object(pcd->callback);
pcd->dialog = NULL;
g_free(pcd);
}
static double
entry_to_double(GtkWidget * entry) {
char * text = gtk_entry_get_text(GTK_ENTRY(entry));
double retval = 0.0;
sscanf(text, "%le", &retval);
return retval;
}
/********************************************************************\
* gnc_ui_print_check_dialog_ok_cb
\********************************************************************/
void
gnc_ui_print_check_dialog_ok_cb(GtkButton * button,
gpointer user_data) {
GtkWidget * dialog = user_data;
PrintCheckDialog * pcd =
gtk_object_get_data(GTK_OBJECT(dialog), "print_check_structure");
SCM make_check_format = gh_eval_str("make-print-check-format");
SCM callback;
SCM fmt, posn, cust_format, date_format;
GtkWidget * menu, * menuitem;
int sel_option;
double multip = 72.0;
char * formats[] = { "quicken", "custom" };
char * positions[] = { "top", "middle", "bottom", "custom" };
char * dateformats[] = { "%B %e, %Y",
"%e %B, %Y",
"%b %e, %Y",
"%e %b, %Y",
"%m/%d/%Y",
"%m/%d/%y",
"%d/%m/%Y",
"%d/%m/%y",
"custom" };
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->format_picker));
menuitem = gtk_menu_get_active(GTK_MENU(menu));
sel_option = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menuitem),
"option_index"));
fmt = gh_symbol2scm(formats[sel_option]);
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->position_picker));
menuitem = gtk_menu_get_active(GTK_MENU(menu));
sel_option = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menuitem),
"option_index"));
posn = gh_symbol2scm(positions[sel_option]);
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->units_picker));
menuitem = gtk_menu_get_active(GTK_MENU(menu));
sel_option = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menuitem),
"option_index"));
switch(sel_option) {
case 0: multip = 72.0; break; /* inches */
case 1: multip = 28.346; break; /* cm */
case 2: multip = 2.8346; break; /* mm */
case 3: multip = 1.0; break; /* points */
}
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(pcd->dformat_picker));
menuitem = gtk_menu_get_active(GTK_MENU(menu));
sel_option = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(menuitem),
"option_index"));
date_format = gh_str02scm(dateformats[sel_option]);
cust_format =
SCM_LIST7
(gh_cons(gh_symbol2scm("payee"),
SCM_LIST2(gh_double2scm(multip*entry_to_double(pcd->payee_x)),
gh_double2scm(multip*entry_to_double(pcd->payee_y)))),
gh_cons(gh_symbol2scm("date"),
SCM_LIST2(gh_double2scm(multip*entry_to_double(pcd->date_x)),
gh_double2scm(multip*entry_to_double(pcd->date_y)))),
gh_cons(gh_symbol2scm("amount-words"),
SCM_LIST2(gh_double2scm(multip*entry_to_double(pcd->words_x)),
gh_double2scm(multip*entry_to_double(pcd->words_y)))),
gh_cons(gh_symbol2scm("amount-number"),
SCM_LIST2(gh_double2scm(multip*entry_to_double(pcd->number_x)),
gh_double2scm(multip*entry_to_double(pcd->number_y)))),
gh_cons(gh_symbol2scm("memo"),
SCM_LIST2(gh_double2scm(multip*entry_to_double(pcd->memo_x)),
gh_double2scm(multip*entry_to_double(pcd->memo_y)))),
gh_cons(gh_symbol2scm("position"),
gh_double2scm(multip*entry_to_double(pcd->check_position))),
gh_cons(gh_symbol2scm("date-format"),
gh_str02scm(gtk_entry_get_text(GTK_ENTRY(pcd->format_entry)))));
callback = pcd->callback;
/* destroy the window */
gnc_ui_print_check_dialog_destroy(pcd);
/* now call the callback passed in from the scheme side with
the format as an arg */
gh_call1(callback,
gh_apply(make_check_format,
SCM_LIST4(fmt, posn, date_format, cust_format)));
}
/********************************************************************\
* gnc_ui_print_check_dialog_cancel_cb
\********************************************************************/
void
gnc_ui_print_check_dialog_cancel_cb(GtkButton * button,
gpointer user_data) {
PrintCheckDialog * pcd =
gtk_object_get_data(GTK_OBJECT(user_data), "print_check_structure");
gnc_ui_print_check_dialog_destroy(pcd);
}
/********************************************************************\
* gnc_ui_print_check_dialog_help_cb
\********************************************************************/
void
gnc_ui_print_check_dialog_help_cb(GtkButton * button,
gpointer user_data) {
helpWindow(NULL, HELP_STR, HH_PRINTCHECK);
}

View File

@ -0,0 +1,63 @@
/********************************************************************\
* dialog-print-check.h : dialog to control check printing *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#ifndef __DIALOG_PRINT_CHECK_H_
#define __DIALOG_PRINT_CHECK_H_
#include "config.h"
#include <gnome.h>
#include <guile/gh.h>
#include "print-session.h"
#include "glade-gnc-dialogs.h"
typedef struct {
GtkWidget * dialog;
GtkWidget * format_picker;
GtkWidget * position_picker;
GtkWidget * dformat_picker;
GtkWidget * payee_x, * payee_y;
GtkWidget * date_x, * date_y;
GtkWidget * words_x, * words_y;
GtkWidget * number_x, * number_y;
GtkWidget * memo_x, * memo_y;
GtkWidget * check_position;
GtkWidget * format_entry;
GtkWidget * units_picker;
SCM callback;
} PrintCheckDialog;
PrintCheckDialog * gnc_ui_print_check_dialog_create();
void gnc_ui_print_check_dialog_destroy(PrintCheckDialog * pcd);
void gnc_ui_print_check_dialog_ok_cb(GtkButton * button,
gpointer user_data);
void gnc_ui_print_check_dialog_cancel_cb(GtkButton * button,
gpointer user_data);
void gnc_ui_print_check_dialog_help_cb(GtkButton * button,
gpointer user_data);
#endif

View File

@ -43,6 +43,8 @@
#include "query-user.h"
#include "util.h"
#define _QIF_IMPORT_NUM_RADIX_FORMATS 3
#define _QIF_IMPORT_NUM_DATE_FORMATS 5
struct _qifimportwindow
{
@ -123,9 +125,6 @@ gnc_ui_qif_import_dialog_make()
retval->cat_list =
gtk_object_get_data(GTK_OBJECT(retval->dialog), "category_page_list");
gtk_object_set_data(GTK_OBJECT(retval->dialog),
"qif_window_struct", retval);
@ -155,7 +154,7 @@ gnc_ui_qif_import_dialog_make()
* index number for each menu item */
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(retval->radix_picker));
for(i = 0; i < 3; i++) {
for(i = 0; i < _QIF_IMPORT_NUM_RADIX_FORMATS; i++) {
gtk_option_menu_set_history(GTK_OPTION_MENU(retval->radix_picker), i);
active = gtk_menu_get_active(GTK_MENU(menu));
gtk_object_set_data(GTK_OBJECT(active), "option_index",
@ -166,7 +165,7 @@ gnc_ui_qif_import_dialog_make()
menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(retval->date_picker));
for(i = 0; i < 5; i++) {
for(i = 0; i < _QIF_IMPORT_NUM_DATE_FORMATS; i++) {
gtk_option_menu_set_history(GTK_OPTION_MENU(retval->date_picker), i);
active = gtk_menu_get_active(GTK_MENU(menu));
gtk_object_set_data(GTK_OBJECT(active),
@ -175,15 +174,8 @@ gnc_ui_qif_import_dialog_make()
}
gtk_option_menu_set_history(GTK_OPTION_MENU(retval->date_picker), 0);
gtk_widget_show(retval->dialog);
if (retval->dialog->window == NULL) {
free(retval);
return NULL;
}
gdk_window_raise(retval->dialog->window);
gtk_widget_show_all(retval->dialog);
return retval;
}

View File

@ -80,6 +80,10 @@ void
gnc_ui_print_dialog_cancel_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_dialog_help_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_paper_dialog_ok_cb (GtkButton *button,
gpointer user_data);
@ -87,3 +91,15 @@ gnc_ui_paper_dialog_ok_cb (GtkButton *button,
void
gnc_ui_paper_dialog_cancel_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_check_dialog_ok_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_check_dialog_cancel_cb (GtkButton *button,
gpointer user_data);
void
gnc_ui_print_check_dialog_help_cb (GtkButton *button,
gpointer user_data);

View File

@ -71,7 +71,7 @@ create_QIF_File_Import_Dialog (void)
GtkWidget *button3;
GtkWidget *button4;
QIF_File_Import_Dialog = gnome_dialog_new (NULL, NULL);
QIF_File_Import_Dialog = gnome_dialog_new (_("Import QIF Files"), NULL);
gtk_object_set_data (GTK_OBJECT (QIF_File_Import_Dialog), "QIF_File_Import_Dialog", QIF_File_Import_Dialog);
gtk_window_set_policy (GTK_WINDOW (QIF_File_Import_Dialog), TRUE, TRUE, TRUE);
@ -503,7 +503,7 @@ create_QIF_Import_Account_Picker (void)
GtkWidget *button1;
GtkWidget *button2;
QIF_Import_Account_Picker = gnome_dialog_new (NULL, NULL);
QIF_Import_Account_Picker = gnome_dialog_new (_("Select Account"), NULL);
gtk_object_set_data (GTK_OBJECT (QIF_Import_Account_Picker), "QIF_Import_Account_Picker", QIF_Import_Account_Picker);
gtk_window_set_policy (GTK_WINDOW (QIF_Import_Account_Picker), TRUE, TRUE, FALSE);
@ -697,7 +697,7 @@ create_Print_Preview_Dialog (void)
GtkWidget *dialog_action_area3;
GtkWidget *button5;
Print_Preview_Dialog = gnome_dialog_new (NULL, NULL);
Print_Preview_Dialog = gnome_dialog_new (_("Print Preview"), NULL);
gtk_object_set_data (GTK_OBJECT (Print_Preview_Dialog), "Print_Preview_Dialog", Print_Preview_Dialog);
gtk_window_set_policy (GTK_WINDOW (Print_Preview_Dialog), TRUE, TRUE, FALSE);
@ -753,7 +753,6 @@ create_Print_Dialog (void)
{
GtkWidget *Print_Dialog;
GtkWidget *dialog_vbox4;
GtkWidget *frame4;
GtkWidget *hbox12;
GtkWidget *vbox7;
GtkWidget *label690;
@ -781,9 +780,10 @@ create_Print_Dialog (void)
GtkWidget *dialog_action_area4;
GtkWidget *button9;
GtkWidget *button13;
GtkWidget *button11;
GtkWidget *button24;
GtkWidget *button25;
Print_Dialog = gnome_dialog_new (_("Print Dialog"), NULL);
Print_Dialog = gnome_dialog_new (_("Print Setup"), NULL);
gtk_object_set_data (GTK_OBJECT (Print_Dialog), "Print_Dialog", Print_Dialog);
gtk_window_set_policy (GTK_WINDOW (Print_Dialog), TRUE, TRUE, FALSE);
@ -791,19 +791,12 @@ create_Print_Dialog (void)
gtk_object_set_data (GTK_OBJECT (Print_Dialog), "dialog_vbox4", dialog_vbox4);
gtk_widget_show (dialog_vbox4);
frame4 = gtk_frame_new (_("Print Setup"));
gtk_widget_ref (frame4);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "frame4", frame4,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame4);
gtk_box_pack_start (GTK_BOX (dialog_vbox4), frame4, TRUE, TRUE, 0);
hbox12 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox12);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "hbox12", hbox12,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox12);
gtk_container_add (GTK_CONTAINER (frame4), hbox12);
gtk_box_pack_start (GTK_BOX (dialog_vbox4), hbox12, TRUE, TRUE, 0);
vbox7 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox7);
@ -992,12 +985,20 @@ create_Print_Dialog (void)
GTK_WIDGET_SET_FLAGS (button13, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button11 = g_list_last (GNOME_DIALOG (Print_Dialog)->buttons)->data;
gtk_widget_ref (button11);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button11", button11,
button24 = g_list_last (GNOME_DIALOG (Print_Dialog)->buttons)->data;
gtk_widget_ref (button24);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button24", button24,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button11);
GTK_WIDGET_SET_FLAGS (button11, GTK_CAN_DEFAULT);
gtk_widget_show (button24);
GTK_WIDGET_SET_FLAGS (button24, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Dialog), GNOME_STOCK_BUTTON_HELP);
button25 = g_list_last (GNOME_DIALOG (Print_Dialog)->buttons)->data;
gtk_widget_ref (button25);
gtk_object_set_data_full (GTK_OBJECT (Print_Dialog), "button25", button25,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button25);
GTK_WIDGET_SET_FLAGS (button25, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button12), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_select_printer_cb),
@ -1011,9 +1012,12 @@ create_Print_Dialog (void)
gtk_signal_connect (GTK_OBJECT (button13), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_preview_cb),
Print_Dialog);
gtk_signal_connect (GTK_OBJECT (button11), "clicked",
gtk_signal_connect (GTK_OBJECT (button24), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_cancel_cb),
Print_Dialog);
gtk_signal_connect (GTK_OBJECT (button25), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_dialog_help_cb),
Print_Dialog);
return Print_Dialog;
}
@ -1029,7 +1033,7 @@ create_Paper_Size_Selector_Dialog (void)
GtkWidget *button19;
GtkWidget *button20;
Paper_Size_Selector_Dialog = gnome_dialog_new (NULL, NULL);
Paper_Size_Selector_Dialog = gnome_dialog_new (_("Select Paper Size"), NULL);
gtk_object_set_data (GTK_OBJECT (Paper_Size_Selector_Dialog), "Paper_Size_Selector_Dialog", Paper_Size_Selector_Dialog);
gtk_window_set_policy (GTK_WINDOW (Paper_Size_Selector_Dialog), FALSE, FALSE, FALSE);
@ -1084,3 +1088,501 @@ create_Paper_Size_Selector_Dialog (void)
return Paper_Size_Selector_Dialog;
}
GtkWidget*
create_Print_Check_Dialog (void)
{
GtkWidget *Print_Check_Dialog;
GtkWidget *dialog_vbox6;
GtkWidget *vbox10;
GtkWidget *hbox15;
GtkWidget *vbox11;
GtkWidget *label699;
GtkWidget *label700;
GtkWidget *label713;
GtkWidget *vbox12;
GtkWidget *check_format_picker;
GtkWidget *check_format_picker_menu;
GtkWidget *glade_menuitem;
GtkWidget *check_position_picker;
GtkWidget *check_position_picker_menu;
GtkWidget *date_format_picker;
GtkWidget *date_format_picker_menu;
GtkWidget *frame5;
GtkWidget *vbox1x6;
GtkWidget *hbox16;
GtkWidget *vbox13;
GtkWidget *label702;
GtkWidget *label701;
GtkWidget *label705;
GtkWidget *label706;
GtkWidget *label707;
GtkWidget *label708;
GtkWidget *label711;
GtkWidget *label714;
GtkWidget *label709;
GtkWidget *vbox14;
GtkWidget *label703;
GtkWidget *payee_x_entry;
GtkWidget *date_x_entry;
GtkWidget *amount_words_x_entry;
GtkWidget *amount_numbers_x_entry;
GtkWidget *memo_x_entry;
GtkWidget *check_position_entry;
GtkWidget *date_format_entry;
GtkWidget *units_picker;
GtkWidget *units_picker_menu;
GtkWidget *vbox1y6;
GtkWidget *label704;
GtkWidget *payee_y_entry;
GtkWidget *date_y_entry;
GtkWidget *amount_words_y_entry;
GtkWidget *amount_numbers_y_entry;
GtkWidget *memo_y_entry;
GtkWidget *label712;
GtkWidget *label715;
GtkWidget *label710;
GtkWidget *dialog_action_area6;
GtkWidget *button21;
GtkWidget *button22;
GtkWidget *button23;
Print_Check_Dialog = gnome_dialog_new (_("Print Check"), NULL);
gtk_object_set_data (GTK_OBJECT (Print_Check_Dialog), "Print_Check_Dialog", Print_Check_Dialog);
gtk_window_set_policy (GTK_WINDOW (Print_Check_Dialog), TRUE, TRUE, FALSE);
dialog_vbox6 = GNOME_DIALOG (Print_Check_Dialog)->vbox;
gtk_object_set_data (GTK_OBJECT (Print_Check_Dialog), "dialog_vbox6", dialog_vbox6);
gtk_widget_show (dialog_vbox6);
vbox10 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox10);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox10", vbox10,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox10);
gtk_box_pack_start (GTK_BOX (dialog_vbox6), vbox10, TRUE, TRUE, 0);
hbox15 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox15);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "hbox15", hbox15,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox15);
gtk_box_pack_start (GTK_BOX (vbox10), hbox15, TRUE, TRUE, 0);
vbox11 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox11);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox11", vbox11,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox11);
gtk_box_pack_start (GTK_BOX (hbox15), vbox11, TRUE, TRUE, 5);
label699 = gtk_label_new (_("Check format:"));
gtk_widget_ref (label699);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label699", label699,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label699);
gtk_box_pack_start (GTK_BOX (vbox11), label699, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label699), 1, 0.5);
label700 = gtk_label_new (_("Check position:"));
gtk_widget_ref (label700);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label700", label700,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label700);
gtk_box_pack_start (GTK_BOX (vbox11), label700, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label700), 1, 0.5);
label713 = gtk_label_new (_("Date format:"));
gtk_widget_ref (label713);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label713", label713,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label713);
gtk_box_pack_start (GTK_BOX (vbox11), label713, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label713), 1, 0.5);
vbox12 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox12);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox12", vbox12,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox12);
gtk_box_pack_start (GTK_BOX (hbox15), vbox12, TRUE, TRUE, 0);
check_format_picker = gtk_option_menu_new ();
gtk_widget_ref (check_format_picker);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "check_format_picker", check_format_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (check_format_picker);
gtk_box_pack_start (GTK_BOX (vbox12), check_format_picker, FALSE, FALSE, 0);
check_format_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Quicken/QuickBooks (tm)"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (check_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Custom"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (check_format_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (check_format_picker), check_format_picker_menu);
check_position_picker = gtk_option_menu_new ();
gtk_widget_ref (check_position_picker);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "check_position_picker", check_position_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (check_position_picker);
gtk_box_pack_start (GTK_BOX (vbox12), check_position_picker, FALSE, FALSE, 0);
check_position_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Top"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (check_position_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Middle"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (check_position_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Bottom"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (check_position_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Custom"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (check_position_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (check_position_picker), check_position_picker_menu);
date_format_picker = gtk_option_menu_new ();
gtk_widget_ref (date_format_picker);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "date_format_picker", date_format_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (date_format_picker);
gtk_box_pack_start (GTK_BOX (vbox12), date_format_picker, FALSE, FALSE, 0);
date_format_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("December 31, 2000"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("31 December, 2000"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Dec 31, 2000"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("31 Dec, 2000"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("12/31/2000"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("12/31/00"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("31/12/2000"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("31/12/00"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Custom"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (date_format_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (date_format_picker), date_format_picker_menu);
frame5 = gtk_frame_new (_("Custom check parameters"));
gtk_widget_ref (frame5);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "frame5", frame5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (frame5);
gtk_box_pack_start (GTK_BOX (vbox10), frame5, TRUE, TRUE, 10);
vbox1x6 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox1x6);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox1x6", vbox1x6,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox1x6);
gtk_container_add (GTK_CONTAINER (frame5), vbox1x6);
hbox16 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox16);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "hbox16", hbox16,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox16);
gtk_box_pack_start (GTK_BOX (vbox1x6), hbox16, TRUE, TRUE, 0);
vbox13 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox13);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox13", vbox13,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox13);
gtk_box_pack_start (GTK_BOX (hbox16), vbox13, FALSE, FALSE, 2);
label702 = gtk_label_new ("");
gtk_widget_ref (label702);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label702", label702,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label702);
gtk_box_pack_start (GTK_BOX (vbox13), label702, FALSE, FALSE, 0);
label701 = gtk_label_new (_("Payee:"));
gtk_widget_ref (label701);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label701", label701,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label701);
gtk_box_pack_start (GTK_BOX (vbox13), label701, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label701), 1, 0.5);
label705 = gtk_label_new (_("Date:"));
gtk_widget_ref (label705);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label705", label705,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label705);
gtk_box_pack_start (GTK_BOX (vbox13), label705, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label705), 1, 0.5);
label706 = gtk_label_new (_("Amount (words):"));
gtk_widget_ref (label706);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label706", label706,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label706);
gtk_box_pack_start (GTK_BOX (vbox13), label706, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label706), 1, 0.5);
label707 = gtk_label_new (_("Amount (numbers):"));
gtk_widget_ref (label707);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label707", label707,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label707);
gtk_box_pack_start (GTK_BOX (vbox13), label707, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label707), 1, 0.5);
label708 = gtk_label_new (_("Memo:"));
gtk_widget_ref (label708);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label708", label708,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label708);
gtk_box_pack_start (GTK_BOX (vbox13), label708, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label708), 1, 0.5);
label711 = gtk_label_new (_("Check position:"));
gtk_widget_ref (label711);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label711", label711,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label711);
gtk_box_pack_start (GTK_BOX (vbox13), label711, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label711), 1, 0.5);
label714 = gtk_label_new (_("Date format:"));
gtk_widget_ref (label714);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label714", label714,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label714);
gtk_box_pack_start (GTK_BOX (vbox13), label714, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label714), 1, 0.5);
label709 = gtk_label_new (_("Units:"));
gtk_widget_ref (label709);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label709", label709,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label709);
gtk_box_pack_start (GTK_BOX (vbox13), label709, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label709), 1, 0.5);
vbox14 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox14);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox14", vbox14,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox14);
gtk_box_pack_start (GTK_BOX (hbox16), vbox14, FALSE, FALSE, 2);
label703 = gtk_label_new (_("x"));
gtk_widget_ref (label703);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label703", label703,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label703);
gtk_box_pack_start (GTK_BOX (vbox14), label703, FALSE, FALSE, 0);
payee_x_entry = gtk_entry_new ();
gtk_widget_ref (payee_x_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "payee_x_entry", payee_x_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (payee_x_entry);
gtk_box_pack_start (GTK_BOX (vbox14), payee_x_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (payee_x_entry, 100, -2);
date_x_entry = gtk_entry_new ();
gtk_widget_ref (date_x_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "date_x_entry", date_x_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (date_x_entry);
gtk_box_pack_start (GTK_BOX (vbox14), date_x_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (date_x_entry, 100, -2);
amount_words_x_entry = gtk_entry_new ();
gtk_widget_ref (amount_words_x_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "amount_words_x_entry", amount_words_x_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (amount_words_x_entry);
gtk_box_pack_start (GTK_BOX (vbox14), amount_words_x_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (amount_words_x_entry, 100, -2);
amount_numbers_x_entry = gtk_entry_new ();
gtk_widget_ref (amount_numbers_x_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "amount_numbers_x_entry", amount_numbers_x_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (amount_numbers_x_entry);
gtk_box_pack_start (GTK_BOX (vbox14), amount_numbers_x_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (amount_numbers_x_entry, 100, -2);
memo_x_entry = gtk_entry_new ();
gtk_widget_ref (memo_x_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "memo_x_entry", memo_x_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (memo_x_entry);
gtk_box_pack_start (GTK_BOX (vbox14), memo_x_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (memo_x_entry, 100, -2);
check_position_entry = gtk_entry_new ();
gtk_widget_ref (check_position_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "check_position_entry", check_position_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (check_position_entry);
gtk_box_pack_start (GTK_BOX (vbox14), check_position_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (check_position_entry, 100, -2);
date_format_entry = gtk_entry_new ();
gtk_widget_ref (date_format_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "date_format_entry", date_format_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (date_format_entry);
gtk_box_pack_start (GTK_BOX (vbox14), date_format_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (date_format_entry, 100, -2);
units_picker = gtk_option_menu_new ();
gtk_widget_ref (units_picker);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "units_picker", units_picker,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (units_picker);
gtk_box_pack_start (GTK_BOX (vbox14), units_picker, FALSE, FALSE, 0);
units_picker_menu = gtk_menu_new ();
glade_menuitem = gtk_menu_item_new_with_label (_("Inches"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (units_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Centimeters"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (units_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Millimeters"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (units_picker_menu), glade_menuitem);
glade_menuitem = gtk_menu_item_new_with_label (_("Points"));
gtk_widget_show (glade_menuitem);
gtk_menu_append (GTK_MENU (units_picker_menu), glade_menuitem);
gtk_option_menu_set_menu (GTK_OPTION_MENU (units_picker), units_picker_menu);
vbox1y6 = gtk_vbox_new (TRUE, 0);
gtk_widget_ref (vbox1y6);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "vbox1y6", vbox1y6,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox1y6);
gtk_box_pack_start (GTK_BOX (hbox16), vbox1y6, FALSE, FALSE, 2);
label704 = gtk_label_new (_("y"));
gtk_widget_ref (label704);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label704", label704,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label704);
gtk_box_pack_start (GTK_BOX (vbox1y6), label704, FALSE, FALSE, 0);
payee_y_entry = gtk_entry_new ();
gtk_widget_ref (payee_y_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "payee_y_entry", payee_y_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (payee_y_entry);
gtk_box_pack_start (GTK_BOX (vbox1y6), payee_y_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (payee_y_entry, 100, -2);
date_y_entry = gtk_entry_new ();
gtk_widget_ref (date_y_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "date_y_entry", date_y_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (date_y_entry);
gtk_box_pack_start (GTK_BOX (vbox1y6), date_y_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (date_y_entry, 100, -2);
amount_words_y_entry = gtk_entry_new ();
gtk_widget_ref (amount_words_y_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "amount_words_y_entry", amount_words_y_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (amount_words_y_entry);
gtk_box_pack_start (GTK_BOX (vbox1y6), amount_words_y_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (amount_words_y_entry, 100, -2);
amount_numbers_y_entry = gtk_entry_new ();
gtk_widget_ref (amount_numbers_y_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "amount_numbers_y_entry", amount_numbers_y_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (amount_numbers_y_entry);
gtk_box_pack_start (GTK_BOX (vbox1y6), amount_numbers_y_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (amount_numbers_y_entry, 100, -2);
memo_y_entry = gtk_entry_new ();
gtk_widget_ref (memo_y_entry);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "memo_y_entry", memo_y_entry,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (memo_y_entry);
gtk_box_pack_start (GTK_BOX (vbox1y6), memo_y_entry, FALSE, FALSE, 0);
gtk_widget_set_usize (memo_y_entry, 100, -2);
label712 = gtk_label_new ("");
gtk_widget_ref (label712);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label712", label712,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label712);
gtk_box_pack_start (GTK_BOX (vbox1y6), label712, FALSE, FALSE, 0);
label715 = gtk_label_new ("");
gtk_widget_ref (label715);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label715", label715,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label715);
gtk_box_pack_start (GTK_BOX (vbox1y6), label715, FALSE, FALSE, 0);
label710 = gtk_label_new ("");
gtk_widget_ref (label710);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "label710", label710,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label710);
gtk_box_pack_start (GTK_BOX (vbox1y6), label710, FALSE, FALSE, 0);
dialog_action_area6 = GNOME_DIALOG (Print_Check_Dialog)->action_area;
gtk_object_set_data (GTK_OBJECT (Print_Check_Dialog), "dialog_action_area6", dialog_action_area6);
gtk_widget_show (dialog_action_area6);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area6), GTK_BUTTONBOX_SPREAD);
gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area6), 8);
gnome_dialog_append_button (GNOME_DIALOG (Print_Check_Dialog), GNOME_STOCK_BUTTON_OK);
button21 = g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data;
gtk_widget_ref (button21);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "button21", button21,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button21);
GTK_WIDGET_SET_FLAGS (button21, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Check_Dialog), GNOME_STOCK_BUTTON_CANCEL);
button22 = g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data;
gtk_widget_ref (button22);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "button22", button22,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button22);
GTK_WIDGET_SET_FLAGS (button22, GTK_CAN_DEFAULT);
gnome_dialog_append_button (GNOME_DIALOG (Print_Check_Dialog), GNOME_STOCK_BUTTON_HELP);
button23 = g_list_last (GNOME_DIALOG (Print_Check_Dialog)->buttons)->data;
gtk_widget_ref (button23);
gtk_object_set_data_full (GTK_OBJECT (Print_Check_Dialog), "button23", button23,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button23);
GTK_WIDGET_SET_FLAGS (button23, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button21), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_check_dialog_ok_cb),
Print_Check_Dialog);
gtk_signal_connect (GTK_OBJECT (button22), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_check_dialog_cancel_cb),
Print_Check_Dialog);
gtk_signal_connect (GTK_OBJECT (button23), "clicked",
GTK_SIGNAL_FUNC (gnc_ui_print_check_dialog_help_cb),
Print_Check_Dialog);
return Print_Check_Dialog;
}

View File

@ -7,3 +7,4 @@ GtkWidget* create_QIF_Import_Account_Picker (void);
GtkWidget* create_Print_Preview_Dialog (void);
GtkWidget* create_Print_Dialog (void);
GtkWidget* create_Paper_Size_Selector_Dialog (void);
GtkWidget* create_Print_Check_Dialog (void);

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,9 @@
#include <stdio.h>
#include <gnome.h>
#include "top-level.h"
#include "window-help.h"
#include "messages_i18n.h"
#include "print-session.h"
#include "ui-callbacks.h"
@ -65,8 +68,11 @@ gnc_ui_print_preview_OK_cb(GtkWidget * widget, gpointer user_data) {
void
gnc_ui_print_preview_destroy(PrintPreviewDialog * ppd) {
gtk_widget_destroy(ppd->toplevel);
gtk_object_unref(GTK_OBJECT(ppd->pc));
gnome_dialog_close(GNOME_DIALOG(ppd->toplevel));
/* gtk_object_unref(GTK_OBJECT(ppd->toplevel)); */
gtk_object_unref(GTK_OBJECT(ppd->pc));
ppd->session = NULL;
g_free(ppd);
}
@ -99,55 +105,65 @@ gnc_ui_print_dialog_create(PrintSession * ps) {
}
}
else {
printer_string = "(none)";
printer_string = _("(none)");
}
gtk_entry_set_text(GTK_ENTRY(pcd->paper_entry), ps->paper);
gtk_entry_set_text(GTK_ENTRY(pcd->printer_entry), printer_string);
gtk_widget_show_all(pcd->toplevel);
return pcd;
}
void
gnc_ui_paper_dialog_cancel_cb(GtkWidget * widg, gpointer user_data) {
gtk_object_set_data(GTK_OBJECT(user_data), "quit-cause",
GINT_TO_POINTER(0));
gtk_main_quit();
PaperDialog * psd = gtk_object_get_data(GTK_OBJECT(user_data),
"paper_struct");
gnc_ui_paper_dialog_destroy(psd);
}
void
gnc_ui_paper_dialog_ok_cb(GtkWidget * widg, gpointer user_data) {
gtk_object_set_data(GTK_OBJECT(user_data), "quit-cause",
GINT_TO_POINTER(1));
gtk_main_quit();
PaperDialog * psd = gtk_object_get_data(GTK_OBJECT(user_data),
"paper_struct");
char * newpaper = g_strdup(gnome_paper_selector_get_name
(GNOME_PAPER_SELECTOR(psd->papersel)));
gtk_entry_set_text(GTK_ENTRY(psd->entry), newpaper);
psd->session->paper = newpaper;
gnc_ui_paper_dialog_destroy(psd);
}
char *
gnc_ui_paper_dialog_new_modal() {
GtkWidget * dialog = create_Paper_Size_Selector_Dialog();
GtkWidget * papersel = gtk_object_get_data(GTK_OBJECT(dialog),
"paperselector1");
char * newpaper = NULL;
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
gtk_widget_show_all(dialog);
gtk_main();
PaperDialog *
gnc_ui_paper_dialog_create(PrintSession * session, GtkWidget * entry) {
PaperDialog * psd = g_new0(PaperDialog, 1);
if(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(dialog), "quit-cause"))) {
newpaper = g_strdup(gnome_paper_selector_get_name
(GNOME_PAPER_SELECTOR(papersel)));
}
gtk_widget_destroy(dialog);
psd->toplevel = create_Paper_Size_Selector_Dialog();
psd->papersel = gtk_object_get_data(GTK_OBJECT(psd->toplevel),
"paperselector1");
psd->session = session;
psd->entry = entry;
return newpaper;
gtk_widget_ref(psd->entry);
gtk_object_set_data(GTK_OBJECT(psd->toplevel),
"paper_struct", psd);
gtk_widget_show_all(psd->toplevel);
return psd;
}
void
gnc_ui_paper_dialog_destroy(PaperDialog * psd) {
gnome_dialog_close(GNOME_DIALOG(psd->toplevel));
gtk_widget_unref(psd->entry);
g_free(psd);
}
void
gnc_ui_print_dialog_destroy(PrintDialog * pcd) {
gtk_widget_destroy(pcd->toplevel);
gnome_dialog_close(GNOME_DIALOG(pcd->toplevel));
gnc_print_session_destroy(pcd->session);
g_free(pcd);
}
@ -178,9 +194,9 @@ gnc_ui_print_dialog_select_printer_cb(GtkWidget * widget, gpointer user_data) {
}
}
else {
printer_string = "(none)";
printer_string = _("(none)");
}
gtk_entry_set_text(GTK_ENTRY(pcd->printer_entry), printer_string);
}
}
@ -189,16 +205,10 @@ gnc_ui_print_dialog_select_printer_cb(GtkWidget * widget, gpointer user_data) {
void
gnc_ui_print_dialog_select_paper_cb(GtkWidget * widget, gpointer user_data) {
PrintDialog * pcd;
char * paper;
if(user_data) {
pcd = gtk_object_get_data(GTK_OBJECT(user_data), "print_struct");
paper =
gnc_ui_paper_dialog_new_modal();
if(paper) {
pcd->session->paper = paper;
gtk_entry_set_text(GTK_ENTRY(pcd->paper_entry), pcd->session->paper);
}
gnc_ui_paper_dialog_create(pcd->session, pcd->paper_entry);
}
}
@ -235,6 +245,13 @@ gnc_ui_print_dialog_cancel_cb(GtkWidget * widget, gpointer user_data) {
}
}
void
gnc_ui_print_dialog_help_cb(GtkButton * button,
gpointer user_data) {
helpWindow(NULL, HELP_STR, HH_PRINT);
}
PrintSession *
gnc_print_session_create() {
PrintSession * ps = g_new0(PrintSession, 1);
@ -313,6 +330,7 @@ PrintDialog * gnc_ui_print_dialog_create(PrintSession * ps) {
void gnc_ui_print_dialog_destroy(PrintDialog * pcd) { }
void gnc_ui_print_dialog_help_cb(GtkWidget * widget, gpointer user_data) { }
void gnc_ui_print_dialog_select_printer_cb(GtkWidget * widget,
gpointer user_data) { }
void gnc_ui_print_dialog_select_paper_cb(GtkWidget * widget,

View File

@ -57,20 +57,27 @@ typedef struct {
PrintSession * session;
} PrintDialog;
typedef struct {
GtkWidget * toplevel;
GtkWidget * papersel;
GtkWidget * entry;
PrintSession * session;
} PaperDialog;
#else
/* type stubs for g-wrap */
typedef int PrintSession;
typedef int PrintPreviewDialog;
typedef int PrintDialog;
typedef int PaperDialog;
#endif
/* paper selector dialog */
void gnc_ui_paper_dialog_cancel_cb(GtkWidget * widg, gpointer user_data);
void gnc_ui_paper_dialog_ok_cb(GtkWidget * widg, gpointer user_data);
char * gnc_ui_paper_dialog_new_modal();
PaperDialog * gnc_ui_paper_dialog_create(PrintSession * ps, GtkWidget * entry);
void gnc_ui_paper_dialog_destroy(PaperDialog * psd);
/* print preview dialog stuff */
PrintPreviewDialog * gnc_ui_print_preview_create(PrintSession * ps);

View File

@ -953,18 +953,10 @@ print_check_cb(GtkWidget * widget, gpointer data)
date = xaccTransGetDate(trans);
memo = xaccSplitGetMemo(split);
timestruct = localtime(&date);
if(!timestruct) {
g_warning("print_check_cb: error in date translation\n");
return;
}
strftime(datestring, sizeof(datestring), "%B %d, %Y", timestruct);
gh_apply(print_check,
SCM_LIST4(gh_str02scm(payee),
gh_double2scm(fabs(amount)),
gh_str02scm(datestring),
gh_ulong2scm(date),
gh_str02scm(memo)));
}
#else

View File

@ -8,7 +8,7 @@
'("<TR>")
items
'("</TR>")))
(define (html-table-row-guess header? strong? items)
(html-table-row-manual
(map
@ -32,11 +32,11 @@
(if (< amount 0)
(string-append
"color=#ff0000>("
(sprintf #f "%.2f" (- amount))
(gnc:amount->string (- amount) #f #t #f)
")")
(string-append
">&nbsp;"
(sprintf #f "%.2f" amount)
(gnc:amount->string amount #f #t #f)
"&nbsp;"))
"</font>")))
@ -88,6 +88,19 @@
(define (html-cell-attributes value attributes)
(string-append "<TD " attributes ">" value "</TD>"))
(define (html-start-document-title title)
(list
"<HTML>"
"<HEAD>"
"<TITLE>" title "</TITLE>"
"</HEAD>"
"<BODY bgcolor=#99ccff>"))
(define (html-start-document-color color)
(list
"<HTML>"
"<BODY bgcolor=" color ">"))
(define (html-start-document)
(list
"<HTML>"
@ -124,7 +137,7 @@
; Create a column entry
(define (html-table-col val)
(sprintf #f "<TD align=right> %s </TD>" (tostring val)))
(string-append "<TD align=right>" (tostring val) "</TD>"))
; Create an html table row from a list of entries
(define (html-table-row lst)
@ -144,10 +157,11 @@
(html-table-footer)))
(define (html-table-headcol val)
(sprintf #f "<TH justify=center> %s </TH>" (tostring val)))
(string-append "<TH justify=center>" (tostring val) "</TH>"))
(define (html-table-header vec)
(apply string-append "<TABLE cellspacing=10 rules=\"rows\">\n" (map html-table-headcol vec)))
(apply string-append "<TABLE cellspacing=10 rules=\"rows\">\n"
(map html-table-headcol vec)))
(define (html-table-footer)
(sprintf #f "</TABLE>"))

View File

@ -574,11 +574,20 @@
(close port)))))
(define (gnc:options-register-translatable-strings options)
(define (external-name? name)
(cond ((not (string? name)) #f)
((< (string-length name) 2) #t)
((not (eq? (string-ref name 0) #\_)) #t)
((not (eq? (string-ref name 1) #\_)) #t)
(else #f)))
(gnc:options-for-each-general
(lambda (section hash)
(gnc:register-translatable-strings section))
(if (external-name? section)
(gnc:register-translatable-strings section)))
(lambda (option)
(gnc:register-translatable-strings (gnc:option-name option))
(if (external-name? (gnc:option-name option))
(gnc:register-translatable-strings (gnc:option-name option)))
(gnc:register-translatable-strings (gnc:option-documentation option))
(let ((getter (gnc:option-strings-getter option)))
(if getter

View File

@ -1,160 +1,121 @@
(gnc:support "report/folio.scm")
(gnc:depend "report-utilities.scm")
(gnc:depend "html-generator.scm")
;; I haven't finished converting this yet...
(let ()
;(gnc:define-report
;; version
; 1
;; Menu name
; "Folio"
;; Options Generator
; #f
;; Rendering thunk. See report.scm for details.
; (lambda (options)
; (list
; "<html>"
; "<head>"
; "<title>Portfolio Valuation</title>"
; "</head>"
(define string-db (gnc:make-string-database))
; "<body bgcolor=#ccccff>"
; "This page shows the valuation of your stock/mutual fund portfolio."
; "<br>"
; "You can create custom reports by editing the file"
; "<tt>Reports/report-folio.phtml</tt>"
; "<p>"
(define (folio-options-generator)
;; currency symbol that is printed is a dollar sign, for now
;; currency amounts get printed with two decimal places
;; require ...
;; hack alert -- need a require here, since the folowing routine(s)
;; are identical to those in gnc-price script.
;; --------------------------------------------------
;; @account_list = &account_flatlist ($account_group);
;; This rouine accepts a pointer to a group, returns
;; a flat list of all of the children in the group.
(define gnc:*folio-report-options* (gnc:new-options))
(define (gnc:register-folio-option new-option)
(gnc:register-option gnc:*folio-report-options* new-option))
;sub account_flatlist
;{
; local ($grp) = $_[0];
; local ($naccts) = gnucash::xaccGroupGetNumAccounts ($grp);
; local ($n);
; local (@acctlist, @childlist);
; local ($children);
(gnc:register-folio-option
(gnc:make-date-option
"Portfolio Options" "At"
"a" "Calculate stock portfolio value at this date"
(lambda ()
(let ((bdtime (localtime (current-time))))
(set-tm:sec bdtime 59)
(set-tm:min bdtime 59)
(set-tm:hour bdtime 23)
(let ((time (car (mktime bdtime))))
(cons time 0))))
#f))
; foreach $n (0..$naccts-1) {
; $acct = gnucash::xaccGroupGetAccount ($grp, $n);
; push (@acctlist, $acct);
; $children = gnucash::xaccAccountGetChildren ($acct);
; if ($children) {
; @childlist = &account_flatlist ($children);
; push (@acctlist, @childlist);
; }
; }
gnc:*folio-report-options*)
; return (@acctlist);
;}
(define (titles)
(map (lambda (key) (string-db 'lookup key))
'(name ticker shares recent value cost profit-loss)))
;; --------------------------------------------------
;; $split = &get_last_split ($account);
;; returns the most recent split in the account.
(define (gnc:account-get-last-split account)
(let ((num-splits (gnc:account-get-split-count account)))
(gnc:account-get-split account (if (> num-splits 0)
(- num-splits 1)
0))))
;sub get_last_split
;{
; local ($acct) = $_[0];
; local ($query, $splitlist, $split);
(define (report-rows)
; $query = gnucash::xaccMallocQuery();
; gnucash::xaccQueryAddAccount ($query, $acct);
; gnucash::xaccQuerySetMaxSplits ($query, 1);
; $splitlist = gnucash::xaccQueryGetSplits ($query);
(define total-value (make-stats-collector))
(define total-cost (make-stats-collector))
; $split = gnucash::IthSplit ($splitlist, 0);
;}
(define blank-row
(list "&nbsp" "&nbsp" "&nbsp" "&nbsp" "&nbsp" "&nbsp" "&nbsp"))
;; --------------------------------------------------
(define (report-row account)
(let ((last-split (gnc:account-get-last-split account)))
(let ((shares (gnc:split-get-share-balance last-split))
(price (gnc:split-get-share-price last-split))
(balance (gnc:split-get-balance last-split))
(cost (gnc:split-get-cost-basis last-split)))
;; get a flat list of all the accounts ...
;@acclist = &account_flatlist ($topgroup);
(total-value 'add balance)
(total-cost 'add cost)
;; get the most recent price date ..
;$latest = -1.0e20;
;$earliest = 1.0e20;
;foreach $acct (@acclist)
;{
; $accntype = &gnucash::xaccAccountGetType($acct);
; if (($accntype == $gnucash::STOCK) ||
; ($accntype == $gnucash::MUTUAL)) {
; $split = &get_last_split ($acct);
; $trans = gnucash::xaccSplitGetParent ($split);
; $secs = gnucash::xaccTransGetDate ($trans);
; if ($latest < $secs) { $latest = $secs; }
; if ($earliest > $secs) { $earliest = $secs; }
; }
;}
(list
(gnc:account-get-name account)
(gnc:account-get-security account)
(gnc:amount->string shares #f #t #t)
(gnc:amount->string price #f #t #f)
(gnc:amount->string balance #f #t #f)
(gnc:amount->string cost #f #t #f)
(gnc:amount->string (- balance cost) #f #t #f)))))
;$ldayte = gnucash::xaccPrintDateSecs ($latest);
;$edayte = gnucash::xaccPrintDateSecs ($earliest);
(define (net-row)
(let ((value (total-value 'total #f))
(cost (total-cost 'total #f)))
(list (html-strong (string-db 'lookup 'net))
"&nbsp" "&nbsp" "&nbsp"
(gnc:amount->string value #f #t #f)
(gnc:amount->string cost #f #t #f)
(gnc:amount->string (- value cost) #f #t #f))))
(define (report-rows-main)
(gnc:group-map-accounts
(lambda (account)
(let ((type (gnc:account-type->symbol
(gnc:account-get-type account))))
(if (member type '(STOCK MUTUAL))
(report-row account)
#f)))
(gnc:get-current-group)))
;<table cellpadding=1>
;<caption><b>Stock Portfolio Valuation</b>
;<br>Earliest Price <:= $edayte :> &nbsp; &nbsp; Latest Price <:= $ldayte :>
;</caption>
;<tr>
;<th>Name
;<th>Ticker
;<th align=center>Shares
;<th align=center>Recent Price
;<th align=center>Value
;<th align=center>Cost
;<th align=center>Profit/Loss
(define (collapse list collapsed)
(cond ((null? list) collapsed)
(else (collapse (cdr list)
(if (car list)
(cons (car list) collapsed)
collapsed)))))
;$totvalue = 0;
;$totcost = 0;
(let ((main-rows (collapse (report-rows-main) '())))
(reverse (cons (net-row)
(cons blank-row main-rows)))))
;foreach $acct (@acclist)
;{
(define (folio-renderer options)
(list
(html-start-document-title (string-db 'lookup 'title))
(html-table (titles) (report-rows))
(html-end-document)))
; $accntype = &gnucash::xaccAccountGetType($acct);
; if (($accntype == $gnucash::STOCK) ||
; ($accntype == $gnucash::MUTUAL)) {
(string-db 'store 'title "Stock Portfolio Valuation")
(string-db 'store 'name "Name")
(string-db 'store 'ticker "Ticker")
(string-db 'store 'shares "Shares")
(string-db 'store 'recent "Recent Price")
(string-db 'store 'value "Value")
(string-db 'store 'cost "Cost")
(string-db 'store 'profit-loss "Profit/Loss")
(string-db 'store 'net "Net")
; $accname = &gnucash::xaccAccountGetName($acct);
; $ticker = &gnucash::xaccAccountGetSecurity ($acct);
; $accbaln = &gnucash::xaccAccountGetBalance($acct);
; $split = &get_last_split ($acct);
; $price = gnucash::xaccSplitGetSharePrice ($split);
; $shares = gnucash::xaccSplitGetShareBalance ($split);
; $value = gnucash::xaccSplitGetBalance ($split);
; $cost = gnucash::xaccSplitGetCostBasis ($split);
; $profit = $accbaln - $cost;
; $totvalue += $value;
; $totcost += $cost;
; print "<tr><td>$accname";
; print "<td>$ticker";
; printf "<td align=right nowrap>%10.3f", $shares;
; printf "<td align=right nowrap>\$%10.2f\n", $price;
; printf "<td align=right nowrap>\$%10.2f\n", $value;
; printf "<td align=right nowrap>\$%10.2f\n", $cost;
; printf "<td align=right nowrap>\$%10.2f\n", $profit;
; }
;}
;print "<tr><td>&nbsp;<td>&nbsp;<td>&nbsp;\n"; ;; blank line
;print "<td>&nbsp;<td>&nbsp;<td>&nbsp;\n"; ;; blank line
;print "<tr><td><b>Net</b><td>&nbsp;";
;print "<td>&nbsp;<td>&nbsp;";
;printf "<td align=right nowrap>&nbsp;&nbsp;<u>\$%10.2f</u> \n", $totvalue;
;printf "<td align=right nowrap>&nbsp;&nbsp;<u>\$%10.2f</u> \n", $totcost;
;printf "<td align=right nowrap>&nbsp;&nbsp;<u>\$%10.2f</u> \n", $totvalue-$totcost;
;</table>
;</body>
;</html>
(gnc:define-report
;; version
1
;; Menu name
"Stock Portfolio"
;; Options Generator
#f
;; Renderer
folio-renderer))

View File

@ -200,7 +200,7 @@
;; Here's a helper function for making some of the paragraphs below.
(define (make-para key . values)
(let ((args (append (list #f (string-db 'lookup key)) values)))
(string-append "<p>" (apply sprintf args) "</p>")))
(html-para (apply sprintf args))))
;; This is the rendering function. It accepts a database of options
@ -243,8 +243,7 @@
;; the other reports for details. Note that you can used nested
;; lists here, as well as arbitrary functions.
(list
"<html>"
"<body bgcolor=" (gnc:color-option->html color-op) ">"
(html-start-document-color (gnc:color-option->html color-op))
;; Here we get the title using the string database and 'lookup.
"<h2>" (string-db 'lookup 'title) "</h2>"
@ -292,8 +291,7 @@
(make-para 'nice-day)
"</body>"
"</html>"))))
(html-end-document)))))
;; Now we store the actual strings we are going to use and

View File

@ -41,6 +41,8 @@
#define HH_GLOBPREFS "xacc-globalprefs.html"
#define HH_ACCEDIT "xacc-accountedit.html"
#define HH_QIFIMPORT "xacc-qif-import.html"
#define HH_PRINTCHECK "xacc-print-check.html"
#define HH_PRINT "xacc-print.html"
/** STRUCTS *********************************************************/