# This software is distributed under the Lesser General Public License
#
# inspector/attributes.tcl
#
# Definition of all node/edge attributes handled by the inspector
#
#------------------------------------------ CVS
#
# CVS Headers -- The following headers are generated by the CVS
# version control system. Note that especially the attribute
# Author is not necessarily the author of the code.
#
# $Source: /home/br/CVS/graphlet/lib/graphscript/inspector/init.tcl,v $
# $Author: forster $
# $Revision: 1.15 $
# $Date: 1999/03/01 16:58:31 $
# $Locker:  $
# $State: Exp $
#
#------------------------------------------ CVS
#
# (C) University of Passau 1995-1999, Graphlet Project
#     Author: Michael Forster

package require Graphlet
package provide Graphscript [gt_version]

namespace eval ::GT::IS {

    namespace export init

    proc init { } {
	variable _Pages
	variable _PageTitle
	variable _PageLayout
	variable _PageAttrs
	variable _PageCtls
	variable _Initialized
	variable _Constraint
	variable _DefaultValue
	variable _Options
	global tcl_platform

	# not supported:
	#   n-graphics-bitmap
	#   n-graphics-anchor
	#   n-graphics-foreground
	#   n-graphics-background
	
	set inspectorLayout {
	    
	    node_attributes "Node Attributes" {
		type "Type" {
		    shape_ctl shape_ctl {
			n-graphics-type
			n-graphics-start
			n-graphics-extent
			n-graphics-style
			n-graphics-line
			n-graphics-image
		    }
		}
	    }
	    
	    edge_attributes "Edge Attributes" {
		bends "Bends" {
		    bends_ctl ctl {
			e-graphics-line
			e-graphics-joinstyle
		    }
		}
		linestyle "Endings" {
		    linestyle_ctl ctl {
			e-graphics-capstyle
			e-graphics-arrow
			e-graphics-arrowshape_touching_length
			e-graphics-arrowshape_overall_length
			e-graphics-arrowshape_width
		    }
		}
	    }

	    common_attributes "Common Attributes" {
		colors "Colors" {
		    generic_ctl color_ctl {
			b-graphics-fill
			n-graphics-outline
		    }
		}
		stipple "Stipple" {
		    stipple_ctl stipple_ctl {
			b-graphics-stipple
		    }
		}
		line_attrs "Line Attributes" {
		    generic_ctl	ctl {
			b-graphics-width
			b-graphics-smooth
		    }
		}
	    }
	    
	    ports "Ports" {
		ports "Ports" {
		    ports_ctl ports {
			n--ports
		    }
		}
		default "Default Anchor" {
		    generic_ctl ctl {
			n--default_function
		    }
		}
	    }
	    
	    edge_anchors "Edge Anchors" {
		source "Source Anchor" {
		    edge_anchor_ctl ctl {
			e--source
			e--source_anchor
			e--delta_x_source
			e--delta_y_source
		    }
		}
		target "Target Anchor" {
		    edge_anchor_ctl ctl {
			e--target
			e--target_anchor
			e--delta_x_target
			e--delta_y_target
		    }
		}
	    }
	    
	    geometry "Geometry" {
		pos "Position" {
		    generic_ctl ctl {
			n-graphics-x
			n-graphics-y
		    }
		}
		size "Size" {
		    generic_ctl size {
			n-graphics-w
			n-graphics-h
		    }
		}
	    }
	    
	    label "Label" {
		font "Font" {
		    font_ctl font {
			b-label_graphics-font
			b-label_graphics-font_size
			b-label_graphics-fill
			b-label_graphics-font_style
		    }
		}
		stipple "Stipple" {
		    stipple_ctl stipple_ctl {
			b-label_graphics-stipple
		    }
		}
		justify "Justify" {
		    justify_ctl justify_ctl {
			b-label_graphics-justify
		    }
		}
		anchor "Anchor" {
		    label_anchor_ctl ctl {
			n--label_anchor
			n-label_graphics-anchor
		    }
		}
	    }
	}

	foreach { pageName pageTitle pageLayout } $inspectorLayout {
	    lappend _Pages $pageName
	    
	    set _PageTitle($pageName) $pageTitle
	    set _PageLayout($pageName) $pageLayout
	    set _PageAttrs($pageName) {}
	    set _PageCtls($pageName) {}
	    
	    foreach { regionName regionTitle regionLayout } $pageLayout {
		foreach { controlType controlName controlAttrs } $regionLayout {
		    
		    lappend _PageCtls($pageName) $controlType $regionName $controlName
		    set _PageAttrs($pageName) [concat $_PageAttrs($pageName) $controlAttrs]
		    
		}
	    }
	}

	set attrs {		
	    b--label					""			{ }
	    b--name					""			{ }
	    b--visible					1			{ bool }
	    b-graphics-fill				white			{ color }
	    b-graphics-smooth				0			{ bool }
	    b-graphics-splinesteps 			-1			{ number -1 {} 1 }
	    b-graphics-stipple				{}			{ list solid gray12 gray25 gray50 gray75 }
	    b-graphics-width				1			{ number 0 {} 1 }
	    b-label_graphics-fill 			black			{ color }
	    b-label_graphics-font_size 			{}			{ number 0 {} 1 }
	    b-label_graphics-font_style			{}			{ list roman bold italic "bold italic" }
	    b-label_graphics-justify 			left			{ list left right center }
	    b-label_graphics-stipple 			{}			{ list solid gray12 gray25 gray50 gray75 }
	    e--delta_x_source				0			{ number -1 1 0.1 }
	    e--delta_x_target				0			{ number -1 1 0.1 }
	    e--delta_y_source				0			{ number -1 1 0.1 }
	    e--delta_y_target				0			{ number -1 1 0.1 }
	    e--source					{}			{ }
	    e--source_anchor				{}			{ }
	    e--target					{}			{ }
	    e--target_anchor				{}			{ }
	    e-graphics-arrow				none			{ list none first last both }
	    e-graphics-arrowshape_overall_length	{}			{ number 0 {} 1 }
	    e-graphics-arrowshape_touching_length	{}			{ number 0 {} 1 }
	    e-graphics-arrowshape_width			{}			{ number 0 {} 1 }
	    e-graphics-capstyle				butt			{ list butt projecting round }
	    e-graphics-joinstyle			bevel			{ list bevel miter round }
	    e-graphics-line				{}			{ }
	    n--default_function				none			{ list none orthogonal middle corner }
	    n--label_anchor				c			{ list nw n ne w c e sw s se }
	    n--ports					{}			{ }
	    n-graphics-anchor				c			{ list nw n ne w c e sw s se }
	    n-graphics-background			white			{ color }
	    n-graphics-bitmap				{}			{ }
	    n-graphics-extent				90			{ number 0 360 1 }
	    n-graphics-foreground			white			{ color }
	    n-graphics-h			  	20			{ number 0 {} 1 }
	    n-graphics-image				{}			{ }
	    n-graphics-line				{ 0 -1 1 0 0 1 -1 0 }	{ }
	    n-graphics-outline				black			{ color }
	    n-graphics-start				0			{ number 0 360 1 }
	    n-graphics-style				pieslice		{ list arc chord pieslice }
	    n-graphics-type				{}			{ list rectangle oval arc polygon line bitmap } 
	    n-graphics-w				20			{ number 0 {} 1 }
	    n-graphics-x				0			{ number {} {} 1 }
	    n-graphics-y				0			{ number {} {} 1 }
	    n-label_graphics-anchor 			c			{ list nw n ne w c e sw s se }
	}

	lappend attrs \
	    "b-label_graphics-font" {} [concat "list" [lsort [font families]]] \

	foreach { attr default constraint } $attrs {
	    set _Constraint($attr) $constraint
	    set _DefaultValue($attr) $default
	}

	set _Initialized 1

	# colors

	array set _Options {
	    color,border,outline		darkgrey
	    color,border,fill			{}
	    color,marker,outline		black
	    color,marker,fill			white
	    color,marker,outline,selected	black
	    color,marker,fill,selected		red
	    color,template,outline		black
	    color,template,fill			darkgrey
	    color,label,outline			black
	    color,label,fill			white
	    color,enabled_text			black
	    color,disabled_text			darkgrey

	    marker_size				{ 6 6 }
	    ctl_borders				{ 25 5 }
	}

	if { $tcl_platform(platform) == "unix" } {
	    array set _Options {
		raised			groove
		sunken			ridge
	    }
	    option add *Inspector*font { Helvetica 10 roman }
	    option add *Inspector*Scrollbar.width 10
	} else {
	    array set _Options {
		raised			ridge
		sunken			groove
	    }
	    option add *Inspector*font { "MS Sans Serif" 8 roman }
	}

	global GT_options
	set _Options(dock) $GT_options(inspector_dock_into_editor)
    }

}

#---------------------------------------------------------------------------
#   Set emacs variables
#---------------------------------------------------------------------------
# ;;; Local Variables: ***
# ;;; mode: tcl ***
# ;;; tcl-indent-level: 4 ***
# ;;; End: ***
#---------------------------------------------------------------------------
#   end of file
#---------------------------------------------------------------------------

