bool undo assert false never supposed to happen return false save cmd bool save as file name doc man get filename if file name document manager defaultfilename save as true get file name true else get file name false savecmd saveas filename docman getfilename filename documentmanager saveas getfilename getfilename command status save cmd execute status clobber c status bar message saving if get file name file dialog f true f set file name file name if f run user cancelled return cancel doc man set filename file name if doc man save undo man flush buffer tcl commander cmd cmd set title text file name assert cmd tcl ok return ok else if err handler has error int error err handler get err number switch error case err handler file create error case err handler file write error c kill status bar set message err handler get message err handler clear error return ok handled gracefully default err handler clear error else err handler non critical false unknownerror err handler file create error return error savecmd statusclobber statusbar messagesaving getfilename filedialog setfilename filename docman setfilename filename docman undoman flushbuffer tclcommander settitletext filename tcl_ok errhandler haserror errhandler geterrnumber errhandler filecreateerror errhandler filewriteerror statusbar setmessage errhandler getmessage errhandler clearerror errhandler clearerror errhandler noncritical errhandler filecreateerror load cmd get file name true loadcmd getfilename load cmd const string name file name name get file name false loadcmd filename getfilename command status load cmd execute status clobber c status bar message loading if get file name file dialog f false f set file name file name if f run return cancel if doc man is dirty msg dialog m msg dialog yes no dialog confirm message if m run msg dialog no return cancel undo man flush buffer we always flush before loading because load tries to flush the existing document at the beginning new behaviour to make corrupt file handling more robust bge 3 27 00 if doc man load file name doc man set filename file name tcl commander cmd cmd set title text file name assert cmd tcl ok return ok else if err handler has error int error err handler get err number switch error case err handler file open error case err handler file read error case err handler file corrupted error c kill status bar set message err handler get message err handler clear error return ok handled gracefully default err handler clear error else err handler non critical false unknownerror err handler file open error return error loadcmd statusclobber statusbar messageloading getfilename filedialog setfilename filename docman isdirty msgdialog msgdialog yesnodialog confirmmessage msgdialog undoman flushbuffer docman filename docman setfilename filename tclcommander settitletext filename tcl_ok errhandler haserror errhandler geterrnumber errhandler fileopenerror errhandler filereaderror errhandler filecorruptederror statusbar setmessage errhandler getmessage errhandler clearerror errhandler clearerror errhandler noncritical errhandler fileopenerror static bool kill all objects document manager dummy graph view go void cd delete go return true killallobjects documentmanager graphview command status new cmd execute status clobber c status bar message clearing if doc man is dirty msg dialog m msg dialog yes no dialog confirm message if m run msg dialog no return cancel document manager temp doc man if temp doc man new document manager null return error doc man for each kill all objects null delete doc man doc man temp doc man doc man activate undo man flush buffer tcl commander cmd cmd set title text document manager defaultfilename assert cmd tcl ok return ok newcmd statusclobber statusbar messageclearing docman isdirty msgdialog msgdialog yesnodialog confirmmessage msgdialog documentmanager tempdocman tempdocman documentmanager docman foreach killallobjects docman docman tempdocman docman undoman flushbuffer tclcommander settitletext documentmanager tcl_ok command status quit cmd execute if doc man is dirty msg dialog m msg dialog yes no dialog confirm message if m run msg dialog no return cancel delete doc man delete fac delete undo man delete status bar delete link tag man delete block tag man delete err handler tcl send exit signal to the tcl interpreter tcl commander cmd cmd exit assert cmd tcl ok return ok quitcmd docman isdirty msgdialog msgdialog yesnodialog confirmmessage msgdialog docman undoman statusbar linktagman blocktagman errhandler tclcommander tcl_ok bool quit cmd undo assert false return false quitcmd bool undo assert false return false command status init cmd execute if err handler new err handler null return error else if block tag man new tag manager b null return error else if link tag man new tag manager l null return error else if doc man new document manager null return error else if fac new factory null return error else if undo man new undo manager null return error else if status bar new status bar s name null return error else tkw obj set canvas c name tkw text reset height return ok initcmd errhandler errhandler blocktagman tagmanager linktagman tagmanager docman documentmanager undoman undomanager statusbar statusbar sname tkwobj setcanvas cname tkwtext resetheight bool undo assert false return false command status undo cmd execute if u if undo man undo assert err handler has error switch err handler get err number case err handler undo first action status bar set message status bar message no action break case err handler undo not undoable status bar set message status bar message not undoable err handler clear error else if undo man redo assert err handler has error switch err handler get err number case err handler redo last action status bar set message status bar message no redo break case err handler redo not redoable status bar set message status bar message not redoable err handler clear error return ok undocmd u_ undoman errhandler haserror errhandler geterrnumber errhandler undofirstaction statusbar setmessage statusbar messagenoaction errhandler undonotundoable statusbar setmessage statusbar messagenotundoable errhandler clearerror undoman errhandler haserror errhandler geterrnumber errhandler redolastaction statusbar setmessage statusbar messagenoredo errhandler redonotredoable statusbar setmessage statusbar messagenotredoable errhandler clearerror select cmd const string tag object tag tag selectcmd objecttag bool undo assert false return false command status select cmd execute graph view object doc man find object object tag if object return error object select object is selected return ok selectcmd graphview docman findobject objecttag isselected edit command executed false editcommand command status edit command execute if executed status flag init switch flag case error return error case cancel return cancel default squelch warning undo man add command this executed true doc man set dirty true return ok editcommand undoman addcommand docman setdirty status init return ok vector string iterator blkend for vector string iterator i blkstart i blkend i tag tag assert block tag man string to tag tag i tag list push back tag dx dx dy dy blocktagman stringtotag taglist push_back _dx _dy command status move cmd execute status s edit command execute if s ok return s for vector tag iterator i tag list begin i tag list end i node graph view block doc man find node i if block return error double oldx oldy block get position oldx oldy block set position oldx dx oldy dy block update return ok movecmd editcommand taglist taglist nodegraphview docman findnode getposition setposition bool move cmd undo for vector tag iterator i tag list begin i tag list end i node graph view block doc man find node i if block return false double oldx oldy block get position oldx oldy block set position oldx dx oldy dy block update return true movecmd taglist taglist nodegraphview docman findnode getposition setposition status init return ok vector string iterator blk end copy lnk start lnk end back inserter obj list copy blk start blk end back inserter obj list undone true vectorstringiterator blkend lnkstart lnkend back_inserter objlist blkstart blkend back_inserter objlist delete cmd delete cmd if undone for vector string iterator i obj list begin i obj list end i graph view object doc man remove i if object delete object deletecmd deletecmd objlist objlist graphview docman command status delete cmd execute status s edit command execute if s ok return s for vector string iterator i obj list begin i obj list end i graph view object doc man find object i if object object visible false undone false return ok deletecmd editcommand objlist objlist graphview docman findobject bool delete cmd undo for vector string iterator i obj list begin i obj list end i graph view object doc man find object i if object object visible true undone true return true deletecmd objlist objlist graphview docman findobject clear cmd undone true clearcmd status init return ok clear cmd clear cmd note only nodes are deleted because doing otherwise breaks foreach if undone doc man for each node destroy callback null clearcmd clearcmd docman foreachnode destroycallback bool clear cmd undo bool temp true doc man for each visible callback temp undone true return true clearcmd docman foreach visiblecallback command status clear cmd execute status s edit command execute if s ok return s bool temp false doc man for each visible callback temp undone false return ok clearcmd editcommand docman foreach visiblecallback bool clear cmd visible callback document manager dman graph view go void cd bool visible flag static cast bool cd go visible visible flag return true clearcmd visiblecallback documentmanager graphview visibleflag static_cast visibleflag bool clear cmd destroy callback node graph view go void cd if go is visible delete go return true clearcmd destroycallback nodegraphview isvisible edit cmd edit cmd const string tag v doc man find object tag assert v object v new edit view old state new state null delete pending false editcmd editcmd docman findobject neweditview oldstate newstate deletepending edit cmd edit cmd if old state delete old state if new state delete new state if object delete object editcmd editcmd oldstate oldstate newstate newstate command status edit cmd execute status s edit command execute if s ok return s assert new state new state reset v update return ok editcmd editcommand newstate newstate bool edit cmd undo precondition old state old state reset v update return true editcmd oldstate oldstate command status edit cmd init if object return error old state object new state if object edit delete pending true return cancel new state object new state return ok editcmd oldstate newstate deletepending newstate newstate new link cmd new link cmd int type string block1 string block2 type type b1 doc man find object block1 b2 doc man find object block2 l null undone true newlinkcmd newlinkcmd _type _type docman findobject docman findobject new link cmd new link cmd if undone l delete l newlinkcmd newlinkcmd command status new link cmd execute status s edit command execute if s ok return s l visible true undone false return ok newlinkcmd editcommand bool new link cmd undo l visible false undone true return true newlinkcmd command status new link cmd init tag tag if b1 b2 return error if link tag man new tag tag return error out of tags if l fac create edge type tag return error weird error if l attach to graph view 0 b1 b2 l attach to graph view 1 b2 b1 status bar set message status bar message already exists return cancel possible duplicate pair edit view e l new edit view if e edit delete e return cancel delete e l create rep if doc man push edge l return error status bar set message status bar message default return ok newlinkcmd linktagman newtag createedge attachtographview attachtographview statusbar setmessage statusbar messagealreadyexists editview neweditview createrep docman pushedge statusbar setmessage statusbar messagedefault new block cmd new block cmd int type double x double y type type cx x cy y b null undone true newblockcmd newblockcmd _type _type new block cmd new block cmd if undone b delete b newblockcmd newblockcmd command status new block cmd execute status s edit command execute if s ok return s b visible true undone false return ok newblockcmd editcommand bool new block cmd undo b visible false undone true return true newblockcmd command status new block cmd init tag tag if block tag man new tag tag return error out of tags if b fac create node type tag return error weird error edit view e b new edit view if e edit delete e return cancel delete e b set position cx cy b create rep if doc man push node b return error return ok newblockcmd blocktagman newtag createnode editview neweditview setposition createrep docman pushnode status init return ok move anchor cmd move anchor cmd anchor anchor double nx double ny precondition anchor anchor get position oldx oldy newx nx newy ny anchor anchor moveanchorcmd moveanchorcmd getposition oldx_ oldy_ newx_ newy_ anchor_ command status move anchor cmd execute status s edit command execute if s ok return s anchor set position newx newy anchor get edge view update return ok moveanchorcmd editcommand anchor_ setposition newx_ newy_ anchor_ getedgeview bool move anchor cmd undo if anchor return false anchor set position oldx oldy anchor get edge view update return true moveanchorcmd anchor_ anchor_ setposition oldx_ oldy_ anchor_ getedgeview queue size qs queue new command queue size assert queue note that current points one past the next entry to be undone current queue limit queue first action true queue_size_ queue_ queue_size_ queue_ current_ current_ queue_ limit_ queue_ first_action_ undo manager undo manager flush buffer delete queue undomanager undomanager flushbuffer queue_ bool undo manager undo if current queue if first action err handler non critical false err handler undo first action else err handler non critical false err handler undo not undoable return false current current undo return true undomanager current_ queue_ first_action_ errhandler noncritical errhandler undofirstaction errhandler noncritical errhandler undonotundoable current_ current_ bool undo manager redo if current limit err handler non critical false err handler redo last action return false current execute first action false current return true undomanager current_ limit_ errhandler noncritical errhandler redolastaction current_ first_action_ current_ void undo manager flush buffer for command i queue i limit i delete i current limit queue first action false undomanager flushbuffer queue_ limit_ current_ limit_ queue_ first_action_ void undo manager add command command done first flush queue of undone commands for command i current i limit i delete i limit current if limit queue queue size delete queue copy queue 1 limit queue remove first element bump back else limit current append current command current 1 done first action false undomanager addcommand current_ limit_ limit_ current_ limit_ queue_ queue_size_ queue_ queue_ limit_ queue_ limit_ current_ current_ first_action_ node graph view factory create node int type tag tag if type id class return new class graph view tag new class subject else if type id comment return new comment graph view tag new comment subject comment else if type id interface return new interface graph view tag new interface subject interface else return null nodegraphview createnode id_class classgraphview classsubject id_comment commentgraphview commentsubject id_interface interfacegraphview interfacesubject edge graph view factory create edge int type tag tag if type id assoc assoc subject tempa new assoc subject link tag man tag to string tag return new assoc graph view tag tempa else if type id gener gener subject tempg new gener subject link tag man tag to string tag return new gener graph view tag tempg else if type id assocclass assoc class subject tempac new assoc class subject link tag man tag to string tag return new assoc class graph view tag tempac else if type id qualassoc qual assoc subject tempqa new qual assoc subject link tag man tag to string tag return new qual assoc graph view tag tempqa else if type id constraint constraint subject tempc new constraint subject link tag man tag to string tag return new constraint graph view tag tempc else if type id dependency dependency subject tempd new dependency subject link tag man tag to string tag return new dependency graph view tag tempd else if type id aggregation aggreg subject tempa new aggreg subject link tag man tag to string tag return new aggreg graph view tag tempa else return null edgegraphview createedge id_assoc assocsubject assocsubject linktagman tagtostring assocgraphview id_gener genersubject genersubject linktagman tagtostring genergraphview id_assocclass assocclasssubject assocclasssubject linktagman tagtostring assocclassgraphview id_qualassoc qualassocsubject qualassocsubject linktagman tagtostring qualassocgraphview id_constraint constraintsubject constraintsubject linktagman tagtostring constraintgraphview id_dependency dependencysubject dependencysubject linktagman tagtostring dependencygraphview id_aggregation aggregsubject aggregsubject linktagman tagtostring aggreggraphview file dialog bool save save flag save file name null filedialog saveflag filename void file dialog set file name string f name file name f name filedialog setfilename fname filename fname bool file dialog run precondition file name tcl commander cmd if save flag tcl call save file dialog with initial filename file name cmd save file dialog file name else tcl call load file dialog cmd load file dialog assert cmd tcl ok if strlen tcl getstringresult et interp return false cancelled file name tcl getstringresult et interp return true filedialog filename tclcommander saveflag savefiledialog filename savefiledialog filename loadfiledialog loadfiledialog tcl_ok tcl_getstringresult et_interp filename tcl_getstringresult et_interp class edit dialog name index null attributes null methods null classeditdialog nameindex void class edit dialog set name int name name index name classeditdialog setname nameindex void class edit dialog set attributes vector attribute attr attributes attr classeditdialog setattributes void class edit dialog set methods vector method meth methods meth classeditdialog setmethods bool class edit dialog run precondition name index attributes methods string class name document manager current get type name index string attr string string method string for vector attribute const iterator i attributes begin i attributes end i attr string i to string attr string n for vector method const iterator i methods begin i methods end i method string i to string method string n tcl call class edit dialog class name attr string method string tcl commander cmd cmd class edit dialog class name attr string method string assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name class name tcl getvar2 et interp data name tcl global only name index document manager current change type name index class name return true classeditdialog nameindex classname documentmanager gettype nameindex attrstring methodstring const_iterator attrstring tostring attrstring const_iterator methodstring tostring methodstring classeditdialog classname attrstring methodstring tclcommander classeditdialog classname attrstring methodstring tcl_ok tcl_getvar2 et_interp tcl_global_only classname tcl_getvar2 et_interp tcl_global_only nameindex documentmanager changetype nameindex classname name1 n1 name2 n2 mult1 mult2 null role1 role2 null arrow1 arrow2 null void assoc edit dialog set mult string m1 string m2 mult1 m1 mult2 m2 assoceditdialog setmult void assoc edit dialog set role vector string r1 vector string r2 role1 r1 role2 r2 assoceditdialog setrole void assoc edit dialog set arrow int a1 int a2 arrow1 a1 arrow2 a2 assoceditdialog setarrow void assoc edit dialog set rel string rel relationship rel assoceditdialog setrel bool assoc edit dialog run precondition mult1 mult2 role1 role2 arrow1 arrow2 relationship string role1 string string role2 string for vector string iterator i role1 begin i role1 end i role1 string i role1 string n for vector string iterator i role2 begin i role2 end i role2 string i role2 string n tcl call assoc edit dialog name1 name2 mult1 mult2 role1 string tcl role2 string tcl and store result in global variable data tcl commander cmd cmd assoc edit dialog name1 name2 mult1 mult2 role1 string role2 string arrow1 arrow2 relationship assert cmd tcl ok tcl get data cancelflag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data mult1 mult1 tcl getvar2 et interp data mult1 tcl global only tcl get data mult2 mult2 tcl getvar2 et interp data mult2 tcl global only tcl get data role1 istrstream iss1 tcl getvar2 et interp data role1 tcl global only role1 clear string temp while getline iss1 temp role1 push back temp tcl get data role2 istrstream iss2 tcl getvar2 et interp data role2 tcl global only role2 clear while getline iss2 temp role2 push back temp tcl get data arrow1 char ch ch tcl getvar2 et interp data arrow1 tcl global only arrow1 ch 0 tcl get data arrow2 ch tcl getvar2 et interp data arrow2 tcl global only arrow2 ch 0 tcl get data relationship relationship tcl getvar2 et interp data relationship tcl global only return true assoceditdialog role1string role2string role1string role1string role2string role2string assoceditdialog role1string role2string tclcommander assoceditdialog role1string role2string tcl_ok tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only push_back tcl_getvar2 et_interp tcl_global_only push_back tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only name1 n1 name2 n2 first is parent null firstisparent void gener edit dialog set flag bool f isp first is parent f isp genereditdialog setflag fisp firstisparent fisp bool gener edit dialog run precondition first is parent tcl commander cmd if first is parent tcl call gener edit dialog name1 name2 1 tcl and store result in global variable data cmd gener edit dialog name1 name2 1 else tcl call gener edit dialog name1 name2 0 tcl and store result in global variable data cmd gener edit dialog name1 name2 0 assert cmd tcl ok tcl get data cancelflag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data first is parent if tcl getvar2 et interp data first is parent tcl global only 1 first is parent false else first is parent true return true genereditdialog firstisparent tclcommander firstisparent genereditdialog genereditdialog genereditdialog genereditdialog tcl_ok tcl_getvar2 et_interp tcl_global_only firstisparent tcl_getvar2 et_interp firstisparent tcl_global_only firstisparent firstisparent msg dialog dialog type type const string msg precondition type ok dialog type yes no dialog dlg type type message msg msgdialog dialogtype okdialog yesnodialog dlgtype msg dialog dialog response msg dialog run tcl commander cmd switch dlg type case ok dialog tcl call ok dialog with argument message cmd ok dialog message assert cmd tcl ok return ok break case yes no dialog tcl call yes no dialog with argument message cmd yes no dialog message assert cmd tcl ok if tcl getstringresult et interp 0 return yes else return no break default should not happen assert false return cancel msgdialog dialogresponse msgdialog tclcommander dlgtype okdialog okdialog okdialog tcl_ok yesnodialog yesnodialog yesnodialog tcl_ok tcl_getstringresult et_interp void status bar set message int id precondition id 0 id last message tcl change text for label status bar name to messages id tcl commander cmd cmd status bar name configure text messages id assert cmd tcl ok statusbar setmessage lastmessage statusbarname tclcommander statusbarname tcl_ok void status bar set message const string msg tcl change text for label status bar name to msg tcl commander cmd cmd status bar name configure text msg assert cmd tcl ok statusbar setmessage statusbarname tclcommander statusbarname tcl_ok dirty false z man list man p man z man list man dirty if cur document null activate zman listman pman zman listman curdocument string get filename const return p man get filename getfilename pman getfilename void set filename const string fname p man set filename fname setfilename pman setfilename bool save return p man save pman bool load const string fname return p man load fname pman bool is dirty const return dirty isdirty void set dirty bool state dirty state setdirty graph view remove const string tag return list man remove tag graphview listman graph view find object const string tag return list man find object tag graphview findobject listman findobject edge graph view find edge tag t link return list man find edge view t link edgegraphview findedge tlink listman findedgeview tlink node graph view find node tag t block return list man find node view t block nodegraphview findnode tblock listman findnodeview tblock bool push edge edge graph view l return list man push edge view l pushedge edgegraphview listman pushedgeview bool push node node graph view b return list man push node view b pushnode nodegraphview listman pushnodeview bool for each callback cback void cdata return list man for each view this cback cdata foreach listman foreachview bool for each node bcallback cback void cdata return list man for each node view cback cdata foreachnode listman foreachnodeview void activate cur document this curdocument static document manager current return cur document documentmanager curdocument string get type int index type temp t list get type index note there are some cases in which we want to return a non existing type if temp return return temp get name gettype tlist gettype getname int get type string name return t list find type name gettype tlist findtype int add type string name return t list add type name addtype tlist addtype void remove type int index t list remove type index removetype tlist removetype int change type int index string new name type temp t list get type index if doesn t exist means we must add it if temp return add type new name temp set name new name return index changetype newname tlist gettype addtype newname setname newname int size type return t list size sizetype tlist void list interface edge destroyc back destroy link tag man del tag tag edges erase tag listinterface edgedestroycback linktagman deltag tag_ edges_ tag_ void list interface node destroyc back destroy block tag man del tag tag nodes erase tag listinterface nodedestroycback blocktagman deltag tag_ nodes_ tag_ list interface clear listinterface void clear for map tag node graph view iterator i nodes begin i nodes end delete i second postcondition edges size 0 nodegraphview graph view list interface remove const string tag graph view retval null tag t map tag node graph view iterator tempb map tag edge graph view iterator templ if block tag man string to tag t tag tempb nodes find t if tempb nodes end retval tempb second nodes erase t else assert link tag man string to tag t tag templ edges find t if templ edges end retval templ second edges erase t return retval graphview listinterface graphview nodegraphview edgegraphview blocktagman stringtotag linktagman stringtotag graph view list interface find object const string tag graph view retval null tag t map tag block iterator tempb map tag link iterator templ if block tag man string to tag t tag tempb nodes find t if tempb nodes end retval tempb second else assert link tag man string to tag t tag templ edges find t if templ edges end retval templ second return retval graphview listinterface findobject graphview blocktagman stringtotag linktagman stringtotag edge graph view list interface find edge view tag tag map tag link iterator temp temp edges find tag if temp edges end return null return temp second edgegraphview listinterface findedgeview node graph view list interface find node view tag tag map tag block iterator temp temp nodes find tag if temp nodes end return null return temp second nodegraphview listinterface findnodeview edge list interface find edge tag tag edge graph view ev find edge view tag if ev return null return ev get edge listinterface findedge edgegraphview findedgeview getedge node list interface find node tag tag node graph view nv find node view tag if nv return null return nv get node listinterface findnode nodegraphview findnodeview getnode node list interface find node const string tag graph view gv find object tag if gv return null return gv get node listinterface findnode graphview findobject getnode bool list interface push edge view edge graph view e e set destroy callback new edge destroyc back edges e edges insert pair tag edge graph view e get tag e return true listinterface pushedgeview edgegraphview setdestroycallback edgedestroycback edgegraphview gettag bool list interface push node view node graph view n n set destroy callback new node destroyc back nodes n nodes insert pair tag node graph view n get tag n return true listinterface pushnodeview nodegraphview setdestroycallback nodedestroycback nodegraphview gettag gcallback cback void cdata for map tag node graph view iterator ib nodes begin ib nodes end if cback docman ib second cdata return false for map tag edge graph view iterator il edges begin il edges end if cback docman il second cdata return false return true nodegraphview edgegraphview bool list interface for each edge view lcallback cback void cdata map tag edge graph view iterator i for i edges begin i edges end if cback i second cdata return false return true listinterface foreachedgeview edgegraphview bool list interface for each node view bcallback cback void cdata map tag node graph view iterator i for i nodes begin i nodes end if cback i second cdata return false return true listinterface foreachnodeview nodegraphview nncallback cback void cdata for map tag node graph view iterator ib nodes begin ib nodes end if cback docman ib second get node cdata return false for map tag edge graph view iterator il edges begin il edges end if cback docman il second get node cdata return false return true nodegraphview getnode edgegraphview getnode bool list interface for each edge ecallback cback void cdata map tag edge graph view iterator i for i edges begin i edges end if cback i second get edge cdata return false return true listinterface foreachedge edgegraphview getedge bool list interface for each node ncallback cback void cdata map tag node graph view iterator i for i nodes begin i nodes end if cback i second get node cdata return false return true listinterface foreachnode nodegraphview getnode size t list interface count edges bool include all const if include all return edges size else size t total 0 for map tag edge graph view const iterator i edges begin i edges end i if i second is visible total return total size_t listinterface countedges includeall includeall size_t edgegraphview const_iterator isvisible size t list interface count nodes bool include all const if include all return nodes size else size t total 0 for map tag node graph view const iterator i nodes begin i nodes end i if i second is visible total return total size_t listinterface countnodes includeall includeall size_t nodegraphview const_iterator isvisible z man zman list man listman dirty dirty filename defaultfilename zman _zman listman _listman _dirty string get filename const return filename getfilename void set filename const string fname filename fname setfilename bool persistence manager save precondition filename defaultfilename ofstream ofs filename c str if err handler non critical ofs fail createrror err handler file create error return false ofs header endl save labels first type tag ofs list man count nodes endl bool cond cond list man for each node view save node label ofs if err handler non critical cond writerror err handler file write error return false ofs list man count edges endl cond list man for each edge view save edge label ofs if err handler non critical cond writerror err handler file write error return false save data cond list man for each node view save node ofs if err handler non critical cond writerror err handler file write error return false cond list man for each edge view save edge ofs if err handler non critical cond writerror err handler file write error return false if err handler non critical ofs fail writerror err handler file write error return false dirty false return true persistencemanager c_str errhandler noncritical errhandler filecreateerror listman countnodes listman foreachnodeview savenodelabel errhandler noncritical errhandler filewriteerror listman countedges listman foreachedgeview saveedgelabel errhandler noncritical errhandler filewriteerror listman foreachnodeview savenode errhandler noncritical errhandler filewriteerror listman foreachedgeview saveedge errhandler noncritical errhandler filewriteerror errhandler noncritical errhandler filewriteerror bool persistence manager load const string fname bool cond node graph view new node edge graph view new edge ifstream ifs fname c str if err handler non critical ifs fail openerror err handler file open error return false string hdr size t block count link count int id tag tag getline ifs hdr if err handler non critical hdr header corrupterror err handler file corrupted error return false clear existing objects since we probably have an ok file list man clear autoclear cleaner list man ifs block count ifs get flush newline for size t i 0 i block count i ifs id tag ifs get new node fac create node id tag if err handler non critical new node corrupterror err handler file corrupted error return false cond new block read ifs if err handler non critical cond readerror err handler file read error delete new block return false block tag man add tag tag if list man push node view new node delete new node return false new block create rep ifs link count ifs get flush newline for size t i 0 i link count i ifs id tag ifs get new edge fac create edge id tag if err handler non critical new edge corrupterror err handler file corrupted error return false cond new link read ifs if err handler non critical cond readerror err handler file read error delete new link return false link tag man add tag tag if list man push edge view new edge delete new edge return false new link create rep read in data cond list man for each node view load node ifs if err handler non critical cond readerror err handler file read error return false cond list man for each edge view load edge ifs if err handler non critical cond readerror err handler file read error return false make the workspace components for all objects list man for each view document manager current make rep null redraw everything so anchors are updated properly list man for each view document manager current update null filename fname dirty false cleaner commit commit changes return true persistencemanager nodegraphview newnode edgegraphview newedge c_str errhandler noncritical errhandler fileopenerror size_t blockcount linkcount errhandler noncritical errhandler filecorruptederror listman listman blockcount size_t blockcount newnode createnode errhandler noncritical newnode errhandler filecorruptederror newblock errhandler noncritical errhandler filereaderror newblock blocktagman addtag listman pushnodeview newnode newnode newblock createrep linkcount size_t linkcount newedge createedge errhandler noncritical newedge errhandler filecorruptederror newlink errhandler noncritical errhandler filereaderror newlink linktagman addtag listman pushedgeview newedge newedge newlink createrep listman foreachnodeview loadnode errhandler noncritical errhandler filereaderror listman foreachedgeview loadedge errhandler noncritical errhandler filereaderror listman foreachview documentmanager makerep listman foreachview documentmanager bool persistence manager save node node graph view blk void cd ostream oss static cast ostream cd if blk write oss return false return true persistencemanager savenode nodegraphview static_cast bool persistence manager save edge edge graph view lnk void cd ostream oss static cast ostream cd if lnk write oss return false return true persistencemanager saveedge edgegraphview static_cast bool persistence manager save node label node graph view ngv void cd ostream oss static cast ostream cd if ngv is visible oss ngv get node get classid ngv get tag endl return oss fail persistencemanager savenodelabel nodegraphview static_cast isvisible getnode getclassid gettag bool persistence manager save edge label edge graph view egv void cd ostream oss static cast ostream cd if egv is visible oss egv get node get classid egv get tag endl return oss fail persistencemanager saveedgelabel edgegraphview static_cast isvisible getnode getclassid gettag void cd delete gv return true bool persistence manager make rep document manager dummy graph view gv void cd gv create rep return true persistencemanager makerep documentmanager graphview createrep bool persistence manager update document manager dummy graph view gv void cd gv update return true persistencemanager documentmanager graphview bool persistence manager load node node graph view ngv void cd istream iss static cast istream cd if ngv read iss return false return true persistencemanager loadnode nodegraphview static_cast bool persistence manager load edge edge graph view egv void cd istream iss static cast istream cd if egv read iss return false return true persistencemanager loadedge edgegraphview static_cast bool z order manager for each z callback cback void cdata vector string z list tag tag tkw obj getz order block z list for vector string iterator i z list begin i z list end assert block tag man string to tag tag i node graph view blk blk list man find node view tag if cback blk cdata return false i return true zordermanager foreach zcallback zlist tkwobj getzorder zlist zlist zlist blocktagman stringtotag nodegraphview listman findnodeview void flush tags tagstart tagend 0 flushtags tag manager tag manager const string prefix precondition prefix length 0 isalpha prefix 0 type prefix prefix tagstart tagend 0 tagmanager tagmanager typeprefix bool tag manager new tag tag tag if tagstart 1 tagend highest return false if tagend highest tag tagend else tag tagstart if tagstart 0 tagstart 1 return true tagmanager newtag void tag manager add tag tag tag precondition tag 0 tag highest if tag tagstart tagstart tag else if tag tagend tagend tag tagmanager addtag void tag manager del tag tag tag precondition tag 0 tag highest if tag tagend tagend else if tag tagstart tagstart if tagend 0 tagstart 0 mark empty list properly tagmanager deltag bool tag manager string to tag tag tag const string tag string if mismatch type prefix begin type prefix end tag string begin first type prefix end return false string temp tag string substr type prefix length tag string length type prefix length tag atoi temp c str return true tagmanager stringtotag tagstring typeprefix typeprefix tagstring typeprefix tagstring typeprefix tagstring typeprefix c_str string tag manager tag to string tag tag precondition tag 0 tag highest ostrstream temp temp type prefix tag ends string temp2 temp str temp freeze 0 return temp2 tagmanager tagtostring typeprefix tkw obj is attached false tkwobj isattached tkw obj destroy tkwobj int tkw obj get const precondition is attached return itemid tkwobj isattached void tkw obj attach int newid tcl commander cmd tcl check if item newid exists precondition ifdef debug cmd canvas gettags newid assert cmd tcl ok endif if we re here assert didn t fail is attached true itemid newid tkwobj tclcommander tcl_ok isattached void tkw obj destroy if is attached return tcl delete item itemid tcl commander cmd cmd canvas delete itemid assert cmd tcl ok detach tkwobj isattached tclcommander tcl_ok void tkw obj detach is attached false tkwobj isattached void tkw obj bind const string event const string action precondition is attached tcl bind event event with action action on itemid tcl commander cmd cmd canvas bind itemid event action assert cmd tcl ok tkwobj isattached tclcommander tcl_ok void tkw obj add tag const string tag precondition is attached tcl add tag tag to itemid tcl commander cmd cmd canvas addtag tag withtag itemid assert cmd tcl ok tkwobj addtag isattached tclcommander tcl_ok void tkw obj del tag const string tag precondition is attached tcl delete tag tag from itemid tcl commander cmd cmd canvas dtag itemid tag assert cmd tcl ok tkwobj deltag isattached tclcommander tcl_ok void tkw obj get tags vector string output precondition is attached tcl get tags for itemid tcl commander cmd cmd canvas gettags itemid assert cmd tcl ok istrstream iss tcl getstringresult et interp string item while iss item output push back item tkwobj gettags isattached tclcommander tcl_ok tcl_getstringresult et_interp push_back void tkw obj raise const string tag above precondition is attached tcl commander cmd cmd canvas raise itemid tag above cmd tkwobj tagabove isattached tclcommander tagabove void tkw obj raise int id above precondition is attached tcl commander cmd cmd canvas raise itemid id above cmd tkwobj idabove isattached tclcommander idabove void tkw obj raise precondition is attached tcl commander cmd cmd canvas raise itemid cmd tkwobj isattached tclcommander void tkw obj lower const string tag below precondition is attached tcl commander cmd cmd canvas lower itemid tag below cmd tkwobj tagbelow isattached tclcommander tagbelow void tkw obj lower int id below precondition is attached tcl commander cmd cmd canvas lower itemid id below cmd tkwobj idbelow isattached tclcommander idbelow void tkw obj lower precondition is attached tcl commander cmd cmd canvas lower itemid cmd tkwobj isattached tclcommander void tkw obj move double dx double dy precondition is attached tcl commander cmd cmd canvas move static cast int dx static cast int dy assert cmd tcl ok tkwobj isattached tclcommander static_cast static_cast tcl_ok void tkw obj set fill const string color precondition is attached tcl commander cmd cmd canvas itemconfigure itemid fill color assert cmd tcl ok tkwobj setfill isattached tclcommander tcl_ok void tkw obj set stipple const string stipple precondition is attached tcl commander cmd cmd canvas itemconfigure itemid stipple stipple assert cmd tcl ok tkwobj setstipple isattached tclcommander tcl_ok void tkw obj set dash const string dash precondition is attached tcl commander cmd cmd canvas itemconfigure itemid dash dash if cmd tcl ok if we can set the dash i e plus patch installed or tk 8 3 we kill the stipple note since not all versions of tcl tk support this we don t assert success set stipple ifdef debug else cerr dash set failed endl endif tkwobj setdash isattached tclcommander tcl_ok setstipple void tkw obj set outline const string color precondition is attached tcl set outline color for itemid to color tcl commander cmd cmd canvas itemconfigure itemid outline color assert cmd tcl ok tkwobj setoutline isattached tclcommander tcl_ok void tkw obj set thickness double thickness precondition is attached tcl set outline thickness for itemid to thickness tcl commander cmd cmd canvas itemconfigure itemid width static cast int thickness assert cmd tcl ok tkwobj setthickness isattached tclcommander static_cast tcl_ok void tkw obj set canvas const string c name tcl check if canvas c name exists canvas name c name tkwobj setcanvas cname cname canvasname cname const string tkw obj canvas return canvas name tkwobj canvasname void tkw obj refresh tcl refresh display update idletasks tcl commander cmd cmd update idletasks assert cmd tcl ok tkwobj tclcommander tcl_ok void tkw obj getz order const string base vector string output tcl call getz order base see mis section 11 7 tcl commander cmd cmd getz order base assert cmd tcl ok istrstream iss tcl getstringresult et interp string temp while iss temp output push back temp tkwobj getzorder getzorder tclcommander getzorder tcl_ok tcl_getstringresult et_interp push_back void tkw line create const vector double nx const vector double ny precondition nx size ny size nx size 2 if is attached return x clear y clear copy nx begin nx end back inserter x copy ny begin ny end back inserter y tcl create line using points in x i y i for all i l t x size tcl commander cmd cmd tkw obj canvas create line for size t i 0 i x size i cmd static cast int x i static cast int y i cmd fill cmd push cmd width static cast int 1 0 2 sel offset tcl add arrow shape cmd arrowshape create a list for arrow values tcl commander cmd2 cmd2 list 15 15 10 assert cmd2 tcl ok result is our list cmd push tcl getobjresult et interp assert cmd tcl ok int id assert tcl getintfromobj et interp tcl getobjresult et interp id tcl ok dummy line attach id cmd tkw obj canvas create line for size t i 0 i x size i cmd static cast int x i static cast int y i cmd width 0 cmd arrowshape create a list for arrow values tcl commander cmd2 cmd2 list 10 10 7 assert cmd2 tcl ok result is our list cmd push tcl getobjresult et interp assert cmd tcl ok assert tcl getintfromobj et interp tcl getobjresult et interp id tcl ok attach id tkwline isattached back_inserter back_inserter tclcommander tkwobj size_t static_cast static_cast static_cast seloffset tclcommander tcl_ok tcl_getobjresult et_interp tcl_ok tcl_getintfromobj et_interp tcl_getobjresult et_interp tcl_ok dummyline tkwobj size_t static_cast static_cast tclcommander tcl_ok tcl_getobjresult et_interp tcl_ok tcl_getintfromobj et_interp tcl_getobjresult et_interp tcl_ok void tkw line create double nx1 double ny1 double nx2 double ny2 vector double t1 t2 t1 push back nx1 t1 push back nx2 t2 push back ny1 t2 push back ny2 create t1 t2 tkwline push_back push_back push_back push_back void tkw line set coords const vector double nx const vector double ny precondition is attached nx size ny size nx size 1 x clear y clear copy nx begin nx end back inserter x copy ny begin ny end back inserter y if visible flag return tcl set line coordinates for itemid to points in x i y i tcl for all i less than x size tcl commander cmd cmd tkw obj canvas coords itemid for size t i 0 i x size i cmd static cast int x i static cast int y i assert cmd tcl ok tcl set line coordinates for dummy line itemid to points in tcl x i y i for all i less than x size cmd tkw obj canvas coords dummy line itemid for size t i 0 i x size i cmd static cast int x i static cast int y i assert cmd tcl ok tkwline setcoords isattached back_inserter back_inserter visibleflag tclcommander tkwobj size_t static_cast static_cast tcl_ok dummyline tkwobj dummyline size_t static_cast static_cast tcl_ok void tkw line set coords double nx1 double ny1 double nx2 double ny2 vector double t1 t2 t1 push back nx1 t1 push back nx2 t2 push back ny1 t2 push back ny2 set coords t1 t2 tkwline setcoords push_back push_back push_back push_back setcoords void tkw line set arrows arrow which precondition is attached current arrow which if visible flag return tcl set arrow for line itemid to arrow strings which tcl commander cmd cmd tkw obj canvas itemconfigure itemid arrow arrow strings which assert cmd tcl ok tkwline setarrows isattached currentarrow visibleflag arrowstrings tclcommander tkwobj arrowstrings tcl_ok double arrowwidth tcl commander cmd cmd tkw obj canvas itemconfigure itemid arrowshape create a list for arrow values tcl commander cmd2 cmd2 list static cast int neck2tip static cast int points2tip static cast int arrowwidth assert cmd2 tcl ok result is our list cmd push tcl getobjresult et interp assert cmd tcl ok cmd tkw obj canvas itemconfigure dummy line itemid arrowshape create a list for arrow values tcl commander cmd2 cmd2 list static cast int neck2tip static cast int points2tip static cast int arrowwidth assert cmd2 tcl ok result is our list cmd push tcl getobjresult et interp assert cmd tcl ok tclcommander tkwobj tclcommander static_cast static_cast static_cast tcl_ok tcl_getobjresult et_interp tcl_ok tkwobj dummyline tclcommander static_cast static_cast static_cast tcl_ok tcl_getobjresult et_interp tcl_ok void tkw line visible bool vis precondition is attached if vis visible flag return tcl commander cmd if vis tcl make line itemid width 0 0 fill transparent tcl make line dummy line itemid width 0 0 cmd tkw obj canvas itemconfigure itemid width 0 fill cmd push assert cmd tcl ok cmd tkw obj canvas itemconfigure dummy line itemid width 0 assert cmd tcl ok else tcl make line itemid width 1 0 fill black tcl make line dummy line itemid width 1 0 2 sel offset cmd tkw obj canvas itemconfigure itemid width 0 fill black assert cmd tcl ok cmd tkw obj canvas itemconfigure dummy line itemid width static cast int 1 0 2 sel offset assert cmd tcl ok visible flag vis tkwline isattached visibleflag tclcommander dummyline tkwobj tcl_ok tkwobj dummyline tcl_ok dummyline seloffset tkwobj tcl_ok tkwobj dummyline static_cast seloffset tcl_ok visibleflag void tkw line add tag both const string tag add tag tag dummy line add tag tag tkwline addtagboth addtag dummyline addtag void tkw line del tag both const string tag del tag tag dummy line del tag tag tkwline deltagboth deltag dummyline deltag void tkw line bind both const string event const string action bind event action dummy line bind event action tkwline bindboth dummyline void tkw line get coords double nx1 double ny1 double nx2 double ny2 const nx1 x 0 ny1 y 0 nx2 x x size 1 ny2 y y size 1 tkwline getcoords void tkw line get coords vector double nx vector double ny const nx x ny y tkwline getcoords tkw line arrow tkw line get arrows const return current arrow tkwline tkwline getarrows currentarrow bool tkw line is visible const return visible flag tkwline isvisible visibleflag void tkw line raise const string tag above tkw obj raise tag above dummy line lower get tkwline tagabove tkwobj tagabove dummyline void tkw line raise int id above tkw obj raise id above dummy line lower get tkwline idabove tkwobj idabove dummyline void tkw line raise tkw obj raise dummy line lower get tkwline tkwobj dummyline void tkw line lower const string tag below tkw obj lower tag below dummy line lower get tkwline tagbelow tkwobj tagbelow dummyline void tkw line lower int id below tkw obj lower id below dummy line lower get tkwline idbelow tkwobj idbelow dummyline void tkw line lower tkw obj lower dummy line lower tkwline tkwobj dummyline void tkw line move double dx double dy tkw obj move dx dy dummy line move dx dy tkwline tkwobj dummyline void tkw line destroy if is attached return dummy line destroy tkw obj destroy tkwline isattached dummyline tkwobj void tkw rect create double nx1 double ny1 double nx2 double ny2 if is attached return x1 nx1 x2 nx2 y1 ny1 y2 ny2 tcl create rectangle at x1 y1 x2 y2 fill white tcl commander cmd cmd tkw obj canvas create rectangle static cast int x1 static cast int y1 static cast int x2 static cast int y2 fill white width 1 assert cmd tcl ok int id assert tcl getintfromobj et interp tcl getobjresult et interp id tcl ok attach id tkwrect isattached tclcommander tkwobj static_cast static_cast static_cast static_cast tcl_ok tcl_getintfromobj et_interp tcl_getobjresult et_interp tcl_ok void tkw rect set coords double nx1 double ny1 double nx2 double ny2 precondition is attached x1 nx1 x2 nx2 y1 ny1 y2 ny2 if visible flag return tcl set rectangle coordinates for itemid to x1 y1 x2 y2 tcl commander cmd cmd tkw obj canvas coords itemid static cast int x1 static cast int y1 static cast int x2 static cast int y2 assert cmd tcl ok tkwrect setcoords isattached visibleflag tclcommander tkwobj static_cast static_cast static_cast static_cast tcl_ok void tkw rect visible bool vis precondition is attached if vis visible flag return tcl commander cmd if vis tcl make rectangle itemid fill transparent outline transparent tcl make rectangle itemid outline width 0 0 cmd tkw obj canvas itemconfigure itemid fill cmd push cmd width 0 outline cmd push else tcl make rectangle itemid fill white outline black tcl make rectangle itemid outline width 1 0 cmd tkw obj canvas itemconfigure itemid fill white outline black width 1 assert cmd tcl ok visible flag vis tkwrect isattached visibleflag tclcommander tkwobj tkwobj tcl_ok visibleflag void tkw rect get coords double nx1 double ny1 double nx2 double ny2 const nx1 x1 ny1 y1 nx2 x2 ny2 y2 tkwrect getcoords bool tkw rect is visible const return visible flag tkwrect isvisible visibleflag tkw text tkw text tkw obj visible flag true tkwtext tkwtext tkwobj visibleflag void tkw text create double nx double ny if is attached return tcl create text item at nx ny font font string tcl commander cmd cmd tkw obj canvas create text static cast int nx static cast int ny font font string assert cmd tcl ok int id assert tcl getintfromobj et interp tcl getobjresult et interp id tcl ok attach id tkwtext isattached fontstring tclcommander tkwobj static_cast static_cast fontstring tcl_ok tcl_getintfromobj et_interp tcl_getobjresult et_interp tcl_ok void tkw text set coords double nx double ny precondition is attached tcl set new text position for itemid to nx ny tcl commander cmd cmd tkw obj canvas coords itemid static cast int nx static cast int ny assert cmd tcl ok tkwtext setcoords isattached tclcommander tkwobj static_cast static_cast tcl_ok void tkw text set anchor anchor anch precondition is attached tcl set text anchor for itemid to anchor strings anch tcl commander cmd cmd tkw obj canvas itemconfigure itemid anchor anchor strings anch assert cmd tcl ok tkwtext setanchor isattached anchorstrings tclcommander tkwobj anchorstrings tcl_ok void tkw text set text const string txt precondition is attached text txt if visible flag tcl set text caption for itemid to text tcl commander cmd cmd tkw obj canvas itemconfigure itemid text text assert cmd tcl ok tkwtext settext isattached visibleflag tclcommander tkwobj tcl_ok void tkw text visible bool vis precondition is attached if vis visible flag return tcl commander cmd if vis tcl set text fill for itemid to black cmd tkw obj canvas itemconfigure itemid fill black text text else tcl set text fill for itemid to transparent cmd tkw obj canvas dchars itemid 0 end assert cmd tcl ok visible flag vis tkwtext isattached visibleflag tclcommander tkwobj tkwobj tcl_ok visibleflag bool tkw text is visible const return visible flag tkwtext isvisible visibleflag int tkw text get width const string str precondition tkwtext cached tk window win tk mainwindow et interp tk font font tk getfont et interp win font string size t width tk textwidth font str c str str length tk freefont font return width tkwtext getwidth tkwtext_cached tk_window tk_mainwindow et_interp tk_font tk_getfont et_interp fontstring size_t tk_textwidth c_str tk_freefont void tkw text reset height if tkwtext cached tk freefont tkwtext fontcache tk window win tk mainwindow et interp tk font tkwtext fontcache tk getfont et interp win font string tk fontmetrics fm tk getfontmetrics tkwtext fontcache fm y pel per line fm linespace tkwtext cached true tcl commander cmd cmd font metrics font string fixed assert cmd tcl ok if tcl getstringresult et interp 1 is fixed true else is fixed false tk freefont tkwtext fontcache tkwtext resetheight tkwtext_cached tk_freefont tkwtext_fontcache tk_window tk_mainwindow et_interp tk_font tkwtext_fontcache tk_getfont et_interp fontstring tk_fontmetrics tk_getfontmetrics tkwtext_fontcache ypelperline tkwtext_cached tclcommander fontstring tcl_ok tcl_getstringresult et_interp isfixed isfixed tk_freefont tkwtext_fontcache err handler err handler error flag false errhandler errhandler errorflag bool err handler non critical bool condition const string msg int e number precondition e number 0 if condition message msg error number e number error flag true return condition errhandler noncritical enumber enumber errornumber enumber errorflag string err handler get message const if error flag return message else return string errhandler getmessage errorflag int err handler get err number const if error flag return error number else return 0 errhandler geterrnumber errorflag errornumber bool err handler has error const return error flag errhandler haserror errorflag void err handler clear error error flag false errhandler clearerror errorflag const char file name int code line if status return cerr critical condition flagged in file file name line code line n condition endl core dump filename codeline filename codeline coredump void err handler core dump intentionally create a segmentation fault and force core dump core dump eh well you got it int null 0 errhandler coredump tcl commander reset if objv objv1 delete objv tclcommander void push const char arg the const cast is ugly but it s required only because of the stoopid way tcl has its header files done normally the string is not really modified push tcl newstringobj const cast char arg strlen arg const_cast tcl_newstringobj const_cast void push const string arg const cast required for reasons given above push tcl newstringobj const cast char arg data arg length const_cast tcl_newstringobj const_cast void push int arg push tcl newintobj arg tcl_newintobj void push long arg push tcl newlongobj arg tcl_newlongobj void push double arg push tcl newdoubleobj arg tcl_newdoubleobj void push push tcl newobj tcl_newobj int operator return invoke tcl commander operator const char arg push arg return this tclcommander tcl commander operator const string arg push arg return this tclcommander tcl commander operator int arg push arg return this tclcommander tcl commander operator long arg push arg return this tclcommander tcl commander operator double arg push arg return this tclcommander tcl commander operator const char cmd assert command cmd return this tclcommander tcl commander operator const string cmd assert command cmd return this tclcommander bool tcl commander command const char cmd precondition cmd make sure we kill previous commands if necessary if is cmd cached reset get info we must allocate a temporary for that if tcl getcommandinfo et interp const cast char cmd cmd info return false objv argc tcl newstringobj const cast char cmd strlen cmd is cmd cached true return true tclcommander iscmdcached tcl_getcommandinfo et_interp const_cast cmdinfo tcl_newstringobj const_cast iscmdcached bool tcl commander command const string cmd return command cmd c str tclcommander c_str int tcl commander invoke ifdef debug cout tcl getstringfromobj objv 0 null endl for int i 1 i argc i cout tcl getstringfromobj objv i null endl endif return cmd info obj proc cmd info obj client data et interp argc objv tclcommander tcl_getstringfromobj tcl_getstringfromobj cmdinfo objproc cmdinfo objclientdata et_interp void tcl commander reset for int i 0 i argc i tcl decrrefcount objv i argc 0 is cmd cached false tclcommander tcl_decrrefcount iscmdcached bool tcl commander command const char cmd size t length char temp new char length 1 copy cmd cmd length temp temp length 0 bool retval command temp delete temp return retval tclcommander size_t parent p current parent begin void node impl edge iterator impl rewind current parent begin nodeimpl edgeiteratorimpl edge node impl edge iterator impl next size t n edge retval current while n if current parent end break return retval nodeimpl edgeiteratorimpl size_t edge iterator node impl edge iterator impl copy edge iterator impl n new edge iterator impl parent assert n n current current return n edgeiterator nodeimpl edgeiteratorimpl edgeiteratorimpl edgeiteratorimpl node impl node impl dump data on stdout because i need to see what gets killed ifdef debug cout deleting node get objid endl endif signal every edge that we are disconnecting for each edges begin edges end detach edge nodeimpl nodeimpl getobjid for_each detach_edge string node impl get objid const return obj id nodeimpl getobjid obj_id void node impl set objid const string oid obj id oid nodeimpl setobjid obj_id bool node impl attach edge edge ptr edge precondition edge get edges push back edge return true nodeimpl attachedge edgeptr push_back bool node impl detach edge edge edge if edge edges clear return true edge collection iterator i find edges begin edges end edge if i edges end return false edges erase i return true nodeimpl detachedge edgecollection edge iterator node impl iterate return new edge iterator impl edges edgeiterator nodeimpl edgeiteratorimpl bool subject impl attach view view base ptr to attach precondition to attach get views push back to attach return true subjectimpl attachview viewbaseptr toattach toattach push_back toattach bool subject impl detach view view base to detach precondition to detach view collection iterator found find views begin views end to detach if found views end return false views erase found delete found not needed anymore return true subjectimpl detachview viewbase todetach todetach viewcollection todetach void subject impl notify how to confuse everyone with the stl lesson 1 what this does is call update on every member of the list that s all there is to it ifdef msc ver for each views begin views end viewbase update else for each views begin views end mem fun view base update endif subjectimpl _msc_ver for_each viewbase_update for_each mem_fun viewbase subject impl subject impl nothing needed now subjectimpl subjectimpl virtual string get objid const return nodei get objid getobjid getobjid virtual void set objid const string oid nodei set objid oid setobjid setobjid virtual bool attach edge edge ptr e return nodei attach edge e attachedge edgeptr attachedge virtual bool detach edge edge e return nodei detach edge e detachedge detachedge virtual edge iterator iterate return nodei iterate edgeiterator virtual bool attach view view base ptr v return subji attach view v attachview viewbaseptr attachview virtual bool detach view view base v return subji detach view v detachview viewbase detachview virtual void notify subji notify graph view cback null graphview destroy callback set destroy callback destroy callback cb destroy callback cback copy cback cback cb return cback copy destroycallback setdestroycallback destroycallback destroycallback cback_copy cback_copy graph view if cback cback destroy delete cback cback null graphview attribute attribute accesslevel private index 1 invalid value to flag accesslevel_ index_ attribute attribute const attribute a accesslevel a accesslevel index a index name a name accesslevel_ accesslevel_ index_ index_ name_ name_ void attribute change access int level accesslevel level changeaccess accesslevel_ void attribute change type int index index index changetype index_ void attribute change name string new name name new name changename newname name_ newname bool attribute edit attribute edit dialog d d set name name d set visibility accesslevel d set type index if d run return false return true attributeeditdialog setname name_ setvisibility accesslevel_ settype index_ bool attribute pedit parameter edit dialog d d set name name d set type index if d run return false accesslevel 0 fix to 0 return true parametereditdialog setname name_ settype index_ accesslevel_ bool attribute piedit inter parameter edit dialog d d set name name d set type index if d run return false accesslevel 0 fix to 0 return true interparametereditdialog setname name_ settype index_ accesslevel_ bool attribute write ostream os const os accesslevel endl os document manager current get type index endl os name endl if os fail return false return true accesslevel_ documentmanager gettype index_ name_ bool attribute read istream is string temp is accesslevel is get flush newline getline is temp index document manager current add type temp getline is name if is fail return false return true accesslevel_ index_ documentmanager addtype name_ string attribute to string const string temp switch accesslevel case nothing break case public temp break case private temp break case protected temp break temp name string type document manager current get type index if type void temp temp document manager current get type index return temp tostring accesslevel_ name_ documentmanager gettype index_ documentmanager gettype index_ attribute attribute operator const attribute a accesslevel a accesslevel name a name index a index return this accesslevel_ accesslevel_ name_ name_ index_ index_ method method access public returntype 1 access_ returntype_ access access returntype return index name name param params access_ returntype_ returnindex name_ param_ access m access returntype m returntype name m name param m param access_ access_ returntype_ returntype_ name_ name_ param_ param_ method method clear void method clear param clear param_ void method change access int access access access changeaccess access_ void method change return int index returntype index changereturn returntype_ void method change name string new name name new name changename newname name_ newname attribute method get parameter int index return param index getparameter param_ attribute method new parameter int index attribute temp temp change access 0 param push back temp index param size 1 return param back newparameter changeaccess param_ push_back param_ param_ void method remove parameter int index precondition index 0 index int param size vector attribute iterator i param begin index param erase i removeparameter param_ param_ param_ bool method edit method edit dialog d d set name name d set return returntype d set visibility access d set params param if d run return false return true methodeditdialog setname name_ setreturn returntype_ setvisibility access_ setparams param_ bool method iedit inter method edit dialog d d set name name d set return returntype d set visibility access d set params param if d run return false return true intermethodeditdialog setname name_ setreturn returntype_ setvisibility access_ setparams param_ bool method write ostream os const os access endl os document manager current get type returntype endl os name endl os param size endl vector attribute const iterator i for i param begin i param end i i write os if os fail return false return true access_ documentmanager gettype returntype_ name_ param_ const_iterator param_ param_ bool method read istream is first clear self clear is access is get flush newline string temp getline is temp returntype document manager current add type temp getline is name size t i is i is get flush newline while i attribute attr attr read is if is fail return false param push back attr if is fail return false return true access_ returntype_ documentmanager addtype name_ size_t param_ push_back string method to string const string temp switch access case nothing break case public temp break case private temp break case protected temp break temp name iterate through parameter list and call to string for vector attribute const iterator i param begin i param end i temp i to string if i param end 1 temp temp temp string return name document manager current get type returntype if return name void temp return name return temp tostring access_ name_ const_iterator param_ param_ tostring param_ returnname documentmanager gettype returntype_ returnname returnname method method operator const method m access m access returntype m returntype name m name param m param return this access_ access_ returntype_ returntype_ name_ name_ param_ param_ interface edit dialog name index null methods null interfaceeditdialog nameindex void interface edit dialog set name int name name index name interfaceeditdialog setname nameindex void interface edit dialog set methods vector method meth methods meth interfaceeditdialog setmethods bool interface edit dialog run precondition name index methods string interface name document manager current get type name index string method string for vector method iterator i methods begin i methods end i method string i to string method string n tcl call interface edit dialog class name method string tcl commander cmd cmd interface edit dialog interface name method string assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name interface name tcl getvar2 et interp data name tcl global only name index document manager current change type name index interface name return true interfaceeditdialog nameindex interfacename documentmanager gettype nameindex methodstring methodstring tostring methodstring interfaceeditdialog classname methodstring tclcommander interfaceeditdialog interfacename methodstring tcl_ok tcl_getvar2 et_interp tcl_global_only interfacename tcl_getvar2 et_interp tcl_global_only nameindex documentmanager changetype nameindex interfacename comment edit dialog comment null commenteditdialog comment_ void comment edit dialog set comment vector string com comment com commenteditdialog setcomment comment_ bool comment edit dialog run precondition comment string comment string for vector string const iterator i comment begin i comment end i comment string i comment string n tcl call comment edit dialog comment string tcl commander cmd cmd comment edit dialog comment string assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data comment istrstream iss1 tcl getvar2 et interp data comment tcl global only comment clear while getline iss1 comment string comment push back comment string return true commenteditdialog comment_ comment_string const_iterator comment_ comment_ comment_string comment_string commenteditdialog comment_string tclcommander commenteditdialog comment_string tcl_ok tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only comment_ comment_string comment_ push_back comment_string name1 n1 name2 n2 mult1 mult2 null role1 role2 null look null void aggreg edit dialog set mult string m1 string m2 mult1 m1 mult2 m2 aggregeditdialog setmult void aggreg edit dialog set role vector string r1 vector string r2 role1 r1 role2 r2 aggregeditdialog setrole void aggreg edit dialog set look int l look l aggregeditdialog setlook void aggreg edit dialog set rel string rel relationship rel aggregeditdialog setrel bool aggreg edit dialog run precondition mult1 mult2 role1 role2 look relationship string role1 string string role2 string for vector string iterator i role1 begin i role1 end i role1 string i role1 string n for vector string iterator i role2 begin i role2 end i role2 string i role2 string n tcl call aggreg edit dialog name1 name2 mult1 mult2 role1 string tcl role2 string look relationship tcl and store result in global variable data tcl commander cmd cmd aggreg edit dialog name1 name2 mult1 mult2 role1 string role2 string look relationship assert cmd tcl ok tcl get data cancelflag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data mult1 mult1 tcl getvar2 et interp data mult1 tcl global only tcl get data mult2 mult2 tcl getvar2 et interp data mult2 tcl global only tcl get data role1 istrstream iss1 tcl getvar2 et interp data role1 tcl global only role1 clear string temp while getline iss1 temp role1 push back temp tcl get data role2 istrstream iss2 tcl getvar2 et interp data role2 tcl global only role2 clear while getline iss2 temp role2 push back temp tcl get data look char ch ch tcl getvar2 et interp data look tcl global only look ch 0 tcl get data relationship relationship tcl getvar2 et interp data relationship tcl global only return true aggregeditdialog role1string role2string role1string role1string role2string role2string aggregeditdialog role1string role2string tclcommander aggregeditdialog role1string role2string tcl_ok tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only push_back tcl_getvar2 et_interp tcl_global_only push_back tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only name2 n2 constraint null arrowend null constraint_ arrowend_ void constraint edit dialog set constraint string c constraint c constrainteditdialog setconstraint constraint_ void constraint edit dialog set arrow int a arrowend a constrainteditdialog setarrow arrowend_ bool constraint edit dialog run precondition constraint arrowend tcl call constraint edit dialog name1 name2 constraint arrowend tcl and store result in global variable data tcl commander cmd cmd constraint edit dialog name1 name2 constraint arrowend assert cmd tcl ok tcl get data cancelflag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data constraint constraint tcl getvar2 et interp data constraint tcl global only tcl get data arrowend char ch ch tcl getvar2 et interp data arrowend tcl global only arrowend ch 0 return true constrainteditdialog constraint_ arrowend_ constrainteditdialog constraint_ arrowend_ tclcommander constrainteditdialog constraint_ arrowend_ tcl_ok tcl_getvar2 et_interp tcl_global_only constraint_ tcl_getvar2 et_interp tcl_global_only tcl_getvar2 et_interp tcl_global_only arrowend_ name1 n1 name2 n2 arrow on first null arrowonfirst void dependency edit dialog set flag bool a onf arrow on first a onf dependencyeditdialog setflag aonf arrowonfirst aonf bool dependency edit dialog run precondition arrow on first tcl commander cmd if arrow on first tcl call dependency edit dialog name1 name2 1 tcl and store result in global variable data cmd dependency edit dialog name1 name2 1 else tcl call dependency edit dialog name1 name2 0 tcl and store result in global variable data cmd dependency edit dialog name1 name2 0 assert cmd tcl ok tcl get data cancelflag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data first is arrow if tcl getvar2 et interp data first is arrow tcl global only 1 arrow on first true else arrow on first false return true dependencyeditdialog arrowonfirst tclcommander arrowonfirst dependencyeditdialog dependencyeditdialog dependencyeditdialog dependencyeditdialog tcl_ok tcl_getvar2 et_interp tcl_global_only firstisarrow tcl_getvar2 et_interp firstisarrow tcl_global_only arrowonfirst arrowonfirst attribute edit dialog attributename null visibility null type null attributeeditdialog attributename_ visibility_ type_ void attribute edit dialog set name string attribute name attributename attribute name attributeeditdialog setname attributename attributename_ attributename void attribute edit dialog set visibility int visibility visibility visibility attributeeditdialog setvisibility visibility_ void attribute edit dialog set type int type type type attributeeditdialog settype type_ bool attribute edit dialog run precondition attributename visibility type string type string document manager current get type type string type list populate string with all types for int i 0 i document manager current size type i string temp if temp document manager current get type i type list temp type list n tcl call attribute edit dialog attribute name type visibility type list tcl commander cmd cmd attribute edit dialog attributename type string visibility type list assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name attributename tcl getvar2 et interp data name tcl global only tcl get data type type string tcl getvar2 et interp data type tcl global only see whether it already exists type document manager current get type type string if type 1 not found type document manager current add type type string tcl get data viz switch tcl getvar2 et interp data viz tcl global only case 0 visibility 0 break case 1 visibility 1 break case 2 visibility 2 break case 3 visibility 3 break default visibility 0 return true attributeeditdialog attributename_ visibility_ type_ typestring documentmanager gettype type_ typelist documentmanager sizetype documentmanager gettype typelist typelist attributeeditdialog attributename typelist tclcommander attributeeditdialog attributename_ typestring visibility_ typelist tcl_ok tcl_getvar2 et_interp tcl_global_only attributename_ tcl_getvar2 et_interp tcl_global_only typestring tcl_getvar2 et_interp tcl_global_only type_ documentmanager gettype typestring type_ type_ documentmanager addtype typestring tcl_getvar2 et_interp tcl_global_only visibility_ visibility_ visibility_ visibility_ visibility_ method edit dialog methodname null returntype null visibility null params null methodeditdialog methodname_ returntype_ visibility_ params_ void method edit dialog set name string name methodname name methodeditdialog setname methodname_ void method edit dialog set return int return type returntype return type methodeditdialog setreturn returntype returntype_ returntype void method edit dialog set visibility int visiblity visibility visiblity methodeditdialog setvisibility visibility_ void method edit dialog set params vector attribute params params params methodeditdialog setparams params_ bool method edit dialog run precondition methodname returntype visibility params string type string document manager current get type returntype string type list string param string populate string with all types for int i 0 i document manager current size type i string temp if temp document manager current get type i type list temp type list n for vector attribute iterator i params begin i params end i param string i to string param string n tcl call parameter edit dialog method name return type visibility params string tcl commander cmd cmd method edit dialog methodname type string visibility param string type list assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name methodname tcl getvar2 et interp data name tcl global only tcl get data type type string tcl getvar2 et interp data type tcl global only returntype document manager current get type type string if returntype 1 not found returntype document manager current add type type string tcl get data viz switch tcl getvar2 et interp data viz tcl global only case 0 visibility 0 break case 1 visibility 1 break case 2 visibility 2 break case 3 visibility 3 break default visibility 0 return true methodeditdialog methodname_ returntype_ visibility_ params_ typestring documentmanager gettype returntype_ typelist paramstring documentmanager sizetype documentmanager gettype typelist typelist params_ params_ paramstring tostring paramstring parametereditdialog methodname returntype paramsstring tclcommander methodeditdialog methodname_ typestring visibility_ paramstring typelist tcl_ok tcl_getvar2 et_interp tcl_global_only methodname_ tcl_getvar2 et_interp tcl_global_only typestring tcl_getvar2 et_interp tcl_global_only returntype_ documentmanager gettype typestring returntype_ returntype_ documentmanager addtype typestring tcl_getvar2 et_interp tcl_global_only visibility_ visibility_ visibility_ visibility_ visibility_ inter method edit dialog methodname null returntype null visibility null params null intermethodeditdialog methodname_ returntype_ visibility_ params_ void inter method edit dialog set name string name methodname name intermethodeditdialog setname methodname_ void inter method edit dialog set return int return type returntype return type intermethodeditdialog setreturn returntype returntype_ returntype void inter method edit dialog set visibility int visiblity visibility visiblity intermethodeditdialog setvisibility visibility_ void inter method edit dialog set params vector attribute params params params intermethodeditdialog setparams params_ bool inter method edit dialog run precondition methodname returntype visibility params string type string document manager current get type returntype string type list string param string populate string with all types for int i 0 i document manager current size type i string temp if temp document manager current get type i type list temp type list n for vector attribute iterator i params begin i params end i param string i to string param string n tcl call parameter edit dialog method name return type visibility params string tcl commander cmd cmd inter method edit dialog methodname type string visibility param string type list assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name methodname tcl getvar2 et interp data name tcl global only tcl get data type type string tcl getvar2 et interp data type tcl global only returntype document manager current get type type string if returntype 1 not found returntype document manager current add type type string tcl get data viz switch tcl getvar2 et interp data viz tcl global only case 0 visibility 0 break case 1 visibility 1 break case 2 visibility 2 break case 3 visibility 3 break default visibility 0 return true intermethodeditdialog methodname_ returntype_ visibility_ params_ typestring documentmanager gettype returntype_ typelist paramstring documentmanager sizetype documentmanager gettype typelist typelist params_ params_ paramstring tostring paramstring parametereditdialog methodname returntype paramsstring tclcommander intermethodeditdialog methodname_ typestring visibility_ paramstring typelist tcl_ok tcl_getvar2 et_interp tcl_global_only methodname_ tcl_getvar2 et_interp tcl_global_only typestring tcl_getvar2 et_interp tcl_global_only returntype_ documentmanager gettype typestring returntype_ returntype_ documentmanager addtype typestring tcl_getvar2 et_interp tcl_global_only visibility_ visibility_ visibility_ visibility_ visibility_ parameter edit dialog parametername null type null parametereditdialog parametername_ type_ void parameter edit dialog set name string attribute name parametername attribute name parametereditdialog setname attributename parametername_ attributename void parameter edit dialog set type int type type type parametereditdialog settype type_ bool parameter edit dialog run precondition parametername type string type string document manager current get type type string type list populate string with all types for int i 0 i document manager current size type i string temp if temp document manager current get type i type list temp type list n tcl call parameter edit dialog attribute name type visibility type list tcl commander cmd cmd parameter edit dialog parametername type string type list assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name parametername tcl getvar2 et interp data name tcl global only tcl get data type type string tcl getvar2 et interp data type tcl global only type document manager current get type type string if type 1 not found type document manager current add type type string return true parametereditdialog parametername_ type_ typestring documentmanager gettype type_ typelist documentmanager sizetype documentmanager gettype typelist typelist parametereditdialog attributename typelist tclcommander parametereditdialog parametername_ typestring typelist tcl_ok tcl_getvar2 et_interp tcl_global_only parametername_ tcl_getvar2 et_interp tcl_global_only typestring tcl_getvar2 et_interp tcl_global_only type_ documentmanager gettype typestring type_ type_ documentmanager addtype typestring inter parameter edit dialog parametername null type null interparametereditdialog parametername_ type_ void inter parameter edit dialog set name string attribute name parametername attribute name interparametereditdialog setname attributename parametername_ attributename void inter parameter edit dialog set type int type type type interparametereditdialog settype type_ bool inter parameter edit dialog run precondition parametername type string type string document manager current get type type string type list populate string with all types for int i 0 i document manager current size type i string temp if temp document manager current get type i type list temp type list n tcl call parameter edit dialog attribute name type visibility type list tcl commander cmd cmd inter parameter edit dialog parametername type string type list assert cmd tcl ok tcl get data cancel flag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data name parametername tcl getvar2 et interp data name tcl global only tcl get data type type string tcl getvar2 et interp data type tcl global only type document manager current get type type string if type 1 not found type document manager current add type type string return true interparametereditdialog parametername_ type_ typestring documentmanager gettype type_ typelist documentmanager sizetype documentmanager gettype typelist typelist parametereditdialog attributename typelist tclcommander interparametereditdialog parametername_ typestring typelist tcl_ok tcl_getvar2 et_interp tcl_global_only parametername_ tcl_getvar2 et_interp tcl_global_only typestring tcl_getvar2 et_interp tcl_global_only type_ documentmanager gettype typestring type_ type_ documentmanager addtype typestring qual assoc edit dialog contents null qualassoceditdialog contents_ void qual assoc edit dialog set contents string c contents c qualassoceditdialog setcontents contents_ bool qual assoc edit dialog run precondition contents tcl call qualification edit dialog contents tcl and store result in global variable data tcl commander cmd cmd qualification edit dialog contents assert cmd tcl ok tcl get data cancelflag if tcl getvar2 et interp data cancelflag tcl global only 1 return false tcl get data title contents tcl getvar2 et interp data title tcl global only return true qualassoceditdialog contents_ qualificationeditdialog contents_ tclcommander qualificationeditdialog contents_ tcl_ok tcl_getvar2 et_interp tcl_global_only contents_ tcl_getvar2 et_interp tcl_global_only void tkw polygon create vector double nx vector double ny if is attached return x clear copy nx begin nx end back inserter x y clear copy ny begin ny end back inserter y tcl create polygon at given coords with black fill can be reset tcl commander cmd cmd tkw obj canvas create polygon for size t i 0 i x size i cmd static cast int x i static cast int y i cmd fill black outline black width 1 assert cmd tcl ok int id assert tcl getintfromobj et interp tcl getobjresult et interp id tcl ok attach id tkwpolygon isattached back_inserter back_inserter tclcommander tkwobj size_t static_cast static_cast tcl_ok tcl_getintfromobj et_interp tcl_getobjresult et_interp tcl_ok void tkw polygon set coords vector double nx vector double ny precondition is attached x clear copy nx begin nx end back inserter x y clear copy ny begin ny end back inserter y if visible flag return tcl set rectangle coordinates for itemid to x1 y1 x2 y2 tcl commander cmd cmd tkw obj canvas coords itemid for size t i 0 i x size i cmd static cast int x i static cast int y i assert cmd tcl ok tkwpolygon setcoords isattached back_inserter back_inserter visibleflag tclcommander tkwobj size_t static_cast static_cast tcl_ok void tkw polygon visible bool vis precondition is attached if vis visible flag return tcl commander cmd if vis tcl make polygon itemid fill transparent outline transparent tcl make polygon itemid outline width 0 0 cmd tkw obj canvas itemconfigure itemid fill cmd push cmd width 0 outline cmd push else tcl make polygon itemid fill black outline black tcl make polygon itemid outline width 0 0 cmd tkw obj canvas itemconfigure itemid fill black outline black width 1 assert cmd tcl ok visible flag vis tkwpolygon isattached visibleflag tclcommander tkwobj tkwobj tcl_ok visibleflag void tkw polygon get coords vector double nx vector double ny const nx clear ny clear copy x begin x end back inserter nx copy y begin y end back inserter ny tkwpolygon getcoords back_inserter back_inserter bool tkw polygon is visible const return visible flag tkwpolygon isvisible visibleflag handle const handle other d ptr other d ptr d ptr ref d_ptr_ d_ptr_ d_ptr_ handle d ptr base other d ptr other d ptr ref d_ptr_base d_ptr_ d_ptr_ handle if d ptr d ptr deref d_ptr_ d_ptr_ handle operator const handle other make sure we handle assign to self if other this return this d ptr base old d ptr d ptr other d ptr if d ptr d ptr ref if old old deref return this d_ptr_base d_ptr_ d_ptr_ d_ptr_ d_ptr_ d_ptr_ parent operator const assert d ptr d ptr get return d ptr get d_ptr_ d_ptr_ d_ptr_ parent operator const assert d ptr return d ptr get d_ptr_ d_ptr_ operator parent const assert d ptr return d ptr get d_ptr_ d_ptr_ bool operator const handle other const return d ptr other d ptr d_ptr_ d_ptr_ bool operator const parent other const assert d ptr return d ptr get other d_ptr_ d_ptr_ bool operator subject base coll view base parent if coll detach view parent delete coll return true subjectbase viewbase detachview type type const string name name name name_ type type const type t name t name name_ name_ string type get name const return name getname name_ void type set name string new name name new name setname newname name_ newname type type operator const type t name t name return this name_ name_ type list type list add basic initial types in list types push back type void types push back type integer types push back type character types push back type real types push back type string types push back type boolean typelist typelist types_ push_back types_ push_back types_ push_back types_ push_back types_ push_back types_ push_back type list type list for vector type iterator i types begin i types end i delete i typelist typelist types_ types_ type type list get type int index type temp null check if index is valid if index 0 index int types size temp types index return temp typelist gettype types_ types_ int type list add type string name int index check to see if type already exists if index find type name 0 return index otherwise push new type on back of vector types push back type name return types size 1 typelist addtype findtype types_ push_back types_ void type list remove type int index types index type nil typelist removetype types_ int type list size return types size typelist types_ int type list find type string name const int index 0 for vector type const iterator i types begin i types end i if i get name name return index index return 1 typelist findtype const_iterator types_ types_ getname status clobber int msg status bar set message msg attached true statusclobber statusbar setmessage status clobber if attached status bar set message status bar message default statusclobber statusbar setmessage statusbar messagedefault void kill attached false new link1 cmd new link1 cmd int type string block1 type type b doc man find object block1 l null undone true newlink1cmd newlink1cmd _type _type docman findobject new link1 cmd new link1 cmd if undone l delete l newlink1cmd newlink1cmd command status new link1 cmd execute status s edit command execute if s ok return s l visible true undone false return ok newlink1cmd editcommand bool new link1 cmd undo l visible false undone true return true newlink1cmd command status new link1 cmd init tag tag if b return error if link tag man new tag tag return error out of tags if l fac create edge type tag return error weird error if l attach to graph view 0 b b status bar set message status bar message already exists return cancel possible duplicate pair edit view e l new edit view if e edit delete e return cancel delete e l create rep if doc man push edge l return error status bar set message status bar message default return ok newlink1cmd linktagman newtag createedge attachtographview statusbar setmessage statusbar messagealreadyexists editview neweditview createrep docman pushedge statusbar setmessage statusbar messagedefault double ny precondition origin slot slot origin origin valid false if reseat to length 0 return no close object found reseat to doc man find object reseat to object not found assert reseat to if reseat to return just for protection this shouldn t happen if origin is edge attach allowed reseat to slot reseat to null return bad bad bad cycle detected anchor anchor origin get anchor slot assert anchor anchor get position oldx oldy old position anchor get view int sl if slot 0 sl 1 else sl 0 anchor origin get anchor sl assert anchor other anchor anchor get view newx nx newy ny valid true postcondition origin reseat to old position other anchor slot_ origin_ valid_ reseat_to reseat_to_ docman findobject reseat_to reseat_to_ reseat_to_ origin_ isedgeattachallowed reseat_to_ slot_ reseat_to_ origin_ getanchor getposition oldx_ oldy_ old_position_ getview origin_ getanchor other_anchor_ getview newx_ newy_ valid_ origin_ reseat_to_ old_position_ other_anchor_ command status reseat anchor cmd execute status s edit command execute if s ok return s precondition origin reseat to old position other anchor different object bool selected false if reseat to old position deselect temporarily so we don t confuse poor anchor thing selected origin is selected origin select false reattach origin attach to graph view slot reseat to other anchor grab newly created anchor in new slot or same anchor if we are reseating to same anchor anchor origin get anchor slot assert anchor anchor set position newx newy origin update different object if reseat to old position selected reselect if necessary origin select selected return ok reseatanchorcmd editcommand origin_ reseat_to_ old_position_ other_anchor_ reseat_to_ old_position_ origin_ isselected origin_ origin_ attachtographview slot_ reseat_to_ other_anchor_ origin_ getanchor slot_ setposition newx_ newy_ origin_ reseat_to_ old_position_ origin_ bool reseat anchor cmd undo precondition origin reseat to old position other anchor different object bool selected false if reseat to old position deselect temporarily so we don t confuse poor anchor thing selected origin is selected origin select false reattach to old one origin attach to graph view slot old position other anchor grab new anchor in new old slot or same anchor if we are reseating to same anchor anchor origin get anchor slot assert anchor anchor set position oldx oldy origin update different object if reseat to old position selected reselect if necessary origin select selected return true reseatanchorcmd origin_ reseat_to_ old_position_ other_anchor_ reseat_to_ old_position_ origin_ isselected origin_ origin_ attachtographview slot_ old_position_ other_anchor_ origin_ getanchor slot_ setposition oldx_ oldy_ origin_ reseat_to_ old_position_ origin_ command status reseat anchor cmd init if valid status bar set message status bar message invalid reseat return cancel possible duplicate pair return ok reseatanchorcmd valid_ statusbar setmessage statusbar messageinvalidreseat class subject const string oid node subject impl oid name document manager current size type classsubject nodesubjectimpl name_ documentmanager sizetype class subject class subject classsubject classsubject int class subject get classid const return id class classsubject getclassid id_class edit view class subject new edit view return new class edit view this editview classsubject neweditview classeditview node graph view class subject new graph view tag tag return new class graph view tag this nodegraphview classsubject newgraphview classgraphview bool class subject read istream is input streamer stream is if stream read type type name stream read attributes attributes attributes stream read methods methods methods return false set up type set objid document manager current get type name return is fail classsubject inputstreamer readtype name_ readattributes attributes_ readmethods methods_ setobjid documentmanager gettype name_ bool class subject write ostream os output streamer stream os if stream write type type name stream write attributes attributes attributes stream write methods methods methods return false return os fail classsubject outputstreamer writetype name_ writeattributes attributes_ writemethods methods_ attribute class subject get attribute int index return attributes index classsubject getattribute attributes_ method class subject get method int index return methods index classsubject getmethod methods_ attribute class subject new attribute int index attribute temp attributes push back temp index attributes size 1 return attributes back classsubject newattribute attributes_ push_back attributes_ attributes_ method class subject new method int index method temp methods push back temp index methods size 1 return methods back classsubject newmethod methods_ push_back methods_ methods_ void class subject remove attribute int index precondition index 0 index int attributes size vector attribute iterator i attributes begin index attributes erase i classsubject removeattribute attributes_ attributes_ attributes_ void class subject remove method int index precondition index 0 index int methods size vector method iterator i methods begin index methods erase i classsubject removemethod methods_ methods_ methods_ edge e reset position anch from resetposition anch_from node anchor node anchor if anchor to anchor to remove this nodeanchor nodeanchor anchor_to anchor_to anchor side node anchor get position double x double y return anchor to location angle x y nodeanchor getposition anchor_to void node anchor set position double x double y angle anchor to rev location x y nodeanchor setposition anchor_to rev_location void node anchor reset position graph view o if o angle 0 5 else double x y o get position x y set position x y nodeanchor resetposition graphview getposition setposition edge graph view node anchor get edge view return edge edgegraphview nodeanchor getedgeview graph view node anchor get view return anchor to get view graphview nodeanchor getview anchor_to getview bool node anchor read istream is is angle is get scrap newline return is fail nodeanchor bool node anchor write ostream os os angle endl return os fail nodeanchor other anch from reset position anch from anch_from resetposition anch_from edge anchor edge anchor if anchor to anchor to remove this edgeanchor edgeanchor anchor_to anchor_to anchor side edge anchor get position double x double y return anchor to location fraction x y edgeanchor getposition anchor_to void edge anchor set position double x double y fraction anchor to rev location x y edgeanchor setposition anchor_to rev_location void edge anchor reset position graph view o fraction 0 5 edgeanchor resetposition graphview edge graph view edge anchor get edge view return edge edgegraphview edgeanchor getedgeview graph view edge anchor get view return anchor to get view graphview edgeanchor getview anchor_to getview bool edge anchor write ostream os os fraction endl return os fail edgeanchor bool edge anchor read istream is is fraction is get discard newline return is fail edgeanchor bool operator anchor anchor if anchor anchor get edge view update return anchor null getedgeview bool operator anchor anchor if anchor anchor get edge view visible vis return anchor null getedgeview anchored anchored current return anchored current line current_line_ void anchored grab anchor if current line null current line release anchor current line this grabanchor current_line_ current_line_ releaseanchor current_line_ line impl line interface li placement strategy strat virtual void create anchor one anchor two tag tag if one first one if two second two lineimpl line_interface placement_strategy first_ second_ double y const return strat location fraction x y strat_ virtual double location double x double y const return strat location x y strat_ virtual void reset anchor one anchor two if one first one if two second two first_ second_ visibleflag true arrows 0 arrows 1 line interface none visibleflag_ arrows_ arrows_ line_interface anchor line impl get anchor int slot assert slot 0 slot 1 if slot return first else return second lineimpl getanchor first_ second_ void line impl visible bool vis if vis visibleflag return if vis release anchor visibleflag vis lineimpl visibleflag_ releaseanchor visibleflag_ void line impl select bool sel if sel selflag return if sel grab anchor else release anchor selflag sel lineimpl selflag_ grabanchor releaseanchor selflag_ void line impl update data get arrow arrows 0 arrows 1 data get arrow shape neck2tip points2tip arrowwidth for int i 0 i 6 i if data get text line interface position i text i text i erase line interface dash type d data get dash dash stipple lineimpl data_ getarrow arrows_ arrows_ data_ getarrowshape neck2tip_ points2tip_ arrowwidth_ data_ gettext line_interface text_ text_ line_interface dash_type data_ getdash dash_ stipple_ void tkw line anchors grab anchor anchor one anchor two precondition one double x y one get position x y ostrstream cmd if two cmd make anchors x y two get position x y cmd x y ends else cmd make anchor x y ends note make anchor no s string z cmd str cmd freeze 0 assert tcl globaleval et interp char z c str tcl ok tkwlineanchors grabanchor getposition makeanchors getposition makeanchor makeanchor tcl_globaleval et_interp c_str tcl_ok void tkw line anchors release anchor tcl globaleval et interp if anch1 1 n catch canvas delete anch1 anch2 n set anch1 1 n set anch2 1 n assert tcl globaleval et interp rm anchors n tcl ok tkwlineanchors releaseanchor tcl_globaleval et_interp tcl_globaleval et_interp rmanchors tcl_ok tkw line impl tkw line impl release anchor tkwlineimpl tkwlineimpl releaseanchor void tkw line impl create anchor one anchor two tag tag line impl create one two tag create the appropriate items base create 0 0 0 0 base add tag both link tag man tag to string tag base add tag link bind for highlighting ostrstream oss oss highlight object base get ends string hobject oss str base bind both enter hobject oss freeze 0 oss seekp 0 ios beg oss un highlight object base get ends string uobject oss str base bind both leave uobject oss freeze 0 create the arrows for int i 0 i 2 i arrow heads i create 0 0 0 0 arrow heads i set fill white arrow heads i bind both enter hobject arrow heads i bind both leave uobject arrow heads i add tag both link tag man tag to string tag arrow heads i set arrows tkw line last arrow heads i set fill white create the text for int i 0 i 6 i tktext i create 0 0 tktext i set fill black tktext i bind enter hobject tktext i bind leave uobject tktext i add tag link tag man tag to string tag tktext i raise base raise pretend we re visible line impl visible force redraw redraw set our real visibility line impl visible base is visible tkwlineimpl lineimpl base_ base_ addtagboth linktagman tagtostring base_ addtag highlightobject base_ base_ bindboth unhighlightobject base_ base_ bindboth arrow_heads_ arrow_heads_ setfill arrow_heads_ bindboth arrow_heads_ bindboth arrow_heads_ addtagboth linktagman tagtostring arrow_heads_ setarrows tkwline arrow_heads_ setfill tktext_ tktext_ setfill tktext_ tktext_ tktext_ addtag linktagman tagtostring tktext_ base_ lineimpl lineimpl base_ isvisible void tkw line impl visible bool vis if vis is visible return if vis base visible true base raise base del tag both inactive if is selected base add tag selected base set fill red for int i 0 i 2 i if arrows i line interface clear arrow heads i visible true arrow heads i raise base get else arrow heads i visible false arrow heads i set fill white arrow heads i del tag both inactive for int i 0 i 6 i tktext i visible true tktext i raise base get tktext i del tag inactive else base visible false base lower base add tag both inactive if is selected base del tag selected for int i 0 i 2 i arrow heads i visible false arrow heads i lower arrow heads i add tag both inactive for int i 0 i 6 i tktext i visible false tktext i lower tktext i add tag inactive line impl visible vis tkwlineimpl isvisible base_ base_ base_ deltagboth isselected base_ addtag base_ setfill arrows_ line_interface arrow_heads_ arrow_heads_ base_ arrow_heads_ arrow_heads_ setfill arrow_heads_ deltagboth tktext_ tktext_ base_ tktext_ deltag base_ base_ base_ addtagboth isselected base_ deltag arrow_heads_ arrow_heads_ arrow_heads_ addtagboth tktext_ tktext_ tktext_ addtag lineimpl void tkw line impl select bool sel precondition is visible if is selected sel return line impl select sel if sel base set fill red base add tag selected else base set fill black base del tag selected tkwlineimpl isvisible isselected lineimpl base_ setfill base_ addtag base_ setfill base_ deltag void tkw line impl redraw if is visible return precondition first second update cache data grab coordinates double x1 y1 x2 y2 anchor side s1 s2 vector double xcoords ycoords s1 first get position x1 y1 s2 second get position x2 y2 grab proper coordinates strat set position x1 y1 s1 x2 y2 s2 fix line strat get line points xcoords ycoords base set coords xcoords ycoords fix arrows strat get arrow points 0 points2tip x1 y1 x2 y2 arrow heads 0 set coords x1 y1 x2 y2 strat get arrow points 1 points2tip x1 y1 x2 y2 arrow heads 1 set coords x1 y1 x2 y2 for int i 0 i 2 i arrow heads i set arrow shape neck2tip 6 points2tip 6 arrowwidth 4 switch arrows i case line interface clear arrow heads i visible true arrow heads i raise base get arrow heads i set fill white break default arrow heads i visible false if arrows 0 line interface none arrows 1 line interface none base set arrows tkw line both else if arrows 0 line interface none arrows 1 line interface none base set arrows tkw line first else if arrows 0 line interface none arrows 1 line interface none base set arrows tkw line last else base set arrows tkw line none fix text for int i line interface ul i line interface lr i double tx ty tkw text anchor tanchor tanchor strat text position line interface position i tx ty tktext i set anchor tanchor tktext i set coords tx ty tktext i set text text i set arrow sizes base set arrow shape neck2tip points2tip arrowwidth set stipple static const char stipple array none gray75 gray75 gray50 gray50 gray25 gray25 gray12 gray12 base set stipple stipple array stipple set dash static const char dash array base set dash dash array dash done fix anchors if necessary if current line this release anchor grab anchor tkwlineimpl isvisible first_ second_ first_ getposition second_ getposition strat_ setposition strat_ getlinepoints base_ setcoords strat_ getarrowpoints points2tip_ arrow_heads_ setcoords strat_ getarrowpoints points2tip_ arrow_heads_ setcoords arrow_heads_ setarrowshape neck2tip_ points2tip_ arrowwidth_ arrows_ line_interface arrow_heads_ arrow_heads_ base_ arrow_heads_ setfill arrow_heads_ arrows_ line_interface arrows_ line_interface base_ setarrows tkwline arrows_ line_interface arrows_ line_interface base_ setarrows tkwline arrows_ line_interface arrows_ line_interface base_ setarrows tkwline base_ setarrows tkwline line_interface line_interface tkwtext strat_ textposition line_interface tktext_ setanchor tktext_ setcoords tktext_ settext text_ base_ setarrowshape neck2tip_ points2tip_ arrowwidth_ stipple_array base_ setstipple stipple_array stipple_ dash_array base_ setdash dash_array dash_ current_line_ releaseanchor grabanchor void tkw line impl grab anchor if current line this return line impl grab anchor anchor impl grab anchor first second tkwlineimpl grabanchor current_line_ lineimpl grabanchor anchor_impl_ grabanchor first_ second_ void tkw line impl release anchor if current line this return anchor impl release anchor current line null tkwlineimpl releaseanchor current_line_ anchor_impl_ releaseanchor current_line_ void multi box impl find size double sx double sy const double line height double min width double min height double x pad double y pad box params line height min width min height x pad y pad sy 0 0 for size t i 0 i sections size i sy heights i line height 2 y pad sx width 2 x pad if sx min width sx min width if sy min height sy min height multiboximpl findsize line_height min_width min_height x_pad y_pad boxparams line_height min_width min_height x_pad y_pad size_t sections_ heights_ line_height y_pad width_ x_pad min_width min_width min_height min_height double y const this function replaces the old chop function double sx sy phi double dx dy anchor side s find size sx sy phi atan2 sy sx if fabs angle phi right intersect dx sx 2 dy dx tan angle s anchor right else if fabs angle m pi phi upper or lower intersect if angle 0 dy sy 2 else dy sy 2 dx dy tan angle if angle 0 s anchor bottom else s anchor top else left intersect dx sx 2 dy dx tan angle s anchor left x dx cx transform deltas to absolute coordinates y dy cy return s findsize m_pi cx_ cy_ double multi box impl location double x double y const return atan2 cy y x cx multiboximpl cy_ cx_ double height if secnum int sections size return false double line height min width min height double x pad y pad box params line height min width min height x pad y pad height heights secnum line height 2 y pad return true sections_ line_height min_width min_height x_pad y_pad boxparams line_height min_width min_height x_pad y_pad heights_ line_height y_pad void multi box impl update sections clear heights clear go through each section one by one and calculate different parameters size t i n data number of sections j k 0 l 0 vector string temp size t width 0 for i 0 i n i string work size t height 0 temp clear data get section i temp for j 0 j temp size j work temp j work n if temp j length width k i l j width temp j length height remove final newlines if j work find last not of n string npos work erase else work resize j 1 sections push back work heights push back height fix width temp clear data get section k temp width text width temp l multiboximpl sections_ heights_ size_t data_ numberofsections size_t size_t data_ getsection find_last_not_of sections_ push_back heights_ push_back data_ getsection width_ textwidth multi box impl mri max sections maxsections text lines new tkw text max sections assert text lines if max sections 1 separators new tkw line max sections 1 assert separators else separators null multiboximpl max_sections_ text_lines_ tkwtext max_sections_ text_lines_ max_sections_ separators_ tkwline max_sections_ separators_ separators_ tkw multi box impl tkw multi box impl if text lines delete text lines if separators delete separators tkwmultiboximpl tkwmultiboximpl text_lines_ text_lines_ separators_ separators_ void tkw multi box impl visible bool vis if vis is visible return nothing to do if vis base visible true base del tag inactive base raise base lower link if is selected base add tag selected base set outline red mess with text and lines for size t i 0 i max sections i text lines i visible true text lines i del tag inactive text lines i raise base get if i max sections 1 separators i visible true separators i del tag both inactive separators i raise base get if is selected separators i set fill red else base visible false base add tag inactive if is selected base del tag selected base lower mess with text and lines for size t i 0 i max sections i text lines i visible false text lines i add tag inactive text lines i lower if i max sections 1 separators i visible false separators i add tag both inactive separators i lower multi box impl visible vis tkwmultiboximpl isvisible base_ base_ deltag base_ base_ isselected base_ addtag base_ setoutline size_t max_sections_ text_lines_ text_lines_ deltag text_lines_ base_ max_sections_ separators_ separators_ deltagboth separators_ base_ isselected separators_ setfill base_ base_ addtag isselected base_ deltag base_ size_t max_sections_ text_lines_ text_lines_ addtag text_lines_ max_sections_ separators_ separators_ addtagboth separators_ multiboximpl void tkw multi box impl select bool sel precondition is visible if is selected sel return if sel base set outline red base set fill white base raise base lower link base add tag selected mess with text and lines for size t i 0 i max sections i text lines i raise base get if i max sections 1 separators i set fill red separators i raise base get else base set outline black base set fill white base del tag selected mess with lines for size t i 0 i max sections 1 i separators i set fill black multi box impl select sel tkwmultiboximpl isvisible isselected base_ setoutline base_ setfill base_ base_ base_ addtag size_t max_sections_ text_lines_ base_ max_sections_ separators_ setfill separators_ base_ base_ setoutline base_ setfill base_ deltag size_t max_sections_ separators_ setfill multiboximpl void tkw multi box impl create double nx double ny const string tag cx nx cy ny create base base create 0 0 0 0 temporary position base lower link base add tag tag base add tag block bind for highlighting ostrstream oss oss highlight object base get ends string hstring oss str rew oss base bind enter hstring oss un highlight object base get ends string ustring oss str rew oss done with oss base bind leave ustring create base create elements for size t i 0 i max sections i text lines i create 0 0 text lines i set anchor tkw text nw text lines i bind enter hstring text lines i bind leave ustring text lines i add tag tag if i max sections 1 separators i create 0 0 0 0 separators i bind both enter hstring separators i bind both leave ustring separators i add tag both tag create elements mark us as visible even if it may not be the case multi box impl visible force redraw resize of everything redraw fix visibility flag multi box impl visible base is visible tkwmultiboximpl cx_ cy_ base_ base_ base_ addtag base_ addtag highlightobject base_ base_ unhighlightobject base_ base_ size_t max_sections_ text_lines_ text_lines_ setanchor tkwtext text_lines_ text_lines_ text_lines_ addtag max_sections_ separators_ separators_ bindboth separators_ bindboth separators_ addtagboth multiboximpl multiboximpl base_ isvisible void tkw multi box impl redraw if is visible return if invisible don t bother update sanity check precondition sections size max sections double sx sy find size find size sx sy set base position double x1 cx sx 2 0 y1 cy sy 2 0 double x2 cx sx 2 0 y2 cy sy 2 0 double ypos 0 0 height base set coords x1 y1 x2 y2 set coordinates text for every section for size t i 0 i max sections i if section size i height height 0 0 text lines i set text else text lines i set text sections i set text position possibly dummy text lines i set coords x1 x padding y1 ypos y padding ypos height set line position possibly dummy as well will end up right on the bottom line of the box if i max sections 1 separators i set coords x1 y1 ypos x2 y1 ypos tkwmultiboximpl isvisible sections_ max_sections_ findsize cx_ cy_ cx_ cy_ base_ setcoords size_t max_sections_ sectionsize text_lines_ settext text_lines_ settext sections_ text_lines_ setcoords x_padding y_padding max_sections_ separators_ setcoords double y pad const line height tkw text get height min width minimum width min height minimum height x pad x padding y pad y padding ypad lineheight tkwtext getheight minwidth minimum_width minheight minimum_height xpad x_padding ypad y_padding int tkw multi box impl text width const string s const return tkw text get width s tkwmultiboximpl textwidth tkwtext getwidth update lock false precondition contained the following line looks strange but it works as intended it attaches the back pointer to the subject contained in the back pointer itself it essentially seals the doule relationship contained attach view contained update_lock_ contained_ contained_ attachview contained_ edge graph view impl edge graph view impl we need to explicitely delete anchors because they are plain pointers if end1 delete end1 if end2 delete end2 we need to detach each anchor attached to us to force them to delete their views for each anchors begin anchors end anchor detach delete the representation children must allocate rep with operator new delete rep edgegraphviewimpl edgegraphviewimpl end1_ end1_ end2_ end2_ for_each anchors_ anchors_ anchor_detach rep_ tag edge graph view impl get tag const return tag edgegraphviewimpl gettag tag_ string edge graph view impl get typed tag const return link tag man tag to string get tag edgegraphviewimpl gettypedtag linktagman tagtostring gettag void edge graph view impl create rep precondition contained end1 end2 rep rep create end1 end2 tag edgegraphviewimpl createrep contained_ end1_ end2_ rep_ rep_ end1_ end2_ tag_ void edge graph view impl visible bool v precondition contained rep visible v update edges anchor collection iterator i remove if anchors begin anchors end edge visible v anchors erase i anchors end edgegraphviewimpl contained_ rep_ anchorcollection remove_if anchors_ anchors_ edge_visible anchors_ anchors_ bool edge graph view impl is visible const precondition contained return rep is visible edgegraphviewimpl isvisible contained_ rep_ isvisible void edge graph view impl select bool s precondition contained rep select s edgegraphviewimpl contained_ rep_ bool edge graph view impl is selected const precondition contained return rep is selected edgegraphviewimpl isselected contained_ rep_ isselected bool edge graph view impl read istream is if contained read is return false input streamer stream is string tag1 tag2 if stream read string pair endtags tag1 tag2 return false graph view block1 document manager current find object tag1 graph view block2 document manager current find object tag2 if block1 block2 return false prevent segfault attach to graph view 0 block1 block2 attach to graph view 1 block2 block1 postcondition end1 end2 read in anchors end1 read is end2 read is return is fail edgegraphviewimpl contained_ inputstreamer readstringpair graphview documentmanager findobject graphview documentmanager findobject attachtographview attachtographview end1_ end2_ end1_ end2_ bool edge graph view impl write ostream os if is visible return true don t write if deleted assert end1 end2 if contained write os return false output streamer stream os if stream write tag pair endtags end1 get view get typed tag end2 get view get typed tag return false end1 write os end2 write os return os fail edgegraphviewimpl isvisible end1_ end2_ contained_ outputstreamer writetagpair end1_ getview gettypedtag end2_ getview gettypedtag end1_ end2_ void edge graph view impl get position double x double y const double x1 y1 x2 y2 dx dy precondition end1 end2 end1 get position x1 y1 end2 get position x2 y2 dx x2 x1 dy y2 y1 x x1 dx 2 0 y y1 dy 2 0 edgegraphviewimpl getposition end1_ end2_ end1_ getposition end2_ getposition anchor edge graph view impl new anchor graph view g edge graph view e precondition e anchor a new edge anchor this g e assert a anchors push back a return a edgegraphviewimpl newanchor graphview edgegraphview edgeanchor anchors_ push_back void edge graph view impl get anchored position double x double y const double f rev location x y location f x y edgegraphviewimpl getanchoredposition rev_location bool edge graph view impl is attach allowed graph view gv if update lock gv this return false update lock true bool retval true if end1 get view is attach allowed gv end2 get view is attach allowed gv retval false update lock false return retval edgegraphviewimpl isattachallowed graphview update_lock_ update_lock_ end1_ getview isattachallowed end2_ getview isattachallowed update_lock_ bool edge graph view impl is edge attach allowed graph view gv int slot anchor anchor if slot 0 anchor end2 else anchor end1 if gv this gv anchor get view return false return gv is attach allowed this edgegraphviewimpl isedgeattachallowed graphview end2_ end1_ getview isattachallowed node edge graph view impl get node return contained edgegraphviewimpl getnode contained_ edge edge graph view impl get edge return contained edgegraphviewimpl getedge contained_ graph view other precondition slot 0 slot 1 if slot 0 if end1 delete end1 end1 view new anchor other this else if end2 delete end2 end2 view new anchor other this update model contained attach to node slot view get node update rep rep reset end1 end2 return true graphview end1_ end1_ end1_ newanchor end2_ end2_ end2_ newanchor contained_ attachtonode getnode rep_ end1_ end2_ anchor edge graph view impl get anchor int slot precondition slot 0 slot 1 if slot 0 return end1 else return end2 edgegraphviewimpl getanchor end1_ end2_ void edge graph view impl update precondition contained if is visible return if update lock update lock true rep redraw anchor collection iterator i remove if anchors begin anchors end edge update anchors erase i anchors end update lock false ifdef debug else cout update lock hit endl endif edgegraphviewimpl contained_ isvisible update_lock_ update_lock_ rep_ anchorcollection remove_if anchors_ anchors_ edge_update anchors_ anchors_ update_lock_ void edge graph view impl detach contained null note that it is the responsibility of the derived class to reset its own pointer as well edgegraphviewimpl contained_ edit view edge graph view impl new edit view precondition contained return contained new edit view editview edgegraphviewimpl neweditview contained_ contained_ neweditview void edge graph view impl notify precondition contained contained notify edgegraphviewimpl contained_ contained_ void edge graph view impl remove anchor ptr anchor collection iterator i clear pointer it will get garbage collected later we don t erase the slot right away because this operation is usually called when we re in the middle of iterating through the list i find anchors begin anchors end ptr if i anchors end i null edgegraphviewimpl anchorcollection anchors_ anchors_ anchors_ graph view edge graph view impl get view return this graphview edgegraphviewimpl getview double y anchor a assert a get anchor slot a get position x y getanchor getposition double y const return rep location fraction x y rep_ double edge graph view impl rev location double x double y const return rep location x y edgegraphviewimpl rev_location rep_ update lock false precondition contained the following line looks strange but it works as intended it attaches the back pointer to the subject contained in the back pointer itself it essentially seals the doule relationship contained attach view contained update_lock_ contained_ contained_ attachview contained_ node graph view impl node graph view impl attempt to kill all anchors for each anchors begin anchors end anchor detach we explicitely delete the representation this way caller can avoid keeping track of it delete rep nodegraphviewimpl nodegraphviewimpl for_each anchors_ anchors_ anchor_detach rep_ tag node graph view impl get tag const return tag nodegraphviewimpl gettag tag_ string node graph view impl get typed tag const return block tag man tag to string get tag nodegraphviewimpl gettypedtag blocktagman tagtostring gettag void node graph view impl create rep precondition contained rep create cx cy get typed tag nodegraphviewimpl createrep contained_ rep_ cx_ cy_ gettypedtag void node graph view impl visible bool v precondition contained rep visible v update every edge anchor collection iterator i remove if anchors begin anchors end edge visible v anchors erase i anchors end nodegraphviewimpl contained_ rep_ anchorcollection remove_if anchors_ anchors_ edge_visible anchors_ anchors_ void node graph view impl select bool s precondition contained rep select s nodegraphviewimpl contained_ rep_ bool node graph view impl is visible const precondition contained return rep is visible nodegraphviewimpl isvisible contained_ rep_ isvisible bool node graph view impl is selected const precondition contained return rep is selected nodegraphviewimpl isselected contained_ rep_ isselected bool node graph view impl read istream is precondition contained if contained read is return false input streamer stream is stream read coords position cx cy return is fail nodegraphviewimpl contained_ contained_ inputstreamer readcoords cx_ cy_ bool node graph view impl write ostream os precondition contained if is visible return true we don t write ourself out if we re deleted if contained write os return false output streamer stream os stream write coords position cx cy return os fail nodegraphviewimpl contained_ isvisible contained_ outputstreamer writecoords cx_ cy_ void node graph view impl get position double nx double ny const precondition contained nx cx ny cy nodegraphviewimpl getposition contained_ cx_ cy_ anchor node graph view impl new anchor graph view other edge graph view edge precondition edge anchor a new node anchor this other edge assert a anchors push back a return a nodegraphviewimpl newanchor graphview edgegraphview nodeanchor anchors_ push_back void node graph view impl get anchored position double x double y const double a rev location x y location a x y nodegraphviewimpl getanchoredposition rev_location bool node graph view impl is attach allowed graph view gv node always allow attach to themselves since they terminate the edge return true nodegraphviewimpl isattachallowed graphview node node graph view impl get node return contained nodegraphviewimpl getnode contained_ void node graph view impl set position double nx double ny precondition contained cx nx cy ny rep set position cx cy nodegraphviewimpl setposition contained_ cx_ cy_ rep_ setposition cx_ cy_ void node graph view impl update precondition contained if is visible return if update lock update lock true rep redraw anchor collection iterator i remove if anchors begin anchors end edge update anchors erase i anchors end update lock false ifdef debug else cout update lock hit endl endif nodegraphviewimpl contained_ isvisible update_lock_ update_lock_ rep_ anchorcollection remove_if anchors_ anchors_ edge_update anchors_ anchors_ update_lock_ void node graph view impl detach contained null child will have to null its own pointer nodegraphviewimpl contained_ edit view node graph view impl new edit view precondition contained return contained new edit view editview nodegraphviewimpl neweditview contained_ contained_ neweditview void node graph view impl notify precondition contained contained notify nodegraphviewimpl contained_ contained_ void node graph view impl remove anchor ptr anchor collection iterator i i find anchors begin anchors end ptr if i anchors end i null nodegraphviewimpl anchorcollection anchors_ anchors_ anchors_ graph view node graph view impl get view return this graphview nodegraphviewimpl getview double y const return rep location angle x y rep_ double node graph view impl rev location double x double y const return rep location x y nodegraphviewimpl rev_location rep_ orig o precondition o name orig get objid attr orig attributes meth orig methods getobjid void class edit view state reset precondition orig orig set objid name orig attributes attr orig methods meth orig notify classeditview setobjid orig o precondition o name orig get objid meth orig methods getobjid void interface edit view state reset precondition orig orig set objid name orig methods meth orig notify interfaceeditview setobjid ass a mult1 ass mult1 mult2 ass mult2 role1 ass role1 role2 ass role2 arrow1 ass arrow1 arrow2 ass arrow2 relationship ass relationship void reset ass mult1 mult1 ass mult2 mult2 ass role1 role1 ass role2 role2 ass arrow1 arrow1 ass arrow2 arrow2 ass relationship relationship ass a contents ass contents void reset ass contents contents orig o precondition o first is parent orig first is parent firstisparent firstisparent void gener edit view state reset precondition orig orig first is parent first is parent orig notify genereditview firstisparent firstisparent orig o precondition o arrowonfirst orig arrow on first arrowonfirst_ arrowonfirst void dependency edit view state reset precondition orig orig arrow on first arrowonfirst orig notify dependencyeditview arrowonfirst arrowonfirst_ ass a constraint a constraint arrowend a arrow end constraint_ arrowend_ arrowend void reset ass constraint constraint ass arrow end arrowend constraint_ arrowend arrowend_ void comment edit view state reset orig comment comment orig notify commenteditview orig_ comment_ orig_ void reset nothing to do ass a mult1 ass mult1 mult2 ass mult2 role1 ass role1 role2 ass role2 look ass look relationship ass relationship void reset ass mult1 mult1 ass mult2 mult2 ass role1 role1 ass role2 role2 ass look look ass relationship relationship contained c precondition contained we don t attach ourself contained attach view this attachview class edit view class edit view if contained contained detach view this contained destroy we don t detach ourselves anymore nor do we try to destroy the subject the reason we don t attach is because we may want to allocate on the stack if we do that the subject will try to delete the edit view through a pointer that s bad it ll kill the program in a major way another reason is that update is meaningless with edit view as edit view is a modal view i e the app is frozen while the view is up classeditview classeditview detachview editview editview editview _modal_ bool class edit view edit precondition contained class edit dialog d int i contained get name vector attribute attr contained attributes vector method meth contained methods d set name i d set attributes attr d set methods meth current attribute list attr current method list meth if d run return false current attribute list null current method list null contained set name i contained set objid document manager current get type i contained attributes attr contained methods meth contained notify return true classeditview classeditdialog getname setname setattributes setmethods currentattributelist currentmethodlist currentattributelist currentmethodlist setname setobjid documentmanager gettype edit view state class edit view new state precondition contained return new class edit view state contained editview classeditview newstate classeditview void class edit view update does nothing note if we make the dialog modeless someday we ll have to allow this however then it won t use edit rather building the view will create the dialog and killing the view will destroy it i don t think it s very easy to do in tk though bge 11 12 99 classeditview void class edit view detach contained null classeditview class graph view class graph view ifdef debug cout deleting class graph view get typed tag endl endif classgraphview classgraphview classgraphview gettypedtag void class graph view detach node graph view impl detach typed contained null classgraphview nodegraphviewimpl typed_contained_ int class graph view number of sections const precondition typed contained int i 1 if typed contained attributes size 0 i if typed contained methods size 0 i return i classgraphview numberofsections typed_contained_ typed_contained_ typed_contained_ void class graph view get section int n vector string s const if n 0 s clear s push back typed contained get objid else if n 1 typed contained attributes size 0 s clear for vector attribute iterator i typed contained attributes begin i typed contained attributes end i s push back i to string else if n 1 typed contained methods size 0 n 2 typed contained attributes size 0 typed contained methods size 0 s clear for vector method iterator i typed contained methods begin i typed contained methods end i s push back i to string classgraphview getsection push_back typed_contained_ getobjid typed_contained_ typed_contained_ typed_contained_ push_back tostring typed_contained_ typed_contained_ typed_contained_ typed_contained_ typed_contained_ push_back tostring interface subject const string oid node subject impl oid name document manager current size type interfacesubject nodesubjectimpl name_ documentmanager sizetype interface subject interface subject interfacesubject interfacesubject int interface subject get classid const return id interface interfacesubject getclassid id_interface edit view interface subject new edit view return new interface edit view this editview interfacesubject neweditview interfaceeditview node graph view interface subject new graph view tag tag return new interface graph view tag this nodegraphview interfacesubject newgraphview interfacegraphview bool interface subject read istream is input streamer stream is if stream read type type name stream read methods methods methods return false set objid document manager current get type name return is fail interfacesubject inputstreamer readtype name_ readmethods methods_ setobjid documentmanager gettype name_ bool interface subject write ostream os output streamer stream os if stream write type type name stream write methods methods methods return false return os fail interfacesubject outputstreamer writetype name_ writemethods methods_ method interface subject get method int index return methods index interfacesubject getmethod methods_ method interface subject new method int index method temp methods push back temp index methods size 1 return methods back interfacesubject newmethod methods_ push_back methods_ methods_ void interface subject remove method int index precondition index 0 index int methods size vector method iterator i methods begin index methods erase i interfacesubject removemethod methods_ methods_ methods_ contained c precondition contained we don t attach ourself contained attach view this attachview interface edit view interface edit view if contained contained detach view this contained destroy we don t detach ourselves anymore nor do we try to destroy the subject the reason we don t attach is because we may want to allocate on the stack if we do that the subject will try to delete the edit view through a pointer that s bad it ll kill the program in a major way another reason is that update is meaningless with edit view as edit view is a modal view i e the app is frozen while the view is up interfaceeditview interfaceeditview detachview editview editview editview _modal_ bool interface edit view edit precondition contained interface edit dialog d int i contained get name vector method meth contained methods d set name i d set methods meth current method list meth if d run return false current method list null contained set name i contained set objid document manager current get type i contained methods meth contained notify return true interfaceeditview interfaceeditdialog getname setname setmethods currentmethodlist currentmethodlist setname setobjid documentmanager gettype edit view state interface edit view new state precondition contained return new interface edit view state contained editview interfaceeditview newstate interfaceeditview void interface edit view update does nothing note if we make the dialog modeless someday we ll have to allow this however then it won t use edit rather building the view will create the dialog and killing the view will destroy it i don t think it s very easy to do in tk though bge 11 12 99 interfaceeditview void interface edit view detach contained null interfaceeditview interface graph view interface graph view ifdef debug cout deleting interface graph view get typed tag endl endif interfacegraphview interfacegraphview interfacegraphview gettypedtag void interface graph view detach node graph view impl detach typed contained null interfacegraphview nodegraphviewimpl typed_contained_ int interface graph view number of sections const precondition typed contained int i 1 if typed contained methods size 0 i return i interfacegraphview numberofsections typed_contained_ typed_contained_ void interface graph view get section int n vector string s const if n 0 s clear s push back typed contained get objid s push back interface else if n 1 typed contained methods size 0 s clear for vector method iterator i typed contained methods begin i typed contained methods end i s push back i to string interfacegraphview getsection push_back typed_contained_ getobjid push_back typed_contained_ typed_contained_ typed_contained_ push_back tostring tkw assoc rep sel flag false tkwassocrep selflag void tkw assoc rep visible bool vis true int i iterator bool t vis is visible line visible vis if t vis vis return if vis line raise line del tag both inactive if is selected line add tag selected line set fill red for i 0 i 4 i text i visible true text i raise line get text i del tag inactive else line lower line add tag both inactive if is selected line del tag selected for i 0 i 4 i text i visible false text i lower text i add tag inactive tkwassocrep tvis isvisible tvis deltagboth isselected addtag setfill deltag addtagboth isselected deltag addtag bool is visible const return line is visible isvisible isvisible void tkw assoc rep select bool sel true precondition is visible if is selected sel return if sel line set fill red line add tag selected else line set fill black line del tag selected sel flag sel tkwassocrep isvisible isselected setfill addtag setfill deltag selflag bool is selected const return sel flag isselected selflag bool input streamer read string vector const char id vector string in in clear size t i string temp is i is get flush newline if is fail return false while i getline is temp if is fail return false in push back temp return is fail inputstreamer readstringvector size_t is_ is_ is_ is_ is_ push_back is_ bool input streamer read type const char id int index string temp getline is temp find type index document manager current add type temp return is fail inputstreamer readtype is_ documentmanager addtype is_ bool input streamer read coords const char id double cx double cy is cx cy is get flush newline return is fail inputstreamer readcoords is_ is_ is_ bool input streamer read tag pair const char id string tag1 string tag2 is tag1 tag2 is get flush newline return is fail inputstreamer readtagpair is_ is_ is_ bool input streamer read int const char id int i is i is get flush newline return is fail inputstreamer readint is_ is_ is_ bool input streamer read int pair const char id int in1 int in2 is in1 in2 is get return is fail inputstreamer readintpair is_ is_ is_ bool input streamer read string const char id string in getline is in return is fail inputstreamer readstring is_ is_ bool input streamer read string pair const char id string in1 string in2 return read tag pair id in1 in2 inputstreamer readstringpair readtagpair bool input streamer read attributes const char id vector attribute attr attr clear size t i is i is get if is fail return false while i attribute a attr push back a if attr back read is return false return is fail inputstreamer readattributes size_t is_ is_ is_ push_back is_ is_ bool input streamer read methods const char id vector method meth meth clear size t i is i is get if is fail return false while i method m meth push back m if meth back read is return false return is fail inputstreamer readmethods size_t is_ is_ is_ push_back is_ is_ bool input streamer read tag const char id string in return read string id in inputstreamer readtag readstring bool output streamer write string vector const char id const vector string out os out size endl vector string const iterator i for i out begin i out end i os i endl return os fail outputstreamer writestringvector os_ const_iterator os_ os_ bool output streamer write type const char id int index os document manager current get type index endl return os fail outputstreamer writetype os_ documentmanager gettype os_ bool output streamer write coords const char id double cx double cy os cx cy endl return os fail outputstreamer writecoords os_ os_ const string tag2 os tag1 tag2 endl return os fail os_ os_ bool output streamer write int const char id int out os out endl return os fail outputstreamer writeint os_ os_ bool output streamer write int pair const char id int out1 int out2 os out1 out2 endl return os fail outputstreamer writeintpair os_ os_ bool output streamer write string const char id const string out os out endl return os fail outputstreamer writestring os_ os_ const string out2 return write tag pair id out1 out2 writetagpair const vector attribute attr os attr size endl vector attribute const iterator i for i attr begin i attr end i i write os return os fail os_ const_iterator os_ os_ const vector method meth os meth size endl vector method const iterator i for i meth begin i meth end i i write os return os fail os_ const_iterator os_ os_ bool output streamer write tag const char id const string out return write string id out outputstreamer writetag writestring node impl oid node0 org node1 org original org precondition org nodeimpl bool edge impl attach to node int id node n precondition id 0 node back ptr operate if id 0 operate node0 else if id 1 operate node1 else return false make sure we don t clobber ourselves bool noclobber false if operate operate ref operate detach edge original noclobber true operate n if n n attach edge operate if noclobber operate deref return true edgeimpl attachtonode nodebackptr detachedge attachedge node edge impl get node int id const precondition id 0 if id 0 return node0 else if id 1 return node1 else return null edgeimpl getnode int edge impl get slot node n const if n node0 return 0 else if n node1 return 1 else return 1 edgeimpl getslot virtual string get objid const return edgei get objid getobjid getobjid virtual void set objid const string s edgei set objid s setobjid setobjid virtual bool attach edge edge ptr e return edgei attach edge e attachedge edgeptr attachedge virtual bool detach edge edge e return edgei detach edge e detachedge detachedge virtual edge iterator iterate return edgei iterate edgeiterator virtual bool attach to node int s node n return edgei attach to node s n attachtonode attachtonode virtual node get node int s const return edgei get node s getnode getnode virtual int get slot node n const return edgei get slot n getslot getslot virtual bool attach view view base ptr v return subji attach view v attachview viewbaseptr attachview virtual bool detach view view base v return subji detach view v detachview viewbase detachview virtual void notify subji notify bool operator node coll edge parent coll detach edge parent return true detachedge node impl oid node0 org original org precondition org nodeimpl bool edge1 impl attach to node int id node n precondition id 0 node back ptr operate if id 0 operate node0 else return false bool noclobber false if operate operate ref operate detach edge original noclobber true operate n if n n attach edge operate if noclobber operate deref return true edge1impl attachtonode nodebackptr detachedge attachedge node edge1 impl get node int id const precondition id 0 if id 0 return node0 else return null edge1impl getnode int edge1 impl get slot node n const if n node0 return 0 else return 1 edge1impl getslot virtual string get objid const return edgei get objid getobjid getobjid virtual void set objid const string s edgei set objid s setobjid setobjid virtual bool attach edge edge ptr e return edgei attach edge e attachedge edgeptr attachedge virtual bool detach edge edge e return edgei detach edge e detachedge detachedge virtual edge iterator iterate return edgei iterate edgeiterator virtual bool attach to node int s node n return edgei attach to node s n attachtonode attachtonode virtual node get node int s const return edgei get node s getnode getnode virtual int get slot node n const return edgei get slot n getslot getslot virtual bool attach view view base ptr v return subji attach view v attachview viewbaseptr attachview virtual bool detach view view base v return subji detach view v detachview viewbase detachview virtual void notify subji notify string mult1 return mult1 mult1_ string mult2 return mult2 mult2_ vector string role1 return role1 role1_ vector string role2 return role2 role2_ int arrow1 return arrow1 arrow1_ int arrow2 return arrow2 arrow2_ string relationship return relationship relationship_ int assoc subject get classid const return id assoc assocsubject getclassid id_assoc edit view assoc subject new edit view return new assoc edit view this editview assocsubject neweditview assoceditview edge graph view assoc subject new graph view tag tag return new assoc graph view tag this edgegraphview assocsubject newgraphview assocgraphview bool assoc subject read istream is input streamer stream is if stream read string multiplicity1 mult1 stream read string multiplicity2 mult2 stream read string vector role1 role1 stream read string vector role2 role2 stream read int pair arrows arrow1 arrow2 stream read string relationship relationship return false return true assocsubject inputstreamer readstring mult1_ readstring mult2_ readstringvector role1_ readstringvector role2_ readintpair arrow1_ arrow2_ readstring relationship_ bool assoc subject write ostream os output streamer stream os if stream write string multiplicity1 mult1 stream write string multiplicity2 mult2 stream write string vector role1 role1 stream write string vector role2 role2 stream write int pair arrows arrow1 arrow2 stream write string relationship relationship return false return true assocsubject outputstreamer writestring mult1_ writestring mult2_ writestringvector role1_ writestringvector role2_ writeintpair arrow1_ arrow2_ writestring relationship_ assoc edit view assoc edit view assoc subject s precondition s contained s assoceditview assoceditview assocsubject assoc edit view assoc edit view nothing for now assoceditview assoceditview bool assoc edit view edit precondition contained contained get node 0 contained get node 1 node end1 contained get node 0 node end2 contained get node 1 assoc edit dialog d end1 get objid end2 get objid d set mult contained mult1 contained mult2 d set role contained role1 contained role2 d set arrow contained arrow1 contained arrow2 d set rel contained relationship if d run return false vector string reverse iterator range end for range end contained role1 rbegin range end contained role1 rend range end if range end length break contained role1 erase range end base contained role1 end for range end contained role2 rbegin range end contained role2 rend range end if range end length break contained role2 erase range end base contained role2 end contained notify return true assoceditview getnode getnode getnode getnode assoceditdialog getobjid getobjid setmult setrole setarrow setrel reverse_iterator rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend edit view state assoc edit view new state precondition contained return new assoc edit view state contained editview assoceditview newstate assoceditview void assoc edit view update for now nothing could implement something later assoceditview void assoc edit view detach contained null assoceditview assoc graph view assoc graph view ifdef debug cout deleting assoc graph view get typed tag endl endif assocgraphview assocgraphview assocgraphview gettypedtag void assoc graph view detach typed contained null assocgraphview typed_contained_ string text const size t j text erase switch p case ll text typed contained mult1 break case ul text typed contained mult2 break case lr for size t i 0 i typed contained role1 size i text typed contained role1 i text n if j text find last not of n string npos text resize j 1 break case ur for size t i 0 i typed contained role2 size i text typed contained role2 i text n if j text find last not of n string npos text resize j 1 break case ml text typed contained relationship break default return false return true size_t typed_contained_ typed_contained_ size_t typed_contained_ typed_contained_ find_last_not_of size_t typed_contained_ typed_contained_ find_last_not_of typed_contained_ line interface arrow state two const if typed contained arrow1 one full else one none if typed contained arrow2 two full else two none line_interface arrow_state typed_contained_ typed_contained_ double arrowwidth const neck2tip 12 points2tip 12 arrowwidth 5 line interface stipple type stipple const dsh solid stipple none line_interface stipple_type double x2 double y2 anchor side s2 lineseg1 reset x1 y1 s1 lineseg2 reset x2 y2 s2 lineseg1 join lineseg2 lineseg2 join lineseg1 lineseg1_ lineseg2_ lineseg1_ lineseg2_ lineseg2_ lineseg1_ double y const two straight lines double total lineseg1 length lineseg2 length double threshold lineseg1 length total if lineseg1 straight simple angle calculated directly through relative line segment length if fraction threshold if line segment is vertical lineseg1 s x lineseg1 xorg y lineseg1 yorg lineseg1 yend lineseg1 yorg fraction threshold return anchor horiz attached horizontally else x lineseg1 xorg lineseg1 xend lineseg1 xorg fraction threshold y lineseg1 yorg return anchor vert attach vertically else if line segment is vertical lineseg2 s x lineseg2 xorg y lineseg2 yorg lineseg2 yend lineseg2 yorg 1 0 fraction 1 0 threshold return anchor horiz else x lineseg2 xorg lineseg2 xend lineseg2 xorg 1 0 fraction 1 0 threshold y lineseg2 yorg return anchor vert two non straight lines else this is less tricky than one might think because in this case the two lines are mirror images of one another they have to be given the algorithm total lineseg1 length both lines are same length if fraction 0 5 fraction fraction 2 0 if line segment is vertical lineseg1 s threshold fabs lineseg1 ymid lineseg1 yorg total if fraction threshold middle segment y lineseg1 ymid x lineseg1 xorg lineseg1 xend lineseg1 xorg fraction threshold 1 0 threshold return anchor vert else x lineseg1 xorg y lineseg1 yorg lineseg1 yend lineseg1 yorg fraction threshold return anchor horiz else threshold fabs lineseg1 xmid lineseg1 xorg total if fraction threshold real segment y lineseg1 yorg x lineseg1 xorg lineseg1 xend lineseg1 xorg fraction threshold return anchor vert else middle segment x lineseg1 xmid y lineseg1 yorg lineseg1 yend lineseg1 yorg fraction threshold 1 0 threshold return anchor horiz else fraction 1 fraction 2 0 if line segment is vertical lineseg2 s threshold fabs lineseg2 ymid lineseg2 yorg total if fraction threshold middle segment y lineseg2 ymid x lineseg2 xmid lineseg2 xend lineseg2 xmid fraction threshold 1 0 threshold return anchor vert else x lineseg2 xorg y lineseg2 yorg lineseg2 ymid lineseg2 yorg fraction threshold return anchor horiz else threshold fabs lineseg2 xmid lineseg2 xorg total if fraction threshold real segment y lineseg2 yorg x lineseg2 xmid lineseg2 xend lineseg2 xmid fraction threshold return anchor vert else middle segment x lineseg2 xmid y lineseg2 yorg lineseg2 yend lineseg2 yorg fraction threshold 1 0 threshold return anchor horiz lineseg1_ lineseg2_ lineseg1_ lineseg1_ linesegment isvertical lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ linesegment isvertical lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg1_ linesegment isvertical lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ linesegment isvertical lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ double broken line strategy location double x double y const strategy test all 3 line segments find which has least distance set anchor there double d1 f1 l1 d2 f2 l2 d3 f3 l3 total total lineseg1 length lineseg2 length if lineseg1 straight two segments fraction of line lineseg1 xorg lineseg1 yorg lineseg1 xend lineseg1 yend x y d1 f1 fraction of line lineseg2 xend lineseg2 yend lineseg2 xorg lineseg2 yorg x y d2 f2 l1 distance lineseg1 xorg lineseg1 yorg lineseg1 xend lineseg1 yend l2 distance lineseg2 xend lineseg2 yend lineseg2 xorg lineseg2 yorg if d1 d2 return f1 l1 total else must calculate according to other end f3 f2 l2 total l1 total if f3 1 0 return 1 0 return f3 else fraction of line lineseg1 xorg lineseg1 yorg lineseg1 xmid lineseg1 ymid x y d1 f1 fraction of line lineseg1 xmid lineseg1 ymid lineseg2 xmid lineseg2 ymid x y d2 f2 fraction of line lineseg2 xmid lineseg2 ymid lineseg2 xorg lineseg2 yorg x y d3 f3 l1 distance lineseg1 xorg lineseg1 yorg lineseg1 xmid lineseg1 ymid l2 distance lineseg1 xmid lineseg1 ymid lineseg2 xmid lineseg2 ymid l3 distance lineseg2 xmid lineseg2 ymid lineseg2 xorg lineseg2 yorg if d1 d2 if d1 d3 first segment return f1 l1 total else third segment return f3 l3 total l1 total l2 total else if d2 d3 return f2 l2 total l1 total else return f3 l3 total l1 total l2 total broken_line_strategy lineseg1_ lineseg2_ lineseg1_ fraction_of_line lineseg1_ lineseg1_ lineseg1_ lineseg1_ fraction_of_line lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ fraction_of_line lineseg1_ lineseg1_ lineseg1_ lineseg1_ fraction_of_line lineseg1_ lineseg1_ lineseg2_ lineseg2_ fraction_of_line lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg1_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ lineseg2_ double y const double x1 y1 int side tkw text anchor just tkw text nw switch p case line interface ll case line interface lr side lineseg1 s x1 lineseg1 xorg y1 lineseg1 yorg break case line interface ul case line interface ur side lineseg2 s x1 lineseg2 xorg y1 lineseg2 yorg break default find larger segment stick in middle if location 0 5 x1 y1 anchor vert side 1 else side 0 switch p case line interface ll case line interface ul just just15 side x x1 offsetx15 side y y1 offsety15 side break case line interface lr case line interface ur just just26 side x x1 offsetx26 side y y1 offsety26 side break case line interface ml just just3 side x x1 offsetx3 side y y1 offsety3 side break case line interface mr just just4 side x x1 offsetx4 side y y1 offsety4 side break default assert false return just tkwtext tkwtext line_interface line_interface lineseg1_ lineseg1_ lineseg1_ line_interface line_interface lineseg2_ lineseg2_ lineseg2_ line_interface line_interface line_interface line_interface line_interface line_interface vector double yresult const xresult clear yresult clear xresult push back lineseg1 xorg yresult push back lineseg1 yorg xresult push back lineseg1 xmid yresult push back lineseg1 ymid if lineseg1 straight xresult push back lineseg2 xmid yresult push back lineseg2 ymid xresult push back lineseg2 xorg yresult push back lineseg2 yorg push_back lineseg1_ push_back lineseg1_ push_back lineseg1_ push_back lineseg1_ lineseg1_ push_back lineseg2_ push_back lineseg2_ push_back lineseg2_ push_back lineseg2_ double y2 const precondition which 0 which 1 int costheta sintheta const line segment ls if which ls lineseg1 else ls lineseg2 if line segment is vertical ls s costheta 0 if ls ymid ls yorg sintheta 1 else sintheta 1 else if ls xmid ls xorg costheta 1 else costheta 1 sintheta 0 x1 ls xorg costheta arrowlen 4 0 y1 ls yorg sintheta arrowlen 4 0 x2 ls xorg costheta 4 0 y2 ls yorg sintheta 4 0 linesegment lineseg1_ lineseg2_ linesegment isvertical anchor side s2 x1 x1 x2 x2 y1 y1 y2 y2 s1 s1 s2 s2 double dx x2 x1 double dy y2 y1 theta atan2 dy dx length sqrt dx dx dy dy if fabs dx fabs dy horiz anchor vert else horiz anchor horiz x1_ x2_ y1_ y2_ s1_ s2_ x2_ x1_ y2_ y1_ theta_ length_ horiz_ horiz_ double y const figure out where we are on the line using a bit of trigonometry double pos fraction length double dx cos theta pos double dy sin theta pos make absolute x x1 dx y y1 dy return horiz length_ theta_ theta_ x1_ y1_ horiz_ double straight line strategy location double x double y const double frac dist fraction of line x1 y1 x2 y2 x y dist frac return frac straight_line_strategy fraction_of_line x1_ y1_ x2_ y2_ double y const double x1 y1 int side tkw text anchor just tkw text ne squelch warning switch p case line interface ll case line interface lr side s1 x1 x1 y1 y1 break case line interface ul case line interface ur side s2 x1 x2 y1 y2 break default x1 x1 x2 2 0 y1 y1 y2 2 0 if fabs x1 x2 fabs y1 y2 side 1 else side 0 switch p case line interface ll case line interface ul just just15 side x x1 offsetx15 side y y1 offsety15 side break case line interface lr case line interface ur just just26 side x x1 offsetx26 side y y1 offsety26 side break case line interface ml just just3 side x x1 offsetx3 side y y1 offsety3 side break case line interface mr just just4 side x x1 offsetx4 side y y1 offsety4 side break default assert false return just tkwtext tkwtext line_interface line_interface s1_ x1_ y1_ line_interface line_interface s2_ x2_ y2_ x1_ x2_ y1_ y2_ x1_ x2_ y1_ y2_ line_interface line_interface line_interface line_interface line_interface line_interface vector double yresult const xresult clear yresult clear xresult push back x1 yresult push back y1 xresult push back x2 yresult push back y2 push_back x1_ push_back y1_ push_back x2_ push_back y2_ double y2 const precondition which 0 which 1 if which x1 x1 cos theta arrowlen 4 0 y1 y1 sin theta arrowlen 4 0 x2 x1 cos theta 4 0 y2 y1 sin theta 4 0 else x1 x2 cos theta arrowlen 2 0 y1 y2 sin theta arrowlen 2 0 x2 x2 cos theta 4 0 y2 y2 sin theta 4 0 x1_ theta_ y1_ theta_ x1_ theta_ y1_ theta_ x2_ theta_ y2_ theta_ x2_ theta_ y2_ theta_ virtual string get objid const if get node 0 string temp get node 0 get objid temp temp contents temp return temp else return edge1 subject impl get objid getobjid getnode getnode getobjid contents_ edge1subjectimpl getobjid string contents return contents contents_ int qual assoc subject get classid const return id qualassoc qualassocsubject getclassid id_qualassoc edit view qual assoc subject new edit view return new qual assoc edit view this editview qualassocsubject neweditview qualassoceditview edge graph view qual assoc subject new graph view tag tag return new qual assoc graph view tag this edgegraphview qualassocsubject newgraphview qualassocgraphview bool qual assoc subject read istream is input streamer stream is return stream read string contents contents qualassocsubject inputstreamer readstring contents_ bool qual assoc subject write ostream os output streamer stream os return stream write string contents contents qualassocsubject outputstreamer writestring contents_ void anchored multi box impl visible bool vis if vis is visible return if vis release anchor multi box visible vis anchoredmultiboximpl isvisible releaseanchor multi_box_ void anchored multi box impl select bool sel if sel is selected return multi box select sel if sel grab anchor else release anchor anchoredmultiboximpl isselected multi_box_ grabanchor releaseanchor void anchored multi box impl create anchor anch const string tag precondition anch anch anch figure out position double x y find location x y multi box create x y tag anchoredmultiboximpl anch_ findlocation multi_box_ void anchored multi box impl redraw if is visible return double x y find location x y multi box set position x y multi box redraw update anchor if current line this release anchor grab anchor anchoredmultiboximpl isvisible findlocation multi_box_ setposition multi_box_ current_line_ releaseanchor grabanchor bool anchored multi box impl is selected const return multi box is selected anchoredmultiboximpl isselected multi_box_ isselected bool anchored multi box impl is visible const return multi box is visible anchoredmultiboximpl isvisible multi_box_ isvisible void anchored multi box impl find size double sx double sy const multi box find size sx sy anchoredmultiboximpl findsize multi_box_ findsize double y const return multi box location angle x y multi_box_ double anchored multi box impl location double x double y const return multi box location x y anchoredmultiboximpl multi_box_ void anchored multi box impl get position double x double y const multi box get position x y anchoredmultiboximpl getposition multi_box_ getposition void anchored multi box impl reset anchor anch precondition anch anch anch note we don t reset position this simply reseats the anchor to reset position call redraw this matches the line semantics anchoredmultiboximpl anch_ void anchored multi box impl find location double x double y const precondition anch double sx sy anchor side s s anch get position x y multi box find size sx sy switch s case anchor right case anchor horiz x sx 2 0 break case anchor left x sx 2 0 break case anchor top case anchor vert y sy 2 0 break case anchor bottom y sy 2 0 break that s all folks anchoredmultiboximpl findlocation anch_ anch_ getposition multi_box_ findsize tkw anchored multi box impl tkw anchored multi box impl release anchor tkwanchoredmultiboximpl tkwanchoredmultiboximpl releaseanchor void tkw anchored multi box impl create anchor anch const string tag precondition anch anchored multi box impl create anch tag tk multi box get base del tag block tk multi box get base add tag link tkwanchoredmultiboximpl anchoredmultiboximpl tk_multi_box_ getbase deltag tk_multi_box_ getbase addtag void tkw anchored multi box impl grab anchor if current line this return anchored multi box impl grab anchor anchor impl grab anchor anch null tkwanchoredmultiboximpl grabanchor current_line_ anchoredmultiboximpl grabanchor anchor_impl_ grabanchor anch_ void tkw anchored multi box impl release anchor if current line this return anchor impl release anchor current line null tkwanchoredmultiboximpl releaseanchor current_line_ anchor_impl_ releaseanchor current_line_ qual assoc edit view qual assoc edit view qual assoc subject s precondition s contained s qualassoceditview qualassoceditview qualassocsubject qual assoc edit view qual assoc edit view nothing for now qualassoceditview qualassoceditview bool qual assoc edit view edit precondition contained contained get node 0 qual assoc edit dialog d d set contents contained contents if d run return false return true qualassoceditview getnode qualassoceditdialog setcontents edit view state qual assoc edit view new state precondition contained return new qual assoc edit view state contained editview qualassoceditview newstate qualassoceditview void qual assoc edit view update for now nothing could implement something later qualassoceditview void qual assoc edit view detach contained null qualassoceditview update lock false precondition contained contained attach view contained update_lock_ attachview qual assoc graph view qual assoc graph view ifdef debug cout deleting qual assoc graph view get typed tag endl endif if end1 delete end1 for each anchors begin anchors end anchor detach delete rep qualassocgraphview qualassocgraphview qualassocgraphview gettypedtag for_each anchor_detach string qual assoc graph view get typed tag const return link tag man tag to string get tag qualassocgraphview gettypedtag linktagman tagtostring gettag void qual assoc graph view create rep precondition contained end1 rep rep create end1 get typed tag qualassocgraphview createrep gettypedtag void qual assoc graph view visible bool v precondition contained rep visible v update edges anchor collection iterator i remove if anchors begin anchors end edge visible v anchors erase i anchors end qualassocgraphview anchorcollection remove_if edge_visible bool qual assoc graph view is visible const precondition contained return rep is visible qualassocgraphview isvisible isvisible void qual assoc graph view select bool s precondition contained rep select s qualassocgraphview bool qual assoc graph view is selected const precondition contained return rep is selected qualassocgraphview isselected isselected bool qual assoc graph view read istream is precondition contained if contained read is return false input streamer stream is string tag1 if stream read tag endtag tag1 return false graph view block1 document manager current find object tag1 if block1 return false prevent segfault attach to graph view 0 block1 null postcondition end1 read in anchors end1 read is return is fail qualassocgraphview inputstreamer readtag graphview documentmanager findobject attachtographview bool qual assoc graph view write ostream os if is visible return true don t write if deleted assert contained end1 if contained write os return false output streamer stream os if stream write tag endtag end1 get view get typed tag return false end1 write os return os fail qualassocgraphview isvisible outputstreamer writetag getview gettypedtag void qual assoc graph view get position double x double y const rep get position x y qualassocgraphview getposition getposition anchor qual assoc graph view new anchor graph view g edge graph view e precondition e anchor a new node anchor this g e assert a anchors push back a return a qualassocgraphview newanchor graphview edgegraphview nodeanchor push_back void qual assoc graph view get anchored position double x double y const double f rev location x y location f x y qualassocgraphview getanchoredposition rev_location bool qual assoc graph view is attach allowed graph view gv if update lock gv this cycle detected return false update lock true bool retval true if end1 get view is attach allowed gv retval false update lock false return retval qualassocgraphview isattachallowed graphview update_lock_ update_lock_ getview isattachallowed update_lock_ bool qual assoc graph view is edge attach allowed graph view gv int slot if gv this return false return gv is attach allowed this qualassocgraphview isedgeattachallowed graphview isattachallowed virtual node get node return contained getnode virtual edge get edge return contained getedge graph view other precondition slot 0 if end1 delete end1 end1 view new anchor other this update model contained attach to node slot view get node update rep rep reset end1 return true graphview newanchor attachtonode getnode anchor qual assoc graph view get anchor int slot precondition slot 0 slot 1 return end1 qualassocgraphview getanchor void qual assoc graph view update precondition contained end1 if is visible return if update lock update lock true rep redraw anchor collection iterator i remove if anchors begin anchors end edge update anchors erase i anchors end update lock false ifdef debug else cout update lock hit endl endif qualassocgraphview isvisible update_lock_ update_lock_ anchorcollection remove_if edge_update update_lock_ void qual assoc graph view detach contained null qualassocgraphview virtual edit view new edit view precondition contained return contained new edit view editview neweditview neweditview virtual void notify precondition contained contained notify void qual assoc graph view remove anchor ptr anchor collection iterator i i find anchors begin anchors end ptr if i anchors end i null qualassocgraphview anchorcollection graph view qual assoc graph view get view return this graphview qualassocgraphview getview double y const return rep location angle x y double qual assoc graph view rev location double x double y const return rep location x y qualassocgraphview rev_location int qual assoc graph view number of sections const return 1 qualassocgraphview numberofsections void qual assoc graph view get section int n vector string s const s clear s push back contained contents qualassocgraphview getsection push_back result type operator argument type a return a length 0 result_type argument_type bool operator const string a return a length 0 result type operator argument type a return a length 0 result_type argument_type int gener subject get classid const return id gener genersubject getclassid id_gener edit view gener subject new edit view return new gener edit view this editview genersubject neweditview genereditview edge graph view gener subject new graph view tag tag return new gener graph view tag this edgegraphview genersubject newgraphview genergraphview bool gener subject read istream is input streamer stream is int i if stream read int parent i return false firstisparent i 0 return is fail genersubject inputstreamer readint firstisparent_ bool gener subject write ostream os output streamer stream os return stream write int parent static cast int firstisparent genersubject outputstreamer writeint static_cast firstisparent_ contained g precondition contained contained attach view this attachview gener edit view gener edit view if contained contained detach view this contained destroy genereditview genereditview detachview bool gener edit view edit precondition contained contained get node 0 contained get node 1 gener edit dialog d contained get node 0 get objid contained get node 1 get objid d set flag contained first is parent if d run return false contained notify return true genereditview getnode getnode genereditdialog getnode getobjid getnode getobjid setflag firstisparent edit view state gener edit view new state precondition contained return new gener edit view state contained editview genereditview newstate genereditview void gener edit view update does nothing note if we make the dialog modeless someday we ll have to allow this however then it won t use edit rather building the view will create the dialog and killing the view will destroy it i don t think it s very easy to do in tk though bge 11 12 99 genereditview void gener edit view detach contained null genereditview gener graph view gener graph view ifdef debug cout deleting gener graph view get typed tag endl endif genergraphview genergraphview genergraphview gettypedtag void gener graph view detach edge graph view impl detach typed contained null genergraphview edgegraphviewimpl typed_contained_ string text const return false line interface arrow state two const if typed contained first is parent one clear two none else two clear one none line_interface arrow_state typed_contained_ firstisparent double arrowwidth const neck2tip 15 points2tip 15 arrowwidth 10 line interface stipple type stipple const dsh solid stipple none line_interface stipple_type void tkwd line impl create anchor one anchor two tag tag create diamond vector double x y for int i 0 i 4 i x push back 0 0 y push back 0 0 diamond create x y make line tkw line impl create one two tag diamond visible true complete creation of diamond diamond add tag link tag man tag to string tag ostrstream oss oss highlight object base get ends diamond bind enter oss str oss freeze 0 oss seekp 0 ios beg oss un highlight object base get ends diamond bind leave oss str oss freeze 0 diamond raise base get tkwdlineimpl push_back push_back diamond_ tkwlineimpl diamond_ diamond_ addtag linktagman tagtostring highlightobject base_ diamond_ unhighlightobject base_ diamond_ diamond_ base_ void tkwd line impl visible bool vis if vis is visible return tkw line impl visible vis if vis diamond visible true diamond raise diamond del tag inactive if filled diamond set fill white if is selected if filled diamond set fill red diamond set outline red else diamond visible false diamond lower diamond add tag inactive tkwdlineimpl isvisible tkwlineimpl diamond_ diamond_ diamond_ deltag filled_ diamond_ setfill isselected filled_ diamond_ setfill diamond_ setoutline diamond_ diamond_ diamond_ addtag void tkwd line impl select bool sel precondition is visible if is selected sel return tkw line impl select sel if sel if filled diamond set fill red diamond set outline red else if filled diamond set fill black else diamond set fill white diamond set outline black tkwdlineimpl isvisible isselected tkwlineimpl filled_ diamond_ setfill diamond_ setoutline filled_ diamond_ setfill diamond_ setfill diamond_ setoutline void tkwd line impl redraw tkw line impl redraw anchor side s double x y if which end s first get position x y else s second get position x y different sides give different results note not recommended to attach a diamond line to a line vector double px py point 0 origin px push back x py push back y set coordinates according to side switch s case anchor top case anchor vert we treat vertical as top point 1 right point px push back x diamond params 1 2 0 py push back y diamond params 0 2 0 point 2 far extremity px push back x py push back y diamond params 0 point 3 left point px push back x diamond params 1 2 0 py push back y diamond params 0 2 0 break case anchor bottom point 1 right point px push back x diamond params 1 2 0 py push back y diamond params 0 2 0 point 2 far extremity px push back x py push back y diamond params 0 point 3 left point px push back x diamond params 1 2 0 py push back y diamond params 0 2 0 break case anchor left case anchor horiz horizontal is treated as left point 1 bottom point px push back x diamond params 0 2 0 py push back y diamond params 1 2 0 point 2 extremity px push back x diamond params 0 py push back y point 3 top point px push back x diamond params 0 2 0 py push back y diamond params 1 2 0 break case anchor right point 1 bottom point px push back x diamond params 0 2 0 py push back y diamond params 1 2 0 point 2 extremity px push back x diamond params 0 py push back y point 3 top point px push back x diamond params 0 2 0 py push back y diamond params 1 2 0 break fix coordinates diamond set coords px py fix colors if filled if is selected diamond set fill red else diamond set fill black else diamond set fill white re raise diamond diamond raise base get tkwdlineimpl tkwlineimpl which_end_ first_ getposition second_ getposition push_back push_back push_back diamond_params_ push_back diamond_params_ push_back push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back diamond_params_ push_back push_back diamond_params_ push_back diamond_params_ diamond_ setcoords filled_ isselected diamond_ setfill diamond_ setfill diamond_ setfill diamond_ base_ void tkwd line impl update tkw line impl update which end ddata get diamond params filled diamond params 0 diamond params 1 tkwdlineimpl tkwlineimpl which_end_ ddata_ getdiamondparams filled_ diamond_params_ diamond_params_ int dependency subject get classid const return id dependency dependencysubject getclassid id_dependency edit view dependency subject new edit view return new dependency edit view this editview dependencysubject neweditview dependencyeditview edge graph view dependency subject new graph view tag tag return new dependency graph view tag this edgegraphview dependencysubject newgraphview dependencygraphview bool dependency subject read istream is input streamer stream is int i if stream read int arrowonfirst i return false arrowonfirst i 0 return is fail dependencysubject inputstreamer readint arrowonfirst_ bool dependency subject write ostream os output streamer stream os if stream write int arrowonfirst static cast int arrowonfirst return false return os fail dependencysubject outputstreamer writeint static_cast arrowonfirst_ contained g precondition contained dependency edit view dependency edit view dependencyeditview dependencyeditview bool dependency edit view edit precondition contained contained get node 0 contained get node 1 dependency edit dialog d contained get node 0 get objid contained get node 1 get objid d set flag contained arrow on first if d run return false contained notify return true dependencyeditview getnode getnode dependencyeditdialog getnode getobjid getnode getobjid setflag arrowonfirst edit view state dependency edit view new state precondition contained return new dependency edit view state contained editview dependencyeditview newstate dependencyeditview void dependency edit view update dependencyeditview void dependency edit view detach contained null dependencyeditview dependency graph view dependency graph view ifdef debug cout deleting dependency graph view get typed tag endl endif dependencygraphview dependencygraphview dependencygraphview gettypedtag void dependency graph view detach edge graph view impl detach typed contained null dependencygraphview edgegraphviewimpl typed_contained_ string text const return false line interface arrow state two const if typed contained arrow on first one full two none else two full one none line_interface arrow_state typed_contained_ arrowonfirst double arrowwidth const neck2tip 12 points2tip 12 arrowwidth 5 line interface stipple type stipple const dsh dash stipple gray50 line_interface stipple_type int constraint subject get classid const return id constraint constraintsubject getclassid id_constraint edit view constraint subject new edit view return new constraint edit view this editview constraintsubject neweditview constrainteditview edge graph view constraint subject new graph view tag tag return new constraint graph view tag this edgegraphview constraintsubject newgraphview constraintgraphview bool constraint subject read istream is input streamer stream is if stream read string constraint constraint stream read int arrowend arrowend return false return is fail constraintsubject inputstreamer readstring constraint_ readint arrowend_ bool constraint subject write ostream os output streamer stream os if stream write string constraint constraint stream write int arrowend arrowend return false return os fail constraintsubject outputstreamer writestring constraint_ writeint arrowend_ constraint edit view constraint edit view constraint subject s precondition s contained s constrainteditview constrainteditview constraintsubject constraint edit view constraint edit view nothing for now constrainteditview constrainteditview bool constraint edit view edit precondition contained contained get node 0 contained get node 1 node end1 contained get node 0 node end2 contained get node 1 constraint edit dialog d end1 get objid end2 get objid d set constraint contained constraint d set arrow contained arrow end if d run return false done return true constrainteditview getnode getnode getnode getnode constrainteditdialog getobjid getobjid setconstraint setarrow arrowend edit view state constraint edit view new state precondition contained return new constraint edit view state contained editview constrainteditview newstate constrainteditview void constraint edit view update for now nothing could implement something later constrainteditview void constraint edit view detach contained null constrainteditview constraint graph view constraint graph view debug ifdef debug cout deleting constraint graph view get typed tag endl endif constraintgraphview constraintgraphview constraintgraphview gettypedtag void constraint graph view detach edge graph view impl detach typed contained null constraintgraphview edgegraphviewimpl typed_contained_ string text const if p mr text typed contained constraint return true return false typed_contained_ line interface arrow state two const one none two none if typed contained arrow end 0x1 one full if typed contained arrow end 0x2 two full line_interface arrow_state typed_contained_ arrowend typed_contained_ arrowend double arrowwidth const neck2tip 12 points2tip 12 arrowwidth 5 line interface stipple type stipple const dsh dash stipple gray50 line_interface stipple_type int comment subject get classid const return id comment commentsubject getclassid id_comment edit view comment subject new edit view return new comment edit view this editview commentsubject neweditview commenteditview node graph view comment subject new graph view tag tag return new comment graph view tag this nodegraphview commentsubject newgraphview commentgraphview bool comment subject read istream is input streamer stream is if stream read string vector comment comment return false return is fail commentsubject inputstreamer readstringvector comment_ bool comment subject write ostream os output streamer stream os if stream write string vector comment comment return false return os fail commentsubject outputstreamer writestringvector comment_ contained c precondition contained contained_ contained_ bool comment edit view edit precondition contained comment edit dialog d d set comment contained comment if d run return false vector string reverse iterator range end for range end contained comment rbegin range end contained comment rend range end if range end length break contained comment erase range end base contained comment end return true commenteditview contained_ commenteditdialog setcomment contained_ reverse_iterator rangeend rangeend contained_ rangeend contained_ rangeend rangeend contained_ rangeend contained_ edit view state comment edit view new state precondition contained return new comment edit view state contained editview commenteditview newstate contained_ commenteditview contained_ void comment edit view detach contained null commenteditview contained_ comment graph view comment graph view ifdef debug cout deleting comment graph view get typed tag endl endif commentgraphview commentgraphview commentgraphview gettypedtag void comment graph view detach node graph view impl detach typed contained null commentgraphview nodegraphviewimpl typed_contained_ void comment graph view get section int n vector string s const precondition n 0 s clear copy typed contained comment begin typed contained comment end back inserter s commentgraphview getsection typed_contained_ typed_contained_ back_inserter void tkw comment box impl visible bool vis if vis is visible return nothing to do if vis base visible true base del tag inactive base raise base lower link base set fill white if is selected base add tag selected base set outline red mess with text and lines text lines visible true text lines del tag inactive text lines raise base get notch visible true notch del tag both inactive notch raise base get if is selected notch set fill red else base visible false base add tag inactive if is selected base del tag selected base lower mess with text and lines text lines visible false text lines add tag inactive text lines lower notch visible false notch add tag both inactive notch lower multi box impl visible vis tkwcommentboximpl isvisible base_ base_ deltag base_ base_ base_ setfill isselected base_ addtag base_ setoutline text_lines_ text_lines_ deltag text_lines_ base_ notch_ notch_ deltagboth notch_ base_ isselected notch_ setfill base_ base_ addtag isselected base_ deltag base_ text_lines_ text_lines_ addtag text_lines_ notch_ notch_ addtagboth notch_ multiboximpl void tkw comment box impl select bool sel precondition is visible if is selected sel return if sel base set outline red base set fill white base raise base lower link base add tag selected mess with text and lines text lines raise base get notch set fill red notch raise base get else base set outline black base set fill white base del tag selected mess with lines notch set fill black multi box impl select sel tkwcommentboximpl isvisible isselected base_ setoutline base_ setfill base_ base_ base_ addtag text_lines_ base_ notch_ setfill notch_ base_ base_ setoutline base_ setfill base_ deltag notch_ setfill multiboximpl void tkw comment box impl create double nx double ny const string tag cx nx cy ny vector double xvec yvec xvec push back 0 0 xvec push back 0 0 xvec push back 0 0 yvec push back 0 0 yvec push back 0 0 yvec push back 0 0 create base base create xvec yvec temporary position base lower link base add tag tag base add tag block bind for highlighting ostrstream oss oss highlight object base get ends string hstring oss str rew oss base bind enter hstring oss un highlight object base get ends string ustring oss str rew oss done with oss base bind leave ustring create base create elements text lines create 0 0 text lines set anchor tkw text nw text lines bind enter hstring text lines bind leave ustring text lines add tag tag notch create 0 0 0 0 notch bind enter hstring notch bind leave ustring notch add tag tag create elements mark us as visible even if it may not be the case multi box impl visible force redraw resize of everything redraw fix visibility flag multi box impl visible base is visible tkwcommentboximpl cx_ cy_ push_back push_back push_back push_back push_back push_back base_ base_ base_ addtag base_ addtag highlightobject base_ base_ unhighlightobject base_ base_ text_lines_ text_lines_ setanchor tkwtext text_lines_ text_lines_ text_lines_ addtag notch_ notch_ notch_ notch_ addtag multiboximpl multiboximpl base_ isvisible void tkw comment box impl redraw if is visible return if invisible don t bother update sanity check precondition sections size 1 double sx sy find size find size sx sy set base position double x1 cx sx 2 0 y1 cy sy 2 0 double x2 cx sx 2 0 y2 cy sy 2 0 double height vector double xvec yvec xvec push back x1 yvec push back y1 xvec push back x2 notch size yvec push back y1 xvec push back x2 yvec push back y1 notch size xvec push back x2 yvec push back y2 xvec push back x1 yvec push back y2 base set coords xvec yvec base set fill white set coordinates text for every section if section size 0 height height 0 0 text lines set text else text lines set text sections 0 set text position possibly dummy text lines set coords x1 x padding y1 y padding set notch position xvec clear yvec clear xvec push back x2 notch size yvec push back y1 xvec push back x2 notch size yvec push back y1 notch size xvec push back x2 yvec push back y1 notch size notch set coords xvec yvec tkwcommentboximpl isvisible sections_ findsize cx_ cy_ cx_ cy_ push_back push_back push_back notch_size push_back push_back push_back notch_size push_back push_back push_back push_back base_ setcoords base_ setfill sectionsize text_lines_ settext text_lines_ settext sections_ text_lines_ setcoords x_padding y_padding push_back notch_size push_back push_back notch_size push_back notch_size push_back push_back notch_size notch_ setcoords double y const double sx sy dx dy anchor side s find size sx sy s multi box impl location angle x y dx x cx dy y cy check if we re in one of the invalid positions if dy sy 2 0 dx sx 2 0 notch size x cx sx 2 0 notch size return anchor top else if dx sx 2 0 dy sy 2 0 notch size y cy sy 2 0 notch size return anchor right else return s findsize multiboximpl cx_ cy_ notch_size cx_ notch_size notch_size cy_ notch_size double tkw comment box impl location double x double y const this is a bit expensive but it should work double angle multi box impl location x y location angle x y note modifies x y return multi box impl location x y tkwcommentboximpl multiboximpl multiboximpl double y pad const line height tkw text get height min width minimum width notch size min height minimum height x pad x padding y pad y padding ypad lineheight tkwtext getheight minwidth minimum_width notch_size minheight minimum_height xpad x_padding ypad y_padding int tkw comment box impl text width const string s const return tkw text get width s notch size tkwcommentboximpl textwidth tkwtext getwidth notch_size int assoc class subject get classid const return id assocclass assocclasssubject getclassid id_assocclass edit view assoc class subject new edit view return new assoc class edit view this editview assocclasssubject neweditview assocclasseditview edge graph view assoc class subject new graph view tag tag return new assoc class graph view tag this edgegraphview assocclasssubject newgraphview assocclassgraphview bool assoc class subject read istream is return true assocclasssubject bool assoc class subject write ostream os return true assocclasssubject assoc class edit view assoc class edit view assoc class subject s precondition s contained s assocclasseditview assocclasseditview assocclasssubject assoc class edit view assoc class edit view nothing for now assocclasseditview assocclasseditview bool assoc class edit view edit nothing to do return true assocclasseditview edit view state assoc class edit view new state precondition contained return new assoc class edit view state contained editview assocclasseditview newstate assocclasseditview void assoc class edit view update for now nothing could implement something later assocclasseditview void assoc class edit view detach contained null assocclasseditview assoc class graph view assoc class graph view debug ifdef debug cout deleting assoc class graph view get typed tag endl endif assocclassgraphview assocclassgraphview assocclassgraphview gettypedtag void assoc class graph view detach edge graph view impl detach typed contained null assocclassgraphview edgegraphviewimpl typed_contained_ string text const return false no text line interface arrow state two const one none no arrow two none line_interface arrow_state double arrowwidth const neck2tip 0 points2tip 0 arrowwidth 0 line interface stipple type stipple const dsh dash stipple gray50 line_interface stipple_type string mult1 return mult1 mult1_ string mult2 return mult2 mult2_ vector string role1 return role1 role1_ vector string role2 return role2 role2_ string relationship return relationship relationship_ int look return look look of the line look_ int aggreg subject get classid const return id aggregation aggregsubject getclassid id_aggregation edit view aggreg subject new edit view return new aggreg edit view this editview aggregsubject neweditview aggregeditview edge graph view aggreg subject new graph view tag tag return new aggreg graph view tag this edgegraphview aggregsubject newgraphview aggreggraphview bool aggreg subject read istream is input streamer stream is if stream read string multiplicity1 mult1 stream read string multiplicity2 mult2 stream read string vector role1 role1 stream read string vector role2 role2 stream read int look look stream read string relationship relationship return false return is fail aggregsubject inputstreamer readstring mult1_ readstring mult2_ readstringvector role1_ readstringvector role2_ readint look_ readstring relationship_ bool aggreg subject write ostream os output streamer stream os if stream write string multiplicity1 mult1 stream write string multiplicity2 mult2 stream write string vector role1 role1 stream write string vector role2 role2 stream write int look look stream write string relationship relationship return false return os fail aggregsubject outputstreamer writestring mult1_ writestring mult2_ writestringvector role1_ writestringvector role2_ writeint look_ writestring relationship_ aggreg edit view aggreg edit view aggreg subject s precondition s contained s aggregeditview aggregeditview aggregsubject aggreg edit view aggreg edit view nothing for now aggregeditview aggregeditview bool aggreg edit view edit precondition contained contained get node 0 contained get node 1 node end1 contained get node 0 node end2 contained get node 1 aggreg edit dialog d end1 get objid end2 get objid d set mult contained mult1 contained mult2 d set role contained role1 contained role2 d set look contained look d set rel contained relationship if d run return false vector string reverse iterator range end for range end contained role1 rbegin range end contained role1 rend range end if range end length break contained role1 erase range end base contained role1 end for range end contained role2 rbegin range end contained role2 rend range end if range end length break contained role2 erase range end base contained role2 end contained notify return true aggregeditview getnode getnode getnode getnode aggregeditdialog getobjid getobjid setmult setrole setlook setrel reverse_iterator rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend rangeend edit view state aggreg edit view new state precondition contained return new aggreg edit view state contained editview aggregeditview newstate aggregeditview void aggreg edit view update for now nothing could implement something later aggregeditview void aggreg edit view detach contained null aggregeditview aggreg graph view aggreg graph view ifdef debug cout deleting aggreg graph view get typed tag endl endif aggreggraphview aggreggraphview aggreggraphview gettypedtag void aggreg graph view detach edge graph view impl detach typed contained null aggreggraphview edgegraphviewimpl typed_contained_ string text const size t j text erase switch p case ll text typed contained mult1 break case ul text typed contained mult2 break case lr for size t i 0 i typed contained role1 size i text typed contained role1 i text n if j text find last not of n string npos text resize j 1 break case ur for size t i 0 i typed contained role2 size i text typed contained role2 i text n if j text find last not of n string npos text resize j 1 break case ml text typed contained relationship break default return false return true size_t typed_contained_ typed_contained_ size_t typed_contained_ typed_contained_ find_last_not_of size_t typed_contained_ typed_contained_ find_last_not_of typed_contained_ line interface arrow state two const one full one two none if typed contained look 0x4 careful arrow is on reverse end of diamond if typed contained look 0x2 two full else one full line_interface arrow_state typed_contained_ typed_contained_ double arrowwidth const neck2tip 12 points2tip 12 arrowwidth 5 line interface stipple type stipple const dsh solid stipple none line_interface stipple_type double height const width 12 height 6 if typed contained look 0x1 filled true else filled false if typed contained look 0x2 return 0 else return 1 typed_contained_ typed_contained_ result type operator argument type e delete e return null result_type argument_type autoclear if commit li clear commit_ li_ void commit commit true commit_ tkw gener rep sel flag false tkwgenerrep selflag void tkw gener rep create double x1 double y1 double x2 double y2 tag tag precondition first is parent line create x1 y1 x2 y2 line add tag both link tag man tag to string tag line add tag link bind for highlighting ostrstream oss oss highlight object line get ends line bind both enter oss str oss freeze 0 oss seekp 0 ios beg oss un highlight object line get ends line bind both leave oss str oss freeze 0 if first is parent line set arrows tkw line first else line set arrows tkw line last line raise tkwgenerrep firstisparent addtagboth linktagman tagtostring addtag highlightobject bindboth unhighlightobject bindboth firstisparent setarrows tkwline setarrows tkwline void tkw gener rep set coords double x1 double y1 double x2 double y2 line set coords x1 y1 x2 y2 if first is parent line set arrows tkw line first else line set arrows tkw line last tkwgenerrep setcoords setcoords firstisparent setarrows tkwline setarrows tkwline void tkw gener rep visible bool vis true bool t vis is visible line visible vis if vis t vis return if vis line add tag both inactive if is selected line del tag selected line lower else line del tag both inactive if is selected line set fill red line add tag selected line raise tkwgenerrep tvis isvisible tvis addtagboth isselected deltag deltagboth isselected setfill addtag bool is visible return line is visible isvisible isvisible void tkw gener rep select bool sel true precondition is visible if sel is selected return if sel line set fill red line add tag selected else line set fill black line del tag selected sel flag sel tkwgenerrep isvisible isselected setfill addtag setfill deltag selflag bool is selected return sel flag isselected selflag tkw class rep sel flag false tkwclassrep selflag tkw class rep can not delete text lines since delete requires a pointer tkwclassrep textlines void tkw class rep create double nx double ny tag tag assert name attributes methods cx nx cy ny base create 0 0 0 0 temporary position base lower link base add tag block tag man tag to string tag base add tag block bind for highlighting ostrstream oss oss highlight object base get ends string hstring oss str rew oss base bind enter hstring oss un highlight object base get ends string ustring oss str oss freeze 0 base bind leave ustring for int i 0 i 3 i text lines i create 0 0 text lines i set anchor tkw text nw text lines i bind enter hstring text lines i bind leave ustring text lines i add tag block tag man tag to string tag adjust lines title sep create 0 0 0 0 title sep bind both enter hstring title sep bind both leave ustring rew oss title sep add tag both block tag man tag to string tag attr sep create 0 0 0 0 attr sep bind both enter hstring attr sep bind both leave ustring attr sep add tag both block tag man tag to string tag create text items and adjust title lines adjust text tkwclassrep addtag blocktagman tagtostring addtag highlightobject unhighlightobject textlines textlines setanchor tkwtext textlines textlines textlines addtag blocktagman tagtostring titlesep titlesep bindboth titlesep bindboth titlesep addtagboth blocktagman tagtostring attrsep attrsep bindboth attrsep bindboth attrsep addtagboth blocktagman tagtostring adjusttext void tkw class rep redraw if is visible return adjust text items lines adjust text tkwclassrep isvisible adjusttext void tkw class rep visible bool vis if vis is visible return if vis base visible true base del tag inactive base raise block title sep visible true title sep del tag both inactive title sep raise base get attr sep visible true attr sep del tag both inactive attr sep raise base get if is selected base add tag selected base set outline red title sep set fill red attr sep set fill red for int i 0 i 3 i text lines i visible true text lines i del tag inactive text lines i raise base get else base visible false base add tag inactive if is selected base del tag selected base lower title sep visible false title sep add tag both inactive title sep lower attr sep visible false attr sep add tag both inactive attr sep lower for int i 0 i 3 i text lines i visible false text lines i add tag inactive text lines i lower tkwclassrep isvisible deltag titlesep titlesep deltagboth titlesep attrsep attrsep deltagboth attrsep isselected addtag setoutline titlesep setfill attrsep setfill textlines textlines deltag textlines addtag isselected deltag titlesep titlesep addtagboth titlesep attrsep attrsep addtagboth attrsep textlines textlines addtag textlines void tkw class rep select bool sel precondition is visible if is selected sel return if sel base set outline red title sep set fill red attr sep set fill red base set fill white base raise block base add tag selected title sep raise base get attr sep raise base get for int i 0 i 3 i text lines i raise base get else base set outline black title sep set fill black attr sep set fill black base set fill white base del tag selected sel flag sel tkwclassrep isvisible isselected setoutline titlesep setfill attrsep setfill setfill addtag titlesep attrsep textlines setoutline titlesep setfill attrsep setfill setfill deltag selflag bool tkw class rep is visible const return base is visible tkwclassrep isvisible isvisible bool tkw class rep is selected const return sel flag tkwclassrep isselected selflag void tkw class rep find size double sx double sy double t1 t2 t3 if tkw text is fixed font find full size sx sy t1 t2 t3 false else find full size fast sx sy t1 t2 t3 false tkwclassrep findsize tkwtext isfixedfont findfullsize findfullsizefast void tkw class rep adjust text double sx sy title height attr height meth height if tkw text is fixed font find full size sx sy title height attr height meth height true else find full size fast sx sy title height attr height meth height true set base position double x1 cx sx 2 0 y1 cy sy 2 0 double x2 cx sx 2 0 y2 cy sy 2 0 base set coords x1 y1 x2 y2 set title s position text lines 0 set coords x1 x padding y1 y padding set attributes position text lines 1 set coords x1 x padding y1 title height y padding set methods position text lines 2 set coords x1 x padding y1 title height attr height y padding set title line position title sep set coords x1 y1 title height x2 y1 title height set attributes line position attr sep set coords x1 y1 title height attr height x2 y1 title height attr height tkwclassrep adjusttext titleheight attrheight methheight tkwtext isfixedfont findfullsize titleheight attrheight methheight findfullsizefast titleheight attrheight methheight setcoords textlines setcoords xpadding ypadding textlines setcoords xpadding titleheight ypadding textlines setcoords xpadding titleheight attrheight ypadding titlesep setcoords titleheight titleheight attrsep setcoords titleheight attrheight titleheight attrheight bool adjust int tempx string tempattr tempmeth sx min width tempx tkw text get width name if tempx sx sx tempx sy tkw text get height 2 y padding title height sy attr height 0 meth height 0 for vector string iterator i attributes begin i attributes end i tempx tkw text get width i if tempx sx sx tempx if adjust tempattr i tempattr n if attributes size 0 attr height tkw text get height attributes size 2 y padding sy attr height if adjust strip new line tempattr for vector string iterator i methods begin i methods end i tempx tkw text get width i if tempx sx sx tempx if adjust tempmeth i tempmeth n if methods size 0 meth height tkw text get height methods size 2 y padding sy meth height if adjust strip new line tempmeth sx 2 x padding if sx min width sx min width if sy min height sy min height if adjust text lines 0 set text name text lines 1 set text tempattr text lines 2 set text tempmeth minwidth tkwtext getwidth tkwtext getheight ypadding titleheight attrheight methheight tkwtext getwidth attrheight tkwtext getheight ypadding attrheight stripnewline tkwtext getwidth methheight tkwtext getheight ypadding methheight stripnewline xpadding minwidth minwidth minheight minheight textlines settext textlines settext textlines settext