Merge from default. Hope I did it right...

This commit is contained in:
Emil Martinec
2012-03-08 20:27:30 -06:00
parent 380728e1f0
commit f47b4b5bb0
262 changed files with 41736 additions and 37104 deletions

View File

@@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rtwindow.h"
#include "options.h"
#include "preferences.h"
@@ -24,14 +25,16 @@
#include "whitebalance.h"
RTWindow::RTWindow ()
:fpanel(NULL)
,epanel(NULL)
:mainNB(NULL)
,bpanel(NULL)
,mainNB(NULL)
,splash(NULL)
,epanel(NULL)
,fpanel(NULL)
{
cacheMgr->init ();
WhiteBalance::init();
ProfilePanel::init();
Glib::ustring fName = "rt-logo.png";
Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName);
@@ -202,6 +205,27 @@ RTWindow::RTWindow ()
if (!isSingleTabMode()&& !simpleEditor) epanel->hide_all();
}
void RTWindow::findVerNumbers(int* numbers, Glib::ustring versionStr) {
numbers[0] = numbers[1] = numbers[2] = numbers[3] = 0;
int n=0;
for (unsigned int i=0; i<versionStr.length(); i++) {
char chr = (char)versionStr.at(i);
if (chr >= '0' && chr <= '9') {
numbers[n] *= 10;
numbers[n] += (int)(chr - '0');
}
else {
n++;
if (n>4) {
printf("Error: malformed version string; \"%s\" must follow this format: xx.xx.xx.xx. Admitting it's a developer version...\n", versionStr.c_str());
// Reseting the already found numbers
numbers[0] = numbers[1] = numbers[2] = numbers[3] = 100;
return;
}
}
}
}
void RTWindow::on_realize () {
Gtk::Window::on_realize ();
@@ -209,6 +233,38 @@ void RTWindow::on_realize () {
fpanel->setAspect();
cursorManager.init (get_window());
// Check if first run of this version, then display the Release Notes text
if (options.version != versionString) {
int prevVerNbr[4];
int currVerNbr[4];
findVerNumbers(prevVerNbr, options.version);
findVerNumbers(currVerNbr, versionString);
// Now we can update the version parameter with the right value
options.version = versionString;
bool showReleaseNotes = false;
// Check if the current version is newer
if (currVerNbr[0] > prevVerNbr[0]) showReleaseNotes = true;
else if (currVerNbr[1] > prevVerNbr[1]) showReleaseNotes = true;
else if (currVerNbr[2] > prevVerNbr[2]) showReleaseNotes = true;
if (showReleaseNotes) {
// this is a first run!
splash = new Splash (*this);
splash->set_transient_for (*this);
splash->signal_delete_event().connect( sigc::mem_fun(*this, &RTWindow::splashClosed) );
if (splash->hasReleaseNotes()) {
splash->showReleaseNotes();
splash->show ();
}
else {
delete splash;
splash = NULL;
}
}
}
}
bool RTWindow::on_window_state_event(GdkEventWindowState* event) {
@@ -227,7 +283,7 @@ void RTWindow::on_mainNB_switch_page(GtkNotebookPage* page, guint page_num) {
if (page_num > 1) {
if (isSingleTabMode()) MoveFileBrowserToEditor();
EditorPanel *ep = (EditorPanel *)mainNB->get_nth_page(page_num);
EditorPanel *ep = static_cast<EditorPanel*>(mainNB->get_nth_page(page_num));
ep->setAspect();
} else {
// in single tab mode with command line filename epanel does not exist yet
@@ -317,7 +373,7 @@ bool RTWindow::selectEditorPanel(const std::string &name) {
bool RTWindow::keyPressed (GdkEventKey* event) {
bool ctrl = event->state & GDK_CONTROL_MASK;
bool shift = event->state & GDK_SHIFT_MASK;
//bool shift = event->state & GDK_SHIFT_MASK;
if (ctrl) {
switch(event->keyval) {
@@ -346,7 +402,7 @@ bool RTWindow::keyPressed (GdkEventKey* event) {
return false;
}
else {
EditorPanel* ep = (EditorPanel*)mainNB->get_nth_page (mainNB->get_current_page());
EditorPanel* ep = static_cast<EditorPanel*>(mainNB->get_nth_page (mainNB->get_current_page()));
return ep->handleShortcutKey (event);
}
return false;
@@ -378,7 +434,7 @@ bool RTWindow::on_delete_event(GdkEventAny* event) {
// First and second are file browser and batch queue
if (pageCount>2) {
for (int i=2;i<pageCount;i++)
isProcessing |= ((EditorPanel*)mainNB->get_nth_page(i))->getIsProcessing();
isProcessing |= (static_cast<EditorPanel*>(mainNB->get_nth_page(i)))->getIsProcessing();
}
}
@@ -395,10 +451,9 @@ bool RTWindow::on_delete_event(GdkEventAny* event) {
cacheMgr->closeCache (); // also makes cleanup if too large
WhiteBalance::cleanup();
ProfilePanel::cleanup();
options.firstRun = false;
if (!options.windowMaximized) {
options.windowWidth = get_width();
options.windowHeight = get_height();
@@ -465,7 +520,7 @@ void RTWindow::SetMainCurrent()
void RTWindow::MoveFileBrowserToMain()
{
if( fpanel->ribbonPane->get_children().size() ==0)
if( fpanel->ribbonPane->get_children().empty())
{
FileCatalog *fCatalog = fpanel->fileCatalog;
epanel->catalogPane->remove(*fCatalog);
@@ -478,7 +533,7 @@ void RTWindow::MoveFileBrowserToMain()
void RTWindow::MoveFileBrowserToEditor()
{
if(epanel->catalogPane->get_children().size() ==0 )
if(epanel->catalogPane->get_children().empty() )
{
FileCatalog *fCatalog = fpanel->fileCatalog;
fpanel->ribbonPane->remove(*fCatalog);
@@ -531,3 +586,9 @@ void RTWindow::updateHistogramPosition (int oldPosition, int newPosition) {
((*itr).second)->updateHistogramPosition (oldPosition, newPosition);
}
}
bool RTWindow::splashClosed(GdkEventAny* event) {
delete splash;
splash = NULL;
return true;
}