Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
viewport.c File Reference
#include <assert.h>
#include "viewport.h"
#include "draw.h"
#include <common/color.h>
#include <glade/glade.h>
#include "gui.h"
#include <limits.h>
#include "menucallbacks.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "glcompui.h"
#include "gltemplate.h"
#include <common/colorprocs.h>
#include "topviewsettings.h"
#include "arcball.h"
#include "hotkeymap.h"
#include "topviewfuncs.h"
#include <util/alloc.h>
#include <util/exit.h>
#include <util/strcasecmp.h>
Include dependency graph for viewport.c:

Go to the source code of this file.

Data Structures

struct  colordata
 

Macros

#define CSZ(x)   (sizeof(x)/sizeof(char*))
 
#define NUM_SCHEMES   (sizeof(palette)/sizeof(colordata))
 

Functions

static colorschemaset create_color_theme (int themeid)
 
static void clear_viewport (ViewInfo *vi)
 
static void * get_glut_font (int ind)
 
void close_graph (ViewInfo *vi)
 
char * get_attribute_value (char *attr, ViewInfo *vi, Agraph_t *g)
 
void set_viewport_settings_from_template (ViewInfo *vi, Agraph_t *g)
 
static gboolean gl_main_expose (void *data)
 
static void get_data_dir (void)
 
static void clear_color_theme (colorschemaset *cs)
 
void init_viewport (ViewInfo *vi)
 
static void update_graph_params (Agraph_t *graph)
 
static Agraph_tloadGraph (char *filename)
 
int add_graph_to_viewport_from_file (char *fileName)
 
void updateRecord (Agraph_t *g)
 
static void graphRecord (Agraph_t *g)
 
void refreshViewport (void)
 
static void activate (int id)
 
int add_graph_to_viewport (Agraph_t *graph, char *id)
 
void switch_graph (int graphId)
 
int save_graph_with_file_name (Agraph_t *graph, char *fileName)
 
int save_graph (void)
 
int save_as_graph (void)
 
void glexpose (void)
 
static float interpol (float minv, float maxv, float minc, float maxc, float x)
 
void getcolorfromschema (const colorschemaset sc, float l, float maxl, glCompColor *c)
 
static void set_color_theme_color (colorschemaset *sc, char **colorstr)
 

Variables

ViewInfoview
 
static char * deep_blue []
 
static char * pastel []
 
static char * magma []
 
static char * rain_forest []
 
static colordata palette []
 

Macro Definition Documentation

◆ CSZ

#define CSZ (   x)    (sizeof(x)/sizeof(char*))

Definition at line 602 of file viewport.c.

◆ NUM_SCHEMES

#define NUM_SCHEMES   (sizeof(palette)/sizeof(colordata))

Definition at line 613 of file viewport.c.

Function Documentation

◆ activate()

static void activate ( int  id)
static

Definition at line 425 of file viewport.c.

References _ViewInfo::activeGraph, id, refreshViewport(), and view.

Referenced by add_graph_to_viewport(), and switch_graph().

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

◆ add_graph_to_viewport()

int add_graph_to_viewport ( Agraph_t graph,
char *  id 
)

Definition at line 431 of file viewport.c.

References activate(), _ViewInfo::g, graph(), _ViewInfo::graphComboBox, _ViewInfo::graphCount, gv_recalloc(), and view.

Referenced by add_graph_to_viewport_from_file(), and run_gvpr().

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

◆ add_graph_to_viewport_from_file()

int add_graph_to_viewport_from_file ( char *  fileName)

Definition at line 364 of file viewport.c.

References add_graph_to_viewport(), fileName(), graph(), and loadGraph().

Referenced by cb_display(), expose_event(), and mOpenSlot().

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

◆ clear_color_theme()

static void clear_color_theme ( colorschemaset cs)
static

Definition at line 185 of file viewport.c.

References free(), and colorschemaset::s.

Referenced by create_color_theme(), and init_viewport().

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

◆ clear_viewport()

static void clear_viewport ( ViewInfo vi)
static

Definition at line 39 of file viewport.c.

References _ViewInfo::activeGraph, agclose(), _ViewInfo::g, and _ViewInfo::graphCount.

Referenced by close_graph().

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

◆ close_graph()

