geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

msgwindow.c File Reference
#include "msgwindow.h"
#include "build.h"
#include "document.h"
#include "callbacks.h"
#include "filetypes.h"
#include "keybindings.h"
#include "main.h"
#include "navqueue.h"
#include "prefs.h"
#include "support.h"
#include "ui_utils.h"
#include "utils.h"
#include "vte.h"
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <gdk/gdkkeysyms.h>
Include dependency graph for msgwindow.c:

Go to the source code of this file.

Classes

struct  ParseData
 

Enumerations

enum  {
  MSG_COL_LINE = 0 , MSG_COL_DOC_ID , MSG_COL_COLOR , MSG_COL_STRING ,
  MSG_COL_COUNT
}
 
enum  { COMPILER_COL_COLOR = 0 , COMPILER_COL_STRING , COMPILER_COL_COUNT }
 

Functions

static void prepare_msg_tree_view (void)
 
static void prepare_status_tree_view (void)
 
static void prepare_compiler_tree_view (void)
 
static GtkWidget * create_message_popup_menu (gint type)
 
static gboolean on_msgwin_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static void on_scribble_populate (GtkTextView *textview, GtkMenu *arg1, gpointer user_data)
 
void msgwin_show_hide_tabs (void)
 
void msgwin_set_messages_dir (const gchar *messages_dir)
 Sets the Messages path for opening any parsed filenames without absolute path from message lines. More...
 
static void load_color (const gchar *color_name, GdkColor *color)
 
void msgwin_init (void)
 
void msgwin_finalize (void)
 
static gboolean on_msgwin_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer data)
 
static const GdkColor * get_color (gint msg_color)
 
void msgwin_compiler_add (gint msg_color, const gchar *format,...)
 Adds a formatted message in the compiler tab treeview in the messages window. More...
 
void msgwin_compiler_add_string (gint msg_color, const gchar *msg)
 Adds a new message in the compiler tab treeview in the messages window. More...
 
void msgwin_show_hide (gboolean show)
 
void msgwin_msg_add (gint msg_color, gint line, GeanyDocument *doc, const gchar *format,...)
 Adds a formatted message in the messages tab treeview in the messages window. More...
 
void msgwin_msg_add_string (gint msg_color, gint line, GeanyDocument *doc, const gchar *string)
 Adds a new message in the messages tab treeview in the messages window. More...
 
void msgwin_status_add_string (const gchar *string)
 Logs a new status message without setting the status bar. More...
 
void msgwin_status_add (const gchar *format,...)
 Logs a formatted status message without setting the status bar. More...
 
static void on_message_treeview_clear_activate (GtkMenuItem *menuitem, gpointer user_data)
 
static void on_compiler_treeview_copy_activate (GtkMenuItem *menuitem, gpointer user_data)
 
static void on_compiler_treeview_copy_all_activate (GtkMenuItem *menuitem, gpointer user_data)
 
static void on_hide_message_window (GtkMenuItem *menuitem, gpointer user_data)
 
void msgwin_menu_add_common_items (GtkMenu *menu)
 
static gboolean find_prev_build_dir (GtkTreePath *cur, GtkTreeModel *model, gchar **prefix)
 
static gboolean goto_compiler_file_line (const gchar *fname, gint line, gboolean focus_editor)
 
gboolean msgwin_goto_compiler_file_line (gboolean focus_editor)
 
static void make_absolute (gchar **filename, const gchar *dir)
 
static void parse_file_line (ParseData *data, gchar **filename, gint *line)
 
static void parse_compiler_error_line (const gchar *string, gchar **filename, gint *line)
 
void msgwin_parse_compiler_error_line (const gchar *string, const gchar *dir, gchar **filename, gint *line)
 
static void msgwin_parse_generic_line (const gchar *string, gchar **filename, gint *line)
 
gboolean msgwin_goto_messages_file_line (gboolean focus_editor)
 
void msgwin_switch_tab (gint tabnum, gboolean show)
 Switches to the given notebook tab of the messages window. More...
 
void msgwin_clear_tab (gint tabnum)
 Removes all messages from a tab specified by tabnum in the messages window. More...
 

Variables

MessageWindow msgwindow
 
static GdkColor color_error = {0, 0xFFFF, 0, 0}
 
static GdkColor color_context = {0, 0x7FFF, 0, 0}
 
static GdkColor color_message = {0, 0, 0, 0xD000}
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MSG_COL_LINE 
MSG_COL_DOC_ID 
MSG_COL_COLOR 
MSG_COL_STRING 
MSG_COL_COUNT 

Definition at line 68 of file msgwindow.c.

◆ anonymous enum

anonymous enum
Enumerator
COMPILER_COL_COLOR 
COMPILER_COL_STRING 
COMPILER_COL_COUNT 

Definition at line 77 of file msgwindow.c.

Function Documentation

◆ create_message_popup_menu()

