GDS-Render v1.2.1
LayerSelector Object
Collaboration diagram for LayerSelector Object:

Data Structures

struct  _LayerSelector
 

Macros

#define TYPE_LAYER_SELECTOR   (layer_selector_get_type())
 

Enumerations

enum  layer_selector_sort_algo { LAYER_SELECTOR_SORT_DOWN = 0 , LAYER_SELECTOR_SORT_UP }
 Defines how to sort the layer selector list box. More...
 

Functions

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (LayerSelector, layer_selector, LAYER, SELECTOR, GObject)
 
LayerSelector * layer_selector_new (GtkListBox *list_box)
 layer_selector_new More...
 
void layer_selector_generate_layer_widgets (LayerSelector *selector, GList *libs)
 Generate layer widgets in in the LayerSelector instance. More...
 
void layer_selector_set_load_mapping_button (LayerSelector *selector, GtkWidget *button, GtkWindow *main_window)
 Supply button for loading the layer mapping. More...
 
void layer_selector_set_save_mapping_button (LayerSelector *selector, GtkWidget *button, GtkWindow *main_window)
 Supply button for saving the layer mapping. More...
 
LayerSettings * layer_selector_export_rendered_layer_info (LayerSelector *selector)
 Get a list of all layers that shall be exported when rendering the cells. More...
 
void layer_selector_force_sort (LayerSelector *selector, enum layer_selector_sort_algo sort_function)
 Force the layer selector list to be sorted according to sort_function. More...
 
void layer_selector_select_all_layers (LayerSelector *layer_selector, gboolean select)
 Set 'export' value of all layers in the LayerSelector to the supplied select value. More...
 
void layer_selector_auto_color_layers (LayerSelector *layer_selector, ColorPalette *palette, double global_alpha)
 Apply colors from palette to all layers. Aditionally set alpha. More...
 
void layer_selector_auto_name_layers (LayerSelector *layer_selector, gboolean overwrite)
 Auto name all layers in the layer selector. More...
 
gboolean layer_selector_contains_elements (LayerSelector *layer_selector)
 Check if the given layer selector contains layer elements. More...
 
size_t layer_selector_num_of_named_elements (LayerSelector *layer_selector)
 Get number of layer elements that are named. More...
 
static void sel_layer_element_drag_begin (GtkWidget *widget, GdkDragContext *context, gpointer data)
 
static void sel_layer_element_drag_end (GtkWidget *widget, GdkDragContext *context, gpointer data)
 
static void sel_layer_element_drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *selection_data, guint info, guint time, gpointer data)
 
static GtkListBoxRow * layer_selector_get_last_row (GtkListBox *list)
 
static GtkListBoxRow * layer_selector_get_row_before (GtkListBox *list, GtkListBoxRow *row)
 
static GtkListBoxRow * layer_selector_get_row_after (GtkListBox *list, GtkListBoxRow *row)
 
static void layer_selector_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint32 time, gpointer data)
 
static gboolean layer_selector_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time)
 
static void layer_selector_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time)
 
static void layer_selector_dispose (GObject *self)
 
static void layer_selector_class_init (LayerSelectorClass *klass)
 
static void layer_selector_setup_dnd (LayerSelector *self)
 
static void layer_selector_init (LayerSelector *self)
 
static void layer_selector_clear_widgets (LayerSelector *self)
 
static gboolean layer_selector_check_if_layer_widget_exists (LayerSelector *self, int layer)
 Check if a specific layer element with the given layer number is present in the layer selector. More...
 
static void sel_layer_element_setup_dnd_callbacks (LayerSelector *self, LayerElement *element)
 Setup the necessary drag and drop callbacks of layer elements. More...
 
static void layer_selector_analyze_cell_layers (LayerSelector *self, struct gds_cell *cell)
 Analyze cell layers and append detected layers to layer selector self. More...
 
static gint layer_selector_sort_func (GtkListBoxRow *row1, GtkListBoxRow *row2, gpointer unused)
 sort_func Sort callback for list box More...
 
static LayerElement * layer_selector_find_layer_element_in_list (GList *el_list, int layer)
 Find LayerElement in list with specified layer number. More...
 
static void layer_selector_load_layer_mapping_from_file (LayerSelector *self, const gchar *file_name)
 Load the layer mapping from a CSV formatted file. More...
 
static void layer_selector_load_mapping_clicked (GtkWidget *button, gpointer user_data)
 Callback for Load Mapping Button. More...
 
static void layer_selector_save_layer_mapping_data (LayerSelector *self, const gchar *file_name)
 Save layer mapping of selector self to a file. More...
 
static void layer_selector_save_mapping_clicked (GtkWidget *button, gpointer user_data)
 Callback for Save Layer Mapping Button. More...
 

Variables

static const char * dnd_additional_css
 

Detailed Description

This objects implements the layer selector and displays the layers in a list box. It uses LayerElement objects to display the individual layers inside the list box.

Macro Definition Documentation