void close_graph ( ViewInfo vi)

Definition at line 71 of file viewport.c.

References _ViewInfo::activeGraph, and clear_viewport().

Referenced by cb_display(), expose_event(), mCloseSlot(), and mQuitSlot().

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

◆ create_color_theme()

static colorschemaset create_color_theme ( int  themeid)
static

Definition at line 615 of file viewport.c.

References clear_color_theme(), colordata::cnt, _ViewInfo::colschms, gv_calloc(), NUM_SCHEMES, palette, set_color_theme_color(), and view.

Referenced by set_viewport_settings_from_template().

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

◆ get_attribute_value()

char * get_attribute_value ( char *  attr,
ViewInfo vi,
Agraph_t g 
)

Definition at line 77 of file viewport.c.

References agget(), systemgraphs::def_attrs, and _ViewInfo::systemGraphs.

Referenced by changetopfishfocus(), prepare_topological_fisheye(), and set_viewport_settings_from_template().

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

◆ get_data_dir()

static void get_data_dir ( void  )
static

Definition at line 179 of file viewport.c.

References free(), smyrnaPath(), _ViewInfo::template_file, and view.

Referenced by init_viewport().

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

◆ get_glut_font()

static void * get_glut_font ( int  ind)
static

Definition at line 43 of file viewport.c.

Referenced by set_viewport_settings_from_template().

Here is the caller graph for this function:

◆ getcolorfromschema()

void getcolorfromschema ( const colorschemaset  sc,
float  l,
float  maxl,
glCompColor c 
)

Definition at line 550 of file viewport.c.

References glCompColor::A, glCompColor::B, colorschema::c, glCompColor::G, interpol(), colorschema::perc, glCompColor::R, colorschemaset::s, and colorschemaset::schemacount.

Referenced by object_color().

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

◆ gl_main_expose()

static gboolean gl_main_expose ( void *  data)
static

Definition at line 168 of file viewport.c.

References _ViewInfo::activeGraph, topview::animate, _ViewInfo::drawing_area, expose_event(), topview::fisheyeParams, NULL, _ViewInfo::Topview, and view.

Referenced by init_viewport().

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

◆ glexpose()

void glexpose ( void  )

Definition at line 540 of file viewport.c.

References _ViewInfo::drawing_area, expose_event(), NULL, and view.

Referenced by appmouse_key_release(), btnToolFit_clicked(), glCompMouseMove(), glmotion_zoom_inc(), and scroll_event().

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

◆ graphRecord()

static void graphRecord ( Agraph_t g)
static

Definition at line 396 of file viewport.c.

References agattr(), agbindrec(), AGNODE, AGRAPH, GG_edgelabelcolor, GG_elabelattribute, GG_labelattribute, GG_nodelabelcolor, GN_pos, and updateRecord().

Referenced by refreshViewport().

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

◆ init_viewport()

void init_viewport ( ViewInfo vi)

Definition at line 190 of file viewport.c.

References glCompColor::A, _ViewInfo::active_camera, _ViewInfo::active_frame, _ViewInfo::activeGraph, agread(), _ViewInfo::arcball, systemgraphs::attrs_widgets, glCompColor::B, _ViewInfo::bdVisible, _ViewInfo::bdxLeft, _ViewInfo::bdxRight, _ViewInfo::bdyBottom, _ViewInfo::bdyTop, _ViewInfo::bgColor, _ViewInfo::borderColor, _ViewInfo::camera_count, _ViewInfo::cameras, clear_color_theme(), levelparms_t::coarsening_rate, _ViewInfo::colschms, systemgraphs::def_attrs, hierparms_t::dist2_limit, reposition_t::distortion, glCompMouse::down, _ViewInfo::fillColor, topview::fisheyeParams, free(), topview::fs, _ViewInfo::g, glCompColor::G, get_data_dir(), gl_main_expose(), glcreate_gl_topview_menu(), _ViewInfo::graphCount, topview::Graphdata, _graph_data::GraphFileName, graphviz_exit(), _ViewInfo::gridColor, _ViewInfo::gridSize, _ViewInfo::gridVisible, GUI_FULLSCREEN, GUI_WINDOWED, _ViewInfo::guiMode, gv_alloc(), reposition_t::height, topview::hier, topview::level, _ViewInfo::LineWidth, load_mouse_actions(), _ViewInfo::mouse, NULL, levelparms_t::num_fine_nodes, _ViewInfo::panx, _ViewInfo::pany, _ViewInfo::panz, _ViewInfo::penColor, glCompColor::R, topview::repos, _ViewInfo::selectedNodeColor, set_viewport_settings_from_template(), SIZE_MAX, smyrnaPath(), _ViewInfo::systemGraphs, _ViewInfo::template_file, _ViewInfo::timer, _ViewInfo::timer2, _ViewInfo::timer3, _ViewInfo::Topview, _ViewInfo::total_frames, _ViewInfo::widgets, reposition_t::width, topview::xDot, and _ViewInfo::zoom.

