Formatted all .cc and .h code in rtengine, rtexif and rtgui using astyle

This commit is contained in:
DrSlony
2015-08-11 11:55:03 +02:00
parent effb46c3e1
commit 0e0cfb9b25
452 changed files with 133354 additions and 99460 deletions

View File

@@ -8,7 +8,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* RawTherapee 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
@@ -22,12 +22,14 @@
#include "../rtengine/safegtk.h"
#include "inspector.h"
int FilePanelInitUI (void* data) {
int FilePanelInitUI (void* data)
{
(static_cast<FilePanel*>(data))->init ();
return 0;
}
FilePanel::FilePanel () : parent(NULL) {
FilePanel::FilePanel () : parent(NULL)
{
dirpaned = Gtk::manage ( new Gtk::HPaned () );
dirpaned->set_position (options.dirBrowserWidth);
@@ -37,7 +39,7 @@ FilePanel::FilePanel () : parent(NULL) {
recentBrowser = Gtk::manage ( new RecentBrowser () );
placespaned = Gtk::manage ( new Gtk::VPaned () );
placespaned->set_size_request(50,100);
placespaned->set_size_request(50, 100);
placespaned->set_position (options.dirBrowserHeight);
Gtk::VBox* obox = Gtk::manage (new Gtk::VBox ());
@@ -51,10 +53,10 @@ FilePanel::FilePanel () : parent(NULL) {
tpc = new BatchToolPanelCoordinator (this);
tpc->removeWbTool();
fileCatalog = Gtk::manage ( new FileCatalog (tpc->coarse, tpc->getToolBar(),this) );
fileCatalog = Gtk::manage ( new FileCatalog (tpc->coarse, tpc->getToolBar(), this) );
ribbonPane = Gtk::manage ( new Gtk::Paned() );
ribbonPane->add(*fileCatalog);
ribbonPane->set_size_request(50,150);
ribbonPane->set_size_request(50, 150);
dirpaned->pack2 (*ribbonPane, true, true);
placesBrowser->setDirBrowserRemoteInterface (dirBrowser);
@@ -67,7 +69,7 @@ FilePanel::FilePanel () : parent(NULL) {
fileCatalog->setDirBrowserRemoteInterface (dirBrowser);
rightBox = Gtk::manage ( new Gtk::HBox () );
rightBox->set_size_request(50,100);
rightBox->set_size_request(50, 100);
rightNotebook = Gtk::manage ( new Gtk::Notebook () );
rightNotebookSwitchConn = rightNotebook->signal_switch_page().connect_notify( sigc::mem_fun(*this, &FilePanel::on_NB_switch_page) );
//Gtk::VBox* taggingBox = Gtk::manage ( new Gtk::VBox () );
@@ -78,20 +80,20 @@ FilePanel::FilePanel () : parent(NULL) {
history->setProfileChangeListener (tpc);
Gtk::ScrolledWindow* sFilterPanel = Gtk::manage ( new Gtk::ScrolledWindow() );
filterPanel = Gtk::manage ( new FilterPanel () );
sFilterPanel->add (*filterPanel);
sFilterPanel->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
filterPanel = Gtk::manage ( new FilterPanel () );
sFilterPanel->add (*filterPanel);
sFilterPanel->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
inspectorPanel = new Inspector();
fileCatalog->setInspector(inspectorPanel);
Gtk::ScrolledWindow* sExportPanel = Gtk::manage ( new Gtk::ScrolledWindow() );
exportPanel = Gtk::manage ( new ExportPanel () );
sExportPanel->add (*exportPanel);
sExportPanel->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
sExportPanel->add (*exportPanel);
sExportPanel->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
fileCatalog->setFilterPanel (filterPanel);
fileCatalog->setExportPanel (exportPanel);
fileCatalog->setFilterPanel (filterPanel);
fileCatalog->setExportPanel (exportPanel);
fileCatalog->setImageAreaToolListener (tpc);
fileCatalog->fileBrowser->setBatchPParamsChangeListener (tpc);
@@ -133,48 +135,58 @@ FilePanel::FilePanel () : parent(NULL) {
show_all ();
}
FilePanel::~FilePanel () {
FilePanel::~FilePanel ()
{
rightNotebookSwitchConn.disconnect();
if (inspectorPanel)
if (inspectorPanel) {
delete inspectorPanel;
}
}
void FilePanel::on_realize () {
void FilePanel::on_realize ()
{
Gtk::HPaned::on_realize ();
tpc->closeAllTools();
}
void FilePanel::setAspect () {
int winW, winH;
parent->get_size(winW, winH);
placespaned->set_position(options.dirBrowserHeight);
dirpaned->set_position(options.dirBrowserWidth);
tpcPaned->set_position(options.browserToolPanelHeight);
set_position(winW - options.browserToolPanelWidth);
if (!options.browserDirPanelOpened)
fileCatalog->toggleLeftPanel();
if (!options.browserToolPanelOpened)
fileCatalog->toggleRightPanel();
void FilePanel::setAspect ()
{
int winW, winH;
parent->get_size(winW, winH);
placespaned->set_position(options.dirBrowserHeight);
dirpaned->set_position(options.dirBrowserWidth);
tpcPaned->set_position(options.browserToolPanelHeight);
set_position(winW - options.browserToolPanelWidth);
if (!options.browserDirPanelOpened) {
fileCatalog->toggleLeftPanel();
}
if (!options.browserToolPanelOpened) {
fileCatalog->toggleRightPanel();
}
}
void FilePanel::init () {
void FilePanel::init ()
{
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
dirBrowser->fillDirTree ();
placesBrowser->refreshPlacesList ();
if (argv1!="" && safe_file_test (argv1, Glib::FILE_TEST_IS_DIR))
if (argv1 != "" && safe_file_test (argv1, Glib::FILE_TEST_IS_DIR)) {
dirBrowser->open (argv1);
else {
if (options.startupDir==STARTUPDIR_HOME)
} else {
if (options.startupDir == STARTUPDIR_HOME) {
dirBrowser->open (safe_get_user_picture_dir());
else if (options.startupDir==STARTUPDIR_CURRENT)
} else if (options.startupDir == STARTUPDIR_CURRENT) {
dirBrowser->open (argv0);
else if (options.startupDir==STARTUPDIR_CUSTOM || options.startupDir==STARTUPDIR_LAST) {
if (options.startupPath.length() && safe_file_test(options.startupPath, Glib::FILE_TEST_EXISTS) && safe_file_test(options.startupPath, Glib::FILE_TEST_IS_DIR))
} else if (options.startupDir == STARTUPDIR_CUSTOM || options.startupDir == STARTUPDIR_LAST) {
if (options.startupPath.length() && safe_file_test(options.startupPath, Glib::FILE_TEST_EXISTS) && safe_file_test(options.startupPath, Glib::FILE_TEST_IS_DIR)) {
dirBrowser->open (options.startupPath);
else {
} else {
// Fallback option if the path is empty or the folder doesn't exist
dirBrowser->open (safe_get_user_picture_dir());
}
@@ -182,29 +194,35 @@ void FilePanel::init () {
}
}
void FilePanel::on_NB_switch_page(GtkNotebookPage* page, guint page_num) {
void FilePanel::on_NB_switch_page(GtkNotebookPage* page, guint page_num)
{
if (page_num == 1) {
// switching the inspector "on"
fileCatalog->enableInspector();
}
else {
} else {
// switching the inspector "off"
fileCatalog->disableInspector();
}
}
bool FilePanel::fileSelected (Thumbnail* thm) {
bool FilePanel::fileSelected (Thumbnail* thm)
{
if (!parent)
if (!parent) {
return false;
}
// Check if it's already open BEFORE loading the file
if (options.tabbedUI && parent->selectEditorPanel(thm->getFileName()))
if (options.tabbedUI && parent->selectEditorPanel(thm->getFileName())) {
return true;
}
// try to open the file
bool loading = thm->imageLoad( true );
if( !loading ) return false;
if( !loading ) {
return false;
}
pendingLoadMutex.lock();
pendingLoad *pl = new pendingLoad();
@@ -215,13 +233,15 @@ bool FilePanel::fileSelected (Thumbnail* thm) {
pendingLoadMutex.unlock();
ProgressConnector<rtengine::InitialImage*> *ld = new ProgressConnector<rtengine::InitialImage*>();
ld->startFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), thm->getFileName (), thm->getType()==FT_Raw, &error, parent->getProgressListener()),
sigc::bind(sigc::mem_fun(*this,&FilePanel::imageLoaded), thm, ld) );
ld->startFunc (sigc::bind(sigc::ptr_fun(&rtengine::InitialImage::load), thm->getFileName (), thm->getType() == FT_Raw, &error, parent->getProgressListener()),
sigc::bind(sigc::mem_fun(*this, &FilePanel::imageLoaded), thm, ld) );
return true;
}
bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::InitialImage*> *pc ){
bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::InitialImage*> *pc )
{
pendingLoadMutex.lock();
// find our place in the array and mark the entry as complete
for (unsigned int i = 0; i < pendingLoads.size(); i++) {
if (pendingLoads[i]->thm == thm) {
@@ -230,24 +250,28 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
break;
}
}
// The purpose of the pendingLoads vector is to open tabs in the same order as the loads where initiated. It has no effect on single editor mode.
while (pendingLoads.size() > 0 && pendingLoads.front()->complete) {
pendingLoad *pl = pendingLoads.front();
if (pl->pc->returnValue()) {
if (options.tabbedUI) {
EditorPanel* epanel;
{
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
epanel = Gtk::manage (new EditorPanel ());
parent->addEditorPanel (epanel,pl->thm->getFileName());
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
epanel = Gtk::manage (new EditorPanel ());
parent->addEditorPanel (epanel, pl->thm->getFileName());
}
epanel->open(pl->thm, pl->pc->returnValue() );
if (!(options.multiDisplayMode>0))
if (!(options.multiDisplayMode > 0)) {
parent->set_title_decorated(pl->thm->getFileName());
}
} else {
{
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
parent->SetEditorCurrent();
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
parent->SetEditorCurrent();
}
parent->epanel->open(pl->thm, pl->pc->returnValue() );
parent->set_title_decorated(pl->thm->getFileName());
@@ -257,17 +281,19 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
Gtk::MessageDialog msgd (msg_, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
}
delete pl->pc;
{
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
parent->setProgress(0.);
parent->setProgressStr("");
GThreadLock lock; // Acquiring the GUI... not sure that it's necessary, but it shouldn't harm
parent->setProgress(0.);
parent->setProgressStr("");
}
pendingLoads.erase(pendingLoads.begin());
delete pl;
}
pendingLoadMutex.unlock();
thm->imageLoad( false );
@@ -275,7 +301,8 @@ bool FilePanel::imageLoaded( Thumbnail* thm, ProgressConnector<rtengine::Initial
return false; // MUST return false from idle function
}
void FilePanel::saveOptions () {
void FilePanel::saveOptions ()
{
int winW, winH;
parent->get_size(winW, winH);
@@ -283,69 +310,86 @@ void FilePanel::saveOptions () {
options.dirBrowserHeight = placespaned->get_position ();
options.browserToolPanelWidth = winW - get_position();
options.browserToolPanelHeight = tpcPaned->get_position ();
if (options.startupDir==STARTUPDIR_LAST && fileCatalog->lastSelectedDir ()!="")
if (options.startupDir == STARTUPDIR_LAST && fileCatalog->lastSelectedDir () != "") {
options.startupPath = fileCatalog->lastSelectedDir ();
}
fileCatalog->closeDir ();
}
void FilePanel::open (const Glib::ustring& d) {
void FilePanel::open (const Glib::ustring& d)
{
if (safe_file_test (d, Glib::FILE_TEST_IS_DIR))
if (safe_file_test (d, Glib::FILE_TEST_IS_DIR)) {
dirBrowser->open (d.c_str());
else if (safe_file_test (d, Glib::FILE_TEST_EXISTS))
} else if (safe_file_test (d, Glib::FILE_TEST_EXISTS)) {
dirBrowser->open (Glib::path_get_dirname(d), Glib::path_get_basename(d));
}
}
bool FilePanel::addBatchQueueJobs ( std::vector<BatchQueueEntry*> &entries ) {
bool FilePanel::addBatchQueueJobs ( std::vector<BatchQueueEntry*> &entries )
{
if (parent)
if (parent) {
parent->addBatchQueueJobs (entries);
return true;
}
return true;
}
void FilePanel::optionsChanged () {
void FilePanel::optionsChanged ()
{
tpc->optionsChanged ();
fileCatalog->refreshThumbImages ();
}
bool FilePanel::handleShortcutKey (GdkEventKey* event) {
bool FilePanel::handleShortcutKey (GdkEventKey* event)
{
bool ctrl = event->state & GDK_CONTROL_MASK;
if (!ctrl) {
switch(event->keyval) {
}
}
else {
} else {
switch (event->keyval) {
}
}
if(tpc->getToolBar() && tpc->getToolBar()->handleShortcutKey(event))
return true;
if(tpc->handleShortcutKey(event))
return true;
if(fileCatalog->handleShortcutKey(event))
if(tpc->getToolBar() && tpc->getToolBar()->handleShortcutKey(event)) {
return true;
}
if(tpc->handleShortcutKey(event)) {
return true;
}
if(fileCatalog->handleShortcutKey(event)) {
return true;
}
return false;
}
void FilePanel::loadingThumbs(Glib::ustring str, double rate)
{
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
if( !str.empty())
parent->setProgressStr(str);
parent->setProgress( rate );
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
if( !str.empty()) {
parent->setProgressStr(str);
}
parent->setProgress( rate );
}
void FilePanel::updateTPVScrollbar (bool hide) {
tpc->updateTPVScrollbar (hide);
void FilePanel::updateTPVScrollbar (bool hide)
{
tpc->updateTPVScrollbar (hide);
}
void FilePanel::updateTabsUsesIcons (bool useIcons) {
tpc->updateTabsUsesIcons (useIcons);
void FilePanel::updateTabsUsesIcons (bool useIcons)
{
tpc->updateTabsUsesIcons (useIcons);
}