◆ TYPE_LAYER_SELECTOR

#define TYPE_LAYER_SELECTOR   (layer_selector_get_type())

Definition at line 43 of file layer-selector.h.

Enumeration Type Documentation

◆ layer_selector_sort_algo

Defines how to sort the layer selector list box.

Enumerator
LAYER_SELECTOR_SORT_DOWN 
LAYER_SELECTOR_SORT_UP 

Definition at line 48 of file layer-selector.h.

Function Documentation

◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE ( LayerSelector  ,
layer_selector  ,
LAYER  ,
SELECTOR  ,
GObject   
)

◆ layer_selector_analyze_cell_layers()

static void layer_selector_analyze_cell_layers ( LayerSelector *  self,
struct gds_cell cell 
)
static

Analyze cell layers and append detected layers to layer selector self.

Parameters
selfLayerSelector instance
cellCell to analyze

Definition at line 497 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_auto_color_layers()

void layer_selector_auto_color_layers ( LayerSelector *  layer_selector,
ColorPalette *  palette,
double  global_alpha 
)

Apply colors from palette to all layers. Aditionally set alpha.

Parameters
layer_selectorLayerSelector object
paletteColor palette to use
global_alphaAdditional alpha value that is applied to all layers. Must be > 0

Definition at line 816 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_auto_name_layers()

void layer_selector_auto_name_layers ( LayerSelector *  layer_selector,
gboolean  overwrite 
)

Auto name all layers in the layer selector.

This functions sets the name of the layer equal to its number. The overwrite parameter specifies if already set layer names are overwritten.

Parameters
layer_selectorLayerSelector
overwriteOverwrite existing layer names

Definition at line 854 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_check_if_layer_widget_exists()

static gboolean layer_selector_check_if_layer_widget_exists ( LayerSelector *  self,
int  layer 
)
static

Check if a specific layer element with the given layer number is present in the layer selector.

Parameters
selfLayerSelector instance
layerLayer number to check for
Returns
TRUE if layer is present, else FALSE

Definition at line 449 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_class_init()

static void layer_selector_class_init ( LayerSelectorClass *  klass)
static

Definition at line 334 of file layer-selector.c.

Here is the call graph for this function:

◆ layer_selector_clear_widgets()

static void layer_selector_clear_widgets ( LayerSelector *  self)
static

Definition at line 423 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_contains_elements()

gboolean layer_selector_contains_elements ( LayerSelector *  layer_selector)

Check if the given layer selector contains layer elements.

This function checks whether there are elements present. If an invalid object pointer layer_selector is passed, the function returns FALSE

Parameters
[in]layer_selectorSelector to check
Returns
True, if there is at least one layer present inside the selector

Definition at line 884 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_dispose()

static void layer_selector_dispose ( GObject *  self)
static

Definition at line 315 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_drag_data_received()

static void layer_selector_drag_data_received ( GtkWidget *  widget,
GdkDragContext *  context,
gint  x,
gint  y,
GtkSelectionData *  selection_data,
guint  info,
guint32  time,
gpointer  data 
)
static

Definition at line 152 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_drag_leave()

static void layer_selector_drag_leave ( GtkWidget *  widget,
GdkDragContext *  context,
guint  time 
)
static

Definition at line 259 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_drag_motion()

static gboolean layer_selector_drag_motion ( GtkWidget *  widget,
GdkDragContext *  context,
int  x,
int  y,
guint  time 
)
static

Definition at line 198 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_export_rendered_layer_info()

LayerSettings * layer_selector_export_rendered_layer_info ( LayerSelector *  selector)

Get a list of all layers that shall be exported when rendering the cells.

Parameters
selectorLayer selector instance
Returns
LayerSettings containing the layer information

Definition at line 388 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_find_layer_element_in_list()

static LayerElement * layer_selector_find_layer_element_in_list ( GList *  el_list,
int  layer 
)
static

Find LayerElement in list with specified layer number.

Parameters
el_listList with elements of type LayerElement
layerLayer number
Returns
Found LayerElement. If nothing is found, NULL.

Definition at line 578 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_force_sort()

void layer_selector_force_sort ( LayerSelector *  selector,
enum layer_selector_sort_algo  sort_function 
)

Force the layer selector list to be sorted according to sort_function.

Parameters
selectorLayerSelector instance
sort_functionThe sorting method (up or down sorting)

Definition at line 779 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_generate_layer_widgets()

void layer_selector_generate_layer_widgets ( LayerSelector *  selector,
GList *  libs 
)

Generate layer widgets in in the LayerSelector instance.

Note
This clears all previously inserted elements
Parameters
selectorLayerSelector instance
libsThe libraries to add

Definition at line 549 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_get_last_row()

static GtkListBoxRow * layer_selector_get_last_row ( GtkListBox *  list)
static

Definition at line 119 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_get_row_after()

static GtkListBoxRow * layer_selector_get_row_after ( GtkListBox *  list,
GtkListBoxRow *  row 
)
static