Referenced by main().

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

◆ interpol()

static float interpol ( float  minv,
float  maxv,
float  minc,
float  maxc,
float  x 
)
static

Definition at line 545 of file viewport.c.

Referenced by getcolorfromschema().

Here is the caller graph for this function:

◆ loadGraph()

static Agraph_t * loadGraph ( char *  filename)
static

Definition at line 335 of file viewport.c.

References agattr(), agclose(), agnameof(), AGNODE, agread(), topview::Graphdata, _graph_data::GraphFileName, gv_strdup(), NULL, _ViewInfo::Topview, and view.

Referenced by add_graph_to_viewport_from_file().

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

◆ refreshViewport()

void refreshViewport ( void  )

Definition at line 411 of file viewport.c.

References _ViewInfo::activeGraph, _ViewInfo::drawing_area, expose_event(), _ViewInfo::g, graph(), graphRecord(), GUI_FULLSCREEN, _ViewInfo::guiMode, initSmGraph(), load_settings_from_graph(), NULL, set_viewport_settings_from_template(), _ViewInfo::Topview, update_graph_from_settings(), and view.

Referenced by activate(), and run_gvpr().

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

◆ save_as_graph()

int save_as_graph ( void  )

Definition at line 510 of file viewport.c.

References _ViewInfo::activeGraph, _ViewInfo::g, NULL, save_graph_with_file_name(), and view.

Referenced by mSaveAsSlot(), and save_graph().

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

◆ save_graph()

int save_graph ( void  )

Definition at line 490 of file viewport.c.

References _ViewInfo::activeGraph, _ViewInfo::g, topview::Graphdata, _graph_data::GraphFileName, save_as_graph(), save_graph_with_file_name(), _ViewInfo::Topview, and view.

Referenced by mSaveSlot().

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

◆ save_graph_with_file_name()

int save_graph_with_file_name ( Agraph_t graph,
char *  fileName 
)

Definition at line 460 of file viewport.c.

References agwrite(), fileName(), graph(), topview::Graphdata, _graph_data::GraphFileName, NULL, _ViewInfo::Topview, update_graph_params(), and view.

Referenced by save_as_graph(), save_as_graph_clicked(), and save_graph().

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

◆ set_color_theme_color()

static void set_color_theme_color ( colorschemaset sc,
char **  colorstr 
)
static

Definition at line 573 of file viewport.c.

References glCompColor::A, glCompColor::B, colorschema::c, colorxlate(), glCompColor::G, colorschema::perc, glCompColor::R, color_s::RGBA, RGBA_DOUBLE, colorschemaset::s, colorschemaset::schemacount, and color_s::u.

Referenced by create_color_theme().

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

◆ set_viewport_settings_from_template()

◆ switch_graph()

void switch_graph ( int  graphId)

Definition at line 449 of file viewport.c.

References activate(), _ViewInfo::graphCount, and view.

Referenced by on_btnActivateGraph_clicked().

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

◆ update_graph_params()

static void update_graph_params ( Agraph_t graph)
static

Definition at line 329 of file viewport.c.

References agattr(), AGRAPH, graph(), topview::Graphdata, _graph_data::GraphFileName, _ViewInfo::Topview, and view.

Referenced by save_graph_with_file_name().

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

◆ updateRecord()

void updateRecord ( Agraph_t g)

Definition at line 374 of file viewport.c.

References agattr(), AGEDGE, AGNODE, GE_labelattribute, GE_pos, GE_selected, GE_visible, GN_labelattribute, GN_selected, GN_size, and GN_visible.

