preferences-widget.cpp revision 6ca0871243b23287418bed8719580f652f45f06b
/*
* Inkscape Preferences dialog.
*
* Authors:
* Marco Scholten
* Bruno Dilly <bruno.dilly@gmail.com>
*
* Copyright (C) 2004, 2006, 2007 Authors
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtkmm/alignment.h>
#include "preferences.h"
#include "ui/widget/preferences-widget.h"
#include "verbs.h"
#include "selcue.h"
#include <iostream>
#include "desktop.h"
#include "enums.h"
#include "inkscape.h"
#include "message-stack.h"
#include "style.h"
#include "selection.h"
#include "selection-chemistry.h"
#include "ui/dialog/filedialog.h"
#ifdef WIN32
#include <windows.h>
#endif
namespace Inkscape {
namespace UI {
namespace Widget {
{
set_border_width(12);
#if WITH_GTKMM_3_0
set_column_spacing(12);
set_row_spacing(6);
#else
set_col_spacings(12);
set_row_spacings(6);
#endif
}
/**
* Add a widget to the bottom row of the dialog page
*
* \param[in] indent Whether the widget should be indented by one column
* \param[in] label The label text for the widget
* \param[in] widget The widget to add to the page
* \param[in] suffix Text for an optional label at the right of the widget
* \param[in] tip Tooltip text for the widget
* \param[in] expand_widget Whether to expand the widget horizontally
* \param[in] other_widget An optional additional widget to display at the right of the first one
*/
bool expand_widget,
{
if (tip != "")
// Pack an additional widget into a box with the widget if desired
if (other_widget)
// Pack the widget into an alignment container so that it can
// be indented if desired
#if WITH_GTKMM_3_0
#else
#endif
// Add a label in the first column if provided
if (label != "")
{
Gtk::ALIGN_CENTER, true));
// Pack the label into an alignment container so that we can indent it
// if necessary
if (indent)
#if WITH_GTKMM_3_0
#else
#endif
}
// Now add the widget to the bottom of the dialog
#if WITH_GTKMM_3_0
if (label == "")
{
if (indent)
add(*w_alignment);
gtk_container_child_set_property(GTK_CONTAINER(gobj()), GTK_WIDGET(w_alignment->gobj()), "width", &width);
}
#else
// The widget should span two columns if there is no label
int w_col_span = 1;
if (label == "")
w_col_span = 2;
Gtk::AttachOptions(),
0, 0);
#endif
// Add a label on the right of the widget if desired
if (suffix != "")
{
Gtk::Label* suffix_widget = Gtk::manage(new Gtk::Label(suffix , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true));
}
}
{
if (name != "")
{
Gtk::Label* label_widget = Gtk::manage(new Gtk::Label(Glib::ustring(/*"<span size='large'>*/"<b>") + name +
label_widget->set_use_markup(true);
#if WITH_GTKMM_3_0
add(*label_widget);
// if (row != 1)
// set_row_spacing(row - 1, 18);
#else
int row = property_n_rows();
if (row != 1)
#endif
}
}
{
}
bool default_value)
{
}
void PrefCheckButton::on_toggled()
{
if (this->get_visible()) //only take action if the user toggled it
{
}
}
{
(void)default_value;
if (group_member)
{
}
else
this->set_active( false );
}
{
if (group_member)
{
}
if (default_value)
else
}
void PrefRadioButton::on_toggled()
{
{
if ( _value_type == VAL_STRING )
else if ( _value_type == VAL_INT )
}
}
{
double value;
if (is_int) {
if (is_percent) {
} else {
}
} else {
}
this->set_increments (step_increment, 0);
this->set_width_chars(6);
if (is_int)
this->set_digits(0);
else if (step_increment < 0.1)
this->set_digits(4);
else
this->set_digits(2);
}
void PrefSpinButton::on_value_changed()
{
if (this->get_visible()) //only take action if user changed value
{
if (_is_int) {
if (_is_percent) {
} else {
}
} else {
}
}
}
{
setIncrements (step_increment, 0);
if (step_increment < 0.1) {
setDigits(4);
} else {
setDigits(2);
}
// write the assumed unit to preferences:
}
}
void PrefSpinUnit::on_my_value_changed()
{
{
}
}
_unitconv(1.0),
_border(5)
{
}
void ZoomCorrRuler::set_size(int x, int y)
{
_min_width = x;
_height = y;
}
// The following two functions are borrowed from 2geom's toy-framework-2; if they are useful in
// other locations, we should perhaps make them (or adapted versions of them) publicly available
static void
// set font and size
}
static void
}
/*
* \arg dist The distance between consecutive minor marks
* \arg major_interval Number of marks after which to draw a major mark
*/
void
double mark = 0;
int i = 0;
while (mark <= _drawing_width) {
if ((i % major_interval) == 0) {
// major mark
} else {
// minor mark
}
++i;
}
}
#if !WITH_GTKMM_3_0
bool
bool result = false;
if(get_is_drawable())
{
}
return result;
}
#endif
bool
if (abbr == "cm") {
} else if (abbr == "in") {
} else if (abbr == "mm") {
} else if (abbr == "pc") {
} else if (abbr == "pt") {
} else if (abbr == "px") {
} else {
}
return true;
}
void
{
{
freeze = true;
_ruler.queue_draw();
freeze = false;
}
}
void
{
{
freeze = true;
_ruler.queue_draw();
freeze = false;
}
}
void
// when the unit menu is initialized, the unit is set to the default but
// it needs to be reset later so we don't perform the change in this case
return;
}
if (_ruler.get_visible()) {
_ruler.queue_draw();
}
}
{
}
void
{
double value = prefs->getDoubleLimited("/options/zoomcorrection/value", default_value, lower, upper) * 100.0;
freeze = false;
#if WITH_GTKMM_3_0
#else
#endif
_slider->signal_value_changed().connect(sigc::mem_fun(*this, &ZoomCorrRulerSlider::on_slider_value_changed));
_sb.signal_value_changed().connect(sigc::mem_fun(*this, &ZoomCorrRulerSlider::on_spinbutton_value_changed));
#if WITH_GTKMM_3_0
#else
#endif
}
void
{
{
freeze = true;
freeze = false;
}
}
void
{
{
freeze = true;
freeze = false;
}
}
{
}
void
double lower, double upper, double step_increment, double page_increment, double default_value, int digits)
{
freeze = false;
#if WITH_GTKMM_3_0
#else
#endif
_slider->signal_value_changed().connect(sigc::mem_fun(*this, &PrefSlider::on_slider_value_changed));
#if WITH_GTKMM_3_0
_slider->set_hexpand();
#else
#endif
}
{
int row = 0;
for (int i = 0 ; i < num_items; ++i)
{
row = i;
}
this->set_active(row);
}
{
int row = 0;
{
}
for (int i = 0 ; i < num_items; ++i)
{
row = i;
}
this->set_active(row);
}
void PrefCombo::on_changed()
{
if (this->get_visible()) //only take action if user changed value
{
{
}
else
{
}
}
}
{
this->pack_start(*relatedEntry);
this->pack_start(*relatedButton);
}
{
if (this->get_visible()) //only take action if user changed value
{
}
}
{
if (this->get_visible()) //only take action if user changed value
{
}
}
{
}
bool visibility)
{
l->set_markup_with_mnemonic(_("_Browse..."));
pixlabel->pack_start(*l);
this->pack_start(*relatedEntry, true, true, 0);
}
{
if (this->get_visible()) //only take action if user changed value
{
}
}
{
if (this->get_visible()) //only take action if user changed value
{
//# Get the current directory for finding files
//# Test if the open_path directory exists
open_path = "";
#ifdef WIN32
//# If no open path, default to our win32 documents folder
{
// The path to the My Documents folder is read from the
// value "HKEY_CURRENT_USER\Software\Windows\CurrentVersion\Explorer\Shell Folders\Personal"
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
{
{
if(utf8path)
{
}
}
}
}
#endif
//# If no open path, default to our home directory
{
open_path = g_get_home_dir();
}
//# Create a dialog
if (!selectPrefsFileInstance) {
*desktop->getToplevel(),
_("Select a bitmap editor"));
}
//# Show the dialog
if (!success) {
return;
}
//# User selected something. Get name and type
{
if ( newFileName.size() > 0)
else
g_warning( "ERROR CONVERTING OPEN FILENAME TO UTF-8" );
}
}
}
{
}
{
}
void PrefFileButton::onFileChanged()
{
}
{
this->set_invisible_char('*');
this->set_visibility(visibility);
}
void PrefEntry::on_changed()
{
if (this->get_visible()) //only take action if user changed value
{
}
}
{
}
{
if (this->get_visible()) //only take action if the user toggled it
{
}
}
{
}
void PrefUnit::on_changed()
{
if (this->get_visible()) //only take action if user changed value
{
}
}
} // namespace Widget
} // namespace UI
} // namespace Inkscape
/*
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 :