// Handle drops.
void QsciScintillaBase::dropEvent(QDropEvent *e)
{
    bool moving;
    int len;
    const char *s;
    bool rectangular;

    acceptAction(e);

    if (!e->isAccepted())
        return;

    moving = (e->dropAction() == Qt::MoveAction);

    QByteArray text = fromMimeData(e->mimeData(), rectangular);
    len = text.length();
    s = text.data();

    std::string dest = QSCI_SCI_NAMESPACE(Document)::TransformLineEnds(s, len,
                sci->pdoc->eolMode);

    sci->DropAt(sci->posDrop, dest.c_str(), dest.length(), moving,
            rectangular);

    sci->Redraw();
}
示例#2
0
void TreeWalker::acceptWidget(DomWidget *widget)
{
    for (int i=0; i<widget->elementAction().size(); ++i)
        acceptAction(widget->elementAction().at(i));

    for (int i=0; i<widget->elementActionGroup().size(); ++i)
        acceptActionGroup(widget->elementActionGroup().at(i));

    for (int i=0; i<widget->elementAddAction().size(); ++i)
        acceptActionRef(widget->elementAddAction().at(i));

    for (int i=0; i<widget->elementProperty().size(); ++i)
        acceptProperty(widget->elementProperty().at(i));



    // recurse down
    DomWidgets childWidgets;
    for (int i=0; i<widget->elementWidget().size(); ++i) {
        DomWidget *child = widget->elementWidget().at(i);
        childWidgets += child;
        acceptWidget(child);
    }

    if (!widget->elementLayout().isEmpty())
        acceptLayout(widget->elementLayout().at(0));

    const DomScripts scripts(widget->elementScript());
    acceptWidgetScripts(scripts, widget, childWidgets);
}
// Handle drops.
void QsciScintillaBase::dropEvent(QDropEvent *e)
{
    bool moving;
    const char *s;

    acceptAction(e);

    if (!e->isAccepted())
        return;

    moving = (e->dropAction() == Qt::MoveAction);

    QString qs = fromMimeData(e->mimeData());
    QByteArray ba;

    if (sci->IsUnicodeMode())
        ba = qs.toUtf8();
    else
        ba = qs.toLatin1();

    s = ba.data();

    sci->DropAt(sci->posDrop, s, moving, false);
    sci->Redraw();
}
// Handle drag moves.
void QsciScintillaBase::dragMoveEvent(QDragMoveEvent *e)
{
    sci->SetDragPosition(sci->PositionFromLocation(Point(e->pos().x(),
                    e->pos().y())));

    acceptAction(e);
}
示例#5
0
// Handle drag moves.
void QsciScintillaBase::dragMoveEvent(QDragMoveEvent *e)
{
    sci->SetDragPosition(
            sci->SPositionFromLocation(Point(e->pos().x(), e->pos().y()),
                    false, false, sci->UserVirtualSpace()));

    acceptAction(e);
}
示例#6
0
void TreeWalker::acceptActionGroup(DomActionGroup *actionGroup)
{
    for (int i=0; i<actionGroup->elementAction().size(); ++i)
        acceptAction(actionGroup->elementAction().at(i));

    for (int i=0; i<actionGroup->elementActionGroup().size(); ++i)
        acceptActionGroup(actionGroup->elementActionGroup().at(i));
}
示例#7
0
	void CommandCenter::scriptActionEnd(const std::string& sourceActionName, bool success)
	{
		bool result = tryUnLockCommandCenter(sourceActionName);
		if (result && _actionsCache.size() > 0)
		{
			_actionsCache.erase(_actionsCache.begin());
			if (_actionsCache.size() > 0)
				acceptAction(_actionsCache.at(0));
		}
	}
示例#8
0
	bool CommandCenter::acceptAction(const std::vector<ScriptAction>& actions)
	{
		if (!_lockedActionName.empty())
			return false;
		_actionsCache = actions;
		if (_actionsCache.size() > 0)
		{
			acceptAction(_actionsCache.at(0));
			return true;
		}
		else
			return false;
	}