static GtkWidget * create_message_popup_menu ( gint  type)
static

◆ find_prev_build_dir()

static gboolean find_prev_build_dir ( GtkTreePath *  cur,
GtkTreeModel *  model,
gchar **  prefix 
)
static

Definition at line 706 of file msgwindow.c.

References build_parse_make_dir(), COMPILER_COL_STRING, and NULL.

Referenced by msgwin_goto_compiler_file_line().

◆ get_color()

static const GdkColor * get_color ( gint  msg_color)
static

◆ goto_compiler_file_line()

◆ load_color()

static void load_color ( const gchar *  color_name,
GdkColor *  color 
)
static

Definition at line 121 of file msgwindow.c.

References color.

Referenced by msgwin_init().

◆ make_absolute()

static void make_absolute ( gchar **  filename,
const gchar *  dir 
)
static

◆ msgwin_clear_tab()

void msgwin_clear_tab ( gint  tabnum)

Removes all messages from a tab specified by tabnum in the messages window.

Parameters
tabnumAn index of a tab in the messages window which should be cleared. Valid values are MSG_STATUS, MSG_COMPILER and MSG_MESSAGE.
Since
0.15

Definition at line 1328 of file msgwindow.c.

References build_menu_update(), MSG_COMPILER, MSG_MESSAGE, MSG_STATUS, msgwindow, and NULL.

Referenced by on_message_treeview_clear_activate().

◆ msgwin_compiler_add()

void msgwin_compiler_add ( gint  msg_color,
const gchar *  format,
  ... 
)

Adds a formatted message in the compiler tab treeview in the messages window.

Parameters
msg_colorA color to be used for the text. It must be an element of MsgColors.
formatprintf()-style format string.
...Arguments for the format string.
See also
msgwin_compiler_add_string()
Since
0.16

Definition at line 320 of file msgwindow.c.

References format, and msgwin_compiler_add_string().

Referenced by build_spawn_cmd().

◆ msgwin_compiler_add_string()

void msgwin_compiler_add_string ( gint  msg_color,
const gchar *  msg 
)

Adds a new message in the compiler tab treeview in the messages window.

Parameters
msg_colorA color to be used for the text. It must be an element of MsgColors.
msgCompiler message to be added.
See also
msgwin_compiler_add()
Since
1.34 (API 236)

Definition at line 343 of file msgwindow.c.

References color, COMPILER_COL_COLOR, COMPILER_COL_STRING, GeanyInterfacePrefs::compiler_tab_autoscroll, get_color(), interface_prefs, msgwindow, NULL, ui_prefs, and utils_get_utf8_from_locale().

Referenced by msgwin_compiler_add(), process_build_output_line(), and show_build_result_message().

◆ msgwin_finalize()

void msgwin_finalize ( void  )

Definition at line 167 of file msgwindow.c.

References msgwindow.

Referenced by do_main_quit().

◆ msgwin_goto_compiler_file_line()

◆ msgwin_goto_messages_file_line()

◆ msgwin_init()

◆ msgwin_menu_add_common_items()

void msgwin_menu_add_common_items ( GtkMenu *  menu)

Definition at line 689 of file msgwindow.c.

References _, gtk_container_add(), NULL, and on_hide_message_window().

Referenced by create_message_popup_menu(), and on_scribble_populate().

◆ msgwin_msg_add()

void msgwin_msg_add ( gint  msg_color,
gint  line,
GeanyDocument doc,
const gchar *  format,
  ... 
)

Adds a formatted message in the messages tab treeview in the messages window.

If line and doc are set, clicking on this line jumps into the file which is specified by doc into the line specified with line.

Parameters
msg_colorA color to be used for the text. It must be an element of MsgColors.
lineThe document's line where the message belongs to. Set to -1 to ignore.
doc The document. Set to NULL to ignore.
formatprintf()-style format string.
...Arguments for the format string.
See also
msgwin_msg_add_string()
Since
0.16

Definition at line 403 of file msgwindow.c.

References format, line, and msgwin_msg_add_string().

Referenced by find_document_usage(), search_find_usage(), and search_finished().

◆ msgwin_msg_add_string()

void msgwin_msg_add_string ( gint  msg_color,
gint  line,
GeanyDocument doc,
const gchar *  string 
)

Adds a new message in the messages tab treeview in the messages window.

If line and doc are set, clicking on this line jumps into the file which is specified by doc into the line specified with line.

Parameters
msg_colorA color to be used for the text. It must be an element of MsgColors.
lineThe document's line where the message belongs to. Set to -1 to ignore.
doc The document. Set to NULL to ignore.
stringMessage to be added.
See also
msgwin_msg_add()
Since
1.34 (API 236)

Definition at line 433 of file msgwindow.c.

References color, get_color(), GeanyDocument::id, line, MSG_COL_COLOR, MSG_COL_DOC_ID, MSG_COL_LINE, MSG_COL_STRING, msgwin_show_hide(), msgwindow, NULL, ui_prefs, and utils_get_utf8_from_locale().

