예제 #1
0
DrawPathTool::DrawPathTool(MapEditorController* editor, QAction* tool_button, bool is_helper_tool, bool allow_closing_paths)
: DrawLineAndAreaTool(editor, DrawPath, tool_button, is_helper_tool)
, allow_closing_paths(allow_closing_paths)
, finished_path_is_selected(false)
, cur_map_widget(mapWidget())
, angle_helper(new ConstrainAngleToolHelper())
, snap_helper(new SnappingToolHelper(this))
, follow_helper(new FollowPathToolHelper())
, key_button_bar(NULL)
{
	angle_helper->setActive(false);
	connect(angle_helper.data(), SIGNAL(displayChanged()), this, SLOT(updateDirtyRect()));
	
	updateSnapHelper();
	connect(snap_helper.data(), SIGNAL(displayChanged()), this, SLOT(updateDirtyRect()));
	
	dragging = false;
	appending = false;
	following = false;
	picking_angle = false;
	picked_angle = false;
	draw_dash_points = false;
	shift_pressed = false;
	ctrl_pressed = false;
	
	connect(map(), SIGNAL(objectSelectionChanged()), this, SLOT(objectSelectionChanged()));
}
예제 #2
0
void CutHoleTool::init()
{
	connect(map(), SIGNAL(objectSelectionChanged()), this, SLOT(objectSelectionChanged()));
	updateDirtyRect();
	updateStatusText();
	
	MapEditorTool::init();
}
예제 #3
0
void MapEditorToolBase::init()
{
	connect(map(), SIGNAL(objectSelectionChanged()), this, SLOT(objectSelectionChanged()));
	connect(map(), SIGNAL(selectedObjectEdited()), this, SLOT(updateDirtyRect()));
	initImpl();
	updateDirtyRect();
	updateStatusText();
	
	MapEditorTool::init();
}
예제 #4
0
void ScaleTool::init()
{
	// Set initial scaling center to the center of the bounding box of the selected objects
	if (map()->getNumSelectedObjects() > 0)
	{
		QRectF rect;
		map()->includeSelectionRect(rect);
		scaling_center = MapCoordF(rect.center());
		scaling_center_set = true;
	}
	
	connect(map(), SIGNAL(objectSelectionChanged()), this, SLOT(objectSelectionChanged()));
	connect(map(), SIGNAL(selectedObjectEdited()), this, SLOT(updateDirtyRect()));
	updateDirtyRect();
	updateStatusText();
	
	MapEditorTool::init();
}
예제 #5
0
RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
	RK_TRACE (PLUGIN);

	XMLHelper *xml = parent_component->xmlHelper ();

// TODO: read filter settings
	addChild ("selected", selected = new RKComponentPropertyRObjects (this, false));
	selected->setInternal (true);
	addChild ("root", root = new RKComponentPropertyRObjects (this, false));
	connect (root, SIGNAL (valueChanged(RKComponentPropertyBase*)), this, SLOT (rootChanged()));
	root->setInternal (true);

	QVBoxLayout *vbox = new QVBoxLayout (this);
	vbox->setContentsMargins (0, 0, 0, 0);

	QHBoxLayout *hbox = new QHBoxLayout ();
	hbox->setContentsMargins (0, 0, 0, 0);
	vbox->addLayout (hbox);
	QLabel *label = new QLabel (xml->i18nStringAttribute (element, "label", i18n ("Select Variable(s)"), DL_INFO), this);
	hbox->addWidget (label);
	QToolButton *advanced_button = new QToolButton (this);
	advanced_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigureGeneric));
	advanced_button->setPopupMode (QToolButton::InstantPopup);
	advanced_button->setAutoRaise (true);
	hbox->addWidget (advanced_button);

	// TODO: Or should these actions be moved to RKObjectListView, non-tool-window-mode?
	show_all_envs_action = new QAction (i18n ("Show all environments"), this);
	show_all_envs_action->setCheckable (true);
	show_all_envs_action->setToolTip (i18n ("Show objects in all environments on the <i>search()</i> path, instead of just those in <i>.GlobalEnv</i>. Check this, if you want to select objects from a loaded package."));
	connect (show_all_envs_action, SIGNAL (toggled(bool)), this, SLOT (rootChanged()));

	filter_widget = 0;
	filter_widget_placeholder = new QVBoxLayout (this);
	filter_widget_placeholder->setContentsMargins (0, 0, 0, 0);
	vbox->addLayout (filter_widget_placeholder);
	show_filter_action = new QAction (i18n ("Show filter options"), this);
	show_filter_action->setCheckable (true);
	show_filter_action->setShortcut (QKeySequence ("Ctrl+F"));
	show_filter_action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionSearch));
	connect (show_filter_action, SIGNAL (toggled(bool)), this, SLOT(showFilterWidget()));

	list_view = new RKObjectListView (false, this);
	list_view->setSelectionMode (QAbstractItemView::ExtendedSelection);
	list_view->initialize ();
	vbox->addWidget (list_view);
	connect (list_view, SIGNAL (selectionChanged()), this, SLOT (objectSelectionChanged()));

	QAction* sep = list_view->contextMenu ()->insertSeparator (list_view->contextMenu ()->actions ().value (0));
	list_view->contextMenu ()->insertAction (sep, show_filter_action);
	list_view->contextMenu ()->insertAction (sep, show_all_envs_action);
	advanced_button->setMenu (list_view->contextMenu ());

	rootChanged ();
}
예제 #6
0
MeasureWidget::MeasureWidget(Map* map, QWidget* parent)
: QTextBrowser(parent)
, map(map)
{
	QScroller::grabGesture(viewport(), QScroller::TouchGesture);
	
	connect(map, &Map::objectSelectionChanged, this, &MeasureWidget::objectSelectionChanged);
	connect(map, &Map::selectedObjectEdited, this, &MeasureWidget::objectSelectionChanged);
	connect(map, &Map::symbolChanged, this, &MeasureWidget::objectSelectionChanged);
	
	objectSelectionChanged();
}
예제 #7
0
void EditPointTool::initImpl()
{
	objectSelectionChanged();
	
	if (editor->isInMobileMode())
	{
		// Create key replacement bar
		key_button_bar = new KeyButtonBar(this, editor->getMainWidget());
		key_button_bar->addModifierKey(Qt::Key_Shift, Qt::ShiftModifier, tr("Snap", "Snap to existing objects"));
		key_button_bar->addModifierKey(Qt::Key_Control, Qt::ControlModifier, tr("Point / Angle", "Modify points or use constrained angles"));
		key_button_bar->addModifierKey(Qt::Key_Space, 0, tr("Toggle dash", "Toggle dash points"));
		editor->showPopupWidget(key_button_bar, QString{});
	}
}
RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
	RK_TRACE (PLUGIN);

// TODO: read filter settings
	addChild ("available", available = new RKComponentPropertyRObjects (this, false));
	addChild ("selected", selected = new RKComponentPropertyRObjects (this, false));

	RKGlobals::rObjectList ()->updateFromR ();
	QVBoxLayout  *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
	
	QLabel *label = new QLabel (element.attribute ("label", "Select Variable(s)"), this);
	vbox->addWidget (label);

	list_view = new RKObjectListView (this);
	list_view->setSelectionMode (QListView::Extended);
	connect (list_view, SIGNAL (listChanged ()), this, SLOT (objectListChanged ()));
	connect (list_view, SIGNAL (selectionChanged ()), this, SLOT (objectSelectionChanged ()));

	vbox->addWidget (list_view);
	list_view->initialize (true);
}