mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Tweak register looks.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3416 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -3991,14 +3991,15 @@ xaccSRGetCellBorderHandler (VirtualLocation virt_loc,
|
||||
gpointer user_data)
|
||||
{
|
||||
SplitRegister *reg = user_data;
|
||||
CursorClass cursor_class;
|
||||
VirtualCell *vcell;
|
||||
|
||||
vcell = gnc_table_get_virtual_cell (reg->table, virt_loc.vcell_loc);
|
||||
if (!vcell || !vcell->cellblock)
|
||||
return;
|
||||
|
||||
if ((virt_loc.phys_col_offset < vcell->cellblock->start_col) ||
|
||||
(virt_loc.phys_col_offset > vcell->cellblock->stop_col))
|
||||
if (virt_loc.phys_col_offset < vcell->cellblock->start_col ||
|
||||
virt_loc.phys_col_offset > vcell->cellblock->stop_col)
|
||||
{
|
||||
borders->top = CELL_BORDER_LINE_NONE;
|
||||
borders->bottom = CELL_BORDER_LINE_NONE;
|
||||
@@ -4007,7 +4008,17 @@ xaccSRGetCellBorderHandler (VirtualLocation virt_loc,
|
||||
return;
|
||||
}
|
||||
|
||||
if (vcell->cellblock->cursor_type == CURSOR_TYPE_SPLIT)
|
||||
cursor_class = xaccCursorTypeToClass (vcell->cellblock->cursor_type);
|
||||
|
||||
if (cursor_class == CURSOR_CLASS_TRANS &&
|
||||
virt_loc.phys_col_offset == vcell->cellblock->start_col)
|
||||
borders->left = CELL_BORDER_LINE_NONE;
|
||||
|
||||
if (cursor_class == CURSOR_CLASS_TRANS &&
|
||||
virt_loc.phys_col_offset == vcell->cellblock->stop_col)
|
||||
borders->right = CELL_BORDER_LINE_NONE;
|
||||
|
||||
if (cursor_class == CURSOR_CLASS_SPLIT)
|
||||
{
|
||||
borders->top = MIN (borders->top, CELL_BORDER_LINE_LIGHT);
|
||||
borders->bottom = MIN (borders->bottom, CELL_BORDER_LINE_LIGHT);
|
||||
|
||||
@@ -603,12 +603,12 @@ gnc_configure_register_borders (void)
|
||||
|
||||
use_vertical_lines = gnc_lookup_boolean_option("Register",
|
||||
"Show Vertical Borders",
|
||||
TRUE);
|
||||
FALSE);
|
||||
|
||||
|
||||
use_horizontal_lines = gnc_lookup_boolean_option("Register",
|
||||
"Show Horizontal Borders",
|
||||
TRUE);
|
||||
FALSE);
|
||||
|
||||
gnucash_style_config_register_borders (use_vertical_lines,
|
||||
use_horizontal_lines);
|
||||
@@ -803,9 +803,9 @@ gnc_configure_auto_decimal(void)
|
||||
* Returns: Nothing
|
||||
*/
|
||||
static void
|
||||
gnc_configure_auto_decimal_places_cb(void *not_used)
|
||||
gnc_configure_auto_decimal_places_cb (gpointer not_used)
|
||||
{
|
||||
gnc_configure_auto_decimal_places();
|
||||
gnc_configure_auto_decimal_places ();
|
||||
}
|
||||
|
||||
/* gnc_configure_auto_decimal_places
|
||||
@@ -815,14 +815,11 @@ gnc_configure_auto_decimal_places_cb(void *not_used)
|
||||
* Returns: Nothing
|
||||
*/
|
||||
static void
|
||||
gnc_configure_auto_decimal_places(void)
|
||||
gnc_configure_auto_decimal_places (void)
|
||||
{
|
||||
gnc_set_auto_decimal_places
|
||||
(
|
||||
(int) gnc_lookup_number_option( "General",
|
||||
"Auto Decimal Places",
|
||||
2 )
|
||||
);
|
||||
(gnc_lookup_number_option("General",
|
||||
"Auto Decimal Places", 2));
|
||||
}
|
||||
|
||||
|
||||
@@ -834,9 +831,9 @@ gnc_configure_auto_decimal_places(void)
|
||||
* Returns: Nothing
|
||||
*/
|
||||
static void
|
||||
gnc_configure_register_font_cb(void *not_used)
|
||||
gnc_configure_register_font_cb (gpointer not_used)
|
||||
{
|
||||
gnc_configure_register_font();
|
||||
gnc_configure_register_font ();
|
||||
}
|
||||
|
||||
/* gnc_configure_register_font
|
||||
|
||||
@@ -1949,29 +1949,29 @@ regWindowLedger (xaccLedgerDisplay *ledger)
|
||||
GtkWidget *popup;
|
||||
guint num_rows;
|
||||
|
||||
table_frame = gtk_frame_new(NULL);
|
||||
gnome_dock_set_client_area(GNOME_DOCK(register_dock), table_frame);
|
||||
table_frame = gtk_frame_new (NULL);
|
||||
gnome_dock_set_client_area (GNOME_DOCK(register_dock), table_frame);
|
||||
|
||||
num_rows = (guint) gnc_lookup_number_option("Register",
|
||||
"Number of Rows", 15.0);
|
||||
gnucash_register_set_initial_rows(num_rows);
|
||||
num_rows = (guint) gnc_lookup_number_option ("Register",
|
||||
"Number of Rows", 20.0);
|
||||
gnucash_register_set_initial_rows (num_rows);
|
||||
|
||||
register_widget = gnucash_register_new(reg->table);
|
||||
gnc_table_init_gui(register_widget, reg);
|
||||
register_widget = gnucash_register_new (reg->table);
|
||||
gnc_table_init_gui (register_widget, reg);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(table_frame), register_widget);
|
||||
gtk_container_add (GTK_CONTAINER(table_frame), register_widget);
|
||||
|
||||
regData->reg = GNUCASH_REGISTER(register_widget);
|
||||
regData->reg = GNUCASH_REGISTER (register_widget);
|
||||
GNUCASH_SHEET(regData->reg->sheet)->window = register_window;
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(register_widget), "activate_cursor",
|
||||
GTK_SIGNAL_FUNC(gnc_register_record_cb), regData);
|
||||
gtk_signal_connect(GTK_OBJECT(register_widget), "redraw_all",
|
||||
GTK_SIGNAL_FUNC(gnc_register_redraw_all_cb), regData);
|
||||
gtk_signal_connect (GTK_OBJECT(register_widget), "activate_cursor",
|
||||
GTK_SIGNAL_FUNC(gnc_register_record_cb), regData);
|
||||
gtk_signal_connect (GTK_OBJECT(register_widget), "redraw_all",
|
||||
GTK_SIGNAL_FUNC(gnc_register_redraw_all_cb), regData);
|
||||
|
||||
popup = gnc_register_create_popup_menu(regData);
|
||||
gnucash_register_attach_popup(GNUCASH_REGISTER(register_widget),
|
||||
popup, regData);
|
||||
popup = gnc_register_create_popup_menu (regData);
|
||||
gnucash_register_attach_popup (GNUCASH_REGISTER(register_widget),
|
||||
popup, regData);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2000,6 +2000,7 @@ regWindowLedger (xaccLedgerDisplay *ledger)
|
||||
prefix = "reg_stock_win";
|
||||
width = &last_stock_width;
|
||||
break;
|
||||
|
||||
default:
|
||||
prefix = "reg_win";
|
||||
width = &last_width;
|
||||
|
||||
@@ -234,15 +234,15 @@ gnucash_item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
dw = item_cursor->w;
|
||||
dh = item_cursor->h;
|
||||
|
||||
/* draw the double rectangle around the entire active
|
||||
/* draw the rectangle around the entire active
|
||||
virtual row */
|
||||
gdk_gc_set_line_attributes (cursor->gc, 1,
|
||||
GDK_LINE_SOLID, -1, -1);
|
||||
|
||||
gdk_gc_set_foreground (cursor->gc, &gn_black);
|
||||
gdk_gc_set_background (cursor->gc, &gn_white);
|
||||
|
||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||
dx+2, dy+2, dw-4, dh-4);
|
||||
dx + 1, dy, dw - 2, dh);
|
||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||
dx, dy, dw, dh);
|
||||
|
||||
@@ -257,13 +257,10 @@ gnucash_item_cursor_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
gdk_gc_set_line_attributes (cursor->gc, 1,
|
||||
GDK_LINE_SOLID, -1, -1);
|
||||
|
||||
gdk_gc_set_foreground (cursor->gc, &gn_light_gray);
|
||||
gdk_gc_set_foreground (cursor->gc, &gn_black);
|
||||
|
||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||
dx+1, dy+1, dw-2, dh-2);
|
||||
|
||||
gdk_gc_set_foreground (cursor->gc, &gn_black);
|
||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||
dx+2, dy+2, dw-4, dh-4);
|
||||
gdk_draw_rectangle (drawable, cursor->gc, FALSE,
|
||||
dx, dy, dw, dh);
|
||||
}
|
||||
|
||||
@@ -439,17 +439,21 @@ draw_cell (GnucashGrid *grid,
|
||||
if ((text == NULL) || (*text == '\0'))
|
||||
return;
|
||||
|
||||
y_offset = height - MAX(CELL_VPADDING, font->descent + 4);
|
||||
y_offset = ((height / 2) +
|
||||
(((font->ascent + font->descent) / 2) - font->descent));
|
||||
|
||||
switch (gnc_table_get_align (table, virt_loc)) {
|
||||
switch (gnc_table_get_align (table, virt_loc))
|
||||
{
|
||||
default:
|
||||
case CELL_ALIGN_LEFT:
|
||||
x_offset = CELL_HPADDING;
|
||||
break;
|
||||
|
||||
case CELL_ALIGN_RIGHT:
|
||||
x_offset = width - CELL_HPADDING
|
||||
- gdk_string_measure (font, text);
|
||||
break;
|
||||
|
||||
case CELL_ALIGN_CENTER:
|
||||
if (width < gdk_string_measure (font, text))
|
||||
x_offset = CELL_HPADDING;
|
||||
@@ -460,9 +464,9 @@ draw_cell (GnucashGrid *grid,
|
||||
break;
|
||||
}
|
||||
|
||||
rect.x = x + CELL_HPADDING;
|
||||
rect.y = y + CELL_VPADDING;
|
||||
rect.width = width - 2 * CELL_HPADDING;
|
||||
rect.x = x + CELL_HPADDING;
|
||||
rect.y = y + CELL_VPADDING;
|
||||
rect.width = width - (2 * CELL_HPADDING);
|
||||
rect.height = height;
|
||||
|
||||
gdk_gc_set_clip_rectangle (grid->gc, &rect);
|
||||
|
||||
@@ -141,7 +141,9 @@ gnucash_header_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
|
||||
if (!text)
|
||||
text = "";
|
||||
|
||||
y_offset = h - MAX(CELL_VPADDING, font->descent + 4);
|
||||
y_offset = ((h / 2) +
|
||||
(((font->ascent + font->descent) / 2) -
|
||||
font->descent));
|
||||
|
||||
switch (gnc_table_get_align (table, virt_loc)) {
|
||||
default:
|
||||
|
||||
@@ -203,25 +203,27 @@ item_edit_draw_info(ItemEdit *item_edit, int x, int y, TextDrawInfo *info)
|
||||
dx = xd - x;
|
||||
dy = yd - y;
|
||||
|
||||
info->bg_rect.x = dx + CELL_HPADDING;
|
||||
info->bg_rect.y = dy + CELL_VPADDING;
|
||||
info->bg_rect.width = wd - (2 * CELL_HPADDING);
|
||||
info->bg_rect.height = hd - (2 * CELL_VPADDING - info->font->descent);
|
||||
info->bg_rect.x = dx + CELL_HPADDING;
|
||||
info->bg_rect.y = dy + CELL_VPADDING;
|
||||
info->bg_rect.width = wd - (2 * CELL_HPADDING);
|
||||
info->bg_rect.height = hd - (2 * CELL_VPADDING);
|
||||
|
||||
toggle_space = item_edit->is_popup ?
|
||||
item_edit->popup_toggle.toggle_offset : 0;
|
||||
|
||||
info->text_rect.x = dx;
|
||||
info->text_rect.y = dy + CELL_VPADDING;
|
||||
info->text_rect.width = wd - toggle_space;
|
||||
info->text_rect.height = hd - (2*CELL_VPADDING - info->font->descent);
|
||||
info->text_rect.x = dx;
|
||||
info->text_rect.y = dy + CELL_VPADDING;
|
||||
info->text_rect.width = wd - toggle_space;
|
||||
info->text_rect.height = hd - (2 * CELL_VPADDING);
|
||||
|
||||
switch (gnc_table_get_align (table, item_edit->virt_loc)) {
|
||||
switch (gnc_table_get_align (table, item_edit->virt_loc))
|
||||
{
|
||||
case CELL_ALIGN_RIGHT:
|
||||
xoffset = info->text_rect.width -
|
||||
(2*CELL_HPADDING + total_width);
|
||||
if (xoffset > 0)
|
||||
break;
|
||||
|
||||
default:
|
||||
xoffset = MIN (CELL_HPADDING,
|
||||
info->text_rect.width -
|
||||
@@ -232,9 +234,11 @@ item_edit_draw_info(ItemEdit *item_edit, int x, int y, TextDrawInfo *info)
|
||||
info->text_x1 = dx + xoffset;
|
||||
info->text_x2 = info->text_x1 + width_1;
|
||||
info->text_x3 = info->text_x2 + width_2;
|
||||
info->text_y = dy + hd - MAX(CELL_VPADDING, info->font->descent + 4);
|
||||
info->text_y = (dy + (hd / 2) +
|
||||
(((info->font->ascent + info->font->descent) / 2)
|
||||
- info->font->descent));
|
||||
|
||||
info->cursor_x = info->text_x1 + pre_cursor_width;
|
||||
info->cursor_x = info->text_x1 + pre_cursor_width;
|
||||
info->cursor_y1 = info->text_y - info->font->ascent;
|
||||
info->cursor_y2 = info->text_y + info->font->descent;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "splitreg.h"
|
||||
#include "table-allgui.h"
|
||||
|
||||
#define CELL_VPADDING 5
|
||||
#define CELL_VPADDING 3
|
||||
#define CELL_HPADDING 4
|
||||
|
||||
|
||||
|
||||
@@ -556,13 +556,13 @@ gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc,
|
||||
g_return_if_fail (sheet != NULL);
|
||||
g_return_if_fail (GNUCASH_IS_SHEET (sheet));
|
||||
|
||||
line_style = use_vertical_lines ?
|
||||
line_style = use_horizontal_lines ?
|
||||
CELL_BORDER_LINE_NORMAL : CELL_BORDER_LINE_NONE;
|
||||
|
||||
borders->top = line_style;
|
||||
borders->bottom = line_style;
|
||||
|
||||
line_style = use_horizontal_lines ?
|
||||
line_style = use_vertical_lines ?
|
||||
CELL_BORDER_LINE_NORMAL : CELL_BORDER_LINE_NONE;
|
||||
|
||||
borders->left = line_style;
|
||||
|
||||
@@ -1099,6 +1099,27 @@ xaccSplitRegisterGetCursorClass (SplitRegister *reg,
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
CursorClass
|
||||
xaccCursorTypeToClass (CursorType cursor_type)
|
||||
{
|
||||
switch (cursor_type)
|
||||
{
|
||||
case CURSOR_TYPE_SINGLE_LEDGER:
|
||||
case CURSOR_TYPE_DOUBLE_LEDGER:
|
||||
case CURSOR_TYPE_SINGLE_JOURNAL:
|
||||
case CURSOR_TYPE_DOUBLE_JOURNAL:
|
||||
return CURSOR_CLASS_TRANS;
|
||||
|
||||
case CURSOR_TYPE_SPLIT:
|
||||
return CURSOR_CLASS_SPLIT;
|
||||
|
||||
default:
|
||||
return CURSOR_CLASS_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================== */
|
||||
|
||||
static CellType
|
||||
sr_cell_type (SplitRegister *reg, void * cell)
|
||||
{
|
||||
|
||||
@@ -264,6 +264,8 @@ CursorClass xaccSplitRegisterGetCurrentCursorClass (SplitRegister *reg);
|
||||
CursorClass xaccSplitRegisterGetCursorClass (SplitRegister *reg,
|
||||
VirtualCellLocation vcell_loc);
|
||||
|
||||
CursorClass xaccCursorTypeToClass (CursorType cursor_type);
|
||||
|
||||
/* Returns the type of the current cell */
|
||||
CellType xaccSplitRegisterGetCurrentCellType (SplitRegister *reg);
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ the account instead of opening a register.") #f))
|
||||
(gnc:make-number-range-option
|
||||
(N_ "Register") (N_ "Number of Rows")
|
||||
"d" (N_ "Default number of register rows to display.")
|
||||
15.0 ;; default
|
||||
20.0 ;; default
|
||||
1.0 ;; lower bound
|
||||
200.0 ;; upper bound
|
||||
0.0 ;; number of decimals
|
||||
@@ -254,12 +254,12 @@ the account instead of opening a register.") #f))
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(N_ "Register") (N_ "Show Vertical Borders")
|
||||
"e" (N_ "By default, show vertical borders on the cells.") #t))
|
||||
"e" (N_ "By default, show vertical borders on the cells.") #f))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-simple-boolean-option
|
||||
(N_ "Register") (N_ "Show Horizontal Borders")
|
||||
"f" (N_ "By default, show horizontal borders on the cells.") #t))
|
||||
"f" (N_ "By default, show horizontal borders on the cells.") #f))
|
||||
|
||||
(gnc:register-configuration-option
|
||||
(gnc:make-simple-boolean-option
|
||||
|
||||
Reference in New Issue
Block a user