summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d72622c)
raw | patch | inline | side by side (parent: d72622c)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 24 Oct 2007 23:19:48 +0000 (23:19 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 24 Oct 2007 23:19:48 +0000 (23:19 +0000) |
+ some bits of code to do on-canvas path parameter editing LPE.
diff --git a/src/attributes-test.h b/src/attributes-test.h
index 1030f9e46755ca94599b8ed2418ff862d54674de..57eb03eb5ae77a78e109e89867c28d3a5a84e3fb 100644 (file)
--- a/src/attributes-test.h
+++ b/src/attributes-test.h
/* SPNamedView */
{"viewonly", true},
{"showgrid", true},
- {"gridtype", true},
+// {"gridtype", true},
{"showguides", true},
{"gridtolerance", true},
{"guidetolerance", true},
{"objecttolerance", true},
- {"gridoriginx", true},
+/* {"gridoriginx", true},
{"gridoriginy", true},
{"gridspacingx", true},
{"gridspacingy", true},
{"gridopacity", true},
{"gridempcolor", true},
{"gridempopacity", true},
- {"gridempspacing", true},
+ {"gridempspacing", true}, */
{"guidecolor", true},
{"guideopacity", true},
{"guidehicolor", true},
diff --git a/src/attributes.cpp b/src/attributes.cpp
index 977ab3483630a944bb4a22e894c4cd959e946ef0..5fb4a87a050f95e74970882bad9db95fd8be7d56 100644 (file)
--- a/src/attributes.cpp
+++ b/src/attributes.cpp
/* SPNamedView */
{SP_ATTR_VIEWONLY, "viewonly"},
{SP_ATTR_SHOWGUIDES, "showguides"},
+ {SP_ATTR_SHOWGRIDS, "showgrid"},
{SP_ATTR_GRIDTOLERANCE, "gridtolerance"},
{SP_ATTR_GUIDETOLERANCE, "guidetolerance"},
{SP_ATTR_OBJECTTOLERANCE, "objecttolerance"},
diff --git a/src/attributes.h b/src/attributes.h
index 4a2970830d414dbe5e250030a2415d5c3c0f008c..6d05361f2b991b38b0b069c27d2147415f765766 100644 (file)
--- a/src/attributes.h
+++ b/src/attributes.h
/* SPNamedView */
SP_ATTR_VIEWONLY,
SP_ATTR_SHOWGUIDES,
+ SP_ATTR_SHOWGRIDS,
SP_ATTR_GRIDTOLERANCE,
SP_ATTR_GUIDETOLERANCE,
SP_ATTR_OBJECTTOLERANCE,
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 4b4d1fe5bcf8358b803cd97e41a2b8b670b26e16..4d2cd2fcb0c91d353e5655e274d0e1bb3603247d 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
_w2d(),
_d2w(),
_doc2dt( NR::Matrix(NR::scale(1, -1)) ),
- grids_visible( true )
+ grids_visible( false )
{
_d2w.set_identity();
_w2d.set_identity();
// (Setting up after the connections are all in place, as it may use some of them)
layer_manager = new Inkscape::LayerManager( this );
- grids_visible = true;
+ showGrids(namedview->grids_visible);
}
sp_event_context_update_cursor(sp_desktop_event_context(this));
}
-void SPDesktop::toggleGrid()
+void SPDesktop::toggleGrids()
{
if (namedview->grids) {
if(gridgroup) {
- grids_visible = !grids_visible;
- if (grids_visible) {
- sp_canvas_item_show(SP_CANVAS_ITEM(gridgroup));
- } else {
- sp_canvas_item_hide(SP_CANVAS_ITEM(gridgroup));
- }
+ showGrids(!grids_visible);
}
} else {
//there is no grid present at the moment. add a rectangular grid and make it visible
Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
Inkscape::CanvasGrid::writeNewGridToRepr(repr, sp_desktop_document(this), Inkscape::GRID_RECTANGULAR);
- grids_visible = true;
+ showGrids(true);
+ }
+}
+
+void SPDesktop::showGrids(bool show)
+{
+ grids_visible = show;
+ g_message(show?"show":"hide");
+ sp_namedview_show_grids(namedview, grids_visible);
+ if (show) {
sp_canvas_item_show(SP_CANVAS_ITEM(gridgroup));
+ } else {
+ sp_canvas_item_hide(SP_CANVAS_ITEM(gridgroup));
}
}
diff --git a/src/desktop.h b/src/desktop.h
index bc80336de4eb0b9d8de05e972dd4e7cbd6f64286..2a811a72383e4e1edc3367891495d70d1f77327f 100644 (file)
--- a/src/desktop.h
+++ b/src/desktop.h
void setWaitingCursor();
void clearWaitingCursor();
- void toggleGrid();
+ void toggleGrids();
bool gridsEnabled() { return grids_visible; }
-
+ void showGrids(bool show);
+
bool is_iconified();
bool is_maximized();
bool is_fullscreen();
virtual void mouseover() {}
virtual void mouseout() {}
- virtual bool onDeleteUI (GdkEventAny*);
- virtual bool onWindowStateEvent (GdkEventWindowState* event);
+ virtual bool onDeleteUI (GdkEventAny*);
+ virtual bool onWindowStateEvent (GdkEventWindowState* event);
private:
Inkscape::UI::View::EditWidgetInterface *_widget;
NR::Matrix _w2d;
NR::Matrix _d2w;
NR::Matrix _doc2dt;
-
- bool grids_visible;
-
+
+ bool grids_visible; /* don't set this variable directly, use the method below */
+ void set_grids_visible(bool visible);
+
void push_current_zoom (GList**);
sigc::signal<void,SPDesktop*,SPDocument*> _document_replaced_signal;
sigc::signal<void> _deactivate_signal;
sigc::signal<void,SPDesktop*,SPEventContext*> _event_context_changed_signal;
sigc::signal<void, gpointer> _tool_subselection_changed;
-
+
sigc::connection _activate_connection;
sigc::connection _deactivate_connection;
sigc::connection _sel_modified_connection;
sigc::connection _reconstruction_finish_connection;
sigc::connection _commit_connection;
sigc::connection _modified_connection;
-
+
virtual void onPositionSet (double, double);
virtual void onResized (double, double);
virtual void onRedrawRequested();
index b6086db270f64bee8d93b2ce19b50f4ece48573e..846d3699a9e846e6a0799df11e7fbca576484adc 100644 (file)
CanvasGrid::createCanvasItem(SPDesktop * desktop)
{
if (!desktop) return NULL;
- //Johan: I think for multiple desktops it is best if each has their own canvasitem, but share the same CanvasGrid object; that is what this function is for.
+// Johan: I think for multiple desktops it is best if each has their own canvasitem,
+// but share the same CanvasGrid object; that is what this function is for.
// check if there is already a canvasitem on this desktop linking to this grid
for (GSList *l = canvasitems; l != NULL; l = l->next) {
index 15ba663bee81a5c39af0c23370b75896d758031c..db1064511dccf966254cad639ec82c1d56d7cfc1 100644 (file)
#include "verbs.h"
#include "document.h"
-#define LPEPATHPARAM_DEBUG
+// needed for on-canvas editting:
#include "tools-switch.h"
#include "shape-editor.h"
#include "node-context.h"
static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
_tooltips->set_tip(*pButton, _("Edit on-canvas"));
edit_button = pButton;
-#ifndef LPEPATHPARAM_DEBUG
- edit_button->set_sensitive(false);
-#endif
pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) );
pButton = Gtk::manage(new Gtk::Button());
diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp
index fa41060c2cd26267f2616936a38a20415ccef00d..c019910cb8ccffa4ade4cbda59fcc0fbac820a89 100644 (file)
--- a/src/sp-namedview.cpp
+++ b/src/sp-namedview.cpp
@@ -127,10 +127,11 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
if (((SPObjectClass *) (parent_class))->build) {
(* ((SPObjectClass *) (parent_class))->build)(object, document, repr);
}
-
+g_message("tijdens laden %d", nv->viewcount);
sp_object_read_attr(object, "inkscape:document-units");
sp_object_read_attr(object, "viewonly");
sp_object_read_attr(object, "showguides");
+ sp_object_read_attr(object, "showgrid");
sp_object_read_attr(object, "gridtolerance");
sp_object_read_attr(object, "guidetolerance");
sp_object_read_attr(object, "objecttolerance");
@@ -206,7 +207,7 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
nv->editable = (!value);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_SHOWGUIDES:
+ case SP_ATTR_SHOWGUIDES:
if (!value) { // show guides if not specified, for backwards compatibility
nv->showguides = TRUE;
} else {
@@ -215,7 +216,17 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
sp_namedview_setup_guides(nv);
object->requestModified(SP_OBJECT_MODIFIED_FLAG);
break;
- case SP_ATTR_GRIDTOLERANCE:
+ case SP_ATTR_SHOWGRIDS:
+ if (!value) { // show grids if not specified, for backwards compatibility
+ nv->grids_visible = false;
+ } else {
+ nv->grids_visible = sp_str_to_bool(value);
+ g_message("set attr : %s", value);
+ }
+ g_message("set attr %s", nv->grids_visible ? "true":"false");
+ object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+ break;
+ case SP_ATTR_GRIDTOLERANCE:
nv->gridtoleranceunit = &px;
nv->gridtolerance = DEFAULTTOLERANCE;
if (value) {
@@ -441,7 +452,7 @@ sp_namedview_add_grid(SPNamedView *nv, Inkscape::XML::Node *repr, SPDesktop *des
break;
}
}
-
+
if (!grid) {
//create grid object
Inkscape::GridType gridtype = Inkscape::CanvasGrid::getGridTypeFromSVGName(repr->attribute("type"));
}
}
}
+
+ desktop->showGrids(grids_visible);
}
#define MIN_ONSCREEN_DISTANCE 50
sp_document_set_undo_sensitive(doc, saved);
}
+void sp_namedview_show_grids(SPNamedView * namedview, bool show)
+{
+ namedview->grids_visible = show;
+
+ SPDocument *doc = SP_OBJECT_DOCUMENT (namedview);
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview);
+
+ bool saved = sp_document_get_undo_sensitive(doc);
+ sp_document_set_undo_sensitive(doc, false);
+
+ sp_repr_set_boolean(repr, "showgrid", namedview->grids_visible);
+
+ doc->rroot->setAttribute("sodipodi:modified", "true");
+ sp_document_set_undo_sensitive(doc, saved);
+}
+
gchar const *SPNamedView::getName() const
{
SPException ex;
diff --git a/src/sp-namedview.h b/src/sp-namedview.h
index 7eefdfae53cf345fd6d65281c2273cf3e69b6510..8b6dbcc920bff986192124b82154b73b7b137329 100644 (file)
--- a/src/sp-namedview.h
+++ b/src/sp-namedview.h
SnapManager snap_manager;
GSList * grids;
+ bool grids_visible;
SPUnit const *doc_units;
GSList *guides;
GSList *views;
-
+
gint viewcount;
void show(SPDesktop *desktop);
void sp_namedview_update_layers_from_document (SPDesktop *desktop);
void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr);
+void sp_namedview_show_grids(SPNamedView *namedview, bool show);
#endif /* !INKSCAPE_SP_NAMEDVIEW_H */
diff --git a/src/verbs.cpp b/src/verbs.cpp
index abf834c47f4fe180c62bfeff1fababd75f913f4c..32e0c46af55b323c914796271207e7a797cf537c 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
sp_desktop_selection(dt)->clear();
}
break;
+
+ case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
+ //FACTOR OUT THIS CODE TO SOMEWHERE ELSE!
+ // if(selection has LPE) {
+ // If not already in nodecontext, goto it!
+ // if (!tools_isactive(dt, TOOLS_NODES)) {
+ // tools_switch_current(TOOLS_NODES);
+ // }
+ // add goto next code here:
+ //} else {
+ // statusbar message: selection has no path effect applied.
+ //}
+ break;
default:
break;
}
sp_namedview_toggle_guides(doc, repr);
break;
case SP_VERB_TOGGLE_GRID:
- dt->toggleGrid();
+ dt->toggleGrids();
break;
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
case SP_VERB_FULLSCREEN:
N_("Select previous object or node"), NULL),
new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
N_("Deselect any selected objects or nodes"), "selection_deselect"),
+ new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next Path Effect Parameter"),
+ N_("Show next Path Effect parameter for editting"), NULL),
/* Selection */
new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
diff --git a/src/verbs.h b/src/verbs.h
index 34a633b2f082a520cadedef4bbf05482b7dc0210..ccb63daddc866832676ef53126e1b2f427d49b99 100644 (file)
--- a/src/verbs.h
+++ b/src/verbs.h
SP_VERB_EDIT_SELECT_NEXT,
SP_VERB_EDIT_SELECT_PREV,
SP_VERB_EDIT_DESELECT,
+ SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER,
/* Selection */
SP_VERB_SELECTION_TO_FRONT,
SP_VERB_SELECTION_TO_BACK,