Add filename to raster::Palette (this will be useful to know the original location of a palette)

This commit is contained in:
David Capello 2014-04-17 01:19:22 -03:00
parent 811a530013
commit 50a10a9056
2 changed files with 9 additions and 0 deletions

View File

@ -426,6 +426,9 @@ Palette* Palette::load(const char *filename)
pal = raster::file::load_gpl_file(filename); pal = raster::file::load_gpl_file(filename);
} }
if (pal)
pal->setFilename(filename);
return pal; return pal;
} }

View File

@ -67,6 +67,11 @@ namespace raster {
int size() const { return m_colors.size(); } int size() const { return m_colors.size(); }
void resize(int ncolors); void resize(int ncolors);
std::string getFilename() const { return m_filename; }
void setFilename(const std::string& filename) {
m_filename = filename;
}
int getModifications() const { return m_modifications; } int getModifications() const { return m_modifications; }
FrameNumber getFrame() const { return m_frame; } FrameNumber getFrame() const { return m_frame; }
@ -101,6 +106,7 @@ namespace raster {
FrameNumber m_frame; FrameNumber m_frame;
std::vector<color_t> m_colors; std::vector<color_t> m_colors;
int m_modifications; int m_modifications;
std::string m_filename; // If the palette is associated with a file.
}; };
} // namespace raster } // namespace raster