Referenced by msgwin_msg_add(), read_fif_io(), search_find_in_files(), and search_finished().

◆ msgwin_parse_compiler_error_line()

void msgwin_parse_compiler_error_line ( const gchar *  string,
const gchar *  dir,
gchar **  filename,
gint *  line 
)

◆ msgwin_parse_generic_line()

static void msgwin_parse_generic_line ( const gchar *  string,
gchar **  filename,
gint *  line 
)
static

◆ msgwin_set_messages_dir()

void msgwin_set_messages_dir ( const gchar *  messages_dir)

Sets the Messages path for opening any parsed filenames without absolute path from message lines.

Parameters
messages_dirThe directory.

Definition at line 114 of file msgwindow.c.

References msgwindow.

Referenced by search_find_in_files().

◆ msgwin_show_hide()

◆ msgwin_show_hide_tabs()

◆ msgwin_status_add()

void msgwin_status_add ( const gchar *  format,
  ... 
)

Logs a formatted status message without setting the status bar.

Use ui_set_statusbar() to display text on the statusbar.

Parameters
formatprintf()-style format string.
...Arguments for the format string.
See also
msgwin_status_add_string()
Since
0.12

Definition at line 520 of file msgwindow.c.

References format, and msgwin_status_add_string().

Referenced by document_new_file(), document_open_file_full(), document_save_file(), plugin_check_version(), print_external(), remove_page(), status_changed(), and ui_set_statusbar().

◆ msgwin_status_add_string()

void msgwin_status_add_string ( const gchar *  string)

Logs a new status message without setting the status bar.

Use ui_set_statusbar() to display text on the statusbar.

Parameters
stringStatus message to be logged.
See also
msgwin_status_add()
Since
1.34 (API 236)

Definition at line 481 of file msgwindow.c.

References main_status, MSG_STATUS, msgwindow, NULL, prefs, GeanyPrefs::switch_to_status, and utils_get_current_time_string().

Referenced by msgwin_status_add().

◆ msgwin_switch_tab()

void msgwin_switch_tab ( gint  tabnum,
gboolean  show 
)

Switches to the given notebook tab of the messages window.

The messages window is shown if it was previously hidden and show is set to TRUE.

Parameters
tabnumAn index of a tab in the messages window. Valid values are all elements of MessageWindowTabNum.
showWhether to show the messages window at all if it was hidden before.
Since
0.15

Definition at line 1293 of file msgwindow.c.

References MSG_COMPILER, MSG_MESSAGE, MSG_SCRATCH, MSG_STATUS, MSG_VTE, msgwin_show_hide(), msgwindow, and NULL.

Referenced by cb_func_switch_action().

◆ on_compiler_treeview_copy_activate()

static void on_compiler_treeview_copy_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)
static

◆ on_compiler_treeview_copy_all_activate()

static void on_compiler_treeview_copy_all_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)
static

◆ on_hide_message_window()

static void on_hide_message_window ( GtkMenuItem *  menuitem,
gpointer  user_data 
)
static

Definition at line 640 of file msgwindow.c.

References msgwin_show_hide().

Referenced by msgwin_menu_add_common_items().

◆ on_message_treeview_clear_activate()

static void on_message_treeview_clear_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)
static

Definition at line 535 of file msgwindow.c.

References msgwin_clear_tab().

Referenced by create_message_popup_menu().

◆ on_msgwin_button_press_event()

static gboolean on_msgwin_button_press_event ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ on_msgwin_key_press_event()

static gboolean on_msgwin_key_press_event ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  data 
)
static

◆ on_scribble_populate()

static void on_scribble_populate ( GtkTextView *  textview,
GtkMenu *  arg1,
gpointer  user_data 
)
static

Definition at line 682 of file msgwindow.c.

References msgwin_menu_add_common_items().

Referenced by msgwin_init().

◆ parse_compiler_error_line()

◆ parse_file_line()

static void parse_file_line ( ParseData data,
gchar **  filename,
gint *  line 
)
static

◆ prepare_compiler_tree_view()

◆ prepare_msg_tree_view()

◆ prepare_status_tree_view()

static void prepare_status_tree_view ( void  )
static

Variable Documentation

◆ color_context

GdkColor color_context = {0, 0x7FFF, 0, 0}
static

Definition at line 86 of file msgwindow.c.

Referenced by get_color(), and msgwin_init().

◆ color_error

GdkColor color_error = {0, 0xFFFF, 0, 0}
static

Definition at line 85 of file msgwindow.c.

Referenced by get_color(), msgwin_goto_compiler_file_line(), and msgwin_init().

◆ color_message

GdkColor color_message = {0, 0, 0, 0xD000}
static

Definition at line 87 of file msgwindow.c.

Referenced by get_color(), and msgwin_init().

◆ msgwindow