#include "gtk_utils.H"
#include "xml_utils.H"
#include "ui_config.H"
#include <iostream>
#include <glib/gstdio.h>
Functions | |
void | new_object_file () |
Setup for a new object file. | |
void | openfile_dialog (GtkWidget *window) |
Present the user with a dialog to open a new object file. | |
void | saveasfile_dialog (GtkWidget *window) |
Present the user with a dialog to save the object file. | |
gboolean | load_object_file (const gchar *filename) |
Load and parse object file. | |
void | reload_props () |
Reload object properties for main window. | |
void | add_new_autonomous_object () |
Create a new autonomous object and add it to the document tree, then reload the main properties to update the treeview. | |
void | add_new_dynamic_object () |
Create a new dynamic object and add it to the document tree, then reload the main properties to update the treeview. | |
void | add_new_static_object () |
Create a new static object and add it to the document tree, then reload the main properties to update the treeview. | |
void | add_new_mesh_object () |
Create a new mesh object and add it to the document tree, then reload the main properties to update the treeview. | |
xml_node_t | get_selected_object () |
Checks the main object treeview and sets the selected object in ui_config. | |
void | selection_foreach_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) |
Used for finding the selection made from the main object treeview. | |
void | editgoals_selection_foreach_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) |
Used for finding which selections have been made on the goals dialog. | |
gboolean | cell_edited (GtkTreeIter *iter, GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeModel *tm) |
Will check if a cell was edited with some text. | |
void | update_sensitive_buttons () |
Will update those buttons on the main window that may change sensitivity depending on selection to be unsensitive. | |
int | main (int argc, char **argv) |
Will set program name, init gtk, init interface, and start gtk main loop. | |
gboolean | on_main_map_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Called when the main window is displayed on the screen. | |
gboolean | on_newfile_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Called when the "New" selection is made. Sets up a new object file. | |
gboolean | on_openfile_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Called when the "Open" selection is made. Handles loading of an object file. | |
gboolean | on_savefile_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Called when the "Save" selection is made. Handles saving of the object file to disk. | |
gboolean | on_saveasfile_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Called when the "Save As" selection is made. Handles saving of the object file to disk. | |
void | on_addobject_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when the user wants to add a new object. | |
void | on_editprops_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when the user wants to edit the properties for an object. | |
void | on_editsensors_treeview_cell_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeView *tv) |
Callback for when the user wants to edit a cell on the sensors edit dialog. | |
void | on_editsensors_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when the user wants to edit the sensors for an autonomous object. | |
void | on_editgoals_treeview_cell1_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeView *tv) |
Callback for when the user wants to edit a cell on the goals edit dialog. | |
void | on_editgoals_treeview_cell2_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeView *tv) |
Callback for when the user wants to edit a cell on the goals edit dialog. | |
void | on_editgoals_treeview_cell3_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeView *tv) |
Callback for when the user wants to edit a cell on the goals edit dialog. | |
void | on_editgoals_treeview_cell4_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeView *tv) |
Callback for when the user wants to edit a cell on the goals edit dialog. | |
void | on_editgoals_treeview_cell5_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GtkTreeView *tv) |
Callback for when the user wants to edit a cell on the goals edit dialog. | |
void | on_editgoals_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when the user wants to edit the goals for a dynamic object. | |
void | on_removeobject_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when the user wants to remove an object. | |
void | on_properties_vertices_path_checkbutton_clicked (GtkButton *button, gpointer user_data) |
Callback to toggle between using base and full path for vertices in a mesh object. | |
void | on_properties_indices_path_checkbutton_clicked (GtkButton *button, gpointer user_data) |
Callback to toggle between using base and full path for indices in a mesh object. | |
void | on_properties_vertices_button_clicked (GtkButton *button, gpointer user_data) |
Callback that will display a file chooser dialog for the vertices file in a mesh object. | |
void | on_properties_indices_button_clicked (GtkButton *button, gpointer user_data) |
Callback that will display a file chooser dialog for the indices file in a mesh object. | |
void | on_properties_cancel_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when any properties changes to an object need to be ignored. | |
void | on_properties_save_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when any properties changes to an object need to be saved and updated to the xml doc. | |
void | on_editsensors_treeview_cursor_changed (GtkTreeView *tree_view, gpointer user_data) |
Callback for when a different sensor selection is made on the edit sensors dialog. | |
void | on_editsensors_add_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a sensor is added to an autonomous object. | |
void | on_editsensors_edit_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a sensor is edited for an autonomous object. | |
void | on_editsensors_remove_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a sensor is removed from an autonomous object. | |
void | on_editsensors_cancel_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when any sensor changes to an autonomous object need to be ignored. | |
void | on_editsensors_save_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when any sensor changes to an autonomous object need to be saved and updated to the xml doc. | |
void | on_editgoals_treeview_cursor_changed (GtkTreeView *tree_view, gpointer user_data) |
Callback for when a different goal selection is made on the edit goals dialog. | |
void | on_editgoals_add_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a goal is added to a dynamic object. | |
void | on_editgoals_addrange_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a range of goals is added to a dynamic object. | |
void | on_editgoals_up_button_clicked (GtkButton *button, gpointer user_data) |
Will move the current selection of goals up, before the previous goals. | |
void | on_editgoals_down_button_clicked (GtkButton *button, gpointer user_data) |
Will move the current selection of goals down, after the previous goals. | |
void | on_editgoals_edit_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a goal is edited for a dynamic object. | |
void | on_editgoals_remove_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a goal or set of goals are removed from a dynamic object. | |
void | on_editgoals_cancel_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when any goals changes to a dynamic object need to be ignored. | |
void | on_editgoals_save_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when any goal changes to a dynamic object need to be saved and updated to the xml doc. | |
void | on_editgoalsrange_cancel_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a range of goals to add to a dynamic object is cancelled. | |
void | on_editgoalsrange_save_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when a range of goals to add to a dynamic object is saved. | |
void | on_editgoalsrange_error_ok_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when there was an error in the range of goals dialog. | |
gboolean | on_main_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Callback for when the main window is closed. | |
gboolean | on_quit_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) |
Callback for when the "Quit" selection is chosen. | |
void | on_savefile_ok_button_clicked (GtkButton *button, gpointer user_data) |
Callback for when the file was successfully saved and the user clicked "ok" on the dialog. | |
void | on_objectselect_combobox_changed (GtkButton *button, gpointer user_data) |
Callback for when user makes a selection as to which kind of object to add. | |
void | on_object_treeview_cursor_changed (GtkTreeView *tree_view, gpointer user_data) |
Callback for when a different object selection is made on the main window. | |
Variables | |
const gchar * | progname = NULL |
Program name. | |
ui_config_t | ui_config |
UI configuration helper. | |
GladeXML * | glade_xml |
Glade GUI. |
void add_new_autonomous_object | ( | ) |
Create a new autonomous object and add it to the document tree, then reload the main properties to update the treeview.
The autonomous object is given default values and sensors.
References cajun::ui_config_t::m_object_root, and reload_props().
Referenced by on_objectselect_combobox_changed().
void add_new_dynamic_object | ( | ) |
Create a new dynamic object and add it to the document tree, then reload the main properties to update the treeview.
The dynamic object is given default values and no initial goals.
References cajun::ui_config_t::m_object_root, and reload_props().
Referenced by on_objectselect_combobox_changed().
void add_new_mesh_object | ( | ) |
Create a new mesh object and add it to the document tree, then reload the main properties to update the treeview.
The mesh object is given default values for the paths to indices and vertices.
References cajun::ui_config_t::m_object_root, and reload_props().
Referenced by on_objectselect_combobox_changed().
void add_new_static_object | ( | ) |
Create a new static object and add it to the document tree, then reload the main properties to update the treeview.
The static object is given default values.
References cajun::ui_config_t::m_object_root, and reload_props().
Referenced by on_objectselect_combobox_changed().
gboolean cell_edited | ( | GtkTreeIter * | iter, | |
GtkCellRendererText * | renderer, | |||
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeModel * | tm | |||
) |
Will check if a cell was edited with some text.
The cell will not be considered updated if there is a lack of text (empty string).
iter | The iterator to the edited row, which will be set if the function returns true, and unmodified otherwise. | |
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tm | The tree model that contains the edited cell. |
Referenced by on_editgoals_treeview_cell1_edited(), on_editgoals_treeview_cell2_edited(), on_editgoals_treeview_cell3_edited(), on_editgoals_treeview_cell4_edited(), and on_editgoals_treeview_cell5_edited().
void editgoals_selection_foreach_func | ( | GtkTreeModel * | model, | |
GtkTreePath * | path, | |||
GtkTreeIter * | iter, | |||
gpointer | data | |||
) |
Used for finding which selections have been made on the goals dialog.
Each iterator will be pushed back in the ui_config goals_selections vector. The last selection that this function is called with will be pointed to by the ui_config goal_selection. It is expected that the goals_selections vector will be cleared before this function is passed to the callback.
model | The tree model used. | |
path | The tree path to the selection. | |
iter | The tree iterator to the selection. | |
data | Ignore. |
References cajun::ui_config_t::m_goals_selection, and cajun::ui_config_t::m_goals_selections.
Referenced by on_editgoals_down_button_clicked(), on_editgoals_remove_button_clicked(), on_editgoals_treeview_cursor_changed(), and on_editgoals_up_button_clicked().
xml_node_t get_selected_object | ( | ) |
Checks the main object treeview and sets the selected object in ui_config.
The object treeview only allows a single object to be selected. This function will set the boolean flag for if a selection has been made as well as set the index for which selection was made and then return the corresponding XML node.
References glade_xml, cajun::ui_config_t::m_has_selection, cajun::ui_config_t::m_object_root, cajun::ui_config_t::m_selection, cajun::ui_config_t::m_selection_node, and selection_foreach_func().
Referenced by on_editprops_button_clicked(), on_object_treeview_cursor_changed(), and on_removeobject_button_clicked().
gboolean load_object_file | ( | const gchar * | filename | ) |
Load and parse object file.
Will attempt to load and parse the object file, and setup the root node.
filename | The object file to load. |
References cajun::ui_config_t::m_object_doc, and cajun::ui_config_t::m_object_root.
Referenced by on_openfile_event().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Will set program name, init gtk, init interface, and start gtk main loop.
argc | Number of arguments at the command line. | |
argv | Array of arguments supplied to the program at the command line. |
References glade_xml, cajun::ui_config_t::init(), and progname.
void new_object_file | ( | ) |
Setup for a new object file.
The XML doc and root are reset, the name is initialized, and the interface reflects that a new unsaved file is in use.
References glade_xml, cajun::ui_config_t::m_object_doc, and cajun::ui_config_t::m_object_root.
Referenced by on_main_map_event(), and on_newfile_event().
void on_addobject_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when the user wants to add a new object.
Will display a combo box for the user to select what type of object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editgoals_add_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a goal is added to a dynamic object.
Will add default values for a goal that can be edited by the user.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editgoals_addrange_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a range of goals is added to a dynamic object.
Will add default values for a range of goals that can be edited by the user.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editgoals_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when the user wants to edit the goals for a dynamic object.
Will display a dialog for editing the goals of the dynamic object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_selection_node, on_editgoals_treeview_cell1_edited(), on_editgoals_treeview_cell2_edited(), on_editgoals_treeview_cell3_edited(), on_editgoals_treeview_cell4_edited(), and on_editgoals_treeview_cell5_edited().
void on_editgoals_cancel_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when any goals changes to a dynamic object need to be ignored.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editgoals_down_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Will move the current selection of goals down, after the previous goals.
button | The button that was clicked. | |
user_data | Ignore. |
References editgoals_selection_foreach_func(), glade_xml, and cajun::ui_config_t::m_goals_selections.
void on_editgoals_edit_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a goal is edited for a dynamic object.
Will set the cursor to the last selection so that the goal can be edited by the user.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, and cajun::ui_config_t::m_goals_selection.
void on_editgoals_remove_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a goal or set of goals are removed from a dynamic object.
Will check the selection and remove the goal(s) at the selection from the list.
button | The button that was clicked. | |
user_data | Ignore. |
References editgoals_selection_foreach_func(), glade_xml, and cajun::ui_config_t::m_goals_selections.
void on_editgoals_save_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when any goal changes to a dynamic object need to be saved and updated to the xml doc.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_selection_node, and reload_props().
void on_editgoals_treeview_cell1_edited | ( | GtkCellRendererText * | renderer, | |
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeView * | tv | |||
) |
Callback for when the user wants to edit a cell on the goals edit dialog.
Will set the new text if it was non-empty into the edited cell.
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tv | The tree view that contains the edited cell. |
References cell_edited().
Referenced by on_editgoals_button_clicked().
void on_editgoals_treeview_cell2_edited | ( | GtkCellRendererText * | renderer, | |
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeView * | tv | |||
) |
Callback for when the user wants to edit a cell on the goals edit dialog.
Will set the new text if it was non-empty into the edited cell.
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tv | The tree view that contains the edited cell. |
References cell_edited().
Referenced by on_editgoals_button_clicked().
void on_editgoals_treeview_cell3_edited | ( | GtkCellRendererText * | renderer, | |
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeView * | tv | |||
) |
Callback for when the user wants to edit a cell on the goals edit dialog.
Will set the new text if it was non-empty into the edited cell.
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tv | The tree view that contains the edited cell. |
References cell_edited().
Referenced by on_editgoals_button_clicked().
void on_editgoals_treeview_cell4_edited | ( | GtkCellRendererText * | renderer, | |
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeView * | tv | |||
) |
Callback for when the user wants to edit a cell on the goals edit dialog.
Will set the new text if it was non-empty into the edited cell.
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tv | The tree view that contains the edited cell. |
References cell_edited().
Referenced by on_editgoals_button_clicked().
void on_editgoals_treeview_cell5_edited | ( | GtkCellRendererText * | renderer, | |
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeView * | tv | |||
) |
Callback for when the user wants to edit a cell on the goals edit dialog.
Will set the new text if it was non-empty into the edited cell.
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tv | The tree view that contains the edited cell. |
References cell_edited().
Referenced by on_editgoals_button_clicked().
void on_editgoals_treeview_cursor_changed | ( | GtkTreeView * | tree_view, | |
gpointer | user_data | |||
) |
Callback for when a different goal selection is made on the edit goals dialog.
tree_view | The tree view that generated the event. | |
user_data | Ignore. |
References editgoals_selection_foreach_func(), and glade_xml.
void on_editgoals_up_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Will move the current selection of goals up, before the previous goals.
button | The button that was clicked. | |
user_data | Ignore. |
References editgoals_selection_foreach_func(), glade_xml, and cajun::ui_config_t::m_goals_selections.
void on_editgoalsrange_cancel_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a range of goals to add to a dynamic object is cancelled.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editgoalsrange_error_ok_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when there was an error in the range of goals dialog.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editgoalsrange_save_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a range of goals to add to a dynamic object is saved.
Will generate the list of goals and add it to the edit goals dialog for the object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editprops_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when the user wants to edit the properties for an object.
Will display a dialog for the user to edit the properties of the selected object. Depending on the type of object, the dialog may differ.
button | The button that was clicked. | |
user_data | Ignore. |
References get_selected_object(), and glade_xml.
void on_editsensors_add_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a sensor is added to an autonomous object.
Will add a default path to a sensor that can be edited by the user.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editsensors_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when the user wants to edit the sensors for an autonomous object.
Will display a dialog for editing the sensors of the autonomous object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_selection_node, and on_editsensors_treeview_cell_edited().
void on_editsensors_cancel_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when any sensor changes to an autonomous object need to be ignored.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_editsensors_edit_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a sensor is edited for an autonomous object.
Will set the cursor to the current selection so that the sensor can be edited by the user.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, and cajun::ui_config_t::m_sensors_selection.
void on_editsensors_remove_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when a sensor is removed from an autonomous object.
Will check the selection and remove the sensor at the selection from the list.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, and cajun::ui_config_t::m_sensors_selection.
void on_editsensors_save_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when any sensor changes to an autonomous object need to be saved and updated to the xml doc.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_selection_node, and reload_props().
void on_editsensors_treeview_cell_edited | ( | GtkCellRendererText * | renderer, | |
gchar * | path, | |||
gchar * | new_text, | |||
GtkTreeView * | tv | |||
) |
Callback for when the user wants to edit a cell on the sensors edit dialog.
Will set the new text if it was non-empty into the edited cell.
renderer | The cell renderer for the edited cell. | |
path | The path to the row of the edited cell. | |
new_text | The new text from the edited cell. | |
tv | The tree view that contains the edited cell. |
Referenced by on_editsensors_button_clicked().
void on_editsensors_treeview_cursor_changed | ( | GtkTreeView * | tree_view, | |
gpointer | user_data | |||
) |
Callback for when a different sensor selection is made on the edit sensors dialog.
tree_view | The tree view that generated the event. | |
user_data | Ignore. |
References glade_xml, and cajun::ui_config_t::m_sensors_selection.
gboolean on_main_delete_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Callback for when the main window is closed.
widget | The widget generating the map event. | |
event | The event that was generated. | |
user_data | Ignore. |
Referenced by on_quit_event().
gboolean on_main_map_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Called when the main window is displayed on the screen.
When the main window is first displayed to the screen, a new object file will created and the main object treeview's properties reloaded.
widget | The widget generating the map event. | |
event | The event that was generated. | |
user_data | Ignore. |
References cajun::ui_config_t::gui_init(), new_object_file(), and reload_props().
gboolean on_newfile_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Called when the "New" selection is made. Sets up a new object file.
Sets many of the ui_config variables to null or invalid values. The main object treeview is reset as well as a new object file setup.
widget | The widget generating the event. | |
event | The event that was generated. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_has_selection, cajun::ui_config_t::m_object_doc, cajun::ui_config_t::m_object_file, cajun::ui_config_t::m_object_root, cajun::ui_config_t::m_selection, cajun::ui_config_t::m_selection_node, new_object_file(), and reload_props().
void on_object_treeview_cursor_changed | ( | GtkTreeView * | tree_view, | |
gpointer | user_data | |||
) |
Callback for when a different object selection is made on the main window.
Will update any sensitive button appropriately.
tree_view | The tree view that generated the event. | |
user_data | Ignore. |
References get_selected_object(), glade_xml, cajun::ui_config_t::m_has_selection, selection_foreach_func(), and update_sensitive_buttons().
void on_objectselect_combobox_changed | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when user makes a selection as to which kind of object to add.
Will add the appropriate object to the main window and refresh the treeview.
button | The button that was clicked. | |
user_data | Ignore. |
References add_new_autonomous_object(), add_new_dynamic_object(), add_new_mesh_object(), add_new_static_object(), and glade_xml.
gboolean on_openfile_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Called when the "Open" selection is made. Handles loading of an object file.
If an object file was selected, then it is loaded the GUI title is updated to reflect the new file that has been loaded.
widget | The widget generating the event. | |
event | The event that was generated. | |
user_data | Ignore. |
References glade_xml, load_object_file(), cajun::ui_config_t::m_object_file, openfile_dialog(), and reload_props().
void on_properties_cancel_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when any properties changes to an object need to be ignored.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_properties_indices_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback that will display a file chooser dialog for the indices file in a mesh object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_properties_indices_path_checkbutton_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback to toggle between using base and full path for indices in a mesh object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_properties_save_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when any properties changes to an object need to be saved and updated to the xml doc.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_selection_node, and reload_props().
void on_properties_vertices_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback that will display a file chooser dialog for the vertices file in a mesh object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void on_properties_vertices_path_checkbutton_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback to toggle between using base and full path for vertices in a mesh object.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
gboolean on_quit_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Callback for when the "Quit" selection is chosen.
widget | The widget generating the map event. | |
event | The event that was generated. | |
user_data | Ignore. |
References on_main_delete_event().
void on_removeobject_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when the user wants to remove an object.
The object will be unlinked and free from the xml doc, removed from the tree store, and sensitive buttons will be updated.
button | The button that was clicked. | |
user_data | Ignore. |
References get_selected_object(), glade_xml, cajun::ui_config_t::m_object_selection, and update_sensitive_buttons().
gboolean on_saveasfile_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Called when the "Save As" selection is made. Handles saving of the object file to disk.
A dialog is shown for the user to set the new filename and then it is saved to disk.
widget | The widget generating the event. | |
event | The event that was generated. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_object_doc, cajun::ui_config_t::m_object_file, cajun::ui_config_t::m_object_root, and saveasfile_dialog().
gboolean on_savefile_event | ( | GtkWidget * | widget, | |
GdkEvent * | event, | |||
gpointer | user_data | |||
) |
Called when the "Save" selection is made. Handles saving of the object file to disk.
If the object file is associated with a filename, then it is saved to disk. Otherwise a dialog is shown for the user to set the new filename and then it is saved to disk.
widget | The widget generating the event. | |
event | The event that was generated. | |
user_data | Ignore. |
References glade_xml, cajun::ui_config_t::m_object_doc, cajun::ui_config_t::m_object_file, cajun::ui_config_t::m_object_root, and saveasfile_dialog().
void on_savefile_ok_button_clicked | ( | GtkButton * | button, | |
gpointer | user_data | |||
) |
Callback for when the file was successfully saved and the user clicked "ok" on the dialog.
button | The button that was clicked. | |
user_data | Ignore. |
References glade_xml.
void openfile_dialog | ( | GtkWidget * | window | ) |
Present the user with a dialog to open a new object file.
The dialog is set to open by default in the $CBCONF/objects directory.
window | The parent window. |
References cajun::ui_config_t::m_object_file.
Referenced by on_openfile_event().
void reload_props | ( | ) |
Reload object properties for main window.
Gets the root node and iterates through the child object nodes, populating the main object treeview. Additionally, the sensitive buttons are updated.
References glade_xml, cajun::ui_config_t::m_object_root, progname, and update_sensitive_buttons().
Referenced by add_new_autonomous_object(), add_new_dynamic_object(), add_new_mesh_object(), add_new_static_object(), on_editgoals_save_button_clicked(), on_editsensors_save_button_clicked(), on_main_map_event(), on_newfile_event(), on_openfile_event(), and on_properties_save_button_clicked().
void saveasfile_dialog | ( | GtkWidget * | window | ) |
Present the user with a dialog to save the object file.
The dialog is set to open by default in the $CBCONF/objects directory.
window | The parent window. |
References cajun::ui_config_t::m_object_file.
Referenced by on_saveasfile_event(), and on_savefile_event().
void selection_foreach_func | ( | GtkTreeModel * | model, | |
GtkTreePath * | path, | |||
GtkTreeIter * | iter, | |||
gpointer | data | |||
) |
Used for finding the selection made from the main object treeview.
This function will determine by traveling up the parent heirarchy which object was selected from the main treeview. The ui_config object selection will be updated to point at the correct row, the ui_config selection index will also be updated and the ui_config has selection flag will be set.
model | The tree model used. | |
path | The tree path to the selection. | |
iter | The tree iterator to the selection. | |
data | Ignore. |
References cajun::ui_config_t::m_has_selection, cajun::ui_config_t::m_object_selection, and cajun::ui_config_t::m_selection.
Referenced by get_selected_object(), and on_object_treeview_cursor_changed().
void update_sensitive_buttons | ( | ) |
Will update those buttons on the main window that may change sensitivity depending on selection to be unsensitive.
It is up to the cursor_changed callback to decide, based on the selection, which buttons should be made sensitive.
References glade_xml.
Referenced by on_object_treeview_cursor_changed(), on_removeobject_button_clicked(), and reload_props().
GladeXML* glade_xml |
Glade GUI.
Referenced by get_selected_object(), cajun::ui_config_t::init(), main(), new_object_file(), on_addobject_button_clicked(), on_editgoals_add_button_clicked(), on_editgoals_addrange_button_clicked(), on_editgoals_button_clicked(), on_editgoals_cancel_button_clicked(), on_editgoals_down_button_clicked(), on_editgoals_edit_button_clicked(), on_editgoals_remove_button_clicked(), on_editgoals_save_button_clicked(), on_editgoals_treeview_cursor_changed(), on_editgoals_up_button_clicked(), on_editgoalsrange_cancel_button_clicked(), on_editgoalsrange_error_ok_button_clicked(), on_editgoalsrange_save_button_clicked(), on_editprops_button_clicked(), on_editsensors_add_button_clicked(), on_editsensors_button_clicked(), on_editsensors_cancel_button_clicked(), on_editsensors_edit_button_clicked(), on_editsensors_remove_button_clicked(), on_editsensors_save_button_clicked(), on_editsensors_treeview_cursor_changed(), on_newfile_event(), on_object_treeview_cursor_changed(), on_objectselect_combobox_changed(), on_openfile_event(), on_properties_cancel_button_clicked(), on_properties_indices_button_clicked(), on_properties_indices_path_checkbutton_clicked(), on_properties_save_button_clicked(), on_properties_vertices_button_clicked(), on_properties_vertices_path_checkbutton_clicked(), on_removeobject_button_clicked(), on_saveasfile_event(), on_savefile_event(), on_savefile_ok_button_clicked(), reload_props(), and update_sensitive_buttons().
const gchar* progname = NULL |
Program name.
Referenced by main(), and reload_props().
UI configuration helper.