Formatted all .cc and .h code in rtengine, rtexif and rtgui using astyle
This commit is contained in:
@@ -7,7 +7,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
|
||||
@@ -19,52 +19,60 @@
|
||||
#include "lwbutton.h"
|
||||
#include "guiutils.h"
|
||||
|
||||
LWButton::LWButton (Cairo::RefPtr<Cairo::ImageSurface> i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring tooltip)
|
||||
: halign(ha), valign(va), icon(i), state(Normal), listener(NULL), actionCode(aCode), actionData(aData), toolTip(tooltip) {
|
||||
|
||||
LWButton::LWButton (Cairo::RefPtr<Cairo::ImageSurface> i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring tooltip)
|
||||
: halign(ha), valign(va), icon(i), state(Normal), listener(NULL), actionCode(aCode), actionData(aData), toolTip(tooltip)
|
||||
{
|
||||
|
||||
if (i) {
|
||||
w = i->get_width () + 2;
|
||||
h = i->get_height () + 2;
|
||||
w = i->get_width () + 2;
|
||||
h = i->get_height () + 2;
|
||||
} else {
|
||||
w = h = 2;
|
||||
}
|
||||
else
|
||||
w = h = 2;
|
||||
}
|
||||
|
||||
void LWButton::getSize (int& minw, int& minh) {
|
||||
void LWButton::getSize (int& minw, int& minh)
|
||||
{
|
||||
|
||||
minw = w;
|
||||
minh = h;
|
||||
}
|
||||
|
||||
void LWButton::setPosition (int x, int y) {
|
||||
void LWButton::setPosition (int x, int y)
|
||||
{
|
||||
|
||||
xpos = x;
|
||||
ypos = y;
|
||||
}
|
||||
|
||||
void LWButton::getPosition (int& x, int& y) {
|
||||
void LWButton::getPosition (int& x, int& y)
|
||||
{
|
||||
|
||||
x = xpos;
|
||||
y = ypos;
|
||||
}
|
||||
|
||||
void LWButton::setIcon (Cairo::RefPtr<Cairo::ImageSurface> i) {
|
||||
void LWButton::setIcon (Cairo::RefPtr<Cairo::ImageSurface> i)
|
||||
{
|
||||
|
||||
icon = i;
|
||||
|
||||
if (i) {
|
||||
w = i->get_width () + 2;
|
||||
h = i->get_height () + 2;
|
||||
w = i->get_width () + 2;
|
||||
h = i->get_height () + 2;
|
||||
} else {
|
||||
w = h = 2;
|
||||
}
|
||||
else
|
||||
w = h = 2;
|
||||
}
|
||||
|
||||
Cairo::RefPtr<Cairo::ImageSurface> LWButton::getIcon () {
|
||||
Cairo::RefPtr<Cairo::ImageSurface> LWButton::getIcon ()
|
||||
{
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
void LWButton::setColors (const Gdk::Color& bg, const Gdk::Color& fg) {
|
||||
void LWButton::setColors (const Gdk::Color& bg, const Gdk::Color& fg)
|
||||
{
|
||||
|
||||
bgr = bg.get_red_p ();
|
||||
bgg = bg.get_green_p ();
|
||||
@@ -74,117 +82,153 @@ void LWButton::setColors (const Gdk::Color& bg, const Gdk::Color& fg) {
|
||||
fgb = fg.get_blue_p ();
|
||||
}
|
||||
|
||||
bool LWButton::inside (int x, int y) {
|
||||
bool LWButton::inside (int x, int y)
|
||||
{
|
||||
|
||||
return x>xpos && x<xpos+w && y>ypos && y<ypos+h;
|
||||
return x > xpos && x < xpos + w && y > ypos && y < ypos + h;
|
||||
}
|
||||
|
||||
bool LWButton::motionNotify (int x, int y) {
|
||||
bool LWButton::motionNotify (int x, int y)
|
||||
{
|
||||
|
||||
bool in = inside (x, y);
|
||||
State nstate = state;
|
||||
if (state==Normal && in)
|
||||
|
||||
if (state == Normal && in) {
|
||||
nstate = Over;
|
||||
else if (state==Over && !in)
|
||||
} else if (state == Over && !in) {
|
||||
nstate = Normal;
|
||||
else if (state==Pressed_In && !in)
|
||||
} else if (state == Pressed_In && !in) {
|
||||
nstate = Pressed_Out;
|
||||
else if (state==Pressed_Out && in)
|
||||
} else if (state == Pressed_Out && in) {
|
||||
nstate = Pressed_In;
|
||||
|
||||
if (state!=nstate) {
|
||||
}
|
||||
|
||||
if (state != nstate) {
|
||||
state = nstate;
|
||||
if (listener)
|
||||
|
||||
if (listener) {
|
||||
listener->redrawNeeded (this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
bool LWButton::pressNotify (int x, int y) {
|
||||
bool LWButton::pressNotify (int x, int y)
|
||||
{
|
||||
|
||||
bool in = inside (x, y);
|
||||
State nstate = state;
|
||||
if (in && (state==Normal || state==Over || state==Pressed_Out))
|
||||
|
||||
if (in && (state == Normal || state == Over || state == Pressed_Out)) {
|
||||
nstate = Pressed_In;
|
||||
else if (!in && state==Pressed_In)
|
||||
} else if (!in && state == Pressed_In) {
|
||||
nstate = Normal;
|
||||
|
||||
if (state!=nstate) {
|
||||
}
|
||||
|
||||
if (state != nstate) {
|
||||
state = nstate;
|
||||
if (listener)
|
||||
|
||||
if (listener) {
|
||||
listener->redrawNeeded (this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
bool LWButton::releaseNotify (int x, int y) {
|
||||
bool LWButton::releaseNotify (int x, int y)
|
||||
{
|
||||
|
||||
bool in = inside (x, y);
|
||||
State nstate = state;
|
||||
bool action = false;
|
||||
if (in && (state==Pressed_In || state==Pressed_Out)) {
|
||||
|
||||
if (in && (state == Pressed_In || state == Pressed_Out)) {
|
||||
nstate = Over;
|
||||
action = true;
|
||||
}
|
||||
else
|
||||
} else {
|
||||
nstate = Normal;
|
||||
|
||||
}
|
||||
|
||||
bool ret = action;
|
||||
if (state!=nstate) {
|
||||
|
||||
if (state != nstate) {
|
||||
state = nstate;
|
||||
if (listener)
|
||||
|
||||
if (listener) {
|
||||
listener->redrawNeeded (this);
|
||||
}
|
||||
|
||||
ret = true;
|
||||
}
|
||||
|
||||
if (action && listener)
|
||||
|
||||
if (action && listener) {
|
||||
listener->buttonPressed (this, actionCode, actionData);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void LWButton::redraw (Cairo::RefPtr<Cairo::Context> context) {
|
||||
void LWButton::redraw (Cairo::RefPtr<Cairo::Context> context)
|
||||
{
|
||||
|
||||
GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected
|
||||
context->set_line_width (1.0);
|
||||
context->set_antialias (Cairo::ANTIALIAS_SUBPIXEL);
|
||||
context->rectangle (xpos+0.5, ypos+0.5, w-1.0, h-1.0);
|
||||
if (state==Pressed_In)
|
||||
context->rectangle (xpos + 0.5, ypos + 0.5, w - 1.0, h - 1.0);
|
||||
|
||||
if (state == Pressed_In) {
|
||||
context->set_source_rgb (fgr, fgg, fgb);
|
||||
else
|
||||
} else {
|
||||
context->set_source_rgba (bgr, bgg, bgb, 0);
|
||||
}
|
||||
|
||||
context->fill_preserve ();
|
||||
if (state==Over)
|
||||
|
||||
if (state == Over) {
|
||||
context->set_source_rgb (fgr, fgg, fgb);
|
||||
else
|
||||
} else {
|
||||
context->set_source_rgba (bgr, bgg, bgb, 0);
|
||||
}
|
||||
|
||||
context->stroke ();
|
||||
int dilat = 1;
|
||||
if (state==Pressed_In)
|
||||
|
||||
if (state == Pressed_In) {
|
||||
dilat++;
|
||||
}
|
||||
|
||||
if (icon) {
|
||||
context->set_source (icon, xpos+dilat, ypos+dilat);
|
||||
context->set_source (icon, xpos + dilat, ypos + dilat);
|
||||
context->paint ();
|
||||
}
|
||||
}
|
||||
|
||||
void LWButton::getAlignment (Alignment& ha, Alignment& va) {
|
||||
void LWButton::getAlignment (Alignment& ha, Alignment& va)
|
||||
{
|
||||
|
||||
ha = halign;
|
||||
va = valign;
|
||||
}
|
||||
|
||||
Glib::ustring LWButton::getToolTip (int x, int y) {
|
||||
Glib::ustring LWButton::getToolTip (int x, int y)
|
||||
{
|
||||
|
||||
if (inside (x, y))
|
||||
if (inside (x, y)) {
|
||||
return toolTip;
|
||||
else
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void LWButton::setToolTip (const Glib::ustring& tooltip) {
|
||||
void LWButton::setToolTip (const Glib::ustring& tooltip)
|
||||
{
|
||||
|
||||
toolTip = tooltip;
|
||||
}
|
||||
|
Reference in New Issue
Block a user