MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / tableChanged

Method tableChanged

Gui/KnobGuiFile.cpp:902–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902void
903KnobGuiPath::tableChanged(int row,
904 int col,
905 std::string* newEncodedValue)
906{
907 KnobTablePtr knob = std::dynamic_pointer_cast<KnobTable>( getKnob() );
908
909 assert(knob);
910
911 if ( knob->getHolder() && knob->getHolder()->isProject() &&
912 appPTR->getCurrentSettings()->isAutoFixRelativeFilePathEnabled() ) {
913 if (col == 0) {
914 std::list<std::vector<std::string> > oldTable, newTable;
915 knob->decodeFromKnobTableFormat(knob->getValue(), &oldTable);
916 knob->decodeFromKnobTableFormat(*newEncodedValue, &newTable);
917
918
919 ///Compare the 2 maps to find-out if a path has changed or just a name
920 if ( ( oldTable.size() == newTable.size() ) && ( row < (int)oldTable.size() ) ) {
921 std::list<std::vector<std::string> >::iterator itOld = oldTable.begin();
922 std::list<std::vector<std::string> >::iterator itNew = newTable.begin();
923 std::advance(itOld, row);
924 std::advance(itNew, row);
925
926
927 if ( (*itOld)[0] != (*itNew)[0] ) {
928 ///a name has changed
929 getGui()->getApp()->getProject()->fixPathName( (*itOld)[0], (*itNew)[0] );
930 } else if ( (*itOld)[1] != (*itNew)[1] ) {
931 getGui()->getApp()->getProject()->fixRelativeFilePaths( (*itOld)[0], (*itNew)[1], false );
932 }
933 }
934 }
935 }
936}
937
938void
939KnobGuiPath::onTextEdited()

Callers

nothing calls this directly

Calls 14

getGuiFunction · 0.85
getCurrentSettingsMethod · 0.80
fixPathNameMethod · 0.80
getProjectMethod · 0.80
fixRelativeFilePathsMethod · 0.80
getKnobFunction · 0.70
getHolderMethod · 0.45
isProjectMethod · 0.45
getValueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected