From 34bbe9388eab58e6a7ab25d664595e0ed3b8dee8 Mon Sep 17 00:00:00 2001 From: kidproto Date: Thu, 24 Aug 2006 23:19:11 +0000 Subject: [PATCH] Cleaned up more of the gboolean to bool janitorial task...great! --- src/dialogs/eek-preview.cpp | 37 ++++++++++++++++++++++++++++++++- src/dialogs/eek-preview.h | 6 +++++- src/dialogs/layers-panel.cpp | 2 +- src/document.cpp | 4 ++++ src/extension/internal/pdf.cpp | 2 +- src/extension/system.cpp | 2 +- src/helper/sp-marshal.cpp.mingw | 24 ++++++++++----------- src/message-stack.cpp | 3 ++- src/message-stack.h | 1 + src/sp-style-elem.cpp | 2 +- src/widgets/icon.cpp | 2 ++ src/widgets/sp-xmlview-tree.cpp | 2 ++ src/widgets/toolbox.cpp | 18 ++++++++-------- src/xml/croco-node-iface.cpp | 2 ++ 14 files changed, 79 insertions(+), 28 deletions(-) diff --git a/src/dialogs/eek-preview.cpp b/src/dialogs/eek-preview.cpp index 0108d4777..15b1990f9 100644 --- a/src/dialogs/eek-preview.cpp +++ b/src/dialogs/eek-preview.cpp @@ -100,6 +100,8 @@ static void eek_preview_size_request( GtkWidget* widget, GtkRequisition* req ) gint width = 0; gint height = 0; EekPreview* preview = EEK_PREVIEW(widget); + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean worked = gtk_icon_size_lookup( preview->_size, &width, &height ); if ( !worked ) { width = 16; @@ -121,7 +123,8 @@ enum { static guint eek_preview_signals[LAST_SIGNAL] = { 0 }; - +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) { /* g_message("Exposed!!! %s", GTK_WIDGET_HAS_FOCUS(widget) ? "XXX" : "---" ); */ @@ -268,6 +271,8 @@ gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { @@ -278,6 +283,8 @@ static gboolean eek_preview_enter_cb( GtkWidget* widget, GdkEventCrossing* event return FALSE; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { @@ -289,21 +296,31 @@ static gboolean eek_preview_leave_cb( GtkWidget* widget, GdkEventCrossing* event } /* +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_focus_in_event( GtkWidget* widget, GdkEventFocus* event ) { g_message("focus IN"); + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean blip = parent_class->focus_in_event ? parent_class->focus_in_event(widget, event) : FALSE; return blip; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_focus_out_event( GtkWidget* widget, GdkEventFocus* event ) { g_message("focus OUT"); + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean blip = parent_class->focus_out_event ? parent_class->focus_out_event(widget, event) : FALSE; return blip; } */ +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { @@ -324,6 +341,8 @@ static gboolean eek_preview_button_press_cb( GtkWidget* widget, GdkEventButton* return FALSE; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton* event ) { if ( gtk_get_event_widget( (GdkEvent*)event ) == widget ) { @@ -331,6 +350,8 @@ static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton preview->_hot = FALSE; gtk_widget_set_state( widget, GTK_STATE_NORMAL ); if ( preview->_within && event->button == PRIME_BUTTON_MAGIC_NUMBER ) { + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean isAlt = (event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK; if ( isAlt ) { @@ -343,12 +364,16 @@ static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton return FALSE; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool gboolean eek_preview_key_press_event( GtkWidget* widget, GdkEventKey* event) { g_message("TICK"); return FALSE; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool gboolean eek_preview_key_release_event( GtkWidget* widget, GdkEventKey* event) { g_message("tock"); @@ -387,6 +412,8 @@ static void eek_preview_set_property( GObject *object, case FOCUS_PROP_ID: { EekPreview* preview = EEK_PREVIEW( object ); + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean val = g_value_get_boolean( value ); if ( val != preview->_takesFocus ) { preview->_takesFocus = val; @@ -403,9 +430,13 @@ static void eek_preview_set_property( GObject *object, } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool static gboolean eek_preview_popup_menu( GtkWidget* widget ) { /* g_message("Do the popup!"); */ + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean blip = parent_class->popup_menu ? parent_class->popup_menu(widget) : FALSE; return blip; } @@ -519,11 +550,15 @@ LinkType eek_preview_get_linked( EekPreview* splat ) return (LinkType)splat->_linked; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool gboolean eek_preview_get_focus_on_click( EekPreview* preview ) { return preview->_takesFocus; } +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click ) { if ( focus_on_click != preview->_takesFocus ) { diff --git a/src/dialogs/eek-preview.h b/src/dialogs/eek-preview.h index 114be8742..a2799dd8c 100644 --- a/src/dialogs/eek-preview.h +++ b/src/dialogs/eek-preview.h @@ -86,7 +86,9 @@ struct _EekPreview int _r; int _g; int _b; - + + // JON: keeping this gboolean because it is legacy c-based code + // TODO: convert to bool gboolean _hot; gboolean _within; gboolean _takesFocus; @@ -114,6 +116,8 @@ void eek_preview_set_color( EekPreview* splat, int r, int g, int b ); void eek_preview_set_linked( EekPreview* splat, LinkType link ); LinkType eek_preview_get_linked( EekPreview* splat ); +// JON: keeping this gboolean because it is legacy c-based code +// TODO: convert to bool gboolean eek_preview_get_focus_on_click( EekPreview* preview ); void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_click ); diff --git a/src/dialogs/layers-panel.cpp b/src/dialogs/layers-panel.cpp index 3a7463ff3..2f5f4b89c 100644 --- a/src/dialogs/layers-panel.cpp +++ b/src/dialogs/layers-panel.cpp @@ -188,7 +188,7 @@ public: SPObject* _target; }; -static gboolean layers_panel_activated( GtkObject *object, GdkEvent * /*event*/, gpointer data ) +static bool layers_panel_activated( GtkObject *object, GdkEvent * /*event*/, gpointer data ) { if ( data ) { diff --git a/src/document.cpp b/src/document.cpp index 04d3a147c..ebc65830f 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -66,6 +66,8 @@ static gint sp_document_idle_handler(gpointer data); +// JON: This must stay as gboolean because its used as a callback into +// our legacy c stuff in here. Would like to make bool gboolean sp_document_resource_list_free(gpointer key, gpointer value, gpointer data); static gint doc_count = 0; @@ -1106,6 +1108,8 @@ sigc::connection sp_document_resources_changed_connect(SPDocument *document, /* Helpers */ +// JON: This must stay this way because it is used as a callback for +// legacy glib code which needs to be moved to glibmm gboolean sp_document_resource_list_free(gpointer key, gpointer value, gpointer data) { diff --git a/src/extension/internal/pdf.cpp b/src/extension/internal/pdf.cpp index c35e4d217..b732fc723 100644 --- a/src/extension/internal/pdf.cpp +++ b/src/extension/internal/pdf.cpp @@ -225,7 +225,7 @@ PrintPDF::setup(Inkscape::Extension::Print * mod) unsigned int PrintPDF::begin(Inkscape::Extension::Print *mod, SPDocument *doc) { - gboolean epsexport = false; + bool epsexport = false; _latin1_encoded_fonts.clear(); _newlatin1font_proc_defined = false; diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 482d6c5ea..76a6f13e0 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -250,7 +250,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, if (official) { // save the filename for next use sp_document_set_uri(doc, fileName); - gboolean saved = sp_document_get_undo_sensitive(doc); + bool saved = sp_document_get_undo_sensitive(doc); // also save the extension for next use Inkscape::XML::Node *repr = sp_document_repr_root(doc); sp_document_set_undo_sensitive (doc, FALSE); diff --git a/src/helper/sp-marshal.cpp.mingw b/src/helper/sp-marshal.cpp.mingw index 8a7e7648c..adbf0a3c7 100644 --- a/src/helper/sp-marshal.cpp.mingw +++ b/src/helper/sp-marshal.cpp.mingw @@ -65,7 +65,7 @@ sp_marshal_VOID__POINTER_BOOLEAN (GClosure *closure, { typedef void (*GMarshalFunc_VOID__POINTER_BOOLEAN) (gpointer data1, gpointer arg_1, - gboolean arg_2, + bool arg_2, gpointer data2); register GMarshalFunc_VOID__POINTER_BOOLEAN callback; register GCClosure *cc = (GCClosure*) closure; @@ -213,7 +213,7 @@ sp_marshal_VOID__STRING_BOOLEAN (GClosure *closure, { typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, gpointer arg_1, - gboolean arg_2, + bool arg_2, gpointer data2); register GMarshalFunc_VOID__STRING_BOOLEAN callback; register GCClosure *cc = (GCClosure*) closure; @@ -248,12 +248,12 @@ sp_marshal_BOOLEAN__VOID (GClosure *closure, gpointer invocation_hint, gpointer marshal_data) { - typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, + typedef bool (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, gpointer data2); register GMarshalFunc_BOOLEAN__VOID callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; - gboolean v_return; + bool v_return; g_return_if_fail (return_value != NULL); g_return_if_fail (n_param_values == 1); @@ -285,13 +285,13 @@ sp_marshal_BOOLEAN__UINT (GClosure *closure, gpointer invocation_hint, gpointer marshal_data) { - typedef gboolean (*GMarshalFunc_BOOLEAN__UINT) (gpointer data1, + typedef bool (*GMarshalFunc_BOOLEAN__UINT) (gpointer data1, guint arg_1, gpointer data2); register GMarshalFunc_BOOLEAN__UINT callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; - gboolean v_return; + bool v_return; g_return_if_fail (return_value != NULL); g_return_if_fail (n_param_values == 2); @@ -324,13 +324,13 @@ sp_marshal_BOOLEAN__POINTER (GClosure *closure, gpointer invocation_hint, gpointer marshal_data) { - typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1, + typedef bool (*GMarshalFunc_BOOLEAN__POINTER) (gpointer data1, gpointer arg_1, gpointer data2); register GMarshalFunc_BOOLEAN__POINTER callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; - gboolean v_return; + bool v_return; g_return_if_fail (return_value != NULL); g_return_if_fail (n_param_values == 2); @@ -363,14 +363,14 @@ sp_marshal_BOOLEAN__POINTER_UINT (GClosure *closure, gpointer invocation_hint, gpointer marshal_data) { - typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_UINT) (gpointer data1, + typedef bool (*GMarshalFunc_BOOLEAN__POINTER_UINT) (gpointer data1, gpointer arg_1, guint arg_2, gpointer data2); register GMarshalFunc_BOOLEAN__POINTER_UINT callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; - gboolean v_return; + bool v_return; g_return_if_fail (return_value != NULL); g_return_if_fail (n_param_values == 3); @@ -404,14 +404,14 @@ sp_marshal_BOOLEAN__POINTER_POINTER (GClosure *closure, gpointer invocation_hint, gpointer marshal_data) { - typedef gboolean (*GMarshalFunc_BOOLEAN__POINTER_POINTER) (gpointer data1, + typedef bool (*GMarshalFunc_BOOLEAN__POINTER_POINTER) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2); register GMarshalFunc_BOOLEAN__POINTER_POINTER callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; - gboolean v_return; + bool v_return; g_return_if_fail (return_value != NULL); g_return_if_fail (n_param_values == 3); diff --git a/src/message-stack.cpp b/src/message-stack.cpp index ae65e3421..4186970e3 100644 --- a/src/message-stack.cpp +++ b/src/message-stack.cpp @@ -138,7 +138,8 @@ void MessageStack::_emitChanged() { _changed_signal.emit(NORMAL_MESSAGE, NULL); } } - +// JON: this has o stay this way because of legacy use of glib +// would like to change this to bool gboolean MessageStack::_timeout(gpointer data) { Message *m=reinterpret_cast(data); m->timeout_id = 0; diff --git a/src/message-stack.h b/src/message-stack.h index 4741cce1e..bcae24161 100644 --- a/src/message-stack.h +++ b/src/message-stack.h @@ -155,6 +155,7 @@ private: Message *_discard(Message *m); ///< frees a message struct and returns the next such struct in the list void _emitChanged(); ///< emits the "changed" signal + // JON: Have to keep this gboolean for legacy reasons of glib support static gboolean _timeout(gpointer data); ///< callback to expire flashed messages sigc::signal _changed_signal; diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index ff27f3de0..46e63478c 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -272,7 +272,7 @@ end_font_face_cb(CRDocHandler *a_handler) static void property_cb(CRDocHandler *const a_handler, CRString *const a_name, - CRTerm *const a_value, gboolean const a_important) + CRTerm *const a_value, int const a_important) { g_return_if_fail(a_handler && a_name); g_return_if_fail(a_handler->app_data != NULL); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 0fadffdc8..b170d69f8 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -35,6 +35,8 @@ #include "icon.h" +// JON: keeping legacy gboolean because of old code +// TODO: replace gboolean with bool static gboolean icon_prerender_task(gpointer data); static void addPreRender( Inkscape::IconSize lsize, gchar const *name ); diff --git a/src/widgets/sp-xmlview-tree.cpp b/src/widgets/sp-xmlview-tree.cpp index d6fd92d78..578951456 100644 --- a/src/widgets/sp-xmlview-tree.cpp +++ b/src/widgets/sp-xmlview-tree.cpp @@ -41,6 +41,8 @@ static void comment_content_changed (Inkscape::XML::Node * repr, const gchar * o static void tree_move (GtkCTree * tree, GtkCTreeNode * node, GtkCTreeNode * new_parent, GtkCTreeNode * new_sibling); +// JON: Must keep this as gboolean legacy +// TODO: convert to use bool static gboolean check_drag (GtkCTree * tree, GtkCTreeNode * node, GtkCTreeNode * new_parent, GtkCTreeNode * new_sibling); static GtkCTreeNode * ref_to_sibling (GtkCTreeNode * parent, Inkscape::XML::Node * ref); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index e42f58954..f474cd735 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -2941,8 +2941,8 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl) { GtkToggleButton *button = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (tbl), "style-bold")); - gboolean active = gtk_toggle_button_get_active (button); - gboolean check = (query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700); + bool active = gtk_toggle_button_get_active (button); + bool check = (query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700); if (active != check) { @@ -2955,8 +2955,8 @@ sp_text_toolbox_selection_changed (Inkscape::Selection *selection, GObject *tbl) { GtkToggleButton *button = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (tbl), "style-italic")); - gboolean active = gtk_toggle_button_get_active (button); - gboolean check = (query->font_style.computed != SP_CSS_FONT_STYLE_NORMAL); + bool active = gtk_toggle_button_get_active (button); + bool check = (query->font_style.computed != SP_CSS_FONT_STYLE_NORMAL); if (active != check) { @@ -3233,7 +3233,7 @@ sp_text_toolbox_orientation_toggled (GtkRadioButton *button, gtk_widget_grab_focus (GTK_WIDGET(desktop->canvas)); } -gboolean +bool sp_text_toolbox_size_keypress (GtkWidget *w, GdkEventKey *event, gpointer data) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -3253,7 +3253,7 @@ sp_text_toolbox_size_keypress (GtkWidget *w, GdkEventKey *event, gpointer data) return FALSE; } -gboolean +bool sp_text_toolbox_family_keypress (GtkWidget *w, GdkEventKey *event, GObject *tbl) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -3269,7 +3269,7 @@ sp_text_toolbox_family_keypress (GtkWidget *w, GdkEventKey *event, GObject *tbl) return FALSE; } -gboolean +bool sp_text_toolbox_family_list_keypress (GtkWidget *w, GdkEventKey *event, GObject *tbl) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -3364,7 +3364,7 @@ sp_text_toolbox_text_popdown_clicked (GtkButton *button, } } -gboolean +bool sp_text_toolbox_entry_focus_in (GtkWidget *entry, GdkEventFocus *event, GObject *tbl) @@ -3373,7 +3373,7 @@ sp_text_toolbox_entry_focus_in (GtkWidget *entry, return FALSE; } -gboolean +bool sp_text_toolbox_popdown_focus_out (GtkWidget *popdown, GdkEventFocus *event, GObject *tbl) diff --git a/src/xml/croco-node-iface.cpp b/src/xml/croco-node-iface.cpp index 0464e4fb7..17c3495a5 100644 --- a/src/xml/croco-node-iface.cpp +++ b/src/xml/croco-node-iface.cpp @@ -38,6 +38,8 @@ static char *get_attr(CRXMLNodePtr n, char const *a) } static char const *get_local_name(CRXMLNodePtr n) { return local_part(static_cast(n)->name()); } +// JON: Need to keep gboolean to interface with libcroco +// TODO: convert to bool static gboolean is_element_node(CRXMLNodePtr n) { return static_cast(n)->type() == ELEMENT_NODE; } } -- 2.30.2