summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c243894)
raw | patch | inline | side by side (parent: c243894)
author | Jon A. Cruz <jon@joncruz.org> | |
Tue, 6 Apr 2010 07:29:20 +0000 (00:29 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Tue, 6 Apr 2010 07:29:20 +0000 (00:29 -0700) |
src/ui/dialog/icon-preview.cpp | patch | blob | history | |
src/ui/dialog/tile.cpp | patch | blob | history | |
src/ui/dialog/tile.h | patch | blob | history |
index 088f630314fb1f5dcca0b2b8cb6d92c76168bd84..a210fe1636c6e31dfda968f9088efd23682b349e 100644 (file)
namespace Dialogs {
-IconPreviewPanel&
-IconPreviewPanel::getInstance()
+IconPreviewPanel &IconPreviewPanel::getInstance()
{
- static IconPreviewPanel &instance = *new IconPreviewPanel();
+ IconPreviewPanel *instance = new IconPreviewPanel();
- instance.refreshPreview();
+ instance->refreshPreview();
- return instance;
+ return *instance;
}
//#########################################################################
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index e0191c589d8994e88acdbfaf434e8f46fd2ef57c..6be3465828cc5775490791a0a84d3a2bd9ea8ad5 100644 (file)
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
#include "sp-item.h"
#include "widgets/icon.h"
#include "tile.h"
+#include "desktop.h"
/*
* Sort items by their x co-ordinates, taking account of y (keeps rows intact)
sp_document_ensure_up_to_date(sp_desktop_document(desktop));
Inkscape::Selection *selection = sp_desktop_selection (desktop);
- const GSList *items = selection->itemList();
+ const GSList *items = selection ? selection->itemList() : 0;
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
// require the sorting done before we can calculate row heights etc.
+ g_return_if_fail(selection);
const GSList *items2 = selection->itemList();
GSList *rev = g_slist_copy((GSList *) items2);
GSList *sorted = NULL;
updating = true;
SPDesktop *desktop = getDesktop();
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop ? desktop->selection : 0;
+ g_return_if_fail( selection );
GSList const *items = selection->itemList();
int selcount = g_slist_length((GSList *)items);
// in turn, prevent listener from responding
updating = true;
SPDesktop *desktop = getDesktop();
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop ? desktop->selection : 0;
+ g_return_if_fail(selection);
GSList const *items = selection->itemList();
int selcount = g_slist_length((GSList *)items);
// in turn, prevent listener from responding
updating = true;
SPDesktop *desktop = getDesktop();
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
- const GSList *items = selection->itemList();
- int selcount = g_slist_length((GSList *)items);
-
- if (NoOfColsSpinner.get_value()>1 && NoOfRowsSpinner.get_value()>1){
- // Update the number of rows assuming number of columns wanted remains same.
- double NoOfRows = ceil(selcount / NoOfColsSpinner.get_value());
- NoOfRowsSpinner.set_value(NoOfRows);
-
- // if the selection has less than the number set for one row, reduce it appropriately
- if (selcount<NoOfColsSpinner.get_value()) {
- double NoOfCols = ceil(selcount / NoOfRowsSpinner.get_value());
- NoOfColsSpinner.set_value(NoOfCols);
- prefs->setInt("/dialogs/gridtiler/NoOfCols", NoOfCols);
+ Inkscape::Selection *selection = desktop ? desktop->selection : 0;
+ GSList const *items = selection ? selection->itemList() : 0;
+
+ if (items) {
+ int selcount = g_slist_length((GSList *)items);
+
+ if (NoOfColsSpinner.get_value() > 1 && NoOfRowsSpinner.get_value() > 1){
+ // Update the number of rows assuming number of columns wanted remains same.
+ double NoOfRows = ceil(selcount / NoOfColsSpinner.get_value());
+ NoOfRowsSpinner.set_value(NoOfRows);
+
+ // if the selection has less than the number set for one row, reduce it appropriately
+ if (selcount < NoOfColsSpinner.get_value()) {
+ double NoOfCols = ceil(selcount / NoOfRowsSpinner.get_value());
+ NoOfColsSpinner.set_value(NoOfCols);
+ prefs->setInt("/dialogs/gridtiler/NoOfCols", NoOfCols);
+ }
+ } else {
+ double PerRow = ceil(sqrt(selcount));
+ double PerCol = ceil(sqrt(selcount));
+ NoOfRowsSpinner.set_value(PerRow);
+ NoOfColsSpinner.set_value(PerCol);
+ prefs->setInt("/dialogs/gridtiler/NoOfCols", static_cast<int>(PerCol));
}
- } else {
- double PerRow = ceil(sqrt(selcount));
- double PerCol = ceil(sqrt(selcount));
- NoOfRowsSpinner.set_value(PerRow);
- NoOfColsSpinner.set_value(PerCol);
- prefs->setInt("/dialogs/gridtiler/NoOfCols", static_cast<int>(PerCol));
-
}
- updating=false;
-
+ updating = false;
}
SPDesktop *desktop = getDesktop();
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = desktop ? desktop->selection : 0;
+ g_return_if_fail( selection );
int selcount = 1;
if (!selection->isEmpty()) {
GSList const *items = selection->itemList();
diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h
index 075b2b33f945250dfa24a29f79c8269aff9a5f65..9ade64935a0ab7e8f15015f65c0ca3e0bcddd7d2 100644 (file)
--- a/src/ui/dialog/tile.h
+++ b/src/ui/dialog/tile.h
void VertAlign_changed();
void HorizAlign_changed();
- static TileDialog& getInstance() {
- static TileDialog instance;
- return instance;
- }
+ static TileDialog& getInstance() { return *new TileDialog(); }
private:
TileDialog(TileDialog const &d); // no copy