diff --git a/pw3270.cbp b/pw3270.cbp
index a9ae9e2..800089b 100644
--- a/pw3270.cbp
+++ b/pw3270.cbp
@@ -46,6 +46,9 @@
+
+
+
diff --git a/src/gtk/colors.c b/src/gtk/colors.c
index 3b32476..6280667 100644
--- a/src/gtk/colors.c
+++ b/src/gtk/colors.c
@@ -44,9 +44,9 @@
else
{
gchar ** group;
- GKeyFile * conf = g_key_file_new();
- int f;
- gboolean found = FALSE;
+ GKeyFile * conf = g_key_file_new();
+ int f = 0;
+ gboolean found = FALSE;
#if !GTK_CHECK_VERSION(3,0,0)
GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(2,G_TYPE_STRING,G_TYPE_STRING);
@@ -76,10 +76,16 @@
#if GTK_CHECK_VERSION(3,0,0)
gtk_combo_box_text_insert( GTK_COMBO_BOX_TEXT(widget),
- 0,
+ f,
str,
g_key_file_get_locale_string(conf,group[f],"Label",NULL,NULL));
+
+ if(active && !g_strcasecmp(active,str))
+ {
+ found = TRUE;
+ gtk_combo_box_set_active(GTK_COMBO_BOX(widget),f);
+ }
#else
gtk_list_store_append((GtkListStore *) model,&iter);
@@ -110,6 +116,7 @@
0,
active,
_( "Custom colors") );
+ gtk_combo_box_set_active(GTK_COMBO_BOX(widget),0);
#else
diff --git a/src/gtk/print.c b/src/gtk/print.c
index 9a2218e..dd3582d 100644
--- a/src/gtk/print.c
+++ b/src/gtk/print.c
@@ -18,7 +18,7 @@
* programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA, 02111-1307, USA
*
- * Este programa está nomeado como dialog.c e possui - linhas de código.
+ * Este programa está nomeado como print.c e possui - linhas de código.
*
* Contatos:
*
@@ -42,10 +42,12 @@
guint fontsize;
cairo_font_weight_t fontweight;
gchar * colorname;
+ int baddr;
int rows;
int cols;
int pages;
cairo_font_extents_t extents;
+ double left;
double width;
double height;
cairo_scaled_font_t * font_scaled;
@@ -54,8 +56,10 @@
/*--[ Implement ]------------------------------------------------------------------------------------*/
- static void setup_font(cairo_t *cr, PRINT_INFO *info)
+ static void setup_font(GtkPrintContext * context, PRINT_INFO *info)
{
+ cairo_t *cr = gtk_print_context_get_cairo_context(context);
+
cairo_select_font_face(cr, info->font, CAIRO_FONT_SLANT_NORMAL, info->fontweight);
info->font_scaled = cairo_get_scaled_font(cr);
@@ -65,15 +69,18 @@
info->width = ((double) info->cols) * info->extents.max_x_advance;
info->height = ((double) info->rows) * (info->extents.height + info->extents.descent);
+ // Center image
+ info->left = (gtk_print_context_get_width(context)-info->width)/2;
+ if(info->left < 2)
+ info->left = 2;
+
+
}
static void begin_print_all(GtkPrintOperation *prt, GtkPrintContext *context, PRINT_INFO *info)
{
- cairo_t *cr = gtk_print_context_get_cairo_context(context);
-
lib3270_get_screen_size(info->session,&info->rows,&info->cols);
- setup_font(cr,info);
-
+ setup_font(context,info);
gtk_print_operation_set_n_pages(prt,1);
}
@@ -82,31 +89,27 @@
int row;
int col;
cairo_t * cr = gtk_print_context_get_cairo_context(context);
- int baddr = 0;
+ int baddr = info->baddr;
GdkRectangle rect;
cairo_set_scaled_font(cr,info->font_scaled);
memset(&rect,0,sizeof(rect));
-
- rect.x = 0;
- rect.y = 0;
+ rect.y = 2;
rect.height = (info->extents.height + info->extents.descent);
rect.width = info->extents.max_x_advance;
-/*
gdk_cairo_set_source_color(cr,info->color+V3270_COLOR_BACKGROUND);
- cairo_rectangle(cr, 0, 0, rect.width*info->cols, rect.height*info->rows);
+ cairo_rectangle(cr, info->left-2, 0, (rect.width*info->cols)+4, (rect.height*info->rows)+4);
cairo_fill(cr);
cairo_stroke(cr);
-*/
rect.width++;
rect.height++;
for(row = 0; row < info->rows; row++)
{
- rect.x = 0;
+ rect.x = info->left;
for(col = 0; col < info->cols; col++)
{
unsigned char c;
diff --git a/src/gtk/v3270/draw.c b/src/gtk/v3270/draw.c
index 60ebd7a..c44dfde 100644
--- a/src/gtk/v3270/draw.c
+++ b/src/gtk/v3270/draw.c
@@ -105,12 +105,12 @@ void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H32
}
else
{
- fg = color+((attr & 0x00F0) >> 4);
+ bg = color+((attr & 0x00F0) >> 4);
if(attr & LIB3270_ATTR_FIELD)
- bg = color+(attr & 0x0003)+V3270_COLOR_FIELD;
+ fg = color+(attr & 0x0003)+V3270_COLOR_FIELD;
else
- bg = color+(attr & 0x000F);
+ fg = color+(attr & 0x000F);
}
v3270_draw_char(cr,chr,attr,session,height,rect,fg,bg);
@@ -119,12 +119,12 @@ void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H32
void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, guint height, GdkRectangle *rect, GdkColor *fg, GdkColor *bg)
{
// Clear element area
- gdk_cairo_set_source_color(cr,fg);
+ gdk_cairo_set_source_color(cr,bg);
cairo_rectangle(cr, rect->x, rect->y, rect->width, rect->height);
cairo_fill(cr);
// Set foreground color
- gdk_cairo_set_source_color(cr,bg);
+ gdk_cairo_set_source_color(cr,fg);
// Draw char
if(attr & LIB3270_ATTR_CG)
--
libgit2 0.21.2