/** * Constructor */ Messages::Messages() : UI::Widget::Panel("", "/dialogs/messages", SP_VERB_DIALOG_DEBUG), buttonClear(_("_Clear"), _("Clear log messages")), checkCapture(_("Capture log messages"), _("Capture log messages")) { Gtk::Box *contents = _getContents(); /* * Menu replaced with buttons * menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) ); fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_Clear"), sigc::mem_fun(*this, &Messages::clear) ) ); fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Capture log messages"), sigc::mem_fun(*this, &Messages::captureLogMessages) ) ); fileMenu.items().push_back( Gtk::Menu_Helpers::MenuElem(_("Release log messages"), sigc::mem_fun(*this, &Messages::releaseLogMessages) ) ); contents->pack_start(menuBar, Gtk::PACK_SHRINK); */ //### Set up the text widget messageText.set_editable(false); textScroll.add(messageText); textScroll.set_policy(Gtk::POLICY_ALWAYS, Gtk::POLICY_ALWAYS); contents->pack_start(textScroll); buttonBox.set_spacing(6); buttonBox.pack_start(checkCapture, true, true, 6); buttonBox.pack_end(buttonClear, false, false, 10); contents->pack_start(buttonBox, Gtk::PACK_SHRINK); // sick of this thing shrinking too much set_size_request(400, 300); show_all_children(); message(_("Ready.")); buttonClear.signal_clicked().connect(sigc::mem_fun(*this, &Messages::clear)); checkCapture.signal_clicked().connect(sigc::mem_fun(*this, &Messages::toggleCapture)); /* * TODO - Setting this preference doesn't capture messages that the user can see. * Inkscape creates an instance of a dialog on startup and sends messages there, but when the user * opens the dialog View > Messages the DialogManager creates a new instance of this class that is not capturing messages. * * message(_("Enable log display by setting dialogs.debug 'redirect' attribute to 1 in preferences.xml")); */ handlerDefault = 0; handlerGlibmm = 0; handlerAtkmm = 0; handlerPangomm = 0; handlerGdkmm = 0; handlerGtkmm = 0; }
INT32 _sptClassMetaInfo::_getFuncDesc( const CHAR *pFileBuff, INT32 fileSize, string &desc ) { INT32 rc = SDB_OK ; stringstream ss ; INT32 buffSize = 0 ; CHAR *pBuff = NULL ; const CHAR *pos = NULL ; const CHAR *beg_mark = SPT_LANG_EN == _lang ? SPT_TROFF_NAME_EN : SPT_TROFF_NAME_CN ; const CHAR *end_mark = SPT_LANG_EN == _lang ? SPT_TROFF_SYNOPSIS_EN : SPT_TROFF_SYNOPSIS_CN ; rc = _getContents( pFileBuff, beg_mark, end_mark, &pBuff, &buffSize ) ; if ( SDB_OK != rc ) { ss << "Failed to contents for extracting synopsis, rc = " << rc << endl ; goto error ; } _replaceCharsWithSpace( pBuff, "\n" ) ; _filterMarks( pBuff, _uselessMarks2, sizeof( _uselessMarks2 ) / sizeof( const CHAR * ) ) ; pos = ossStrstr( pBuff, "-" ) ; if ( NULL == pos ) { rc = SDB_INVALIDARG ; ss << "Failed to get the description of function, rc = " << rc << ERROR_END ; goto error ; } pos++ ; while( '\r' != *pos && '\n' != *pos ) { if ( ' ' == *pos ) { pos++ ; } else { break ; } } if ( '\r' != *pos && '\n' != *pos ) { desc += string( "- " ) + pos ; boost::trim( desc ) ; } done: if ( pBuff ) { SAFE_OSS_FREE( pBuff ) ; } return rc ; error: PRINT_ERROR ; goto done ; }
LivePathEffectEditor::LivePathEffectEditor() : UI::Widget::Panel("", "/dialogs/livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT), lpe_list_locked(false), combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter), effectwidget(NULL), explain_label("", Gtk::ALIGN_CENTER), // TRANSLATORS: this dialog is accessible via menu Path - Path Effect Editor... effectapplication_frame(_("Apply new effect")), effectcontrol_frame(_("Current effect")), effectlist_frame(_("Effect list")), button_up(Gtk::Stock::GO_UP), button_down(Gtk::Stock::GO_DOWN), button_apply(Gtk::Stock::ADD), button_remove(Gtk::Stock::REMOVE), current_desktop(NULL), current_lpeitem(NULL) { Gtk::Box *contents = _getContents(); contents->set_spacing(4); //Add the TreeView, inside a ScrolledWindow, with the button underneath: scrolled_window.add(effectlist_view); //Only show the scrollbars when they are necessary: scrolled_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolled_window.set_size_request(0, 50); effectapplication_hbox.set_spacing(4); effectcontrol_vbox.set_spacing(4); effectlist_vbox.set_spacing(4); effectapplication_hbox.pack_start(combo_effecttype, true, true); effectapplication_hbox.pack_start(button_apply, true, true); effectapplication_frame.add(effectapplication_hbox); effectlist_vbox.pack_start(scrolled_window, Gtk::PACK_EXPAND_WIDGET); effectlist_vbox.pack_end(toolbar, Gtk::PACK_SHRINK); // effectlist_vbox.pack_end(button_hbox, Gtk::PACK_SHRINK); effectlist_frame.add(effectlist_vbox); effectcontrol_vbox.pack_start(explain_label, true, true); effectcontrol_frame.add(effectcontrol_vbox); // button_hbox.pack_start(button_up, true, true); // button_hbox.pack_start(button_down, true, true); // button_hbox.pack_end(button_remove, true, true); toolbar.set_toolbar_style(Gtk::TOOLBAR_ICONS); // Add toolbar items to toolbar toolbar.append(button_up); toolbar.append(button_down); toolbar.append(button_remove); // Add toolbar //add_toolbar(toolbar); toolbar.show_all(); //Show the toolbar and all its child widgets. //Create the Tree model: effectlist_store = Gtk::ListStore::create(columns); effectlist_view.set_model(effectlist_store); effectlist_view.set_headers_visible(false); // Handle tree selections effectlist_selection = effectlist_view.get_selection(); effectlist_selection->signal_changed().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_effect_selection_changed) ); //Add the visibility icon column: Inkscape::UI::Widget::ImageToggler *eyeRenderer = manage( new Inkscape::UI::Widget::ImageToggler( INKSCAPE_ICON_OBJECT_VISIBLE, INKSCAPE_ICON_OBJECT_HIDDEN) ); int visibleColNum = effectlist_view.append_column("is_visible", *eyeRenderer) - 1; eyeRenderer->signal_toggled().connect( sigc::mem_fun(*this, &LivePathEffectEditor::on_visibility_toggled) ); eyeRenderer->property_activatable() = true; Gtk::TreeViewColumn* col = effectlist_view.get_column(visibleColNum); if ( col ) { col->add_attribute( eyeRenderer->property_active(), columns.col_visible ); } //Add the effect name column: effectlist_view.append_column("Effect", columns.col_name); contents->pack_start(effectapplication_frame, false, false); contents->pack_start(effectlist_frame, true, true); contents->pack_start(effectcontrol_frame, false, false); // connect callback functions to buttons button_apply.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onApply)); button_remove.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onRemove)); button_up.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onUp)); button_down.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onDown)); show_all_children(); //button_remove.hide(); }
INT32 _sptClassMetaInfo::_getFuncSynopsis( const CHAR *pFileBuff, INT32 fileSize, vector<string> &output ) { INT32 rc = SDB_OK ; stringstream ss ; INT32 buffSize = 0 ; CHAR *pBuff = NULL ; vector<string> vec ; vector<string>::iterator it ; const CHAR *beg_mark = SPT_LANG_EN == _lang ? SPT_TROFF_SYNOPSIS_EN : SPT_TROFF_SYNOPSIS_CN ; const CHAR *end_mark = SPT_LANG_EN == _lang ? SPT_TROFF_CATEGORY_EN : SPT_TROFF_CATEGORY_CN ; rc = _getContents( pFileBuff, beg_mark, end_mark, &pBuff, &buffSize ) ; if ( SDB_OK != rc ) { ss << "Failed to contents for extracting synopsis, rc = " << rc << endl ; goto error ; } _filterMarks( pBuff, _uselessMarks, sizeof( _uselessMarks ) / sizeof( const CHAR * ) ) ; boost::split( vec, pBuff, boost::is_any_of("\n") ) ; for ( it = vec.begin(); it != vec.end(); it++ ) { if ( !it->empty() ) { std::size_t found = it->find( "(" ) ; if ( std::string::npos == found ) { output.push_back( *it ) ; } else { string sub = it->substr( 0, found ) ; found = sub.find_last_of( "." ) ; if ( std::string::npos == found ) { output.push_back( *it ) ; } else { output.push_back( it->substr( found + 1 ) ) ; } } } } done: if ( pBuff ) { SAFE_OSS_FREE( pBuff ) ; } return rc ; error: PRINT_ERROR ; goto done ; }
AlignAndDistribute::AlignAndDistribute() : UI::Widget::Panel ("", "/dialogs/align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE), randomize_bbox(), _alignFrame(_("Align")), _distributeFrame(_("Distribute")), _rearrangeFrame(_("Rearrange")), _removeOverlapFrame(_("Remove overlaps")), _nodesFrame(_("Nodes")), #if WITH_GTKMM_3_0 _alignTable(), _distributeTable(), _rearrangeTable(), _removeOverlapTable(), _nodesTable(), #else _alignTable(2, 6, true), _distributeTable(2, 6, true), _rearrangeTable(1, 5, false), _removeOverlapTable(1, 5, false), _nodesTable(1, 4, true), #endif _anchorLabel(_("Relative to: ")), _selgrpLabel(_("_Treat selection as group: "), 1) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); //Instanciate the align buttons addAlignButton(INKSCAPE_ICON("align-horizontal-right-to-anchor"), _("Align right edges of objects to the left edge of the anchor"), 0, 0); addAlignButton(INKSCAPE_ICON("align-horizontal-left"), _("Align left edges"), 0, 1); addAlignButton(INKSCAPE_ICON("align-horizontal-center"), _("Center on vertical axis"), 0, 2); addAlignButton(INKSCAPE_ICON("align-horizontal-right"), _("Align right sides"), 0, 3); addAlignButton(INKSCAPE_ICON("align-horizontal-left-to-anchor"), _("Align left edges of objects to the right edge of the anchor"), 0, 4); addAlignButton(INKSCAPE_ICON("align-vertical-bottom-to-anchor"), _("Align bottom edges of objects to the top edge of the anchor"), 1, 0); addAlignButton(INKSCAPE_ICON("align-vertical-top"), _("Align top edges"), 1, 1); addAlignButton(INKSCAPE_ICON("align-vertical-center"), _("Center on horizontal axis"), 1, 2); addAlignButton(INKSCAPE_ICON("align-vertical-bottom"), _("Align bottom edges"), 1, 3); addAlignButton(INKSCAPE_ICON("align-vertical-top-to-anchor"), _("Align top edges of objects to the bottom edge of the anchor"), 1, 4); //Baseline aligns addBaselineButton(INKSCAPE_ICON("align-horizontal-baseline"), _("Align baseline anchors of texts horizontally"), 0, 5, this->align_table(), Geom::X, false); addBaselineButton(INKSCAPE_ICON("align-vertical-baseline"), _("Align baselines of texts"), 1, 5, this->align_table(), Geom::Y, false); //The distribute buttons addDistributeButton(INKSCAPE_ICON("distribute-horizontal-gaps"), _("Make horizontal gaps between objects equal"), 0, 4, true, Geom::X, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-horizontal-left"), _("Distribute left edges equidistantly"), 0, 1, false, Geom::X, 1., 0.); addDistributeButton(INKSCAPE_ICON("distribute-horizontal-center"), _("Distribute centers equidistantly horizontally"), 0, 2, false, Geom::X, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-horizontal-right"), _("Distribute right edges equidistantly"), 0, 3, false, Geom::X, 0., 1.); addDistributeButton(INKSCAPE_ICON("distribute-vertical-gaps"), _("Make vertical gaps between objects equal"), 1, 4, true, Geom::Y, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-vertical-top"), _("Distribute top edges equidistantly"), 1, 1, false, Geom::Y, 0, 1); addDistributeButton(INKSCAPE_ICON("distribute-vertical-center"), _("Distribute centers equidistantly vertically"), 1, 2, false, Geom::Y, .5, .5); addDistributeButton(INKSCAPE_ICON("distribute-vertical-bottom"), _("Distribute bottom edges equidistantly"), 1, 3, false, Geom::Y, 1., 0.); //Baseline distribs addBaselineButton(INKSCAPE_ICON("distribute-horizontal-baseline"), _("Distribute baseline anchors of texts horizontally"), 0, 5, this->distribute_table(), Geom::X, true); addBaselineButton(INKSCAPE_ICON("distribute-vertical-baseline"), _("Distribute baselines of texts vertically"), 1, 5, this->distribute_table(), Geom::Y, true); // Rearrange //Graph Layout addGraphLayoutButton(INKSCAPE_ICON("distribute-graph"), _("Nicely arrange selected connector network"), 0, 0); addExchangePositionsButton(INKSCAPE_ICON("exchange-positions"), _("Exchange positions of selected objects - selection order"), 0, 1); addExchangePositionsByZOrderButton(INKSCAPE_ICON("exchange-positions-zorder"), _("Exchange positions of selected objects - stacking order"), 0, 2); addExchangePositionsClockwiseButton(INKSCAPE_ICON("exchange-positions-clockwise"), _("Exchange positions of selected objects - clockwise rotate"), 0, 3); //Randomize & Unclump addRandomizeButton(INKSCAPE_ICON("distribute-randomize"), _("Randomize centers in both dimensions"), 0, 4); addUnclumpButton(INKSCAPE_ICON("distribute-unclump"), _("Unclump objects: try to equalize edge-to-edge distances"), 0, 5); //Remove overlaps addRemoveOverlapsButton(INKSCAPE_ICON("distribute-remove-overlaps"), _("Move objects as little as possible so that their bounding boxes do not overlap"), 0, 0); //Node Mode buttons // NOTE: "align nodes vertically" means "move nodes vertically until they align on a common // _horizontal_ line". This is analogous to what the "align-vertical-center" icon means. // There is no doubt some ambiguity. For this reason the descriptions are different. addNodeButton(INKSCAPE_ICON("align-vertical-node"), _("Align selected nodes to a common horizontal line"), 0, Geom::X, false); addNodeButton(INKSCAPE_ICON("align-horizontal-node"), _("Align selected nodes to a common vertical line"), 1, Geom::Y, false); addNodeButton(INKSCAPE_ICON("distribute-horizontal-node"), _("Distribute selected nodes horizontally"), 2, Geom::X, true); addNodeButton(INKSCAPE_ICON("distribute-vertical-node"), _("Distribute selected nodes vertically"), 3, Geom::Y, true); //Rest of the widgetry _combo.append(_("Last selected")); _combo.append(_("First selected")); _combo.append(_("Biggest object")); _combo.append(_("Smallest object")); _combo.append(_("Page")); _combo.append(_("Drawing")); _combo.append(_("Selection")); _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6)); _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change)); _anchorBox.pack_end(_combo, false, false); _anchorBox.pack_end(_anchorLabel, false, false); _selgrpLabel.set_mnemonic_widget(_selgrp); _selgrpBox.pack_end(_selgrp, false, false); _selgrpBox.pack_end(_selgrpLabel, false, false); _selgrp.set_active(prefs->getBool("/dialogs/align/sel-as-groups")); _selgrp.signal_toggled().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_selgrp_toggled)); // Right align the buttons _alignTableBox.pack_end(_alignTable, false, false); _distributeTableBox.pack_end(_distributeTable, false, false); _rearrangeTableBox.pack_end(_rearrangeTable, false, false); _removeOverlapTableBox.pack_end(_removeOverlapTable, false, false); _nodesTableBox.pack_end(_nodesTable, false, false); _alignBox.pack_start(_anchorBox); _alignBox.pack_start(_selgrpBox); _alignBox.pack_start(_alignTableBox); _alignFrame.add(_alignBox); _distributeFrame.add(_distributeTableBox); _rearrangeFrame.add(_rearrangeTableBox); _removeOverlapFrame.add(_removeOverlapTableBox); _nodesFrame.add(_nodesTableBox); Gtk::Box *contents = _getContents(); contents->set_spacing(4); // Notebook for individual transformations contents->pack_start(_alignFrame, true, true); contents->pack_start(_distributeFrame, true, true); contents->pack_start(_rearrangeFrame, true, true); contents->pack_start(_removeOverlapFrame, true, true); contents->pack_start(_nodesFrame, true, true); //Connect to the global tool change signal g_signal_connect (G_OBJECT (INKSCAPE), "set_eventcontext", G_CALLBACK (on_tool_changed), this); // Connect to the global selection change, to invalidate cached randomize_bbox g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this); randomize_bbox = Geom::OptRect(); _desktopChangeConn = _deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &AlignAndDistribute::setDesktop) ); _deskTrack.connect(GTK_WIDGET(gobj())); show_all_children(); on_tool_changed (NULL, NULL, this); // set current mode }