| 900 | } |
| 901 | |
| 902 | void |
| 903 | KnobGuiPath::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 | |
| 938 | void |
| 939 | KnobGuiPath::onTextEdited() |
nothing calls this directly
no test coverage detected