From 6be8af55e8ef9f6ce50911112fee63258a1efdab Mon Sep 17 00:00:00 2001 From: "Hombrenatureh.510" Date: Mon, 16 Mar 2015 20:18:32 +0100 Subject: [PATCH] Enhance usability of the Tools' Enable/Disable button. --- rtdata/images/Dark/actions/expanderClosed.png | Bin 351 -> 404 bytes .../images/Dark/actions/expanderDisabled.png | Bin 347 -> 444 bytes .../images/Dark/actions/expanderEnabled.png | Bin 422 -> 559 bytes .../Dark/actions/expanderInconsistent.png | Bin 359 -> 495 bytes rtdata/images/Dark/actions/expanderOpened.png | Bin 349 -> 430 bytes .../images/Light/actions/expanderClosed.png | Bin 347 -> 416 bytes .../images/Light/actions/expanderDisabled.png | Bin 354 -> 427 bytes .../images/Light/actions/expanderEnabled.png | Bin 412 -> 576 bytes .../Light/actions/expanderInconsistent.png | Bin 364 -> 480 bytes .../images/Light/actions/expanderOpened.png | Bin 355 -> 435 bytes rtgui/guiutils.cc | 224 ++++++++++-------- rtgui/guiutils.h | 7 +- .../source_icons/scalable/expanderClosed.file | 2 +- .../source_icons/scalable/expanderClosed.svg | 94 +++++--- .../scalable/expanderDisabled.file | 2 +- .../scalable/expanderDisabled.svg | 34 +-- .../scalable/expanderEnabled.file | 2 +- .../source_icons/scalable/expanderEnabled.svg | 146 +++++++----- .../scalable/expanderInconsistent.file | 2 +- .../scalable/expanderInconsistent.svg | 98 ++++---- .../source_icons/scalable/expanderOpened.file | 2 +- .../source_icons/scalable/expanderOpened.svg | 64 +++-- 22 files changed, 399 insertions(+), 278 deletions(-) diff --git a/rtdata/images/Dark/actions/expanderClosed.png b/rtdata/images/Dark/actions/expanderClosed.png index 0df54f05523a57bcab318d12e8ec1d855773b9ce..1de08957046e27288531b09704c231e5e7a33ad3 100644 GIT binary patch delta 353 zcmV-n0iOQf0+a(GiBL{Q4GJ0x0000DNk~Le0000I0000E2nGNE03zBpG!Mkjv(5lKWrR49?H&p%7UKo|z__s`umI3=5)Q^CbSgzRl5p{o%5j{OpM zRH~Z_f`W^iIA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ff1a8179961538152aa3807acf6d85344d538..a3d16f51c256fb80993007d969e007439a1a29e7 100644 GIT binary patch delta 508 zcmVpG!Mks%*Nkl5QhJ%%#e%|vSIh+S-f~r6k!h%WM-sU5O<$I z4?clU;Kdj4;L(#P=s{ToAtpV{fV(Giac{cf6G%WzW-{qcd6~!(I$8ZM4SyA1|J6;A zh`=SS^}dMwOp@f2vtdP^%k2027rWi=yXkcL3qbc@K>HSxtJkM`i zYp(!E&-z;H#{gc%as2h%M8n~5KMcb@GjBU0USj5>G)=Fc2ck}=^PGsp7;`8hrv3z5 z*WVD)j)*+n2pS9qSA!tfDa-O%k|ZZesnfD7Us!9O06-K)??vR0h<39qb3VQY0L;8c zL@0{l-FxRZM4?r%zR+2RRCT)6ZyX1BBH-wmx#y*01;`d9j&UWV{0vfAUN0n zQuXaK0IZ{e}0pQ;5T7LlGRJeH0&H=pu0000of&!jk~{Aa$Ie`bhM3jPz?m{=4=lx5k$ z%7AH_=Kydzmec=qK5Clg-Sa#G03=D0HAI|7QIriP6h(g#S(bGngy6j8x(9&6C4e!8UDs_kP4f%@5Cp+>7>2jsHLn1$#TdgM zAdX{62>H}BZEs}HU8U3_j$^rGsjlls+qP+%rt7_y=lK*7LjZUhT&Zo_OI_EuUDv%T z%koW1sSG;9*l64K0}*ffI`aF|j4||m|9CQ)>_{mU=lrFrs)ydr09Yly02Y3EoV7d; Q+W-In07*qoM6N<$g4FGtR{#J2 diff --git a/rtdata/images/Dark/actions/expanderInconsistent.png b/rtdata/images/Dark/actions/expanderInconsistent.png index af7e889cb84d086b022cda41ea2904bcb41cbd4f..06619ca107682fee8d52388571ac0db7b57d55c0 100644 GIT binary patch delta 445 zcmV;u0Yd)g0`CJMiBL{Q4GJ0x0000DNk~Le0000I0000E2nGNE03zBpG!Mkjv(Y)M2xR49>^lTS+mQ540`yUth`RMrSBBHR?wCR#;N;6F5XZD!qP z@oV@IaxL;6jtnUX1wk!bwTRY(i$GDq#U3YuFRXGO1YtwvY8o+j+F9_nMGKS03a5Ntuym@(G0$Q zsMTtrnwbO8uzIv-$$T#<$S&Co4_>0000^k+EvTFbsxmrw$3tmhC#LSCg~AFADA z2ecpDcH9&60X(JnRQ+8pAtZse0)s5+v*ceIfclS_wIC5acU|}NXP_vGw}FM3gN6X5Na(v1ytpBJTh` zZvK&(x8oQ96aeMDe;NGwndZh0A`+c*oB1c5a~lzfi;=9gXRY;q4rs0S*4p!UpDxaO zzY~#10GC_w&KPs5>-w?^3~Kd#|Dcpod7ghxC0zx6vmXI&kf+hF?rs18002ovPDHLk FV1jMff0fheD0pG!Mkjv(D@jB_R49?n(mhK9K@bMucW)DugA@w+0X8;iQ=|>KBBb(%27kj9 zg7E{i3SuXMg$N>Na>vfjhs{My5fdea(=5xtGs`>c%nbXeWG~9Ugc{T7H0^e~Jy+MN zVRd+`(>eDr91a(oAZKRC^Zc~gY#z7U?E^D25m7S}Rh54bf|%KBmStxEHg2W?0IGV~ zYPC)}oz9VSuEETKnTd!h5viDY_7eis8D&}a5@Wn4q5#0W_Xz-qh&tyUN2Ag6wv4{Q z_THaYRrSuyq^i!$R79vO%h@($4H^sv1vB5q7)wk delta 297 zcmV+^0oMMm1Kk24iBL{Q4GJ0x0000DNk~Le0000C0000C2nGNE09JKe=aC^B3M&8r z04o9UejYfHMkjv&+DSw~R49?1Qax+KKn&HzhkZ5JrjRv1!+1F;*#6@M2eO8=LknFx zwNr-r%&8~oI`jkLcyZq(^xhMCLMp}xYp_|R{*OWb7Q-;yB4RohFmufFJXmYb7Y0P! zrD=L+jLAeK5)lIcAtHJ2_W*FdSgGr}2d%X$%W_*))wXdciYm*pn;7Fq-}jG88HAY! z@4Zvs*bosZr49ffi=nNx&*L~g5z(iJgb>1O+qN%@q5m3M-%r!DV`eeN?C1Q|S(~PL vcg`K1bEmql->wGE8$UQCNwP?&wXg970I6iw>avlz00000NkvXXu0mjfh_rqz diff --git a/rtdata/images/Light/actions/expanderClosed.png b/rtdata/images/Light/actions/expanderClosed.png index c436748b6ea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0Gy#Knu z%$pFxH7|+?13(Dj%FLUEB@vmt_uKm?z4u!YnHGT7`kYca+yg14gVy@Ino`p=dl7jB zaQTt;N~yQ5>n^K6POB)27XX;&`QtXyRp7t+2KhZ}M=Cd1(*OVf07*qoM6N<$g8nXn AZ2$lO diff --git a/rtdata/images/Light/actions/expanderEnabled.png b/rtdata/images/Light/actions/expanderEnabled.png index db02844f73bc511b122caa3f1b99aa309e5bdcee..402d4aae2cf33b3abfdcf6c7de11966ced09af81 100644 GIT binary patch delta 525 zcmV+o0`mQw1Hc3!iBL{Q4GJ0x0000DNk~Le0000I0000E2nGNE03zBpG!Mks&1Nklfu*kX%?MHWHa z{RCQAS^5cV`~nu1R$`%rvIv4!2HdSIf?G`fjQ9yGl4ruid4FsYScaLfp7OlIk9!{X zlC>5^3d8Ua!0*v$^sO+ElT&22+wH53M&pB&at7e?ML>TnZx9h_t+yCs1Ym3J{THa) z?e4W&ttS9*zOoSFSrkRrF9Z@o9QwZhnK5=HA97vy8WEicA#QC15fKGJ@QN{JjWNes zYh|s4wN?XwG3Fg(Y@2ibVk1ZhaidnNZO`ZPmvJ1QB}tN`Y5Lk2^Be%;IR0piIR>!P zY&Hu&-&uc6bdQK2rTnsf7z_pv&j*b$eIh!lR4NAm-WE>edEO-=0udFi0{}3_+*Ms( zT1`rMs+2;#UOy@W0XP5v&iVIJkk-0Co6UatzW=z>>Dm&?;E%N`|3l9ctP{L%J$J$E{t-X@|Q$8r8@txv||@ef;e-7EbAh6uR4{Fm-1 P00000NkvXXu0mjfC@AMs delta 360 zcmV-u0hj*31e^mQiBL{Q4GJ0x0000DNk~Le0000C0000C2nGNE09JKe=aC^B3M&8r z04o9UejYfHMks$7NklTWw>j;saQu5tJ0Mns(ce2}m-NYat_q4Y;22yL@mC7Z8#BCv*x5Ar@Jd9d0am zo_9?tz5G+i^Zb-^K1W0V0N|X@(=P$WltVLc}LZ>B&d{00$9wnx-iTA*3jZ`?4$_2q8pk{SE-T0O0%zh-d(y zbsT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1Q}F{(iY!R^I!kEX&q^f&d^%k|`0r_xt^qQxRbEkA5_j e3Phy+4fF+S;ky}D67fg?0000V91sya0(_|ZKLe{dNRs45DHYDSG3K%nk*u}0uItm) zfKqD17~2XVp1k)IhM{xLO~Wuuobv+!oUTqPilX408?AS>j^kKIQS>aOTr}I=lR#7=@~+ZUE8)B=bV>P z9&Y(y>2YbAz5)Q0W%+i?-6;S7AmVYU{;R@YI0Ne?V!c&7uq6Nh002ovPDHLkV1nset_can_focus(false); - - if (useEnabled) { - statusImage = Gtk::manage(new Gtk::Image(disabledPBuf)); - Gtk::EventBox *imageEvBox = Gtk::manage(new Gtk::EventBox()); - imageEvBox->add(*statusImage); - imageEvBox->set_above_child(true); - imageEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_enabled_change) ); - headerHBox->pack_start(*imageEvBox, Gtk::PACK_SHRINK, 0); - } - else { - statusImage = Gtk::manage(new Gtk::Image(openedPBuf)); - headerHBox->pack_start(*statusImage, Gtk::PACK_SHRINK, 0); - } - statusImage->set_can_focus(false); - - if (titleWidget) { - headerHBox->pack_start(*titleWidget, Gtk::PACK_EXPAND_WIDGET, 0); - headerWidget = titleWidget; - } - - titleEvBox = Gtk::manage(new Gtk::EventBox()); - titleEvBox->set_name("MyExpanderTitle"); - titleEvBox->add(*headerHBox); - titleEvBox->set_above_child(false); // this is the key! By making it below the child, they will get the events first. - titleEvBox->set_can_focus(false); - - pack_start(*titleEvBox, Gtk::PACK_EXPAND_WIDGET, 0); - - updateStyle(); - titleEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_toggle) ); - titleEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave), false); - titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave), false); -} - -MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) : - enabled(false), inconsistent(false), flushEvent(false), expBox(NULL), - child(NULL), headerWidget(NULL), statusImage(NULL), - label(NULL), useEnabled(useEnabled) -{ - set_spacing(options.slimUI ? 0 : 2); - set_name("MyExpander"); - set_can_focus(false); - - headerHBox = Gtk::manage( new Gtk::HBox()); - headerHBox->set_can_focus(false); - - - if (useEnabled) { - statusImage = Gtk::manage(new Gtk::Image(disabledPBuf)); - Gtk::EventBox *imageEvBox = Gtk::manage(new Gtk::EventBox()); - imageEvBox->add(*statusImage); - imageEvBox->set_above_child(true); - imageEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_enabled_change) ); - headerHBox->pack_start(*imageEvBox, Gtk::PACK_SHRINK, 0); - } - else { - statusImage = Gtk::manage(new Gtk::Image(openedPBuf)); - headerHBox->pack_start(*statusImage, Gtk::PACK_SHRINK, 0); - } - statusImage->set_can_focus(false); - - Glib::ustring str("-"); - if (!titleLabel.empty()) - str = titleLabel; - label = Gtk::manage(new Gtk::Label()); - label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); - label->set_markup(Glib::ustring("") + escapeHtmlChars(titleLabel) + Glib::ustring("")); - headerHBox->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0); - - titleEvBox = Gtk::manage(new Gtk::EventBox()); - titleEvBox->set_name("MyExpanderTitle"); - titleEvBox->add(*headerHBox); - titleEvBox->set_above_child(false); // this is the key! By make it below the child, they will get the events first. - titleEvBox->set_can_focus(false); - - pack_start(*titleEvBox, Gtk::PACK_EXPAND_WIDGET, 0); - - updateStyle(); - titleEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_toggle)); - titleEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave), false); - titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave), false); -} - ExpanderBox::ExpanderBox( Gtk::Container *p):pC(p) { set_name ("ExpanderBox"); updateStyle(); @@ -529,7 +427,113 @@ void ExpanderBox::hideBox() { Gtk::EventBox::hide(); } -bool MyExpander::on_enter_leave (GdkEventCrossing* event) { +void MyExpander::init() { + inconsistentPBuf = Gdk::Pixbuf::create_from_file(RTImage::findIconAbsolutePath("expanderInconsistent.png")); + enabledPBuf = Gdk::Pixbuf::create_from_file(RTImage::findIconAbsolutePath("expanderEnabled.png")); + disabledPBuf = Gdk::Pixbuf::create_from_file(RTImage::findIconAbsolutePath("expanderDisabled.png")); + openedPBuf = Gdk::Pixbuf::create_from_file(RTImage::findIconAbsolutePath("expanderOpened.png")); + closedPBuf = Gdk::Pixbuf::create_from_file(RTImage::findIconAbsolutePath("expanderClosed.png")); +} + +MyExpander::MyExpander(bool useEnabled, Gtk::Widget* titleWidget) : + enabled(false), inconsistent(false), flushEvent(false), expBox(NULL), + child(NULL), headerWidget(NULL), statusImage(NULL), + label(NULL), useEnabled(useEnabled) +{ + set_spacing(options.slimUI ? 0 : 2); + set_name("MyExpander"); + set_can_focus(false); + + headerHBox = Gtk::manage( new Gtk::HBox()); + headerHBox->set_can_focus(false); + + if (useEnabled) { + statusImage = Gtk::manage(new Gtk::Image(disabledPBuf)); + imageEvBox = Gtk::manage(new Gtk::EventBox()); + imageEvBox->add(*statusImage); + imageEvBox->set_above_child(true); + imageEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_enabled_change) ); + imageEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_enable), false ); + imageEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_enable), false ); + headerHBox->pack_start(*imageEvBox, Gtk::PACK_SHRINK, 0); + } + else { + statusImage = Gtk::manage(new Gtk::Image(openedPBuf)); + headerHBox->pack_start(*statusImage, Gtk::PACK_SHRINK, 0); + } + statusImage->set_can_focus(false); + + if (titleWidget) { + headerHBox->pack_start(*titleWidget, Gtk::PACK_EXPAND_WIDGET, 0); + headerWidget = titleWidget; + } + + titleEvBox = Gtk::manage(new Gtk::EventBox()); + titleEvBox->set_name("MyExpanderTitle"); + titleEvBox->add(*headerHBox); + titleEvBox->set_above_child(false); // this is the key! By making it below the child, they will get the events first. + titleEvBox->set_can_focus(false); + + pack_start(*titleEvBox, Gtk::PACK_EXPAND_WIDGET, 0); + + updateStyle(); + titleEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_toggle) ); + titleEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false); + titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false); +} + +MyExpander::MyExpander(bool useEnabled, Glib::ustring titleLabel) : + enabled(false), inconsistent(false), flushEvent(false), expBox(NULL), + child(NULL), headerWidget(NULL), statusImage(NULL), + label(NULL), useEnabled(useEnabled) +{ + set_spacing(options.slimUI ? 0 : 2); + set_name("MyExpander"); + set_can_focus(false); + + headerHBox = Gtk::manage( new Gtk::HBox()); + headerHBox->set_can_focus(false); + + + if (useEnabled) { + statusImage = Gtk::manage(new Gtk::Image(disabledPBuf)); + imageEvBox = Gtk::manage(new Gtk::EventBox()); + imageEvBox->add(*statusImage); + imageEvBox->set_above_child(true); + imageEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_enabled_change) ); + imageEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_enable), false ); + imageEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_enable), false ); + headerHBox->pack_start(*imageEvBox, Gtk::PACK_SHRINK, 0); + } + else { + statusImage = Gtk::manage(new Gtk::Image(openedPBuf)); + headerHBox->pack_start(*statusImage, Gtk::PACK_SHRINK, 0); + } + statusImage->set_can_focus(false); + + Glib::ustring str("-"); + if (!titleLabel.empty()) + str = titleLabel; + label = Gtk::manage(new Gtk::Label()); + label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER); + label->set_markup(Glib::ustring("") + escapeHtmlChars(titleLabel) + Glib::ustring("")); + headerHBox->pack_start(*label, Gtk::PACK_EXPAND_WIDGET, 0); + + titleEvBox = Gtk::manage(new Gtk::EventBox()); + titleEvBox->set_name("MyExpanderTitle"); + titleEvBox->add(*headerHBox); + titleEvBox->set_above_child(false); // this is the key! By make it below the child, they will get the events first. + titleEvBox->set_can_focus(false); + + pack_start(*titleEvBox, Gtk::PACK_EXPAND_WIDGET, 0); + + updateStyle(); + titleEvBox->signal_button_release_event().connect( sigc::mem_fun(this, & MyExpander::on_toggle)); + titleEvBox->signal_enter_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false); + titleEvBox->signal_leave_notify_event().connect( sigc::mem_fun(this, & MyExpander::on_enter_leave_title), false); +} + +bool MyExpander::on_enter_leave_title (GdkEventCrossing* event) { if (is_sensitive()) { if (event->type == GDK_ENTER_NOTIFY) { titleEvBox->set_state(Gtk::STATE_PRELIGHT); @@ -543,6 +547,20 @@ bool MyExpander::on_enter_leave (GdkEventCrossing* event) { return true; } +bool MyExpander::on_enter_leave_enable (GdkEventCrossing* event) { + if (is_sensitive()) { + if (event->type == GDK_ENTER_NOTIFY) { + imageEvBox->set_state(Gtk::STATE_PRELIGHT); + queue_draw(); + } + else if (event->type == GDK_LEAVE_NOTIFY) { + imageEvBox->set_state(Gtk::STATE_NORMAL); + queue_draw(); + } + } + return true; +} + void MyExpander::updateStyle() { headerHBox->set_spacing(options.slimUI ? 2 : 5); headerHBox->set_border_width(options.slimUI ? 1 : 2); diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index bc6c52b5e..960401a2e 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -126,13 +126,16 @@ private: Gtk::HBox *headerHBox; bool flushEvent; /// Flag to control the weird event mechanism of Gtk (please prove me wrong!) ExpanderBox* expBox; /// Frame that includes the child and control its visibility + Gtk::EventBox *imageEvBox; /// Enable/Disable or Open/Close arrow event box /// Triggered on opened/closed event bool on_toggle(GdkEventButton* event); /// Triggered on enabled/disabled change -> will emit a toggle event to the connected objects bool on_enabled_change(GdkEventButton* event); - /// Used to handle the colored background - bool on_enter_leave (GdkEventCrossing* event); + /// Used to handle the colored background for the whole Title + bool on_enter_leave_title (GdkEventCrossing* event); + /// Used to handle the colored background for the Enable button + bool on_enter_leave_enable (GdkEventCrossing* event); /// Update the style of this widget, depending in the "slim" option void updateStyle(); diff --git a/tools/source_icons/scalable/expanderClosed.file b/tools/source_icons/scalable/expanderClosed.file index 42abd041b..039041106 100644 --- a/tools/source_icons/scalable/expanderClosed.file +++ b/tools/source_icons/scalable/expanderClosed.file @@ -1 +1 @@ -expanderClosed.png,w12,actions +expanderClosed.png,w18,actions diff --git a/tools/source_icons/scalable/expanderClosed.svg b/tools/source_icons/scalable/expanderClosed.svg index a7dca0cfc..ca47969f8 100644 --- a/tools/source_icons/scalable/expanderClosed.svg +++ b/tools/source_icons/scalable/expanderClosed.svg @@ -10,7 +10,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1000" + width="1300" height="1000" id="svg2" sodipodi:version="0.32" @@ -307,20 +307,20 @@ inkscape:collect="always" xlink:href="#linearGradient3625" id="linearGradient3631" - x1="-274.27156" - y1="34.445074" - x2="334.30281" - y2="34.445074" + x1="-274.27155" + y1="34.445072" + x2="334.3028" + y2="34.445072" gradientUnits="userSpaceOnUse" /> + gradientUnits="userSpaceOnUse" /> + + + + + + image/svg+xml - + @@ -683,19 +715,23 @@ - - + + + + diff --git a/tools/source_icons/scalable/expanderDisabled.file b/tools/source_icons/scalable/expanderDisabled.file index 28eb79392..e2cc81d31 100644 --- a/tools/source_icons/scalable/expanderDisabled.file +++ b/tools/source_icons/scalable/expanderDisabled.file @@ -1 +1 @@ -expanderDisabled.png,w12,actions +expanderDisabled.png,w18,actions diff --git a/tools/source_icons/scalable/expanderDisabled.svg b/tools/source_icons/scalable/expanderDisabled.svg index 5e82ba4d8..1826d71f7 100644 --- a/tools/source_icons/scalable/expanderDisabled.svg +++ b/tools/source_icons/scalable/expanderDisabled.svg @@ -10,7 +10,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1000" + width="1300" height="1000" id="svg2" sodipodi:version="0.32" @@ -283,20 +283,20 @@ inkscape:collect="always" xlink:href="#linearGradient3625" id="linearGradient3631" - x1="-274.27156" - y1="34.445074" - x2="334.30281" - y2="34.445074" + x1="-274.27155" + y1="34.445072" + x2="334.3028" + y2="34.445072" gradientUnits="userSpaceOnUse" /> + d="m -88.73454,-132.23737 c -76.58256,42.130688 -128.60399,123.6612321 -128.60399,217.10952 0,136.48913 110.97734,247.55344 247.359582,247.55344 136.382238,0 247.384578,-111.06431 247.384578,-247.55344 0,-93.4496955 -52.04453,-174.9794 -128.62899,-217.10952 l 0,46.803955 c 53.62053,37.471077 88.61052,99.700722 88.61052,170.305565 0,114.85813 -92.59794,207.52864 -207.366108,207.52864 -114.768164,0 -207.366112,-92.67051 -207.366112,-207.52864 0,-70.604843 34.98281,-132.834488 88.61052,-170.305565 l 0,-46.803955 z" + id="path3832" + inkscape:connector-curvature="0" /> diff --git a/tools/source_icons/scalable/expanderEnabled.file b/tools/source_icons/scalable/expanderEnabled.file index 55afa72ed..790e109da 100644 --- a/tools/source_icons/scalable/expanderEnabled.file +++ b/tools/source_icons/scalable/expanderEnabled.file @@ -1 +1 @@ -expanderEnabled.png,w12,actions +expanderEnabled.png,w18,actions diff --git a/tools/source_icons/scalable/expanderEnabled.svg b/tools/source_icons/scalable/expanderEnabled.svg index 318e61341..1407ca335 100644 --- a/tools/source_icons/scalable/expanderEnabled.svg +++ b/tools/source_icons/scalable/expanderEnabled.svg @@ -10,12 +10,12 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1000" + width="1300" height="1000" id="svg2" sodipodi:version="0.32" inkscape:version="0.48.3.1 r9886" - sodipodi:docname="crop.svg" + sodipodi:docname="expanderEnabled.svg" inkscape:export-filename="/home/philippe/devel/rawtherapee/icons/NewIcons/crop22.png" inkscape:export-xdpi="2.1600001" inkscape:export-ydpi="2.1600001" @@ -283,37 +283,21 @@ inkscape:collect="always" xlink:href="#linearGradient3625" id="linearGradient3631" - x1="-274.27156" - y1="34.445074" - x2="334.30281" - y2="34.445074" + x1="-274.27155" + y1="34.445072" + x2="334.3028" + y2="34.445072" gradientUnits="userSpaceOnUse" /> - - - - - - + id="filter4171" + color-interpolation-filters="sRGB"> + height="1.2280345" + color-interpolation-filters="sRGB"> + + + + + - - - - - - - - + + + + diff --git a/tools/source_icons/scalable/expanderInconsistent.file b/tools/source_icons/scalable/expanderInconsistent.file index 594ef14d9..0ce1f9a2e 100644 --- a/tools/source_icons/scalable/expanderInconsistent.file +++ b/tools/source_icons/scalable/expanderInconsistent.file @@ -1 +1 @@ -expanderInconsistent.png,w12,actions +expanderInconsistent.png,w18,actions diff --git a/tools/source_icons/scalable/expanderInconsistent.svg b/tools/source_icons/scalable/expanderInconsistent.svg index 176b900df..167b86b66 100644 --- a/tools/source_icons/scalable/expanderInconsistent.svg +++ b/tools/source_icons/scalable/expanderInconsistent.svg @@ -10,12 +10,12 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1000" + width="1300" height="1000" id="svg2" sodipodi:version="0.32" inkscape:version="0.48.3.1 r9886" - sodipodi:docname="expanderDisabled.svg" + sodipodi:docname="expanderInconsistent.svg" inkscape:export-filename="/home/philippe/devel/rawtherapee/icons/NewIcons/crop22.png" inkscape:export-xdpi="2.1600001" inkscape:export-ydpi="2.1600001" @@ -283,20 +283,20 @@ inkscape:collect="always" xlink:href="#linearGradient3625" id="linearGradient3631" - x1="-274.27156" - y1="34.445074" - x2="334.30281" - y2="34.445074" + x1="-274.27155" + y1="34.445072" + x2="334.3028" + y2="34.445072" gradientUnits="userSpaceOnUse" /> + inkscape:collect="always" + color-interpolation-filters="sRGB"> @@ -1154,6 +1155,26 @@ y1="-91.573822" x2="71.28112" y2="-91.573822" /> + + image/svg+xml - + @@ -1202,23 +1223,20 @@ transform="matrix(1.5074827,0,0,1.5074827,-9.4212231,-17.89429)"> - - - - + d="M -88.785465,-132.68836 C -165.40086,-90.572569 -217.44459,-9.0709456 -217.44459,84.344206 c 0,136.440714 111.02492,247.465634 247.465635,247.465634 136.440715,0 247.490635,-111.02492 247.490635,-247.465634 0,-93.41656 -52.06684,-174.917327 -128.68413,-217.032566 l 0,46.787414 c 53.64352,37.457766 88.64852,99.665345 88.64852,170.245152 0,114.817384 -92.63765,207.455024 -207.455025,207.455024 -114.817372,0 -207.455025,-92.63764 -207.455025,-207.455024 0,-70.579807 34.99781,-132.787386 88.648515,-170.245152 l 0,-46.787414 z" + id="path3832" + inkscape:connector-curvature="0" /> + + diff --git a/tools/source_icons/scalable/expanderOpened.file b/tools/source_icons/scalable/expanderOpened.file index 7b7d1aad6..c2175efad 100644 --- a/tools/source_icons/scalable/expanderOpened.file +++ b/tools/source_icons/scalable/expanderOpened.file @@ -1 +1 @@ -expanderOpened.png,w12,actions +expanderOpened.png,w18,actions diff --git a/tools/source_icons/scalable/expanderOpened.svg b/tools/source_icons/scalable/expanderOpened.svg index 06d8e8bf9..c00fe2d85 100644 --- a/tools/source_icons/scalable/expanderOpened.svg +++ b/tools/source_icons/scalable/expanderOpened.svg @@ -10,7 +10,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1000" + width="1300" height="1000" id="svg2" sodipodi:version="0.32" @@ -307,20 +307,20 @@ inkscape:collect="always" xlink:href="#linearGradient3625" id="linearGradient3631" - x1="-274.27156" - y1="34.445074" - x2="334.30281" - y2="34.445074" + x1="-274.27155" + y1="34.445072" + x2="334.3028" + y2="34.445072" gradientUnits="userSpaceOnUse" /> + - - + + + +