示例#9
0
void handleButtonPress(AppInfo *app, XEvent *event)
{
   DialogInfo *d = app->dialog;

   cancelInputTimeout(app);
   if (event->xbutton.button != Button1) {
      return;
   }
   if (ButtonPress == event->type) {
      if (eventIsInsideButton(app, event, d->okButton)) {
	 d->pressedButton = OK_BUTTON;
	 d->okButton.pressed = True;
	 paintButton(app, d->dialogWindow, d->okButton);
      } else if (eventIsInsideButton(app, event, d->cancelButton)) {
	 d->pressedButton = CANCEL_BUTTON;
	 d->cancelButton.pressed = True;
	 paintButton(app, d->dialogWindow, d->cancelButton);
      } else {
	 d->pressedButton = NO_BUTTON;
      }
   } else if (ButtonRelease == event->type) {
      if (OK_BUTTON == d->pressedButton) {
	 if (eventIsInsideButton(app, event, d->okButton)) {
	    acceptAction(app);
	 } else {
	    if (d->okButton.pressed) {
	       d->okButton.pressed = False;
	       paintButton(app, d->dialogWindow, d->okButton);
	    }
	 }
      } else if (CANCEL_BUTTON == d->pressedButton) {
	 if (eventIsInsideButton(app, event, d->cancelButton)) {
	    cancelAction(app);
	 } else {
	    if (d->cancelButton.pressed) {
	       d->cancelButton.pressed = False;
	       paintButton(app, d->dialogWindow, d->cancelButton);
	    }
	 }
      }
      d->pressedButton = NO_BUTTON;
   }
}
示例#10
0
// Handle drops.
void QsciScintillaBase::dropEvent(QDropEvent *e)
{
    bool moving;
    const char *s;
    bool rectangular;

    acceptAction(e);

    if (!e->isAccepted())
        return;

    moving = (e->dropAction() == Qt::MoveAction);

    QByteArray ba = fromMimeData(e->mimeData(), rectangular);

    s = ba.data();

    sci->DropAt(sci->posDrop, s, moving, rectangular);
    sci->Redraw();
}
示例#11
0
void handleKeyPress(AppInfo *app, XEvent *event)
{
   char s[2];
   int n;
   
   if (event->xkey.send_event) {
      /* Pay no attention to synthetic key events. */
      return;
   }
   cancelInputTimeout(app);
   n = XLookupString(&(event->xkey), s, 1, NULL, NULL);
   
   if (1 != n) {
      return;
   }
   s[1] = '\0';
   switch (s[0]) {
    case '\010':
    case '\177':
      backspacePassphrase(app);
      break;
    case '\025':
    case '\030':
      erasePassphrase(app);
      break;
    case '\012':
    case '\015':
      acceptAction(app);
      break;
    case '\033':
      cancelAction(app);
      break;
    default:
      addToPassphrase(app, s[0]);
      break;
   }
}
static void menuActionSlot(GtkWidget*, gpointer data) {
	if (acceptAction()) {
		((ZLApplication::Action*)data)->checkAndRun();
	}
}
static void mouseMoved(GtkWidget*, GdkEventMotion *event, gpointer data) {
	if (acceptAction()) {
		((ZLGtkViewWidget*)data)->onMouseMoved(event);
	}
}
static void mousePressed(GtkWidget *area, GdkEventButton *event, gpointer data) {
	gtk_window_set_focus(GTK_WINDOW(gtk_widget_get_toplevel(area)), area);
	if (acceptAction()) {
		((ZLGtkViewWidget*)data)->onMousePressed(event);
	}
}
static bool handleKeyRelease(GtkWidget*, GdkEventKey *key, gpointer data) {
	if (acceptAction()) {
		return ((ZLGtkApplicationWindow*)data)->handleKeyEventSlot(key, true);
	}
	return true;
}
static void repaint(GtkWidget*, GdkEvent*, gpointer data) {
	if (acceptAction()) {
		((ZLGtkViewWidget*)data)->doPaint();
	}
}
static bool applicationQuit(GtkWidget*, GdkEvent*, gpointer data) {
	if (acceptAction()) {
		((ZLGtkApplicationWindow*)data)->application().closeView();
	}
	return true;
}