notepad_thumbnail.h

Go to the documentation of this file.
00001 #ifndef __NOTEPAD_THUMBNAIL_H__
00002 #define __NOTEPAD_THUMBNAIL_H__
00003 
00004 /**
00005  * File Name  : notepad_thumbnail.h
00006  *
00007  * Description: save thumbnail of coverpage of note for contentbrowser
00008  */
00009 
00010 /*
00011  * This file is part of notepad.
00012  *
00013  * notepad is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * notepad is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2010 IREX Technologies B.V.
00029  * All rights reserved.
00030  */
00031 
00032 #include <libermetadb/ermetadb.h>
00033 #include <gdk/gdk.h>
00034 #include "notepad_pages.h"
00035 #include "notepad_filestore.h"
00036 
00037 namespace notepad
00038 {
00039     class CThumbnail 
00040     {
00041         public:
00042             // Note: must be synchronised with table THUMBNAIL_COLUMNS[] in uds_mdb_manager.cpp.
00043             enum ThumbnailSize
00044             {
00045                 THUMBNAIL_MINI = 0, // not used
00046                 THUMBNAIL_SMALL,
00047                 THUMBNAIL_MEDIUM,
00048                 THUMBNAIL_LARGE, // not used
00049                 THUMBNAIL_COUNT
00050             };
00051 
00052         public: // lifecycle
00053             CThumbnail();
00054             CThumbnail(CFileStore& filestore, CNotepadPages& pagecache, gint margin) 
00055                 { storeThumbnail(filestore, pagecache, margin); };
00056             ~CThumbnail() {};
00057 
00058         private: // don'ts
00059             CThumbnail(const CThumbnail&);
00060             CThumbnail operator=(const CThumbnail&);
00061 
00062 
00063         //internals
00064         private:
00065             void        storeThumbnail(CFileStore& filestore, CNotepadPages& pagecache, gint margin);
00066             void        putPixel(GdkPixbuf* pb, gint x, gint y);
00067             void        enhance(GdkPixbuf* pb, gint width, gint height);
00068             void        drawRectangle(GdkPixbuf* pb, gint width, gint height);
00069             gint        getWidth(const ThumbnailSize size);
00070             gint        getHeight(const ThumbnailSize size);
00071 
00072     };
00073 }
00074 
00075 
00076 #endif // __NOTEPAD_THUMBNAIL_H__
Generated by  doxygen 1.6.2-20100208