Moved UI related utils from utils.c to ui_utils.c
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@790 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
dff3122273
commit
a63fc1e40e
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2006-09-05 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
|
||||
* src/utils.c, src/utils.h, src/ui_utils.c, src/ui_utils.h,
|
||||
src/keybindings.c, src/about.c, src/treeviews.c, src/msgwindow.c,
|
||||
src/callbacks.c, src/notebook.c, src/sci_cb.c, src/keyfile.c,
|
||||
src/vte.c, src/document.c, src/prefs.c, src/main.c,
|
||||
po/POTFILES.in, src/Makefile.am, src/makefile.win32:
|
||||
Moved UI related utils from utils.c to ui_utils.c.
|
||||
|
||||
|
||||
2006-09-04 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
|
||||
* src/keyfile.c, src/main.c, src/main.h:
|
||||
|
@ -7,6 +7,7 @@ src/support.c
|
||||
src/dialogs.c
|
||||
src/document.c
|
||||
src/utils.c
|
||||
src/ui_utils.c
|
||||
src/filetypes.c
|
||||
src/highlighting.c
|
||||
src/win32.c
|
||||
|
@ -26,6 +26,7 @@ SRCS = \
|
||||
sciwrappers.c sciwrappers.h \
|
||||
document.c document.h \
|
||||
utils.c utils.h \
|
||||
ui_utils.c ui_utils.h \
|
||||
support.c support.h \
|
||||
interface.c interface.h \
|
||||
callbacks.c callbacks.h
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "about.h"
|
||||
#include "geany.h"
|
||||
#include "utils.h"
|
||||
#include "ui_utils.h"
|
||||
#include "support.h"
|
||||
|
||||
static GtkWidget *gb_window = NULL;
|
||||
@ -130,7 +131,7 @@ static GtkWidget *create_dialog(void)
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), header_eventbox, FALSE, FALSE, 0);
|
||||
|
||||
// set image
|
||||
icon = utils_new_pixbuf_from_inline(GEANY_IMAGE_LOGO, FALSE);
|
||||
icon = ui_new_pixbuf_from_inline(GEANY_IMAGE_LOGO, FALSE);
|
||||
gtk_image_set_from_pixbuf(GTK_IMAGE(header_image), icon);
|
||||
gtk_window_set_icon(GTK_WINDOW(dialog), icon);
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "document.h"
|
||||
#include "sciwrappers.h"
|
||||
#include "sci_cb.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "dialogs.h"
|
||||
#include "about.h"
|
||||
@ -270,8 +271,8 @@ on_save_all1_activate (GtkMenuItem *menuitem,
|
||||
else
|
||||
document_save_file(idx, FALSE);
|
||||
}
|
||||
utils_update_tag_list(cur_idx, TRUE);
|
||||
utils_set_window_title(cur_idx);
|
||||
ui_update_tag_list(cur_idx, TRUE);
|
||||
ui_set_window_title(cur_idx);
|
||||
}
|
||||
|
||||
|
||||
@ -321,8 +322,8 @@ on_edit1_activate (GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint idx = document_get_cur_idx();
|
||||
utils_update_menu_copy_items(idx);
|
||||
utils_update_insert_include_item(idx, 1);
|
||||
ui_update_menu_copy_items(idx);
|
||||
ui_update_insert_include_item(idx, 1);
|
||||
}
|
||||
|
||||
|
||||
@ -504,7 +505,7 @@ on_reload_as_activate (GtkMenuItem *menuitem,
|
||||
{
|
||||
document_reload_file(idx, charset);
|
||||
if (charset != NULL)
|
||||
utils_update_statusbar(idx, -1);
|
||||
ui_update_statusbar(idx, -1);
|
||||
}
|
||||
g_free(basename);
|
||||
}
|
||||
@ -632,7 +633,7 @@ on_toolbar_large_icons1_activate (GtkMenuItem *menuitem,
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
app->toolbar_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
utils_update_toolbar_icons(GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
ui_update_toolbar_icons(GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
}
|
||||
|
||||
|
||||
@ -643,7 +644,7 @@ on_toolbar_small_icons1_activate (GtkMenuItem *menuitem,
|
||||
if (ignore_toolbar_toggle) return;
|
||||
|
||||
app->toolbar_icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
utils_update_toolbar_icons(GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
ui_update_toolbar_icons(GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
}
|
||||
|
||||
|
||||
@ -733,11 +734,11 @@ on_notebook1_switch_page (GtkNotebook *notebook,
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx));
|
||||
|
||||
document_set_text_changed(idx);
|
||||
utils_document_show_hide(idx); // update the document menu
|
||||
utils_build_show_hide(idx);
|
||||
utils_update_statusbar(idx, -1);
|
||||
utils_set_window_title(idx);
|
||||
utils_update_tag_list(idx, FALSE);
|
||||
ui_document_show_hide(idx); // update the document menu
|
||||
ui_build_show_hide(idx);
|
||||
ui_update_statusbar(idx, -1);
|
||||
ui_set_window_title(idx);
|
||||
ui_update_tag_list(idx, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -905,10 +906,10 @@ on_file_save_dialog_response (GtkDialog *dialog,
|
||||
utils_replace_filename(idx);
|
||||
document_save_file(idx, TRUE);
|
||||
|
||||
utils_build_show_hide(idx);
|
||||
ui_build_show_hide(idx);
|
||||
|
||||
// finally add current file to recent files menu
|
||||
utils_add_recent_file(doc_list[idx].file_name);
|
||||
ui_add_recent_file(doc_list[idx].file_name);
|
||||
}
|
||||
else gtk_widget_hide(app->save_filesel);
|
||||
}
|
||||
@ -935,7 +936,7 @@ on_font_apply_button_clicked (GtkButton *button,
|
||||
|
||||
fontname = gtk_font_selection_dialog_get_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG(app->open_fontsel));
|
||||
utils_set_editor_font(fontname);
|
||||
ui_set_editor_font(fontname);
|
||||
g_free(fontname);
|
||||
}
|
||||
|
||||
@ -1170,7 +1171,7 @@ on_show_toolbar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
if (app->ignore_callback) return;
|
||||
|
||||
app->toolbar_visible = (app->toolbar_visible) ? FALSE : TRUE;;
|
||||
utils_widget_show_hide(GTK_WIDGET(app->toolbar), app->toolbar_visible);
|
||||
ui_widget_show_hide(GTK_WIDGET(app->toolbar), app->toolbar_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -1179,7 +1180,7 @@ on_fullscreen1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->fullscreen = (app->fullscreen) ? FALSE : TRUE;
|
||||
utils_set_fullscreen();
|
||||
ui_set_fullscreen();
|
||||
}
|
||||
|
||||
|
||||
@ -1190,7 +1191,7 @@ on_show_messages_window1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
if (app->ignore_callback) return;
|
||||
|
||||
app->msgwindow_visible = (app->msgwindow_visible) ? FALSE : TRUE;
|
||||
utils_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), app->msgwindow_visible);
|
||||
ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), app->msgwindow_visible);
|
||||
}
|
||||
|
||||
|
||||
@ -1199,7 +1200,7 @@ on_markers_margin1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->show_markers_margin = (app->show_markers_margin) ? FALSE : TRUE;
|
||||
utils_show_markers_margin();
|
||||
ui_show_markers_margin();
|
||||
}
|
||||
|
||||
|
||||
@ -1208,7 +1209,7 @@ on_show_line_numbers1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
app->show_linenumber_margin = (app->show_linenumber_margin) ? FALSE : TRUE;
|
||||
utils_show_linenumber_margin();
|
||||
ui_show_linenumber_margin();
|
||||
}
|
||||
|
||||
|
||||
@ -1236,7 +1237,7 @@ on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
if (idx == -1 || ! doc_list[idx].is_valid) return;
|
||||
doc_list[idx].readonly = ! doc_list[idx].readonly;
|
||||
sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly);
|
||||
utils_update_statusbar(idx, -1);
|
||||
ui_update_statusbar(idx, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1464,13 +1465,13 @@ on_openfiles_tree_popup_clicked (GtkMenuItem *menuitem,
|
||||
case 3:
|
||||
{
|
||||
app->sidebar_openfiles_visible = FALSE;
|
||||
utils_treeviews_showhide(FALSE);
|
||||
ui_treeviews_show_hide(FALSE);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
app->sidebar_visible = FALSE;
|
||||
utils_treeviews_showhide(TRUE);
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1488,13 +1489,13 @@ on_taglist_tree_popup_clicked (GtkMenuItem *menuitem,
|
||||
case 0:
|
||||
{
|
||||
app->sidebar_symbol_visible = FALSE;
|
||||
utils_treeviews_showhide(FALSE);
|
||||
ui_treeviews_show_hide(FALSE);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
app->sidebar_visible = FALSE;
|
||||
utils_treeviews_showhide(TRUE);
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2311,7 +2312,7 @@ on_recent_file_activate (GtkMenuItem *menuitem,
|
||||
gchar *locale_filename = utils_get_locale_from_utf8((gchar*) user_data);
|
||||
|
||||
document_open_file(-1, locale_filename, 0, FALSE, NULL, NULL);
|
||||
utils_recent_file_loaded((gchar*) user_data);
|
||||
ui_recent_file_loaded((gchar*) user_data);
|
||||
|
||||
g_free(locale_filename);
|
||||
}
|
||||
@ -2396,7 +2397,7 @@ on_encoding_change (GtkMenuItem *menuitem,
|
||||
doc_list[idx].encoding = g_strdup(encodings[i].charset);
|
||||
doc_list[idx].changed = TRUE;
|
||||
document_set_text_changed(idx);
|
||||
utils_update_statusbar(idx, -1);
|
||||
ui_update_statusbar(idx, -1);
|
||||
gtk_widget_set_sensitive(lookup_widget(app->window, "menu_write_unicode_bom1"),
|
||||
utils_is_unicode_charset(doc_list[idx].encoding));
|
||||
}
|
||||
@ -2436,7 +2437,7 @@ on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
app->sidebar_symbol_visible = TRUE;
|
||||
app->sidebar_openfiles_visible = TRUE;
|
||||
}
|
||||
utils_treeviews_showhide(TRUE);
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
}
|
||||
|
||||
|
||||
@ -2454,7 +2455,7 @@ on_menu_write_unicode_bom1_toggled (GtkCheckMenuItem *checkmenuitem,
|
||||
|
||||
doc_list[idx].changed = TRUE;
|
||||
document_set_text_changed(idx);
|
||||
utils_update_statusbar(idx, -1);
|
||||
ui_update_statusbar(idx, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "msgwindow.h"
|
||||
#include "templates.h"
|
||||
#include "treeviews.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "encodings.h"
|
||||
#include "notebook.h"
|
||||
@ -179,8 +180,8 @@ void document_change_tab_color(gint index)
|
||||
void document_set_text_changed(gint index)
|
||||
{
|
||||
document_change_tab_color(index);
|
||||
utils_save_buttons_toggle(doc_list[index].changed);
|
||||
utils_set_window_title(index);
|
||||
ui_save_buttons_toggle(doc_list[index].changed);
|
||||
ui_set_window_title(index);
|
||||
}
|
||||
|
||||
|
||||
@ -290,7 +291,7 @@ gint document_create_new_sci(const gchar *filename)
|
||||
g_signal_connect((GtkWidget*) sci, "button-press-event",
|
||||
G_CALLBACK(on_editor_button_press_event), GINT_TO_POINTER(new_idx));
|
||||
|
||||
utils_close_buttons_toggle();
|
||||
ui_close_buttons_toggle();
|
||||
|
||||
// store important pointers in the tab list
|
||||
this->file_name = (filename) ? g_strdup(filename) : NULL;
|
||||
@ -344,12 +345,12 @@ gboolean document_remove(guint page_num)
|
||||
doc_list[idx].tm_file = NULL;
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0)
|
||||
{
|
||||
utils_update_tag_list(-1, FALSE);
|
||||
ui_update_tag_list(-1, FALSE);
|
||||
//on_notebook1_switch_page(GTK_NOTEBOOK(app->notebook), NULL, 0, NULL);
|
||||
utils_set_window_title(-1);
|
||||
utils_save_buttons_toggle(FALSE);
|
||||
utils_close_buttons_toggle();
|
||||
utils_build_show_hide(-1);
|
||||
ui_set_window_title(-1);
|
||||
ui_save_buttons_toggle(FALSE);
|
||||
ui_close_buttons_toggle();
|
||||
ui_build_show_hide(-1);
|
||||
}
|
||||
}
|
||||
else geany_debug("Error: idx: %d page_num: %d", idx, page_num);
|
||||
@ -383,13 +384,13 @@ void document_new_file(filetype *ft)
|
||||
//document_set_filetype(idx, (ft == NULL) ? filetypes[GEANY_FILETYPES_ALL] : ft);
|
||||
document_set_filetype(idx, ft);
|
||||
if (ft == NULL) filetypes[GEANY_FILETYPES_ALL]->style_func_ptr(doc_list[idx].sci);
|
||||
utils_set_window_title(idx);
|
||||
utils_build_show_hide(idx);
|
||||
utils_update_tag_list(idx, FALSE);
|
||||
ui_set_window_title(idx);
|
||||
ui_build_show_hide(idx);
|
||||
ui_update_tag_list(idx, FALSE);
|
||||
doc_list[idx].mtime = time(NULL);
|
||||
doc_list[idx].changed = FALSE;
|
||||
document_set_text_changed(idx);
|
||||
utils_document_show_hide(idx); //update the document menu
|
||||
ui_document_show_hide(idx); //update the document menu
|
||||
#ifdef G_OS_WIN32
|
||||
sci_set_eol_mode(doc_list[idx].sci, SC_EOL_CRLF);
|
||||
#else
|
||||
@ -628,7 +629,7 @@ int document_open_file(gint idx, const gchar *filename, gint pos, gboolean reado
|
||||
sci_set_readonly(doc_list[idx].sci, readonly);
|
||||
|
||||
document_set_filetype(idx, use_ft);
|
||||
utils_build_show_hide(idx);
|
||||
ui_build_show_hide(idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -636,13 +637,13 @@ int document_open_file(gint idx, const gchar *filename, gint pos, gboolean reado
|
||||
}
|
||||
|
||||
document_set_text_changed(idx);
|
||||
utils_document_show_hide(idx); //update the document menu
|
||||
ui_document_show_hide(idx); //update the document menu
|
||||
|
||||
g_free(data);
|
||||
|
||||
|
||||
// finally add current file to recent files menu, but not the files from the last session
|
||||
if (! app->opening_session_files) utils_add_recent_file(utf8_filename);
|
||||
if (! app->opening_session_files) ui_add_recent_file(utf8_filename);
|
||||
|
||||
if (reload)
|
||||
msgwin_status_add(_("File %s reloaded."), utf8_filename);
|
||||
@ -794,7 +795,7 @@ void document_save_file(gint idx, gboolean force)
|
||||
gtk_label_set_text(GTK_LABEL(doc_list[idx].tabmenu_label), basename);
|
||||
treeviews_openfiles_update(doc_list[idx].iter, doc_list[idx].file_name);
|
||||
msgwin_status_add(_("File %s saved."), doc_list[idx].file_name);
|
||||
utils_update_statusbar(idx, -1);
|
||||
ui_update_statusbar(idx, -1);
|
||||
treeviews_openfiles_update(doc_list[idx].iter, basename);
|
||||
g_free(basename);
|
||||
#ifdef HAVE_VTE
|
||||
@ -1082,13 +1083,13 @@ void document_update_tag_list(gint idx, gboolean update)
|
||||
tm_workspace_add_object(doc_list[idx].tm_file);
|
||||
if (update)
|
||||
tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
|
||||
utils_update_tag_list(idx, TRUE);
|
||||
ui_update_tag_list(idx, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE))
|
||||
{
|
||||
utils_update_tag_list(idx, TRUE);
|
||||
ui_update_tag_list(idx, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1148,7 +1149,7 @@ void document_set_filetype(gint idx, filetype *type)
|
||||
}
|
||||
}
|
||||
sci_colourise(doc_list[idx].sci, 0, -1);
|
||||
utils_build_show_hide(idx);
|
||||
ui_build_show_hide(idx);
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "keybindings.h"
|
||||
#include "support.h"
|
||||
#include "utils.h"
|
||||
#include "ui_utils.h"
|
||||
#include "document.h"
|
||||
#include "callbacks.h"
|
||||
#include "prefs.h"
|
||||
@ -706,7 +707,7 @@ static void cb_func_toggle_sidebar(void)
|
||||
app->sidebar_symbol_visible = TRUE;
|
||||
}
|
||||
|
||||
utils_treeviews_showhide(TRUE);
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->treeview_notebook), active_page);
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "support.h"
|
||||
#include "keyfile.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "document.h"
|
||||
#include "sciwrappers.h"
|
||||
@ -556,7 +557,7 @@ void configuration_apply_settings()
|
||||
{
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_fullscreen1")), TRUE);
|
||||
app->fullscreen = TRUE;
|
||||
utils_set_fullscreen();
|
||||
ui_set_fullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
27
src/main.c
27
src/main.c
@ -44,6 +44,7 @@
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "document.h"
|
||||
#include "keyfile.h"
|
||||
@ -149,7 +150,7 @@ void geany_debug(gchar const *format, ...)
|
||||
* (all the following code is not perfect but it works for the moment) */
|
||||
static void apply_settings(void)
|
||||
{
|
||||
utils_update_fold_items();
|
||||
ui_update_fold_items();
|
||||
|
||||
// toolbar, message window and sidebar are by default visible, so don't change it if it is true
|
||||
if (! app->toolbar_visible)
|
||||
@ -172,7 +173,7 @@ static void apply_settings(void)
|
||||
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_sidebar1")), FALSE);
|
||||
app->ignore_callback = FALSE;
|
||||
}
|
||||
utils_treeviews_showhide(TRUE);
|
||||
ui_treeviews_show_hide(TRUE);
|
||||
// sets the icon style of the toolbar
|
||||
switch (app->toolbar_icon_style)
|
||||
{
|
||||
@ -202,7 +203,7 @@ static void apply_settings(void)
|
||||
{
|
||||
gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_size);
|
||||
}
|
||||
utils_update_toolbar_icons(app->toolbar_icon_size);
|
||||
ui_update_toolbar_icons(app->toolbar_icon_size);
|
||||
|
||||
// line number and markers margin are by default enabled
|
||||
if (! app->show_markers_margin)
|
||||
@ -238,7 +239,7 @@ static void apply_settings(void)
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), app->tab_pos_sidebar);
|
||||
|
||||
utils_update_toolbar_items();
|
||||
ui_update_toolbar_items();
|
||||
}
|
||||
|
||||
|
||||
@ -546,8 +547,8 @@ gint main(gint argc, gchar **argv)
|
||||
#endif
|
||||
if (no_msgwin) app->msgwindow_visible = FALSE;
|
||||
|
||||
utils_create_insert_menu_items();
|
||||
utils_create_insert_date_menu_items();
|
||||
ui_create_insert_menu_items();
|
||||
ui_create_insert_date_menu_items();
|
||||
keybindings_init();
|
||||
notebook_init();
|
||||
templates_init();
|
||||
@ -560,7 +561,7 @@ gint main(gint argc, gchar **argv)
|
||||
}
|
||||
configuration_read_filetype_extensions();
|
||||
|
||||
gtk_window_set_icon(GTK_WINDOW(app->window), utils_new_pixbuf_from_inline(GEANY_IMAGE_LOGO, FALSE));
|
||||
gtk_window_set_icon(GTK_WINDOW(app->window), ui_new_pixbuf_from_inline(GEANY_IMAGE_LOGO, FALSE));
|
||||
|
||||
// registering some basic events
|
||||
g_signal_connect(G_OBJECT(app->window), "delete_event", G_CALLBACK(on_exit_clicked), NULL);
|
||||
@ -620,8 +621,8 @@ gint main(gint argc, gchar **argv)
|
||||
{
|
||||
if (! configuration_open_files())
|
||||
{
|
||||
utils_update_popup_copy_items(-1);
|
||||
utils_update_popup_reundo_items(-1);
|
||||
ui_update_popup_copy_items(-1);
|
||||
ui_update_popup_reundo_items(-1);
|
||||
}
|
||||
}
|
||||
app->opening_session_files = FALSE;
|
||||
@ -629,14 +630,14 @@ gint main(gint argc, gchar **argv)
|
||||
// open a new file if no other file was opened
|
||||
if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0) document_new_file(NULL);
|
||||
|
||||
utils_close_buttons_toggle();
|
||||
utils_save_buttons_toggle(FALSE);
|
||||
ui_close_buttons_toggle();
|
||||
ui_save_buttons_toggle(FALSE);
|
||||
|
||||
idx = document_get_cur_idx();
|
||||
gtk_widget_grab_focus(GTK_WIDGET(doc_list[idx].sci));
|
||||
gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx));
|
||||
utils_build_show_hide(idx);
|
||||
utils_update_tag_list(idx, FALSE);
|
||||
ui_build_show_hide(idx);
|
||||
ui_update_tag_list(idx, FALSE);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
// hide "Build" menu item, at least until it is available for Windows
|
||||
|
@ -45,7 +45,7 @@ ALL_GTK_LIBS= \
|
||||
CCFLAGS=-Wall -O2 -g -mms-bitfields $(DEFINES) $(INCLUDEDIRS)
|
||||
|
||||
OBJS = treeviews.o templates.o encodings.o about.o prefs.o win32.o build.o msgwindow.o dialogs.o \
|
||||
filetypes.o interface.o main.o support.o callbacks.o utils.o \
|
||||
filetypes.o interface.o main.o support.o callbacks.o utils.o ui_utils.o \
|
||||
highlighting.o sci_cb.o document.o sciwrappers.o keyfile.o keybindings.o search.o notebook.o
|
||||
|
||||
.c.o:
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
#include "msgwindow.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "document.h"
|
||||
|
||||
@ -231,7 +232,7 @@ void msgwin_status_add(gchar const *format, ...)
|
||||
va_end(args);
|
||||
|
||||
// display status message in status bar
|
||||
utils_set_statusbar(string, FALSE);
|
||||
ui_set_statusbar(string, FALSE);
|
||||
|
||||
gtk_list_store_append(msgwindow.store_status, &iter);
|
||||
//gtk_list_store_insert(msgwindow.store_status, &iter, 0);
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "geany.h"
|
||||
#include "notebook.h"
|
||||
#include "document.h"
|
||||
#include "utils.h"
|
||||
#include "ui_utils.h"
|
||||
#include "treeviews.h"
|
||||
|
||||
#define GEANY_DND_NOTEBOOK_TAB_TYPE "geany_dnd_notebook_tab"
|
||||
@ -257,7 +257,7 @@ gint notebook_new_tab(gint doc_idx, gchar *title, GtkWidget *page)
|
||||
hbox = gtk_hbox_new(FALSE, 0);
|
||||
but = gtk_button_new();
|
||||
gtk_container_add(GTK_CONTAINER(but),
|
||||
utils_new_image_from_inline(GEANY_IMAGE_SMALL_CROSS, FALSE));
|
||||
ui_new_image_from_inline(GEANY_IMAGE_SMALL_CROSS, FALSE));
|
||||
gtk_container_set_border_width(GTK_CONTAINER(but), 0);
|
||||
gtk_widget_set_size_request(but, 19, 18);
|
||||
|
||||
|
11
src/prefs.c
11
src/prefs.c
@ -29,6 +29,7 @@
|
||||
#include "prefs.h"
|
||||
#include "support.h"
|
||||
#include "dialogs.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "msgwindow.h"
|
||||
#include "sciwrappers.h"
|
||||
@ -495,7 +496,7 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_folding");
|
||||
app->pref_editor_folding = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
utils_update_fold_items();
|
||||
ui_update_fold_items();
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_indent");
|
||||
app->pref_editor_show_indent_guide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
@ -607,10 +608,10 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
|
||||
#endif
|
||||
|
||||
// apply the changes made
|
||||
utils_update_toolbar_items();
|
||||
utils_update_toolbar_icons(app->toolbar_icon_size);
|
||||
ui_update_toolbar_items();
|
||||
ui_update_toolbar_icons(app->toolbar_icon_size);
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_style);
|
||||
utils_treeviews_showhide(FALSE);
|
||||
ui_treeviews_show_hide(FALSE);
|
||||
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), app->tab_pos_editor);
|
||||
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin);
|
||||
@ -714,7 +715,7 @@ void on_prefs_font_choosed(GtkFontButton *widget, gpointer user_data)
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
utils_set_editor_font(fontbtn);
|
||||
ui_set_editor_font(fontbtn);
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_VTE
|
||||
|
11
src/sci_cb.c
11
src/sci_cb.c
@ -30,6 +30,7 @@
|
||||
#include "sci_cb.h"
|
||||
#include "document.h"
|
||||
#include "sciwrappers.h"
|
||||
#include "ui_utils.h"
|
||||
#include "utils.h"
|
||||
#include "main.h"
|
||||
|
||||
@ -70,9 +71,9 @@ on_editor_button_press_event (GtkWidget *widget,
|
||||
sci_cb_find_current_word(doc_list[idx].sci, editor_info.click_pos,
|
||||
current_word, sizeof current_word);
|
||||
|
||||
utils_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
|
||||
utils_update_popup_copy_items(idx);
|
||||
utils_update_insert_include_item(idx, 0);
|
||||
ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE);
|
||||
ui_update_popup_copy_items(idx);
|
||||
ui_update_insert_include_item(idx, 0);
|
||||
gtk_menu_popup(GTK_MENU(app->popup_menu), NULL, NULL, NULL, NULL, event->button, event->time);
|
||||
|
||||
return TRUE;
|
||||
@ -131,12 +132,12 @@ void on_editor_notification(GtkWidget *editor, gint scn, gpointer lscn, gpointer
|
||||
gint pos = sci_get_current_position(sci);
|
||||
|
||||
// undo / redo menu update
|
||||
utils_update_popup_reundo_items(idx);
|
||||
ui_update_popup_reundo_items(idx);
|
||||
|
||||
// brace highlighting
|
||||
sci_cb_highlight_braces(sci, pos);
|
||||
|
||||
utils_update_statusbar(idx, pos);
|
||||
ui_update_statusbar(idx, pos);
|
||||
|
||||
#if 0
|
||||
/// experimental code for inverting selections
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "geany.h"
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
#include "utils.h"
|
||||
#include "treeviews.h"
|
||||
#include "document.h"
|
||||
|
||||
|
1050
src/ui_utils.c
Normal file
1050
src/ui_utils.c
Normal file
File diff suppressed because it is too large
Load Diff
97
src/ui_utils.h
Normal file
97
src/ui_utils.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* ui_utils.h - this file is part of Geany, a fast and lightweight IDE
|
||||
*
|
||||
* Copyright 2006 Enrico Troeger <enrico.troeger@uvena.de>
|
||||
* Copyright 2006 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef GEANY_UI_UTILS_H
|
||||
#define GEANY_UI_UTILS_H 1
|
||||
|
||||
/* allow_override is TRUE if text can be ignored when another message has been set
|
||||
* that didn't use allow_override and has not timed out. */
|
||||
void ui_set_statusbar(const gchar *text, gboolean allow_override);
|
||||
|
||||
void ui_update_statusbar(gint idx, gint pos);
|
||||
|
||||
|
||||
/* This sets the window title according to the current filename. */
|
||||
void ui_set_window_title(gint index);
|
||||
|
||||
void ui_set_editor_font(const gchar *font_name);
|
||||
|
||||
void ui_set_fullscreen();
|
||||
|
||||
|
||||
void ui_update_tag_list(gint idx, gboolean update);
|
||||
|
||||
|
||||
void ui_update_popup_reundo_items(gint idx);
|
||||
|
||||
void ui_update_popup_copy_items(gint idx);
|
||||
|
||||
void ui_update_popup_goto_items(gboolean enable);
|
||||
|
||||
|
||||
void ui_update_menu_copy_items(gint idx);
|
||||
|
||||
void ui_update_insert_include_item(gint idx, gint item);
|
||||
|
||||
void ui_update_fold_items();
|
||||
|
||||
|
||||
void ui_create_insert_menu_items();
|
||||
|
||||
void ui_create_insert_date_menu_items();
|
||||
|
||||
|
||||
void ui_save_buttons_toggle(gboolean enable);
|
||||
|
||||
void ui_close_buttons_toggle();
|
||||
|
||||
|
||||
void ui_widget_show_hide(GtkWidget *widget, gboolean show);
|
||||
|
||||
void ui_build_show_hide(gint);
|
||||
|
||||
void ui_treeviews_show_hide(gboolean force);
|
||||
|
||||
void ui_document_show_hide(gint idx);
|
||||
|
||||
|
||||
void ui_update_toolbar_icons(GtkIconSize size);
|
||||
|
||||
void ui_update_toolbar_items();
|
||||
|
||||
|
||||
GdkPixbuf *ui_new_pixbuf_from_inline(gint img, gboolean small_img);
|
||||
|
||||
GtkWidget *ui_new_image_from_inline(gint img, gboolean small_img);
|
||||
|
||||
|
||||
void ui_add_recent_file(const gchar *filename);
|
||||
|
||||
void ui_recent_file_loaded(const gchar *filename);
|
||||
|
||||
|
||||
void ui_show_markers_margin();
|
||||
|
||||
void ui_show_linenumber_margin();
|
||||
|
||||
#endif
|
1025
src/utils.c
1025
src/utils.c
File diff suppressed because it is too large
Load Diff
75
src/utils.h
75
src/utils.h
@ -27,28 +27,6 @@
|
||||
|
||||
void utils_start_browser(const gchar *uri);
|
||||
|
||||
/* allow_override is TRUE if text can be ignored when another message has been set
|
||||
* that didn't use allow_override and has not timed out. */
|
||||
void utils_set_statusbar(const gchar *text, gboolean allow_override);
|
||||
|
||||
void utils_update_statusbar(gint idx, gint pos);
|
||||
|
||||
void utils_set_buttons_state(gboolean enable);
|
||||
|
||||
void utils_update_popup_reundo_items(gint idx);
|
||||
|
||||
void utils_update_popup_copy_items(gint idx);
|
||||
|
||||
void utils_update_insert_include_item(gint idx, gint item);
|
||||
|
||||
void utils_update_menu_copy_items(gint idx);
|
||||
|
||||
void utils_update_popup_goto_items(gboolean enable);
|
||||
|
||||
void utils_save_buttons_toggle(gboolean enable);
|
||||
|
||||
void utils_close_buttons_toggle(void);
|
||||
|
||||
/* taken from anjuta, to determine the EOL mode of the file */
|
||||
gint utils_get_line_endings(gchar* buffer, glong size);
|
||||
|
||||
@ -56,11 +34,6 @@ gboolean utils_isbrace(gchar c);
|
||||
|
||||
gboolean utils_is_opening_brace(gchar c);
|
||||
|
||||
/* This sets the window title according to the current filename. */
|
||||
void utils_set_window_title(gint index);
|
||||
|
||||
void utils_set_editor_font(const gchar *font_name);
|
||||
|
||||
const GList *utils_get_tag_list(gint idx, guint tag_types);
|
||||
|
||||
gint utils_get_local_tag(gint idx, const gchar *qual_name);
|
||||
@ -69,26 +42,8 @@ gboolean utils_goto_file_line(const gchar *file, gboolean is_tm_filename, gint l
|
||||
|
||||
gboolean utils_goto_line(gint idx, gint line);
|
||||
|
||||
GdkPixbuf *utils_new_pixbuf_from_inline(gint img, gboolean small_img);
|
||||
|
||||
GtkWidget *utils_new_image_from_inline(gint img, gboolean small_img);
|
||||
|
||||
gint utils_write_file(const gchar *filename, const gchar *text);
|
||||
|
||||
void utils_show_indention_guides(void);
|
||||
|
||||
void utils_show_white_space(void);
|
||||
|
||||
void utils_show_linenumber_margin(void);
|
||||
|
||||
void utils_show_markers_margin(void);
|
||||
|
||||
void utils_show_line_endings(void);
|
||||
|
||||
void utils_set_fullscreen(void);
|
||||
|
||||
void utils_update_tag_list(gint idx, gboolean update);
|
||||
|
||||
gchar *utils_convert_to_utf8(const gchar *buffer, gsize size, gchar **used_encoding);
|
||||
|
||||
gchar *utils_convert_to_utf8_from_charset(const gchar *buffer, gsize size, const gchar *charset);
|
||||
@ -122,10 +77,6 @@ gboolean utils_is_absolute_path(const gchar *path);
|
||||
|
||||
gdouble utils_scale_round(gdouble val, gdouble factor);
|
||||
|
||||
void utils_widget_show_hide(GtkWidget *widget, gboolean show);
|
||||
|
||||
void utils_build_show_hide(gint);
|
||||
|
||||
/* (taken from libexo from os-cillation)
|
||||
* NULL-safe string comparison. Returns TRUE if both a and b are
|
||||
* NULL or if a and b refer to valid strings which are equal.
|
||||
@ -139,7 +90,7 @@ gchar *utils_remove_ext_from_filename(const gchar *filename);
|
||||
|
||||
gchar utils_brace_opposite(gchar ch);
|
||||
|
||||
gchar *utils_get_hostname(void);
|
||||
gchar *utils_get_hostname();
|
||||
|
||||
gint utils_make_settings_dir(const gchar *dir, const gchar *data_dir, const gchar *doc_dir);
|
||||
|
||||
@ -147,22 +98,12 @@ gchar *utils_str_replace(gchar *haystack, const gchar *needle, const gchar *repl
|
||||
|
||||
gint utils_strpos(const gchar* haystack, const gchar * needle);
|
||||
|
||||
gchar *utils_get_date_time(void);
|
||||
gchar *utils_get_date_time();
|
||||
|
||||
gchar *utils_get_date(void);
|
||||
|
||||
void utils_create_insert_menu_items(void);
|
||||
|
||||
void utils_create_insert_date_menu_items(void);
|
||||
gchar *utils_get_date();
|
||||
|
||||
gchar *utils_get_initials(gchar *name);
|
||||
|
||||
void utils_update_toolbar_icons(GtkIconSize size);
|
||||
|
||||
void utils_add_recent_file(const gchar *filename);
|
||||
|
||||
void utils_recent_file_loaded(const gchar *filename);
|
||||
|
||||
gboolean utils_get_setting_boolean(GKeyFile *config, const gchar *section, const gchar *key, const gboolean default_value);
|
||||
|
||||
gint utils_get_setting_integer(GKeyFile *config, const gchar *section, const gchar *key, const gint default_value);
|
||||
@ -177,17 +118,13 @@ gint utils_compare_symbol(const GeanySymbol *a, const GeanySymbol *b);
|
||||
|
||||
gchar *utils_get_hex_from_color(GdkColor *color);
|
||||
|
||||
void utils_treeviews_showhide(gboolean force);
|
||||
|
||||
gchar *utils_get_current_file_dir();
|
||||
|
||||
void utils_beep(void);
|
||||
void utils_beep();
|
||||
|
||||
gchar *utils_make_human_readable_str(unsigned long long size, unsigned long block_size,
|
||||
unsigned long display_unit);
|
||||
|
||||
void utils_update_fold_items(void);
|
||||
|
||||
/* utils_strtod() converts a string containing a hex colour ("0x00ff00") into an integer.
|
||||
* Basically, it is the same as strtod() would do, but it does not understand hex colour values,
|
||||
* before ANSI-C99. With with_route set, it takes strings of the format "#00ff00". */
|
||||
@ -200,8 +137,6 @@ TMTag *utils_find_tm_tag(const GPtrArray *tags, const gchar *tag_name);
|
||||
|
||||
GIOChannel *utils_set_up_io_channel(gint fd, GIOCondition cond, GIOFunc func, gpointer data);
|
||||
|
||||
void utils_update_toolbar_items(void);
|
||||
|
||||
gchar **utils_read_file_in_array(const gchar *filename);
|
||||
|
||||
/* Contributed by Stefan Oltmanns, thanks.
|
||||
@ -212,8 +147,6 @@ gchar *utils_scan_unicode_bom(const gchar *string);
|
||||
|
||||
gboolean utils_is_unicode_charset(const gchar *string);
|
||||
|
||||
void utils_document_show_hide(gint idx);
|
||||
|
||||
/* Wraps a string in place, replacing a space with a newline character.
|
||||
* wrapstart is the minimum position to start wrapping or -1 for default */
|
||||
gboolean utils_wrap_string(gchar *string, gint wrapstart);
|
||||
|
Loading…
x
Reference in New Issue
Block a user