stroke-marker-selector.cpp revision 0ce918f80fe50c422e3cb9918b5fb0c3b4613ab7
/**
* @file
* Combobox for selecting dash patterns - implementation.
*/
/* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Maximilian Albert <maximilian.albert@gmail.com>
*
* Copyright (C) 2002 Lauris Kaplinski
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "stroke-marker-selector.h"
#include <cstring>
#include <string>
#include "style.h"
#include "dialogs/dialog-events.h"
#include "desktop-handles.h"
#include "desktop-style.h"
#include "preferences.h"
#include "path-prefix.h"
#include "marker.h"
#include "sp-defs.h"
#include "sp-root.h"
#include "ui/cache/svg_preview_cache.h"
#include "helper/stock-items.h"
#include <gtkmm/adjustment.h>
#include "ui/widget/spinbutton.h"
updating(false),
is_history(false)
{
pack_start(image_renderer, false);
pack_end(label_renderer, true);
gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, NULL, NULL);
init_combo();
show();
}
MarkerComboBox::~MarkerComboBox() {
delete combo_id;
delete sandbox;
}
/**
* Init the combobox widget to display markers from markers.svg
*/
void
{
updating = false;
if (!doc) {
set_sensitive(false);
return;
}
// add "None"
// find and load markers.svg
if (markers_doc == NULL) {
}
}
// suck in from current doc
is_history = true;
is_history = false;
// add separator
// suck in from markers.svg
if (markers_doc) {
doc->ensureUpToDate();
}
set_sensitive(true);
/* Set history */
}
/**
* Sets the current marker in the marker combobox.
*/
{
updating = true;
bool mark_is_stock = false;
mark_is_stock = true;
}
if (mark_is_stock) {
} else {
}
}
else {
}
updating = false;
}
/**
* Return a uri string representing the current selected marker used for setting the marker style in the document
*/
{
/* Get Marker */
if (!markid)
{
return NULL;
}
if (mark) {
}
} else {
}
return marker;
}
void MarkerComboBox::set_active_history() {
}
if (!name) {
set_active(0);
return;
}
return;
}
}
}
if (!match_row) {
return;
}
return;
}
}
// Add a new row to the history
}
/**
* Pick up all markers from source, except those that are in
* current_doc (if non-NULL), and add items to the combo.
*/
{
continue;
// Add to the list of markers we really do wish to show
}
g_slist_free (ml);
}
/**
* Returns a list of markers in the defs of the given source document as a GSList object
* Returns NULL if there are no markers in the document.
*/
{
return NULL;
{
if (SP_IS_MARKER(child)) {
}
}
return ml;
}
/**
* Adds previews of markers in marker_list to the combo
*/
{
// Do this here, outside of loop, to speed up preview generation:
// generate preview
}
}
/**
* Creates a copy of the marker named mname, determines its visible and renderable
* area in the bounding box, and then renders it. This allows us to fill in
* preview images of each marker in the marker combobox.
*/
{
// Retrieve the marker named 'mname' from the source SVG document
return NULL;
}
// Create a copy repr of the marker with id="sample"
// Replace the old sample in the sandbox by the new one
if (oldmarker) {
oldmarker->deleteObject(false);
}
// TODO - This causes a SIGTRAP on windows
// Uncomment this to get the sandbox documents saved (useful for debugging)
//FILE *fp = fopen (g_strconcat(combo_id, mname, ".svg", NULL), "w");
//sp_repr_save_stream(sandbox->getReprDoc(), fp);
//fclose (fp);
// object to render; note that the id is the same as that of the combo we're building
return NULL; // sandbox broken?
}
// Find object's bbox in document
if (!dbox) {
return NULL;
}
/* Update to renderable state */
double sf = 0.8;
g_free (cache_name);
if (!pixbuf) {
}
// Create widget
return pb;
}
}
if (image)
else
}
return sep;
}
/**
* Returns a new document containing default start, mid, and end markers.
*/
{
gchar const *buffer = "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">"
" <defs id=\"defs\" />"
" <g id=\"marker-start\">"
" <path style=\"fill:none;stroke:black;stroke-width:1.7;marker-start:url(#sample);marker-mid:none;marker-end:none\""
" d=\"M 12.5,13 L 25,13\" id=\"path1\" />"
" <rect style=\"fill:none;stroke:none\" id=\"rect2\""
" width=\"25\" height=\"25\" x=\"0\" y=\"0\" />"
" </g>"
" <g id=\"marker-mid\">"
" <path style=\"fill:none;stroke:black;stroke-width:1.7;marker-start:none;marker-mid:url(#sample);marker-end:none\""
" d=\"M 0,113 L 12.5,113 L 25,113\" id=\"path11\" />"
" <rect style=\"fill:none;stroke:none\" id=\"rect22\""
" width=\"25\" height=\"25\" x=\"0\" y=\"100\" />"
" </g>"
" <g id=\"marker-end\">"
" <path style=\"fill:none;stroke:black;stroke-width:1.7;marker-start:none;marker-mid:none;marker-end:url(#sample)\""
" d=\"M 0,213 L 12.5,213\" id=\"path111\" />"
" <rect style=\"fill:none;stroke:none\" id=\"rect222\""
" width=\"25\" height=\"25\" x=\"0\" y=\"200\" />"
" </g>"
"</svg>";
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :