cppcheck fixes

This commit is contained in:
Ingo Weyrich 2019-08-08 13:41:14 +02:00
parent d765c06cf4
commit 4bf4b818c0
9 changed files with 103 additions and 129 deletions

View File

@ -228,12 +228,12 @@ void ImProcFunctions::dehaze(Imagefloat *img)
array2D<float> dark(W, H); array2D<float> dark(W, H);
int patchsize = max(int(5 / scale), 2); int patchsize = max(int(5 / scale), 2);
int npatches = 0;
float ambient[3]; float ambient[3];
array2D<float> &t_tilde = dark; array2D<float> &t_tilde = dark;
float max_t = 0.f; float max_t = 0.f;
{ {
int npatches = 0;
array2D<float> R(W, H); array2D<float> R(W, H);
array2D<float> G(W, H); array2D<float> G(W, H);
array2D<float> B(W, H); array2D<float> B(W, H);

View File

@ -356,24 +356,19 @@ void ImProcFunctions::workingtrc(const Imagefloat* src, Imagefloat* dst, int cw,
{ {
const TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile); const TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.workingProfile);
double dx = Color::D50x;
double dz = Color::D50z;
{
dx = dz = 1.0;
}
const float toxyz[3][3] = { const float toxyz[3][3] = {
{ {
static_cast<float>(wprof[0][0] / (dx * (normalizeIn ? 65535.0 : 1.0))), //I have suppressed / Color::D50x static_cast<float>(wprof[0][0] / ((normalizeIn ? 65535.0 : 1.0))), //I have suppressed / Color::D50x
static_cast<float>(wprof[0][1] / (dx * (normalizeIn ? 65535.0 : 1.0))), static_cast<float>(wprof[0][1] / ((normalizeIn ? 65535.0 : 1.0))),
static_cast<float>(wprof[0][2] / (dx * (normalizeIn ? 65535.0 : 1.0))) static_cast<float>(wprof[0][2] / ((normalizeIn ? 65535.0 : 1.0)))
}, { }, {
static_cast<float>(wprof[1][0] / (normalizeIn ? 65535.0 : 1.0)), static_cast<float>(wprof[1][0] / (normalizeIn ? 65535.0 : 1.0)),
static_cast<float>(wprof[1][1] / (normalizeIn ? 65535.0 : 1.0)), static_cast<float>(wprof[1][1] / (normalizeIn ? 65535.0 : 1.0)),
static_cast<float>(wprof[1][2] / (normalizeIn ? 65535.0 : 1.0)) static_cast<float>(wprof[1][2] / (normalizeIn ? 65535.0 : 1.0))
}, { }, {
static_cast<float>(wprof[2][0] / (dz * (normalizeIn ? 65535.0 : 1.0))), //I have suppressed / Color::D50z static_cast<float>(wprof[2][0] / ((normalizeIn ? 65535.0 : 1.0))), //I have suppressed / Color::D50z
static_cast<float>(wprof[2][1] / (dz * (normalizeIn ? 65535.0 : 1.0))), static_cast<float>(wprof[2][1] / ((normalizeIn ? 65535.0 : 1.0))),
static_cast<float>(wprof[2][2] / (dz * (normalizeIn ? 65535.0 : 1.0))) static_cast<float>(wprof[2][2] / ((normalizeIn ? 65535.0 : 1.0)))
} }
}; };

View File

@ -234,8 +234,6 @@ rtengine::LCPProfile::LCPProfile(const Glib::ustring& fname) :
pCurCommon(nullptr), pCurCommon(nullptr),
aPersModel{} aPersModel{}
{ {
const int BufferSize = 8192;
char buf[BufferSize];
XML_Parser parser = XML_ParserCreate(nullptr); XML_Parser parser = XML_ParserCreate(nullptr);
@ -250,6 +248,8 @@ rtengine::LCPProfile::LCPProfile(const Glib::ustring& fname) :
FILE* const pFile = g_fopen(fname.c_str (), "rb"); FILE* const pFile = g_fopen(fname.c_str (), "rb");
if (pFile) { if (pFile) {
constexpr int BufferSize = 8192;
char buf[BufferSize];
bool done; bool done;
do { do {
@ -362,9 +362,8 @@ void rtengine::LCPProfile::calcParams(
const float focDist = aPersModel[pm]->focDist; const float focDist = aPersModel[pm]->focDist;
const float focDistLog = std::log(focDist) + euler; const float focDistLog = std::log(focDist) + euler;
double meanErr = 0.0;
if (aPersModel[pm]->hasModeData(mode)) { if (aPersModel[pm]->hasModeData(mode)) {
double meanErr = 0.0;
double lowMeanErr = 0.0; double lowMeanErr = 0.0;
double highMeanErr = 0.0; double highMeanErr = 0.0;

View File

@ -261,10 +261,10 @@ bool ProfileStore::parseDir (Glib::ustring& realPath, Glib::ustring& virtualPath
return fileFound; return fileFound;
} }
int ProfileStore::findFolderId (const Glib::ustring &path) int ProfileStore::findFolderId (const Glib::ustring &path) const
{ {
// initialization must have been done when calling this // initialization must have been done when calling this
for (std::vector<Glib::ustring>::iterator i = folders.begin(); i != folders.end(); ++i) { for (std::vector<Glib::ustring>::const_iterator i = folders.begin(); i != folders.end(); ++i) {
if (*i == path) { if (*i == path) {
return i - folders.begin(); return i - folders.begin();
} }
@ -454,7 +454,7 @@ const PartialProfile* ProfileStore::getDefaultPartialProfile (bool isRaw)
return pProf; return pProf;
} }
const Glib::ustring ProfileStore::getPathFromId (int folderId) const Glib::ustring ProfileStore::getPathFromId (int folderId) const
{ {
// initialization must have been done when calling this // initialization must have been done when calling this
return folders.at (folderId); return folders.at (folderId);

View File

@ -185,7 +185,7 @@ public:
bool init (bool loadAll = true); bool init (bool loadAll = true);
void parseProfiles (); void parseProfiles ();
int findFolderId (const Glib::ustring &path); int findFolderId (const Glib::ustring &path) const;
const ProfileStoreEntry* findEntryFromFullPath (Glib::ustring path); const ProfileStoreEntry* findEntryFromFullPath (Glib::ustring path);
const rtengine::procparams::PartialProfile* getProfile (Glib::ustring path); const rtengine::procparams::PartialProfile* getProfile (Glib::ustring path);
const rtengine::procparams::PartialProfile* getProfile (const ProfileStoreEntry* entry); const rtengine::procparams::PartialProfile* getProfile (const ProfileStoreEntry* entry);
@ -193,13 +193,13 @@ public:
void releaseFileList (); void releaseFileList ();
const rtengine::procparams::ProcParams* getDefaultProcParams (bool isRaw); const rtengine::procparams::ProcParams* getDefaultProcParams (bool isRaw);
const rtengine::procparams::PartialProfile* getDefaultPartialProfile (bool isRaw); const rtengine::procparams::PartialProfile* getDefaultPartialProfile (bool isRaw);
const Glib::ustring getPathFromId (int folderId); const Glib::ustring getPathFromId (int folderId) const;
const ProfileStoreEntry* getInternalDefaultPSE() const ProfileStoreEntry* getInternalDefaultPSE() const
{ {
return internalDefaultEntry; return internalDefaultEntry;
} }
const ProfileStoreEntry* getInternalDynamicPSE() const ProfileStoreEntry* getInternalDynamicPSE() const
{ {
return internalDynamicEntry; return internalDynamicEntry;
} }

View File

@ -840,10 +840,10 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
} }
for (size_t i = 0; i < mselected.size(); i++) { for (size_t i = 0; i < mselected.size(); i++) {
rtengine::procparams::ProcParams pp = mselected[i]->thumbnail->getProcParams(); rtengine::procparams::ProcParams lpp = mselected[i]->thumbnail->getProcParams();
pp.raw.dark_frame = fc.get_filename(); lpp.raw.dark_frame = fc.get_filename();
pp.raw.df_autoselect = false; lpp.raw.df_autoselect = false;
mselected[i]->thumbnail->setProcParams(pp, nullptr, FILEBROWSER, false); mselected[i]->thumbnail->setProcParams(lpp, nullptr, FILEBROWSER, false);
} }
if (bppcl) { if (bppcl) {
@ -916,10 +916,10 @@ void FileBrowser::menuItemActivated (Gtk::MenuItem* m)
} }
for (size_t i = 0; i < mselected.size(); i++) { for (size_t i = 0; i < mselected.size(); i++) {
rtengine::procparams::ProcParams pp = mselected[i]->thumbnail->getProcParams(); rtengine::procparams::ProcParams lpp = mselected[i]->thumbnail->getProcParams();
pp.raw.ff_file = fc.get_filename(); lpp.raw.ff_file = fc.get_filename();
pp.raw.ff_AutoSelect = false; lpp.raw.ff_AutoSelect = false;
mselected[i]->thumbnail->setProcParams(pp, nullptr, FILEBROWSER, false); mselected[i]->thumbnail->setProcParams(lpp, nullptr, FILEBROWSER, false);
} }
if (bppcl) { if (bppcl) {
@ -1079,17 +1079,17 @@ void FileBrowser::partPasteProfile ()
bppcl->beginBatchPParamsChange(mselected.size()); bppcl->beginBatchPParamsChange(mselected.size());
} }
for (unsigned int i = 0; i < mselected.size(); i++) { for (auto entry : mselected) {
// copying read only clipboard PartialProfile to a temporary one, initialized to the thumb's ProcParams // copying read only clipboard PartialProfile to a temporary one, initialized to the thumb's ProcParams
mselected[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file entry->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile(); const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile();
rtengine::procparams::PartialProfile pastedPartProf(&mselected[i]->thumbnail->getProcParams (), nullptr); rtengine::procparams::PartialProfile pastedPartProf(&entry->thumbnail->getProcParams (), nullptr);
// pushing the selected values of the clipboard PartialProfile to the temporary PartialProfile // pushing the selected values of the clipboard PartialProfile to the temporary PartialProfile
partialPasteDlg.applyPaste (pastedPartProf.pparams, pastedPartProf.pedited, cbPartProf.pparams, cbPartProf.pedited); partialPasteDlg.applyPaste (pastedPartProf.pparams, pastedPartProf.pedited, cbPartProf.pparams, cbPartProf.pedited);
// applying the temporary PartialProfile to the thumb's ProcParams // applying the temporary PartialProfile to the thumb's ProcParams
mselected[i]->thumbnail->setProcParams (*pastedPartProf.pparams, pastedPartProf.pedited, FILEBROWSER); entry->thumbnail->setProcParams (*pastedPartProf.pparams, pastedPartProf.pedited, FILEBROWSER);
pastedPartProf.deleteInstance(); pastedPartProf.deleteInstance();
} }
@ -1502,8 +1502,8 @@ bool FileBrowser::checkFilter (ThumbBrowserEntryBase* entryb) const // true ->
std::transform(FileName.begin(), FileName.end(), FileName.begin(), ::toupper); std::transform(FileName.begin(), FileName.end(), FileName.begin(), ::toupper);
int iFilenameMatch = 0; int iFilenameMatch = 0;
for (const auto& entry : filter.vFilterStrings) { for (const auto& filter : filter.vFilterStrings) {
if (FileName.find(entry) != std::string::npos) { if (FileName.find(filter) != std::string::npos) {
++iFilenameMatch; ++iFilenameMatch;
break; break;
} }

View File

@ -37,23 +37,22 @@ ProfileStoreComboBox::ProfileStoreComboBox ()
setPreferredWidth (50, 120); setPreferredWidth (50, 120);
} }
Glib::ustring ProfileStoreComboBox::getCurrentLabel() Glib::ustring ProfileStoreComboBox::getCurrentLabel() const
{ {
Glib::ustring currLabel; const Gtk::TreeModel::const_iterator currRow = get_active();
Gtk::TreeModel::iterator currRow = get_active();
if (currRow) { if (currRow) {
const ProfileStoreEntry *currEntry = (*currRow)[methodColumns.profileStoreEntry]; const ProfileStoreEntry *currEntry = (*currRow)[methodColumns.profileStoreEntry];
return currEntry->label; return currEntry->label;
} }
return currLabel; return {};
} }
const ProfileStoreEntry* ProfileStoreComboBox::getSelectedEntry() const ProfileStoreEntry* ProfileStoreComboBox::getSelectedEntry() const
{ {
Gtk::TreeModel::iterator currRow_ = get_active(); const Gtk::TreeModel::const_iterator currRow_ = get_active();
Gtk::TreeModel::Row currRow = *currRow_; const Gtk::TreeModel::Row currRow = *currRow_;
if (currRow) { if (currRow) {
return currRow[methodColumns.profileStoreEntry]; return currRow[methodColumns.profileStoreEntry];
@ -145,18 +144,16 @@ void ProfileStoreComboBox::updateProfileList ()
cellRenderer->property_ellipsize_set() = true; cellRenderer->property_ellipsize_set() = true;
} }
Gtk::TreeIter ProfileStoreComboBox::findRowFromEntry_ (Gtk::TreeModel::Children childs, const ProfileStoreEntry *pse) Gtk::TreeIter ProfileStoreComboBox::findRowFromEntry_ (Gtk::TreeModel::Children childs, const ProfileStoreEntry *pse) const
{ {
Gtk::TreeModel::Row row;
Gtk::TreeIter rowInSubLevel;
for (Gtk::TreeModel::Children::iterator iter = childs.begin(); iter != childs.end(); ++iter) { for (const auto iter : childs) {
row = *iter; const Gtk::TreeModel::Row row = *iter;
// Hombre: is there a smarter way of knowing if this row has childs? // Hombre: is there a smarter way of knowing if this row has childs?
const ProfileStoreEntry *pse_ = row[methodColumns.profileStoreEntry]; const ProfileStoreEntry *pse_ = row[methodColumns.profileStoreEntry];
if (pse_->type == PSET_FOLDER) { if (pse_->type == PSET_FOLDER) {
rowInSubLevel = findRowFromEntry_ (iter->children(), pse); const Gtk::TreeIter rowInSubLevel = findRowFromEntry_ (iter->children(), pse);
if (rowInSubLevel) { if (rowInSubLevel) {
// entry found // entry found
@ -171,30 +168,27 @@ Gtk::TreeIter ProfileStoreComboBox::findRowFromEntry_ (Gtk::TreeModel::Children
return childs.end(); return childs.end();
} }
Gtk::TreeIter ProfileStoreComboBox::findRowFromEntry (const ProfileStoreEntry *pse) Gtk::TreeIter ProfileStoreComboBox::findRowFromEntry (const ProfileStoreEntry *pse) const
{ {
Gtk::TreeModel::Children childs = refTreeModel->children(); Gtk::TreeModel::Children childs = refTreeModel->children();
if (pse) { if (pse) {
Gtk::TreeIter row = findRowFromEntry_ (childs, pse); return findRowFromEntry_ (childs, pse);
return row;
} }
return childs.end(); return childs.end();
} }
Gtk::TreeIter ProfileStoreComboBox::findRowFromFullPath_ (Gtk::TreeModel::Children childs, int parentFolderId, Glib::ustring &name) Gtk::TreeIter ProfileStoreComboBox::findRowFromFullPath_ (Gtk::TreeModel::Children childs, int parentFolderId, const Glib::ustring &name) const
{ {
Gtk::TreeModel::Row row;
Gtk::TreeIter rowInSubLevel;
for (Gtk::TreeModel::Children::iterator iter = childs.begin(); iter != childs.end(); ++iter) { for (const auto iter : childs) {
row = *iter; const Gtk::TreeModel::Row row = *iter;
// Hombre: is there a smarter way of knowing if this row has childs? // Hombre: is there a smarter way of knowing if this row has childs?
const ProfileStoreEntry *pse = row[methodColumns.profileStoreEntry]; const ProfileStoreEntry *pse = row[methodColumns.profileStoreEntry];
if (pse->type == PSET_FOLDER) { if (pse->type == PSET_FOLDER) {
rowInSubLevel = findRowFromFullPath_ (iter->children(), parentFolderId, name); const Gtk::TreeIter rowInSubLevel = findRowFromFullPath_ (iter->children(), parentFolderId, name);
if (rowInSubLevel) { if (rowInSubLevel) {
// entry found // entry found
@ -209,88 +203,77 @@ Gtk::TreeIter ProfileStoreComboBox::findRowFromFullPath_ (Gtk::TreeModel::Childr
return childs.end(); return childs.end();
} }
Gtk::TreeIter ProfileStoreComboBox::findRowFromFullPath (Glib::ustring path) Gtk::TreeIter ProfileStoreComboBox::findRowFromFullPath (const Glib::ustring &path) const
{ {
Gtk::TreeIter row;
ProfileStore *profileStore = ProfileStore::getInstance();
if (path.empty()) { if (path.empty()) {
return row; return {};
} }
const ProfileStore *profileStore = ProfileStore::getInstance();
if (path == DEFPROFILE_INTERNAL) { if (path == DEFPROFILE_INTERNAL) {
row = findRowFromEntry (profileStore->getInternalDefaultPSE()); return findRowFromEntry (profileStore->getInternalDefaultPSE());
return row;
} }
if (path == DEFPROFILE_DYNAMIC) { if (path == DEFPROFILE_DYNAMIC) {
row = findRowFromEntry (profileStore->getInternalDynamicPSE()); return findRowFromEntry (profileStore->getInternalDynamicPSE());
return row;
} }
// removing the filename // removing the filename
Glib::ustring fName = Glib::path_get_basename (path); const Glib::ustring fName = Glib::path_get_basename(path);
if (!fName.empty()) { if (!fName.empty()) {
path = path.substr (0, path.length() - fName.length()); int parentFolderId = profileStore->findFolderId (Glib::path_get_dirname (path.substr (0, path.length() - fName.length())));
} else { // 1. find the path in the folder list
// path is malformed; if (parentFolderId != -1) {
return row; return findRowFromFullPath_ (refTreeModel->children(), parentFolderId, fName);
}
} }
path = Glib::path_get_dirname (path); return {};
int parentFolderId = profileStore->findFolderId (path);
// 1. find the path in the folder list
if (parentFolderId != -1) {
row = findRowFromFullPath_ (refTreeModel->children(), parentFolderId, fName);
}
return row;
} }
/** @brief Get the absolute full path of the active row entry. /** @brief Get the absolute full path of the active row entry.
* @return The absolute full path of the active row entry, or the "Internal" keyword, * @return The absolute full path of the active row entry, or the "Internal" keyword,
* or an empty string if the ComboBox is in an invalid state * or an empty string if the ComboBox is in an invalid state
*/ */
Glib::ustring ProfileStoreComboBox::getFullPathFromActiveRow() Glib::ustring ProfileStoreComboBox::getFullPathFromActiveRow() const
{ {
Glib::ustring path; const Gtk::TreeModel::const_iterator currRowI = get_active();
Gtk::TreeModel::iterator currRowI = get_active();
ProfileStore *profileStore = ProfileStore::getInstance();
if (!currRowI) { if (!currRowI) {
return path; return {};
} }
Gtk::TreeModel::Row currRow = *currRowI; Gtk::TreeModel::Row currRow = *currRowI;
if (currRow) { if (currRow) {
const ProfileStoreEntry *currEntry = currRow[methodColumns.profileStoreEntry]; const ProfileStoreEntry *currEntry = currRow[methodColumns.profileStoreEntry];
if (!currEntry) { if (!currEntry) {
return path; return {};
} }
const ProfileStore *profileStore = ProfileStore::getInstance();
if (currEntry == profileStore->getInternalDefaultPSE()) { if (currEntry == profileStore->getInternalDefaultPSE()) {
return Glib::ustring (DEFPROFILE_INTERNAL); return DEFPROFILE_INTERNAL;
} }
if (currEntry == profileStore->getInternalDynamicPSE()) { if (currEntry == profileStore->getInternalDynamicPSE()) {
return Glib::ustring (DEFPROFILE_DYNAMIC); return DEFPROFILE_DYNAMIC;
} }
path = Glib::build_filename (profileStore->getPathFromId (currEntry->parentFolderId), currEntry->label); return Glib::build_filename (profileStore->getPathFromId (currEntry->parentFolderId), currEntry->label);
} }
return path; return {};
} }
bool ProfileStoreComboBox::setActiveRowFromFullPath (Glib::ustring path) bool ProfileStoreComboBox::setActiveRowFromFullPath (const Glib::ustring &path)
{ {
if (!path.empty()) { if (!path.empty()) {
Gtk::TreeIter row = findRowFromFullPath (path); const Gtk::TreeIter row = findRowFromFullPath (path);
if (row) { if (row) {
set_active (row); set_active (row);
@ -304,7 +287,7 @@ bool ProfileStoreComboBox::setActiveRowFromFullPath (Glib::ustring path)
bool ProfileStoreComboBox::setActiveRowFromEntry (const ProfileStoreEntry *pse) bool ProfileStoreComboBox::setActiveRowFromEntry (const ProfileStoreEntry *pse)
{ {
if (pse) { if (pse) {
Gtk::TreeIter row = findRowFromEntry (pse); const Gtk::TreeIter row = findRowFromEntry (pse);
if (row) { if (row) {
set_active (row); set_active (row);
@ -321,16 +304,13 @@ bool ProfileStoreComboBox::setInternalEntry ()
} }
/** @brief Get the row from the first level of the tree that match the provided name */ /** @brief Get the row from the first level of the tree that match the provided name */
Gtk::TreeIter ProfileStoreComboBox::getRowFromLabel (Glib::ustring name) Gtk::TreeIter ProfileStoreComboBox::getRowFromLabel (const Glib::ustring &name) const
{ {
Gtk::TreeIter row; const Gtk::TreeModel::Children childs = refTreeModel->children();
Gtk::TreeModel::Children childs = refTreeModel->children();
if (!name.empty()) { if (!name.empty()) {
Gtk::TreeModel::Row currRow; for (const auto iter : childs) {
const Gtk::TreeModel::Row currRow = *iter;
for (Gtk::TreeModel::Children::iterator iter = childs.begin(); iter != childs.end(); ++iter) {
currRow = *iter;
const ProfileStoreEntry *pse = currRow[methodColumns.profileStoreEntry]; const ProfileStoreEntry *pse = currRow[methodColumns.profileStoreEntry];
if (pse->label == name) { if (pse->label == name) {

View File

@ -24,7 +24,6 @@
#include <glibmm.h> #include <glibmm.h>
#include "../rtengine/rtengine.h" #include "../rtengine/rtengine.h"
#include "../rtengine/noncopyable.h"
#include "../rtengine/profilestore.h" #include "../rtengine/profilestore.h"
#include "threadutils.h" #include "threadutils.h"
@ -35,7 +34,7 @@
/** /**
* @brief subclass of Gtk::Label with extra fields for Combobox and Menu, to link with a ProfileStoreEntry * @brief subclass of Gtk::Label with extra fields for Combobox and Menu, to link with a ProfileStoreEntry
*/ */
class ProfileStoreLabel : public Gtk::Label class ProfileStoreLabel final : public Gtk::Label
{ {
public: public:
@ -44,7 +43,7 @@ public:
#ifndef NDEBUG #ifndef NDEBUG
ProfileStoreLabel() : Gtk::Label ("*** error ***"), entry (nullptr) {} ProfileStoreLabel() : Gtk::Label ("*** error ***"), entry (nullptr) {}
#else #else
ProfileStoreLabel() : Gtk::Label (""), entry (NULL) {} ProfileStoreLabel() : Gtk::Label (""), entry (nullptr) {}
#endif #endif
/** @brief Create a new ProfileStoreLabel /** @brief Create a new ProfileStoreLabel
@ -55,11 +54,11 @@ public:
ProfileStoreLabel (const ProfileStoreLabel &other); ProfileStoreLabel (const ProfileStoreLabel &other);
}; };
class ProfileStoreComboBox : public MyComboBox class ProfileStoreComboBox final : public MyComboBox
{ {
protected: private:
class MethodColumns : public Gtk::TreeModel::ColumnRecord class MethodColumns final : public Gtk::TreeModel::ColumnRecord
{ {
public: public:
Gtk::TreeModelColumn<Glib::ustring> label; Gtk::TreeModelColumn<Glib::ustring> label;
@ -74,21 +73,22 @@ protected:
Glib::RefPtr<Gtk::TreeStore> refTreeModel; Glib::RefPtr<Gtk::TreeStore> refTreeModel;
MethodColumns methodColumns; MethodColumns methodColumns;
void refreshProfileList_ (Gtk::TreeModel::Row *parentRow, int parentFolderId, bool initial, const std::vector<const ProfileStoreEntry*> *entryList); void refreshProfileList_ (Gtk::TreeModel::Row *parentRow, int parentFolderId, bool initial, const std::vector<const ProfileStoreEntry*> *entryList);
Gtk::TreeIter findRowFromEntry_ (Gtk::TreeModel::Children childs, const ProfileStoreEntry *pse); Gtk::TreeIter findRowFromEntry_ (Gtk::TreeModel::Children childs, const ProfileStoreEntry *pse) const;
Gtk::TreeIter findRowFromFullPath_ (Gtk::TreeModel::Children childs, int parentFolderId, Glib::ustring &name); Gtk::TreeIter findRowFromFullPath_ (Gtk::TreeModel::Children childs, int parentFolderId, const Glib::ustring &name) const;
Gtk::TreeIter findRowFromEntry (const ProfileStoreEntry *pse) const;
Gtk::TreeIter findRowFromFullPath (const Glib::ustring &path) const;
public: public:
ProfileStoreComboBox(); ProfileStoreComboBox();
void updateProfileList(); void updateProfileList();
Glib::ustring getCurrentLabel(); Glib::ustring getCurrentLabel() const;
const ProfileStoreEntry* getSelectedEntry(); const ProfileStoreEntry* getSelectedEntry() const;
Gtk::TreeIter findRowFromEntry (const ProfileStoreEntry *pse); Glib::ustring getFullPathFromActiveRow () const;
Gtk::TreeIter findRowFromFullPath (Glib::ustring path); bool setActiveRowFromFullPath (const Glib::ustring &oldPath);
Glib::ustring getFullPathFromActiveRow ();
bool setActiveRowFromFullPath (Glib::ustring oldPath);
bool setActiveRowFromEntry (const ProfileStoreEntry *pse); bool setActiveRowFromEntry (const ProfileStoreEntry *pse);
bool setInternalEntry (); bool setInternalEntry ();
Gtk::TreeIter getRowFromLabel (Glib::ustring name); Gtk::TreeIter getRowFromLabel (const Glib::ustring &name) const;
Gtk::TreeIter addRow (const ProfileStoreEntry *profileStoreEntry); Gtk::TreeIter addRow (const ProfileStoreEntry *profileStoreEntry);
void deleteRow (const ProfileStoreEntry *profileStoreEntry); void deleteRow (const ProfileStoreEntry *profileStoreEntry);
}; };

View File

@ -225,21 +225,21 @@ void ThumbBrowserBase::selectSet (ThumbBrowserEntryBase* clicked)
static void scrollToEntry (double& h, double& v, int iw, int ih, ThumbBrowserEntryBase* entry) static void scrollToEntry (double& h, double& v, int iw, int ih, ThumbBrowserEntryBase* entry)
{ {
const int hmin = entry->getX (); const int hMin = entry->getX();
const int hmax = hmin + entry->getEffectiveWidth () - iw; const int hMax = hMin + entry->getEffectiveWidth() - iw;
const int vmin = entry->getY (); const int vMin = entry->getY();
const int vmax = vmin + entry->getEffectiveHeight () - ih; const int vMax = vMin + entry->getEffectiveHeight() - ih;
if (hmin < 0) { if (hMin < 0) {
h += hmin; h += hMin;
} else if (hmax > 0) { } else if (hMax > 0) {
h += hmax; h += hMax;
} }
if(vmin < 0) { if (vMin < 0) {
v += vmin; v += vMin;
} else if (vmax > 0) { } else if (vMax > 0) {
v += vmax; v += vMax;
} }
} }