mrg_ui/src/mtktextbuffer.cxx
//============================================================================
// Return the current starting offset and length of the given region.
// If the region is being tracked, these values are brought up to date.
// If not, tracking is begun.
//
Return the current starting offset and length of the given region.
If the region is being tracked, these values are brought up to date.
If not, tracking is begun.
Return the current starting offset and length of the given region . If the region is being tracked these values are brought up to date . If not tracking is begun .
void textBuffer::GetRegionRange(Region *region, int &start, int &length)
{
    Tcl_Interp *itrp = framework.interp;
    char *m = GetMarker(region);
    if (!tagAlive(m)) {
	framework.Tcl("makeTag %s %s %d %d",
		       tk_name.str(),
		       m,
		       region->offset,
		       region->offset + region->length);
	start = region->offset;
	length = region->length;
    }
    else {
	int index;
	start = region->offset;
	length = region->length;
	if (framework.Tcl("indexToOffset %s %s.first", tk_name.str(), m)
                == TCL_OK
	    && Tcl_GetInt(itrp, itrp->result, &index) == TCL_OK) {
	    start = index;
	    if (framework.Tcl("indexToOffset %s %s.last", tk_name.str(), m)
                    == TCL_OK 
		&& Tcl_GetInt(itrp, itrp->result, &index) == TCL_OK) {
		length = index - start;
	    }
	}
    }
}
void textBuffer :: GetRegionRange ( Region * region , int & start , int & length ) { Tcl_Interp * itrp = framework . interp ; char * m = GetMarker ( region ) ; if ( ! tagAlive ( m ) ) { framework . Tcl ( " " , tk_name . str ( ) , m , region -> offset , region -> offset + region -> length ) ; start = region -> offset ; length = region -> length ; } else { int index ; start = region -> offset ; length = region -> length ; if ( framework . Tcl ( " " , tk_name . str ( ) , m ) == TCL_OK && Tcl_GetInt ( itrp , itrp -> result , & index ) == TCL_OK ) { start = index ; if ( framework . Tcl ( " " , tk_name . str ( ) , m ) == TCL_OK && Tcl_GetInt ( itrp , itrp -> result , & index ) == TCL_OK ) { length = index - start ; } } } }
Return the current starting offset and length of the given region.
Return the current starting offset and length of the given region .
// Tag does not yet exist.