Kaydet (Commit) d8897914 authored tarafından Enrico Tröger's avatar Enrico Tröger

Fix build with GTK >= 2.10.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2625 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst be0d9e8e
...@@ -213,7 +213,7 @@ static gint get_page_count(GtkPrintContext *context, DocInfo *dinfo) ...@@ -213,7 +213,7 @@ static gint get_page_count(GtkPrintContext *context, DocInfo *dinfo)
gint lines = 1; gint lines = 1;
gint line_width; gint line_width;
line_buf = sci_get_line(doc_list[dinfo->idx].sci, j); line_buf = sci_get_line(documents[dinfo->idx]->sci, j);
line_width = (g_utf8_strlen(line_buf, -1) + 1) * dinfo->font_width; line_width = (g_utf8_strlen(line_buf, -1) + 1) * dinfo->font_width;
if (line_width > width) if (line_width > width)
lines = ceil(line_width / width); lines = ceil(line_width / width);
...@@ -240,8 +240,8 @@ static void add_page_header(PangoLayout *layout, cairo_t *cr, DocInfo *dinfo, gi ...@@ -240,8 +240,8 @@ static void add_page_header(PangoLayout *layout, cairo_t *cr, DocInfo *dinfo, gi
gint ph_height = dinfo->line_height * 3; gint ph_height = dinfo->line_height * 3;
gchar *data; gchar *data;
gchar *datetime; gchar *datetime;
gchar *tmp_file_name = (doc_list[dinfo->idx].file_name != NULL) ? gchar *tmp_file_name = (documents[dinfo->idx]->file_name != NULL) ?
doc_list[dinfo->idx].file_name : GEANY_STRING_UNTITLED; documents[dinfo->idx]->file_name : GEANY_STRING_UNTITLED;
gchar *file_name = (printing_prefs.page_header_basename) ? gchar *file_name = (printing_prefs.page_header_basename) ?
g_path_get_basename(tmp_file_name) : g_strdup(tmp_file_name); g_path_get_basename(tmp_file_name) : g_strdup(tmp_file_name);
...@@ -430,7 +430,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context, ...@@ -430,7 +430,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
desc = pango_font_description_from_string(interface_prefs.editor_font); desc = pango_font_description_from_string(interface_prefs.editor_font);
/* init dinfo fields */ /* init dinfo fields */
dinfo->lines = sci_get_line_count(doc_list[dinfo->idx].sci); dinfo->lines = sci_get_line_count(documents[dinfo->idx]->sci);
dinfo->lines_per_page = 0; dinfo->lines_per_page = 0;
dinfo->cur_line = 0; dinfo->cur_line = 0;
dinfo->cur_pos = 0; dinfo->cur_pos = 0;
...@@ -446,7 +446,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context, ...@@ -446,7 +446,7 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
dinfo->n_pages = get_page_count(context, dinfo); dinfo->n_pages = get_page_count(context, dinfo);
/* read all styles from Scintilla */ /* read all styles from Scintilla */
style_max = pow(2, scintilla_send_message(doc_list[dinfo->idx].sci, SCI_GETSTYLEBITS, 0, 0)); style_max = pow(2, scintilla_send_message(documents[dinfo->idx]->sci, SCI_GETSTYLEBITS, 0, 0));
/* if the lexer uses only the first 32 styles(style bits = 5), /* if the lexer uses only the first 32 styles(style bits = 5),
* we need to add the pre-defined styles */ * we need to add the pre-defined styles */
if (style_max == 32) if (style_max == 32)
...@@ -454,21 +454,21 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context, ...@@ -454,21 +454,21 @@ static void begin_print(GtkPrintOperation *operation, GtkPrintContext *context,
for (i = 0; i < style_max; i++) for (i = 0; i < style_max; i++)
{ {
dinfo->styles[i][FORE] = ROTATE_RGB(scintilla_send_message( dinfo->styles[i][FORE] = ROTATE_RGB(scintilla_send_message(
doc_list[dinfo->idx].sci, SCI_STYLEGETFORE, i, 0)); documents[dinfo->idx]->sci, SCI_STYLEGETFORE, i, 0));
if (i == STYLE_LINENUMBER) if (i == STYLE_LINENUMBER)
{ /* ignore background colour for line number margin to avoid trouble with wrapped lines */ { /* ignore background colour for line number margin to avoid trouble with wrapped lines */
dinfo->styles[STYLE_LINENUMBER][BACK] = ROTATE_RGB(scintilla_send_message( dinfo->styles[STYLE_LINENUMBER][BACK] = ROTATE_RGB(scintilla_send_message(
doc_list[dinfo->idx].sci, SCI_STYLEGETBACK, STYLE_DEFAULT, 0)); documents[dinfo->idx]->sci, SCI_STYLEGETBACK, STYLE_DEFAULT, 0));
} }
else else
{ {
dinfo->styles[i][BACK] = ROTATE_RGB(scintilla_send_message( dinfo->styles[i][BACK] = ROTATE_RGB(scintilla_send_message(
doc_list[dinfo->idx].sci, SCI_STYLEGETBACK, i, 0)); documents[dinfo->idx]->sci, SCI_STYLEGETBACK, i, 0));
} }
dinfo->styles[i][BOLD] = dinfo->styles[i][BOLD] =
scintilla_send_message(doc_list[dinfo->idx].sci, SCI_STYLEGETBOLD, i, 0); scintilla_send_message(documents[dinfo->idx]->sci, SCI_STYLEGETBOLD, i, 0);
dinfo->styles[i][ITALIC] = dinfo->styles[i][ITALIC] =
scintilla_send_message(doc_list[dinfo->idx].sci, SCI_STYLEGETITALIC, i, 0); scintilla_send_message(documents[dinfo->idx]->sci, SCI_STYLEGETITALIC, i, 0);
} }
if (dinfo->n_pages >= 0) if (dinfo->n_pages >= 0)
...@@ -562,8 +562,8 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context, ...@@ -562,8 +562,8 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
/* data */ /* data */
else else
{ {
style = sci_get_style_at(doc_list[dinfo->idx].sci, dinfo->cur_pos); style = sci_get_style_at(documents[dinfo->idx]->sci, dinfo->cur_pos);
c = sci_get_char_at(doc_list[dinfo->idx].sci, dinfo->cur_pos); c = sci_get_char_at(documents[dinfo->idx]->sci, dinfo->cur_pos);
if (c == '\0' || style == -1) if (c == '\0' || style == -1)
{ /* if c gets 0, we are probably out of document boundaries, { /* if c gets 0, we are probably out of document boundaries,
* so stop to break out of outer loop */ * so stop to break out of outer loop */
...@@ -583,7 +583,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context, ...@@ -583,7 +583,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
/* don't add line breaks, they are handled manually below */ /* don't add line breaks, they are handled manually below */
else if (c == '\r' || c == '\n') else if (c == '\r' || c == '\n')
{ {
gchar c_next = sci_get_char_at(doc_list[dinfo->idx].sci, dinfo->cur_pos); gchar c_next = sci_get_char_at(documents[dinfo->idx]->sci, dinfo->cur_pos);
at_eol = TRUE; at_eol = TRUE;
if (c == '\r' && c_next == '\n') if (c == '\r' && c_next == '\n')
dinfo->cur_pos++; /* skip LF part of CR/LF */ dinfo->cur_pos++; /* skip LF part of CR/LF */
...@@ -599,7 +599,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context, ...@@ -599,7 +599,7 @@ static void draw_page(GtkPrintOperation *operation, GtkPrintContext *context,
* style doesn't change since it is only one character with multiple bytes. */ * style doesn't change since it is only one character with multiple bytes. */
while (c < 0) while (c < 0)
{ {
c = sci_get_char_at(doc_list[dinfo->idx].sci, dinfo->cur_pos); c = sci_get_char_at(documents[dinfo->idx]->sci, dinfo->cur_pos);
if (c < 0) if (c < 0)
{ /* only add the byte when it is part of the UTF-8 character { /* only add the byte when it is part of the UTF-8 character
* otherwise we could add e.g. a '\n' and it won't be visible in the * otherwise we could add e.g. a '\n' and it won't be visible in the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment