Tk Source Code

Check-in [1a6d9912]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Realization of global default value for tag option -undo (bug report [5a670c16ba]).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | revised_text-aside
Files: files | file ages | folders
SHA3-256: 1a6d99122ac9c040e2eaf56a66ba4e4425b2c455ca6c7583b5ae3f99ea974cf0
User & Date: gcramer 2019-01-01 15:00:43
References
2019-01-01
15:07 Ticket [5a670c16] Revised text: -undo tag option default should be changed status still Open with 3 other changes artifact: e1fd84d7 user: gcramer
Context
2019-01-03
21:45
Realization of global default value for tag option -undo (bug report [5a670c16ba]). check-in: a263e6c9 user: jan.nijtmans tags: revised_text, tip-466
19:38
Make the sync command generate a <<WidgetViewSync>> event after updating all line metrics. Merge the modified 11a-* tests from the legacy widget. Closed-Leaf check-in: 4aca5dbe user: culler tags: revised_text-aside
2019-01-01
15:00
Realization of global default value for tag option -undo (bug report [5a670c16ba]). check-in: 1a6d9912 user: gcramer tags: revised_text-aside
2018-12-31
16:32
Fix gcc warning: tkText.c:5159:55: warning: division ‘sizeof (TkTextPosition * {aka struct TkTextPosition *}) / sizeof (TkTextPosition {aka struct TkTextPosition})’ does not compute the number of array elements [-Wsizeof-pointer-div] which turns out to be an actual - but harmless - bug check-in: 1b803cf9 user: jan.nijtmans tags: revised_text-aside
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to doc/text.n.

   483    483   mode), but only if a preceding character exists in this line. This mode is
   484    484   commonly used in some text editors.
   485    485   .IP "\fBnone\fR"
   486    486   The new text will not receive any tags from surrounded text.
   487    487   .RE
   488    488   .OP \-undo undo Undo
   489    489   Specifies a boolean that says whether the undo mechanism is active or not.
          490  +.OP \-undotagging undoTagging UndoTagging
          491  +This boolean value specifies the setup value for \fB-undo\fR option when
          492  +creating tags. Per default the setup value is \fItrue\fR. Note that this
          493  +value will not be used for the special tag \fBsel\fR. See description of
          494  +tag option \fB-undo\fR for more information.
   490    495   .OP \-width width Width
   491    496   Specifies the desired width for the window in units of characters in the font
   492    497   given by the \fB\-font\fR option. If the font does not have a uniform width
   493    498   then the width of the character
   494    499   .QW 0
   495    500   is used in translating from character units to screen units.
   496    501   .OP \-useunibreak useUniBreak UseUniBreak
................................................................................
  1112   1117   may be removed in a future version.
  1113   1118   See equivalent tag option \fB\-underlinecolor\fR for a description.
  1114   1119   .TP
  1115   1120   \fB\-undo \fIboolean\fR
  1116   1121   .
  1117   1122   Specifies whether adding/removing this tag to/from text will be undone with
  1118   1123   \fBundo\fR operation. If this flag is \fIfalse\fR, then changes of tag
  1119         -associations will not be undone for this tag. The default is \fItrue\fR, except
  1120         -for the special selection flag \fBsel\fR, the default for this tag is \fIfalse\fR.
         1124  +associations will not be undone for this tag. The default is given with
         1125  +text option \fB-undotagging\fR (normally \fItrue\fR), except for the special
         1126  +selection flag \fBsel\fR, the default for this tag is always \fIfalse\fR.
  1121   1127   .TP
  1122   1128   \fB\-wrap \fImode\fR
  1123   1129   .
  1124   1130   \fIMode\fR specifies how to handle lines that are wider than the text's
  1125   1131   window. This option only applies to a display line if it applies to the
  1126   1132   first non-elided character on that display line. It has the same legal
  1127   1133   values as the \fB\-wrap\fR option for the text widget: \fBnone\fR,

