summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-06-13 16:06:01 +0000
committertavmjong-free <tavmjong@free.fr>2014-06-13 16:06:01 +0000
commitba2d7d753aec7f4c356d3fec1f07f79db5e56eec (patch)
tree8d1d802b2b406312bfcef56b9957fc9d76414a4a
parentDisplay symbols in document order. (diff)
downloadinkscape-ba2d7d753aec7f4c356d3fec1f07f79db5e56eec.tar.gz
inkscape-ba2d7d753aec7f4c356d3fec1f07f79db5e56eec.zip
Allow symbol zooming independent of icon screen size.
(bzr r13425)
-rw-r--r--share/icons/icons.svg23
-rw-r--r--src/ui/dialog/symbols.cpp72
-rw-r--r--src/ui/dialog/symbols.h9
3 files changed, 91 insertions, 13 deletions
diff --git a/share/icons/icons.svg b/share/icons/icons.svg
index 3d4223fd7..133fad72f 100644
--- a/share/icons/icons.svg
+++ b/share/icons/icons.svg
@@ -3856,6 +3856,29 @@ http://www.inkscape.org/</dc:description>
<path transform="matrix(2.894146,0,0,2.833322,-656.743,-353.6308)" d="m 341.3078,163.0209 c 0,2.2716 -1.7745,4.113 -3.9635,4.113 l 0,-4.113 z" sodipodi:ry="4.113043" sodipodi:rx="3.963478" sodipodi:cy="163.0209" sodipodi:cx="337.3443" id="path11111" style="color:#000000;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:#99b7d6;fill-opacity:0.7019608;fill-rule:evenodd;stroke:#000000;stroke-width:0.3492142;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto" sodipodi:type="arc" sodipodi:start="0" sodipodi:end="1.570796" />
<path sodipodi:type="arc" style="color:#000000;color-interpolation:sRGB;color-interpolation-filters:linearRGB;fill:none;stroke:#c80000;stroke-width:0.9166215;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:0.9166215, 0.9166215;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;clip-rule:nonzero;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto" id="path11051-8" sodipodi:cx="337.3443" sodipodi:cy="163.0209" sodipodi:rx="3.963478" sodipodi:ry="4.113043" d="m 341.3078,163.0209 c 0,2.2716 -1.7745,4.113 -3.9635,4.113 -2.189,0 -3.9635,-1.8414 -3.9635,-4.113 0,-2.2716 1.7745,-4.113 3.9635,-4.113 2.189,0 3.9635,1.8414 3.9635,4.113 z" transform="matrix(1.101789,0,0,1.080243,-44.03243,-59.90819)" />
</g>
+<g id="pack-more">
+<rect y="235" x="350" height="16" width="16" style="fill:none" />
+<g style="fill:#98b6d6;fill-opacity:0.70;stroke:#000000">
+ <rect x="351.5" y="236.5" width="3" height="3"/>
+ <rect x="356.5" y="236.5" width="3" height="3"/>
+ <rect x="361.5" y="236.5" width="3" height="3"/>
+ <rect x="351.5" y="241.5" width="3" height="3"/>
+ <rect x="356.5" y="241.5" width="3" height="3"/>
+ <rect x="361.5" y="241.5" width="3" height="3"/>
+ <rect x="351.5" y="246.5" width="3" height="3"/>
+ <rect x="356.5" y="246.5" width="3" height="3"/>
+ <rect x="361.5" y="246.5" width="3" height="3"/>
+</g>
+</g>
+<g id="pack-less">
+<rect y="215" x="350" height="16" width="16" style="fill:none" />
+<g style="fill:#98b6d6;fill-opacity:0.70;stroke:#000000">
+ <rect x="351.5" y="216.5" width="5" height="5"/>
+ <rect x="359.5" y="216.5" width="5" height="5"/>
+ <rect x="351.5" y="224.5" width="5" height="5"/>
+ <rect x="359.5" y="224.5" width="5" height="5"/>
+</g>
+</g>
<g id="boundingbox_top_left" transform="translate(998.14709,-107)" inkscape:label="#boundingbox_top_left" style="display:inline">
<rect y="475" x="-262.14709" height="16" width="16" id="rect7835" style="fill:none;stroke:none" />
<path sodipodi:nodetypes="ccccccc" inkscape:connector-curvature="0" id="path7837" d="m -257.64708,489.5 0,-10 10,0 0,2 -8,0 0,8 z" style="fill:#ffffff;fill-opacity:1;stroke:#888a85;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1" />
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 0dfd915fe..c58df864c 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -219,25 +219,27 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
Gtk::Label* spacer = Gtk::manage(new Gtk::Label(""));
tools->pack_start(* Gtk::manage(spacer));
- in_sizes = 2; // Default 32px
+ // Pack size (controls display area)
+ pack_size = 2; // Default 32px
button = Gtk::manage(new Gtk::Button());
button->add(*Gtk::manage(Glib::wrap(
- sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-bigger")))) );
- button->set_tooltip_text(_("Make Icons bigger by zooming in."));
+ sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("pack-more")))) );
+ button->set_tooltip_text(_("Display more icons in row."));
button->set_relief( Gtk::RELIEF_NONE );
button->set_focus_on_click( false );
- button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomin));
+ button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::packmore));
tools->pack_start(* button, Gtk::PACK_SHRINK);
button = Gtk::manage(new Gtk::Button());
button->add(*Gtk::manage(Glib::wrap(
- sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-smaller")))) );
- button->set_tooltip_text(_("Make Icons smaller by zooming out."));
+ sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("pack-less")))) );
+ button->set_tooltip_text(_("Display fewer icons in row."));
button->set_relief( Gtk::RELIEF_NONE );
button->set_focus_on_click( false );
- button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout));
+ button->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::packless));
tools->pack_start(* button, Gtk::PACK_SHRINK);
+ // Toggle scale to fit on/off
fitSymbol = Gtk::manage(new Gtk::ToggleButton());
fitSymbol->add(*Gtk::manage(Glib::wrap(
sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-fit")))) );
@@ -248,6 +250,28 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
fitSymbol->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::rebuild));
tools->pack_start(* fitSymbol, Gtk::PACK_SHRINK);
+ // Render size (scales symbols within display area)
+ scale_factor = 0; // Default 1:1 * pack_size/pack_size default
+ zoomOut = Gtk::manage(new Gtk::Button());
+ zoomOut->add(*Gtk::manage(Glib::wrap(
+ sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-smaller")))) );
+ zoomOut->set_tooltip_text(_("Make symbols smaller by zooming out."));
+ zoomOut->set_relief( Gtk::RELIEF_NONE );
+ zoomOut->set_focus_on_click( false );
+ zoomOut->set_sensitive( false );
+ zoomOut->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomout));
+ tools->pack_start(* zoomOut, Gtk::PACK_SHRINK);
+
+ zoomIn = Gtk::manage(new Gtk::Button());
+ zoomIn->add(*Gtk::manage(Glib::wrap(
+ sp_icon_new (Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("symbol-bigger")))) );
+ zoomIn->set_tooltip_text(_("Make symbols bigger by zooming in."));
+ zoomIn->set_relief( Gtk::RELIEF_NONE );
+ zoomIn->set_focus_on_click( false );
+ zoomIn->set_sensitive( false );
+ zoomIn->signal_clicked().connect(sigc::mem_fun(*this, &SymbolsDialog::zoomin));
+ tools->pack_start(* zoomIn, Gtk::PACK_SHRINK);
+
++row;
/**********************************************************/
@@ -298,22 +322,44 @@ SymbolsDialog& SymbolsDialog::getInstance()
return *new SymbolsDialog();
}
+void SymbolsDialog::packless() {
+ if(pack_size < 4) {
+ pack_size++;
+ rebuild();
+ }
+}
+
+void SymbolsDialog::packmore() {
+ if(pack_size > 0) {
+ pack_size--;
+ rebuild();
+ }
+}
+
void SymbolsDialog::zoomin() {
- if(in_sizes < 4) {
- in_sizes++;
+ if(scale_factor < 4) {
+ scale_factor++;
rebuild();
}
}
void SymbolsDialog::zoomout() {
- if(in_sizes > 0) {
- in_sizes--;
+ if(scale_factor > -8) {
+ scale_factor--;
rebuild();
}
}
void SymbolsDialog::rebuild() {
+ if( fitSymbol->get_active() ) {
+ zoomIn->set_sensitive( false );
+ zoomOut->set_sensitive( false );
+ } else {
+ zoomIn->set_sensitive( true);
+ zoomOut->set_sensitive( true );
+ }
+
store->clear();
Glib::ustring symbolSetString = symbolSet->get_active_text();
@@ -757,7 +803,7 @@ SymbolsDialog::draw_symbol(SPObject *symbol)
previewDocument->ensureUpToDate();
SPItem *item = SP_ITEM(object_temp);
- unsigned psize = SYMBOL_ICON_SIZES[in_sizes];
+ unsigned psize = SYMBOL_ICON_SIZES[pack_size];
Glib::RefPtr<Gdk::Pixbuf> pixbuf(NULL);
// We could use cache here, but it doesn't really work with the structure
@@ -779,6 +825,8 @@ SymbolsDialog::draw_symbol(SPObject *symbol)
if( fitSymbol->get_active() )
scale = psize / std::max(width, height);
+ else
+ scale = pow( 2.0, scale_factor/2.0 ) * psize / 32.0;
pixbuf = Glib::wrap(render_pixbuf(renderDrawing, scale, *dbox, psize));
}
diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h
index 8021fb0c1..5dc1e3cad 100644
--- a/src/ui/dialog/symbols.h
+++ b/src/ui/dialog/symbols.h
@@ -65,6 +65,8 @@ private:
static SymbolColumns *getColumns();
+ void packless();
+ void packmore();
void zoomin();
void zoomout();
void rebuild();
@@ -95,13 +97,18 @@ private:
std::map<Glib::ustring, SPDocument*> symbolSets;
// Index into sizes which is selected
- int in_sizes;
+ int pack_size;
+
+ // Scale factor
+ int scale_factor;
Glib::RefPtr<Gtk::ListStore> store;
Gtk::ComboBoxText* symbolSet;
Gtk::IconView* iconView;
Gtk::Button* addSymbol;
Gtk::Button* removeSymbol;
+ Gtk::Button* zoomIn;
+ Gtk::Button* zoomOut;
Gtk::ToggleButton* fitSymbol;
void setTargetDesktop(SPDesktop *desktop);