summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a45e91f)
raw | patch | inline | side by side (parent: a45e91f)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:33:13 +0000 (00:33 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:33:13 +0000 (00:33 +0000) |
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index fd854caec3473dd5820df49e6b2eee722e02f5f2..9717c0aa1e9d56cda8c36349faa5c44618f95525 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
dc->selection = NULL;
}
- dc->waiting_LPE_type = Inkscape::LivePathEffect::INVALID_LPE;
-
spdc_free_colors(dc);
G_OBJECT_CLASS(draw_parent_class)->dispose(object);
index 1308a1860092d838346f1067ffadb5b41f808910..7d01f63dd54308e02cf8abcd830ef3badb660469 100644 (file)
Effect::Effect(LivePathEffectObject *lpeobject)
: oncanvasedit_it(0),
is_visible(_("Is visible?"), _("If unchecked, the effect remains applied to the object but is temporarily disabled on canvas"), "is_visible", &wr, this, true),
- done_pathparam_set(false),
show_orig_path(false),
lpeobj(lpeobject),
concatenate_before_pwd2(false),
- provides_own_flash_paths(true) // is automatically set to false if providesOwnFlashPaths() is not overridden
+ provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden
+ is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden
{
registerParameter( dynamic_cast<Parameter *>(&is_visible) );
}
/**
* If the effect expects a path parameter (specified by a number of mouse clicks) before it is
* applied, this is the method that processes the resulting path. Override it to customize it for
- * your LPE. But don't forget to call the parent method so that done_pathparam_set is set to true!
+ * your LPE. But don't forget to call the parent method so that is_ready is set to true!
*/
void
Effect::acceptParamPath (SPPath */*param_path*/) {
- done_pathparam_set = true;
+ setReady();
}
/*
index 1bc3988ab49e3b4bf94d20a86e23684275467e92..e703c888b11faf0ef673c80fab8ec68d716e079b 100644 (file)
int acceptsNumParams() { return acceptsNumParams(effectType()); }
void doAcceptPathPreparations(SPLPEItem *lpeitem);
- inline bool pathParamAccepted() { return done_pathparam_set; }
+ /*
+ * isReady() indicates whether all preparations which are necessary to apply the LPE are done,
+ * e.g., waiting for a parameter path either before the effect is created or when it needs a
+ * path as argument. This is set in sp_lpe_item_add_path_effect().
+ */
+ inline bool isReady() { return is_ready; }
+ inline void setReady(bool ready = true) { is_ready = ready; }
virtual void doEffect (SPCurve * curve);
std::vector<std::pair<KnotHolderEntity*, const char*> > kh_entity_vector;
int oncanvasedit_it;
BoolParam is_visible;
- bool done_pathparam_set;
bool show_orig_path; // set this to true in derived effects to automatically have the original
// path displayed as helperpath
private:
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
+ bool is_ready;
+
Effect(const Effect&);
Effect& operator=(const Effect&);
};
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 3cc7cc0d62a71a3e9830211f11f0000be91ca85f..8e1f6947b13dc0d2eff727ace1e792bea8332655 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
pc->num_clicks = 0;
pc->waiting_LPE = NULL;
+ pc->waiting_item = NULL;
}
/**
@@ -564,7 +565,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
}
}
- if (pc->expecting_clicks_for_LPE) {
+ if (pc->expecting_clicks_for_LPE > 0) {
--pc->expecting_clicks_for_LPE;
}
@@ -1383,10 +1384,12 @@ sp_pen_context_wait_for_LPE_mouse_clicks(SPPenContext *pc, Inkscape::LivePathEff
{
g_print ("Now waiting for %s to be applied\n",
Inkscape::LivePathEffect::LPETypeConverter.get_label(effect_type).c_str());
+ g_return_if_fail(effect_type != Inkscape::LivePathEffect::INVALID_LPE);
+
+ pc->waiting_LPE_type = effect_type;
pc->expecting_clicks_for_LPE = num_clicks;
pc->polylines_only = use_polylines;
pc->polylines_paraxial = false; // TODO: think if this is correct for all cases
- pc->waiting_LPE_type = effect_type;
}
static int pen_next_paraxial_direction(const SPPenContext *const pc,
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index f3620ab2fd45169d20e3228a00d4fe2dee43b6c5..7ff5a7f4be23a809558999c57ba1dda6fe192cb0 100644 (file)
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
Inkscape::LivePathEffect::Effect *lpe = lpeobj->lpe;
if (lpe->isVisible()) {
- if (lpe->acceptsNumParams() > 0 && !lpe->pathParamAccepted()) {
+ if (lpe->acceptsNumParams() > 0 && !lpe->isReady()) {
// if the effect expects mouse input before being applied and the input is not finished
// yet, we don't alter the path
return;
// perform this once when the effect is applied
lpe->doOnApply(SP_LPE_ITEM(lpeitem));
- // if the effect expects a number of mouse clicks to set a parameter path, perform the
- // necessary preparations
- if (lpe->acceptsNumParams() > 0) {
- lpe->doAcceptPathPreparations(lpeitem);
- }
+ // indicate that all necessary preparations are done and the effect can be performed
+ lpe->setReady();
}
//Enable the path effects now that everything is ready to apply the new path effect