glyphs.cpp revision c652591f8105502bfed1dcd3d7207681932a7515
/* Authors:
* Jon A. Cruz
* Abhishek Sharma
* Tavmjong Bah
*
* Copyright (C) 2010 Jon A. Cruz
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <vector>
#include "glyphs.h"
#include <gtkmm/alignment.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/iconview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/scrolledwindow.h>
#if WITH_GTKMM_3_0
#else
#endif
#include <gtkmm/treemodelcolumn.h>
#include "desktop.h"
#include "document.h" // for SPDocumentUndo::done()
#include "document-undo.h"
#include "libnrtype/font-instance.h"
#include "sp-flowtext.h"
#include "sp-text.h"
#include "verbs.h"
#include "widgets/font-selector.h"
#include "text-editing.h"
#include "selection.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
{
return *new GlyphsPanel();
}
{
static bool init = false;
if (!init) {
init = true;
}
return mappings;
}
{
static bool init = false;
if (!init) {
init = true;
ranges.push_back(std::make_pair(std::make_pair(0x1400, 0x167F), _("Unified Canadian Aboriginal Syllabics")));
ranges.push_back(std::make_pair(std::make_pair(0x18B0, 0x18FF), _("Unified Canadian Aboriginal Syllabics Extended")));
ranges.push_back(std::make_pair(std::make_pair(0x1D80, 0x1DBF), _("Phonetic Extensions Supplement")));
ranges.push_back(std::make_pair(std::make_pair(0x1DC0, 0x1DFF), _("Combining Diacritical Marks Supplement")));
ranges.push_back(std::make_pair(std::make_pair(0x20D0, 0x20FF), _("Combining Diacritical Marks for Symbols")));
ranges.push_back(std::make_pair(std::make_pair(0x2440, 0x245F), _("Optical Character Recognition")));
ranges.push_back(std::make_pair(std::make_pair(0x27C0, 0x27EF), _("Miscellaneous Mathematical Symbols-A")));
ranges.push_back(std::make_pair(std::make_pair(0x2980, 0x29FF), _("Miscellaneous Mathematical Symbols-B")));
ranges.push_back(std::make_pair(std::make_pair(0x2A00, 0x2AFF), _("Supplemental Mathematical Operators")));
ranges.push_back(std::make_pair(std::make_pair(0x2B00, 0x2BFF), _("Miscellaneous Symbols and Arrows")));
ranges.push_back(std::make_pair(std::make_pair(0x2FF0, 0x2FFF), _("Ideographic Description Characters")));
ranges.push_back(std::make_pair(std::make_pair(0x31F0, 0x31FF), _("Katakana Phonetic Extensions")));
ranges.push_back(std::make_pair(std::make_pair(0x3200, 0x32FF), _("Enclosed CJK Letters and Months")));
ranges.push_back(std::make_pair(std::make_pair(0x3400, 0x4DBF), _("CJK Unified Ideographs Extension A")));
ranges.push_back(std::make_pair(std::make_pair(0xF900, 0xFAFF), _("CJK Compatibility Ideographs")));
ranges.push_back(std::make_pair(std::make_pair(0xFB00, 0xFB4F), _("Alphabetic Presentation Forms")));
ranges.push_back(std::make_pair(std::make_pair(0xFF00, 0xFFEF), _("Halfwidth and Fullwidth Forms")));
}
return ranges;
}
{
public:
{
}
};
{
return columns;
}
/**
* Constructor
*/
iconView(0),
entry(0),
label(0),
insertBtn(0),
scriptCombo(0),
fsel(0),
targetDesktop(0),
deskTrack(),
{
#if WITH_GTKMM_3_0
#else
#endif
// -------------------------------
#if WITH_GTKMM_3_0
#else
#endif
row++;
// -------------------------------
{
#if WITH_GTKMM_3_0
#else
#endif
for (std::map<GUnicodeScript, Glib::ustring>::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it)
{
}
sigc::connection conn = scriptCombo->signal_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::rebuild));
Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0));
#if WITH_GTKMM_3_0
align->set_hexpand();
#else
#endif
}
row++;
// -------------------------------
{
#if WITH_GTKMM_3_0
#else
#endif
}
sigc::connection conn = rangeCombo->signal_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::rebuild));
#if WITH_GTKMM_3_0
align->set_hexpand();
#else
#endif
}
row++;
// -------------------------------
//iconView->set_columns(16);
conn = iconView->signal_item_activated().connect(sigc::mem_fun(*this, &GlyphsPanel::glyphActivated));
conn = iconView->signal_selection_changed().connect(sigc::mem_fun(*this, &GlyphsPanel::glyphSelectionChanged));
#if WITH_GTKMM_3_0
scroller->set_hexpand();
scroller->set_vexpand();
#else
#endif
row++;
// -------------------------------
insertBtn->set_sensitive(false);
#if WITH_GTKMM_3_0
box->set_hexpand();
#else
#endif
row++;
// -------------------------------
// Connect this up last
}
{
for (std::vector<sigc::connection>::iterator it = instanceConns.begin(); it != instanceConns.end(); ++it) {
it->disconnect();
}
for (std::vector<sigc::connection>::iterator it = desktopConns.begin(); it != desktopConns.end(); ++it) {
it->disconnect();
}
}
{
}
{
if (targetDesktop != desktop) {
if (targetDesktop) {
for (std::vector<sigc::connection>::iterator it = desktopConns.begin(); it != desktopConns.end(); ++it) {
it->disconnect();
}
}
sigc::connection conn = desktop->selection->connectChanged(sigc::hide(sigc::bind(sigc::mem_fun(*this, &GlyphsPanel::readSelection), true, true)));
// Text selection within selected items has changed:
conn = desktop->connectToolSubselectionChanged(sigc::hide(sigc::bind(sigc::mem_fun(*this, &GlyphsPanel::readSelection), true, false)));
// Must check flags, so can't call performUpdate() directly.
conn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &GlyphsPanel::selectionModifiedCB)));
readSelection(true, true);
}
}
}
// Append selected glyphs to selected text
void GlyphsPanel::insertText()
{
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) {
textItem = *i;
break;
}
}
if (textItem) {
if (entry->get_text_length() > 0) {
} else {
#if WITH_GTKMM_3_0
#else
#endif
}
}
if (str) {
str = 0;
}
}
}
}
{
int startPos = 0;
int endPos = 0;
// there was something selected.
}
}
void GlyphsPanel::glyphSelectionChanged()
{
#if WITH_GTKMM_3_0
#else
#endif
} else {
}
}
}
void GlyphsPanel::fontChangeCB(SPFontSelector * /*fontsel*/, Glib::ustring /*fontspec*/, GlyphsPanel *self)
{
if (self) {
}
}
{
SP_OBJECT_STYLE_MODIFIED_FLAG )) != 0 );
SP_TEXT_CONTENT_MODIFIED_FLAG )) != 0 );
}
void GlyphsPanel::calcCanInsert()
{
int items = 0;
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) {
++items;
}
}
if (enable) {
|| (entry->get_text_length() > 0));
}
}
}
{
if (targetDesktop && updateStyle) {
//SPStyle query(SP_ACTIVE_DOCUMENT);
//int result_family = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTFAMILY);
//int result_style = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTSTYLE);
//int result_numbers = sp_desktop_query_style(targetDesktop, &query, QUERY_STYLE_PROPERTY_FONTNUMBERS);
}
}
void GlyphsPanel::rebuild()
{
font_instance* font = 0;
}
if (font) {
//double sp_font_selector_get_size (SPFontSelector *fsel);
for (std::map<GUnicodeScript, Glib::ustring>::iterator it = items.begin(); it != items.end(); ++it) {
break;
}
}
// Disconnect the model while we update it. Simple work-around for 5x+ performance boost.
if (active >= 0) {
}
if (glyphId > 0) {
}
}
}
{
}
// Reconnect the model once it has been updated:
}
}
} // namespace Dialogs
} // 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 :