Documentation ¶
Index ¶
- type Open_file
- type Velement
- func (ve *Velement) Contains(x float64, y float64) bool
- func (ve *Velement) Data_update(data string)
- func (ve *Velement) Get_dgroup() (dg *data_mgr.Data_group)
- func (ve *Velement) Get_name() string
- func (ve *Velement) Nuke(gc sketch.Graphics_api)
- func (ve *Velement) Paint(gc sketch.Graphics_api, scale float64)
- func (ve *Velement) Set_iscale(increment float64)
- func (ve *Velement) Set_scale(scale float64)
- func (ve *Velement) Tickle(data interface{})
- func (ve *Velement) Update(jbuf string)
- type View
- func (vp *View) Data_update(elename string, ibuf interface{})
- func (vp *View) Hard_click(ev *sktools.Interaction)
- func (vp *View) Json_update(elename string, jstr string)
- func (vp *View) Paint(gc sketch.Graphics_api, scale float64)
- func (vp *View) Set_scale(scale float64)
- func (vp *View) Tickle(elename string, ibuf interface{})
- func (vp *View) Update(ibuf interface{})
- type Vparser
- func (p *Vparser) Compute(vname string, ass_op string, tokens []string)
- func (p *Vparser) Crunch_rec(ibuf interface{}) (rtype string, result interface{})
- func (p *Vparser) Dump_st()
- func (p *Vparser) Expand(buf string) (ebuf string)
- func (p *Vparser) Expand_tokens(tokens []string) string
- func (p *Vparser) Get_origin() (x float64, y float64)
- func (p *Vparser) Restore()
- func (p *Vparser) Save()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Velement ¶
type Velement struct {
// contains filtered or unexported fields
}
View element -- something that can be converted into a drawing thing and painted using the graphics output mechanisms supported by the graphics api. Depending on the element, it could translate into multiple drawing things.
func Mk_velement ¶
func Mk_velement(ename string, xo float64, yo float64, scale float64, etype string, json string, data *data_mgr.Data_group) (ve *Velement, err error)
Mk_velement creates a view element loacted at the current xo,yo corridant using the given json string. The json is expected to be accepted format defined by the drawingthings package.
Scale is passed to the drawing thing maker should it be needed.
func (*Velement) Data_update ¶
Data_update accepts a data string which which is passed to the element to update its data. Data varies by element, so the contents of the string are important at the lower level and not looked at here.
func (*Velement) Get_dgroup ¶
func (ve *Velement) Get_dgroup() (dg *data_mgr.Data_group)
Get_ds returns the element's data group or nil if it doesn't exist.
func (*Velement) Nuke ¶
func (ve *Velement) Nuke(gc sketch.Graphics_api)
Nuke destroys what ever we need to clean up when we're done. Must specifically drive underlying dthing cleanup to eliminate subpages immediately, not when the GC runs.
func (*Velement) Paint ¶
func (ve *Velement) Paint(gc sketch.Graphics_api, scale float64)
Paint causes this element to be rendered on the output device defined by the graphics context (api) passed in.
func (*Velement) Set_iscale ¶
Set_iscale passes the given scale value to the underlying drawing thing for an incremental scale change. The increment value is added to the current scale setting.
func (*Velement) Set_scale ¶
Set_scale passes the given scale value to the underlying drawing thing.
func (*Velement) Tickle ¶
func (ve *Velement) Tickle(data interface{})
A tickle -- likely a button press on a menu
func (ve *Velement ) Tickle( data string ) {
type View ¶
type View struct {
// contains filtered or unexported fields
}
func MkScaledView ¶ added in v1.2.1
Read the view file from fname and create a view. We need the scale because some drawing things which create a subpage must scale that outside of the GC.
func Mk_view ¶
Deprecated! Original form (prevent scaled support from being breaking change). Defaults to a scale of 1.0. Use MkScaledView( fname, scale)
func (*View) Data_update ¶
Data_pdate processes a change/addition to an element's data. Elements have different data types:
text - string meter - single value graph - data group
We assume the buffer passed is of the form:
data_update element-name "data-value"
The data string is passed to the element for processing and each will liklely have a different expected format.
To change the element's properties (position, size, etc.) use the Update function.
func (*View) Hard_click ¶
func (vp *View) Hard_click(ev *sktools.Interaction)
func (*View) Json_update ¶
Same as update, but we assume that jstr contains the update json, and elename is the name that we should location. We assume this is invoked when sent a buffer of the form:
jupdate <name> <json information>
func (*View) Paint ¶
func (vp *View) Paint(gc sketch.Graphics_api, scale float64)
Paint renders all view elements, in order, using the graphics context (sketch) passed in. We assume that the underlying graphics medium is double buffered and thus needs to have every element drawn on each call, not just those who think they've changed.
func (*View) Set_scale ¶
Will set the scale for all elements in the view. Scale for images/graphs does affect size while for most other elements it only affects visibility if an element is painted only when at a certain scale setting.
type Vparser ¶
type Vparser struct {
// contains filtered or unexported fields
}
func Mk_vparser ¶
Mk_vparser creates the parser struct which is needed to parse or get information about the parsed data.
func (*Vparser) Compute ¶
Compute accepts a variable name, assignment operator, and expression tokens. The expression tokens are evaluated as a reverse polish expression (e.g. 1 2 3 + + or 1 2 * 4 + 6 /) and the result is stored into the named variable using the assignment operator:
= direct replacement += add to current value -= subtract from current value *= current value is multipled by result /= current value is divided by result if result !0
Tokens are expanded, so it is not necessary to expand prior to calling. Any invalid number is treated as a 0. If an expression resulted in zero tokens, then a 0 is applied per the assignment operator.
func (*Vparser) Crunch_rec ¶
Crunch a record from the view input. Returns record type and json if it's an element. View record has the format:
<type> <key>:["]value["] var <vname> <value> orig <x>,<y> delta <delta-x>,<delta-y> Variables are substituted in values using $vname, ${vname} or ${vname:-default} syntax.
Returns the record type and a pointer to the resuting data struct (Velement, or string) as an interface.
func (*Vparser) Dump_st ¶
func (p *Vparser) Dump_st()
Dump_st spits the parser's symbol table out to standard error.
func (*Vparser) Expand ¶
Expand searches a string for any $name or ${name} strings and expand with the current value in the symbol tab. We allow the following derefernce syntax:
$vname ${vname}[junk] (junk not treated as part of the name, and is appended to the expansion ${vname:-default}
Var references s must be separated by space or tab, or the name must be wrapped in curly braces.
func (*Vparser) Expand_tokens ¶
Expand_tokens ccepts a slice of string pointers and builds an expanded string. Comments (anything after a token with a single hash (#) are removed.
func (*Vparser) Get_origin ¶
Get origin returns the current x,y coordinates of the origin.