annotate src/logwindow.c @ 2909:2e7fd08bfbe4

DEBUG_NAME() function for use with GTKInspector This debug function can be used with GTKInspector to provide a visual indication of where a widget is declared. This is a documentation facility to aid developers new to the project. Sample call: GTK_DEBUG=interactive src/geeqie
author Colin Clark <colin.clark@cclark.uk>
date Thu, 14 Feb 2019 12:05:04 +0000
parents 59db4be809a8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
1 /*
2350
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
2 * Copyright (C) 2008 - 2016 The Geeqie Team
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
3 *
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
4 * Authors: Vladimir Nadvornik, Laurent Monin
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
5 *
2350
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
6 * This program is free software; you can redistribute it and/or modify
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
7 * it under the terms of the GNU General Public License as published by
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
9 * (at your option) any later version.
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
10 *
2350
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
11 * This program is distributed in the hope that it will be useful,
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
14 * GNU General Public License for more details.
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
15 *
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
16 * You should have received a copy of the GNU General Public License along
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
17 * with this program; if not, write to the Free Software Foundation, Inc.,
95507e596256 Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents: 2185
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
19 */
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
20
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
21 #include "main.h"
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
22 #include "logwindow.h"
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
23
1022
d09059a8b243 Move miscellaneous functions to their own files (new misc.[ch]).
Laurent Monin <geeqie@norz.org>
parents: 767
diff changeset
24 #include "misc.h"
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
25 #include "secure_save.h"
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
26 #include "ui_misc.h"
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
27 #include "window.h"
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
28
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
29 #include <gdk/gdkkeysyms.h>
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
30
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
31
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
32 typedef struct _LogWindow LogWindow;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
33
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
34 struct _LogWindow
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
35 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
36 GtkWidget *window;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
37 GtkWidget *scrolledwin;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
38 GtkWidget *text;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2132
diff changeset
39
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
40 #if !GTK_CHECK_VERSION(3,0,0)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
41 GdkColor colors[LOG_COUNT];
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
42 #else
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
43 GtkTextTag *color_tags[LOG_COUNT];
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
44 #endif
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
45
736
31d858f3272d Fix signed vs unsigned warnings.
Laurent Monin <geeqie@norz.org>
parents: 718
diff changeset
46 guint lines;
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
47 GtkWidget *regexp_box;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
48 GtkWidget *bar;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
49 GtkWidget *pause;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
50 GtkWidget *wrap;
2596
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
51 GtkWidget *timer_data;
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
52 GtkWidget *debug_level;
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
53 };
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
54
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
55 #if !GTK_CHECK_VERSION(3,0,0)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
56 typedef struct _LogDef LogDef;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
57 struct _LogDef
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
58 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
59 LogType type;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
60 const gchar *tag;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
61 const gchar *color;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
62 };
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
63
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
64 /* Keep LogType order !! */
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
65 static LogDef logdefs[LOG_COUNT] = {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
66 { LOG_NORMAL, "normal", "black" },
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
67 { LOG_MSG, "message", "blue" },
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
68 { LOG_WARN, "warning", "orange" },
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
69 { LOG_ERROR, "error", "red" },
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
70 };
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
71 #endif
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
72
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
73 static LogWindow *logwindow = NULL;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
74
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
75 static void hide_cb(GtkWidget *widget, LogWindow *logwin)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
76 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
77 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
78
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
79 static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event,
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
80 LogWindow *logwin)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
81 {
2036
472c094c0154 changed GDK_<key> to GDK_KEY_<key>
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 2035
diff changeset
82 if (event && event->keyval == GDK_KEY_Escape)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
83 gtk_widget_hide(logwin->window);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
84 return FALSE;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
85 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
86
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
87
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
88 static void log_window_pause_cb(GtkWidget *widget, gpointer data)
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
89 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
90 options->log_window.paused = !options->log_window.paused;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
91 }
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
92
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
93 static void log_window_line_wrap_cb(GtkWidget *widget, gpointer data)
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
94 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
95 LogWindow *logwin = data;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
96
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
97 options->log_window.line_wrap = !options->log_window.line_wrap;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
98
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
99 if (options->log_window.line_wrap)
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
100 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
101 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(logwin->text), GTK_WRAP_WORD);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
102 }
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
103 else
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
104 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
105 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(logwin->text), GTK_WRAP_NONE);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
106 }
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
107 }
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
108
2596
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
109 static void log_window_timer_data_cb(GtkWidget *widget, gpointer data)
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
110 {
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
111 options->log_window.timer_data = !options->log_window.timer_data;
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
112 }
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
113
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
114 static void log_window_regexp_cb(GtkWidget *text_entry, gpointer data)
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
115 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
116 gchar *new_regexp;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
117
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
118 new_regexp = g_strdup(gtk_entry_get_text(GTK_ENTRY(text_entry)));
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
119 set_regexp(new_regexp);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
120 g_free(new_regexp);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
121 }
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
122
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
123 static void log_window_debug_spin_cb(GtkSpinButton *debug_level, gpointer data)
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
124 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
125 set_debug_level(gtk_spin_button_get_value(debug_level));
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
126 }
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
127
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
128 static LogWindow *log_window_create(LayoutWindow *lw)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
129 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
130 LogWindow *logwin;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
131 GtkWidget *window;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
132 GtkWidget *scrolledwin;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
133 GtkWidget *text;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
134 GtkTextBuffer *buffer;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
135 GtkTextIter iter;
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
136 GtkWidget *win_vbox;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
137 GtkWidget *textbox;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
138 GtkWidget *hbox;
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
139
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
140 logwin = g_new0(LogWindow, 1);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
141
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
142 window = window_new(GTK_WINDOW_TOPLEVEL, "log", NULL, NULL, _("Log"));
2909
2e7fd08bfbe4 DEBUG_NAME() function for use with GTKInspector
Colin Clark <colin.clark@cclark.uk>
parents: 2751
diff changeset
143 DEBUG_NAME(window);
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
144 win_vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
145 gtk_container_add(GTK_CONTAINER(window), win_vbox);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
146 gtk_widget_show(win_vbox);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
147
2559
2b49bbaa9045 Fix compatibility problems with log window
Colin Clark <colin.clark@cclark.uk>
parents: 2508
diff changeset
148 gtk_window_resize(GTK_WINDOW(window), lw->options.log_window.w,
2b49bbaa9045 Fix compatibility problems with log window
Colin Clark <colin.clark@cclark.uk>
parents: 2508
diff changeset
149 lw->options.log_window.h);
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
150 gtk_window_move(GTK_WINDOW(window), lw->options.log_window.x, lw->options.log_window.y);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
151
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
152 g_signal_connect(G_OBJECT(window), "delete_event",
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
153 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
154 g_signal_connect(G_OBJECT(window), "key_press_event",
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
155 G_CALLBACK(key_pressed), logwin);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
156 g_signal_connect(G_OBJECT(window), "hide",
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
157 G_CALLBACK(hide_cb), logwin);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
158 gtk_widget_realize(window);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
159
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
160 scrolledwin = gtk_scrolled_window_new(NULL, NULL);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
161 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
162 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
163 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
164 GTK_SHADOW_IN);
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
165
2559
2b49bbaa9045 Fix compatibility problems with log window
Colin Clark <colin.clark@cclark.uk>
parents: 2508
diff changeset
166 gtk_box_pack_start(GTK_BOX(win_vbox), scrolledwin, TRUE, TRUE, 0);
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
167 gtk_widget_show(scrolledwin);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
168
2751
59db4be809a8 Log window - do not show buttons when debug is disabled
Colin Clark <colin.clark@cclark.uk>
parents: 2606
diff changeset
169 #ifdef DEBUG
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
170 hbox = pref_box_new(win_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
171
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
172 gtk_widget_show(hbox);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
173 logwin->debug_level = pref_spin_new_mnemonic(hbox, _("Debug level:"), NULL,
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
174 0, 4, 1, 1, get_debug_level(),G_CALLBACK(log_window_debug_spin_cb),
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
175 logwin->debug_level );
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
176
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
177 logwin->pause = pref_button_new(hbox, NULL, "Pause", FALSE,
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
178 G_CALLBACK(log_window_pause_cb), NULL);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
179
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
180 logwin->wrap = pref_button_new(hbox, NULL, "Line wrap", FALSE,
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
181 G_CALLBACK(log_window_line_wrap_cb), logwin);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
182
2596
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
183 logwin->timer_data = pref_button_new(hbox, NULL, "Timer data", FALSE,
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
184 G_CALLBACK(log_window_timer_data_cb), logwin);
9c435c86a296 Optional timer data in log window
Colin Clark <colin.clark@cclark.uk>
parents: 2559
diff changeset
185
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
186 pref_label_new(hbox, "Filter regexp");
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
187
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
188 textbox = gtk_entry_new();
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
189 gtk_container_add(GTK_CONTAINER(hbox), textbox);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
190 gtk_widget_show(textbox);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
191 g_signal_connect(G_OBJECT(textbox), "activate",
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
192 G_CALLBACK(log_window_regexp_cb), logwin);
2751
59db4be809a8 Log window - do not show buttons when debug is disabled
Colin Clark <colin.clark@cclark.uk>
parents: 2606
diff changeset
193 #endif
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
194
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
195 text = gtk_text_view_new();
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
196 gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
197 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
198 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
199 gtk_text_buffer_get_start_iter(buffer, &iter);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
200 gtk_text_buffer_create_mark(buffer, "end", &iter, FALSE);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
201 gtk_container_add(GTK_CONTAINER(scrolledwin), text);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
202 gtk_widget_show(text);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
203
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
204 logwin->window = window;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
205 logwin->scrolledwin = scrolledwin;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
206 logwin->text = text;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
207 logwin->lines = 1;
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
208 logwin->regexp_box = textbox;
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
209 lw->log_window = logwin->window;
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
210 return logwin;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
211 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
212
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
213 static void log_window_init(LogWindow *logwin)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
214 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
215 GtkTextBuffer *buffer;
2035
4321c486aec7 use cairo for drawing
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 2034
diff changeset
216 #if !GTK_CHECK_VERSION(3,0,0)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
217 GdkColormap *colormap;
2132
e8df5a39862c Silent a warning when compiling with GTK+ >= 3.0.0.
Laurent Monin <zas@norz.org>
parents: 2106
diff changeset
218 gboolean success[LOG_COUNT];
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
219 gint i;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
220
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
221 g_assert(logwin != NULL);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
222 g_assert(logwin->colors != NULL);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
223 for (i = LOG_NORMAL; i < LOG_COUNT; i++)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
224 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
225 gboolean ok = gdk_color_parse(logdefs[i].color, &logwin->colors[i]);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
226 if (ok == TRUE) continue;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
227
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
228 if (i == LOG_NORMAL) return;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
229 memcpy(&logwin->colors[i], &logwin->colors[LOG_NORMAL], sizeof(GdkColor));
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
230 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
231
2034
9297985567b5 use accessor functions
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 2021
diff changeset
232 colormap = gdk_drawable_get_colormap(gtk_widget_get_window(logwin->window));
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
233 gdk_colormap_alloc_colors(colormap, logwin->colors, LOG_COUNT, FALSE, TRUE, success);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
234
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
235 for (i = LOG_NORMAL; i < LOG_COUNT; i++)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
236 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
237 if (success[i] == FALSE)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
238 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
239 GtkStyle *style;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
240 gint j;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
241
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
242 g_warning("LogWindow: color allocation failed\n");
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
243 style = gtk_widget_get_style(logwin->window);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
244 for (j = LOG_NORMAL; j < LOG_COUNT; j++)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
245 logwin->colors[j] = style->black;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
246 break;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
247 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
248 }
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
249
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
250 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
251 for (i = LOG_NORMAL; i < LOG_COUNT; i++)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
252 gtk_text_buffer_create_tag(buffer, logdefs[i].tag,
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
253 "foreground-gdk", &logwin->colors[i],
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
254 "family", "MonoSpace",
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
255 NULL);
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
256 #else
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
257 g_assert(logwin != NULL);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
258
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
259 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
260
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
261 logwin->color_tags[LOG_NORMAL] = gtk_text_buffer_create_tag (buffer,
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
262 "black_foreground", "foreground", "black",
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
263 "family", "MonoSpace", NULL);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
264 logwin->color_tags[LOG_MSG] = gtk_text_buffer_create_tag (buffer,
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
265 "blue_foreground", "foreground", "blue",
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
266 "family", "MonoSpace", NULL);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
267 logwin->color_tags[LOG_WARN] = gtk_text_buffer_create_tag (buffer,
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
268 "orange_foreground", "foreground", "orange",
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
269 "family", "MonoSpace", NULL);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
270 logwin->color_tags[LOG_ERROR] = gtk_text_buffer_create_tag (buffer,
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
271 "red_foreground", "foreground", "red",
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
272 "family", "MonoSpace", NULL);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
273 #endif
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
274 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
275
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
276 static void log_window_show(LogWindow *logwin)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
277 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
278 GtkTextView *text = GTK_TEXT_VIEW(logwin->text);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
279 GtkTextBuffer *buffer;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
280 GtkTextMark *mark;
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
281 gchar *regexp;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2132
diff changeset
282
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
283 g_assert(logwin != NULL);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
284
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
285 buffer = gtk_text_view_get_buffer(text);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
286 mark = gtk_text_buffer_get_mark(buffer, "end");
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
287 gtk_text_view_scroll_mark_onscreen(text, mark);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
288
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
289 gtk_window_present(GTK_WINDOW(logwin->window));
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
290
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
291 log_window_append("", LOG_NORMAL); // to flush memorized lines
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
292
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
293 regexp = g_strdup(get_regexp());
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
294 if (regexp != NULL)
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
295 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
296 gtk_entry_set_text(GTK_ENTRY(logwin->regexp_box), regexp);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
297 g_free(regexp);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
298 }
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
299 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
300
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
301 void log_window_new(LayoutWindow *lw)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
302 {
681
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
303 if (logwindow == NULL)
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
304 {
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
305 LogWindow *logwin;
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
306
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
307 logwin = log_window_create(lw);
681
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
308 log_window_init(logwin);
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
309 logwindow = logwin;
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
310 }
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
311
681
59dbb3f5f364 Do not create log window more than once.
Laurent Monin <geeqie@norz.org>
parents: 678
diff changeset
312 log_window_show(logwindow);
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
313 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
314
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
315 typedef struct _LogMsg LogMsg;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
316
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
317 struct _LogMsg {
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
318 gchar *text;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
319 LogType type;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
320 };
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
321
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
322 #if !GTK_CHECK_VERSION(3,0,0)
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
323 static void log_window_insert_text(GtkTextBuffer *buffer, GtkTextIter *iter,
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
324 const gchar *text, const gchar *tag)
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
325 {
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
326 gchar *str_utf8;
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
327
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
328 if (!text || !*text) return;
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
329
767
f8ae19e47ef8 Make utf8_validate_or_convert() to always allocate a new string.
Laurent Monin <geeqie@norz.org>
parents: 736
diff changeset
330 str_utf8 = utf8_validate_or_convert(text);
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
331 gtk_text_buffer_insert_with_tags_by_name(buffer, iter, str_utf8, -1, tag, NULL);
767
f8ae19e47ef8 Make utf8_validate_or_convert() to always allocate a new string.
Laurent Monin <geeqie@norz.org>
parents: 736
diff changeset
332 g_free(str_utf8);
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
333 }
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
334 #else
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
335 static void log_window_insert_text(GtkTextBuffer *buffer, GtkTextIter *iter,
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
336 const gchar *text, GtkTextTag *tag)
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
337 {
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
338 gchar *str_utf8;
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
339
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
340 if (!text || !*text) return;
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
341
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
342 str_utf8 = utf8_validate_or_convert(text);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
343 gtk_text_buffer_insert_with_tags(buffer, iter, str_utf8, -1, tag, NULL);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
344 g_free(str_utf8);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
345 }
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
346 #endif
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
347
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
348 void log_window_append(const gchar *str, LogType type)
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
349 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
350 GtkTextView *text;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
351 GtkTextBuffer *buffer;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
352 GtkTextIter iter;
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
353 static GList *memory = NULL;
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
354
718
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
355 if (logwindow == NULL)
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
356 {
718
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
357 if (*str) {
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
358 LogMsg *msg = g_new(LogMsg, 1);
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
359
718
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
360 msg->text = g_strdup(str);
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
361 msg->type = type;
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
362
718
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
363 memory = g_list_prepend(memory, msg);
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
364
2505
d01e5b8e80d9 Eliminate FIXME: Log window line limit
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
365 while (g_list_length(memory) >= options->log_window_lines)
718
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
366 {
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
367 GList *work = g_list_last(memory);
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
368 LogMsg *oldest_msg = work->data;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2132
diff changeset
369
718
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
370 g_free(oldest_msg->text);
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
371 memory = g_list_delete_link(memory, work);
52c8fa6740b5 Fix a segfault occuring when logging an empty message and there is no log window.
Laurent Monin <geeqie@norz.org>
parents: 683
diff changeset
372 }
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
373 }
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
374 return;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
375 }
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
376
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
377 text = GTK_TEXT_VIEW(logwindow->text);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
378 buffer = gtk_text_view_get_buffer(text);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
379
2505
d01e5b8e80d9 Eliminate FIXME: Log window line limit
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
380 if (options->log_window_lines > 0 && logwindow->lines >= options->log_window_lines)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
381 {
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
382 GtkTextIter start, end;
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
383
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
384 gtk_text_buffer_get_start_iter(buffer, &start);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
385 end = start;
2505
d01e5b8e80d9 Eliminate FIXME: Log window line limit
Colin Clark <colin.clark@cclark.uk>
parents: 2350
diff changeset
386 gtk_text_iter_forward_lines(&end, logwindow->lines - options->log_window_lines);
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
387 gtk_text_buffer_delete(buffer, &start, &end);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
388 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
389
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
390 gtk_text_buffer_get_end_iter(buffer, &iter);
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
391
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
392 {
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
393 GList *work = g_list_last(memory);
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
394
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
395 while (work)
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
396 {
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
397 GList *prev;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
398 LogMsg *oldest_msg = work->data;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2132
diff changeset
399
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
400 #if !GTK_CHECK_VERSION(3,0,0)
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
401 log_window_insert_text(buffer, &iter, oldest_msg->text, logdefs[oldest_msg->type].tag);
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
402 #else
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
403 log_window_insert_text(buffer, &iter, oldest_msg->text,
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
404 logwindow->color_tags[oldest_msg->type]);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
405 #endif
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2132
diff changeset
406
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
407 prev = work->prev;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
408 memory = g_list_delete_link(memory, work);
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
409 work = prev;
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
410 }
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
411 }
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
412
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
413 #if !GTK_CHECK_VERSION(3,0,0)
683
ac0cb7232f78 Cleanup and code redundancy reduction.
Laurent Monin <geeqie@norz.org>
parents: 682
diff changeset
414 log_window_insert_text(buffer, &iter, str, logdefs[type].tag);
2601
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
415 #else
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
416 log_window_insert_text(buffer, &iter, str, logwindow->color_tags[type]);
5d2e634fd54f Update log window output
Colin Clark <colin.clark@cclark.uk>
parents: 2596
diff changeset
417 #endif
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
418
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
419 if (!options->log_window.paused)
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
420 {
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
421 if (gtk_widget_get_visible(GTK_WIDGET(text)))
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
422 {
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
423 GtkTextMark *mark;
2185
c14a1d8e6aa4 Trim trailing white spaces on empty lines.
Laurent Monin <zas@norz.org>
parents: 2132
diff changeset
424
2508
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
425 mark = gtk_text_buffer_get_mark(buffer, "end");
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
426 gtk_text_view_scroll_mark_onscreen(text, mark);
a39331032807 Additional debug features
Colin Clark <colin.clark@cclark.uk>
parents: 2505
diff changeset
427 }
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
428 }
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
429
682
d4da000fb687 Memorize text to display in the log window when the window is
Laurent Monin <geeqie@norz.org>
parents: 681
diff changeset
430 logwindow->lines = gtk_text_buffer_get_line_count(buffer);
678
fbb7a20c06b7 Add a log window that shows normal and debug messages. For now, it was added to Help menu.
Laurent Monin <geeqie@norz.org>
parents:
diff changeset
431 }
1055
4bbdfab3c89a Adding a vim modeline to all files - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents: 1022
diff changeset
432 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */