Merge branch 'maint'

This commit is contained in:
John Ralls
2016-05-23 11:47:06 -07:00
3 changed files with 79 additions and 45 deletions

View File

@@ -5306,7 +5306,7 @@ msgstr "Ütemezett tranzakciók beállítása kölcsön törlesztésére"
#: ../src/gnome/gnc-plugin-basic-commands.c:174 #: ../src/gnome/gnc-plugin-basic-commands.c:174
#: ../src/report/report-system/report.scm:67 #: ../src/report/report-system/report.scm:67
msgid "B_udget" msgid "B_udget"
msgstr "Költségvetés" msgstr "_Költségvetés"
#: ../src/gnome/gnc-plugin-basic-commands.c:177 #: ../src/gnome/gnc-plugin-basic-commands.c:177
msgid "Close _Books" msgid "Close _Books"

View File

@@ -499,15 +499,10 @@ gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
return FALSE; return FALSE;
/* Ok, we are sure we want to trigger auto-completion. Now find an /* Ok, we are sure we want to trigger auto-completion. Now find an
* entry to copy the values from. FIXME: Currently we only use * entry to copy the values from. */
* the entries from the current invoice/bill, but it would be
* better to draw this from a larger set of entries. */
auto_entry = auto_entry =
/* Use this for book-wide auto-completion of the invoice entries */ /* Use this for book-wide auto-completion of the invoice entries */
find_entry_in_book_by_desc(ledger, desc); find_entry_in_book_by_desc(ledger, desc);
/* #else */
/* gnc_find_entry_in_reg_by_desc(ledger, desc); */
/* #endif */
if (auto_entry == NULL) if (auto_entry == NULL)
return FALSE; return FALSE;
@@ -586,8 +581,8 @@ gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
/* Taxable?, Tax-include?, Tax table */ /* Taxable?, Tax-include?, Tax table */
{ {
gboolean taxable, taxincluded; gboolean taxable = FALSE, taxincluded = FALSE;
GncTaxTable *taxtable; GncTaxTable *taxtable = NULL;
switch (ledger->type) switch (ledger->type)
{ {
case GNCENTRY_INVOICE_ENTRY: case GNCENTRY_INVOICE_ENTRY:
@@ -596,26 +591,39 @@ gnc_entry_ledger_auto_completion (GncEntryLedger *ledger,
taxincluded = gncEntryGetInvTaxIncluded (auto_entry); taxincluded = gncEntryGetInvTaxIncluded (auto_entry);
taxtable = gncEntryGetInvTaxTable (auto_entry); taxtable = gncEntryGetInvTaxTable (auto_entry);
break; break;
default: case GNCENTRY_BILL_ENTRY:
case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
taxable = gncEntryGetBillTaxable (auto_entry); taxable = gncEntryGetBillTaxable (auto_entry);
taxincluded = gncEntryGetBillTaxIncluded (auto_entry); taxincluded = gncEntryGetBillTaxIncluded (auto_entry);
taxtable = gncEntryGetBillTaxTable (auto_entry); taxtable = gncEntryGetBillTaxTable (auto_entry);
break; break;
default:
break;
} }
/* Taxable? cell */ switch (ledger->type)
cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXABLE_CELL); {
gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxable); case GNCENTRY_INVOICE_ENTRY:
gnc_basic_cell_set_changed (cell, TRUE); case GNCENTRY_CUST_CREDIT_NOTE_ENTRY:
case GNCENTRY_BILL_ENTRY:
case GNCENTRY_VEND_CREDIT_NOTE_ENTRY:
/* Taxable? cell */
cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXABLE_CELL);
gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxable);
gnc_basic_cell_set_changed (cell, TRUE);
/* taxincluded? cell */ /* taxincluded? cell */
cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXINCLUDED_CELL); cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXINCLUDED_CELL);
gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxincluded); gnc_checkbox_cell_set_flag ((CheckboxCell *) cell, taxincluded);
gnc_basic_cell_set_changed (cell, TRUE); gnc_basic_cell_set_changed (cell, TRUE);
/* Taxable? cell */ /* Taxable? cell */
cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL); cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_TAXTABLE_CELL);
set_value_combo_cell(cell, gncTaxTableGetName (taxtable)); set_value_combo_cell(cell, gncTaxTableGetName (taxtable));
break;
default:
break;
}
} }

View File

@@ -2238,33 +2238,19 @@ draw_check_format(GtkPrintContext *context, gint position,
check_format_t *format, gpointer user_data) check_format_t *format, gpointer user_data)
{ {
PrintCheckDialog *pcd = (PrintCheckDialog *) user_data; PrintCheckDialog *pcd = (PrintCheckDialog *) user_data;
cairo_t *cr;
gdouble x, y, r, multip; gdouble x, y, r, multip;
cairo_t *cr = gtk_print_context_get_cairo_context(context);
cr = gtk_print_context_get_cairo_context(context); /* Translate all subsequent check items if required. */
cairo_translate(cr, format->trans_x, format->trans_y);
g_debug("Page translated by %f,%f", format->trans_x, format->trans_y);
cairo_rotate(cr, format->rotation * DEGREES_TO_RADIANS);
g_debug("Page rotated by %f degrees", format->rotation);
/* The grid is useful when determining check layouts */
if (format->show_grid)
{
draw_grid(context,
gtk_print_context_get_width(context),
gtk_print_context_get_height(context),
pcd->default_font);
}
/* Translate all subsequent check items if requested.
* For check position 0, no translation is needed. */
if ((position > 0) && (position < pcd->position_max)) if ((position > 0) && (position < pcd->position_max))
{ {
/* Standard positioning is used. /* Standard positioning is used.
* Note that the first check on the page (position 0) doesn't * Note that the first check on the page (position 0) doesn't
* need to be moved (hence the test for position > 0 above. */ * need to be moved (hence the test for position > 0 above. */
cairo_translate(cr, 0, position * format->height); cairo_translate(cr, 0, format->height); /* Translation is relative to previous
g_debug("Position %d translated by %f (pre-defined)", position, position * format->height); check translation, not to page border ! */
g_debug("Position %d translated by %f relative to previous check (pre-defined)", position, format->height);
g_debug(" by %f relative to page (pre-defined)", position * format->height);
} }
else if (position == pcd->position_max) else if (position == pcd->position_max)
{ {
@@ -2392,6 +2378,7 @@ draw_page(GtkPrintOperation *operation,
{ {
PrintCheckDialog *pcd = (PrintCheckDialog *) user_data; PrintCheckDialog *pcd = (PrintCheckDialog *) user_data;
check_format_t *format; check_format_t *format;
cairo_t *cr = gtk_print_context_get_cairo_context(context);
format = pcd->selected_format; format = pcd->selected_format;
if (format) if (format)
@@ -2401,6 +2388,7 @@ draw_page(GtkPrintOperation *operation,
guint check_count = g_list_length(pcd->splits); guint check_count = g_list_length(pcd->splits);
gint check_number; gint check_number;
gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox)); gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
gint last_blank_check_pos;
gint checks_per_page; gint checks_per_page;
GList *next_split; GList *next_split;
@@ -2432,6 +2420,28 @@ draw_page(GtkPrintOperation *operation,
position = 0; position = 0;
} }
/* Do page level translations/rotations */
cairo_translate(cr, format->trans_x, format->trans_y);
g_debug("Page translated by %f,%f", format->trans_x, format->trans_y);
cairo_rotate(cr, format->rotation * DEGREES_TO_RADIANS);
g_debug("Page rotated by %f degrees", format->rotation);
/* The grid is useful when determining check layouts */
if (format->show_grid)
{
draw_grid(context,
gtk_print_context_get_width(context),
gtk_print_context_get_height(context),
pcd->default_font);
}
last_blank_check_pos = position - 1;
/* Optionally skip blank check positions if */
if ((page_nr == 0) /* on first page AND */
&& (last_blank_check_pos > 0) /* there's more than one blank check */
&& (position < pcd->position_max)) /* but don't skip for custom positioning */
cairo_translate(cr, 0, format->height * last_blank_check_pos);
for (check_number = first_check; check_number <= last_check; for (check_number = first_check; check_number <= last_check;
check_number++, position++) check_number++, position++)
{ {
@@ -2460,15 +2470,31 @@ begin_print(GtkPrintOperation *operation,
{ {
PrintCheckDialog *pcd = (PrintCheckDialog *) user_data; PrintCheckDialog *pcd = (PrintCheckDialog *) user_data;
guint check_count = g_list_length(pcd->splits); guint check_count = g_list_length(pcd->splits);
gint first_page_count;
gint pages; gint pages;
gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox)); gint position = gtk_combo_box_get_active(GTK_COMBO_BOX(pcd->position_combobox));
if (pcd->selected_format && pcd->position_max > 1 && position < pcd->position_max) if (pcd->selected_format /* User selected a format other than custom */
&& pcd->position_max > 1 /* The format has more than one check per page
(position_max is equivalent to custom
positioning, and there need to be at least two
other check defined positions (0 and 1), so
custom positioning should be at least
at position 2, i.e. >1) */
&& position < pcd->position_max) /* User chose a check position other
then custom (which is always at
position_max in the list) */
{ {
gint first_page_count, remaining_count;
first_page_count = gtk_spin_button_get_value_as_int(pcd->first_page_count); first_page_count = gtk_spin_button_get_value_as_int(pcd->first_page_count);
pages = ((check_count - first_page_count) + pcd->position_max - 1) / remaining_count = check_count - first_page_count;
pcd->position_max + 1; pages = 1 /* First page, will have first_page_count checks */
+ remaining_count / pcd->position_max;
/* Subsequent pages with all positions filled */
if ((remaining_count % pcd->position_max) > 0)
pages++; /* Last page, not all positions are filled. Needs to be added
separately because integer division rounds towards 0 and
would omit the last checks if they didn't fill a full page */
} }
else else
pages = check_count; pages = check_count;