Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

gui/main.h File Reference

GUI - The main gui structures, windows, and functions. More...

#include "lib/lib.h"
#include <gtk/gtk.h>
#include <libguile.h>
#include "kernel/kernel.h"
#include "gui/visualisation.h"

Go to the source code of this file.

Data Structures

struct  console
struct  console_search_stack
struct  console_string
struct  context
 The context structure. More...

struct  factory
 The one and the only GO Factory instance. More...

struct  of_state
 The structure for one GO factory state. More...

struct  text_edit
 The Text editor window structure. More...

struct  view
 The View window structure. More...

struct  view_navigator
 The View navigator structure. More...

struct  window
 The general window structure used for most GUI windows. More...

struct  wnd_main
 Main window structure. More...

struct  wnd_plugins
 The Plugin window structure. More...

struct  wnd_settings
 The Global settings window strucure. More...

struct  wnd_style
 The Style window structure. More...

struct  wnd_undo_history
 The Undo history window structure. More...

struct  wnd_univ_browser
 The Universe browser window structure. More...


Defines

#define MAX_ERR_MSG_LENGTH   TRANS_ERR_SIZE + 200
 Maximal length of error mssage (includes also additional arguments).

#define VRR_HOMEPAGE   "http://vrr.ucw.cz/"
 URL of the VRR homepage.

#define TOLERANCE_PIX   10
 The snap tolerance in pixels.

#define EXTERNAL_TEXT_EDITOR   "vim"
 Text editor, which can be used by vrr to modify text files.

#define TEXT_EDITOR_RUN_IN_TERM   1
 Do we use a text editor which must be run in a terminal?

#define WWW_BROWSER   "links"
 Which command should be use to open web browser for help?

#define WWW_BROWSER_RUN_IN_TERM   1
 Do we use a browser which must be run in a terminal?

#define FAVOURITE_TERMINAL   "rxvt"
 The terminal to run browser and/or text editor, if needed.

#define GRID_X1   10.0
 The x-coordinate of the first grid vector.

#define GRID_Y1   0.0
 The y-coordinate of the first grid vector.

#define GRID_X2   0.0
 The x-coordinate of the second grid vector.

#define GRID_Y2   10.0
 The y-coordinate of the second grid vector.

#define GRID_COLOR   (rgba_uns2uns(128, 128, 128, 255))
 The default grid color.

#define RULERX_RES   10.0
 The resolution of the horizontal ruler.

#define RULERY_RES   10.0
 The resolution of the vertical ruler.

#define PANNING_DRAG_IMAGE   0
 Whether to drag the image, not the view.

#define ENABLE_FIFI   0
 Whether to enable Fifi.

#define SAFE_G_VALUE(_x)   GValue _x; bzero(&_x, sizeof(_x))
 A macro that defines a GValue and initializes it to zero.

#define WIN_O_MAGIC   u8 type; SCM proxy; GtkWidget * statusbar; gint context_id
 The common data for most GUI windows.

#define statusbar_err(_win,)   statusbar_msg(_win, ":-( "__VA_ARGS__)

Enumerations

enum  {
  SNAP_HANGERS = 1, SNAP_GRID = 2, SNAP_LINES = 4, SNAP_INTERS = 8,
  SNAP_DEPENDENCY = 16
}
 Flags for snap settings.

enum  window_type {
  WT_VIEW, WT_UNDO_HISTORY, WT_UNIVERSE_BROWSER, WT_PROPERTIES,
  WT_PLUGINS, WT_TEXT_EDITOR, WT_CONSOLE, WT_MAIN_WINDOW,
  WT_UNITS
}
 The window type identifier used in the gerenal window structure struct window.

enum  moving_mode {
  MOVE_NONE, MOVE_FACTORY, MOVE_TRANSFORM, MOVE_TRANSFORM_2,
  MOVE_PANNING, MOVE_PANNING_NAV, MOVE_PANNING_IMG, MOVE_SELECT,
  MOVE_CNT
}
 The internal moving modes of the View.

enum  console_state {
  STATE_NORMAL, STATE_FSEARCH_FIRST, STATE_RSEARCH_FIRST, STATE_FSEARCH,
  STATE_RSEARCH
}
enum  of_input_kind {
  OFIK_NONE, OFIK_DPR, OFIK_PROP, OFIK_SEL,
  OFIK_TRANSFORM, OFIK_TF
}
 The kind of the input object of a factory state.

