summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f9c216f)
raw | patch | inline | side by side (parent: f9c216f)
| author | joncruz <joncruz@users.sourceforge.net> | |
| Thu, 21 Feb 2008 06:54:33 +0000 (06:54 +0000) | ||
| committer | joncruz <joncruz@users.sourceforge.net> | |
| Thu, 21 Feb 2008 06:54:33 +0000 (06:54 +0000) |
index d90137a04a6f59334ae82f952a57c745672b4adc..145346af3026f595c20fb199284b2f82d7801ada 100644 (file)
#define PREVIEW_SIZE_LAST PREVIEW_SIZE_HUGE
#define PREVIEW_SIZE_NEXTFREE (PREVIEW_SIZE_HUGE + 1)
+#define PREVIEW_MAX_RATIO 500
static void eek_preview_class_init( EekPreviewClass *klass );
static void eek_preview_init( EekPreview *preview );
width *= 3;
}
+ if ( preview->_ratio != 100 ) {
+ width = (width * preview->_ratio) / 100;
+ if ( width < 0 ) {
+ width = 1;
+ }
+ }
+
req->width = width;
req->height = height;
}
@@ -582,7 +590,7 @@ void eek_preview_set_focus_on_click( EekPreview* preview, gboolean focus_on_clic
}
}
-void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewType view, PreviewSize size )
+void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio )
{
preview->_prevstyle = prevstyle;
preview->_view = view;
@@ -592,6 +600,11 @@ void eek_preview_set_details( EekPreview* preview, PreviewStyle prevstyle, ViewT
}
preview->_size = size;
+ if ( ratio > PREVIEW_MAX_RATIO ) {
+ ratio = PREVIEW_MAX_RATIO;
+ }
+ preview->_ratio = ratio;
+
gtk_widget_queue_draw(GTK_WIDGET(preview));
}
preview->_prevstyle = PREVIEW_STYLE_ICON;
preview->_view = VIEW_TYPE_LIST;
preview->_size = PREVIEW_SIZE_SMALL;
+ preview->_ratio = 100;
/*
GdkColor color = {0};
index b2f8359f344a854ffc1abeb5eff9ac0668dcf97b..ee99125af35dc9b982316fa8e3bfd5aa1987c996 100644 (file)
PreviewStyle _prevstyle;
ViewType _view;
PreviewSize _size;
+ guint _ratio;
guint _linked;
};
GType eek_preview_get_type(void) G_GNUC_CONST;
GtkWidget* eek_preview_new(void);
-void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size );
+void eek_preview_set_details( EekPreview* splat, PreviewStyle prevstyle, ViewType view, PreviewSize size, guint ratio );
void eek_preview_set_color( EekPreview* splat, int r, int g, int b );
void eek_preview_set_linked( EekPreview* splat, LinkType link );
index 28c21e270d8dce6f8aba35c4a9cb8e9f0ab9bbfd..68e6fff0d3f3e5324b4d59e39681b9a8b91d6a64 100644 (file)
--- a/src/dialogs/swatches.cpp
+++ b/src/dialogs/swatches.cpp
}
-Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewSize size)
+Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewSize size, guint ratio)
{
Gtk::Widget* widget = 0;
if ( style == PREVIEW_STYLE_BLURB ) {
@@ -522,7 +522,7 @@ Gtk::Widget* ColorItem::getPreview(PreviewStyle style, ViewType view, ::PreviewS
eek_preview_set_color( preview, (def.getR() << 8) | def.getR(), (def.getG() << 8) | def.getG(), (def.getB() << 8) | def.getB());
- eek_preview_set_details( preview, (::PreviewStyle)style, (::ViewType)view, (::PreviewSize)size );
+ eek_preview_set_details( preview, (::PreviewStyle)style, (::ViewType)view, (::PreviewSize)size, ratio );
eek_preview_set_linked( preview, (LinkType)((_linkSrc ? PREVIEW_LINK_IN:0)
| (_listeners.empty() ? 0:PREVIEW_LINK_OUT)
| (_isLive ? PREVIEW_LINK_OTHER:0)) );
diff --git a/src/dialogs/swatches.h b/src/dialogs/swatches.h
index f21aec1ff6ce156e0c1e44bab7920fbb0398fc7e..310272b1c49003200eb2c5d690ad46054220b8a3 100644 (file)
--- a/src/dialogs/swatches.h
+++ b/src/dialogs/swatches.h
virtual ColorItem &operator=(ColorItem const &other);
virtual Gtk::Widget* getPreview(PreviewStyle style,
ViewType view,
- ::PreviewSize size);
+ ::PreviewSize size,
+ guint ratio);
void buttonClicked(bool secondary = false);
ColorDef def;
index 9415ca144bc9c31899190047c3b9d65fb558c741..12783c02250edf263efd1481e472c4a12d2d4153 100644 (file)
" </group>\n"
" <group id=\"colorselector\" page=\"0\"/>\n"
" <group id=\"embedded\">\n"
-" <group id=\"swatches\"\n"
+" <group id=\"swatches\"\n"
" panel_size=\"1\"\n"
" panel_mode=\"1\"\n"
+" panel_ratio=\"100\"\n"
" panel_wrap=\"0\"\n"
" palette=\"Inkscape default\" />\n"
" </group>\n"
diff --git a/src/ui/previewable.h b/src/ui/previewable.h
index f0c64208252cbc79fec1bc1854327eb682550b04..c517e4f28d1540443d34b0a9b47e4c87afaf9812 100644 (file)
--- a/src/ui/previewable.h
+++ b/src/ui/previewable.h
public:
// TODO need to add some nice parameters
virtual ~Previewable() {}
- virtual Gtk::Widget* getPreview( PreviewStyle style, ViewType view, ::PreviewSize size ) = 0;
+ virtual Gtk::Widget* getPreview( PreviewStyle style, ViewType view, ::PreviewSize size, guint ratio ) = 0;
};
index d12771c90eb32d7bcf52c3cf09e8ef6686571aff..6f02b60a8235b5a42aaf52acc1bfee7f776eaede 100644 (file)
--- a/src/ui/previewfillable.h
+++ b/src/ui/previewfillable.h
virtual void addPreview( Previewable* preview ) = 0;
virtual void freezeUpdates() = 0;
virtual void thawUpdates() = 0;
- virtual void setStyle( ::PreviewSize size, ViewType type) = 0;
+ virtual void setStyle( ::PreviewSize size, ViewType type, guint ratio) = 0;
virtual void setOrientation( Gtk::AnchorType how ) = 0;
virtual ::PreviewSize getPreviewSize() const = 0;
virtual ViewType getPreviewType() const = 0;
+ virtual guint getPreviewRatio() const = 0;
virtual void setWrap( bool b ) = 0;
virtual bool getWrap() const = 0;
};
index 764890395666806055162cfb3233467c79ab5ac3..da991e1dfc85756e7abf220be1c5ba08325ca41c 100644 (file)
--- a/src/ui/previewholder.cpp
+++ b/src/ui/previewholder.cpp
_updatesFrozen(false),
_anchor(Gtk::ANCHOR_CENTER),
_baseSize(PREVIEW_SIZE_SMALL),
+ _ratio(100),
_view(VIEW_TYPE_LIST),
_wrap(false)
{
int i = items.size() - 1;
if ( _view == VIEW_TYPE_LIST ) {
- Gtk::Widget* label = manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize));
- Gtk::Widget* thing = manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize));
+ Gtk::Widget* label = manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio));
+ Gtk::Widget* thing = manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio));
_insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
_insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
} else {
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_GRID, _baseSize));
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_GRID, _baseSize, _ratio));
int width = 1;
int height = 1;
rebuildUI();
}
-void PreviewHolder::setStyle( ::PreviewSize size, ViewType view )
+void PreviewHolder::setStyle( ::PreviewSize size, ViewType view, guint ratio )
{
- if ( size != _baseSize || view != _view ) {
+ if ( size != _baseSize || view != _view || ratio != _ratio ) {
_baseSize = size;
_view = view;
+ _ratio = ratio;
rebuildUI();
}
}
_insides->set_col_spacings( 8 );
for ( unsigned int i = 0; i < items.size(); i++ ) {
- Gtk::Widget* label = manage(items[i]->getPreview(PREVIEW_STYLE_BLURB, _view, _baseSize));
+ Gtk::Widget* label = manage(items[i]->getPreview(PREVIEW_STYLE_BLURB, _view, _baseSize, _ratio));
//label->set_alignment(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize));
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio));
_insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND );
_insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK );
int height = 1;
for ( unsigned int i = 0; i < items.size(); i++ ) {
- Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize));
+ Gtk::Widget* thing = manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio));
if ( !_insides ) {
calcGridSize( thing, items.size(), width, height );
diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h
index e3515c987a2d48139a778487cca69add22f41311..812d4b27d0259d77008f3e50c47e11f20cfeef80 100644 (file)
--- a/src/ui/previewholder.h
+++ b/src/ui/previewholder.h
virtual void addPreview( Previewable* preview );
virtual void freezeUpdates();
virtual void thawUpdates();
- virtual void setStyle( ::PreviewSize size, ViewType view );
+ virtual void setStyle( ::PreviewSize size, ViewType view, guint ratio );
virtual void setOrientation( Gtk::AnchorType how );
virtual int getColumnPref() const { return _prefCols; }
virtual void setColumnPref( int cols );
virtual ::PreviewSize getPreviewSize() const { return _baseSize; }
virtual ViewType getPreviewType() const { return _view; }
+ virtual guint getPreviewRatio() const { return _ratio; }
virtual void setWrap( bool b );
virtual bool getWrap() const { return _wrap; }
bool _updatesFrozen;
Gtk::AnchorType _anchor;
::PreviewSize _baseSize;
+ guint _ratio;
ViewType _view;
bool _wrap;
};
index 51b289ddf19d5a4a98814237600b965b9151f662..c01cb7768a6e4a58021403a5df2b3761b18e9258 100644 (file)
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
static const int PANEL_SETTING_SIZE = 0;
static const int PANEL_SETTING_MODE = 1;
-static const int PANEL_SETTING_WRAP = 2;
-static const int PANEL_SETTING_NEXTFREE = 3;
+static const int PANEL_SETTING_SHAPE = 2;
+static const int PANEL_SETTING_WRAP = 3;
+static const int PANEL_SETTING_NEXTFREE = 4;
void Panel::prep() {
panel_wrap = prefs_get_int_attribute_limited( _prefs_path, "panel_wrap", 0, 0, 1 );
}
+ guint panel_ratio = 100;
+ if (_prefs_path) {
+ panel_ratio = prefs_get_int_attribute_limited( _prefs_path, "panel_ratio", 100, 0, 500 );
+ }
+
_menu = new Gtk::Menu();
{
const char *things[] = {
{
Glib::ustring type_label(_("Shape"));
+ Glib::ustring ellipsis(_("..."));
Glib::ustring shape_1_label(_("Tall"));
Glib::ustring shape_2_label(_("Square"));
Glib::ustring shape_3_label(_("Wide"));
Gtk::RadioMenuItem::Group shapeGroup;
- Gtk::RadioMenuItem *shape_1 = manage(new Gtk::RadioMenuItem(shapeGroup, shape_1_label));
- Gtk::RadioMenuItem *shape_2 = manage(new Gtk::RadioMenuItem(shapeGroup, shape_2_label));
- Gtk::RadioMenuItem *shape_3 = manage(new Gtk::RadioMenuItem(shapeGroup, shape_3_label));
- type_menu->append(*shape_1);
- type_menu->append(*shape_2);
- type_menu->append(*shape_3);
-
- shape_2->set_active(true);
+ Glib::ustring* labels[] = {&ellipsis, &shape_1_label, &ellipsis, &shape_2_label, &ellipsis, &shape_3_label};
+ guint values[] = {0, 25, 50, 100, 200, 400};
+ guint hot_index = 3;
+ for ( guint i = 0; i < G_N_ELEMENTS(labels); ++i ) {
+ // Assume all values are in increasing order
+ if ( values[i] <= panel_ratio ) {
+ hot_index = i;
+ }
+ }
+ for ( guint i = 0; i < G_N_ELEMENTS(labels); ++i ) {
+ Gtk::RadioMenuItem *single = manage(new Gtk::RadioMenuItem(shapeGroup, *(labels[i])));
+ type_menu->append(*single);
+ if ( i <= hot_index ) {
+ single->set_active(true);
+ }
+ single->signal_activate().connect(sigc::bind<int, int>(sigc::mem_fun(*this, &Panel::_bounceCall), PANEL_SETTING_SHAPE, values[i]));
+ }
}
sep = manage(new Gtk::SeparatorMenuItem());
_bounceCall(PANEL_SETTING_SIZE, panel_size);
_bounceCall(PANEL_SETTING_MODE, panel_mode);
+ _bounceCall(PANEL_SETTING_SHAPE, panel_ratio);
_bounceCall(PANEL_SETTING_WRAP, panel_wrap);
}
if (_prefs_path) {
panel_wrap = prefs_get_int_attribute_limited(_prefs_path, "panel_wrap", 0, 0, 1 );
}
+ guint panel_ratio = 100;
+ if (_prefs_path) {
+ panel_ratio = prefs_get_int_attribute_limited(_prefs_path, "panel_ratio", 000, 0, 500 );
+ }
_bounceCall(PANEL_SETTING_SIZE, panel_size);
_bounceCall(PANEL_SETTING_MODE, panel_mode);
+ _bounceCall(PANEL_SETTING_SHAPE, panel_ratio);
_bounceCall(PANEL_SETTING_WRAP, panel_wrap);
}
}
if (_fillable) {
ViewType curr_type = _fillable->getPreviewType();
+ guint curr_ratio = _fillable->getPreviewRatio();
switch (j) {
case 0:
{
- _fillable->setStyle(::PREVIEW_SIZE_TINY, curr_type);
+ _fillable->setStyle(::PREVIEW_SIZE_TINY, curr_type, curr_ratio);
}
break;
case 1:
{
- _fillable->setStyle(::PREVIEW_SIZE_SMALL, curr_type);
+ _fillable->setStyle(::PREVIEW_SIZE_SMALL, curr_type, curr_ratio);
}
break;
case 2:
{
- _fillable->setStyle(::PREVIEW_SIZE_MEDIUM, curr_type);
+ _fillable->setStyle(::PREVIEW_SIZE_MEDIUM, curr_type, curr_ratio);
}
break;
case 3:
{
- _fillable->setStyle(::PREVIEW_SIZE_BIG, curr_type);
+ _fillable->setStyle(::PREVIEW_SIZE_BIG, curr_type, curr_ratio);
}
break;
case 4:
{
- _fillable->setStyle(::PREVIEW_SIZE_HUGE, curr_type);
+ _fillable->setStyle(::PREVIEW_SIZE_HUGE, curr_type, curr_ratio);
}
break;
default:
}
if (_fillable) {
::PreviewSize curr_size = _fillable->getPreviewSize();
+ guint curr_ratio = _fillable->getPreviewRatio();
switch (j) {
case 0:
{
- _fillable->setStyle(curr_size, VIEW_TYPE_LIST);
+ _fillable->setStyle(curr_size, VIEW_TYPE_LIST, curr_ratio);
}
break;
case 1:
{
- _fillable->setStyle(curr_size, VIEW_TYPE_GRID);
+ _fillable->setStyle(curr_size, VIEW_TYPE_GRID, curr_ratio);
}
break;
default:
}
}
break;
+ case PANEL_SETTING_SHAPE:
+ if (_prefs_path) {
+ prefs_set_int_attribute (_prefs_path, "panel_ratio", j);
+ }
+ if ( _fillable ) {
+ ViewType curr_type = _fillable->getPreviewType();
+ ::PreviewSize curr_size = _fillable->getPreviewSize();
+ _fillable->setStyle(curr_size, curr_type, j);
+ }
+ break;
case PANEL_SETTING_WRAP:
if (_prefs_path) {
prefs_set_int_attribute (_prefs_path, "panel_wrap", j ? 1 : 0);