X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fchanneldb.C;fp=cinelerra-5.0%2Fcinelerra%2Fchanneldb.C;h=0000000000000000000000000000000000000000;hb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;hp=b7c99f1ddbb6428a2c5c6ec943123ed00baff608;hpb=52fcc46226f9df46f9ce9d0566dc568455a7db0b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.0/cinelerra/channeldb.C b/cinelerra-5.0/cinelerra/channeldb.C deleted file mode 100644 index b7c99f1d..00000000 --- a/cinelerra-5.0/cinelerra/channeldb.C +++ /dev/null @@ -1,143 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "channel.h" -#include "channeldb.h" -#include "filesystem.h" -#include "filexml.h" -#include "preferences.inc" - - -#include - -ChannelDB::ChannelDB() -{ -} - -ChannelDB::~ChannelDB() -{ - channels.remove_all_objects(); -} - -char* ChannelDB::prefix_to_path(char *path, const char *filename) -{ - FileSystem fs; - char directory[BCTEXTLEN]; - sprintf(directory, BCASTDIR); - fs.complete_path(directory); - fs.join_names(path, directory, filename); - return path; -} - -void ChannelDB::load(const char *filename) -{ - if( !filename ) return; - - FileXML file; - char path[BCTEXTLEN]; - - prefix_to_path(path, filename); - channels.remove_all_objects(); - - int done = file.read_from_file(path, 1); - - channels.remove_all_objects(); -// Load channels - while(!done) - { - Channel *channel = new Channel; - if(!(done = channel->load(&file))) - channels.append(channel); - else - { - delete channel; - } - } -} - -void ChannelDB::save(const char *filename) -{ - if( !filename ) return; - char path[BCTEXTLEN]; - FileXML file; - - prefix_to_path(path, filename); - - if(channels.total) - { - for(int i = 0; i < channels.total; i++) - { -// Save channel here - channels.values[i]->save(&file); - } - file.terminate_string(); - file.write_to_file(path); - } -} - -Channel* ChannelDB::get(int number) -{ - if(number >= 0 && number < channels.total) - return channels.values[number]; - else - return 0; -} - -void ChannelDB::copy_from(ChannelDB *src) -{ - clear(); - for(int i = 0; i < src->size(); i++) - { - Channel *dst = new Channel; - channels.append(dst); - dst->copy_settings(src->get(i)); - } -} - -int ChannelDB::number_of(Channel *channel) -{ - return channels.number_of(channel); -} - -int ChannelDB::size() -{ - return channels.total; -} - -void ChannelDB::clear() -{ - channels.remove_all_objects(); -} - -void ChannelDB::append(Channel *channel) -{ - channels.append(channel); -} - -void ChannelDB::remove_number(int number) -{ - channels.remove_number(number); -} - -void ChannelDB::set(int number, Channel *ptr) -{ - channels.values[number] = ptr; -}