enum  of_go_role { OFR_DISPLAY, OFR_CNT }
enum  ofs_flags {
  OFF_FULL = 1, OFF_START_MOVE = 2, OFF_END_MOVE = 4, OFF_PATHABLE = 8,
  OFF_HIDE_HANGERS = 16
}
 The GO Factory state flags. More...

enum  of_flags { OFF_OPERATION_ACTIVE = 1, OFF_PATH_ON = 2, OFF_PATH_ACTIVE = 4, OFF_PATH_DESTROYED = 8 }
 The GO factory flags. More...


Functions

void win_o_init (struct window *window, uns type)
 Initialize the window with the given type, create the statusbar, initialize scheme proxy.

void win_o_finish (struct window *window)
 Finalize the window.

void change_context (struct window *window, struct go_group *group, struct o *o)
 Changes the current context and does some change notifications by calling some functions.

void main_window_create (void)
 Create the main window (the only instance in wnd_main).

void main_window_show (void)
 Show the main window (the only instance in wnd_main).

void main_window_refresh_menu (void)
void main_window_refresh_toolbar (void)
void create_universe_browser (void)
 Create the Universe browser window.

void ub_refresh_menu (void)
 Refresh the menu (and rebuild, if necessary.

void ub_context_changed (struct context *old_context)
 Show/hide the context icons where needed.

viewcreate_view (struct go_group *group)
 Create a view for the given group.

void close_view (struct view *vw)
 Close the view and deallocate all resources (some of them need to be deallocated before the window is destroyed).

void view_refresh_toolbar (struct view *vw)
void view_refresh_menu (void)
void view_update_grid (struct view *vw)
void transform_update (struct view *vw)
 Update and refresh the transformation box and gadgets.

void view_get_size (struct view *vw, uns *width, uns *height)
void view_moving_start (struct geom_point pix, struct view *vw, enum moving_mode mode, GdkCursorType cursor_type)
 Start moving in view.

void view_moving_end (void)
 End the moving, unset the cursor and set moving state to MOVE_NONE.

void view_moving_release (GdkEventButton *event, struct view *vw)
 Process the button release event of the moving drag.

void view_moving_motion (GdkEventMotion *event, struct view *vw)
 Save the last move coordinates and set the events_pending flag on.

void view_clicked (GdkEventButton *event, struct view *vw)
 Process the click event -- save the coordinates.

void view_selection_start (struct geom_point coords, struct geom_point coords_pix, struct view *vw)
 Start the rectangular selection.

int view_transform_start (GdkEventButton *event, struct geom_point coords, struct geom_point coords_pix, struct view *vw)
 Start the transformation drag move.

void view_s_transform_start (GdkEventButton *event, struct geom_point coords, struct geom_point coords_pix, struct view *view)
 Start the Santiago's transformation drag move.

void view_panning_start (struct geom_point coords_pix, struct view *vw)
 Start the panning move.

void view_panning_nav_start (struct geom_point coords, struct geom_point coords_pix, struct view *vw)
 Start the panning move in the View navigator.

void set_fifi_on (uns on)
 Set Fifi on or off.

void set_fifi_enabled (uns enabled)
 Enable or disable Fifi.

void transform_set_shift (int on, struct view *vw)
 Set or unset the shift mode of the tranformation box.

void transform_recalc_dimen (struct view *vw)
 Recalculate the dimension mode of the transformation bbox (empty, wide, high) and redisplay it.

void transform_recalc_all (struct view *vw)
 Recalculate the transformation box and gadget positions.

wnd_undo_historycreate_wnd_undo_history (struct obj_page *page)
 Create the undo history window.

void wuh_refresh_toolbar (struct wnd_undo_history *wuh)
void gui_fonts_finish (void)
 Destroy the allocated font list.

int fill_font_list (void)
 Fill the font list using the Fontconfig.

uns fonts_iter_to_font_id (GtkTreeIter *ti)
 Convert the TreeIter of the font list to font_id.

int fonts_compare_iter_with (GtkTreeIter *ti, char *filename)
 Compare the TreeIter of the font list with the font filename.

int fonts_get_default (void)
 Return the default or least recently used font_id.

void text_edit_create (struct o *o, string text_key)
 Create the text editor window.

void console_create (void)
void console_init (void)
void factory_init (void)
void factory_finish (void)
void factory_op_start (struct go_group *group, struct of_state *state, char *desc)
 Start a new factory operation.

void factory_op_break (void)
 Break the current operation -- return to the state before it.

void factory_moving_step (struct geom_point po)
 Move the factory cursor to the new point position.

void factory_op_step (void)
 Move to the next state.

int factory_merge_trans (void)
 Merge all partial transactions for the current operation.

void factory_op_step_back (void)
 Move to the previous state and undo the effect of the last step.

void factory_msg (const char *text)
 Output a factory message into the factory statusbar.

go * factory_get_created_go (void)
void snap_point (struct geom_point *pos, struct dist_pass_result *dpr, struct geom_transform2 *grid, struct obj_page *page, real maxdist)
 Snap the point using the current snap settings.

void snap_to_go (struct geom_point *pos, struct dist_pass_result *dpr, struct obj_page *page, real maxdist)
 Snap the point to an object using the current snap settings.

void snap_to_anchor (struct geom_point *pos, struct dist_pass_result *dpr, struct obj_page *page, real maxdist)
 Snap the point to an anchor using the current snap settings.

char * get_new_noname (void)
 Get a new name for an untitled document.

char * get_new_page_noname (struct obj_doc *doc)
 Get the name for a new untitled page in the document.

void refresh_gui (void)
 Update all the GUI widgets whose values depend on context or similar settings.

void main_quit (void)
 Closes all opened documents and does all neccessary cleaning before quitting.

GdkPixbuf * icon_load (const char *filename)
GtkWidget * image_get_from_icon (GdkPixbuf *icon)
void statusbar_clear (struct window *window)
void statusbar_msg (struct window *window, const char *fmt,...) FORMAT(2
void modify_selection (struct go *go, struct obj_page *page, GdkEventButton *event, struct geom_rectangle *rect, struct go_group *group)
 (Un)selects some objects according to the rect, go and group. If the rect is non-NULL, performs the rectangular selection within the rectangle rect. Otherwise, (un)selects the go. The (un)selection is done according to the keys pressed (passed in the event). Can also unselect all other gos within the given group, if non-NULL.

void modify_meta_selection (struct obj *obj, GdkEventButton *event)
 (Un)selects the obj according to the keys pressed (passed in the event.

float * new_float (float val)
 Allocates and fills memory with val.

char * str_trim (char *str)
 Cuts white chars from beginning and end of the str.

void on_file_new (void *subj)
void on_file_open (void *subj)
void on_svg_file_import (void *subj)
void on_import_ipe5 (void *subj)
void on_file_save (void *subj)
void on_file_save_all (void *subj)
void on_file_save_as (void *subj)
void on_file_close (void *subj)
void on_file_new_page (void *subj)
void on_file_close_page (void *subj)
void on_group_new_view (void *subj)
void on_page_new_view (void *subj)
void on_document_rerun_tex (void *subj)
void on_page_rerun_tex (void *subj)
void on_view_fit_selected (void *subj)
void on_view_fit_all (void *subj)
void on_view_zoom_in (void *subj)
void on_view_zoom_out (void *subj)
void on_view_zoom_reset (void *subj)
void on_export_pdf (void *subj)
void on_export_ps (void *subj)
void on_export_eps (void *subj)
void on_export_svg (void *subj)
void on_set_vrr_options (void *subj)
void on_help (void *subj)
void on_open_www (void *subj)
void on_show_about_window (void *subj)
void on_file_exit (void *subj)
void on_show_property_window (void *subj)
void on_show_console_window (void *subj)
void on_show_universe_browser (void *subj)
void on_show_main_window (void *subj)
void on_show_undo_history (void *subj)
void on_view_clipboard (void *subj)
void on_show_plugin_window (void *subj)
void on_show_unit_window (void *subj)
void on_show_settings_window (void *subj)
void on_show_style_window (void *subj)
void on_copy (void *subj)
void on_cut (void *subj)
void on_paste (void *subj)
void on_obj_copy (void *subj)
void on_obj_cut (void *subj)
void on_obj_paste (void *subj)
void on_group_selected (void *subj)
void on_group_ungroup (void *subj)
void on_group_pathize_selected (void *subj)
void on_group_select_all (void *subj)
void on_group_select_none (void *subj)
void on_move_up (void *subj)
void on_move_down (void *subj)
void on_move_front (void *subj)
void on_move_back (void *subj)
void on_page_move_up (void *subj)
void on_page_move_down (void *subj)
void on_page_move_front (void *subj)
void on_page_move_back (void *subj)
void on_create_proxy (void *subj)
void on_obj_undo (void *subj)
 UNDO and REDO.

void on_obj_redo (void *subj)
void on_page_undo (void *subj)
void on_page_redo (void *subj)
void on_hist_jump (void *subj)
void on_delete (void *subj)
void on_go_enclose_sel (void *subj)
void on_rotate90 (void *subj)
void on_rotate180 (void *subj)
void on_rotate270 (void *subj)
void on_flip_vertical (void *subj)
void on_flip_horizontal (void *subj)
void on_change_prop (void *subj)
 Change properties.

void on_edit_text (void *subj)
void on_undo_history (void *subj)
void on_dump (void *subj)
void on_kerntest (void *subj)
void on_random_point (void *subj)
void on_random_segment (void *subj)
void on_random_bezier_quad (void *subj)
void on_random_bezier_cubic (void *subj)
void on_path_switch (void *subj)
void on_path_end_close (void *subj)
void on_path_end (void *subj)
void on_step_back (void *subj)
void on_break_op (void *subj)
void on_snap_hangers (void *subj)
void on_snap_grid (void *subj)
void on_snap_lines (void *subj)
void on_snap_inters (void *subj)
void on_snap_depend (void *subj)
o * o_get_gui_ancestor (struct o *o)
 For an obj, returns his father obj.


Variables

GtkWidget * view_menu
 The popup menu of all views.

GSList * view_list
 The list of all existing views.

GtkWidget * main_window
 The one and the only main window instance.

console * console_window
 Console (the one and the only one :)).

context context
 The main GUI context.

wnd_main wnd_main
 The Main window instance.

wnd_univ_browser wnd_univ_browser
 The one and the only instance of the Universe browser window,.

wnd_settings wnd_settings
 The one and the only Global settings window instance.

wnd_style wnd_style
 The one and the only Style window instance.

wnd_plugins wnd_plugins
 The one and the only Plugin window instance.

enum moving_mode moving_mode
 The view moving mode of the one view where there was a move started recently.

GSList * wuh_list
 The list of opened undo history windows.

GSList * text_edit_list
 The list of all existing text editor windows.

GtkListStore * font_list
 The list of all fonts found by the Fontconfig.

of_state ofs_start
 The start state which must be the previous state of all the starting ones.

of_state ofs_end
 The ending state which must be the next state for all last states.

factory factory
 The one and the only GO Factory instance.

of_state ofs_select
of_state ofs_transform_x
of_state ofs_point
of_state ofs_decorator_pt
of_state ofs_arrow
of_state ofs_point_inters
of_state ofs_ngon_1
of_state ofs_segment_1
of_state ofs_bez_cub_1
of_state ofs_bez_quad_1
of_state ofs_arc_3p_1
of_state ofs_arc_center_radius_1
of_state ofs_circ_3p_1
of_state ofs_circ_center_pt_1
of_state ofs_circ_center_radius_1
of_state ofs_ellipse_3p_smallest_1
of_state ofs_ellipse_3p_ecc_1
of_state ofs_ellarc_center_radii_1
of_state ofs_ellipse_center_radii_1
of_state ofs_ellipse_foci_pt_1
of_state ofs_ellipse_xy1ecc_1
of_state ofs_transform_1
of_state ofs_rehang_1 ofs_rehang_2
of_state ofs_text_1
of_state ofs_tex_text_1
GdkPixbuf * icon_arrow_down
GdkPixbuf * icon_arrow_up
GdkPixbuf * icon_arrow_left
GdkPixbuf * icon_arrow_right
GdkPixbuf * icon_pencil_on
GdkPixbuf * icon_modified
GdkPixbuf * icon_rotation_left
GdkPixbuf * icon_rotation_right
GdkPixbuf * icon_zoom_in
GdkPixbuf * icon_zoom_out


Detailed Description

GUI - The main gui structures, windows, and functions.

Copyright (c) 2004-2005 The VRR Team <vrr@ucw.cz> This program is distributed under GNU General Public License, see COPYING.


Define Documentation

#define WIN_O_MAGIC   u8 type; SCM proxy; GtkWidget * statusbar; gint context_id
 

The common data for most GUI windows.

They are in the beginning of the structure to enable typecasts.


Enumeration Type Documentation

enum of_flags
 

The GO factory flags.

Enumeration values:
OFF_OPERATION_ACTIVE  If there is an active operation (not in the initial state, but with some input already obtained.
OFF_PATH_ON  If the path mode is on.
OFF_PATH_ACTIVE  If there is a path created.
OFF_PATH_DESTROYED  A path is just being destroyed by the factory.

enum ofs_flags
 

The GO Factory state flags.

Enumeration values:
OFF_FULL  If the state has its required input ready.
OFF_START_MOVE  If the state does start the move.
OFF_END_MOVE  If the state does end the move.
OFF_PATHABLE  If the state creates an object which can be contained in a path.
OFF_HIDE_HANGERS  If the state does not work with hangers, hide them.


Function Documentation

void create_universe_browser void   ) 
 

Create the Universe browser window.

The window data structure is the global wnd_univ_browser.

struct wnd_undo_history* create_wnd_undo_history struct obj_page *  page  ) 
 

Create the undo history window.

Returns:
A pointer to the allocated window structure.

int factory_merge_trans void   ) 
 

