X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Ffilter-effects-dialog.cpp;h=4ea5faf138a1c9b68d655f72e1bc9298877f2436;hb=fb2c6b206989f303ea4a7e97876eaebf674aa07d;hp=3fa7d73d416320ede7df5736d103716170562f35;hpb=2c1198bed6e28190d7d1caae429cbb71dfe2ce44;p=inkscape.git diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 3fa7d73d4..4ea5faf13 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -751,7 +751,7 @@ public: : AttrWidget(SP_ATTR_INVALID), _dialog(d), _settings(d, _box, sigc::mem_fun(_dialog, &FilterEffectsDialog::set_child_attr_direct), LIGHT_ENDSOURCE), - _light_label("Light Source:", Gtk::ALIGN_LEFT), + _light_label(_("Light Source:"), Gtk::ALIGN_LEFT), _light_source(LightSourceConverter), _locked(false) { @@ -892,7 +892,7 @@ Glib::RefPtr create_popup_menu(Gtk::Widget& parent, sigc::slot /*** FilterModifier ***/ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) - : _dialog(d), _add(Gtk::Stock::ADD), _observer(new SignalObserver) + : _dialog(d), _add(Gtk::Stock::NEW), _observer(new SignalObserver) { Gtk::ScrolledWindow* sw = Gtk::manage(new Gtk::ScrolledWindow); pack_start(*sw); @@ -1166,7 +1166,8 @@ void FilterEffectsDialog::FilterModifier::duplicate_filter() void FilterEffectsDialog::FilterModifier::rename_filter() { SPFilter* filter = get_selected_filter(); - Gtk::Dialog m("", _dialog, true); + Gtk::Window *window = dynamic_cast(_dialog.get_vbox()->get_ancestor(GTK_TYPE_WINDOW)); + Gtk::Dialog m("", *window, true); m.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); m.add_button(_("_Rename"), Gtk::RESPONSE_OK); m.set_default_response(Gtk::RESPONSE_OK); @@ -1243,7 +1244,7 @@ FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d) set_reorderable(true); set_model(_model); - append_column(_("_Type"), _columns.type); + append_column(_("_Effect"), _columns.type); _observer->signal_changed().connect(signal_primitive_changed().make_slot()); get_selection()->signal_changed().connect(sigc::mem_fun(*this, &PrimitiveList::on_primitive_selection_changed)); @@ -1464,31 +1465,49 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Gtk::TreeIter& in const int text_start_x, const int x1, const int y1, const int row_count) { - int src_id; - const Gtk::TreeIter res = find_result(input, attr, src_id); - Glib::RefPtr gc = get_style()->get_black_gc(); + int src_id = 0; + Gtk::TreeIter res = find_result(input, attr, src_id); + Glib::RefPtr darkgc = get_style()->get_black_gc(); + Glib::RefPtr lightgc = get_style()->get_dark_gc(Gtk::STATE_NORMAL); + Glib::RefPtr gc; + + const bool is_first = input == get_model()->children().begin(); + const bool is_merge = SP_IS_FEMERGE((SPFilterPrimitive*)(*input)[_columns.primitive]); + const bool use_default = !res && !is_merge; - if(res == input) { + if(res == input || (use_default && is_first)) { // Draw straight connection to a standard input + // Draw a lighter line for an implicit connection to a standard input const int tw = _connection_cell.get_text_width(); gint end_x = text_start_x + tw * (src_id + 1) + (int)(tw * 0.5f) + 1; + gc = (use_default && is_first) ? lightgc : darkgc; get_bin_window()->draw_rectangle(gc, true, end_x-2, y1-2, 5, 5); get_bin_window()->draw_line(gc, x1, y1, end_x, y1); } - else if(res != _model->children().end()) { - Gdk::Rectangle rct; - - get_cell_area(get_model()->get_path(_model->children().begin()), *get_column(1), rct); - const int fheight = CellRendererConnection::size; + else { + // Draw an 'L'-shaped connection to another filter primitive + // If no connection is specified, draw a light connection to the previous primitive + gc = use_default ? lightgc : darkgc; - get_cell_area(get_model()->get_path(res), *get_column(1), rct); - const int row_index = find_index(res); - const int x2 = rct.get_x() + fheight * (row_count - row_index) - fheight / 2; - const int y2 = rct.get_y() + rct.get_height(); + if(use_default) { + res = input; + --res; + } - // Draw an 'L'-shaped connection to another filter primitive - get_bin_window()->draw_line(gc, x1, y1, x2, y1); - get_bin_window()->draw_line(gc, x2, y1, x2, y2); + if(res) { + Gdk::Rectangle rct; + + get_cell_area(get_model()->get_path(_model->children().begin()), *get_column(1), rct); + const int fheight = CellRendererConnection::size; + + get_cell_area(get_model()->get_path(res), *get_column(1), rct); + const int row_index = find_index(res); + const int x2 = rct.get_x() + fheight * (row_count - row_index) - fheight / 2; + const int y2 = rct.get_y() + rct.get_height(); + + get_bin_window()->draw_line(gc, x1, y1, x2, y1); + get_bin_window()->draw_line(gc, x2, y1, x2, y2); + } } } @@ -1526,10 +1545,15 @@ const Gtk::TreeIter FilterEffectsDialog::PrimitiveList::find_result(const Gtk::T if(SP_IS_FEMERGE(prim)) { int c = 0; + bool found = false; for(const SPObject* o = prim->firstChild(); o; o = o->next, ++c) { - if(c == attr && SP_IS_FEMERGENODE(o)) + if(c == attr && SP_IS_FEMERGENODE(o)) { image = SP_FEMERGENODE(o)->input; + found = true; + } } + if(!found) + return target; } else { if(attr == SP_ATTR_IN) @@ -1843,13 +1867,13 @@ int FilterEffectsDialog::PrimitiveList::primitive_count() const /*** FilterEffectsDialog ***/ -FilterEffectsDialog::FilterEffectsDialog() - : Dialog ("dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS), +FilterEffectsDialog::FilterEffectsDialog(Behavior::BehaviorFactory behavior_factory) + : Dialog (behavior_factory, "dialogs.filtereffects", SP_VERB_DIALOG_FILTER_EFFECTS), _filter_modifier(*this), _primitive_list(*this), _add_primitive_type(FPConverter), - _add_primitive(Gtk::Stock::ADD), - _empty_settings(_("No primitive selected"), Gtk::ALIGN_LEFT), + _add_primitive(_("Add Effect:")), + _empty_settings(_("No effect selected"), Gtk::ALIGN_LEFT), _locked(false), _attr_lock(false) { @@ -1862,7 +1886,7 @@ FilterEffectsDialog::FilterEffectsDialog() Gtk::HPaned* hpaned = Gtk::manage(new Gtk::HPaned); Gtk::ScrolledWindow* sw_prims = Gtk::manage(new Gtk::ScrolledWindow); Gtk::HBox* hb_prims = Gtk::manage(new Gtk::HBox); - Gtk::Frame* fr_settings = Gtk::manage(new Gtk::Frame(_("Settings"))); + Gtk::Frame* fr_settings = Gtk::manage(new Gtk::Frame(_("Effect parameters"))); Gtk::Alignment* al_settings = Gtk::manage(new Gtk::Alignment); get_vbox()->add(*hpaned); hpaned->pack1(_filter_modifier); @@ -1870,8 +1894,8 @@ FilterEffectsDialog::FilterEffectsDialog() _primitive_box.pack_start(*sw_prims); _primitive_box.pack_start(*hb_prims, false, false); sw_prims->add(_primitive_list); - hb_prims->pack_end(_add_primitive, false, false); hb_prims->pack_end(_add_primitive_type, false, false); + hb_prims->pack_end(_add_primitive, false, false); get_vbox()->pack_start(*fr_settings, false, false); fr_settings->add(*al_settings); al_settings->add(_settings_box);