Referenced by graphRecord(), and run_gvpr().

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

Variable Documentation

◆ deep_blue

char* deep_blue[]
static
Initial value:
= {
"#C8CBED", "#9297D3", "#0000FF", "#2C2E41"
}

Definition at line 590 of file viewport.c.

◆ magma

char* magma[]
static
Initial value:
= {
"#E0061E", "#F0F143", "#95192B", "#EB712F"
}

Definition at line 596 of file viewport.c.

◆ palette

colordata palette[]
static
Initial value:
= {
}
static char * deep_blue[]
Definition viewport.c:590
static char * rain_forest[]
Definition viewport.c:599
static char * magma[]
Definition viewport.c:596
#define CSZ(x)
Definition viewport.c:602
static char * pastel[]
Definition viewport.c:593

Definition at line 607 of file viewport.c.

Referenced by create_color_theme().

◆ pastel

char* pastel[]
static
Initial value:
= {
"#EBBE29", "#D58C4A", "#74AE09", "#893C49"
}

Definition at line 593 of file viewport.c.

◆ rain_forest

char* rain_forest[]
static
Initial value:
= {
"#1E6A10", "#2ABE0E", "#AEDD39", "#5EE88B"
}

Definition at line 599 of file viewport.c.

◆ view

ViewInfo* view

Definition at line 37 of file viewport.c.

Referenced by activate(), add_graph_to_viewport(), aglocaldictsym(), apply_actions(), appmouse_down(), appmouse_key_release(), appmouse_up(), arcmouseClick(), arcmouseDrag(), btnToolFit_clicked(), btnToolZoomFit_clicked(), button_press_event(), button_release_event(), cb_display(), cb_drag(), cb_keyboard(), cb_keyboard_up(), cb_mouseclick(), cb_reshape(), cb_special_key(), cb_special_key_up(), change_cursor(), changetopfishfocus(), configure_event(), create_color_theme(), create_save_subgraph_from_filter(), create_window(), deselect_all(), doApply(), draw_selpoly(), draw_xdot(), DrawBezier(), DrawBeziers(), drawCircle(), DrawEllipse(), DrawPolygon(), DrawPolyline(), drawRotatingAxis(), drawtopfishedges(), drawtopfishnodes(), dtview(), EmbedText(), expose_event(), get_active_frame(), get_button(), get_data_dir(), get_temp_coords(), GetglCompColor(), gl_main_expose(), glcreate_gl_topview_menu(), glexpose(), glmotion_zoom(), glmotion_zoom_inc(), graph_zoom(), gvpr_select(), initSmGraph(), key_press_event(), key_release_event(), load_attr_list(), load_graph_properties(), load_settings_from_graph(), loadGraph(), main(), mCloseSlot(), menu_click_add_camera(), menu_click_center(), menu_click_pan(), menu_switch_to_fisheye(), mGraphPropertiesSlot(), mNodeListSlot(), motion_notify_event(), mPropertiesSlot(), mQuitSlot(), mShowToolBoxSlot(), mTestgvpr(), object_color(), on_attrAddBtn_clicked(), on_attrRB0_clicked(), on_btnActivateGraph_clicked(), on_settingsApplyBtn_clicked(), on_txtAttr_changed(), pick_object(), pick_objects_in_rect(), pick_objects_rect(), prepare_topological_fisheye(), realize(), refreshViewport(), Render_Contour2(), renderEdgeLabels(), renderEdges(), renderNodeLabels(), renderNodes(), renderSelectedNodes(), renderSmGraph(), run_gvpr(), save_as_graph(), save_as_graph_clicked(), save_graph(), save_graph_with_file_name(), scroll_event(), select_polygon(), selectedges(), selectnodes(), set_boundaries(), set_checkbox_widget(), set_color_button_widget(), set_combobox_widget(), set_header_text(), set_options(), set_scalebtn_widget_to_attribute(), set_spinbtn_widget(), set_text_widget(), SetFillColor(), SetPenColor(), show_settings_form(), showAttrsWidget(), switch2D3D(), switch_graph(), tv_hide_all(), tv_show_all(), update_graph_from_settings(), update_graph_params(), updateSmGraph(), windowedMode(), write_dict(), and writeDict().