Merge all partial transactions for the current operation.

Returns nonzero if there was at least one new transaction since that.

void factory_op_start struct go_group *  group,
struct of_state state,
char *  desc
 

Start a new factory operation.

Parameters:
state The state to start with

void factory_op_step void   ) 
 

Move to the next state.

This function should be called when the input value for the current state is ready.

int fill_font_list void   ) 
 

Fill the font list using the Fontconfig.

Return values:
zero if succesful

char* get_new_noname void   ) 
 

Get a new name for an untitled document.

Returns:
The pointer to a static buffer (should not be freed).

char* get_new_page_noname struct obj_doc *  doc  ) 
 

Get the name for a new untitled page in the document.

Returns:
The pointer to a static buffer (should not be freed).

void main_quit void   ) 
 

Closes all opened documents and does all neccessary cleaning before quitting.

After that, terminates the program.

struct o* o_get_gui_ancestor struct o *  o  ) 
 

For an obj, returns his father obj.

For a go in a top level group, returns the page. For other gos, returns their father group.

void refresh_gui void   ) 
 

Update all the GUI widgets whose values depend on context or similar settings.

Sync all menus (enable/disable) the menu items, indicator icons, ...

void set_fifi_enabled uns  enabled  ) 
 

Enable or disable Fifi.