Changes to generic/tkText.c.

     5      5    *	editable text widgets for Tk. Among other things, it provides the Tcl
     6      6    *	command interfaces to text widgets. The B-tree representation of text
     7      7    *	and its actual display are implemented elsewhere.
     8      8    *
     9      9    * Copyright (c) 1992-1994 The Regents of the University of California.
    10     10    * Copyright (c) 1994-1996 Sun Microsystems, Inc.
    11     11    * Copyright (c) 1999 by Scriptics Corporation.
    12         - * Copyright (c) 2015-2017 Gregor Cramer
           12  + * Copyright (c) 2015-2018 Gregor Cramer
    13     13    *
    14     14    * See the file "license.terms" for information on usage and redistribution of
    15     15    * this file, and for a DISCLAIMER OF ALL WARRANTIES.
    16     16    */
    17     17   
    18     18   #include "tkInt.h"
    19     19   #include "tkText.h"
................................................................................
   373    373       {TK_OPTION_CUSTOM, "-startline", NULL, NULL,
   374    374   	 NULL, -1, Tk_Offset(TkText, startLine), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE},
   375    375   #endif
   376    376       {TK_OPTION_STRING_TABLE, "-state", "state", "State",
   377    377   	DEF_TEXT_STATE, -1, Tk_Offset(TkText, state), 0, stateStrings, 0},
   378    378       {TK_OPTION_BOOLEAN, "-steadymarks", "steadyMarks", "SteadyMarks",
   379    379   	"0", -1, Tk_Offset(TkText, steadyMarks), TK_OPTION_DONT_SET_DEFAULT, 0, 0},
   380         -    {TK_OPTION_INT, "-synctime", "syncTime", "SyncTime", "150", -1, Tk_Offset(TkText, syncTime),
   381         -	0, 0, TK_TEXT_SYNCHRONIZE},
          380  +    {TK_OPTION_INT, "-synctime", "syncTime", "SyncTime",
          381  +	"150", -1, Tk_Offset(TkText, syncTime), 0, 0, TK_TEXT_SYNCHRONIZE},
   382    382       {TK_OPTION_STRING, "-tabs", "tabs", "Tabs",
   383    383   	DEF_TEXT_TABS, Tk_Offset(TkText, tabOptionPtr), -1, TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY},
   384    384       {TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle",
   385    385   	DEF_TEXT_TABSTYLE, -1, Tk_Offset(TkText, tabStyle), 0, tabStyleStrings, TK_TEXT_LINE_GEOMETRY},
   386    386       {TK_OPTION_STRING_TABLE, "-tagging", "tagging", "Tagging",
   387    387   	"within", -1, Tk_Offset(TkText, tagging), 0, taggingStrings, 0},
   388    388       {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus",
   389    389   	DEF_TEXT_TAKE_FOCUS, -1, Tk_Offset(TkText, takeFocus), TK_OPTION_NULL_OK, 0, 0},
   390    390       {TK_OPTION_BOOLEAN, "-undo", "undo", "Undo",
   391    391   	DEF_TEXT_UNDO, -1, Tk_Offset(TkText, undo), TK_OPTION_DONT_SET_DEFAULT, 0 ,0},
          392  +    {TK_OPTION_BOOLEAN, "-undotagging", "undoTagging", "UndoTagging",
          393  +	"1", -1, Tk_Offset(TkText, undoTagging), 0, 0 ,0},
   392    394       {TK_OPTION_BOOLEAN, "-useunibreak", "useUniBreak", "UseUniBreak",
   393    395   	"0", -1, Tk_Offset(TkText, useUniBreak), 0, 0, TK_TEXT_LINE_GEOMETRY},
   394    396       {TK_OPTION_INT, "-width", "width", "Width",
   395    397   	DEF_TEXT_WIDTH, -1, Tk_Offset(TkText, width), 0, 0, TK_TEXT_LINE_GEOMETRY},
   396    398       {TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap",
   397    399   	DEF_TEXT_WRAP, -1, Tk_Offset(TkText, wrapMode), 0, wrapStrings, TK_TEXT_LINE_GEOMETRY},
   398    400       {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
................................................................................
  1046   1048   	sharedTextPtr->affectGeometryTags = TkBitResize(NULL, TK_TEXT_SET_MAX_BIT_SIZE);
  1047   1049   	sharedTextPtr->affectGeometryNonSelTags = TkBitResize(NULL, TK_TEXT_SET_MAX_BIT_SIZE);
  1048   1050   	sharedTextPtr->affectLineHeightTags = TkBitResize(NULL, TK_TEXT_SET_MAX_BIT_SIZE);
  1049   1051   	sharedTextPtr->tagLookup = malloc(TK_TEXT_SET_MAX_BIT_SIZE*sizeof(TkTextTag *));
  1050   1052   	sharedTextPtr->emptyTagInfoPtr = TkTextTagSetResize(NULL, 0);
  1051   1053   	sharedTextPtr->maxRedoDepth = -1;
  1052   1054   	sharedTextPtr->autoSeparators = true;
         1055  +	sharedTextPtr->undoTagging = true;
  1053   1056   	sharedTextPtr->lastEditMode = TK_TEXT_EDIT_OTHER;
  1054   1057   	sharedTextPtr->lastUndoTokenType = -1;
  1055   1058   	sharedTextPtr->startMarker = TkTextMakeStartEndMark(NULL, &tkTextLeftMarkType);
  1056   1059   	sharedTextPtr->endMarker = TkTextMakeStartEndMark(NULL, &tkTextRightMarkType);
  1057   1060   	sharedTextPtr->protectionMark[0] = TkTextMakeMark(NULL, NULL);
  1058   1061   	sharedTextPtr->protectionMark[1] = TkTextMakeMark(NULL, NULL);
  1059   1062   	sharedTextPtr->protectionMark[0]->typePtr = &tkTextProtectionMarkType;
................................................................................
  1172   1175        */
  1173   1176   
  1174   1177       TkTextCreateDInfo(textPtr);
  1175   1178       TkTextIndexSetupToStartOfText(&startIndex, textPtr, sharedTextPtr->tree);
  1176   1179       TkTextSetYView(textPtr, &startIndex, 0);
  1177   1180       textPtr->exportSelection = true;
  1178   1181       textPtr->pickEvent.type = LeaveNotify;
  1179         -    textPtr->steadyMarks = textPtr->sharedTextPtr->steadyMarks;
  1180         -    textPtr->undo = textPtr->sharedTextPtr->undo;
  1181         -    textPtr->maxUndoDepth = textPtr->sharedTextPtr->maxUndoDepth;
  1182         -    textPtr->maxRedoDepth = textPtr->sharedTextPtr->maxRedoDepth;
  1183         -    textPtr->maxUndoSize = textPtr->sharedTextPtr->maxUndoSize;
  1184         -    textPtr->autoSeparators = textPtr->sharedTextPtr->autoSeparators;
         1182  +    textPtr->steadyMarks = sharedTextPtr->steadyMarks;
         1183  +    textPtr->undo = sharedTextPtr->undo;
         1184  +    textPtr->maxUndoDepth = sharedTextPtr->maxUndoDepth;
         1185  +    textPtr->maxRedoDepth = sharedTextPtr->maxRedoDepth;
         1186  +    textPtr->maxUndoSize = sharedTextPtr->maxUndoSize;
         1187  +    textPtr->autoSeparators = sharedTextPtr->autoSeparators;
         1188  +    textPtr->undoTagging = sharedTextPtr->undoTagging;
  1185   1189   
  1186   1190       /*
  1187   1191        * Create the "sel" tag and the "current" and "insert" marks.
  1188   1192        * Note: it is important that textPtr->selTagPtr is NULL before this
  1189   1193        * initial call.
  1190   1194        */
  1191   1195   
................................................................................
  3875   3879       Tcl_Obj *const objv[])	/* Argument objects. */
  3876   3880   {
  3877   3881       Tk_SavedOptions savedOptions;
  3878   3882       TkTextIndex start, end, current;
  3879   3883       TkSizeT currentEpoch;
  3880   3884       TkSharedText *sharedTextPtr = textPtr->sharedTextPtr;
  3881   3885       TkTextBTree tree = sharedTextPtr->tree;
         3886  +    bool copyDownFlags = false;
  3882   3887       bool oldExport = (textPtr->exportSelection) && (!Tcl_IsSafe(textPtr->interp));
  3883   3888       bool oldTextDebug = tkTextDebug;
  3884   3889       bool didHyphenate = textPtr->hyphenate;
         3890  +    bool oldUndoTagging = textPtr->undoTagging;
  3885   3891       int oldHyphenRules = textPtr->hyphenRules;
  3886   3892       int mask = 0;
  3887         -    bool copyDownFlags = false;
  3888   3893   
  3889   3894       tkTextDebug = false; /* debugging is not useful here */
  3890   3895   
  3891   3896   #if SUPPORT_DEPRECATED_STARTLINE_ENDLINE
  3892   3897   
  3893   3898       /*
  3894   3899        * We want also to support the "-start", and "-end" abbreviations. The thing that
................................................................................
  4063   4068   	    goto error;
  4064   4069   	}
  4065   4070       }
  4066   4071   
  4067   4072       /*
  4068   4073        * Copy up shared flags.
  4069   4074        */
         4075  +
         4076  +    /*
         4077  +     * Update default value for undoing tag operations.
         4078  +     */
         4079  +
         4080  +    if (oldUndoTagging != textPtr->undoTagging) {
         4081  +	sharedTextPtr->undoTagging = textPtr->undoTagging;
         4082  +	copyDownFlags = true;
         4083  +    }
  4070   4084   
  4071   4085       /* This flag cannot alter if we have peers. */
  4072   4086       sharedTextPtr->steadyMarks = textPtr->steadyMarks;
  4073   4087   
  4074   4088       if (sharedTextPtr->autoSeparators != textPtr->autoSeparators) {
  4075   4089   	sharedTextPtr->autoSeparators = textPtr->autoSeparators;
  4076   4090   	copyDownFlags = true;
................................................................................
  4129   4143   
  4130   4144   	for (tPtr = sharedTextPtr->peers; tPtr; tPtr = tPtr->next) {
  4131   4145   	    tPtr->autoSeparators = sharedTextPtr->autoSeparators;
  4132   4146   	    tPtr->maxUndoDepth = sharedTextPtr->maxUndoDepth;
  4133   4147   	    tPtr->maxRedoDepth = sharedTextPtr->maxRedoDepth;
  4134   4148   	    tPtr->maxUndoSize = sharedTextPtr->maxUndoSize;
  4135   4149   	    tPtr->undo = sharedTextPtr->undo;
         4150  +	    tPtr->undoTagging = sharedTextPtr->undoTagging;
  4136   4151   	}
  4137   4152       }
  4138   4153   
  4139   4154       /*
  4140   4155        * Check soft hyphen support.
  4141   4156        */
  4142   4157   

Changes to generic/tkText.h.

     1      1   /*
     2      2    * tkText.h --
     3      3    *
     4      4    *	Declarations shared among the files that implement text widgets.
     5      5    *
     6      6    * Copyright (c) 1992-1994 The Regents of the University of California.
     7      7    * Copyright (c) 1994-1995 Sun Microsystems, Inc.
     8         - * Copyright (c) 2015-2017 Gregor Cramer
            8  + * Copyright (c) 2015-2018 Gregor Cramer
     9      9    *
    10     10    * See the file "license.terms" for information on usage and redistribution of
    11     11    * this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12     12    */
    13     13   
    14     14   #ifndef _TKTEXT
    15     15   #define _TKTEXT
................................................................................
  1198   1198   				 * be cleared, or the user is clearing. */
  1199   1199       bool userHasSetModifiedFlag;/* Flag indicating if the user has set the 'modified' flag.
  1200   1200       				 * Value 'true' is superseding the computed value, but value
  1201   1201   				 * 'false' is only clearing to the initial state of this flag. */
  1202   1202       bool undoStackEvent;	/* Flag indicating whether <<UndoStack>> is already triggered. */
  1203   1203       bool pushSeparator;		/* Flag indicating whether a separator has to be pushed before next
  1204   1204       				 * insert/delete item. */
         1205  +    bool undoTagging;		/* Global default value for TkTextTag::undo. */
  1205   1206       unsigned undoLevel;		/* The undo level which corresponds to the unmodified state. */
  1206   1207       TkTextEditMode lastEditMode;/* Keeps track of what the last edit mode was. */
  1207   1208       int lastUndoTokenType;	/* Type of newest undo token on stack. */
  1208   1209       TkTextTag **undoTagList;	/* Array of tags, prepared for undo stack. */
  1209   1210       TkTextMarkChange *undoMarkList;
  1210   1211       				/* Array of mark changes, prepared for undo stack. */
  1211   1212       uint32_t undoTagListCount;	/* Number of entries in array 'undoTagList'. */
................................................................................
  1486   1487        * Copies of information from the shared section relating to the editor control mode:
  1487   1488        */
  1488   1489   
  1489   1490       int steadyMarks;		/* false = behavior of original implementation,
  1490   1491       				 * true  = new editor control mode. */
  1491   1492   
  1492   1493       /*
  1493         -     * Copies of information from the shared section relating to the undo/redo functonality:
         1494  +     * Copies of information from the shared section relating to the undo/redo functionality:
  1494   1495        */
  1495   1496   
  1496   1497       int undo;			/* Non-zero means the undo/redo behaviour is enabled. */
  1497   1498       int maxUndoDepth;		/* The maximum depth of the undo stack expressed as the
  1498   1499       				 * maximum number of compound statements. */
  1499   1500       int maxRedoDepth;		/* The maximum depth of the redo stack expressed as the
  1500   1501       				 * maximum number of compound statements. */
  1501   1502       int maxUndoSize;		/* The maximum number of bytes kept on the undo stack. */
  1502   1503       int autoSeparators;		/* Non-zero means the separators will be inserted automatically. */
         1504  +    bool undoTagging;		/* Global default value for TkTextTag::undo. */
  1503   1505   
  1504   1506       /*
  1505   1507        * Support of sync command:
  1506   1508        */
  1507   1509   
  1508   1510       Tcl_Obj *afterSyncCmd;	/* Commands to be executed when lines are up to date */
  1509   1511   

Changes to generic/tkTextTag.c.

     3      3    *
     4      4    *	This module implements the "tag" subcommand of the widget command for
     5      5    *	text widgets, plus most of the other high-level functions related to
     6      6    *	tags.
     7      7    *
     8      8    * Copyright (c) 1992-1994 The Regents of the University of California.
     9      9    * Copyright (c) 1994-1997 Sun Microsystems, Inc.
    10         - * Copyright (c) 2015-2017 Gregor Cramer
           10  + * Copyright (c) 2015-2018 Gregor Cramer
    11     11    *
    12     12    * See the file "license.terms" for information on usage and redistribution of
    13     13    * this file, and for a DISCLAIMER OF ALL WARRANTIES.
    14     14    */
    15     15   
    16     16   #include "tkInt.h"
    17     17   #include "tkText.h"
................................................................................
  2021   2021        * No existing entry. Create a new one, initialize it, and add a pointer
  2022   2022        * to it to the hash table entry.
  2023   2023        */
  2024   2024   
  2025   2025       tagPtr = calloc(1, sizeof(TkTextTag));
  2026   2026       tagPtr->name = name;
  2027   2027       tagPtr->index = index;
  2028         -    tagPtr->priority = textPtr->sharedTextPtr->numEnabledTags;
         2028  +    tagPtr->priority = sharedTextPtr->numEnabledTags;
  2029   2029       tagPtr->isSelTag = isSelTag;
  2030   2030       tagPtr->bgStipple = 0;
  2031   2031       tagPtr->fgStipple = 0;
  2032   2032       tagPtr->justify = TK_TEXT_JUSTIFY_LEFT;
  2033   2033       tagPtr->tabStyle = TK_TEXT_TABSTYLE_NONE;
  2034   2034       tagPtr->wrapMode = TEXT_WRAPMODE_NULL;
  2035         -    tagPtr->undo = !isSelTag;
         2035  +    tagPtr->undo = sharedTextPtr->undoTagging && !isSelTag;
  2036   2036       tagPtr->sharedTextPtr = sharedTextPtr;
  2037   2037       tagPtr->undoTagListIndex = -1;
  2038   2038       tagPtr->refCount = 1;
  2039   2039       tagPtr->tagEpoch = ++sharedTextPtr->tagEpoch;
  2040   2040       DEBUG_ALLOC(tkTextCountNewTag++);
  2041   2041   
  2042   2042       tagPtr->optionTable = Tk_CreateOptionTable(textPtr->interp, tagOptionSpecs);
  2043   2043       assert(!tagPtr->reliefPtr);
  2044   2044   
  2045         -    textPtr->sharedTextPtr->numTags += 1;
  2046         -    textPtr->sharedTextPtr->numEnabledTags += 1;
         2045  +    sharedTextPtr->numTags += 1;
         2046  +    sharedTextPtr->numEnabledTags += 1;
  2047   2047   
  2048   2048       if (isSelTag) {
  2049   2049   	tagPtr->textPtr = textPtr;
  2050   2050   	textPtr->refCount += 1;
  2051   2051   	TkBitSet(sharedTextPtr->selectionTags, index);
  2052   2052   	TkBitSet(sharedTextPtr->dontUndoTags, index);
  2053   2053       } else {

Changes to tests/text.test.

  1080   1080   test text-1.108 {configuration option: "useunibreak"} -setup {
  1081   1081       text .t
  1082   1082       pack .t
  1083   1083       update
  1084   1084   } -body {
  1085   1085       .t configure -useunibreak eh
  1086   1086   } -cleanup {
         1087  +    destroy .t
         1088  +} -match glob -returnCodes {error} -result {*}
         1089  +test text-1.109 {configuration option: "undotagging"} -setup {
         1090  +    text .t
         1091  +    update
         1092  +} -body {
         1093  +    .t configure -undotagging 0
         1094  +    .t cget -undotagging
         1095  +} -cleanup {
         1096  +    destroy .t
         1097  +} -result {0}
         1098  +test text-1.110 {configuration option: "undotagging"} -setup {
         1099  +    text .t
         1100  +    update
         1101  +} -body {
         1102  +    .t configure -undotagging eh
         1103  +} -cleanup {
  1087   1104       destroy .t
  1088   1105   } -match glob -returnCodes {error} -result {*}
  1089   1106   
  1090   1107   
  1091   1108   test text-2.1 {Tk_TextCmd procedure} -body {
  1092   1109       text
  1093   1110   } -returnCodes {error} -result {wrong # args: should be "text pathName ?-option value ...?"}

Changes to tests/textTag.test.

   307    307       .t tag configure x -underlinecolor [lindex [.t tag configure x -underlinecolor] 3]
   308    308   } -result {red}
   309    309   test textTag-1.37 {configuration options} -body {
   310    310       .t tag configure x -underlinecolor stupid
   311    311   } -cleanup {
   312    312       .t tag configure x -underlinecolor [lindex [.t tag configure x -underlinecolor] 3]
   313    313   } -returnCodes error -result {unknown color name "stupid"}
          314  +test textTag-1.38 {configuration options} -body {
          315  +    .t tag configure x -undo eh
          316  +} -cleanup {
          317  +    .t tag configure x -undo 1
          318  +} -returnCodes error -result {expected boolean value but got "eh"}
          319  +test textTag-1.39 {configuration options} -setup {
          320  +    .t tag configure x -underline [lindex [.t tag configure x -underline] 3]
          321  +} -body {
          322  +    .t tag cget x -undo
          323  +} -result {1}
          324  +test textTag-1.40 {configuration options} -setup {
          325  +    text .u
          326  +} -body {
          327  +    .u configure -undotagging 0
          328  +    .u tag configure x -underline 0
          329  +    .u tag cget x -undo
          330  +} -cleanup {
          331  +    destroy .u
          332  +} -result {0}
   314    333   
   315    334   
   316    335   test textTag-2.1 {TkTextTagCmd - "add" option} -body {
   317    336       .t tag
   318    337   } -returnCodes error -result {wrong # args: should be ".t tag option ?arg arg ...?"}
   319    338   test textTag-2.2 {TkTextTagCmd - "add" option} -body {
   320    339       .t tag gorp