Definition at line 144 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_get_row_before()

static GtkListBoxRow * layer_selector_get_row_before ( GtkListBox *  list,
GtkListBoxRow *  row 
)
static

Definition at line 136 of file layer-selector.c.

Here is the caller graph for this function:

◆ layer_selector_init()

static void layer_selector_init ( LayerSelector *  self)
static

Definition at line 361 of file layer-selector.c.

◆ layer_selector_load_layer_mapping_from_file()

static void layer_selector_load_layer_mapping_from_file ( LayerSelector *  self,
const gchar *  file_name 
)
static

Load the layer mapping from a CSV formatted file.

This function imports the layer specification from a file (see Layer Mapping File Specification). The layer ordering defined in the file is kept. All layers present in the current loaded library, which are not present in the layer mapping file are appended at the end of the layer selector list.

Parameters
selfLayerSelector instance
file_nameFile name to load from

Definition at line 602 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_load_mapping_clicked()

static void layer_selector_load_mapping_clicked ( GtkWidget *  button,
gpointer  user_data 
)
static

Callback for Load Mapping Button.

Parameters
button
user_data

Definition at line 685 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_new()

LayerSelector * layer_selector_new ( GtkListBox *  list_box)

layer_selector_new

Parameters
list_boxThe associated list box, the content is displayed in
Returns
Newly created layer selector

Definition at line 373 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_num_of_named_elements()

size_t layer_selector_num_of_named_elements ( LayerSelector *  layer_selector)

Get number of layer elements that are named.

Parameters
[in]layer_selectorLayer selector
Returns
Number of layers with a name != NULL or != ""

Definition at line 899 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_save_layer_mapping_data()

static void layer_selector_save_layer_mapping_data ( LayerSelector *  self,
const gchar *  file_name 
)
static

Save layer mapping of selector self to a file.

Parameters
selfLayerSelector instance
file_nameFile name to save to

Definition at line 714 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_save_mapping_clicked()

static void layer_selector_save_mapping_clicked ( GtkWidget *  button,
gpointer  user_data 
)
static

Callback for Save Layer Mapping Button.

Parameters
button
user_data

Definition at line 731 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_select_all_layers()

void layer_selector_select_all_layers ( LayerSelector *  layer_selector,
gboolean  select 
)

Set 'export' value of all layers in the LayerSelector to the supplied select value.

Parameters
layer_selectorLayerSelector object
select

Definition at line 796 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_set_load_mapping_button()

void layer_selector_set_load_mapping_button ( LayerSelector *  selector,
GtkWidget *  button,
GtkWindow *  main_window 
)

Supply button for loading the layer mapping.

Parameters
selectorLayerSelector instance
buttonLoad button. Will be referenced
main_windowParent window for dialogs. Will be referenced

Definition at line 755 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_set_save_mapping_button()

void layer_selector_set_save_mapping_button ( LayerSelector *  selector,
GtkWidget *  button,
GtkWindow *  main_window 
)

Supply button for saving the layer mapping.

Parameters
selectorLayerSelector instance
buttonSave button. Will be refeneced
main_windowParent window for dialogs. Will be referenced

Definition at line 767 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_setup_dnd()

static void layer_selector_setup_dnd ( LayerSelector *  self)
static

Definition at line 350 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_selector_sort_func()

static gint layer_selector_sort_func ( GtkListBoxRow *  row1,
GtkListBoxRow *  row2,
gpointer  unused 
)
static

sort_func Sort callback for list box

Parameters
row1
row2
unused
Note
Do not use this function. This is an internal callback
Returns
See sort function documentation of GTK+

Definition at line 525 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sel_layer_element_drag_begin()

static void sel_layer_element_drag_begin ( GtkWidget *  widget,
GdkDragContext *  context,
gpointer  data 
)
static

Definition at line 62 of file layer-selector.c.

Here is the caller graph for this function:

◆ sel_layer_element_drag_data_get()

static void sel_layer_element_drag_data_get ( GtkWidget *  widget,
GdkDragContext *  context,
GtkSelectionData *  selection_data,
guint  info,
guint  time,
gpointer  data 
)
static

Definition at line 103 of file layer-selector.c.

Here is the caller graph for this function:

◆ sel_layer_element_drag_end()

static void sel_layer_element_drag_end ( GtkWidget *  widget,
GdkDragContext *  context,
gpointer  data 
)
static

Definition at line 91 of file layer-selector.c.

Here is the caller graph for this function:

◆ sel_layer_element_setup_dnd_callbacks()

static void sel_layer_element_setup_dnd_callbacks ( LayerSelector *  self,
LayerElement *  element 
)
static

Setup the necessary drag and drop callbacks of layer elements.

Parameters
selfLayerSelector instance. Used to get the DnD target entry.
elementLayerElement instance to set the callbacks

Definition at line 476 of file layer-selector.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dnd_additional_css

const char* dnd_additional_css
static

Definition at line 279 of file layer-selector.c.