Parameters:
enabled Whether to enable Fifi

void set_fifi_on uns  on  ) 
 

Set Fifi on or off.

Parameters:
on Whether to show Fifi

void snap_point struct geom_point pos,
struct dist_pass_result dpr,
struct geom_transform2 grid,
struct obj_page *  page,
real  maxdist
 

Snap the point using the current snap settings.

Parameters:
pos The position to be snapped
dpr The result of the dist pass -- the nearest suitable object found
grid The view grid
page The parent page inside which to snap
maxdist The maximum snap distance

void snap_to_anchor struct geom_point pos,
struct dist_pass_result dpr,
struct obj_page *  page,
real  maxdist
 

Snap the point to an anchor using the current snap settings.

Parameters:
pos The position to be snapped
dpr The result of the dist pass -- the nearest suitable object found
page The parent page inside which to snap
maxdist The maximum snap distance

void snap_to_go struct geom_point pos,
struct dist_pass_result dpr,
struct obj_page *  page,
real  maxdist
 

Snap the point to an object using the current snap settings.

Parameters:
pos The position to be snapped
dpr The result of the dist pass -- the nearest suitable object found
page The parent page inside which to snap
maxdist The maximum snap distance

void text_edit_create struct o *  o,
string  text_key
 

Create the text editor window.

The window has three forms according to what object o is edited and what is the key identifier of the property. For the "text" property of a go_text and go_tex_text, it displays additional property editors.

void view_moving_start struct geom_point  pix,
struct view vw,
enum moving_mode  mode,
GdkCursorType  cursor_type
 

Start moving in view.

Set the given moving mode and the cursor of cursor_type to the view window.

Parameters:
pix the pixel coordinates of the startpoint


Generated on Tue Dec 9 16:30:09 2008 for Vrr by doxygen 1.3.5