## util util |

## Synopsis

    #define             SWAMIGUI_SAMPLE_TRANSFORM_SIZE
    void                (*UtilQuickFunc)                    (gpointer userdata,
                                                             GtkWidget *popup);
    #define             SWAMIGUI_UNIT_RGBA_COLOR
    void                swamigui_util_init                  (void);
    guint               swamigui_util_unit_rgba_color_get_type
                                                            (void);
    void                swamigui_util_canvas_line_set       (GnomeCanvasItem *item,
                                                             double x1,
                                                             double y1,
                                                             double x2,
                                                             double y2);
    GtkWidget *         swamigui_util_quick_popup           (gchar *msg,
                                                             gchar *btn1,
                                                             ...);
    GtkWidget *         swamigui_util_lookup_unique_dialog  (gchar *strkey,
                                                             gint key2);
    gboolean            swamigui_util_register_unique_dialog
                                                            (GtkWidget *dialog,
                                                             gchar *strkey,
                                                             gint key2);
    void                swamigui_util_unregister_unique_dialog
                                                            (GtkWidget *dialog);
    gboolean            swamigui_util_activate_unique_dialog
                                                            (gchar *strkey,
                                                             gint key2);
    gpointer            swamigui_util_waitfor_widget_action (GtkWidget *widg);
    void                swamigui_util_widget_action         (GtkWidget *cbwidg,
                                                             gpointer value);
    GtkWidget *         swamigui_util_glade_create          (const char *name);
    GtkWidget *         swamigui_util_glade_lookup          (GtkWidget *widget,
                                                             const char *name);
    GtkWidget *         swamigui_util_glade_lookup_nowarn   (GtkWidget *widget,
                                                             const char *name);
    int                 swamigui_util_option_menu_index     (GtkWidget *opmenu);
    char *              swamigui_util_str_crlf2lf           (char *str);
    char *              swamigui_util_str_lf2crlf           (char *str);
    int                 swamigui_util_substrcmp             (char *sub,
                                                             char *str);

## Description

## Details

### SWAMIGUI_SAMPLE_TRANSFORM_SIZE

    #define SWAMIGUI_SAMPLE_TRANSFORM_SIZE  (64 * 1024)

### UtilQuickFunc ()

    void                (*UtilQuickFunc)                    (gpointer userdata,
                                                             GtkWidget *popup);

### SWAMIGUI_UNIT_RGBA_COLOR

    #define SWAMIGUI_UNIT_RGBA_COLOR  swamigui_util_unit_rgba_color_get_type()

### swamigui_util_init ()

    void                swamigui_util_init                  (void);

### swamigui_util_unit_rgba_color_get_type ()

    guint               swamigui_util_unit_rgba_color_get_type
                                                            (void);

### swamigui_util_canvas_line_set ()

    void                swamigui_util_canvas_line_set       (GnomeCanvasItem *item,
                                                             double x1,
                                                             double y1,
                                                             double x2,
                                                             double y2);

A convenience function to set a GnomeCanvasLine to a single line segment. Can also be used on other GnomeCanvasItem types which have a "points" property.

`line` : | GnomeCanvasLine object or an item with a "points" property
`x1` : | First X coordinate of line
`y1` : | First Y coordinate of line
`x2` : | Second X coordinate of line
`y2` : | Second Y coordinate of line

### swamigui_util_quick_popup ()

    GtkWidget *         swamigui_util_quick_popup           (gchar *msg,
                                                             gchar *btn1,
                                                             ...);

### swamigui_util_lookup_unique_dialog ()

    GtkWidget *         swamigui_util_lookup_unique_dialog  (gchar *strkey,
                                                             gint key2);

### swamigui_util_register_unique_dialog ()

    gboolean            swamigui_util_register_unique_dialog
                                                            (GtkWidget *dialog,
                                                             gchar *strkey,
                                                             gint key2);

### swamigui_util_unregister_unique_dialog ()

    void                swamigui_util_unregister_unique_dialog
                                                            (GtkWidget *dialog);

### swamigui_util_activate_unique_dialog ()

    gboolean            swamigui_util_activate_unique_dialog
                                                            (gchar *strkey,
                                                             gint key2);

### swamigui_util_waitfor_widget_action ()

    gpointer            swamigui_util_waitfor_widget_action (GtkWidget *widg);

### swamigui_util_widget_action ()

    void                swamigui_util_widget_action         (GtkWidget *cbwidg,
                                                             gpointer value);

### swamigui_util_glade_create ()

    GtkWidget *         swamigui_util_glade_create          (const char *name);

Creates a glade widget, by `name`, from the main Swami glade XML file. Prints a warning if the named widget does not exist.

`name` : | Name of the glade widget to create
Returns : | Newly created glade widget or `NULL` on error

### swamigui_util_glade_lookup ()

    GtkWidget *         swamigui_util_glade_lookup          (GtkWidget *widget,
                                                             const char *name);

Find a libglade generated widget, by `name`, via any other widget in the same XML widget tree. A warning is printed if the widget is not found to help with debugging, when a widget is expected. Use `swamigui_util_glade_lookup_nowarn()` to check if the named widget does not exist, and not display a warning.

`widget` : | A libglade generated widget or a child there of.
`name` : | Name of widget in same XML tree as `widget` to get.
Returns : | The widget or `NULL` if not found.

### swamigui_util_glade_lookup_nowarn ()

    GtkWidget *         swamigui_util_glade_lookup_nowarn   (GtkWidget *widget,
                                                             const char *name);

Like `swamigui_util_glade_lookup()` but does not print a warning if named widget is not found.

`widget` : | A libglade generated widget or a child there of.
`name` : | Name of widget in same tree as `widget` to get.
Returns : | The widget or `NULL` if not found.

### swamigui_util_option_menu_index ()

    int                 swamigui_util_option_menu_index     (GtkWidget *opmenu);

### swamigui_util_str_crlf2lf ()

    char *              swamigui_util_str_crlf2lf           (char *str);

Convert all dos newlines ("\r\n") to unix newlines "\n" in a string

`str` : | String to convert
Returns : | New string with converted newlines, should be freed when done with

### swamigui_util_str_lf2crlf ()

    char *              swamigui_util_str_lf2crlf           (char *str);

Convert all unix newlines "\n" to dos newlines ("\r\n") in a string

`str` : | String to convert
Returns : | New string with converted newlines, should be freed when done with

### swamigui_util_substrcmp ()

    int                 swamigui_util_substrcmp             (char *sub,
                                                             char *str);

Search for a sub string in a string

`sub` : | Partial string to search for in str
`str` : | String to search for sub string in
Returns : | `TRUE` if "sub" is found in "str", `FALSE` otherwise