edit-widget.cpp revision 035e109c2dce9f6a9552f75d09b1573311d02546
/**
* \brief This class implements the functionality of the window layout, menus,
* and signals.
*
* This is a reimplementation into C++/Gtkmm of Sodipodi's SPDesktopWidget class.
* Both SPDesktopWidget and EditWidget adhere to the EditWidgetInterface, so
*
* Ideally, this class should only contain the handling of the Window (i.e.,
* content construction and window signals) and implement its
* EditWidgetInterface.
*
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
* Bryce W. Harrington <bryce@bryceharrington.org>
* Derek P. Moore <derekm@hackunix.org>
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
* John Bintz <jcoswell@coswellproductions.org>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 2006 John Bintz
* Copyright (C) 1999-2005 Authors
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtkwindow.h>
#include <gtk/gtkversion.h>
#include <gtk/gtklabel.h>
#include <gtkmm/radioaction.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/accelmap.h>
#include <gtkmm/separator.h>
#include "macros.h"
#include "path-prefix.h"
#include "preferences.h"
#include "file.h"
#include "application/editor.h"
#include "edit-widget.h"
#include "display/sodipodi-ctrlrect.h"
#include "shortcuts.h"
#include "widgets/spw-utilities.h"
#include "event-context.h"
#include "document.h"
#include "sp-namedview.h"
#include "sp-item.h"
#include "interface.h"
#include "ui/dialog/dialog-manager.h"
namespace Inkscape {
namespace UI {
namespace View {
: _main_window_table(4),
_update_s_f(false),
_update_a_f(false),
{
g_warning("Creating new EditWidget");
_desktop = 0;
initActions();
initAccelMap();
initLayout();
g_warning("Done creating new EditWidget");
}
EditWidget::~EditWidget()
{
destroyEdit();
}
void
{
}
void
{
// fixme-charset: What charset should we pass to g_warning?
}
}
void
{
set_title("New document 1 - Inkscape");
// top level window into which all other portions of the UI get inserted
// attach box for horizontal toolbars
// attach sub-window for viewport and vertical toolbars
// viewport table with 3 rows by 3 columns
// Menus and Bars
initMenuBar();
initUriBar();
initToolsBar();
// Canvas Viewport
initTopRuler();
_viewport_table.attach(_svg_canvas.widget(), 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
// The statusbar comes last and appears at the bottom of _main_window_table
}
void
{
g_warning("onMenuItem called");
}
void
{
// g_warning("onActionFileNew called");
}
void
{
// g_warning("onActionFileOpen called");
}
void
{
g_warning("onActionFileQuit");
}
void
{
g_warning("onActionFilePrint");
}
void
{
g_warning("onToolbarItem called");
}
void
{
_tool_ctrl->remove();
}
void
{
_tool_ctrl->remove();
}
void
{
}
void
{
}
void
{
}
void
{
// manage (Inkscape::UI::Dialog::DocumentPreferences::create());
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
}
void
{
g_message("onUriChanged called");
}
// FIXME: strings are replaced by placeholders, NOT to be translated until the code is enabled
// See http://sourceforge.net/mailarchive/message.php?msg_id=11746016 for details
void
{
// This has no chance of working right now.
// Has to be converted to Gtk::Action::create_with_icon_name.
// File menu
_("PLACEHOLDER, do not translate")),
_("PLACEHOLDER, do not translate")),
/*
_act_grp->add(Gtk::Action::create("OpenRecent",
Stock::OPEN_RECENT));*/
_("PLACEHOLDER, do not translate")),
_("PLACEHOLDER, do not translate")),
_("PLACEHOLDER, do not translate")),
/*
_act_grp->add(Gtk::Action::create("Import",
Stock::IMPORT, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onActionFileOpen));
_act_grp->add(Gtk::Action::create("Export",
Stock::EXPORT, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onDialogExport));*/
_("PLACEHOLDER, do not translate")),
/*
_act_grp->add(Gtk::Action::create("VacuumDefs",
Stock::VACUUM_DEFS),
sigc::mem_fun(*this, &EditWidget::onActionFileOpen));*/
_("PLACEHOLDER, do not translate")),
_("PLACEHOLDER, do not translate")),
// EditWidget menu
_("PLACEHOLDER, do not translate")));
_("PLACEHOLDER, do not translate")));
/*
_act_grp->add(Gtk::Action::create("UndoHistory",
Stock::UNDO_HISTORY, Glib::ustring(),
_("PLACEHOLDER, do not translate")));*/
_("PLACEHOLDER, do not translate")));
_("PLACEHOLDER, do not translate")));
_("PLACEHOLDER, do not translate")));
/*
_act_grp->add(Gtk::Action::create("PasteInPlace",
Stock::PASTE_IN_PLACE));
_act_grp->add(Gtk::Action::create("PasteStyle",
Stock::PASTE_STYLE));*/
/*
_act_grp->add(Gtk::Action::create("Duplicate",
Stock::DUPLICATE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Clone",
Stock::CLONE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("CloneUnlink",
Stock::CLONE_UNLINK, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("CloneSelectOrig",
Stock::CLONE_SELECT_ORIG));
_act_grp->add(Gtk::Action::create("MakeBitmap",
Stock::MAKE_BITMAP));
_act_grp->add(Gtk::Action::create("Tile",
Stock::TILE));
_act_grp->add(Gtk::Action::create("Untile",
Stock::UNTILE));
_act_grp->add(Gtk::Action::create("Delete",
Gtk::Stock::DELETE));
_act_grp->add(Gtk::Action::create("SelectAll",
Stock::SELECT_ALL));
_act_grp->add(Gtk::Action::create("SelectAllInAllLayers",
Stock::SELECT_ALL_IN_ALL_LAYERS));
_act_grp->add(Gtk::Action::create("SelectInvert",
Stock::SELECT_INVERT));
_act_grp->add(Gtk::Action::create("SelectNone",
Stock::SELECT_NONE));
_act_grp->add(Gtk::Action::create("XmlEditor",
Stock::XML_EDITOR, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onDialogXmlEditor));
// View menu
_act_grp->add(Gtk::Action::create("Zoom",
Stock::ZOOM));
_act_grp->add(Gtk::Action::create("ZoomIn",
Stock::ZOOM_IN, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomOut",
Stock::ZOOM_OUT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Zoom100",
Stock::ZOOM_100, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Zoom50",
Stock::ZOOM_50, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Zoom200",
Stock::ZOOM_200, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomSelection",
Stock::ZOOM_SELECTION, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomDrawing",
Stock::ZOOM_DRAWING, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomPage",
Stock::ZOOM_PAGE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomWidth",
Stock::ZOOM_WIDTH, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomPrev",
Stock::ZOOM_PREV, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ZoomNext",
Stock::ZOOM_NEXT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("ShowHide",
Stock::SHOW_HIDE));
_act_grp->add(Gtk::ToggleAction::create("ShowHideCommandsBar",
Stock::SHOW_HIDE_COMMANDS_BAR));
_act_grp->add(Gtk::ToggleAction::create("ShowHideToolControlsBar",
Stock::SHOW_HIDE_TOOL_CONTROLS_BAR));
_act_grp->add(Gtk::ToggleAction::create("ShowHideToolsBar",
Stock::SHOW_HIDE_TOOLS_BAR));
_act_grp->add(Gtk::ToggleAction::create("ShowHideRulers",
Stock::SHOW_HIDE_RULERS));
_act_grp->add(Gtk::ToggleAction::create("ShowHideScrollbars",
Stock::SHOW_HIDE_SCROLLBARS));
_act_grp->add(Gtk::ToggleAction::create("ShowHideStatusbar",
Stock::SHOW_HIDE_STATUSBAR));
_act_grp->add(Gtk::Action::create("ShowHideDialogs",
Stock::SHOW_HIDE_DIALOGS));
_act_grp->add(Gtk::Action::create("Grid",
Stock::GRID));
_act_grp->add(Gtk::Action::create("Guides",
Stock::GUIDES));
_act_grp->add(Gtk::Action::create("Fullscreen",
Stock::FULLSCREEN));
_act_grp->add(Gtk::Action::create("Messages",
Stock::MESSAGES),
sigc::mem_fun(*this, &EditWidget::onDialogMessages));
_act_grp->add(Gtk::Action::create("Scripts",
Stock::SCRIPTS));
_act_grp->add(Gtk::Action::create("WindowPrev",
Stock::WINDOW_PREV));
_act_grp->add(Gtk::Action::create("WindowNext",
Stock::WINDOW_NEXT));
_act_grp->add(Gtk::Action::create("WindowDuplicate",
Stock::WINDOW_DUPLICATE));
// Layer menu
_act_grp->add(Gtk::Action::create("LayerNew",
Stock::LAYER_NEW));
_act_grp->add(Gtk::Action::create("LayerRename",
Stock::LAYER_RENAME));
_act_grp->add(Gtk::Action::create("LayerDuplicate",
Stock::LAYER_DUPLICATE));
_act_grp->add(Gtk::Action::create("LayerAnchor",
Stock::LAYER_ANCHOR));
_act_grp->add(Gtk::Action::create("LayerMergeDown",
Stock::LAYER_MERGE_DOWN));
_act_grp->add(Gtk::Action::create("LayerDelete",
Stock::LAYER_DELETE));
_act_grp->add(Gtk::Action::create("LayerSelectNext",
Stock::LAYER_SELECT_NEXT));
_act_grp->add(Gtk::Action::create("LayerSelectPrev",
Stock::LAYER_SELECT_PREV));
_act_grp->add(Gtk::Action::create("LayerSelectTop",
Stock::LAYER_SELECT_TOP));
_act_grp->add(Gtk::Action::create("LayerSelectBottom",
Stock::LAYER_SELECT_BOTTOM));
_act_grp->add(Gtk::Action::create("LayerRaise",
Stock::LAYER_RAISE));
_act_grp->add(Gtk::Action::create("LayerLower",
Stock::LAYER_LOWER));
_act_grp->add(Gtk::Action::create("LayerToTop",
Stock::LAYER_TO_TOP));
_act_grp->add(Gtk::Action::create("LayerToBottom",
Stock::LAYER_TO_BOTTOM));
// Object menu
_act_grp->add(Gtk::Action::create("FillAndStroke",
Stock::FILL_STROKE, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onDialogFillAndStroke));
_act_grp->add(Gtk::Action::create("ObjectProperties",
Stock::OBJECT_PROPERTIES),
sigc::mem_fun(*this, &EditWidget::onDialogObjectProperties));
_act_grp->add(Gtk::Action::create("FilterEffects",
Stock::FILTER_EFFECTS));
_act_grp->add(Gtk::Action::create("Group",
Stock::GROUP, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Ungroup",
Stock::UNGROUP, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Raise",
Stock::RAISE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Lower",
Stock::LOWER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("RaiseToTop",
Stock::RAISE_TO_TOP, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("LowerToBottom",
Stock::LOWER_TO_BOTTOM, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("MoveToNewLayer",
Stock::MOVE_TO_NEW_LAYER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("MoveToNextLayer",
Stock::MOVE_TO_NEXT_LAYER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("MoveToPrevLayer",
Stock::MOVE_TO_PREV_LAYER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("MoveToTopLayer",
Stock::MOVE_TO_TOP_LAYER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("MoveToBottomLayer",
Stock::MOVE_TO_BOTTOM_LAYER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Rotate90CW",
Stock::ROTATE_90_CW, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Rotate90CCW",
Stock::ROTATE_90_CCW, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("FlipHoriz",
Stock::FLIP_HORIZ, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("FlipVert",
Stock::FLIP_VERT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Transformation",
Stock::TRANSFORMATION, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onDialogTransformation));
_act_grp->add(Gtk::Action::create("AlignAndDistribute",
Stock::ALIGN_DISTRIBUTE, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onDialogAlignAndDistribute));
// Path menu
_act_grp->add(Gtk::Action::create("ObjectToPath",
Stock::OBJECT_TO_PATH, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("StrokeToPath",
Stock::STROKE_TO_PATH, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("Trace",
Stock::TRACE),
sigc::mem_fun(*this, &EditWidget::onDialogTrace));
_act_grp->add(Gtk::Action::create("Union",
Stock::UNION));
_act_grp->add(Gtk::Action::create("Difference",
Stock::DIFFERENCE));
_act_grp->add(Gtk::Action::create("Intersection",
Stock::INTERSECTION));
_act_grp->add(Gtk::Action::create("Exclusion",
Stock::EXCLUSION));
_act_grp->add(Gtk::Action::create("Division",
Stock::DIVISION));
_act_grp->add(Gtk::Action::create("CutPath",
Stock::CUT_PATH));
_act_grp->add(Gtk::Action::create("Combine",
Stock::COMBINE));
_act_grp->add(Gtk::Action::create("BreakApart",
Stock::BREAK_APART));
_act_grp->add(Gtk::Action::create("Inset",
Stock::INSET));
_act_grp->add(Gtk::Action::create("Outset",
Stock::OUTSET));
_act_grp->add(Gtk::Action::create("OffsetDynamic",
Stock::OFFSET_DYNAMIC));
_act_grp->add(Gtk::Action::create("OffsetLinked",
Stock::OFFSET_LINKED));
_act_grp->add(Gtk::Action::create("Simplify",
Stock::SIMPLIFY));
_act_grp->add(Gtk::Action::create("Reverse",
Stock::REVERSE));*/
_("PLACEHOLDER, do not translate")));
// Text menu
_("PLACEHOLDER, do not translate")),
/*
_act_grp->add(Gtk::Action::create("PutOnPath",
Stock::PUT_ON_PATH));
_act_grp->add(Gtk::Action::create("RemoveFromPath",
Stock::REMOVE_FROM_PATH));
_act_grp->add(Gtk::Action::create("RemoveManualKerns",
Stock::REMOVE_MANUAL_KERNS));*/
// Whiteboard menu
#ifdef WITH_INKBOARD
#endif
// About menu
/*
_act_grp->add(Gtk::Action::create("KeysAndMouse",
Stock::KEYS_MOUSE));
_act_grp->add(Gtk::Action::create("Tutorials",
Stock::TUTORIALS));
_act_grp->add(Gtk::Action::create("About",
Stock::ABOUT),
sigc::mem_fun(*this, &EditWidget::onDialogAbout));*/
}
void
{
// Tools bar
// This has zero chance to work, and has to be converted to create_with_icon_name
/*
_act_grp->add(Gtk::RadioAction::create(tools, "ToolSelect",
Stock::TOOL_SELECT, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onSelectTool));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolNode",
Stock::TOOL_NODE, Glib::ustring(),
_("PLACEHOLDER, do not translate")),
sigc::mem_fun(*this, &EditWidget::onNodeTool));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolZoom",
Stock::TOOL_ZOOM, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolRect",
Stock::TOOL_RECT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolArc",
Stock::TOOL_ARC, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolStar",
Stock::TOOL_STAR, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolSpiral",
Stock::TOOL_SPIRAL, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolFreehand",
Stock::TOOL_FREEHAND, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolPen",
Stock::TOOL_PEN, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolDynaDraw",
Stock::TOOL_DYNADRAW, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolText",
Stock::TOOL_TEXT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::RadioAction::create(tools, "ToolDropper",
Stock::TOOL_DROPPER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
// Select Controls bar
_act_grp->add(Gtk::ToggleAction::create("TransformStroke",
Stock::TRANSFORM_STROKE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::ToggleAction::create("TransformCorners",
Stock::TRANSFORM_CORNERS, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::ToggleAction::create("TransformGradient",
Stock::TRANSFORM_GRADIENT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::ToggleAction::create("TransformPattern",
Stock::TRANSFORM_PATTERN, Glib::ustring(),
_("PLACEHOLDER, do not translate")));*/
// Node Controls bar
_("PLACEHOLDER, do not translate")));
_("PLACEHOLDER, do not translate")));
/*
_act_grp->add(Gtk::Action::create("NodeJoin",
Stock::NODE_JOIN, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeJoinSegment",
Stock::NODE_JOIN_SEGMENT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeDeleteSegment",
Stock::NODE_DELETE_SEGMENT, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeBreak",
Stock::NODE_BREAK, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeCorner",
Stock::NODE_CORNER, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeSmooth",
Stock::NODE_SMOOTH, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeSymmetric",
Stock::NODE_SYMMETRIC, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeLine",
Stock::NODE_LINE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));
_act_grp->add(Gtk::Action::create("NodeCurve",
Stock::NODE_CURVE, Glib::ustring(),
_("PLACEHOLDER, do not translate")));*/
}
void
{
// One problem is that the keys 1-6 are zoom accelerators which get
// caught as accelerator _before_ any Entry input handler receives them,
// for example the zoom status. At the moment, the best way seems to
// disable them as accelerators when the Entry gets focus, and enable
// them when focus goes elsewhere. The code for this belongs here,
// and not in zoom-status.cpp .
_zoom_status.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditWidget::onEntryFocusOut));
}
bool
{
return false;
}
bool
{
return false;
}
void
{
}
void
{
Gtk::TOOLBAR_ICONS);
}
void
{
// TODO: Do UIManager controlled widgets need to be deleted?
}
void
{
/// \todo Create an Inkscape::UI::Widget::UriBar class (?)
}
void
{
}
void
{
}
void
{
}
void
{
_bottom_scrollbar.signal_value_changed().connect (sigc::mem_fun (*this, &EditWidget::onAdjValueChanged));
_bottom_scrollbar.property_adjustment() = new Gtk::Adjustment (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0);
}
void
{
_right_scrollbar.signal_value_changed().connect (sigc::mem_fun (*this, &EditWidget::onAdjValueChanged));
_right_scrollbar.property_adjustment() = new Gtk::Adjustment (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0);
}
void
{
/// \todo icon not implemented
}
void
{
_select_status.set_markup (_("<b>Welcome to Inkscape!</b> Use shape or drawing tools to create objects; use selector (arrow) to move or transform them."));
// include this again with Gtk+-2.6
#endif
}
//========================================
//----------implements EditWidgetInterface
{
return this;
}
void
{
}
void
EditWidget::layout()
{
}
void
{
}
void
{
get_position (x, y);
get_size (w, h);
}
void
{
resize (w, h);
}
void
{
}
/// \param p is already gobj()!
void
EditWidget::setTransient (void* p, int i)
{
if (i==2)
}
{
int x, y;
get_pointer (x, y);
}
void
{
iconify();
}
void
{
maximize();
}
void
{
fullscreen();
}
/**
* Shuts down the desktop object for the view being closed. It checks
* to see if the document has been edited, and if so prompts the user
* to save, discard, or cancel. Returns TRUE if the shutdown operation
* is cancelled or if the save is cancelled or fails, FALSE otherwise.
*/
bool
{
return false;
if (doc->isModifiedSinceSave()) {
/// \todo FIXME !!! obviously this will have problems if the document
/// name contains markup characters
_("<span weight=\"bold\" size=\"larger\">Save changes to document \"%s\" before closing?</span>\n\n"
"If you close without saving, your changes will be discarded."),
true,
true);
close_button.show();
switch (response)
{
case Gtk::RESPONSE_YES:
if (sp_file_save_document(*this, doc)) {
} else { // save dialog cancelled or save failed
return TRUE;
}
break;
case Gtk::RESPONSE_NO:
break;
default: // cancel pressed, or dialog was closed
return TRUE;
break;
}
}
/* Code to check data loss */
bool allow_data_loss = FALSE;
while (sp_document_repr_root(doc)->attribute("inkscape:dataloss") != NULL && allow_data_loss == FALSE)
{
/// \todo FIXME !!! obviously this will have problems if the document
/// name contains markup characters
_("<span weight=\"bold\" size=\"larger\">The file \"%s\" was saved with a format (%s) that may cause data loss!</span>\n\n"
"Do you want to save this file as an Inkscape SVG?"),
Inkscape::Extension::db.get(sp_document_repr_root(doc)->attribute("inkscape:output_extension"))->get_name());
true,
true);
close_button.show();
save_button.show();
switch (response)
{
case Gtk::RESPONSE_YES:
if (sp_file_save_document(*this, doc)) {
} else { // save dialog cancelled or save failed
return TRUE;
}
break;
case Gtk::RESPONSE_NO:
break;
default: // cancel pressed, or dialog was closed
return TRUE;
break;
}
}
return false;
}
void
{
delete this;
}
void
{
}
void
{
while (gtk_events_pending())
}
void
{
if (_interaction_disabled_counter == 0) {
this->set_sensitive(true);
}
}
void
{
if (_interaction_disabled_counter == 0) {
this->set_sensitive(false);
}
}
void
{
/// \todo active_desktop_indicator not implemented
}
void
{
/// \todo active_desktop_indicator not implemented
}
void
{
// p -= _namedview->gridorigin;
/// \todo Why was the origin corrected for the grid origin? (johan)
}
void
{
//Geom::Point gridorigin = _namedview->gridorigin;
/// \todo Why was the origin corrected for the grid origin? (johan)
/// \todo is that correct?
}
void
{
// do not call this function before canvas has its size allocated
if (!is_realized() || _update_s_f) {
return;
}
_update_s_f = true;
/* The desktop region we always show unconditionally */
/* Canvas region we always show unconditionally */
Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64),
/* Viewbox is always included into scrollable region */
_update_s_f = false;
}
void
{
if (_top_ruler.is_visible())
{
prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", false);
} else {
prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", true);
}
}
void
{
if (_bottom_scrollbar.is_visible())
{
prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", false);
} else {
prefs->setBool(_desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", true);
}
}
void EditWidget::toggleColorProfAdjust()
{
// TODO implement
}
void
{
}
void
{
}
void
{
/// \todo not implemented
}
void
{
/// \todo not implemented
}
void
{
/// \todo not implemented
}
bool
{
/// \todo not implemented
return true;
}
void
{
}
void
{
}
bool
{
msg,
true,
true);
return r == Gtk::RESPONSE_YES;
}
EditWidget::getDock ()
{
return &_dock;
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
this->_top_ruler.update_metric();
this->_left_ruler.update_metric();
this->updateRulers();
}
}
void
{
_desktop->registerEditWidget (this);
/// \todo convert to sigc++ when SPObject hierarchy gets converted
/* Listen on namedview modification */
_namedview_modified_connection = _desktop->namedview->connectModified(sigc::mem_fun(*this, &EditWidget::_namedview_modified));
updateRulers();
}
void
{
if (_desktop) {
_desktop = 0;
}
}
//----------end of EditWidgetInterface implementation
//----------start of other callbacks
bool
{
// this is the original code from helper/window.cpp
unsigned int shortcut;
SP_SHORTCUT_SHIFT_MASK : 0 ) |
SP_SHORTCUT_CONTROL_MASK : 0 ) |
SP_SHORTCUT_ALT_MASK : 0 );
return sp_shortcut_invoke (shortcut,
}
bool
{
return shutdown();
}
bool
{
return false;
}
void
{
if (!is_realized()) return;
return;
}
if (_sticky_zoom.get_active()) {
/* Calculate zoom per pixel */
/* Find new visible area */
/* Calculate adjusted zoom */
}
}
void
{
return;
}
_desktop->set_display_area(d.min()[Geom::X], d.min()[Geom::Y], d.max()[Geom::X], d.max()[Geom::Y], 10);
}
void
{
if (_update_a_f) return;
_update_a_f = true;
false);
updateRulers();
_update_a_f = false;
}
} // namespace View
} // 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:encoding=utf-8:textwidth=99 :